Version Description
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Gutenberg Products Block |
Version | 3.2 |
Comparing to | |
See all releases |
Code changes from version 3.1.0 to 3.2
- assets/css/abstracts/_colors.scss +10 -0
- assets/img/cart-preview.svg +0 -20
- assets/img/checkout-preview.svg +0 -20
- assets/js/atomic/blocks/product-elements/add-to-cart/block.js +27 -21
- assets/js/atomic/blocks/product-elements/add-to-cart/edit.js +27 -10
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/simple.js +4 -4
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/index.js +8 -5
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/attribute-picker.js +53 -67
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/attribute-select-control.js +61 -8
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/index.js +4 -10
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/style.scss +15 -0
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/test/index.js +395 -0
- assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/utils.js +140 -39
- assets/js/atomic/blocks/product-elements/add-to-cart/shared/add-to-cart-button.js +63 -40
- assets/js/atomic/blocks/product-elements/add-to-cart/style.scss +7 -1
- assets/js/atomic/blocks/product-elements/button/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/category-list/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/image/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/price/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/rating/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/sale-badge/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/sku/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/stock-indicator/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/summary/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/tag-list/edit.js +1 -1
- assets/js/atomic/blocks/product-elements/title/edit.js +1 -1
- assets/js/atomic/blocks/product/price/attributes.js +0 -40
- assets/js/atomic/blocks/product/price/index.js +0 -32
- assets/js/base/components/cart-checkout/address-form/default-address-fields.js +8 -0
- assets/js/base/components/cart-checkout/address-form/index.js +1 -0
- assets/js/base/components/cart-checkout/form-step/index.js +23 -8
- assets/js/base/components/cart-checkout/form-step/style.scss +28 -26
- assets/js/base/components/cart-checkout/form-step/test/__snapshots__/index.js.snap +262 -0
- assets/js/base/components/cart-checkout/form-step/test/index.js +100 -0
- assets/js/base/components/cart-checkout/product-price/index.js +1 -1
- assets/js/base/components/cart-checkout/product-sale-badge/index.js +1 -1
- assets/js/base/components/cart-checkout/shipping-calculator/style.scss +1 -0
- assets/js/base/components/checkbox-control/index.js +9 -0
- assets/js/base/components/checkbox-control/style.scss +40 -18
- assets/js/base/components/country-input/country-input.js +1 -0
- assets/js/base/components/country-input/style.scss +3 -0
- assets/js/base/components/panel/style.scss +3 -1
- assets/js/base/components/payment-methods/saved-payment-method-options.js +11 -9
- assets/js/base/components/payment-methods/style.scss +4 -0
- assets/js/base/components/quantity-selector/style.scss +31 -0
- assets/js/base/components/radio-control/_mixin.scss +9 -1
- assets/js/base/components/radio-control/editor.scss +0 -6
- assets/js/base/components/radio-control/index.js +0 -1
- assets/js/base/components/select/style.scss +33 -3
- assets/js/base/components/state-input/state-input.js +6 -1
- assets/js/base/components/state-input/style.scss +3 -0
- assets/js/base/components/store-notices-container/style.scss +3 -5
- assets/js/base/components/tabs/style.scss +5 -0
- assets/js/base/components/text-input/index.js +3 -0
- assets/js/base/components/text-input/style.scss +18 -4
- assets/js/base/components/textarea/index.js +43 -0
- assets/js/base/components/textarea/style.scss +22 -0
- assets/js/base/context/add-to-cart-form-context.js +0 -156
- assets/js/base/context/add-to-cart-form/form-state/actions.js +58 -0
- assets/js/base/context/add-to-cart-form/form-state/constants.js +32 -0
- assets/js/base/context/add-to-cart-form/form-state/event-emit.js +52 -0
- assets/js/base/context/add-to-cart-form/form-state/index.js +319 -0
- assets/js/base/context/add-to-cart-form/form-state/reducer.js +151 -0
- assets/js/base/context/add-to-cart-form/form/index.js +38 -0
- assets/js/base/context/add-to-cart-form/form/submit/index.js +143 -0
- assets/js/base/context/add-to-cart-form/index.js +2 -0
- assets/js/base/context/cart-checkout/checkout-state/actions.js +5 -0
- assets/js/base/context/cart-checkout/checkout-state/constants.js +2 -0
- assets/js/base/context/cart-checkout/checkout-state/event-emit.js +1 -1
- assets/js/base/context/cart-checkout/checkout-state/index.js +6 -1
- assets/js/base/context/cart-checkout/checkout-state/reducer.js +11 -2
- assets/js/base/context/cart-checkout/checkout/processor/index.js +3 -1
- assets/js/base/context/cart-checkout/index.js +0 -1
- assets/js/base/context/cart-checkout/payment-methods/event-emit.js +1 -1
- assets/js/base/context/cart-checkout/payment-methods/payment-method-data-context.js +46 -5
- assets/js/base/context/cart-checkout/payment-methods/use-payment-method-registration.js +60 -8
- assets/js/base/context/cart-checkout/shipping/event-emit.js +1 -1
- assets/js/base/context/index.js +2 -1
- assets/js/base/context/{cart-checkout → shared}/event-emit/emitter-callback.js +0 -0
- assets/js/base/context/{cart-checkout → shared}/event-emit/emitters.js +2 -3
- assets/js/base/context/{cart-checkout → shared}/event-emit/index.js +0 -0
- assets/js/base/context/{cart-checkout → shared}/event-emit/reducer.js +0 -0
- assets/js/base/context/{cart-checkout → shared}/event-emit/test/emitters.js +0 -0
- assets/js/base/context/shared/index.js +2 -0
- assets/js/base/context/{cart-checkout → shared}/validation/index.js +0 -0
- assets/js/base/utils/index.js +1 -0
- assets/js/base/utils/legacy-events.js +18 -8
- assets/js/base/utils/product-data.js +31 -0
- assets/js/base/utils/render-frontend.js +154 -36
- assets/js/blocks/cart-checkout/cart/attributes.js +5 -0
- assets/js/blocks/cart-checkout/cart/block.js +16 -2
- assets/js/blocks/cart-checkout/cart/edit.js +28 -13
- assets/js/blocks/cart-checkout/cart/editor.scss +5 -0
- assets/js/blocks/cart-checkout/cart/full-cart/index.js +6 -1
- assets/js/blocks/cart-checkout/cart/full-cart/style.scss +9 -0
- assets/js/blocks/cart-checkout/checkout/attributes.js +13 -0
- assets/js/blocks/cart-checkout/checkout/block.js +31 -3
- assets/js/blocks/cart-checkout/checkout/checkout-order-notes/index.js +68 -0
- assets/js/blocks/cart-checkout/checkout/checkout-order-notes/style.scss +8 -0
- assets/js/blocks/cart-checkout/checkout/edit.js +54 -15
- assets/js/blocks/cart-checkout/checkout/editor.scss +5 -0
- assets/js/blocks/cart-checkout/checkout/style.scss +7 -9
- assets/js/blocks/product-search/edit.js +2 -2
- assets/js/blocks/products/utils.js +2 -2
- assets/js/blocks/reviews/all-reviews/edit.js +0 -1
- assets/js/blocks/reviews/editor-container-block.js +2 -2
- assets/js/blocks/reviews/reviews-by-category/edit.js +0 -1
- assets/js/blocks/reviews/reviews-by-product/edit.js +0 -1
- assets/js/blocks/reviews/save.js +3 -34
- assets/js/blocks/reviews/utils.js +45 -1
- assets/js/blocks/single-product/block.js +5 -1
- assets/js/blocks/single-product/frontend.js +1 -15
- assets/js/components/feedback-prompt/index.js +16 -2
- assets/js/hocs/index.js +0 -1
- assets/js/hocs/with-feedback-prompt/index.js +0 -35
- assets/js/payment-method-extensions/payment-methods/cheque/index.js +1 -1
- assets/js/payment-method-extensions/payment-methods/stripe/credit-card/index.js +0 -1
- assets/js/payment-method-extensions/payment-methods/stripe/index.js +10 -3
- assets/js/payment-method-extensions/payment-methods/stripe/stripe-utils/type-defs.js +21 -19
- assets/js/previews/cart-block.js +0 -16
- assets/js/previews/checkout-block.js +0 -16
- assets/js/previews/index.js +0 -2
- assets/js/settings/blocks/constants.js +9 -0
- assets/js/settings/shared/set-setting.js +19 -1
- assets/js/settings/shared/test/compare-with-wp-version.js +7 -0
- assets/js/settings/shared/test/set-setting.js +4 -1
- assets/js/type-defs/add-to-cart-form.js +43 -0
- assets/js/type-defs/checkout.js +2 -0
- assets/js/type-defs/contexts.js +25 -24
- build/active-filters-frontend.asset.php +1 -1
- build/active-filters-frontend.js +2 -2
- build/active-filters.asset.php +1 -1
- build/active-filters.js +1 -1
- build/all-products-frontend.asset.php +1 -1
- build/all-products-frontend.js +2 -2
- build/all-products.asset.php +1 -1
- build/all-products.js +1 -1
- build/all-reviews-legacy.asset.php +0 -1
- build/all-reviews-legacy.js +0 -1
- build/all-reviews.asset.php +1 -1
- build/all-reviews.js +1 -1
- build/atomic-block-components/add-to-cart-frontend.js +1 -1
- build/atomic-block-components/add-to-cart.js +1 -1
- build/atomic-block-components/add-to-cart~atomic-block-components/button.js +1 -1
- build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js +1 -1
- build/atomic-block-components/button-frontend.js +1 -1
- build/atomic-block-components/button.js +1 -1
- build/atomic-block-components/category-list-frontend.js +1 -1
- build/atomic-block-components/category-list.js +0 -1
assets/css/abstracts/_colors.scss
CHANGED
@@ -51,4 +51,14 @@ $gray-60: #50575e;
|
|
51 |
$gray-80: #2c3338;
|
52 |
|
53 |
$input-border-gray: #8d96a0;
|
|
|
|
|
|
|
54 |
$input-text-active: #2b2d2f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
$gray-80: #2c3338;
|
52 |
|
53 |
$input-border-gray: #8d96a0;
|
54 |
+
$input-border-dark: rgba(255, 255, 255, 0.4);
|
55 |
+
$input-disabled-dark: rgba(255, 255, 255, 0.3);
|
56 |
+
$controls-border-dark: rgba(255, 255, 255, 0.6);
|
57 |
$input-text-active: #2b2d2f;
|
58 |
+
$input-placeholder-dark: rgba(255, 255, 255, 0.6);
|
59 |
+
$input-text-dark: #fff;
|
60 |
+
$input-background-dark: rgba(0, 0, 0, 0.1);
|
61 |
+
$select-dropdown-dark: #1e1e1e;
|
62 |
+
$select-dropdown-light: #fff;
|
63 |
+
$select-item-dark: rgba(0, 0, 0, 0.4);
|
64 |
+
|
assets/img/cart-preview.svg
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 250">
|
2 |
-
<g fill="#E1E3E6" fill-rule="evenodd">
|
3 |
-
<g transform="translate(0 43)">
|
4 |
-
<path d="M0 0h33v33H0zM38 0h24v8H38zM120 0h28v8h-28z"/>
|
5 |
-
<rect width="28" height="14" x="87" rx="2"/>
|
6 |
-
<path d="M38 10h44v8H38zM0 38h148v1H0z"/>
|
7 |
-
</g>
|
8 |
-
<g transform="translate(0 87)">
|
9 |
-
<path d="M0 0h33v33H0zM38 0h24v8H38zM120 0h28v8h-28z"/>
|
10 |
-
<rect width="28" height="14" x="87" rx="2"/>
|
11 |
-
<path d="M38 10h44v8H38zM0 38h148v1H0z"/>
|
12 |
-
</g>
|
13 |
-
<g transform="translate(0 131)">
|
14 |
-
<path d="M0 0h33v33H0zM38 0h24v8H38zM120 0h28v8h-28z"/>
|
15 |
-
<rect width="28" height="14" x="87" rx="2"/>
|
16 |
-
<path d="M38 10h44v8H38zM0 38h148v1H0z"/>
|
17 |
-
</g>
|
18 |
-
<path d="M164 0h66v170h-66zM0 24h33v8H0zM120 24h28v8h-28zM87 24h28v8H87zM0 37h148v1H0zM0 0h66v14H0z"/>
|
19 |
-
</g>
|
20 |
-
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/img/checkout-preview.svg
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 250">
|
2 |
-
<g fill="none" fill-rule="evenodd">
|
3 |
-
<g transform="translate(0 72)">
|
4 |
-
<path fill="#E1E3E6" d="M15 33h125V0H15z"/>
|
5 |
-
<circle cx="5.5" cy="5.5" r="5.5" fill="#D8D8D8"/>
|
6 |
-
<path fill="#D8D8D8" d="M5 16h1v23H5z"/>
|
7 |
-
</g>
|
8 |
-
<g transform="translate(0 113)">
|
9 |
-
<path fill="#E1E3E6" d="M15 33h125V0H15z"/>
|
10 |
-
<circle cx="5.5" cy="5.5" r="5.5" fill="#D8D8D8"/>
|
11 |
-
<path fill="#D8D8D8" d="M5 16h1v23H5z"/>
|
12 |
-
</g>
|
13 |
-
<g transform="translate(0 154)">
|
14 |
-
<path fill="#E1E3E6" d="M15 33h125V0H15z"/>
|
15 |
-
<circle cx="5.5" cy="5.5" r="5.5" fill="#D8D8D8"/>
|
16 |
-
</g>
|
17 |
-
<path fill="#E1E3E6" d="M164 0h66v148h-66zM61 57h33v8H61zM107 194h33v11h-33zM15 61h43v1H15zM97 60h43v1H97z"/>
|
18 |
-
<rect width="154" height="50" fill="#E1E3E6" rx="3"/>
|
19 |
-
</g>
|
20 |
-
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/atomic/blocks/product-elements/add-to-cart/block.js
CHANGED
@@ -3,7 +3,10 @@
|
|
3 |
*/
|
4 |
import PropTypes from 'prop-types';
|
5 |
import classnames from 'classnames';
|
6 |
-
import {
|
|
|
|
|
|
|
7 |
import { useProductDataContext } from '@woocommerce/shared-context';
|
8 |
import { isEmpty } from 'lodash';
|
9 |
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
@@ -46,32 +49,35 @@ const Block = ( { className, showFormElements } ) => {
|
|
46 |
showFormElements={ showFormElements }
|
47 |
>
|
48 |
<div className={ componentClass }>
|
49 |
-
|
50 |
-
{ showFormElements ? (
|
51 |
-
<AddToCartForm productType={ product.type } />
|
52 |
-
) : (
|
53 |
-
<AddToCartButton />
|
54 |
-
) }
|
55 |
-
</>
|
56 |
</div>
|
57 |
</AddToCartFormContextProvider>
|
58 |
);
|
59 |
};
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
-
|
|
|
75 |
};
|
76 |
|
77 |
Block.propTypes = {
|
3 |
*/
|
4 |
import PropTypes from 'prop-types';
|
5 |
import classnames from 'classnames';
|
6 |
+
import {
|
7 |
+
AddToCartFormContextProvider,
|
8 |
+
useAddToCartFormContext,
|
9 |
+
} from '@woocommerce/base-context';
|
10 |
import { useProductDataContext } from '@woocommerce/shared-context';
|
11 |
import { isEmpty } from 'lodash';
|
12 |
import { withProductDataContext } from '@woocommerce/shared-hocs';
|
49 |
showFormElements={ showFormElements }
|
50 |
>
|
51 |
<div className={ componentClass }>
|
52 |
+
<AddToCartForm />
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
</div>
|
54 |
</AddToCartFormContextProvider>
|
55 |
);
|
56 |
};
|
57 |
|
58 |
+
/**
|
59 |
+
* Renders the add to cart form using useAddToCartFormContext.
|
60 |
+
*/
|
61 |
+
const AddToCartForm = () => {
|
62 |
+
const { showFormElements, productType } = useAddToCartFormContext();
|
63 |
+
|
64 |
+
if ( showFormElements ) {
|
65 |
+
if ( productType === 'variable' ) {
|
66 |
+
return <VariableProductForm />;
|
67 |
+
}
|
68 |
+
if ( productType === 'grouped' ) {
|
69 |
+
return <GroupedProductForm />;
|
70 |
+
}
|
71 |
+
if ( productType === 'external' ) {
|
72 |
+
return <ExternalProductForm />;
|
73 |
+
}
|
74 |
+
if ( productType === 'simple' || productType === 'variation' ) {
|
75 |
+
return <SimpleProductForm />;
|
76 |
+
}
|
77 |
+
return null;
|
78 |
}
|
79 |
+
|
80 |
+
return <AddToCartButton />;
|
81 |
};
|
82 |
|
83 |
Block.propTypes = {
|
assets/js/atomic/blocks/product-elements/add-to-cart/edit.js
CHANGED
@@ -5,8 +5,14 @@ import { __ } from '@wordpress/i18n';
|
|
5 |
import EditProductLink from '@woocommerce/block-components/edit-product-link';
|
6 |
import { useProductDataContext } from '@woocommerce/shared-context';
|
7 |
import classnames from 'classnames';
|
8 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
9 |
import { InspectorControls } from '@wordpress/block-editor';
|
|
|
10 |
|
11 |
/**
|
12 |
* Internal dependencies
|
@@ -28,11 +34,11 @@ const Edit = ( { attributes, setAttributes } ) => {
|
|
28 |
) }
|
29 |
>
|
30 |
<EditProductLink productId={ product.id } />
|
31 |
-
|
32 |
-
<
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
<ToggleControl
|
37 |
label={ __(
|
38 |
'Display form elements',
|
@@ -49,9 +55,20 @@ const Edit = ( { attributes, setAttributes } ) => {
|
|
49 |
} )
|
50 |
}
|
51 |
/>
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
<Disabled>
|
56 |
<Block { ...attributes } />
|
57 |
</Disabled>
|
@@ -63,7 +80,7 @@ export default withProductSelector( {
|
|
63 |
icon: BLOCK_ICON,
|
64 |
label: BLOCK_TITLE,
|
65 |
description: __(
|
66 |
-
"Choose a product to display
|
67 |
'woo-gutenberg-products-block'
|
68 |
),
|
69 |
} )( Edit );
|
5 |
import EditProductLink from '@woocommerce/block-components/edit-product-link';
|
6 |
import { useProductDataContext } from '@woocommerce/shared-context';
|
7 |
import classnames from 'classnames';
|
8 |
+
import {
|
9 |
+
Disabled,
|
10 |
+
PanelBody,
|
11 |
+
ToggleControl,
|
12 |
+
Notice,
|
13 |
+
} from '@wordpress/components';
|
14 |
import { InspectorControls } from '@wordpress/block-editor';
|
15 |
+
import { productSupportsAddToCartForm } from '@woocommerce/base-utils';
|
16 |
|
17 |
/**
|
18 |
* Internal dependencies
|
34 |
) }
|
35 |
>
|
36 |
<EditProductLink productId={ product.id } />
|
37 |
+
<InspectorControls>
|
38 |
+
<PanelBody
|
39 |
+
title={ __( 'Layout', 'woo-gutenberg-products-block' ) }
|
40 |
+
>
|
41 |
+
{ productSupportsAddToCartForm( product ) ? (
|
42 |
<ToggleControl
|
43 |
label={ __(
|
44 |
'Display form elements',
|
55 |
} )
|
56 |
}
|
57 |
/>
|
58 |
+
) : (
|
59 |
+
<Notice
|
60 |
+
className="wc-block-components-product-add-to-cart-notice"
|
61 |
+
isDismissible={ false }
|
62 |
+
status="info"
|
63 |
+
>
|
64 |
+
{ __(
|
65 |
+
'This product does not support the block based add to cart form. A link to the product page will be shown instead.',
|
66 |
+
'woo-gutenberg-products-block'
|
67 |
+
) }
|
68 |
+
</Notice>
|
69 |
+
) }
|
70 |
+
</PanelBody>
|
71 |
+
</InspectorControls>
|
72 |
<Disabled>
|
73 |
<Block { ...attributes } />
|
74 |
</Disabled>
|
80 |
icon: BLOCK_ICON,
|
81 |
label: BLOCK_TITLE,
|
82 |
description: __(
|
83 |
+
"Choose a product to display its add to cart form.",
|
84 |
'woo-gutenberg-products-block'
|
85 |
),
|
86 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/simple.js
CHANGED
@@ -18,8 +18,8 @@ const Simple = () => {
|
|
18 |
quantity,
|
19 |
minQuantity,
|
20 |
maxQuantity,
|
21 |
-
|
22 |
-
|
23 |
} = useAddToCartFormContext();
|
24 |
|
25 |
if ( product.id && ! product.is_purchasable ) {
|
@@ -43,8 +43,8 @@ const Simple = () => {
|
|
43 |
value={ quantity }
|
44 |
min={ minQuantity }
|
45 |
max={ maxQuantity }
|
46 |
-
disabled={
|
47 |
-
onChange={ setQuantity }
|
48 |
/>
|
49 |
<AddToCartButton />
|
50 |
</>
|
18 |
quantity,
|
19 |
minQuantity,
|
20 |
maxQuantity,
|
21 |
+
dispatchActions,
|
22 |
+
isDisabled,
|
23 |
} = useAddToCartFormContext();
|
24 |
|
25 |
if ( product.id && ! product.is_purchasable ) {
|
43 |
value={ quantity }
|
44 |
min={ minQuantity }
|
45 |
max={ maxQuantity }
|
46 |
+
disabled={ isDisabled }
|
47 |
+
onChange={ dispatchActions.setQuantity }
|
48 |
/>
|
49 |
<AddToCartButton />
|
50 |
</>
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/index.js
CHANGED
@@ -23,8 +23,8 @@ const Variable = () => {
|
|
23 |
quantity,
|
24 |
minQuantity,
|
25 |
maxQuantity,
|
26 |
-
|
27 |
-
|
28 |
} = useAddToCartFormContext();
|
29 |
|
30 |
if ( product.id && ! product.is_purchasable ) {
|
@@ -44,13 +44,16 @@ const Variable = () => {
|
|
44 |
|
45 |
return (
|
46 |
<>
|
47 |
-
<VariationAttributes
|
|
|
|
|
|
|
48 |
<QuantityInput
|
49 |
value={ quantity }
|
50 |
min={ minQuantity }
|
51 |
max={ maxQuantity }
|
52 |
-
disabled={
|
53 |
-
onChange={ setQuantity }
|
54 |
/>
|
55 |
<AddToCartButton />
|
56 |
</>
|
23 |
quantity,
|
24 |
minQuantity,
|
25 |
maxQuantity,
|
26 |
+
dispatchActions,
|
27 |
+
isDisabled,
|
28 |
} = useAddToCartFormContext();
|
29 |
|
30 |
if ( product.id && ! product.is_purchasable ) {
|
44 |
|
45 |
return (
|
46 |
<>
|
47 |
+
<VariationAttributes
|
48 |
+
product={ product }
|
49 |
+
dispatchers={ dispatchActions }
|
50 |
+
/>
|
51 |
<QuantityInput
|
52 |
value={ quantity }
|
53 |
min={ minQuantity }
|
54 |
max={ maxQuantity }
|
55 |
+
disabled={ isDisabled }
|
56 |
+
onChange={ dispatchActions.setQuantity }
|
57 |
/>
|
58 |
<AddToCartButton />
|
59 |
</>
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/attribute-picker.js
CHANGED
@@ -2,14 +2,15 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { useState, useEffect, useMemo } from '@wordpress/element';
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
9 |
import AttributeSelectControl from './attribute-select-control';
|
10 |
import {
|
11 |
-
|
12 |
-
|
13 |
} from './utils';
|
14 |
|
15 |
/**
|
@@ -17,88 +18,74 @@ import {
|
|
17 |
*
|
18 |
* @param {*} props Component props.
|
19 |
*/
|
20 |
-
const AttributePicker = ( {
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
const [ variationId, setVariationId ] = useState( 0 );
|
|
|
22 |
|
23 |
-
//
|
24 |
-
const [ selectedAttributes, setSelectedAttributes ] = useState( [] );
|
25 |
-
|
26 |
-
const attributeNames = Object.keys( attributes );
|
27 |
-
const hasSelectedAttributes =
|
28 |
-
Object.values( selectedAttributes ).filter( Boolean ).length > 0;
|
29 |
-
const hasSelectedAllAttributes =
|
30 |
-
Object.values( selectedAttributes ).filter(
|
31 |
-
( selected ) => selected !== ''
|
32 |
-
).length === attributeNames.length;
|
33 |
-
|
34 |
-
// Gets valid attribute options for the picker taking current selections into account.
|
35 |
const filteredAttributeOptions = useMemo( () => {
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
? getVariationsMatchingSelectedAttributes( {
|
45 |
-
selectedAttributes,
|
46 |
-
variationAttributes,
|
47 |
-
attributeNames: attributeNamesExcludingCurrentAttribute,
|
48 |
-
} )
|
49 |
-
: null;
|
50 |
-
const validAttributeTerms =
|
51 |
-
matchingVariationIds !== null
|
52 |
-
? matchingVariationIds.map(
|
53 |
-
( varId ) =>
|
54 |
-
variationAttributes[ varId ][ attributeName ]
|
55 |
-
)
|
56 |
-
: null;
|
57 |
-
options[ attributeName ] = getSelectControlOptions(
|
58 |
-
currentAttribute.terms,
|
59 |
-
validAttributeTerms
|
60 |
-
);
|
61 |
-
} );
|
62 |
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}, [
|
65 |
-
attributes,
|
66 |
-
variationAttributes,
|
67 |
-
attributeNames,
|
68 |
selectedAttributes,
|
69 |
-
|
|
|
|
|
70 |
] );
|
71 |
|
72 |
-
//
|
73 |
useEffect( () => {
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
83 |
} );
|
|
|
84 |
|
85 |
-
setVariationId( matchingVariationIds[ 0 ] || 0 );
|
86 |
-
}, [
|
87 |
-
selectedAttributes,
|
88 |
-
variationAttributes,
|
89 |
-
attributeNames,
|
90 |
-
hasSelectedAllAttributes,
|
91 |
-
] );
|
92 |
-
|
93 |
-
// @todo Hook up Variation Picker with Cart Form.
|
94 |
return (
|
95 |
<div className="wc-block-components-product-add-to-cart-attribute-picker">
|
96 |
-
{
|
97 |
<AttributeSelectControl
|
98 |
key={ attributeName }
|
99 |
attributeName={ attributeName }
|
100 |
options={ filteredAttributeOptions[ attributeName ] }
|
101 |
-
|
102 |
onChange={ ( selected ) => {
|
103 |
setSelectedAttributes( {
|
104 |
...selectedAttributes,
|
@@ -107,7 +94,6 @@ const AttributePicker = ( { attributes, variationAttributes } ) => {
|
|
107 |
} }
|
108 |
/>
|
109 |
) ) }
|
110 |
-
<p>Matched variation ID: { variationId }</p>
|
111 |
</div>
|
112 |
);
|
113 |
};
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { useState, useEffect, useMemo } from '@wordpress/element';
|
5 |
+
import { useShallowEqual } from '@woocommerce/base-hooks';
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
import AttributeSelectControl from './attribute-select-control';
|
11 |
import {
|
12 |
+
getVariationMatchingSelectedAttributes,
|
13 |
+
getActiveSelectControlOptions,
|
14 |
} from './utils';
|
15 |
|
16 |
/**
|
18 |
*
|
19 |
* @param {*} props Component props.
|
20 |
*/
|
21 |
+
const AttributePicker = ( {
|
22 |
+
attributes,
|
23 |
+
variationAttributes,
|
24 |
+
setRequestParams,
|
25 |
+
} ) => {
|
26 |
+
const currentAttributes = useShallowEqual( attributes );
|
27 |
+
const currentVariationAttributes = useShallowEqual( variationAttributes );
|
28 |
const [ variationId, setVariationId ] = useState( 0 );
|
29 |
+
const [ selectedAttributes, setSelectedAttributes ] = useState( {} );
|
30 |
|
31 |
+
// Get options for each attribute picker.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
const filteredAttributeOptions = useMemo( () => {
|
33 |
+
return getActiveSelectControlOptions(
|
34 |
+
currentAttributes,
|
35 |
+
currentVariationAttributes,
|
36 |
+
selectedAttributes
|
37 |
+
);
|
38 |
+
}, [ selectedAttributes, currentAttributes, currentVariationAttributes ] );
|
39 |
|
40 |
+
// Select variations when selections are change.
|
41 |
+
useEffect( () => {
|
42 |
+
const hasSelectedAllAttributes =
|
43 |
+
Object.values( selectedAttributes ).filter(
|
44 |
+
( selected ) => selected !== ''
|
45 |
+
).length === Object.keys( currentAttributes ).length;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
if ( hasSelectedAllAttributes ) {
|
48 |
+
setVariationId(
|
49 |
+
getVariationMatchingSelectedAttributes(
|
50 |
+
currentAttributes,
|
51 |
+
currentVariationAttributes,
|
52 |
+
selectedAttributes
|
53 |
+
)
|
54 |
+
);
|
55 |
+
} else if ( variationId > 0 ) {
|
56 |
+
// Unset variation when form is incomplete.
|
57 |
+
setVariationId( 0 );
|
58 |
+
}
|
59 |
}, [
|
|
|
|
|
|
|
60 |
selectedAttributes,
|
61 |
+
variationId,
|
62 |
+
currentAttributes,
|
63 |
+
currentVariationAttributes,
|
64 |
] );
|
65 |
|
66 |
+
// Set requests params as variation ID and data changes.
|
67 |
useEffect( () => {
|
68 |
+
setRequestParams( {
|
69 |
+
id: variationId,
|
70 |
+
variation: Object.keys( selectedAttributes ).map(
|
71 |
+
( attributeName ) => {
|
72 |
+
return {
|
73 |
+
attribute: attributeName,
|
74 |
+
value: selectedAttributes[ attributeName ],
|
75 |
+
};
|
76 |
+
}
|
77 |
+
),
|
78 |
} );
|
79 |
+
}, [ setRequestParams, variationId, selectedAttributes ] );
|
80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
return (
|
82 |
<div className="wc-block-components-product-add-to-cart-attribute-picker">
|
83 |
+
{ Object.keys( currentAttributes ).map( ( attributeName ) => (
|
84 |
<AttributeSelectControl
|
85 |
key={ attributeName }
|
86 |
attributeName={ attributeName }
|
87 |
options={ filteredAttributeOptions[ attributeName ] }
|
88 |
+
value={ selectedAttributes[ attributeName ] }
|
89 |
onChange={ ( selected ) => {
|
90 |
setSelectedAttributes( {
|
91 |
...selectedAttributes,
|
94 |
} }
|
95 |
/>
|
96 |
) ) }
|
|
|
97 |
</div>
|
98 |
);
|
99 |
};
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/attribute-select-control.js
CHANGED
@@ -4,6 +4,10 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { decodeEntities } from '@wordpress/html-entities';
|
6 |
import { SelectControl } from '@wordpress/components';
|
|
|
|
|
|
|
|
|
7 |
|
8 |
// Default option for select boxes.
|
9 |
const selectAnOption = {
|
@@ -19,17 +23,66 @@ const selectAnOption = {
|
|
19 |
const AttributeSelectControl = ( {
|
20 |
attributeName,
|
21 |
options = [],
|
22 |
-
|
23 |
onChange = () => {},
|
|
|
|
|
|
|
|
|
24 |
} ) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
return (
|
26 |
-
<
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
);
|
34 |
};
|
35 |
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { decodeEntities } from '@wordpress/html-entities';
|
6 |
import { SelectControl } from '@wordpress/components';
|
7 |
+
import { useValidationContext } from '@woocommerce/base-context';
|
8 |
+
import { useEffect } from 'react';
|
9 |
+
import classnames from 'classnames';
|
10 |
+
import { ValidationInputError } from '@woocommerce/base-components/validation';
|
11 |
|
12 |
// Default option for select boxes.
|
13 |
const selectAnOption = {
|
23 |
const AttributeSelectControl = ( {
|
24 |
attributeName,
|
25 |
options = [],
|
26 |
+
value = '',
|
27 |
onChange = () => {},
|
28 |
+
errorMessage = __(
|
29 |
+
'Please select a value.',
|
30 |
+
'woo-gutenberg-products-block'
|
31 |
+
),
|
32 |
} ) => {
|
33 |
+
const {
|
34 |
+
getValidationError,
|
35 |
+
setValidationErrors,
|
36 |
+
clearValidationError,
|
37 |
+
} = useValidationContext();
|
38 |
+
const errorId = attributeName;
|
39 |
+
const error = getValidationError( errorId ) || {};
|
40 |
+
|
41 |
+
useEffect( () => {
|
42 |
+
if ( value ) {
|
43 |
+
clearValidationError( errorId );
|
44 |
+
} else {
|
45 |
+
setValidationErrors( {
|
46 |
+
[ errorId ]: {
|
47 |
+
message: errorMessage,
|
48 |
+
hidden: true,
|
49 |
+
},
|
50 |
+
} );
|
51 |
+
}
|
52 |
+
}, [
|
53 |
+
value,
|
54 |
+
errorId,
|
55 |
+
errorMessage,
|
56 |
+
clearValidationError,
|
57 |
+
setValidationErrors,
|
58 |
+
] );
|
59 |
+
|
60 |
+
// Remove validation errors when unmounted.
|
61 |
+
useEffect( () => () => void clearValidationError( errorId ), [
|
62 |
+
errorId,
|
63 |
+
clearValidationError,
|
64 |
+
] );
|
65 |
+
|
66 |
return (
|
67 |
+
<div className="wc-block-components-product-add-to-cart-attribute-picker__container">
|
68 |
+
<SelectControl
|
69 |
+
label={ decodeEntities( attributeName ) }
|
70 |
+
value={ value || '' }
|
71 |
+
options={ [ selectAnOption, ...options ] }
|
72 |
+
onChange={ onChange }
|
73 |
+
required={ true }
|
74 |
+
className={ classnames(
|
75 |
+
'wc-block-components-product-add-to-cart-attribute-picker__select',
|
76 |
+
{
|
77 |
+
'has-error': error.message && ! error.hidden,
|
78 |
+
}
|
79 |
+
) }
|
80 |
+
/>
|
81 |
+
<ValidationInputError
|
82 |
+
propertyName={ errorId }
|
83 |
+
elementId={ errorId }
|
84 |
+
/>
|
85 |
+
</div>
|
86 |
);
|
87 |
};
|
88 |
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/index.js
CHANGED
@@ -7,17 +7,10 @@ import { getAttributes, getVariationAttributes } from './utils';
|
|
7 |
|
8 |
/**
|
9 |
* VariationAttributes component.
|
10 |
-
*
|
11 |
-
* @param {*} props Component props.
|
12 |
*/
|
13 |
-
const VariationAttributes = ( { product } ) => {
|
14 |
-
const
|
15 |
-
|
16 |
-
variations: productVariations = [],
|
17 |
-
} = product;
|
18 |
-
|
19 |
-
const attributes = getAttributes( productAttributes );
|
20 |
-
const variationAttributes = getVariationAttributes( productVariations );
|
21 |
|
22 |
if (
|
23 |
Object.keys( attributes ).length === 0 ||
|
@@ -30,6 +23,7 @@ const VariationAttributes = ( { product } ) => {
|
|
30 |
<AttributePicker
|
31 |
attributes={ attributes }
|
32 |
variationAttributes={ variationAttributes }
|
|
|
33 |
/>
|
34 |
);
|
35 |
};
|
7 |
|
8 |
/**
|
9 |
* VariationAttributes component.
|
|
|
|
|
10 |
*/
|
11 |
+
const VariationAttributes = ( { product, dispatchers } ) => {
|
12 |
+
const attributes = getAttributes( product.attributes );
|
13 |
+
const variationAttributes = getVariationAttributes( product.variations );
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
if (
|
16 |
Object.keys( attributes ).length === 0 ||
|
23 |
<AttributePicker
|
24 |
attributes={ attributes }
|
25 |
variationAttributes={ variationAttributes }
|
26 |
+
setRequestParams={ dispatchers.setRequestParams }
|
27 |
/>
|
28 |
);
|
29 |
};
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/style.scss
CHANGED
@@ -7,6 +7,10 @@
|
|
7 |
@include font-size(regular);
|
8 |
}
|
9 |
|
|
|
|
|
|
|
|
|
10 |
.wc-block-components-product-add-to-cart-attribute-picker__select {
|
11 |
margin: 0 0 em($gap-small) 0;
|
12 |
|
@@ -14,5 +18,16 @@
|
|
14 |
min-width: 60%;
|
15 |
min-height: 1.75em;
|
16 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
}
|
7 |
@include font-size(regular);
|
8 |
}
|
9 |
|
10 |
+
.wc-block-components-product-add-to-cart-attribute-picker__container {
|
11 |
+
position: relative;
|
12 |
+
}
|
13 |
+
|
14 |
.wc-block-components-product-add-to-cart-attribute-picker__select {
|
15 |
margin: 0 0 em($gap-small) 0;
|
16 |
|
18 |
min-width: 60%;
|
19 |
min-height: 1.75em;
|
20 |
}
|
21 |
+
|
22 |
+
&.has-error {
|
23 |
+
margin-bottom: $gap-large;
|
24 |
+
|
25 |
+
select {
|
26 |
+
border-color: $error-red;
|
27 |
+
&:focus {
|
28 |
+
outline-color: $error-red;
|
29 |
+
}
|
30 |
+
}
|
31 |
+
}
|
32 |
}
|
33 |
}
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/test/index.js
ADDED
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import {
|
5 |
+
getAttributes,
|
6 |
+
getVariationAttributes,
|
7 |
+
getVariationsMatchingSelectedAttributes,
|
8 |
+
getVariationMatchingSelectedAttributes,
|
9 |
+
getActiveSelectControlOptions,
|
10 |
+
} from '../utils';
|
11 |
+
|
12 |
+
const rawAttributeData = [
|
13 |
+
{
|
14 |
+
id: 1,
|
15 |
+
name: 'Color',
|
16 |
+
taxonomy: 'pa_color',
|
17 |
+
has_variations: true,
|
18 |
+
terms: [
|
19 |
+
{
|
20 |
+
id: 22,
|
21 |
+
name: 'Blue',
|
22 |
+
slug: 'blue',
|
23 |
+
},
|
24 |
+
{
|
25 |
+
id: 23,
|
26 |
+
name: 'Green',
|
27 |
+
slug: 'green',
|
28 |
+
},
|
29 |
+
{
|
30 |
+
id: 24,
|
31 |
+
name: 'Red',
|
32 |
+
slug: 'red',
|
33 |
+
},
|
34 |
+
],
|
35 |
+
},
|
36 |
+
{
|
37 |
+
id: 0,
|
38 |
+
name: 'Logo',
|
39 |
+
taxonomy: null,
|
40 |
+
has_variations: true,
|
41 |
+
terms: [
|
42 |
+
{
|
43 |
+
id: 0,
|
44 |
+
name: 'Yes',
|
45 |
+
slug: 'Yes',
|
46 |
+
},
|
47 |
+
{
|
48 |
+
id: 0,
|
49 |
+
name: 'No',
|
50 |
+
slug: 'No',
|
51 |
+
},
|
52 |
+
],
|
53 |
+
},
|
54 |
+
{
|
55 |
+
id: 0,
|
56 |
+
name: 'Non-variable attribute',
|
57 |
+
taxonomy: null,
|
58 |
+
has_variations: false,
|
59 |
+
terms: [
|
60 |
+
{
|
61 |
+
id: 0,
|
62 |
+
name: 'Test',
|
63 |
+
slug: 'Test',
|
64 |
+
},
|
65 |
+
{
|
66 |
+
id: 0,
|
67 |
+
name: 'Test 2',
|
68 |
+
slug: 'Test 2',
|
69 |
+
},
|
70 |
+
],
|
71 |
+
},
|
72 |
+
];
|
73 |
+
|
74 |
+
const rawVariations = [
|
75 |
+
{
|
76 |
+
id: 35,
|
77 |
+
attributes: [
|
78 |
+
{
|
79 |
+
name: 'Color',
|
80 |
+
value: 'blue',
|
81 |
+
},
|
82 |
+
{
|
83 |
+
name: 'Logo',
|
84 |
+
value: 'Yes',
|
85 |
+
},
|
86 |
+
],
|
87 |
+
},
|
88 |
+
{
|
89 |
+
id: 28,
|
90 |
+
attributes: [
|
91 |
+
{
|
92 |
+
name: 'Color',
|
93 |
+
value: 'red',
|
94 |
+
},
|
95 |
+
{
|
96 |
+
name: 'Logo',
|
97 |
+
value: 'No',
|
98 |
+
},
|
99 |
+
],
|
100 |
+
},
|
101 |
+
{
|
102 |
+
id: 29,
|
103 |
+
attributes: [
|
104 |
+
{
|
105 |
+
name: 'Color',
|
106 |
+
value: 'green',
|
107 |
+
},
|
108 |
+
{
|
109 |
+
name: 'Logo',
|
110 |
+
value: 'No',
|
111 |
+
},
|
112 |
+
],
|
113 |
+
},
|
114 |
+
{
|
115 |
+
id: 30,
|
116 |
+
attributes: [
|
117 |
+
{
|
118 |
+
name: 'Color',
|
119 |
+
value: 'blue',
|
120 |
+
},
|
121 |
+
{
|
122 |
+
name: 'Logo',
|
123 |
+
value: 'No',
|
124 |
+
},
|
125 |
+
],
|
126 |
+
},
|
127 |
+
];
|
128 |
+
|
129 |
+
describe( 'Testing utils', () => {
|
130 |
+
describe( 'Testing getAttributes()', () => {
|
131 |
+
it( 'returns empty object if there are no attributes', () => {
|
132 |
+
const attributes = getAttributes( null );
|
133 |
+
expect( attributes ).toStrictEqual( {} );
|
134 |
+
} );
|
135 |
+
it( 'returns list of attributes when given valid data', () => {
|
136 |
+
const attributes = getAttributes( rawAttributeData );
|
137 |
+
expect( attributes ).toStrictEqual( {
|
138 |
+
Color: {
|
139 |
+
id: 1,
|
140 |
+
name: 'Color',
|
141 |
+
taxonomy: 'pa_color',
|
142 |
+
has_variations: true,
|
143 |
+
terms: [
|
144 |
+
{
|
145 |
+
id: 22,
|
146 |
+
name: 'Blue',
|
147 |
+
slug: 'blue',
|
148 |
+
},
|
149 |
+
{
|
150 |
+
id: 23,
|
151 |
+
name: 'Green',
|
152 |
+
slug: 'green',
|
153 |
+
},
|
154 |
+
{
|
155 |
+
id: 24,
|
156 |
+
name: 'Red',
|
157 |
+
slug: 'red',
|
158 |
+
},
|
159 |
+
],
|
160 |
+
},
|
161 |
+
Logo: {
|
162 |
+
id: 0,
|
163 |
+
name: 'Logo',
|
164 |
+
taxonomy: null,
|
165 |
+
has_variations: true,
|
166 |
+
terms: [
|
167 |
+
{
|
168 |
+
id: 0,
|
169 |
+
name: 'Yes',
|
170 |
+
slug: 'Yes',
|
171 |
+
},
|
172 |
+
{
|
173 |
+
id: 0,
|
174 |
+
name: 'No',
|
175 |
+
slug: 'No',
|
176 |
+
},
|
177 |
+
],
|
178 |
+
},
|
179 |
+
} );
|
180 |
+
} );
|
181 |
+
} );
|
182 |
+
describe( 'Testing getVariationAttributes()', () => {
|
183 |
+
it( 'returns empty object if there are no variations', () => {
|
184 |
+
const variationAttributes = getVariationAttributes( null );
|
185 |
+
expect( variationAttributes ).toStrictEqual( {} );
|
186 |
+
} );
|
187 |
+
it( 'returns list of attribute names and value pairs when given valid data', () => {
|
188 |
+
const variationAttributes = getVariationAttributes( rawVariations );
|
189 |
+
expect( variationAttributes ).toStrictEqual( {
|
190 |
+
'id:35': {
|
191 |
+
id: 35,
|
192 |
+
attributes: {
|
193 |
+
Color: 'blue',
|
194 |
+
Logo: 'Yes',
|
195 |
+
},
|
196 |
+
},
|
197 |
+
'id:28': {
|
198 |
+
id: 28,
|
199 |
+
attributes: {
|
200 |
+
Color: 'red',
|
201 |
+
Logo: 'No',
|
202 |
+
},
|
203 |
+
},
|
204 |
+
'id:29': {
|
205 |
+
id: 29,
|
206 |
+
attributes: {
|
207 |
+
Color: 'green',
|
208 |
+
Logo: 'No',
|
209 |
+
},
|
210 |
+
},
|
211 |
+
'id:30': {
|
212 |
+
id: 30,
|
213 |
+
attributes: {
|
214 |
+
Color: 'blue',
|
215 |
+
Logo: 'No',
|
216 |
+
},
|
217 |
+
},
|
218 |
+
} );
|
219 |
+
} );
|
220 |
+
} );
|
221 |
+
describe( 'Testing getVariationsMatchingSelectedAttributes()', () => {
|
222 |
+
const attributes = getAttributes( rawAttributeData );
|
223 |
+
const variationAttributes = getVariationAttributes( rawVariations );
|
224 |
+
|
225 |
+
it( 'returns all variations, in the correct order, if no selections have been made yet', () => {
|
226 |
+
const selectedAttributes = {};
|
227 |
+
const matches = getVariationsMatchingSelectedAttributes(
|
228 |
+
attributes,
|
229 |
+
variationAttributes,
|
230 |
+
selectedAttributes
|
231 |
+
);
|
232 |
+
expect( matches ).toStrictEqual( [ 35, 28, 29, 30 ] );
|
233 |
+
} );
|
234 |
+
|
235 |
+
it( 'returns correct subset of variations after a selection', () => {
|
236 |
+
const selectedAttributes = {
|
237 |
+
Color: 'blue',
|
238 |
+
};
|
239 |
+
const matches = getVariationsMatchingSelectedAttributes(
|
240 |
+
attributes,
|
241 |
+
variationAttributes,
|
242 |
+
selectedAttributes
|
243 |
+
);
|
244 |
+
expect( matches ).toStrictEqual( [ 35, 30 ] );
|
245 |
+
} );
|
246 |
+
|
247 |
+
it( 'returns correct subset of variations after all selections', () => {
|
248 |
+
const selectedAttributes = {
|
249 |
+
Color: 'blue',
|
250 |
+
Logo: 'No',
|
251 |
+
};
|
252 |
+
const matches = getVariationsMatchingSelectedAttributes(
|
253 |
+
attributes,
|
254 |
+
variationAttributes,
|
255 |
+
selectedAttributes
|
256 |
+
);
|
257 |
+
expect( matches ).toStrictEqual( [ 30 ] );
|
258 |
+
} );
|
259 |
+
|
260 |
+
it( 'returns no results if selection does not match or is invalid', () => {
|
261 |
+
const selectedAttributes = {
|
262 |
+
Color: 'brown',
|
263 |
+
};
|
264 |
+
const matches = getVariationsMatchingSelectedAttributes(
|
265 |
+
attributes,
|
266 |
+
variationAttributes,
|
267 |
+
selectedAttributes
|
268 |
+
);
|
269 |
+
expect( matches ).toStrictEqual( [] );
|
270 |
+
} );
|
271 |
+
} );
|
272 |
+
describe( 'Testing getVariationMatchingSelectedAttributes()', () => {
|
273 |
+
const attributes = getAttributes( rawAttributeData );
|
274 |
+
const variationAttributes = getVariationAttributes( rawVariations );
|
275 |
+
|
276 |
+
it( 'returns first match if no selections have been made yet', () => {
|
277 |
+
const selectedAttributes = {};
|
278 |
+
const matches = getVariationMatchingSelectedAttributes(
|
279 |
+
attributes,
|
280 |
+
variationAttributes,
|
281 |
+
selectedAttributes
|
282 |
+
);
|
283 |
+
expect( matches ).toStrictEqual( 35 );
|
284 |
+
} );
|
285 |
+
|
286 |
+
it( 'returns first match after single selection', () => {
|
287 |
+
const selectedAttributes = {
|
288 |
+
Color: 'blue',
|
289 |
+
};
|
290 |
+
const matches = getVariationMatchingSelectedAttributes(
|
291 |
+
attributes,
|
292 |
+
variationAttributes,
|
293 |
+
selectedAttributes
|
294 |
+
);
|
295 |
+
expect( matches ).toStrictEqual( 35 );
|
296 |
+
} );
|
297 |
+
|
298 |
+
it( 'returns correct match after all selections', () => {
|
299 |
+
const selectedAttributes = {
|
300 |
+
Color: 'blue',
|
301 |
+
Logo: 'No',
|
302 |
+
};
|
303 |
+
const matches = getVariationMatchingSelectedAttributes(
|
304 |
+
attributes,
|
305 |
+
variationAttributes,
|
306 |
+
selectedAttributes
|
307 |
+
);
|
308 |
+
expect( matches ).toStrictEqual( 30 );
|
309 |
+
} );
|
310 |
+
|
311 |
+
it( 'returns no match if invalid', () => {
|
312 |
+
const selectedAttributes = {
|
313 |
+
Color: 'brown',
|
314 |
+
};
|
315 |
+
const matches = getVariationMatchingSelectedAttributes(
|
316 |
+
attributes,
|
317 |
+
variationAttributes,
|
318 |
+
selectedAttributes
|
319 |
+
);
|
320 |
+
expect( matches ).toStrictEqual( 0 );
|
321 |
+
} );
|
322 |
+
} );
|
323 |
+
describe( 'Testing getActiveSelectControlOptions()', () => {
|
324 |
+
const attributes = getAttributes( rawAttributeData );
|
325 |
+
const variationAttributes = getVariationAttributes( rawVariations );
|
326 |
+
|
327 |
+
it( 'returns all possible options if no selections have been made yet', () => {
|
328 |
+
const selectedAttributes = {};
|
329 |
+
const controlOptions = getActiveSelectControlOptions(
|
330 |
+
attributes,
|
331 |
+
variationAttributes,
|
332 |
+
selectedAttributes
|
333 |
+
);
|
334 |
+
expect( controlOptions ).toStrictEqual( {
|
335 |
+
Color: [
|
336 |
+
{
|
337 |
+
value: 'blue',
|
338 |
+
label: 'Blue',
|
339 |
+
},
|
340 |
+
{
|
341 |
+
value: 'green',
|
342 |
+
label: 'Green',
|
343 |
+
},
|
344 |
+
{
|
345 |
+
value: 'red',
|
346 |
+
label: 'Red',
|
347 |
+
},
|
348 |
+
],
|
349 |
+
Logo: [
|
350 |
+
{
|
351 |
+
value: 'Yes',
|
352 |
+
label: 'Yes',
|
353 |
+
},
|
354 |
+
{
|
355 |
+
value: 'No',
|
356 |
+
label: 'No',
|
357 |
+
},
|
358 |
+
],
|
359 |
+
} );
|
360 |
+
} );
|
361 |
+
|
362 |
+
it( 'returns only valid options if color is selected', () => {
|
363 |
+
const selectedAttributes = {
|
364 |
+
Color: 'green',
|
365 |
+
};
|
366 |
+
const controlOptions = getActiveSelectControlOptions(
|
367 |
+
attributes,
|
368 |
+
variationAttributes,
|
369 |
+
selectedAttributes
|
370 |
+
);
|
371 |
+
expect( controlOptions ).toStrictEqual( {
|
372 |
+
Color: [
|
373 |
+
{
|
374 |
+
value: 'blue',
|
375 |
+
label: 'Blue',
|
376 |
+
},
|
377 |
+
{
|
378 |
+
value: 'green',
|
379 |
+
label: 'Green',
|
380 |
+
},
|
381 |
+
{
|
382 |
+
value: 'red',
|
383 |
+
label: 'Red',
|
384 |
+
},
|
385 |
+
],
|
386 |
+
Logo: [
|
387 |
+
{
|
388 |
+
value: 'No',
|
389 |
+
label: 'No',
|
390 |
+
},
|
391 |
+
],
|
392 |
+
} );
|
393 |
+
} );
|
394 |
+
} );
|
395 |
+
} );
|
assets/js/atomic/blocks/product-elements/add-to-cart/product-types/variable/variation-attributes/utils.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { keyBy } from 'lodash';
|
|
|
5 |
|
6 |
/**
|
7 |
* Key an array of attributes by name,
|
@@ -16,13 +17,16 @@ export const getAttributes = ( attributes ) => {
|
|
16 |
),
|
17 |
'name'
|
18 |
)
|
19 |
-
:
|
20 |
};
|
21 |
|
22 |
/**
|
23 |
* Format variations from the API into a map of just the attribute names and values.
|
24 |
*
|
25 |
-
*
|
|
|
|
|
|
|
26 |
*/
|
27 |
export const getVariationAttributes = ( variations ) => {
|
28 |
if ( ! variations ) {
|
@@ -32,23 +36,101 @@ export const getVariationAttributes = ( variations ) => {
|
|
32 |
const attributesMap = {};
|
33 |
|
34 |
variations.forEach( ( { id, attributes } ) => {
|
35 |
-
attributesMap[ id
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
39 |
} );
|
40 |
|
41 |
return attributesMap;
|
42 |
};
|
43 |
|
44 |
/**
|
45 |
-
* Given a list of
|
|
|
|
|
|
|
46 |
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
* @param {Object} attributeTerms List of attribute term objects.
|
48 |
* @param {?Array} validAttributeTerms Valid values if selections have been made already.
|
49 |
* @return {Array} Value/Label pairs of select box options.
|
50 |
*/
|
51 |
-
|
52 |
attributeTerms,
|
53 |
validAttributeTerms = null
|
54 |
) => {
|
@@ -61,7 +143,7 @@ export const getSelectControlOptions = (
|
|
61 |
) {
|
62 |
return {
|
63 |
value: slug,
|
64 |
-
label: name,
|
65 |
};
|
66 |
}
|
67 |
return null;
|
@@ -70,38 +152,57 @@ export const getSelectControlOptions = (
|
|
70 |
};
|
71 |
|
72 |
/**
|
73 |
-
* Given a list of
|
74 |
-
*
|
75 |
-
* Allows an attribute to be excluded by name. This is used to filter displayed options for
|
76 |
-
* individual attribute selects.
|
77 |
*
|
78 |
-
* @param {Object}
|
79 |
-
* @param {Object}
|
80 |
-
* @param {Object}
|
81 |
-
* @
|
82 |
-
* @return {Array} List of matching variation IDs.
|
83 |
*/
|
84 |
-
export const
|
85 |
-
|
86 |
variationAttributes,
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
variationAttributes[ variationId ][ attributeName ];
|
94 |
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
};
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { keyBy } from 'lodash';
|
5 |
+
import { decodeEntities } from '@wordpress/html-entities';
|
6 |
|
7 |
/**
|
8 |
* Key an array of attributes by name,
|
17 |
),
|
18 |
'name'
|
19 |
)
|
20 |
+
: {};
|
21 |
};
|
22 |
|
23 |
/**
|
24 |
* Format variations from the API into a map of just the attribute names and values.
|
25 |
*
|
26 |
+
* Note, each item is keyed by the variation ID with an id: prefix. This is to prevent the object
|
27 |
+
* being reordered when iterated.
|
28 |
+
*
|
29 |
+
* @param {Object} variations List of Variation objects and attributes keyed by variation ID.
|
30 |
*/
|
31 |
export const getVariationAttributes = ( variations ) => {
|
32 |
if ( ! variations ) {
|
36 |
const attributesMap = {};
|
37 |
|
38 |
variations.forEach( ( { id, attributes } ) => {
|
39 |
+
attributesMap[ `id:${ id }` ] = {
|
40 |
+
id,
|
41 |
+
attributes: attributes.reduce( ( acc, { name, value } ) => {
|
42 |
+
acc[ name ] = value;
|
43 |
+
return acc;
|
44 |
+
}, {} ),
|
45 |
+
};
|
46 |
} );
|
47 |
|
48 |
return attributesMap;
|
49 |
};
|
50 |
|
51 |
/**
|
52 |
+
* Given a list of variations and a list of attribute values, return variations which match.
|
53 |
+
*
|
54 |
+
* Allows an attribute to be excluded by name. This is used to filter displayed options for
|
55 |
+
* individual attribute selects.
|
56 |
*
|
57 |
+
* @param {Object} attributes List of attribute names and terms.
|
58 |
+
* @param {Object} variationAttributes Attributes for each variation keyed by variation ID.
|
59 |
+
* @param {Object} selectedAttributes Attribute Name Value pairs of current selections by the user.
|
60 |
+
* @return {Array} List of matching variation IDs.
|
61 |
+
*/
|
62 |
+
export const getVariationsMatchingSelectedAttributes = (
|
63 |
+
attributes,
|
64 |
+
variationAttributes,
|
65 |
+
selectedAttributes
|
66 |
+
) => {
|
67 |
+
const variationIds = Object.values( variationAttributes ).map(
|
68 |
+
( { id: variationId } ) => {
|
69 |
+
return variationId;
|
70 |
+
}
|
71 |
+
);
|
72 |
+
|
73 |
+
// If nothing is selected yet, just return all variations.
|
74 |
+
if (
|
75 |
+
Object.values( selectedAttributes ).every( ( value ) => value === '' )
|
76 |
+
) {
|
77 |
+
return variationIds;
|
78 |
+
}
|
79 |
+
|
80 |
+
const attributeNames = Object.keys( attributes );
|
81 |
+
|
82 |
+
return variationIds.filter( ( variationId ) =>
|
83 |
+
attributeNames.every( ( attributeName ) => {
|
84 |
+
const selectedAttribute = selectedAttributes[ attributeName ] || '';
|
85 |
+
const variationAttribute =
|
86 |
+
variationAttributes[ 'id:' + variationId ].attributes[
|
87 |
+
attributeName
|
88 |
+
];
|
89 |
+
|
90 |
+
// If there is no selected attribute, consider this a match.
|
91 |
+
if ( selectedAttribute === '' ) {
|
92 |
+
return true;
|
93 |
+
}
|
94 |
+
// If the variation attributes for this attribute are set to null, it matches all values.
|
95 |
+
if ( variationAttribute === null ) {
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
// Otherwise, only match if the selected values are the same.
|
99 |
+
return variationAttribute === selectedAttribute;
|
100 |
+
} )
|
101 |
+
);
|
102 |
+
};
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Given a list of variations and a list of attribute values, returns the first matched variation ID.
|
106 |
+
*
|
107 |
+
* @param {Object} attributes List of attribute names and terms.
|
108 |
+
* @param {Object} variationAttributes Attributes for each variation keyed by variation ID.
|
109 |
+
* @param {Object} selectedAttributes Attribute Name Value pairs of current selections by the user.
|
110 |
+
* @return {number} Variation ID.
|
111 |
+
*/
|
112 |
+
export const getVariationMatchingSelectedAttributes = (
|
113 |
+
attributes,
|
114 |
+
variationAttributes,
|
115 |
+
selectedAttributes
|
116 |
+
) => {
|
117 |
+
const matchingVariationIds = getVariationsMatchingSelectedAttributes(
|
118 |
+
attributes,
|
119 |
+
variationAttributes,
|
120 |
+
selectedAttributes
|
121 |
+
);
|
122 |
+
return matchingVariationIds[ 0 ] || 0;
|
123 |
+
};
|
124 |
+
|
125 |
+
/**
|
126 |
+
* Given a list of terms, filter them and return valid options for the select boxes.
|
127 |
+
*
|
128 |
+
* @see getActiveSelectControlOptions
|
129 |
* @param {Object} attributeTerms List of attribute term objects.
|
130 |
* @param {?Array} validAttributeTerms Valid values if selections have been made already.
|
131 |
* @return {Array} Value/Label pairs of select box options.
|
132 |
*/
|
133 |
+
const getValidSelectControlOptions = (
|
134 |
attributeTerms,
|
135 |
validAttributeTerms = null
|
136 |
) => {
|
143 |
) {
|
144 |
return {
|
145 |
value: slug,
|
146 |
+
label: decodeEntities( name ),
|
147 |
};
|
148 |
}
|
149 |
return null;
|
152 |
};
|
153 |
|
154 |
/**
|
155 |
+
* Given a list of terms, filter them and return active options for the select boxes. This factors in
|
156 |
+
* which options should be hidden due to current selections.
|
|
|
|
|
157 |
*
|
158 |
+
* @param {Object} attributes List of attribute names and terms.
|
159 |
+
* @param {Object} variationAttributes Attributes for each variation keyed by variation ID.
|
160 |
+
* @param {Object} selectedAttributes Attribute Name Value pairs of current selections by the user.
|
161 |
+
* @return {Object} Select box options.
|
|
|
162 |
*/
|
163 |
+
export const getActiveSelectControlOptions = (
|
164 |
+
attributes,
|
165 |
variationAttributes,
|
166 |
+
selectedAttributes
|
167 |
+
) => {
|
168 |
+
const options = {};
|
169 |
+
const attributeNames = Object.keys( attributes );
|
170 |
+
const hasSelectedAttributes =
|
171 |
+
Object.values( selectedAttributes ).filter( Boolean ).length > 0;
|
|
|
172 |
|
173 |
+
attributeNames.forEach( ( attributeName ) => {
|
174 |
+
const currentAttribute = attributes[ attributeName ];
|
175 |
+
const selectedAttributesExcludingCurrentAttribute = {
|
176 |
+
...selectedAttributes,
|
177 |
+
[ attributeName ]: null,
|
178 |
+
};
|
179 |
+
// This finds matching variations for selected attributes apart from this one. This will be
|
180 |
+
// used to get valid attribute terms of the current attribute narrowed down by those matching
|
181 |
+
// variation IDs. For example, if I had Large Blue Shirts and Medium Red Shirts, I want to only
|
182 |
+
// show Red shirts if Medium is selected.
|
183 |
+
const matchingVariationIds = hasSelectedAttributes
|
184 |
+
? getVariationsMatchingSelectedAttributes(
|
185 |
+
attributes,
|
186 |
+
variationAttributes,
|
187 |
+
selectedAttributesExcludingCurrentAttribute
|
188 |
+
)
|
189 |
+
: null;
|
190 |
+
// Uses the above matching variation IDs to get the attributes from just those variations.
|
191 |
+
const validAttributeTerms =
|
192 |
+
matchingVariationIds !== null
|
193 |
+
? matchingVariationIds.map(
|
194 |
+
( varId ) =>
|
195 |
+
variationAttributes[ 'id:' + varId ].attributes[
|
196 |
+
attributeName
|
197 |
+
]
|
198 |
+
)
|
199 |
+
: null;
|
200 |
+
// Intersects attributes with valid attributes.
|
201 |
+
options[ attributeName ] = getValidSelectControlOptions(
|
202 |
+
currentAttribute.terms,
|
203 |
+
validAttributeTerms
|
204 |
+
);
|
205 |
+
} );
|
206 |
+
|
207 |
+
return options;
|
208 |
};
|
assets/js/atomic/blocks/product-elements/add-to-cart/shared/add-to-cart-button.js
CHANGED
@@ -4,8 +4,9 @@
|
|
4 |
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
import Button from '@woocommerce/base-components/button';
|
6 |
import { Icon, done as doneIcon } from '@woocommerce/icons';
|
7 |
-
import { useState } from '@wordpress/element';
|
8 |
import { useAddToCartFormContext } from '@woocommerce/base-context';
|
|
|
9 |
|
10 |
/**
|
11 |
* Add to Cart Form Button Component.
|
@@ -13,38 +14,64 @@ import { useAddToCartFormContext } from '@woocommerce/base-context';
|
|
13 |
const AddToCartButton = () => {
|
14 |
const {
|
15 |
showFormElements,
|
|
|
|
|
16 |
product,
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
21 |
} = useAddToCartFormContext();
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
// No link is required to the full form under these circumstances.
|
35 |
-
if ( ( showFormElements || ! hasOptions ) && isPurchasable ) {
|
36 |
-
return (
|
37 |
-
<ButtonComponent
|
38 |
-
className="wc-block-components-product-add-to-cart-button"
|
39 |
-
quantityInCart={ quantityInCart }
|
40 |
-
disabled={ formDisabled }
|
41 |
-
loading={ formSubmitting }
|
42 |
-
onClick={ onSubmit }
|
43 |
-
/>
|
44 |
);
|
45 |
-
|
|
|
|
|
|
|
46 |
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
<LinkComponent
|
49 |
className="wc-block-components-product-add-to-cart-button"
|
50 |
href={ addToCartButtonData.url }
|
@@ -73,23 +100,19 @@ const LinkComponent = ( { className, href, text } ) => {
|
|
73 |
const ButtonComponent = ( {
|
74 |
className,
|
75 |
quantityInCart,
|
76 |
-
|
77 |
-
|
|
|
78 |
onClick,
|
79 |
} ) => {
|
80 |
-
const [ wasClicked, setWasClicked ] = useState( false );
|
81 |
-
|
82 |
return (
|
83 |
<Button
|
84 |
className={ className }
|
85 |
-
disabled={
|
86 |
-
showSpinner={
|
87 |
-
onClick={
|
88 |
-
onClick();
|
89 |
-
setWasClicked( true );
|
90 |
-
} }
|
91 |
>
|
92 |
-
{ quantityInCart > 0
|
93 |
? sprintf(
|
94 |
// translators: %s number of products in cart.
|
95 |
_n(
|
@@ -101,7 +124,7 @@ const ButtonComponent = ( {
|
|
101 |
quantityInCart
|
102 |
)
|
103 |
: __( 'Add to cart', 'woo-gutenberg-products-block' ) }
|
104 |
-
{
|
105 |
<Icon
|
106 |
srcElement={ doneIcon }
|
107 |
alt={ __( 'Done', 'woo-gutenberg-products-block' ) }
|
4 |
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
import Button from '@woocommerce/base-components/button';
|
6 |
import { Icon, done as doneIcon } from '@woocommerce/icons';
|
7 |
+
import { useState, useEffect } from '@wordpress/element';
|
8 |
import { useAddToCartFormContext } from '@woocommerce/base-context';
|
9 |
+
import { useStoreAddToCart } from '@woocommerce/base-hooks';
|
10 |
|
11 |
/**
|
12 |
* Add to Cart Form Button Component.
|
14 |
const AddToCartButton = () => {
|
15 |
const {
|
16 |
showFormElements,
|
17 |
+
productIsPurchasable,
|
18 |
+
productHasOptions,
|
19 |
product,
|
20 |
+
productType,
|
21 |
+
isDisabled,
|
22 |
+
isProcessing,
|
23 |
+
eventRegistration,
|
24 |
+
hasError,
|
25 |
+
dispatchActions,
|
26 |
} = useAddToCartFormContext();
|
27 |
+
const { cartQuantity } = useStoreAddToCart( product.id || 0 );
|
28 |
+
const [ addedToCart, setAddedToCart ] = useState( false );
|
29 |
+
const addToCartButtonData = product.add_to_cart || {
|
30 |
+
url: '',
|
31 |
+
text: '',
|
32 |
+
};
|
33 |
|
34 |
+
// Subscribe to emitter for after processing.
|
35 |
+
useEffect( () => {
|
36 |
+
const onSuccess = () => {
|
37 |
+
if ( ! hasError ) {
|
38 |
+
setAddedToCart( true );
|
39 |
+
}
|
40 |
+
return true;
|
41 |
+
};
|
42 |
+
const unsubscribeProcessing = eventRegistration.onAddToCartAfterProcessingWithSuccess(
|
43 |
+
onSuccess,
|
44 |
+
0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
);
|
46 |
+
return () => {
|
47 |
+
unsubscribeProcessing();
|
48 |
+
};
|
49 |
+
}, [ eventRegistration, hasError ] );
|
50 |
|
51 |
+
/**
|
52 |
+
* We can show a real button if we are:
|
53 |
+
*
|
54 |
+
* a) Showing a full add to cart form.
|
55 |
+
* b) The product doesn't have options and can therefore be added directly to the cart.
|
56 |
+
* c) The product is purchasable.
|
57 |
+
*
|
58 |
+
* Otherwise we show a link instead.
|
59 |
+
*/
|
60 |
+
const showButton =
|
61 |
+
( showFormElements ||
|
62 |
+
( ! productHasOptions && productType === 'simple' ) ) &&
|
63 |
+
productIsPurchasable;
|
64 |
+
|
65 |
+
return showButton ? (
|
66 |
+
<ButtonComponent
|
67 |
+
className="wc-block-components-product-add-to-cart-button"
|
68 |
+
quantityInCart={ cartQuantity }
|
69 |
+
isDisabled={ isDisabled }
|
70 |
+
isProcessing={ isProcessing }
|
71 |
+
isDone={ addedToCart }
|
72 |
+
onClick={ () => dispatchActions.submitForm() }
|
73 |
+
/>
|
74 |
+
) : (
|
75 |
<LinkComponent
|
76 |
className="wc-block-components-product-add-to-cart-button"
|
77 |
href={ addToCartButtonData.url }
|
100 |
const ButtonComponent = ( {
|
101 |
className,
|
102 |
quantityInCart,
|
103 |
+
isProcessing,
|
104 |
+
isDisabled,
|
105 |
+
isDone,
|
106 |
onClick,
|
107 |
} ) => {
|
|
|
|
|
108 |
return (
|
109 |
<Button
|
110 |
className={ className }
|
111 |
+
disabled={ isDisabled }
|
112 |
+
showSpinner={ isProcessing }
|
113 |
+
onClick={ onClick }
|
|
|
|
|
|
|
114 |
>
|
115 |
+
{ isDone && quantityInCart > 0
|
116 |
? sprintf(
|
117 |
// translators: %s number of products in cart.
|
118 |
_n(
|
124 |
quantityInCart
|
125 |
)
|
126 |
: __( 'Add to cart', 'woo-gutenberg-products-block' ) }
|
127 |
+
{ !! isDone && (
|
128 |
<Icon
|
129 |
srcElement={ doneIcon }
|
130 |
alt={ __( 'Done', 'woo-gutenberg-products-block' ) }
|
assets/js/atomic/blocks/product-elements/add-to-cart/style.scss
CHANGED
@@ -21,7 +21,7 @@
|
|
21 |
|
22 |
.wc-block-components-product-add-to-cart-quantity {
|
23 |
margin: 0 1em em($gap-small) 0;
|
24 |
-
|
25 |
padding: 0.618em;
|
26 |
background: $white;
|
27 |
border: 1px solid #ccc;
|
@@ -31,6 +31,8 @@
|
|
31 |
text-align: center;
|
32 |
}
|
33 |
}
|
|
|
|
|
34 |
.wc-block-components-product-add-to-cart--placeholder {
|
35 |
.wc-block-components-product-add-to-cart-quantity,
|
36 |
.wc-block-components-product-add-to-cart-button {
|
@@ -41,3 +43,7 @@
|
|
41 |
.wc-block-grid .wc-block-components-product-add-to-cart {
|
42 |
justify-content: center;
|
43 |
}
|
|
|
|
|
|
|
|
21 |
|
22 |
.wc-block-components-product-add-to-cart-quantity {
|
23 |
margin: 0 1em em($gap-small) 0;
|
24 |
+
flex-basis: 5em;
|
25 |
padding: 0.618em;
|
26 |
background: $white;
|
27 |
border: 1px solid #ccc;
|
31 |
text-align: center;
|
32 |
}
|
33 |
}
|
34 |
+
|
35 |
+
.is-loading .wc-block-components-product-add-to-cart,
|
36 |
.wc-block-components-product-add-to-cart--placeholder {
|
37 |
.wc-block-components-product-add-to-cart-quantity,
|
38 |
.wc-block-components-product-add-to-cart-button {
|
43 |
.wc-block-grid .wc-block-components-product-add-to-cart {
|
44 |
justify-content: center;
|
45 |
}
|
46 |
+
|
47 |
+
.wc-block-components-product-add-to-cart-notice {
|
48 |
+
margin: 0;
|
49 |
+
}
|
assets/js/atomic/blocks/product-elements/button/edit.js
CHANGED
@@ -23,7 +23,7 @@ export default withProductSelector( {
|
|
23 |
icon: BLOCK_ICON,
|
24 |
label: BLOCK_TITLE,
|
25 |
description: __(
|
26 |
-
"Choose a product to display
|
27 |
'woo-gutenberg-products-block'
|
28 |
),
|
29 |
} )( Edit );
|
23 |
icon: BLOCK_ICON,
|
24 |
label: BLOCK_TITLE,
|
25 |
description: __(
|
26 |
+
"Choose a product to display its add to cart button.",
|
27 |
'woo-gutenberg-products-block'
|
28 |
),
|
29 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/category-list/edit.js
CHANGED
@@ -27,7 +27,7 @@ export default withProductSelector( {
|
|
27 |
icon: BLOCK_ICON,
|
28 |
label: BLOCK_TITLE,
|
29 |
description: __(
|
30 |
-
"Choose a product to display
|
31 |
'woo-gutenberg-products-block'
|
32 |
),
|
33 |
} )( Edit );
|
27 |
icon: BLOCK_ICON,
|
28 |
label: BLOCK_TITLE,
|
29 |
description: __(
|
30 |
+
"Choose a product to display its categories.",
|
31 |
'woo-gutenberg-products-block'
|
32 |
),
|
33 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/image/edit.js
CHANGED
@@ -153,7 +153,7 @@ export default withProductSelector( {
|
|
153 |
icon: BLOCK_ICON,
|
154 |
label: BLOCK_TITLE,
|
155 |
description: __(
|
156 |
-
"Choose a product to display
|
157 |
'woo-gutenberg-products-block'
|
158 |
),
|
159 |
} )( Edit );
|
153 |
icon: BLOCK_ICON,
|
154 |
label: BLOCK_TITLE,
|
155 |
description: __(
|
156 |
+
"Choose a product to display its image.",
|
157 |
'woo-gutenberg-products-block'
|
158 |
),
|
159 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/price/edit.js
CHANGED
@@ -123,7 +123,7 @@ const Price = isFeaturePluginBuild()
|
|
123 |
icon: BLOCK_ICON,
|
124 |
label: BLOCK_TITLE,
|
125 |
description: __(
|
126 |
-
"Choose a product to display
|
127 |
'woo-gutenberg-products-block'
|
128 |
),
|
129 |
} ),
|
123 |
icon: BLOCK_ICON,
|
124 |
label: BLOCK_TITLE,
|
125 |
description: __(
|
126 |
+
"Choose a product to display its price.",
|
127 |
'woo-gutenberg-products-block'
|
128 |
),
|
129 |
} ),
|
assets/js/atomic/blocks/product-elements/rating/edit.js
CHANGED
@@ -17,7 +17,7 @@ export default withProductSelector( {
|
|
17 |
icon: BLOCK_ICON,
|
18 |
label: BLOCK_TITLE,
|
19 |
description: __(
|
20 |
-
"Choose a product to display
|
21 |
'woo-gutenberg-products-block'
|
22 |
),
|
23 |
} )( Edit );
|
17 |
icon: BLOCK_ICON,
|
18 |
label: BLOCK_TITLE,
|
19 |
description: __(
|
20 |
+
"Choose a product to display its rating.",
|
21 |
'woo-gutenberg-products-block'
|
22 |
),
|
23 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/sale-badge/edit.js
CHANGED
@@ -18,7 +18,7 @@ export default withProductSelector( {
|
|
18 |
icon: BLOCK_ICON,
|
19 |
label: BLOCK_TITLE,
|
20 |
description: __(
|
21 |
-
"Choose a product to display
|
22 |
'woo-gutenberg-products-block'
|
23 |
),
|
24 |
} )( Edit );
|
18 |
icon: BLOCK_ICON,
|
19 |
label: BLOCK_TITLE,
|
20 |
description: __(
|
21 |
+
"Choose a product to display its sale-badge.",
|
22 |
'woo-gutenberg-products-block'
|
23 |
),
|
24 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/sku/edit.js
CHANGED
@@ -24,7 +24,7 @@ export default withProductSelector( {
|
|
24 |
icon: BLOCK_ICON,
|
25 |
label: BLOCK_TITLE,
|
26 |
description: __(
|
27 |
-
"Choose a product to display
|
28 |
'woo-gutenberg-products-block'
|
29 |
),
|
30 |
} )( Edit );
|
24 |
icon: BLOCK_ICON,
|
25 |
label: BLOCK_TITLE,
|
26 |
description: __(
|
27 |
+
"Choose a product to display its SKU.",
|
28 |
'woo-gutenberg-products-block'
|
29 |
),
|
30 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/stock-indicator/edit.js
CHANGED
@@ -24,7 +24,7 @@ export default withProductSelector( {
|
|
24 |
icon: BLOCK_ICON,
|
25 |
label: BLOCK_TITLE,
|
26 |
description: __(
|
27 |
-
"Choose a product to display
|
28 |
'woo-gutenberg-products-block'
|
29 |
),
|
30 |
} )( Edit );
|
24 |
icon: BLOCK_ICON,
|
25 |
label: BLOCK_TITLE,
|
26 |
description: __(
|
27 |
+
"Choose a product to display its stock.",
|
28 |
'woo-gutenberg-products-block'
|
29 |
),
|
30 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/summary/edit.js
CHANGED
@@ -18,7 +18,7 @@ export default withProductSelector( {
|
|
18 |
icon: BLOCK_ICON,
|
19 |
label: BLOCK_TITLE,
|
20 |
description: __(
|
21 |
-
"Choose a product to display
|
22 |
'woo-gutenberg-products-block'
|
23 |
),
|
24 |
} )( Edit );
|
18 |
icon: BLOCK_ICON,
|
19 |
label: BLOCK_TITLE,
|
20 |
description: __(
|
21 |
+
"Choose a product to display its short description.",
|
22 |
'woo-gutenberg-products-block'
|
23 |
),
|
24 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/tag-list/edit.js
CHANGED
@@ -27,7 +27,7 @@ export default withProductSelector( {
|
|
27 |
icon: BLOCK_ICON,
|
28 |
label: BLOCK_TITLE,
|
29 |
description: __(
|
30 |
-
"Choose a product to display
|
31 |
'woo-gutenberg-products-block'
|
32 |
),
|
33 |
} )( Edit );
|
27 |
icon: BLOCK_ICON,
|
28 |
label: BLOCK_TITLE,
|
29 |
description: __(
|
30 |
+
"Choose a product to display its tags.",
|
31 |
'woo-gutenberg-products-block'
|
32 |
),
|
33 |
} )( Edit );
|
assets/js/atomic/blocks/product-elements/title/edit.js
CHANGED
@@ -121,7 +121,7 @@ const Title = isFeaturePluginBuild()
|
|
121 |
icon: BLOCK_ICON,
|
122 |
label: BLOCK_TITLE,
|
123 |
description: __(
|
124 |
-
"Choose a product to display
|
125 |
'woo-gutenberg-products-block'
|
126 |
),
|
127 |
} ),
|
121 |
icon: BLOCK_ICON,
|
122 |
label: BLOCK_TITLE,
|
123 |
description: __(
|
124 |
+
"Choose a product to display its title.",
|
125 |
'woo-gutenberg-products-block'
|
126 |
),
|
127 |
} ),
|
assets/js/atomic/blocks/product/price/attributes.js
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
5 |
-
|
6 |
-
let blockAttributes = {};
|
7 |
-
|
8 |
-
if ( isFeaturePluginBuild() ) {
|
9 |
-
blockAttributes = {
|
10 |
-
...blockAttributes,
|
11 |
-
align: {
|
12 |
-
type: 'string',
|
13 |
-
},
|
14 |
-
fontSize: {
|
15 |
-
type: 'string',
|
16 |
-
},
|
17 |
-
customFontSize: {
|
18 |
-
type: 'number',
|
19 |
-
},
|
20 |
-
saleFontSize: {
|
21 |
-
type: 'string',
|
22 |
-
},
|
23 |
-
customSaleFontSize: {
|
24 |
-
type: 'number',
|
25 |
-
},
|
26 |
-
color: {
|
27 |
-
type: 'string',
|
28 |
-
},
|
29 |
-
saleColor: {
|
30 |
-
type: 'string',
|
31 |
-
},
|
32 |
-
customColor: {
|
33 |
-
type: 'string',
|
34 |
-
},
|
35 |
-
customSaleColor: {
|
36 |
-
type: 'string',
|
37 |
-
},
|
38 |
-
};
|
39 |
-
}
|
40 |
-
export default blockAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/atomic/blocks/product/price/index.js
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { __ } from '@wordpress/i18n';
|
5 |
-
import { registerBlockType } from '@wordpress/blocks';
|
6 |
-
import { CURRENCY } from '@woocommerce/settings';
|
7 |
-
|
8 |
-
/**
|
9 |
-
* Internal dependencies
|
10 |
-
*/
|
11 |
-
import sharedConfig from '../shared-config';
|
12 |
-
import attributes from './attributes';
|
13 |
-
import edit from './edit';
|
14 |
-
|
15 |
-
const blockConfig = {
|
16 |
-
title: __( 'Product Price', 'woo-gutenberg-products-block' ),
|
17 |
-
description: __(
|
18 |
-
'Display the price of a product.',
|
19 |
-
'woo-gutenberg-products-block'
|
20 |
-
),
|
21 |
-
icon: {
|
22 |
-
src: <b style={ { color: '$96588a' } }>{ CURRENCY.symbol }</b>,
|
23 |
-
foreground: '#96588a',
|
24 |
-
},
|
25 |
-
edit,
|
26 |
-
attributes,
|
27 |
-
};
|
28 |
-
|
29 |
-
registerBlockType( 'woocommerce/product-price', {
|
30 |
-
...sharedConfig,
|
31 |
-
...blockConfig,
|
32 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/components/cart-checkout/address-form/default-address-fields.js
CHANGED
@@ -26,6 +26,7 @@ const AddressFields = {
|
|
26 |
'woo-gutenberg-products-block'
|
27 |
),
|
28 |
autocomplete: 'given-name',
|
|
|
29 |
required: true,
|
30 |
hidden: false,
|
31 |
index: 1,
|
@@ -37,6 +38,7 @@ const AddressFields = {
|
|
37 |
'woo-gutenberg-products-block'
|
38 |
),
|
39 |
autocomplete: 'family-name',
|
|
|
40 |
required: true,
|
41 |
hidden: false,
|
42 |
index: 2,
|
@@ -48,6 +50,7 @@ const AddressFields = {
|
|
48 |
'woo-gutenberg-products-block'
|
49 |
),
|
50 |
autocomplete: 'organization',
|
|
|
51 |
required: false,
|
52 |
hidden: false,
|
53 |
index: 3,
|
@@ -59,6 +62,7 @@ const AddressFields = {
|
|
59 |
'woo-gutenberg-products-block'
|
60 |
),
|
61 |
autocomplete: 'address-line1',
|
|
|
62 |
required: true,
|
63 |
hidden: false,
|
64 |
index: 4,
|
@@ -70,6 +74,7 @@ const AddressFields = {
|
|
70 |
'woo-gutenberg-products-block'
|
71 |
),
|
72 |
autocomplete: 'address-line2',
|
|
|
73 |
required: false,
|
74 |
hidden: false,
|
75 |
index: 5,
|
@@ -89,6 +94,7 @@ const AddressFields = {
|
|
89 |
label: __( 'City', 'woo-gutenberg-products-block' ),
|
90 |
optionalLabel: __( 'City (optional)', 'woo-gutenberg-products-block' ),
|
91 |
autocomplete: 'address-level2',
|
|
|
92 |
required: true,
|
93 |
hidden: false,
|
94 |
index: 7,
|
@@ -100,6 +106,7 @@ const AddressFields = {
|
|
100 |
'woo-gutenberg-products-block'
|
101 |
),
|
102 |
autocomplete: 'address-level1',
|
|
|
103 |
required: true,
|
104 |
hidden: false,
|
105 |
index: 8,
|
@@ -111,6 +118,7 @@ const AddressFields = {
|
|
111 |
'woo-gutenberg-products-block'
|
112 |
),
|
113 |
autocomplete: 'postal-code',
|
|
|
114 |
required: true,
|
115 |
hidden: false,
|
116 |
index: 9,
|
26 |
'woo-gutenberg-products-block'
|
27 |
),
|
28 |
autocomplete: 'given-name',
|
29 |
+
autocapitalize: 'sentences',
|
30 |
required: true,
|
31 |
hidden: false,
|
32 |
index: 1,
|
38 |
'woo-gutenberg-products-block'
|
39 |
),
|
40 |
autocomplete: 'family-name',
|
41 |
+
autocapitalize: 'sentences',
|
42 |
required: true,
|
43 |
hidden: false,
|
44 |
index: 2,
|
50 |
'woo-gutenberg-products-block'
|
51 |
),
|
52 |
autocomplete: 'organization',
|
53 |
+
autocapitalize: 'sentences',
|
54 |
required: false,
|
55 |
hidden: false,
|
56 |
index: 3,
|
62 |
'woo-gutenberg-products-block'
|
63 |
),
|
64 |
autocomplete: 'address-line1',
|
65 |
+
autocapitalize: 'sentences',
|
66 |
required: true,
|
67 |
hidden: false,
|
68 |
index: 4,
|
74 |
'woo-gutenberg-products-block'
|
75 |
),
|
76 |
autocomplete: 'address-line2',
|
77 |
+
autocapitalize: 'sentences',
|
78 |
required: false,
|
79 |
hidden: false,
|
80 |
index: 5,
|
94 |
label: __( 'City', 'woo-gutenberg-products-block' ),
|
95 |
optionalLabel: __( 'City (optional)', 'woo-gutenberg-products-block' ),
|
96 |
autocomplete: 'address-level2',
|
97 |
+
autocapitalize: 'sentences',
|
98 |
required: true,
|
99 |
hidden: false,
|
100 |
index: 7,
|
106 |
'woo-gutenberg-products-block'
|
107 |
),
|
108 |
autocomplete: 'address-level1',
|
109 |
+
autocapitalize: 'sentences',
|
110 |
required: true,
|
111 |
hidden: false,
|
112 |
index: 8,
|
118 |
'woo-gutenberg-products-block'
|
119 |
),
|
120 |
autocomplete: 'postal-code',
|
121 |
+
autocapitalize: 'characters',
|
122 |
required: true,
|
123 |
hidden: false,
|
124 |
index: 9,
|
assets/js/base/components/cart-checkout/address-form/index.js
CHANGED
@@ -180,6 +180,7 @@ const AddressForm = ( {
|
|
180 |
field.required ? field.label : field.optionalLabel
|
181 |
}
|
182 |
value={ values[ field.key ] }
|
|
|
183 |
autoComplete={ field.autocomplete }
|
184 |
onChange={ ( newValue ) =>
|
185 |
onChange( {
|
180 |
field.required ? field.label : field.optionalLabel
|
181 |
}
|
182 |
value={ values[ field.key ] }
|
183 |
+
autoCapitalize={ field.autocapitalize }
|
184 |
autoComplete={ field.autocomplete }
|
185 |
onChange={ ( newValue ) =>
|
186 |
onChange( {
|
assets/js/base/components/cart-checkout/form-step/index.js
CHANGED
@@ -35,22 +35,36 @@ const FormStep = ( {
|
|
35 |
description,
|
36 |
children,
|
37 |
disabled = false,
|
|
|
38 |
stepHeadingContent = () => {},
|
39 |
} ) => {
|
|
|
|
|
|
|
|
|
40 |
return (
|
41 |
-
<
|
42 |
className={ classnames(
|
43 |
className,
|
44 |
-
'wc-block-components-checkout-step'
|
|
|
|
|
|
|
45 |
) }
|
46 |
id={ id }
|
47 |
disabled={ disabled }
|
48 |
>
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
<div className="wc-block-components-checkout-step__container">
|
55 |
{ !! description && (
|
56 |
<p className="wc-block-components-checkout-step__description">
|
@@ -61,7 +75,7 @@ const FormStep = ( {
|
|
61 |
{ children }
|
62 |
</div>
|
63 |
</div>
|
64 |
-
</
|
65 |
);
|
66 |
};
|
67 |
|
@@ -71,6 +85,7 @@ FormStep.propTypes = {
|
|
71 |
title: PropTypes.string,
|
72 |
description: PropTypes.string,
|
73 |
children: PropTypes.node,
|
|
|
74 |
stepHeadingContent: PropTypes.func,
|
75 |
disabled: PropTypes.bool,
|
76 |
legend: PropTypes.string,
|
35 |
description,
|
36 |
children,
|
37 |
disabled = false,
|
38 |
+
showStepNumber = true,
|
39 |
stepHeadingContent = () => {},
|
40 |
} ) => {
|
41 |
+
// If the form step doesn't have a legend or title, render a <div> instead
|
42 |
+
// of a <fieldset>.
|
43 |
+
const Element = legend || title ? 'fieldset' : 'div';
|
44 |
+
|
45 |
return (
|
46 |
+
<Element
|
47 |
className={ classnames(
|
48 |
className,
|
49 |
+
'wc-block-components-checkout-step',
|
50 |
+
{
|
51 |
+
'wc-block-components-checkout-step--with-step-number': showStepNumber,
|
52 |
+
}
|
53 |
) }
|
54 |
id={ id }
|
55 |
disabled={ disabled }
|
56 |
>
|
57 |
+
{ !! ( legend || title ) && (
|
58 |
+
<legend className="screen-reader-text">
|
59 |
+
{ legend || title }
|
60 |
+
</legend>
|
61 |
+
) }
|
62 |
+
{ !! title && (
|
63 |
+
<StepHeading
|
64 |
+
title={ title }
|
65 |
+
stepHeadingContent={ stepHeadingContent() }
|
66 |
+
/>
|
67 |
+
) }
|
68 |
<div className="wc-block-components-checkout-step__container">
|
69 |
{ !! description && (
|
70 |
<p className="wc-block-components-checkout-step__description">
|
75 |
{ children }
|
76 |
</div>
|
77 |
</div>
|
78 |
+
</Element>
|
79 |
);
|
80 |
};
|
81 |
|
85 |
title: PropTypes.string,
|
86 |
description: PropTypes.string,
|
87 |
children: PropTypes.node,
|
88 |
+
showStepNumber: PropTypes.bool,
|
89 |
stepHeadingContent: PropTypes.func,
|
90 |
disabled: PropTypes.bool,
|
91 |
legend: PropTypes.string,
|
assets/js/base/components/cart-checkout/form-step/style.scss
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
counter-reset: checkout-step;
|
3 |
}
|
4 |
|
5 |
-
.wc-block-components-checkout-form
|
6 |
position: relative;
|
7 |
border: none;
|
8 |
padding: 0 0 0 $gap-larger;
|
@@ -22,7 +22,7 @@
|
|
22 |
padding-bottom: em($gap-large);
|
23 |
}
|
24 |
|
25 |
-
.wc-block-components-checkout-form
|
26 |
opacity: 0.6;
|
27 |
}
|
28 |
|
@@ -60,30 +60,32 @@
|
|
60 |
margin-bottom: $gap;
|
61 |
}
|
62 |
|
63 |
-
.wc-block-components-checkout-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
|
|
76 |
|
77 |
-
.wc-block-components-checkout-step__container::after {
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
}
|
86 |
|
87 |
-
|
88 |
-
|
|
|
89 |
}
|
2 |
counter-reset: checkout-step;
|
3 |
}
|
4 |
|
5 |
+
.wc-block-components-checkout-form .wc-block-components-checkout-step {
|
6 |
position: relative;
|
7 |
border: none;
|
8 |
padding: 0 0 0 $gap-larger;
|
22 |
padding-bottom: em($gap-large);
|
23 |
}
|
24 |
|
25 |
+
.wc-block-components-checkout-form .wc-block-components-checkout-step:disabled {
|
26 |
opacity: 0.6;
|
27 |
}
|
28 |
|
60 |
margin-bottom: $gap;
|
61 |
}
|
62 |
|
63 |
+
.wc-block-components-checkout-step--with-step-number {
|
64 |
+
.wc-block-components-checkout-step__title::before {
|
65 |
+
@include reset-box();
|
66 |
+
background: transparent;
|
67 |
+
counter-increment: checkout-step;
|
68 |
+
content: "\00a0" counter(checkout-step) ".";
|
69 |
+
content: "\00a0" counter(checkout-step) "." / "";
|
70 |
+
position: absolute;
|
71 |
+
width: $gap-larger;
|
72 |
+
left: -$gap-larger/2;
|
73 |
+
top: 0;
|
74 |
+
text-align: center;
|
75 |
+
transform: translateX(-50%);
|
76 |
+
}
|
77 |
|
78 |
+
.wc-block-components-checkout-step__container::after {
|
79 |
+
content: "";
|
80 |
+
height: 100%;
|
81 |
+
border-left: 1px solid;
|
82 |
+
opacity: 0.3;
|
83 |
+
position: absolute;
|
84 |
+
left: -$gap-larger/2;
|
85 |
+
top: 0;
|
86 |
+
}
|
87 |
|
88 |
+
&:last-of-type .wc-block-components-checkout-step__container::after {
|
89 |
+
content: none;
|
90 |
+
}
|
91 |
}
|
assets/js/base/components/cart-checkout/form-step/test/__snapshots__/index.js.snap
ADDED
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2 |
+
|
3 |
+
exports[`FormStep fieldset legend should default to legend prop when title and legend are defined 1`] = `
|
4 |
+
<fieldset
|
5 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
6 |
+
disabled={false}
|
7 |
+
>
|
8 |
+
<legend
|
9 |
+
className="screen-reader-text"
|
10 |
+
>
|
11 |
+
Lorem Ipsum 2
|
12 |
+
</legend>
|
13 |
+
<div
|
14 |
+
className="wc-block-components-checkout-step__heading"
|
15 |
+
>
|
16 |
+
<h2
|
17 |
+
aria-hidden="true"
|
18 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
19 |
+
>
|
20 |
+
Lorem Ipsum
|
21 |
+
</h2>
|
22 |
+
</div>
|
23 |
+
<div
|
24 |
+
className="wc-block-components-checkout-step__container"
|
25 |
+
>
|
26 |
+
<div
|
27 |
+
className="wc-block-components-checkout-step__content"
|
28 |
+
>
|
29 |
+
Dolor sit amet
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
</fieldset>
|
33 |
+
`;
|
34 |
+
|
35 |
+
exports[`FormStep should apply id and className props 1`] = `
|
36 |
+
<div
|
37 |
+
className="my-classname wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
38 |
+
disabled={false}
|
39 |
+
id="my-id"
|
40 |
+
>
|
41 |
+
<div
|
42 |
+
className="wc-block-components-checkout-step__container"
|
43 |
+
>
|
44 |
+
<div
|
45 |
+
className="wc-block-components-checkout-step__content"
|
46 |
+
>
|
47 |
+
Dolor sit amet
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
</div>
|
51 |
+
`;
|
52 |
+
|
53 |
+
exports[`FormStep should remove step number CSS class if prop is false 1`] = `
|
54 |
+
<fieldset
|
55 |
+
className="wc-block-components-checkout-step"
|
56 |
+
disabled={false}
|
57 |
+
>
|
58 |
+
<legend
|
59 |
+
className="screen-reader-text"
|
60 |
+
>
|
61 |
+
Lorem Ipsum
|
62 |
+
</legend>
|
63 |
+
<div
|
64 |
+
className="wc-block-components-checkout-step__heading"
|
65 |
+
>
|
66 |
+
<h2
|
67 |
+
aria-hidden="true"
|
68 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
69 |
+
>
|
70 |
+
Lorem Ipsum
|
71 |
+
</h2>
|
72 |
+
</div>
|
73 |
+
<div
|
74 |
+
className="wc-block-components-checkout-step__container"
|
75 |
+
>
|
76 |
+
<div
|
77 |
+
className="wc-block-components-checkout-step__content"
|
78 |
+
>
|
79 |
+
Dolor sit amet
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</fieldset>
|
83 |
+
`;
|
84 |
+
|
85 |
+
exports[`FormStep should render a div if no title or legend is provided 1`] = `
|
86 |
+
<div
|
87 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
88 |
+
disabled={false}
|
89 |
+
>
|
90 |
+
<div
|
91 |
+
className="wc-block-components-checkout-step__container"
|
92 |
+
>
|
93 |
+
<div
|
94 |
+
className="wc-block-components-checkout-step__content"
|
95 |
+
>
|
96 |
+
Dolor sit amet
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
`;
|
101 |
+
|
102 |
+
exports[`FormStep should render a fieldset if a legend is provided 1`] = `
|
103 |
+
<fieldset
|
104 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
105 |
+
disabled={false}
|
106 |
+
>
|
107 |
+
<legend
|
108 |
+
className="screen-reader-text"
|
109 |
+
>
|
110 |
+
Lorem Ipsum 2
|
111 |
+
</legend>
|
112 |
+
<div
|
113 |
+
className="wc-block-components-checkout-step__container"
|
114 |
+
>
|
115 |
+
<div
|
116 |
+
className="wc-block-components-checkout-step__content"
|
117 |
+
>
|
118 |
+
Dolor sit amet
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
</fieldset>
|
122 |
+
`;
|
123 |
+
|
124 |
+
exports[`FormStep should render a fieldset with heading if a title is provided 1`] = `
|
125 |
+
<fieldset
|
126 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
127 |
+
disabled={false}
|
128 |
+
>
|
129 |
+
<legend
|
130 |
+
className="screen-reader-text"
|
131 |
+
>
|
132 |
+
Lorem Ipsum
|
133 |
+
</legend>
|
134 |
+
<div
|
135 |
+
className="wc-block-components-checkout-step__heading"
|
136 |
+
>
|
137 |
+
<h2
|
138 |
+
aria-hidden="true"
|
139 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
140 |
+
>
|
141 |
+
Lorem Ipsum
|
142 |
+
</h2>
|
143 |
+
</div>
|
144 |
+
<div
|
145 |
+
className="wc-block-components-checkout-step__container"
|
146 |
+
>
|
147 |
+
<div
|
148 |
+
className="wc-block-components-checkout-step__content"
|
149 |
+
>
|
150 |
+
Dolor sit amet
|
151 |
+
</div>
|
152 |
+
</div>
|
153 |
+
</fieldset>
|
154 |
+
`;
|
155 |
+
|
156 |
+
exports[`FormStep should render step description 1`] = `
|
157 |
+
<fieldset
|
158 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
159 |
+
disabled={false}
|
160 |
+
>
|
161 |
+
<legend
|
162 |
+
className="screen-reader-text"
|
163 |
+
>
|
164 |
+
Lorem Ipsum
|
165 |
+
</legend>
|
166 |
+
<div
|
167 |
+
className="wc-block-components-checkout-step__heading"
|
168 |
+
>
|
169 |
+
<h2
|
170 |
+
aria-hidden="true"
|
171 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
172 |
+
>
|
173 |
+
Lorem Ipsum
|
174 |
+
</h2>
|
175 |
+
</div>
|
176 |
+
<div
|
177 |
+
className="wc-block-components-checkout-step__container"
|
178 |
+
>
|
179 |
+
<p
|
180 |
+
className="wc-block-components-checkout-step__description"
|
181 |
+
>
|
182 |
+
This is the description
|
183 |
+
</p>
|
184 |
+
<div
|
185 |
+
className="wc-block-components-checkout-step__content"
|
186 |
+
>
|
187 |
+
Dolor sit amet
|
188 |
+
</div>
|
189 |
+
</div>
|
190 |
+
</fieldset>
|
191 |
+
`;
|
192 |
+
|
193 |
+
exports[`FormStep should render step heading content 1`] = `
|
194 |
+
<fieldset
|
195 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
196 |
+
disabled={false}
|
197 |
+
>
|
198 |
+
<legend
|
199 |
+
className="screen-reader-text"
|
200 |
+
>
|
201 |
+
Lorem Ipsum
|
202 |
+
</legend>
|
203 |
+
<div
|
204 |
+
className="wc-block-components-checkout-step__heading"
|
205 |
+
>
|
206 |
+
<h2
|
207 |
+
aria-hidden="true"
|
208 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
209 |
+
>
|
210 |
+
Lorem Ipsum
|
211 |
+
</h2>
|
212 |
+
<span
|
213 |
+
className="wc-block-components-checkout-step__heading-content"
|
214 |
+
>
|
215 |
+
<span>
|
216 |
+
Some context to render next to the heading
|
217 |
+
</span>
|
218 |
+
</span>
|
219 |
+
</div>
|
220 |
+
<div
|
221 |
+
className="wc-block-components-checkout-step__container"
|
222 |
+
>
|
223 |
+
<div
|
224 |
+
className="wc-block-components-checkout-step__content"
|
225 |
+
>
|
226 |
+
Dolor sit amet
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
</fieldset>
|
230 |
+
`;
|
231 |
+
|
232 |
+
exports[`FormStep should set disabled prop to the fieldset element when disabled is true 1`] = `
|
233 |
+
<fieldset
|
234 |
+
className="wc-block-components-checkout-step wc-block-components-checkout-step--with-step-number"
|
235 |
+
disabled={true}
|
236 |
+
>
|
237 |
+
<legend
|
238 |
+
className="screen-reader-text"
|
239 |
+
>
|
240 |
+
Lorem Ipsum
|
241 |
+
</legend>
|
242 |
+
<div
|
243 |
+
className="wc-block-components-checkout-step__heading"
|
244 |
+
>
|
245 |
+
<h2
|
246 |
+
aria-hidden="true"
|
247 |
+
className="wc-block-components-title wc-block-components-checkout-step__title"
|
248 |
+
>
|
249 |
+
Lorem Ipsum
|
250 |
+
</h2>
|
251 |
+
</div>
|
252 |
+
<div
|
253 |
+
className="wc-block-components-checkout-step__container"
|
254 |
+
>
|
255 |
+
<div
|
256 |
+
className="wc-block-components-checkout-step__content"
|
257 |
+
>
|
258 |
+
Dolor sit amet
|
259 |
+
</div>
|
260 |
+
</div>
|
261 |
+
</fieldset>
|
262 |
+
`;
|
assets/js/base/components/cart-checkout/form-step/test/index.js
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import FormStep from '..';
|
10 |
+
|
11 |
+
describe( 'FormStep', () => {
|
12 |
+
test( 'should render a div if no title or legend is provided', () => {
|
13 |
+
const component = TestRenderer.create(
|
14 |
+
<FormStep>Dolor sit amet</FormStep>
|
15 |
+
);
|
16 |
+
|
17 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
18 |
+
} );
|
19 |
+
|
20 |
+
test( 'should apply id and className props', () => {
|
21 |
+
const component = TestRenderer.create(
|
22 |
+
<FormStep id="my-id" className="my-classname">
|
23 |
+
Dolor sit amet
|
24 |
+
</FormStep>
|
25 |
+
);
|
26 |
+
|
27 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
28 |
+
} );
|
29 |
+
|
30 |
+
test( 'should render a fieldset if a legend is provided', () => {
|
31 |
+
const component = TestRenderer.create(
|
32 |
+
<FormStep legend="Lorem Ipsum 2">Dolor sit amet</FormStep>
|
33 |
+
);
|
34 |
+
|
35 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
36 |
+
} );
|
37 |
+
|
38 |
+
test( 'should render a fieldset with heading if a title is provided', () => {
|
39 |
+
const component = TestRenderer.create(
|
40 |
+
<FormStep title="Lorem Ipsum">Dolor sit amet</FormStep>
|
41 |
+
);
|
42 |
+
|
43 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
44 |
+
} );
|
45 |
+
|
46 |
+
test( 'fieldset legend should default to legend prop when title and legend are defined', () => {
|
47 |
+
const component = TestRenderer.create(
|
48 |
+
<FormStep title="Lorem Ipsum" legend="Lorem Ipsum 2">
|
49 |
+
Dolor sit amet
|
50 |
+
</FormStep>
|
51 |
+
);
|
52 |
+
|
53 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
54 |
+
} );
|
55 |
+
|
56 |
+
test( 'should remove step number CSS class if prop is false', () => {
|
57 |
+
const component = TestRenderer.create(
|
58 |
+
<FormStep title="Lorem Ipsum" showStepNumber={ false }>
|
59 |
+
Dolor sit amet
|
60 |
+
</FormStep>
|
61 |
+
);
|
62 |
+
|
63 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
64 |
+
} );
|
65 |
+
|
66 |
+
test( 'should render step heading content', () => {
|
67 |
+
const component = TestRenderer.create(
|
68 |
+
<FormStep
|
69 |
+
title="Lorem Ipsum"
|
70 |
+
stepHeadingContent={ () => (
|
71 |
+
<span>Some context to render next to the heading</span>
|
72 |
+
) }
|
73 |
+
>
|
74 |
+
Dolor sit amet
|
75 |
+
</FormStep>
|
76 |
+
);
|
77 |
+
|
78 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
79 |
+
} );
|
80 |
+
|
81 |
+
test( 'should render step description', () => {
|
82 |
+
const component = TestRenderer.create(
|
83 |
+
<FormStep title="Lorem Ipsum" description="This is the description">
|
84 |
+
Dolor sit amet
|
85 |
+
</FormStep>
|
86 |
+
);
|
87 |
+
|
88 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
89 |
+
} );
|
90 |
+
|
91 |
+
test( 'should set disabled prop to the fieldset element when disabled is true', () => {
|
92 |
+
const component = TestRenderer.create(
|
93 |
+
<FormStep title="Lorem Ipsum" disabled={ true }>
|
94 |
+
Dolor sit amet
|
95 |
+
</FormStep>
|
96 |
+
);
|
97 |
+
|
98 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
99 |
+
} );
|
100 |
+
} );
|
assets/js/base/components/cart-checkout/product-price/index.js
CHANGED
@@ -13,7 +13,7 @@ import './style.scss';
|
|
13 |
|
14 |
const ProductPrice = ( { className, currency, regularValue, value } ) => {
|
15 |
const isDiscounted =
|
16 |
-
Number.isFinite( regularValue ) && regularValue
|
17 |
|
18 |
if ( isDiscounted ) {
|
19 |
return (
|
13 |
|
14 |
const ProductPrice = ( { className, currency, regularValue, value } ) => {
|
15 |
const isDiscounted =
|
16 |
+
Number.isFinite( regularValue ) && regularValue > value;
|
17 |
|
18 |
if ( isDiscounted ) {
|
19 |
return (
|
assets/js/base/components/cart-checkout/product-sale-badge/index.js
CHANGED
@@ -21,7 +21,7 @@ import ProductBadge from '../product-badge';
|
|
21 |
* @return {*} The component.
|
22 |
*/
|
23 |
const ProductSaleBadge = ( { currency, saleAmount } ) => {
|
24 |
-
if ( ! saleAmount ) {
|
25 |
return null;
|
26 |
}
|
27 |
return (
|
21 |
* @return {*} The component.
|
22 |
*/
|
23 |
const ProductSaleBadge = ( { currency, saleAmount } ) => {
|
24 |
+
if ( ! saleAmount || saleAmount <= 0 ) {
|
25 |
return null;
|
26 |
}
|
27 |
return (
|
assets/js/base/components/cart-checkout/shipping-calculator/style.scss
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
|
5 |
.wc-block-components-shipping-calculator-address__button {
|
6 |
width: 100%;
|
|
|
7 |
}
|
8 |
|
9 |
.wc-block-components-shipping-calculator {
|
4 |
|
5 |
.wc-block-components-shipping-calculator-address__button {
|
6 |
width: 100%;
|
7 |
+
margin-top: em($gap-large);
|
8 |
}
|
9 |
|
10 |
.wc-block-components-shipping-calculator {
|
assets/js/base/components/checkbox-control/index.js
CHANGED
@@ -38,6 +38,15 @@ const CheckboxControl = ( {
|
|
38 |
onChange={ ( event ) => onChange( event.target.checked ) }
|
39 |
{ ...rest }
|
40 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
<span className="wc-block-components-checkbox__label">
|
42 |
{ label }
|
43 |
</span>
|
38 |
onChange={ ( event ) => onChange( event.target.checked ) }
|
39 |
{ ...rest }
|
40 |
/>
|
41 |
+
<svg
|
42 |
+
className="wc-block-components-checkbox__mark"
|
43 |
+
aria-hidden="true"
|
44 |
+
xmlns="http://www.w3.org/2000/svg"
|
45 |
+
viewBox="0 0 24 20"
|
46 |
+
>
|
47 |
+
<path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z" />
|
48 |
+
</svg>
|
49 |
+
|
50 |
<span className="wc-block-components-checkbox__label">
|
51 |
{ label }
|
52 |
</span>
|
assets/js/base/components/checkbox-control/style.scss
CHANGED
@@ -1,41 +1,63 @@
|
|
1 |
.wc-block-components-checkbox {
|
2 |
@include reset-typography();
|
3 |
-
|
|
|
|
|
4 |
position: relative;
|
5 |
|
6 |
.wc-block-components-checkbox__input[type="checkbox"] {
|
7 |
appearance: none;
|
8 |
-
border:
|
9 |
-
|
|
|
|
|
10 |
margin: 0;
|
11 |
-
min-height:
|
12 |
-
min-width:
|
13 |
overflow: hidden;
|
14 |
position: static;
|
15 |
vertical-align: middle;
|
16 |
-
|
17 |
|
18 |
&:checked {
|
19 |
background: currentColor;
|
20 |
border-color: currentColor;
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
margin: 0;
|
30 |
-
line-height: 100%;
|
31 |
-
text-align: center;
|
32 |
-
width: calc(1rem - 2px);
|
33 |
}
|
34 |
}
|
35 |
}
|
36 |
|
37 |
-
.wc-block-components-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
padding-left: $gap-smaller;
|
39 |
vertical-align: middle;
|
40 |
}
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
.wc-block-components-checkbox {
|
2 |
@include reset-typography();
|
3 |
+
align-items: center;
|
4 |
+
display: flex;
|
5 |
+
height: 1em;
|
6 |
position: relative;
|
7 |
|
8 |
.wc-block-components-checkbox__input[type="checkbox"] {
|
9 |
appearance: none;
|
10 |
+
border: 2px solid currentColor;
|
11 |
+
border-radius: 2px;
|
12 |
+
height: em(18px);
|
13 |
+
width: em(18px);
|
14 |
margin: 0;
|
15 |
+
min-height: 18px;
|
16 |
+
min-width: 18px;
|
17 |
overflow: hidden;
|
18 |
position: static;
|
19 |
vertical-align: middle;
|
20 |
+
background-color: #fff;
|
21 |
|
22 |
&:checked {
|
23 |
background: currentColor;
|
24 |
border-color: currentColor;
|
25 |
+
}
|
26 |
+
|
27 |
+
&:not(:checked) + .wc-block-components-checkbox__mark {
|
28 |
+
display: none;
|
29 |
+
}
|
30 |
|
31 |
+
.has-dark-controls & {
|
32 |
+
border-color: $controls-border-dark;
|
33 |
+
background-color: transparent;
|
34 |
+
|
35 |
+
&:checked {
|
36 |
+
background: transparent;
|
37 |
+
border-color: $controls-border-dark;
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
.wc-block-components-checkbox__mark {
|
43 |
+
fill: #fff;
|
44 |
+
position: absolute;
|
45 |
+
left: em(1px);
|
46 |
+
top: em(-2px);
|
47 |
+
width: em(16px);
|
48 |
+
height: em(16px);
|
49 |
+
}
|
50 |
+
|
51 |
+
.wc-block-components-checkbox__label {
|
52 |
padding-left: $gap-smaller;
|
53 |
vertical-align: middle;
|
54 |
}
|
55 |
}
|
56 |
+
|
57 |
+
// Hack to hide the check mark in IE11
|
58 |
+
// See comment: https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/2320/#issuecomment-621936576
|
59 |
+
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
|
60 |
+
.wc-block-components-checkbox__mark {
|
61 |
+
display: none;
|
62 |
+
}
|
63 |
+
}
|
assets/js/base/components/country-input/country-input.js
CHANGED
@@ -10,6 +10,7 @@ import classnames from 'classnames';
|
|
10 |
* Internal dependencies
|
11 |
*/
|
12 |
import { ValidatedSelect } from '../select';
|
|
|
13 |
|
14 |
const CountryInput = ( {
|
15 |
className,
|
10 |
* Internal dependencies
|
11 |
*/
|
12 |
import { ValidatedSelect } from '../select';
|
13 |
+
import './style.scss';
|
14 |
|
15 |
const CountryInput = ( {
|
16 |
className,
|
assets/js/base/components/country-input/style.scss
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.wc-block-components-country-input {
|
2 |
+
margin-top: em($gap-large);
|
3 |
+
}
|
assets/js/base/components/panel/style.scss
CHANGED
@@ -43,6 +43,8 @@
|
|
43 |
overflow: auto;
|
44 |
}
|
45 |
|
46 |
-
.theme-twentytwenty .wc-blocks-components-panel__button
|
|
|
47 |
background: transparent;
|
|
|
48 |
}
|
43 |
overflow: auto;
|
44 |
}
|
45 |
|
46 |
+
.theme-twentytwenty .wc-blocks-components-panel__button,
|
47 |
+
.theme-twentyseventeen .wc-blocks-components-panel__button {
|
48 |
background: transparent;
|
49 |
+
color: inherit;
|
50 |
}
|
assets/js/base/components/payment-methods/saved-payment-method-options.js
CHANGED
@@ -131,15 +131,17 @@ const SavedPaymentMethodOptions = ( { onSelect } ) => {
|
|
131 |
);
|
132 |
}
|
133 |
} );
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
143 |
}
|
144 |
}, [
|
145 |
customerPaymentMethods,
|
131 |
);
|
132 |
}
|
133 |
} );
|
134 |
+
if ( options.length > 0 ) {
|
135 |
+
currentOptions.current = options;
|
136 |
+
currentOptions.current.push( {
|
137 |
+
value: '0',
|
138 |
+
label: __(
|
139 |
+
'Use a new payment method',
|
140 |
+
'woo-gutenberg-product-blocks'
|
141 |
+
),
|
142 |
+
name: `wc-saved-payment-method-token-new`,
|
143 |
+
} );
|
144 |
+
}
|
145 |
}
|
146 |
}, [
|
147 |
customerPaymentMethods,
|
assets/js/base/components/payment-methods/style.scss
CHANGED
@@ -91,6 +91,10 @@ $border-radius: 5px;
|
|
91 |
.wc-block-card-elements {
|
92 |
display: flex;
|
93 |
width: 100%;
|
|
|
|
|
|
|
|
|
94 |
}
|
95 |
|
96 |
.wc-block-gateway-container {
|
91 |
.wc-block-card-elements {
|
92 |
display: flex;
|
93 |
width: 100%;
|
94 |
+
|
95 |
+
.wc-block-components-validation-error {
|
96 |
+
position: static;
|
97 |
+
}
|
98 |
}
|
99 |
|
100 |
.wc-block-gateway-container {
|
assets/js/base/components/quantity-selector/style.scss
CHANGED
@@ -16,6 +16,13 @@
|
|
16 |
border: 1px solid $core-grey-light-600;
|
17 |
background: #fff;
|
18 |
border-radius: 4px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
// Extra label for specificity needed in the editor.
|
21 |
input.wc-block-components-quantity-selector__input {
|
@@ -41,6 +48,18 @@
|
|
41 |
&:disabled {
|
42 |
color: $core-grey-dark-100;
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
input::-webkit-outer-spin-button,
|
46 |
input::-webkit-inner-spin-button {
|
@@ -66,6 +85,18 @@
|
|
66 |
cursor: default;
|
67 |
@include reset-button;
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
70 |
.wc-block-components-quantity-selector__button--minus {
|
71 |
order: 1;
|
16 |
border: 1px solid $core-grey-light-600;
|
17 |
background: #fff;
|
18 |
border-radius: 4px;
|
19 |
+
// needed so that buttons fill the container.
|
20 |
+
box-sizing: content-box;
|
21 |
+
|
22 |
+
.has-dark-controls & {
|
23 |
+
background-color: transparent;
|
24 |
+
border-color: $input-border-dark;
|
25 |
+
}
|
26 |
|
27 |
// Extra label for specificity needed in the editor.
|
28 |
input.wc-block-components-quantity-selector__input {
|
48 |
&:disabled {
|
49 |
color: $core-grey-dark-100;
|
50 |
}
|
51 |
+
|
52 |
+
.has-dark-controls & {
|
53 |
+
color: $input-text-dark;
|
54 |
+
background: transparent;
|
55 |
+
|
56 |
+
&:focus {
|
57 |
+
background: transparent;
|
58 |
+
}
|
59 |
+
&:disabled {
|
60 |
+
color: $input-disabled-dark;
|
61 |
+
}
|
62 |
+
}
|
63 |
}
|
64 |
input::-webkit-outer-spin-button,
|
65 |
input::-webkit-inner-spin-button {
|
85 |
cursor: default;
|
86 |
@include reset-button;
|
87 |
}
|
88 |
+
|
89 |
+
.has-dark-controls & {
|
90 |
+
color: $input-text-dark;
|
91 |
+
|
92 |
+
&:hover,
|
93 |
+
&:focus {
|
94 |
+
color: $input-text-dark;
|
95 |
+
}
|
96 |
+
&:disabled {
|
97 |
+
color: $input-disabled-dark;
|
98 |
+
}
|
99 |
+
}
|
100 |
}
|
101 |
.wc-block-components-quantity-selector__button--minus {
|
102 |
order: 1;
|
assets/js/base/components/radio-control/_mixin.scss
CHANGED
@@ -60,7 +60,7 @@
|
|
60 |
.wc-block-components-radio-control {
|
61 |
.wc-block-components-radio-control__input {
|
62 |
appearance: none;
|
63 |
-
background:
|
64 |
border: 2px solid currentColor;
|
65 |
border-radius: 50%;
|
66 |
display: inline-block;
|
@@ -84,6 +84,14 @@
|
|
84 |
transform: translate(-50%, -50%);
|
85 |
width: 0.625em;
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
}
|
88 |
|
89 |
@include breakpoint( ">782px" ) {
|
60 |
.wc-block-components-radio-control {
|
61 |
.wc-block-components-radio-control__input {
|
62 |
appearance: none;
|
63 |
+
background: transparent;
|
64 |
border: 2px solid currentColor;
|
65 |
border-radius: 50%;
|
66 |
display: inline-block;
|
84 |
transform: translate(-50%, -50%);
|
85 |
width: 0.625em;
|
86 |
}
|
87 |
+
|
88 |
+
.has-dark-controls & {
|
89 |
+
border-color: $controls-border-dark;
|
90 |
+
|
91 |
+
&:checked::before {
|
92 |
+
background: $input-text-dark;
|
93 |
+
}
|
94 |
+
}
|
95 |
}
|
96 |
|
97 |
@include breakpoint( ">782px" ) {
|
assets/js/base/components/radio-control/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
@import "./mixin";
|
2 |
-
|
3 |
-
// We need to increase the styles specificity in the editor, to avoid wp-admin styles taking preference.
|
4 |
-
#wpbody .edit-post-visual-editor {
|
5 |
-
@include radio-control-input-styles;
|
6 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/components/radio-control/index.js
CHANGED
@@ -8,7 +8,6 @@ import { withInstanceId } from '@woocommerce/base-hocs/with-instance-id';
|
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
import RadioControlOption from './option';
|
11 |
-
import './editor.scss';
|
12 |
import './style.scss';
|
13 |
|
14 |
const RadioControl = ( {
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
import RadioControlOption from './option';
|
|
|
11 |
import './style.scss';
|
12 |
|
13 |
const RadioControl = ( {
|
assets/js/base/components/select/style.scss
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
.wc-block-components-select {
|
2 |
height: 3em;
|
3 |
position: relative;
|
4 |
-
margin-bottom: em($gap-large);
|
5 |
|
6 |
label {
|
7 |
@include reset-typography();
|
@@ -19,6 +18,9 @@
|
|
19 |
max-width: calc(100% - #{2 * $gap});
|
20 |
white-space: nowrap;
|
21 |
|
|
|
|
|
|
|
22 |
@media screen and (prefers-reduced-motion: reduce) {
|
23 |
transition: none;
|
24 |
}
|
@@ -30,7 +32,16 @@
|
|
30 |
|
31 |
&.has-error {
|
32 |
.components-custom-select-control__button {
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
}
|
36 |
|
@@ -59,15 +70,23 @@
|
|
59 |
text-transform: none;
|
60 |
white-space: nowrap;
|
61 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
|
62 |
}
|
63 |
}
|
64 |
|
65 |
.components-custom-select-control__button-icon {
|
66 |
right: #{$gap - 4px};
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
.components-custom-select-control__menu {
|
70 |
-
background-color:
|
71 |
margin: 0;
|
72 |
max-height: 300px;
|
73 |
overflow: auto;
|
@@ -76,12 +95,23 @@
|
|
76 |
&:empty {
|
77 |
display: none;
|
78 |
}
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
81 |
.components-custom-select-control__item {
|
82 |
@include font-size(regular);
|
83 |
margin-left: 0;
|
84 |
padding-left: $gap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
}
|
86 |
|
87 |
.components-custom-select-control__item-icon {
|
1 |
.wc-block-components-select {
|
2 |
height: 3em;
|
3 |
position: relative;
|
|
|
4 |
|
5 |
label {
|
6 |
@include reset-typography();
|
18 |
max-width: calc(100% - #{2 * $gap});
|
19 |
white-space: nowrap;
|
20 |
|
21 |
+
.has-dark-controls & {
|
22 |
+
color: $input-placeholder-dark;
|
23 |
+
}
|
24 |
@media screen and (prefers-reduced-motion: reduce) {
|
25 |
transition: none;
|
26 |
}
|
32 |
|
33 |
&.has-error {
|
34 |
.components-custom-select-control__button {
|
35 |
+
&,
|
36 |
+
&:hover,
|
37 |
+
&:focus,
|
38 |
+
&:active {
|
39 |
+
border-color: $error-red;
|
40 |
+
}
|
41 |
+
&:focus {
|
42 |
+
outline: 1px dotted $error-red;
|
43 |
+
outline-offset: 2px;
|
44 |
+
}
|
45 |
}
|
46 |
}
|
47 |
|
70 |
text-transform: none;
|
71 |
white-space: nowrap;
|
72 |
width: 100%;
|
73 |
+
.has-dark-controls & {
|
74 |
+
background-color: $input-background-dark;
|
75 |
+
border-color: $input-border-dark;
|
76 |
+
color: $input-text-dark;
|
77 |
+
}
|
78 |
}
|
79 |
}
|
80 |
|
81 |
.components-custom-select-control__button-icon {
|
82 |
right: #{$gap - 4px};
|
83 |
+
.has-dark-controls & {
|
84 |
+
fill: $input-text-dark;
|
85 |
+
}
|
86 |
}
|
87 |
|
88 |
.components-custom-select-control__menu {
|
89 |
+
background-color: $select-dropdown-dark;
|
90 |
margin: 0;
|
91 |
max-height: 300px;
|
92 |
overflow: auto;
|
95 |
&:empty {
|
96 |
display: none;
|
97 |
}
|
98 |
+
.has-dark-controls & {
|
99 |
+
background-color: $select-dropdown-dark;
|
100 |
+
color: $input-text-dark;
|
101 |
+
}
|
102 |
}
|
103 |
|
104 |
.components-custom-select-control__item {
|
105 |
@include font-size(regular);
|
106 |
margin-left: 0;
|
107 |
padding-left: $gap;
|
108 |
+
&:hover,
|
109 |
+
&:focus,
|
110 |
+
&.is-highlighted {
|
111 |
+
.has-dark-controls & {
|
112 |
+
background-color: $select-item-dark;
|
113 |
+
}
|
114 |
+
}
|
115 |
}
|
116 |
|
117 |
.components-custom-select-control__item-icon {
|
assets/js/base/components/state-input/state-input.js
CHANGED
@@ -5,12 +5,14 @@ import { __ } from '@wordpress/i18n';
|
|
5 |
import PropTypes from 'prop-types';
|
6 |
import { decodeEntities } from '@wordpress/html-entities';
|
7 |
import { useCallback } from '@wordpress/element';
|
|
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
11 |
*/
|
12 |
import { ValidatedTextInput } from '../text-input';
|
13 |
import { ValidatedSelect } from '../select';
|
|
|
14 |
|
15 |
const StateInput = ( {
|
16 |
className,
|
@@ -56,7 +58,10 @@ const StateInput = ( {
|
|
56 |
return (
|
57 |
<>
|
58 |
<ValidatedSelect
|
59 |
-
className={
|
|
|
|
|
|
|
60 |
id={ id }
|
61 |
label={ label }
|
62 |
onChange={ onChangeState }
|
5 |
import PropTypes from 'prop-types';
|
6 |
import { decodeEntities } from '@wordpress/html-entities';
|
7 |
import { useCallback } from '@wordpress/element';
|
8 |
+
import classnames from 'classnames';
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
12 |
*/
|
13 |
import { ValidatedTextInput } from '../text-input';
|
14 |
import { ValidatedSelect } from '../select';
|
15 |
+
import './style.scss';
|
16 |
|
17 |
const StateInput = ( {
|
18 |
className,
|
58 |
return (
|
59 |
<>
|
60 |
<ValidatedSelect
|
61 |
+
className={ classnames(
|
62 |
+
className,
|
63 |
+
'wc-block-components-state-input'
|
64 |
+
) }
|
65 |
id={ id }
|
66 |
label={ label }
|
67 |
onChange={ onChangeState }
|
assets/js/base/components/state-input/style.scss
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.wc-block-components-state-input {
|
2 |
+
margin-top: em($gap-large);
|
3 |
+
}
|
assets/js/base/components/store-notices-container/style.scss
CHANGED
@@ -3,17 +3,15 @@
|
|
3 |
margin-bottom: 2em;
|
4 |
.wc-block-components-notices__notice {
|
5 |
margin: 0;
|
6 |
-
|
7 |
-
|
8 |
-
}
|
9 |
.components-notice__dismiss {
|
10 |
background: transparent none;
|
11 |
padding: 0;
|
12 |
-
margin: 0;
|
13 |
border: 0;
|
14 |
outline: 0;
|
15 |
color: #fff;
|
16 |
-
float: right;
|
17 |
svg {
|
18 |
fill: #fff;
|
19 |
vertical-align: text-top;
|
3 |
margin-bottom: 2em;
|
4 |
.wc-block-components-notices__notice {
|
5 |
margin: 0;
|
6 |
+
display: flex;
|
7 |
+
flex-wrap: nowrap;
|
|
|
8 |
.components-notice__dismiss {
|
9 |
background: transparent none;
|
10 |
padding: 0;
|
11 |
+
margin: 0 0 0 0.5em;
|
12 |
border: 0;
|
13 |
outline: 0;
|
14 |
color: #fff;
|
|
|
15 |
svg {
|
16 |
fill: #fff;
|
17 |
vertical-align: text-top;
|
assets/js/base/components/tabs/style.scss
CHANGED
@@ -14,6 +14,7 @@
|
|
14 |
text-align: center;
|
15 |
transition: box-shadow 0.1s linear;
|
16 |
box-shadow: inset 0 -1px currentColor;
|
|
|
17 |
&.is-active {
|
18 |
box-shadow: inset 0 -3px currentColor;
|
19 |
font-weight: 600;
|
@@ -23,6 +24,10 @@
|
|
23 |
outline-offset: -1px;
|
24 |
outline: 1px dotted currentColor;
|
25 |
}
|
|
|
|
|
|
|
|
|
26 |
.wc-block-components-tabs__item-content {
|
27 |
@include font-size(regular);
|
28 |
line-height: 1;
|
14 |
text-align: center;
|
15 |
transition: box-shadow 0.1s linear;
|
16 |
box-shadow: inset 0 -1px currentColor;
|
17 |
+
border-radius: 0;
|
18 |
&.is-active {
|
19 |
box-shadow: inset 0 -3px currentColor;
|
20 |
font-weight: 600;
|
24 |
outline-offset: -1px;
|
25 |
outline: 1px dotted currentColor;
|
26 |
}
|
27 |
+
&:hover,
|
28 |
+
&:active {
|
29 |
+
background: transparent;
|
30 |
+
}
|
31 |
.wc-block-components-tabs__item-content {
|
32 |
@include font-size(regular);
|
33 |
line-height: 1;
|
assets/js/base/components/text-input/index.js
CHANGED
@@ -24,6 +24,7 @@ const TextInput = forwardRef(
|
|
24 |
screenReaderLabel,
|
25 |
disabled,
|
26 |
help,
|
|
|
27 |
autoComplete = 'off',
|
28 |
value = '',
|
29 |
onChange,
|
@@ -50,6 +51,7 @@ const TextInput = forwardRef(
|
|
50 |
id={ id }
|
51 |
value={ value }
|
52 |
ref={ ref }
|
|
|
53 |
autoComplete={ autoComplete }
|
54 |
onChange={ ( event ) => {
|
55 |
onChange( event.target.value );
|
@@ -101,6 +103,7 @@ TextInput.propTypes = {
|
|
101 |
screenReaderLabel: PropTypes.string,
|
102 |
disabled: PropTypes.bool,
|
103 |
help: PropTypes.string,
|
|
|
104 |
autoComplete: PropTypes.string,
|
105 |
required: PropTypes.bool,
|
106 |
};
|
24 |
screenReaderLabel,
|
25 |
disabled,
|
26 |
help,
|
27 |
+
autoCapitalize = 'off',
|
28 |
autoComplete = 'off',
|
29 |
value = '',
|
30 |
onChange,
|
51 |
id={ id }
|
52 |
value={ value }
|
53 |
ref={ ref }
|
54 |
+
autoCapitalize={ autoCapitalize }
|
55 |
autoComplete={ autoComplete }
|
56 |
onChange={ ( event ) => {
|
57 |
onChange( event.target.value );
|
103 |
screenReaderLabel: PropTypes.string,
|
104 |
disabled: PropTypes.bool,
|
105 |
help: PropTypes.string,
|
106 |
+
autoCapitalize: PropTypes.string,
|
107 |
autoComplete: PropTypes.string,
|
108 |
required: PropTypes.bool,
|
109 |
};
|
assets/js/base/components/text-input/style.scss
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
.wc-block-components-text-input {
|
2 |
position: relative;
|
3 |
-
margin-
|
4 |
white-space: nowrap;
|
5 |
|
6 |
label {
|
@@ -20,6 +20,9 @@
|
|
20 |
max-width: calc(100% - #{2 * $gap});
|
21 |
cursor: text;
|
22 |
|
|
|
|
|
|
|
23 |
@media screen and (prefers-reduced-motion: reduce) {
|
24 |
transition: none;
|
25 |
}
|
@@ -54,6 +57,11 @@
|
|
54 |
&:focus {
|
55 |
background-color: #fff;
|
56 |
}
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
&.is-active input[type="tel"],
|
@@ -64,9 +72,15 @@
|
|
64 |
}
|
65 |
|
66 |
&.has-error input {
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
&:focus {
|
69 |
-
outline
|
|
|
70 |
}
|
71 |
}
|
72 |
|
@@ -75,6 +89,6 @@
|
|
75 |
}
|
76 |
|
77 |
&:only-child {
|
78 |
-
margin-
|
79 |
}
|
80 |
}
|
1 |
.wc-block-components-text-input {
|
2 |
position: relative;
|
3 |
+
margin-top: em($gap-large);
|
4 |
white-space: nowrap;
|
5 |
|
6 |
label {
|
20 |
max-width: calc(100% - #{2 * $gap});
|
21 |
cursor: text;
|
22 |
|
23 |
+
.has-dark-controls & {
|
24 |
+
color: $input-placeholder-dark;
|
25 |
+
}
|
26 |
@media screen and (prefers-reduced-motion: reduce) {
|
27 |
transition: none;
|
28 |
}
|
57 |
&:focus {
|
58 |
background-color: #fff;
|
59 |
}
|
60 |
+
.has-dark-controls & {
|
61 |
+
background-color: $input-background-dark;
|
62 |
+
border-color: $input-border-dark;
|
63 |
+
color: $input-text-dark;
|
64 |
+
}
|
65 |
}
|
66 |
|
67 |
&.is-active input[type="tel"],
|
72 |
}
|
73 |
|
74 |
&.has-error input {
|
75 |
+
&,
|
76 |
+
&:hover,
|
77 |
+
&:focus,
|
78 |
+
&:active {
|
79 |
+
border-color: $error-red;
|
80 |
+
}
|
81 |
&:focus {
|
82 |
+
outline: 1px dotted $error-red;
|
83 |
+
outline-offset: 2px;
|
84 |
}
|
85 |
}
|
86 |
|
89 |
}
|
90 |
|
91 |
&:only-child {
|
92 |
+
margin-top: 0;
|
93 |
}
|
94 |
}
|
assets/js/base/components/textarea/index.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import classnames from 'classnames';
|
5 |
+
import PropTypes from 'prop-types';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import './style.scss';
|
11 |
+
|
12 |
+
const Textarea = ( {
|
13 |
+
className = '',
|
14 |
+
disabled = false,
|
15 |
+
onTextChange,
|
16 |
+
placeholder,
|
17 |
+
value = '',
|
18 |
+
} ) => {
|
19 |
+
return (
|
20 |
+
<textarea
|
21 |
+
className={ classnames(
|
22 |
+
'wc-block-components-textarea',
|
23 |
+
className
|
24 |
+
) }
|
25 |
+
disabled={ disabled }
|
26 |
+
onChange={ ( event ) => {
|
27 |
+
onTextChange( event.target.value );
|
28 |
+
} }
|
29 |
+
placeholder={ placeholder }
|
30 |
+
rows={ 2 }
|
31 |
+
value={ value }
|
32 |
+
/>
|
33 |
+
);
|
34 |
+
};
|
35 |
+
|
36 |
+
Textarea.propTypes = {
|
37 |
+
onTextChange: PropTypes.func.isRequired,
|
38 |
+
disabled: PropTypes.bool,
|
39 |
+
placeholder: PropTypes.string,
|
40 |
+
value: PropTypes.string,
|
41 |
+
};
|
42 |
+
|
43 |
+
export default Textarea;
|
assets/js/base/components/textarea/style.scss
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-components-textarea {
|
2 |
+
@include font-size(regular);
|
3 |
+
background-color: #fff;
|
4 |
+
border: 1px solid $input-border-gray;
|
5 |
+
border-radius: 4px;
|
6 |
+
color: $input-text-active;
|
7 |
+
font-family: inherit;
|
8 |
+
line-height: 1.375; // =22px when font-size is 16px.
|
9 |
+
margin: 0;
|
10 |
+
padding: em($gap-small) $gap;
|
11 |
+
width: 100%;
|
12 |
+
|
13 |
+
.has-dark-controls & {
|
14 |
+
background-color: $input-background-dark;
|
15 |
+
border-color: $input-border-dark;
|
16 |
+
color: $input-text-dark;
|
17 |
+
|
18 |
+
&::placeholder {
|
19 |
+
color: $input-placeholder-dark;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
assets/js/base/context/add-to-cart-form-context.js
DELETED
@@ -1,156 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import {
|
5 |
-
createContext,
|
6 |
-
useContext,
|
7 |
-
useState,
|
8 |
-
useCallback,
|
9 |
-
} from '@wordpress/element';
|
10 |
-
import {
|
11 |
-
useStoreAddToCart,
|
12 |
-
useTriggerFragmentRefresh,
|
13 |
-
} from '@woocommerce/base-hooks';
|
14 |
-
|
15 |
-
/**
|
16 |
-
* @typedef {import('@woocommerce/type-defs/contexts').AddToCartFormContext} AddToCartFormContext
|
17 |
-
*/
|
18 |
-
|
19 |
-
const AddToCartFormContext = createContext( {
|
20 |
-
product: {},
|
21 |
-
productId: 0,
|
22 |
-
variationId: 0,
|
23 |
-
variationData: {},
|
24 |
-
cartItemData: {},
|
25 |
-
quantity: 1,
|
26 |
-
minQuantity: 1,
|
27 |
-
maxQuantity: 99,
|
28 |
-
quantityInCart: 0,
|
29 |
-
setQuantity: ( quantity ) => void { quantity },
|
30 |
-
setVariationId: ( variationId ) => void { variationId },
|
31 |
-
setVariationData: ( variationData ) => void { variationData },
|
32 |
-
setCartItemData: ( cartItemData ) => void { cartItemData },
|
33 |
-
showFormElements: false,
|
34 |
-
formInitialized: false,
|
35 |
-
formDisabled: true,
|
36 |
-
formSubmitting: false,
|
37 |
-
onChange: () => void null,
|
38 |
-
onSubmit: () => void null,
|
39 |
-
onSuccess: () => void null,
|
40 |
-
onFail: () => void null,
|
41 |
-
} );
|
42 |
-
|
43 |
-
/**
|
44 |
-
* @return {AddToCartFormContext} Returns the add to cart form context value.
|
45 |
-
*/
|
46 |
-
export const useAddToCartFormContext = () => {
|
47 |
-
return useContext( AddToCartFormContext );
|
48 |
-
};
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Provides an interface for blocks to control the add to cart form for a product.
|
52 |
-
*
|
53 |
-
* @param {Object} props Incoming props for the provider.
|
54 |
-
* @param {*} props.children The children being wrapped.
|
55 |
-
* @param {Object} [props.product] The product for which the form belongs to.
|
56 |
-
* @param {boolean} [props.showFormElements] Should form elements be shown.
|
57 |
-
*/
|
58 |
-
export const AddToCartFormContextProvider = ( {
|
59 |
-
children,
|
60 |
-
product: productProp,
|
61 |
-
showFormElements,
|
62 |
-
} ) => {
|
63 |
-
const product = productProp || {};
|
64 |
-
const productId = product.id || 0;
|
65 |
-
const [ variationId, setVariationId ] = useState( 0 );
|
66 |
-
const [ variationData, setVariationData ] = useState( {} );
|
67 |
-
const [ cartItemData, setCartItemData ] = useState( {} );
|
68 |
-
const [ quantity, setQuantity ] = useState( 1 );
|
69 |
-
const {
|
70 |
-
addToCart: storeAddToCart,
|
71 |
-
addingToCart: formSubmitting,
|
72 |
-
cartQuantity: quantityInCart,
|
73 |
-
cartIsLoading,
|
74 |
-
} = useStoreAddToCart( productId );
|
75 |
-
|
76 |
-
// This will ensure any add to cart events update legacy fragments using jQuery.
|
77 |
-
useTriggerFragmentRefresh( quantityInCart );
|
78 |
-
|
79 |
-
/**
|
80 |
-
* @todo Introduce Validation Emitter for the Add to Cart Form
|
81 |
-
*
|
82 |
-
* The add to cart form may have several inner form elements which need to run validation and
|
83 |
-
* change whether or not the form can be submitted. They may also need to show errors and
|
84 |
-
* validation notices.
|
85 |
-
*/
|
86 |
-
const formInitialized = ! cartIsLoading && productId > 0;
|
87 |
-
const formDisabled =
|
88 |
-
formSubmitting ||
|
89 |
-
! formInitialized ||
|
90 |
-
! productIsPurchasable( product );
|
91 |
-
|
92 |
-
// Events.
|
93 |
-
const onSubmit = useCallback( () => {
|
94 |
-
/**
|
95 |
-
* @todo Surface add to cart errors in the single product block.
|
96 |
-
*
|
97 |
-
* If the addToCart function within useStoreAddToCart fails, a notice should be shown on the product page.
|
98 |
-
*/
|
99 |
-
storeAddToCart( quantity );
|
100 |
-
}, [ storeAddToCart, quantity ] );
|
101 |
-
|
102 |
-
/**
|
103 |
-
* @todo Add Event Callbacks to the Add to Cart Form.
|
104 |
-
*
|
105 |
-
* - onChange should trigger when a form element changes, so for example, a variation picker could indicate that it's ready.
|
106 |
-
* - onSuccess should trigger after a successful add to cart. This could be used to reset form elements, do a redirect, or show something to the user.
|
107 |
-
* - onFail should trigger when adding to cart fails. Form elements might show extra notices or reset. A fallback might be to redirect to the core product page in case of incompatibilities.
|
108 |
-
*/
|
109 |
-
const onChange = useCallback( () => {}, [] );
|
110 |
-
const onSuccess = useCallback( () => {}, [] );
|
111 |
-
const onFail = useCallback( () => {}, [] );
|
112 |
-
|
113 |
-
/**
|
114 |
-
* @type {AddToCartFormContext}
|
115 |
-
*/
|
116 |
-
const contextValue = {
|
117 |
-
product,
|
118 |
-
productId,
|
119 |
-
variationId,
|
120 |
-
variationData,
|
121 |
-
cartItemData,
|
122 |
-
quantity,
|
123 |
-
minQuantity: 1,
|
124 |
-
maxQuantity: product.quantity_limit || 99,
|
125 |
-
quantityInCart,
|
126 |
-
setQuantity,
|
127 |
-
setVariationId,
|
128 |
-
setVariationData,
|
129 |
-
setCartItemData,
|
130 |
-
showFormElements,
|
131 |
-
formInitialized,
|
132 |
-
formDisabled,
|
133 |
-
formSubmitting,
|
134 |
-
onChange,
|
135 |
-
onSubmit,
|
136 |
-
onSuccess,
|
137 |
-
onFail,
|
138 |
-
};
|
139 |
-
|
140 |
-
return (
|
141 |
-
<AddToCartFormContext.Provider value={ contextValue }>
|
142 |
-
{ children }
|
143 |
-
</AddToCartFormContext.Provider>
|
144 |
-
);
|
145 |
-
};
|
146 |
-
|
147 |
-
/**
|
148 |
-
* Check a product object to see if it can be purchased.
|
149 |
-
*
|
150 |
-
* @param {Object} product Product object.
|
151 |
-
*/
|
152 |
-
const productIsPurchasable = ( product ) => {
|
153 |
-
const { is_purchasable: isPurchasable = false } = product;
|
154 |
-
|
155 |
-
return isPurchasable;
|
156 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/context/add-to-cart-form/form-state/actions.js
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { ACTION_TYPES } from './constants';
|
5 |
+
|
6 |
+
const {
|
7 |
+
SET_PRISTINE,
|
8 |
+
SET_IDLE,
|
9 |
+
SET_DISABLED,
|
10 |
+
SET_PROCESSING,
|
11 |
+
SET_BEFORE_PROCESSING,
|
12 |
+
SET_AFTER_PROCESSING,
|
13 |
+
SET_PROCESSING_RESPONSE,
|
14 |
+
SET_HAS_ERROR,
|
15 |
+
SET_NO_ERROR,
|
16 |
+
SET_QUANTITY,
|
17 |
+
SET_REQUEST_PARAMS,
|
18 |
+
} = ACTION_TYPES;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* All the actions that can be dispatched for the checkout.
|
22 |
+
*/
|
23 |
+
export const actions = {
|
24 |
+
setPristine: () => ( {
|
25 |
+
type: SET_PRISTINE,
|
26 |
+
} ),
|
27 |
+
setIdle: () => ( {
|
28 |
+
type: SET_IDLE,
|
29 |
+
} ),
|
30 |
+
setDisabled: () => ( {
|
31 |
+
type: SET_DISABLED,
|
32 |
+
} ),
|
33 |
+
setProcessing: () => ( {
|
34 |
+
type: SET_PROCESSING,
|
35 |
+
} ),
|
36 |
+
setBeforeProcessing: () => ( {
|
37 |
+
type: SET_BEFORE_PROCESSING,
|
38 |
+
} ),
|
39 |
+
setAfterProcessing: () => ( {
|
40 |
+
type: SET_AFTER_PROCESSING,
|
41 |
+
} ),
|
42 |
+
setProcessingResponse: ( data ) => ( {
|
43 |
+
type: SET_PROCESSING_RESPONSE,
|
44 |
+
data,
|
45 |
+
} ),
|
46 |
+
setHasError: ( hasError = true ) => {
|
47 |
+
const type = hasError ? SET_HAS_ERROR : SET_NO_ERROR;
|
48 |
+
return { type };
|
49 |
+
},
|
50 |
+
setQuantity: ( quantity ) => ( {
|
51 |
+
type: SET_QUANTITY,
|
52 |
+
quantity,
|
53 |
+
} ),
|
54 |
+
setRequestParams: ( data ) => ( {
|
55 |
+
type: SET_REQUEST_PARAMS,
|
56 |
+
data,
|
57 |
+
} ),
|
58 |
+
};
|
assets/js/base/context/add-to-cart-form/form-state/constants.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @type {import("@woocommerce/type-defs/add-to-cart-form").AddToCartFormStatusConstants}
|
3 |
+
*/
|
4 |
+
export const STATUS = {
|
5 |
+
PRISTINE: 'pristine',
|
6 |
+
IDLE: 'idle',
|
7 |
+
DISABLED: 'disabled',
|
8 |
+
PROCESSING: 'processing',
|
9 |
+
BEFORE_PROCESSING: 'before_processing',
|
10 |
+
AFTER_PROCESSING: 'after_processing',
|
11 |
+
};
|
12 |
+
|
13 |
+
export const DEFAULT_STATE = {
|
14 |
+
status: STATUS.PRISTINE,
|
15 |
+
hasError: false,
|
16 |
+
quantity: 1,
|
17 |
+
processingResponse: null,
|
18 |
+
requestParams: {},
|
19 |
+
};
|
20 |
+
export const ACTION_TYPES = {
|
21 |
+
SET_PRISTINE: 'set_pristine',
|
22 |
+
SET_IDLE: 'set_idle',
|
23 |
+
SET_DISABLED: 'set_disabled',
|
24 |
+
SET_PROCESSING: 'set_processing',
|
25 |
+
SET_BEFORE_PROCESSING: 'set_before_processing',
|
26 |
+
SET_AFTER_PROCESSING: 'set_after_processing',
|
27 |
+
SET_PROCESSING_RESPONSE: 'set_processing_response',
|
28 |
+
SET_HAS_ERROR: 'set_has_error',
|
29 |
+
SET_NO_ERROR: 'set_no_error',
|
30 |
+
SET_QUANTITY: 'set_quantity',
|
31 |
+
SET_REQUEST_PARAMS: 'set_request_params',
|
32 |
+
};
|
assets/js/base/context/add-to-cart-form/form-state/event-emit.js
ADDED
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import {
|
5 |
+
emitterCallback,
|
6 |
+
reducer,
|
7 |
+
emitEvent,
|
8 |
+
emitEventWithAbort,
|
9 |
+
} from '../../shared/event-emit';
|
10 |
+
|
11 |
+
const EMIT_TYPES = {
|
12 |
+
ADD_TO_CART_BEFORE_PROCESSING: 'add_to_cart_before_processing',
|
13 |
+
ADD_TO_CART_AFTER_PROCESSING_WITH_SUCCESS:
|
14 |
+
'add_to_cart_after_processing_with_success',
|
15 |
+
ADD_TO_CART_AFTER_PROCESSING_WITH_ERROR:
|
16 |
+
'add_to_cart_after_processing_with_error',
|
17 |
+
};
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Receives a reducer dispatcher and returns an object with the callback registration function for
|
21 |
+
* the add to cart emit events.
|
22 |
+
*
|
23 |
+
* Calling the event registration function with the callback will register it for the event emitter
|
24 |
+
* and will return a dispatcher for removing the registered callback (useful for implementation
|
25 |
+
* in `useEffect`).
|
26 |
+
*
|
27 |
+
* @param {Function} dispatcher The emitter reducer dispatcher.
|
28 |
+
*
|
29 |
+
* @return {Object} An object with the add to cart form emitter registration
|
30 |
+
*/
|
31 |
+
const emitterSubscribers = ( dispatcher ) => ( {
|
32 |
+
onAddToCartAfterProcessingWithSuccess: emitterCallback(
|
33 |
+
EMIT_TYPES.ADD_TO_CART_AFTER_PROCESSING_WITH_SUCCESS,
|
34 |
+
dispatcher
|
35 |
+
),
|
36 |
+
onAddToCartProcessingWithError: emitterCallback(
|
37 |
+
EMIT_TYPES.ADD_TO_CART_AFTER_PROCESSING_WITH_ERROR,
|
38 |
+
dispatcher
|
39 |
+
),
|
40 |
+
onAddToCartBeforeProcessing: emitterCallback(
|
41 |
+
EMIT_TYPES.ADD_TO_CART_BEFORE_PROCESSING,
|
42 |
+
dispatcher
|
43 |
+
),
|
44 |
+
} );
|
45 |
+
|
46 |
+
export {
|
47 |
+
EMIT_TYPES,
|
48 |
+
emitterSubscribers,
|
49 |
+
reducer,
|
50 |
+
emitEvent,
|
51 |
+
emitEventWithAbort,
|
52 |
+
};
|
assets/js/base/context/add-to-cart-form/form-state/index.js
ADDED
@@ -0,0 +1,319 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import {
|
5 |
+
createContext,
|
6 |
+
useContext,
|
7 |
+
useReducer,
|
8 |
+
useMemo,
|
9 |
+
useEffect,
|
10 |
+
} from '@wordpress/element';
|
11 |
+
import { __ } from '@wordpress/i18n';
|
12 |
+
import {
|
13 |
+
useStoreNotices,
|
14 |
+
useEmitResponse,
|
15 |
+
useShallowEqual,
|
16 |
+
} from '@woocommerce/base-hooks';
|
17 |
+
import {
|
18 |
+
productIsPurchasable,
|
19 |
+
productSupportsAddToCartForm,
|
20 |
+
} from '@woocommerce/base-utils';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Internal dependencies
|
24 |
+
*/
|
25 |
+
import { actions } from './actions';
|
26 |
+
import { reducer } from './reducer';
|
27 |
+
import { DEFAULT_STATE, STATUS } from './constants';
|
28 |
+
import {
|
29 |
+
EMIT_TYPES,
|
30 |
+
emitterSubscribers,
|
31 |
+
emitEvent,
|
32 |
+
emitEventWithAbort,
|
33 |
+
reducer as emitReducer,
|
34 |
+
} from './event-emit';
|
35 |
+
import { useValidationContext } from '../../shared/validation';
|
36 |
+
|
37 |
+
/**
|
38 |
+
* @typedef {import('@woocommerce/type-defs/add-to-cart-form').AddToCartFormDispatchActions} AddToCartFormDispatchActions
|
39 |
+
* @typedef {import('@woocommerce/type-defs/add-to-cart-form').AddToCartFormEventRegistration} AddToCartFormEventRegistration
|
40 |
+
* @typedef {import('@woocommerce/type-defs/contexts').AddToCartFormContext} AddToCartFormContext
|
41 |
+
*/
|
42 |
+
|
43 |
+
const AddToCartFormContext = createContext( {
|
44 |
+
product: {},
|
45 |
+
productType: 'simple',
|
46 |
+
productIsPurchasable: true,
|
47 |
+
productHasOptions: false,
|
48 |
+
supportsFormElements: true,
|
49 |
+
showFormElements: false,
|
50 |
+
quantity: 0,
|
51 |
+
minQuantity: 1,
|
52 |
+
maxQuantity: 99,
|
53 |
+
requestParams: {},
|
54 |
+
isIdle: false,
|
55 |
+
isDisabled: false,
|
56 |
+
isProcessing: false,
|
57 |
+
isBeforeProcessing: false,
|
58 |
+
isAfterProcessing: false,
|
59 |
+
hasError: false,
|
60 |
+
eventRegistration: {
|
61 |
+
onAddToCartAfterProcessingWithSuccess: ( callback ) => void callback,
|
62 |
+
onAddToCartAfterProcessingWithError: ( callback ) => void callback,
|
63 |
+
onAddToCartBeforeProcessing: ( callback ) => void callback,
|
64 |
+
},
|
65 |
+
dispatchActions: {
|
66 |
+
resetForm: () => void null,
|
67 |
+
submitForm: () => void null,
|
68 |
+
setQuantity: ( quantity ) => void quantity,
|
69 |
+
setHasError: ( hasError ) => void hasError,
|
70 |
+
setAfterProcessing: ( response ) => void response,
|
71 |
+
setRequestParams: ( data ) => void data,
|
72 |
+
},
|
73 |
+
} );
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @return {AddToCartFormContext} Returns the add to cart form data context value
|
77 |
+
*/
|
78 |
+
export const useAddToCartFormContext = () => {
|
79 |
+
// @ts-ignore
|
80 |
+
return useContext( AddToCartFormContext );
|
81 |
+
};
|
82 |
+
|
83 |
+
/**
|
84 |
+
* Add to cart form state provider.
|
85 |
+
*
|
86 |
+
* This provides provides an api interface exposing add to cart form state.
|
87 |
+
*
|
88 |
+
* @param {Object} props Incoming props for the provider.
|
89 |
+
* @param {Object} props.children The children being wrapped.
|
90 |
+
* @param {Object} [props.product] The product for which the form belongs to.
|
91 |
+
* @param {boolean} [props.showFormElements] Should form elements be shown.
|
92 |
+
*/
|
93 |
+
export const AddToCartFormStateContextProvider = ( {
|
94 |
+
children,
|
95 |
+
product,
|
96 |
+
showFormElements,
|
97 |
+
} ) => {
|
98 |
+
const [ addToCartFormState, dispatch ] = useReducer(
|
99 |
+
reducer,
|
100 |
+
DEFAULT_STATE
|
101 |
+
);
|
102 |
+
const [ observers, subscriber ] = useReducer( emitReducer, {} );
|
103 |
+
const currentObservers = useShallowEqual( observers );
|
104 |
+
const { addErrorNotice, removeNotices } = useStoreNotices();
|
105 |
+
const { setValidationErrors } = useValidationContext();
|
106 |
+
const {
|
107 |
+
isSuccessResponse,
|
108 |
+
isErrorResponse,
|
109 |
+
isFailResponse,
|
110 |
+
} = useEmitResponse();
|
111 |
+
|
112 |
+
/**
|
113 |
+
* @type {AddToCartFormEventRegistration}
|
114 |
+
*/
|
115 |
+
const eventRegistration = useMemo(
|
116 |
+
() => ( {
|
117 |
+
onAddToCartAfterProcessingWithSuccess: emitterSubscribers(
|
118 |
+
subscriber
|
119 |
+
).onAddToCartAfterProcessingWithSuccess,
|
120 |
+
onAddToCartAfterProcessingWithError: emitterSubscribers(
|
121 |
+
subscriber
|
122 |
+
).onAddToCartAfterProcessingWithError,
|
123 |
+
onAddToCartBeforeProcessing: emitterSubscribers( subscriber )
|
124 |
+
.onAddToCartBeforeProcessing,
|
125 |
+
} ),
|
126 |
+
[ subscriber ]
|
127 |
+
);
|
128 |
+
|
129 |
+
/**
|
130 |
+
* @type {AddToCartFormDispatchActions}
|
131 |
+
*/
|
132 |
+
const dispatchActions = useMemo(
|
133 |
+
() => ( {
|
134 |
+
resetForm: () => void dispatch( actions.setPristine() ),
|
135 |
+
submitForm: () => void dispatch( actions.setBeforeProcessing() ),
|
136 |
+
setQuantity: ( quantity ) =>
|
137 |
+
void dispatch( actions.setQuantity( quantity ) ),
|
138 |
+
setHasError: ( hasError ) =>
|
139 |
+
void dispatch( actions.setHasError( hasError ) ),
|
140 |
+
setRequestParams: ( data ) =>
|
141 |
+
void dispatch( actions.setRequestParams( data ) ),
|
142 |
+
setAfterProcessing: ( response ) => {
|
143 |
+
dispatch( actions.setProcessingResponse( response ) );
|
144 |
+
void dispatch( actions.setAfterProcessing() );
|
145 |
+
},
|
146 |
+
} ),
|
147 |
+
[]
|
148 |
+
);
|
149 |
+
|
150 |
+
/**
|
151 |
+
* This Effect is responsible for disabling or enabling the form based on the provided product.
|
152 |
+
*/
|
153 |
+
useEffect( () => {
|
154 |
+
const status = addToCartFormState.status;
|
155 |
+
const willBeDisabled =
|
156 |
+
! product.id || ! productIsPurchasable( product );
|
157 |
+
|
158 |
+
if ( status === STATUS.DISABLED && ! willBeDisabled ) {
|
159 |
+
dispatch( actions.setIdle() );
|
160 |
+
} else if ( status !== STATUS.DISABLED && willBeDisabled ) {
|
161 |
+
dispatch( actions.setDisabled() );
|
162 |
+
}
|
163 |
+
}, [ addToCartFormState.status, product, dispatch ] );
|
164 |
+
|
165 |
+
/**
|
166 |
+
* This Effect performs events before processing starts.
|
167 |
+
*/
|
168 |
+
useEffect( () => {
|
169 |
+
const status = addToCartFormState.status;
|
170 |
+
|
171 |
+
if ( status === STATUS.BEFORE_PROCESSING ) {
|
172 |
+
removeNotices( 'error' );
|
173 |
+
emitEvent(
|
174 |
+
currentObservers,
|
175 |
+
EMIT_TYPES.ADD_TO_CART_BEFORE_PROCESSING,
|
176 |
+
{}
|
177 |
+
).then( ( response ) => {
|
178 |
+
if ( response !== true ) {
|
179 |
+
if ( Array.isArray( response ) ) {
|
180 |
+
response.forEach(
|
181 |
+
( { errorMessage, validationErrors } ) => {
|
182 |
+
if ( errorMessage ) {
|
183 |
+
addErrorNotice( errorMessage );
|
184 |
+
}
|
185 |
+
if ( validationErrors ) {
|
186 |
+
setValidationErrors( validationErrors );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
);
|
190 |
+
}
|
191 |
+
dispatch( actions.setIdle() );
|
192 |
+
} else {
|
193 |
+
dispatch( actions.setProcessing() );
|
194 |
+
}
|
195 |
+
} );
|
196 |
+
}
|
197 |
+
}, [
|
198 |
+
addToCartFormState.status,
|
199 |
+
setValidationErrors,
|
200 |
+
addErrorNotice,
|
201 |
+
removeNotices,
|
202 |
+
dispatch,
|
203 |
+
currentObservers,
|
204 |
+
] );
|
205 |
+
|
206 |
+
/**
|
207 |
+
* This Effect performs events after processing is complete.
|
208 |
+
*/
|
209 |
+
useEffect( () => {
|
210 |
+
if ( addToCartFormState.status === STATUS.AFTER_PROCESSING ) {
|
211 |
+
const data = {
|
212 |
+
processingResponse: addToCartFormState.processingResponse,
|
213 |
+
};
|
214 |
+
|
215 |
+
const handleErrorResponse = ( response ) => {
|
216 |
+
if ( response.message ) {
|
217 |
+
const errorOptions = response.messageContext
|
218 |
+
? { context: response.messageContext }
|
219 |
+
: undefined;
|
220 |
+
addErrorNotice( response.message, errorOptions );
|
221 |
+
}
|
222 |
+
};
|
223 |
+
|
224 |
+
if ( addToCartFormState.hasError ) {
|
225 |
+
// allow things to customize the error with a fallback if nothing customizes it.
|
226 |
+
emitEventWithAbort(
|
227 |
+
currentObservers,
|
228 |
+
EMIT_TYPES.ADD_TO_CART_AFTER_PROCESSING_WITH_ERROR,
|
229 |
+
data
|
230 |
+
).then( ( response ) => {
|
231 |
+
if (
|
232 |
+
isErrorResponse( response ) ||
|
233 |
+
isFailResponse( response )
|
234 |
+
) {
|
235 |
+
handleErrorResponse( response );
|
236 |
+
} else {
|
237 |
+
// no error handling in place by anything so let's fall back to default
|
238 |
+
const message =
|
239 |
+
data.processingResponse?.message ||
|
240 |
+
__(
|
241 |
+
'Something went wrong. Please contact us to get assistance.',
|
242 |
+
'woo-gutenberg-products-block'
|
243 |
+
);
|
244 |
+
addErrorNotice( message, {
|
245 |
+
id: 'add-to-cart',
|
246 |
+
} );
|
247 |
+
}
|
248 |
+
dispatch( actions.setIdle() );
|
249 |
+
} );
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
|
253 |
+
emitEventWithAbort(
|
254 |
+
currentObservers,
|
255 |
+
EMIT_TYPES.ADD_TO_CART_AFTER_PROCESSING_WITH_SUCCESS,
|
256 |
+
data
|
257 |
+
).then( ( response ) => {
|
258 |
+
if (
|
259 |
+
isErrorResponse( response ) ||
|
260 |
+
isFailResponse( response )
|
261 |
+
) {
|
262 |
+
handleErrorResponse( response );
|
263 |
+
// this will set an error which will end up
|
264 |
+
// triggering the onAddToCartAfterProcessingWithError emitter.
|
265 |
+
// and then setting to IDLE state.
|
266 |
+
dispatch( actions.setHasError( true ) );
|
267 |
+
} else {
|
268 |
+
dispatch( actions.setIdle() );
|
269 |
+
}
|
270 |
+
} );
|
271 |
+
}
|
272 |
+
}, [
|
273 |
+
addToCartFormState.status,
|
274 |
+
addToCartFormState.hasError,
|
275 |
+
addToCartFormState.processingResponse,
|
276 |
+
dispatchActions,
|
277 |
+
addErrorNotice,
|
278 |
+
isErrorResponse,
|
279 |
+
isFailResponse,
|
280 |
+
isSuccessResponse,
|
281 |
+
currentObservers,
|
282 |
+
] );
|
283 |
+
|
284 |
+
const supportsFormElements = productSupportsAddToCartForm( product );
|
285 |
+
|
286 |
+
/**
|
287 |
+
* @type {AddToCartFormContext}
|
288 |
+
*/
|
289 |
+
const contextData = {
|
290 |
+
product,
|
291 |
+
productType: product.type || 'simple',
|
292 |
+
productIsPurchasable: productIsPurchasable( product ),
|
293 |
+
productHasOptions: product.has_options || false,
|
294 |
+
supportsFormElements,
|
295 |
+
showFormElements: showFormElements && supportsFormElements,
|
296 |
+
quantity: addToCartFormState.quantity,
|
297 |
+
minQuantity: 1,
|
298 |
+
maxQuantity: product.quantity_limit || 99,
|
299 |
+
requestParams: addToCartFormState.requestParams,
|
300 |
+
isIdle: addToCartFormState.status === STATUS.IDLE,
|
301 |
+
isDisabled: addToCartFormState.status === STATUS.DISABLED,
|
302 |
+
isProcessing: addToCartFormState.status === STATUS.PROCESSING,
|
303 |
+
isBeforeProcessing:
|
304 |
+
addToCartFormState.status === STATUS.BEFORE_PROCESSING,
|
305 |
+
isAfterProcessing:
|
306 |
+
addToCartFormState.status === STATUS.AFTER_PROCESSING,
|
307 |
+
hasError: addToCartFormState.hasError,
|
308 |
+
eventRegistration,
|
309 |
+
dispatchActions,
|
310 |
+
};
|
311 |
+
return (
|
312 |
+
<AddToCartFormContext.Provider
|
313 |
+
// @ts-ignore
|
314 |
+
value={ contextData }
|
315 |
+
>
|
316 |
+
{ children }
|
317 |
+
</AddToCartFormContext.Provider>
|
318 |
+
);
|
319 |
+
};
|
assets/js/base/context/add-to-cart-form/form-state/reducer.js
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { ACTION_TYPES, DEFAULT_STATE, STATUS } from './constants';
|
5 |
+
|
6 |
+
const {
|
7 |
+
SET_PRISTINE,
|
8 |
+
SET_IDLE,
|
9 |
+
SET_DISABLED,
|
10 |
+
SET_PROCESSING,
|
11 |
+
SET_BEFORE_PROCESSING,
|
12 |
+
SET_AFTER_PROCESSING,
|
13 |
+
SET_PROCESSING_RESPONSE,
|
14 |
+
SET_HAS_ERROR,
|
15 |
+
SET_NO_ERROR,
|
16 |
+
SET_QUANTITY,
|
17 |
+
SET_REQUEST_PARAMS,
|
18 |
+
} = ACTION_TYPES;
|
19 |
+
|
20 |
+
const {
|
21 |
+
PRISTINE,
|
22 |
+
IDLE,
|
23 |
+
DISABLED,
|
24 |
+
PROCESSING,
|
25 |
+
BEFORE_PROCESSING,
|
26 |
+
AFTER_PROCESSING,
|
27 |
+
} = STATUS;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Reducer for the checkout state
|
31 |
+
*
|
32 |
+
* @param {Object} state Current state.
|
33 |
+
* @param {Object} action Incoming action object.
|
34 |
+
*/
|
35 |
+
export const reducer = ( state = DEFAULT_STATE, { quantity, type, data } ) => {
|
36 |
+
let newState;
|
37 |
+
switch ( type ) {
|
38 |
+
case SET_PRISTINE:
|
39 |
+
newState = DEFAULT_STATE;
|
40 |
+
break;
|
41 |
+
case SET_IDLE:
|
42 |
+
newState =
|
43 |
+
state.status !== IDLE
|
44 |
+
? {
|
45 |
+
...state,
|
46 |
+
status: IDLE,
|
47 |
+
}
|
48 |
+
: state;
|
49 |
+
break;
|
50 |
+
case SET_DISABLED:
|
51 |
+
newState =
|
52 |
+
state.status !== DISABLED
|
53 |
+
? {
|
54 |
+
...state,
|
55 |
+
status: DISABLED,
|
56 |
+
}
|
57 |
+
: state;
|
58 |
+
break;
|
59 |
+
case SET_QUANTITY:
|
60 |
+
newState =
|
61 |
+
quantity !== state.quantity
|
62 |
+
? {
|
63 |
+
...state,
|
64 |
+
quantity,
|
65 |
+
}
|
66 |
+
: state;
|
67 |
+
break;
|
68 |
+
case SET_REQUEST_PARAMS:
|
69 |
+
newState = {
|
70 |
+
...state,
|
71 |
+
requestParams: {
|
72 |
+
...state.requestParams,
|
73 |
+
...data,
|
74 |
+
},
|
75 |
+
};
|
76 |
+
break;
|
77 |
+
case SET_PROCESSING_RESPONSE:
|
78 |
+
newState = {
|
79 |
+
...state,
|
80 |
+
processingResponse: data,
|
81 |
+
};
|
82 |
+
break;
|
83 |
+
case SET_PROCESSING:
|
84 |
+
newState =
|
85 |
+
state.status !== PROCESSING
|
86 |
+
? {
|
87 |
+
...state,
|
88 |
+
status: PROCESSING,
|
89 |
+
hasError: false,
|
90 |
+
}
|
91 |
+
: state;
|
92 |
+
// clear any error state.
|
93 |
+
newState =
|
94 |
+
newState.hasError === false
|
95 |
+
? newState
|
96 |
+
: { ...newState, hasError: false };
|
97 |
+
break;
|
98 |
+
case SET_BEFORE_PROCESSING:
|
99 |
+
newState =
|
100 |
+
state.status !== BEFORE_PROCESSING
|
101 |
+
? {
|
102 |
+
...state,
|
103 |
+
status: BEFORE_PROCESSING,
|
104 |
+
hasError: false,
|
105 |
+
}
|
106 |
+
: state;
|
107 |
+
break;
|
108 |
+
case SET_AFTER_PROCESSING:
|
109 |
+
newState =
|
110 |
+
state.status !== AFTER_PROCESSING
|
111 |
+
? {
|
112 |
+
...state,
|
113 |
+
status: AFTER_PROCESSING,
|
114 |
+
}
|
115 |
+
: state;
|
116 |
+
break;
|
117 |
+
case SET_HAS_ERROR:
|
118 |
+
newState = state.hasError
|
119 |
+
? state
|
120 |
+
: {
|
121 |
+
...state,
|
122 |
+
hasError: true,
|
123 |
+
};
|
124 |
+
newState =
|
125 |
+
state.status === PROCESSING ||
|
126 |
+
state.status === BEFORE_PROCESSING
|
127 |
+
? {
|
128 |
+
...newState,
|
129 |
+
status: IDLE,
|
130 |
+
}
|
131 |
+
: newState;
|
132 |
+
break;
|
133 |
+
case SET_NO_ERROR:
|
134 |
+
newState = state.hasError
|
135 |
+
? {
|
136 |
+
...state,
|
137 |
+
hasError: false,
|
138 |
+
}
|
139 |
+
: state;
|
140 |
+
break;
|
141 |
+
}
|
142 |
+
// automatically update state to idle from pristine as soon as it initially changes.
|
143 |
+
if (
|
144 |
+
newState !== state &&
|
145 |
+
type !== SET_PRISTINE &&
|
146 |
+
newState.status === PRISTINE
|
147 |
+
) {
|
148 |
+
newState.status = IDLE;
|
149 |
+
}
|
150 |
+
return newState;
|
151 |
+
};
|
assets/js/base/context/add-to-cart-form/form/index.js
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { ValidationContextProvider } from '@woocommerce/base-context';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import { AddToCartFormStateContextProvider } from '../form-state';
|
10 |
+
import FormSubmit from './submit';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Add to cart form provider.
|
14 |
+
*
|
15 |
+
* This wraps the add to cart form and provides an api interface for children via various hooks.
|
16 |
+
*
|
17 |
+
* @param {Object} props Incoming props for the provider.
|
18 |
+
* @param {Object} props.children The children being wrapped.
|
19 |
+
* @param {Object} [props.product] The product for which the form belongs to.
|
20 |
+
* @param {boolean} [props.showFormElements] Should form elements be shown.
|
21 |
+
*/
|
22 |
+
export const AddToCartFormContextProvider = ( {
|
23 |
+
children,
|
24 |
+
product,
|
25 |
+
showFormElements,
|
26 |
+
} ) => {
|
27 |
+
return (
|
28 |
+
<ValidationContextProvider>
|
29 |
+
<AddToCartFormStateContextProvider
|
30 |
+
product={ product }
|
31 |
+
showFormElements={ showFormElements }
|
32 |
+
>
|
33 |
+
{ children }
|
34 |
+
<FormSubmit />
|
35 |
+
</AddToCartFormStateContextProvider>
|
36 |
+
</ValidationContextProvider>
|
37 |
+
);
|
38 |
+
};
|
assets/js/base/context/add-to-cart-form/form/submit/index.js
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import triggerFetch from '@wordpress/api-fetch';
|
6 |
+
import {
|
7 |
+
useAddToCartFormContext,
|
8 |
+
useValidationContext,
|
9 |
+
} from '@woocommerce/base-context';
|
10 |
+
import { useEffect, useCallback, useState } from '@wordpress/element';
|
11 |
+
import { useStoreCart, useStoreNotices } from '@woocommerce/base-hooks';
|
12 |
+
import { decodeEntities } from '@wordpress/html-entities';
|
13 |
+
import { triggerFragmentRefresh } from '@woocommerce/base-utils';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* FormSubmit.
|
17 |
+
*
|
18 |
+
* Subscribes to add to cart form context and triggers processing via the API.
|
19 |
+
*/
|
20 |
+
const FormSubmit = () => {
|
21 |
+
const {
|
22 |
+
dispatchActions,
|
23 |
+
product,
|
24 |
+
quantity,
|
25 |
+
eventRegistration,
|
26 |
+
hasError,
|
27 |
+
isProcessing,
|
28 |
+
requestParams,
|
29 |
+
} = useAddToCartFormContext();
|
30 |
+
const {
|
31 |
+
hasValidationErrors,
|
32 |
+
showAllValidationErrors,
|
33 |
+
} = useValidationContext();
|
34 |
+
const { addErrorNotice, removeNotice } = useStoreNotices();
|
35 |
+
const { receiveCart } = useStoreCart();
|
36 |
+
const [ isSubmitting, setIsSubmitting ] = useState( false );
|
37 |
+
const doSubmit = ! hasError && isProcessing;
|
38 |
+
|
39 |
+
const checkValidationContext = useCallback( () => {
|
40 |
+
if ( hasValidationErrors ) {
|
41 |
+
showAllValidationErrors();
|
42 |
+
return {
|
43 |
+
type: 'error',
|
44 |
+
};
|
45 |
+
}
|
46 |
+
return true;
|
47 |
+
}, [ hasValidationErrors, showAllValidationErrors ] );
|
48 |
+
|
49 |
+
// Subscribe to emitter before processing.
|
50 |
+
useEffect( () => {
|
51 |
+
const unsubscribeProcessing = eventRegistration.onAddToCartBeforeProcessing(
|
52 |
+
checkValidationContext,
|
53 |
+
0
|
54 |
+
);
|
55 |
+
return () => {
|
56 |
+
unsubscribeProcessing();
|
57 |
+
};
|
58 |
+
}, [ eventRegistration, checkValidationContext ] );
|
59 |
+
|
60 |
+
// Triggers form submission to the API.
|
61 |
+
const submitFormCallback = useCallback( () => {
|
62 |
+
setIsSubmitting( true );
|
63 |
+
removeNotice( 'add-to-cart' );
|
64 |
+
|
65 |
+
const fetchData = {
|
66 |
+
id: product.id || 0,
|
67 |
+
quantity,
|
68 |
+
...requestParams,
|
69 |
+
};
|
70 |
+
|
71 |
+
triggerFetch( {
|
72 |
+
path: '/wc/store/cart/add-item',
|
73 |
+
method: 'POST',
|
74 |
+
data: fetchData,
|
75 |
+
cache: 'no-store',
|
76 |
+
parse: false,
|
77 |
+
} )
|
78 |
+
.then( ( fetchResponse ) => {
|
79 |
+
// Update nonce.
|
80 |
+
triggerFetch.setNonce( fetchResponse.headers );
|
81 |
+
|
82 |
+
// Handle response.
|
83 |
+
fetchResponse.json().then( function( response ) {
|
84 |
+
if ( ! fetchResponse.ok ) {
|
85 |
+
// We received an error response.
|
86 |
+
if ( response.body && response.body.message ) {
|
87 |
+
addErrorNotice(
|
88 |
+
decodeEntities( response.body.message ),
|
89 |
+
{
|
90 |
+
id: 'add-to-cart',
|
91 |
+
}
|
92 |
+
);
|
93 |
+
} else {
|
94 |
+
addErrorNotice(
|
95 |
+
__(
|
96 |
+
'Something went wrong. Please contact us to get assistance.',
|
97 |
+
'woo-gutenberg-products-block'
|
98 |
+
),
|
99 |
+
{
|
100 |
+
id: 'add-to-cart',
|
101 |
+
}
|
102 |
+
);
|
103 |
+
}
|
104 |
+
dispatchActions.setHasError();
|
105 |
+
} else {
|
106 |
+
receiveCart( response );
|
107 |
+
}
|
108 |
+
dispatchActions.setAfterProcessing( response );
|
109 |
+
setIsSubmitting( false );
|
110 |
+
triggerFragmentRefresh();
|
111 |
+
} );
|
112 |
+
} )
|
113 |
+
.catch( ( error ) => {
|
114 |
+
error.json().then( function( response ) {
|
115 |
+
// If updated cart state was returned, also update that.
|
116 |
+
if ( response.data?.cart ) {
|
117 |
+
receiveCart( response.data.cart );
|
118 |
+
}
|
119 |
+
dispatchActions.setHasError();
|
120 |
+
dispatchActions.setAfterProcessing( response );
|
121 |
+
setIsSubmitting( false );
|
122 |
+
} );
|
123 |
+
} );
|
124 |
+
}, [
|
125 |
+
product,
|
126 |
+
addErrorNotice,
|
127 |
+
removeNotice,
|
128 |
+
receiveCart,
|
129 |
+
dispatchActions,
|
130 |
+
quantity,
|
131 |
+
requestParams,
|
132 |
+
] );
|
133 |
+
|
134 |
+
useEffect( () => {
|
135 |
+
if ( doSubmit && ! isSubmitting ) {
|
136 |
+
submitFormCallback();
|
137 |
+
}
|
138 |
+
}, [ doSubmit, submitFormCallback, isSubmitting ] );
|
139 |
+
|
140 |
+
return null;
|
141 |
+
};
|
142 |
+
|
143 |
+
export default FormSubmit;
|
assets/js/base/context/add-to-cart-form/index.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
export * from './form';
|
2 |
+
export * from './form-state';
|
assets/js/base/context/cart-checkout/checkout-state/actions.js
CHANGED
@@ -17,6 +17,7 @@ const {
|
|
17 |
INCREMENT_CALCULATING,
|
18 |
DECREMENT_CALCULATING,
|
19 |
SET_ORDER_ID,
|
|
|
20 |
} = TYPES;
|
21 |
|
22 |
/**
|
@@ -64,4 +65,8 @@ export const actions = {
|
|
64 |
type: SET_ORDER_ID,
|
65 |
orderId,
|
66 |
} ),
|
|
|
|
|
|
|
|
|
67 |
};
|
17 |
INCREMENT_CALCULATING,
|
18 |
DECREMENT_CALCULATING,
|
19 |
SET_ORDER_ID,
|
20 |
+
SET_ORDER_NOTES,
|
21 |
} = TYPES;
|
22 |
|
23 |
/**
|
65 |
type: SET_ORDER_ID,
|
66 |
orderId,
|
67 |
} ),
|
68 |
+
setOrderNotes: ( orderNotes ) => ( {
|
69 |
+
type: SET_ORDER_NOTES,
|
70 |
+
orderNotes,
|
71 |
+
} ),
|
72 |
};
|
assets/js/base/context/cart-checkout/checkout-state/constants.js
CHANGED
@@ -26,6 +26,7 @@ export const DEFAULT_STATE = {
|
|
26 |
hasError: false,
|
27 |
calculatingCount: 0,
|
28 |
orderId: checkoutData.order_id,
|
|
|
29 |
customerId: checkoutData.customer_id,
|
30 |
processingResponse: null,
|
31 |
};
|
@@ -42,6 +43,7 @@ export const TYPES = {
|
|
42 |
SET_HAS_ERROR: 'set_checkout_has_error',
|
43 |
SET_NO_ERROR: 'set_checkout_no_error',
|
44 |
SET_ORDER_ID: 'set_checkout_order_id',
|
|
|
45 |
INCREMENT_CALCULATING: 'increment_calculating',
|
46 |
DECREMENT_CALCULATING: 'decrement_calculating',
|
47 |
};
|
26 |
hasError: false,
|
27 |
calculatingCount: 0,
|
28 |
orderId: checkoutData.order_id,
|
29 |
+
orderNotes: '',
|
30 |
customerId: checkoutData.customer_id,
|
31 |
processingResponse: null,
|
32 |
};
|
43 |
SET_HAS_ERROR: 'set_checkout_has_error',
|
44 |
SET_NO_ERROR: 'set_checkout_no_error',
|
45 |
SET_ORDER_ID: 'set_checkout_order_id',
|
46 |
+
SET_ORDER_NOTES: 'set_checkout_order_notes',
|
47 |
INCREMENT_CALCULATING: 'increment_calculating',
|
48 |
DECREMENT_CALCULATING: 'decrement_calculating',
|
49 |
};
|
assets/js/base/context/cart-checkout/checkout-state/event-emit.js
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6 |
reducer,
|
7 |
emitEvent,
|
8 |
emitEventWithAbort,
|
9 |
-
} from '
|
10 |
|
11 |
const EMIT_TYPES = {
|
12 |
CHECKOUT_BEFORE_PROCESSING: 'checkout_before_processing',
|
6 |
reducer,
|
7 |
emitEvent,
|
8 |
emitEventWithAbort,
|
9 |
+
} from '../../shared/event-emit';
|
10 |
|
11 |
const EMIT_TYPES = {
|
12 |
CHECKOUT_BEFORE_PROCESSING: 'checkout_before_processing',
|
assets/js/base/context/cart-checkout/checkout-state/index.js
CHANGED
@@ -26,7 +26,7 @@ import {
|
|
26 |
emitEventWithAbort,
|
27 |
reducer as emitReducer,
|
28 |
} from './event-emit';
|
29 |
-
import { useValidationContext } from '
|
30 |
|
31 |
/**
|
32 |
* @typedef {import('@woocommerce/type-defs/checkout').CheckoutDispatchActions} CheckoutDispatchActions
|
@@ -43,6 +43,7 @@ const CheckoutContext = createContext( {
|
|
43 |
hasError: false,
|
44 |
redirectUrl: '',
|
45 |
orderId: 0,
|
|
|
46 |
customerId: 0,
|
47 |
onSubmit: () => void null,
|
48 |
onCheckoutAfterProcessingWithSuccess: ( callback ) => void callback,
|
@@ -56,6 +57,7 @@ const CheckoutContext = createContext( {
|
|
56 |
incrementCalculating: () => void null,
|
57 |
decrementCalculating: () => void null,
|
58 |
setOrderId: ( id ) => void id,
|
|
|
59 |
},
|
60 |
hasOrder: false,
|
61 |
isCart: false,
|
@@ -137,6 +139,8 @@ export const CheckoutStateProvider = ( {
|
|
137 |
void dispatch( actions.decrementCalculating() ),
|
138 |
setOrderId: ( orderId ) =>
|
139 |
void dispatch( actions.setOrderId( orderId ) ),
|
|
|
|
|
140 |
setAfterProcessing: ( response ) => {
|
141 |
// capture general error message if this is an error response.
|
142 |
if (
|
@@ -330,6 +334,7 @@ export const CheckoutStateProvider = ( {
|
|
330 |
orderId: checkoutState.orderId,
|
331 |
hasOrder: !! checkoutState.orderId,
|
332 |
customerId: checkoutState.customerId,
|
|
|
333 |
};
|
334 |
return (
|
335 |
<CheckoutContext.Provider value={ checkoutData }>
|
26 |
emitEventWithAbort,
|
27 |
reducer as emitReducer,
|
28 |
} from './event-emit';
|
29 |
+
import { useValidationContext } from '../../shared/validation';
|
30 |
|
31 |
/**
|
32 |
* @typedef {import('@woocommerce/type-defs/checkout').CheckoutDispatchActions} CheckoutDispatchActions
|
43 |
hasError: false,
|
44 |
redirectUrl: '',
|
45 |
orderId: 0,
|
46 |
+
orderNotes: '',
|
47 |
customerId: 0,
|
48 |
onSubmit: () => void null,
|
49 |
onCheckoutAfterProcessingWithSuccess: ( callback ) => void callback,
|
57 |
incrementCalculating: () => void null,
|
58 |
decrementCalculating: () => void null,
|
59 |
setOrderId: ( id ) => void id,
|
60 |
+
setOrderNotes: ( orderNotes ) => void orderNotes,
|
61 |
},
|
62 |
hasOrder: false,
|
63 |
isCart: false,
|
139 |
void dispatch( actions.decrementCalculating() ),
|
140 |
setOrderId: ( orderId ) =>
|
141 |
void dispatch( actions.setOrderId( orderId ) ),
|
142 |
+
setOrderNotes: ( orderNotes ) =>
|
143 |
+
void dispatch( actions.setOrderNotes( orderNotes ) ),
|
144 |
setAfterProcessing: ( response ) => {
|
145 |
// capture general error message if this is an error response.
|
146 |
if (
|
334 |
orderId: checkoutState.orderId,
|
335 |
hasOrder: !! checkoutState.orderId,
|
336 |
customerId: checkoutState.customerId,
|
337 |
+
orderNotes: checkoutState.orderNotes,
|
338 |
};
|
339 |
return (
|
340 |
<CheckoutContext.Provider value={ checkoutData }>
|
assets/js/base/context/cart-checkout/checkout-state/reducer.js
CHANGED
@@ -17,6 +17,7 @@ const {
|
|
17 |
INCREMENT_CALCULATING,
|
18 |
DECREMENT_CALCULATING,
|
19 |
SET_ORDER_ID,
|
|
|
20 |
} = TYPES;
|
21 |
|
22 |
const {
|
@@ -66,9 +67,9 @@ export const prepareResponseData = ( data ) => {
|
|
66 |
*/
|
67 |
export const reducer = (
|
68 |
state = DEFAULT_STATE,
|
69 |
-
{ url, type, orderId, data }
|
70 |
) => {
|
71 |
-
let newState;
|
72 |
switch ( type ) {
|
73 |
case SET_PRISTINE:
|
74 |
newState = DEFAULT_STATE;
|
@@ -184,6 +185,14 @@ export const reducer = (
|
|
184 |
orderId,
|
185 |
};
|
186 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
}
|
188 |
// automatically update state to idle from pristine as soon as it
|
189 |
// initially changes.
|
17 |
INCREMENT_CALCULATING,
|
18 |
DECREMENT_CALCULATING,
|
19 |
SET_ORDER_ID,
|
20 |
+
SET_ORDER_NOTES,
|
21 |
} = TYPES;
|
22 |
|
23 |
const {
|
67 |
*/
|
68 |
export const reducer = (
|
69 |
state = DEFAULT_STATE,
|
70 |
+
{ url, type, orderId, orderNotes, data }
|
71 |
) => {
|
72 |
+
let newState = state;
|
73 |
switch ( type ) {
|
74 |
case SET_PRISTINE:
|
75 |
newState = DEFAULT_STATE;
|
185 |
orderId,
|
186 |
};
|
187 |
break;
|
188 |
+
case SET_ORDER_NOTES:
|
189 |
+
if ( state.orderNotes !== orderNotes ) {
|
190 |
+
newState = {
|
191 |
+
...state,
|
192 |
+
orderNotes,
|
193 |
+
};
|
194 |
+
}
|
195 |
+
break;
|
196 |
}
|
197 |
// automatically update state to idle from pristine as soon as it
|
198 |
// initially changes.
|
assets/js/base/context/cart-checkout/checkout/processor/index.js
CHANGED
@@ -62,6 +62,7 @@ const CheckoutProcessor = () => {
|
|
62 |
isProcessing: checkoutIsProcessing,
|
63 |
isBeforeProcessing: checkoutIsBeforeProcessing,
|
64 |
isComplete: checkoutIsComplete,
|
|
|
65 |
} = useCheckoutContext();
|
66 |
const { hasValidationErrors } = useValidationContext();
|
67 |
const { shippingAddress, shippingErrorStatus } = useShippingDataContext();
|
@@ -186,7 +187,7 @@ const CheckoutProcessor = () => {
|
|
186 |
let data = {
|
187 |
billing_address: currentBillingData.current,
|
188 |
shipping_address: currentShippingAddress.current,
|
189 |
-
customer_note:
|
190 |
};
|
191 |
if ( cartNeedsPayment ) {
|
192 |
data = {
|
@@ -256,6 +257,7 @@ const CheckoutProcessor = () => {
|
|
256 |
cartNeedsPayment,
|
257 |
receiveCart,
|
258 |
dispatchActions,
|
|
|
259 |
] );
|
260 |
// redirect when checkout is complete and there is a redirect url.
|
261 |
useEffect( () => {
|
62 |
isProcessing: checkoutIsProcessing,
|
63 |
isBeforeProcessing: checkoutIsBeforeProcessing,
|
64 |
isComplete: checkoutIsComplete,
|
65 |
+
orderNotes,
|
66 |
} = useCheckoutContext();
|
67 |
const { hasValidationErrors } = useValidationContext();
|
68 |
const { shippingAddress, shippingErrorStatus } = useShippingDataContext();
|
187 |
let data = {
|
188 |
billing_address: currentBillingData.current,
|
189 |
shipping_address: currentShippingAddress.current,
|
190 |
+
customer_note: orderNotes,
|
191 |
};
|
192 |
if ( cartNeedsPayment ) {
|
193 |
data = {
|
257 |
cartNeedsPayment,
|
258 |
receiveCart,
|
259 |
dispatchActions,
|
260 |
+
orderNotes,
|
261 |
] );
|
262 |
// redirect when checkout is complete and there is a redirect url.
|
263 |
useEffect( () => {
|
assets/js/base/context/cart-checkout/index.js
CHANGED
@@ -3,5 +3,4 @@ export * from './shipping';
|
|
3 |
export * from './billing';
|
4 |
export * from './checkout';
|
5 |
export * from './cart';
|
6 |
-
export * from './validation';
|
7 |
export { useCheckoutContext } from './checkout-state';
|
3 |
export * from './billing';
|
4 |
export * from './checkout';
|
5 |
export * from './cart';
|
|
|
6 |
export { useCheckoutContext } from './checkout-state';
|
assets/js/base/context/cart-checkout/payment-methods/event-emit.js
CHANGED
@@ -6,7 +6,7 @@ import {
|
|
6 |
emitEvent,
|
7 |
emitEventWithAbort,
|
8 |
emitterCallback,
|
9 |
-
} from '
|
10 |
|
11 |
const EMIT_TYPES = {
|
12 |
PAYMENT_PROCESSING: 'payment_processing',
|
6 |
emitEvent,
|
7 |
emitEventWithAbort,
|
8 |
emitterCallback,
|
9 |
+
} from '../../shared/event-emit';
|
10 |
|
11 |
const EMIT_TYPES = {
|
12 |
PAYMENT_PROCESSING: 'payment_processing',
|
assets/js/base/context/cart-checkout/payment-methods/payment-method-data-context.js
CHANGED
@@ -46,7 +46,7 @@ import {
|
|
46 |
emitEventWithAbort,
|
47 |
reducer as emitReducer,
|
48 |
} from './event-emit';
|
49 |
-
import { useValidationContext } from '
|
50 |
|
51 |
/**
|
52 |
* @typedef {import('@woocommerce/type-defs/contexts').PaymentMethodDataContext} PaymentMethodDataContext
|
@@ -77,6 +77,33 @@ export const usePaymentMethodDataContext = () => {
|
|
77 |
return useContext( PaymentMethodDataContext );
|
78 |
};
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
/**
|
81 |
* PaymentMethodDataProvider is automatically included in the
|
82 |
* CheckoutDataProvider.
|
@@ -107,10 +134,6 @@ export const PaymentMethodDataProvider = ( { children } ) => {
|
|
107 |
const currentObservers = useRef( observers );
|
108 |
|
109 |
const { isEditor, previewData } = useEditorContext();
|
110 |
-
const customerPaymentMethods =
|
111 |
-
isEditor && previewData?.previewSavedPaymentMethods
|
112 |
-
? previewData?.previewSavedPaymentMethods
|
113 |
-
: getSetting( 'customerPaymentMethods', {} );
|
114 |
const [ paymentData, dispatch ] = useReducer(
|
115 |
reducer,
|
116 |
DEFAULT_PAYMENT_DATA
|
@@ -150,6 +173,24 @@ export const PaymentMethodDataProvider = ( { children } ) => {
|
|
150 |
[ dispatch ]
|
151 |
);
|
152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
const setExpressPaymentError = useCallback(
|
154 |
( message ) => {
|
155 |
if ( message ) {
|
46 |
emitEventWithAbort,
|
47 |
reducer as emitReducer,
|
48 |
} from './event-emit';
|
49 |
+
import { useValidationContext } from '../../shared/validation';
|
50 |
|
51 |
/**
|
52 |
* @typedef {import('@woocommerce/type-defs/contexts').PaymentMethodDataContext} PaymentMethodDataContext
|
77 |
return useContext( PaymentMethodDataContext );
|
78 |
};
|
79 |
|
80 |
+
/**
|
81 |
+
* Gets the payment methods saved for the current user after filtering out
|
82 |
+
* disabled ones.
|
83 |
+
*
|
84 |
+
* @param {Object[]} availablePaymentMethods List of available payment methods.
|
85 |
+
* @return {Object} Object containing the payment methods saved for a specific
|
86 |
+
* user which are available.
|
87 |
+
*/
|
88 |
+
const getCustomerPaymentMethods = ( availablePaymentMethods = [] ) => {
|
89 |
+
const customerPaymentMethods = getSetting( 'customerPaymentMethods', {} );
|
90 |
+
const paymentMethodKeys = Object.keys( customerPaymentMethods );
|
91 |
+
if ( paymentMethodKeys.length === 0 ) {
|
92 |
+
return {};
|
93 |
+
}
|
94 |
+
const enabledCustomerPaymentMethods = {};
|
95 |
+
paymentMethodKeys.forEach( ( type ) => {
|
96 |
+
enabledCustomerPaymentMethods[ type ] = customerPaymentMethods[
|
97 |
+
type
|
98 |
+
].filter( ( paymentMethod ) => {
|
99 |
+
return Object.keys( availablePaymentMethods ).includes(
|
100 |
+
paymentMethod.method.gateway
|
101 |
+
);
|
102 |
+
} );
|
103 |
+
} );
|
104 |
+
return enabledCustomerPaymentMethods;
|
105 |
+
};
|
106 |
+
|
107 |
/**
|
108 |
* PaymentMethodDataProvider is automatically included in the
|
109 |
* CheckoutDataProvider.
|
134 |
const currentObservers = useRef( observers );
|
135 |
|
136 |
const { isEditor, previewData } = useEditorContext();
|
|
|
|
|
|
|
|
|
137 |
const [ paymentData, dispatch ] = useReducer(
|
138 |
reducer,
|
139 |
DEFAULT_PAYMENT_DATA
|
173 |
[ dispatch ]
|
174 |
);
|
175 |
|
176 |
+
const customerPaymentMethods = useMemo( () => {
|
177 |
+
if ( isEditor && previewData.previewSavedPaymentMethods ) {
|
178 |
+
return previewData.previewSavedPaymentMethods;
|
179 |
+
}
|
180 |
+
if (
|
181 |
+
! paymentMethodsInitialized ||
|
182 |
+
paymentData.paymentMethods.length === 0
|
183 |
+
) {
|
184 |
+
return {};
|
185 |
+
}
|
186 |
+
return getCustomerPaymentMethods( paymentData.paymentMethods );
|
187 |
+
}, [
|
188 |
+
isEditor,
|
189 |
+
previewData.previewSavedPaymentMethods,
|
190 |
+
paymentMethodsInitialized,
|
191 |
+
paymentData.paymentMethods,
|
192 |
+
] );
|
193 |
+
|
194 |
const setExpressPaymentError = useCallback(
|
195 |
( message ) => {
|
196 |
if ( message ) {
|
assets/js/base/context/cart-checkout/payment-methods/use-payment-method-registration.js
CHANGED
@@ -12,7 +12,10 @@ import {
|
|
12 |
useShippingDataContext,
|
13 |
} from '@woocommerce/base-context';
|
14 |
import { useStoreCart, useShallowEqual } from '@woocommerce/base-hooks';
|
15 |
-
import {
|
|
|
|
|
|
|
16 |
|
17 |
/**
|
18 |
* If there was an error registering a payment method, alert the admin.
|
@@ -44,18 +47,23 @@ const handleRegistrationError = ( error ) => {
|
|
44 |
* state.
|
45 |
* @param {Object} registeredPaymentMethods Registered payment methods to
|
46 |
* process.
|
|
|
|
|
|
|
47 |
*
|
48 |
* @return {boolean} Whether the payment methods have been initialized or not. True when all payment
|
49 |
* methods have been initialized.
|
50 |
*/
|
51 |
const usePaymentMethodRegistration = (
|
52 |
dispatcher,
|
53 |
-
registeredPaymentMethods
|
|
|
54 |
) => {
|
55 |
const [ isInitialized, setIsInitialized ] = useState( false );
|
56 |
const { isEditor } = useEditorContext();
|
57 |
const { selectedRates, shippingAddress } = useShippingDataContext();
|
58 |
const selectedShippingMethods = useShallowEqual( selectedRates );
|
|
|
59 |
const { cartTotals, cartNeedsShipping } = useStoreCart();
|
60 |
const canPayArgument = useRef( {
|
61 |
cartTotals,
|
@@ -86,8 +94,13 @@ const usePaymentMethodRegistration = (
|
|
86 |
[ paymentMethod.name ]: paymentMethod,
|
87 |
};
|
88 |
};
|
89 |
-
|
|
|
|
|
90 |
const paymentMethod = registeredPaymentMethods[ paymentMethodName ];
|
|
|
|
|
|
|
91 |
|
92 |
// In editor, shortcut so all payment methods show as available.
|
93 |
if ( isEditor ) {
|
@@ -119,7 +132,12 @@ const usePaymentMethodRegistration = (
|
|
119 |
// Example: Stripe CC, Stripe Payment Request.
|
120 |
// That's why we track "is initialised" state here.
|
121 |
setIsInitialized( true );
|
122 |
-
}, [
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
// Determine which payment methods are available initially and whenever
|
125 |
// shipping methods change.
|
@@ -131,7 +149,41 @@ const usePaymentMethodRegistration = (
|
|
131 |
return isInitialized;
|
132 |
};
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
useShippingDataContext,
|
13 |
} from '@woocommerce/base-context';
|
14 |
import { useStoreCart, useShallowEqual } from '@woocommerce/base-hooks';
|
15 |
+
import {
|
16 |
+
CURRENT_USER_IS_ADMIN,
|
17 |
+
PAYMENT_GATEWAY_SORT_ORDER,
|
18 |
+
} from '@woocommerce/block-settings';
|
19 |
|
20 |
/**
|
21 |
* If there was an error registering a payment method, alert the admin.
|
47 |
* state.
|
48 |
* @param {Object} registeredPaymentMethods Registered payment methods to
|
49 |
* process.
|
50 |
+
* @param {Array} paymentMethodsSortOrder Array of payment method names to
|
51 |
+
* sort by. This should match keys of
|
52 |
+
* registeredPaymentMethods.
|
53 |
*
|
54 |
* @return {boolean} Whether the payment methods have been initialized or not. True when all payment
|
55 |
* methods have been initialized.
|
56 |
*/
|
57 |
const usePaymentMethodRegistration = (
|
58 |
dispatcher,
|
59 |
+
registeredPaymentMethods,
|
60 |
+
paymentMethodsSortOrder
|
61 |
) => {
|
62 |
const [ isInitialized, setIsInitialized ] = useState( false );
|
63 |
const { isEditor } = useEditorContext();
|
64 |
const { selectedRates, shippingAddress } = useShippingDataContext();
|
65 |
const selectedShippingMethods = useShallowEqual( selectedRates );
|
66 |
+
const paymentMethodsOrder = useShallowEqual( paymentMethodsSortOrder );
|
67 |
const { cartTotals, cartNeedsShipping } = useStoreCart();
|
68 |
const canPayArgument = useRef( {
|
69 |
cartTotals,
|
94 |
[ paymentMethod.name ]: paymentMethod,
|
95 |
};
|
96 |
};
|
97 |
+
|
98 |
+
for ( let i = 0; i < paymentMethodsOrder.length; i++ ) {
|
99 |
+
const paymentMethodName = paymentMethodsOrder[ i ];
|
100 |
const paymentMethod = registeredPaymentMethods[ paymentMethodName ];
|
101 |
+
if ( ! paymentMethod ) {
|
102 |
+
continue;
|
103 |
+
}
|
104 |
|
105 |
// In editor, shortcut so all payment methods show as available.
|
106 |
if ( isEditor ) {
|
132 |
// Example: Stripe CC, Stripe Payment Request.
|
133 |
// That's why we track "is initialised" state here.
|
134 |
setIsInitialized( true );
|
135 |
+
}, [
|
136 |
+
dispatcher,
|
137 |
+
isEditor,
|
138 |
+
registeredPaymentMethods,
|
139 |
+
paymentMethodsOrder,
|
140 |
+
] );
|
141 |
|
142 |
// Determine which payment methods are available initially and whenever
|
143 |
// shipping methods change.
|
149 |
return isInitialized;
|
150 |
};
|
151 |
|
152 |
+
/**
|
153 |
+
* Custom hook for setting up payment methods (standard, non-express).
|
154 |
+
*
|
155 |
+
* @param {function(Object):undefined} dispatcher
|
156 |
+
*
|
157 |
+
* @return {boolean} True when standard payment methods have been initialized.
|
158 |
+
*/
|
159 |
+
export const usePaymentMethods = ( dispatcher ) => {
|
160 |
+
const standardMethods = getPaymentMethods();
|
161 |
+
// Ensure all methods are present in order.
|
162 |
+
// Some payment methods may not be present in PAYMENT_GATEWAY_SORT_ORDER if they
|
163 |
+
// depend on state, e.g. COD can depend on shipping method.
|
164 |
+
const displayOrder = new Set( [
|
165 |
+
...PAYMENT_GATEWAY_SORT_ORDER,
|
166 |
+
...Object.keys( standardMethods ),
|
167 |
+
] );
|
168 |
+
return usePaymentMethodRegistration(
|
169 |
+
dispatcher,
|
170 |
+
standardMethods,
|
171 |
+
Array.from( displayOrder )
|
172 |
+
);
|
173 |
+
};
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Custom hook for setting up express payment methods.
|
177 |
+
*
|
178 |
+
* @param {function(Object):undefined} dispatcher
|
179 |
+
*
|
180 |
+
* @return {boolean} True when express payment methods have been initialized.
|
181 |
+
*/
|
182 |
+
export const useExpressPaymentMethods = ( dispatcher ) => {
|
183 |
+
const expressMethods = getExpressPaymentMethods();
|
184 |
+
return usePaymentMethodRegistration(
|
185 |
+
dispatcher,
|
186 |
+
expressMethods,
|
187 |
+
Object.keys( expressMethods )
|
188 |
+
);
|
189 |
+
};
|
assets/js/base/context/cart-checkout/shipping/event-emit.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
-
import { emitterCallback, reducer, emitEvent } from '
|
5 |
|
6 |
const EMIT_TYPES = {
|
7 |
SHIPPING_RATES_SUCCESS: 'shipping_rates_success',
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
+
import { emitterCallback, reducer, emitEvent } from '../../shared/event-emit';
|
5 |
|
6 |
const EMIT_TYPES = {
|
7 |
SHIPPING_RATES_SUCCESS: 'shipping_rates_success',
|
assets/js/base/context/index.js
CHANGED
@@ -3,4 +3,5 @@ export * from './container-width-context';
|
|
3 |
export * from './query-state-context';
|
4 |
export * from './store-notices-context';
|
5 |
export * from './editor';
|
6 |
-
export * from './add-to-cart-form
|
|
3 |
export * from './query-state-context';
|
4 |
export * from './store-notices-context';
|
5 |
export * from './editor';
|
6 |
+
export * from './add-to-cart-form';
|
7 |
+
export * from './shared';
|
assets/js/base/context/{cart-checkout → shared}/event-emit/emitter-callback.js
RENAMED
File without changes
|
assets/js/base/context/{cart-checkout → shared}/event-emit/emitters.js
RENAMED
@@ -46,7 +46,7 @@ export const emitEvent = async ( observers, eventType, data ) => {
|
|
46 |
/**
|
47 |
* Emits events on registered observers for the provided type and passes along
|
48 |
* the provided data. This event emitter will abort and return any value from
|
49 |
-
* observers that
|
50 |
*
|
51 |
* @param {Object} observers The registered observers to omit to.
|
52 |
* @param {string} eventType The event type being emitted.
|
@@ -75,8 +75,7 @@ export const emitEventWithAbort = async ( observers, eventType, data ) => {
|
|
75 |
return emitterResponse;
|
76 |
}
|
77 |
} catch ( e ) {
|
78 |
-
//
|
79 |
-
// troubleshooting
|
80 |
// eslint-disable-next-line no-console
|
81 |
console.error( e );
|
82 |
return { type: 'error' };
|
46 |
/**
|
47 |
* Emits events on registered observers for the provided type and passes along
|
48 |
* the provided data. This event emitter will abort and return any value from
|
49 |
+
* observers that return an object which should contain a type property.
|
50 |
*
|
51 |
* @param {Object} observers The registered observers to omit to.
|
52 |
* @param {string} eventType The event type being emitted.
|
75 |
return emitterResponse;
|
76 |
}
|
77 |
} catch ( e ) {
|
78 |
+
// We don't handle thrown errors but just console.log for troubleshooting.
|
|
|
79 |
// eslint-disable-next-line no-console
|
80 |
console.error( e );
|
81 |
return { type: 'error' };
|
assets/js/base/context/{cart-checkout → shared}/event-emit/index.js
RENAMED
File without changes
|
assets/js/base/context/{cart-checkout → shared}/event-emit/reducer.js
RENAMED
File without changes
|
assets/js/base/context/{cart-checkout → shared}/event-emit/test/emitters.js
RENAMED
File without changes
|
assets/js/base/context/shared/index.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
export * from './validation';
|
2 |
+
export * from './event-emit';
|
assets/js/base/context/{cart-checkout → shared}/validation/index.js
RENAMED
File without changes
|
assets/js/base/utils/index.js
CHANGED
@@ -5,3 +5,4 @@ export * from './shipping-rates';
|
|
5 |
export * from './legacy-events';
|
6 |
export * from './render-frontend';
|
7 |
export * from './get-valid-block-attributes';
|
|
5 |
export * from './legacy-events';
|
6 |
export * from './render-frontend';
|
7 |
export * from './get-valid-block-attributes';
|
8 |
+
export * from './product-data';
|
assets/js/base/utils/legacy-events.js
CHANGED
@@ -3,22 +3,32 @@ const Event = window.Event || null;
|
|
3 |
/**
|
4 |
* Wrapper function to dispatch an event so it's compatible with IE11.
|
5 |
*
|
6 |
-
* @param {string}
|
7 |
-
* @param {
|
8 |
-
*
|
|
|
|
|
|
|
|
|
9 |
*/
|
10 |
-
const dispatchEvent = (
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
// In IE, Event is an object and can't be instantiated with `new Event()`.
|
12 |
if ( typeof Event === 'function' ) {
|
13 |
const event = new Event( name, {
|
14 |
bubbles,
|
15 |
cancelable,
|
16 |
} );
|
17 |
-
|
18 |
} else {
|
19 |
const event = document.createEvent( 'Event' );
|
20 |
event.initEvent( name, bubbles, cancelable );
|
21 |
-
|
22 |
}
|
23 |
};
|
24 |
|
@@ -26,7 +36,7 @@ const dispatchEvent = ( name, bubbles = false, cancelable = false ) => {
|
|
26 |
// that relies on the store, see
|
27 |
// https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/1247
|
28 |
export const triggerFragmentRefresh = () => {
|
29 |
-
dispatchEvent( 'wc_fragment_refresh', true, true );
|
30 |
};
|
31 |
|
32 |
/**
|
@@ -53,7 +63,7 @@ export const translateJQueryEventToNative = (
|
|
53 |
}
|
54 |
|
55 |
const eventDispatcher = () => {
|
56 |
-
dispatchEvent( nativeEventName, bubbles, cancelable );
|
57 |
};
|
58 |
|
59 |
// @ts-ignore -- jQuery is window global
|
3 |
/**
|
4 |
* Wrapper function to dispatch an event so it's compatible with IE11.
|
5 |
*
|
6 |
+
* @param {string} name Name of the event to dispatch.
|
7 |
+
* @param {Object} [options] Some additional options to modify
|
8 |
+
* the event.
|
9 |
+
* @param {boolean} [options.bubbles] Whether the event bubbles.
|
10 |
+
* @param {boolean} [options.cancelable] Whether the event is cancelable.
|
11 |
+
* @param {HTMLNode} [options.element] Element that dispatches the event. By
|
12 |
+
* default, the body.
|
13 |
*/
|
14 |
+
export const dispatchEvent = (
|
15 |
+
name,
|
16 |
+
{ bubbles = false, cancelable = false, element }
|
17 |
+
) => {
|
18 |
+
if ( ! element ) {
|
19 |
+
element = document.body;
|
20 |
+
}
|
21 |
// In IE, Event is an object and can't be instantiated with `new Event()`.
|
22 |
if ( typeof Event === 'function' ) {
|
23 |
const event = new Event( name, {
|
24 |
bubbles,
|
25 |
cancelable,
|
26 |
} );
|
27 |
+
element.dispatchEvent( event );
|
28 |
} else {
|
29 |
const event = document.createEvent( 'Event' );
|
30 |
event.initEvent( name, bubbles, cancelable );
|
31 |
+
element.dispatchEvent( event );
|
32 |
}
|
33 |
};
|
34 |
|
36 |
// that relies on the store, see
|
37 |
// https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/1247
|
38 |
export const triggerFragmentRefresh = () => {
|
39 |
+
dispatchEvent( 'wc_fragment_refresh', { bubbles: true, cancelable: true } );
|
40 |
};
|
41 |
|
42 |
/**
|
63 |
}
|
64 |
|
65 |
const eventDispatcher = () => {
|
66 |
+
dispatchEvent( nativeEventName, { bubbles, cancelable } );
|
67 |
};
|
68 |
|
69 |
// @ts-ignore -- jQuery is window global
|
assets/js/base/utils/product-data.js
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Check a product object to see if it can be purchased.
|
3 |
+
*
|
4 |
+
* @param {Object} product Product object.
|
5 |
+
* @return {boolean} True if purchasable.
|
6 |
+
*/
|
7 |
+
export const productIsPurchasable = ( product ) => {
|
8 |
+
return product.is_purchasable || false;
|
9 |
+
};
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Check if the product is supported by the blocks add to cart form.
|
13 |
+
*
|
14 |
+
* @param {Object} product Product object.
|
15 |
+
* @return {boolean} True if supported.
|
16 |
+
*/
|
17 |
+
export const productSupportsAddToCartForm = ( product ) => {
|
18 |
+
/**
|
19 |
+
* @todo Define supported product types for add to cart form.
|
20 |
+
*
|
21 |
+
* When introducing the form-element registration system, include a method of defining if a
|
22 |
+
* product type has support.
|
23 |
+
*
|
24 |
+
* If, as an example, we went with an inner block system for the add to cart form, we could allow
|
25 |
+
* a type to be registered along with it's default Block template. Registered types would then be
|
26 |
+
* picked up here, as well as the core types which would be defined elsewhere.
|
27 |
+
*/
|
28 |
+
const supportedTypes = [ 'simple', 'variable' ];
|
29 |
+
|
30 |
+
return supportedTypes.includes( product.type || 'simple' );
|
31 |
+
};
|
assets/js/base/utils/render-frontend.js
CHANGED
@@ -4,53 +4,171 @@
|
|
4 |
import { render, Suspense } from '@wordpress/element';
|
5 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
/**
|
8 |
-
* Renders a block component in
|
9 |
*
|
10 |
-
* @param {Object}
|
11 |
-
* @param {Function}
|
12 |
-
*
|
13 |
-
* @param {
|
14 |
-
*
|
|
|
|
|
|
|
|
|
|
|
15 |
*/
|
16 |
-
|
17 |
Block,
|
18 |
-
|
19 |
getProps = () => {},
|
20 |
getErrorBoundaryProps = () => {},
|
21 |
} ) => {
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
const
|
28 |
-
|
|
|
|
|
29 |
};
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
} );
|
53 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
};
|
55 |
|
56 |
export default renderFrontend;
|
4 |
import { render, Suspense } from '@wordpress/element';
|
5 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
6 |
|
7 |
+
// Some blocks take care of rendering their inner blocks automatically. For
|
8 |
+
// example, the empty cart. In those cases, we don't want to trigger the render
|
9 |
+
// function of inner components on load. Instead, the wrapper block can trigger
|
10 |
+
// the event `wc-blocks_render_blocks_frontend` to render its inner blocks.
|
11 |
+
const selectorsToSkipOnLoad = [ '.wp-block-woocommerce-cart' ];
|
12 |
+
|
13 |
+
// Given an element and a list of wrappers, check if the element is inside at
|
14 |
+
// least one of the wrappers.
|
15 |
+
const isElementInsideWrappers = ( el, wrappers ) => {
|
16 |
+
return Array.prototype.some.call(
|
17 |
+
wrappers,
|
18 |
+
( wrapper ) => wrapper.contains( el ) && ! wrapper.isSameNode( el )
|
19 |
+
);
|
20 |
+
};
|
21 |
+
|
22 |
/**
|
23 |
+
* Renders a block component in each `containers` node.
|
24 |
*
|
25 |
+
* @param {Object} props Render props.
|
26 |
+
* @param {Function} props.Block React component to use as a
|
27 |
+
* replacement.
|
28 |
+
* @param {NodeList} props.containers Containers to replace with
|
29 |
+
* the Block component.
|
30 |
+
* @param {Function} [props.getProps] Function to generate the
|
31 |
+
* props object for the block.
|
32 |
+
* @param {Function} [props.getErrorBoundaryProps] Function to generate the
|
33 |
+
* props object for the error
|
34 |
+
* boundary.
|
35 |
*/
|
36 |
+
const renderBlockInContainers = ( {
|
37 |
Block,
|
38 |
+
containers,
|
39 |
getProps = () => {},
|
40 |
getErrorBoundaryProps = () => {},
|
41 |
} ) => {
|
42 |
+
if ( containers.length === 0 ) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
|
46 |
+
// Use Array.forEach for IE11 compatibility.
|
47 |
+
Array.prototype.forEach.call( containers, ( el, i ) => {
|
48 |
+
const props = getProps( el, i );
|
49 |
+
const errorBoundaryProps = getErrorBoundaryProps( el, i );
|
50 |
+
const attributes = {
|
51 |
+
...el.dataset,
|
52 |
+
...props.attributes,
|
53 |
};
|
54 |
+
el.classList.remove( 'is-loading' );
|
55 |
+
|
56 |
+
render(
|
57 |
+
<BlockErrorBoundary { ...errorBoundaryProps }>
|
58 |
+
<Suspense fallback={ <div className="wc-block-placeholder" /> }>
|
59 |
+
<Block { ...props } attributes={ attributes } />
|
60 |
+
</Suspense>
|
61 |
+
</BlockErrorBoundary>,
|
62 |
+
el
|
63 |
+
);
|
64 |
+
} );
|
65 |
+
};
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Renders the block frontend in the elements matched by the selector which are
|
69 |
+
* outside the wrapper elements.
|
70 |
+
*
|
71 |
+
* @param {Object} props Render props.
|
72 |
+
* @param {Function} props.Block React component to use as a
|
73 |
+
* replacement.
|
74 |
+
* @param {string} props.selector CSS selector to match the
|
75 |
+
* elements to replace.
|
76 |
+
* @param {Function} [props.getProps] Function to generate the
|
77 |
+
* props object for the block.
|
78 |
+
* @param {Function} [props.getErrorBoundaryProps] Function to generate the
|
79 |
+
* props object for the error
|
80 |
+
* boundary.
|
81 |
+
* @param {NodeList} props.wrappers All elements matched by the
|
82 |
+
* selector which are inside
|
83 |
+
* the wrapper will be ignored.
|
84 |
+
*/
|
85 |
+
const renderBlockOutsideWrappers = ( {
|
86 |
+
Block,
|
87 |
+
getProps,
|
88 |
+
getErrorBoundaryProps,
|
89 |
+
selector,
|
90 |
+
wrappers,
|
91 |
+
} ) => {
|
92 |
+
const containers = document.body.querySelectorAll( selector );
|
93 |
+
// Filter out blocks inside the wrappers.
|
94 |
+
if ( wrappers.length > 0 ) {
|
95 |
+
Array.prototype.filter.call( containers, ( el ) => {
|
96 |
+
return ! isElementInsideWrappers( el, wrappers );
|
97 |
} );
|
98 |
}
|
99 |
+
renderBlockInContainers( {
|
100 |
+
Block,
|
101 |
+
containers,
|
102 |
+
getProps,
|
103 |
+
getErrorBoundaryProps,
|
104 |
+
} );
|
105 |
+
};
|
106 |
+
|
107 |
+
/**
|
108 |
+
* Renders the block frontend in the elements matched by the selector inside the
|
109 |
+
* wrapper element.
|
110 |
+
*
|
111 |
+
* @param {Object} props Render props.
|
112 |
+
* @param {Function} props.Block React component to use as a
|
113 |
+
* replacement.
|
114 |
+
* @param {string} props.selector CSS selector to match the
|
115 |
+
* elements to replace.
|
116 |
+
* @param {Function} [props.getProps] Function to generate the
|
117 |
+
* props object for the block.
|
118 |
+
* @param {Function} [props.getErrorBoundaryProps] Function to generate the
|
119 |
+
* props object for the error
|
120 |
+
* boundary.
|
121 |
+
* @param {Element} props.wrapper Wrapper element to query the
|
122 |
+
* selector inside.
|
123 |
+
*/
|
124 |
+
const renderBlockInsideWrapper = ( {
|
125 |
+
Block,
|
126 |
+
getProps,
|
127 |
+
getErrorBoundaryProps,
|
128 |
+
selector,
|
129 |
+
wrapper,
|
130 |
+
} ) => {
|
131 |
+
const containers = wrapper.querySelectorAll( selector );
|
132 |
+
renderBlockInContainers( {
|
133 |
+
Block,
|
134 |
+
containers,
|
135 |
+
getProps,
|
136 |
+
getErrorBoundaryProps,
|
137 |
+
} );
|
138 |
+
};
|
139 |
+
|
140 |
+
/**
|
141 |
+
* Renders the block frontend on page load. If the block is contained inside a
|
142 |
+
* wrapper element that should be excluded from initial load, it adds the
|
143 |
+
* appropriate event listeners to render the block when the
|
144 |
+
* `blocks_render_blocks_frontend` event is triggered.
|
145 |
+
*
|
146 |
+
* @param {Object} props Render props.
|
147 |
+
* @param {Function} props.Block React component to use as a
|
148 |
+
* replacement.
|
149 |
+
* @param {string} props.selector CSS selector to match the
|
150 |
+
* elements to replace.
|
151 |
+
* @param {Function} [props.getProps] Function to generate the
|
152 |
+
* props object for the block.
|
153 |
+
* @param {Function} [props.getErrorBoundaryProps] Function to generate the
|
154 |
+
* props object for the error
|
155 |
+
* boundary.
|
156 |
+
*/
|
157 |
+
export const renderFrontend = ( props ) => {
|
158 |
+
const wrappersToSkipOnLoad = document.body.querySelectorAll(
|
159 |
+
selectorsToSkipOnLoad.join( ',' )
|
160 |
+
);
|
161 |
+
renderBlockOutsideWrappers( {
|
162 |
+
...props,
|
163 |
+
wrappers: wrappersToSkipOnLoad,
|
164 |
+
} );
|
165 |
+
// For each wrapper, add an event listener to render the inner blocks when
|
166 |
+
// `wc-blocks_render_blocks_frontend` event is triggered.
|
167 |
+
Array.prototype.forEach.call( wrappersToSkipOnLoad, ( wrapper ) => {
|
168 |
+
wrapper.addEventListener( 'wc-blocks_render_blocks_frontend', () => {
|
169 |
+
renderBlockInsideWrapper( { ...props, wrapper } );
|
170 |
+
} );
|
171 |
+
} );
|
172 |
};
|
173 |
|
174 |
export default renderFrontend;
|
assets/js/blocks/cart-checkout/cart/attributes.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import {
|
5 |
IS_SHIPPING_CALCULATOR_ENABLED,
|
6 |
IS_SHIPPING_COST_HIDDEN,
|
|
|
7 |
} from '@woocommerce/block-settings';
|
8 |
|
9 |
const blockAttributes = {
|
@@ -24,6 +25,10 @@ const blockAttributes = {
|
|
24 |
type: 'number',
|
25 |
default: 0,
|
26 |
},
|
|
|
|
|
|
|
|
|
27 |
};
|
28 |
|
29 |
export default blockAttributes;
|
4 |
import {
|
5 |
IS_SHIPPING_CALCULATOR_ENABLED,
|
6 |
IS_SHIPPING_COST_HIDDEN,
|
7 |
+
HAS_DARK_EDITOR_STYLE_SUPPORT,
|
8 |
} from '@woocommerce/block-settings';
|
9 |
|
10 |
const blockAttributes = {
|
25 |
type: 'number',
|
26 |
default: 0,
|
27 |
},
|
28 |
+
hasDarkControls: {
|
29 |
+
type: 'boolean',
|
30 |
+
default: HAS_DARK_EDITOR_STYLE_SUPPORT,
|
31 |
+
},
|
32 |
};
|
33 |
|
34 |
export default blockAttributes;
|
assets/js/blocks/cart-checkout/cart/block.js
CHANGED
@@ -10,7 +10,10 @@ import {
|
|
10 |
ValidationContextProvider,
|
11 |
CartProvider,
|
12 |
} from '@woocommerce/base-context';
|
13 |
-
import {
|
|
|
|
|
|
|
14 |
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
|
15 |
|
16 |
/**
|
@@ -18,6 +21,17 @@ import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
|
|
18 |
*/
|
19 |
import FullCart from './full-cart';
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
const Block = ( { emptyCart, attributes, scrollToTop } ) => {
|
22 |
const { cartItems, cartIsLoading } = useStoreCart();
|
23 |
|
@@ -64,7 +78,7 @@ const Block = ( { emptyCart, attributes, scrollToTop } ) => {
|
|
64 |
return (
|
65 |
<>
|
66 |
{ ! cartIsLoading && cartItems.length === 0 ? (
|
67 |
-
<
|
68 |
) : (
|
69 |
<LoadingMask showSpinner={ true } isLoading={ cartIsLoading }>
|
70 |
<ValidationContextProvider>
|
10 |
ValidationContextProvider,
|
11 |
CartProvider,
|
12 |
} from '@woocommerce/base-context';
|
13 |
+
import {
|
14 |
+
dispatchEvent,
|
15 |
+
translateJQueryEventToNative,
|
16 |
+
} from '@woocommerce/base-utils';
|
17 |
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
|
18 |
|
19 |
/**
|
21 |
*/
|
22 |
import FullCart from './full-cart';
|
23 |
|
24 |
+
const EmptyCart = ( { content } ) => {
|
25 |
+
useEffect( () => {
|
26 |
+
dispatchEvent( 'wc-blocks_render_blocks_frontend', {
|
27 |
+
element: document.body.querySelector(
|
28 |
+
'.wp-block-woocommerce-cart'
|
29 |
+
),
|
30 |
+
} );
|
31 |
+
}, [] );
|
32 |
+
return <RawHTML>{ content }</RawHTML>;
|
33 |
+
};
|
34 |
+
|
35 |
const Block = ( { emptyCart, attributes, scrollToTop } ) => {
|
36 |
const { cartItems, cartIsLoading } = useStoreCart();
|
37 |
|
78 |
return (
|
79 |
<>
|
80 |
{ ! cartIsLoading && cartItems.length === 0 ? (
|
81 |
+
<EmptyCart content={ emptyCart } />
|
82 |
) : (
|
83 |
<LoadingMask showSpinner={ true } isLoading={ cartIsLoading }>
|
84 |
<ValidationContextProvider>
|
assets/js/blocks/cart-checkout/cart/edit.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
-
import
|
6 |
import { InspectorControls } from '@wordpress/block-editor';
|
7 |
import {
|
8 |
Disabled,
|
@@ -23,7 +24,7 @@ import {
|
|
23 |
import { __experimentalCreateInterpolateElement } from 'wordpress-element';
|
24 |
import { useRef } from '@wordpress/element';
|
25 |
import { getAdminLink } from '@woocommerce/settings';
|
26 |
-
import { previewCart
|
27 |
|
28 |
/**
|
29 |
* Internal dependencies
|
@@ -37,6 +38,7 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
37 |
isShippingCalculatorEnabled,
|
38 |
isShippingCostHidden,
|
39 |
checkoutPageId,
|
|
|
40 |
} = attributes;
|
41 |
const { currentPostId } = useEditorContext();
|
42 |
const { current: savedCheckoutPageId } = useRef( checkoutPageId );
|
@@ -129,12 +131,25 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
129 |
} }
|
130 |
/>
|
131 |
) }
|
132 |
-
<
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
</InspectorControls>
|
139 |
);
|
140 |
};
|
@@ -148,12 +163,12 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
148 |
* in the frontend.
|
149 |
*/
|
150 |
const CartEditor = ( { className, attributes, setAttributes } ) => {
|
151 |
-
if ( attributes.isPreview ) {
|
152 |
-
return cartBlockPreview;
|
153 |
-
}
|
154 |
-
|
155 |
return (
|
156 |
-
<div
|
|
|
|
|
|
|
|
|
157 |
<ViewSwitcher
|
158 |
label={ __( 'Edit', 'woo-gutenberg-products-block' ) }
|
159 |
views={ [
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import classnames from 'classnames';
|
5 |
import { __ } from '@wordpress/i18n';
|
6 |
+
import { CartCheckoutFeedbackPrompt } from '@woocommerce/block-components/feedback-prompt';
|
7 |
import { InspectorControls } from '@wordpress/block-editor';
|
8 |
import {
|
9 |
Disabled,
|
24 |
import { __experimentalCreateInterpolateElement } from 'wordpress-element';
|
25 |
import { useRef } from '@wordpress/element';
|
26 |
import { getAdminLink } from '@woocommerce/settings';
|
27 |
+
import { previewCart } from '@woocommerce/resource-previews';
|
28 |
|
29 |
/**
|
30 |
* Internal dependencies
|
38 |
isShippingCalculatorEnabled,
|
39 |
isShippingCostHidden,
|
40 |
checkoutPageId,
|
41 |
+
hasDarkControls,
|
42 |
} = attributes;
|
43 |
const { currentPostId } = useEditorContext();
|
44 |
const { current: savedCheckoutPageId } = useRef( checkoutPageId );
|
131 |
} }
|
132 |
/>
|
133 |
) }
|
134 |
+
<PanelBody title={ __( 'Style', 'woo-gutenberg-products-block' ) }>
|
135 |
+
<ToggleControl
|
136 |
+
label={ __(
|
137 |
+
'Dark mode inputs',
|
138 |
+
'woo-gutenberg-products-block'
|
139 |
+
) }
|
140 |
+
help={ __(
|
141 |
+
'Inputs styled specifically for use on dark background colors.',
|
142 |
+
'woo-gutenberg-products-block'
|
143 |
+
) }
|
144 |
+
checked={ hasDarkControls }
|
145 |
+
onChange={ () =>
|
146 |
+
setAttributes( {
|
147 |
+
hasDarkControls: ! hasDarkControls,
|
148 |
+
} )
|
149 |
+
}
|
150 |
+
/>
|
151 |
+
</PanelBody>
|
152 |
+
<CartCheckoutFeedbackPrompt />
|
153 |
</InspectorControls>
|
154 |
);
|
155 |
};
|
163 |
* in the frontend.
|
164 |
*/
|
165 |
const CartEditor = ( { className, attributes, setAttributes } ) => {
|
|
|
|
|
|
|
|
|
166 |
return (
|
167 |
+
<div
|
168 |
+
className={ classnames( className, 'wp-block-woocommerce-cart', {
|
169 |
+
'is-editor-preview': attributes.isPreview,
|
170 |
+
} ) }
|
171 |
+
>
|
172 |
<ViewSwitcher
|
173 |
label={ __( 'Edit', 'woo-gutenberg-products-block' ) }
|
174 |
views={ [
|
assets/js/blocks/cart-checkout/cart/editor.scss
CHANGED
@@ -1,3 +1,8 @@
|
|
1 |
.wc-block-cart__page-notice {
|
2 |
margin: 0;
|
3 |
}
|
|
|
|
|
|
|
|
|
|
1 |
.wc-block-cart__page-notice {
|
2 |
margin: 0;
|
3 |
}
|
4 |
+
|
5 |
+
.wp-block-woocommerce-cart.is-editor-preview {
|
6 |
+
max-height: 1000px;
|
7 |
+
overflow: hidden;
|
8 |
+
}
|
assets/js/blocks/cart-checkout/cart/full-cart/index.js
CHANGED
@@ -47,7 +47,11 @@ import './style.scss';
|
|
47 |
* Component that renders the Cart block when user has something in cart aka "full".
|
48 |
*/
|
49 |
const Cart = ( { attributes } ) => {
|
50 |
-
const {
|
|
|
|
|
|
|
|
|
51 |
|
52 |
const {
|
53 |
cartItems,
|
@@ -82,6 +86,7 @@ const Cart = ( { attributes } ) => {
|
|
82 |
|
83 |
const cartClassName = classnames( 'wc-block-cart', {
|
84 |
'wc-block-cart--is-loading': cartIsLoading,
|
|
|
85 |
} );
|
86 |
|
87 |
return (
|
47 |
* Component that renders the Cart block when user has something in cart aka "full".
|
48 |
*/
|
49 |
const Cart = ( { attributes } ) => {
|
50 |
+
const {
|
51 |
+
isShippingCalculatorEnabled,
|
52 |
+
isShippingCostHidden,
|
53 |
+
hasDarkControls,
|
54 |
+
} = attributes;
|
55 |
|
56 |
const {
|
57 |
cartItems,
|
86 |
|
87 |
const cartClassName = classnames( 'wc-block-cart', {
|
88 |
'wc-block-cart--is-loading': cartIsLoading,
|
89 |
+
'has-dark-controls': hasDarkControls,
|
90 |
} );
|
91 |
|
92 |
return (
|
assets/js/blocks/cart-checkout/cart/full-cart/style.scss
CHANGED
@@ -6,6 +6,15 @@
|
|
6 |
.wc-block-components-product-name {
|
7 |
color: inherit;
|
8 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
}
|
10 |
|
11 |
table.wc-block-cart-items,
|
6 |
.wc-block-components-product-name {
|
7 |
color: inherit;
|
8 |
}
|
9 |
+
.wc-block-components-address-form {
|
10 |
+
.wc-block-components-text-input,
|
11 |
+
.wc-block-components-country-input,
|
12 |
+
.wc-block-components-state-input {
|
13 |
+
&:first-of-type {
|
14 |
+
margin-top: 0;
|
15 |
+
}
|
16 |
+
}
|
17 |
+
}
|
18 |
}
|
19 |
|
20 |
table.wc-block-cart-items,
|
assets/js/blocks/cart-checkout/checkout/attributes.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
const blockAttributes = {
|
2 |
isPreview: {
|
3 |
type: 'boolean',
|
@@ -24,6 +29,10 @@ const blockAttributes = {
|
|
24 |
type: 'boolean',
|
25 |
default: false,
|
26 |
},
|
|
|
|
|
|
|
|
|
27 |
showPolicyLinks: {
|
28 |
type: 'boolean',
|
29 |
default: true,
|
@@ -36,6 +45,10 @@ const blockAttributes = {
|
|
36 |
type: 'number',
|
37 |
default: 0,
|
38 |
},
|
|
|
|
|
|
|
|
|
39 |
};
|
40 |
|
41 |
export default blockAttributes;
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { HAS_DARK_EDITOR_STYLE_SUPPORT } from '@woocommerce/block-settings';
|
5 |
+
|
6 |
const blockAttributes = {
|
7 |
isPreview: {
|
8 |
type: 'boolean',
|
29 |
type: 'boolean',
|
30 |
default: false,
|
31 |
},
|
32 |
+
showOrderNotes: {
|
33 |
+
type: 'boolean',
|
34 |
+
default: true,
|
35 |
+
},
|
36 |
showPolicyLinks: {
|
37 |
type: 'boolean',
|
38 |
default: true,
|
45 |
type: 'number',
|
46 |
default: 0,
|
47 |
},
|
48 |
+
hasDarkControls: {
|
49 |
+
type: 'boolean',
|
50 |
+
default: HAS_DARK_EDITOR_STYLE_SUPPORT,
|
51 |
+
},
|
52 |
};
|
53 |
|
54 |
export default blockAttributes;
|
assets/js/blocks/cart-checkout/checkout/block.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { useMemo, useEffect } from '@wordpress/element';
|
5 |
import { __ } from '@wordpress/i18n';
|
6 |
import {
|
@@ -57,6 +58,7 @@ import {
|
|
57 |
*/
|
58 |
import CheckoutSidebar from './sidebar';
|
59 |
import CheckoutOrderError from './checkout-order-error';
|
|
|
60 |
import NoShippingPlaceholder from './no-shipping-placeholder';
|
61 |
import './style.scss';
|
62 |
|
@@ -118,7 +120,10 @@ const Checkout = ( { attributes, scrollToTop } ) => {
|
|
118 |
isProcessing: checkoutIsProcessing,
|
119 |
customerId,
|
120 |
onSubmit,
|
|
|
|
|
121 |
} = useCheckoutContext();
|
|
|
122 |
const {
|
123 |
hasValidationErrors,
|
124 |
showAllValidationErrors,
|
@@ -166,7 +171,7 @@ const Checkout = ( { attributes, scrollToTop } ) => {
|
|
166 |
showAllValidationErrors();
|
167 |
scrollToTop( { focusableSelector: 'input:invalid' } );
|
168 |
}
|
169 |
-
}, [ hasErrorsToDisplay ] );
|
170 |
|
171 |
if ( ! isEditor && ! hasOrder ) {
|
172 |
return <CheckoutOrderError />;
|
@@ -176,7 +181,7 @@ const Checkout = ( { attributes, scrollToTop } ) => {
|
|
176 |
window.location.href
|
177 |
) }`;
|
178 |
|
179 |
-
if ( ! customerId && ! CHECKOUT_ALLOWS_GUEST ) {
|
180 |
return (
|
181 |
<>
|
182 |
{ __(
|
@@ -207,9 +212,12 @@ const Checkout = ( { attributes, scrollToTop } ) => {
|
|
207 |
</>
|
208 |
);
|
209 |
|
|
|
|
|
|
|
210 |
return (
|
211 |
<>
|
212 |
-
<SidebarLayout className=
|
213 |
<Main className="wc-block-checkout__main">
|
214 |
{ cartNeedsPayment && <ExpressCheckoutFormControl /> }
|
215 |
<CheckoutForm onSubmit={ onSubmit }>
|
@@ -389,6 +397,26 @@ const Checkout = ( { attributes, scrollToTop } ) => {
|
|
389 |
</StoreNoticesProvider>
|
390 |
</FormStep>
|
391 |
) }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
</CheckoutForm>
|
393 |
<div className="wc-block-checkout__actions">
|
394 |
{ attributes.showReturnToCart && (
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import classnames from 'classnames';
|
5 |
import { useMemo, useEffect } from '@wordpress/element';
|
6 |
import { __ } from '@wordpress/i18n';
|
7 |
import {
|
58 |
*/
|
59 |
import CheckoutSidebar from './sidebar';
|
60 |
import CheckoutOrderError from './checkout-order-error';
|
61 |
+
import CheckoutOrderNotes from './checkout-order-notes';
|
62 |
import NoShippingPlaceholder from './no-shipping-placeholder';
|
63 |
import './style.scss';
|
64 |
|
120 |
isProcessing: checkoutIsProcessing,
|
121 |
customerId,
|
122 |
onSubmit,
|
123 |
+
orderNotes,
|
124 |
+
dispatchActions,
|
125 |
} = useCheckoutContext();
|
126 |
+
const { setOrderNotes } = dispatchActions;
|
127 |
const {
|
128 |
hasValidationErrors,
|
129 |
showAllValidationErrors,
|
171 |
showAllValidationErrors();
|
172 |
scrollToTop( { focusableSelector: 'input:invalid' } );
|
173 |
}
|
174 |
+
}, [ hasErrorsToDisplay, scrollToTop, showAllValidationErrors ] );
|
175 |
|
176 |
if ( ! isEditor && ! hasOrder ) {
|
177 |
return <CheckoutOrderError />;
|
181 |
window.location.href
|
182 |
) }`;
|
183 |
|
184 |
+
if ( ! isEditor && ! customerId && ! CHECKOUT_ALLOWS_GUEST ) {
|
185 |
return (
|
186 |
<>
|
187 |
{ __(
|
212 |
</>
|
213 |
);
|
214 |
|
215 |
+
const checkoutClassName = classnames( 'wc-block-checkout', {
|
216 |
+
'has-dark-controls': attributes.hasDarkControls,
|
217 |
+
} );
|
218 |
return (
|
219 |
<>
|
220 |
+
<SidebarLayout className={ checkoutClassName }>
|
221 |
<Main className="wc-block-checkout__main">
|
222 |
{ cartNeedsPayment && <ExpressCheckoutFormControl /> }
|
223 |
<CheckoutForm onSubmit={ onSubmit }>
|
397 |
</StoreNoticesProvider>
|
398 |
</FormStep>
|
399 |
) }
|
400 |
+
{ attributes.showOrderNotes && (
|
401 |
+
<FormStep id="order-notes" showStepNumber={ false }>
|
402 |
+
<CheckoutOrderNotes
|
403 |
+
disabled={ checkoutIsProcessing }
|
404 |
+
onChange={ setOrderNotes }
|
405 |
+
placeholder={
|
406 |
+
needsShipping
|
407 |
+
? __(
|
408 |
+
'Notes about your order, e.g. special notes for delivery.',
|
409 |
+
'woo-gutenberg-products-block'
|
410 |
+
)
|
411 |
+
: __(
|
412 |
+
'Notes about your order.',
|
413 |
+
'woo-gutenberg-products-block'
|
414 |
+
)
|
415 |
+
}
|
416 |
+
value={ orderNotes }
|
417 |
+
/>
|
418 |
+
</FormStep>
|
419 |
+
) }
|
420 |
</CheckoutForm>
|
421 |
<div className="wc-block-checkout__actions">
|
422 |
{ attributes.showReturnToCart && (
|
assets/js/blocks/cart-checkout/checkout/checkout-order-notes/index.js
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { useState } from '@wordpress/element';
|
6 |
+
import CheckboxControl from '@woocommerce/base-components/checkbox-control';
|
7 |
+
import Textarea from '@woocommerce/base-components/textarea';
|
8 |
+
import PropTypes from 'prop-types';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import './style.scss';
|
14 |
+
|
15 |
+
const CheckoutOrderNotes = ( { disabled, onChange, placeholder, value } ) => {
|
16 |
+
const [ withOrderNotes, setWithOrderNotes ] = useState( false );
|
17 |
+
// Store order notes when the textarea is hidden. This allows us to recover
|
18 |
+
// text entered previously by the user when the checkbox is re-enabled
|
19 |
+
// while keeping the context clean if the checkbox is disabled.
|
20 |
+
const [ hiddenOrderNotesText, setHiddenOrderNotesText ] = useState( '' );
|
21 |
+
|
22 |
+
return (
|
23 |
+
<div className="wc-block-checkout__add-note">
|
24 |
+
<CheckboxControl
|
25 |
+
disabled={ disabled }
|
26 |
+
label={ __(
|
27 |
+
'Add a note to your order',
|
28 |
+
'woo-gutenberg-products-block'
|
29 |
+
) }
|
30 |
+
checked={ withOrderNotes }
|
31 |
+
onChange={ ( isChecked ) => {
|
32 |
+
setWithOrderNotes( isChecked );
|
33 |
+
if ( isChecked ) {
|
34 |
+
// When re-enabling the checkbox, store in context the
|
35 |
+
// order notes value previously stored in the component
|
36 |
+
// state.
|
37 |
+
if ( value !== hiddenOrderNotesText ) {
|
38 |
+
onChange( hiddenOrderNotesText );
|
39 |
+
}
|
40 |
+
} else {
|
41 |
+
// When un-checking the checkbox, clear the order notes
|
42 |
+
// value in the context but store it in the component
|
43 |
+
// state.
|
44 |
+
onChange( '' );
|
45 |
+
setHiddenOrderNotesText( value );
|
46 |
+
}
|
47 |
+
} }
|
48 |
+
/>
|
49 |
+
{ withOrderNotes && (
|
50 |
+
<Textarea
|
51 |
+
disabled={ disabled }
|
52 |
+
onTextChange={ onChange }
|
53 |
+
placeholder={ placeholder }
|
54 |
+
value={ value }
|
55 |
+
/>
|
56 |
+
) }
|
57 |
+
</div>
|
58 |
+
);
|
59 |
+
};
|
60 |
+
|
61 |
+
Textarea.propTypes = {
|
62 |
+
onTextChange: PropTypes.func.isRequired,
|
63 |
+
disabled: PropTypes.bool,
|
64 |
+
placeholder: PropTypes.string,
|
65 |
+
value: PropTypes.string,
|
66 |
+
};
|
67 |
+
|
68 |
+
export default CheckoutOrderNotes;
|
assets/js/blocks/cart-checkout/checkout/checkout-order-notes/style.scss
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-checkout__add-note {
|
2 |
+
@include with-translucent-border(1px 0);
|
3 |
+
padding: $gap;
|
4 |
+
}
|
5 |
+
|
6 |
+
.wc-block-checkout__add-note .wc-block-components-textarea {
|
7 |
+
margin-top: $gap;
|
8 |
+
}
|
assets/js/blocks/cart-checkout/checkout/edit.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
-
import
|
6 |
import { InspectorControls } from '@wordpress/block-editor';
|
7 |
import {
|
8 |
PanelBody,
|
@@ -25,7 +26,6 @@ import PageSelector from '@woocommerce/block-components/page-selector';
|
|
25 |
import {
|
26 |
previewCart,
|
27 |
previewSavedPaymentMethods,
|
28 |
-
checkoutBlockPreview,
|
29 |
} from '@woocommerce/resource-previews';
|
30 |
|
31 |
/**
|
@@ -41,9 +41,11 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
41 |
showPhoneField,
|
42 |
requireCompanyField,
|
43 |
requirePhoneField,
|
|
|
44 |
showPolicyLinks,
|
45 |
showReturnToCart,
|
46 |
cartPageId,
|
|
|
47 |
} = attributes;
|
48 |
const { currentPostId } = useEditorContext();
|
49 |
const { current: savedCartPageId } = useRef( cartPageId );
|
@@ -148,6 +150,28 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
148 |
/>
|
149 |
) }
|
150 |
</PanelBody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
<PanelBody
|
152 |
title={ __(
|
153 |
'Navigation options',
|
@@ -239,29 +263,44 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
|
|
239 |
} }
|
240 |
/>
|
241 |
) }
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
</InspectorControls>
|
250 |
);
|
251 |
};
|
252 |
|
253 |
const CheckoutEditor = ( { attributes, setAttributes } ) => {
|
254 |
const { className, isPreview } = attributes;
|
255 |
-
|
256 |
-
if ( isPreview ) {
|
257 |
-
return checkoutBlockPreview;
|
258 |
-
}
|
259 |
-
|
260 |
return (
|
261 |
<EditorProvider
|
262 |
previewData={ { previewCart, previewSavedPaymentMethods } }
|
263 |
>
|
264 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
265 |
<BlockSettings
|
266 |
attributes={ attributes }
|
267 |
setAttributes={ setAttributes }
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import classnames from 'classnames';
|
5 |
import { __ } from '@wordpress/i18n';
|
6 |
+
import { CartCheckoutFeedbackPrompt } from '@woocommerce/block-components/feedback-prompt';
|
7 |
import { InspectorControls } from '@wordpress/block-editor';
|
8 |
import {
|
9 |
PanelBody,
|
26 |
import {
|
27 |
previewCart,
|
28 |
previewSavedPaymentMethods,
|
|
|
29 |
} from '@woocommerce/resource-previews';
|
30 |
|
31 |
/**
|
41 |
showPhoneField,
|
42 |
requireCompanyField,
|
43 |
requirePhoneField,
|
44 |
+
showOrderNotes,
|
45 |
showPolicyLinks,
|
46 |
showReturnToCart,
|
47 |
cartPageId,
|
48 |
+
hasDarkControls,
|
49 |
} = attributes;
|
50 |
const { currentPostId } = useEditorContext();
|
51 |
const { current: savedCartPageId } = useRef( cartPageId );
|
150 |
/>
|
151 |
) }
|
152 |
</PanelBody>
|
153 |
+
<PanelBody
|
154 |
+
title={ __( 'Order notes', 'woo-gutenberg-products-block' ) }
|
155 |
+
>
|
156 |
+
<p className="wc-block-checkout__controls-text">
|
157 |
+
{ __(
|
158 |
+
'Reduce the number of fields to checkout.',
|
159 |
+
'woo-gutenberg-products-block'
|
160 |
+
) }
|
161 |
+
</p>
|
162 |
+
<ToggleControl
|
163 |
+
label={ __(
|
164 |
+
'Allow customers to optionally add order notes',
|
165 |
+
'woo-gutenberg-products-block'
|
166 |
+
) }
|
167 |
+
checked={ showOrderNotes }
|
168 |
+
onChange={ () =>
|
169 |
+
setAttributes( {
|
170 |
+
showOrderNotes: ! showOrderNotes,
|
171 |
+
} )
|
172 |
+
}
|
173 |
+
/>
|
174 |
+
</PanelBody>
|
175 |
<PanelBody
|
176 |
title={ __(
|
177 |
'Navigation options',
|
263 |
} }
|
264 |
/>
|
265 |
) }
|
266 |
+
<PanelBody title={ __( 'Style', 'woo-gutenberg-products-block' ) }>
|
267 |
+
<ToggleControl
|
268 |
+
label={ __(
|
269 |
+
'Dark mode inputs',
|
270 |
+
'woo-gutenberg-products-block'
|
271 |
+
) }
|
272 |
+
help={ __(
|
273 |
+
'Inputs styled specifically for use on dark background colors.',
|
274 |
+
'woo-gutenberg-products-block'
|
275 |
+
) }
|
276 |
+
checked={ hasDarkControls }
|
277 |
+
onChange={ () =>
|
278 |
+
setAttributes( {
|
279 |
+
hasDarkControls: ! hasDarkControls,
|
280 |
+
} )
|
281 |
+
}
|
282 |
+
/>
|
283 |
+
</PanelBody>
|
284 |
+
<CartCheckoutFeedbackPrompt />
|
285 |
</InspectorControls>
|
286 |
);
|
287 |
};
|
288 |
|
289 |
const CheckoutEditor = ( { attributes, setAttributes } ) => {
|
290 |
const { className, isPreview } = attributes;
|
|
|
|
|
|
|
|
|
|
|
291 |
return (
|
292 |
<EditorProvider
|
293 |
previewData={ { previewCart, previewSavedPaymentMethods } }
|
294 |
>
|
295 |
+
<div
|
296 |
+
className={ classnames(
|
297 |
+
className,
|
298 |
+
'wp-block-woocommerce-checkout',
|
299 |
+
{
|
300 |
+
'is-editor-preview': isPreview,
|
301 |
+
}
|
302 |
+
) }
|
303 |
+
>
|
304 |
<BlockSettings
|
305 |
attributes={ attributes }
|
306 |
setAttributes={ setAttributes }
|
assets/js/blocks/cart-checkout/checkout/editor.scss
CHANGED
@@ -22,3 +22,8 @@
|
|
22 |
.components-panel__body-title .components-button {
|
23 |
opacity: 1;
|
24 |
}
|
|
|
|
|
|
|
|
|
|
22 |
.components-panel__body-title .components-button {
|
23 |
opacity: 1;
|
24 |
}
|
25 |
+
|
26 |
+
.wp-block-woocommerce-checkout.is-editor-preview {
|
27 |
+
max-height: 1000px;
|
28 |
+
overflow: hidden;
|
29 |
+
}
|
assets/js/blocks/cart-checkout/checkout/style.scss
CHANGED
@@ -2,9 +2,8 @@
|
|
2 |
top: -96px;
|
3 |
}
|
4 |
|
5 |
-
.wc-block-
|
6 |
-
|
7 |
-
margin-top: $gap;
|
8 |
}
|
9 |
|
10 |
.wc-block-checkout__shipping-option {
|
@@ -196,18 +195,16 @@
|
|
196 |
|
197 |
.wc-block-components-text-input,
|
198 |
.wc-block-components-country-input,
|
199 |
-
.wc-block-components-
|
200 |
float: left;
|
201 |
margin-left: #{$gap-small / 2};
|
202 |
margin-right: #{$gap-small / 2};
|
203 |
position: relative;
|
204 |
width: calc(50% - #{$gap-small});
|
205 |
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
margin-left: 0;
|
210 |
-
margin-right: 0;
|
211 |
}
|
212 |
}
|
213 |
|
@@ -220,6 +217,7 @@
|
|
220 |
.wc-block-components-checkbox {
|
221 |
clear: both;
|
222 |
}
|
|
|
223 |
}
|
224 |
}
|
225 |
}
|
2 |
top: -96px;
|
3 |
}
|
4 |
|
5 |
+
.wc-block-checkout__use-address-for-billing {
|
6 |
+
margin-top: em($gap-large);
|
|
|
7 |
}
|
8 |
|
9 |
.wc-block-checkout__shipping-option {
|
195 |
|
196 |
.wc-block-components-text-input,
|
197 |
.wc-block-components-country-input,
|
198 |
+
.wc-block-components-state-input {
|
199 |
float: left;
|
200 |
margin-left: #{$gap-small / 2};
|
201 |
margin-right: #{$gap-small / 2};
|
202 |
position: relative;
|
203 |
width: calc(50% - #{$gap-small});
|
204 |
|
205 |
+
&:nth-of-type(2),
|
206 |
+
&:first-of-type {
|
207 |
+
margin-top: 0;
|
|
|
|
|
208 |
}
|
209 |
}
|
210 |
|
217 |
.wc-block-components-checkbox {
|
218 |
clear: both;
|
219 |
}
|
220 |
+
|
221 |
}
|
222 |
}
|
223 |
}
|
assets/js/blocks/product-search/edit.js
CHANGED
@@ -5,7 +5,7 @@ import { __ } from '@wordpress/i18n';
|
|
5 |
import classnames from 'classnames';
|
6 |
import PropTypes from 'prop-types';
|
7 |
import { InspectorControls, PlainText } from '@wordpress/block-editor';
|
8 |
-
import { PanelBody, ToggleControl } from '@wordpress/components';
|
9 |
import { withInstanceId } from '@wordpress/compose';
|
10 |
|
11 |
/**
|
@@ -75,7 +75,7 @@ const Edit = ( {
|
|
75 |
/>
|
76 |
) }
|
77 |
<div className="wc-block-product-search__fields">
|
78 |
-
<
|
79 |
className="wc-block-product-search__field input-control"
|
80 |
value={ placeholder }
|
81 |
onChange={ ( value ) =>
|
5 |
import classnames from 'classnames';
|
6 |
import PropTypes from 'prop-types';
|
7 |
import { InspectorControls, PlainText } from '@wordpress/block-editor';
|
8 |
+
import { PanelBody, ToggleControl, TextControl } from '@wordpress/components';
|
9 |
import { withInstanceId } from '@wordpress/compose';
|
10 |
|
11 |
/**
|
75 |
/>
|
76 |
) }
|
77 |
<div className="wc-block-product-search__fields">
|
78 |
+
<TextControl
|
79 |
className="wc-block-product-search__field input-control"
|
80 |
value={ placeholder }
|
81 |
onChange={ ( value ) =>
|
assets/js/blocks/products/utils.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Button, Placeholder } from '@wordpress/components';
|
6 |
import classNames from 'classnames';
|
7 |
-
import {
|
8 |
import { Icon, external } from '@woocommerce/icons';
|
9 |
|
10 |
export const getBlockClassName = ( blockClassName, attributes ) => {
|
@@ -35,7 +35,7 @@ export const renderNoProductsPlaceholder = ( blockTitle, blockIcon ) => (
|
|
35 |
className="wc-block-products__add-product-button"
|
36 |
isDefault
|
37 |
isLarge
|
38 |
-
href={
|
39 |
>
|
40 |
{ __( 'Add new product', 'woo-gutenberg-products-block' ) + ' ' }
|
41 |
<Icon srcElement={ external } />
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Button, Placeholder } from '@wordpress/components';
|
6 |
import classNames from 'classnames';
|
7 |
+
import { ADMIN_URL } from '@woocommerce/settings';
|
8 |
import { Icon, external } from '@woocommerce/icons';
|
9 |
|
10 |
export const getBlockClassName = ( blockClassName, attributes ) => {
|
35 |
className="wc-block-products__add-product-button"
|
36 |
isDefault
|
37 |
isLarge
|
38 |
+
href={ ADMIN_URL + 'post-new.php?post_type=product' }
|
39 |
>
|
40 |
{ __( 'Add new product', 'woo-gutenberg-products-block' ) + ' ' }
|
41 |
<Icon srcElement={ external } />
|
assets/js/blocks/reviews/all-reviews/edit.js
CHANGED
@@ -62,7 +62,6 @@ const AllReviewsEditor = ( { attributes, setAttributes } ) => {
|
|
62 |
{ getInspectorControls() }
|
63 |
<EditorContainerBlock
|
64 |
attributes={ attributes }
|
65 |
-
className="wc-block-all-reviews"
|
66 |
icon={
|
67 |
<Icon
|
68 |
icon={ discussion }
|
62 |
{ getInspectorControls() }
|
63 |
<EditorContainerBlock
|
64 |
attributes={ attributes }
|
|
|
65 |
icon={
|
66 |
<Icon
|
67 |
icon={ discussion }
|
assets/js/blocks/reviews/editor-container-block.js
CHANGED
@@ -31,7 +31,7 @@ class EditorContainerBlock extends Component {
|
|
31 |
}
|
32 |
|
33 |
render() {
|
34 |
-
const { attributes,
|
35 |
const {
|
36 |
categoryIds,
|
37 |
productId,
|
@@ -57,7 +57,7 @@ class EditorContainerBlock extends Component {
|
|
57 |
}
|
58 |
|
59 |
return (
|
60 |
-
<div className={ getBlockClassName(
|
61 |
<EditorBlock
|
62 |
attributes={ attributes }
|
63 |
categoryIds={ categoryIds }
|
31 |
}
|
32 |
|
33 |
render() {
|
34 |
+
const { attributes, noReviewsPlaceholder } = this.props;
|
35 |
const {
|
36 |
categoryIds,
|
37 |
productId,
|
57 |
}
|
58 |
|
59 |
return (
|
60 |
+
<div className={ getBlockClassName( attributes ) }>
|
61 |
<EditorBlock
|
62 |
attributes={ attributes }
|
63 |
categoryIds={ categoryIds }
|
assets/js/blocks/reviews/reviews-by-category/edit.js
CHANGED
@@ -174,7 +174,6 @@ const ReviewsByCategoryEditor = ( {
|
|
174 |
{ getInspectorControls() }
|
175 |
<EditorContainerBlock
|
176 |
attributes={ attributes }
|
177 |
-
className="wc-block-reviews-by-category"
|
178 |
icon={
|
179 |
<Icon
|
180 |
srcElement={ review }
|
174 |
{ getInspectorControls() }
|
175 |
<EditorContainerBlock
|
176 |
attributes={ attributes }
|
|
|
177 |
icon={
|
178 |
<Icon
|
179 |
srcElement={ review }
|
assets/js/blocks/reviews/reviews-by-product/edit.js
CHANGED
@@ -162,7 +162,6 @@ const ReviewsByProductEditor = ( {
|
|
162 |
{ getInspectorControls() }
|
163 |
<EditorContainerBlock
|
164 |
attributes={ attributes }
|
165 |
-
className="wc-block-reviews-by-product"
|
166 |
icon={
|
167 |
<Icon
|
168 |
icon={ comment }
|
162 |
{ getInspectorControls() }
|
163 |
<EditorContainerBlock
|
164 |
attributes={ attributes }
|
|
|
165 |
icon={
|
166 |
<Icon
|
167 |
icon={ comment }
|
assets/js/blocks/reviews/save.js
CHANGED
@@ -2,44 +2,13 @@
|
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
import './editor.scss';
|
5 |
-
import { getBlockClassName } from './utils.js';
|
6 |
|
7 |
export default ( { attributes } ) => {
|
8 |
-
const {
|
9 |
-
categoryIds,
|
10 |
-
imageType,
|
11 |
-
orderby,
|
12 |
-
productId,
|
13 |
-
reviewsOnPageLoad,
|
14 |
-
reviewsOnLoadMore,
|
15 |
-
showLoadMore,
|
16 |
-
showOrderby,
|
17 |
-
} = attributes;
|
18 |
-
|
19 |
-
const data = {
|
20 |
-
'data-image-type': imageType,
|
21 |
-
'data-orderby': orderby,
|
22 |
-
'data-reviews-on-page-load': reviewsOnPageLoad,
|
23 |
-
'data-reviews-on-load-more': reviewsOnLoadMore,
|
24 |
-
'data-show-load-more': showLoadMore,
|
25 |
-
'data-show-orderby': showOrderby,
|
26 |
-
};
|
27 |
-
let className = 'wc-block-all-reviews';
|
28 |
-
|
29 |
-
if ( productId ) {
|
30 |
-
data[ 'data-product-id' ] = productId;
|
31 |
-
className = 'wc-block-reviews-by-product';
|
32 |
-
}
|
33 |
-
|
34 |
-
if ( Array.isArray( categoryIds ) ) {
|
35 |
-
data[ 'data-category-ids' ] = categoryIds.join( ',' );
|
36 |
-
className = 'wc-block-reviews-by-category';
|
37 |
-
}
|
38 |
-
|
39 |
return (
|
40 |
<div
|
41 |
-
className={ getBlockClassName(
|
42 |
-
{ ...
|
43 |
/>
|
44 |
);
|
45 |
};
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
import './editor.scss';
|
5 |
+
import { getBlockClassName, getDataAttrs } from './utils.js';
|
6 |
|
7 |
export default ( { attributes } ) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
return (
|
9 |
<div
|
10 |
+
className={ getBlockClassName( attributes ) }
|
11 |
+
{ ...getDataAttrs( attributes ) }
|
12 |
/>
|
13 |
);
|
14 |
};
|
assets/js/blocks/reviews/utils.js
CHANGED
@@ -46,9 +46,11 @@ export const getReviews = ( args ) => {
|
|
46 |
} );
|
47 |
};
|
48 |
|
49 |
-
export const getBlockClassName = (
|
50 |
const {
|
51 |
className,
|
|
|
|
|
52 |
showReviewDate,
|
53 |
showReviewerName,
|
54 |
showReviewContent,
|
@@ -57,6 +59,16 @@ export const getBlockClassName = ( blockClassName, attributes ) => {
|
|
57 |
showReviewRating,
|
58 |
} = attributes;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
return classNames( blockClassName, className, {
|
61 |
'has-image': showReviewImage,
|
62 |
'has-name': showReviewerName,
|
@@ -66,3 +78,35 @@ export const getBlockClassName = ( blockClassName, attributes ) => {
|
|
66 |
'has-product-name': showProductName,
|
67 |
} );
|
68 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
} );
|
47 |
};
|
48 |
|
49 |
+
export const getBlockClassName = ( attributes ) => {
|
50 |
const {
|
51 |
className,
|
52 |
+
categoryIds,
|
53 |
+
productId,
|
54 |
showReviewDate,
|
55 |
showReviewerName,
|
56 |
showReviewContent,
|
59 |
showReviewRating,
|
60 |
} = attributes;
|
61 |
|
62 |
+
let blockClassName = 'wc-block-all-reviews';
|
63 |
+
|
64 |
+
if ( productId ) {
|
65 |
+
blockClassName = 'wc-block-reviews-by-product';
|
66 |
+
}
|
67 |
+
|
68 |
+
if ( Array.isArray( categoryIds ) ) {
|
69 |
+
blockClassName = 'wc-block-reviews-by-category';
|
70 |
+
}
|
71 |
+
|
72 |
return classNames( blockClassName, className, {
|
73 |
'has-image': showReviewImage,
|
74 |
'has-name': showReviewerName,
|
78 |
'has-product-name': showProductName,
|
79 |
} );
|
80 |
};
|
81 |
+
|
82 |
+
export const getDataAttrs = ( attributes ) => {
|
83 |
+
const {
|
84 |
+
categoryIds,
|
85 |
+
imageType,
|
86 |
+
orderby,
|
87 |
+
productId,
|
88 |
+
reviewsOnPageLoad,
|
89 |
+
reviewsOnLoadMore,
|
90 |
+
showLoadMore,
|
91 |
+
showOrderby,
|
92 |
+
} = attributes;
|
93 |
+
|
94 |
+
const data = {
|
95 |
+
'data-image-type': imageType,
|
96 |
+
'data-orderby': orderby,
|
97 |
+
'data-reviews-on-page-load': reviewsOnPageLoad,
|
98 |
+
'data-reviews-on-load-more': reviewsOnLoadMore,
|
99 |
+
'data-show-load-more': showLoadMore,
|
100 |
+
'data-show-orderby': showOrderby,
|
101 |
+
};
|
102 |
+
|
103 |
+
if ( productId ) {
|
104 |
+
data[ 'data-product-id' ] = productId;
|
105 |
+
}
|
106 |
+
|
107 |
+
if ( Array.isArray( categoryIds ) ) {
|
108 |
+
data[ 'data-category-ids' ] = categoryIds.join( ',' );
|
109 |
+
}
|
110 |
+
|
111 |
+
return data;
|
112 |
+
};
|
assets/js/blocks/single-product/block.js
CHANGED
@@ -6,6 +6,7 @@ import {
|
|
6 |
InnerBlockLayoutContextProvider,
|
7 |
ProductDataContextProvider,
|
8 |
} from '@woocommerce/shared-context';
|
|
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
@@ -17,6 +18,7 @@ import { BLOCK_NAME } from './constants';
|
|
17 |
*/
|
18 |
const Block = ( { isLoading, product, children } ) => {
|
19 |
const className = 'wc-block-single-product wc-block-layout';
|
|
|
20 |
|
21 |
return (
|
22 |
<InnerBlockLayoutContextProvider
|
@@ -27,7 +29,9 @@ const Block = ( { isLoading, product, children } ) => {
|
|
27 |
product={ product }
|
28 |
isLoading={ isLoading }
|
29 |
>
|
30 |
-
<
|
|
|
|
|
31 |
</ProductDataContextProvider>
|
32 |
</InnerBlockLayoutContextProvider>
|
33 |
);
|
6 |
InnerBlockLayoutContextProvider,
|
7 |
ProductDataContextProvider,
|
8 |
} from '@woocommerce/shared-context';
|
9 |
+
import { StoreNoticesProvider } from '@woocommerce/base-context';
|
10 |
|
11 |
/**
|
12 |
* Internal dependencies
|
18 |
*/
|
19 |
const Block = ( { isLoading, product, children } ) => {
|
20 |
const className = 'wc-block-single-product wc-block-layout';
|
21 |
+
const noticeContext = `woocommerce/single-product/${ product?.id || 0 }`;
|
22 |
|
23 |
return (
|
24 |
<InnerBlockLayoutContextProvider
|
29 |
product={ product }
|
30 |
isLoading={ isLoading }
|
31 |
>
|
32 |
+
<StoreNoticesProvider context={ noticeContext }>
|
33 |
+
<div className={ className }>{ children }</div>
|
34 |
+
</StoreNoticesProvider>
|
35 |
</ProductDataContextProvider>
|
36 |
</InnerBlockLayoutContextProvider>
|
37 |
);
|
assets/js/blocks/single-product/frontend.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import { StoreNoticesProvider } from '@woocommerce/base-context';
|
5 |
import { getValidBlockAttributes } from '@woocommerce/base-utils';
|
6 |
import {
|
7 |
renderParentBlock,
|
@@ -15,19 +14,6 @@ import Block from './block';
|
|
15 |
import blockAttributes from './attributes';
|
16 |
import { BLOCK_NAME } from './constants';
|
17 |
|
18 |
-
/**
|
19 |
-
* Wrapper component to supply the notice provider.
|
20 |
-
*
|
21 |
-
* @param {*} props
|
22 |
-
*/
|
23 |
-
const FrontendBlock = ( props ) => {
|
24 |
-
return (
|
25 |
-
<StoreNoticesProvider context="woocommerce/single-product">
|
26 |
-
<Block { ...props } />
|
27 |
-
</StoreNoticesProvider>
|
28 |
-
);
|
29 |
-
};
|
30 |
-
|
31 |
const getProps = ( el ) => {
|
32 |
return {
|
33 |
attributes: getValidBlockAttributes( blockAttributes, el.dataset ),
|
@@ -35,7 +21,7 @@ const getProps = ( el ) => {
|
|
35 |
};
|
36 |
|
37 |
renderParentBlock( {
|
38 |
-
Block
|
39 |
blockName: BLOCK_NAME,
|
40 |
selector: '.wp-block-woocommerce-single-product',
|
41 |
getProps,
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { getValidBlockAttributes } from '@woocommerce/base-utils';
|
5 |
import {
|
6 |
renderParentBlock,
|
14 |
import blockAttributes from './attributes';
|
15 |
import { BLOCK_NAME } from './constants';
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
const getProps = ( el ) => {
|
18 |
return {
|
19 |
attributes: getValidBlockAttributes( blockAttributes, el.dataset ),
|
21 |
};
|
22 |
|
23 |
renderParentBlock( {
|
24 |
+
Block,
|
25 |
blockName: BLOCK_NAME,
|
26 |
selector: '.wp-block-woocommerce-single-product',
|
27 |
getProps,
|
assets/js/components/feedback-prompt/index.js
CHANGED
@@ -13,7 +13,10 @@ import './style.scss';
|
|
13 |
/**
|
14 |
* Component to render a Feedback prompt in the sidebar.
|
15 |
*/
|
16 |
-
const FeedbackPrompt = ( {
|
|
|
|
|
|
|
17 |
return (
|
18 |
<div className="wc-block-feedback-prompt">
|
19 |
<Icon srcElement={ comment } />
|
@@ -22,7 +25,7 @@ const FeedbackPrompt = ( { text } ) => {
|
|
22 |
</h2>
|
23 |
<p className="wc-block-feedback-prompt__text">{ text }</p>
|
24 |
<a
|
25 |
-
href=
|
26 |
className="wc-block-feedback-prompt__link"
|
27 |
rel="noreferrer noopener"
|
28 |
target="_blank"
|
@@ -39,6 +42,17 @@ const FeedbackPrompt = ( { text } ) => {
|
|
39 |
|
40 |
FeedbackPrompt.propTypes = {
|
41 |
text: PropTypes.string,
|
|
|
42 |
};
|
43 |
|
44 |
export default FeedbackPrompt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
/**
|
14 |
* Component to render a Feedback prompt in the sidebar.
|
15 |
*/
|
16 |
+
const FeedbackPrompt = ( {
|
17 |
+
text,
|
18 |
+
url = 'https://ideas.woocommerce.com/forums/133476-woocommerce?category_id=384565',
|
19 |
+
} ) => {
|
20 |
return (
|
21 |
<div className="wc-block-feedback-prompt">
|
22 |
<Icon srcElement={ comment } />
|
25 |
</h2>
|
26 |
<p className="wc-block-feedback-prompt__text">{ text }</p>
|
27 |
<a
|
28 |
+
href={ url }
|
29 |
className="wc-block-feedback-prompt__link"
|
30 |
rel="noreferrer noopener"
|
31 |
target="_blank"
|
42 |
|
43 |
FeedbackPrompt.propTypes = {
|
44 |
text: PropTypes.string,
|
45 |
+
url: PropTypes.string,
|
46 |
};
|
47 |
|
48 |
export default FeedbackPrompt;
|
49 |
+
|
50 |
+
export const CartCheckoutFeedbackPrompt = () => (
|
51 |
+
<FeedbackPrompt
|
52 |
+
text={ __(
|
53 |
+
'We are currently working on improving our cart and checkout blocks to provide merchants with the tools and customization options they need.',
|
54 |
+
'woo-gutenberg-products-block'
|
55 |
+
) }
|
56 |
+
url="https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/new?template=--cart-checkout-feedback.md"
|
57 |
+
/>
|
58 |
+
);
|
assets/js/hocs/index.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
export { default as withAttributes } from './with-attributes';
|
2 |
export { default as withCategories } from './with-categories';
|
3 |
export { default as withCategory } from './with-category';
|
4 |
-
export { default as withFeedbackPrompt } from './with-feedback-prompt';
|
5 |
export { default as withProduct } from './with-product';
|
6 |
export { default as withProductVariations } from './with-product-variations';
|
7 |
export { default as withSearchedProducts } from './with-searched-products';
|
1 |
export { default as withAttributes } from './with-attributes';
|
2 |
export { default as withCategories } from './with-categories';
|
3 |
export { default as withCategory } from './with-category';
|
|
|
4 |
export { default as withProduct } from './with-product';
|
5 |
export { default as withProductVariations } from './with-product-variations';
|
6 |
export { default as withSearchedProducts } from './with-searched-products';
|
assets/js/hocs/with-feedback-prompt/index.js
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { Fragment } from '@wordpress/element';
|
5 |
-
import { InspectorControls } from '@wordpress/block-editor';
|
6 |
-
import { createHigherOrderComponent } from '@wordpress/compose';
|
7 |
-
import FeedbackPrompt from '@woocommerce/block-components/feedback-prompt';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Adds a feedback prompt with custom text to the editor sidebar.
|
11 |
-
*
|
12 |
-
* @param {string} content Text to display in the feedback prompt.
|
13 |
-
*
|
14 |
-
* @return {Function} Function that returns the wrapped component.
|
15 |
-
*/
|
16 |
-
const withFeedbackPrompt = ( content ) =>
|
17 |
-
/**
|
18 |
-
* Adds a feedback prompt to the provided component.
|
19 |
-
*
|
20 |
-
* @param {WPComponent} BlockEdit Original component.
|
21 |
-
*
|
22 |
-
* @return {WPComponent} Wrapped component.
|
23 |
-
*/
|
24 |
-
createHigherOrderComponent( ( BlockEdit ) => {
|
25 |
-
return ( props ) => (
|
26 |
-
<Fragment>
|
27 |
-
<InspectorControls>
|
28 |
-
<FeedbackPrompt text={ content } />
|
29 |
-
</InspectorControls>
|
30 |
-
<BlockEdit { ...props } />
|
31 |
-
</Fragment>
|
32 |
-
);
|
33 |
-
}, 'withFeedbackPrompt' );
|
34 |
-
|
35 |
-
export default withFeedbackPrompt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/payment-method-extensions/payment-methods/cheque/index.js
CHANGED
@@ -33,7 +33,7 @@ const Content = () => {
|
|
33 |
*/
|
34 |
const Label = ( props ) => {
|
35 |
const { PaymentMethodLabel } = props.components;
|
36 |
-
return <PaymentMethodLabel
|
37 |
};
|
38 |
|
39 |
/**
|
33 |
*/
|
34 |
const Label = ( props ) => {
|
35 |
const { PaymentMethodLabel } = props.components;
|
36 |
+
return <PaymentMethodLabel text={ label } />;
|
37 |
};
|
38 |
|
39 |
/**
|
assets/js/payment-method-extensions/payment-methods/stripe/credit-card/index.js
CHANGED
@@ -38,7 +38,6 @@ const StripeLabel = ( props ) => {
|
|
38 |
|
39 |
return (
|
40 |
<PaymentMethodLabel
|
41 |
-
icon="card"
|
42 |
text={ __( 'Credit / Debit Card', 'woo-gutenberg-products-block' ) }
|
43 |
/>
|
44 |
);
|
38 |
|
39 |
return (
|
40 |
<PaymentMethodLabel
|
|
|
41 |
text={ __( 'Credit / Debit Card', 'woo-gutenberg-products-block' ) }
|
42 |
/>
|
43 |
);
|
assets/js/payment-method-extensions/payment-methods/stripe/index.js
CHANGED
@@ -11,8 +11,15 @@ import {
|
|
11 |
*/
|
12 |
import stripeCcPaymentMethod from './credit-card';
|
13 |
import PaymentRequestPaymentMethod from './payment-request';
|
|
|
14 |
|
|
|
15 |
registerPaymentMethod( ( Config ) => new Config( stripeCcPaymentMethod ) );
|
16 |
-
|
17 |
-
|
18 |
-
)
|
|
|
|
|
|
|
|
|
|
11 |
*/
|
12 |
import stripeCcPaymentMethod from './credit-card';
|
13 |
import PaymentRequestPaymentMethod from './payment-request';
|
14 |
+
import { getStripeServerData } from './stripe-utils';
|
15 |
|
16 |
+
// Register Stripe Credit Card.
|
17 |
registerPaymentMethod( ( Config ) => new Config( stripeCcPaymentMethod ) );
|
18 |
+
|
19 |
+
// Register Stripe Payment Request (Apple/Chrome Pay) if enabled.
|
20 |
+
if ( getStripeServerData().allowPaymentRequest ) {
|
21 |
+
registerExpressPaymentMethod(
|
22 |
+
( Config ) => new Config( PaymentRequestPaymentMethod )
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
assets/js/payment-method-extensions/payment-methods/stripe/stripe-utils/type-defs.js
CHANGED
@@ -277,25 +277,27 @@
|
|
277 |
/**
|
278 |
* @typedef {Object} StripeServerData
|
279 |
*
|
280 |
-
* @property {string} stripeTotalLabel
|
281 |
-
*
|
282 |
-
* @property {string} publicKey
|
283 |
-
*
|
284 |
-
* @property {boolean} allowPrepaidCard
|
285 |
-
*
|
286 |
-
* @property {Object} button
|
287 |
-
* @property {string} button.type
|
288 |
-
* @property {string} button.theme
|
289 |
-
* @property {string} button.height
|
290 |
-
*
|
291 |
-
* @property {string} button.locale
|
292 |
-
*
|
293 |
-
* @property {boolean} inline_cc_form
|
294 |
-
*
|
295 |
-
*
|
296 |
-
* @property {{[k:string]:CreditCardIcon}} icons
|
297 |
-
* @property {boolean} allowSavedCards
|
298 |
-
*
|
|
|
|
|
299 |
*/
|
300 |
|
301 |
/**
|
277 |
/**
|
278 |
* @typedef {Object} StripeServerData
|
279 |
*
|
280 |
+
* @property {string} stripeTotalLabel The string used for payment
|
281 |
+
* descriptor.
|
282 |
+
* @property {string} publicKey The public api key for stripe
|
283 |
+
* requests.
|
284 |
+
* @property {boolean} allowPrepaidCard True means that prepaid cards
|
285 |
+
* can be used for payment.
|
286 |
+
* @property {Object} button Contains button styles
|
287 |
+
* @property {string} button.type The type of button.
|
288 |
+
* @property {string} button.theme The theme for the button.
|
289 |
+
* @property {string} button.height The height (in pixels) for
|
290 |
+
* the button.
|
291 |
+
* @property {string} button.locale The locale to use for stripe
|
292 |
+
* elements.
|
293 |
+
* @property {boolean} inline_cc_form Whether stripe cc should use
|
294 |
+
* inline cc
|
295 |
+
* form or separate inputs.
|
296 |
+
* @property {{[k:string]:CreditCardIcon}} icons Contains supported cc icons.
|
297 |
+
* @property {boolean} allowSavedCards Used to indicate whether saved cards
|
298 |
+
* can be used.
|
299 |
+
* @property {boolean} allowPaymentRequest True if merchant has enabled payment
|
300 |
+
* request (Chrome/Apple Pay).
|
301 |
*/
|
302 |
|
303 |
/**
|
assets/js/previews/cart-block.js
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { WC_BLOCKS_ASSET_URL } from '@woocommerce/block-settings';
|
5 |
-
|
6 |
-
export const cartBlockPreview = (
|
7 |
-
<img
|
8 |
-
src={ WC_BLOCKS_ASSET_URL + 'img/cart-preview.svg' }
|
9 |
-
alt=""
|
10 |
-
width="230"
|
11 |
-
height="250"
|
12 |
-
style={ {
|
13 |
-
width: '100%',
|
14 |
-
} }
|
15 |
-
/>
|
16 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/previews/checkout-block.js
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { WC_BLOCKS_ASSET_URL } from '@woocommerce/block-settings';
|
5 |
-
|
6 |
-
export const checkoutBlockPreview = (
|
7 |
-
<img
|
8 |
-
src={ WC_BLOCKS_ASSET_URL + 'img/checkout-preview.svg' }
|
9 |
-
alt=""
|
10 |
-
width="230"
|
11 |
-
height="250"
|
12 |
-
style={ {
|
13 |
-
width: '100%',
|
14 |
-
} }
|
15 |
-
/>
|
16 |
-
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/previews/index.js
CHANGED
@@ -5,7 +5,5 @@ export { previewCategories } from './categories';
|
|
5 |
export { previewShippingRates } from './shipping-rates';
|
6 |
export { previewSavedPaymentMethods } from './saved-payment-methods';
|
7 |
|
8 |
-
export { cartBlockPreview } from './cart-block';
|
9 |
-
export { checkoutBlockPreview } from './checkout-block';
|
10 |
export { gridBlockPreview } from './grid-block';
|
11 |
export { singleProductBlockPreview } from './single-product-block';
|
5 |
export { previewShippingRates } from './shipping-rates';
|
6 |
export { previewSavedPaymentMethods } from './saved-payment-methods';
|
7 |
|
|
|
|
|
8 |
export { gridBlockPreview } from './grid-block';
|
9 |
export { singleProductBlockPreview } from './single-product-block';
|
assets/js/settings/blocks/constants.js
CHANGED
@@ -31,6 +31,10 @@ export const DISPLAY_ITEMIZED_TAXES = getSetting(
|
|
31 |
'displayItemizedTaxes',
|
32 |
false
|
33 |
);
|
|
|
|
|
|
|
|
|
34 |
export const DISPLAY_SHOP_PRICES_INCLUDING_TAX = getSetting(
|
35 |
'displayShopPricesIncludingTax',
|
36 |
false
|
@@ -64,6 +68,11 @@ export const SHIPPING_METHODS_EXIST = getSetting(
|
|
64 |
false
|
65 |
);
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
export const CHECKOUT_SHOW_LOGIN_REMINDER = getSetting(
|
68 |
'checkoutShowLoginReminder',
|
69 |
true
|
31 |
'displayItemizedTaxes',
|
32 |
false
|
33 |
);
|
34 |
+
export const HAS_DARK_EDITOR_STYLE_SUPPORT = getSetting(
|
35 |
+
'hasDarkEditorStyleSupport',
|
36 |
+
false
|
37 |
+
);
|
38 |
export const DISPLAY_SHOP_PRICES_INCLUDING_TAX = getSetting(
|
39 |
'displayShopPricesIncludingTax',
|
40 |
false
|
68 |
false
|
69 |
);
|
70 |
|
71 |
+
export const PAYMENT_GATEWAY_SORT_ORDER = getSetting(
|
72 |
+
'paymentGatewaySortOrder',
|
73 |
+
[]
|
74 |
+
);
|
75 |
+
|
76 |
export const CHECKOUT_SHOW_LOGIN_REMINDER = getSetting(
|
77 |
'checkoutShowLoginReminder',
|
78 |
true
|
assets/js/settings/shared/set-setting.js
CHANGED
@@ -3,17 +3,35 @@
|
|
3 |
*/
|
4 |
import { allSettings } from './settings-init';
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
/**
|
7 |
* Sets a value to a property on the settings state.
|
8 |
*
|
9 |
* @export
|
10 |
* @param {string} name The setting property key for the
|
11 |
* setting being mutated.
|
12 |
-
* @param {*}
|
13 |
* @param {Function} [filter=( val ) => val] Allows for providing a callback
|
14 |
* to sanitize the setting (eg.
|
15 |
* ensure it's a number)
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
export function setSetting( name, value, filter = ( val ) => val ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
allSettings[ name ] = filter( value );
|
19 |
}
|
3 |
*/
|
4 |
import { allSettings } from './settings-init';
|
5 |
|
6 |
+
/**
|
7 |
+
* External dependencies
|
8 |
+
*/
|
9 |
+
import deprecated from '@wordpress/deprecated';
|
10 |
+
|
11 |
/**
|
12 |
* Sets a value to a property on the settings state.
|
13 |
*
|
14 |
* @export
|
15 |
* @param {string} name The setting property key for the
|
16 |
* setting being mutated.
|
17 |
+
* @param {*} value The value to set.
|
18 |
* @param {Function} [filter=( val ) => val] Allows for providing a callback
|
19 |
* to sanitize the setting (eg.
|
20 |
* ensure it's a number)
|
21 |
+
*
|
22 |
+
* @todo Remove setSetting function from `@woocommerce/settings`.
|
23 |
+
*
|
24 |
+
* The `wc.wcSettings.setSetting` function was deprecated beginning with WooCommerce Blocks 3.2.0
|
25 |
+
* and can be removed completely with WooCommerce Blocks 3.8.0 (that gives 6 versions of the
|
26 |
+
* feature plugin for warning and 3 versions of WooCommerce core).
|
27 |
*/
|
28 |
export function setSetting( name, value, filter = ( val ) => val ) {
|
29 |
+
deprecated( 'setSetting', {
|
30 |
+
version: '3.8.0',
|
31 |
+
alternative: `a locally scoped value for "${ name }"`,
|
32 |
+
plugin: 'WooCommerce Blocks',
|
33 |
+
hint:
|
34 |
+
'wc.wcSettings is a global settings configuration object that should not be mutated during a session. Hence the removal of this function.',
|
35 |
+
} );
|
36 |
allSettings[ name ] = filter( value );
|
37 |
}
|
assets/js/settings/shared/test/compare-with-wp-version.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { compareWithWpVersion, setSetting } from '..';
|
5 |
|
6 |
describe( 'compareWithWpVersion', () => {
|
|
|
7 |
it.each`
|
8 |
version | operator | result
|
9 |
${'5.3-beta1'} | ${'>'} | ${true}
|
@@ -18,6 +19,12 @@ describe( 'compareWithWpVersion', () => {
|
|
18 |
'and `5.3` is the version compared using `$operator`',
|
19 |
( { version, operator, result } ) => {
|
20 |
setSetting( 'wpVersion', version );
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
expect( compareWithWpVersion( '5.3', operator ) ).toBe( result );
|
22 |
}
|
23 |
);
|
4 |
import { compareWithWpVersion, setSetting } from '..';
|
5 |
|
6 |
describe( 'compareWithWpVersion', () => {
|
7 |
+
let initial = true;
|
8 |
it.each`
|
9 |
version | operator | result
|
10 |
${'5.3-beta1'} | ${'>'} | ${true}
|
19 |
'and `5.3` is the version compared using `$operator`',
|
20 |
( { version, operator, result } ) => {
|
21 |
setSetting( 'wpVersion', version );
|
22 |
+
// deprecated caches messages once per session, so we only check
|
23 |
+
// console warn on initial call.
|
24 |
+
if ( initial ) {
|
25 |
+
expect( console ).toHaveWarned();
|
26 |
+
}
|
27 |
+
initial = false;
|
28 |
expect( compareWithWpVersion( '5.3', operator ) ).toBe( result );
|
29 |
}
|
30 |
);
|
assets/js/settings/shared/test/set-setting.js
CHANGED
@@ -7,14 +7,17 @@ import { getSetting } from '../get-setting';
|
|
7 |
describe( 'setSetting', () => {
|
8 |
it( 'should add a new value to the settings state for value not present', () => {
|
9 |
setSetting( 'aSetting', 42 );
|
|
|
10 |
expect( getSetting( 'aSetting' ) ).toBe( 42 );
|
11 |
} );
|
12 |
it( 'should replace existing value', () => {
|
13 |
setSetting( 'adminUrl', 'not original' );
|
|
|
14 |
expect( getSetting( 'adminUrl' ) ).toBe( 'not original' );
|
15 |
} );
|
16 |
it( 'should save the value run through the provided filter', () => {
|
17 |
-
setSetting( '
|
|
|
18 |
expect( getSetting( 'aSetting' ) ).toBe( 42 );
|
19 |
} );
|
20 |
} );
|
7 |
describe( 'setSetting', () => {
|
8 |
it( 'should add a new value to the settings state for value not present', () => {
|
9 |
setSetting( 'aSetting', 42 );
|
10 |
+
expect( console ).toHaveWarned();
|
11 |
expect( getSetting( 'aSetting' ) ).toBe( 42 );
|
12 |
} );
|
13 |
it( 'should replace existing value', () => {
|
14 |
setSetting( 'adminUrl', 'not original' );
|
15 |
+
expect( console ).toHaveWarned();
|
16 |
expect( getSetting( 'adminUrl' ) ).toBe( 'not original' );
|
17 |
} );
|
18 |
it( 'should save the value run through the provided filter', () => {
|
19 |
+
setSetting( 'bSetting', 'who', () => 42 );
|
20 |
+
expect( console ).toHaveWarned();
|
21 |
expect( getSetting( 'aSetting' ) ).toBe( 42 );
|
22 |
} );
|
23 |
} );
|
assets/js/type-defs/add-to-cart-form.js
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* @typedef {Object} AddToCartFormDispatchActions
|
3 |
+
*
|
4 |
+
* @property {function():void} resetForm Dispatches an action that resets the form to a
|
5 |
+
* pristine state.
|
6 |
+
* @property {function():void} submitForm Dispatches an action that tells the form to submit.
|
7 |
+
* @property {function(number):void} setQuantity Dispatches an action that sets the quantity to
|
8 |
+
* the given value.
|
9 |
+
* @property {function(Object):void} setRequestParams Dispatches an action that sets params for the
|
10 |
+
* add to cart request (key value pairs).
|
11 |
+
* @property {function(boolean=):void} setHasError Dispatches an action that sets the status to
|
12 |
+
* having an error.
|
13 |
+
* @property {function(Object):void} setAfterProcessing Dispatches an action that sets the status to
|
14 |
+
* after processing and also sets the response
|
15 |
+
* data accordingly.
|
16 |
+
*/
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @typedef {Object} AddToCartFormEventRegistration
|
20 |
+
*
|
21 |
+
* @property {function(function():boolean|Object,number=):function():void} onAddToCartAfterProcessingWithSuccess Used to register a callback that will fire after form has been processed and there are no errors.
|
22 |
+
* @property {function(function():boolean|Object,number=):function():void} onAddToCartAfterProcessingWithError Used to register a callback that will fire when the form has been processed and has an error.
|
23 |
+
* @property {function(function():boolean|Object,number=):function():void} onAddToCartBeforeProcessing Used to register a callback that will fire when the form has been submitted before being sent off to the server.
|
24 |
+
*/
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @typedef {Object} AddToCartFormStatusConstants
|
28 |
+
*
|
29 |
+
* @property {string} PRISTINE Form is in it's initialized state.
|
30 |
+
* @property {string} IDLE When form state has changed but there is no
|
31 |
+
* activity happening.
|
32 |
+
* @property {string} DISABLED If the form cannot be submitted due to missing
|
33 |
+
* constraints, this status is assigned.
|
34 |
+
* @property {string} BEFORE_PROCESSING This is the state before form processing
|
35 |
+
* begins after the add to cart button has been
|
36 |
+
* pressed. Validation occurs at point point.
|
37 |
+
* @property {string} PROCESSING After BEFORE_PROCESSING status emitters have
|
38 |
+
* finished successfully.
|
39 |
+
* @property {string} AFTER_PROCESSING After server side processing is completed
|
40 |
+
* this status is set.
|
41 |
+
*/
|
42 |
+
|
43 |
+
export {};
|
assets/js/type-defs/checkout.js
CHANGED
@@ -16,6 +16,8 @@
|
|
16 |
* the calculating state for checkout by one.
|
17 |
* @property {function(number|string)} setOrderId Dispatches an action that stores the draft
|
18 |
* order ID and key to state.
|
|
|
|
|
19 |
*/
|
20 |
|
21 |
/**
|
16 |
* the calculating state for checkout by one.
|
17 |
* @property {function(number|string)} setOrderId Dispatches an action that stores the draft
|
18 |
* order ID and key to state.
|
19 |
+
* @property {function(string)} setOrderNotes Dispatches an action that sets the order
|
20 |
+
* notes.
|
21 |
*/
|
22 |
|
23 |
/**
|
assets/js/type-defs/contexts.js
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
* @typedef {import('./cart').CartShippingAddress} CartShippingAddress
|
5 |
* @typedef {import('./cart').CartData} CartData
|
6 |
* @typedef {import('./checkout').CheckoutDispatchActions} CheckoutDispatchActions
|
|
|
|
|
7 |
*/
|
8 |
|
9 |
/**
|
@@ -241,6 +243,8 @@
|
|
241 |
* context data.
|
242 |
* @property {number} orderId This is the ID for the draft
|
243 |
* order if one exists.
|
|
|
|
|
244 |
* @property {boolean} hasOrder True when the checkout has a
|
245 |
* draft order from the API.
|
246 |
* @property {boolean} isCart When true, means the provider
|
@@ -252,35 +256,32 @@
|
|
252 |
/**
|
253 |
* @typedef {Object} EditorDataContext
|
254 |
*
|
255 |
-
* @property {
|
256 |
-
* @property {number}
|
257 |
-
* @property {Object}
|
258 |
*/
|
259 |
|
260 |
/**
|
261 |
* @typedef {Object} AddToCartFormContext
|
262 |
*
|
263 |
-
* @property {Object}
|
264 |
-
* @property {
|
265 |
-
* @property {
|
266 |
-
* @property {
|
267 |
-
* @property {
|
268 |
-
* @property {
|
269 |
-
* @property {number}
|
270 |
-
* @property {number}
|
271 |
-
* @property {number}
|
272 |
-
* @property {
|
273 |
-
* @property {
|
274 |
-
* @property {
|
275 |
-
* @property {
|
276 |
-
* @property {boolean}
|
277 |
-
* @property {boolean}
|
278 |
-
* @property {boolean}
|
279 |
-
* @property {
|
280 |
-
* @property {
|
281 |
-
* @property {function():void} onSubmit Submits the form.
|
282 |
-
* @property {function():void} onSuccess Triggered when the add to cart request is successful.
|
283 |
-
* @property {function():void} onFail Triggered when the add to cart request fails.
|
284 |
*/
|
285 |
|
286 |
/**
|
4 |
* @typedef {import('./cart').CartShippingAddress} CartShippingAddress
|
5 |
* @typedef {import('./cart').CartData} CartData
|
6 |
* @typedef {import('./checkout').CheckoutDispatchActions} CheckoutDispatchActions
|
7 |
+
* @typedef {import('./add-to-cart-form').AddToCartFormDispatchActions} AddToCartFormDispatchActions
|
8 |
+
* @typedef {import('./add-to-cart-form').AddToCartFormEventRegistration} AddToCartFormEventRegistration
|
9 |
*/
|
10 |
|
11 |
/**
|
243 |
* context data.
|
244 |
* @property {number} orderId This is the ID for the draft
|
245 |
* order if one exists.
|
246 |
+
* @property {number} orderNotes Order notes introduced by the
|
247 |
+
* user in the checkout form.
|
248 |
* @property {boolean} hasOrder True when the checkout has a
|
249 |
* draft order from the API.
|
250 |
* @property {boolean} isCart When true, means the provider
|
256 |
/**
|
257 |
* @typedef {Object} EditorDataContext
|
258 |
*
|
259 |
+
* @property {boolean} isEditor Indicates whether in the editor context.
|
260 |
+
* @property {number} currentPostId The post ID being edited.
|
261 |
+
* @property {Object} previewData Object containing preview data for the editor.
|
262 |
*/
|
263 |
|
264 |
/**
|
265 |
* @typedef {Object} AddToCartFormContext
|
266 |
*
|
267 |
+
* @property {Object} product The product object to add to the cart.
|
268 |
+
* @property {string} productType The name of the product type.
|
269 |
+
* @property {boolean} productIsPurchasable True if the product can be purchased.
|
270 |
+
* @property {boolean} productHasOptions True if the product has additonal options and thus needs a cart form.
|
271 |
+
* @property {boolean} supportsFormElements True if the product type supports form elements.
|
272 |
+
* @property {boolean} showFormElements True if showing a full add to cart form (enabled and supported).
|
273 |
+
* @property {number} quantity Stores the quantity being added to the cart.
|
274 |
+
* @property {number} minQuantity Min quantity that can be added to the cart.
|
275 |
+
* @property {number} maxQuantity Max quantity than can be added to the cart.
|
276 |
+
* @property {Object} requestParams List of params to send to the API.
|
277 |
+
* @property {boolean} isIdle True when the form state has changed and has no activity.
|
278 |
+
* @property {boolean} isDisabled True when the form cannot be submitted.
|
279 |
+
* @property {boolean} isProcessing True when the form has been submitted and is being processed.
|
280 |
+
* @property {boolean} isBeforeProcessing True during any observers executing logic before form processing (eg. validation).
|
281 |
+
* @property {boolean} isAfterProcessing True when form status is AFTER_PROCESSING.
|
282 |
+
* @property {boolean} hasError True when the form is in an error state. Whatever caused the error (validation/payment method) will likely have triggered a notice.
|
283 |
+
* @property {AddToCartFormEventRegistration} eventRegistration Event emitters that can be subscribed to.
|
284 |
+
* @property {AddToCartFormDispatchActions} dispatchActions Various actions that can be dispatched for the add to cart form context data.
|
|
|
|
|
|
|
285 |
*/
|
286 |
|
287 |
/**
|
build/active-filters-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-blocks', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-blocks', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '186de1407769d626c27bbd639a7bc99e');
|
build/active-filters-frontend.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=201)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t,r){var n=r(68),o=r(69),c=r(52),i=r(70);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||i()}},103:function(e,t,r){"use strict";r.d(t,"a",(function(){return f}));var n=r(11),o=r.n(n),c=r(6),i=r.n(c),a=r(0),u=r(44);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=function(e){var t=e.Block,r=e.selector,n=e.getProps,c=void 0===n?function(){}:n,i=e.getErrorBoundaryProps,s=void 0===i?function(){}:i,f=document.querySelectorAll(r);if(f.length){var p=a.Suspense||function(e){var t=e.children;return React.createElement(React.Fragment,null,t)};Array.prototype.forEach.call(f,(function(e,r){var n=c(e,r),i=s(e,r),f=l(l({},e.dataset),n.attributes);e.classList.remove("is-loading"),Object(a.render)(React.createElement(u.a,i,React.createElement(p,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},n,{attributes:f})))),e)}))}}},106:function(e,t){},109:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(14),o=r(13),c=r(0),i=r(85),a=r(37),u=function(e){var t=e.namespace,r=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,f=void 0===l?{}:l,p=e.shouldSelect,b=void 0===p||p;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");var d=Object(c.useRef)({results:[],isLoading:!0}),g=Object(a.a)(f),m=Object(a.a)(s),O=Object(i.a)(),y=Object(o.useSelect)((function(e){if(!b)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,g,m],i=o.getCollectionError.apply(o,c);return i&&O(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,m,g,b]);return null!==y&&(d.current=y),d.current}},11:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},121:function(e,t,r){"use strict";var n=r(11),o=r.n(n),c=r(15),i=r.n(c),a=r(50),u=function(e){var t=e.className,r=e.size,n=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),React.createElement("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},s=React.createElement(u,null);t.a=s},122:function(e,t,r){"use strict";var n=r(6),o=r.n(n),c=r(15),i=r.n(c),a=r(3);r(4);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},124:function(e,t,r){"use strict";var n=r(0),o=r(2),c=r(14),i=r(13);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(Object(o.getSetting)("restApiRoutes")),Object(i.useSelect)((function(e,t){if(r.current){var n=e(c.SCHEMA_STORE_KEY),o=n.isResolving,i=n.hasFinishedResolution,a=t.dispatch(c.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];o("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},13:function(e,t){!function(){e.exports=this.wp.data}()},135:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return i}));var n=r(8),o=n.c.reduce((function(e,t){var r,n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;return n.id&&e.push(n),e}),[]),c=function(e){if(e)return o.find((function(t){return t.id===e}))},i=function(e){if(e)return o.find((function(t){return t.taxonomy===e}))}},136:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c}));var n=r(7),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",c=e.filter((function(e){return e.attribute===r.taxonomy})),i=c.length?c[0]:null;if(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)){var a=i.slug.filter((function(e){return e!==o})),u=e.filter((function(e){return e.attribute!==r.taxonomy}));a.length>0&&(i.slug=a.sort(),u.push(i)),t(Object(n.sortBy)(u,"attribute"))}},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in",i=e.filter((function(e){return e.attribute!==r.taxonomy}));0===o.length?t(i):(i.push({attribute:r.taxonomy,operator:c,slug:Object(n.map)(o,"slug").sort()}),t(Object(n.sortBy)(i,"attribute")))}},139:function(e,t,r){"use strict";var n=r(11),o=r.n(n),c=r(15),i=r.n(c),a=(r(4),r(5)),u=r.n(a),s=r(1),l=r(122),f=r(121),p=(r(106),function(e){var t=e.text,r=e.screenReaderText,n=void 0===r?"":r,c=e.element,a=void 0===c?"li":c,s=e.className,l=void 0===s?"":s,f=e.radius,p=void 0===f?"small":f,b=e.children,d=void 0===b?null:b,g=i()(e,["text","screenReaderText","element","className","radius","children"]),m=a,O=u()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+p),y=Boolean(n&&n!==t);return React.createElement(m,o()({className:O},g),React.createElement("span",{"aria-hidden":y,className:"wc-block-components-chip__text"},t),y&&React.createElement("span",{className:"screen-reader-text"},n),d)});t.a=function(e){var t=e.ariaLabel,r=void 0===t?"":t,n=e.className,c=void 0===n?"":n,a=e.disabled,b=void 0!==a&&a,d=e.onRemove,g=void 0===d?function(){}:d,m=e.removeOnAnyClick,O=void 0!==m&&m,y=e.text,v=e.screenReaderText,h=void 0===v?"":v,j=i()(e,["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"]),_=O?"span":"button";if(!r){var w=h&&"string"==typeof h?h:y;r="string"!=typeof w?Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),w)}var E={"aria-label":r,disabled:b,onClick:g,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||g()}},S=O?E:{},R=O?{"aria-hidden":!0}:E;return React.createElement(p,o()({},j,S,{className:u()(c,"is-removable"),element:O?"button":j.element,screenReaderText:h,text:y}),React.createElement(_,o()({className:"wc-block-components-chip__remove"},R),React.createElement(l.a,{className:"wc-block-components-chip__remove-icon",srcElement:f.a,size:16})))}},14:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},142:function(e,t,r){"use strict";r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return d})),r.d(t,"a",(function(){return g}));var n=r(6),o=r.n(n),c=r(23),i=r.n(c),a=r(2);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l,f,p={code:a.CURRENCY.code,symbol:a.CURRENCY.symbol,thousandSeparator:a.CURRENCY.thousandSeparator,decimalSeparator:a.CURRENCY.decimalSeparator,minorUnit:a.CURRENCY.precision,prefix:(l=a.CURRENCY.symbol,f=a.CURRENCY.symbolPosition,{left:l,left_space:" "+l,right:"",right_space:""}[f]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(a.CURRENCY.symbol,a.CURRENCY.symbolPosition)},b=function(e){if(!e||"object"!==i()(e))return p;var t=e.currency_code,r=e.currency_symbol,n=e.currency_thousand_separator,o=e.currency_decimal_separator,c=e.currency_minor_unit,a=e.currency_prefix,u=e.currency_suffix;return{code:t||"USD",symbol:r||"$",thousandSeparator:"string"==typeof n?n:",",decimalSeparator:"string"==typeof o?o:".",minorUnit:Number.isFinite(c)?c:2,prefix:"string"==typeof a?a:"$",suffix:"string"==typeof u?u:""}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(s({},p),e)},g=function(e,t){if(""===e||void 0===e)return"";var r=parseInt(e,10);if(!Number.isFinite(r))return"";var n=d(t),o=r/Math.pow(10,n.minorUnit),c=n.prefix+o+n.suffix,i=document.createElement("textarea");return i.innerHTML=c,i.value}},15:function(e,t,r){var n=r(54);e.exports=function(e,t){if(null==e)return{};var r,o,c=n(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c}},16:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},18:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},19:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},2:function(e,t){!function(){e.exports=this.wc.wcSettings}()},20:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(40);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){Object(n.a)(e,t,r[t])}))}return e}},201:function(e,t,r){e.exports=r(263)},202:function(e,t){},23:function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},263:function(e,t,r){"use strict";r.r(t);var n=r(124),o=r(103),c=r(10),i=r.n(c),a=r(1),u=r(93),s=r(0),l=r(5),f=r.n(l),p=(r(4),r(29)),b=(r(202),r(135)),d=r(142),g=r(139),m=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(a.sprintf)(Object(a.__)("Between %s and %s","woo-gutenberg-products-block"),Object(d.a)(e),Object(d.a)(t)):Number.isFinite(e)?Object(a.sprintf)(Object(a.__)("From %s","woo-gutenberg-products-block"),Object(d.a)(e)):Object(a.sprintf)(Object(a.__)("Up to %s","woo-gutenberg-products-block"),Object(d.a)(t))},O=function(e){var t=e.type,r=e.name,n=e.prefix,o=e.removeCallback,c=void 0===o?function(){}:o,i=e.showLabel,u=void 0===i||i,s=e.displayStyle,l=n?React.createElement(React.Fragment,null,n," ",r):r,f=Object(a.sprintf)(Object(a.__)("Remove %s filter","woo-gutenberg-products-block"),r);return React.createElement("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},u&&React.createElement("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?React.createElement(g.a,{element:"span",text:l,onRemove:c,radius:"large",ariaLabel:f}):React.createElement("span",{className:"wc-block-active-filters__list-item-name"},l,React.createElement("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},f)))},y=r(109),v=r(16),h=r(136),j=function(e){var t=e.attributeObject,r=void 0===t?{}:t,n=e.slugs,o=void 0===n?[]:n,c=e.operator,s=void 0===c?"in":c,l=e.displayStyle,f=Object(y.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[r.id]}),p=f.results,b=f.isLoading,d=Object(u.b)("attributes",[]),g=i()(d,2),m=g[0],j=g[1];if(b)return null;var _=r.label;return React.createElement("li",null,React.createElement("span",{className:"wc-block-active-filters__list-item-type"},_,":"),React.createElement("ul",null,o.map((function(e,t){var n=p.find((function(t){return t.slug===e}));if(!n)return null;var o="";return t>0&&"and"===s&&(o=React.createElement("span",{className:"wc-block-active-filters__list-item-operator"},Object(a.__)("and","woo-gutenberg-products-block"))),O({type:_,name:Object(v.decodeEntities)(n.name||e),prefix:o,removeCallback:function(){Object(h.a)(m,j,r,e)},showLabel:!1,displayStyle:l})}))))},_=function(e){var t=e.attributes,r=e.isEditor,n=void 0!==r&&r,o=Object(u.b)("attributes",[]),c=i()(o,2),l=c[0],d=c[1],g=Object(u.b)("min_price"),y=i()(g,2),v=y[0],h=y[1],_=Object(u.b)("max_price"),w=i()(_,2),E=w[0],S=w[1],R=Object(s.useMemo)((function(){return Number.isFinite(v)||Number.isFinite(E)?O({type:Object(a.__)("Price","woo-gutenberg-products-block"),name:m(v,E),removeCallback:function(){h(void 0),S(void 0)},displayStyle:t.displayStyle}):null}),[v,E,m]),x=Object(s.useMemo)((function(){return l.map((function(e){var r=Object(b.b)(e.attribute);return React.createElement(j,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[l]);if(!(l.length>0||Number.isFinite(v)||Number.isFinite(E)||n))return null;var k="h".concat(t.headingLevel),P=f()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return React.createElement(s.Fragment,null,!n&&t.heading&&React.createElement(k,null,t.heading),React.createElement("div",{className:"wc-block-active-filters"},React.createElement("ul",{className:P},n?React.createElement(s.Fragment,null,O({type:Object(a.__)("Size","woo-gutenberg-products-block"),name:Object(a.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),O({type:Object(a.__)("Color","woo-gutenberg-products-block"),name:Object(a.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):React.createElement(s.Fragment,null,R,x)),React.createElement("button",{className:"wc-block-active-filters__clear-all",onClick:function(){h(void 0),S(void 0),d([])}},React.createElement(p.a,{label:Object(a.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Clear All Filters","woo-gutenberg-products-block")}))))};Object(o.a)({selector:".wp-block-woocommerce-active-filters",Block:Object(n.a)(_),getProps:function(e){return{attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3}}}})},29:function(e,t,r){"use strict";var n=r(6),o=r.n(n),c=(r(4),r(3)),i=r(5),a=r.n(i);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=null!=r,l=null!=n;return!u&&l?(t=o||"span",i=s(s({},i),{},{className:a()(i.className,"screen-reader-text")}),React.createElement(t,i,n)):(t=o||c.Fragment,u&&l&&r!==n?React.createElement(t,i,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,i,r))};l.defaultProps={wrapperProps:{}},t.a=l},3:function(e,t){!function(){e.exports=this.React}()},30:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},31:function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},32:function(e,t,r){var n=r(58);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},33:function(e,t,r){var n=r(23),o=r(18);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},36:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(36),c=r.n(o),i=function(e){var t=Object(n.useRef)();return c()(e,t.current)||(t.current=e),t.current}},38:function(e,t){!function(){e.exports=this.wp.blocks}()},4:function(e,t,r){e.exports=r(59)()},40:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},44:function(e,t,r){"use strict";var n=r(30),o=r.n(n),c=r(31),i=r.n(c),a=r(18),u=r.n(a),s=r(32),l=r.n(s),f=r(33),p=r.n(f),b=r(19),d=r.n(b),g=r(6),m=r.n(g),O=(r(4),r(3)),y=r(1),v=r(8),h=function(e){var t=e.imageUrl,r=void 0===t?"".concat(v.A,"img/block-error.svg"):t,n=e.header,o=void 0===n?Object(y.__)("Oops!","woo-gutenberg-products-block"):n,c=e.text,i=void 0===c?Object(y.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,a=e.errorMessage,u=e.errorMessagePrefix,s=void 0===u?Object(y.__)("Error:","woo-gutenberg-products-block"):u;return React.createElement("div",{className:"wc-block-error wc-block-components-error"},r&&React.createElement("img",{className:"wc-block-error__image wc-block-components-error__image",src:r,alt:""}),React.createElement("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&React.createElement("p",{className:"wc-block-error__header wc-block-components-error__header"},o),i&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},i),a&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",a)))};r(61);function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p()(this,r)}}var _=function(e){l()(r,e);var t=j(r);function r(){var e;o()(this,r);for(var n=arguments.length,c=new Array(n),i=0;i<n;i++)c[i]=arguments[i];return e=t.call.apply(t,[this].concat(c)),m()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=this.state,a=i.errorMessage;return i.hasError?React.createElement(h,{errorMessage:n?a:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(O.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),r}(O.Component);_.defaultProps={showErrorMessage:!0};t.a=_},5:function(e,t,r){var n;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)&&n.length){var i=o.apply(null,n);i&&e.push(i)}else if("object"===c)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=205)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t,r){var n=r(69),o=r(70),c=r(53),i=r(71);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||i()}},103:function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(11),o=r.n(n),c=r(6),i=r.n(c),a=r(0),u=r(44);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){i()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=[".wp-block-woocommerce-cart"],p=function(e){var t=e.Block,r=e.containers,n=e.getProps,c=void 0===n?function(){}:n,i=e.getErrorBoundaryProps,s=void 0===i?function(){}:i;0!==r.length&&Array.prototype.forEach.call(r,(function(e,r){var n=c(e,r),i=s(e,r),f=l(l({},e.dataset),n.attributes);e.classList.remove("is-loading"),Object(a.render)(React.createElement(u.a,i,React.createElement(a.Suspense,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},n,{attributes:f})))),e)}))},b=function(e){var t=e.Block,r=e.getProps,n=e.getErrorBoundaryProps,o=e.selector,c=e.wrappers,i=document.body.querySelectorAll(o);c.length>0&&Array.prototype.filter.call(i,(function(e){return!function(e,t){return Array.prototype.some.call(t,(function(t){return t.contains(e)&&!t.isSameNode(e)}))}(e,c)})),p({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})},d=function(e){var t=document.body.querySelectorAll(f.join(","));b(l(l({},e),{},{wrappers:t})),Array.prototype.forEach.call(t,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var r,n,o,c,i,a;r=l(l({},e),{},{wrapper:t}),n=r.Block,o=r.getProps,c=r.getErrorBoundaryProps,i=r.selector,a=r.wrapper.querySelectorAll(i),p({Block:n,containers:a,getProps:o,getErrorBoundaryProps:c})}))}))}},106:function(e,t){},11:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},110:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(14),o=r(13),c=r(0),i=r(85),a=r(37),u=function(e){var t=e.namespace,r=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,f=void 0===l?{}:l,p=e.shouldSelect,b=void 0===p||p;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");var d=Object(c.useRef)({results:[],isLoading:!0}),g=Object(a.a)(f),m=Object(a.a)(s),y=Object(i.a)(),O=Object(o.useSelect)((function(e){if(!b)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,g,m],i=o.getCollectionError.apply(o,c);return i&&y(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,m,g,b]);return null!==O&&(d.current=O),d.current}},121:function(e,t,r){"use strict";var n=r(11),o=r.n(n),c=r(15),i=r.n(c),a=r(51),u=function(e){var t=e.className,r=e.size,n=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),React.createElement("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},s=React.createElement(u,null);t.a=s},122:function(e,t,r){"use strict";var n=r(6),o=r.n(n),c=r(15),i=r.n(c),a=r(3);r(4);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},124:function(e,t,r){"use strict";var n=r(0),o=r(2),c=r(14),i=r(13);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(Object(o.getSetting)("restApiRoutes")),Object(i.useSelect)((function(e,t){if(r.current){var n=e(c.SCHEMA_STORE_KEY),o=n.isResolving,i=n.hasFinishedResolution,a=t.dispatch(c.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];o("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},13:function(e,t){!function(){e.exports=this.wp.data}()},135:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return i}));var n=r(8),o=n.c.reduce((function(e,t){var r,n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;return n.id&&e.push(n),e}),[]),c=function(e){if(e)return o.find((function(t){return t.id===e}))},i=function(e){if(e)return o.find((function(t){return t.taxonomy===e}))}},136:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c}));var n=r(7),o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",c=e.filter((function(e){return e.attribute===r.taxonomy})),i=c.length?c[0]:null;if(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)){var a=i.slug.filter((function(e){return e!==o})),u=e.filter((function(e){return e.attribute!==r.taxonomy}));a.length>0&&(i.slug=a.sort(),u.push(i)),t(Object(n.sortBy)(u,"attribute"))}},c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in",i=e.filter((function(e){return e.attribute!==r.taxonomy}));0===o.length?t(i):(i.push({attribute:r.taxonomy,operator:c,slug:Object(n.map)(o,"slug").sort()}),t(Object(n.sortBy)(i,"attribute")))}},139:function(e,t,r){"use strict";var n=r(11),o=r.n(n),c=r(15),i=r.n(c),a=(r(4),r(5)),u=r.n(a),s=r(1),l=r(122),f=r(121),p=(r(106),function(e){var t=e.text,r=e.screenReaderText,n=void 0===r?"":r,c=e.element,a=void 0===c?"li":c,s=e.className,l=void 0===s?"":s,f=e.radius,p=void 0===f?"small":f,b=e.children,d=void 0===b?null:b,g=i()(e,["text","screenReaderText","element","className","radius","children"]),m=a,y=u()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+p),O=Boolean(n&&n!==t);return React.createElement(m,o()({className:y},g),React.createElement("span",{"aria-hidden":O,className:"wc-block-components-chip__text"},t),O&&React.createElement("span",{className:"screen-reader-text"},n),d)});t.a=function(e){var t=e.ariaLabel,r=void 0===t?"":t,n=e.className,c=void 0===n?"":n,a=e.disabled,b=void 0!==a&&a,d=e.onRemove,g=void 0===d?function(){}:d,m=e.removeOnAnyClick,y=void 0!==m&&m,O=e.text,v=e.screenReaderText,h=void 0===v?"":v,j=i()(e,["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"]),_=y?"span":"button";if(!r){var w=h&&"string"==typeof h?h:O;r="string"!=typeof w?Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),w)}var E={"aria-label":r,disabled:b,onClick:g,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||g()}},S=y?E:{},R=y?{"aria-hidden":!0}:E;return React.createElement(p,o()({},j,S,{className:u()(c,"is-removable"),element:y?"button":j.element,screenReaderText:h,text:O}),React.createElement(_,o()({className:"wc-block-components-chip__remove"},R),React.createElement(l.a,{className:"wc-block-components-chip__remove-icon",srcElement:f.a,size:16})))}},14:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},143:function(e,t,r){"use strict";r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return d})),r.d(t,"a",(function(){return g}));var n=r(6),o=r.n(n),c=r(22),i=r.n(c),a=r(2);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l,f,p={code:a.CURRENCY.code,symbol:a.CURRENCY.symbol,thousandSeparator:a.CURRENCY.thousandSeparator,decimalSeparator:a.CURRENCY.decimalSeparator,minorUnit:a.CURRENCY.precision,prefix:(l=a.CURRENCY.symbol,f=a.CURRENCY.symbolPosition,{left:l,left_space:" "+l,right:"",right_space:""}[f]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(a.CURRENCY.symbol,a.CURRENCY.symbolPosition)},b=function(e){if(!e||"object"!==i()(e))return p;var t=e.currency_code,r=e.currency_symbol,n=e.currency_thousand_separator,o=e.currency_decimal_separator,c=e.currency_minor_unit,a=e.currency_prefix,u=e.currency_suffix;return{code:t||"USD",symbol:r||"$",thousandSeparator:"string"==typeof n?n:",",decimalSeparator:"string"==typeof o?o:".",minorUnit:Number.isFinite(c)?c:2,prefix:"string"==typeof a?a:"$",suffix:"string"==typeof u?u:""}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return s(s({},p),e)},g=function(e,t){if(""===e||void 0===e)return"";var r=parseInt(e,10);if(!Number.isFinite(r))return"";var n=d(t),o=r/Math.pow(10,n.minorUnit),c=n.prefix+o+n.suffix,i=document.createElement("textarea");return i.innerHTML=c,i.value}},15:function(e,t,r){var n=r(55);e.exports=function(e,t){if(null==e)return{};var r,o,c=n(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)r=i[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c}},16:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},18:function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},19:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},2:function(e,t){!function(){e.exports=this.wc.wcSettings}()},20:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(40);function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?Object(arguments[t]):{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable})))),o.forEach((function(t){Object(n.a)(e,t,r[t])}))}return e}},205:function(e,t,r){e.exports=r(266)},206:function(e,t){},22:function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},266:function(e,t,r){"use strict";r.r(t);var n=r(124),o=r(103),c=r(10),i=r.n(c),a=r(1),u=r(96),s=r(0),l=r(5),f=r.n(l),p=(r(4),r(29)),b=(r(206),r(135)),d=r(143),g=r(139),m=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(a.sprintf)(Object(a.__)("Between %s and %s","woo-gutenberg-products-block"),Object(d.a)(e),Object(d.a)(t)):Number.isFinite(e)?Object(a.sprintf)(Object(a.__)("From %s","woo-gutenberg-products-block"),Object(d.a)(e)):Object(a.sprintf)(Object(a.__)("Up to %s","woo-gutenberg-products-block"),Object(d.a)(t))},y=function(e){var t=e.type,r=e.name,n=e.prefix,o=e.removeCallback,c=void 0===o?function(){}:o,i=e.showLabel,u=void 0===i||i,s=e.displayStyle,l=n?React.createElement(React.Fragment,null,n," ",r):r,f=Object(a.sprintf)(Object(a.__)("Remove %s filter","woo-gutenberg-products-block"),r);return React.createElement("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},u&&React.createElement("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?React.createElement(g.a,{element:"span",text:l,onRemove:c,radius:"large",ariaLabel:f}):React.createElement("span",{className:"wc-block-active-filters__list-item-name"},l,React.createElement("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},f)))},O=r(110),v=r(16),h=r(136),j=function(e){var t=e.attributeObject,r=void 0===t?{}:t,n=e.slugs,o=void 0===n?[]:n,c=e.operator,s=void 0===c?"in":c,l=e.displayStyle,f=Object(O.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[r.id]}),p=f.results,b=f.isLoading,d=Object(u.b)("attributes",[]),g=i()(d,2),m=g[0],j=g[1];if(b)return null;var _=r.label;return React.createElement("li",null,React.createElement("span",{className:"wc-block-active-filters__list-item-type"},_,":"),React.createElement("ul",null,o.map((function(e,t){var n=p.find((function(t){return t.slug===e}));if(!n)return null;var o="";return t>0&&"and"===s&&(o=React.createElement("span",{className:"wc-block-active-filters__list-item-operator"},Object(a.__)("and","woo-gutenberg-products-block"))),y({type:_,name:Object(v.decodeEntities)(n.name||e),prefix:o,removeCallback:function(){Object(h.a)(m,j,r,e)},showLabel:!1,displayStyle:l})}))))},_=function(e){var t=e.attributes,r=e.isEditor,n=void 0!==r&&r,o=Object(u.b)("attributes",[]),c=i()(o,2),l=c[0],d=c[1],g=Object(u.b)("min_price"),O=i()(g,2),v=O[0],h=O[1],_=Object(u.b)("max_price"),w=i()(_,2),E=w[0],S=w[1],R=Object(s.useMemo)((function(){return Number.isFinite(v)||Number.isFinite(E)?y({type:Object(a.__)("Price","woo-gutenberg-products-block"),name:m(v,E),removeCallback:function(){h(void 0),S(void 0)},displayStyle:t.displayStyle}):null}),[v,E,m]),x=Object(s.useMemo)((function(){return l.map((function(e){var r=Object(b.b)(e.attribute);return React.createElement(j,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[l]);if(!(l.length>0||Number.isFinite(v)||Number.isFinite(E)||n))return null;var k="h".concat(t.headingLevel),P=f()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return React.createElement(s.Fragment,null,!n&&t.heading&&React.createElement(k,null,t.heading),React.createElement("div",{className:"wc-block-active-filters"},React.createElement("ul",{className:P},n?React.createElement(s.Fragment,null,y({type:Object(a.__)("Size","woo-gutenberg-products-block"),name:Object(a.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),y({type:Object(a.__)("Color","woo-gutenberg-products-block"),name:Object(a.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):React.createElement(s.Fragment,null,R,x)),React.createElement("button",{className:"wc-block-active-filters__clear-all",onClick:function(){h(void 0),S(void 0),d([])}},React.createElement(p.a,{label:Object(a.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Clear All Filters","woo-gutenberg-products-block")}))))};Object(o.a)({selector:".wp-block-woocommerce-active-filters",Block:Object(n.a)(_),getProps:function(e){return{attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3}}}})},29:function(e,t,r){"use strict";var n=r(6),o=r.n(n),c=(r(4),r(3)),i=r(5),a=r.n(i);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=null!=r,l=null!=n;return!u&&l?(t=o||"span",i=s(s({},i),{},{className:a()(i.className,"screen-reader-text")}),React.createElement(t,i,n)):(t=o||c.Fragment,u&&l&&r!==n?React.createElement(t,i,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,i,r))};l.defaultProps={wrapperProps:{}},t.a=l},3:function(e,t){!function(){e.exports=this.React}()},30:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},31:function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},32:function(e,t,r){var n=r(59);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},33:function(e,t,r){var n=r(22),o=r(18);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},36:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(36),c=r.n(o),i=function(e){var t=Object(n.useRef)();return c()(e,t.current)||(t.current=e),t.current}},38:function(e,t){!function(){e.exports=this.wp.blocks}()},4:function(e,t,r){e.exports=r(60)()},40:function(e,t,r){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}r.d(t,"a",(function(){return n}))},44:function(e,t,r){"use strict";var n=r(30),o=r.n(n),c=r(31),i=r.n(c),a=r(18),u=r.n(a),s=r(32),l=r.n(s),f=r(33),p=r.n(f),b=r(19),d=r.n(b),g=r(6),m=r.n(g),y=(r(4),r(3)),O=r(1),v=r(8),h=function(e){var t=e.imageUrl,r=void 0===t?"".concat(v.C,"img/block-error.svg"):t,n=e.header,o=void 0===n?Object(O.__)("Oops!","woo-gutenberg-products-block"):n,c=e.text,i=void 0===c?Object(O.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,a=e.errorMessage,u=e.errorMessagePrefix,s=void 0===u?Object(O.__)("Error:","woo-gutenberg-products-block"):u;return React.createElement("div",{className:"wc-block-error wc-block-components-error"},r&&React.createElement("img",{className:"wc-block-error__image wc-block-components-error__image",src:r,alt:""}),React.createElement("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&React.createElement("p",{className:"wc-block-error__header wc-block-components-error__header"},o),i&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},i),a&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",a)))};r(62);function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return p()(this,r)}}var _=function(e){l()(r,e);var t=j(r);function r(){var e;o()(this,r);for(var n=arguments.length,c=new Array(n),i=0;i<n;i++)c[i]=arguments[i];return e=t.call.apply(t,[this].concat(c)),m()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=this.state,a=i.errorMessage;return i.hasError?React.createElement(h,{errorMessage:n?a:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(y.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),r}(y.Component);_.defaultProps={showErrorMessage:!0};t.a=_},5:function(e,t,r){var n;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)&&n.length){var i=o.apply(null,n);i&&e.push(i)}else if("object"===c)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(20),o=r(7),c=r(0),i=function(e){var t=Object(n.a)({},e,{role:"img","aria-hidden":"true",focusable:"false"});return Object(c.createElement)("svg",Object(o.omit)(t,"__unstableActive"))}},53:function(e,t,r){var n=r(54);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}},54:function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}},55:function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,o={},c=Object.keys(e);for(n=0;n<c.length;n++)r=c[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}},58:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),o=Object(n.createContext)("page"),c=function(){return Object(n.useContext)(o)};o.Provider},59:function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},6:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},60:function(e,t,r){"use strict";var n=r(61);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,c,i){if(i!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:o};return r.PropTypes=r,r}},61:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},62:function(e,t){},69:function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},7:function(e,t){!function(){e.exports=this.lodash}()},70:function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,c=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw c}}return r}}},71:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},8:function(e,t,r){"use strict";r.d(t,"i",(function(){return o})),r.d(t,"u",(function(){return c})),r.d(t,"y",(function(){return i})),r.d(t,"r",(function(){return a})),r.d(t,"m",(function(){return u})),r.d(t,"p",(function(){return s})),r.d(t,"h",(function(){return l})),r.d(t,"z",(function(){return f})),r.d(t,"k",(function(){return p})),r.d(t,"l",(function(){return b})),r.d(t,"j",(function(){return d})),r.d(t,"c",(function(){return g})),r.d(t,"n",(function(){return m})),r.d(t,"o",(function(){return y})),r.d(t,"C",(function(){return v})),r.d(t,"D",(function(){return h})),r.d(t,"v",(function(){return j})),r.d(t,"a",(function(){return _})),r.d(t,"w",(function(){return w})),r.d(t,"b",(function(){return E})),r.d(t,"q",(function(){return S})),r.d(t,"f",(function(){return R})),r.d(t,"x",(function(){return P})),r.d(t,"g",(function(){return C})),r.d(t,"t",(function(){return N})),r.d(t,"s",(function(){return T})),r.d(t,"B",(function(){return A})),r.d(t,"A",(function(){return D})),r.d(t,"d",(function(){return U})),r.d(t,"e",(function(){return L})),r.d(t,"E",(function(){return B}));var n=r(2),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),a=(Object(n.getSetting)("max_columns",6),Object(n.getSetting)("min_columns",1),Object(n.getSetting)("default_columns",3),Object(n.getSetting)("max_rows",6),Object(n.getSetting)("min_rows",1),Object(n.getSetting)("default_rows",3),Object(n.getSetting)("min_height",500),Object(n.getSetting)("default_height",500),Object(n.getSetting)("placeholderImgSrc","")),u=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),s=Object(n.getSetting)("limitTags"),l=(Object(n.getSetting)("hasProducts",!0),Object(n.getSetting)("hasTags",!0),Object(n.getSetting)("homeUrl",""),Object(n.getSetting)("couponsEnabled",!0)),f=(Object(n.getSetting)("shippingEnabled",!0),Object(n.getSetting)("taxesEnabled",!0)),p=Object(n.getSetting)("displayItemizedTaxes",!1),b=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),d=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),g=(Object(n.getSetting)("productCount",0),Object(n.getSetting)("attributes",[])),m=Object(n.getSetting)("isShippingCalculatorEnabled",!0),y=Object(n.getSetting)("isShippingCostHidden",!1),O=Object(n.getSetting)("woocommerceBlocksPhase",1),v=Object(n.getSetting)("wcBlocksAssetUrl",""),h=Object(n.getSetting)("wcBlocksBuildUrl",""),j=Object(n.getSetting)("shippingCountries",{}),_=Object(n.getSetting)("allowedCountries",{}),w=Object(n.getSetting)("shippingStates",{}),E=Object(n.getSetting)("allowedStates",{}),S=(Object(n.getSetting)("shippingMethodsExist",!1),Object(n.getSetting)("paymentGatewaySortOrder",[])),R=Object(n.getSetting)("checkoutShowLoginReminder",!0),x={id:0,title:"",permalink:""},k=Object(n.getSetting)("storePages",{shop:x,cart:x,checkout:x,privacy:x,terms:x}),P=k.shop.permalink,C=(k.checkout.id,k.checkout.permalink),N=k.privacy.permalink,T=k.privacy.title,A=k.terms.permalink,D=k.terms.title,U=(k.cart.id,k.cart.permalink),L=Object(n.getSetting)("checkoutAllowsGuest",!1),B=(Object(n.getSetting)("checkoutAllowsSignup",!1),r(38),function(){return O>1})},85:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(10),o=r.n(n),c=r(0),i=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return function(e){return t((function(){throw e}))}}},96:function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(10),o=r.n(n),c=r(14),i=r(13),a=r(0),u=r(58),s=r(7),l=r(37),f=function(e){var t=Object(u.a)();e=e||t;var r=Object(i.useSelect)((function(t){return t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),n=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[r,Object(a.useCallback)((function(t){n(e,t)}),[e])]},p=function(e,t,r){var n=Object(u.a)();r=r||n;var o=Object(i.useSelect)((function(n){return n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),s=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(a.useCallback)((function(t){s(r,e,t)}),[r,e])]},b=function(e,t){var r=Object(u.a)(),n=f(t=t||r),c=o()(n,2),i=c[0],p=c[1],b=Object(l.a)(e),d=Object(a.useRef)(!1);return Object(a.useEffect)((function(){p(Object(s.assign)({},i,b)),d.current=!0}),[b]),d.current?[i,p]:[e,p]}}});
|
build/active-filters.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '8c082222b23f9b3102e2ae6ae20320c7');
|
build/active-filters.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var r,o,a=t[0],u=t[1],l=t[2],b=0,f=[];b<a.length;b++)o=a[b],Object.prototype.hasOwnProperty.call(c,o)&&c[o]&&f.push(c[o][0]),c[o]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);for(s&&s(t);f.length;)f.shift()();return i.push.apply(i,l||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,a=1;a<n.length;a++){var u=n[a];0!==c[u]&&(r=!1)}r&&(i.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},c={4:0},i=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var s=u;return i.push([838,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},121:function(e,t){},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},153:function(e,t,n){"use strict";var r=n(21),c=n.n(r),i=n(24),o=n.n(i),a=n(22),u=n.n(a),l=n(23),s=n.n(l),b=n(12),f=n.n(b),p=n(0),d=n(6),g=n(1),m=n(4);function v(e){var t=e.level,n={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return n.hasOwnProperty(t)?Object(p.createElement)(m.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(p.createElement)(m.Path,{d:n[t]})):null}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f()(e);if(t){var c=f()(this).constructor;n=Reflect.construct(r,arguments,c)}else n=r.apply(this,arguments);return s()(this,n)}}var h=function(e){u()(n,e);var t=O(n);function n(){return c()(this,n),t.apply(this,arguments)}return o()(n,[{key:"createLevelControl",value:function(e,t,n){var r=e===t;return{icon:Object(p.createElement)(v,{level:e}),title:Object(g.sprintf)(Object(g.__)("Heading %d"),e),isActive:r,onClick:function(){return n(e)}}}},{key:"render",value:function(){var e=this,t=this.props,n=t.isCollapsed,r=void 0===n||n,c=t.minLevel,i=t.maxLevel,o=t.selectedLevel,a=t.onChange;return Object(p.createElement)(m.Toolbar,{isCollapsed:r,icon:Object(p.createElement)(v,{level:o}),controls:Object(d.range)(c,i).map((function(t){return e.createLevelControl(t,o,a)}))})}}]),n}(p.Component);t.a=h},156:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(11),c=n.n(r),i=n(0),o=function(){var e=Object(i.useState)(),t=c()(e,2)[1];return function(e){return t((function(){throw e}))}}},169:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return p}));var r=n(11),c=n.n(r),i=n(40),o=n(36),a=n(0),u=n(99),l=n(6),s=n(60),b=function(e){var t=Object(u.a)();e=e||t;var n=Object(o.useSelect)((function(t){return t(i.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),r=Object(o.useDispatch)(i.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[n,Object(a.useCallback)((function(t){r(e,t)}),[e])]},f=function(e,t,n){var r=Object(u.a)();n=n||r;var c=Object(o.useSelect)((function(r){return r(i.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)}),[n,e]),l=Object(o.useDispatch)(i.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(a.useCallback)((function(t){l(n,e,t)}),[n,e])]},p=function(e,t){var n=Object(u.a)(),r=b(t=t||n),i=c()(r,2),o=i[0],f=i[1],p=Object(s.a)(e),d=Object(a.useRef)(!1);return Object(a.useEffect)((function(){f(Object(l.assign)({},o,p)),d.current=!0}),[p]),d.current?[o,f]:[e,f]}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},182:function(e,t,n){"use strict";var r=n(0),c=(n(2),n(14)),i=n(8),o=n.n(i);n(252);t.a=function(e){var t=e.className,n=e.headingLevel,i=e.onChange,a=e.heading,u="h".concat(n);return Object(r.createElement)(u,null,Object(r.createElement)(c.PlainText,{className:o()("wc-block-editor-components-title",t),value:a,onChange:i}))}},198:function(e,t){},201:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(40),c=n(36),i=n(0),o=n(156),a=n(60),u=function(e){var t=e.namespace,n=e.resourceName,u=e.resourceValues,l=void 0===u?[]:u,s=e.query,b=void 0===s?{}:s,f=e.shouldSelect,p=void 0===f||f;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");var d=Object(i.useRef)({results:[],isLoading:!0}),g=Object(a.a)(b),m=Object(a.a)(l),v=Object(o.a)(),O=Object(c.useSelect)((function(e){if(!p)return null;var c=e(r.COLLECTIONS_STORE_KEY),i=[t,n,g,m],o=c.getCollectionError.apply(c,i);return o&&v(o),{results:c.getCollection.apply(c,i),isLoading:!c.hasFinishedResolution("getCollection",i)}}),[t,n,m,g,p]);return null!==O&&(d.current=O),d.current}},25:function(e,t){!function(){e.exports=this.wp.compose}()},250:function(e,t,n){"use strict";n.d(t,"c",(function(){return p})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return g}));var r=n(7),c=n.n(r),i=n(54),o=n.n(i),a=n(3);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s,b,f={code:a.CURRENCY.code,symbol:a.CURRENCY.symbol,thousandSeparator:a.CURRENCY.thousandSeparator,decimalSeparator:a.CURRENCY.decimalSeparator,minorUnit:a.CURRENCY.precision,prefix:(s=a.CURRENCY.symbol,b=a.CURRENCY.symbolPosition,{left:s,left_space:" "+s,right:"",right_space:""}[b]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(a.CURRENCY.symbol,a.CURRENCY.symbolPosition)},p=function(e){if(!e||"object"!==o()(e))return f;var t=e.currency_code,n=e.currency_symbol,r=e.currency_thousand_separator,c=e.currency_decimal_separator,i=e.currency_minor_unit,a=e.currency_prefix,u=e.currency_suffix;return{code:t||"USD",symbol:n||"$",thousandSeparator:"string"==typeof r?r:",",decimalSeparator:"string"==typeof c?c:".",minorUnit:Number.isFinite(i)?i:2,prefix:"string"==typeof a?a:"$",suffix:"string"==typeof u?u:""}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(l({},f),e)},g=function(e,t){if(""===e||void 0===e)return"";var n=parseInt(e,10);if(!Number.isFinite(n))return"";var r=d(t),c=n/Math.pow(10,r.minorUnit),i=r.prefix+c+r.suffix,o=document.createElement("textarea");return o.innerHTML=i,o.value}},252:function(e,t){},262:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}));var r=n(5),c=r.c.reduce((function(e,t){var n,r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;return r.id&&e.push(r),e}),[]),i=function(e){if(e)return c.find((function(t){return t.id===e}))},o=function(e){if(e)return c.find((function(t){return t.taxonomy===e}))}},263:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return i}));var r=n(6),c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=e.filter((function(e){return e.attribute===n.taxonomy})),o=i.length?i[0]:null;if(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)){var a=o.slug.filter((function(e){return e!==c})),u=e.filter((function(e){return e.attribute!==n.taxonomy}));a.length>0&&(o.slug=a.sort(),u.push(o)),t(Object(r.sortBy)(u,"attribute"))}},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in",o=e.filter((function(e){return e.attribute!==n.taxonomy}));0===c.length?t(o):(o.push({attribute:n.taxonomy,operator:i,slug:Object(r.map)(c,"slug").sort()}),t(Object(r.sortBy)(o,"attribute")))}},268:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(27),o=n.n(i),a=n(0),u=(n(2),n(8)),l=n.n(u),s=n(1),b=n(59),f=n(274),p=(n(198),function(e){var t=e.text,n=e.screenReaderText,r=void 0===n?"":n,i=e.element,u=void 0===i?"li":i,s=e.className,b=void 0===s?"":s,f=e.radius,p=void 0===f?"small":f,d=e.children,g=void 0===d?null:d,m=o()(e,["text","screenReaderText","element","className","radius","children"]),v=u,O=l()(b,"wc-block-components-chip","wc-block-components-chip--radius-"+p),h=Boolean(r&&r!==t);return Object(a.createElement)(v,c()({className:O},m),Object(a.createElement)("span",{"aria-hidden":h,className:"wc-block-components-chip__text"},t),h&&Object(a.createElement)("span",{className:"screen-reader-text"},r),g)});t.a=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.className,i=void 0===r?"":r,u=e.disabled,d=void 0!==u&&u,g=e.onRemove,m=void 0===g?function(){}:g,v=e.removeOnAnyClick,O=void 0!==v&&v,h=e.text,j=e.screenReaderText,y=void 0===j?"":j,w=o()(e,["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"]),_=O?"span":"button";if(!n){var E=y&&"string"==typeof y?y:h;n="string"!=typeof E?Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),E)}var S={"aria-label":n,disabled:d,onClick:m,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||m()}},k=O?S:{},x=O?{"aria-hidden":!0}:S;return Object(a.createElement)(p,c()({},w,k,{className:l()(i,"is-removable"),element:O?"button":w.element,screenReaderText:y,text:h}),Object(a.createElement)(_,c()({className:"wc-block-components-chip__remove"},x),Object(a.createElement)(b.a,{className:"wc-block-components-chip__remove-icon",srcElement:f.a,size:16})))}},274:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(27),o=n.n(i),a=n(0),u=n(58),l=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=o()(e,["className","size"]);return Object(a.createElement)(u.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(a.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=l},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},36:function(e,t){!function(){e.exports=this.wp.data}()},4:function(e,t){!function(){e.exports=this.wp.components}()},40:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},46:function(e,t,n){"use strict";var r=n(7),c=n.n(r),i=n(0),o=(n(2),n(9)),a=n(8),u=n.n(a);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b=function(e){var t,n=e.label,r=e.screenReaderLabel,c=e.wrapperElement,a=e.wrapperProps,l=null!=n,b=null!=r;return!l&&b?(t=c||"span",a=s(s({},a),{},{className:u()(a.className,"screen-reader-text")}),Object(i.createElement)(t,a,r)):(t=c||o.Fragment,l&&b&&n!==r?Object(i.createElement)(t,a,Object(i.createElement)("span",{"aria-hidden":"true"},n),Object(i.createElement)("span",{className:"screen-reader-text"},r)):Object(i.createElement)(t,a,n))};b.defaultProps={wrapperProps:{}},t.a=b},47:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},5:function(e,t,n){"use strict";n.d(t,"k",(function(){return c})),n.d(t,"G",(function(){return i})),n.d(t,"M",(function(){return o})),n.d(t,"x",(function(){return a})),n.d(t,"z",(function(){return u})),n.d(t,"l",(function(){return l})),n.d(t,"y",(function(){return s})),n.d(t,"B",(function(){return b})),n.d(t,"n",(function(){return f})),n.d(t,"A",(function(){return p})),n.d(t,"m",(function(){return d})),n.d(t,"C",(function(){return g})),n.d(t,"t",(function(){return m})),n.d(t,"w",(function(){return v})),n.d(t,"q",(function(){return O})),n.d(t,"r",(function(){return h})),n.d(t,"s",(function(){return j})),n.d(t,"j",(function(){return y})),n.d(t,"I",(function(){return w})),n.d(t,"N",(function(){return _})),n.d(t,"p",(function(){return E})),n.d(t,"o",(function(){return S})),n.d(t,"F",(function(){return k})),n.d(t,"c",(function(){return x})),n.d(t,"u",(function(){return C})),n.d(t,"v",(function(){return R})),n.d(t,"Q",(function(){return P})),n.d(t,"R",(function(){return L})),n.d(t,"H",(function(){return T})),n.d(t,"a",(function(){return H})),n.d(t,"K",(function(){return z})),n.d(t,"b",(function(){return D})),n.d(t,"J",(function(){return V})),n.d(t,"h",(function(){return B})),n.d(t,"L",(function(){return M})),n.d(t,"g",(function(){return A})),n.d(t,"i",(function(){return Y})),n.d(t,"E",(function(){return I})),n.d(t,"D",(function(){return Q})),n.d(t,"P",(function(){return K})),n.d(t,"O",(function(){return G})),n.d(t,"d",(function(){return W})),n.d(t,"e",(function(){return q})),n.d(t,"f",(function(){return J})),n.d(t,"U",(function(){return X})),n.d(t,"V",(function(){return Z})),n.d(t,"S",(function(){return ee})),n.d(t,"T",(function(){return te}));var r=n(3),c=Object(r.getSetting)("currentUserIsAdmin",!1),i=Object(r.getSetting)("reviewRatingsEnabled",!0),o=Object(r.getSetting)("showAvatars",!0),a=Object(r.getSetting)("max_columns",6),u=Object(r.getSetting)("min_columns",1),l=Object(r.getSetting)("default_columns",3),s=Object(r.getSetting)("max_rows",6),b=Object(r.getSetting)("min_rows",1),f=Object(r.getSetting)("default_rows",3),p=Object(r.getSetting)("min_height",500),d=Object(r.getSetting)("default_height",500),g=Object(r.getSetting)("placeholderImgSrc",""),m=(Object(r.getSetting)("thumbnail_size",300),Object(r.getSetting)("isLargeCatalog")),v=Object(r.getSetting)("limitTags"),O=Object(r.getSetting)("hasProducts",!0),h=Object(r.getSetting)("hasTags",!0),j=Object(r.getSetting)("homeUrl",""),y=Object(r.getSetting)("couponsEnabled",!0),w=Object(r.getSetting)("shippingEnabled",!0),_=Object(r.getSetting)("taxesEnabled",!0),E=Object(r.getSetting)("displayItemizedTaxes",!1),S=(Object(r.getSetting)("displayShopPricesIncludingTax",!1),Object(r.getSetting)("displayCartPricesIncludingTax",!1)),k=Object(r.getSetting)("productCount",0),x=Object(r.getSetting)("attributes",[]),C=Object(r.getSetting)("isShippingCalculatorEnabled",!0),R=Object(r.getSetting)("isShippingCostHidden",!1),N=Object(r.getSetting)("woocommerceBlocksPhase",1),P=Object(r.getSetting)("wcBlocksAssetUrl",""),L=Object(r.getSetting)("wcBlocksBuildUrl",""),T=Object(r.getSetting)("shippingCountries",{}),H=Object(r.getSetting)("allowedCountries",{}),z=Object(r.getSetting)("shippingStates",{}),D=Object(r.getSetting)("allowedStates",{}),V=Object(r.getSetting)("shippingMethodsExist",!1),B=Object(r.getSetting)("checkoutShowLoginReminder",!0),F={id:0,title:"",permalink:""},U=Object(r.getSetting)("storePages",{shop:F,cart:F,checkout:F,privacy:F,terms:F}),M=U.shop.permalink,A=U.checkout.id,Y=U.checkout.permalink,I=U.privacy.permalink,Q=U.privacy.title,K=U.terms.permalink,G=U.terms.title,W=U.cart.id,q=U.cart.permalink,J=Object(r.getSetting)("checkoutAllowsGuest",!1),$=(Object(r.getSetting)("checkoutAllowsSignup",!1),n(17)),X=function(e,t){if(N>2)return Object($.registerBlockType)(e,t)},Z=function(e,t){if(N>1)return Object($.registerBlockType)(e,t)},ee=function(){return N>2},te=function(){return N>1}},59:function(e,t,n){"use strict";var r=n(7),c=n.n(r),i=n(27),o=n.n(i),a=n(9);n(2);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.a=function(e){var t=e.srcElement,n=e.size,r=void 0===n?24:n,i=o()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({width:r,height:r},i))}},6:function(e,t){!function(){e.exports=this.lodash}()},60:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=n(47),i=n.n(c),o=function(e){var t=Object(r.useRef)();return i()(e,t.current)||(t.current=e),t.current}},72:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(21),o=n.n(i),a=n(24),u=n.n(a),l=n(19),s=n.n(l),b=n(22),f=n.n(b),p=n(23),d=n.n(p),g=n(12),m=n.n(g),v=n(0),O=n(6),h=n(8),j=n.n(h),y=n(4),w=n(25);n(121);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m()(e);if(t){var c=m()(this).constructor;n=Reflect.construct(r,arguments,c)}else n=r.apply(this,arguments);return d()(this,n)}}var E=function(e){f()(n,e);var t=_(n);function n(){var e;return o()(this,n),(e=t.apply(this,arguments)).onClick=e.onClick.bind(s()(e)),e}return u()(n,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.label,i=n.checked,o=n.instanceId,a=n.className,u=n.help,l=n.options,s=n.value,b="inspector-toggle-button-control-".concat(o);return u&&(e=Object(O.isFunction)(u)?u(i):u),Object(v.createElement)(y.BaseControl,{id:b,help:e,className:j()("components-toggle-button-control",a)},Object(v.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},r),Object(v.createElement)(y.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,n){var i={};return s===e.value?(i.isPrimary=!0,i["aria-pressed"]=!0):(i.isDefault=!0,i["aria-pressed"]=!1),Object(v.createElement)(y.Button,c()({key:"".concat(e.label,"-").concat(e.value,"-").concat(n),value:e.value,onClick:t.onClick,"aria-label":r+": "+e.label},i),e.label)}))))}}]),n}(v.Component);t.a=Object(w.withInstanceId)(E)},838:function(e,t,n){e.exports=n(892)},839:function(e,t){},892:function(e,t,n){"use strict";n.r(t);var r=n(10),c=n.n(r),i=n(0),o=n(1),a=n(17),u=n(59),l=n(58),s=Object(i.createElement)(l.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(i.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"})),b=n(8),f=n.n(b),p=n(14),d=n(4),g=n(153),m=n(182),v=n(11),O=n.n(v),h=n(169),j=(n(2),n(46)),y=(n(839),n(262)),w=n(250),_=n(268),E=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(o.sprintf)(Object(o.__)("Between %s and %s","woo-gutenberg-products-block"),Object(w.a)(e),Object(w.a)(t)):Number.isFinite(e)?Object(o.sprintf)(Object(o.__)("From %s","woo-gutenberg-products-block"),Object(w.a)(e)):Object(o.sprintf)(Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(w.a)(t))},S=function(e){var t=e.type,n=e.name,r=e.prefix,c=e.removeCallback,a=void 0===c?function(){}:c,u=e.showLabel,l=void 0===u||u,s=e.displayStyle,b=r?Object(i.createElement)(i.Fragment,null,r," ",n):n,f=Object(o.sprintf)(Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),n);return Object(i.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+n},l&&Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(i.createElement)(_.a,{element:"span",text:b,onRemove:a,radius:"large",ariaLabel:f}):Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-name"},b,Object(i.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:a},f)))},k=n(201),x=n(33),C=n(263),R=function(e){var t=e.attributeObject,n=void 0===t?{}:t,r=e.slugs,c=void 0===r?[]:r,a=e.operator,u=void 0===a?"in":a,l=e.displayStyle,s=Object(k.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[n.id]}),b=s.results,f=s.isLoading,p=Object(h.b)("attributes",[]),d=O()(p,2),g=d[0],m=d[1];if(f)return null;var v=n.label;return Object(i.createElement)("li",null,Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-type"},v,":"),Object(i.createElement)("ul",null,c.map((function(e,t){var r=b.find((function(t){return t.slug===e}));if(!r)return null;var c="";return t>0&&"and"===u&&(c=Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),S({type:v,name:Object(x.decodeEntities)(r.name||e),prefix:c,removeCallback:function(){Object(C.a)(g,m,n,e)},showLabel:!1,displayStyle:l})}))))},N=function(e){var t=e.attributes,n=e.isEditor,r=void 0!==n&&n,c=Object(h.b)("attributes",[]),a=O()(c,2),u=a[0],l=a[1],s=Object(h.b)("min_price"),b=O()(s,2),p=b[0],d=b[1],g=Object(h.b)("max_price"),m=O()(g,2),v=m[0],w=m[1],_=Object(i.useMemo)((function(){return Number.isFinite(p)||Number.isFinite(v)?S({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:E(p,v),removeCallback:function(){d(void 0),w(void 0)},displayStyle:t.displayStyle}):null}),[p,v,E]),k=Object(i.useMemo)((function(){return u.map((function(e){var n=Object(y.b)(e.attribute);return Object(i.createElement)(R,{attributeObject:n,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[u]);if(!(u.length>0||Number.isFinite(p)||Number.isFinite(v)||r))return null;var x="h".concat(t.headingLevel),C=f()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(i.createElement)(i.Fragment,null,!r&&t.heading&&Object(i.createElement)(x,null,t.heading),Object(i.createElement)("div",{className:"wc-block-active-filters"},Object(i.createElement)("ul",{className:C},r?Object(i.createElement)(i.Fragment,null,S({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),S({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(i.createElement)(i.Fragment,null,_,k)),Object(i.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:function(){d(void 0),w(void 0),l([])}},Object(i.createElement)(j.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},P=n(72),L=Object(d.withSpokenMessages)((function(e){var t=e.attributes,n=e.setAttributes,r=t.className,c=t.displayStyle,a=t.heading,u=t.headingLevel;return Object(i.createElement)("div",{className:r},Object(i.createElement)(p.InspectorControls,{key:"inspector"},Object(i.createElement)(d.PanelBody,{title:Object(o.__)("Block Settings","woo-gutenberg-products-block")},Object(i.createElement)(P.a,{label:Object(o.__)("Display Style","woo-gutenberg-products-block"),value:c,options:[{label:Object(o.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(o.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:function(e){return n({displayStyle:e})}}),Object(i.createElement)("p",null,Object(o.__)("Heading Level","woo-gutenberg-products-block")),Object(i.createElement)(g.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:u,onChange:function(e){return n({headingLevel:e})}}))),Object(i.createElement)(m.a,{headingLevel:u,heading:a,onChange:function(e){return n({heading:e})}}),Object(i.createElement)(d.Disabled,null,Object(i.createElement)(N,{attributes:t,isEditor:!0})))}));Object(a.registerBlockType)("woocommerce/active-filters",{title:Object(o.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(i.createElement)(u.a,{srcElement:s}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Show the currently active product filters. Works in combination with the All Products and filters blocks.","woo-gutenberg-products-block"),supports:{html:!1,multiple:!1},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(o.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:L,save:function(e){var t=e.attributes,n=t.className,r={"data-display-style":t.displayStyle,"data-heading":t.heading,"data-heading-level":t.headingLevel};return Object(i.createElement)("div",c()({className:f()("is-loading",n)},r),Object(i.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},9:function(e,t){!function(){e.exports=this.React}()},99:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),c=Object(r.createContext)("page"),i=function(){return Object(r.useContext)(c)};c.Provider}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var r,o,a=t[0],u=t[1],l=t[2],b=0,f=[];b<a.length;b++)o=a[b],Object.prototype.hasOwnProperty.call(c,o)&&c[o]&&f.push(c[o][0]),c[o]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);for(s&&s(t);f.length;)f.shift()();return i.push.apply(i,l||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],r=!0,a=1;a<n.length;a++){var u=n[a];0!==c[u]&&(r=!1)}r&&(i.splice(t--,1),e=o(o.s=n[0]))}return e}var r={},c={4:0},i=[];function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.m=e,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var s=u;return i.push([842,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},121:function(e,t){},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},154:function(e,t,n){"use strict";var r=n(21),c=n.n(r),i=n(24),o=n.n(i),a=n(22),u=n.n(a),l=n(23),s=n.n(l),b=n(12),f=n.n(b),p=n(0),d=n(6),g=n(1),m=n(4);function v(e){var t=e.level,n={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return n.hasOwnProperty(t)?Object(p.createElement)(m.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(p.createElement)(m.Path,{d:n[t]})):null}function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=f()(e);if(t){var c=f()(this).constructor;n=Reflect.construct(r,arguments,c)}else n=r.apply(this,arguments);return s()(this,n)}}var h=function(e){u()(n,e);var t=O(n);function n(){return c()(this,n),t.apply(this,arguments)}return o()(n,[{key:"createLevelControl",value:function(e,t,n){var r=e===t;return{icon:Object(p.createElement)(v,{level:e}),title:Object(g.sprintf)(Object(g.__)("Heading %d"),e),isActive:r,onClick:function(){return n(e)}}}},{key:"render",value:function(){var e=this,t=this.props,n=t.isCollapsed,r=void 0===n||n,c=t.minLevel,i=t.maxLevel,o=t.selectedLevel,a=t.onChange;return Object(p.createElement)(m.Toolbar,{isCollapsed:r,icon:Object(p.createElement)(v,{level:o}),controls:Object(d.range)(c,i).map((function(t){return e.createLevelControl(t,o,a)}))})}}]),n}(p.Component);t.a=h},157:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(11),c=n.n(r),i=n(0),o=function(){var e=Object(i.useState)(),t=c()(e,2)[1];return function(e){return t((function(){throw e}))}}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},170:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return p}));var r=n(11),c=n.n(r),i=n(41),o=n(36),a=n(0),u=n(99),l=n(6),s=n(61),b=function(e){var t=Object(u.a)();e=e||t;var n=Object(o.useSelect)((function(t){return t(i.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),r=Object(o.useDispatch)(i.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[n,Object(a.useCallback)((function(t){r(e,t)}),[e])]},f=function(e,t,n){var r=Object(u.a)();n=n||r;var c=Object(o.useSelect)((function(r){return r(i.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)}),[n,e]),l=Object(o.useDispatch)(i.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(a.useCallback)((function(t){l(n,e,t)}),[n,e])]},p=function(e,t){var n=Object(u.a)(),r=b(t=t||n),i=c()(r,2),o=i[0],f=i[1],p=Object(s.a)(e),d=Object(a.useRef)(!1);return Object(a.useEffect)((function(){f(Object(l.assign)({},o,p)),d.current=!0}),[p]),d.current?[o,f]:[e,f]}},183:function(e,t,n){"use strict";var r=n(0),c=(n(2),n(14)),i=n(8),o=n.n(i);n(254);t.a=function(e){var t=e.className,n=e.headingLevel,i=e.onChange,a=e.heading,u="h".concat(n);return Object(r.createElement)(u,null,Object(r.createElement)(c.PlainText,{className:o()("wc-block-editor-components-title",t),value:a,onChange:i}))}},200:function(e,t){},203:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(41),c=n(36),i=n(0),o=n(157),a=n(61),u=function(e){var t=e.namespace,n=e.resourceName,u=e.resourceValues,l=void 0===u?[]:u,s=e.query,b=void 0===s?{}:s,f=e.shouldSelect,p=void 0===f||f;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");var d=Object(i.useRef)({results:[],isLoading:!0}),g=Object(a.a)(b),m=Object(a.a)(l),v=Object(o.a)(),O=Object(c.useSelect)((function(e){if(!p)return null;var c=e(r.COLLECTIONS_STORE_KEY),i=[t,n,g,m],o=c.getCollectionError.apply(c,i);return o&&v(o),{results:c.getCollection.apply(c,i),isLoading:!c.hasFinishedResolution("getCollection",i)}}),[t,n,m,g,p]);return null!==O&&(d.current=O),d.current}},25:function(e,t){!function(){e.exports=this.wp.compose}()},252:function(e,t,n){"use strict";n.d(t,"c",(function(){return p})),n.d(t,"b",(function(){return d})),n.d(t,"a",(function(){return g}));var r=n(7),c=n.n(r),i=n(52),o=n.n(i),a=n(3);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s,b,f={code:a.CURRENCY.code,symbol:a.CURRENCY.symbol,thousandSeparator:a.CURRENCY.thousandSeparator,decimalSeparator:a.CURRENCY.decimalSeparator,minorUnit:a.CURRENCY.precision,prefix:(s=a.CURRENCY.symbol,b=a.CURRENCY.symbolPosition,{left:s,left_space:" "+s,right:"",right_space:""}[b]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(a.CURRENCY.symbol,a.CURRENCY.symbolPosition)},p=function(e){if(!e||"object"!==o()(e))return f;var t=e.currency_code,n=e.currency_symbol,r=e.currency_thousand_separator,c=e.currency_decimal_separator,i=e.currency_minor_unit,a=e.currency_prefix,u=e.currency_suffix;return{code:t||"USD",symbol:n||"$",thousandSeparator:"string"==typeof r?r:",",decimalSeparator:"string"==typeof c?c:".",minorUnit:Number.isFinite(i)?i:2,prefix:"string"==typeof a?a:"$",suffix:"string"==typeof u?u:""}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(l({},f),e)},g=function(e,t){if(""===e||void 0===e)return"";var n=parseInt(e,10);if(!Number.isFinite(n))return"";var r=d(t),c=n/Math.pow(10,r.minorUnit),i=r.prefix+c+r.suffix,o=document.createElement("textarea");return o.innerHTML=i,o.value}},254:function(e,t){},264:function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}));var r=n(5),c=r.c.reduce((function(e,t){var n,r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;return r.id&&e.push(r),e}),[]),i=function(e){if(e)return c.find((function(t){return t.id===e}))},o=function(e){if(e)return c.find((function(t){return t.taxonomy===e}))}},265:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return i}));var r=n(6),c=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=e.filter((function(e){return e.attribute===n.taxonomy})),o=i.length?i[0]:null;if(o&&o.slug&&Array.isArray(o.slug)&&o.slug.includes(c)){var a=o.slug.filter((function(e){return e!==c})),u=e.filter((function(e){return e.attribute!==n.taxonomy}));a.length>0&&(o.slug=a.sort(),u.push(o)),t(Object(r.sortBy)(u,"attribute"))}},i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){},n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in",o=e.filter((function(e){return e.attribute!==n.taxonomy}));0===c.length?t(o):(o.push({attribute:n.taxonomy,operator:i,slug:Object(r.map)(c,"slug").sort()}),t(Object(r.sortBy)(o,"attribute")))}},270:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(27),o=n.n(i),a=n(0),u=(n(2),n(8)),l=n.n(u),s=n(1),b=n(60),f=n(275),p=(n(200),function(e){var t=e.text,n=e.screenReaderText,r=void 0===n?"":n,i=e.element,u=void 0===i?"li":i,s=e.className,b=void 0===s?"":s,f=e.radius,p=void 0===f?"small":f,d=e.children,g=void 0===d?null:d,m=o()(e,["text","screenReaderText","element","className","radius","children"]),v=u,O=l()(b,"wc-block-components-chip","wc-block-components-chip--radius-"+p),h=Boolean(r&&r!==t);return Object(a.createElement)(v,c()({className:O},m),Object(a.createElement)("span",{"aria-hidden":h,className:"wc-block-components-chip__text"},t),h&&Object(a.createElement)("span",{className:"screen-reader-text"},r),g)});t.a=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.className,i=void 0===r?"":r,u=e.disabled,d=void 0!==u&&u,g=e.onRemove,m=void 0===g?function(){}:g,v=e.removeOnAnyClick,O=void 0!==v&&v,h=e.text,j=e.screenReaderText,y=void 0===j?"":j,w=o()(e,["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"]),_=O?"span":"button";if(!n){var E=y&&"string"==typeof y?y:h;n="string"!=typeof E?Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),E)}var S={"aria-label":n,disabled:d,onClick:m,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||m()}},k=O?S:{},x=O?{"aria-hidden":!0}:S;return Object(a.createElement)(p,c()({},w,k,{className:l()(i,"is-removable"),element:O?"button":w.element,screenReaderText:y,text:h}),Object(a.createElement)(_,c()({className:"wc-block-components-chip__remove"},x),Object(a.createElement)(b.a,{className:"wc-block-components-chip__remove-icon",srcElement:f.a,size:16})))}},275:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(27),o=n.n(i),a=n(0),u=n(59),l=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=o()(e,["className","size"]);return Object(a.createElement)(u.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(a.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=l},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},36:function(e,t){!function(){e.exports=this.wp.data}()},4:function(e,t){!function(){e.exports=this.wp.components}()},41:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},45:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},48:function(e,t,n){"use strict";var r=n(7),c=n.n(r),i=n(0),o=(n(2),n(9)),a=n(8),u=n.n(a);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var b=function(e){var t,n=e.label,r=e.screenReaderLabel,c=e.wrapperElement,a=e.wrapperProps,l=null!=n,b=null!=r;return!l&&b?(t=c||"span",a=s(s({},a),{},{className:u()(a.className,"screen-reader-text")}),Object(i.createElement)(t,a,r)):(t=c||o.Fragment,l&&b&&n!==r?Object(i.createElement)(t,a,Object(i.createElement)("span",{"aria-hidden":"true"},n),Object(i.createElement)("span",{className:"screen-reader-text"},r)):Object(i.createElement)(t,a,n))};b.defaultProps={wrapperProps:{}},t.a=b},5:function(e,t,n){"use strict";n.d(t,"k",(function(){return c})),n.d(t,"I",(function(){return i})),n.d(t,"O",(function(){return o})),n.d(t,"y",(function(){return a})),n.d(t,"A",(function(){return u})),n.d(t,"l",(function(){return l})),n.d(t,"z",(function(){return s})),n.d(t,"C",(function(){return b})),n.d(t,"n",(function(){return f})),n.d(t,"B",(function(){return p})),n.d(t,"m",(function(){return d})),n.d(t,"E",(function(){return g})),n.d(t,"u",(function(){return m})),n.d(t,"x",(function(){return v})),n.d(t,"r",(function(){return O})),n.d(t,"s",(function(){return h})),n.d(t,"t",(function(){return j})),n.d(t,"j",(function(){return y})),n.d(t,"K",(function(){return w})),n.d(t,"P",(function(){return _})),n.d(t,"p",(function(){return E})),n.d(t,"q",(function(){return S})),n.d(t,"o",(function(){return k})),n.d(t,"H",(function(){return x})),n.d(t,"c",(function(){return C})),n.d(t,"v",(function(){return R})),n.d(t,"w",(function(){return N})),n.d(t,"S",(function(){return L})),n.d(t,"T",(function(){return T})),n.d(t,"J",(function(){return H})),n.d(t,"a",(function(){return z})),n.d(t,"M",(function(){return D})),n.d(t,"b",(function(){return V})),n.d(t,"L",(function(){return B})),n.d(t,"D",(function(){return F})),n.d(t,"h",(function(){return U})),n.d(t,"N",(function(){return Y})),n.d(t,"g",(function(){return I})),n.d(t,"i",(function(){return Q})),n.d(t,"G",(function(){return K})),n.d(t,"F",(function(){return G})),n.d(t,"R",(function(){return W})),n.d(t,"Q",(function(){return q})),n.d(t,"d",(function(){return J})),n.d(t,"e",(function(){return $})),n.d(t,"f",(function(){return X})),n.d(t,"W",(function(){return ee})),n.d(t,"X",(function(){return te})),n.d(t,"U",(function(){return ne})),n.d(t,"V",(function(){return re}));var r=n(3),c=Object(r.getSetting)("currentUserIsAdmin",!1),i=Object(r.getSetting)("reviewRatingsEnabled",!0),o=Object(r.getSetting)("showAvatars",!0),a=Object(r.getSetting)("max_columns",6),u=Object(r.getSetting)("min_columns",1),l=Object(r.getSetting)("default_columns",3),s=Object(r.getSetting)("max_rows",6),b=Object(r.getSetting)("min_rows",1),f=Object(r.getSetting)("default_rows",3),p=Object(r.getSetting)("min_height",500),d=Object(r.getSetting)("default_height",500),g=Object(r.getSetting)("placeholderImgSrc",""),m=(Object(r.getSetting)("thumbnail_size",300),Object(r.getSetting)("isLargeCatalog")),v=Object(r.getSetting)("limitTags"),O=Object(r.getSetting)("hasProducts",!0),h=Object(r.getSetting)("hasTags",!0),j=Object(r.getSetting)("homeUrl",""),y=Object(r.getSetting)("couponsEnabled",!0),w=Object(r.getSetting)("shippingEnabled",!0),_=Object(r.getSetting)("taxesEnabled",!0),E=Object(r.getSetting)("displayItemizedTaxes",!1),S=Object(r.getSetting)("hasDarkEditorStyleSupport",!1),k=(Object(r.getSetting)("displayShopPricesIncludingTax",!1),Object(r.getSetting)("displayCartPricesIncludingTax",!1)),x=Object(r.getSetting)("productCount",0),C=Object(r.getSetting)("attributes",[]),R=Object(r.getSetting)("isShippingCalculatorEnabled",!0),N=Object(r.getSetting)("isShippingCostHidden",!1),P=Object(r.getSetting)("woocommerceBlocksPhase",1),L=Object(r.getSetting)("wcBlocksAssetUrl",""),T=Object(r.getSetting)("wcBlocksBuildUrl",""),H=Object(r.getSetting)("shippingCountries",{}),z=Object(r.getSetting)("allowedCountries",{}),D=Object(r.getSetting)("shippingStates",{}),V=Object(r.getSetting)("allowedStates",{}),B=Object(r.getSetting)("shippingMethodsExist",!1),F=Object(r.getSetting)("paymentGatewaySortOrder",[]),U=Object(r.getSetting)("checkoutShowLoginReminder",!0),M={id:0,title:"",permalink:""},A=Object(r.getSetting)("storePages",{shop:M,cart:M,checkout:M,privacy:M,terms:M}),Y=A.shop.permalink,I=A.checkout.id,Q=A.checkout.permalink,K=A.privacy.permalink,G=A.privacy.title,W=A.terms.permalink,q=A.terms.title,J=A.cart.id,$=A.cart.permalink,X=Object(r.getSetting)("checkoutAllowsGuest",!1),Z=(Object(r.getSetting)("checkoutAllowsSignup",!1),n(17)),ee=function(e,t){if(P>2)return Object(Z.registerBlockType)(e,t)},te=function(e,t){if(P>1)return Object(Z.registerBlockType)(e,t)},ne=function(){return P>2},re=function(){return P>1}},6:function(e,t){!function(){e.exports=this.lodash}()},60:function(e,t,n){"use strict";var r=n(7),c=n.n(r),i=n(27),o=n.n(i),a=n(9);n(2);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.a=function(e){var t=e.srcElement,n=e.size,r=void 0===n?24:n,i=o()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({width:r,height:r},i))}},61:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=n(45),i=n.n(c),o=function(e){var t=Object(r.useRef)();return i()(e,t.current)||(t.current=e),t.current}},73:function(e,t,n){"use strict";var r=n(10),c=n.n(r),i=n(21),o=n.n(i),a=n(24),u=n.n(a),l=n(19),s=n.n(l),b=n(22),f=n.n(b),p=n(23),d=n.n(p),g=n(12),m=n.n(g),v=n(0),O=n(6),h=n(8),j=n.n(h),y=n(4),w=n(25);n(121);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m()(e);if(t){var c=m()(this).constructor;n=Reflect.construct(r,arguments,c)}else n=r.apply(this,arguments);return d()(this,n)}}var E=function(e){f()(n,e);var t=_(n);function n(){var e;return o()(this,n),(e=t.apply(this,arguments)).onClick=e.onClick.bind(s()(e)),e}return u()(n,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,n=this.props,r=n.label,i=n.checked,o=n.instanceId,a=n.className,u=n.help,l=n.options,s=n.value,b="inspector-toggle-button-control-".concat(o);return u&&(e=Object(O.isFunction)(u)?u(i):u),Object(v.createElement)(y.BaseControl,{id:b,help:e,className:j()("components-toggle-button-control",a)},Object(v.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},r),Object(v.createElement)(y.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,n){var i={};return s===e.value?(i.isPrimary=!0,i["aria-pressed"]=!0):(i.isDefault=!0,i["aria-pressed"]=!1),Object(v.createElement)(y.Button,c()({key:"".concat(e.label,"-").concat(e.value,"-").concat(n),value:e.value,onClick:t.onClick,"aria-label":r+": "+e.label},i),e.label)}))))}}]),n}(v.Component);t.a=Object(w.withInstanceId)(E)},842:function(e,t,n){e.exports=n(895)},843:function(e,t){},895:function(e,t,n){"use strict";n.r(t);var r=n(10),c=n.n(r),i=n(0),o=n(1),a=n(17),u=n(60),l=n(59),s=Object(i.createElement)(l.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(i.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"})),b=n(8),f=n.n(b),p=n(14),d=n(4),g=n(154),m=n(183),v=n(11),O=n.n(v),h=n(170),j=(n(2),n(48)),y=(n(843),n(264)),w=n(252),_=n(270),E=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(o.sprintf)(Object(o.__)("Between %s and %s","woo-gutenberg-products-block"),Object(w.a)(e),Object(w.a)(t)):Number.isFinite(e)?Object(o.sprintf)(Object(o.__)("From %s","woo-gutenberg-products-block"),Object(w.a)(e)):Object(o.sprintf)(Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(w.a)(t))},S=function(e){var t=e.type,n=e.name,r=e.prefix,c=e.removeCallback,a=void 0===c?function(){}:c,u=e.showLabel,l=void 0===u||u,s=e.displayStyle,b=r?Object(i.createElement)(i.Fragment,null,r," ",n):n,f=Object(o.sprintf)(Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),n);return Object(i.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+n},l&&Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(i.createElement)(_.a,{element:"span",text:b,onRemove:a,radius:"large",ariaLabel:f}):Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-name"},b,Object(i.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:a},f)))},k=n(203),x=n(33),C=n(265),R=function(e){var t=e.attributeObject,n=void 0===t?{}:t,r=e.slugs,c=void 0===r?[]:r,a=e.operator,u=void 0===a?"in":a,l=e.displayStyle,s=Object(k.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[n.id]}),b=s.results,f=s.isLoading,p=Object(h.b)("attributes",[]),d=O()(p,2),g=d[0],m=d[1];if(f)return null;var v=n.label;return Object(i.createElement)("li",null,Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-type"},v,":"),Object(i.createElement)("ul",null,c.map((function(e,t){var r=b.find((function(t){return t.slug===e}));if(!r)return null;var c="";return t>0&&"and"===u&&(c=Object(i.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("and","woo-gutenberg-products-block"))),S({type:v,name:Object(x.decodeEntities)(r.name||e),prefix:c,removeCallback:function(){Object(C.a)(g,m,n,e)},showLabel:!1,displayStyle:l})}))))},N=function(e){var t=e.attributes,n=e.isEditor,r=void 0!==n&&n,c=Object(h.b)("attributes",[]),a=O()(c,2),u=a[0],l=a[1],s=Object(h.b)("min_price"),b=O()(s,2),p=b[0],d=b[1],g=Object(h.b)("max_price"),m=O()(g,2),v=m[0],w=m[1],_=Object(i.useMemo)((function(){return Number.isFinite(p)||Number.isFinite(v)?S({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:E(p,v),removeCallback:function(){d(void 0),w(void 0)},displayStyle:t.displayStyle}):null}),[p,v,E]),k=Object(i.useMemo)((function(){return u.map((function(e){var n=Object(y.b)(e.attribute);return Object(i.createElement)(R,{attributeObject:n,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[u]);if(!(u.length>0||Number.isFinite(p)||Number.isFinite(v)||r))return null;var x="h".concat(t.headingLevel),C=f()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(i.createElement)(i.Fragment,null,!r&&t.heading&&Object(i.createElement)(x,null,t.heading),Object(i.createElement)("div",{className:"wc-block-active-filters"},Object(i.createElement)("ul",{className:C},r?Object(i.createElement)(i.Fragment,null,S({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),S({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(i.createElement)(i.Fragment,null,_,k)),Object(i.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:function(){d(void 0),w(void 0),l([])}},Object(i.createElement)(j.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},P=n(73),L=Object(d.withSpokenMessages)((function(e){var t=e.attributes,n=e.setAttributes,r=t.className,c=t.displayStyle,a=t.heading,u=t.headingLevel;return Object(i.createElement)("div",{className:r},Object(i.createElement)(p.InspectorControls,{key:"inspector"},Object(i.createElement)(d.PanelBody,{title:Object(o.__)("Block Settings","woo-gutenberg-products-block")},Object(i.createElement)(P.a,{label:Object(o.__)("Display Style","woo-gutenberg-products-block"),value:c,options:[{label:Object(o.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(o.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:function(e){return n({displayStyle:e})}}),Object(i.createElement)("p",null,Object(o.__)("Heading Level","woo-gutenberg-products-block")),Object(i.createElement)(g.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:u,onChange:function(e){return n({headingLevel:e})}}))),Object(i.createElement)(m.a,{headingLevel:u,heading:a,onChange:function(e){return n({heading:e})}}),Object(i.createElement)(d.Disabled,null,Object(i.createElement)(N,{attributes:t,isEditor:!0})))}));Object(a.registerBlockType)("woocommerce/active-filters",{title:Object(o.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(i.createElement)(u.a,{srcElement:s}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Show the currently active product filters. Works in combination with the All Products and filters blocks.","woo-gutenberg-products-block"),supports:{html:!1,multiple:!1},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(o.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:L,save:function(e){var t=e.attributes,n=t.className,r={"data-display-style":t.displayStyle,"data-heading":t.heading,"data-heading-level":t.headingLevel};return Object(i.createElement)("div",c()({className:f()("is-loading",n)},r),Object(i.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},9:function(e,t){!function(){e.exports=this.React}()},99:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),c=Object(r.createContext)("page"),i=function(){return Object(r.useContext)(c)};c.Provider}});
|
build/all-products-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wc-shared-context', 'wc-shared-hocs', 'wp-a11y', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wc-shared-context', 'wc-shared-hocs', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-wordcount'), 'version' => 'fad10656fba2ec923a8a19337de2717c');
|
build/all-products-frontend.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){function t(t){for(var n,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(u&&u(t);s.length;)s.shift()()}var n={},r={1:0};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var c=new Promise((function(t,o){n=r[e]=[t,o]}));t.push(n[2]=c);var i,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(e){return o.p+""+({2:"atomic-block-components/add-to-cart",3:"atomic-block-components/button",4:"atomic-block-components/category-list",5:"atomic-block-components/image",6:"atomic-block-components/price",7:"atomic-block-components/rating",8:"atomic-block-components/sale-badge",9:"atomic-block-components/sku",10:"atomic-block-components/stock-indicator",11:"atomic-block-components/summary",12:"atomic-block-components/tag-list",13:"atomic-block-components/title",20:"vendors~atomic-block-components/price"}[e]||e)+"-frontend.js"}(e);var u=new Error;i=function(t){a.onerror=a.onload=null,clearTimeout(s);var n=r[e];if(0!==n){if(n){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",u.name="ChunkLoadError",u.type=o,u.request=c,n[1](u)}r[e]=void 0}};var s=setTimeout((function(){i({type:"timeout",target:a})}),12e4);a.onerror=a.onload=i,document.head.appendChild(a)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var u=i;o(o.s=
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
-
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var i=o.apply(null,r);i&&e.push(i)}else if("object"===c)for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.lodash}()},function(e,t,n){"use strict";n.d(t,"i",(function(){return o})),n.d(t,"s",(function(){return c})),n.d(t,"w",(function(){return i})),n.d(t,"p",(function(){return a})),n.d(t,"l",(function(){return u})),n.d(t,"o",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"x",(function(){return f})),n.d(t,"k",(function(){return p})),n.d(t,"j",(function(){return d})),n.d(t,"c",(function(){return m})),n.d(t,"m",(function(){return b})),n.d(t,"n",(function(){return h})),n.d(t,"A",(function(){return v})),n.d(t,"B",(function(){return y})),n.d(t,"t",(function(){return O})),n.d(t,"a",(function(){return j})),n.d(t,"u",(function(){return w})),n.d(t,"b",(function(){return k})),n.d(t,"f",(function(){return E})),n.d(t,"v",(function(){return R})),n.d(t,"g",(function(){return x})),n.d(t,"r",(function(){return P})),n.d(t,"q",(function(){return C})),n.d(t,"z",(function(){return N})),n.d(t,"y",(function(){return T})),n.d(t,"d",(function(){return A})),n.d(t,"e",(function(){return F})),n.d(t,"C",(function(){return M}));var r=n(2),o=Object(r.getSetting)("currentUserIsAdmin",!1),c=Object(r.getSetting)("reviewRatingsEnabled",!0),i=Object(r.getSetting)("showAvatars",!0),a=(Object(r.getSetting)("max_columns",6),Object(r.getSetting)("min_columns",1),Object(r.getSetting)("default_columns",3),Object(r.getSetting)("max_rows",6),Object(r.getSetting)("min_rows",1),Object(r.getSetting)("default_rows",3),Object(r.getSetting)("min_height",500),Object(r.getSetting)("default_height",500),Object(r.getSetting)("placeholderImgSrc","")),u=(Object(r.getSetting)("thumbnail_size",300),Object(r.getSetting)("isLargeCatalog")),s=Object(r.getSetting)("limitTags"),l=(Object(r.getSetting)("hasProducts",!0),Object(r.getSetting)("hasTags",!0),Object(r.getSetting)("homeUrl",""),Object(r.getSetting)("couponsEnabled",!0)),f=(Object(r.getSetting)("shippingEnabled",!0),Object(r.getSetting)("taxesEnabled",!0)),p=Object(r.getSetting)("displayItemizedTaxes",!1),d=(Object(r.getSetting)("displayShopPricesIncludingTax",!1),Object(r.getSetting)("displayCartPricesIncludingTax",!1)),m=(Object(r.getSetting)("productCount",0),Object(r.getSetting)("attributes",[])),b=Object(r.getSetting)("isShippingCalculatorEnabled",!0),h=Object(r.getSetting)("isShippingCostHidden",!1),g=Object(r.getSetting)("woocommerceBlocksPhase",1),v=Object(r.getSetting)("wcBlocksAssetUrl",""),y=Object(r.getSetting)("wcBlocksBuildUrl",""),O=Object(r.getSetting)("shippingCountries",{}),j=Object(r.getSetting)("allowedCountries",{}),w=Object(r.getSetting)("shippingStates",{}),k=Object(r.getSetting)("allowedStates",{}),E=(Object(r.getSetting)("shippingMethodsExist",!1),Object(r.getSetting)("checkoutShowLoginReminder",!0)),_={id:0,title:"",permalink:""},S=Object(r.getSetting)("storePages",{shop:_,cart:_,checkout:_,privacy:_,terms:_}),R=S.shop.permalink,x=(S.checkout.id,S.checkout.permalink),P=S.privacy.permalink,C=S.privacy.title,N=S.terms.permalink,T=S.terms.title,A=(S.cart.id,S.cart.permalink),F=Object(r.getSetting)("checkoutAllowsGuest",!1),M=(Object(r.getSetting)("checkoutAllowsSignup",!1),n(38),function(){return g>1})},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){var r=n(68),o=n(69),c=n(52),i=n(70);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||i()}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},function(e,t,n){var r=n(54);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t){!function(){e.exports=this.wp.htmlEntities}()},,function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(40);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Object(r.a)(e,t,n[t])}))}return e}},,function(e,t){!function(){e.exports=this.regeneratorRuntime}()},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(51);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}(e,t)||Object(r.a)(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(28);function o(e,t){if(null==e)return{};var n,o,c=Object(r.a)(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=n(6),o=n.n(r),c=(n(4),n(3)),i=n(5),a=n.n(i);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l=function(e){var t,n=e.label,r=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=null!=n,l=null!=r;return!u&&l?(t=o||"span",i=s(s({},i),{},{className:a()(i.className,"screen-reader-text")}),React.createElement(t,i,r)):(t=o||c.Fragment,u&&l&&n!==r?React.createElement(t,i,React.createElement("span",{"aria-hidden":"true"},n),React.createElement("span",{className:"screen-reader-text"},r)):React.createElement(t,i,n))};l.defaultProps={wrapperProps:{}},t.a=l},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(58);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(23),o=n(18);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(45);var o=n(51);function c(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t){!function(){e.exports=this.wc.wcBlocksRegistry}()},function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(36),c=n.n(o),i=function(e){var t=Object(r.useRef)();return c()(e,t.current)||(t.current=e),t.current}},function(e,t){!function(){e.exports=this.wp.blocks}()},,function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},,function(e,t){!function(){e.exports=this.wp.a11y}()},,function(e,t,n){"use strict";var r=n(30),o=n.n(r),c=n(31),i=n.n(c),a=n(18),u=n.n(a),s=n(32),l=n.n(s),f=n(33),p=n.n(f),d=n(19),m=n.n(d),b=n(6),h=n.n(b),g=(n(4),n(3)),v=n(1),y=n(8),O=function(e){var t=e.imageUrl,n=void 0===t?"".concat(y.A,"img/block-error.svg"):t,r=e.header,o=void 0===r?Object(v.__)("Oops!","woo-gutenberg-products-block"):r,c=e.text,i=void 0===c?Object(v.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,a=e.errorMessage,u=e.errorMessagePrefix,s=void 0===u?Object(v.__)("Error:","woo-gutenberg-products-block"):u;return React.createElement("div",{className:"wc-block-error wc-block-components-error"},n&&React.createElement("img",{className:"wc-block-error__image wc-block-components-error__image",src:n,alt:""}),React.createElement("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&React.createElement("p",{className:"wc-block-error__header wc-block-components-error__header"},o),i&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},i),a&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",a)))};n(61);function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m()(e);if(t){var o=m()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p()(this,n)}}var w=function(e){l()(n,e);var t=j(n);function n(){var e;o()(this,n);for(var r=arguments.length,c=new Array(r),i=0;i<r;i++)c[i]=arguments[i];return e=t.call.apply(t,[this].concat(c)),h()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(n,[{key:"render",value:function(){var e=this.props,t=e.header,n=e.imageUrl,r=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=this.state,a=i.errorMessage;return i.hasError?React.createElement(O,{errorMessage:r?a:null,header:t,imageUrl:n,text:o,errorMessagePrefix:c}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(g.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),n}(g.Component);w.defaultProps={showErrorMessage:!0};t.a=w},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},function(e,t){!function(){e.exports=this.wp.dom}()},function(e,t){!function(){e.exports=this.wp.keycodes}()},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(20),o=n(7),c=n(0),i=function(e){var t=Object(r.a)({},e,{role:"img","aria-hidden":"true",focusable:"false"});return Object(c.createElement)("svg",Object(o.omit)(t,"__unstableActive"))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(45);function o(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(e,t):void 0}}},function(e,t,n){var r=n(53);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=Object(r.createContext)("page"),c=function(){return Object(r.useContext)(o)};o.Provider},,function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){"use strict";var r=n(60);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,c,i){if(i!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return r}))},,function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(11)),c=r(n(54)),i=n(3),a=r(i),u=r(n(105)),s=r(n(18)),l={arr:Array.isArray,obj:function(e){return"[object Object]"===Object.prototype.toString.call(e)},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},und:function(e){return void 0===e},nul:function(e){return null===e},set:function(e){return e instanceof Set},map:function(e){return e instanceof Map},equ:function(e,t){if(typeof e!=typeof t)return!1;if(l.str(e)||l.num(e))return e===t;if(l.obj(e)&&l.obj(t)&&Object.keys(e).length+Object.keys(t).length===0)return!0;var n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return!l.und(n)||e===t}};function f(){var e=i.useState(!1)[1];return i.useCallback((function(){return e((function(e){return!e}))}),[])}function p(e,t){return l.und(e)||l.nul(e)?t:e}function d(e){return l.und(e)?[]:l.arr(e)?e:[e]}function m(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return l.fun(e)?e.apply(void 0,n):e}function b(e){var t=function(e){return e.to,e.from,e.config,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.delay,e.attach,e.destroyed,e.interpolateTo,e.ref,e.lazy,c(e,["to","from","config","onStart","onRest","onFrame","children","reset","reverse","force","immediate","delay","attach","destroyed","interpolateTo","ref","lazy"])}(e);if(l.und(t))return o({to:t},e);var n=Object.keys(e).reduce((function(n,r){var c;return l.und(t[r])?o({},n,((c={})[r]=e[r],c)):n}),{});return o({to:t},n)}var h,g,v=function(){function e(){this.payload=void 0,this.children=[]}var t=e.prototype;return t.getAnimatedValue=function(){return this.getValue()},t.getPayload=function(){return this.payload||this},t.attach=function(){},t.detach=function(){},t.getChildren=function(){return this.children},t.addChild=function(e){0===this.children.length&&this.attach(),this.children.push(e)},t.removeChild=function(e){var t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()},e}(),y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).payload=[],t.attach=function(){return t.payload.forEach((function(e){return e instanceof v&&e.addChild(s(t))}))},t.detach=function(){return t.payload.forEach((function(e){return e instanceof v&&e.removeChild(s(t))}))},t}return u(t,e),t}(v),O=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).payload={},t.attach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof v&&e.addChild(s(t))}))},t.detach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof v&&e.removeChild(s(t))}))},t}u(t,e);var n=t.prototype;return n.getValue=function(e){void 0===e&&(e=!1);var t={};for(var n in this.payload){var r=this.payload[n];(!e||r instanceof v)&&(t[n]=r instanceof v?r[e?"getAnimatedValue":"getValue"]():r)}return t},n.getAnimatedValue=function(){return this.getValue(!0)},t}(v);function j(e,t){h={fn:e,transform:t}}function w(e){g=e}var k,E=function(e){return"undefined"!=typeof window?window.requestAnimationFrame(e):-1},_=function(e){"undefined"!=typeof window&&window.cancelAnimationFrame(e)};function S(e){k=e}var R,x=function(){return Date.now()};function P(e){R=e}var C,N,T=function(e){return e.current};function A(e){C=e}var F=Object.freeze({get applyAnimatedValues(){return h},injectApplyAnimatedValues:j,get colorNames(){return g},injectColorNames:w,get requestFrame(){return E},get cancelFrame(){return _},injectFrame:function(e,t){E=e,_=t},get interpolation(){return k},injectStringInterpolator:S,get now(){return x},injectNow:function(e){x=e},get defaultElement(){return R},injectDefaultElement:P,get animatedApi(){return T},injectAnimatedApi:function(e){T=e},get createAnimatedStyle(){return C},injectCreateAnimatedStyle:A,get manualFrameloop(){return N},injectManualFrameloop:function(e){N=e}}),M=function(e){function t(t,n){var r;return(r=e.call(this)||this).update=void 0,r.payload=t.style?o({},t,{style:C(t.style)}):t,r.update=n,r.attach(),r}return u(t,e),t}(O),I=!1,D=new Set,L=function e(){if(!I)return!1;var t=x(),n=D,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var c;if(r){if(o>=n.length)break;c=n[o++]}else{if((o=n.next()).done)break;c=o.value}for(var i=c,a=!1,u=0;u<i.configs.length;u++){for(var s=i.configs[u],l=void 0,f=void 0,p=0;p<s.animatedValues.length;p++){var d=s.animatedValues[p];if(!d.done){var m=s.fromValues[p],b=s.toValues[p],h=d.lastPosition,g=b instanceof v,y=Array.isArray(s.initialVelocity)?s.initialVelocity[p]:s.initialVelocity;if(g&&(b=b.getValue()),s.immediate)d.setValue(b),d.done=!0;else if("string"!=typeof m&&"string"!=typeof b){if(void 0!==s.duration)h=m+s.easing((t-d.startTime)/s.duration)*(b-m),l=t>=d.startTime+s.duration;else if(s.decay)h=m+y/(1-.998)*(1-Math.exp(-(1-.998)*(t-d.startTime))),(l=Math.abs(d.lastPosition-h)<.1)&&(b=h);else{f=void 0!==d.lastTime?d.lastTime:t,y=void 0!==d.lastVelocity?d.lastVelocity:s.initialVelocity,t>f+64&&(f=t);for(var O=Math.floor(t-f),j=0;j<O;++j){h+=1*(y+=1*((-s.tension*(h-b)+-s.friction*y)/s.mass)/1e3)/1e3}var w=!(!s.clamp||0===s.tension)&&(m<b?h>b:h<b),k=Math.abs(y)<=s.precision,_=0===s.tension||Math.abs(b-h)<=s.precision;l=w||k&&_,d.lastVelocity=y,d.lastTime=t}g&&!s.toValues[p].done&&(l=!1),l?(d.value!==b&&(h=b),d.done=!0):a=!0,d.setValue(h),d.lastPosition=h}else d.setValue(b),d.done=!0}}i.props.onFrame&&(i.values[s.name]=s.interpolation.getValue())}i.props.onFrame&&i.props.onFrame(i.values),a||(D.delete(i),i.stop(!0))}return D.size?N?N():E(e):I=!1,I};function V(e,t,n){if("function"==typeof e)return e;if(Array.isArray(e))return V({range:e,output:t,extrapolate:n});if(k&&"string"==typeof e.output[0])return k(e);var r=e,o=r.output,c=r.range||[0,1],i=r.extrapolateLeft||r.extrapolate||"extend",a=r.extrapolateRight||r.extrapolate||"extend",u=r.easing||function(e){return e};return function(e){var t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,c);return function(e,t,n,r,o,c,i,a,u){var s=u?u(e):e;if(s<t){if("identity"===i)return s;"clamp"===i&&(s=t)}if(s>n){if("identity"===a)return s;"clamp"===a&&(s=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?s=-s:n===1/0?s-=t:s=(s-t)/(n-t);s=c(s),r===-1/0?s=-s:o===1/0?s+=r:s=s*(o-r)+r;return s}(e,c[t],c[t+1],o[t],o[t+1],u,i,a,r.map)}}var B=function(e){function t(n,r,o,c){var i;return(i=e.call(this)||this).calc=void 0,i.payload=n instanceof y&&!(n instanceof t)?n.getPayload():Array.isArray(n)?n:[n],i.calc=V(r,o,c),i}u(t,e);var n=t.prototype;return n.getValue=function(){return this.calc.apply(this,this.payload.map((function(e){return e.getValue()})))},n.updateConfig=function(e,t,n){this.calc=V(e,t,n)},n.interpolate=function(e,n,r){return new t(this,e,n,r)},t}(y);var z=function(e){function t(t){var n;return(n=e.call(this)||this).animatedStyles=new Set,n.value=void 0,n.startPosition=void 0,n.lastPosition=void 0,n.lastVelocity=void 0,n.startTime=void 0,n.lastTime=void 0,n.done=!1,n.setValue=function(e,t){void 0===t&&(t=!0),n.value=e,t&&n.flush()},n.value=t,n.startPosition=t,n.lastPosition=t,n}u(t,e);var n=t.prototype;return n.flush=function(){0===this.animatedStyles.size&&function e(t,n){"update"in t?n.add(t):t.getChildren().forEach((function(t){return e(t,n)}))}(this,this.animatedStyles),this.animatedStyles.forEach((function(e){return e.update()}))},n.clearStyles=function(){this.animatedStyles.clear()},n.getValue=function(){return this.value},n.interpolate=function(e,t,n){return new B(this,e,t,n)},t}(v),q=function(e){function t(t){var n;return(n=e.call(this)||this).payload=t.map((function(e){return new z(e)})),n}u(t,e);var n=t.prototype;return n.setValue=function(e,t){var n=this;void 0===t&&(t=!0),Array.isArray(e)?e.length===this.payload.length&&e.forEach((function(e,r){return n.payload[r].setValue(e,t)})):this.payload.forEach((function(n){return n.setValue(e,t)}))},n.getValue=function(){return this.payload.map((function(e){return e.getValue()}))},n.interpolate=function(e,t){return new B(this,e,t)},t}(y),H=0,W=function(){function e(){var e=this;this.id=void 0,this.idle=!0,this.hasChanged=!1,this.guid=0,this.local=0,this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.listeners=[],this.queue=[],this.localQueue=void 0,this.getValues=function(){return e.interpolations},this.id=H++}var t=e.prototype;return t.update=function(e){if(!e)return this;var t=b(e),n=t.delay,r=void 0===n?0:n,i=t.to,a=c(t,["delay","to"]);if(l.arr(i)||l.fun(i))this.queue.push(o({},a,{delay:r,to:i}));else if(i){var u={};Object.entries(i).forEach((function(e){var t,n=e[0],c=e[1],i=o({to:(t={},t[n]=c,t),delay:m(r,n)},a),s=u[i.delay]&&u[i.delay].to;u[i.delay]=o({},u[i.delay],i,{to:o({},s,i.to)})})),this.queue=Object.values(u)}return this.queue=this.queue.sort((function(e,t){return e.delay-t.delay})),this.diff(a),this},t.start=function(e){var t,n=this;if(this.queue.length){this.idle=!1,this.localQueue&&this.localQueue.forEach((function(e){var t=e.from,r=void 0===t?{}:t,c=e.to,i=void 0===c?{}:c;l.obj(r)&&(n.merged=o({},r,n.merged)),l.obj(i)&&(n.merged=o({},n.merged,i))}));var r=this.local=++this.guid,i=this.localQueue=this.queue;this.queue=[],i.forEach((function(t,o){var a=t.delay,u=c(t,["delay"]),s=function(t){o===i.length-1&&r===n.guid&&t&&(n.idle=!0,n.props.onRest&&n.props.onRest(n.merged)),e&&e()},f=l.arr(u.to)||l.fun(u.to);a?setTimeout((function(){r===n.guid&&(f?n.runAsync(u,s):n.diff(u).start(s))}),a):f?n.runAsync(u,s):n.diff(u).start(s)}))}else l.fun(e)&&this.listeners.push(e),this.props.onStart&&this.props.onStart(),t=this,D.has(t)||D.add(t),I||(I=!0,E(N||L));return this},t.stop=function(e){return this.listeners.forEach((function(t){return t(e)})),this.listeners=[],this},t.pause=function(e){var t;return this.stop(!0),e&&(t=this,D.has(t)&&D.delete(t)),this},t.runAsync=function(e,t){var n=this,r=(e.delay,c(e,["delay"])),i=this.local,a=Promise.resolve(void 0);if(l.arr(r.to))for(var u=function(e){var t=e,c=o({},r,b(r.to[t]));l.arr(c.config)&&(c.config=c.config[t]),a=a.then((function(){if(i===n.guid)return new Promise((function(e){return n.diff(c).start(e)}))}))},s=0;s<r.to.length;s++)u(s);else if(l.fun(r.to)){var f,p=0;a=a.then((function(){return r.to((function(e){var t=o({},r,b(e));if(l.arr(t.config)&&(t.config=t.config[p]),p++,i===n.guid)return f=new Promise((function(e){return n.diff(t).start(e)}))}),(function(e){return void 0===e&&(e=!0),n.stop(e)})).then((function(){return f}))}))}a.then(t)},t.diff=function(e){var t=this;this.props=o({},this.props,e);var n=this.props,r=n.from,c=void 0===r?{}:r,i=n.to,a=void 0===i?{}:i,u=n.config,s=void 0===u?{}:u,f=n.reverse,b=n.attach,h=n.reset,v=n.immediate;if(f){var y=[a,c];c=y[0],a=y[1]}this.merged=o({},c,this.merged,a),this.hasChanged=!1;var O=b&&b(this);if(this.animations=Object.entries(this.merged).reduce((function(e,n){var r=n[0],i=n[1],a=e[r]||{},u=l.num(i),f=l.str(i)&&!i.startsWith("#")&&!/\d/.test(i)&&!g[i],b=l.arr(i),y=!u&&!b&&!f,j=l.und(c[r])?i:c[r],w=u||b||f?i:1,E=m(s,r);O&&(w=O.animations[r].parent);var _,S=a.parent,R=a.interpolation,P=d(O?w.getPayload():w),C=i;y&&(C=k({range:[0,1],output:[i,i]})(1));var N,T=R&&R.getValue(),A=!l.und(S)&&a.animatedValues.some((function(e){return!e.done})),F=!l.equ(C,T),M=!l.equ(C,a.previous),I=!l.equ(E,a.config);if(h||M&&F||I){var D;if(u||f)S=R=a.parent||new z(j);else if(b)S=R=a.parent||new q(j);else if(y){var L=a.interpolation&&a.interpolation.calc(a.parent.value);L=void 0===L||h?j:L,a.parent?(S=a.parent).setValue(0,!1):S=new z(0);var V={output:[L,i]};a.interpolation?(R=a.interpolation,a.interpolation.updateConfig(V)):R=S.interpolate(V)}return P=d(O?w.getPayload():w),_=d(S.getPayload()),h&&!y&&S.setValue(j,!1),t.hasChanged=!0,_.forEach((function(e){e.startPosition=e.value,e.lastPosition=e.value,e.lastVelocity=A?e.lastVelocity:void 0,e.lastTime=A?e.lastTime:void 0,e.startTime=x(),e.done=!1,e.animatedStyles.clear()})),m(v,r)&&S.setValue(y?w:i,!1),o({},e,((D={})[r]=o({},a,{name:r,parent:S,interpolation:R,animatedValues:_,toValues:P,previous:C,config:E,fromValues:d(S.getValue()),immediate:m(v,r),initialVelocity:p(E.velocity,0),clamp:p(E.clamp,!1),precision:p(E.precision,.01),tension:p(E.tension,170),friction:p(E.friction,26),mass:p(E.mass,1),duration:E.duration,easing:p(E.easing,(function(e){return e})),decay:E.decay}),D))}return F?e:(y&&(S.setValue(1,!1),R.updateConfig({output:[C,C]})),S.done=!0,t.hasChanged=!0,o({},e,((N={})[r]=o({},e[r],{previous:C}),N)))}),this.animations),this.hasChanged)for(var j in this.configs=Object.values(this.animations),this.values={},this.interpolations={},this.animations)this.interpolations[j]=this.animations[j].interpolation,this.values[j]=this.animations[j].interpolation.getValue();return this},t.destroy=function(){this.stop(),this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.local=0},e}(),U=function(e,t){var n=i.useRef(!1),r=i.useRef(),o=l.fun(t),c=i.useMemo((function(){var n;return r.current&&(r.current.map((function(e){return e.destroy()})),r.current=void 0),[new Array(e).fill().map((function(e,r){var c=new W,i=o?m(t,r,c):t[r];return 0===r&&(n=i.ref),c.update(i),n||c.start(),c})),n]}),[e]),a=c[0],u=c[1];r.current=a;i.useImperativeHandle(u,(function(){return{start:function(){return Promise.all(r.current.map((function(e){return new Promise((function(t){return e.start(t)}))})))},stop:function(e){return r.current.forEach((function(t){return t.stop(e)}))},get controllers(){return r.current}}}));var s=i.useMemo((function(){return function(e){return r.current.map((function(t,n){t.update(o?m(e,n,t):e[n]),u||t.start()}))}}),[e]);i.useEffect((function(){n.current?o||s(t):u||r.current.forEach((function(e){return e.start()}))})),i.useEffect((function(){return n.current=!0,function(){return r.current.forEach((function(e){return e.destroy()}))}}),[]);var f=r.current.map((function(e){return e.getValues()}));return o?[f,s,function(e){return r.current.forEach((function(t){return t.pause(e)}))}]:f},K=0,Q=function(e,t){return("function"==typeof t?e.map(t):d(t)).map(String)},Y=function(e){var t=e.items,n=e.keys,r=void 0===n?function(e){return e}:n,i=c(e,["items","keys"]);return t=d(void 0!==t?t:null),o({items:t,keys:Q(t,r)},i)};function G(e,t){var n=function(){if(o){if(c>=r.length)return"break";i=r[c++]}else{if((c=r.next()).done)return"break";i=c.value}var n=i.key,a=function(e){return e.key!==n};(l.und(t)||t===n)&&(e.current.instances.delete(n),e.current.transitions=e.current.transitions.filter(a),e.current.deleted=e.current.deleted.filter(a))},r=e.current.deleted,o=Array.isArray(r),c=0;for(r=o?r:r[Symbol.iterator]();;){var i;if("break"===n())break}e.current.forceUpdate()}var $=function(e){function t(t){var n;return void 0===t&&(t={}),n=e.call(this)||this,!t.transform||t.transform instanceof v||(t=h.transform(t)),n.payload=t,n}return u(t,e),t}(O),J={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Z="[-+]?\\d*\\.?\\d+";function X(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var ee=new RegExp("rgb"+X(Z,Z,Z)),te=new RegExp("rgba"+X(Z,Z,Z,Z)),ne=new RegExp("hsl"+X(Z,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),re=new RegExp("hsla"+X(Z,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",Z)),oe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ce=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ie=/^#([0-9a-fA-F]{6})$/,ae=/^#([0-9a-fA-F]{8})$/;function ue(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function se(e,t,n){var r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,c=ue(o,r,e+1/3),i=ue(o,r,e),a=ue(o,r,e-1/3);return Math.round(255*c)<<24|Math.round(255*i)<<16|Math.round(255*a)<<8}function le(e){var t=parseInt(e,10);return t<0?0:t>255?255:t}function fe(e){return(parseFloat(e)%360+360)%360/360}function pe(e){var t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function de(e){var t=parseFloat(e);return t<0?0:t>100?1:t/100}function me(e){var t,n,r="number"==typeof(t=e)?t>>>0===t&&t>=0&&t<=4294967295?t:null:(n=ie.exec(t))?parseInt(n[1]+"ff",16)>>>0:J.hasOwnProperty(t)?J[t]:(n=ee.exec(t))?(le(n[1])<<24|le(n[2])<<16|le(n[3])<<8|255)>>>0:(n=te.exec(t))?(le(n[1])<<24|le(n[2])<<16|le(n[3])<<8|pe(n[4]))>>>0:(n=oe.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0:(n=ae.exec(t))?parseInt(n[1],16)>>>0:(n=ce.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0:(n=ne.exec(t))?(255|se(fe(n[1]),de(n[2]),de(n[3])))>>>0:(n=re.exec(t))?(se(fe(n[1]),de(n[2]),de(n[3]))|pe(n[4]))>>>0:null;return null===r?e:"rgba("+((4278190080&(r=r||0))>>>24)+", "+((16711680&r)>>>16)+", "+((65280&r)>>>8)+", "+(255&r)/255+")"}var be=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,he=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ge=new RegExp("("+Object.keys(J).join("|")+")","g"),ve={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","Ms","Moz","O"];function Oe(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}ve=Object.keys(ve).reduce((function(e,t){return ye.forEach((function(n){return e[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(n,t)]=e[t]})),e}),ve);var je={};A((function(e){return new $(e)})),P("div"),S((function(e){var t=e.output.map((function(e){return e.replace(he,me)})).map((function(e){return e.replace(ge,me)})),n=t[0].match(be).map((function(){return[]}));t.forEach((function(e){e.match(be).forEach((function(e,t){return n[t].push(+e)}))}));var r=t[0].match(be).map((function(t,r){return V(o({},e,{output:n[r]}))}));return function(e){var n=0;return t[0].replace(be,(function(){return r[n++](e)})).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(function(e,t,n,r,o){return"rgba("+Math.round(t)+", "+Math.round(n)+", "+Math.round(r)+", "+o+")"}))}})),w(J),j((function(e,t){if(!e.nodeType||void 0===e.setAttribute)return!1;var n=t.style,r=t.children,o=t.scrollTop,i=t.scrollLeft,a=c(t,["style","children","scrollTop","scrollLeft"]),u="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName;for(var s in void 0!==o&&(e.scrollTop=o),void 0!==i&&(e.scrollLeft=i),void 0!==r&&(e.textContent=r),n)if(n.hasOwnProperty(s)){var l=0===s.indexOf("--"),f=Oe(s,n[s],l);"float"===s&&(s="cssFloat"),l?e.style.setProperty(s,f):e.style[s]=f}for(var p in a){var d=u?p:je[p]||(je[p]=p.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})));void 0!==e.getAttribute(d)&&e.setAttribute(d,a[p])}}),(function(e){return e}));var we,ke,Ee=(we=function(e){return i.forwardRef((function(t,n){var r=f(),u=i.useRef(!0),s=i.useRef(null),p=i.useRef(null),d=i.useCallback((function(e){var t=s.current;s.current=new M(e,(function(){var e=!1;p.current&&(e=h.fn(p.current,s.current.getAnimatedValue())),p.current&&!1!==e||r()})),t&&t.detach()}),[]);i.useEffect((function(){return function(){u.current=!1,s.current&&s.current.detach()}}),[]),i.useImperativeHandle(n,(function(){return T(p,u,r)})),d(t);var m,b=s.current.getValue(),g=(b.scrollTop,b.scrollLeft,c(b,["scrollTop","scrollLeft"])),v=(m=e,!l.fun(m)||m.prototype instanceof a.Component?function(e){return p.current=function(e,t){return t&&(l.fun(t)?t(e):l.obj(t)&&(t.current=e)),e}(e,n)}:void 0);return a.createElement(e,o({},g,{ref:v}))}))},void 0===(ke=!1)&&(ke=!0),function(e){return(l.arr(e)?e:Object.keys(e)).reduce((function(e,t){var n=ke?t[0].toLowerCase()+t.substring(1):t;return e[n]=we(n),e}),we)}),_e=Ee(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]);t.apply=Ee,t.config={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},t.update=L,t.animated=_e,t.a=_e,t.interpolate=function(e,t,n){return e&&new B(e,t,n)},t.Globals=F,t.useSpring=function(e){var t=l.fun(e),n=U(1,t?e:[e]),r=n[0],o=n[1],c=n[2];return t?[r[0],o,c]:r},t.useTrail=function(e,t){var n=i.useRef(!1),r=l.fun(t),c=m(t),a=i.useRef(),u=U(e,(function(e,t){return 0===e&&(a.current=[]),a.current.push(t),o({},c,{config:m(c.config,e),attach:e>0&&function(){return a.current[e-1]}})})),s=u[0],f=u[1],p=u[2],d=i.useMemo((function(){return function(e){return f((function(t,n){e.reverse;var r=e.reverse?t+1:t-1,i=a.current[r];return o({},e,{config:m(e.config||c.config,t),attach:i&&function(){return i}})}))}}),[e,c.reverse]);return i.useEffect((function(){n.current&&!r&&d(t)})),i.useEffect((function(){n.current=!0}),[]),r?[s,d,p]:s},t.useTransition=function(e,t,n){var r=o({items:e,keys:t||function(e){return e}},n),a=Y(r),u=a.lazy,s=void 0!==u&&u,l=(a.unique,a.reset),p=void 0!==l&&l,d=(a.enter,a.leave,a.update,a.onDestroyed),b=(a.keys,a.items,a.onFrame),h=a.onRest,g=a.onStart,v=a.ref,y=c(a,["lazy","unique","reset","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","ref"]),O=f(),j=i.useRef(!1),w=i.useRef({mounted:!1,first:!0,deleted:[],current:{},transitions:[],prevProps:{},paused:!!r.ref,instances:!j.current&&new Map,forceUpdate:O});return i.useImperativeHandle(r.ref,(function(){return{start:function(){return Promise.all(Array.from(w.current.instances).map((function(e){var t=e[1];return new Promise((function(e){return t.start(e)}))})))},stop:function(e){return Array.from(w.current.instances).forEach((function(t){return t[1].stop(e)}))},get controllers(){return Array.from(w.current.instances).map((function(e){return e[1]}))}}})),w.current=function(e,t){var n=e.first,r=e.prevProps,i=c(e,["first","prevProps"]),a=Y(t),u=a.items,s=a.keys,l=a.initial,f=a.from,p=a.enter,d=a.leave,b=a.update,h=a.trail,g=void 0===h?0:h,v=a.unique,y=a.config,O=a.order,j=void 0===O?["enter","leave","update"]:O,w=Y(r),k=w.keys,E=w.items,_=o({},i.current),S=[].concat(i.deleted),R=Object.keys(_),x=new Set(R),P=new Set(s),C=s.filter((function(e){return!x.has(e)})),N=i.transitions.filter((function(e){return!e.destroyed&&!P.has(e.originalKey)})).map((function(e){return e.originalKey})),T=s.filter((function(e){return x.has(e)})),A=-g;for(;j.length;){switch(j.shift()){case"enter":C.forEach((function(e,t){v&&S.find((function(t){return t.originalKey===e}))&&(S=S.filter((function(t){return t.originalKey!==e})));var r=s.indexOf(e),o=u[r],c=n&&void 0!==l?"initial":"enter";_[e]={slot:c,originalKey:e,key:v?String(e):K++,item:o,trail:A+=g,config:m(y,o,c),from:m(n&&void 0!==l?l||{}:f,o),to:m(p,o)}}));break;case"leave":N.forEach((function(e){var t=k.indexOf(e),n=E[t];S.unshift(o({},_[e],{slot:"leave",destroyed:!0,left:k[Math.max(0,t-1)],right:k[Math.min(k.length,t+1)],trail:A+=g,config:m(y,n,"leave"),to:m(d,n)})),delete _[e]}));break;case"update":T.forEach((function(e){var t=s.indexOf(e),n=u[t];_[e]=o({},_[e],{item:n,slot:"update",trail:A+=g,config:m(y,n,"update"),to:m(b,n)})}))}}var F=s.map((function(e){return _[e]}));return S.forEach((function(e){var t,n=e.left,r=(e.right,c(e,["left","right"]));-1!==(t=F.findIndex((function(e){return e.originalKey===n})))&&(t+=1),t=Math.max(0,t),F=[].concat(F.slice(0,t),[r],F.slice(t))})),o({},i,{changed:C.length||N.length||T.length,first:n&&0===C.length,transitions:F,current:_,deleted:S,prevProps:t})}(w.current,r),w.current.changed&&w.current.transitions.forEach((function(e){var t=e.slot,n=e.from,r=e.to,c=e.config,i=e.trail,a=e.key,u=e.item;w.current.instances.has(a)||w.current.instances.set(a,new W);var l=w.current.instances.get(a),f=o({},y,{to:r,from:n,config:c,ref:v,onRest:function(n){w.current.mounted&&(e.destroyed&&(v||s||G(w,a),d&&d(u)),!Array.from(w.current.instances).some((function(e){return!e[1].idle}))&&(v||s)&&w.current.deleted.length>0&&G(w),h&&h(u,t,n))},onStart:g&&function(){return g(u,t)},onFrame:b&&function(e){return b(u,t,e)},delay:i,reset:p&&"enter"===t});l.update(f),w.current.paused||l.start()})),i.useEffect((function(){return w.current.mounted=j.current=!0,function(){w.current.mounted=j.current=!1,Array.from(w.current.instances).map((function(e){return e[1].destroy()})),w.current.instances.clear()}}),[]),w.current.transitions.map((function(e){var t=e.item,n=e.slot,r=e.key;return{item:t,key:r,state:n,props:w.current.instances.get(r).getValues()}}))},t.useChain=function(e,t,n){void 0===n&&(n=1e3);var r=i.useRef();i.useEffect((function(){l.equ(e,r.current)?e.forEach((function(e){var t=e.current;return t&&t.start()})):t?e.forEach((function(e,r){var c=e.current;if(c){var i=c.controllers;if(i.length){var a=n*t[r];i.forEach((function(e){e.queue=e.queue.map((function(e){return o({},e,{delay:e.delay+a})})),e.start()}))}}})):e.reduce((function(e,t,n){var r=t.current;return e.then((function(){return r.start()}))}),Promise.resolve()),r.current=e}))},t.useSprings=U},function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(15),i=n.n(c),a=n(50),u=function(e){var t=e.className,n=e.size,r=void 0===n?20:n,c=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},c),React.createElement("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))},s=React.createElement(u,null),l=n(121),f=n(0);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=s;break;case"no-alt":t=l.a}return t?Object(f.cloneElement)(t,{size:e.size||20,className:e.className}):null}},function(e,t){!function(){e.exports=this.wc.wcSharedContext}()},,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},,,function(e,t,n){"use strict";var r=n(20),o=n(9),c=n(27),i=n(0),a=n(65),u=n(50);t.a=function(e){var t=e.icon,n=void 0===t?null:t,s=e.size,l=Object(c.a)(e,["icon","size"]),f=s||20;if("string"==typeof n)return Object(i.createElement)(a.a,Object(o.a)({icon:n,size:f},l));if(n&&a.a===n.type)return Object(i.cloneElement)(n,Object(r.a)({size:f},l));var p=s||24;if("function"==typeof n)return n.prototype instanceof i.Component?Object(i.createElement)(n,Object(r.a)({size:p},l)):n(Object(r.a)({size:p},l));if(n&&("svg"===n.type||n.type===u.a)){var d=Object(r.a)({width:p,height:p},n.props,l);return Object(i.createElement)(u.a,d)}return Object(i.isValidElement)(n)?Object(i.cloneElement)(n,Object(r.a)({size:p},l)):n}},function(e,t,n){"use strict";var r=n(20),o=n(27),c=n(5),i=n.n(c),a=n(0);t.a=Object(a.forwardRef)((function(e,t){var n=e.href,c=e.target,u=e.isPrimary,s=e.isLarge,l=e.isSmall,f=e.isTertiary,p=e.isToggled,d=e.isBusy,m=e.isDefault,b=e.isLink,h=e.isDestructive,g=e.className,v=e.disabled,y=Object(o.a)(e,["href","target","isPrimary","isLarge","isSmall","isTertiary","isToggled","isBusy","isDefault","isLink","isDestructive","className","disabled"]),O=i()("components-button",g,{"is-button":m||u||s||l,"is-default":m||!u&&(s||l),"is-primary":u,"is-large":s,"is-small":l,"is-tertiary":f,"is-toggled":p,"is-busy":d,"is-link":b,"is-destructive":h}),j=void 0===n||v?"button":"a",w="a"===j?{href:n,target:c}:{type:"button",disabled:v};return Object(a.createElement)(j,Object(r.a)({},w,y,{className:O,ref:t}))}))},,function(e,t){!function(){e.exports=this.wp.autop}()},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(6),o=n.n(r),c=n(113),i=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s=function(){var e=Object(c.b)(),t=e.notices,n=e.createNotice,r=e.removeNotice,o=e.createSnackbarNotice,a=e.setIsSuppressed,s=Object(i.useRef)(t);Object(i.useEffect)((function(){s.current=t}),[t]);var l=Object(i.useMemo)((function(){return{hasNoticesOfType:function(e){return s.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;s.current.map((function(t){return null!==e&&t.status!==e||r(t.id),!0}))},removeNotice:r}}),[r]),f=Object(i.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",e,u({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",e,u({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",e,u({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",e,u({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",e,u({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(e,t)}}}),[n,o]);return u(u(u({notices:t},l),f),{},{setIsSuppressed:a})}},,function(e,t){!function(){e.exports=this.wp.deprecated}()},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(10),o=n.n(r),c=n(0),i=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return function(e){return t((function(){throw e}))}}},,,,,,function(e,t){!function(){e.exports=this.wp.wordcount}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return d}));var r=n(10),o=n.n(r),c=n(14),i=n(13),a=n(0),u=n(56),s=n(7),l=n(37),f=function(e){var t=Object(u.a)();e=e||t;var n=Object(i.useSelect)((function(t){return t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),r=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[n,Object(a.useCallback)((function(t){r(e,t)}),[e])]},p=function(e,t,n){var r=Object(u.a)();n=n||r;var o=Object(i.useSelect)((function(r){return r(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)}),[n,e]),s=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(a.useCallback)((function(t){s(n,e,t)}),[n,e])]},d=function(e,t){var n=Object(u.a)(),r=f(t=t||n),c=o()(r,2),i=c[0],p=c[1],d=Object(l.a)(e),m=Object(a.useRef)(!1);return Object(a.useEffect)((function(){p(Object(s.assign)({},i,d)),m.current=!0}),[d]),m.current?[i,p]:[e,p]}},function(e,t,n){"use strict";var r=n(9),o=n(0),c=n(7);var i=function(e,t){return function(n){var r=e(n),o=n.displayName,i=void 0===o?n.name||"Component":o;return r.displayName="".concat(Object(c.upperFirst)(Object(c.camelCase)(t)),"(").concat(i,")"),r}},a=new WeakMap;function u(e){return Object(o.useMemo)((function(){return function(e){var t=a.get(e)||0;return a.set(e,t+1),t}(e)}),[e])}t.a=i((function(e){return function(t){var n=u(e);return Object(o.createElement)(e,Object(r.a)({},t,{instanceId:n}))}}),"withInstanceId")},,function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(30),i=n.n(c),a=n(31),u=n.n(a),s=n(18),l=n.n(s),f=n(32),p=n.n(f),d=n(33),m=n.n(d),b=n(19),h=n.n(b),g=n(6),v=n.n(g),y=n(3);n(123);function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h()(e);if(t){var o=h()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}t.a=function(e){var t=function(t){p()(r,t);var n=O(r);function r(){var e;return i()(this,r),e=n.call(this),v()(l()(e),"scrollToTopIfNeeded",(function(){var t=e.scrollPointRef.current.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollPointRef.current.scrollIntoView()})),v()(l()(e),"moveFocusToTop",(function(t){var n=e.scrollPointRef.current.parentElement.querySelectorAll(t);n.length&&n[0].focus()})),v()(l()(e),"scrollToTop",(function(t){window&&Number.isFinite(window.innerHeight)&&(e.scrollToTopIfNeeded(),t&&t.focusableSelector&&e.moveFocusToTop(t.focusableSelector))})),e.scrollPointRef=Object(y.createRef)(),e}return u()(r,[{key:"render",value:function(){return React.createElement(y.Fragment,null,React.createElement("div",{className:"with-scroll-to-top__scroll-point",ref:this.scrollPointRef,"aria-hidden":!0}),React.createElement(e,o()({},this.props,{scrollToTop:this.scrollToTop})))}}]),r}(y.Component);return t.displayName="withScrollToTop",t}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r=n(11),o=n.n(r),c=n(6),i=n.n(c),a=n(0),u=n(44);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f=function(e){var t=e.Block,n=e.selector,r=e.getProps,c=void 0===r?function(){}:r,i=e.getErrorBoundaryProps,s=void 0===i?function(){}:i,f=document.querySelectorAll(n);if(f.length){var p=a.Suspense||function(e){var t=e.children;return React.createElement(React.Fragment,null,t)};Array.prototype.forEach.call(f,(function(e,n){var r=c(e,n),i=s(e,n),f=l(l({},e.dataset),r.attributes);e.classList.remove("is-loading"),Object(a.render)(React.createElement(u.a,i,React.createElement(p,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},r,{attributes:f})))),e)}))}}},function(e,t){},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(14),o=n(13),c=n(0),i=n(85),a=n(37),u=function(e){var t=e.namespace,n=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,f=void 0===l?{}:l,p=e.shouldSelect,d=void 0===p||p;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");var m=Object(c.useRef)({results:[],isLoading:!0}),b=Object(a.a)(f),h=Object(a.a)(s),g=Object(i.a)(),v=Object(o.useSelect)((function(e){if(!d)return null;var o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,b,h],i=o.getCollectionError.apply(o,c);return i&&g(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,n,h,b,d]);return null!==v&&(m.current=v),m.current}},,,,function(e,t,n){"use strict";n.d(t,"b",(function(){return M})),n.d(t,"a",(function(){return I}));var r=n(6),o=n.n(r),c=n(10),i=n.n(c),a=(n(4),n(0)),u=n(13),s=n(11),l=n.n(s),f=n(5),p=n.n(f),d=n(166),m=(n(104),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),b=function(e){var t=e.className,n=e.notices,r=M().removeNotice,o=p()(t,"wc-block-components-notices"),c=n.filter((function(e){return"snackbar"!==e.type}));return c.length?React.createElement("div",{className:o},c.map((function(e){return React.createElement(d.a,l()({key:"store-notice-"+e.id},e,{className:p()("wc-block-components-notices__notice","woocommerce-message",m(e)),onRemove:function(){e.isDismissible&&r(e.id)}}),e.content)}))):null},h=n(9),g=n(22),v=n.n(g);function y(e,t,n,r,o,c,i){try{var a=e[c](i),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function i(e){y(c,r,o,i,a,"next",e)}function a(e){y(c,r,o,i,a,"throw",e)}i(void 0)}))}}var j=n(25),w=n(7),k=n(64),E=n(26),_=n(1),S=n(74);var R=Object(a.forwardRef)((function(e,t){var n=e.className,r=e.children,o=e.actions,c=void 0===o?[]:o,i=e.onRemove,u=void 0===i?w.noop:i;Object(a.useEffect)((function(){var e=setTimeout((function(){u()}),1e4);return function(){return clearTimeout(e)}}),[]);var s=p()(n,"components-snackbar");return c&&c.length>1&&(console.warn("Snackbar can only have 1 action, use Notice if your message require many messages"),c=[c[0]]),Object(a.createElement)("div",{ref:t,className:s,onClick:u,tabIndex:"0",role:"button",onKeyPress:u,label:Object(_.__)("Dismiss this notice")},Object(a.createElement)("div",{className:"components-snackbar__content"},r,c.map((function(e,t){var n=e.label,r=e.onClick,o=e.url;return Object(a.createElement)(S.a,{key:t,href:o,isTertiary:!0,onClick:function(e){e.stopPropagation(),r&&r(e)},className:"components-snackbar__action"},n)}))))}));var x=function(e){var t=e.notices,n=e.className,r=e.children,o=e.onRemove,c=void 0===o?w.noop:o,i=Object(E.useReducedMotion)(),u=Object(a.useState)((function(){return new WeakMap})),s=Object(j.a)(u,1)[0],l=Object(k.useTransition)(t,(function(e){return e.id}),{from:{opacity:0,height:0},enter:function(e){return function(){var t=O(v.a.mark((function t(n){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n({opacity:1,height:s.get(e).offsetHeight});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},leave:function(){return function(){var e=O(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({opacity:0});case 2:return e.next=4,t({height:0});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},immediate:i});n=p()("components-snackbar-list",n);var f=function(e){return function(){return c(e.id)}};return Object(a.createElement)("div",{className:n},r,l.map((function(e){var t=e.item,n=e.key,r=e.props;return Object(a.createElement)(k.animated.div,{key:n,style:r},Object(a.createElement)("div",{className:"components-snackbar-list__notice-container",ref:function(e){return e&&s.set(t,e)}},Object(a.createElement)(R,Object(h.a)({},Object(w.omit)(t,["content"]),{onRemove:f(t)}),t.content)))})))},P=n(79),C=n(132),N=function(){var e=Object(C.a)().isEditor,t=Object(P.a)(),n=t.notices,r=t.removeNotice,o=n.filter((function(e){return"snackbar"===e.type}));return e?null:React.createElement(x,{notices:o,className:"wc-block-components-notices__snackbar",onRemove:r})};function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=Object(a.createContext)({notices:[],createNotice:function(e,t,n){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),M=function(){return Object(a.useContext)(F)},I=function(e){var t=e.children,n=e.className,r=void 0===n?"":n,o=e.createNoticeContainer,c=void 0===o||o,s=e.context,l=void 0===s?"wc/core":s,f=Object(u.useDispatch)("core/notices"),p=f.createNotice,d=f.removeNotice,m=Object(a.useState)(!1),h=i()(m,2),g=h[0],v=h[1],y=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};p(e,t,A(A({},n),{},{context:n.context||l}))}),[p,l]),O=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;d(e,t)}),[d,l]),j=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y("default",e,A(A({},t),{},{type:"snackbar"}))}),[y]),w={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(l)}}),[l]).notices,createNotice:y,createSnackbarNotice:j,removeNotice:O,context:l,setIsSuppressed:v},k=g?null:React.createElement(b,{className:r,notices:w.notices}),E=g?null:React.createElement(N,null);return React.createElement(F.Provider,{value:w},c&&k,t,E)}},,,,,,,,function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(15),i=n.n(c),a=n(50),u=function(e){var t=e.className,n=e.size,r=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),React.createElement("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},s=React.createElement(u,null);t.a=s},function(e,t,n){"use strict";var r=n(6),o=n.n(r),c=n(15),i=n.n(c),a=n(3);n(4);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.a=function(e){var t=e.srcElement,n=e.size,r=void 0===n?24:n,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({width:r,height:r},c))}},function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(2),c=n(14),i=n(13);t.a=function(e){return function(t){var n;return n=Object(r.useRef)(Object(o.getSetting)("restApiRoutes")),Object(i.useSelect)((function(e,t){if(n.current){var r=e(c.SCHEMA_STORE_KEY),o=r.isResolving,i=r.hasFinishedResolution,a=t.dispatch(c.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(n.current).forEach((function(e){var t=n.current[e];o("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},,,,,,function(e,t,n){"use strict";n(4);var r=n(5),o=n.n(r),c=n(29),i=n(94);n(146);t.a=Object(i.a)((function(e){var t=e.className,n=e.instanceId,r=e.defaultValue,i=e.label,a=e.onChange,u=e.options,s=e.screenReaderLabel,l=e.readOnly,f=e.value,p="wc-block-components-sort-select__select-".concat(n);return React.createElement("div",{className:o()("wc-block-sort-select","wc-block-components-sort-select",t)},React.createElement(c.a,{label:i,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),React.createElement("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:r,onChange:a,readOnly:l,value:f},u.map((function(e){return React.createElement("option",{key:e.key,value:e.key},e.label)}))))}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=(n(13),Object(r.createContext)({isEditor:!1,currentPostId:0,previewData:{}})),c=function(){return Object(r.useContext)(o)}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(35),o=n(0),c=n(8);n.p=c.B,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)((function(){return Promise.all([n.e(20),n.e(6)]).then(n.bind(null,289))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)((function(){return n.e(5).then(n.bind(null,299))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)((function(){return n.e(13).then(n.bind(null,298))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return n.e(7).then(n.bind(null,290))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)((function(){return n.e(3).then(n.bind(null,291))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return n.e(11).then(n.bind(null,292))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return n.e(8).then(n.bind(null,275))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return n.e(9).then(n.bind(null,293))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return n.e(4).then(n.bind(null,294))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return n.e(12).then(n.bind(null,295))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return n.e(10).then(n.bind(null,296))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)((function(){return n.e(2).then(n.bind(null,297))}))});var i=function(e){return Object(r.getRegisteredBlockComponents)(e)}},,,,,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(7),c=n(5),i=n.n(c),a=n(1),u=n(74),s=n(9),l=n(27);function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e}var m=n(62),b=n(12);function h(e,t){return!t||"object"!==Object(m.a)(t)&&"function"!=typeof t?Object(b.a)(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}var O=n(25),j=n(46),w=n(47),k=n(81),E=n.n(k),_=n(26),S=n(20),R=function(){return"rtl"===document.documentElement.dir};function x(e,t,n,r){var o=t.width;"left"===n&&R()?n="right":"right"===n&&R()&&(n="left");var c,i=Math.round(e.left+e.width/2),a={popoverLeft:i,contentWidth:(i-o/2>0?o/2:i)+(i+o/2>window.innerWidth?window.innerWidth-i:o/2)},u="middle"===r?e.left:i,s={popoverLeft:u,contentWidth:u-o>0?o:u},l="middle"===r?e.right:i,f={popoverLeft:l,contentWidth:l+o>window.innerWidth?window.innerWidth-l:o},p=null;if("center"===n&&a.contentWidth===o)c="center";else if("left"===n&&s.contentWidth===o)c="left";else if("right"===n&&f.contentWidth===o)c="right";else{var d="left"===(c=s.contentWidth>f.contentWidth?"left":"right")?s.contentWidth:f.contentWidth;p=d!==o?d:null}return{xAxis:c,popoverLeft:"center"===c?a.popoverLeft:"left"===c?s.popoverLeft:f.popoverLeft,contentWidth:p}}function P(e,t,n){var r,o=t.height,c=e.top+e.height/2,i={popoverTop:c,contentHeight:(c-o/2>0?o/2:c)+(c+o/2>window.innerHeight?window.innerHeight-c:o/2)},a={popoverTop:e.top,contentHeight:e.top-10-o>0?o:e.top-10},u={popoverTop:e.bottom,contentHeight:e.bottom+10+o>window.innerHeight?window.innerHeight-10-e.bottom:o},s=null;if("middle"===n&&i.contentHeight===o)r="middle";else if("top"===n&&a.contentHeight===o)r="top";else if("bottom"===n&&u.contentHeight===o)r="bottom";else{var l="top"===(r=a.contentHeight>u.contentHeight?"top":"bottom")?a.contentHeight:u.contentHeight;s=l!==o?l:null}return{yAxis:r,popoverTop:"middle"===r?i.popoverTop:"top"===r?a.popoverTop:u.popoverTop,contentHeight:s}}var C=n(34),N=Object(r.createContext)({focusHistory:[]}),T=N.Provider,A=N.Consumer;T.displayName="FocusReturnProvider",A.displayName="FocusReturnConsumer";r.Component;var F=Object(_.createHigherOrderComponent)((function e(t){if((c=t)instanceof r.Component||"function"==typeof c){var n=t;return e({})(n)}var c,i=t.onFocusReturn,a=void 0===i?o.stubTrue:i;return function(e){var t=function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).ownFocusedElements=new Set,e.activeElementOnMount=document.activeElement,e.setIsFocusedFalse=function(){return e.isFocused=!1},e.setIsFocusedTrue=function(t){e.ownFocusedElements.add(t.target),e.isFocused=!0},e}return y(n,t),d(n,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,n=this.ownFocusedElements;if(t&&!1!==a())for(var r,c=[].concat(Object(C.a)(o.without.apply(void 0,[this.props.focus.focusHistory].concat(Object(C.a)(n)))),[e]);r=c.pop();)if(document.body.contains(r))return void r.focus()}},{key:"render",value:function(){return Object(r.createElement)("div",{onFocus:this.setIsFocusedTrue,onBlur:this.setIsFocusedFalse},Object(r.createElement)(e,this.props.childProps))}}]),n}(r.Component);return function(e){return Object(r.createElement)(A,null,(function(n){return Object(r.createElement)(t,{childProps:e,focus:n})}))}}}),"withFocusReturn"),M=Object(_.createHigherOrderComponent)((function(e){return function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).focusContainRef=Object(r.createRef)(),e.handleTabBehaviour=e.handleTabBehaviour.bind(Object(b.a)(e)),e}return y(n,t),d(n,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===w.TAB){var t=j.focus.tabbable.find(this.focusContainRef.current);if(t.length){var n=t[0],r=t[t.length-1];e.shiftKey&&e.target===n?(e.preventDefault(),r.focus()):(e.shiftKey||e.target!==r)&&t.includes(e.target)||(e.preventDefault(),n.focus())}}}},{key:"render",value:function(){return Object(r.createElement)("div",{onKeyDown:this.handleTabBehaviour,ref:this.focusContainRef,tabIndex:"-1"},Object(r.createElement)(e,this.props))}}]),n}(r.Component)}),"withConstrainedTabbing"),I=["button","submit"];var D=Object(_.createHigherOrderComponent)((function(e){return function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).bindNode=e.bindNode.bind(Object(b.a)(e)),e.cancelBlurCheck=e.cancelBlurCheck.bind(Object(b.a)(e)),e.queueBlurCheck=e.queueBlurCheck.bind(Object(b.a)(e)),e.normalizeButtonFocus=e.normalizeButtonFocus.bind(Object(b.a)(e)),e}return y(n,t),d(n,[{key:"componentWillUnmount",value:function(){this.cancelBlurCheck()}},{key:"bindNode",value:function(e){e?this.node=e:(delete this.node,this.cancelBlurCheck())}},{key:"queueBlurCheck",value:function(e){var t=this;e.persist(),this.preventBlurCheck||(this.blurCheckTimeout=setTimeout((function(){document.hasFocus()?"function"==typeof t.node.handleFocusOutside&&t.node.handleFocusOutside(e):e.preventDefault()}),0))}},{key:"cancelBlurCheck",value:function(){clearTimeout(this.blurCheckTimeout)}},{key:"normalizeButtonFocus",value:function(e){var t=e.type,n=e.target;Object(o.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return Object(o.includes)(I,e.type)}return!1}(n)&&(this.preventBlurCheck=!0)}},{key:"render",value:function(){return Object(r.createElement)("div",{onFocus:this.cancelBlurCheck,onMouseDown:this.normalizeButtonFocus,onMouseUp:this.normalizeButtonFocus,onTouchStart:this.normalizeButtonFocus,onTouchEnd:this.normalizeButtonFocus,onBlur:this.queueBlurCheck},Object(r.createElement)(e,Object(s.a)({ref:this.bindNode},this.props)))}}]),n}(r.Component)}),"withFocusOutside")(function(e){function t(){return f(this,t),h(this,g(t).apply(this,arguments))}return y(t,e),d(t,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),t}(r.Component));var L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.htmlDocument,n=void 0===t?document:t,o=e.className,c=void 0===o?"lockscroll":o,i=0,a=0;function u(e){var t=n.scrollingElement||n.body;e&&(a=t.scrollTop);var r=e?"add":"remove";t.classList[r](c),n.documentElement.classList[r](c),e||(t.scrollTop=a)}function s(){0===i&&u(!0),++i}function l(){1===i&&u(!1),--i}return function(e){function t(){return f(this,t),h(this,g(t).apply(this,arguments))}return y(t,e),d(t,[{key:"componentDidMount",value:function(){s()}},{key:"componentWillUnmount",value:function(){l()}},{key:"render",value:function(){return null}}]),t}(r.Component)}();function V(e){e.stopPropagation()}var B=Object(r.forwardRef)((function(e,t){var n=e.children,o=Object(l.a)(e,["children"]);return Object(r.createElement)("div",Object(s.a)({},o,{ref:t,onMouseDown:V}),n)})),z=Object(r.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),q=z.Provider,H=z.Consumer,W=(r.Component,0);function U(e){var t=e.name,n=e.children,c=e.registerFill,i=e.unregisterFill,a=function(e){var t=Object(r.useContext)(z),n=t.getSlot,o=t.subscribe,c=Object(r.useState)(n(e)),i=Object(O.a)(c,2),a=i[0],u=i[1];return Object(r.useEffect)((function(){return u(n(e)),o((function(){u(n(e))}))}),[e]),a}(t),u=Object(r.useRef)({name:t,children:n});return u.current.occurrence||(u.current.occurrence=++W),Object(r.useLayoutEffect)((function(){return c(t,u.current),function(){return i(t,u.current)}}),[]),Object(r.useLayoutEffect)((function(){u.current.children=n,a&&!a.props.bubblesVirtually&&a.forceUpdate()}),[n]),Object(r.useLayoutEffect)((function(){t!==u.current.name&&(i(u.current.name,u.current),u.current.name=t,c(t,u.current))}),[t]),a&&a.node&&a.props.bubblesVirtually?(Object(o.isFunction)(n)&&(n=n(a.props.fillProps)),Object(r.createPortal)(n,a.node)):null}var K=function(e){return Object(r.createElement)(H,null,(function(t){var n=t.registerFill,o=t.unregisterFill;return Object(r.createElement)(U,Object(s.a)({},e,{registerFill:n,unregisterFill:o}))}))},Q=function(e){function t(){var e;return f(this,t),(e=h(this,g(t).apply(this,arguments))).bindNode=e.bindNode.bind(Object(b.a)(e)),e}return y(t,e),d(t,[{key:"componentDidMount",value:function(){(0,this.props.registerSlot)(this.props.name,this)}},{key:"componentWillUnmount",value:function(){(0,this.props.unregisterSlot)(this.props.name,this)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.name,r=t.unregisterSlot,o=t.registerSlot;e.name!==n&&(r(e.name),o(n,this))}},{key:"bindNode",value:function(e){this.node=e}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.name,c=e.bubblesVirtually,i=void 0!==c&&c,a=e.fillProps,u=void 0===a?{}:a,s=e.getFills,l=e.className;if(i)return Object(r.createElement)("div",{ref:this.bindNode,className:l});var f=Object(o.map)(s(n,this),(function(e){var t=e.occurrence,n=Object(o.isFunction)(e.children)?e.children(u):e.children;return r.Children.map(n,(function(e,n){if(!e||Object(o.isString)(e))return e;var c="".concat(t,"---").concat(e.key||n);return Object(r.cloneElement)(e,{key:c})}))})).filter(Object(o.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(o.isFunction)(t)?t(f):f)}}]),t}(r.Component),Y=function(e){return Object(r.createElement)(H,null,(function(t){var n=t.registerSlot,o=t.unregisterSlot,c=t.getFills;return Object(r.createElement)(Q,Object(s.a)({},e,{registerSlot:n,unregisterSlot:o,getFills:c}))}))},G=n(40);var $=function(e){var t=e.type,n=e.options,r=void 0===n?{}:n,o=e.children;if("appear"===t){var c,a=r.origin,u=(void 0===a?"top":a).split(" "),s=Object(O.a)(u,2),l=s[0],f=s[1],p=void 0===f?"center":f;return o({className:i()("components-animate__appear",(c={},Object(G.a)(c,"is-from-"+p,"center"!==p),Object(G.a)(c,"is-from-"+l,"middle"!==l),c))})}if("slide-in"===t){var d=r.origin,m=void 0===d?"left":d;return o({className:i()("components-animate__slide-in","is-from-"+m)})}return o("loading"===t?{className:i()("components-animate__loading")}:{})},J=M(F((function(e){return e.children})));function Z(e,t){var n=window.getComputedStyle(t),r=n.paddingTop,o=n.paddingBottom,c=n.paddingLeft,i=n.paddingRight,a=r?parseInt(r,10):0,u=o?parseInt(o,10):0,s=c?parseInt(c,10):0,l=i?parseInt(i,10):0;return{x:e.left+s,y:e.top+a,width:e.width-s-l,height:e.height-a-u,left:e.left+s,right:e.right-l,top:e.top+a,bottom:e.bottom-u}}function X(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==n&&(e.style[t]=n)}function te(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var ne=function(e){var t=e.headerTitle,n=e.onClose,o=e.onKeyDown,c=e.children,a=e.className,u=e.noArrow,f=void 0!==u&&u,p=e.position,d=void 0===p?"top":p,m=(e.range,e.focusOnMount),b=void 0===m?"firstElement":m,h=e.anchorRef,g=e.shouldAnchorIncludePadding,v=e.anchorVerticalBuffer,y=e.anchorHorizontalBuffer,k=e.anchorRect,R=e.getAnchorRect,C=e.expandOnMobile,N=e.animate,T=void 0===N||N,A=e.onClickOutside,F=e.onFocusOutside,M=Object(l.a)(e,["headerTitle","onClose","onKeyDown","children","className","noArrow","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorVerticalBuffer","anchorHorizontalBuffer","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside"]),I=Object(r.useRef)(null),V=Object(r.useRef)(null),z=Object(r.useRef)(),q=Object(r.useRef)(),W=Object(_.useViewportMatch)("medium","<"),U=Object(r.useState)(),Q=Object(O.a)(U,2),Y=Q[0],G=Q[1],ne=C&&W;f=ne||f,Object(r.useEffect)((function(){var e=z.current,t=V.current;if(ne)return te(e,"is-without-arrow",f),X(e,"data-x-axis"),X(e,"data-y-axis"),ee(e,"top"),ee(e,"left"),ee(t,"maxHeight"),void ee(t,"maxWidth");var n=function(){var n=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(t)return t;if(n){if(!e.current)return;return n(e.current)}if(!1!==r){if(!r)return;if(r instanceof window.Range)return Object(j.getRectangleFromRange)(r);var c=r.getBoundingClientRect();return o?c:Z(c,r)}if(e.current){var i=e.current.parentNode,a=i.getBoundingClientRect();return o?a:Z(a,i)}}(I,k,R,h,g);if(n){n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{x:e.left-n,y:e.top-t,width:e.width+2*n,height:e.height+2*t,left:e.left-n,right:e.right+n,top:e.top-t,bottom:e.bottom+t}}(n,v,y),q.current||(q.current=t.getBoundingClientRect());var r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",r=n.split(" "),o=Object(O.a)(r,2),c=o[0],i=o[1],a=void 0===i?"center":i,u=P(e,t,c),s=x(e,t,a,u.yAxis);return Object(S.a)({},s,u)}(n,q.current,d),o=r.popoverTop,c=r.popoverLeft,i=r.xAxis,a=r.yAxis,u=r.contentHeight,s=r.contentWidth;te(e,"is-without-arrow",f||"center"===i&&"middle"===a),X(e,"data-x-axis",i),X(e,"data-y-axis",a),ee(e,"top","number"==typeof o?o+"px":""),ee(e,"left","number"==typeof c?c+"px":""),ee(t,"maxHeight","number"==typeof u?u+"px":""),ee(t,"maxWidth","number"==typeof s?s+"px":"");G(({left:"right",right:"left"}[i]||"center")+" "+({top:"bottom",bottom:"top"}[a]||"middle"))}},r=window.setTimeout(n),o=window.setInterval(n,500);return window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),function(){window.clearTimeout(r),window.clearInterval(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}}),[ne,k,R,h,g,v,y,d]),function(e,t){Object(r.useEffect)((function(){var n=setTimeout((function(){if(e&&t.current)if("firstElement"!==e)"container"===e&&t.current.focus();else{var n=j.focus.tabbable.find(t.current)[0];n?n.focus():t.current.focus()}}),0);return function(){return clearTimeout(n)}}),[])}(b,V);var re=function(e){e.keyCode===w.ESCAPE&&n&&(e.stopPropagation(),n()),o&&o(e)};var oe=Object(r.createElement)(D,{onFocusOutside:function(e){if(F)F(e);else if(A){var t;try{t=new window.MouseEvent("click")}catch(e){(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}Object.defineProperty(t,"target",{get:function(){return e.relatedTarget}}),E()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),A(t)}else n&&n()}},Object(r.createElement)($,{type:T&&Y?"appear":null,options:{origin:Y}},(function(e){var o=e.className;return Object(r.createElement)(B,Object(s.a)({className:i()("components-popover",a,o,{"is-expanded":ne,"is-without-arrow":f})},M,{onKeyDown:re,ref:z}),ne&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},t),Object(r.createElement)(ae,{className:"components-popover__close",icon:"no-alt",onClick:n})),Object(r.createElement)("div",{ref:V,className:"components-popover__content",tabIndex:"-1"},c))})));return b&&(oe=Object(r.createElement)(J,null,oe)),Object(r.createElement)(H,null,(function(e){var t=e.getSlot;return t&&t("Popover")&&(oe=Object(r.createElement)(K,{name:"Popover"},oe)),Object(r.createElement)("span",{ref:I},oe,W&&C&&Object(r.createElement)(L,null))}))};ne.Slot=function(){return Object(r.createElement)(Y,{bubblesVirtually:!0,name:"Popover"})};var re=ne;var oe=function(e){var t,n,c=e.shortcut,i=e.className;return c?(Object(o.isString)(c)&&(t=c),Object(o.isObject)(c)&&(t=c.display,n=c.ariaLabel),Object(r.createElement)("span",{className:i,"aria-label":n},t)):null},ce=function(e){function t(){var e;return f(this,t),(e=h(this,g(t).apply(this,arguments))).delayedSetIsOver=Object(o.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return y(t,e),d(t,[{key:"componentWillUnmount",value:function(){this.delayedSetIsOver.cancel(),document.removeEventListener("mouseup",this.cancelIsMouseDown)}},{key:"emitToChild",value:function(e,t){var n=this.props.children;if(1===r.Children.count(n)){var o=r.Children.only(n);"function"==typeof o.props[e]&&o.props[e](t)}}},{key:"createToggleIsOver",value:function(e,t){var n=this;return function(r){if(n.emitToChild(e,r),!(r.currentTarget.disabled||"focus"===r.type&&n.isInMouseDown)){n.delayedSetIsOver.cancel();var c=Object(o.includes)(["focus","mouseenter"],r.type);c!==n.state.isOver&&(t?n.delayedSetIsOver(c):n.setState({isOver:c}))}}}},{key:"createSetIsMouseDown",value:function(e){var t=this;return function(n){t.emitToChild(e?"onMouseDown":"onMouseUp",n),document[e?"addEventListener":"removeEventListener"]("mouseup",t.cancelIsMouseDown),t.isInMouseDown=e}}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.position,o=e.text,c=e.shortcut;if(1!==r.Children.count(t))return t;var i=r.Children.only(t),a=this.state.isOver;return Object(r.cloneElement)(i,{onMouseEnter:this.createToggleIsOver("onMouseEnter",!0),onMouseLeave:this.createToggleIsOver("onMouseLeave"),onClick:this.createToggleIsOver("onClick"),onFocus:this.createToggleIsOver("onFocus"),onBlur:this.createToggleIsOver("onBlur"),onMouseDown:this.createSetIsMouseDown(!0),children:Object(r.concatChildren)(i.props.children,a&&Object(r.createElement)(re,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1},o,Object(r.createElement)(oe,{className:"components-tooltip__shortcut",shortcut:c})))})}}]),t}(r.Component),ie=n(73);var ae=Object(r.forwardRef)((function(e,t){var n=e.icon,c=e.children,a=e.label,f=e.className,p=e.tooltip,d=e.shortcut,m=e.labelPosition,b=e.size,h=Object(l.a)(e,["icon","children","label","className","tooltip","shortcut","labelPosition","size"]),g=i()("components-icon-button",f,{"has-text":c}),v=p||a,y=!h.disabled&&(p||d||!!a&&(!c||Object(o.isArray)(c)&&!c.length)&&!1!==p),O=Object(r.createElement)(u.a,Object(s.a)({"aria-label":a},h,{className:g,ref:t}),Object(r.createElement)(ie.a,{icon:n,size:b}),c);return y&&(O=Object(r.createElement)(ce,{text:v,shortcut:d,position:m},O)),O}));t.a=function(e){var t=e.className,n=e.status,c=e.children,s=e.onRemove,l=void 0===s?o.noop:s,f=e.isDismissible,p=void 0===f||f,d=e.actions,m=void 0===d?[]:d,b=e.__unstableHTML,h=i()(t,"components-notice","is-"+n,{"is-dismissible":p});return b&&(c=Object(r.createElement)(r.RawHTML,null,c)),Object(r.createElement)("div",{className:h},Object(r.createElement)("div",{className:"components-notice__content"},c,m.map((function(e,t){var n=e.className,o=e.label,c=e.noDefaultClasses,a=void 0!==c&&c,s=e.onClick,l=e.url;return Object(r.createElement)(u.a,{key:t,href:l,isDefault:!a&&!l,isLink:!a&&!!l,onClick:l?void 0:s,className:i()("components-notice__action",n)},o)}))),p&&Object(r.createElement)(ae,{className:"components-notice__dismiss",icon:"no-alt",label:Object(a.__)("Dismiss this notice"),onClick:l,tooltip:!1}))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),o=function(e,t){var n=Object(r.useRef)();return Object(r.useEffect)((function(){n.current===e||t&&!t(e,n.current)||(n.current=e)}),[e,n.current]),n.current}},,,,,function(e,t){!function(){e.exports=this.wc.wcSharedHocs}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.components}()},,,,,,,,,,function(e,t,n){e.exports=n(255)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(124),o=n(113),c=n(103),i=n(30),a=n.n(i),u=n(31),s=n.n(u),l=n(32),f=n.n(l),p=n(33),d=n.n(p),m=n(19),b=n.n(m),h=n(3),g=(n(4),n(10)),v=n.n(g),y=n(0),O=n(23),j=n.n(O),w=n(15),k=n.n(w),E=n(6),_=n.n(E),S=n(1),R=n(7),x=n(5),P=n.n(x),C=n(29),N=(n(193),function(e){var t=e.currentPage,n=e.displayFirstAndLastPages,r=e.displayNextAndPreviousArrows,o=e.pagesToDisplay,c=e.onPageChange,i=e.totalPages,a=function(e,t,n){if(n<=2)return{minIndex:null,maxIndex:null};var r=e-1,o=Math.max(Math.floor(t-r/2),2),c=Math.min(Math.ceil(t+(r-(t-o))),n-1);return{minIndex:Math.max(Math.floor(t-(r-(c-t))),2),maxIndex:c}}(o,t,i),u=a.minIndex,s=a.maxIndex,l=n&&Boolean(1!==u),f=n&&Boolean(s!==i),p=n&&Boolean(u>3),d=n&&Boolean(s<i-2);l&&3===u&&(u-=1),f&&s===i-2&&(s+=1);var m=[];if(u&&s)for(var b=u;b<=s;b++)m.push(b);return React.createElement("div",{className:"wc-block-pagination wc-block-components-pagination"},React.createElement(C.a,{screenReaderLabel:Object(S.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return c(t-1)},title:Object(S.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},React.createElement(C.a,{label:"<",screenReaderLabel:Object(S.__)("Previous page","woo-gutenberg-products-block")})),l&&React.createElement("button",{className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:function(){return c(1)},disabled:1===t},React.createElement(C.a,{label:1,screenReaderLabel:Object(S.sprintf)(Object(S.__)("Page %d","woo-gutenberg-products-block"),1)})),p&&React.createElement("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(S.__)("…","woo-gutenberg-products-block")),m.map((function(e){return React.createElement("button",{key:e,className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?null:function(){return c(e)},disabled:t===e},React.createElement(C.a,{label:e,screenReaderLabel:Object(S.sprintf)(Object(S.__)("Page %d","woo-gutenberg-products-block"),e)}))})),d&&React.createElement("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(S.__)("…","woo-gutenberg-products-block")),f&&React.createElement("button",{className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===i,"wc-block-components-pagination__page--active":t===i}),onClick:function(){return c(i)},disabled:t===i},React.createElement(C.a,{label:i,screenReaderLabel:Object(S.sprintf)(Object(S.__)("Page %d","woo-gutenberg-products-block"),i)})),r&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return c(t+1)},title:Object(S.__)("Next page","woo-gutenberg-products-block"),disabled:t>=i},React.createElement(C.a,{label:">",screenReaderLabel:Object(S.__)("Next page","woo-gutenberg-products-block")})))});N.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var T=N,A=n(130),F=(n(192),function(e){var t=e.defaultValue,n=e.onChange,r=e.readOnly,o=e.value;return React.createElement(A.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",defaultValue:t,name:"orderby",onChange:n,options:[{key:"menu_order",label:Object(S.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(S.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(S.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(S.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(S.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(S.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(S.__)("Order products by","woo-gutenberg-products-block"),value:o})}),M=n(66),I=n(94),D=n(11),L=n.n(D),V=n(138),B=Object(I.a)((function(e){var t=e.product,n=e.attributes,r=e.instanceId,o=n.layoutConfig,c=Object(M.useInnerBlockLayoutContext)(),i=c.parentClassName,a=c.parentName,u=0===Object.keys(t).length,s=P()("".concat(i,"__product"),"wc-block-layout",{"is-loading":u});return React.createElement("li",{className:s,"aria-hidden":u},function e(t,n,r,o){if(r){var c=Object(V.a)(t);return r.map((function(r,i){var a=v()(r,2),u=a[0],s=a[1],l=void 0===s?{}:s,f=[];l.children&&l.children.length>0&&(f=e(t,n,l.children,o));var p=c[u];if(!p)return null;var d=n.id||0,m=["layout",u,i,o,d];return React.createElement(y.Suspense,{key:m.join("_"),fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(p,L()({},l,{children:f,product:n})))}))}}(a,t,o,r))})),z=n(93),q=n(109),H=n(14),W=n(13),U=n(37);function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){_()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Y=function(e){var t={namespace:"/wc/store",resourceName:"products"},n=Object(q.a)(Q(Q({},t),{},{query:e})),r=n.results,o=n.isLoading,c=function(e,t){var n=t.namespace,r=t.resourceName,o=t.resourceValues,c=void 0===o?[]:o,i=t.query,a=void 0===i?{}:i;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");var u=Object(U.a)(a),s=Object(U.a)(c),l=Object(W.useSelect)((function(t){var o=t(H.COLLECTIONS_STORE_KEY),c=[e,n,r,u,s];return{value:o.getCollectionHeader.apply(o,c),isLoading:o.hasFinishedResolution("getCollectionHeader",c)}}),[e,n,r,s,u]),f=l.value,p=l.isLoading;return{value:f,isLoading:void 0===p||p}}("x-wp-total",Q(Q({},t),{},{query:e})).value;return{products:r,totalProducts:parseInt(c,10),productsLoading:o}},G=n(173),$=n(96),J=n(42),Z=(n(191),n(122)),X=n(50),ee=React.createElement(X.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},React.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),te=function(){var e=Object(M.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(e,"__no-products")},React.createElement(Z.a,{className:"".concat(e,"__no-products-image"),alt:"",srcElement:ee,size:100}),React.createElement("strong",{className:"".concat(e,"__no-products-title")},Object(S.__)("No products","woo-gutenberg-products-block")),React.createElement("p",{className:"".concat(e,"__no-products-description")},Object(S.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},ne=React.createElement(X.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},React.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),React.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})),re=function(e){var t=e.resetCallback,n=void 0===t?function(){}:t,r=Object(M.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(r,"__no-products")},React.createElement(Z.a,{className:"".concat(r,"__no-products-image"),alt:"",srcElement:ne,size:100}),React.createElement("strong",{className:"".concat(r,"__no-products-title")},Object(S.__)("No products found","woo-gutenberg-products-block")),React.createElement("p",{className:"".concat(r,"__no-products-description")},Object(S.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),React.createElement("button",{onClick:n},Object(S.__)("Reset Search","woo-gutenberg-products-block")))};function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach((function(t){_()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ie=Object($.a)((function(e){var t=e.attributes,n=e.currentPage,r=e.onPageChange,o=e.onSortChange,c=e.sortValue,i=e.scrollToTop,a=Object(z.c)(function(e){var t=e.sortValue,n=e.currentPage,r=e.attributes,o=r.columns,c=r.rows;return ce(ce({},function(e){switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}}(t)),{},{catalog_visibility:"catalog",per_page:o*c,page:n})}({attributes:t,sortValue:c,currentPage:n})),u=v()(a,1)[0],s=Y(u),l=s.products,f=s.totalProducts,p=s.productsLoading,d=Object(M.useInnerBlockLayoutContext)().parentClassName,m=function(e){e.order,e.orderby,e.page,e.per_page;return k()(e,["order","orderby","page","per_page"])}(u),b=Object(z.b)("attributes",[]),h=v()(b,2),g=h[0],O=h[1],w=Object(z.b)("min_price"),E=v()(w,2),_=E[0],x=E[1],C=Object(z.b)("max_price"),N=v()(C,2),A=N[0],I=N[1],D=Object(G.a)({totalQuery:m,totalProducts:f},(function(e){var t=e.totalQuery,n=e.totalProducts,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.totalQuery;return!Object(R.isEqual)(t,o)&&Number.isFinite(n)})),L="object"===j()(D)&&Object(R.isEqual)(m,D.totalQuery);Object(y.useEffect)((function(){L||(r(1),D&&function(e){Number.isFinite(e)&&(0===e?Object(J.speak)(Object(S.__)("No products found","woo-gutenberg-products-block")):Object(J.speak)(Object(S.sprintf)(Object(S._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(f))}),[u]);var V,q,H,W,U,K=t.contentVisibility,Q=t.columns*t.rows,$=!Number.isFinite(f)&&L?Math.ceil(D.totalProducts/Q):Math.ceil(f/Q),Z=l.length?l:Array.from({length:Q}),X=0!==l.length||p,ee=g.length>0||Number.isFinite(_)||Number.isFinite(A);return React.createElement("div",{className:(V=t.columns,q=t.rows,H=t.alignButtons,W=t.align,U=void 0!==W?"align"+W:"",P()(d,U,"has-"+V+"-columns",{"has-multiple-rows":q>1,"has-aligned-buttons":H}))},K.orderBy&&X&&React.createElement(F,{onChange:o,value:c}),!X&&ee&&React.createElement(re,{resetCallback:function(){O([]),x(null),I(null)}}),!X&&!ee&&React.createElement(te,null),X&&React.createElement("ul",{className:"".concat(d,"__products")},Z.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return React.createElement(B,{key:e.id||n,attributes:t,product:e})}))),$>1&&React.createElement(T,{currentPage:n,onPageChange:function(e){i({focusableSelector:"a, button"}),r(e)},totalPages:$}))})),ae=function(e){var t=e.attributes,n=Object(y.useState)(1),r=v()(n,2),o=r[0],c=r[1],i=Object(y.useState)(t.orderby),a=v()(i,2),u=a[0],s=a[1];Object(y.useEffect)((function(){s(t.orderby)}),[t.orderby]);return React.createElement(ie,{attributes:t,currentPage:o,onPageChange:function(e){c(e)},onSortChange:function(e){var t=e.target.value;s(t),c(1)},sortValue:u})},ue=n(8),se=React.createElement("img",{src:ue.A+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}});function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b()(e);if(t){var o=b()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d()(this,n)}}var fe=function(e){f()(n,e);var t=le(n);function n(){return a()(this,n),t.apply(this,arguments)}return s()(n,[{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.urlParameterSuffix;return t.isPreview?se:React.createElement(M.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},React.createElement(ae,{attributes:t,urlParameterSuffix:n}))}}]),n}(h.Component);Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:Object(r.a)((function(e){return React.createElement(o.a,{context:"wc/all-products"},React.createElement(fe,e))})),getProps:function(e){return{attributes:JSON.parse(e.dataset.attributes)}}})}]);
|
1 |
+
!function(e){function t(t){for(var n,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&s.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(u&&u(t);s.length;)s.shift()()}var n={},r={1:0};function o(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,o),r.l=!0,r.exports}o.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var c=new Promise((function(t,o){n=r[e]=[t,o]}));t.push(n[2]=c);var i,a=document.createElement("script");a.charset="utf-8",a.timeout=120,o.nc&&a.setAttribute("nonce",o.nc),a.src=function(e){return o.p+""+({2:"atomic-block-components/add-to-cart",3:"atomic-block-components/button",4:"atomic-block-components/category-list",5:"atomic-block-components/image",6:"atomic-block-components/price",7:"atomic-block-components/rating",8:"atomic-block-components/sale-badge",9:"atomic-block-components/sku",10:"atomic-block-components/stock-indicator",11:"atomic-block-components/summary",12:"atomic-block-components/tag-list",13:"atomic-block-components/title",20:"vendors~atomic-block-components/price"}[e]||e)+"-frontend.js"}(e);var u=new Error;i=function(t){a.onerror=a.onload=null,clearTimeout(s);var n=r[e];if(0!==n){if(n){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",u.name="ChunkLoadError",u.type=o,u.request=c,n[1](u)}r[e]=void 0}};var s=setTimeout((function(){i({type:"timeout",target:a})}),12e4);a.onerror=a.onload=i,document.head.appendChild(a)}return Promise.all(t)},o.m=e,o.c=n,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var u=i;o(o.s=194)}([function(e,t){!function(){e.exports=this.wp.element}()},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.wc.wcSettings}()},function(e,t){!function(){e.exports=this.React}()},function(e,t,n){e.exports=n(60)()},function(e,t,n){var r;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
5 |
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var c=typeof r;if("string"===c||"number"===c)e.push(r);else if(Array.isArray(r)&&r.length){var i=o.apply(null,r);i&&e.push(i)}else if("object"===c)for(var a in r)n.call(r,a)&&r[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){!function(){e.exports=this.lodash}()},function(e,t,n){"use strict";n.d(t,"i",(function(){return o})),n.d(t,"u",(function(){return c})),n.d(t,"y",(function(){return i})),n.d(t,"r",(function(){return a})),n.d(t,"m",(function(){return u})),n.d(t,"p",(function(){return s})),n.d(t,"h",(function(){return l})),n.d(t,"z",(function(){return f})),n.d(t,"k",(function(){return p})),n.d(t,"l",(function(){return d})),n.d(t,"j",(function(){return m})),n.d(t,"c",(function(){return b})),n.d(t,"n",(function(){return h})),n.d(t,"o",(function(){return g})),n.d(t,"C",(function(){return y})),n.d(t,"D",(function(){return O})),n.d(t,"v",(function(){return j})),n.d(t,"a",(function(){return w})),n.d(t,"w",(function(){return k})),n.d(t,"b",(function(){return E})),n.d(t,"q",(function(){return S})),n.d(t,"f",(function(){return _})),n.d(t,"x",(function(){return P})),n.d(t,"g",(function(){return C})),n.d(t,"t",(function(){return N})),n.d(t,"s",(function(){return T})),n.d(t,"B",(function(){return A})),n.d(t,"A",(function(){return F})),n.d(t,"d",(function(){return M})),n.d(t,"e",(function(){return I})),n.d(t,"E",(function(){return B}));var r=n(2),o=Object(r.getSetting)("currentUserIsAdmin",!1),c=Object(r.getSetting)("reviewRatingsEnabled",!0),i=Object(r.getSetting)("showAvatars",!0),a=(Object(r.getSetting)("max_columns",6),Object(r.getSetting)("min_columns",1),Object(r.getSetting)("default_columns",3),Object(r.getSetting)("max_rows",6),Object(r.getSetting)("min_rows",1),Object(r.getSetting)("default_rows",3),Object(r.getSetting)("min_height",500),Object(r.getSetting)("default_height",500),Object(r.getSetting)("placeholderImgSrc","")),u=(Object(r.getSetting)("thumbnail_size",300),Object(r.getSetting)("isLargeCatalog")),s=Object(r.getSetting)("limitTags"),l=(Object(r.getSetting)("hasProducts",!0),Object(r.getSetting)("hasTags",!0),Object(r.getSetting)("homeUrl",""),Object(r.getSetting)("couponsEnabled",!0)),f=(Object(r.getSetting)("shippingEnabled",!0),Object(r.getSetting)("taxesEnabled",!0)),p=Object(r.getSetting)("displayItemizedTaxes",!1),d=Object(r.getSetting)("hasDarkEditorStyleSupport",!1),m=(Object(r.getSetting)("displayShopPricesIncludingTax",!1),Object(r.getSetting)("displayCartPricesIncludingTax",!1)),b=(Object(r.getSetting)("productCount",0),Object(r.getSetting)("attributes",[])),h=Object(r.getSetting)("isShippingCalculatorEnabled",!0),g=Object(r.getSetting)("isShippingCostHidden",!1),v=Object(r.getSetting)("woocommerceBlocksPhase",1),y=Object(r.getSetting)("wcBlocksAssetUrl",""),O=Object(r.getSetting)("wcBlocksBuildUrl",""),j=Object(r.getSetting)("shippingCountries",{}),w=Object(r.getSetting)("allowedCountries",{}),k=Object(r.getSetting)("shippingStates",{}),E=Object(r.getSetting)("allowedStates",{}),S=(Object(r.getSetting)("shippingMethodsExist",!1),Object(r.getSetting)("paymentGatewaySortOrder",[])),_=Object(r.getSetting)("checkoutShowLoginReminder",!0),x={id:0,title:"",permalink:""},R=Object(r.getSetting)("storePages",{shop:x,cart:x,checkout:x,privacy:x,terms:x}),P=R.shop.permalink,C=(R.checkout.id,R.checkout.permalink),N=R.privacy.permalink,T=R.privacy.title,A=R.terms.permalink,F=R.terms.title,M=(R.cart.id,R.cart.permalink),I=Object(r.getSetting)("checkoutAllowsGuest",!1),B=(Object(r.getSetting)("checkoutAllowsSignup",!1),n(38),function(){return v>1})},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){var r=n(69),o=n(70),c=n(53),i=n(71);e.exports=function(e,t){return r(e)||o(e,t)||c(e,t)||i()}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){"use strict";function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}n.d(t,"a",(function(){return r}))},function(e,t){!function(){e.exports=this.wp.data}()},function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},function(e,t,n){var r=n(55);e.exports=function(e,t){if(null==e)return{};var n,o,c=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t){!function(){e.exports=this.wp.htmlEntities}()},,function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(40);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?Object(arguments[t]):{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),o.forEach((function(t){Object(r.a)(e,t,n[t])}))}return e}},,function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=n=function(e){return typeof e}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.regeneratorRuntime}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(52);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}(e,t)||Object(r.a)(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t){!function(){e.exports=this.wp.compose}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(28);function o(e,t){if(null==e)return{};var n,o,c=Object(r.a)(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}},function(e,t,n){"use strict";function r(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";var r=n(6),o=n.n(r),c=(n(4),n(3)),i=n(5),a=n.n(i);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var l=function(e){var t,n=e.label,r=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=null!=n,l=null!=r;return!u&&l?(t=o||"span",i=s(s({},i),{},{className:a()(i.className,"screen-reader-text")}),React.createElement(t,i,r)):(t=o||c.Fragment,u&&l&&n!==r?React.createElement(t,i,React.createElement("span",{"aria-hidden":"true"},n),React.createElement("span",{className:"screen-reader-text"},r)):React.createElement(t,i,n))};l.defaultProps={wrapperProps:{}},t.a=l},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(59);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){var r=n(22),o=n(18);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(45);var o=n(52);function c(e){return function(e){if(Array.isArray(e))return Object(r.a)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||Object(o.a)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}},function(e,t){!function(){e.exports=this.wc.wcBlocksRegistry}()},function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(36),c=n.n(o),i=function(e){var t=Object(r.useRef)();return c()(e,t.current)||(t.current=e),t.current}},function(e,t){!function(){e.exports=this.wp.blocks}()},,function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},,function(e,t){!function(){e.exports=this.wp.a11y}()},,function(e,t,n){"use strict";var r=n(30),o=n.n(r),c=n(31),i=n.n(c),a=n(18),u=n.n(a),s=n(32),l=n.n(s),f=n(33),p=n.n(f),d=n(19),m=n.n(d),b=n(6),h=n.n(b),g=(n(4),n(3)),v=n(1),y=n(8),O=function(e){var t=e.imageUrl,n=void 0===t?"".concat(y.C,"img/block-error.svg"):t,r=e.header,o=void 0===r?Object(v.__)("Oops!","woo-gutenberg-products-block"):r,c=e.text,i=void 0===c?Object(v.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,a=e.errorMessage,u=e.errorMessagePrefix,s=void 0===u?Object(v.__)("Error:","woo-gutenberg-products-block"):u;return React.createElement("div",{className:"wc-block-error wc-block-components-error"},n&&React.createElement("img",{className:"wc-block-error__image wc-block-components-error__image",src:n,alt:""}),React.createElement("div",{className:"wc-block-error__content wc-block-components-error__content"},o&&React.createElement("p",{className:"wc-block-error__header wc-block-components-error__header"},o),i&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},i),a&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",a)))};n(62);function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=m()(e);if(t){var o=m()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return p()(this,n)}}var w=function(e){l()(n,e);var t=j(n);function n(){var e;o()(this,n);for(var r=arguments.length,c=new Array(r),i=0;i<r;i++)c[i]=arguments[i];return e=t.call.apply(t,[this].concat(c)),h()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(n,[{key:"render",value:function(){var e=this.props,t=e.header,n=e.imageUrl,r=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=this.state,a=i.errorMessage;return i.hasError?React.createElement(O,{errorMessage:r?a:null,header:t,imageUrl:n,text:o,errorMessagePrefix:c}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(g.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),n}(g.Component);w.defaultProps={showErrorMessage:!0};t.a=w},function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,"a",(function(){return r}))},function(e,t){!function(){e.exports=this.wp.dom}()},function(e,t){!function(){e.exports=this.wp.keycodes}()},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(20),o=n(7),c=n(0),i=function(e){var t=Object(r.a)({},e,{role:"img","aria-hidden":"true",focusable:"false"});return Object(c.createElement)("svg",Object(o.omit)(t,"__unstableActive"))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(45);function o(e,t){if(e){if("string"==typeof e)return Object(r.a)(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Object(r.a)(e,t):void 0}}},function(e,t,n){var r=n(54);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){!function(){e.exports=this.wp.apiFetch}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=Object(r.createContext)("page"),c=function(){return Object(r.useContext)(o)};o.Provider},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){"use strict";var r=n(61);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,c,i){if(i!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:c,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){},function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",(function(){return r}))},,function(e,t,n){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(11)),c=r(n(55)),i=n(3),a=r(i),u=r(n(105)),s=r(n(18)),l={arr:Array.isArray,obj:function(e){return"[object Object]"===Object.prototype.toString.call(e)},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},und:function(e){return void 0===e},nul:function(e){return null===e},set:function(e){return e instanceof Set},map:function(e){return e instanceof Map},equ:function(e,t){if(typeof e!=typeof t)return!1;if(l.str(e)||l.num(e))return e===t;if(l.obj(e)&&l.obj(t)&&Object.keys(e).length+Object.keys(t).length===0)return!0;var n;for(n in e)if(!(n in t))return!1;for(n in t)if(e[n]!==t[n])return!1;return!l.und(n)||e===t}};function f(){var e=i.useState(!1)[1];return i.useCallback((function(){return e((function(e){return!e}))}),[])}function p(e,t){return l.und(e)||l.nul(e)?t:e}function d(e){return l.und(e)?[]:l.arr(e)?e:[e]}function m(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return l.fun(e)?e.apply(void 0,n):e}function b(e){var t=function(e){return e.to,e.from,e.config,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.delay,e.attach,e.destroyed,e.interpolateTo,e.ref,e.lazy,c(e,["to","from","config","onStart","onRest","onFrame","children","reset","reverse","force","immediate","delay","attach","destroyed","interpolateTo","ref","lazy"])}(e);if(l.und(t))return o({to:t},e);var n=Object.keys(e).reduce((function(n,r){var c;return l.und(t[r])?o({},n,((c={})[r]=e[r],c)):n}),{});return o({to:t},n)}var h,g,v=function(){function e(){this.payload=void 0,this.children=[]}var t=e.prototype;return t.getAnimatedValue=function(){return this.getValue()},t.getPayload=function(){return this.payload||this},t.attach=function(){},t.detach=function(){},t.getChildren=function(){return this.children},t.addChild=function(e){0===this.children.length&&this.attach(),this.children.push(e)},t.removeChild=function(e){var t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()},e}(),y=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).payload=[],t.attach=function(){return t.payload.forEach((function(e){return e instanceof v&&e.addChild(s(t))}))},t.detach=function(){return t.payload.forEach((function(e){return e instanceof v&&e.removeChild(s(t))}))},t}return u(t,e),t}(v),O=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(t=e.call.apply(e,[this].concat(r))||this).payload={},t.attach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof v&&e.addChild(s(t))}))},t.detach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof v&&e.removeChild(s(t))}))},t}u(t,e);var n=t.prototype;return n.getValue=function(e){void 0===e&&(e=!1);var t={};for(var n in this.payload){var r=this.payload[n];(!e||r instanceof v)&&(t[n]=r instanceof v?r[e?"getAnimatedValue":"getValue"]():r)}return t},n.getAnimatedValue=function(){return this.getValue(!0)},t}(v);function j(e,t){h={fn:e,transform:t}}function w(e){g=e}var k,E=function(e){return"undefined"!=typeof window?window.requestAnimationFrame(e):-1},S=function(e){"undefined"!=typeof window&&window.cancelAnimationFrame(e)};function _(e){k=e}var x,R=function(){return Date.now()};function P(e){x=e}var C,N,T=function(e){return e.current};function A(e){C=e}var F=Object.freeze({get applyAnimatedValues(){return h},injectApplyAnimatedValues:j,get colorNames(){return g},injectColorNames:w,get requestFrame(){return E},get cancelFrame(){return S},injectFrame:function(e,t){E=e,S=t},get interpolation(){return k},injectStringInterpolator:_,get now(){return R},injectNow:function(e){R=e},get defaultElement(){return x},injectDefaultElement:P,get animatedApi(){return T},injectAnimatedApi:function(e){T=e},get createAnimatedStyle(){return C},injectCreateAnimatedStyle:A,get manualFrameloop(){return N},injectManualFrameloop:function(e){N=e}}),M=function(e){function t(t,n){var r;return(r=e.call(this)||this).update=void 0,r.payload=t.style?o({},t,{style:C(t.style)}):t,r.update=n,r.attach(),r}return u(t,e),t}(O),I=!1,B=new Set,D=function e(){if(!I)return!1;var t=R(),n=B,r=Array.isArray(n),o=0;for(n=r?n:n[Symbol.iterator]();;){var c;if(r){if(o>=n.length)break;c=n[o++]}else{if((o=n.next()).done)break;c=o.value}for(var i=c,a=!1,u=0;u<i.configs.length;u++){for(var s=i.configs[u],l=void 0,f=void 0,p=0;p<s.animatedValues.length;p++){var d=s.animatedValues[p];if(!d.done){var m=s.fromValues[p],b=s.toValues[p],h=d.lastPosition,g=b instanceof v,y=Array.isArray(s.initialVelocity)?s.initialVelocity[p]:s.initialVelocity;if(g&&(b=b.getValue()),s.immediate)d.setValue(b),d.done=!0;else if("string"!=typeof m&&"string"!=typeof b){if(void 0!==s.duration)h=m+s.easing((t-d.startTime)/s.duration)*(b-m),l=t>=d.startTime+s.duration;else if(s.decay)h=m+y/(1-.998)*(1-Math.exp(-(1-.998)*(t-d.startTime))),(l=Math.abs(d.lastPosition-h)<.1)&&(b=h);else{f=void 0!==d.lastTime?d.lastTime:t,y=void 0!==d.lastVelocity?d.lastVelocity:s.initialVelocity,t>f+64&&(f=t);for(var O=Math.floor(t-f),j=0;j<O;++j){h+=1*(y+=1*((-s.tension*(h-b)+-s.friction*y)/s.mass)/1e3)/1e3}var w=!(!s.clamp||0===s.tension)&&(m<b?h>b:h<b),k=Math.abs(y)<=s.precision,S=0===s.tension||Math.abs(b-h)<=s.precision;l=w||k&&S,d.lastVelocity=y,d.lastTime=t}g&&!s.toValues[p].done&&(l=!1),l?(d.value!==b&&(h=b),d.done=!0):a=!0,d.setValue(h),d.lastPosition=h}else d.setValue(b),d.done=!0}}i.props.onFrame&&(i.values[s.name]=s.interpolation.getValue())}i.props.onFrame&&i.props.onFrame(i.values),a||(B.delete(i),i.stop(!0))}return B.size?N?N():E(e):I=!1,I};function L(e,t,n){if("function"==typeof e)return e;if(Array.isArray(e))return L({range:e,output:t,extrapolate:n});if(k&&"string"==typeof e.output[0])return k(e);var r=e,o=r.output,c=r.range||[0,1],i=r.extrapolateLeft||r.extrapolate||"extend",a=r.extrapolateRight||r.extrapolate||"extend",u=r.easing||function(e){return e};return function(e){var t=function(e,t){for(var n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}(e,c);return function(e,t,n,r,o,c,i,a,u){var s=u?u(e):e;if(s<t){if("identity"===i)return s;"clamp"===i&&(s=t)}if(s>n){if("identity"===a)return s;"clamp"===a&&(s=n)}if(r===o)return r;if(t===n)return e<=t?r:o;t===-1/0?s=-s:n===1/0?s-=t:s=(s-t)/(n-t);s=c(s),r===-1/0?s=-s:o===1/0?s+=r:s=s*(o-r)+r;return s}(e,c[t],c[t+1],o[t],o[t+1],u,i,a,r.map)}}var V=function(e){function t(n,r,o,c){var i;return(i=e.call(this)||this).calc=void 0,i.payload=n instanceof y&&!(n instanceof t)?n.getPayload():Array.isArray(n)?n:[n],i.calc=L(r,o,c),i}u(t,e);var n=t.prototype;return n.getValue=function(){return this.calc.apply(this,this.payload.map((function(e){return e.getValue()})))},n.updateConfig=function(e,t,n){this.calc=L(e,t,n)},n.interpolate=function(e,n,r){return new t(this,e,n,r)},t}(y);var z=function(e){function t(t){var n;return(n=e.call(this)||this).animatedStyles=new Set,n.value=void 0,n.startPosition=void 0,n.lastPosition=void 0,n.lastVelocity=void 0,n.startTime=void 0,n.lastTime=void 0,n.done=!1,n.setValue=function(e,t){void 0===t&&(t=!0),n.value=e,t&&n.flush()},n.value=t,n.startPosition=t,n.lastPosition=t,n}u(t,e);var n=t.prototype;return n.flush=function(){0===this.animatedStyles.size&&function e(t,n){"update"in t?n.add(t):t.getChildren().forEach((function(t){return e(t,n)}))}(this,this.animatedStyles),this.animatedStyles.forEach((function(e){return e.update()}))},n.clearStyles=function(){this.animatedStyles.clear()},n.getValue=function(){return this.value},n.interpolate=function(e,t,n){return new V(this,e,t,n)},t}(v),q=function(e){function t(t){var n;return(n=e.call(this)||this).payload=t.map((function(e){return new z(e)})),n}u(t,e);var n=t.prototype;return n.setValue=function(e,t){var n=this;void 0===t&&(t=!0),Array.isArray(e)?e.length===this.payload.length&&e.forEach((function(e,r){return n.payload[r].setValue(e,t)})):this.payload.forEach((function(n){return n.setValue(e,t)}))},n.getValue=function(){return this.payload.map((function(e){return e.getValue()}))},n.interpolate=function(e,t){return new V(this,e,t)},t}(y),H=0,W=function(){function e(){var e=this;this.id=void 0,this.idle=!0,this.hasChanged=!1,this.guid=0,this.local=0,this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.listeners=[],this.queue=[],this.localQueue=void 0,this.getValues=function(){return e.interpolations},this.id=H++}var t=e.prototype;return t.update=function(e){if(!e)return this;var t=b(e),n=t.delay,r=void 0===n?0:n,i=t.to,a=c(t,["delay","to"]);if(l.arr(i)||l.fun(i))this.queue.push(o({},a,{delay:r,to:i}));else if(i){var u={};Object.entries(i).forEach((function(e){var t,n=e[0],c=e[1],i=o({to:(t={},t[n]=c,t),delay:m(r,n)},a),s=u[i.delay]&&u[i.delay].to;u[i.delay]=o({},u[i.delay],i,{to:o({},s,i.to)})})),this.queue=Object.values(u)}return this.queue=this.queue.sort((function(e,t){return e.delay-t.delay})),this.diff(a),this},t.start=function(e){var t,n=this;if(this.queue.length){this.idle=!1,this.localQueue&&this.localQueue.forEach((function(e){var t=e.from,r=void 0===t?{}:t,c=e.to,i=void 0===c?{}:c;l.obj(r)&&(n.merged=o({},r,n.merged)),l.obj(i)&&(n.merged=o({},n.merged,i))}));var r=this.local=++this.guid,i=this.localQueue=this.queue;this.queue=[],i.forEach((function(t,o){var a=t.delay,u=c(t,["delay"]),s=function(t){o===i.length-1&&r===n.guid&&t&&(n.idle=!0,n.props.onRest&&n.props.onRest(n.merged)),e&&e()},f=l.arr(u.to)||l.fun(u.to);a?setTimeout((function(){r===n.guid&&(f?n.runAsync(u,s):n.diff(u).start(s))}),a):f?n.runAsync(u,s):n.diff(u).start(s)}))}else l.fun(e)&&this.listeners.push(e),this.props.onStart&&this.props.onStart(),t=this,B.has(t)||B.add(t),I||(I=!0,E(N||D));return this},t.stop=function(e){return this.listeners.forEach((function(t){return t(e)})),this.listeners=[],this},t.pause=function(e){var t;return this.stop(!0),e&&(t=this,B.has(t)&&B.delete(t)),this},t.runAsync=function(e,t){var n=this,r=(e.delay,c(e,["delay"])),i=this.local,a=Promise.resolve(void 0);if(l.arr(r.to))for(var u=function(e){var t=e,c=o({},r,b(r.to[t]));l.arr(c.config)&&(c.config=c.config[t]),a=a.then((function(){if(i===n.guid)return new Promise((function(e){return n.diff(c).start(e)}))}))},s=0;s<r.to.length;s++)u(s);else if(l.fun(r.to)){var f,p=0;a=a.then((function(){return r.to((function(e){var t=o({},r,b(e));if(l.arr(t.config)&&(t.config=t.config[p]),p++,i===n.guid)return f=new Promise((function(e){return n.diff(t).start(e)}))}),(function(e){return void 0===e&&(e=!0),n.stop(e)})).then((function(){return f}))}))}a.then(t)},t.diff=function(e){var t=this;this.props=o({},this.props,e);var n=this.props,r=n.from,c=void 0===r?{}:r,i=n.to,a=void 0===i?{}:i,u=n.config,s=void 0===u?{}:u,f=n.reverse,b=n.attach,h=n.reset,v=n.immediate;if(f){var y=[a,c];c=y[0],a=y[1]}this.merged=o({},c,this.merged,a),this.hasChanged=!1;var O=b&&b(this);if(this.animations=Object.entries(this.merged).reduce((function(e,n){var r=n[0],i=n[1],a=e[r]||{},u=l.num(i),f=l.str(i)&&!i.startsWith("#")&&!/\d/.test(i)&&!g[i],b=l.arr(i),y=!u&&!b&&!f,j=l.und(c[r])?i:c[r],w=u||b||f?i:1,E=m(s,r);O&&(w=O.animations[r].parent);var S,_=a.parent,x=a.interpolation,P=d(O?w.getPayload():w),C=i;y&&(C=k({range:[0,1],output:[i,i]})(1));var N,T=x&&x.getValue(),A=!l.und(_)&&a.animatedValues.some((function(e){return!e.done})),F=!l.equ(C,T),M=!l.equ(C,a.previous),I=!l.equ(E,a.config);if(h||M&&F||I){var B;if(u||f)_=x=a.parent||new z(j);else if(b)_=x=a.parent||new q(j);else if(y){var D=a.interpolation&&a.interpolation.calc(a.parent.value);D=void 0===D||h?j:D,a.parent?(_=a.parent).setValue(0,!1):_=new z(0);var L={output:[D,i]};a.interpolation?(x=a.interpolation,a.interpolation.updateConfig(L)):x=_.interpolate(L)}return P=d(O?w.getPayload():w),S=d(_.getPayload()),h&&!y&&_.setValue(j,!1),t.hasChanged=!0,S.forEach((function(e){e.startPosition=e.value,e.lastPosition=e.value,e.lastVelocity=A?e.lastVelocity:void 0,e.lastTime=A?e.lastTime:void 0,e.startTime=R(),e.done=!1,e.animatedStyles.clear()})),m(v,r)&&_.setValue(y?w:i,!1),o({},e,((B={})[r]=o({},a,{name:r,parent:_,interpolation:x,animatedValues:S,toValues:P,previous:C,config:E,fromValues:d(_.getValue()),immediate:m(v,r),initialVelocity:p(E.velocity,0),clamp:p(E.clamp,!1),precision:p(E.precision,.01),tension:p(E.tension,170),friction:p(E.friction,26),mass:p(E.mass,1),duration:E.duration,easing:p(E.easing,(function(e){return e})),decay:E.decay}),B))}return F?e:(y&&(_.setValue(1,!1),x.updateConfig({output:[C,C]})),_.done=!0,t.hasChanged=!0,o({},e,((N={})[r]=o({},e[r],{previous:C}),N)))}),this.animations),this.hasChanged)for(var j in this.configs=Object.values(this.animations),this.values={},this.interpolations={},this.animations)this.interpolations[j]=this.animations[j].interpolation,this.values[j]=this.animations[j].interpolation.getValue();return this},t.destroy=function(){this.stop(),this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.local=0},e}(),U=function(e,t){var n=i.useRef(!1),r=i.useRef(),o=l.fun(t),c=i.useMemo((function(){var n;return r.current&&(r.current.map((function(e){return e.destroy()})),r.current=void 0),[new Array(e).fill().map((function(e,r){var c=new W,i=o?m(t,r,c):t[r];return 0===r&&(n=i.ref),c.update(i),n||c.start(),c})),n]}),[e]),a=c[0],u=c[1];r.current=a;i.useImperativeHandle(u,(function(){return{start:function(){return Promise.all(r.current.map((function(e){return new Promise((function(t){return e.start(t)}))})))},stop:function(e){return r.current.forEach((function(t){return t.stop(e)}))},get controllers(){return r.current}}}));var s=i.useMemo((function(){return function(e){return r.current.map((function(t,n){t.update(o?m(e,n,t):e[n]),u||t.start()}))}}),[e]);i.useEffect((function(){n.current?o||s(t):u||r.current.forEach((function(e){return e.start()}))})),i.useEffect((function(){return n.current=!0,function(){return r.current.forEach((function(e){return e.destroy()}))}}),[]);var f=r.current.map((function(e){return e.getValues()}));return o?[f,s,function(e){return r.current.forEach((function(t){return t.pause(e)}))}]:f},K=0,Q=function(e,t){return("function"==typeof t?e.map(t):d(t)).map(String)},Y=function(e){var t=e.items,n=e.keys,r=void 0===n?function(e){return e}:n,i=c(e,["items","keys"]);return t=d(void 0!==t?t:null),o({items:t,keys:Q(t,r)},i)};function G(e,t){var n=function(){if(o){if(c>=r.length)return"break";i=r[c++]}else{if((c=r.next()).done)return"break";i=c.value}var n=i.key,a=function(e){return e.key!==n};(l.und(t)||t===n)&&(e.current.instances.delete(n),e.current.transitions=e.current.transitions.filter(a),e.current.deleted=e.current.deleted.filter(a))},r=e.current.deleted,o=Array.isArray(r),c=0;for(r=o?r:r[Symbol.iterator]();;){var i;if("break"===n())break}e.current.forceUpdate()}var $=function(e){function t(t){var n;return void 0===t&&(t={}),n=e.call(this)||this,!t.transform||t.transform instanceof v||(t=h.transform(t)),n.payload=t,n}return u(t,e),t}(O),J={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Z="[-+]?\\d*\\.?\\d+";function X(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var ee=new RegExp("rgb"+X(Z,Z,Z)),te=new RegExp("rgba"+X(Z,Z,Z,Z)),ne=new RegExp("hsl"+X(Z,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),re=new RegExp("hsla"+X(Z,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",Z)),oe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ce=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ie=/^#([0-9a-fA-F]{6})$/,ae=/^#([0-9a-fA-F]{8})$/;function ue(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function se(e,t,n){var r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,c=ue(o,r,e+1/3),i=ue(o,r,e),a=ue(o,r,e-1/3);return Math.round(255*c)<<24|Math.round(255*i)<<16|Math.round(255*a)<<8}function le(e){var t=parseInt(e,10);return t<0?0:t>255?255:t}function fe(e){return(parseFloat(e)%360+360)%360/360}function pe(e){var t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function de(e){var t=parseFloat(e);return t<0?0:t>100?1:t/100}function me(e){var t,n,r="number"==typeof(t=e)?t>>>0===t&&t>=0&&t<=4294967295?t:null:(n=ie.exec(t))?parseInt(n[1]+"ff",16)>>>0:J.hasOwnProperty(t)?J[t]:(n=ee.exec(t))?(le(n[1])<<24|le(n[2])<<16|le(n[3])<<8|255)>>>0:(n=te.exec(t))?(le(n[1])<<24|le(n[2])<<16|le(n[3])<<8|pe(n[4]))>>>0:(n=oe.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0:(n=ae.exec(t))?parseInt(n[1],16)>>>0:(n=ce.exec(t))?parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0:(n=ne.exec(t))?(255|se(fe(n[1]),de(n[2]),de(n[3])))>>>0:(n=re.exec(t))?(se(fe(n[1]),de(n[2]),de(n[3]))|pe(n[4]))>>>0:null;return null===r?e:"rgba("+((4278190080&(r=r||0))>>>24)+", "+((16711680&r)>>>16)+", "+((65280&r)>>>8)+", "+(255&r)/255+")"}var be=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,he=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ge=new RegExp("("+Object.keys(J).join("|")+")","g"),ve={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","Ms","Moz","O"];function Oe(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||ve.hasOwnProperty(e)&&ve[e]?(""+t).trim():t+"px"}ve=Object.keys(ve).reduce((function(e,t){return ye.forEach((function(n){return e[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(n,t)]=e[t]})),e}),ve);var je={};A((function(e){return new $(e)})),P("div"),_((function(e){var t=e.output.map((function(e){return e.replace(he,me)})).map((function(e){return e.replace(ge,me)})),n=t[0].match(be).map((function(){return[]}));t.forEach((function(e){e.match(be).forEach((function(e,t){return n[t].push(+e)}))}));var r=t[0].match(be).map((function(t,r){return L(o({},e,{output:n[r]}))}));return function(e){var n=0;return t[0].replace(be,(function(){return r[n++](e)})).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(function(e,t,n,r,o){return"rgba("+Math.round(t)+", "+Math.round(n)+", "+Math.round(r)+", "+o+")"}))}})),w(J),j((function(e,t){if(!e.nodeType||void 0===e.setAttribute)return!1;var n=t.style,r=t.children,o=t.scrollTop,i=t.scrollLeft,a=c(t,["style","children","scrollTop","scrollLeft"]),u="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName;for(var s in void 0!==o&&(e.scrollTop=o),void 0!==i&&(e.scrollLeft=i),void 0!==r&&(e.textContent=r),n)if(n.hasOwnProperty(s)){var l=0===s.indexOf("--"),f=Oe(s,n[s],l);"float"===s&&(s="cssFloat"),l?e.style.setProperty(s,f):e.style[s]=f}for(var p in a){var d=u?p:je[p]||(je[p]=p.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})));void 0!==e.getAttribute(d)&&e.setAttribute(d,a[p])}}),(function(e){return e}));var we,ke,Ee=(we=function(e){return i.forwardRef((function(t,n){var r=f(),u=i.useRef(!0),s=i.useRef(null),p=i.useRef(null),d=i.useCallback((function(e){var t=s.current;s.current=new M(e,(function(){var e=!1;p.current&&(e=h.fn(p.current,s.current.getAnimatedValue())),p.current&&!1!==e||r()})),t&&t.detach()}),[]);i.useEffect((function(){return function(){u.current=!1,s.current&&s.current.detach()}}),[]),i.useImperativeHandle(n,(function(){return T(p,u,r)})),d(t);var m,b=s.current.getValue(),g=(b.scrollTop,b.scrollLeft,c(b,["scrollTop","scrollLeft"])),v=(m=e,!l.fun(m)||m.prototype instanceof a.Component?function(e){return p.current=function(e,t){return t&&(l.fun(t)?t(e):l.obj(t)&&(t.current=e)),e}(e,n)}:void 0);return a.createElement(e,o({},g,{ref:v}))}))},void 0===(ke=!1)&&(ke=!0),function(e){return(l.arr(e)?e:Object.keys(e)).reduce((function(e,t){var n=ke?t[0].toLowerCase()+t.substring(1):t;return e[n]=we(n),e}),we)}),Se=Ee(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]);t.apply=Ee,t.config={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},t.update=D,t.animated=Se,t.a=Se,t.interpolate=function(e,t,n){return e&&new V(e,t,n)},t.Globals=F,t.useSpring=function(e){var t=l.fun(e),n=U(1,t?e:[e]),r=n[0],o=n[1],c=n[2];return t?[r[0],o,c]:r},t.useTrail=function(e,t){var n=i.useRef(!1),r=l.fun(t),c=m(t),a=i.useRef(),u=U(e,(function(e,t){return 0===e&&(a.current=[]),a.current.push(t),o({},c,{config:m(c.config,e),attach:e>0&&function(){return a.current[e-1]}})})),s=u[0],f=u[1],p=u[2],d=i.useMemo((function(){return function(e){return f((function(t,n){e.reverse;var r=e.reverse?t+1:t-1,i=a.current[r];return o({},e,{config:m(e.config||c.config,t),attach:i&&function(){return i}})}))}}),[e,c.reverse]);return i.useEffect((function(){n.current&&!r&&d(t)})),i.useEffect((function(){n.current=!0}),[]),r?[s,d,p]:s},t.useTransition=function(e,t,n){var r=o({items:e,keys:t||function(e){return e}},n),a=Y(r),u=a.lazy,s=void 0!==u&&u,l=(a.unique,a.reset),p=void 0!==l&&l,d=(a.enter,a.leave,a.update,a.onDestroyed),b=(a.keys,a.items,a.onFrame),h=a.onRest,g=a.onStart,v=a.ref,y=c(a,["lazy","unique","reset","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","ref"]),O=f(),j=i.useRef(!1),w=i.useRef({mounted:!1,first:!0,deleted:[],current:{},transitions:[],prevProps:{},paused:!!r.ref,instances:!j.current&&new Map,forceUpdate:O});return i.useImperativeHandle(r.ref,(function(){return{start:function(){return Promise.all(Array.from(w.current.instances).map((function(e){var t=e[1];return new Promise((function(e){return t.start(e)}))})))},stop:function(e){return Array.from(w.current.instances).forEach((function(t){return t[1].stop(e)}))},get controllers(){return Array.from(w.current.instances).map((function(e){return e[1]}))}}})),w.current=function(e,t){var n=e.first,r=e.prevProps,i=c(e,["first","prevProps"]),a=Y(t),u=a.items,s=a.keys,l=a.initial,f=a.from,p=a.enter,d=a.leave,b=a.update,h=a.trail,g=void 0===h?0:h,v=a.unique,y=a.config,O=a.order,j=void 0===O?["enter","leave","update"]:O,w=Y(r),k=w.keys,E=w.items,S=o({},i.current),_=[].concat(i.deleted),x=Object.keys(S),R=new Set(x),P=new Set(s),C=s.filter((function(e){return!R.has(e)})),N=i.transitions.filter((function(e){return!e.destroyed&&!P.has(e.originalKey)})).map((function(e){return e.originalKey})),T=s.filter((function(e){return R.has(e)})),A=-g;for(;j.length;){switch(j.shift()){case"enter":C.forEach((function(e,t){v&&_.find((function(t){return t.originalKey===e}))&&(_=_.filter((function(t){return t.originalKey!==e})));var r=s.indexOf(e),o=u[r],c=n&&void 0!==l?"initial":"enter";S[e]={slot:c,originalKey:e,key:v?String(e):K++,item:o,trail:A+=g,config:m(y,o,c),from:m(n&&void 0!==l?l||{}:f,o),to:m(p,o)}}));break;case"leave":N.forEach((function(e){var t=k.indexOf(e),n=E[t];_.unshift(o({},S[e],{slot:"leave",destroyed:!0,left:k[Math.max(0,t-1)],right:k[Math.min(k.length,t+1)],trail:A+=g,config:m(y,n,"leave"),to:m(d,n)})),delete S[e]}));break;case"update":T.forEach((function(e){var t=s.indexOf(e),n=u[t];S[e]=o({},S[e],{item:n,slot:"update",trail:A+=g,config:m(y,n,"update"),to:m(b,n)})}))}}var F=s.map((function(e){return S[e]}));return _.forEach((function(e){var t,n=e.left,r=(e.right,c(e,["left","right"]));-1!==(t=F.findIndex((function(e){return e.originalKey===n})))&&(t+=1),t=Math.max(0,t),F=[].concat(F.slice(0,t),[r],F.slice(t))})),o({},i,{changed:C.length||N.length||T.length,first:n&&0===C.length,transitions:F,current:S,deleted:_,prevProps:t})}(w.current,r),w.current.changed&&w.current.transitions.forEach((function(e){var t=e.slot,n=e.from,r=e.to,c=e.config,i=e.trail,a=e.key,u=e.item;w.current.instances.has(a)||w.current.instances.set(a,new W);var l=w.current.instances.get(a),f=o({},y,{to:r,from:n,config:c,ref:v,onRest:function(n){w.current.mounted&&(e.destroyed&&(v||s||G(w,a),d&&d(u)),!Array.from(w.current.instances).some((function(e){return!e[1].idle}))&&(v||s)&&w.current.deleted.length>0&&G(w),h&&h(u,t,n))},onStart:g&&function(){return g(u,t)},onFrame:b&&function(e){return b(u,t,e)},delay:i,reset:p&&"enter"===t});l.update(f),w.current.paused||l.start()})),i.useEffect((function(){return w.current.mounted=j.current=!0,function(){w.current.mounted=j.current=!1,Array.from(w.current.instances).map((function(e){return e[1].destroy()})),w.current.instances.clear()}}),[]),w.current.transitions.map((function(e){var t=e.item,n=e.slot,r=e.key;return{item:t,key:r,state:n,props:w.current.instances.get(r).getValues()}}))},t.useChain=function(e,t,n){void 0===n&&(n=1e3);var r=i.useRef();i.useEffect((function(){l.equ(e,r.current)?e.forEach((function(e){var t=e.current;return t&&t.start()})):t?e.forEach((function(e,r){var c=e.current;if(c){var i=c.controllers;if(i.length){var a=n*t[r];i.forEach((function(e){e.queue=e.queue.map((function(e){return o({},e,{delay:e.delay+a})})),e.start()}))}}})):e.reduce((function(e,t,n){var r=t.current;return e.then((function(){return r.start()}))}),Promise.resolve()),r.current=e}))},t.useSprings=U},function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(15),i=n.n(c),a=n(51),u=function(e){var t=e.className,n=e.size,r=void 0===n?20:n,c=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},c),React.createElement("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))},s=React.createElement(u,null),l=n(121),f=n(0);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=s;break;case"no-alt":t=l.a}return t?Object(f.cloneElement)(t,{size:e.size||20,className:e.className}):null}},function(e,t){!function(){e.exports=this.wc.wcSharedContext}()},,function(e,t){e.exports=function(e){if(Array.isArray(e))return e}},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,c=void 0;try{for(var i,a=e[Symbol.iterator]();!(r=(i=a.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,c=e}finally{try{r||null==a.return||a.return()}finally{if(o)throw c}}return n}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},,function(e,t,n){"use strict";var r=n(20),o=n(9),c=n(27),i=n(0),a=n(66),u=n(51);t.a=function(e){var t=e.icon,n=void 0===t?null:t,s=e.size,l=Object(c.a)(e,["icon","size"]),f=s||20;if("string"==typeof n)return Object(i.createElement)(a.a,Object(o.a)({icon:n,size:f},l));if(n&&a.a===n.type)return Object(i.cloneElement)(n,Object(r.a)({size:f},l));var p=s||24;if("function"==typeof n)return n.prototype instanceof i.Component?Object(i.createElement)(n,Object(r.a)({size:p},l)):n(Object(r.a)({size:p},l));if(n&&("svg"===n.type||n.type===u.a)){var d=Object(r.a)({width:p,height:p},n.props,l);return Object(i.createElement)(u.a,d)}return Object(i.isValidElement)(n)?Object(i.cloneElement)(n,Object(r.a)({size:p},l)):n}},function(e,t,n){"use strict";var r=n(20),o=n(27),c=n(5),i=n.n(c),a=n(0);t.a=Object(a.forwardRef)((function(e,t){var n=e.href,c=e.target,u=e.isPrimary,s=e.isLarge,l=e.isSmall,f=e.isTertiary,p=e.isToggled,d=e.isBusy,m=e.isDefault,b=e.isLink,h=e.isDestructive,g=e.className,v=e.disabled,y=Object(o.a)(e,["href","target","isPrimary","isLarge","isSmall","isTertiary","isToggled","isBusy","isDefault","isLink","isDestructive","className","disabled"]),O=i()("components-button",g,{"is-button":m||u||s||l,"is-default":m||!u&&(s||l),"is-primary":u,"is-large":s,"is-small":l,"is-tertiary":f,"is-toggled":p,"is-busy":d,"is-link":b,"is-destructive":h}),j=void 0===n||v?"button":"a",w="a"===j?{href:n,target:c}:{type:"button",disabled:v};return Object(a.createElement)(j,Object(r.a)({},w,y,{className:O,ref:t}))}))},,function(e,t){!function(){e.exports=this.wp.autop}()},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(6),o=n.n(r),c=n(113),i=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var s=function(){var e=Object(c.b)(),t=e.notices,n=e.createNotice,r=e.removeNotice,o=e.createSnackbarNotice,a=e.setIsSuppressed,s=Object(i.useRef)(t);Object(i.useEffect)((function(){s.current=t}),[t]);var l=Object(i.useMemo)((function(){return{hasNoticesOfType:function(e){return s.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;s.current.map((function(t){return null!==e&&t.status!==e||r(t.id),!0}))},removeNotice:r}}),[r]),f=Object(i.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",e,u({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",e,u({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",e,u({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",e,u({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",e,u({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(e,t)}}}),[n,o]);return u(u(u({notices:t},l),f),{},{setIsSuppressed:a})}},,function(e,t){!function(){e.exports=this.wp.deprecated}()},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(10),o=n.n(r),c=n(0),i=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return function(e){return t((function(){throw e}))}}},,,,,,,,,function(e,t){!function(){e.exports=this.wp.wordcount}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return d}));var r=n(10),o=n.n(r),c=n(14),i=n(13),a=n(0),u=n(58),s=n(7),l=n(37),f=function(e){var t=Object(u.a)();e=e||t;var n=Object(i.useSelect)((function(t){return t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),r=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[n,Object(a.useCallback)((function(t){r(e,t)}),[e])]},p=function(e,t,n){var r=Object(u.a)();n=n||r;var o=Object(i.useSelect)((function(r){return r(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)}),[n,e]),s=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(a.useCallback)((function(t){s(n,e,t)}),[n,e])]},d=function(e,t){var n=Object(u.a)(),r=f(t=t||n),c=o()(r,2),i=c[0],p=c[1],d=Object(l.a)(e),m=Object(a.useRef)(!1);return Object(a.useEffect)((function(){p(Object(s.assign)({},i,d)),m.current=!0}),[d]),m.current?[i,p]:[e,p]}},function(e,t,n){"use strict";var r=n(9),o=n(0),c=n(7);var i=function(e,t){return function(n){var r=e(n),o=n.displayName,i=void 0===o?n.name||"Component":o;return r.displayName="".concat(Object(c.upperFirst)(Object(c.camelCase)(t)),"(").concat(i,")"),r}},a=new WeakMap;function u(e){return Object(o.useMemo)((function(){return function(e){var t=a.get(e)||0;return a.set(e,t+1),t}(e)}),[e])}t.a=i((function(e){return function(t){var n=u(e);return Object(o.createElement)(e,Object(r.a)({},t,{instanceId:n}))}}),"withInstanceId")},,function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(30),i=n.n(c),a=n(31),u=n.n(a),s=n(18),l=n.n(s),f=n(32),p=n.n(f),d=n(33),m=n.n(d),b=n(19),h=n.n(b),g=n(6),v=n.n(g),y=n(3);n(123);function O(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=h()(e);if(t){var o=h()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return m()(this,n)}}t.a=function(e){var t=function(t){p()(r,t);var n=O(r);function r(){var e;return i()(this,r),e=n.call(this),v()(l()(e),"scrollToTopIfNeeded",(function(){var t=e.scrollPointRef.current.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollPointRef.current.scrollIntoView()})),v()(l()(e),"moveFocusToTop",(function(t){var n=e.scrollPointRef.current.parentElement.querySelectorAll(t);n.length&&n[0].focus()})),v()(l()(e),"scrollToTop",(function(t){window&&Number.isFinite(window.innerHeight)&&(e.scrollToTopIfNeeded(),t&&t.focusableSelector&&e.moveFocusToTop(t.focusableSelector))})),e.scrollPointRef=Object(y.createRef)(),e}return u()(r,[{key:"render",value:function(){return React.createElement(y.Fragment,null,React.createElement("div",{className:"with-scroll-to-top__scroll-point",ref:this.scrollPointRef,"aria-hidden":!0}),React.createElement(e,o()({},this.props,{scrollToTop:this.scrollToTop})))}}]),r}(y.Component);return t.displayName="withScrollToTop",t}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return m}));var r=n(11),o=n.n(r),c=n(6),i=n.n(c),a=n(0),u=n(44);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){i()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var f=[".wp-block-woocommerce-cart"],p=function(e){var t=e.Block,n=e.containers,r=e.getProps,c=void 0===r?function(){}:r,i=e.getErrorBoundaryProps,s=void 0===i?function(){}:i;0!==n.length&&Array.prototype.forEach.call(n,(function(e,n){var r=c(e,n),i=s(e,n),f=l(l({},e.dataset),r.attributes);e.classList.remove("is-loading"),Object(a.render)(React.createElement(u.a,i,React.createElement(a.Suspense,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},r,{attributes:f})))),e)}))},d=function(e){var t=e.Block,n=e.getProps,r=e.getErrorBoundaryProps,o=e.selector,c=e.wrappers,i=document.body.querySelectorAll(o);c.length>0&&Array.prototype.filter.call(i,(function(e){return!function(e,t){return Array.prototype.some.call(t,(function(t){return t.contains(e)&&!t.isSameNode(e)}))}(e,c)})),p({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})},m=function(e){var t=document.body.querySelectorAll(f.join(","));d(l(l({},e),{},{wrappers:t})),Array.prototype.forEach.call(t,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var n,r,o,c,i,a;n=l(l({},e),{},{wrapper:t}),r=n.Block,o=n.getProps,c=n.getErrorBoundaryProps,i=n.selector,a=n.wrapper.querySelectorAll(i),p({Block:r,containers:a,getProps:o,getErrorBoundaryProps:c})}))}))}},function(e,t){},function(e,t){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(14),o=n(13),c=n(0),i=n(85),a=n(37),u=function(e){var t=e.namespace,n=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,f=void 0===l?{}:l,p=e.shouldSelect,d=void 0===p||p;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");var m=Object(c.useRef)({results:[],isLoading:!0}),b=Object(a.a)(f),h=Object(a.a)(s),g=Object(i.a)(),v=Object(o.useSelect)((function(e){if(!d)return null;var o=e(r.COLLECTIONS_STORE_KEY),c=[t,n,b,h],i=o.getCollectionError.apply(o,c);return i&&g(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,n,h,b,d]);return null!==v&&(m.current=v),m.current}},,,function(e,t,n){"use strict";n.d(t,"b",(function(){return M})),n.d(t,"a",(function(){return I}));var r=n(6),o=n.n(r),c=n(10),i=n.n(c),a=(n(4),n(0)),u=n(13),s=n(11),l=n.n(s),f=n(5),p=n.n(f),d=n(167),m=(n(104),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),b=function(e){var t=e.className,n=e.notices,r=M().removeNotice,o=p()(t,"wc-block-components-notices"),c=n.filter((function(e){return"snackbar"!==e.type}));return c.length?React.createElement("div",{className:o},c.map((function(e){return React.createElement(d.a,l()({key:"store-notice-"+e.id},e,{className:p()("wc-block-components-notices__notice","woocommerce-message",m(e)),onRemove:function(){e.isDismissible&&r(e.id)}}),e.content)}))):null},h=n(9),g=n(23),v=n.n(g);function y(e,t,n,r,o,c,i){try{var a=e[c](i),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var c=e.apply(t,n);function i(e){y(c,r,o,i,a,"next",e)}function a(e){y(c,r,o,i,a,"throw",e)}i(void 0)}))}}var j=n(25),w=n(7),k=n(65),E=n(26),S=n(1),_=n(74);var x=Object(a.forwardRef)((function(e,t){var n=e.className,r=e.children,o=e.actions,c=void 0===o?[]:o,i=e.onRemove,u=void 0===i?w.noop:i;Object(a.useEffect)((function(){var e=setTimeout((function(){u()}),1e4);return function(){return clearTimeout(e)}}),[]);var s=p()(n,"components-snackbar");return c&&c.length>1&&(console.warn("Snackbar can only have 1 action, use Notice if your message require many messages"),c=[c[0]]),Object(a.createElement)("div",{ref:t,className:s,onClick:u,tabIndex:"0",role:"button",onKeyPress:u,label:Object(S.__)("Dismiss this notice")},Object(a.createElement)("div",{className:"components-snackbar__content"},r,c.map((function(e,t){var n=e.label,r=e.onClick,o=e.url;return Object(a.createElement)(_.a,{key:t,href:o,isTertiary:!0,onClick:function(e){e.stopPropagation(),r&&r(e)},className:"components-snackbar__action"},n)}))))}));var R=function(e){var t=e.notices,n=e.className,r=e.children,o=e.onRemove,c=void 0===o?w.noop:o,i=Object(E.useReducedMotion)(),u=Object(a.useState)((function(){return new WeakMap})),s=Object(j.a)(u,1)[0],l=Object(k.useTransition)(t,(function(e){return e.id}),{from:{opacity:0,height:0},enter:function(e){return function(){var t=O(v.a.mark((function t(n){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n({opacity:1,height:s.get(e).offsetHeight});case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()},leave:function(){return function(){var e=O(v.a.mark((function e(t){return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({opacity:0});case 2:return e.next=4,t({height:0});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},immediate:i});n=p()("components-snackbar-list",n);var f=function(e){return function(){return c(e.id)}};return Object(a.createElement)("div",{className:n},r,l.map((function(e){var t=e.item,n=e.key,r=e.props;return Object(a.createElement)(k.animated.div,{key:n,style:r},Object(a.createElement)("div",{className:"components-snackbar-list__notice-container",ref:function(e){return e&&s.set(t,e)}},Object(a.createElement)(x,Object(h.a)({},Object(w.omit)(t,["content"]),{onRemove:f(t)}),t.content)))})))},P=n(79),C=n(132),N=function(){var e=Object(C.a)().isEditor,t=Object(P.a)(),n=t.notices,r=t.removeNotice,o=n.filter((function(e){return"snackbar"===e.type}));return e?null:React.createElement(R,{notices:o,className:"wc-block-components-notices__snackbar",onRemove:r})};function T(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?T(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):T(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F=Object(a.createContext)({notices:[],createNotice:function(e,t,n){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),M=function(){return Object(a.useContext)(F)},I=function(e){var t=e.children,n=e.className,r=void 0===n?"":n,o=e.createNoticeContainer,c=void 0===o||o,s=e.context,l=void 0===s?"wc/core":s,f=Object(u.useDispatch)("core/notices"),p=f.createNotice,d=f.removeNotice,m=Object(a.useState)(!1),h=i()(m,2),g=h[0],v=h[1],y=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};p(e,t,A(A({},n),{},{context:n.context||l}))}),[p,l]),O=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;d(e,t)}),[d,l]),j=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y("default",e,A(A({},t),{},{type:"snackbar"}))}),[y]),w={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(l)}}),[l]).notices,createNotice:y,createSnackbarNotice:j,removeNotice:O,context:l,setIsSuppressed:v},k=g?null:React.createElement(b,{className:r,notices:w.notices}),E=g?null:React.createElement(N,null);return React.createElement(F.Provider,{value:w},c&&k,t,E)}},,,,,,,,function(e,t,n){"use strict";var r=n(11),o=n.n(r),c=n(15),i=n.n(c),a=n(51),u=function(e){var t=e.className,n=e.size,r=i()(e,["className","size"]);return React.createElement(a.a,o()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),React.createElement("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))},s=React.createElement(u,null);t.a=s},function(e,t,n){"use strict";var r=n(6),o=n.n(r),c=n(15),i=n.n(c),a=n(3);n(4);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}t.a=function(e){var t=e.srcElement,n=e.size,r=void 0===n?24:n,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){o()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({width:r,height:r},c))}},function(e,t){},function(e,t,n){"use strict";var r=n(0),o=n(2),c=n(14),i=n(13);t.a=function(e){return function(t){var n;return n=Object(r.useRef)(Object(o.getSetting)("restApiRoutes")),Object(i.useSelect)((function(e,t){if(n.current){var r=e(c.SCHEMA_STORE_KEY),o=r.isResolving,i=r.hasFinishedResolution,a=t.dispatch(c.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(n.current).forEach((function(e){var t=n.current[e];o("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},,,,,,function(e,t,n){"use strict";n(4);var r=n(5),o=n.n(r),c=n(29),i=n(97);n(147);t.a=Object(i.a)((function(e){var t=e.className,n=e.instanceId,r=e.defaultValue,i=e.label,a=e.onChange,u=e.options,s=e.screenReaderLabel,l=e.readOnly,f=e.value,p="wc-block-components-sort-select__select-".concat(n);return React.createElement("div",{className:o()("wc-block-sort-select","wc-block-components-sort-select",t)},React.createElement(c.a,{label:i,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),React.createElement("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:r,onChange:a,readOnly:l,value:f},u.map((function(e){return React.createElement("option",{key:e.key,value:e.key},e.label)}))))}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=(n(13),Object(r.createContext)({isEditor:!1,currentPostId:0,previewData:{}})),c=function(){return Object(r.useContext)(o)}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(35),o=n(0),c=n(8);n.p=c.D,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)((function(){return Promise.all([n.e(20),n.e(6)]).then(n.bind(null,292))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)((function(){return n.e(5).then(n.bind(null,302))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)((function(){return n.e(13).then(n.bind(null,301))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return n.e(7).then(n.bind(null,293))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)((function(){return n.e(3).then(n.bind(null,294))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return n.e(11).then(n.bind(null,295))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return n.e(8).then(n.bind(null,278))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return n.e(9).then(n.bind(null,296))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return n.e(4).then(n.bind(null,297))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return n.e(12).then(n.bind(null,298))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return n.e(10).then(n.bind(null,299))}))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)((function(){return n.e(2).then(n.bind(null,300))}))});var i=function(e){return Object(r.getRegisteredBlockComponents)(e)}},,,,,,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(7),c=n(5),i=n.n(c),a=n(1),u=n(74),s=n(9),l=n(27);function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function d(e,t,n){return t&&p(e.prototype,t),n&&p(e,n),e}var m=n(63),b=n(12);function h(e,t){return!t||"object"!==Object(m.a)(t)&&"function"!=typeof t?Object(b.a)(e):t}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}var O=n(25),j=n(46),w=n(47),k=n(81),E=n.n(k),S=n(26),_=n(20),x=function(){return"rtl"===document.documentElement.dir};function R(e,t,n,r){var o=t.width;"left"===n&&x()?n="right":"right"===n&&x()&&(n="left");var c,i=Math.round(e.left+e.width/2),a={popoverLeft:i,contentWidth:(i-o/2>0?o/2:i)+(i+o/2>window.innerWidth?window.innerWidth-i:o/2)},u="middle"===r?e.left:i,s={popoverLeft:u,contentWidth:u-o>0?o:u},l="middle"===r?e.right:i,f={popoverLeft:l,contentWidth:l+o>window.innerWidth?window.innerWidth-l:o},p=null;if("center"===n&&a.contentWidth===o)c="center";else if("left"===n&&s.contentWidth===o)c="left";else if("right"===n&&f.contentWidth===o)c="right";else{var d="left"===(c=s.contentWidth>f.contentWidth?"left":"right")?s.contentWidth:f.contentWidth;p=d!==o?d:null}return{xAxis:c,popoverLeft:"center"===c?a.popoverLeft:"left"===c?s.popoverLeft:f.popoverLeft,contentWidth:p}}function P(e,t,n){var r,o=t.height,c=e.top+e.height/2,i={popoverTop:c,contentHeight:(c-o/2>0?o/2:c)+(c+o/2>window.innerHeight?window.innerHeight-c:o/2)},a={popoverTop:e.top,contentHeight:e.top-10-o>0?o:e.top-10},u={popoverTop:e.bottom,contentHeight:e.bottom+10+o>window.innerHeight?window.innerHeight-10-e.bottom:o},s=null;if("middle"===n&&i.contentHeight===o)r="middle";else if("top"===n&&a.contentHeight===o)r="top";else if("bottom"===n&&u.contentHeight===o)r="bottom";else{var l="top"===(r=a.contentHeight>u.contentHeight?"top":"bottom")?a.contentHeight:u.contentHeight;s=l!==o?l:null}return{yAxis:r,popoverTop:"middle"===r?i.popoverTop:"top"===r?a.popoverTop:u.popoverTop,contentHeight:s}}var C=n(34),N=Object(r.createContext)({focusHistory:[]}),T=N.Provider,A=N.Consumer;T.displayName="FocusReturnProvider",A.displayName="FocusReturnConsumer";r.Component;var F=Object(S.createHigherOrderComponent)((function e(t){if((c=t)instanceof r.Component||"function"==typeof c){var n=t;return e({})(n)}var c,i=t.onFocusReturn,a=void 0===i?o.stubTrue:i;return function(e){var t=function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).ownFocusedElements=new Set,e.activeElementOnMount=document.activeElement,e.setIsFocusedFalse=function(){return e.isFocused=!1},e.setIsFocusedTrue=function(t){e.ownFocusedElements.add(t.target),e.isFocused=!0},e}return y(n,t),d(n,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,n=this.ownFocusedElements;if(t&&!1!==a())for(var r,c=[].concat(Object(C.a)(o.without.apply(void 0,[this.props.focus.focusHistory].concat(Object(C.a)(n)))),[e]);r=c.pop();)if(document.body.contains(r))return void r.focus()}},{key:"render",value:function(){return Object(r.createElement)("div",{onFocus:this.setIsFocusedTrue,onBlur:this.setIsFocusedFalse},Object(r.createElement)(e,this.props.childProps))}}]),n}(r.Component);return function(e){return Object(r.createElement)(A,null,(function(n){return Object(r.createElement)(t,{childProps:e,focus:n})}))}}}),"withFocusReturn"),M=Object(S.createHigherOrderComponent)((function(e){return function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).focusContainRef=Object(r.createRef)(),e.handleTabBehaviour=e.handleTabBehaviour.bind(Object(b.a)(e)),e}return y(n,t),d(n,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===w.TAB){var t=j.focus.tabbable.find(this.focusContainRef.current);if(t.length){var n=t[0],r=t[t.length-1];e.shiftKey&&e.target===n?(e.preventDefault(),r.focus()):(e.shiftKey||e.target!==r)&&t.includes(e.target)||(e.preventDefault(),n.focus())}}}},{key:"render",value:function(){return Object(r.createElement)("div",{onKeyDown:this.handleTabBehaviour,ref:this.focusContainRef,tabIndex:"-1"},Object(r.createElement)(e,this.props))}}]),n}(r.Component)}),"withConstrainedTabbing"),I=["button","submit"];var B=Object(S.createHigherOrderComponent)((function(e){return function(t){function n(){var e;return f(this,n),(e=h(this,g(n).apply(this,arguments))).bindNode=e.bindNode.bind(Object(b.a)(e)),e.cancelBlurCheck=e.cancelBlurCheck.bind(Object(b.a)(e)),e.queueBlurCheck=e.queueBlurCheck.bind(Object(b.a)(e)),e.normalizeButtonFocus=e.normalizeButtonFocus.bind(Object(b.a)(e)),e}return y(n,t),d(n,[{key:"componentWillUnmount",value:function(){this.cancelBlurCheck()}},{key:"bindNode",value:function(e){e?this.node=e:(delete this.node,this.cancelBlurCheck())}},{key:"queueBlurCheck",value:function(e){var t=this;e.persist(),this.preventBlurCheck||(this.blurCheckTimeout=setTimeout((function(){document.hasFocus()?"function"==typeof t.node.handleFocusOutside&&t.node.handleFocusOutside(e):e.preventDefault()}),0))}},{key:"cancelBlurCheck",value:function(){clearTimeout(this.blurCheckTimeout)}},{key:"normalizeButtonFocus",value:function(e){var t=e.type,n=e.target;Object(o.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return Object(o.includes)(I,e.type)}return!1}(n)&&(this.preventBlurCheck=!0)}},{key:"render",value:function(){return Object(r.createElement)("div",{onFocus:this.cancelBlurCheck,onMouseDown:this.normalizeButtonFocus,onMouseUp:this.normalizeButtonFocus,onTouchStart:this.normalizeButtonFocus,onTouchEnd:this.normalizeButtonFocus,onBlur:this.queueBlurCheck},Object(r.createElement)(e,Object(s.a)({ref:this.bindNode},this.props)))}}]),n}(r.Component)}),"withFocusOutside")(function(e){function t(){return f(this,t),h(this,g(t).apply(this,arguments))}return y(t,e),d(t,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),t}(r.Component));var D=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.htmlDocument,n=void 0===t?document:t,o=e.className,c=void 0===o?"lockscroll":o,i=0,a=0;function u(e){var t=n.scrollingElement||n.body;e&&(a=t.scrollTop);var r=e?"add":"remove";t.classList[r](c),n.documentElement.classList[r](c),e||(t.scrollTop=a)}function s(){0===i&&u(!0),++i}function l(){1===i&&u(!1),--i}return function(e){function t(){return f(this,t),h(this,g(t).apply(this,arguments))}return y(t,e),d(t,[{key:"componentDidMount",value:function(){s()}},{key:"componentWillUnmount",value:function(){l()}},{key:"render",value:function(){return null}}]),t}(r.Component)}();function L(e){e.stopPropagation()}var V=Object(r.forwardRef)((function(e,t){var n=e.children,o=Object(l.a)(e,["children"]);return Object(r.createElement)("div",Object(s.a)({},o,{ref:t,onMouseDown:L}),n)})),z=Object(r.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),q=z.Provider,H=z.Consumer,W=(r.Component,0);function U(e){var t=e.name,n=e.children,c=e.registerFill,i=e.unregisterFill,a=function(e){var t=Object(r.useContext)(z),n=t.getSlot,o=t.subscribe,c=Object(r.useState)(n(e)),i=Object(O.a)(c,2),a=i[0],u=i[1];return Object(r.useEffect)((function(){return u(n(e)),o((function(){u(n(e))}))}),[e]),a}(t),u=Object(r.useRef)({name:t,children:n});return u.current.occurrence||(u.current.occurrence=++W),Object(r.useLayoutEffect)((function(){return c(t,u.current),function(){return i(t,u.current)}}),[]),Object(r.useLayoutEffect)((function(){u.current.children=n,a&&!a.props.bubblesVirtually&&a.forceUpdate()}),[n]),Object(r.useLayoutEffect)((function(){t!==u.current.name&&(i(u.current.name,u.current),u.current.name=t,c(t,u.current))}),[t]),a&&a.node&&a.props.bubblesVirtually?(Object(o.isFunction)(n)&&(n=n(a.props.fillProps)),Object(r.createPortal)(n,a.node)):null}var K=function(e){return Object(r.createElement)(H,null,(function(t){var n=t.registerFill,o=t.unregisterFill;return Object(r.createElement)(U,Object(s.a)({},e,{registerFill:n,unregisterFill:o}))}))},Q=function(e){function t(){var e;return f(this,t),(e=h(this,g(t).apply(this,arguments))).bindNode=e.bindNode.bind(Object(b.a)(e)),e}return y(t,e),d(t,[{key:"componentDidMount",value:function(){(0,this.props.registerSlot)(this.props.name,this)}},{key:"componentWillUnmount",value:function(){(0,this.props.unregisterSlot)(this.props.name,this)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.name,r=t.unregisterSlot,o=t.registerSlot;e.name!==n&&(r(e.name),o(n,this))}},{key:"bindNode",value:function(e){this.node=e}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.name,c=e.bubblesVirtually,i=void 0!==c&&c,a=e.fillProps,u=void 0===a?{}:a,s=e.getFills,l=e.className;if(i)return Object(r.createElement)("div",{ref:this.bindNode,className:l});var f=Object(o.map)(s(n,this),(function(e){var t=e.occurrence,n=Object(o.isFunction)(e.children)?e.children(u):e.children;return r.Children.map(n,(function(e,n){if(!e||Object(o.isString)(e))return e;var c="".concat(t,"---").concat(e.key||n);return Object(r.cloneElement)(e,{key:c})}))})).filter(Object(o.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(o.isFunction)(t)?t(f):f)}}]),t}(r.Component),Y=function(e){return Object(r.createElement)(H,null,(function(t){var n=t.registerSlot,o=t.unregisterSlot,c=t.getFills;return Object(r.createElement)(Q,Object(s.a)({},e,{registerSlot:n,unregisterSlot:o,getFills:c}))}))},G=n(40);var $=function(e){var t=e.type,n=e.options,r=void 0===n?{}:n,o=e.children;if("appear"===t){var c,a=r.origin,u=(void 0===a?"top":a).split(" "),s=Object(O.a)(u,2),l=s[0],f=s[1],p=void 0===f?"center":f;return o({className:i()("components-animate__appear",(c={},Object(G.a)(c,"is-from-"+p,"center"!==p),Object(G.a)(c,"is-from-"+l,"middle"!==l),c))})}if("slide-in"===t){var d=r.origin,m=void 0===d?"left":d;return o({className:i()("components-animate__slide-in","is-from-"+m)})}return o("loading"===t?{className:i()("components-animate__loading")}:{})},J=M(F((function(e){return e.children})));function Z(e,t){var n=window.getComputedStyle(t),r=n.paddingTop,o=n.paddingBottom,c=n.paddingLeft,i=n.paddingRight,a=r?parseInt(r,10):0,u=o?parseInt(o,10):0,s=c?parseInt(c,10):0,l=i?parseInt(i,10):0;return{x:e.left+s,y:e.top+a,width:e.width-s-l,height:e.height-a-u,left:e.left+s,right:e.right-l,top:e.top+a,bottom:e.bottom-u}}function X(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function ee(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==n&&(e.style[t]=n)}function te(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var ne=function(e){var t=e.headerTitle,n=e.onClose,o=e.onKeyDown,c=e.children,a=e.className,u=e.noArrow,f=void 0!==u&&u,p=e.position,d=void 0===p?"top":p,m=(e.range,e.focusOnMount),b=void 0===m?"firstElement":m,h=e.anchorRef,g=e.shouldAnchorIncludePadding,v=e.anchorVerticalBuffer,y=e.anchorHorizontalBuffer,k=e.anchorRect,x=e.getAnchorRect,C=e.expandOnMobile,N=e.animate,T=void 0===N||N,A=e.onClickOutside,F=e.onFocusOutside,M=Object(l.a)(e,["headerTitle","onClose","onKeyDown","children","className","noArrow","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorVerticalBuffer","anchorHorizontalBuffer","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside"]),I=Object(r.useRef)(null),L=Object(r.useRef)(null),z=Object(r.useRef)(),q=Object(r.useRef)(),W=Object(S.useViewportMatch)("medium","<"),U=Object(r.useState)(),Q=Object(O.a)(U,2),Y=Q[0],G=Q[1],ne=C&&W;f=ne||f,Object(r.useEffect)((function(){var e=z.current,t=L.current;if(ne)return te(e,"is-without-arrow",f),X(e,"data-x-axis"),X(e,"data-y-axis"),ee(e,"top"),ee(e,"left"),ee(t,"maxHeight"),void ee(t,"maxWidth");var n=function(){var n=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(t)return t;if(n){if(!e.current)return;return n(e.current)}if(!1!==r){if(!r)return;if(r instanceof window.Range)return Object(j.getRectangleFromRange)(r);var c=r.getBoundingClientRect();return o?c:Z(c,r)}if(e.current){var i=e.current.parentNode,a=i.getBoundingClientRect();return o?a:Z(a,i)}}(I,k,x,h,g);if(n){n=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{x:e.left-n,y:e.top-t,width:e.width+2*n,height:e.height+2*t,left:e.left-n,right:e.right+n,top:e.top-t,bottom:e.bottom+t}}(n,v,y),q.current||(q.current=t.getBoundingClientRect());var r=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",r=n.split(" "),o=Object(O.a)(r,2),c=o[0],i=o[1],a=void 0===i?"center":i,u=P(e,t,c),s=R(e,t,a,u.yAxis);return Object(_.a)({},s,u)}(n,q.current,d),o=r.popoverTop,c=r.popoverLeft,i=r.xAxis,a=r.yAxis,u=r.contentHeight,s=r.contentWidth;te(e,"is-without-arrow",f||"center"===i&&"middle"===a),X(e,"data-x-axis",i),X(e,"data-y-axis",a),ee(e,"top","number"==typeof o?o+"px":""),ee(e,"left","number"==typeof c?c+"px":""),ee(t,"maxHeight","number"==typeof u?u+"px":""),ee(t,"maxWidth","number"==typeof s?s+"px":"");G(({left:"right",right:"left"}[i]||"center")+" "+({top:"bottom",bottom:"top"}[a]||"middle"))}},r=window.setTimeout(n),o=window.setInterval(n,500);return window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),function(){window.clearTimeout(r),window.clearInterval(o),window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}}),[ne,k,x,h,g,v,y,d]),function(e,t){Object(r.useEffect)((function(){var n=setTimeout((function(){if(e&&t.current)if("firstElement"!==e)"container"===e&&t.current.focus();else{var n=j.focus.tabbable.find(t.current)[0];n?n.focus():t.current.focus()}}),0);return function(){return clearTimeout(n)}}),[])}(b,L);var re=function(e){e.keyCode===w.ESCAPE&&n&&(e.stopPropagation(),n()),o&&o(e)};var oe=Object(r.createElement)(B,{onFocusOutside:function(e){if(F)F(e);else if(A){var t;try{t=new window.MouseEvent("click")}catch(e){(t=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null)}Object.defineProperty(t,"target",{get:function(){return e.relatedTarget}}),E()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),A(t)}else n&&n()}},Object(r.createElement)($,{type:T&&Y?"appear":null,options:{origin:Y}},(function(e){var o=e.className;return Object(r.createElement)(V,Object(s.a)({className:i()("components-popover",a,o,{"is-expanded":ne,"is-without-arrow":f})},M,{onKeyDown:re,ref:z}),ne&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},t),Object(r.createElement)(ae,{className:"components-popover__close",icon:"no-alt",onClick:n})),Object(r.createElement)("div",{ref:L,className:"components-popover__content",tabIndex:"-1"},c))})));return b&&(oe=Object(r.createElement)(J,null,oe)),Object(r.createElement)(H,null,(function(e){var t=e.getSlot;return t&&t("Popover")&&(oe=Object(r.createElement)(K,{name:"Popover"},oe)),Object(r.createElement)("span",{ref:I},oe,W&&C&&Object(r.createElement)(D,null))}))};ne.Slot=function(){return Object(r.createElement)(Y,{bubblesVirtually:!0,name:"Popover"})};var re=ne;var oe=function(e){var t,n,c=e.shortcut,i=e.className;return c?(Object(o.isString)(c)&&(t=c),Object(o.isObject)(c)&&(t=c.display,n=c.ariaLabel),Object(r.createElement)("span",{className:i,"aria-label":n},t)):null},ce=function(e){function t(){var e;return f(this,t),(e=h(this,g(t).apply(this,arguments))).delayedSetIsOver=Object(o.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return y(t,e),d(t,[{key:"componentWillUnmount",value:function(){this.delayedSetIsOver.cancel(),document.removeEventListener("mouseup",this.cancelIsMouseDown)}},{key:"emitToChild",value:function(e,t){var n=this.props.children;if(1===r.Children.count(n)){var o=r.Children.only(n);"function"==typeof o.props[e]&&o.props[e](t)}}},{key:"createToggleIsOver",value:function(e,t){var n=this;return function(r){if(n.emitToChild(e,r),!(r.currentTarget.disabled||"focus"===r.type&&n.isInMouseDown)){n.delayedSetIsOver.cancel();var c=Object(o.includes)(["focus","mouseenter"],r.type);c!==n.state.isOver&&(t?n.delayedSetIsOver(c):n.setState({isOver:c}))}}}},{key:"createSetIsMouseDown",value:function(e){var t=this;return function(n){t.emitToChild(e?"onMouseDown":"onMouseUp",n),document[e?"addEventListener":"removeEventListener"]("mouseup",t.cancelIsMouseDown),t.isInMouseDown=e}}},{key:"render",value:function(){var e=this.props,t=e.children,n=e.position,o=e.text,c=e.shortcut;if(1!==r.Children.count(t))return t;var i=r.Children.only(t),a=this.state.isOver;return Object(r.cloneElement)(i,{onMouseEnter:this.createToggleIsOver("onMouseEnter",!0),onMouseLeave:this.createToggleIsOver("onMouseLeave"),onClick:this.createToggleIsOver("onClick"),onFocus:this.createToggleIsOver("onFocus"),onBlur:this.createToggleIsOver("onBlur"),onMouseDown:this.createSetIsMouseDown(!0),children:Object(r.concatChildren)(i.props.children,a&&Object(r.createElement)(re,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1},o,Object(r.createElement)(oe,{className:"components-tooltip__shortcut",shortcut:c})))})}}]),t}(r.Component),ie=n(73);var ae=Object(r.forwardRef)((function(e,t){var n=e.icon,c=e.children,a=e.label,f=e.className,p=e.tooltip,d=e.shortcut,m=e.labelPosition,b=e.size,h=Object(l.a)(e,["icon","children","label","className","tooltip","shortcut","labelPosition","size"]),g=i()("components-icon-button",f,{"has-text":c}),v=p||a,y=!h.disabled&&(p||d||!!a&&(!c||Object(o.isArray)(c)&&!c.length)&&!1!==p),O=Object(r.createElement)(u.a,Object(s.a)({"aria-label":a},h,{className:g,ref:t}),Object(r.createElement)(ie.a,{icon:n,size:b}),c);return y&&(O=Object(r.createElement)(ce,{text:v,shortcut:d,position:m},O)),O}));t.a=function(e){var t=e.className,n=e.status,c=e.children,s=e.onRemove,l=void 0===s?o.noop:s,f=e.isDismissible,p=void 0===f||f,d=e.actions,m=void 0===d?[]:d,b=e.__unstableHTML,h=i()(t,"components-notice","is-"+n,{"is-dismissible":p});return b&&(c=Object(r.createElement)(r.RawHTML,null,c)),Object(r.createElement)("div",{className:h},Object(r.createElement)("div",{className:"components-notice__content"},c,m.map((function(e,t){var n=e.className,o=e.label,c=e.noDefaultClasses,a=void 0!==c&&c,s=e.onClick,l=e.url;return Object(r.createElement)(u.a,{key:t,href:l,isDefault:!a&&!l,isLink:!a&&!!l,onClick:l?void 0:s,className:i()("components-notice__action",n)},o)}))),p&&Object(r.createElement)(ae,{className:"components-notice__dismiss",icon:"no-alt",label:Object(a.__)("Dismiss this notice"),onClick:l,tooltip:!1}))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3),o=function(e,t){var n=Object(r.useRef)();return Object(r.useEffect)((function(){n.current===e||t&&!t(e,n.current)||(n.current=e)}),[e,n.current]),n.current}},,,,,function(e,t){!function(){e.exports=this.wc.wcSharedHocs}()},function(e,t){!function(){e.exports=this.wp.blockEditor}()},function(e,t){!function(){e.exports=this.wp.components}()},,,,,,,,,,,,,function(e,t,n){e.exports=n(258)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(124),o=n(113),c=n(103),i=n(30),a=n.n(i),u=n(31),s=n.n(u),l=n(32),f=n.n(l),p=n(33),d=n.n(p),m=n(19),b=n.n(m),h=n(3),g=(n(4),n(10)),v=n.n(g),y=n(0),O=n(22),j=n.n(O),w=n(15),k=n.n(w),E=n(6),S=n.n(E),_=n(1),x=n(7),R=n(5),P=n.n(R),C=n(29),N=(n(197),function(e){var t=e.currentPage,n=e.displayFirstAndLastPages,r=e.displayNextAndPreviousArrows,o=e.pagesToDisplay,c=e.onPageChange,i=e.totalPages,a=function(e,t,n){if(n<=2)return{minIndex:null,maxIndex:null};var r=e-1,o=Math.max(Math.floor(t-r/2),2),c=Math.min(Math.ceil(t+(r-(t-o))),n-1);return{minIndex:Math.max(Math.floor(t-(r-(c-t))),2),maxIndex:c}}(o,t,i),u=a.minIndex,s=a.maxIndex,l=n&&Boolean(1!==u),f=n&&Boolean(s!==i),p=n&&Boolean(u>3),d=n&&Boolean(s<i-2);l&&3===u&&(u-=1),f&&s===i-2&&(s+=1);var m=[];if(u&&s)for(var b=u;b<=s;b++)m.push(b);return React.createElement("div",{className:"wc-block-pagination wc-block-components-pagination"},React.createElement(C.a,{screenReaderLabel:Object(_.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return c(t-1)},title:Object(_.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},React.createElement(C.a,{label:"<",screenReaderLabel:Object(_.__)("Previous page","woo-gutenberg-products-block")})),l&&React.createElement("button",{className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:function(){return c(1)},disabled:1===t},React.createElement(C.a,{label:1,screenReaderLabel:Object(_.sprintf)(Object(_.__)("Page %d","woo-gutenberg-products-block"),1)})),p&&React.createElement("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(_.__)("…","woo-gutenberg-products-block")),m.map((function(e){return React.createElement("button",{key:e,className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?null:function(){return c(e)},disabled:t===e},React.createElement(C.a,{label:e,screenReaderLabel:Object(_.sprintf)(Object(_.__)("Page %d","woo-gutenberg-products-block"),e)}))})),d&&React.createElement("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(_.__)("…","woo-gutenberg-products-block")),f&&React.createElement("button",{className:P()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===i,"wc-block-components-pagination__page--active":t===i}),onClick:function(){return c(i)},disabled:t===i},React.createElement(C.a,{label:i,screenReaderLabel:Object(_.sprintf)(Object(_.__)("Page %d","woo-gutenberg-products-block"),i)})),r&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return c(t+1)},title:Object(_.__)("Next page","woo-gutenberg-products-block"),disabled:t>=i},React.createElement(C.a,{label:">",screenReaderLabel:Object(_.__)("Next page","woo-gutenberg-products-block")})))});N.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var T=N,A=n(130),F=(n(196),function(e){var t=e.defaultValue,n=e.onChange,r=e.readOnly,o=e.value;return React.createElement(A.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",defaultValue:t,name:"orderby",onChange:n,options:[{key:"menu_order",label:Object(_.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(_.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(_.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(_.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(_.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(_.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(_.__)("Order products by","woo-gutenberg-products-block"),value:o})}),M=n(67),I=n(97),B=n(11),D=n.n(B),L=n(138),V=Object(I.a)((function(e){var t=e.product,n=e.attributes,r=e.instanceId,o=n.layoutConfig,c=Object(M.useInnerBlockLayoutContext)(),i=c.parentClassName,a=c.parentName,u=0===Object.keys(t).length,s=P()("".concat(i,"__product"),"wc-block-layout",{"is-loading":u});return React.createElement("li",{className:s,"aria-hidden":u},function e(t,n,r,o){if(r){var c=Object(L.a)(t);return r.map((function(r,i){var a=v()(r,2),u=a[0],s=a[1],l=void 0===s?{}:s,f=[];l.children&&l.children.length>0&&(f=e(t,n,l.children,o));var p=c[u];if(!p)return null;var d=n.id||0,m=["layout",u,i,o,d];return React.createElement(y.Suspense,{key:m.join("_"),fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(p,D()({},l,{children:f,product:n})))}))}}(a,t,o,r))})),z=n(96),q=n(110),H=n(14),W=n(13),U=n(37);function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach((function(t){S()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Y=function(e){var t={namespace:"/wc/store",resourceName:"products"},n=Object(q.a)(Q(Q({},t),{},{query:e})),r=n.results,o=n.isLoading,c=function(e,t){var n=t.namespace,r=t.resourceName,o=t.resourceValues,c=void 0===o?[]:o,i=t.query,a=void 0===i?{}:i;if(!n||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");var u=Object(U.a)(a),s=Object(U.a)(c),l=Object(W.useSelect)((function(t){var o=t(H.COLLECTIONS_STORE_KEY),c=[e,n,r,u,s];return{value:o.getCollectionHeader.apply(o,c),isLoading:o.hasFinishedResolution("getCollectionHeader",c)}}),[e,n,r,s,u]),f=l.value,p=l.isLoading;return{value:f,isLoading:void 0===p||p}}("x-wp-total",Q(Q({},t),{},{query:e})).value;return{products:r,totalProducts:parseInt(c,10),productsLoading:o}},G=n(174),$=n(99),J=n(42),Z=(n(195),n(122)),X=n(51),ee=React.createElement(X.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},React.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),te=function(){var e=Object(M.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(e,"__no-products")},React.createElement(Z.a,{className:"".concat(e,"__no-products-image"),alt:"",srcElement:ee,size:100}),React.createElement("strong",{className:"".concat(e,"__no-products-title")},Object(_.__)("No products","woo-gutenberg-products-block")),React.createElement("p",{className:"".concat(e,"__no-products-description")},Object(_.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},ne=React.createElement(X.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},React.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),React.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})),re=function(e){var t=e.resetCallback,n=void 0===t?function(){}:t,r=Object(M.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(r,"__no-products")},React.createElement(Z.a,{className:"".concat(r,"__no-products-image"),alt:"",srcElement:ne,size:100}),React.createElement("strong",{className:"".concat(r,"__no-products-title")},Object(_.__)("No products found","woo-gutenberg-products-block")),React.createElement("p",{className:"".concat(r,"__no-products-description")},Object(_.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),React.createElement("button",{onClick:n},Object(_.__)("Reset Search","woo-gutenberg-products-block")))};function oe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ce(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach((function(t){S()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var ie=Object($.a)((function(e){var t=e.attributes,n=e.currentPage,r=e.onPageChange,o=e.onSortChange,c=e.sortValue,i=e.scrollToTop,a=Object(z.c)(function(e){var t=e.sortValue,n=e.currentPage,r=e.attributes,o=r.columns,c=r.rows;return ce(ce({},function(e){switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}}(t)),{},{catalog_visibility:"catalog",per_page:o*c,page:n})}({attributes:t,sortValue:c,currentPage:n})),u=v()(a,1)[0],s=Y(u),l=s.products,f=s.totalProducts,p=s.productsLoading,d=Object(M.useInnerBlockLayoutContext)().parentClassName,m=function(e){e.order,e.orderby,e.page,e.per_page;return k()(e,["order","orderby","page","per_page"])}(u),b=Object(z.b)("attributes",[]),h=v()(b,2),g=h[0],O=h[1],w=Object(z.b)("min_price"),E=v()(w,2),S=E[0],R=E[1],C=Object(z.b)("max_price"),N=v()(C,2),A=N[0],I=N[1],B=Object(G.a)({totalQuery:m,totalProducts:f},(function(e){var t=e.totalQuery,n=e.totalProducts,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=r.totalQuery;return!Object(x.isEqual)(t,o)&&Number.isFinite(n)})),D="object"===j()(B)&&Object(x.isEqual)(m,B.totalQuery);Object(y.useEffect)((function(){D||(r(1),B&&function(e){Number.isFinite(e)&&(0===e?Object(J.speak)(Object(_.__)("No products found","woo-gutenberg-products-block")):Object(J.speak)(Object(_.sprintf)(Object(_._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(f))}),[u]);var L,q,H,W,U,K=t.contentVisibility,Q=t.columns*t.rows,$=!Number.isFinite(f)&&D?Math.ceil(B.totalProducts/Q):Math.ceil(f/Q),Z=l.length?l:Array.from({length:Q}),X=0!==l.length||p,ee=g.length>0||Number.isFinite(S)||Number.isFinite(A);return React.createElement("div",{className:(L=t.columns,q=t.rows,H=t.alignButtons,W=t.align,U=void 0!==W?"align"+W:"",P()(d,U,"has-"+L+"-columns",{"has-multiple-rows":q>1,"has-aligned-buttons":H}))},K.orderBy&&X&&React.createElement(F,{onChange:o,value:c}),!X&&ee&&React.createElement(re,{resetCallback:function(){O([]),R(null),I(null)}}),!X&&!ee&&React.createElement(te,null),X&&React.createElement("ul",{className:"".concat(d,"__products")},Z.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return React.createElement(V,{key:e.id||n,attributes:t,product:e})}))),$>1&&React.createElement(T,{currentPage:n,onPageChange:function(e){i({focusableSelector:"a, button"}),r(e)},totalPages:$}))})),ae=function(e){var t=e.attributes,n=Object(y.useState)(1),r=v()(n,2),o=r[0],c=r[1],i=Object(y.useState)(t.orderby),a=v()(i,2),u=a[0],s=a[1];Object(y.useEffect)((function(){s(t.orderby)}),[t.orderby]);return React.createElement(ie,{attributes:t,currentPage:o,onPageChange:function(e){c(e)},onSortChange:function(e){var t=e.target.value;s(t),c(1)},sortValue:u})},ue=n(8),se=React.createElement("img",{src:ue.C+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}});function le(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=b()(e);if(t){var o=b()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return d()(this,n)}}var fe=function(e){f()(n,e);var t=le(n);function n(){return a()(this,n),t.apply(this,arguments)}return s()(n,[{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.urlParameterSuffix;return t.isPreview?se:React.createElement(M.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},React.createElement(ae,{attributes:t,urlParameterSuffix:n}))}}]),n}(h.Component);Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:Object(r.a)((function(e){return React.createElement(o.a,{context:"wc/all-products"},React.createElement(fe,e))})),getProps:function(e){return{attributes:JSON.parse(e.dataset.attributes)}}})}]);
|
build/all-products.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wc-shared-context', 'wc-shared-hocs', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-url', 'wp-viewport', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-settings', 'wc-shared-context', 'wc-shared-hocs', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-url', 'wp-viewport', 'wp-wordcount'), 'version' => '21c239cd71538a06fadef68dccd113fa');
|
build/all-products.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var n,a,i=t[0],u=t[1],l=t[2],b=0,p=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(c,a)&&c[a]&&p.push(c[a][0]),c[a]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(e[n]=u[n]);for(s&&s(t);p.length;)p.shift()();return o.push.apply(o,l||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,i=1;i<r.length;i++){var u=r[i];0!==c[u]&&(n=!1)}n&&(o.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},c={5:0,2:0,3:0,8:0,9:0,11:0,12:0,13:0,14:0,15:0,16:0},o=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(e){var t=[],r=c[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=c[e]=[t,n]}));t.push(r[2]=n);var o,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({1:"atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title",2:"atomic-block-components/add-to-cart~atomic-block-components/button",3:"atomic-block-components/sale-badge",7:"atomic-block-components/add-to-cart",10:"atomic-block-components/image",17:"atomic-block-components/title"}[e]||e)+".js"}(e);var u=new Error;o=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=c[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",u.name="ChunkLoadError",u.type=n,u.request=o,r[1](u)}c[e]=void 0}};var l=setTimeout((function(){o({type:"timeout",target:i})}),12e4);i.onerror=i.onload=o,document.head.appendChild(i)}return Promise.all(t)},a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var s=u;return o.push([819,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},107:function(e,t){},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},119:function(e,t){},120:function(e,t){},121:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},133:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(40),c=r(36),o=r(260),a=r(33),i=r(6),u={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(o.b)(),r=t.isEditor,l=t.previewData,s=(null==l?void 0:l.previewCart)||{},b=e.shouldSelect,p=Object(c.useSelect)((function(e,t){var c=t.dispatch;if(!b)return u;if(r)return{cartCoupons:s.coupons,cartItems:s.items,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:[],cartTotals:s.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:s.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:function(){}};var o=e(n.CART_STORE_KEY),l=o.getCartData(),p=o.getCartErrors(),d=o.getCartTotals(),f=!o.hasFinishedResolution("getCartData"),m=o.areShippingRatesLoading(),O=c(n.CART_STORE_KEY).receiveCart,g=Object(i.mapValues)(l.shippingAddress,(function(e){return Object(a.decodeEntities)(e)}));return{cartCoupons:l.coupons,cartItems:l.items||[],cartItemsCount:l.itemsCount,cartItemsWeight:l.itemsWeight,cartNeedsPayment:l.needsPayment,cartNeedsShipping:l.needsShipping,cartItemErrors:l.errors||[],cartTotals:d,cartIsLoading:f,cartErrors:p,shippingAddress:g,shippingRates:l.shippingRates||[],shippingRatesLoading:m,hasShippingAddress:!!g.country,receiveCart:O}}),[b]);return p}},134:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(59),a=r(166),i=r(3),u=r(14),l=r(42);t.a=function(e){var t=(Object(l.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(n.createElement)(u.InspectorControls,null,Object(n.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(n.createElement)("a",{href:"".concat(i.ADMIN_URL,"post.php?post=").concat(t,"&action=edit"),target:"_blank",rel:"noopener noreferrer"},Object(c.__)("Edit this product's details","woo-gutenberg-products-block"),Object(n.createElement)(o.a,{srcElement:a.a,size:16}))),Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(c.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},143:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(7),c=r.n(n),o=r(267),a=r(0);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l=function(){var e=Object(o.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.createSnackbarNotice,i=e.setIsSuppressed,l=Object(a.useRef)(t);Object(a.useEffect)((function(){l.current=t}),[t]);var s=Object(a.useMemo)((function(){return{hasNoticesOfType:function(e){return l.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;l.current.map((function(t){return null!==e&&t.status!==e||n(t.id),!0}))},removeNotice:n}}),[n]),b=Object(a.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("default",e,u({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("error",e,u({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("warning",e,u({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("info",e,u({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("success",e,u({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(e,t)}}}),[r,c]);return u(u(u({notices:t},s),b),{},{setIsSuppressed:i})}},144:function(e,t){!function(){e.exports=this.wp.wordcount}()},145:function(e,t,r){"use strict";var n=r(61),c=r.n(n),o=r(10),a=r.n(o),i=r(0),u=r(1),l=r(6),s=(r(2),r(50)),b=r(4),p=r(8),d=r.n(p),f=r(21),m=r.n(f),O=r(24),g=r.n(O),j=r(22),v=r.n(j),h=r(23),w=r.n(h),y=r(12),_=r.n(y),k=r(25);function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var c=_()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return w()(this,r)}}var P=Object(k.createHigherOrderComponent)((function(e){var t=function(t){v()(n,t);var r=E(n);function n(){return m()(this,n),r.apply(this,arguments)}return g()(n,[{key:"render",value:function(){var t=this.props.selected;return Object(i.createElement)(e,a()({},this.props,{selected:Object(l.isNil)(t)?[]:[t]}))}}]),n}(i.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),C=r(292),S=r(15),N=r.n(S),x=r(38),D=r.n(x),z=r(19),B=r.n(z),I=r(7),L=r.n(I),T=r(47),R=r.n(T),V=r(39),F=r(43);function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(Object(r),!0).forEach((function(t){L()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var c=_()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return w()(this,r)}}var Q=Object(k.createHigherOrderComponent)((function(e){var t=function(t){v()(n,t);var r=H(n);function n(){var e;m()(this,n);for(var t=arguments.length,c=new Array(t),o=0;o<t;o++)c[o]=arguments[o];return e=r.call.apply(r,[this].concat(c)),L()(B()(e),"state",{error:null,loading:!1,variations:{}}),L()(B()(e),"loadVariations",(function(){var t=e.props.products,r=e.state,n=r.loading,c=r.variations;if(!n){var o=e.getExpandedProduct();if(o&&!c[o]){var a=t.find((function(e){return e.id===o}));a.variations&&0!==a.variations.length?(e.setState({loading:!0}),Object(V.g)(o).then((function(t){var r=t.map((function(e){return M(M({},e),{},{parent:o})}));e.setState({variations:M(M({},e.state.variations),{},L()({},o,r)),loading:!1,error:null})})).catch(function(){var t=D()(N.a.mark((function t(r){var n;return N.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(F.a)(r);case 2:n=t.sent,e.setState({variations:M(M({},e.state.variations),{},L()({},o,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({variations:M(M({},e.state.variations),{},L()({},o,null)),loading:!1,error:null})}}})),e}return g()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.selected,r=e.showVariations;t&&r&&this.loadVariations()}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.isLoading,n=t.selected;t.showVariations&&(!R()(e.selected,n)||e.isLoading&&!r)&&this.loadVariations()}},{key:"isProductId",value:function(e){return this.props.products.some((function(t){return t.id===e}))}},{key:"findParentProduct",value:function(e){return this.props.products.filter((function(t){return t.variations&&t.variations.find((function(t){return t.id===e}))}))[0].id}},{key:"getExpandedProduct",value:function(){var e=this.props,t=e.isLoading,r=e.selected;if(!e.showVariations)return null;var n=r&&r.length?r[0]:null;return n?this.prevSelectedItem=n:this.prevSelectedItem&&(t||this.isProductId(this.prevSelectedItem)||(n=this.prevSelectedItem)),!t&&n?this.isProductId(n)?n:this.findParentProduct(n):null}},{key:"render",value:function(){var t=this.props,r=t.error,n=t.isLoading,c=this.state,o=c.error,u=c.loading,l=c.variations;return Object(i.createElement)(e,a()({},this.props,{error:o||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:l,variationsLoading:u}))}}]),n}(i.Component);return L()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),U=r(59),q=r(58),Y=Object(i.createElement)(q.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),K=Object(i.createElement)(q.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),G=r(48);r(195);function W(e,t){if(!t)return e;var r=new RegExp(Object(l.escapeRegExp)(t),"ig");return e.replace(r,"<strong>$&</strong>")}var J=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(i.createElement)(U.a,{srcElement:Y}):Object(i.createElement)(U.a,{srcElement:K})},$={list:Object(u.__)("Products","woo-gutenberg-products-block"),noItems:Object(u.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(u.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(u.__)("Product search results updated.","woo-gutenberg-products-block")},X=function(e){var t=e.expandedProduct,r=e.error,n=e.isLoading,o=e.onChange,p=e.onSearch,f=e.products,m=e.renderItem,O=e.selected,g=e.showVariations,j=e.variations,v=e.variationsLoading,h=function(e){var r=e.item,n=e.search,c=e.depth,o=void 0===c?0:c,p=e.isSelected,f=e.onSelect,m=r.variations&&Array.isArray(r.variations)?r.variations.length:0,O=d()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(o),{"is-searching":n.length>0,"is-skip-level":0===o&&0!==r.parent,"is-variable":m>0}),g=Object.assign({},e);delete g.isSingle;var j={role:"menuitemradio"};return r.breadcrumbs.length&&(j["aria-label"]="".concat(r.breadcrumbs[0],": ").concat(r.name)),m&&(j["aria-expanded"]=r.id===t),r.breadcrumbs.length?(Object(l.isEmpty)(r.variation)||(r.name=r.variation),Object(i.createElement)(s.b,a()({className:O},e,j))):[Object(i.createElement)(b.MenuItem,a()({key:"product-".concat(r.id),isSelected:p},g,j,{className:O,onClick:function(){f(r)()}}),Object(i.createElement)("span",{className:"woocommerce-search-list__item-state"},J(p)),Object(i.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(i.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:W(r.name,n)}})),m?Object(i.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(u.sprintf)(Object(u._n)("%d variation","%d variations",m,"woo-gutenberg-products-block"),m)):null),t===r.id&&m>0&&v&&Object(i.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(i.createElement)(b.Spinner,null))]};if(r)return Object(i.createElement)(G.a,{error:r});var w=j&&j[t]?j[t]:[],y=[].concat(c()(f),c()(w));return Object(i.createElement)(s.a,{className:"woocommerce-products",list:y,isLoading:n,isSingle:!0,selected:y.filter((function(e){var t=e.id;return O.includes(t)})),onChange:o,renderItem:m||(g?h:null),onSearch:p,messages:$,isHierarchical:!0})};X.defaultProps={expandedProduct:null,selected:[],showVariations:!1};t.a=P(Object(C.a)(Q(X)))},146:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=o},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},151:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(8)),o=r.n(c),a=r(46),i=r(188);r(197);t.a=Object(i.a)((function(e){var t=e.className,r=e.instanceId,c=e.defaultValue,i=e.label,u=e.onChange,l=e.options,s=e.screenReaderLabel,b=e.readOnly,p=e.value,d="wc-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:o()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(a.a,{label:i,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(n.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:c,onChange:u,readOnly:b,value:p},l.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},153:function(e,t,r){"use strict";var n=r(21),c=r.n(n),o=r(24),a=r.n(o),i=r(22),u=r.n(i),l=r(23),s=r.n(l),b=r(12),p=r.n(b),d=r(0),f=r(6),m=r(1),O=r(4);function g(e){var t=e.level,r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?Object(d.createElement)(O.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(d.createElement)(O.Path,{d:r[t]})):null}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var c=p()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return s()(this,r)}}var v=function(e){u()(r,e);var t=j(r);function r(){return c()(this,r),t.apply(this,arguments)}return a()(r,[{key:"createLevelControl",value:function(e,t,r){var n=e===t;return{icon:Object(d.createElement)(g,{level:e}),title:Object(m.sprintf)(Object(m.__)("Heading %d"),e),isActive:n,onClick:function(){return r(e)}}}},{key:"render",value:function(){var e=this,t=this.props,r=t.isCollapsed,n=void 0===r||r,c=t.minLevel,o=t.maxLevel,a=t.selectedLevel,i=t.onChange;return Object(d.createElement)(O.Toolbar,{isCollapsed:n,icon:Object(d.createElement)(g,{level:a}),controls:Object(f.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),r}(d.Component);t.a=v},156:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(11),c=r.n(n),o=r(0),a=function(){var e=Object(o.useState)(),t=c()(e,2)[1];return function(e){return t((function(){throw e}))}}},166:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(n.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(n.createElement)("g",{mask:"url(#external-mask)"},Object(n.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=o},169:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(11),c=r.n(n),o=r(40),a=r(36),i=r(0),u=r(99),l=r(6),s=r(60),b=function(e){var t=Object(u.a)();e=e||t;var r=Object(a.useSelect)((function(t){return t(o.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),n=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[r,Object(i.useCallback)((function(t){n(e,t)}),[e])]},p=function(e,t,r){var n=Object(u.a)();r=r||n;var c=Object(a.useSelect)((function(n){return n(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),l=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(i.useCallback)((function(t){l(r,e,t)}),[r,e])]},d=function(e,t){var r=Object(u.a)(),n=b(t=t||r),o=c()(n,2),a=o[0],p=o[1],d=Object(s.a)(e),f=Object(i.useRef)(!1);return Object(i.useEffect)((function(){p(Object(l.assign)({},a,d)),f.current=!0}),[d]),f.current?[a,p]:[e,p]}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},171:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(5),o=Object(n.createElement)("img",{src:c.Q+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}})},172:function(e,t,r){"use strict";var n=r(0),c=r(144),o=r(92),a=function(e){var t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},i=function(e){return e.replace(/<\/?[a-z][^>]*?>/gi,"")},u=function(e,t){return e.replace(/[\s|\.\,]+$/i,"")+t},l=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",n=i(e),c=n.split(" ").splice(0,t).join(" ");return Object(o.autop)(u(c,r))},s=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…",c=i(e),a=c.slice(0,t);if(r)return Object(o.autop)(u(a,n));var l=a.match(/([\s]+)/g),s=l?l.length:0,b=c.slice(0,t+s);return Object(o.autop)(u(b,n))};t.a=function(e){var t=e.source,r=e.maxLength,i=void 0===r?15:r,u=e.countType,b=void 0===u?"words":u,p=e.className,d=void 0===p?"":p,f=Object(n.useMemo)((function(){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words",n=Object(o.autop)(e),i=Object(c.count)(n,r);if(i<=t)return n;var u=a(n),b=Object(c.count)(u,r);return b<=t?u:"words"===r?l(u,t):s(u,t,"characters_including_spaces"===r)}(t,i,b)}),[t,i,b]);return Object(n.createElement)(n.RawHTML,{className:d},f)}},18:function(e,t){!function(){e.exports=this.wp.url}()},181:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(21),a=r.n(o),i=r(24),u=r.n(i),l=r(19),s=r.n(l),b=r(22),p=r.n(b),d=r(23),f=r.n(d),m=r(12),O=r.n(m),g=r(7),j=r.n(g),v=r(0),h=r(9);r(251);function w(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var c=O()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return f()(this,r)}}t.a=function(e){var t=function(t){p()(n,t);var r=w(n);function n(){var e;return a()(this,n),e=r.call(this),j()(s()(e),"scrollToTopIfNeeded",(function(){var t=e.scrollPointRef.current.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollPointRef.current.scrollIntoView()})),j()(s()(e),"moveFocusToTop",(function(t){var r=e.scrollPointRef.current.parentElement.querySelectorAll(t);r.length&&r[0].focus()})),j()(s()(e),"scrollToTop",(function(t){window&&Number.isFinite(window.innerHeight)&&(e.scrollToTopIfNeeded(),t&&t.focusableSelector&&e.moveFocusToTop(t.focusableSelector))})),e.scrollPointRef=Object(h.createRef)(),e}return u()(n,[{key:"render",value:function(){return Object(v.createElement)(h.Fragment,null,Object(v.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:this.scrollPointRef,"aria-hidden":!0}),Object(v.createElement)(e,c()({},this.props,{scrollToTop:this.scrollToTop})))}}]),n}(h.Component);return t.displayName="withScrollToTop",t}},189:function(e,t){},195:function(e,t){},197:function(e,t){},201:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(40),c=r(36),o=r(0),a=r(156),i=r(60),u=function(e){var t=e.namespace,r=e.resourceName,u=e.resourceValues,l=void 0===u?[]:u,s=e.query,b=void 0===s?{}:s,p=e.shouldSelect,d=void 0===p||p;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");var f=Object(o.useRef)({results:[],isLoading:!0}),m=Object(i.a)(b),O=Object(i.a)(l),g=Object(a.a)(),j=Object(c.useSelect)((function(e){if(!d)return null;var c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,m,O],a=c.getCollectionError.apply(c,o);return a&&g(a),{results:c.getCollection.apply(c,o),isLoading:!c.hasFinishedResolution("getCollection",o)}}),[t,r,O,m,d]);return null!==j&&(f.current=j),f.current}},228:function(e,t){},229:function(e,t){},25:function(e,t){!function(){e.exports=this.wp.compose}()},250:function(e,t,r){"use strict";r.d(t,"c",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return m}));var n=r(7),c=r.n(n),o=r(54),a=r.n(o),i=r(3);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var s,b,p={code:i.CURRENCY.code,symbol:i.CURRENCY.symbol,thousandSeparator:i.CURRENCY.thousandSeparator,decimalSeparator:i.CURRENCY.decimalSeparator,minorUnit:i.CURRENCY.precision,prefix:(s=i.CURRENCY.symbol,b=i.CURRENCY.symbolPosition,{left:s,left_space:" "+s,right:"",right_space:""}[b]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(i.CURRENCY.symbol,i.CURRENCY.symbolPosition)},d=function(e){if(!e||"object"!==a()(e))return p;var t=e.currency_code,r=e.currency_symbol,n=e.currency_thousand_separator,c=e.currency_decimal_separator,o=e.currency_minor_unit,i=e.currency_prefix,u=e.currency_suffix;return{code:t||"USD",symbol:r||"$",thousandSeparator:"string"==typeof n?n:",",decimalSeparator:"string"==typeof c?c:".",minorUnit:Number.isFinite(o)?o:2,prefix:"string"==typeof i?i:"$",suffix:"string"==typeof u?u:""}},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return l(l({},p),e)},m=function(e,t){if(""===e||void 0===e)return"";var r=parseInt(e,10);if(!Number.isFinite(r))return"";var n=f(t),c=r/Math.pow(10,n.minorUnit),o=n.prefix+c+n.suffix,a=document.createElement("textarea");return a.innerHTML=o,a.value}},251:function(e,t){},257:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(8),u=r.n(i),l=r(46),s=r(42),b=r(71);r(529);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=e.align,n=Object(s.useInnerBlockLayoutContext)().parentClassName,i=Object(s.useProductDataContext)().product;if(!i.id||!i.on_sale)return null;var b="string"==typeof r?"wc-block-components-product-sale-badge--align".concat(r):"";return Object(o.createElement)("div",{className:u()("wc-block-components-product-sale-badge",t,b,c()({},"".concat(n,"__product-onsale"),n))},Object(o.createElement)(l.a,{label:Object(a.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Product on sale","woo-gutenberg-products-block")}))}))},258:function(e,t){!function(){e.exports=this.wp.deprecated}()},259:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),u=r(58),l=Object(i.createElement)((function(e){var t=e.className,r=e.size,n=void 0===r?20:r,o=a()(e,["className","size"]);return Object(i.createElement)(u.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},o),Object(i.createElement)("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))}),null),s=r(274);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=l;break;case"no-alt":t=s.a}return t?Object(i.cloneElement)(t,{size:e.size||20,className:e.className}):null}},260:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(0),c=r(36),o=Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{}}),a=function(){return Object(n.useContext)(o)},i=function(e){var t=e.children,r=e.currentPostId,a=void 0===r?0:r,i=e.previewData,u=void 0===i?{}:i,l={isEditor:!0,currentPostId:Object(c.useSelect)((function(e){return a||e("core/editor").getCurrentPostId()}),[a]),previewData:u};return Object(n.createElement)(o.Provider,{value:l},t)}},267:function(e,t,r){"use strict";r.d(t,"b",(function(){return _})),r.d(t,"a",(function(){return k}));var n=r(7),c=r.n(n),o=r(11),a=r.n(o),i=r(0),u=(r(2),r(36)),l=r(10),s=r.n(l),b=r(8),p=r.n(b),d=r(925),f=(r(228),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),m=function(e){var t=e.className,r=e.notices,n=_().removeNotice,c=p()(t,"wc-block-components-notices"),o=r.filter((function(e){return"snackbar"!==e.type}));return o.length?Object(i.createElement)("div",{className:c},o.map((function(e){return Object(i.createElement)(d.a,s()({key:"store-notice-"+e.id},e,{className:p()("wc-block-components-notices__notice","woocommerce-message",f(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)}))):null},O=r(929),g=r(143),j=r(260),v=function(){var e=Object(j.b)().isEditor,t=Object(g.a)(),r=t.notices,n=t.removeNotice,c=r.filter((function(e){return"snackbar"===e.type}));return e?null:Object(i.createElement)(O.a,{notices:c,className:"wc-block-components-notices__snackbar",onRemove:n})};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var y=Object(i.createContext)({notices:[],createNotice:function(e,t,r){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),_=function(){return Object(i.useContext)(y)},k=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,c=e.createNoticeContainer,o=void 0===c||c,l=e.context,s=void 0===l?"wc/core":l,b=Object(u.useDispatch)("core/notices"),p=b.createNotice,d=b.removeNotice,f=Object(i.useState)(!1),O=a()(f,2),g=O[0],j=O[1],h=Object(i.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};p(e,t,w(w({},r),{},{context:r.context||s}))}),[p,s]),_=Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s;d(e,t)}),[d,s]),k=Object(i.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};h("default",e,w(w({},t),{},{type:"snackbar"}))}),[h]),E={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(s)}}),[s]).notices,createNotice:h,createSnackbarNotice:k,removeNotice:_,context:s,setIsSuppressed:j},P=g?null:Object(i.createElement)(m,{className:n,notices:E.notices}),C=g?null:Object(i.createElement)(v,null);return Object(i.createElement)(y.Provider,{value:E},o&&P,t,C)}},274:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),u=r(58),l=Object(i.createElement)((function(e){var t=e.className,r=e.size,n=a()(e,["className","size"]);return Object(i.createElement)(u.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),Object(i.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=l},292:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(15),a=r.n(o),i=r(38),u=r.n(i),l=r(21),s=r.n(l),b=r(24),p=r.n(b),d=r(19),f=r.n(d),m=r(22),O=r.n(m),g=r(23),j=r.n(g),v=r(12),h=r.n(v),w=r(0),y=r(6),_=r(25),k=(r(2),r(5)),E=r(39),P=r(43);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=h()(e);if(t){var c=h()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return j()(this,r)}}var S=Object(_.createHigherOrderComponent)((function(e){var t=function(t){O()(o,t);var r,n=C(o);function o(){var e;return s()(this,o),(e=n.apply(this,arguments)).state={list:[],loading:!0},e.setError=e.setError.bind(f()(e)),e.debouncedOnSearch=Object(y.debounce)(e.onSearch.bind(f()(e)),400),e}return p()(o,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(E.h)({selected:t}).then((function(t){e.setState({list:t,loading:!1})})).catch(this.setError)}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,r=this.props.selected;Object(E.h)({selected:r,search:e}).then((function(e){t.setState({list:e,loading:!1})})).catch(this.setError)}},{key:"setError",value:(r=u()(a.a.mark((function e(t){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(P.a)(t);case 2:r=e.sent,this.setState({list:[],loading:!1,error:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"render",value:function(){var t=this,r=this.state,n=r.error,o=r.list,a=r.loading;return Object(w.createElement)(e,c()({},this.props,{error:n,products:o,isLoading:a,onSearch:k.t?function(e){t.setState({loading:!0}),t.debouncedOnSearch(e)}:null}))}}]),o}(w.Component);return t.defaultProps={selected:[]},t}),"withSearchedProducts");t.a=S},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},34:function(e,t){!function(){e.exports=this.moment}()},36:function(e,t){!function(){e.exports=this.wp.data}()},371:function(e,t){},373:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(5);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u={headingLevel:{type:"number",default:2},productLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(o.T)()&&(u=i(i({},u),{},{align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}})),t.a=u},374:function(e,t,r){"use strict";t.a={productLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0}}},375:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(11),a=r.n(o),i=r(0),u=(r(2),r(8)),l=r.n(u),s=r(5),b=r(42),p=r(71),d=r(6),f=r(257);r(530);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=function(){return Object(i.createElement)("img",{src:s.C,alt:"",width:500,height:500})},j=function(e){var t=e.image,r=e.onLoad,n=e.loaded,c=e.showFullSize,o=t||{},a=o.thumbnail,u=o.src,l=o.srcset,s=o.sizes,b={alt:o.alt,onLoad:r,hidden:!n,src:a};return c&&(b=O(O({},b),{},{src:u,srcSet:l,sizes:s})),Object(i.createElement)(i.Fragment,null,Object(i.createElement)("img",b),!n&&Object(i.createElement)(g,null))};t.a=Object(p.withProductDataContext)((function(e){var t=e.className,r=e.imageSizing,n=void 0===r?"full-size":r,o=e.productLink,u=void 0===o||o,s=e.showSaleBadge,p=e.saleBadgeAlign,m=void 0===p?"right":p,O=Object(b.useInnerBlockLayoutContext)().parentClassName,v=Object(b.useProductDataContext)().product,h=Object(i.useState)(!1),w=a()(h,2),y=w[0],_=w[1];if(!v.id)return Object(i.createElement)("div",{className:l()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",c()({},"".concat(O,"__product-image"),O))},Object(i.createElement)(g,null));var k=Object(d.isEmpty)(v.images)?null:v.images[0];return Object(i.createElement)("div",{className:l()(t,"wc-block-components-product-image",c()({},"".concat(O,"__product-image"),O))},u?Object(i.createElement)("a",{href:v.permalink,rel:"nofollow"},!!s&&Object(i.createElement)(f.default,{align:m,product:v}),Object(i.createElement)(j,{image:k,onLoad:function(){return _(!0)},loaded:y,showFullSize:"cropped"!==n})):Object(i.createElement)(i.Fragment,null,!!s&&Object(i.createElement)(f.default,{align:m,product:v}),Object(i.createElement)(j,{image:k,onLoad:function(){return _(!0)},loaded:y,showFullSize:"cropped"!==n})))}))},376:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},377:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(8)),o=r.n(c),a=r(11),i=r.n(a),u=r(822),l=r(511),s=Object(n.createContext)({product:{},productId:0,variationId:0,variationData:{},cartItemData:{},quantity:1,minQuantity:1,maxQuantity:99,quantityInCart:0,setQuantity:function(e){},setVariationId:function(e){},setVariationData:function(e){},setCartItemData:function(e){},showFormElements:!1,formInitialized:!1,formDisabled:!0,formSubmitting:!1,onChange:function(){},onSubmit:function(){},onSuccess:function(){},onFail:function(){}}),b=function(){return Object(n.useContext)(s)},p=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=r||{},a=o.id||0,b=Object(n.useState)(0),p=i()(b,2),f=p[0],m=p[1],O=Object(n.useState)({}),g=i()(O,2),j=g[0],v=g[1],h=Object(n.useState)({}),w=i()(h,2),y=w[0],_=w[1],k=Object(n.useState)(1),E=i()(k,2),P=E[0],C=E[1],S=Object(u.a)(a),N=S.addToCart,x=S.addingToCart,D=S.cartQuantity,z=S.cartIsLoading;!function(e){var t=Object(n.useRef)(!0);Object(n.useEffect)((function(){t.current?t.current=!1:Object(l.b)()}),[e])}(D);var B=!z&&a>0,I=x||!B||!d(o),L=Object(n.useCallback)((function(){N(P)}),[N,P]),T=Object(n.useCallback)((function(){}),[]),R=Object(n.useCallback)((function(){}),[]),V=Object(n.useCallback)((function(){}),[]),F={product:o,productId:a,variationId:f,variationData:j,cartItemData:y,quantity:P,minQuantity:1,maxQuantity:o.quantity_limit||99,quantityInCart:D,setQuantity:C,setVariationId:m,setVariationData:v,setCartItemData:_,showFormElements:c,formInitialized:B,formDisabled:I,formSubmitting:x,onChange:T,onSubmit:L,onSuccess:R,onFail:V};return Object(n.createElement)(s.Provider,{value:F},t)},d=function(e){var t=e.is_purchasable;return void 0!==t&&t},f=r(42),m=r(6),O=r(71),g=(r(371),r(1)),j=r(97),v=r(59),h=r(539),w=function(e){var t=e.className,r=e.href,c=e.text;return Object(n.createElement)(j.a,{className:t,href:r,rel:"nofollow"},c)},y=function(e){var t=e.className,r=e.quantityInCart,c=e.loading,o=e.disabled,a=e.onClick,u=Object(n.useState)(!1),l=i()(u,2),s=l[0],b=l[1];return Object(n.createElement)(j.a,{className:t,disabled:o,showSpinner:c,onClick:function(){a(),b(!0)}},r>0?Object(g.sprintf)(Object(g._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(g.__)("Add to cart","woo-gutenberg-products-block"),s&&Object(n.createElement)(v.a,{srcElement:h.a,alt:Object(g.__)("Done","woo-gutenberg-products-block")}))},_=function(){var e=b(),t=e.showFormElements,r=e.product,c=e.quantityInCart,o=e.formDisabled,a=e.formSubmitting,i=e.onSubmit,u=r.is_purchasable,l=void 0===u||u,s=r.has_options,p=r.add_to_cart,d=void 0===p?{url:"",text:""}:p;return!t&&s||!l?Object(n.createElement)(w,{className:"wc-block-components-product-add-to-cart-button",href:d.url,text:d.text||Object(g.__)("View Product","woo-gutenberg-products-block")}):Object(n.createElement)(y,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:c,disabled:o,loading:a,onClick:i})},k=function(e){var t=e.disabled,r=e.min,c=e.max,o=e.value,a=e.onChange;return Object(n.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:o,min:r,max:c,hidden:1===c,disabled:t,onChange:function(e){a(e.target.value)}})},E=function(e){var t=e.reason,r=void 0===t?Object(g.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):t;return Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},r)},P=function(){var e=b(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.setQuantity,i=e.formDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)(E,null):t.id&&!t.is_in_stock?Object(n.createElement)(E,{reason:Object(g.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(k,{value:r,min:c,max:o,disabled:i,onChange:a}),Object(n.createElement)(_,null))},C=(r(538),r(7)),S=r.n(C),N=r(61),x=r.n(N),D=r(33),z=r(4),B={value:"",label:Object(g.__)("Select an option","woo-gutenberg-products-block")},I=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,o=e.selected,a=void 0===o?"":o,i=e.onChange,u=void 0===i?function(){}:i;return Object(n.createElement)(z.SelectControl,{className:"wc-block-components-product-add-to-cart-attribute-picker__select",label:Object(D.decodeEntities)(t),value:a||"",options:[B].concat(x()(c)),onChange:u})},L=function(e){var t=e.selectedAttributes,r=e.variationAttributes,n=e.attributeNames;return Object.keys(r).filter((function(e){return n.every((function(n){var c=t[n]||"",o=r[e][n];return""===c||(null===o||o===c)}))}))};function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var V=function(e){var t=e.attributes,r=e.variationAttributes,c=Object(n.useState)(0),o=i()(c,2),a=o[0],u=o[1],l=Object(n.useState)([]),s=i()(l,2),b=s[0],p=s[1],d=Object.keys(t),f=Object.values(b).filter(Boolean).length>0,m=Object.values(b).filter((function(e){return""!==e})).length===d.length,O=Object(n.useMemo)((function(){var e=[];return d.forEach((function(n){var c=t[n],o=d.filter((function(e){return e!==n})),a=f?L({selectedAttributes:b,variationAttributes:r,attributeNames:o}):null,i=null!==a?a.map((function(e){return r[e][n]})):null;e[n]=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map((function(e){var r=e.name,n=e.slug;return null===t||t.includes(null)||t.includes(n)?{value:n,label:r}:null})).filter(Boolean)}(c.terms,i)})),e}),[t,r,d,b,f]);return Object(n.useEffect)((function(){if(m){var e=L({selectedAttributes:b,variationAttributes:r,attributeNames:d});u(e[0]||0)}else u(0)}),[b,r,d,m]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},d.map((function(e){return Object(n.createElement)(I,{key:e,attributeName:e,options:O[e],selected:b[e],onChange:function(t){p(R(R({},b),{},S()({},e,t)))}})})),Object(n.createElement)("p",null,"Matched variation ID: ",a))},F=function(e){var t=e.product,r=t.attributes,c=void 0===r?{}:r,o=t.variations,a=void 0===o?[]:o,i=function(e){return e?Object(m.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):[]}(c),u=function(e){if(!e)return{};var t={};return e.forEach((function(e){var r=e.id,n=e.attributes;t[r]=n.reduce((function(e,t){var r=t.name,n=t.value;return e[r]=n,e}),[])})),t}(a);return 0===Object.keys(i).length||0===u.length?null:Object(n.createElement)(V,{attributes:i,variationAttributes:u})},A=function(){var e=b(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.setQuantity,i=e.formDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)(E,null):t.id&&!t.is_in_stock?Object(n.createElement)(E,{reason:Object(g.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(F,{product:t}),Object(n.createElement)(k,{value:r,min:c,max:o,disabled:i,onChange:a}),Object(n.createElement)(_,null))},M=function(){return Object(n.createElement)(_,null)},H=function(){return Object(n.createElement)(z.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},Q=function(){return Object(n.createElement)(H,null)},U=function(e){var t=e.productType;return"variable"===t?Object(n.createElement)(A,null):"grouped"===t?Object(n.createElement)(Q,null):"external"===t?Object(n.createElement)(M,null):"simple"===t||"variation"===t?Object(n.createElement)(P,null):null};t.a=Object(O.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(f.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(m.isEmpty)(c)});return Object(n.createElement)(p,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(n.Fragment,null,r?Object(n.createElement)(U,{productType:c.type}):Object(n.createElement)(_,null))))}))},378:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),u=r(33),l=r(42),s=r(14),b=r(5),p=function(e){var t=e.color,r=e.fontSize;return Object(b.T)()?{color:t,fontSize:r}:{}},d=r(71);r(527),t.a=Object(d.withProductDataContext)((function(e){var t,r,n,a=e.className,d=e.headingLevel,f=void 0===d?2:d,m=e.productLink,O=void 0===m||m,g=e.align,j=e.color,v=e.customColor,h=e.fontSize,w=e.customFontSize,y=Object(l.useInnerBlockLayoutContext)().parentClassName,_=Object(l.useProductDataContext)().product,k="h".concat(f),E=Object(s.getColorClassName)("color",j),P=Object(s.getFontSizeClass)(h),C=i()((t={"has-text-color":j||v,"has-font-size":h||w},c()(t,E,E),c()(t,P,P),t));if(!_.id)return Object(o.createElement)(k,{className:i()(a,"wc-block-components-product-title",(n={},c()(n,"".concat(y,"__product-title"),y),c()(n,"wc-block-components-product-title--align-".concat(g),g&&Object(b.T)()),c()(n,C,Object(b.T)()),n)),style:p({color:v,fontSize:w})});var S=Object(u.decodeEntities)(_.name);return Object(o.createElement)(k,{className:i()(a,"wc-block-components-product-title",(r={},c()(r,"".concat(y,"__product-title"),y),c()(r,"wc-block-components-product-title__align-".concat(g),g&&Object(b.T)()),r))},O?Object(o.createElement)("a",{href:_.permalink,rel:"nofollow",className:i()(c()({},C,Object(b.T)())),style:p({color:v,fontSize:w})},S):S)}))},39:function(e,t,r){"use strict";r.d(t,"h",(function(){return p})),r.d(t,"e",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return m})),r.d(t,"f",(function(){return O})),r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return j})),r.d(t,"g",(function(){return v})),r.d(t,"a",(function(){return h}));var n=r(7),c=r.n(n),o=r(18),a=r(13),i=r.n(a),u=r(6),l=r(5);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,s=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,i=void 0===a?[]:a,u={per_page:l.t?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(o.addQueryArgs)("/wc/store/products",b(b({},u),i))];return l.t&&r.length&&s.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r})),s}({selected:r,search:c,queryArgs:void 0===a?[]:a});return Promise.all(s.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id").map((function(e){return b(b({},e),{},{parent:0})}))})).catch((function(e){throw e}))},d=function(e){return i()({path:"/wc/store/products/".concat(e)})},f=function(){return i()({path:"wc/store/products/attributes"})},m=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},O=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:l.w?100:0,orderby:l.w?"count":"name",order:l.w?"desc":"asc",search:n})];return l.w&&r.length&&c.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:r})),c}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return i()({path:e})}))).then((function(e){return Object(u.uniqBy)(Object(u.flatten)(e),"id")}))},g=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products/categories",b({per_page:0},e))})},j=function(e){return i()({path:"wc/store/products/categories/".concat(e)})},v=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})})},h=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},4:function(e,t){!function(){e.exports=this.wp.components}()},40:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},42:function(e,t){!function(){e.exports=this.wc.wcSharedContext}()},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(15),c=r.n(n),o=r(38),a=r.n(o),i=function(){var e=a()(c.a.mark((function e(t){var r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},45:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},46:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(9)),i=r(8),u=r.n(i);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t,r=e.label,n=e.screenReaderLabel,c=e.wrapperElement,i=e.wrapperProps,l=null!=r,b=null!=n;return!l&&b?(t=c||"span",i=s(s({},i),{},{className:u()(i.className,"screen-reader-text")}),Object(o.createElement)(t,i,n)):(t=c||a.Fragment,l&&b&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))};b.defaultProps={wrapperProps:{}},t.a=b},47:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},48:function(e,t,r){"use strict";var n=r(0),c=r(1),o=(r(2),r(45));t.a=function(e){var t,r,a,i=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=i).message,a=t.type,r?"general"===a?Object(n.createElement)("span",null,Object(c.__)("The following error was returned","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(o.escapeHTML)(r))):"api"===a?Object(n.createElement)("span",null,Object(c.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(o.escapeHTML)(r))):r:Object(c.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))}},5:function(e,t,r){"use strict";r.d(t,"k",(function(){return c})),r.d(t,"G",(function(){return o})),r.d(t,"M",(function(){return a})),r.d(t,"x",(function(){return i})),r.d(t,"z",(function(){return u})),r.d(t,"l",(function(){return l})),r.d(t,"y",(function(){return s})),r.d(t,"B",(function(){return b})),r.d(t,"n",(function(){return p})),r.d(t,"A",(function(){return d})),r.d(t,"m",(function(){return f})),r.d(t,"C",(function(){return m})),r.d(t,"t",(function(){return O})),r.d(t,"w",(function(){return g})),r.d(t,"q",(function(){return j})),r.d(t,"r",(function(){return v})),r.d(t,"s",(function(){return h})),r.d(t,"j",(function(){return w})),r.d(t,"I",(function(){return y})),r.d(t,"N",(function(){return _})),r.d(t,"p",(function(){return k})),r.d(t,"o",(function(){return E})),r.d(t,"F",(function(){return P})),r.d(t,"c",(function(){return C})),r.d(t,"u",(function(){return S})),r.d(t,"v",(function(){return N})),r.d(t,"Q",(function(){return D})),r.d(t,"R",(function(){return z})),r.d(t,"H",(function(){return B})),r.d(t,"a",(function(){return I})),r.d(t,"K",(function(){return L})),r.d(t,"b",(function(){return T})),r.d(t,"J",(function(){return R})),r.d(t,"h",(function(){return V})),r.d(t,"L",(function(){return M})),r.d(t,"g",(function(){return H})),r.d(t,"i",(function(){return Q})),r.d(t,"E",(function(){return U})),r.d(t,"D",(function(){return q})),r.d(t,"P",(function(){return Y})),r.d(t,"O",(function(){return K})),r.d(t,"d",(function(){return G})),r.d(t,"e",(function(){return W})),r.d(t,"f",(function(){return J})),r.d(t,"U",(function(){return X})),r.d(t,"V",(function(){return Z})),r.d(t,"S",(function(){return ee})),r.d(t,"T",(function(){return te}));var n=r(3),c=Object(n.getSetting)("currentUserIsAdmin",!1),o=Object(n.getSetting)("reviewRatingsEnabled",!0),a=Object(n.getSetting)("showAvatars",!0),i=Object(n.getSetting)("max_columns",6),u=Object(n.getSetting)("min_columns",1),l=Object(n.getSetting)("default_columns",3),s=Object(n.getSetting)("max_rows",6),b=Object(n.getSetting)("min_rows",1),p=Object(n.getSetting)("default_rows",3),d=Object(n.getSetting)("min_height",500),f=Object(n.getSetting)("default_height",500),m=Object(n.getSetting)("placeholderImgSrc",""),O=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),g=Object(n.getSetting)("limitTags"),j=Object(n.getSetting)("hasProducts",!0),v=Object(n.getSetting)("hasTags",!0),h=Object(n.getSetting)("homeUrl",""),w=Object(n.getSetting)("couponsEnabled",!0),y=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),E=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),P=Object(n.getSetting)("productCount",0),C=Object(n.getSetting)("attributes",[]),S=Object(n.getSetting)("isShippingCalculatorEnabled",!0),N=Object(n.getSetting)("isShippingCostHidden",!1),x=Object(n.getSetting)("woocommerceBlocksPhase",1),D=Object(n.getSetting)("wcBlocksAssetUrl",""),z=Object(n.getSetting)("wcBlocksBuildUrl",""),B=Object(n.getSetting)("shippingCountries",{}),I=Object(n.getSetting)("allowedCountries",{}),L=Object(n.getSetting)("shippingStates",{}),T=Object(n.getSetting)("allowedStates",{}),R=Object(n.getSetting)("shippingMethodsExist",!1),V=Object(n.getSetting)("checkoutShowLoginReminder",!0),F={id:0,title:"",permalink:""},A=Object(n.getSetting)("storePages",{shop:F,cart:F,checkout:F,privacy:F,terms:F}),M=A.shop.permalink,H=A.checkout.id,Q=A.checkout.permalink,U=A.privacy.permalink,q=A.privacy.title,Y=A.terms.permalink,K=A.terms.title,G=A.cart.id,W=A.cart.permalink,J=Object(n.getSetting)("checkoutAllowsGuest",!1),$=(Object(n.getSetting)("checkoutAllowsSignup",!1),r(17)),X=function(e,t){if(x>2)return Object($.registerBlockType)(e,t)},Z=function(e,t){if(x>1)return Object($.registerBlockType)(e,t)},ee=function(){return x>2},te=function(){return x>1}},507:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),u=r(57),l=r(250),s=r(42),b=r(14),p=r(5),d=r(71),f=(r(528),function(e){return e.price_range&&e.price_range.min_amount&&e.price_range.max_amount}),m=function(e){var t,r=e.currency,n=e.minAmount,a=e.maxAmount,l=e.classes,b=e.style,d=Object(s.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value",(t={},c()(t,"".concat(d,"__product-price__value"),d),c()(t,l,Object(p.T)()),t)),style:Object(p.T)()?b:{}},Object(o.createElement)(u.a,{currency:r,value:n})," — ",Object(o.createElement)(u.a,{currency:r,value:a}))},O=function(e){var t,r,n=e.currency,a=e.price,l=e.regularPrice,b=e.saleClasses,d=void 0===b?"":b,f=e.saleStyle,m=void 0===f?{}:f,O=e.classes,g=void 0===O?"":O,j=e.style,v=void 0===j?{}:j,h=Object(s.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("del",{className:i()("wc-block-components-product-price__regular",(t={},c()(t,"".concat(h,"__product-price__regular"),h),c()(t,g,Object(p.T)()),t)),style:Object(p.T)()?v:{}},Object(o.createElement)(u.a,{currency:n,value:l})),Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value",(r={},c()(r,"".concat(h,"__product-price__value"),h),c()(r,d,Object(p.T)()),r)),style:Object(p.T)()?m:{}},Object(o.createElement)(u.a,{currency:n,value:a})))},g=function(e){var t=e.currency,r=e.price,n=e.classes,a=void 0===n?"":n,l=e.style,b=void 0===l?{}:l,d=Object(s.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value","".concat(d,"__product-price__value"),c()({},a,Object(p.T)())),style:Object(p.T)()?b:{}},Object(o.createElement)(u.a,{currency:t,value:r}))};t.default=Object(d.withProductDataContext)((function(e){var t,r,n,a=e.className,u=e.align,d=e.fontSize,j=e.customFontSize,v=e.saleFontSize,h=e.customSaleFontSize,w=e.color,y=e.customColor,_=e.saleColor,k=e.customSaleColor,E=Object(s.useInnerBlockLayoutContext)().parentClassName,P=Object(s.useProductDataContext)().product,C=Object(b.getColorClassName)("color",w),S=Object(b.getFontSizeClass)(d),N=Object(b.getColorClassName)("color",_),x=Object(b.getFontSizeClass)(v),D=i()((t={"has-text-color":w||y,"has-font-size":d||j},c()(t,C,C),c()(t,S,S),t)),z=i()((r={"has-text-color":_||k,"has-font-size":v||h},c()(r,N,N),c()(r,x,x),r)),B={color:y,fontSize:j},I={color:k,fontSize:h};if(!P.id)return Object(o.createElement)("div",{className:i()(a,"price","wc-block-components-product-price",c()({},"".concat(E,"__product-price"),E))});var L=P.prices,T=Object(l.c)(L);return Object(o.createElement)("div",{className:i()(a,"price","wc-block-components-product-price",(n={},c()(n,"".concat(E,"__product-price"),E),c()(n,"wc-block-components-product-price__align-".concat(u),u&&Object(p.T)()),n))},f(L)?Object(o.createElement)(m,{currency:T,minAmount:L.price_range.min_amount,maxAmount:L.price_range.max_amount,classes:D,style:B}):L.price!==L.regular_price?Object(o.createElement)(O,{currency:T,price:L.price,regularPrice:L.regular_price,saleClasses:z,saleStyle:I,classes:D,style:B}):Object(o.createElement)(g,{currency:T,price:L.price,classes:D,style:B}))}))},508:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"}));t.a=o},509:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(8),u=r.n(i),l=r(42),s=r(71),b=(r(531),function(e){var t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0});t.default=Object(s.withProductDataContext)((function(e){var t=e.className,r=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product,i=b(n);if(!i)return null;var s={width:i/5*100+"%"},p=Object(a.sprintf)(Object(a.__)("Rated %f out of 5","woo-gutenberg-products-block"),i);return Object(o.createElement)("div",{className:u()(t,"star-rating","wc-block-components-product-rating",c()({},"".concat(r,"__product-rating"),r))},Object(o.createElement)("div",{className:u()("wc-block-components-product-rating__stars","".concat(r,"__product-rating__stars")),role:"img","aria-label":p},Object(o.createElement)("span",{style:s},p)))}))},510:function(e,t,r){"use strict";r.r(t);var n=r(10),c=r.n(n),o=r(7),a=r.n(o),i=r(0),u=(r(2),r(8)),l=r.n(u),s=r(1),b=r(822),p=r(33),d=r(511),f=r(42),m=r(71),O=(r(532),function(e){var t=e.product,r=Object(i.useRef)(!0),n=t.id,o=t.permalink,a=t.add_to_cart,u=t.has_options,f=t.is_purchasable,m=t.is_in_stock,O=Object(b.a)(n),g=O.cartQuantity,j=O.addingToCart,v=O.addToCart;Object(i.useEffect)((function(){r.current?r.current=!1:Object(d.b)()}),[g]);var h=Number.isFinite(g)&&g>0,w=!u&&f&&m,y=Object(p.decodeEntities)((null==a?void 0:a.description)||""),_=h?Object(s.sprintf)(Object(s._n)("%d in cart","%d in cart",g,"woo-gutenberg-products-block"),g):Object(p.decodeEntities)((null==a?void 0:a.text)||Object(s.__)("Add to cart","woo-gutenberg-products-block")),k=w?"button":"a",E={};return w?E.onClick=function(){v()}:(E.href=o,E.rel="nofollow"),Object(i.createElement)(k,c()({"aria-label":y,className:l()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:h}),disabled:j},E),_)}),g=function(){return Object(i.createElement)("button",{className:l()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0})};t.default=Object(m.withProductDataContext)((function(e){var t=e.className,r=Object(f.useInnerBlockLayoutContext)().parentClassName,n=Object(f.useProductDataContext)().product;return Object(i.createElement)("div",{className:l()(t,"wp-block-button","wc-block-components-product-button",a()({},"".concat(r,"__product-add-to-cart"),r))},n.id?Object(i.createElement)(O,{product:n}):Object(i.createElement)(g,null))}))},511:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=window.Event||null,c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof n){var c=new n(e,{bubbles:t,cancelable:r});document.body.dispatchEvent(c)}else{var o=document.createEvent("Event");o.initEvent(e,t,r),document.body.dispatchEvent(o)}},o=function(){c("wc_fragment_refresh",!0,!0)},a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var o=function(){c(t,r,n)};return jQuery(document).on(e,o),function(){return jQuery(document).off(e,o)}}},512:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),u=r(172),l=r(3),s=r(42),b=r(71);r(533);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(s.useInnerBlockLayoutContext)().parentClassName,n=Object(s.useProductDataContext)().product;if(!n)return Object(o.createElement)("div",{className:i()(t,"wc-block-components-product-summary",c()({},"".concat(r,"__product-summary"),r))});var a=n.short_description?n.short_description:n.description;if(!a)return null;var b=Object(l.getSetting)("wordCountType","words");return Object(o.createElement)(u.a,{className:i()(t,"wc-block-components-product-summary",c()({},"".concat(r,"__product-summary"),r)),source:a,maxLength:150,countType:b})}))},513:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),u=r.n(i),l=r(42),s=r(71);r(534);t.default=Object(s.withProductDataContext)((function(e){var t=e.className,r=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product.sku;return n?Object(o.createElement)("div",{className:u()(t,"wc-block-components-product-sku",c()({},"".concat(r,"__product-sku"),r))},Object(a.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,n)):null}))},514:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),u=r.n(i),l=r(42),s=r(6),b=r(71);r(535);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product;return Object(s.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:u()(t,"wc-block-components-product-category-list",c()({},"".concat(r,"__product-category-list"),r))},Object(a.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map((function(e){var t=e.name,r=e.link,n=e.slug;return Object(o.createElement)("li",{key:"category-list-item-".concat(n)},Object(o.createElement)("a",{href:r},t))}))))}))},515:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),u=r.n(i),l=r(42),s=r(6),b=r(71);r(536);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product;return Object(s.isEmpty)(n.tags)?null:Object(o.createElement)("div",{className:u()(t,"wc-block-components-product-tag-list",c()({},"".concat(r,"__product-tag-list"),r))},Object(a.__)("Tags:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.tags).map((function(e){var t=e.name,r=e.link,n=e.slug;return Object(o.createElement)("li",{key:"tag-list-item-".concat(n)},Object(o.createElement)("a",{href:r},t))}))))}))},516:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),u=r.n(i),l=r(42),s=r(71),b=(r(537),function(e){return Object(a.sprintf)(Object(a.__)("%d left in stock","woo-gutenberg-products-block"),e)}),p=function(e,t){return t?Object(a.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(a.__)("In Stock","woo-gutenberg-products-block"):Object(a.__)("Out of Stock","woo-gutenberg-products-block")};t.default=Object(s.withProductDataContext)((function(e){var t,r=e.className,n=Object(l.useInnerBlockLayoutContext)().parentClassName,a=Object(l.useProductDataContext)().product;if(!a.id||!a.is_purchasable)return null;var i=!!a.is_in_stock,s=a.low_stock_remaining,d=a.is_on_backorder;return Object(o.createElement)("div",{className:u()(r,"wc-block-components-product-stock-indicator",(t={},c()(t,"".concat(n,"__stock-indicator"),n),c()(t,"wc-block-components-product-stock-indicator--in-stock",i),c()(t,"wc-block-components-product-stock-indicator--out-of-stock",!i),c()(t,"wc-block-components-product-stock-indicator--low-stock",!!s),c()(t,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),t))},s?b(s):p(i,d))}))},517:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(9),c=function(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,r.current]),r.current}},527:function(e,t){},528:function(e,t){},529:function(e,t){},53:function(e,t){!function(){e.exports=this.wp.keycodes}()},530:function(e,t){},531:function(e,t){},532:function(e,t){},533:function(e,t){},534:function(e,t){},535:function(e,t){},536:function(e,t){},537:function(e,t){},538:function(e,t){},539:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=o},56:function(e,t){!function(){e.exports=this.wc.wcBlocksRegistry}()},57:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(7),a=r.n(o),i=r(27),u=r.n(i),l=r(0),s=r(180),b=r(8),p=r.n(b);r(189);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}t.a=function(e){var t=e.className,r=e.value,n=e.currency,o=e.onValueChange,a=u()(e,["className","value","currency","onValueChange"]);if("-"===r)return null;var i=r/Math.pow(10,n.minorUnit);if(!Number.isFinite(i))return null;var b=p()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),d=f(f(f({displayType:"text"},a),function(e){return{thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0}}(n)),{},{value:void 0,currency:void 0,onValueChange:void 0}),m=o?function(e){var t=e.value*Math.pow(10,n.minorUnit);o(t)}:function(){};return Object(l.createElement)(s.a,c()({className:b},d,{value:i,onValueChange:m}))}},59:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(27),a=r.n(o),i=r(9);r(2);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,o=a()(e,["srcElement","size"]);return Object(i.isValidElement)(t)&&Object(i.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},o))}},6:function(e,t){!function(){e.exports=this.lodash}()},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(47),o=r.n(c),a=function(e){var t=Object(n.useRef)();return o()(e,t.current)||(t.current=e),t.current}},71:function(e,t){!function(){e.exports=this.wc.wcSharedHocs}()},72:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(21),a=r.n(o),i=r(24),u=r.n(i),l=r(19),s=r.n(l),b=r(22),p=r.n(b),d=r(23),f=r.n(d),m=r(12),O=r.n(m),g=r(0),j=r(6),v=r(8),h=r.n(v),w=r(4),y=r(25);r(121);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var c=O()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return f()(this,r)}}var k=function(e){p()(r,e);var t=_(r);function r(){var e;return a()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(s()(e)),e}return u()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,o=r.checked,a=r.instanceId,i=r.className,u=r.help,l=r.options,s=r.value,b="inspector-toggle-button-control-".concat(a);return u&&(e=Object(j.isFunction)(u)?u(o):u),Object(g.createElement)(w.BaseControl,{id:b,help:e,className:h()("components-toggle-button-control",i)},Object(g.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(g.createElement)(w.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,r){var o={};return s===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isDefault=!0,o["aria-pressed"]=!1),Object(g.createElement)(w.Button,c()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},o),e.label)}))))}}]),r}(g.Component);t.a=Object(y.withInstanceId)(k)},73:function(e,t){!function(){e.exports=this.wp.hooks}()},76:function(e,t){!function(){e.exports=this.ReactDOM}()},77:function(e,t){!function(){e.exports=this.wp.dom}()},79:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(6),a=(r(2),r(4)),i=r(5);t.a=function(e){var t=e.columns,r=e.rows,u=e.setAttributes,l=e.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(o.clamp)(e,i.z,i.x);u({columns:Object(o.isNaN)(t)?"":t})},min:i.z,max:i.x}),Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Rows","woo-gutenberg-products-block"),value:r,onChange:function(e){var t=Object(o.clamp)(e,i.B,i.y);u({rows:Object(o.isNaN)(t)?"":t})},min:i.B,max:i.y}),Object(n.createElement)(a.ToggleControl,{label:Object(c.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(c.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(c.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:function(){return u({alignButtons:!l})}}))}},791:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"}));t.a=o},798:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42zM13 20.01L4 11V4h7v-.01l9 9-7 7.02z"}),Object(n.createElement)("circle",{cx:"6.5",cy:"6.5",r:"1.5"}),Object(n.createElement)("path",{d:"M8.9 12.55c0 .57.23 1.07.6 1.45l3.5 3.5 3.5-3.5c.37-.37.6-.89.6-1.45 0-1.13-.92-2.05-2.05-2.05-.57 0-1.08.23-1.45.6l-.6.6-.6-.59c-.37-.38-.89-.61-1.45-.61-1.13 0-2.05.92-2.05 2.05z"}));t.a=o},806:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}));t.a=o},807:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1),c=r(5),o=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(n.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:c.Q+"img/pennant.jpg",thumbnail:c.Q+"img/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(n.__)("Add to cart","woo-gutenberg-products-block"),description:Object(n.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},81:function(e,t){!function(){e.exports=this.wp.viewport}()},812:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}));t.a=o},819:function(e,t,r){e.exports=r(884)},820:function(e,t){},821:function(e,t){},822:function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(11),c=r.n(n),o=r(0),a=r(36),i=r(133),u=r(40),l=r(33),s=r(143),b=function(e,t){var r=e.find((function(e){return e.id===t}));return r?r.quantity:0},p=function(e){var t=Object(a.useDispatch)(u.CART_STORE_KEY).addItemToCart,r=Object(i.a)(),n=r.cartItems,p=r.cartIsLoading,d=Object(s.a)(),f=d.addErrorNotice,m=d.removeNotice,O=Object(o.useState)(!1),g=c()(O,2),j=g[0],v=g[1],h=Object(o.useRef)(b(n,e));return Object(o.useEffect)((function(){var t=b(n,e);t!==h.current&&(h.current=t)}),[n,e]),{cartQuantity:Number.isFinite(h.current)?h.current:0,addingToCart:j,cartIsLoading:p,addToCart:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v(!0),t(e,r).then((function(e){!0===e&&m("add-to-cart")})).catch((function(e){f(Object(l.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){v(!1)}))}}}},824:function(e,t,r){"use strict";var n=r(0),c=r(58),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=o},825:function(e,t){},826:function(e,t){},827:function(e,t){},828:function(e,t){},84:function(e,t){!function(){e.exports=this.wp.a11y}()},884:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(10),a=r.n(o),i=r(0),u=r(1),l=r(14),s=r(17),b=r(59),p=r(58),d=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"})),f=r(5),m=r(8),O=r.n(m),g=function(e){var t=e.attributes;return Object(i.createElement)("div",{className:O()("is-loading",t.className)})},j={category:"woocommerce-product-elements",keywords:[Object(u.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(i.createElement)(b.a,{srcElement:d}),foreground:"#96588a"},supports:{html:!1},parent:Object(f.S)()?null:["@woocommerce/all-products","@woocommerce/single-product"],save:g,deprecated:[{save:function(){}}]},v=r(373),h=r(4),w=r(25),y=r(153),_=r(378),k=r(11),E=r.n(k),P=r(145),C=r(27),S=r.n(C);r(821);var N=function(e){var t=e.className,r=void 0===t?"":t,n=S()(e,["className"]),c=O()("wc-block-text-toolbar-button",r);return Object(i.createElement)(h.Button,a()({className:c},n))},x=r(42),D=(r(820),function(e){return function(t){return function(r){var n=Object(x.useProductDataContext)(),c=r.attributes,o=r.setAttributes,a=c.productId,s=Object(i.useState)(!a),b=E()(s,2),p=b[0],d=b[1];return n.hasContext?Object(i.createElement)(t,r):Object(i.createElement)(i.Fragment,null,p?Object(i.createElement)(h.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(i.createElement)("div",null,e.description),Object(i.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(i.createElement)(P.a,{selected:a||0,showVariations:!0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o({productId:e[0]?e[0].id:0})}}),Object(i.createElement)(h.Button,{isDefault:!0,disabled:!a,onClick:function(){d(!1)}},Object(u.__)("Done","woo-gutenberg-products-block")))):Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.BlockControls,null,Object(i.createElement)(h.Toolbar,null,Object(i.createElement)(N,{onClick:function(){return d(!0)}},Object(u.__)("Switch product…","woo-gutenberg-products-block")))),Object(i.createElement)(t,r)))}}}),z=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(i.createElement)("path",{d:"M17 3H7a2 2 0 00-2 2v16l7-3 7 3V5a2 2 0 00-2-2z"})),B=Object(u.__)("Product Title","woo-gutenberg-products-block"),I=Object(i.createElement)(b.a,{srcElement:z}),L=Object(u.__)("Display the title of a product.","woo-gutenberg-products-block"),T=function(e){var t=e.color,r=e.fontSize,n=e.setFontSize,c=e.setColor,o=e.attributes,a=e.setAttributes,s=o.headingLevel,b=o.productLink,p=o.align;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.BlockControls,null,Object(i.createElement)(y.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:s,onChange:function(e){return a({headingLevel:e})}}),Object(f.T)()&&Object(i.createElement)(l.AlignmentToolbar,{value:p,onChange:function(e){a({align:e})}})),Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.ToggleControl,{label:Object(u.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(u.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:b,onChange:function(){return a({productLink:!b})}})),Object(f.T)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Text settings","woo-gutenberg-products-block")},Object(i.createElement)(l.FontSizePicker,{value:r.size,onChange:n})),Object(i.createElement)(l.PanelColorSettings,{title:Object(u.__)("Color settings","woo-gutenberg-products-block"),colorSettings:[{value:t.color,onChange:c,label:Object(u.__)("Text color","woo-gutenberg-products-block")}]}))),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(_.a,o)))},R=Object(f.T)()?Object(w.compose)([Object(l.withFontSizes)("fontSize"),Object(l.withColors)("color",{textColor:"color"}),D({icon:I,label:B,description:Object(u.__)("Choose a product to display it's title.","woo-gutenberg-products-block")})])(T):T;function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var A={title:B,description:L,icon:{src:I,foreground:"#874FB9"},attributes:v.a,edit:R};Object(s.registerBlockType)("woocommerce/product-title",F(F({},j),A));var M=r(507),H=r(508),Q=Object(u.__)("Product Price","woo-gutenberg-products-block"),U=Object(i.createElement)(b.a,{srcElement:H.a}),q=Object(u.__)("Display the price of a product.","woo-gutenberg-products-block"),Y=function(e){var t=e.fontSize,r=e.setFontSize,n=e.color,c=e.setColor,o=e.colorLabel;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.FontSizePicker,{value:t.size,onChange:r}),Object(i.createElement)(h.BaseControl,{label:o},Object(i.createElement)(l.ColorPalette,{value:n.color,onChange:c,label:Object(u.__)("Color")})))},K=function(e){var t=e.fontSize,r=e.saleFontSize,n=e.setFontSize,c=e.setSaleFontSize,o=e.color,a=e.saleColor,s=e.setColor,b=e.setSaleColor,p=e.attributes,d=e.setAttributes,m=p.align;return Object(i.createElement)(i.Fragment,null,Object(f.T)()&&Object(i.createElement)(l.BlockControls,null,Object(i.createElement)(l.AlignmentToolbar,{value:m,onChange:function(e){d({align:e})}})),Object(i.createElement)(l.InspectorControls,null,Object(f.T)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:o,setColor:s,fontSize:t,setFontSize:n,colorLabel:Object(u.__)("Color","woo-gutenberg-products-block")})),Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Sale price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:a,setColor:b,fontSize:r,setFontSize:c,colorLabel:Object(u.__)("Color","woo-gutenberg-products-block")})))),Object(i.createElement)(M.default,p))},G=Object(f.T)()?Object(w.compose)([Object(l.withFontSizes)("fontSize"),Object(l.withFontSizes)("saleFontSize"),Object(l.withFontSizes)("originalFontSize"),Object(l.withColors)("color",{textColor:"color"}),Object(l.withColors)("saleColor",{textColor:"saleColor"}),Object(l.withColors)("originalColor",{textColor:"originalColor"}),D({icon:U,label:Q,description:Object(u.__)("Choose a product to display it's price.","woo-gutenberg-products-block")})])(K):K;function W(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?W(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var $={productId:{type:"number",default:0}};function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(f.T)()&&($=J(J({},$),{},{align:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"},saleFontSize:{type:"string"},customSaleFontSize:{type:"number"},color:{type:"string"},saleColor:{type:"string"},customColor:{type:"string"},customSaleColor:{type:"string"}}));var ee={title:Q,description:q,icon:{src:U,foreground:"#874FB9"},attributes:$,edit:G};Object(s.registerBlockType)("woocommerce/product-price",Z(Z({},j),ee));var te=r(374),re=r(187),ne=r(72),ce=r(3),oe=r(375),ae=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"})),ie=Object(u.__)("Product Image","woo-gutenberg-products-block"),ue=Object(i.createElement)(b.a,{srcElement:ae}),le=Object(u.__)("Display the main product image","woo-gutenberg-products-block"),se=D({icon:ue,label:ie,description:Object(u.__)("Choose a product to display it's image.","woo-gutenberg-products-block")})((function(e){var t=e.attributes,r=e.setAttributes,n=t.productLink,c=t.imageSizing,o=t.showSaleBadge,a=t.saleBadgeAlign;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.ToggleControl,{label:Object(u.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(u.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:function(){return r({productLink:!n})}}),Object(i.createElement)(h.ToggleControl,{label:Object(u.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(u.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:o,onChange:function(){return r({showSaleBadge:!o})}}),o&&Object(i.createElement)(ne.a,{label:Object(u.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:a,options:[{label:Object(u.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(u.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(u.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:function(e){return r({saleBadgeAlign:e})}}),Object(i.createElement)(ne.a,{label:Object(u.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(re.a)(Object(u.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(i.createElement)("a",{href:"".concat(Object(ce.getAdminLink)("customize.php"),"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images"),target:"_blank",rel:"noopener noreferrer"})}),value:c,options:[{label:Object(u.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(u.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:function(e){return r({imageSizing:e})}}))),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(oe.a,t)))}));function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var de={title:ie,description:le,icon:{src:ue,foreground:"#874FB9"},attributes:te.a,edit:se};Object(s.registerBlockType)("woocommerce/product-image",pe(pe({},j),de));var fe={productId:{type:"number",default:0}},me=r(509),Oe=r(806),ge=Object(u.__)("Product Rating","woo-gutenberg-products-block"),je=Object(i.createElement)(b.a,{srcElement:Oe.a});function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function he(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var we={title:ge,description:Object(u.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:je,foreground:"#874FB9"},attributes:fe,edit:D({icon:je,label:ge,description:Object(u.__)("Choose a product to display it's rating.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(me.default,t)}))};Object(s.registerBlockType)("woocommerce/product-rating",he(he({},j),we));var ye={productId:{type:"number",default:0}},_e=r(510),ke=r(824),Ee=Object(u.__)("Add to Cart Button","woo-gutenberg-products-block"),Pe=Object(i.createElement)(b.a,{srcElement:ke.a});function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ne={title:Ee,description:Object(u.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),icon:{src:Pe,foreground:"#874FB9"},attributes:ye,edit:D({icon:Pe,label:Ee,description:Object(u.__)("Choose a product to display it's add to cart button.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(h.Disabled,null,Object(i.createElement)(_e.default,t))}))};Object(s.registerBlockType)("woocommerce/product-button",Se(Se({},j),Ne));var xe={productId:{type:"number",default:0}},De=r(512),ze=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M21 11.01L3 11v2h18zM3 16h12v2H3zM21 6H3v2.01L21 8z"})),Be=Object(u.__)("Product Summary","woo-gutenberg-products-block"),Ie=Object(i.createElement)(b.a,{srcElement:ze});function Le(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Te(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Le(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Le(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Re={title:Be,description:Object(u.__)("Display a short description about a product.","woo-gutenberg-products-block"),icon:{src:Ie,foreground:"#874FB9"},attributes:xe,edit:D({icon:Ie,label:Be,description:Object(u.__)("Choose a product to display it's short description.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(De.default,t)}))};Object(s.registerBlockType)("woocommerce/product-summary",Te(Te({},j),Re));var Ve={productId:{type:"number",default:0}},Fe=r(257),Ae=r(798),Me=Object(u.__)("On-Sale Badge","woo-gutenberg-products-block"),He=Object(i.createElement)(b.a,{srcElement:Ae.a});function Qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var qe={title:Me,description:Object(u.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:He,foreground:"#874FB9"},supports:{html:!1},attributes:Ve,edit:D({icon:He,label:Me,description:Object(u.__)("Choose a product to display it's sale-badge.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(Fe.default,t)}))};Object(s.registerBlockType)("woocommerce/product-sale-badge",Ue(Ue({},j),qe));var Ye={productId:{type:"number",default:0}},Ke=r(134),Ge=r(513),We=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"})),Je=Object(u.__)("Product SKU","woo-gutenberg-products-block"),$e=Object(i.createElement)(b.a,{srcElement:We});function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var et={title:Je,description:Object(u.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:$e,foreground:"#874FB9"},attributes:Ye,edit:D({icon:$e,label:Je,description:Object(u.__)("Choose a product to display it's SKU.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ke.a,null),Object(i.createElement)(Ge.default,t))}))};Object(f.U)("woocommerce/product-sku",Ze(Ze({},j),et));var tt={productId:{type:"number",default:0}},rt=r(514),nt=r(791),ct=Object(u.__)("Product Category List","woo-gutenberg-products-block"),ot=Object(i.createElement)(b.a,{srcElement:nt.a});function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function it(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ut={title:ct,description:Object(u.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block"),icon:{src:ot,foreground:"#874FB9"},attributes:tt,edit:D({icon:ot,label:ct,description:Object(u.__)("Choose a product to display it's categories.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ke.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(rt.default,t)))}))};Object(f.U)("woocommerce/product-category-list",it(it({},j),ut));var lt={productId:{type:"number",default:0}},st=r(515),bt=Object(u.__)("Product Tag List","woo-gutenberg-products-block"),pt=Object(i.createElement)(b.a,{srcElement:Ae.a});function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mt={title:bt,description:Object(u.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:pt,foreground:"#874FB9"},attributes:lt,edit:D({icon:pt,label:bt,description:Object(u.__)("Choose a product to display it's tags.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ke.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(st.default,t)))}))};Object(f.U)("woocommerce/product-tag-list",ft(ft({},j),mt));var Ot={productId:{type:"number",default:0}},gt=r(516),jt=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("g",{fillRule:"evenodd"},Object(i.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)("path",{fillRule:"nonzero",d:"M20.5 5.2l-1.4-1.7C19 3.3 18.5 3 18 3H6c-.5 0-.9.2-1.2.5L3.5 5.3A2 2 0 003 6.5V19c0 1.1.9 2 2 2h14a2 2 0 002-2V6.5c0-.5-.2-1-.5-1.3zM6.2 5h11.6l.8 1H5.4l.8-1zM5 19V8h14v11H5z"}))),vt=Object(u.__)("Product Stock Indicator","woo-gutenberg-products-block"),ht=Object(i.createElement)(b.a,{srcElement:jt});function wt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var _t={title:vt,description:Object(u.__)("Display product stock status.","woo-gutenberg-products-block"),icon:{src:ht,foreground:"#874FB9"},attributes:Ot,edit:D({icon:ht,label:vt,description:Object(u.__)("Choose a product to display it's stock.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ke.a,null),Object(i.createElement)(gt.default,t))}))};Object(f.U)("woocommerce/product-stock-indicator",yt(yt({},j),_t));r(371);var kt=r(377),Et=Object(u.__)("Add to Cart","woo-gutenberg-products-block"),Pt=Object(i.createElement)(b.a,{srcElement:ke.a});function Ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function St(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ct(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ct(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Nt={title:Et,description:Object(u.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:Pt,foreground:"#874FB9"},edit:D({icon:Pt,label:Et,description:Object(u.__)("Choose a product to display it's add to cart form.","woo-gutenberg-products-block")})((function(e){var t=e.attributes,r=e.setAttributes,n=Object(x.useProductDataContext)().product,c=t.className,o=t.showFormElements;return Object(i.createElement)("div",{className:O()(c,"wc-block-components-product-add-to-cart")},Object(i.createElement)(Ke.a,{productId:n.id}),"external"!==n.type&&Object(i.createElement)(l.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Layout","woo-gutenberg-products-block")},Object(i.createElement)(h.ToggleControl,{label:Object(u.__)("Display form elements","woo-gutenberg-products-block"),help:Object(u.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:o,onChange:function(){return r({showFormElements:!o})}}))),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(kt.a,t)))})),attributes:r(376).a};Object(f.U)("woocommerce/product-add-to-cart",St(St({},j),Nt));var xt=r(21),Dt=r.n(xt),zt=r(19),Bt=r.n(zt),It=r(22),Lt=r.n(It),Tt=r(23),Rt=r.n(Tt),Vt=r(12),Ft=r.n(Vt),At=r(36),Mt=(r(2),r(79)),Ht=r(912),Qt=r(807),Ut=r(166),qt=function(e,t){var r=t.className,n=t.contentVisibility;return O()(e,r,{"has-image":n&&n.image,"has-title":n&&n.title,"has-rating":n&&n.rating,"has-price":n&&n.price,"has-button":n&&n.button})},Yt=function(e,t){return Object(i.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(i.createElement)("p",null,Object(u.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(i.createElement)(h.Button,{className:"wc-block-products__add-product-button",isDefault:!0,isLarge:!0,href:ce.adminUrl+"post-new.php?post_type=product"},Object(u.__)("Add new product","woo-gutenberg-products-block")+" ",Object(i.createElement)(b.a,{srcElement:Ut.a})),Object(i.createElement)(h.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(u.__)("Learn more","woo-gutenberg-products-block")))},Kt=function(e,t){return Object(i.createElement)(h.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(u.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))};function Gt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Wt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Gt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Gt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Jt=[["woocommerce/product-image"],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],$t=function e(t){return t&&0!==t.length?t.map((function(t){return[t.name,Wt(Wt({},t.attributes),{},{product:void 0,children:t.innerBlocks.length>0?e(t.innerBlocks):[]})]})):[]};r(825);function Xt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Zt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var er=function(e,t){var r=e.contentVisibility;return Object(i.createElement)(h.ToggleControl,{label:Object(u.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:r.orderBy,onChange:function(){return t({contentVisibility:Zt(Zt({},r),{},{orderBy:!r.orderBy})})}})},tr=function(e,t){return Object(i.createElement)(h.SelectControl,{label:Object(u.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(u.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(u.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(u.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(u.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(u.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(u.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:function(e){return t({orderby:e})}})},rr=r(24),nr=r.n(rr),cr=r(9),or=r(54),ar=r.n(or),ir=r(6),ur=r(46),lr=(r(828),function(e){var t=e.currentPage,r=e.displayFirstAndLastPages,n=e.displayNextAndPreviousArrows,c=e.pagesToDisplay,o=e.onPageChange,a=e.totalPages,l=function(e,t,r){if(r<=2)return{minIndex:null,maxIndex:null};var n=e-1,c=Math.max(Math.floor(t-n/2),2),o=Math.min(Math.ceil(t+(n-(t-c))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(o-t))),2),maxIndex:o}}(c,t,a),s=l.minIndex,b=l.maxIndex,p=r&&Boolean(1!==s),d=r&&Boolean(b!==a),f=r&&Boolean(s>3),m=r&&Boolean(b<a-2);p&&3===s&&(s-=1),d&&b===a-2&&(b+=1);var g=[];if(s&&b)for(var j=s;j<=b;j++)g.push(j);return Object(i.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(i.createElement)(ur.a,{screenReaderLabel:Object(u.__)("Navigate to another page","woo-gutenberg-products-block")}),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return o(t-1)},title:Object(u.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(i.createElement)(ur.a,{label:"<",screenReaderLabel:Object(u.__)("Previous page","woo-gutenberg-products-block")})),p&&Object(i.createElement)("button",{className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:function(){return o(1)},disabled:1===t},Object(i.createElement)(ur.a,{label:1,screenReaderLabel:Object(u.sprintf)(Object(u.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(i.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(u.__)("…","woo-gutenberg-products-block")),g.map((function(e){return Object(i.createElement)("button",{key:e,className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?null:function(){return o(e)},disabled:t===e},Object(i.createElement)(ur.a,{label:e,screenReaderLabel:Object(u.sprintf)(Object(u.__)("Page %d","woo-gutenberg-products-block"),e)}))})),m&&Object(i.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(u.__)("…","woo-gutenberg-products-block")),d&&Object(i.createElement)("button",{className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:function(){return o(a)},disabled:t===a},Object(i.createElement)(ur.a,{label:a,screenReaderLabel:Object(u.sprintf)(Object(u.__)("Page %d","woo-gutenberg-products-block"),a)})),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return o(t+1)},title:Object(u.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(i.createElement)(ur.a,{label:">",screenReaderLabel:Object(u.__)("Next page","woo-gutenberg-products-block")})))});lr.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var sr=lr,br=r(151),pr=(r(827),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,c=e.value;return Object(i.createElement)(br.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",defaultValue:t,name:"orderby",onChange:r,options:[{key:"menu_order",label:Object(u.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(u.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(u.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(u.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(u.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(u.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(u.__)("Order products by","woo-gutenberg-products-block"),value:c})}),dr=r(188),fr=Object(dr.a)((function(e){var t=e.product,r=e.attributes,n=e.instanceId,c=r.layoutConfig,o=Object(x.useInnerBlockLayoutContext)(),u=o.parentClassName,l=o.parentName,s=0===Object.keys(t).length,b=O()("".concat(u,"__product"),"wc-block-layout",{"is-loading":s});return Object(i.createElement)("li",{className:b,"aria-hidden":s},function e(t,r,n,c){if(n){var o=Object(Ht.a)(t);return n.map((function(n,u){var l=E()(n,2),s=l[0],b=l[1],p=void 0===b?{}:b,d=[];p.children&&p.children.length>0&&(d=e(t,r,p.children,c));var f=o[s];if(!f)return null;var m=r.id||0,O=["layout",s,u,c,m];return Object(i.createElement)(i.Suspense,{key:O.join("_"),fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},Object(i.createElement)(f,a()({},p,{children:d,product:r})))}))}}(l,t,c,n))})),mr=r(169),Or=r(201),gr=r(40),jr=r(60);function vr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function hr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wr=function(e){var t={namespace:"/wc/store",resourceName:"products"},r=Object(Or.a)(hr(hr({},t),{},{query:e})),n=r.results,c=r.isLoading,o=function(e,t){var r=t.namespace,n=t.resourceName,c=t.resourceValues,o=void 0===c?[]:c,a=t.query,i=void 0===a?{}:a;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");var u=Object(jr.a)(i),l=Object(jr.a)(o),s=Object(At.useSelect)((function(t){var c=t(gr.COLLECTIONS_STORE_KEY),o=[e,r,n,u,l];return{value:c.getCollectionHeader.apply(c,o),isLoading:c.hasFinishedResolution("getCollectionHeader",o)}}),[e,r,n,l,u]),b=s.value,p=s.isLoading;return{value:b,isLoading:void 0===p||p}}("x-wp-total",hr(hr({},t),{},{query:e})).value;return{products:n,totalProducts:parseInt(o,10),productsLoading:c}},yr=r(517),_r=r(181),kr=r(84),Er=(r(826),r(146)),Pr=function(){var e=Object(x.useInnerBlockLayoutContext)().parentClassName;return Object(i.createElement)("div",{className:"".concat(e,"__no-products")},Object(i.createElement)(b.a,{className:"".concat(e,"__no-products-image"),alt:"",srcElement:Er.a,size:100}),Object(i.createElement)("strong",{className:"".concat(e,"__no-products-title")},Object(u.__)("No products","woo-gutenberg-products-block")),Object(i.createElement)("p",{className:"".concat(e,"__no-products-description")},Object(u.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Cr=r(812),Sr=function(e){var t=e.resetCallback,r=void 0===t?function(){}:t,n=Object(x.useInnerBlockLayoutContext)().parentClassName;return Object(i.createElement)("div",{className:"".concat(n,"__no-products")},Object(i.createElement)(b.a,{className:"".concat(n,"__no-products-image"),alt:"",srcElement:Cr.a,size:100}),Object(i.createElement)("strong",{className:"".concat(n,"__no-products-title")},Object(u.__)("No products found","woo-gutenberg-products-block")),Object(i.createElement)("p",{className:"".concat(n,"__no-products-description")},Object(u.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(i.createElement)("button",{onClick:r},Object(u.__)("Reset Search","woo-gutenberg-products-block")))};function Nr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Dr=Object(_r.a)((function(e){var t=e.attributes,r=e.currentPage,n=e.onPageChange,c=e.onSortChange,o=e.sortValue,a=e.scrollToTop,l=Object(mr.c)(function(e){var t=e.sortValue,r=e.currentPage,n=e.attributes,c=n.columns,o=n.rows;return xr(xr({},function(e){switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}}(t)),{},{catalog_visibility:"catalog",per_page:c*o,page:r})}({attributes:t,sortValue:o,currentPage:r})),s=E()(l,1)[0],b=wr(s),p=b.products,d=b.totalProducts,f=b.productsLoading,m=Object(x.useInnerBlockLayoutContext)().parentClassName,g=function(e){e.order,e.orderby,e.page,e.per_page;return S()(e,["order","orderby","page","per_page"])}(s),j=Object(mr.b)("attributes",[]),v=E()(j,2),h=v[0],w=v[1],y=Object(mr.b)("min_price"),_=E()(y,2),k=_[0],P=_[1],C=Object(mr.b)("max_price"),N=E()(C,2),D=N[0],z=N[1],B=Object(yr.a)({totalQuery:g,totalProducts:d},(function(e){var t=e.totalQuery,r=e.totalProducts,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=n.totalQuery;return!Object(ir.isEqual)(t,c)&&Number.isFinite(r)})),I="object"===ar()(B)&&Object(ir.isEqual)(g,B.totalQuery);Object(i.useEffect)((function(){I||(n(1),B&&function(e){Number.isFinite(e)&&(0===e?Object(kr.speak)(Object(u.__)("No products found","woo-gutenberg-products-block")):Object(kr.speak)(Object(u.sprintf)(Object(u._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(d))}),[s]);var L,T,R,V,F,A=t.contentVisibility,M=t.columns*t.rows,H=!Number.isFinite(d)&&I?Math.ceil(B.totalProducts/M):Math.ceil(d/M),Q=p.length?p:Array.from({length:M}),U=0!==p.length||f,q=h.length>0||Number.isFinite(k)||Number.isFinite(D);return Object(i.createElement)("div",{className:(L=t.columns,T=t.rows,R=t.alignButtons,V=t.align,F=void 0!==V?"align"+V:"",O()(m,F,"has-"+L+"-columns",{"has-multiple-rows":T>1,"has-aligned-buttons":R}))},A.orderBy&&U&&Object(i.createElement)(pr,{onChange:c,value:o}),!U&&q&&Object(i.createElement)(Sr,{resetCallback:function(){w([]),P(null),z(null)}}),!U&&!q&&Object(i.createElement)(Pr,null),U&&Object(i.createElement)("ul",{className:"".concat(m,"__products")},Q.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(i.createElement)(fr,{key:e.id||r,attributes:t,product:e})}))),H>1&&Object(i.createElement)(sr,{currentPage:r,onPageChange:function(e){a({focusableSelector:"a, button"}),n(e)},totalPages:H}))})),zr=function(e){var t=e.attributes,r=Object(i.useState)(1),n=E()(r,2),c=n[0],o=n[1],a=Object(i.useState)(t.orderby),u=E()(a,2),l=u[0],s=u[1];Object(i.useEffect)((function(){s(t.orderby)}),[t.orderby]);return Object(i.createElement)(Dr,{attributes:t,currentPage:c,onPageChange:function(e){o(e)},onSortChange:function(e){var t=e.target.value;s(t),o(1)},sortValue:l})},Br=r(171);function Ir(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ft()(e);if(t){var c=Ft()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return Rt()(this,r)}}var Lr=function(e){Lt()(r,e);var t=Ir(r);function r(){return Dt()(this,r),t.apply(this,arguments)}return nr()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.urlParameterSuffix;return t.isPreview?Br.a:Object(i.createElement)(x.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)(zr,{attributes:t,urlParameterSuffix:r}))}}]),r}(cr.Component);function Tr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ft()(e);if(t){var c=Ft()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return Rt()(this,r)}}var Rr=function(e){Lt()(r,e);var t=Tr(r);function r(){var e;Dt()(this,r);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e=t.call.apply(t,[this].concat(o)),c()(Bt()(e),"state",{isEditing:!1,innerBlocks:[]}),c()(Bt()(e),"blockMap",Object(Ht.a)("woocommerce/all-products")),c()(Bt()(e),"componentDidMount",(function(){var t=e.props.block;e.setState({innerBlocks:t.innerBlocks})})),c()(Bt()(e),"getTitle",(function(){return Object(u.__)("All Products","woo-gutenberg-products-block")})),c()(Bt()(e),"getIcon",(function(){return Object(i.createElement)(b.a,{srcElement:d})})),c()(Bt()(e),"togglePreview",(function(){var t=e.props.debouncedSpeak;e.setState({isEditing:!e.state.isEditing}),e.state.isEditing||t(Object(u.__)("Showing All Products block preview.","woo-gutenberg-products-block"))})),c()(Bt()(e),"getInspectorControls",(function(){var t=e.props,r=t.attributes,n=t.setAttributes,c=r.columns,o=r.rows,a=r.alignButtons;return Object(i.createElement)(l.InspectorControls,{key:"inspector"},Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(i.createElement)(Mt.a,{columns:c,rows:o,alignButtons:a,setAttributes:n})),Object(i.createElement)(h.PanelBody,{title:Object(u.__)("Content Settings","woo-gutenberg-products-block")},er(r,n),tr(r,n)))})),c()(Bt()(e),"getBlockControls",(function(){var t=e.state.isEditing;return Object(i.createElement)(l.BlockControls,null,Object(i.createElement)(h.Toolbar,{controls:[{icon:"edit",title:Object(u.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return e.togglePreview()},isActive:t}]}))})),c()(Bt()(e),"renderEditMode",(function(){var t={template:e.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(e.blockMap)};return 0!==e.props.attributes.layoutConfig.length&&(t.renderAppender=!1),Object(i.createElement)(h.Placeholder,{icon:e.getIcon(),label:e.getTitle()},Object(u.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(i.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(i.createElement)(h.Tip,null,Object(u.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(i.createElement)(x.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(i.createElement)("ul",{className:"wc-block-grid__products"},Object(i.createElement)("li",{className:"wc-block-grid__product"},Object(i.createElement)(x.ProductDataContextProvider,{product:Qt.a[0]},Object(i.createElement)(l.InnerBlocks,t)))))),Object(i.createElement)("div",{className:"wc-block-all-products__actions"},Object(i.createElement)(h.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,isLarge:!0,onClick:function(){var t=e.props,r=t.block;(0,t.setAttributes)({layoutConfig:$t(r.innerBlocks)}),e.setState({innerBlocks:r.innerBlocks}),e.togglePreview()}},Object(u.__)("Done","woo-gutenberg-products-block")),Object(i.createElement)(h.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:function(){var t=e.props,r=t.block,n=t.replaceInnerBlocks,c=e.state.innerBlocks;n(r.clientId,c,!1),e.togglePreview()}},Object(u.__)("Cancel","woo-gutenberg-products-block")),Object(i.createElement)(h.IconButton,{className:"wc-block-all-products__reset-button",icon:Object(i.createElement)(b.a,{srcElement:d}),label:Object(u.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:function(){var t=e.props,r=t.block,n=t.replaceInnerBlocks,c=[];Jt.map((function(e){var t=E()(e,2),r=t[0],n=t[1];return c.push(Object(s.createBlock)(r,n)),!0})),n(r.clientId,c,!1),e.setState({innerBlocks:r.innerBlocks})}},Object(u.__)("Reset Layout","woo-gutenberg-products-block")))))})),c()(Bt()(e),"renderViewMode",(function(){var t=e.props.attributes,r=t.layoutConfig,n=r&&0!==r.length,c=e.getTitle(),o=e.getIcon();return n?Object(i.createElement)(h.Disabled,null,Object(i.createElement)(Lr,{attributes:t})):Kt(c,o)})),c()(Bt()(e),"render",(function(){var t=e.props.attributes,r=e.state.isEditing,n=e.getTitle(),c=e.getIcon();return f.q?Object(i.createElement)("div",{className:qt("wc-block-all-products",t)},e.getBlockControls(),e.getInspectorControls(),r?e.renderEditMode():e.renderViewMode()):Yt(n,c)})),e}return r}(i.Component),Vr=Object(w.compose)(h.withSpokenMessages,Object(At.withSelect)((function(e,t){var r=t.clientId;return{block:(0,e("core/block-editor").getBlock)(r)}})),Object(At.withDispatch)((function(e){return{replaceInnerBlocks:e("core/block-editor").replaceInnerBlocks}})))(Rr),Fr={columns:f.l,rows:f.n,alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Jt,isPreview:!1};function Ar(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ar(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ar(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Hr={title:Object(u.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(i.createElement)(b.a,{srcElement:d}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(u.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(u.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:Fr,edit:function(e){return Object(i.createElement)(Vr,e)},save:function(e){var t=e.attributes,r={};Object.keys(t).sort().forEach((function(e){r[e]=t[e]}));var n={"data-attributes":JSON.stringify(r)};return Object(i.createElement)("div",a()({className:qt("wc-block-all-products",t)},n),Object(i.createElement)(l.InnerBlocks.Content,null))}};Object(s.registerBlockType)("woocommerce/all-products",Mr(Mr({},Hr),{},{deprecated:[{attributes:Object.assign({},Hr.attributes,{rows:{type:"number",default:1}}),save:function(e){var t=e.attributes,r={"data-attributes":JSON.stringify(t)};return Object(i.createElement)("div",a()({className:qt("wc-block-all-products",t)},r),Object(i.createElement)(l.InnerBlocks.Content,null))}}]}))},9:function(e,t){!function(){e.exports=this.React}()},91:function(e,t){!function(){e.exports=this.wp.date}()},912:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(56),c=r(0),o=r(5);r.p=o.R,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(11)]).then(r.bind(null,507))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(3),r.e(10)]).then(r.bind(null,932))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(17)]).then(r.bind(null,933))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(c.lazy)((function(){return r.e(12).then(r.bind(null,509))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(2),r.e(8)]).then(r.bind(null,510))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(c.lazy)((function(){return r.e(15).then(r.bind(null,512))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(c.lazy)((function(){return r.e(3).then(r.bind(null,257))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(c.lazy)((function(){return r.e(13).then(r.bind(null,513))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(c.lazy)((function(){return r.e(9).then(r.bind(null,514))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(c.lazy)((function(){return r.e(16).then(r.bind(null,515))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(c.lazy)((function(){return r.e(14).then(r.bind(null,516))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(2),r.e(7)]).then(r.bind(null,934))}))});var a=function(e){return Object(n.getRegisteredBlockComponents)(e)}},92:function(e,t){!function(){e.exports=this.wp.autop}()},97:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),u=r(271),l=(r(2),r(8)),s=r.n(l);r(229);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,l=a()(e,["className","showSpinner","children"]),b=s()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(i.createElement)(u.a,c()({className:b},l),n&&Object(i.createElement)("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),Object(i.createElement)("span",{className:"wc-block-components-button__text"},o))}},99:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=Object(n.createContext)("page"),o=function(){return Object(n.useContext)(c)};c.Provider}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],u=t[2],b=0,p=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(c,a)&&c[a]&&p.push(c[a][0]),c[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);p.length;)p.shift()();return o.push.apply(o,u||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,i=1;i<r.length;i++){var s=r[i];0!==c[s]&&(n=!1)}n&&(o.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},c={5:0,2:0,3:0,8:0,9:0,11:0,12:0,13:0,14:0,15:0,16:0},o=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.e=function(e){var t=[],r=c[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=c[e]=[t,n]}));t.push(r[2]=n);var o,i=document.createElement("script");i.charset="utf-8",i.timeout=120,a.nc&&i.setAttribute("nonce",a.nc),i.src=function(e){return a.p+""+({1:"atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title",2:"atomic-block-components/add-to-cart~atomic-block-components/button",3:"atomic-block-components/sale-badge",7:"atomic-block-components/add-to-cart",10:"atomic-block-components/image",17:"atomic-block-components/title"}[e]||e)+".js"}(e);var s=new Error;o=function(t){i.onerror=i.onload=null,clearTimeout(u);var r=c[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;s.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",s.name="ChunkLoadError",s.type=n,s.request=o,r[1](s)}c[e]=void 0}};var u=setTimeout((function(){o({type:"timeout",target:i})}),12e4);i.onerror=i.onload=o,document.head.appendChild(i)}return Promise.all(t)},a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var u=0;u<i.length;u++)t(i[u]);var l=s;return o.push([823,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},107:function(e,t){},108:function(e,t){},109:function(e,t){},110:function(e,t){},111:function(e,t){},112:function(e,t){},113:function(e,t){},114:function(e,t){},115:function(e,t){},116:function(e,t){},117:function(e,t){},118:function(e,t){},119:function(e,t){},120:function(e,t){},121:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},133:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(41),c=r(36),o=r(262),a=r(33),i=r(6),s={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(o.b)(),r=t.isEditor,u=t.previewData,l=(null==u?void 0:u.previewCart)||{},b=e.shouldSelect,p=Object(c.useSelect)((function(e,t){var c=t.dispatch;if(!b)return s;if(r)return{cartCoupons:l.coupons,cartItems:l.items,cartItemsCount:l.items_count,cartItemsWeight:l.items_weight,cartNeedsPayment:l.needs_payment,cartNeedsShipping:l.needs_shipping,cartItemErrors:[],cartTotals:l.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:l.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==l?void 0:l.receiveCart)?l.receiveCart:function(){}};var o=e(n.CART_STORE_KEY),u=o.getCartData(),p=o.getCartErrors(),d=o.getCartTotals(),f=!o.hasFinishedResolution("getCartData"),m=o.areShippingRatesLoading(),O=c(n.CART_STORE_KEY).receiveCart,g=Object(i.mapValues)(u.shippingAddress,(function(e){return Object(a.decodeEntities)(e)}));return{cartCoupons:u.coupons,cartItems:u.items||[],cartItemsCount:u.itemsCount,cartItemsWeight:u.itemsWeight,cartNeedsPayment:u.needsPayment,cartNeedsShipping:u.needsShipping,cartItemErrors:u.errors||[],cartTotals:d,cartIsLoading:f,cartErrors:p,shippingAddress:g,shippingRates:u.shippingRates||[],shippingRatesLoading:m,hasShippingAddress:!!g.country,receiveCart:O}}),[b]);return p}},134:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(60),a=r(167),i=r(3),s=r(14),u=r(42);t.a=function(e){var t=(Object(u.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(n.createElement)("a",{href:"".concat(i.ADMIN_URL,"post.php?post=").concat(t,"&action=edit"),target:"_blank",rel:"noopener noreferrer"},Object(c.__)("Edit this product's details","woo-gutenberg-products-block"),Object(n.createElement)(o.a,{srcElement:a.a,size:16}))),Object(n.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(c.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},143:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(7),c=r.n(n),o=r(269),a=r(0);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u=function(){var e=Object(o.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.createSnackbarNotice,i=e.setIsSuppressed,u=Object(a.useRef)(t);Object(a.useEffect)((function(){u.current=t}),[t]);var l=Object(a.useMemo)((function(){return{hasNoticesOfType:function(e){return u.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;u.current.map((function(t){return null!==e&&t.status!==e||n(t.id),!0}))},removeNotice:n}}),[n]),b=Object(a.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("default",e,s({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("error",e,s({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("warning",e,s({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("info",e,s({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("success",e,s({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(e,t)}}}),[r,c]);return s(s(s({notices:t},l),b),{},{setIsSuppressed:i})}},144:function(e,t){!function(){e.exports=this.wp.wordcount}()},145:function(e,t,r){"use strict";var n=r(56),c=r.n(n),o=r(10),a=r.n(o),i=r(0),s=r(1),u=r(6),l=(r(2),r(50)),b=r(4),p=r(8),d=r.n(p),f=r(21),m=r.n(f),O=r(24),g=r.n(O),j=r(22),h=r.n(j),v=r(23),y=r.n(v),w=r(12),E=r.n(w),_=r(25);function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=E()(e);if(t){var c=E()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return y()(this,r)}}var P=Object(_.createHigherOrderComponent)((function(e){var t=function(t){h()(n,t);var r=k(n);function n(){return m()(this,n),r.apply(this,arguments)}return g()(n,[{key:"render",value:function(){var t=this.props.selected;return Object(i.createElement)(e,a()({},this.props,{selected:Object(u.isNil)(t)?[]:[t]}))}}]),n}(i.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),C=r(293),S=r(15),x=r.n(S),N=r(37),D=r.n(N),B=r(19),z=r.n(B),R=r(7),V=r.n(R),I=r(45),L=r.n(I),T=r(40),A=r(43);function F(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function M(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?F(Object(r),!0).forEach((function(t){V()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=E()(e);if(t){var c=E()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return y()(this,r)}}var q=Object(_.createHigherOrderComponent)((function(e){var t=function(t){h()(n,t);var r=H(n);function n(){var e;m()(this,n);for(var t=arguments.length,c=new Array(t),o=0;o<t;o++)c[o]=arguments[o];return e=r.call.apply(r,[this].concat(c)),V()(z()(e),"state",{error:null,loading:!1,variations:{}}),V()(z()(e),"loadVariations",(function(){var t=e.props.products,r=e.state,n=r.loading,c=r.variations;if(!n){var o=e.getExpandedProduct();if(o&&!c[o]){var a=t.find((function(e){return e.id===o}));a.variations&&0!==a.variations.length?(e.setState({loading:!0}),Object(T.g)(o).then((function(t){var r=t.map((function(e){return M(M({},e),{},{parent:o})}));e.setState({variations:M(M({},e.state.variations),{},V()({},o,r)),loading:!1,error:null})})).catch(function(){var t=D()(x.a.mark((function t(r){var n;return x.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(A.a)(r);case 2:n=t.sent,e.setState({variations:M(M({},e.state.variations),{},V()({},o,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())):e.setState({variations:M(M({},e.state.variations),{},V()({},o,null)),loading:!1,error:null})}}})),e}return g()(n,[{key:"componentDidMount",value:function(){var e=this.props,t=e.selected,r=e.showVariations;t&&r&&this.loadVariations()}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.isLoading,n=t.selected;t.showVariations&&(!L()(e.selected,n)||e.isLoading&&!r)&&this.loadVariations()}},{key:"isProductId",value:function(e){return this.props.products.some((function(t){return t.id===e}))}},{key:"findParentProduct",value:function(e){return this.props.products.filter((function(t){return t.variations&&t.variations.find((function(t){return t.id===e}))}))[0].id}},{key:"getExpandedProduct",value:function(){var e=this.props,t=e.isLoading,r=e.selected;if(!e.showVariations)return null;var n=r&&r.length?r[0]:null;return n?this.prevSelectedItem=n:this.prevSelectedItem&&(t||this.isProductId(this.prevSelectedItem)||(n=this.prevSelectedItem)),!t&&n?this.isProductId(n)?n:this.findParentProduct(n):null}},{key:"render",value:function(){var t=this.props,r=t.error,n=t.isLoading,c=this.state,o=c.error,s=c.loading,u=c.variations;return Object(i.createElement)(e,a()({},this.props,{error:o||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:u,variationsLoading:s}))}}]),n}(i.Component);return V()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),U=r(60),Q=r(59),W=Object(i.createElement)(Q.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),Y=Object(i.createElement)(Q.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"})),G=r(49);r(197);function K(e,t){if(!t)return e;var r=new RegExp(Object(u.escapeRegExp)(t),"ig");return e.replace(r,"<strong>$&</strong>")}var $=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(i.createElement)(U.a,{srcElement:W}):Object(i.createElement)(U.a,{srcElement:Y})},J={list:Object(s.__)("Products","woo-gutenberg-products-block"),noItems:Object(s.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(s.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(s.__)("Product search results updated.","woo-gutenberg-products-block")},X=function(e){var t=e.expandedProduct,r=e.error,n=e.isLoading,o=e.onChange,p=e.onSearch,f=e.products,m=e.renderItem,O=e.selected,g=e.showVariations,j=e.variations,h=e.variationsLoading,v=function(e){var r=e.item,n=e.search,c=e.depth,o=void 0===c?0:c,p=e.isSelected,f=e.onSelect,m=r.variations&&Array.isArray(r.variations)?r.variations.length:0,O=d()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(o),{"is-searching":n.length>0,"is-skip-level":0===o&&0!==r.parent,"is-variable":m>0}),g=Object.assign({},e);delete g.isSingle;var j={role:"menuitemradio"};return r.breadcrumbs.length&&(j["aria-label"]="".concat(r.breadcrumbs[0],": ").concat(r.name)),m&&(j["aria-expanded"]=r.id===t),r.breadcrumbs.length?(Object(u.isEmpty)(r.variation)||(r.name=r.variation),Object(i.createElement)(l.b,a()({className:O},e,j))):[Object(i.createElement)(b.MenuItem,a()({key:"product-".concat(r.id),isSelected:p},g,j,{className:O,onClick:function(){f(r)()}}),Object(i.createElement)("span",{className:"woocommerce-search-list__item-state"},$(p)),Object(i.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(i.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:K(r.name,n)}})),m?Object(i.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(s.sprintf)(Object(s._n)("%d variation","%d variations",m,"woo-gutenberg-products-block"),m)):null),t===r.id&&m>0&&h&&Object(i.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(i.createElement)(b.Spinner,null))]};if(r)return Object(i.createElement)(G.a,{error:r});var y=j&&j[t]?j[t]:[],w=[].concat(c()(f),c()(y));return Object(i.createElement)(l.a,{className:"woocommerce-products",list:w,isLoading:n,isSingle:!0,selected:w.filter((function(e){var t=e.id;return O.includes(t)})),onChange:o,renderItem:m||(g?v:null),onSearch:p,messages:J,isHierarchical:!0})};X.defaultProps={expandedProduct:null,selected:[],showVariations:!1};t.a=P(Object(C.a)(q(X)))},146:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=o},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},151:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(8)),o=r.n(c),a=r(48),i=r(189);r(199);t.a=Object(i.a)((function(e){var t=e.className,r=e.instanceId,c=e.defaultValue,i=e.label,s=e.onChange,u=e.options,l=e.screenReaderLabel,b=e.readOnly,p=e.value,d="wc-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:o()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(a.a,{label:i,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(n.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:c,onChange:s,readOnly:b,value:p},u.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},152:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return b}));var n=r(7),c=r.n(n),o=r(6);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var s="add_event_callback",u="remove_event_callback",l={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(o.uniqueId)(),type:s,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:u,eventType:e}}},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=t.type,n=t.eventType,o=t.id,a=t.callback,l=t.priority,b=new Map(e[n]);switch(r){case s:return b.set(o,{priority:l,callback:a}),i(i({},e),{},c()({},n,b));case u:return b.delete(o),i(i({},e),{},c()({},n,b))}return e}},154:function(e,t,r){"use strict";var n=r(21),c=r.n(n),o=r(24),a=r.n(o),i=r(22),s=r.n(i),u=r(23),l=r.n(u),b=r(12),p=r.n(b),d=r(0),f=r(6),m=r(1),O=r(4);function g(e){var t=e.level,r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?Object(d.createElement)(O.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(d.createElement)(O.Path,{d:r[t]})):null}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=p()(e);if(t){var c=p()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return l()(this,r)}}var h=function(e){s()(r,e);var t=j(r);function r(){return c()(this,r),t.apply(this,arguments)}return a()(r,[{key:"createLevelControl",value:function(e,t,r){var n=e===t;return{icon:Object(d.createElement)(g,{level:e}),title:Object(m.sprintf)(Object(m.__)("Heading %d"),e),isActive:n,onClick:function(){return r(e)}}}},{key:"render",value:function(){var e=this,t=this.props,r=t.isCollapsed,n=void 0===r||r,c=t.minLevel,o=t.maxLevel,a=t.selectedLevel,i=t.onChange;return Object(d.createElement)(O.Toolbar,{isCollapsed:n,icon:Object(d.createElement)(g,{level:a}),controls:Object(f.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),r}(d.Component);t.a=h},157:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(11),c=r.n(n),o=r(0),a=function(){var e=Object(o.useState)(),t=c()(e,2)[1];return function(e){return t((function(){throw e}))}}},167:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("mask",{id:"external-mask",width:"24",height:"24",x:"0",y:"0",maskUnits:"userSpaceOnUse"},Object(n.createElement)("path",{fill:"#fff",d:"M6.3431 6.3431v1.994l7.8984.0072-8.6055 8.6054 1.4142 1.4143 8.6055-8.6055.0071 7.8984h1.994V6.3431H6.3431z"})),Object(n.createElement)("g",{mask:"url(#external-mask)"},Object(n.createElement)("path",{d:"M0 0h24v24H0z"})));t.a=o},17:function(e,t){!function(){e.exports=this.wp.blocks}()},170:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(11),c=r.n(n),o=r(41),a=r(36),i=r(0),s=r(99),u=r(6),l=r(61),b=function(e){var t=Object(s.a)();e=e||t;var r=Object(a.useSelect)((function(t){return t(o.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),n=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[r,Object(i.useCallback)((function(t){n(e,t)}),[e])]},p=function(e,t,r){var n=Object(s.a)();r=r||n;var c=Object(a.useSelect)((function(n){return n(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),u=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(i.useCallback)((function(t){u(r,e,t)}),[r,e])]},d=function(e,t){var r=Object(s.a)(),n=b(t=t||r),o=c()(n,2),a=o[0],p=o[1],d=Object(l.a)(e),f=Object(i.useRef)(!1);return Object(i.useEffect)((function(){p(Object(u.assign)({},a,d)),f.current=!0}),[d]),f.current?[a,p]:[e,p]}},172:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(5),o=Object(n.createElement)("img",{src:c.S+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}})},173:function(e,t,r){"use strict";var n=r(0),c=r(144),o=r(93),a=function(e){var t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},i=function(e){return e.replace(/<\/?[a-z][^>]*?>/gi,"")},s=function(e,t){return e.replace(/[\s|\.\,]+$/i,"")+t},u=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",n=i(e),c=n.split(" ").splice(0,t).join(" ");return Object(o.autop)(s(c,r))},l=function(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…",c=i(e),a=c.slice(0,t);if(r)return Object(o.autop)(s(a,n));var u=a.match(/([\s]+)/g),l=u?u.length:0,b=c.slice(0,t+l);return Object(o.autop)(s(b,n))};t.a=function(e){var t=e.source,r=e.maxLength,i=void 0===r?15:r,s=e.countType,b=void 0===s?"words":s,p=e.className,d=void 0===p?"":p,f=Object(n.useMemo)((function(){return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words",n=Object(o.autop)(e),i=Object(c.count)(n,r);if(i<=t)return n;var s=a(n),b=Object(c.count)(s,r);return b<=t?s:"words"===r?u(s,t):l(s,t,"characters_including_spaces"===r)}(t,i,b)}),[t,i,b]);return Object(n.createElement)(n.RawHTML,{className:d},f)}},18:function(e,t){!function(){e.exports=this.wp.url}()},182:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(21),a=r.n(o),i=r(24),s=r.n(i),u=r(19),l=r.n(u),b=r(22),p=r.n(b),d=r(23),f=r.n(d),m=r(12),O=r.n(m),g=r(7),j=r.n(g),h=r(0),v=r(9);r(253);function y(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var c=O()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return f()(this,r)}}t.a=function(e){var t=function(t){p()(n,t);var r=y(n);function n(){var e;return a()(this,n),e=r.call(this),j()(l()(e),"scrollToTopIfNeeded",(function(){var t=e.scrollPointRef.current.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollPointRef.current.scrollIntoView()})),j()(l()(e),"moveFocusToTop",(function(t){var r=e.scrollPointRef.current.parentElement.querySelectorAll(t);r.length&&r[0].focus()})),j()(l()(e),"scrollToTop",(function(t){window&&Number.isFinite(window.innerHeight)&&(e.scrollToTopIfNeeded(),t&&t.focusableSelector&&e.moveFocusToTop(t.focusableSelector))})),e.scrollPointRef=Object(v.createRef)(),e}return s()(n,[{key:"render",value:function(){return Object(h.createElement)(v.Fragment,null,Object(h.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:this.scrollPointRef,"aria-hidden":!0}),Object(h.createElement)(e,c()({},this.props,{scrollToTop:this.scrollToTop})))}}]),n}(v.Component);return t.displayName="withScrollToTop",t}},190:function(e,t){},197:function(e,t){},199:function(e,t){},203:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(41),c=r(36),o=r(0),a=r(157),i=r(61),s=function(e){var t=e.namespace,r=e.resourceName,s=e.resourceValues,u=void 0===s?[]:s,l=e.query,b=void 0===l?{}:l,p=e.shouldSelect,d=void 0===p||p;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");var f=Object(o.useRef)({results:[],isLoading:!0}),m=Object(i.a)(b),O=Object(i.a)(u),g=Object(a.a)(),j=Object(c.useSelect)((function(e){if(!d)return null;var c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,m,O],a=c.getCollectionError.apply(c,o);return a&&g(a),{results:c.getCollection.apply(c,o),isLoading:!c.hasFinishedResolution("getCollection",o)}}),[t,r,O,m,d]);return null!==j&&(f.current=j),f.current}},226:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(84),o=(r(2),r(232),function(e){var t=e.errorMessage,r=void 0===t?"":t,o=e.propertyName,a=void 0===o?"":o,i=e.elementId,s=void 0===i?"":i,u=Object(c.b)(),l=u.getValidationError,b=u.getValidationErrorId;if(!r){var p=l(a)||{};if(!p.message||p.hidden)return null;r=p.message}return Object(n.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(n.createElement)("p",{id:b(s)},r))})},230:function(e,t){},231:function(e,t){},232:function(e,t){},25:function(e,t){!function(){e.exports=this.wp.compose}()},252:function(e,t,r){"use strict";r.d(t,"c",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return m}));var n=r(7),c=r.n(n),o=r(52),a=r.n(o),i=r(3);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l,b,p={code:i.CURRENCY.code,symbol:i.CURRENCY.symbol,thousandSeparator:i.CURRENCY.thousandSeparator,decimalSeparator:i.CURRENCY.decimalSeparator,minorUnit:i.CURRENCY.precision,prefix:(l=i.CURRENCY.symbol,b=i.CURRENCY.symbolPosition,{left:l,left_space:" "+l,right:"",right_space:""}[b]||""),suffix:function(e,t){return{left:"",left_space:"",right:e,right_space:" "+e}[t]||""}(i.CURRENCY.symbol,i.CURRENCY.symbolPosition)},d=function(e){if(!e||"object"!==a()(e))return p;var t=e.currency_code,r=e.currency_symbol,n=e.currency_thousand_separator,c=e.currency_decimal_separator,o=e.currency_minor_unit,i=e.currency_prefix,s=e.currency_suffix;return{code:t||"USD",symbol:r||"$",thousandSeparator:"string"==typeof n?n:",",decimalSeparator:"string"==typeof c?c:".",minorUnit:Number.isFinite(o)?o:2,prefix:"string"==typeof i?i:"$",suffix:"string"==typeof s?s:""}},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u(u({},p),e)},m=function(e,t){if(""===e||void 0===e)return"";var r=parseInt(e,10);if(!Number.isFinite(r))return"";var n=f(t),c=r/Math.pow(10,n.minorUnit),o=n.prefix+c+n.suffix,a=document.createElement("textarea");return a.innerHTML=o,a.value}},253:function(e,t){},259:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(8),s=r.n(i),u=r(48),l=r(42),b=r(72);r(533);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=e.align,n=Object(l.useInnerBlockLayoutContext)().parentClassName,i=Object(l.useProductDataContext)().product;if(!i.id||!i.on_sale)return null;var b="string"==typeof r?"wc-block-components-product-sale-badge--align".concat(r):"";return Object(o.createElement)("div",{className:s()("wc-block-components-product-sale-badge",t,b,c()({},"".concat(n,"__product-onsale"),n))},Object(o.createElement)(u.a,{label:Object(a.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Product on sale","woo-gutenberg-products-block")}))}))},260:function(e,t){!function(){e.exports=this.wp.deprecated}()},261:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),s=r(59),u=Object(i.createElement)((function(e){var t=e.className,r=e.size,n=void 0===r?20:r,o=a()(e,["className","size"]);return Object(i.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},o),Object(i.createElement)("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))}),null),l=r(275);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=u;break;case"no-alt":t=l.a}return t?Object(i.cloneElement)(t,{size:e.size||20,className:e.className}):null}},262:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(0),c=r(36),o=Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{}}),a=function(){return Object(n.useContext)(o)},i=function(e){var t=e.children,r=e.currentPostId,a=void 0===r?0:r,i=e.previewData,s=void 0===i?{}:i,u={isEditor:!0,currentPostId:Object(c.useSelect)((function(e){return a||e("core/editor").getCurrentPostId()}),[a]),previewData:s};return Object(n.createElement)(o.Provider,{value:u},t)}},269:function(e,t,r){"use strict";r.d(t,"b",(function(){return E})),r.d(t,"a",(function(){return _}));var n=r(7),c=r.n(n),o=r(11),a=r.n(o),i=r(0),s=(r(2),r(36)),u=r(10),l=r.n(u),b=r(8),p=r.n(b),d=r(929),f=(r(230),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),m=function(e){var t=e.className,r=e.notices,n=E().removeNotice,c=p()(t,"wc-block-components-notices"),o=r.filter((function(e){return"snackbar"!==e.type}));return o.length?Object(i.createElement)("div",{className:c},o.map((function(e){return Object(i.createElement)(d.a,l()({key:"store-notice-"+e.id},e,{className:p()("wc-block-components-notices__notice","woocommerce-message",f(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)}))):null},O=r(933),g=r(143),j=r(262),h=function(){var e=Object(j.b)().isEditor,t=Object(g.a)(),r=t.notices,n=t.removeNotice,c=r.filter((function(e){return"snackbar"===e.type}));return e?null:Object(i.createElement)(O.a,{notices:c,className:"wc-block-components-notices__snackbar",onRemove:n})};function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var w=Object(i.createContext)({notices:[],createNotice:function(e,t,r){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),E=function(){return Object(i.useContext)(w)},_=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,c=e.createNoticeContainer,o=void 0===c||c,u=e.context,l=void 0===u?"wc/core":u,b=Object(s.useDispatch)("core/notices"),p=b.createNotice,d=b.removeNotice,f=Object(i.useState)(!1),O=a()(f,2),g=O[0],j=O[1],v=Object(i.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};p(e,t,y(y({},r),{},{context:r.context||l}))}),[p,l]),E=Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;d(e,t)}),[d,l]),_=Object(i.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};v("default",e,y(y({},t),{},{type:"snackbar"}))}),[v]),k={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(l)}}),[l]).notices,createNotice:v,createSnackbarNotice:_,removeNotice:E,context:l,setIsSuppressed:j},P=g?null:Object(i.createElement)(m,{className:n,notices:k.notices}),C=g?null:Object(i.createElement)(h,null);return Object(i.createElement)(w.Provider,{value:k},o&&P,t,C)}},275:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),s=r(59),u=Object(i.createElement)((function(e){var t=e.className,r=e.size,n=a()(e,["className","size"]);return Object(i.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},n),Object(i.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=u},293:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(15),a=r.n(o),i=r(37),s=r.n(i),u=r(21),l=r.n(u),b=r(24),p=r.n(b),d=r(19),f=r.n(d),m=r(22),O=r.n(m),g=r(23),j=r.n(g),h=r(12),v=r.n(h),y=r(0),w=r(6),E=r(25),_=(r(2),r(5)),k=r(40),P=r(43);function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=v()(e);if(t){var c=v()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return j()(this,r)}}var S=Object(E.createHigherOrderComponent)((function(e){var t=function(t){O()(o,t);var r,n=C(o);function o(){var e;return l()(this,o),(e=n.apply(this,arguments)).state={list:[],loading:!0},e.setError=e.setError.bind(f()(e)),e.debouncedOnSearch=Object(w.debounce)(e.onSearch.bind(f()(e)),400),e}return p()(o,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(k.h)({selected:t}).then((function(t){e.setState({list:t,loading:!1})})).catch(this.setError)}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,r=this.props.selected;Object(k.h)({selected:r,search:e}).then((function(e){t.setState({list:e,loading:!1})})).catch(this.setError)}},{key:"setError",value:(r=s()(a.a.mark((function e(t){var r;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(P.a)(t);case 2:r=e.sent,this.setState({list:[],loading:!1,error:r});case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"render",value:function(){var t=this,r=this.state,n=r.error,o=r.list,a=r.loading;return Object(y.createElement)(e,c()({},this.props,{error:n,products:o,isLoading:a,onSearch:_.u?function(e){t.setState({loading:!0}),t.debouncedOnSearch(e)}:null}))}}]),o}(y.Component);return t.defaultProps={selected:[]},t}),"withSearchedProducts");t.a=S},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},33:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},34:function(e,t){!function(){e.exports=this.moment}()},36:function(e,t){!function(){e.exports=this.wp.data}()},372:function(e,t){},374:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(5);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var s={headingLevel:{type:"number",default:2},productLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(o.V)()&&(s=i(i({},s),{},{align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}})),t.a=s},375:function(e,t,r){"use strict";t.a={productLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0}}},376:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(11),a=r.n(o),i=r(0),s=(r(2),r(8)),u=r.n(s),l=r(5),b=r(42),p=r(72),d=r(6),f=r(259);r(534);function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var g=function(){return Object(i.createElement)("img",{src:l.E,alt:"",width:500,height:500})},j=function(e){var t=e.image,r=e.onLoad,n=e.loaded,c=e.showFullSize,o=t||{},a=o.thumbnail,s=o.src,u=o.srcset,l=o.sizes,b={alt:o.alt,onLoad:r,hidden:!n,src:a};return c&&(b=O(O({},b),{},{src:s,srcSet:u,sizes:l})),Object(i.createElement)(i.Fragment,null,Object(i.createElement)("img",b),!n&&Object(i.createElement)(g,null))};t.a=Object(p.withProductDataContext)((function(e){var t=e.className,r=e.imageSizing,n=void 0===r?"full-size":r,o=e.productLink,s=void 0===o||o,l=e.showSaleBadge,p=e.saleBadgeAlign,m=void 0===p?"right":p,O=Object(b.useInnerBlockLayoutContext)().parentClassName,h=Object(b.useProductDataContext)().product,v=Object(i.useState)(!1),y=a()(v,2),w=y[0],E=y[1];if(!h.id)return Object(i.createElement)("div",{className:u()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",c()({},"".concat(O,"__product-image"),O))},Object(i.createElement)(g,null));var _=Object(d.isEmpty)(h.images)?null:h.images[0];return Object(i.createElement)("div",{className:u()(t,"wc-block-components-product-image",c()({},"".concat(O,"__product-image"),O))},s?Object(i.createElement)("a",{href:h.permalink,rel:"nofollow"},!!l&&Object(i.createElement)(f.default,{align:m,product:h}),Object(i.createElement)(j,{image:_,onLoad:function(){return E(!0)},loaded:w,showFullSize:"cropped"!==n})):Object(i.createElement)(i.Fragment,null,!!l&&Object(i.createElement)(f.default,{align:m,product:h}),Object(i.createElement)(j,{image:_,onLoad:function(){return E(!0)},loaded:w,showFullSize:"cropped"!==n})))}))},377:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=function(e,t){return!!e.type&&e.type===t},c={SUCCESS:"success",FAIL:"failure",ERROR:"error"},o={PAYMENTS:"wc/payment-area",EXPRESS_PAYMENTS:"wc/express-payment-area"},a=function(e){return n(e,c.SUCCESS)},i=function(e){return n(e,c.ERROR)},s=function(e){return n(e,c.FAIL)},u=function(){return{responseTypes:c,noticeContexts:o,isSuccessResponse:a,isErrorResponse:i,isFailResponse:s}}},378:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(152),c=function(e,t){return function(r){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=n.a.addEventCallback(e,r,c);return t(o),function(){t(n.a.removeEventCallback(e,o.id))}}}},379:function(e,t,r){"use strict";r.d(t,"a",(function(){return p})),r.d(t,"b",(function(){return d}));var n=r(15),c=r.n(n),o=r(52),a=r.n(o),i=r(37),s=r.n(i);function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,c=function(){};return{s:c,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var b=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},p=function(){var e=s()(c.a.mark((function e(t,r,n){var o,i,s,l,p,d;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=b(t,r),i=[],s=u(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=19;break}return p=l.value,e.prev=7,e.next=10,Promise.resolve(p.callback(n));case 10:d=e.sent,"object"===a()(d)&&i.push(d),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.error(e.t0);case 17:e.next=5;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(3),s.e(e.t1);case 24:return e.prev=24,s.f(),e.finish(24);case 27:return e.abrupt("return",!i.length||i);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(t,r,n){return e.apply(this,arguments)}}(),d=function(){var e=s()(c.a.mark((function e(t,r,n){var o,i,s,l,p,d;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=b(t,r),i=!0,s=u(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=24;break}return p=l.value,e.prev=7,e.next=10,Promise.resolve(p.callback(n));case 10:if(d=e.sent,"object"!==a()(d)||void 0!==d.type){e.next=13;break}throw new Error("If you want to abort event emitter processing, your observer must return an object with a type property");case 13:if(!0===(i="object"!==a()(d)||d)){e.next=16;break}return e.abrupt("return",i);case 16:e.next=22;break;case 18:return e.prev=18,e.t0=e.catch(7),console.error(e.t0),e.abrupt("return",{type:"error"});case 22:e.next=5;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(3),s.e(e.t1);case 29:return e.prev=29,s.f(),e.finish(29);case 32:return e.abrupt("return",i);case 33:case"end":return e.stop()}}),e,null,[[3,26,29,32],[7,18]])})));return function(t,r,n){return e.apply(this,arguments)}}()},380:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},381:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(8)),o=r.n(c),a=r(84),i=r(11),s=r.n(i),u=r(1),l=r(61),b=r(143),p=r(377),d=r(917),f="pristine",m="idle",O="disabled",g="processing",j="before_processing",h="after_processing",v={status:f,hasError:!1,quantity:1,processingResponse:null,requestParams:{}},y="set_pristine",w="set_idle",E="set_disabled",_="set_processing",k="set_before_processing",P="set_after_processing",C="set_processing_response",S="set_has_error",x="set_no_error",N="set_quantity",D="set_request_params",B=y,z=w,R=E,V=_,I=k,L=P,T=C,A=S,F=x,M=N,H=D,q=function(){return{type:B}},U=function(){return{type:z}},Q=function(){return{type:R}},W=function(){return{type:V}},Y=function(){return{type:I}},G=function(){return{type:L}},K=function(e){return{type:T,data:e}},$=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?A:F;return{type:t}},J=function(e){return{type:M,quantity:e}},X=function(e){return{type:H,data:e}},Z=r(7),ee=r.n(Z);function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ne=y,ce=w,oe=E,ae=_,ie=k,se=P,ue=C,le=S,be=x,pe=N,de=D,fe=f,me=m,Oe=O,ge=g,je=j,he=h,ve=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case ne:e=v;break;case ce:e=t.status!==me?re(re({},t),{},{status:me}):t;break;case oe:e=t.status!==Oe?re(re({},t),{},{status:Oe}):t;break;case pe:e=n!==t.quantity?re(re({},t),{},{quantity:n}):t;break;case de:e=re(re({},t),{},{requestParams:re(re({},t.requestParams),o)});break;case ue:e=re(re({},t),{},{processingResponse:o});break;case ae:e=!1===(e=t.status!==ge?re(re({},t),{},{status:ge,hasError:!1}):t).hasError?e:re(re({},e),{},{hasError:!1});break;case ie:e=t.status!==je?re(re({},t),{},{status:je,hasError:!1}):t;break;case se:e=t.status!==he?re(re({},t),{},{status:he}):t;break;case le:e=t.hasError?t:re(re({},t),{},{hasError:!0}),e=t.status===ge||t.status===je?re(re({},e),{},{status:me}):e;break;case be:e=t.hasError?re(re({},t),{},{hasError:!1}):t}return e!==t&&c!==ne&&e.status===fe&&(e.status=me),e},ye=r(152),we=r(378),Ee="add_to_cart_before_processing",_e="add_to_cart_after_processing_with_success",ke="add_to_cart_after_processing_with_error",Pe=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(we.a)(_e,e),onAddToCartProcessingWithError:Object(we.a)(ke,e),onAddToCartBeforeProcessing:Object(we.a)(Ee,e)}},Ce=r(379),Se=Object(n.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:function(e){},onAddToCartAfterProcessingWithError:function(e){},onAddToCartBeforeProcessing:function(e){}},dispatchActions:{resetForm:function(){},submitForm:function(){},setQuantity:function(e){},setHasError:function(e){},setAfterProcessing:function(e){},setRequestParams:function(e){}}}),xe=function(){return Object(n.useContext)(Se)},Ne=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=Object(n.useReducer)(ve,v),i=s()(o,2),f=i[0],y=i[1],w=Object(n.useReducer)(ye.b,{}),E=s()(w,2),_=E[0],k=E[1],P=Object(l.a)(_),C=Object(b.a)(),S=C.addErrorNotice,x=C.removeNotices,N=Object(a.b)().setValidationErrors,D=Object(p.a)(),B=D.isSuccessResponse,z=D.isErrorResponse,R=D.isFailResponse,V=Object(n.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:Pe(k).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Pe(k).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Pe(k).onAddToCartBeforeProcessing}}),[k]),I=Object(n.useMemo)((function(){return{resetForm:function(){y(q())},submitForm:function(){y(Y())},setQuantity:function(e){y(J(e))},setHasError:function(e){y($(e))},setRequestParams:function(e){y(X(e))},setAfterProcessing:function(e){y(K(e)),y(G())}}}),[]);Object(n.useEffect)((function(){var e=f.status,t=!r.id||!Object(d.a)(r);e!==O||t?e!==O&&t&&y(Q()):y(U())}),[f.status,r,y]),Object(n.useEffect)((function(){f.status===j&&(x("error"),Object(Ce.a)(P,Ee,{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&S(t),r&&N(r)})),y(U())):y(W())})))}),[f.status,N,S,x,y,P]),Object(n.useEffect)((function(){if(f.status===h){var e={processingResponse:f.processingResponse},t=function(e){if(e.message){var t=e.messageContext?{context:e.messageContext}:void 0;S(e.message,t)}};if(f.hasError)return void Object(Ce.b)(P,ke,e).then((function(r){if(z(r)||R(r))t(r);else{var n,c=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(u.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");S(c,{id:"add-to-cart"})}y(U())}));Object(Ce.b)(P,_e,e).then((function(e){z(e)||R(e)?(t(e),y($(!0))):y(U())}))}}),[f.status,f.hasError,f.processingResponse,I,S,z,R,B,P]);var L=Object(d.b)(r),T={product:r,productType:r.type||"simple",productIsPurchasable:Object(d.a)(r),productHasOptions:r.has_options||!1,supportsFormElements:L,showFormElements:c&&L,quantity:f.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:f.requestParams,isIdle:f.status===m,isDisabled:f.status===O,isProcessing:f.status===g,isBeforeProcessing:f.status===j,isAfterProcessing:f.status===h,hasError:f.hasError,eventRegistration:V,dispatchActions:I};return Object(n.createElement)(Se.Provider,{value:T},t)},De=r(13),Be=r.n(De),ze=r(133),Re=r(33),Ve=r(515);function Ie(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Le=function(){var e=xe(),t=e.dispatchActions,r=e.product,c=e.quantity,o=e.eventRegistration,i=e.hasError,l=e.isProcessing,p=e.requestParams,d=Object(a.b)(),f=d.hasValidationErrors,m=d.showAllValidationErrors,O=Object(b.a)(),g=O.addErrorNotice,j=O.removeNotice,h=Object(ze.a)().receiveCart,v=Object(n.useState)(!1),y=s()(v,2),w=y[0],E=y[1],_=!i&&l,k=Object(n.useCallback)((function(){return!f||(m(),{type:"error"})}),[f,m]);Object(n.useEffect)((function(){var e=o.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[o,k]);var P=Object(n.useCallback)((function(){E(!0),j("add-to-cart");var e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ie(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ie(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:r.id||0,quantity:c},p);Be()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){Be.a.setNonce(e.headers),e.json().then((function(r){e.ok?h(r):(r.body&&r.body.message?g(Object(Re.decodeEntities)(r.body.message),{id:"add-to-cart"}):g(Object(u.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),E(!1),Object(Ve.c)()}))})).catch((function(e){e.json().then((function(e){var r;(null===(r=e.data)||void 0===r?void 0:r.cart)&&h(e.data.cart),t.setHasError(),t.setAfterProcessing(e),E(!1)}))}))}),[r,g,j,h,t,c,p]);return Object(n.useEffect)((function(){_&&!w&&P()}),[_,P,w]),null},Te=function(e){var t=e.children,r=e.product,c=e.showFormElements;return Object(n.createElement)(a.a,null,Object(n.createElement)(Ne,{product:r,showFormElements:c},t,Object(n.createElement)(Le,null)))},Ae=r(42),Fe=r(6),Me=r(72),He=(r(372),r(98)),qe=r(60),Ue=r(543),Qe=r(826),We=function(e){var t=e.className,r=e.href,c=e.text;return Object(n.createElement)(He.a,{className:t,href:r,rel:"nofollow"},c)},Ye=function(e){var t=e.className,r=e.quantityInCart,c=e.isProcessing,o=e.isDisabled,a=e.isDone,i=e.onClick;return Object(n.createElement)(He.a,{className:t,disabled:o,showSpinner:c,onClick:i},a&&r>0?Object(u.sprintf)(Object(u._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(u.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(qe.a,{srcElement:Ue.a,alt:Object(u.__)("Done","woo-gutenberg-products-block")}))},Ge=function(){var e=xe(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,i=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,p=e.hasError,d=e.dispatchActions,f=Object(Qe.a)(o.id||0).cartQuantity,m=Object(n.useState)(!1),O=s()(m,2),g=O[0],j=O[1],h=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return p||j(!0),!0}),0);return function(){e()}}),[b,p]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(Ye,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:f,isDisabled:i,isProcessing:l,isDone:g,onClick:function(){return d.submitForm()}}):Object(n.createElement)(We,{className:"wc-block-components-product-add-to-cart-button",href:h.url,text:h.text||Object(u.__)("View Product","woo-gutenberg-products-block")})},Ke=function(e){var t=e.disabled,r=e.min,c=e.max,o=e.value,a=e.onChange;return Object(n.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:o,min:r,max:c,hidden:1===c,disabled:t,onChange:function(e){a(e.target.value)}})},$e=function(e){var t=e.reason,r=void 0===t?Object(u.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):t;return Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},r)},Je=function(){var e=xe(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.dispatchActions,i=e.isDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)($e,null):t.id&&!t.is_in_stock?Object(n.createElement)($e,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Ke,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Ge,null))},Xe=(r(542),r(56)),Ze=r.n(Xe),et=r(4),tt=r(9),rt=r(226),nt={value:"",label:Object(u.__)("Select an option","woo-gutenberg-products-block")},ct=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,i=e.value,s=void 0===i?"":i,l=e.onChange,b=void 0===l?function(){}:l,p=e.errorMessage,d=void 0===p?Object(u.__)("Please select a value.","woo-gutenberg-products-block"):p,f=Object(a.b)(),m=f.getValidationError,O=f.setValidationErrors,g=f.clearValidationError,j=t,h=m(j)||{};return Object(tt.useEffect)((function(){s?g(j):O(ee()({},j,{message:d,hidden:!0}))}),[s,j,d,g,O]),Object(tt.useEffect)((function(){return function(){g(j)}}),[j,g]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(n.createElement)(et.SelectControl,{label:Object(Re.decodeEntities)(t),value:s||"",options:[nt].concat(Ze()(c)),onChange:b,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(rt.a,{propertyName:j,elementId:j}))};function ot(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function at(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var it=function(e,t,r){var n=Object.values(t).map((function(e){return e.id}));if(Object.values(r).every((function(e){return""===e})))return n;var c=Object.keys(e);return n.filter((function(e){return c.every((function(n){var c=r[n]||"",o=t["id:"+e].attributes[n];return""===c||(null===o||o===c)}))}))},st=function(e,t,r){var n={},c=Object.keys(e),o=Object.values(r).filter(Boolean).length>0;return c.forEach((function(c){var a=e[c],i=at(at({},r),{},ee()({},c,null)),s=o?it(e,t,i):null,u=null!==s?s.map((function(e){return t["id:"+e].attributes[c]})):null;n[c]=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map((function(e){var r=e.name,n=e.slug;return null===t||t.includes(null)||t.includes(n)?{value:n,label:Object(Re.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n};function ut(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var bt=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(l.a)(t),a=Object(l.a)(r),i=Object(n.useState)(0),u=s()(i,2),b=u[0],p=u[1],d=Object(n.useState)({}),f=s()(d,2),m=f[0],O=f[1],g=Object(n.useMemo)((function(){return st(o,a,m)}),[m,o,a]);return Object(n.useEffect)((function(){Object.values(m).filter((function(e){return""!==e})).length===Object.keys(o).length?p(function(e,t,r){return it(e,t,r)[0]||0}(o,a,m)):b>0&&p(0)}),[m,b,o,a]),Object(n.useEffect)((function(){c({id:b,variation:Object.keys(m).map((function(e){return{attribute:e,value:m[e]}}))})}),[c,b,m]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(o).map((function(e){return Object(n.createElement)(ct,{key:e,attributeName:e,options:g[e],value:m[e],onChange:function(t){O(lt(lt({},m),{},ee()({},e,t)))}})})))},pt=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(Fe.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):{}}(t.attributes),o=function(e){if(!e)return{};var t={};return e.forEach((function(e){var r=e.id,n=e.attributes;t["id:".concat(r)]={id:r,attributes:n.reduce((function(e,t){var r=t.name,n=t.value;return e[r]=n,e}),{})}})),t}(t.variations);return 0===Object.keys(c).length||0===o.length?null:Object(n.createElement)(bt,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},dt=function(){var e=xe(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.dispatchActions,i=e.isDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)($e,null):t.id&&!t.is_in_stock?Object(n.createElement)($e,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(pt,{product:t,dispatchers:a}),Object(n.createElement)(Ke,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Ge,null))},ft=function(){return Object(n.createElement)(Ge,null)},mt=function(){return Object(n.createElement)(et.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},Ot=function(){return Object(n.createElement)(mt,null)},gt=function(){var e=xe(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(dt,null):"grouped"===r?Object(n.createElement)(Ot,null):"external"===r?Object(n.createElement)(ft,null):"simple"===r||"variation"===r?Object(n.createElement)(Je,null):null:Object(n.createElement)(Ge,null)};t.a=Object(Me.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(Ae.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(Fe.isEmpty)(c)});return Object(n.createElement)(Te,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(gt,null)))}))},382:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),s=r(33),u=r(42),l=r(14),b=r(5),p=function(e){var t=e.color,r=e.fontSize;return Object(b.V)()?{color:t,fontSize:r}:{}},d=r(72);r(531),t.a=Object(d.withProductDataContext)((function(e){var t,r,n,a=e.className,d=e.headingLevel,f=void 0===d?2:d,m=e.productLink,O=void 0===m||m,g=e.align,j=e.color,h=e.customColor,v=e.fontSize,y=e.customFontSize,w=Object(u.useInnerBlockLayoutContext)().parentClassName,E=Object(u.useProductDataContext)().product,_="h".concat(f),k=Object(l.getColorClassName)("color",j),P=Object(l.getFontSizeClass)(v),C=i()((t={"has-text-color":j||h,"has-font-size":v||y},c()(t,k,k),c()(t,P,P),t));if(!E.id)return Object(o.createElement)(_,{className:i()(a,"wc-block-components-product-title",(n={},c()(n,"".concat(w,"__product-title"),w),c()(n,"wc-block-components-product-title--align-".concat(g),g&&Object(b.V)()),c()(n,C,Object(b.V)()),n)),style:p({color:h,fontSize:y})});var S=Object(s.decodeEntities)(E.name);return Object(o.createElement)(_,{className:i()(a,"wc-block-components-product-title",(r={},c()(r,"".concat(w,"__product-title"),w),c()(r,"wc-block-components-product-title__align-".concat(g),g&&Object(b.V)()),r))},O?Object(o.createElement)("a",{href:E.permalink,rel:"nofollow",className:i()(c()({},C,Object(b.V)())),style:p({color:h,fontSize:y})},S):S)}))},4:function(e,t){!function(){e.exports=this.wp.components}()},40:function(e,t,r){"use strict";r.d(t,"h",(function(){return p})),r.d(t,"e",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"i",(function(){return m})),r.d(t,"f",(function(){return O})),r.d(t,"c",(function(){return g})),r.d(t,"d",(function(){return j})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return v}));var n=r(7),c=r.n(n),o=r(18),a=r(13),i=r.n(a),s=r(6),u=r(5);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,l=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,i=void 0===a?[]:a,s={per_page:u.u?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},l=[Object(o.addQueryArgs)("/wc/store/products",b(b({},s),i))];return u.u&&r.length&&l.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r})),l}({selected:r,search:c,queryArgs:void 0===a?[]:a});return Promise.all(l.map((function(e){return i()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return b(b({},e),{},{parent:0})}))})).catch((function(e){throw e}))},d=function(e){return i()({path:"/wc/store/products/".concat(e)})},f=function(){return i()({path:"wc/store/products/attributes"})},m=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},O=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:u.x?100:0,orderby:u.x?"count":"name",order:u.x?"desc":"asc",search:n})];return u.x&&r.length&&c.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:r})),c}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map((function(e){return i()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id")}))},g=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products/categories",b({per_page:0},e))})},j=function(e){return i()({path:"wc/store/products/categories/".concat(e)})},h=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products",{per_page:0,type:"variation",parent:e})})},v=function(e,t){if(!e.title.raw)return e.slug;var r=1===t.filter((function(t){return t.title.raw===e.title.raw})).length;return e.title.raw+(r?"":" - ".concat(e.slug))}},41:function(e,t){!function(){e.exports=this.wc.wcBlocksData}()},42:function(e,t){!function(){e.exports=this.wc.wcSharedContext}()},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(15),c=r.n(n),o=r(37),a=r.n(o),i=function(){var e=a()(c.a.mark((function e(t){var r;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},45:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},46:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},48:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(9)),i=r(8),s=r.n(i);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t,r=e.label,n=e.screenReaderLabel,c=e.wrapperElement,i=e.wrapperProps,u=null!=r,b=null!=n;return!u&&b?(t=c||"span",i=l(l({},i),{},{className:s()(i.className,"screen-reader-text")}),Object(o.createElement)(t,i,n)):(t=c||a.Fragment,u&&b&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))};b.defaultProps={wrapperProps:{}},t.a=b},49:function(e,t,r){"use strict";var n=r(0),c=r(1),o=(r(2),r(46));t.a=function(e){var t,r,a,i=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=i).message,a=t.type,r?"general"===a?Object(n.createElement)("span",null,Object(c.__)("The following error was returned","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(o.escapeHTML)(r))):"api"===a?Object(n.createElement)("span",null,Object(c.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(o.escapeHTML)(r))):r:Object(c.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))}},5:function(e,t,r){"use strict";r.d(t,"k",(function(){return c})),r.d(t,"I",(function(){return o})),r.d(t,"O",(function(){return a})),r.d(t,"y",(function(){return i})),r.d(t,"A",(function(){return s})),r.d(t,"l",(function(){return u})),r.d(t,"z",(function(){return l})),r.d(t,"C",(function(){return b})),r.d(t,"n",(function(){return p})),r.d(t,"B",(function(){return d})),r.d(t,"m",(function(){return f})),r.d(t,"E",(function(){return m})),r.d(t,"u",(function(){return O})),r.d(t,"x",(function(){return g})),r.d(t,"r",(function(){return j})),r.d(t,"s",(function(){return h})),r.d(t,"t",(function(){return v})),r.d(t,"j",(function(){return y})),r.d(t,"K",(function(){return w})),r.d(t,"P",(function(){return E})),r.d(t,"p",(function(){return _})),r.d(t,"q",(function(){return k})),r.d(t,"o",(function(){return P})),r.d(t,"H",(function(){return C})),r.d(t,"c",(function(){return S})),r.d(t,"v",(function(){return x})),r.d(t,"w",(function(){return N})),r.d(t,"S",(function(){return B})),r.d(t,"T",(function(){return z})),r.d(t,"J",(function(){return R})),r.d(t,"a",(function(){return V})),r.d(t,"M",(function(){return I})),r.d(t,"b",(function(){return L})),r.d(t,"L",(function(){return T})),r.d(t,"D",(function(){return A})),r.d(t,"h",(function(){return F})),r.d(t,"N",(function(){return q})),r.d(t,"g",(function(){return U})),r.d(t,"i",(function(){return Q})),r.d(t,"G",(function(){return W})),r.d(t,"F",(function(){return Y})),r.d(t,"R",(function(){return G})),r.d(t,"Q",(function(){return K})),r.d(t,"d",(function(){return $})),r.d(t,"e",(function(){return J})),r.d(t,"f",(function(){return X})),r.d(t,"W",(function(){return ee})),r.d(t,"X",(function(){return te})),r.d(t,"U",(function(){return re})),r.d(t,"V",(function(){return ne}));var n=r(3),c=Object(n.getSetting)("currentUserIsAdmin",!1),o=Object(n.getSetting)("reviewRatingsEnabled",!0),a=Object(n.getSetting)("showAvatars",!0),i=Object(n.getSetting)("max_columns",6),s=Object(n.getSetting)("min_columns",1),u=Object(n.getSetting)("default_columns",3),l=Object(n.getSetting)("max_rows",6),b=Object(n.getSetting)("min_rows",1),p=Object(n.getSetting)("default_rows",3),d=Object(n.getSetting)("min_height",500),f=Object(n.getSetting)("default_height",500),m=Object(n.getSetting)("placeholderImgSrc",""),O=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),g=Object(n.getSetting)("limitTags"),j=Object(n.getSetting)("hasProducts",!0),h=Object(n.getSetting)("hasTags",!0),v=Object(n.getSetting)("homeUrl",""),y=Object(n.getSetting)("couponsEnabled",!0),w=Object(n.getSetting)("shippingEnabled",!0),E=Object(n.getSetting)("taxesEnabled",!0),_=Object(n.getSetting)("displayItemizedTaxes",!1),k=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),P=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),C=Object(n.getSetting)("productCount",0),S=Object(n.getSetting)("attributes",[]),x=Object(n.getSetting)("isShippingCalculatorEnabled",!0),N=Object(n.getSetting)("isShippingCostHidden",!1),D=Object(n.getSetting)("woocommerceBlocksPhase",1),B=Object(n.getSetting)("wcBlocksAssetUrl",""),z=Object(n.getSetting)("wcBlocksBuildUrl",""),R=Object(n.getSetting)("shippingCountries",{}),V=Object(n.getSetting)("allowedCountries",{}),I=Object(n.getSetting)("shippingStates",{}),L=Object(n.getSetting)("allowedStates",{}),T=Object(n.getSetting)("shippingMethodsExist",!1),A=Object(n.getSetting)("paymentGatewaySortOrder",[]),F=Object(n.getSetting)("checkoutShowLoginReminder",!0),M={id:0,title:"",permalink:""},H=Object(n.getSetting)("storePages",{shop:M,cart:M,checkout:M,privacy:M,terms:M}),q=H.shop.permalink,U=H.checkout.id,Q=H.checkout.permalink,W=H.privacy.permalink,Y=H.privacy.title,G=H.terms.permalink,K=H.terms.title,$=H.cart.id,J=H.cart.permalink,X=Object(n.getSetting)("checkoutAllowsGuest",!1),Z=(Object(n.getSetting)("checkoutAllowsSignup",!1),r(17)),ee=function(e,t){if(D>2)return Object(Z.registerBlockType)(e,t)},te=function(e,t){if(D>1)return Object(Z.registerBlockType)(e,t)},re=function(){return D>2},ne=function(){return D>1}},511:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),s=r(58),u=r(252),l=r(42),b=r(14),p=r(5),d=r(72),f=(r(532),function(e){return e.price_range&&e.price_range.min_amount&&e.price_range.max_amount}),m=function(e){var t,r=e.currency,n=e.minAmount,a=e.maxAmount,u=e.classes,b=e.style,d=Object(l.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value",(t={},c()(t,"".concat(d,"__product-price__value"),d),c()(t,u,Object(p.V)()),t)),style:Object(p.V)()?b:{}},Object(o.createElement)(s.a,{currency:r,value:n})," — ",Object(o.createElement)(s.a,{currency:r,value:a}))},O=function(e){var t,r,n=e.currency,a=e.price,u=e.regularPrice,b=e.saleClasses,d=void 0===b?"":b,f=e.saleStyle,m=void 0===f?{}:f,O=e.classes,g=void 0===O?"":O,j=e.style,h=void 0===j?{}:j,v=Object(l.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("del",{className:i()("wc-block-components-product-price__regular",(t={},c()(t,"".concat(v,"__product-price__regular"),v),c()(t,g,Object(p.V)()),t)),style:Object(p.V)()?h:{}},Object(o.createElement)(s.a,{currency:n,value:u})),Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value",(r={},c()(r,"".concat(v,"__product-price__value"),v),c()(r,d,Object(p.V)()),r)),style:Object(p.V)()?m:{}},Object(o.createElement)(s.a,{currency:n,value:a})))},g=function(e){var t=e.currency,r=e.price,n=e.classes,a=void 0===n?"":n,u=e.style,b=void 0===u?{}:u,d=Object(l.useInnerBlockLayoutContext)().parentClassName;return Object(o.createElement)("span",{className:i()("wc-block-components-product-price__value","".concat(d,"__product-price__value"),c()({},a,Object(p.V)())),style:Object(p.V)()?b:{}},Object(o.createElement)(s.a,{currency:t,value:r}))};t.default=Object(d.withProductDataContext)((function(e){var t,r,n,a=e.className,s=e.align,d=e.fontSize,j=e.customFontSize,h=e.saleFontSize,v=e.customSaleFontSize,y=e.color,w=e.customColor,E=e.saleColor,_=e.customSaleColor,k=Object(l.useInnerBlockLayoutContext)().parentClassName,P=Object(l.useProductDataContext)().product,C=Object(b.getColorClassName)("color",y),S=Object(b.getFontSizeClass)(d),x=Object(b.getColorClassName)("color",E),N=Object(b.getFontSizeClass)(h),D=i()((t={"has-text-color":y||w,"has-font-size":d||j},c()(t,C,C),c()(t,S,S),t)),B=i()((r={"has-text-color":E||_,"has-font-size":h||v},c()(r,x,x),c()(r,N,N),r)),z={color:w,fontSize:j},R={color:_,fontSize:v};if(!P.id)return Object(o.createElement)("div",{className:i()(a,"price","wc-block-components-product-price",c()({},"".concat(k,"__product-price"),k))});var V=P.prices,I=Object(u.c)(V);return Object(o.createElement)("div",{className:i()(a,"price","wc-block-components-product-price",(n={},c()(n,"".concat(k,"__product-price"),k),c()(n,"wc-block-components-product-price__align-".concat(s),s&&Object(p.V)()),n))},f(V)?Object(o.createElement)(m,{currency:I,minAmount:V.price_range.min_amount,maxAmount:V.price_range.max_amount,classes:D,style:z}):V.price!==V.regular_price?Object(o.createElement)(O,{currency:I,price:V.price,regularPrice:V.regular_price,saleClasses:B,saleStyle:R,classes:D,style:z}):Object(o.createElement)(g,{currency:I,price:V.price,classes:D,style:z}))}))},512:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M11 17h2v-1h1c.55 0 1-.45 1-1v-3c0-.55-.45-1-1-1h-3v-1h4V8h-2V7h-2v1h-1c-.55 0-1 .45-1 1v3c0 .55.45 1 1 1h3v1H9v2h2v1zm9-13H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4V6h16v12z"}));t.a=o},513:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(8),s=r.n(i),u=r(42),l=r(72),b=(r(535),function(e){var t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0});t.default=Object(l.withProductDataContext)((function(e){var t=e.className,r=Object(u.useInnerBlockLayoutContext)().parentClassName,n=Object(u.useProductDataContext)().product,i=b(n);if(!i)return null;var l={width:i/5*100+"%"},p=Object(a.sprintf)(Object(a.__)("Rated %f out of 5","woo-gutenberg-products-block"),i);return Object(o.createElement)("div",{className:s()(t,"star-rating","wc-block-components-product-rating",c()({},"".concat(r,"__product-rating"),r))},Object(o.createElement)("div",{className:s()("wc-block-components-product-rating__stars","".concat(r,"__product-rating__stars")),role:"img","aria-label":p},Object(o.createElement)("span",{style:l},p)))}))},514:function(e,t,r){"use strict";r.r(t);var n=r(10),c=r.n(n),o=r(7),a=r.n(o),i=r(0),s=(r(2),r(8)),u=r.n(s),l=r(1),b=r(826),p=r(33),d=r(515),f=r(42),m=r(72),O=(r(536),function(e){var t=e.product,r=Object(i.useRef)(!0),n=t.id,o=t.permalink,a=t.add_to_cart,s=t.has_options,f=t.is_purchasable,m=t.is_in_stock,O=Object(b.a)(n),g=O.cartQuantity,j=O.addingToCart,h=O.addToCart;Object(i.useEffect)((function(){r.current?r.current=!1:Object(d.c)()}),[g]);var v=Number.isFinite(g)&&g>0,y=!s&&f&&m,w=Object(p.decodeEntities)((null==a?void 0:a.description)||""),E=v?Object(l.sprintf)(Object(l._n)("%d in cart","%d in cart",g,"woo-gutenberg-products-block"),g):Object(p.decodeEntities)((null==a?void 0:a.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),_=y?"button":"a",k={};return y?k.onClick=function(){h()}:(k.href=o,k.rel="nofollow"),Object(i.createElement)(_,c()({"aria-label":w,className:u()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:v}),disabled:j},k),E)}),g=function(){return Object(i.createElement)("button",{className:u()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0})};t.default=Object(m.withProductDataContext)((function(e){var t=e.className,r=Object(f.useInnerBlockLayoutContext)().parentClassName,n=Object(f.useProductDataContext)().product;return Object(i.createElement)("div",{className:u()(t,"wp-block-button","wc-block-components-product-button",a()({},"".concat(r,"__product-add-to-cart"),r))},n.id?Object(i.createElement)(O,{product:n}):Object(i.createElement)(g,null))}))},515:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return a}));var n=window.Event||null,c=function(e,t){var r=t.bubbles,c=void 0!==r&&r,o=t.cancelable,a=void 0!==o&&o,i=t.element;if(i||(i=document.body),"function"==typeof n){var s=new n(e,{bubbles:c,cancelable:a});i.dispatchEvent(s)}else{var u=document.createEvent("Event");u.initEvent(e,c,a),i.dispatchEvent(u)}},o=function(){c("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var o=function(){c(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,o),function(){return jQuery(document).off(e,o)}}},516:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=(r(2),r(8)),i=r.n(a),s=r(173),u=r(3),l=r(42),b=r(72);r(537);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product;if(!n)return Object(o.createElement)("div",{className:i()(t,"wc-block-components-product-summary",c()({},"".concat(r,"__product-summary"),r))});var a=n.short_description?n.short_description:n.description;if(!a)return null;var b=Object(u.getSetting)("wordCountType","words");return Object(o.createElement)(s.a,{className:i()(t,"wc-block-components-product-summary",c()({},"".concat(r,"__product-summary"),r)),source:a,maxLength:150,countType:b})}))},517:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),s=r.n(i),u=r(42),l=r(72);r(538);t.default=Object(l.withProductDataContext)((function(e){var t=e.className,r=Object(u.useInnerBlockLayoutContext)().parentClassName,n=Object(u.useProductDataContext)().product.sku;return n?Object(o.createElement)("div",{className:s()(t,"wc-block-components-product-sku",c()({},"".concat(r,"__product-sku"),r))},Object(a.__)("SKU:","woo-gutenberg-products-block")," ",Object(o.createElement)("strong",null,n)):null}))},518:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),s=r.n(i),u=r(42),l=r(6),b=r(72);r(539);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(u.useInnerBlockLayoutContext)().parentClassName,n=Object(u.useProductDataContext)().product;return Object(l.isEmpty)(n.categories)?null:Object(o.createElement)("div",{className:s()(t,"wc-block-components-product-category-list",c()({},"".concat(r,"__product-category-list"),r))},Object(a.__)("Categories:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.categories).map((function(e){var t=e.name,r=e.link,n=e.slug;return Object(o.createElement)("li",{key:"category-list-item-".concat(n)},Object(o.createElement)("a",{href:r},t))}))))}))},519:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),s=r.n(i),u=r(42),l=r(6),b=r(72);r(540);t.default=Object(b.withProductDataContext)((function(e){var t=e.className,r=Object(u.useInnerBlockLayoutContext)().parentClassName,n=Object(u.useProductDataContext)().product;return Object(l.isEmpty)(n.tags)?null:Object(o.createElement)("div",{className:s()(t,"wc-block-components-product-tag-list",c()({},"".concat(r,"__product-tag-list"),r))},Object(a.__)("Tags:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.tags).map((function(e){var t=e.name,r=e.link,n=e.slug;return Object(o.createElement)("li",{key:"tag-list-item-".concat(n)},Object(o.createElement)("a",{href:r},t))}))))}))},520:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(8)),s=r.n(i),u=r(42),l=r(72),b=(r(541),function(e){return Object(a.sprintf)(Object(a.__)("%d left in stock","woo-gutenberg-products-block"),e)}),p=function(e,t){return t?Object(a.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(a.__)("In Stock","woo-gutenberg-products-block"):Object(a.__)("Out of Stock","woo-gutenberg-products-block")};t.default=Object(l.withProductDataContext)((function(e){var t,r=e.className,n=Object(u.useInnerBlockLayoutContext)().parentClassName,a=Object(u.useProductDataContext)().product;if(!a.id||!a.is_purchasable)return null;var i=!!a.is_in_stock,l=a.low_stock_remaining,d=a.is_on_backorder;return Object(o.createElement)("div",{className:s()(r,"wc-block-components-product-stock-indicator",(t={},c()(t,"".concat(n,"__stock-indicator"),n),c()(t,"wc-block-components-product-stock-indicator--in-stock",i),c()(t,"wc-block-components-product-stock-indicator--out-of-stock",!i),c()(t,"wc-block-components-product-stock-indicator--low-stock",!!l),c()(t,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),t))},l?b(l):p(i,d))}))},521:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(9),c=function(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,r.current]),r.current}},531:function(e,t){},532:function(e,t){},533:function(e,t){},534:function(e,t){},535:function(e,t){},536:function(e,t){},537:function(e,t){},538:function(e,t){},539:function(e,t){},54:function(e,t){!function(){e.exports=this.wp.keycodes}()},540:function(e,t){},541:function(e,t){},542:function(e,t){},543:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=o},57:function(e,t){!function(){e.exports=this.wc.wcBlocksRegistry}()},58:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(7),a=r.n(o),i=r(27),s=r.n(i),u=r(0),l=r(181),b=r(8),p=r.n(b);r(190);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}t.a=function(e){var t=e.className,r=e.value,n=e.currency,o=e.onValueChange,a=s()(e,["className","value","currency","onValueChange"]);if("-"===r)return null;var i=r/Math.pow(10,n.minorUnit);if(!Number.isFinite(i))return null;var b=p()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),d=f(f(f({displayType:"text"},a),function(e){return{thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0}}(n)),{},{value:void 0,currency:void 0,onValueChange:void 0}),m=o?function(e){var t=e.value*Math.pow(10,n.minorUnit);o(t)}:function(){};return Object(u.createElement)(l.a,c()({className:b},d,{value:i,onValueChange:m}))}},6:function(e,t){!function(){e.exports=this.lodash}()},60:function(e,t,r){"use strict";var n=r(7),c=r.n(n),o=r(27),a=r.n(o),i=r(9);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,o=a()(e,["srcElement","size"]);return Object(i.isValidElement)(t)&&Object(i.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},o))}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(45),o=r.n(c),a=function(e){var t=Object(n.useRef)();return o()(e,t.current)||(t.current=e),t.current}},72:function(e,t){!function(){e.exports=this.wc.wcSharedHocs}()},73:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(21),a=r.n(o),i=r(24),s=r.n(i),u=r(19),l=r.n(u),b=r(22),p=r.n(b),d=r(23),f=r.n(d),m=r(12),O=r.n(m),g=r(0),j=r(6),h=r(8),v=r.n(h),y=r(4),w=r(25);r(121);function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O()(e);if(t){var c=O()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return f()(this,r)}}var _=function(e){p()(r,e);var t=E(r);function r(){var e;return a()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(l()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,o=r.checked,a=r.instanceId,i=r.className,s=r.help,u=r.options,l=r.value,b="inspector-toggle-button-control-".concat(a);return s&&(e=Object(j.isFunction)(s)?s(o):s),Object(g.createElement)(y.BaseControl,{id:b,help:e,className:v()("components-toggle-button-control",i)},Object(g.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(g.createElement)(y.ButtonGroup,{"aria-labelledby":b+"__label"},u.map((function(e,r){var o={};return l===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isDefault=!0,o["aria-pressed"]=!1),Object(g.createElement)(y.Button,c()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},o),e.label)}))))}}]),r}(g.Component);t.a=Object(w.withInstanceId)(_)},74:function(e,t){!function(){e.exports=this.wp.hooks}()},77:function(e,t){!function(){e.exports=this.ReactDOM}()},78:function(e,t){!function(){e.exports=this.wp.dom}()},795:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"}));t.a=o},80:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(6),a=(r(2),r(4)),i=r(5);t.a=function(e){var t=e.columns,r=e.rows,s=e.setAttributes,u=e.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(o.clamp)(e,i.A,i.y);s({columns:Object(o.isNaN)(t)?"":t})},min:i.A,max:i.y}),Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Rows","woo-gutenberg-products-block"),value:r,onChange:function(e){var t=Object(o.clamp)(e,i.C,i.z);s({rows:Object(o.isNaN)(t)?"":t})},min:i.C,max:i.z}),Object(n.createElement)(a.ToggleControl,{label:Object(c.__)("Align Last Block","woo-gutenberg-products-block"),help:u?Object(c.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(c.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:u,onChange:function(){return s({alignButtons:!u})}}))}},802:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58s1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41s-.23-1.06-.59-1.42zM13 20.01L4 11V4h7v-.01l9 9-7 7.02z"}),Object(n.createElement)("circle",{cx:"6.5",cy:"6.5",r:"1.5"}),Object(n.createElement)("path",{d:"M8.9 12.55c0 .57.23 1.07.6 1.45l3.5 3.5 3.5-3.5c.37-.37.6-.89.6-1.45 0-1.13-.92-2.05-2.05-2.05-.57 0-1.08.23-1.45.6l-.6.6-.6-.59c-.37-.38-.89-.61-1.45-.61-1.13 0-2.05.92-2.05 2.05z"}));t.a=o},81:function(e,t){!function(){e.exports=this.wp.viewport}()},810:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}));t.a=o},811:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1),c=r(5),o=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(n.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:c.S+"img/pennant.jpg",thumbnail:c.S+"img/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(n.__)("Add to cart","woo-gutenberg-products-block"),description:Object(n.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},816:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}));t.a=o},823:function(e,t,r){e.exports=r(887)},824:function(e,t){},825:function(e,t){},826:function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(11),c=r.n(n),o=r(0),a=r(36),i=r(133),s=r(41),u=r(33),l=r(143),b=function(e,t){var r=e.find((function(e){return e.id===t}));return r?r.quantity:0},p=function(e){var t=Object(a.useDispatch)(s.CART_STORE_KEY).addItemToCart,r=Object(i.a)(),n=r.cartItems,p=r.cartIsLoading,d=Object(l.a)(),f=d.addErrorNotice,m=d.removeNotice,O=Object(o.useState)(!1),g=c()(O,2),j=g[0],h=g[1],v=Object(o.useRef)(b(n,e));return Object(o.useEffect)((function(){var t=b(n,e);t!==v.current&&(v.current=t)}),[n,e]),{cartQuantity:Number.isFinite(v.current)?v.current:0,addingToCart:j,cartIsLoading:p,addToCart:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;h(!0),t(e,r).then((function(e){!0===e&&m("add-to-cart")})).catch((function(e){f(Object(u.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){h(!1)}))}}}},828:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(n.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=o},829:function(e,t){},830:function(e,t){},831:function(e,t){},832:function(e,t){},84:function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return m}));var n=r(7),c=r.n(n),o=r(11),a=r.n(o),i=r(0),s=r(6),u=r(45),l=r.n(u);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d=Object(i.createContext)({getValidationError:function(){return""},setValidationErrors:function(e){},clearValidationError:function(e){},clearAllValidationErrors:function(){},hideValidationError:function(){},showValidationError:function(){},showAllValidationErrors:function(){},hasValidationErrors:!1,getValidationErrorId:function(e){return e}}),f=function(){return Object(i.useContext)(d)},m=function(e){var t=e.children,r=Object(i.useState)({}),n=a()(r,2),o=n[0],u=n[1],b=Object(i.useCallback)((function(e){return o[e]}),[o]),f=Object(i.useCallback)((function(e){var t=o[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[o]),m=Object(i.useCallback)((function(e){u((function(t){return t[e]?Object(s.omit)(t,[e]):t}))}),[]),O=Object(i.useCallback)((function(){u({})}),[]),g=Object(i.useCallback)((function(e){e&&u((function(t){return e=Object(s.pickBy)(e,(function(e,r){return"string"==typeof e.message&&(!t.hasOwnProperty(r)||!l()(t[r],e))})),0===Object.values(e).length?t:p(p({},t),e)}))}),[]),j=Object(i.useCallback)((function(e,t){u((function(r){if(!r.hasOwnProperty(e))return r;var n=p(p({},r[e]),t);return l()(r[e],n)?r:p(p({},r),{},c()({},e,n))}))}),[]),h={getValidationError:b,setValidationErrors:g,clearValidationError:m,clearAllValidationErrors:O,hideValidationError:Object(i.useCallback)((function(e){j(e,{hidden:!0})}),[j]),showValidationError:Object(i.useCallback)((function(e){j(e,{hidden:!1})}),[j]),showAllValidationErrors:Object(i.useCallback)((function(){u((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=p(p({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:p(p({},e),t)}))}),[]),hasValidationErrors:Object.keys(o).length>0,getValidationErrorId:f};return Object(i.createElement)(d.Provider,{value:h},t)}},85:function(e,t){!function(){e.exports=this.wp.a11y}()},887:function(e,t,r){"use strict";r.r(t);var n=r(7),c=r.n(n),o=r(10),a=r.n(o),i=r(0),s=r(1),u=r(14),l=r(17),b=r(60),p=r(59),d=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"})),f=r(5),m=r(8),O=r.n(m),g=function(e){var t=e.attributes;return Object(i.createElement)("div",{className:O()("is-loading",t.className)})},j={category:"woocommerce-product-elements",keywords:[Object(s.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(i.createElement)(b.a,{srcElement:d}),foreground:"#96588a"},supports:{html:!1},parent:Object(f.U)()?null:["@woocommerce/all-products","@woocommerce/single-product"],save:g,deprecated:[{save:function(){}}]},h=r(374),v=r(4),y=r(25),w=r(154),E=r(382),_=r(11),k=r.n(_),P=r(145),C=r(27),S=r.n(C);r(825);var x=function(e){var t=e.className,r=void 0===t?"":t,n=S()(e,["className"]),c=O()("wc-block-text-toolbar-button",r);return Object(i.createElement)(v.Button,a()({className:c},n))},N=r(42),D=(r(824),function(e){return function(t){return function(r){var n=Object(N.useProductDataContext)(),c=r.attributes,o=r.setAttributes,a=c.productId,l=Object(i.useState)(!a),b=k()(l,2),p=b[0],d=b[1];return n.hasContext?Object(i.createElement)(t,r):Object(i.createElement)(i.Fragment,null,p?Object(i.createElement)(v.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(i.createElement)("div",null,e.description),Object(i.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(i.createElement)(P.a,{selected:a||0,showVariations:!0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o({productId:e[0]?e[0].id:0})}}),Object(i.createElement)(v.Button,{isDefault:!0,disabled:!a,onClick:function(){d(!1)}},Object(s.__)("Done","woo-gutenberg-products-block")))):Object(i.createElement)(i.Fragment,null,Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(v.Toolbar,null,Object(i.createElement)(x,{onClick:function(){return d(!0)}},Object(s.__)("Switch product…","woo-gutenberg-products-block")))),Object(i.createElement)(t,r)))}}}),B=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(i.createElement)("path",{d:"M17 3H7a2 2 0 00-2 2v16l7-3 7 3V5a2 2 0 00-2-2z"})),z=Object(s.__)("Product Title","woo-gutenberg-products-block"),R=Object(i.createElement)(b.a,{srcElement:B}),V=Object(s.__)("Display the title of a product.","woo-gutenberg-products-block"),I=function(e){var t=e.color,r=e.fontSize,n=e.setFontSize,c=e.setColor,o=e.attributes,a=e.setAttributes,l=o.headingLevel,b=o.productLink,p=o.align;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(w.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:l,onChange:function(e){return a({headingLevel:e})}}),Object(f.V)()&&Object(i.createElement)(u.AlignmentToolbar,{value:p,onChange:function(e){a({align:e})}})),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(v.ToggleControl,{label:Object(s.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(s.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:b,onChange:function(){return a({productLink:!b})}})),Object(f.V)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Text settings","woo-gutenberg-products-block")},Object(i.createElement)(u.FontSizePicker,{value:r.size,onChange:n})),Object(i.createElement)(u.PanelColorSettings,{title:Object(s.__)("Color settings","woo-gutenberg-products-block"),colorSettings:[{value:t.color,onChange:c,label:Object(s.__)("Text color","woo-gutenberg-products-block")}]}))),Object(i.createElement)(v.Disabled,null,Object(i.createElement)(E.a,o)))},L=Object(f.V)()?Object(y.compose)([Object(u.withFontSizes)("fontSize"),Object(u.withColors)("color",{textColor:"color"}),D({icon:R,label:z,description:Object(s.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(I):I;function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var F={title:z,description:V,icon:{src:R,foreground:"#874FB9"},attributes:h.a,edit:L};Object(l.registerBlockType)("woocommerce/product-title",A(A({},j),F));var M=r(511),H=r(512),q=Object(s.__)("Product Price","woo-gutenberg-products-block"),U=Object(i.createElement)(b.a,{srcElement:H.a}),Q=Object(s.__)("Display the price of a product.","woo-gutenberg-products-block"),W=function(e){var t=e.fontSize,r=e.setFontSize,n=e.color,c=e.setColor,o=e.colorLabel;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(u.FontSizePicker,{value:t.size,onChange:r}),Object(i.createElement)(v.BaseControl,{label:o},Object(i.createElement)(u.ColorPalette,{value:n.color,onChange:c,label:Object(s.__)("Color")})))},Y=function(e){var t=e.fontSize,r=e.saleFontSize,n=e.setFontSize,c=e.setSaleFontSize,o=e.color,a=e.saleColor,l=e.setColor,b=e.setSaleColor,p=e.attributes,d=e.setAttributes,m=p.align;return Object(i.createElement)(i.Fragment,null,Object(f.V)()&&Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(u.AlignmentToolbar,{value:m,onChange:function(e){d({align:e})}})),Object(i.createElement)(u.InspectorControls,null,Object(f.V)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Price","woo-gutenberg-products-block")},Object(i.createElement)(W,{color:o,setColor:l,fontSize:t,setFontSize:n,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})),Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Sale price","woo-gutenberg-products-block")},Object(i.createElement)(W,{color:a,setColor:b,fontSize:r,setFontSize:c,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})))),Object(i.createElement)(M.default,p))},G=Object(f.V)()?Object(y.compose)([Object(u.withFontSizes)("fontSize"),Object(u.withFontSizes)("saleFontSize"),Object(u.withFontSizes)("originalFontSize"),Object(u.withColors)("color",{textColor:"color"}),Object(u.withColors)("saleColor",{textColor:"saleColor"}),Object(u.withColors)("originalColor",{textColor:"originalColor"}),D({icon:U,label:q,description:Object(s.__)("Choose a product to display its price.","woo-gutenberg-products-block")})])(Y):Y;function K(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?K(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var J={productId:{type:"number",default:0}};function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(f.V)()&&(J=$($({},J),{},{align:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"},saleFontSize:{type:"string"},customSaleFontSize:{type:"number"},color:{type:"string"},saleColor:{type:"string"},customColor:{type:"string"},customSaleColor:{type:"string"}}));var ee={title:q,description:Q,icon:{src:U,foreground:"#874FB9"},attributes:J,edit:G};Object(l.registerBlockType)("woocommerce/product-price",Z(Z({},j),ee));var te=r(375),re=r(188),ne=r(73),ce=r(3),oe=r(376),ae=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86l-3 3.87L9 13.14 6 17h12l-3.86-5.14z"})),ie=Object(s.__)("Product Image","woo-gutenberg-products-block"),se=Object(i.createElement)(b.a,{srcElement:ae}),ue=Object(s.__)("Display the main product image","woo-gutenberg-products-block"),le=D({icon:se,label:ie,description:Object(s.__)("Choose a product to display its image.","woo-gutenberg-products-block")})((function(e){var t=e.attributes,r=e.setAttributes,n=t.productLink,c=t.imageSizing,o=t.showSaleBadge,a=t.saleBadgeAlign;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(v.ToggleControl,{label:Object(s.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(s.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:function(){return r({productLink:!n})}}),Object(i.createElement)(v.ToggleControl,{label:Object(s.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(s.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:o,onChange:function(){return r({showSaleBadge:!o})}}),o&&Object(i.createElement)(ne.a,{label:Object(s.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:a,options:[{label:Object(s.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(s.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(s.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:function(e){return r({saleBadgeAlign:e})}}),Object(i.createElement)(ne.a,{label:Object(s.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(re.a)(Object(s.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(i.createElement)("a",{href:"".concat(Object(ce.getAdminLink)("customize.php"),"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images"),target:"_blank",rel:"noopener noreferrer"})}),value:c,options:[{label:Object(s.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(s.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:function(e){return r({imageSizing:e})}}))),Object(i.createElement)(v.Disabled,null,Object(i.createElement)(oe.a,t)))}));function be(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?be(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):be(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var de={title:ie,description:ue,icon:{src:se,foreground:"#874FB9"},attributes:te.a,edit:le};Object(l.registerBlockType)("woocommerce/product-image",pe(pe({},j),de));var fe={productId:{type:"number",default:0}},me=r(513),Oe=r(810),ge=Object(s.__)("Product Rating","woo-gutenberg-products-block"),je=Object(i.createElement)(b.a,{srcElement:Oe.a});function he(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ve(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?he(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):he(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ye={title:ge,description:Object(s.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:je,foreground:"#874FB9"},attributes:fe,edit:D({icon:je,label:ge,description:Object(s.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(me.default,t)}))};Object(l.registerBlockType)("woocommerce/product-rating",ve(ve({},j),ye));var we={productId:{type:"number",default:0}},Ee=r(514),_e=r(828),ke=Object(s.__)("Add to Cart Button","woo-gutenberg-products-block"),Pe=Object(i.createElement)(b.a,{srcElement:_e.a});function Ce(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ce(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ce(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var xe={title:ke,description:Object(s.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block"),icon:{src:Pe,foreground:"#874FB9"},attributes:we,edit:D({icon:Pe,label:ke,description:Object(s.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(v.Disabled,null,Object(i.createElement)(Ee.default,t))}))};Object(l.registerBlockType)("woocommerce/product-button",Se(Se({},j),xe));var Ne={productId:{type:"number",default:0}},De=r(516),Be=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(i.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(i.createElement)("path",{d:"M21 11.01L3 11v2h18zM3 16h12v2H3zM21 6H3v2.01L21 8z"})),ze=Object(s.__)("Product Summary","woo-gutenberg-products-block"),Re=Object(i.createElement)(b.a,{srcElement:Be});function Ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ie(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Le={title:ze,description:Object(s.__)("Display a short description about a product.","woo-gutenberg-products-block"),icon:{src:Re,foreground:"#874FB9"},attributes:Ne,edit:D({icon:Re,label:ze,description:Object(s.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(De.default,t)}))};Object(l.registerBlockType)("woocommerce/product-summary",Ie(Ie({},j),Le));var Te={productId:{type:"number",default:0}},Ae=r(259),Fe=r(802),Me=Object(s.__)("On-Sale Badge","woo-gutenberg-products-block"),He=Object(i.createElement)(b.a,{srcElement:Fe.a});function qe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ue(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?qe(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):qe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Qe={title:Me,description:Object(s.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:He,foreground:"#874FB9"},supports:{html:!1},attributes:Te,edit:D({icon:He,label:Me,description:Object(s.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(Ae.default,t)}))};Object(l.registerBlockType)("woocommerce/product-sale-badge",Ue(Ue({},j),Qe));var We={productId:{type:"number",default:0}},Ye=r(134),Ge=r(517),Ke=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"})),$e=Object(s.__)("Product SKU","woo-gutenberg-products-block"),Je=Object(i.createElement)(b.a,{srcElement:Ke});function Xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ze(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var et={title:$e,description:Object(s.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Je,foreground:"#874FB9"},attributes:We,edit:D({icon:Je,label:$e,description:Object(s.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ye.a,null),Object(i.createElement)(Ge.default,t))}))};Object(f.W)("woocommerce/product-sku",Ze(Ze({},j),et));var tt={productId:{type:"number",default:0}},rt=r(518),nt=r(795),ct=Object(s.__)("Product Category List","woo-gutenberg-products-block"),ot=Object(i.createElement)(b.a,{srcElement:nt.a});function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function it(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var st={title:ct,description:Object(s.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block"),icon:{src:ot,foreground:"#874FB9"},attributes:tt,edit:D({icon:ot,label:ct,description:Object(s.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ye.a,null),Object(i.createElement)(v.Disabled,null,Object(i.createElement)(rt.default,t)))}))};Object(f.W)("woocommerce/product-category-list",it(it({},j),st));var ut={productId:{type:"number",default:0}},lt=r(519),bt=Object(s.__)("Product Tag List","woo-gutenberg-products-block"),pt=Object(i.createElement)(b.a,{srcElement:Fe.a});function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mt={title:bt,description:Object(s.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:pt,foreground:"#874FB9"},attributes:ut,edit:D({icon:pt,label:bt,description:Object(s.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ye.a,null),Object(i.createElement)(v.Disabled,null,Object(i.createElement)(lt.default,t)))}))};Object(f.W)("woocommerce/product-tag-list",ft(ft({},j),mt));var Ot={productId:{type:"number",default:0}},gt=r(520),jt=Object(i.createElement)(p.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(i.createElement)("g",{fillRule:"evenodd"},Object(i.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(i.createElement)("path",{fillRule:"nonzero",d:"M20.5 5.2l-1.4-1.7C19 3.3 18.5 3 18 3H6c-.5 0-.9.2-1.2.5L3.5 5.3A2 2 0 003 6.5V19c0 1.1.9 2 2 2h14a2 2 0 002-2V6.5c0-.5-.2-1-.5-1.3zM6.2 5h11.6l.8 1H5.4l.8-1zM5 19V8h14v11H5z"}))),ht=Object(s.__)("Product Stock Indicator","woo-gutenberg-products-block"),vt=Object(i.createElement)(b.a,{srcElement:jt});function yt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Et={title:ht,description:Object(s.__)("Display product stock status.","woo-gutenberg-products-block"),icon:{src:vt,foreground:"#874FB9"},attributes:Ot,edit:D({icon:vt,label:ht,description:Object(s.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(Ye.a,null),Object(i.createElement)(gt.default,t))}))};Object(f.W)("woocommerce/product-stock-indicator",wt(wt({},j),Et));var _t=r(917),kt=(r(372),r(381)),Pt=Object(s.__)("Add to Cart","woo-gutenberg-products-block"),Ct=Object(i.createElement)(b.a,{srcElement:_e.a});function St(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?St(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Nt={title:Pt,description:Object(s.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:Ct,foreground:"#874FB9"},edit:D({icon:Ct,label:Pt,description:Object(s.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})((function(e){var t=e.attributes,r=e.setAttributes,n=Object(N.useProductDataContext)().product,c=t.className,o=t.showFormElements;return Object(i.createElement)("div",{className:O()(c,"wc-block-components-product-add-to-cart")},Object(i.createElement)(Ye.a,{productId:n.id}),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Layout","woo-gutenberg-products-block")},Object(_t.b)(n)?Object(i.createElement)(v.ToggleControl,{label:Object(s.__)("Display form elements","woo-gutenberg-products-block"),help:Object(s.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:o,onChange:function(){return r({showFormElements:!o})}}):Object(i.createElement)(v.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(s.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(i.createElement)(v.Disabled,null,Object(i.createElement)(kt.a,t)))})),attributes:r(380).a};Object(f.W)("woocommerce/product-add-to-cart",xt(xt({},j),Nt));var Dt=r(21),Bt=r.n(Dt),zt=r(19),Rt=r.n(zt),Vt=r(22),It=r.n(Vt),Lt=r(23),Tt=r.n(Lt),At=r(12),Ft=r.n(At),Mt=r(36),Ht=(r(2),r(80)),qt=r(915),Ut=r(811),Qt=r(167),Wt=function(e,t){var r=t.className,n=t.contentVisibility;return O()(e,r,{"has-image":n&&n.image,"has-title":n&&n.title,"has-rating":n&&n.rating,"has-price":n&&n.price,"has-button":n&&n.button})},Yt=function(e,t){return Object(i.createElement)(v.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(i.createElement)("p",null,Object(s.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(i.createElement)(v.Button,{className:"wc-block-products__add-product-button",isDefault:!0,isLarge:!0,href:ce.ADMIN_URL+"post-new.php?post_type=product"},Object(s.__)("Add new product","woo-gutenberg-products-block")+" ",Object(i.createElement)(b.a,{srcElement:Qt.a})),Object(i.createElement)(v.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(s.__)("Learn more","woo-gutenberg-products-block")))},Gt=function(e,t){return Object(i.createElement)(v.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(s.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))};function Kt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function $t(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Jt=[["woocommerce/product-image"],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],Xt=function e(t){return t&&0!==t.length?t.map((function(t){return[t.name,$t($t({},t.attributes),{},{product:void 0,children:t.innerBlocks.length>0?e(t.innerBlocks):[]})]})):[]};r(829);function Zt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function er(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Zt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Zt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var tr=function(e,t){var r=e.contentVisibility;return Object(i.createElement)(v.ToggleControl,{label:Object(s.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:r.orderBy,onChange:function(){return t({contentVisibility:er(er({},r),{},{orderBy:!r.orderBy})})}})},rr=function(e,t){return Object(i.createElement)(v.SelectControl,{label:Object(s.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(s.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(s.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(s.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(s.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(s.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(s.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:function(e){return t({orderby:e})}})},nr=r(24),cr=r.n(nr),or=r(9),ar=r(52),ir=r.n(ar),sr=r(6),ur=r(48),lr=(r(832),function(e){var t=e.currentPage,r=e.displayFirstAndLastPages,n=e.displayNextAndPreviousArrows,c=e.pagesToDisplay,o=e.onPageChange,a=e.totalPages,u=function(e,t,r){if(r<=2)return{minIndex:null,maxIndex:null};var n=e-1,c=Math.max(Math.floor(t-n/2),2),o=Math.min(Math.ceil(t+(n-(t-c))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(o-t))),2),maxIndex:o}}(c,t,a),l=u.minIndex,b=u.maxIndex,p=r&&Boolean(1!==l),d=r&&Boolean(b!==a),f=r&&Boolean(l>3),m=r&&Boolean(b<a-2);p&&3===l&&(l-=1),d&&b===a-2&&(b+=1);var g=[];if(l&&b)for(var j=l;j<=b;j++)g.push(j);return Object(i.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(i.createElement)(ur.a,{screenReaderLabel:Object(s.__)("Navigate to another page","woo-gutenberg-products-block")}),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return o(t-1)},title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(i.createElement)(ur.a,{label:"<",screenReaderLabel:Object(s.__)("Previous page","woo-gutenberg-products-block")})),p&&Object(i.createElement)("button",{className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:function(){return o(1)},disabled:1===t},Object(i.createElement)(ur.a,{label:1,screenReaderLabel:Object(s.sprintf)(Object(s.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(i.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),g.map((function(e){return Object(i.createElement)("button",{key:e,className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?null:function(){return o(e)},disabled:t===e},Object(i.createElement)(ur.a,{label:e,screenReaderLabel:Object(s.sprintf)(Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))})),m&&Object(i.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),d&&Object(i.createElement)("button",{className:O()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:function(){return o(a)},disabled:t===a},Object(i.createElement)(ur.a,{label:a,screenReaderLabel:Object(s.sprintf)(Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page",onClick:function(){return o(t+1)},title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(i.createElement)(ur.a,{label:">",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))});lr.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var br=lr,pr=r(151),dr=(r(831),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,c=e.value;return Object(i.createElement)(pr.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",defaultValue:t,name:"orderby",onChange:r,options:[{key:"menu_order",label:Object(s.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(s.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(s.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(s.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(s.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(s.__)("Price: high to low","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:c})}),fr=r(189),mr=Object(fr.a)((function(e){var t=e.product,r=e.attributes,n=e.instanceId,c=r.layoutConfig,o=Object(N.useInnerBlockLayoutContext)(),s=o.parentClassName,u=o.parentName,l=0===Object.keys(t).length,b=O()("".concat(s,"__product"),"wc-block-layout",{"is-loading":l});return Object(i.createElement)("li",{className:b,"aria-hidden":l},function e(t,r,n,c){if(n){var o=Object(qt.a)(t);return n.map((function(n,s){var u=k()(n,2),l=u[0],b=u[1],p=void 0===b?{}:b,d=[];p.children&&p.children.length>0&&(d=e(t,r,p.children,c));var f=o[l];if(!f)return null;var m=r.id||0,O=["layout",l,s,c,m];return Object(i.createElement)(i.Suspense,{key:O.join("_"),fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},Object(i.createElement)(f,a()({},p,{children:d,product:r})))}))}}(u,t,c,n))})),Or=r(170),gr=r(203),jr=r(41),hr=r(61);function vr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wr=function(e){var t={namespace:"/wc/store",resourceName:"products"},r=Object(gr.a)(yr(yr({},t),{},{query:e})),n=r.results,c=r.isLoading,o=function(e,t){var r=t.namespace,n=t.resourceName,c=t.resourceValues,o=void 0===c?[]:c,a=t.query,i=void 0===a?{}:a;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");var s=Object(hr.a)(i),u=Object(hr.a)(o),l=Object(Mt.useSelect)((function(t){var c=t(jr.COLLECTIONS_STORE_KEY),o=[e,r,n,s,u];return{value:c.getCollectionHeader.apply(c,o),isLoading:c.hasFinishedResolution("getCollectionHeader",o)}}),[e,r,n,u,s]),b=l.value,p=l.isLoading;return{value:b,isLoading:void 0===p||p}}("x-wp-total",yr(yr({},t),{},{query:e})).value;return{products:n,totalProducts:parseInt(o,10),productsLoading:c}},Er=r(521),_r=r(182),kr=r(85),Pr=(r(830),r(146)),Cr=function(){var e=Object(N.useInnerBlockLayoutContext)().parentClassName;return Object(i.createElement)("div",{className:"".concat(e,"__no-products")},Object(i.createElement)(b.a,{className:"".concat(e,"__no-products-image"),alt:"",srcElement:Pr.a,size:100}),Object(i.createElement)("strong",{className:"".concat(e,"__no-products-title")},Object(s.__)("No products","woo-gutenberg-products-block")),Object(i.createElement)("p",{className:"".concat(e,"__no-products-description")},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Sr=r(816),xr=function(e){var t=e.resetCallback,r=void 0===t?function(){}:t,n=Object(N.useInnerBlockLayoutContext)().parentClassName;return Object(i.createElement)("div",{className:"".concat(n,"__no-products")},Object(i.createElement)(b.a,{className:"".concat(n,"__no-products-image"),alt:"",srcElement:Sr.a,size:100}),Object(i.createElement)("strong",{className:"".concat(n,"__no-products-title")},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(i.createElement)("p",{className:"".concat(n,"__no-products-description")},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(i.createElement)("button",{onClick:r},Object(s.__)("Reset Search","woo-gutenberg-products-block")))};function Nr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Dr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Nr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Br=Object(_r.a)((function(e){var t=e.attributes,r=e.currentPage,n=e.onPageChange,c=e.onSortChange,o=e.sortValue,a=e.scrollToTop,u=Object(Or.c)(function(e){var t=e.sortValue,r=e.currentPage,n=e.attributes,c=n.columns,o=n.rows;return Dr(Dr({},function(e){switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}}(t)),{},{catalog_visibility:"catalog",per_page:c*o,page:r})}({attributes:t,sortValue:o,currentPage:r})),l=k()(u,1)[0],b=wr(l),p=b.products,d=b.totalProducts,f=b.productsLoading,m=Object(N.useInnerBlockLayoutContext)().parentClassName,g=function(e){e.order,e.orderby,e.page,e.per_page;return S()(e,["order","orderby","page","per_page"])}(l),j=Object(Or.b)("attributes",[]),h=k()(j,2),v=h[0],y=h[1],w=Object(Or.b)("min_price"),E=k()(w,2),_=E[0],P=E[1],C=Object(Or.b)("max_price"),x=k()(C,2),D=x[0],B=x[1],z=Object(Er.a)({totalQuery:g,totalProducts:d},(function(e){var t=e.totalQuery,r=e.totalProducts,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=n.totalQuery;return!Object(sr.isEqual)(t,c)&&Number.isFinite(r)})),R="object"===ir()(z)&&Object(sr.isEqual)(g,z.totalQuery);Object(i.useEffect)((function(){R||(n(1),z&&function(e){Number.isFinite(e)&&(0===e?Object(kr.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(kr.speak)(Object(s.sprintf)(Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(d))}),[l]);var V,I,L,T,A,F=t.contentVisibility,M=t.columns*t.rows,H=!Number.isFinite(d)&&R?Math.ceil(z.totalProducts/M):Math.ceil(d/M),q=p.length?p:Array.from({length:M}),U=0!==p.length||f,Q=v.length>0||Number.isFinite(_)||Number.isFinite(D);return Object(i.createElement)("div",{className:(V=t.columns,I=t.rows,L=t.alignButtons,T=t.align,A=void 0!==T?"align"+T:"",O()(m,A,"has-"+V+"-columns",{"has-multiple-rows":I>1,"has-aligned-buttons":L}))},F.orderBy&&U&&Object(i.createElement)(dr,{onChange:c,value:o}),!U&&Q&&Object(i.createElement)(xr,{resetCallback:function(){y([]),P(null),B(null)}}),!U&&!Q&&Object(i.createElement)(Cr,null),U&&Object(i.createElement)("ul",{className:"".concat(m,"__products")},q.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(i.createElement)(mr,{key:e.id||r,attributes:t,product:e})}))),H>1&&Object(i.createElement)(br,{currentPage:r,onPageChange:function(e){a({focusableSelector:"a, button"}),n(e)},totalPages:H}))})),zr=function(e){var t=e.attributes,r=Object(i.useState)(1),n=k()(r,2),c=n[0],o=n[1],a=Object(i.useState)(t.orderby),s=k()(a,2),u=s[0],l=s[1];Object(i.useEffect)((function(){l(t.orderby)}),[t.orderby]);return Object(i.createElement)(Br,{attributes:t,currentPage:c,onPageChange:function(e){o(e)},onSortChange:function(e){var t=e.target.value;l(t),o(1)},sortValue:u})},Rr=r(172);function Vr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ft()(e);if(t){var c=Ft()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return Tt()(this,r)}}var Ir=function(e){It()(r,e);var t=Vr(r);function r(){return Bt()(this,r),t.apply(this,arguments)}return cr()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.urlParameterSuffix;return t.isPreview?Rr.a:Object(i.createElement)(N.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)(zr,{attributes:t,urlParameterSuffix:r}))}}]),r}(or.Component);function Lr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=Ft()(e);if(t){var c=Ft()(this).constructor;r=Reflect.construct(n,arguments,c)}else r=n.apply(this,arguments);return Tt()(this,r)}}var Tr=function(e){It()(r,e);var t=Lr(r);function r(){var e;Bt()(this,r);for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return e=t.call.apply(t,[this].concat(o)),c()(Rt()(e),"state",{isEditing:!1,innerBlocks:[]}),c()(Rt()(e),"blockMap",Object(qt.a)("woocommerce/all-products")),c()(Rt()(e),"componentDidMount",(function(){var t=e.props.block;e.setState({innerBlocks:t.innerBlocks})})),c()(Rt()(e),"getTitle",(function(){return Object(s.__)("All Products","woo-gutenberg-products-block")})),c()(Rt()(e),"getIcon",(function(){return Object(i.createElement)(b.a,{srcElement:d})})),c()(Rt()(e),"togglePreview",(function(){var t=e.props.debouncedSpeak;e.setState({isEditing:!e.state.isEditing}),e.state.isEditing||t(Object(s.__)("Showing All Products block preview.","woo-gutenberg-products-block"))})),c()(Rt()(e),"getInspectorControls",(function(){var t=e.props,r=t.attributes,n=t.setAttributes,c=r.columns,o=r.rows,a=r.alignButtons;return Object(i.createElement)(u.InspectorControls,{key:"inspector"},Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(i.createElement)(Ht.a,{columns:c,rows:o,alignButtons:a,setAttributes:n})),Object(i.createElement)(v.PanelBody,{title:Object(s.__)("Content Settings","woo-gutenberg-products-block")},tr(r,n),rr(r,n)))})),c()(Rt()(e),"getBlockControls",(function(){var t=e.state.isEditing;return Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(v.Toolbar,{controls:[{icon:"edit",title:Object(s.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return e.togglePreview()},isActive:t}]}))})),c()(Rt()(e),"renderEditMode",(function(){var t={template:e.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(e.blockMap)};return 0!==e.props.attributes.layoutConfig.length&&(t.renderAppender=!1),Object(i.createElement)(v.Placeholder,{icon:e.getIcon(),label:e.getTitle()},Object(s.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(i.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(i.createElement)(v.Tip,null,Object(s.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(i.createElement)(N.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(i.createElement)("ul",{className:"wc-block-grid__products"},Object(i.createElement)("li",{className:"wc-block-grid__product"},Object(i.createElement)(N.ProductDataContextProvider,{product:Ut.a[0]},Object(i.createElement)(u.InnerBlocks,t)))))),Object(i.createElement)("div",{className:"wc-block-all-products__actions"},Object(i.createElement)(v.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,isLarge:!0,onClick:function(){var t=e.props,r=t.block;(0,t.setAttributes)({layoutConfig:Xt(r.innerBlocks)}),e.setState({innerBlocks:r.innerBlocks}),e.togglePreview()}},Object(s.__)("Done","woo-gutenberg-products-block")),Object(i.createElement)(v.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:function(){var t=e.props,r=t.block,n=t.replaceInnerBlocks,c=e.state.innerBlocks;n(r.clientId,c,!1),e.togglePreview()}},Object(s.__)("Cancel","woo-gutenberg-products-block")),Object(i.createElement)(v.IconButton,{className:"wc-block-all-products__reset-button",icon:Object(i.createElement)(b.a,{srcElement:d}),label:Object(s.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:function(){var t=e.props,r=t.block,n=t.replaceInnerBlocks,c=[];Jt.map((function(e){var t=k()(e,2),r=t[0],n=t[1];return c.push(Object(l.createBlock)(r,n)),!0})),n(r.clientId,c,!1),e.setState({innerBlocks:r.innerBlocks})}},Object(s.__)("Reset Layout","woo-gutenberg-products-block")))))})),c()(Rt()(e),"renderViewMode",(function(){var t=e.props.attributes,r=t.layoutConfig,n=r&&0!==r.length,c=e.getTitle(),o=e.getIcon();return n?Object(i.createElement)(v.Disabled,null,Object(i.createElement)(Ir,{attributes:t})):Gt(c,o)})),c()(Rt()(e),"render",(function(){var t=e.props.attributes,r=e.state.isEditing,n=e.getTitle(),c=e.getIcon();return f.r?Object(i.createElement)("div",{className:Wt("wc-block-all-products",t)},e.getBlockControls(),e.getInspectorControls(),r?e.renderEditMode():e.renderViewMode()):Yt(n,c)})),e}return r}(i.Component),Ar=Object(y.compose)(v.withSpokenMessages,Object(Mt.withSelect)((function(e,t){var r=t.clientId;return{block:(0,e("core/block-editor").getBlock)(r)}})),Object(Mt.withDispatch)((function(e){return{replaceInnerBlocks:e("core/block-editor").replaceInnerBlocks}})))(Tr),Fr={columns:f.l,rows:f.n,alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Jt,isPreview:!1};function Mr(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Hr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var qr={title:Object(s.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(i.createElement)(b.a,{srcElement:d}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(s.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(s.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:Fr,edit:function(e){return Object(i.createElement)(Ar,e)},save:function(e){var t=e.attributes,r={};Object.keys(t).sort().forEach((function(e){r[e]=t[e]}));var n={"data-attributes":JSON.stringify(r)};return Object(i.createElement)("div",a()({className:Wt("wc-block-all-products",t)},n),Object(i.createElement)(u.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",Hr(Hr({},qr),{},{deprecated:[{attributes:Object.assign({},qr.attributes,{rows:{type:"number",default:1}}),save:function(e){var t=e.attributes,r={"data-attributes":JSON.stringify(t)};return Object(i.createElement)("div",a()({className:Wt("wc-block-all-products",t)},r),Object(i.createElement)(u.InnerBlocks.Content,null))}}]}))},9:function(e,t){!function(){e.exports=this.React}()},915:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(57),c=r(0),o=r(5);r.p=o.T,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(11)]).then(r.bind(null,511))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(3),r.e(10)]).then(r.bind(null,936))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(17)]).then(r.bind(null,937))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(c.lazy)((function(){return r.e(12).then(r.bind(null,513))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(2),r.e(8)]).then(r.bind(null,514))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(c.lazy)((function(){return r.e(15).then(r.bind(null,516))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(c.lazy)((function(){return r.e(3).then(r.bind(null,259))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(c.lazy)((function(){return r.e(13).then(r.bind(null,517))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(c.lazy)((function(){return r.e(9).then(r.bind(null,518))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(c.lazy)((function(){return r.e(16).then(r.bind(null,519))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(c.lazy)((function(){return r.e(14).then(r.bind(null,520))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(2),r.e(7)]).then(r.bind(null,938))}))});var a=function(e){return Object(n.getRegisteredBlockComponents)(e)}},917:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var n=function(e){return e.is_purchasable||!1},c=function(e){return["simple","variable"].includes(e.type||"simple")}},92:function(e,t){!function(){e.exports=this.wp.date}()},93:function(e,t){!function(){e.exports=this.wp.autop}()},98:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),i=r(0),s=r(273),u=(r(2),r(8)),l=r.n(u);r(231);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,["className","showSpinner","children"]),b=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(i.createElement)(s.a,c()({className:b},u),n&&Object(i.createElement)("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),Object(i.createElement)("span",{className:"wc-block-components-button__text"},o))}},99:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=Object(n.createContext)("page"),o=function(){return Object(n.useContext)(c)};c.Provider}});
|
build/all-reviews-legacy.asset.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => 'f043a0b5fe4149b453e7e5ff7b62fc17');
|
|
build/all-reviews-legacy.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],l=t[2],b=0,d=[];b<a.length;b++)i=a[b],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&d.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var u=s;return c.push([614,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.React}()},102:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},103:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(0),i=(r(111),r(44));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,a=t.orderby,s=t.productId,l={"data-image-type":n,"data-orderby":a,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return s&&(l["data-product-id"]=s,u="wc-block-reviews-by-product"),Array.isArray(r)&&(l["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(i.a)(u,t)},l))}},104:function(e,t,r){"use strict";var n=r(18),o=r.n(n),c=r(19),i=r.n(c),a=r(20),s=r.n(a),l=r(21),u=r.n(l),b=r(11),d=r.n(b),p=r(0),w=r(1),g=r(10),m=(r(2),r(5)),v=r(4),f=r(6),h=r(57),O=r(8),j=r.n(O),y=r(7),_=r.n(y);function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach((function(t){j()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var E=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,c=e.wrapperProps,i=null!=r,a=null!=n;return!i&&a?(t=o||"span",c=R(R({},c),{},{className:_()(c.className,"screen-reader-text")}),Object(p.createElement)(t,c,n)):(t=o||g.Fragment,i&&a&&r!==n?Object(p.createElement)(t,c,Object(p.createElement)("span",{"aria-hidden":"true"},r),Object(p.createElement)("span",{className:"screen-reader-text"},n)):Object(p.createElement)(t,c,r))};E.defaultProps={wrapperProps:{}};var P=E,S=(r(148),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(P,{label:r,screenReaderLabel:n})))});S.defaultProps={label:Object(w.__)("Load more","woo-gutenberg-products-block")};var C=S,N=r(22),x=(r(145),Object(N.withInstanceId)((function(e){var t=e.className,r=e.instanceId,n=e.defaultValue,o=e.label,c=e.onChange,i=e.options,a=e.screenReaderLabel,s=e.readOnly,l=e.value,u="wc-block-components-sort-select__select-".concat(r);return Object(p.createElement)("div",{className:_()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(p.createElement)(P,{label:o,screenReaderLabel:a,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(p.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:n,onChange:c,readOnly:s,value:l},i.map((function(e){return Object(p.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))),L=(r(144),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(x,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",defaultValue:t,label:Object(w.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(w.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(w.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(w.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(w.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),T=r(17),D=r.n(T),I=r(127),M=r.n(I),A=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=M()(e,{suffix:r,limit:t});return n.html},B=function(e,t,r,n){var o=H(e,t,r);return A(e,o-n.length,n)},H=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=A(e,n.middle),n=F(n,t.clientHeight,r);return n.middle},F=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};function V(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var z=function(e){s()(r,e);var t=V(r);function r(e){var n;return o()(this,r),(n=t.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},n.reviewSummary=Object(g.createRef)(),n.reviewContent=Object(g.createRef)(),n.getButton=n.getButton.bind(D()(n)),n.onClick=n.onClick.bind(D()(n)),n}return i()(r,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:B(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),r}(g.Component);z.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(w.__)("Read more","woo-gutenberg-products-block"),lessText:Object(w.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var W=z;r(147);var U=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,i=t.showReviewerName,a=t.showReviewImage,s=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,g=Number.isFinite(b)&&s;return Object(p.createElement)("li",{className:_()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||i||a||g)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},a&&function(e,t,r){var n,o;return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(o=e.product_image)||void 0===o?void 0:o.thumbnail)||""}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(w.__)("Verified buyer","woo-gutenberg-products-block")},Object(w.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||i||g||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},g&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(w.sprintf)(Object(w.__)("Rated %f out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),i&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(n))),l&&function(e){return Object(p.createElement)(W,{maxLines:10,moreText:Object(w.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(w.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(146);function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function G(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach((function(t){j()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var q=function(e){var t=e.attributes,r=e.reviews,n=(f.n||"product"===t.imageType)&&t.showReviewImage,o=f.m&&t.showReviewRating,c=G(G({},t),{},{showReviewImage:n,showReviewRating:o});return Object(p.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(p.createElement)(U,{attributes:c}):r.map((function(e,t){return Object(p.createElement)(U,{key:e.id||t,attributes:c,review:e})})))},Y=r(16),K=r.n(Y),Q=r(13),X=r.n(Q),Z=r(24),$=r.n(Z),ee=r(71),te=r.n(ee),re=r(44),ne=r(26);function oe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}function ce(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var ie=function(e){var t=function(t){s()(n,t);var r=oe(n);function n(){var e;o()(this,n);for(var t=arguments.length,c=new Array(t),i=0;i<t;i++)c[i]=arguments[i];return e=r.call.apply(r,[this].concat(c)),j()(D()(e),"isPreview",!!e.props.attributes.previewReviews),j()(D()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),j()(D()(e),"state",{error:null,loading:!0,reviews:e.isPreview?e.props.attributes.previewReviews:[],totalReviews:e.isPreview?e.props.attributes.previewReviews.length:0}),j()(D()(e),"setError",function(){var t=$()(X.a.mark((function t(r){var n,o;return X.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.onReviewsLoadError,t.next=3,Object(ne.a)(r);case 3:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e}return i()(n,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!te()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,i={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(i.category_id=Array.isArray(r)?r.join(","):r),c&&(i.product_id=c),i}},{key:"replaceReviews",value:function(){if(!this.isPreview){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}}},{key:"appendReviews",value:function(){if(!this.isPreview){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(re.b)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter((function(e){return Object.keys(e).length})).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}})).catch(this.setError)}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,i=r.totalReviews;return Object(p.createElement)(e,K()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:i}))}}]),n}(g.Component);j()(t,"defaultProps",{delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}});var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){s()(r,e);var t=ce(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,i=e.totalReviews;return r?Object(p.createElement)(h.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(v.Disabled,null,t.showOrderby&&f.m&&Object(p.createElement)(L,{readOnly:!0,value:t.orderby}),Object(p.createElement)(q,{attributes:t,reviews:c}),t.showLoadMore&&i>c.length&&Object(p.createElement)(C,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")})):Object(p.createElement)(o,{attributes:t})}}]),r}(g.Component));function ae(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var se=function(e){s()(r,e);var t=ae(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(v.Placeholder,{icon:t,label:r},Object(w.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,i=t.reviewsOnPageLoad,a=t.showProductName,s=t.showReviewDate,l=t.showReviewerName,u=t.showReviewContent,b=t.showReviewImage,d=t.showReviewRating,w=Object(re.c)(t.orderby),g=w.order,v=w.orderby;return!(u||d||s||l||b||a)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(re.a)(r,t)},Object(p.createElement)(ie,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(m.debounce)(e,400)},noReviewsPlaceholder:n,orderby:v,order:g,productId:c,reviewsToDisplay:i}))}}]),r}(g.Component);t.a=se},110:function(e,t){},111:function(e,t){},13:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},144:function(e,t){},145:function(e,t){},146:function(e,t){},147:function(e,t){},148:function(e,t){},15:function(e,t){!function(){e.exports=this.wp.blocks}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blockEditor}()},26:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(13),o=r.n(n),c=r(24),i=r.n(c),a=function(){var e=i()(o.a.mark((function e(t){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},28:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},30:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(28));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))}},4:function(e,t){!function(){e.exports=this.wp.components}()},44:function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return u}));var n=r(9),o=r.n(n),c=r(7),i=r.n(c),a=r(6),s=function(e){if(a.m){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=function(e){return o()({path:"/wc/store/products/reviews?"+Object.entries(e).map((function(e){return e.join("=")})).join("&"),parse:!1}).then((function(e){return e.json().then((function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}}))}))},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,a=t.showProductName,s=t.showReviewImage,l=t.showReviewRating;return i()(e,r,{"has-image":s,"has-name":o,"has-date":n,"has-rating":l,"has-content":c,"has-product-name":a})}},5:function(e,t){!function(){e.exports=this.lodash}()},57:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(60)),i=r(645),a=Object(n.createElement)(i.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),s=r(7),l=r.n(s),u=r(4),b=r(30);r(99),t.a=function(e){var t=e.className,r=e.error,i=e.isLoading,s=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:a}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:l()("wc-block-api-error",t)},Object(n.createElement)(b.a,{error:r}),s&&Object(n.createElement)(n.Fragment,null,i?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:s},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},6:function(e,t,r){"use strict";r.d(t,"m",(function(){return o})),r.d(t,"n",(function(){return c})),r.d(t,"h",(function(){return i})),r.d(t,"j",(function(){return a})),r.d(t,"a",(function(){return s})),r.d(t,"i",(function(){return l})),r.d(t,"l",(function(){return u})),r.d(t,"c",(function(){return b})),r.d(t,"k",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"f",(function(){return w})),r.d(t,"g",(function(){return g})),r.d(t,"d",(function(){return m})),r.d(t,"e",(function(){return v})),r.d(t,"o",(function(){return f}));var n=r(3),o=(Object(n.getSetting)("currentUserIsAdmin",!1),Object(n.getSetting)("reviewRatingsEnabled",!0)),c=Object(n.getSetting)("showAvatars",!0),i=Object(n.getSetting)("max_columns",6),a=Object(n.getSetting)("min_columns",1),s=Object(n.getSetting)("default_columns",3),l=Object(n.getSetting)("max_rows",6),u=Object(n.getSetting)("min_rows",1),b=Object(n.getSetting)("default_rows",3),d=Object(n.getSetting)("min_height",500),p=Object(n.getSetting)("default_height",500),w=(Object(n.getSetting)("placeholderImgSrc",""),Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),g=Object(n.getSetting)("limitTags"),m=(Object(n.getSetting)("hasProducts",!0),Object(n.getSetting)("hasTags",!0)),v=Object(n.getSetting)("homeUrl",""),f=(Object(n.getSetting)("couponsEnabled",!0),Object(n.getSetting)("shippingEnabled",!0),Object(n.getSetting)("taxesEnabled",!0),Object(n.getSetting)("displayItemizedTaxes",!1),Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1),Object(n.getSetting)("productCount",0),Object(n.getSetting)("attributes",[]),Object(n.getSetting)("isShippingCalculatorEnabled",!0),Object(n.getSetting)("isShippingCostHidden",!1),Object(n.getSetting)("woocommerceBlocksPhase",1),Object(n.getSetting)("wcBlocksAssetUrl","")),h=(Object(n.getSetting)("wcBlocksBuildUrl",""),Object(n.getSetting)("shippingCountries",{}),Object(n.getSetting)("allowedCountries",{}),Object(n.getSetting)("shippingStates",{}),Object(n.getSetting)("allowedStates",{}),Object(n.getSetting)("shippingMethodsExist",!1),Object(n.getSetting)("checkoutShowLoginReminder",!0),{id:0,title:"",permalink:""}),O=Object(n.getSetting)("storePages",{shop:h,cart:h,checkout:h,privacy:h,terms:h});O.shop.permalink,O.checkout.id,O.checkout.permalink,O.privacy.permalink,O.privacy.title,O.terms.permalink,O.terms.title,O.cart.id,O.cart.permalink,Object(n.getSetting)("checkoutAllowsGuest",!1),Object(n.getSetting)("checkoutAllowsSignup",!1),r(15)},60:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(35),i=r.n(c),a=r(10);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},614:function(e,t,r){e.exports=r(629)},629:function(e,t,r){"use strict";r.r(t);var n=r(8),o=r.n(n),c=r(0),i=r(1),a=r(15),s=r(60),l=r(645),u=Object(c.createElement)(l.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M15 4v7H5.17l-.59.59-.58.58V4h11m1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1z"})),b=(r(111),r(23)),d=r(4),p=(r(2),r(104)),w=function(){return Object(c.createElement)(d.Placeholder,{className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{srcElement:u,className:"block-editor-block-icon"}),label:Object(i.__)("All Reviews","woo-gutenberg-products-block")},Object(i.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block"))},g=r(72),m=function(e){var t=e.attributes,r=e.setAttributes;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(b.InspectorControls,{key:"inspector"},Object(c.createElement)(d.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(d.ToggleControl,{label:Object(i.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(g.b)(t,r)),Object(c.createElement)(d.PanelBody,{title:Object(i.__)("List Settings","woo-gutenberg-products-block")},Object(g.c)(t,r))),Object(c.createElement)(p.a,{attributes:t,className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{icon:u,className:"block-editor-block-icon"}),name:Object(i.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))},v=r(102),f=r(103),h=r(92);function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(a.registerBlockType)("woocommerce/all-reviews",{title:Object(i.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(s.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1},example:j(j({},h.a),{},{attributes:j(j({},h.a.attributes),{},{showProductName:!0})}),attributes:j(j({},v.a),{},{showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(m,e)},save:f.a})},71:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},72:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return p}));var n=r(0),o=r(1),c=r(129),i=r(4),a=r(23),s=r(3),l=r(6),u=r(91),b=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(i.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!l.m&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!l.n&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(i.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},9:function(e,t){!function(){e.exports=this.wp.apiFetch}()},91:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(18),i=r.n(c),a=r(19),s=r.n(a),l=r(17),u=r.n(l),b=r(20),d=r.n(b),p=r(21),w=r.n(p),g=r(11),m=r.n(g),v=r(0),f=r(5),h=r(7),O=r.n(h),j=r(4),y=r(22);r(110);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=m()(e);if(t){var o=m()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return w()(this,r)}}var k=function(e){d()(r,e);var t=_(r);function r(){var e;return i()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,i=r.instanceId,a=r.className,s=r.help,l=r.options,u=r.value,b="inspector-toggle-button-control-".concat(i);return s&&(e=Object(f.isFunction)(s)?s(c):s),Object(v.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",a)},Object(v.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(v.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(v.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)}))))}}]),r}(v.Component);t.a=Object(y.withInstanceId)(k)},92:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(6),c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(n.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Alice","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.o+"img/avatar.jpg",96:o.o+"img/avatar.jpg"},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(n.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Bob","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("This product is awesome, I love it!","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.o+"img/avatar.jpg",96:o.o+"img/avatar.jpg"},rating:null,verified:!1}]}}},99:function(e,t){}});
|
|
build/all-reviews.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill'), 'version' => '1da75ef7375d6f7834bbf477f7720ff0');
|
build/all-reviews.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],l=t[2],b=0,d=[];b<a.length;b++)i=a[b],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&d.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={6:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var u=s;return c.push([808,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},121:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},137:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return p}));var n=r(0),o=r(1),c=r(187),i=r(4),a=r(14),s=r(3),l=r(5),u=r(72),b=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(i.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!l.G&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!l.M&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(i.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},146:function(e,t,r){"use strict";var n=r(0),o=r(58),c=Object(n.createElement)(o.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},149:function(e,t){},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},151:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(8)),c=r.n(o),i=r(46),a=r(188);r(197);t.a=Object(a.a)((function(e){var t=e.className,r=e.instanceId,o=e.defaultValue,a=e.label,s=e.onChange,l=e.options,u=e.screenReaderLabel,b=e.readOnly,d=e.value,p="wc-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:a,screenReaderLabel:u,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),Object(n.createElement)("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:o,onChange:s,readOnly:b,value:d},l.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},158:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(5),c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(n.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Alice","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.Q+"img/avatar.jpg",96:o.Q+"img/avatar.jpg"},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(n.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Bob","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("This product is awesome, I love it!","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.Q+"img/avatar.jpg",96:o.Q+"img/avatar.jpg"},rating:null,verified:!1}]}}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},178:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},179:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=(r(196),r(80));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,a=t.orderby,s=t.productId,l={"data-image-type":n,"data-orderby":a,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return s&&(l["data-product-id"]=s,u="wc-block-reviews-by-product"),Array.isArray(r)&&(l["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(i.a)(u,t)},l))}},184:function(e,t,r){"use strict";var n=r(21),o=r.n(n),c=r(24),i=r.n(c),a=r(22),s=r.n(a),l=r(23),u=r.n(l),b=r(12),d=r.n(b),p=r(0),w=r(1),g=r(9),f=(r(2),r(6)),m=r(4),v=r(5),h=r(89),O=r(46),j=(r(249),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(O.a,{label:r,screenReaderLabel:n})))});j.defaultProps={label:Object(w.__)("Load more","woo-gutenberg-products-block")};var y=j,_=r(151),k=(r(246),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(_.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",defaultValue:t,label:Object(w.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(w.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(w.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(w.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(w.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),R=r(7),E=r.n(R),P=r(8),S=r.n(P),C=r(19),N=r.n(C),x=r(224),T=r.n(x),L=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=T()(e,{suffix:r,limit:t});return n.html},D=function(e,t,r,n){var o=I(e,t,r);return L(e,o-n.length,n)},I=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=L(e,n.middle),n=M(n,t.clientHeight,r);return n.middle},M=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var B=function(e){s()(r,e);var t=A(r);function r(e){var n;return o()(this,r),(n=t.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},n.reviewSummary=Object(g.createRef)(),n.reviewContent=Object(g.createRef)(),n.getButton=n.getButton.bind(N()(n)),n.onClick=n.onClick.bind(N()(n)),n}return i()(r,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:D(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),r}(g.Component);B.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(w.__)("Read more","woo-gutenberg-products-block"),lessText:Object(w.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var H=B;r(248);var F=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,i=t.showReviewerName,a=t.showReviewImage,s=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,g=Number.isFinite(b)&&s;return Object(p.createElement)("li",{className:S()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||i||a||g)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},a&&function(e,t,r){var n,o;return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(o=e.product_image)||void 0===o?void 0:o.thumbnail)||""}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(w.__)("Verified buyer","woo-gutenberg-products-block")},Object(w.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||i||g||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},g&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(w.sprintf)(Object(w.__)("Rated %f out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),i&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(n))),l&&function(e){return Object(p.createElement)(H,{maxLines:10,moreText:Object(w.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(w.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(247);function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){E()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var G=function(e){var t=e.attributes,r=e.reviews,n=(v.M||"product"===t.imageType)&&t.showReviewImage,o=v.G&&t.showReviewRating,c=z(z({},t),{},{showReviewImage:n,showReviewRating:o});return Object(p.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(p.createElement)(F,{attributes:c}):r.map((function(e,t){return Object(p.createElement)(F,{key:e.id||t,attributes:c,review:e})})))},U=r(10),W=r.n(U),J=r(15),Q=r.n(J),q=r(38),K=r.n(q),Y=r(47),X=r.n(Y),Z=r(80),$=r(43);function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var re=function(e){var t=function(t){s()(n,t);var r=ee(n);function n(){var e;o()(this,n);for(var t=arguments.length,c=new Array(t),i=0;i<t;i++)c[i]=arguments[i];return e=r.call.apply(r,[this].concat(c)),E()(N()(e),"isPreview",!!e.props.attributes.previewReviews),E()(N()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),E()(N()(e),"state",{error:null,loading:!0,reviews:e.isPreview?e.props.attributes.previewReviews:[],totalReviews:e.isPreview?e.props.attributes.previewReviews.length:0}),E()(N()(e),"setError",function(){var t=K()(Q.a.mark((function t(r){var n,o;return Q.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.onReviewsLoadError,t.next=3,Object($.a)(r);case 3:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e}return i()(n,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!X()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,i={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(i.category_id=Array.isArray(r)?r.join(","):r),c&&(i.product_id=c),i}},{key:"replaceReviews",value:function(){if(!this.isPreview){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}}},{key:"appendReviews",value:function(){if(!this.isPreview){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(Z.b)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter((function(e){return Object.keys(e).length})).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}})).catch(this.setError)}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,i=r.totalReviews;return Object(p.createElement)(e,W()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:i}))}}]),n}(g.Component);E()(t,"defaultProps",{delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}});var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){s()(r,e);var t=te(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,i=e.totalReviews;return r?Object(p.createElement)(h.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(m.Disabled,null,t.showOrderby&&v.G&&Object(p.createElement)(k,{readOnly:!0,value:t.orderby}),Object(p.createElement)(G,{attributes:t,reviews:c}),t.showLoadMore&&i>c.length&&Object(p.createElement)(y,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")})):Object(p.createElement)(o,{attributes:t})}}]),r}(g.Component));function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var oe=function(e){s()(r,e);var t=ne(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(m.Placeholder,{icon:t,label:r},Object(w.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,i=t.reviewsOnPageLoad,a=t.showProductName,s=t.showReviewDate,l=t.showReviewerName,u=t.showReviewContent,b=t.showReviewImage,d=t.showReviewRating,w=Object(Z.c)(t.orderby),g=w.order,m=w.orderby;return!(u||d||s||l||b||a)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(Z.a)(r,t)},Object(p.createElement)(re,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(f.debounce)(e,400)},noReviewsPlaceholder:n,orderby:m,order:g,productId:c,reviewsToDisplay:i}))}}]),r}(g.Component);t.a=oe},196:function(e,t){},197:function(e,t){},246:function(e,t){},247:function(e,t){},248:function(e,t){},249:function(e,t){},25:function(e,t){!function(){e.exports=this.wp.compose}()},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},4:function(e,t){!function(){e.exports=this.wp.components}()},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(15),o=r.n(n),c=r(38),i=r.n(c),a=function(){var e=i()(o.a.mark((function e(t){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},45:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},46:function(e,t,r){"use strict";var n=r(7),o=r.n(n),c=r(0),i=(r(2),r(9)),a=r(8),s=r.n(a);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,l=null!=r,b=null!=n;return!l&&b?(t=o||"span",a=u(u({},a),{},{className:s()(a.className,"screen-reader-text")}),Object(c.createElement)(t,a,n)):(t=o||i.Fragment,l&&b&&r!==n?Object(c.createElement)(t,a,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,a,r))};b.defaultProps={wrapperProps:{}},t.a=b},47:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},48:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(45));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))}},5:function(e,t,r){"use strict";r.d(t,"k",(function(){return o})),r.d(t,"G",(function(){return c})),r.d(t,"M",(function(){return i})),r.d(t,"x",(function(){return a})),r.d(t,"z",(function(){return s})),r.d(t,"l",(function(){return l})),r.d(t,"y",(function(){return u})),r.d(t,"B",(function(){return b})),r.d(t,"n",(function(){return d})),r.d(t,"A",(function(){return p})),r.d(t,"m",(function(){return w})),r.d(t,"C",(function(){return g})),r.d(t,"t",(function(){return f})),r.d(t,"w",(function(){return m})),r.d(t,"q",(function(){return v})),r.d(t,"r",(function(){return h})),r.d(t,"s",(function(){return O})),r.d(t,"j",(function(){return j})),r.d(t,"I",(function(){return y})),r.d(t,"N",(function(){return _})),r.d(t,"p",(function(){return k})),r.d(t,"o",(function(){return R})),r.d(t,"F",(function(){return E})),r.d(t,"c",(function(){return P})),r.d(t,"u",(function(){return S})),r.d(t,"v",(function(){return C})),r.d(t,"Q",(function(){return x})),r.d(t,"R",(function(){return T})),r.d(t,"H",(function(){return L})),r.d(t,"a",(function(){return D})),r.d(t,"K",(function(){return I})),r.d(t,"b",(function(){return M})),r.d(t,"J",(function(){return A})),r.d(t,"h",(function(){return B})),r.d(t,"L",(function(){return V})),r.d(t,"g",(function(){return z})),r.d(t,"i",(function(){return G})),r.d(t,"E",(function(){return U})),r.d(t,"D",(function(){return W})),r.d(t,"P",(function(){return J})),r.d(t,"O",(function(){return Q})),r.d(t,"d",(function(){return q})),r.d(t,"e",(function(){return K})),r.d(t,"f",(function(){return Y})),r.d(t,"U",(function(){return Z})),r.d(t,"V",(function(){return $})),r.d(t,"S",(function(){return ee})),r.d(t,"T",(function(){return te}));var n=r(3),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),a=Object(n.getSetting)("max_columns",6),s=Object(n.getSetting)("min_columns",1),l=Object(n.getSetting)("default_columns",3),u=Object(n.getSetting)("max_rows",6),b=Object(n.getSetting)("min_rows",1),d=Object(n.getSetting)("default_rows",3),p=Object(n.getSetting)("min_height",500),w=Object(n.getSetting)("default_height",500),g=Object(n.getSetting)("placeholderImgSrc",""),f=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),m=Object(n.getSetting)("limitTags"),v=Object(n.getSetting)("hasProducts",!0),h=Object(n.getSetting)("hasTags",!0),O=Object(n.getSetting)("homeUrl",""),j=Object(n.getSetting)("couponsEnabled",!0),y=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),R=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),E=Object(n.getSetting)("productCount",0),P=Object(n.getSetting)("attributes",[]),S=Object(n.getSetting)("isShippingCalculatorEnabled",!0),C=Object(n.getSetting)("isShippingCostHidden",!1),N=Object(n.getSetting)("woocommerceBlocksPhase",1),x=Object(n.getSetting)("wcBlocksAssetUrl",""),T=Object(n.getSetting)("wcBlocksBuildUrl",""),L=Object(n.getSetting)("shippingCountries",{}),D=Object(n.getSetting)("allowedCountries",{}),I=Object(n.getSetting)("shippingStates",{}),M=Object(n.getSetting)("allowedStates",{}),A=Object(n.getSetting)("shippingMethodsExist",!1),B=Object(n.getSetting)("checkoutShowLoginReminder",!0),H={id:0,title:"",permalink:""},F=Object(n.getSetting)("storePages",{shop:H,cart:H,checkout:H,privacy:H,terms:H}),V=F.shop.permalink,z=F.checkout.id,G=F.checkout.permalink,U=F.privacy.permalink,W=F.privacy.title,J=F.terms.permalink,Q=F.terms.title,q=F.cart.id,K=F.cart.permalink,Y=Object(n.getSetting)("checkoutAllowsGuest",!1),X=(Object(n.getSetting)("checkoutAllowsSignup",!1),r(17)),Z=function(e,t){if(N>2)return Object(X.registerBlockType)(e,t)},$=function(e,t){if(N>1)return Object(X.registerBlockType)(e,t)},ee=function(){return N>2},te=function(){return N>1}},59:function(e,t,r){"use strict";var n=r(7),o=r.n(n),c=r(27),i=r.n(c),a=r(9);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},6:function(e,t){!function(){e.exports=this.lodash}()},72:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(21),i=r.n(c),a=r(24),s=r.n(a),l=r(19),u=r.n(l),b=r(22),d=r.n(b),p=r(23),w=r.n(p),g=r(12),f=r.n(g),m=r(0),v=r(6),h=r(8),O=r.n(h),j=r(4),y=r(25);r(121);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f()(e);if(t){var o=f()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return w()(this,r)}}var k=function(e){d()(r,e);var t=_(r);function r(){var e;return i()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,i=r.instanceId,a=r.className,s=r.help,l=r.options,u=r.value,b="inspector-toggle-button-control-".concat(i);return s&&(e=Object(v.isFunction)(s)?s(c):s),Object(m.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",a)},Object(m.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(m.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(m.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)}))))}}]),r}(m.Component);t.a=Object(y.withInstanceId)(k)},80:function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return u}));var n=r(13),o=r.n(n),c=r(8),i=r.n(c),a=r(5),s=function(e){if(a.G){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=function(e){return o()({path:"/wc/store/products/reviews?"+Object.entries(e).map((function(e){return e.join("=")})).join("&"),parse:!1}).then((function(e){return e.json().then((function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}}))}))},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,a=t.showProductName,s=t.showReviewImage,l=t.showReviewRating;return i()(e,r,{"has-image":s,"has-name":o,"has-date":n,"has-rating":l,"has-content":c,"has-product-name":a})}},808:function(e,t,r){e.exports=r(898)},89:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(59)),i=r(146),a=r(8),s=r.n(a),l=r(4),u=r(48);r(149);t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,b=e.onRetry;return Object(n.createElement)(l.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(n.createElement)(u.a,{error:r}),b&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(l.Spinner,null):Object(n.createElement)(l.Button,{isDefault:!0,onClick:b},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},898:function(e,t,r){"use strict";r.r(t);var n=r(7),o=r.n(n),c=r(0),i=r(1),a=r(17),s=r(59),l=r(58),u=Object(c.createElement)(l.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M15 4v7H5.17l-.59.59-.58.58V4h11m1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1z"})),b=(r(196),r(14)),d=r(4),p=(r(2),r(184)),w=function(){return Object(c.createElement)(d.Placeholder,{className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{srcElement:u,className:"block-editor-block-icon"}),label:Object(i.__)("All Reviews","woo-gutenberg-products-block")},Object(i.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block"))},g=r(137),f=function(e){var t=e.attributes,r=e.setAttributes;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(b.InspectorControls,{key:"inspector"},Object(c.createElement)(d.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(d.ToggleControl,{label:Object(i.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(g.b)(t,r)),Object(c.createElement)(d.PanelBody,{title:Object(i.__)("List Settings","woo-gutenberg-products-block")},Object(g.c)(t,r))),Object(c.createElement)(p.a,{attributes:t,className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{icon:u,className:"block-editor-block-icon"}),name:Object(i.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))},m=r(178),v=r(179),h=r(158);function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(a.registerBlockType)("woocommerce/all-reviews",{title:Object(i.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(s.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1},example:j(j({},h.a),{},{attributes:j(j({},h.a.attributes),{},{showProductName:!0})}),attributes:j(j({},m.a),{},{showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(f,e)},save:v.a})},9:function(e,t){!function(){e.exports=this.React}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,i,a=t[0],s=t[1],l=t[2],b=0,d=[];b<a.length;b++)i=a[b],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&d.push(o[i][0]),o[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={6:0},c=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var u=s;return c.push([812,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},121:function(e,t){},13:function(e,t){!function(){e.exports=this.wp.apiFetch}()},137:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return p}));var n=r(0),o=r(1),c=r(188),i=r(4),a=r(14),s=r(3),l=r(5),u=r(73),b=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(i.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!l.I&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!l.O&&Object(n.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(c.a)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(i.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},14:function(e,t){!function(){e.exports=this.wp.blockEditor}()},146:function(e,t,r){"use strict";var n=r(0),o=r(59),c=Object(n.createElement)(o.a,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));t.a=c},149:function(e,t){},15:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},151:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(8)),c=r.n(o),i=r(48),a=r(189);r(199);t.a=Object(a.a)((function(e){var t=e.className,r=e.instanceId,o=e.defaultValue,a=e.label,s=e.onChange,l=e.options,u=e.screenReaderLabel,b=e.readOnly,d=e.value,p="wc-block-components-sort-select__select-".concat(r);return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:a,screenReaderLabel:u,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:p}}),Object(n.createElement)("select",{id:p,className:"wc-block-sort-select__select wc-block-components-sort-select__select",defaultValue:o,onChange:s,readOnly:b,value:d},l.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},159:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(5),c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(n.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Alice","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.S+"img/avatar.jpg",96:o.S+"img/avatar.jpg"},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(n.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(n.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",reviewer:Object(n.__)("Bob","woo-gutenberg-products-block"),review:"<p>".concat(Object(n.__)("This product is awesome, I love it!","woo-gutenberg-products-block"),"</p>\n"),reviewer_avatar_urls:{48:o.S+"img/avatar.jpg",96:o.S+"img/avatar.jpg"},rating:null,verified:!1}]}}},17:function(e,t){!function(){e.exports=this.wp.blocks}()},179:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},180:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=(r(198),r(69));t.a=function(e){var t=e.attributes;return Object(c.createElement)("div",o()({className:Object(i.a)(t)},Object(i.b)(t)))}},185:function(e,t,r){"use strict";var n=r(21),o=r.n(n),c=r(24),i=r.n(c),a=r(22),s=r.n(a),l=r(23),u=r.n(l),b=r(12),d=r.n(b),p=r(0),w=r(1),g=r(9),f=(r(2),r(6)),m=r(4),v=r(5),h=r(91),O=r(48),j=(r(251),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(O.a,{label:r,screenReaderLabel:n})))});j.defaultProps={label:Object(w.__)("Load more","woo-gutenberg-products-block")};var y=j,_=r(151),k=(r(248),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(_.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",defaultValue:t,label:Object(w.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(w.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(w.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(w.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(w.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),R=r(7),E=r.n(R),S=r(8),P=r.n(S),C=r(19),N=r.n(C),x=r(225),T=r.n(x),L=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=T()(e,{suffix:r,limit:t});return n.html},D=function(e,t,r,n){var o=I(e,t,r);return L(e,o-n.length,n)},I=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=L(e,n.middle),n=M(n,t.clientHeight,r);return n.middle},M=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var B=function(e){s()(r,e);var t=A(r);function r(e){var n;return o()(this,r),(n=t.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},n.reviewSummary=Object(g.createRef)(),n.reviewContent=Object(g.createRef)(),n.getButton=n.getButton.bind(N()(n)),n.onClick=n.onClick.bind(N()(n)),n}return i()(r,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:D(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),r}(g.Component);B.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(w.__)("Read more","woo-gutenberg-products-block"),lessText:Object(w.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var H=B;r(250);var F=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,i=t.showReviewerName,a=t.showReviewImage,s=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,g=Number.isFinite(b)&&s;return Object(p.createElement)("li",{className:P()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||i||a||g)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},a&&function(e,t,r){var n,o;return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:(null===(n=e.product_image)||void 0===n?void 0:n.alt)||"",src:(null===(o=e.product_image)||void 0===o?void 0:o.thumbnail)||""}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(w.__)("Verified buyer","woo-gutenberg-products-block")},Object(w.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||i||g||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},g&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(w.sprintf)(Object(w.__)("Rated %f out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(n),i&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(n))),l&&function(e){return Object(p.createElement)(H,{maxLines:10,moreText:Object(w.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(w.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(249);function V(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V(Object(r),!0).forEach((function(t){E()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var W=function(e){var t=e.attributes,r=e.reviews,n=(v.O||"product"===t.imageType)&&t.showReviewImage,o=v.I&&t.showReviewRating,c=z(z({},t),{},{showReviewImage:n,showReviewRating:o});return Object(p.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(p.createElement)(F,{attributes:c}):r.map((function(e,t){return Object(p.createElement)(F,{key:e.id||t,attributes:c,review:e})})))},U=r(10),G=r.n(U),J=r(15),q=r.n(J),K=r(37),Q=r.n(K),X=r(45),Y=r.n(X),Z=r(69),$=r(43);function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}function te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var re=function(e){var t=function(t){s()(n,t);var r=ee(n);function n(){var e;o()(this,n);for(var t=arguments.length,c=new Array(t),i=0;i<t;i++)c[i]=arguments[i];return e=r.call.apply(r,[this].concat(c)),E()(N()(e),"isPreview",!!e.props.attributes.previewReviews),E()(N()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),E()(N()(e),"state",{error:null,loading:!0,reviews:e.isPreview?e.props.attributes.previewReviews:[],totalReviews:e.isPreview?e.props.attributes.previewReviews.length:0}),E()(N()(e),"setError",function(){var t=Q()(q.a.mark((function t(r){var n,o;return q.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.props.onReviewsLoadError,t.next=3,Object($.a)(r);case 3:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e}return i()(n,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,i={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(i.category_id=Array.isArray(r)?r.join(","):r),c&&(i.product_id=c),i}},{key:"replaceReviews",value:function(){if(!this.isPreview){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}}},{key:"appendReviews",value:function(){if(!this.isPreview){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(Z.c)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter((function(e){return Object.keys(e).length})).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}})).catch(this.setError)}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,i=r.totalReviews;return Object(p.createElement)(e,G()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:i}))}}]),n}(g.Component);E()(t,"defaultProps",{delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}});var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){s()(r,e);var t=te(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,i=e.totalReviews;return r?Object(p.createElement)(h.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(m.Disabled,null,t.showOrderby&&v.I&&Object(p.createElement)(k,{readOnly:!0,value:t.orderby}),Object(p.createElement)(W,{attributes:t,reviews:c}),t.showLoadMore&&i>c.length&&Object(p.createElement)(y,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")})):Object(p.createElement)(o,{attributes:t})}}]),r}(g.Component));function ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d()(e);if(t){var o=d()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return u()(this,r)}}var oe=function(e){s()(r,e);var t=ne(r);function r(){return o()(this,r),t.apply(this,arguments)}return i()(r,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(m.Placeholder,{icon:t,label:r},Object(w.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.noReviewsPlaceholder,n=t.categoryIds,o=t.productId,c=t.reviewsOnPageLoad,i=t.showProductName,a=t.showReviewDate,s=t.showReviewerName,l=t.showReviewContent,u=t.showReviewImage,b=t.showReviewRating,d=Object(Z.d)(t.orderby),w=d.order,g=d.orderby;return!(l||b||a||s||u||i)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(Z.a)(t)},Object(p.createElement)(re,{attributes:t,categoryIds:n,delayFunction:function(e){return Object(f.debounce)(e,400)},noReviewsPlaceholder:r,orderby:g,order:w,productId:o,reviewsToDisplay:c}))}}]),r}(g.Component);t.a=oe},198:function(e,t){},199:function(e,t){},248:function(e,t){},249:function(e,t){},25:function(e,t){!function(){e.exports=this.wp.compose}()},250:function(e,t){},251:function(e,t){},3:function(e,t){!function(){e.exports=this.wc.wcSettings}()},4:function(e,t){!function(){e.exports=this.wp.components}()},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(15),o=r.n(n),c=r(37),i=r.n(c),a=function(){var e=i()(o.a.mark((function e(t){var r;return o.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof t.json){e.next=11;break}return e.prev=1,e.next=4,t.json();case 4:return r=e.sent,e.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",{message:e.t0.message,type:"general"});case 11:return e.abrupt("return",{message:t.message,type:t.type||"general"});case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}()},45:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},46:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},48:function(e,t,r){"use strict";var n=r(7),o=r.n(n),c=r(0),i=(r(2),r(9)),a=r(8),s=r.n(a);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var b=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,l=null!=r,b=null!=n;return!l&&b?(t=o||"span",a=u(u({},a),{},{className:s()(a.className,"screen-reader-text")}),Object(c.createElement)(t,a,n)):(t=o||i.Fragment,l&&b&&r!==n?Object(c.createElement)(t,a,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,a,r))};b.defaultProps={wrapperProps:{}},t.a=b},49:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(46));t.a=function(e){var t,r,i,a=e.error;return Object(n.createElement)("div",{className:"wc-block-error-message"},(r=(t=a).message,i=t.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))}},5:function(e,t,r){"use strict";r.d(t,"k",(function(){return o})),r.d(t,"I",(function(){return c})),r.d(t,"O",(function(){return i})),r.d(t,"y",(function(){return a})),r.d(t,"A",(function(){return s})),r.d(t,"l",(function(){return l})),r.d(t,"z",(function(){return u})),r.d(t,"C",(function(){return b})),r.d(t,"n",(function(){return d})),r.d(t,"B",(function(){return p})),r.d(t,"m",(function(){return w})),r.d(t,"E",(function(){return g})),r.d(t,"u",(function(){return f})),r.d(t,"x",(function(){return m})),r.d(t,"r",(function(){return v})),r.d(t,"s",(function(){return h})),r.d(t,"t",(function(){return O})),r.d(t,"j",(function(){return j})),r.d(t,"K",(function(){return y})),r.d(t,"P",(function(){return _})),r.d(t,"p",(function(){return k})),r.d(t,"q",(function(){return R})),r.d(t,"o",(function(){return E})),r.d(t,"H",(function(){return S})),r.d(t,"c",(function(){return P})),r.d(t,"v",(function(){return C})),r.d(t,"w",(function(){return N})),r.d(t,"S",(function(){return T})),r.d(t,"T",(function(){return L})),r.d(t,"J",(function(){return D})),r.d(t,"a",(function(){return I})),r.d(t,"M",(function(){return M})),r.d(t,"b",(function(){return A})),r.d(t,"L",(function(){return B})),r.d(t,"D",(function(){return H})),r.d(t,"h",(function(){return F})),r.d(t,"N",(function(){return W})),r.d(t,"g",(function(){return U})),r.d(t,"i",(function(){return G})),r.d(t,"G",(function(){return J})),r.d(t,"F",(function(){return q})),r.d(t,"R",(function(){return K})),r.d(t,"Q",(function(){return Q})),r.d(t,"d",(function(){return X})),r.d(t,"e",(function(){return Y})),r.d(t,"f",(function(){return Z})),r.d(t,"W",(function(){return ee})),r.d(t,"X",(function(){return te})),r.d(t,"U",(function(){return re})),r.d(t,"V",(function(){return ne}));var n=r(3),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),a=Object(n.getSetting)("max_columns",6),s=Object(n.getSetting)("min_columns",1),l=Object(n.getSetting)("default_columns",3),u=Object(n.getSetting)("max_rows",6),b=Object(n.getSetting)("min_rows",1),d=Object(n.getSetting)("default_rows",3),p=Object(n.getSetting)("min_height",500),w=Object(n.getSetting)("default_height",500),g=Object(n.getSetting)("placeholderImgSrc",""),f=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),m=Object(n.getSetting)("limitTags"),v=Object(n.getSetting)("hasProducts",!0),h=Object(n.getSetting)("hasTags",!0),O=Object(n.getSetting)("homeUrl",""),j=Object(n.getSetting)("couponsEnabled",!0),y=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),R=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),E=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),S=Object(n.getSetting)("productCount",0),P=Object(n.getSetting)("attributes",[]),C=Object(n.getSetting)("isShippingCalculatorEnabled",!0),N=Object(n.getSetting)("isShippingCostHidden",!1),x=Object(n.getSetting)("woocommerceBlocksPhase",1),T=Object(n.getSetting)("wcBlocksAssetUrl",""),L=Object(n.getSetting)("wcBlocksBuildUrl",""),D=Object(n.getSetting)("shippingCountries",{}),I=Object(n.getSetting)("allowedCountries",{}),M=Object(n.getSetting)("shippingStates",{}),A=Object(n.getSetting)("allowedStates",{}),B=Object(n.getSetting)("shippingMethodsExist",!1),H=Object(n.getSetting)("paymentGatewaySortOrder",[]),F=Object(n.getSetting)("checkoutShowLoginReminder",!0),V={id:0,title:"",permalink:""},z=Object(n.getSetting)("storePages",{shop:V,cart:V,checkout:V,privacy:V,terms:V}),W=z.shop.permalink,U=z.checkout.id,G=z.checkout.permalink,J=z.privacy.permalink,q=z.privacy.title,K=z.terms.permalink,Q=z.terms.title,X=z.cart.id,Y=z.cart.permalink,Z=Object(n.getSetting)("checkoutAllowsGuest",!1),$=(Object(n.getSetting)("checkoutAllowsSignup",!1),r(17)),ee=function(e,t){if(x>2)return Object($.registerBlockType)(e,t)},te=function(e,t){if(x>1)return Object($.registerBlockType)(e,t)},re=function(){return x>2},ne=function(){return x>1}},6:function(e,t){!function(){e.exports=this.lodash}()},60:function(e,t,r){"use strict";var n=r(7),o=r.n(n),c=r(27),i=r.n(c),a=r(9);r(2);function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=i()(e,["srcElement","size"]);return Object(a.isValidElement)(t)&&Object(a.cloneElement)(t,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({width:n,height:n},c))}},69:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b}));var n=r(13),o=r.n(n),c=r(8),i=r.n(c),a=r(5),s=function(e){if(a.I){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=function(e){return o()({path:"/wc/store/products/reviews?"+Object.entries(e).map((function(e){return e.join("=")})).join("&"),parse:!1}).then((function(e){return e.json().then((function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}}))}))},u=function(e){var t=e.className,r=e.categoryIds,n=e.productId,o=e.showReviewDate,c=e.showReviewerName,a=e.showReviewContent,s=e.showProductName,l=e.showReviewImage,u=e.showReviewRating,b="wc-block-all-reviews";return n&&(b="wc-block-reviews-by-product"),Array.isArray(r)&&(b="wc-block-reviews-by-category"),i()(b,t,{"has-image":l,"has-name":c,"has-date":o,"has-rating":u,"has-content":a,"has-product-name":s})},b=function(e){var t=e.categoryIds,r=e.imageType,n=e.orderby,o=e.productId,c={"data-image-type":r,"data-orderby":n,"data-reviews-on-page-load":e.reviewsOnPageLoad,"data-reviews-on-load-more":e.reviewsOnLoadMore,"data-show-load-more":e.showLoadMore,"data-show-orderby":e.showOrderby};return o&&(c["data-product-id"]=o),Array.isArray(t)&&(c["data-category-ids"]=t.join(",")),c}},73:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(21),i=r.n(c),a=r(24),s=r.n(a),l=r(19),u=r.n(l),b=r(22),d=r.n(b),p=r(23),w=r.n(p),g=r(12),f=r.n(g),m=r(0),v=r(6),h=r(8),O=r.n(h),j=r(4),y=r(25);r(121);function _(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=f()(e);if(t){var o=f()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return w()(this,r)}}var k=function(e){d()(r,e);var t=_(r);function r(){var e;return i()(this,r),(e=t.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return s()(r,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,i=r.instanceId,a=r.className,s=r.help,l=r.options,u=r.value,b="inspector-toggle-button-control-".concat(i);return s&&(e=Object(v.isFunction)(s)?s(c):s),Object(m.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",a)},Object(m.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(m.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(m.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)}))))}}]),r}(m.Component);t.a=Object(y.withInstanceId)(k)},812:function(e,t,r){e.exports=r(901)},9:function(e,t){!function(){e.exports=this.React}()},901:function(e,t,r){"use strict";r.r(t);var n=r(7),o=r.n(n),c=r(0),i=r(1),a=r(17),s=r(60),l=r(59),u=Object(c.createElement)(l.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M15 4v7H5.17l-.59.59-.58.58V4h11m1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1z"})),b=(r(198),r(14)),d=r(4),p=(r(2),r(185)),w=function(){return Object(c.createElement)(d.Placeholder,{className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{srcElement:u,className:"block-editor-block-icon"}),label:Object(i.__)("All Reviews","woo-gutenberg-products-block")},Object(i.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block"))},g=r(137),f=function(e){var t=e.attributes,r=e.setAttributes;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(b.InspectorControls,{key:"inspector"},Object(c.createElement)(d.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(d.ToggleControl,{label:Object(i.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(g.b)(t,r)),Object(c.createElement)(d.PanelBody,{title:Object(i.__)("List Settings","woo-gutenberg-products-block")},Object(g.c)(t,r))),Object(c.createElement)(p.a,{attributes:t,icon:Object(c.createElement)(s.a,{icon:u,className:"block-editor-block-icon"}),name:Object(i.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))},m=r(179),v=r(180),h=r(159);function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){o()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Object(a.registerBlockType)("woocommerce/all-reviews",{title:Object(i.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(s.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1},example:j(j({},h.a),{},{attributes:j(j({},h.a.attributes),{},{showProductName:!0})}),attributes:j(j({},m.a),{},{showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(f,e)},save:v.a})},91:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(60)),i=r(146),a=r(8),s=r.n(a),l=r(4),u=r(49);r(149);t.a=function(e){var t=e.className,r=e.error,a=e.isLoading,b=e.onRetry;return Object(n.createElement)(l.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:i.a}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(n.createElement)(u.a,{error:r}),b&&Object(n.createElement)(n.Fragment,null,a?Object(n.createElement)(l.Spinner,null):Object(n.createElement)(l.Button,{isDefault:!0,onClick:b},Object(o.__)("Retry","woo-gutenberg-products-block"))))}}});
|
build/atomic-block-components/add-to-cart-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{100:function(t,e){t.exports=function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}},101:function(t,e){t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},141:function(t,e){},170:function(t,e,n){"use strict";n.d(e,"a",(function(){return a}));var a=function(t,e){var n=[];return Object.keys(t).forEach((function(a){if(void 0!==e[a])switch(t[a].type){case"boolean":n[a]="false"!==e[a]&&!1!==e[a];break;case"number":n[a]=parseInt(e[a],10);break;case"array":case"object":n[a]=JSON.parse(e[a]);break;default:n[a]=e[a]}else n[a]=t[a].default})),n}},267:function(t,e,n){"use strict";n.d(e,"b",(function(){return c})),n.d(e,"a",(function(){return o}));var a=window.Event||null,r=function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof a){var r=new a(t,{bubbles:e,cancelable:n});document.body.dispatchEvent(r)}else{var c=document.createEvent("Event");c.initEvent(t,e,n),document.body.dispatchEvent(c)}},c=function(){r("wc_fragment_refresh",!0,!0)},o=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var c=function(){r(e,n,a)};return jQuery(document).on(t,c),function(){return jQuery(document).off(t,c)}}},268:function(t,e,n){"use strict";var a=n(50),r=React.createElement(a.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},React.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),React.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));e.a=r},273:function(t,e,n){"use strict";var a=n(11),r=n.n(a),c=n(170);e.a=function(t){return function(e){return function(n){var a=Object(c.a)(t,n);return React.createElement(e,r()({},n,a))}}}},281:function(t,e,n){"use strict";n.d(e,"a",(function(){return m}));var a=n(10),r=n.n(a),c=n(0),o=n(13),i=n(80),u=n(14),s=n(16),l=n(79),d=function(t,e){var n=t.find((function(t){return t.id===e}));return n?n.quantity:0},m=function(t){var e=Object(o.useDispatch)(u.CART_STORE_KEY).addItemToCart,n=Object(i.a)(),a=n.cartItems,m=n.cartIsLoading,b=Object(l.a)(),p=b.addErrorNotice,f=b.removeNotice,v=Object(c.useState)(!1),h=r()(v,2),g=h[0],y=h[1],E=Object(c.useRef)(d(a,t));return Object(c.useEffect)((function(){var e=d(a,t);e!==E.current&&(E.current=e)}),[a,t]),{cartQuantity:Number.isFinite(E.current)?E.current:0,addingToCart:g,cartIsLoading:m,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;y(!0),e(t,n).then((function(t){!0===t&&f("add-to-cart")})).catch((function(t){p(Object(s.decodeEntities)(t.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){y(!1)}))}}}},287:function(t,e){},288:function(t,e){},297:function(t,e,n){"use strict";n.r(e);var a=n(26),r=n(273),c=(n(4),n(5)),o=n.n(c),i=n(10),u=n.n(i),s=n(0),l=n(281),d=n(267),m=Object(s.createContext)({product:{},productId:0,variationId:0,variationData:{},cartItemData:{},quantity:1,minQuantity:1,maxQuantity:99,quantityInCart:0,setQuantity:function(t){},setVariationId:function(t){},setVariationData:function(t){},setCartItemData:function(t){},showFormElements:!1,formInitialized:!1,formDisabled:!0,formSubmitting:!1,onChange:function(){},onSubmit:function(){},onSuccess:function(){},onFail:function(){}}),b=function(){return Object(s.useContext)(m)},p=function(t){var e=t.children,n=t.product,a=t.showFormElements,r=n||{},c=r.id||0,o=Object(s.useState)(0),i=u()(o,2),b=i[0],p=i[1],v=Object(s.useState)({}),h=u()(v,2),g=h[0],y=h[1],E=Object(s.useState)({}),O=u()(E,2),j=O[0],R=O[1],w=Object(s.useState)(1),_=u()(w,2),C=_[0],k=_[1],S=Object(l.a)(c),I=S.addToCart,N=S.addingToCart,D=S.cartQuantity,x=S.cartIsLoading;!function(t){var e=Object(s.useRef)(!0);Object(s.useEffect)((function(){e.current?e.current=!1:Object(d.b)()}),[t])}(D);var A=!x&&c>0,T=N||!A||!f(r),P=Object(s.useCallback)((function(){I(C)}),[I,C]),Q=Object(s.useCallback)((function(){}),[]),F=Object(s.useCallback)((function(){}),[]),L=Object(s.useCallback)((function(){}),[]),q={product:r,productId:c,variationId:b,variationData:g,cartItemData:j,quantity:C,minQuantity:1,maxQuantity:r.quantity_limit||99,quantityInCart:D,setQuantity:k,setVariationId:p,setVariationData:y,setCartItemData:R,showFormElements:a,formInitialized:A,formDisabled:T,formSubmitting:N,onChange:Q,onSubmit:P,onSuccess:F,onFail:L};return React.createElement(m.Provider,{value:q},e)},f=function(t){var e=t.is_purchasable;return void 0!==e&&e},v=n(66),h=n(7),g=n(178),y=(n(287),n(1)),E=n(72),O=n(122),j=n(268),R=function(t){var e=t.className,n=t.href,a=t.text;return React.createElement(E.a,{className:e,href:n,rel:"nofollow"},a)},w=function(t){var e=t.className,n=t.quantityInCart,a=t.loading,r=t.disabled,c=t.onClick,o=Object(s.useState)(!1),i=u()(o,2),l=i[0],d=i[1];return React.createElement(E.a,{className:e,disabled:r,showSpinner:a,onClick:function(){c(),d(!0)}},n>0?Object(y.sprintf)(Object(y._n)("%d in cart","%d in cart",n,"woo-gutenberg-products-block"),n):Object(y.__)("Add to cart","woo-gutenberg-products-block"),l&&React.createElement(O.a,{srcElement:j.a,alt:Object(y.__)("Done","woo-gutenberg-products-block")}))},_=function(){var t=b(),e=t.showFormElements,n=t.product,a=t.quantityInCart,r=t.formDisabled,c=t.formSubmitting,o=t.onSubmit,i=n.is_purchasable,u=void 0===i||i,s=n.has_options,l=n.add_to_cart,d=void 0===l?{url:"",text:""}:l;return!e&&s||!u?React.createElement(R,{className:"wc-block-components-product-add-to-cart-button",href:d.url,text:d.text||Object(y.__)("View Product","woo-gutenberg-products-block")}):React.createElement(w,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:a,disabled:r,loading:c,onClick:o})},C=function(t){var e=t.disabled,n=t.min,a=t.max,r=t.value,c=t.onChange;return React.createElement("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:r,min:n,max:a,hidden:1===a,disabled:e,onChange:function(t){c(t.target.value)}})},k=function(t){var e=t.reason,n=void 0===e?Object(y.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):e;return React.createElement("div",{className:"wc-block-components-product-add-to-cart-unavailable"},n)},S=function(){var t=b(),e=t.product,n=t.quantity,a=t.minQuantity,r=t.maxQuantity,c=t.setQuantity,o=t.formDisabled;return e.id&&!e.is_purchasable?React.createElement(k,null):e.id&&!e.is_in_stock?React.createElement(k,{reason:Object(y.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(C,{value:n,min:a,max:r,disabled:o,onChange:c}),React.createElement(_,null))},I=(n(288),n(6)),N=n.n(I),D=n(71),x=n.n(D),A=n(16),T=n(180),P={value:"",label:Object(y.__)("Select an option","woo-gutenberg-products-block")},Q=function(t){var e=t.attributeName,n=t.options,a=void 0===n?[]:n,r=t.selected,c=void 0===r?"":r,o=t.onChange,i=void 0===o?function(){}:o;return React.createElement(T.SelectControl,{className:"wc-block-components-product-add-to-cart-attribute-picker__select",label:Object(A.decodeEntities)(e),value:c||"",options:[P].concat(x()(a)),onChange:i})},F=function(t){var e=t.selectedAttributes,n=t.variationAttributes,a=t.attributeNames;return Object.keys(n).filter((function(t){return a.every((function(a){var r=e[a]||"",c=n[t][a];return""===r||(null===c||c===r)}))}))};function L(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function q(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?L(Object(n),!0).forEach((function(e){N()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var V=function(t){var e=t.attributes,n=t.variationAttributes,a=Object(s.useState)(0),r=u()(a,2),c=r[0],o=r[1],i=Object(s.useState)([]),l=u()(i,2),d=l[0],m=l[1],b=Object.keys(e),p=Object.values(d).filter(Boolean).length>0,f=Object.values(d).filter((function(t){return""!==t})).length===b.length,v=Object(s.useMemo)((function(){var t=[];return b.forEach((function(a){var r=e[a],c=b.filter((function(t){return t!==a})),o=p?F({selectedAttributes:d,variationAttributes:n,attributeNames:c}):null,i=null!==o?o.map((function(t){return n[t][a]})):null;t[a]=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(t).map((function(t){var n=t.name,a=t.slug;return null===e||e.includes(null)||e.includes(a)?{value:a,label:n}:null})).filter(Boolean)}(r.terms,i)})),t}),[e,n,b,d,p]);return Object(s.useEffect)((function(){if(f){var t=F({selectedAttributes:d,variationAttributes:n,attributeNames:b});o(t[0]||0)}else o(0)}),[d,n,b,f]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},b.map((function(t){return React.createElement(Q,{key:t,attributeName:t,options:v[t],selected:d[t],onChange:function(e){m(q(q({},d),{},N()({},t,e)))}})})),React.createElement("p",null,"Matched variation ID: ",c))},B=function(t){var e=t.product,n=e.attributes,a=void 0===n?{}:n,r=e.variations,c=void 0===r?[]:r,o=function(t){return t?Object(h.keyBy)(Object.values(t).filter((function(t){return t.has_variations})),"name"):[]}(a),i=function(t){if(!t)return{};var e={};return t.forEach((function(t){var n=t.id,a=t.attributes;e[n]=a.reduce((function(t,e){var n=e.name,a=e.value;return t[n]=a,t}),[])})),e}(c);return 0===Object.keys(o).length||0===i.length?null:React.createElement(V,{attributes:o,variationAttributes:i})},W=function(){var t=b(),e=t.product,n=t.quantity,a=t.minQuantity,r=t.maxQuantity,c=t.setQuantity,o=t.formDisabled;return e.id&&!e.is_purchasable?React.createElement(k,null):e.id&&!e.is_in_stock?React.createElement(k,{reason:Object(y.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(B,{product:e}),React.createElement(C,{value:n,min:a,max:r,disabled:o,onChange:c}),React.createElement(_,null))},z=function(){return React.createElement(_,null)},M=function(){return React.createElement(T.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},J=function(){return React.createElement(M,null)},K=function(t){var e=t.productType;return"variable"===e?React.createElement(W,null):"grouped"===e?React.createElement(J,null):"external"===e?React.createElement(z,null):"simple"===e||"variation"===e?React.createElement(S,null):null},Y=Object(g.withProductDataContext)((function(t){var e=t.className,n=t.showFormElements,a=Object(v.useProductDataContext)().product,r=o()(e,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(h.isEmpty)(a)});return React.createElement(p,{product:a,showFormElements:n},React.createElement("div",{className:r},React.createElement(React.Fragment,null,n?React.createElement(K,{productType:a.type}):React.createElement(_,null))))})),G={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}};e.default=Object(a.compose)(Object(r.a)(G))(Y)},71:function(t,e,n){var a=n(99),r=n(100),c=n(52),o=n(101);t.exports=function(t){return a(t)||r(t)||c(t)||o()}},72:function(t,e,n){"use strict";var a=n(11),r=n.n(a),c=n(15),o=n.n(c),i=n(74),u=(n(4),n(5)),s=n.n(u);n(141);e.a=function(t){var e=t.className,n=t.showSpinner,a=void 0!==n&&n,c=t.children,u=o()(t,["className","showSpinner","children"]),l=s()("wc-block-components-button",e,{"wc-block-components-button--loading":a});return React.createElement(i.a,r()({className:l},u),a&&React.createElement("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),React.createElement("span",{className:"wc-block-components-button__text"},c))}},80:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var a=n(14),r=n(13),c=n(132),o=n(16),i=n(7),u={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},s=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},e=Object(c.a)(),n=e.isEditor,s=e.previewData,l=(null==s?void 0:s.previewCart)||{},d=t.shouldSelect,m=Object(r.useSelect)((function(t,e){var r=e.dispatch;if(!d)return u;if(n)return{cartCoupons:l.coupons,cartItems:l.items,cartItemsCount:l.items_count,cartItemsWeight:l.items_weight,cartNeedsPayment:l.needs_payment,cartNeedsShipping:l.needs_shipping,cartItemErrors:[],cartTotals:l.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:l.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==l?void 0:l.receiveCart)?l.receiveCart:function(){}};var c=t(a.CART_STORE_KEY),s=c.getCartData(),m=c.getCartErrors(),b=c.getCartTotals(),p=!c.hasFinishedResolution("getCartData"),f=c.areShippingRatesLoading(),v=r(a.CART_STORE_KEY).receiveCart,h=Object(i.mapValues)(s.shippingAddress,(function(t){return Object(o.decodeEntities)(t)}));return{cartCoupons:s.coupons,cartItems:s.items||[],cartItemsCount:s.itemsCount,cartItemsWeight:s.itemsWeight,cartNeedsPayment:s.needsPayment,cartNeedsShipping:s.needsShipping,cartItemErrors:s.errors||[],cartTotals:b,cartIsLoading:p,cartErrors:m,shippingAddress:h,shippingRates:s.shippingRates||[],shippingRatesLoading:f,hasShippingAddress:!!h.country,receiveCart:v}}),[d]);return m}},99:function(t,e,n){var a=n(53);t.exports=function(t){if(Array.isArray(t))return a(t)}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{108:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d}));var n=r(6),a=r.n(n),c=r(7);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var i="add_event_callback",u="remove_event_callback",l={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(c.uniqueId)(),type:i,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:u,eventType:e}}},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=t.type,n=t.eventType,c=t.id,o=t.callback,l=t.priority,d=new Map(e[n]);switch(r){case i:return d.set(c,{priority:l,callback:o}),s(s({},e),{},a()({},n,d));case u:return d.delete(c),s(s({},e),{},a()({},n,d))}return e}},140:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(57),a=(r(4),r(141),function(e){var t=e.errorMessage,r=void 0===t?"":t,a=e.propertyName,c=void 0===a?"":a,o=e.elementId,s=void 0===o?"":o,i=Object(n.b)(),u=i.getValidationError,l=i.getValidationErrorId;if(!r){var d=u(c)||{};if(!d.message||d.hidden)return null;r=d.message}return React.createElement("div",{className:"wc-block-components-validation-error",role:"alert"},React.createElement("p",{id:l(s)},r))})},141:function(e,t){},142:function(e,t){},171:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e,t){var r=[];return Object.keys(e).forEach((function(n){if(void 0!==t[n])switch(e[n].type){case"boolean":r[n]="false"!==t[n]&&!1!==t[n];break;case"number":r[n]=parseInt(t[n],10);break;case"array":case"object":r[n]=JSON.parse(t[n]);break;default:r[n]=t[n]}else r[n]=e[n].default})),r}},182:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=function(e,t){return!!e.type&&e.type===t},a={SUCCESS:"success",FAIL:"failure",ERROR:"error"},c={PAYMENTS:"wc/payment-area",EXPRESS_PAYMENTS:"wc/express-payment-area"},o=function(e){return n(e,a.SUCCESS)},s=function(e){return n(e,a.ERROR)},i=function(e){return n(e,a.FAIL)},u=function(){return{responseTypes:a,noticeContexts:c,isSuccessResponse:o,isErrorResponse:s,isFailResponse:i}}},183:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(108),a=function(e,t){return function(r){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,c=n.a.addEventCallback(e,r,a);return t(c),function(){t(n.a.removeEventCallback(e,c.id))}}}},184:function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p}));var n=r(23),a=r.n(n),c=r(22),o=r.n(c),s=r(49),i=r.n(s);function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,o=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,c=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw c}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var d=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},f=function(){var e=i()(a.a.mark((function e(t,r,n){var c,s,i,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=d(t,r),s=[],i=u(c),e.prev=3,i.s();case 5:if((l=i.n()).done){e.next=19;break}return f=l.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:p=e.sent,"object"===o()(p)&&s.push(p),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.error(e.t0);case 17:e.next=5;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(3),i.e(e.t1);case 24:return e.prev=24,i.f(),e.finish(24);case 27:return e.abrupt("return",!s.length||s);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(t,r,n){return e.apply(this,arguments)}}(),p=function(){var e=i()(a.a.mark((function e(t,r,n){var c,s,i,l,f,p;return a.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=d(t,r),s=!0,i=u(c),e.prev=3,i.s();case 5:if((l=i.n()).done){e.next=24;break}return f=l.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:if(p=e.sent,"object"!==o()(p)||void 0!==p.type){e.next=13;break}throw new Error("If you want to abort event emitter processing, your observer must return an object with a type property");case 13:if(!0===(s="object"!==o()(p)||p)){e.next=16;break}return e.abrupt("return",s);case 16:e.next=22;break;case 18:return e.prev=18,e.t0=e.catch(7),console.error(e.t0),e.abrupt("return",{type:"error"});case 22:e.next=5;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(3),i.e(e.t1);case 29:return e.prev=29,i.f(),e.finish(29);case 32:return e.abrupt("return",s);case 33:case"end":return e.stop()}}),e,null,[[3,26,29,32],[7,18]])})));return function(t,r,n){return e.apply(this,arguments)}}()},270:function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return c})),r.d(t,"b",(function(){return o}));var n=window.Event||null,a=function(e,t){var r=t.bubbles,a=void 0!==r&&r,c=t.cancelable,o=void 0!==c&&c,s=t.element;if(s||(s=document.body),"function"==typeof n){var i=new n(e,{bubbles:a,cancelable:o});s.dispatchEvent(i)}else{var u=document.createEvent("Event");u.initEvent(e,a,o),s.dispatchEvent(u)}},c=function(){a("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},o=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var c=function(){a(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,c),function(){return jQuery(document).off(e,c)}}},271:function(e,t,r){"use strict";var n=r(51),a=React.createElement(n.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},React.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}),React.createElement("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=a},276:function(e,t,r){"use strict";var n=r(11),a=r.n(n),c=r(171);t.a=function(e){return function(t){return function(r){var n=Object(c.a)(e,r);return React.createElement(t,a()({},r,n))}}}},284:function(e,t,r){"use strict";r.d(t,"a",(function(){return f}));var n=r(10),a=r.n(n),c=r(0),o=r(13),s=r(80),i=r(14),u=r(16),l=r(79),d=function(e,t){var r=e.find((function(e){return e.id===t}));return r?r.quantity:0},f=function(e){var t=Object(o.useDispatch)(i.CART_STORE_KEY).addItemToCart,r=Object(s.a)(),n=r.cartItems,f=r.cartIsLoading,p=Object(l.a)(),b=p.addErrorNotice,m=p.removeNotice,v=Object(c.useState)(!1),h=a()(v,2),g=h[0],O=h[1],y=Object(c.useRef)(d(n,e));return Object(c.useEffect)((function(){var t=d(n,e);t!==y.current&&(y.current=t)}),[n,e]),{cartQuantity:Number.isFinite(y.current)?y.current:0,addingToCart:g,cartIsLoading:f,addToCart:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;O(!0),t(e,r).then((function(e){!0===e&&m("add-to-cart")})).catch((function(e){b(Object(u.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){O(!1)}))}}}},290:function(e,t){},291:function(e,t){},300:function(e,t,r){"use strict";r.r(t);var n=r(26),a=r(276),c=(r(4),r(5)),o=r.n(c),s=r(57),i=r(10),u=r.n(i),l=r(0),d=r(1),f=r(37),p=r(79),b=r(182),m=function(e){return e.is_purchasable||!1},v="pristine",h="idle",g="disabled",O="processing",y="before_processing",j="after_processing",E={status:v,hasError:!1,quantity:1,processingResponse:null,requestParams:{}},w="set_pristine",P="set_idle",k="set_disabled",_="set_processing",R="set_before_processing",C="set_after_processing",S="set_processing_response",A="set_has_error",x="set_no_error",T="set_quantity",I="set_request_params",D=w,N=P,q=k,V=_,F=R,Q=C,W=S,B=A,L=x,M=T,H=I,Y=function(){return{type:D}},J=function(){return{type:N}},K=function(){return{type:q}},U=function(){return{type:V}},z=function(){return{type:F}},G=function(){return{type:Q}},X=function(e){return{type:W,data:e}},$=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?B:L;return{type:t}},Z=function(e){return{type:M,quantity:e}},ee=function(e){return{type:H,data:e}},te=r(6),re=r.n(te);function ne(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ae(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(r),!0).forEach((function(t){re()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ne(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ce=w,oe=P,se=k,ie=_,ue=R,le=C,de=S,fe=A,pe=x,be=T,me=I,ve=v,he=h,ge=g,Oe=O,ye=y,je=j,Ee=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:E,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,a=r.type,c=r.data;switch(a){case ce:e=E;break;case oe:e=t.status!==he?ae(ae({},t),{},{status:he}):t;break;case se:e=t.status!==ge?ae(ae({},t),{},{status:ge}):t;break;case be:e=n!==t.quantity?ae(ae({},t),{},{quantity:n}):t;break;case me:e=ae(ae({},t),{},{requestParams:ae(ae({},t.requestParams),c)});break;case de:e=ae(ae({},t),{},{processingResponse:c});break;case ie:e=!1===(e=t.status!==Oe?ae(ae({},t),{},{status:Oe,hasError:!1}):t).hasError?e:ae(ae({},e),{},{hasError:!1});break;case ue:e=t.status!==ye?ae(ae({},t),{},{status:ye,hasError:!1}):t;break;case le:e=t.status!==je?ae(ae({},t),{},{status:je}):t;break;case fe:e=t.hasError?t:ae(ae({},t),{},{hasError:!0}),e=t.status===Oe||t.status===ye?ae(ae({},e),{},{status:he}):e;break;case pe:e=t.hasError?ae(ae({},t),{},{hasError:!1}):t}return e!==t&&a!==ce&&e.status===ve&&(e.status=he),e},we=r(108),Pe=r(183),ke="add_to_cart_before_processing",_e="add_to_cart_after_processing_with_success",Re="add_to_cart_after_processing_with_error",Ce=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(Pe.a)(_e,e),onAddToCartProcessingWithError:Object(Pe.a)(Re,e),onAddToCartBeforeProcessing:Object(Pe.a)(ke,e)}},Se=r(184),Ae=Object(l.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:function(e){},onAddToCartAfterProcessingWithError:function(e){},onAddToCartBeforeProcessing:function(e){}},dispatchActions:{resetForm:function(){},submitForm:function(){},setQuantity:function(e){},setHasError:function(e){},setAfterProcessing:function(e){},setRequestParams:function(e){}}}),xe=function(){return Object(l.useContext)(Ae)},Te=function(e){var t=e.children,r=e.product,n=e.showFormElements,a=Object(l.useReducer)(Ee,E),c=u()(a,2),o=c[0],i=c[1],v=Object(l.useReducer)(we.b,{}),w=u()(v,2),P=w[0],k=w[1],_=Object(f.a)(P),R=Object(p.a)(),C=R.addErrorNotice,S=R.removeNotices,A=Object(s.b)().setValidationErrors,x=Object(b.a)(),T=x.isSuccessResponse,I=x.isErrorResponse,D=x.isFailResponse,N=Object(l.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:Ce(k).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Ce(k).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Ce(k).onAddToCartBeforeProcessing}}),[k]),q=Object(l.useMemo)((function(){return{resetForm:function(){i(Y())},submitForm:function(){i(z())},setQuantity:function(e){i(Z(e))},setHasError:function(e){i($(e))},setRequestParams:function(e){i(ee(e))},setAfterProcessing:function(e){i(X(e)),i(G())}}}),[]);Object(l.useEffect)((function(){var e=o.status,t=!r.id||!m(r);e!==g||t?e!==g&&t&&i(K()):i(J())}),[o.status,r,i]),Object(l.useEffect)((function(){o.status===y&&(S("error"),Object(Se.a)(_,ke,{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&C(t),r&&A(r)})),i(J())):i(U())})))}),[o.status,A,C,S,i,_]),Object(l.useEffect)((function(){if(o.status===j){var e={processingResponse:o.processingResponse},t=function(e){if(e.message){var t=e.messageContext?{context:e.messageContext}:void 0;C(e.message,t)}};if(o.hasError)return void Object(Se.b)(_,Re,e).then((function(r){if(I(r)||D(r))t(r);else{var n,a=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(d.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");C(a,{id:"add-to-cart"})}i(J())}));Object(Se.b)(_,_e,e).then((function(e){I(e)||D(e)?(t(e),i($(!0))):i(J())}))}}),[o.status,o.hasError,o.processingResponse,q,C,I,D,T,_]);var V=function(e){return["simple","variable"].includes(e.type||"simple")}(r),F={product:r,productType:r.type||"simple",productIsPurchasable:m(r),productHasOptions:r.has_options||!1,supportsFormElements:V,showFormElements:n&&V,quantity:o.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:o.requestParams,isIdle:o.status===h,isDisabled:o.status===g,isProcessing:o.status===O,isBeforeProcessing:o.status===y,isAfterProcessing:o.status===j,hasError:o.hasError,eventRegistration:N,dispatchActions:q};return React.createElement(Ae.Provider,{value:F},t)},Ie=r(56),De=r.n(Ie),Ne=r(80),qe=r(16),Ve=r(270);function Fe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Qe=function(){var e=xe(),t=e.dispatchActions,r=e.product,n=e.quantity,a=e.eventRegistration,c=e.hasError,o=e.isProcessing,i=e.requestParams,f=Object(s.b)(),b=f.hasValidationErrors,m=f.showAllValidationErrors,v=Object(p.a)(),h=v.addErrorNotice,g=v.removeNotice,O=Object(Ne.a)().receiveCart,y=Object(l.useState)(!1),j=u()(y,2),E=j[0],w=j[1],P=!c&&o,k=Object(l.useCallback)((function(){return!b||(m(),{type:"error"})}),[b,m]);Object(l.useEffect)((function(){var e=a.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[a,k]);var _=Object(l.useCallback)((function(){w(!0),g("add-to-cart");var e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(r),!0).forEach((function(t){re()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fe(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:r.id||0,quantity:n},i);De()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){De.a.setNonce(e.headers),e.json().then((function(r){e.ok?O(r):(r.body&&r.body.message?h(Object(qe.decodeEntities)(r.body.message),{id:"add-to-cart"}):h(Object(d.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),w(!1),Object(Ve.c)()}))})).catch((function(e){e.json().then((function(e){var r;(null===(r=e.data)||void 0===r?void 0:r.cart)&&O(e.data.cart),t.setHasError(),t.setAfterProcessing(e),w(!1)}))}))}),[r,h,g,O,t,n,i]);return Object(l.useEffect)((function(){P&&!E&&_()}),[P,_,E]),null},We=function(e){var t=e.children,r=e.product,n=e.showFormElements;return React.createElement(s.a,null,React.createElement(Te,{product:r,showFormElements:n},t,React.createElement(Qe,null)))},Be=r(67),Le=r(7),Me=r(179),He=(r(290),r(72)),Ye=r(122),Je=r(271),Ke=r(284),Ue=function(e){var t=e.className,r=e.href,n=e.text;return React.createElement(He.a,{className:t,href:r,rel:"nofollow"},n)},ze=function(e){var t=e.className,r=e.quantityInCart,n=e.isProcessing,a=e.isDisabled,c=e.isDone,o=e.onClick;return React.createElement(He.a,{className:t,disabled:a,showSpinner:n,onClick:o},c&&r>0?Object(d.sprintf)(Object(d._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(d.__)("Add to cart","woo-gutenberg-products-block"),!!c&&React.createElement(Ye.a,{srcElement:Je.a,alt:Object(d.__)("Done","woo-gutenberg-products-block")}))},Ge=function(){var e=xe(),t=e.showFormElements,r=e.productIsPurchasable,n=e.productHasOptions,a=e.product,c=e.productType,o=e.isDisabled,s=e.isProcessing,i=e.eventRegistration,f=e.hasError,p=e.dispatchActions,b=Object(Ke.a)(a.id||0).cartQuantity,m=Object(l.useState)(!1),v=u()(m,2),h=v[0],g=v[1],O=a.add_to_cart||{url:"",text:""};return Object(l.useEffect)((function(){var e=i.onAddToCartAfterProcessingWithSuccess((function(){return f||g(!0),!0}),0);return function(){e()}}),[i,f]),(t||!n&&"simple"===c)&&r?React.createElement(ze,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:b,isDisabled:o,isProcessing:s,isDone:h,onClick:function(){return p.submitForm()}}):React.createElement(Ue,{className:"wc-block-components-product-add-to-cart-button",href:O.url,text:O.text||Object(d.__)("View Product","woo-gutenberg-products-block")})},Xe=function(e){var t=e.disabled,r=e.min,n=e.max,a=e.value,c=e.onChange;return React.createElement("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:r,max:n,hidden:1===n,disabled:t,onChange:function(e){c(e.target.value)}})},$e=function(e){var t=e.reason,r=void 0===t?Object(d.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):t;return React.createElement("div",{className:"wc-block-components-product-add-to-cart-unavailable"},r)},Ze=function(){var e=xe(),t=e.product,r=e.quantity,n=e.minQuantity,a=e.maxQuantity,c=e.dispatchActions,o=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement($e,null):t.id&&!t.is_in_stock?React.createElement($e,{reason:Object(d.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(Xe,{value:r,min:n,max:a,disabled:o,onChange:c.setQuantity}),React.createElement(Ge,null))},et=(r(291),r(50)),tt=r.n(et),rt=r(181),nt=r(3),at=r(140),ct={value:"",label:Object(d.__)("Select an option","woo-gutenberg-products-block")},ot=function(e){var t=e.attributeName,r=e.options,n=void 0===r?[]:r,a=e.value,c=void 0===a?"":a,i=e.onChange,u=void 0===i?function(){}:i,l=e.errorMessage,f=void 0===l?Object(d.__)("Please select a value.","woo-gutenberg-products-block"):l,p=Object(s.b)(),b=p.getValidationError,m=p.setValidationErrors,v=p.clearValidationError,h=t,g=b(h)||{};return Object(nt.useEffect)((function(){c?v(h):m(re()({},h,{message:f,hidden:!0}))}),[c,h,f,v,m]),Object(nt.useEffect)((function(){return function(){v(h)}}),[h,v]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},React.createElement(rt.SelectControl,{label:Object(qe.decodeEntities)(t),value:c||"",options:[ct].concat(tt()(n)),onChange:u,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":g.message&&!g.hidden})}),React.createElement(at.a,{propertyName:h,elementId:h}))};function st(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function it(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?st(Object(r),!0).forEach((function(t){re()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):st(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ut=function(e,t,r){var n=Object.values(t).map((function(e){return e.id}));if(Object.values(r).every((function(e){return""===e})))return n;var a=Object.keys(e);return n.filter((function(e){return a.every((function(n){var a=r[n]||"",c=t["id:"+e].attributes[n];return""===a||(null===c||c===a)}))}))},lt=function(e,t,r){var n={},a=Object.keys(e),c=Object.values(r).filter(Boolean).length>0;return a.forEach((function(a){var o=e[a],s=it(it({},r),{},re()({},a,null)),i=c?ut(e,t,s):null,u=null!==i?i.map((function(e){return t["id:"+e].attributes[a]})):null;n[a]=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map((function(e){var r=e.name,n=e.slug;return null===t||t.includes(null)||t.includes(n)?{value:n,label:Object(qe.decodeEntities)(r)}:null})).filter(Boolean)}(o.terms,u)})),n};function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(r),!0).forEach((function(t){re()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var pt=function(e){var t=e.attributes,r=e.variationAttributes,n=e.setRequestParams,a=Object(f.a)(t),c=Object(f.a)(r),o=Object(l.useState)(0),s=u()(o,2),i=s[0],d=s[1],p=Object(l.useState)({}),b=u()(p,2),m=b[0],v=b[1],h=Object(l.useMemo)((function(){return lt(a,c,m)}),[m,a,c]);return Object(l.useEffect)((function(){Object.values(m).filter((function(e){return""!==e})).length===Object.keys(a).length?d(function(e,t,r){return ut(e,t,r)[0]||0}(a,c,m)):i>0&&d(0)}),[m,i,a,c]),Object(l.useEffect)((function(){n({id:i,variation:Object.keys(m).map((function(e){return{attribute:e,value:m[e]}}))})}),[n,i,m]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(a).map((function(e){return React.createElement(ot,{key:e,attributeName:e,options:h[e],value:m[e],onChange:function(t){v(ft(ft({},m),{},re()({},e,t)))}})})))},bt=function(e){var t=e.product,r=e.dispatchers,n=function(e){return e?Object(Le.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):{}}(t.attributes),a=function(e){if(!e)return{};var t={};return e.forEach((function(e){var r=e.id,n=e.attributes;t["id:".concat(r)]={id:r,attributes:n.reduce((function(e,t){var r=t.name,n=t.value;return e[r]=n,e}),{})}})),t}(t.variations);return 0===Object.keys(n).length||0===a.length?null:React.createElement(pt,{attributes:n,variationAttributes:a,setRequestParams:r.setRequestParams})},mt=function(){var e=xe(),t=e.product,r=e.quantity,n=e.minQuantity,a=e.maxQuantity,c=e.dispatchActions,o=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement($e,null):t.id&&!t.is_in_stock?React.createElement($e,{reason:Object(d.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(bt,{product:t,dispatchers:c}),React.createElement(Xe,{value:r,min:n,max:a,disabled:o,onChange:c.setQuantity}),React.createElement(Ge,null))},vt=function(){return React.createElement(Ge,null)},ht=function(){return React.createElement(rt.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},gt=function(){return React.createElement(ht,null)},Ot=function(){var e=xe(),t=e.showFormElements,r=e.productType;return t?"variable"===r?React.createElement(mt,null):"grouped"===r?React.createElement(gt,null):"external"===r?React.createElement(vt,null):"simple"===r||"variation"===r?React.createElement(Ze,null):null:React.createElement(Ge,null)},yt=Object(Me.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,n=Object(Be.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(Le.isEmpty)(n)});return React.createElement(We,{product:n,showFormElements:r},React.createElement("div",{className:a},React.createElement(Ot,null)))})),jt={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}};t.default=Object(n.compose)(Object(a.a)(jt))(yt)},37:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),a=r(36),c=r.n(a),o=function(e){var t=Object(n.useRef)();return c()(e,t.current)||(t.current=e),t.current}},49:function(e,t){function r(e,t,r,n,a,c,o){try{var s=e[c](o),i=s.value}catch(e){return void r(e)}s.done?t(i):Promise.resolve(i).then(n,a)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(a,c){var o=e.apply(t,n);function s(e){r(o,a,c,s,i,"next",e)}function i(e){r(o,a,c,s,i,"throw",e)}s(void 0)}))}}},50:function(e,t,r){var n=r(90),a=r(91),c=r(53),o=r(92);e.exports=function(e){return n(e)||a(e)||c(e)||o()}},57:function(e,t,r){"use strict";r.d(t,"b",(function(){return b})),r.d(t,"a",(function(){return m}));var n=r(6),a=r.n(n),c=r(10),o=r.n(c),s=r(0),i=r(7),u=r(36),l=r.n(u);function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p=Object(s.createContext)({getValidationError:function(){return""},setValidationErrors:function(e){},clearValidationError:function(e){},clearAllValidationErrors:function(){},hideValidationError:function(){},showValidationError:function(){},showAllValidationErrors:function(){},hasValidationErrors:!1,getValidationErrorId:function(e){return e}}),b=function(){return Object(s.useContext)(p)},m=function(e){var t=e.children,r=Object(s.useState)({}),n=o()(r,2),c=n[0],u=n[1],d=Object(s.useCallback)((function(e){return c[e]}),[c]),b=Object(s.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),m=Object(s.useCallback)((function(e){u((function(t){return t[e]?Object(i.omit)(t,[e]):t}))}),[]),v=Object(s.useCallback)((function(){u({})}),[]),h=Object(s.useCallback)((function(e){e&&u((function(t){return e=Object(i.pickBy)(e,(function(e,r){return"string"==typeof e.message&&(!t.hasOwnProperty(r)||!l()(t[r],e))})),0===Object.values(e).length?t:f(f({},t),e)}))}),[]),g=Object(s.useCallback)((function(e,t){u((function(r){if(!r.hasOwnProperty(e))return r;var n=f(f({},r[e]),t);return l()(r[e],n)?r:f(f({},r),{},a()({},e,n))}))}),[]),O={getValidationError:d,setValidationErrors:h,clearValidationError:m,clearAllValidationErrors:v,hideValidationError:Object(s.useCallback)((function(e){g(e,{hidden:!0})}),[g]),showValidationError:Object(s.useCallback)((function(e){g(e,{hidden:!1})}),[g]),showAllValidationErrors:Object(s.useCallback)((function(){u((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=f(f({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:f(f({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:b};return React.createElement(p.Provider,{value:O},t)}},72:function(e,t,r){"use strict";var n=r(11),a=r.n(n),c=r(15),o=r.n(c),s=r(74),i=(r(4),r(5)),u=r.n(i);r(142);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,c=e.children,i=o()(e,["className","showSpinner","children"]),l=u()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return React.createElement(s.a,a()({className:l},i),n&&React.createElement("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),React.createElement("span",{className:"wc-block-components-button__text"},c))}},80:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(14),a=r(13),c=r(132),o=r(16),s=r(7),i={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(c.a)(),r=t.isEditor,u=t.previewData,l=(null==u?void 0:u.previewCart)||{},d=e.shouldSelect,f=Object(a.useSelect)((function(e,t){var a=t.dispatch;if(!d)return i;if(r)return{cartCoupons:l.coupons,cartItems:l.items,cartItemsCount:l.items_count,cartItemsWeight:l.items_weight,cartNeedsPayment:l.needs_payment,cartNeedsShipping:l.needs_shipping,cartItemErrors:[],cartTotals:l.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:l.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==l?void 0:l.receiveCart)?l.receiveCart:function(){}};var c=e(n.CART_STORE_KEY),u=c.getCartData(),f=c.getCartErrors(),p=c.getCartTotals(),b=!c.hasFinishedResolution("getCartData"),m=c.areShippingRatesLoading(),v=a(n.CART_STORE_KEY).receiveCart,h=Object(s.mapValues)(u.shippingAddress,(function(e){return Object(o.decodeEntities)(e)}));return{cartCoupons:u.coupons,cartItems:u.items||[],cartItemsCount:u.itemsCount,cartItemsWeight:u.itemsWeight,cartNeedsPayment:u.needsPayment,cartNeedsShipping:u.needsShipping,cartItemErrors:u.errors||[],cartTotals:p,cartIsLoading:b,cartErrors:f,shippingAddress:h,shippingRates:u.shippingRates||[],shippingRatesLoading:m,hasShippingAddress:!!h.country,receiveCart:v}}),[d]);return f}},90:function(e,t,r){var n=r(54);e.exports=function(e){if(Array.isArray(e))return n(e)}},91:function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},92:function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}}}]);
|
build/atomic-block-components/add-to-cart.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[7],{229:function(t,e){},371:function(t,e){},376:function(t,e,n){"use strict";e.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},377:function(t,e,n){"use strict";var c=n(0),a=(n(2),n(8)),r=n.n(a),o=n(11),u=n.n(o),i=n(822),l=n(511),s=Object(c.createContext)({product:{},productId:0,variationId:0,variationData:{},cartItemData:{},quantity:1,minQuantity:1,maxQuantity:99,quantityInCart:0,setQuantity:function(t){},setVariationId:function(t){},setVariationData:function(t){},setCartItemData:function(t){},showFormElements:!1,formInitialized:!1,formDisabled:!0,formSubmitting:!1,onChange:function(){},onSubmit:function(){},onSuccess:function(){},onFail:function(){}}),b=function(){return Object(c.useContext)(s)},d=function(t){var e=t.children,n=t.product,a=t.showFormElements,r=n||{},o=r.id||0,b=Object(c.useState)(0),d=u()(b,2),f=d[0],p=d[1],O=Object(c.useState)({}),j=u()(O,2),v=j[0],h=j[1],E=Object(c.useState)({}),g=u()(E,2),y=g[0],w=g[1],k=Object(c.useState)(1),_=u()(k,2),C=_[0],S=_[1],N=Object(i.a)(o),D=N.addToCart,x=N.addingToCart,I=N.cartQuantity,P=N.cartIsLoading;!function(t){var e=Object(c.useRef)(!0);Object(c.useEffect)((function(){e.current?e.current=!1:Object(l.b)()}),[t])}(I);var Q=!P&&o>0,F=x||!Q||!m(r),q=Object(c.useCallback)((function(){D(C)}),[D,C]),A=Object(c.useCallback)((function(){}),[]),T=Object(c.useCallback)((function(){}),[]),B=Object(c.useCallback)((function(){}),[]),V={product:r,productId:o,variationId:f,variationData:v,cartItemData:y,quantity:C,minQuantity:1,maxQuantity:r.quantity_limit||99,quantityInCart:I,setQuantity:S,setVariationId:p,setVariationData:h,setCartItemData:w,showFormElements:a,formInitialized:Q,formDisabled:F,formSubmitting:x,onChange:A,onSubmit:q,onSuccess:T,onFail:B};return Object(c.createElement)(s.Provider,{value:V},e)},m=function(t){var e=t.is_purchasable;return void 0!==e&&e},f=n(42),p=n(6),O=n(71),j=(n(371),n(1)),v=n(97),h=n(59),E=n(539),g=function(t){var e=t.className,n=t.href,a=t.text;return Object(c.createElement)(v.a,{className:e,href:n,rel:"nofollow"},a)},y=function(t){var e=t.className,n=t.quantityInCart,a=t.loading,r=t.disabled,o=t.onClick,i=Object(c.useState)(!1),l=u()(i,2),s=l[0],b=l[1];return Object(c.createElement)(v.a,{className:e,disabled:r,showSpinner:a,onClick:function(){o(),b(!0)}},n>0?Object(j.sprintf)(Object(j._n)("%d in cart","%d in cart",n,"woo-gutenberg-products-block"),n):Object(j.__)("Add to cart","woo-gutenberg-products-block"),s&&Object(c.createElement)(h.a,{srcElement:E.a,alt:Object(j.__)("Done","woo-gutenberg-products-block")}))},w=function(){var t=b(),e=t.showFormElements,n=t.product,a=t.quantityInCart,r=t.formDisabled,o=t.formSubmitting,u=t.onSubmit,i=n.is_purchasable,l=void 0===i||i,s=n.has_options,d=n.add_to_cart,m=void 0===d?{url:"",text:""}:d;return!e&&s||!l?Object(c.createElement)(g,{className:"wc-block-components-product-add-to-cart-button",href:m.url,text:m.text||Object(j.__)("View Product","woo-gutenberg-products-block")}):Object(c.createElement)(y,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:a,disabled:r,loading:o,onClick:u})},k=function(t){var e=t.disabled,n=t.min,a=t.max,r=t.value,o=t.onChange;return Object(c.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:r,min:n,max:a,hidden:1===a,disabled:e,onChange:function(t){o(t.target.value)}})},_=function(t){var e=t.reason,n=void 0===e?Object(j.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):e;return Object(c.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},n)},C=function(){var t=b(),e=t.product,n=t.quantity,a=t.minQuantity,r=t.maxQuantity,o=t.setQuantity,u=t.formDisabled;return e.id&&!e.is_purchasable?Object(c.createElement)(_,null):e.id&&!e.is_in_stock?Object(c.createElement)(_,{reason:Object(j.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(k,{value:n,min:a,max:r,disabled:u,onChange:o}),Object(c.createElement)(w,null))},S=(n(538),n(7)),N=n.n(S),D=n(61),x=n.n(D),I=n(33),P=n(4),Q={value:"",label:Object(j.__)("Select an option","woo-gutenberg-products-block")},F=function(t){var e=t.attributeName,n=t.options,a=void 0===n?[]:n,r=t.selected,o=void 0===r?"":r,u=t.onChange,i=void 0===u?function(){}:u;return Object(c.createElement)(P.SelectControl,{className:"wc-block-components-product-add-to-cart-attribute-picker__select",label:Object(I.decodeEntities)(e),value:o||"",options:[Q].concat(x()(a)),onChange:i})},q=function(t){var e=t.selectedAttributes,n=t.variationAttributes,c=t.attributeNames;return Object.keys(n).filter((function(t){return c.every((function(c){var a=e[c]||"",r=n[t][c];return""===a||(null===r||r===a)}))}))};function A(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(t);e&&(c=c.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,c)}return n}function T(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?A(Object(n),!0).forEach((function(e){N()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var B=function(t){var e=t.attributes,n=t.variationAttributes,a=Object(c.useState)(0),r=u()(a,2),o=r[0],i=r[1],l=Object(c.useState)([]),s=u()(l,2),b=s[0],d=s[1],m=Object.keys(e),f=Object.values(b).filter(Boolean).length>0,p=Object.values(b).filter((function(t){return""!==t})).length===m.length,O=Object(c.useMemo)((function(){var t=[];return m.forEach((function(c){var a=e[c],r=m.filter((function(t){return t!==c})),o=f?q({selectedAttributes:b,variationAttributes:n,attributeNames:r}):null,u=null!==o?o.map((function(t){return n[t][c]})):null;t[c]=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(t).map((function(t){var n=t.name,c=t.slug;return null===e||e.includes(null)||e.includes(c)?{value:c,label:n}:null})).filter(Boolean)}(a.terms,u)})),t}),[e,n,m,b,f]);return Object(c.useEffect)((function(){if(p){var t=q({selectedAttributes:b,variationAttributes:n,attributeNames:m});i(t[0]||0)}else i(0)}),[b,n,m,p]),Object(c.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},m.map((function(t){return Object(c.createElement)(F,{key:t,attributeName:t,options:O[t],selected:b[t],onChange:function(e){d(T(T({},b),{},N()({},t,e)))}})})),Object(c.createElement)("p",null,"Matched variation ID: ",o))},V=function(t){var e=t.product,n=e.attributes,a=void 0===n?{}:n,r=e.variations,o=void 0===r?[]:r,u=function(t){return t?Object(p.keyBy)(Object.values(t).filter((function(t){return t.has_variations})),"name"):[]}(a),i=function(t){if(!t)return{};var e={};return t.forEach((function(t){var n=t.id,c=t.attributes;e[n]=c.reduce((function(t,e){var n=e.name,c=e.value;return t[n]=c,t}),[])})),e}(o);return 0===Object.keys(u).length||0===i.length?null:Object(c.createElement)(B,{attributes:u,variationAttributes:i})},z=function(){var t=b(),e=t.product,n=t.quantity,a=t.minQuantity,r=t.maxQuantity,o=t.setQuantity,u=t.formDisabled;return e.id&&!e.is_purchasable?Object(c.createElement)(_,null):e.id&&!e.is_in_stock?Object(c.createElement)(_,{reason:Object(j.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(V,{product:e}),Object(c.createElement)(k,{value:n,min:a,max:r,disabled:u,onChange:o}),Object(c.createElement)(w,null))},L=function(){return Object(c.createElement)(w,null)},M=function(){return Object(c.createElement)(P.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},J=function(){return Object(c.createElement)(M,null)},W=function(t){var e=t.productType;return"variable"===e?Object(c.createElement)(z,null):"grouped"===e?Object(c.createElement)(J,null):"external"===e?Object(c.createElement)(L,null):"simple"===e||"variation"===e?Object(c.createElement)(C,null):null};e.a=Object(O.withProductDataContext)((function(t){var e=t.className,n=t.showFormElements,a=Object(f.useProductDataContext)().product,o=r()(e,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(p.isEmpty)(a)});return Object(c.createElement)(d,{product:a,showFormElements:n},Object(c.createElement)("div",{className:o},Object(c.createElement)(c.Fragment,null,n?Object(c.createElement)(W,{productType:a.type}):Object(c.createElement)(w,null))))}))},538:function(t,e){},539:function(t,e,n){"use strict";var c=n(0),a=n(58),r=Object(c.createElement)(a.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(c.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));e.a=r},934:function(t,e,n){"use strict";n.r(e);var c=n(25),a=n(931),r=n(377),o=n(376);e.default=Object(c.compose)(Object(a.a)(o.a))(r.a)},97:function(t,e,n){"use strict";var c=n(10),a=n.n(c),r=n(27),o=n.n(r),u=n(0),i=n(271),l=(n(2),n(8)),s=n.n(l);n(229);e.a=function(t){var e=t.className,n=t.showSpinner,c=void 0!==n&&n,r=t.children,l=o()(t,["className","showSpinner","children"]),b=s()("wc-block-components-button",e,{"wc-block-components-button--loading":c});return Object(u.createElement)(i.a,a()({className:b},l),c&&Object(u.createElement)("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),Object(u.createElement)("span",{className:"wc-block-components-button__text"},r))}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[7],{152:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return b}));var n=r(7),c=r.n(n),o=r(6);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var i="add_event_callback",u="remove_event_callback",l={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(o.uniqueId)(),type:i,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:u,eventType:e}}},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0,r=t.type,n=t.eventType,o=t.id,a=t.callback,l=t.priority,b=new Map(e[n]);switch(r){case i:return b.set(o,{priority:l,callback:a}),s(s({},e),{},c()({},n,b));case u:return b.delete(o),s(s({},e),{},c()({},n,b))}return e}},226:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=r(84),o=(r(2),r(232),function(e){var t=e.errorMessage,r=void 0===t?"":t,o=e.propertyName,a=void 0===o?"":o,s=e.elementId,i=void 0===s?"":s,u=Object(c.b)(),l=u.getValidationError,b=u.getValidationErrorId;if(!r){var f=l(a)||{};if(!f.message||f.hidden)return null;r=f.message}return Object(n.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(n.createElement)("p",{id:b(i)},r))})},231:function(e,t){},232:function(e,t){},372:function(e,t){},377:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=function(e,t){return!!e.type&&e.type===t},c={SUCCESS:"success",FAIL:"failure",ERROR:"error"},o={PAYMENTS:"wc/payment-area",EXPRESS_PAYMENTS:"wc/express-payment-area"},a=function(e){return n(e,c.SUCCESS)},s=function(e){return n(e,c.ERROR)},i=function(e){return n(e,c.FAIL)},u=function(){return{responseTypes:c,noticeContexts:o,isSuccessResponse:a,isErrorResponse:s,isFailResponse:i}}},378:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(152),c=function(e,t){return function(r){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=n.a.addEventCallback(e,r,c);return t(o),function(){t(n.a.removeEventCallback(e,o.id))}}}},379:function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return d}));var n=r(15),c=r.n(n),o=r(52),a=r.n(o),s=r(37),i=r.n(s);function u(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,c=function(){};return{s:c,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:c}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var b=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},f=function(){var e=i()(c.a.mark((function e(t,r,n){var o,s,i,l,f,d;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=b(t,r),s=[],i=u(o),e.prev=3,i.s();case 5:if((l=i.n()).done){e.next=19;break}return f=l.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:d=e.sent,"object"===a()(d)&&s.push(d),e.next=17;break;case 14:e.prev=14,e.t0=e.catch(7),console.error(e.t0);case 17:e.next=5;break;case 19:e.next=24;break;case 21:e.prev=21,e.t1=e.catch(3),i.e(e.t1);case 24:return e.prev=24,i.f(),e.finish(24);case 27:return e.abrupt("return",!s.length||s);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(t,r,n){return e.apply(this,arguments)}}(),d=function(){var e=i()(c.a.mark((function e(t,r,n){var o,s,i,l,f,d;return c.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=b(t,r),s=!0,i=u(o),e.prev=3,i.s();case 5:if((l=i.n()).done){e.next=24;break}return f=l.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:if(d=e.sent,"object"!==a()(d)||void 0!==d.type){e.next=13;break}throw new Error("If you want to abort event emitter processing, your observer must return an object with a type property");case 13:if(!0===(s="object"!==a()(d)||d)){e.next=16;break}return e.abrupt("return",s);case 16:e.next=22;break;case 18:return e.prev=18,e.t0=e.catch(7),console.error(e.t0),e.abrupt("return",{type:"error"});case 22:e.next=5;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(3),i.e(e.t1);case 29:return e.prev=29,i.f(),e.finish(29);case 32:return e.abrupt("return",s);case 33:case"end":return e.stop()}}),e,null,[[3,26,29,32],[7,18]])})));return function(t,r,n){return e.apply(this,arguments)}}()},380:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},381:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(8)),o=r.n(c),a=r(84),s=r(11),i=r.n(s),u=r(1),l=r(61),b=r(143),f=r(377),d=r(917),p="pristine",O="idle",m="disabled",j="processing",v="before_processing",h="after_processing",y={status:p,hasError:!1,quantity:1,processingResponse:null,requestParams:{}},g="set_pristine",E="set_idle",w="set_disabled",P="set_processing",k="set_before_processing",_="set_after_processing",C="set_processing_response",A="set_has_error",S="set_no_error",x="set_quantity",D="set_request_params",q=g,N=E,R=w,T=P,V=k,F=_,I=C,B=A,Q=S,M=x,W=D,H=function(){return{type:q}},L=function(){return{type:N}},U=function(){return{type:R}},z=function(){return{type:T}},J=function(){return{type:V}},Y=function(){return{type:F}},G=function(e){return{type:I,data:e}},X=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?B:Q;return{type:t}},$=function(e){return{type:M,quantity:e}},K=function(e){return{type:W,data:e}},Z=r(7),ee=r.n(Z);function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function re(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ne=g,ce=E,oe=w,ae=P,se=k,ie=_,ue=C,le=A,be=S,fe=x,de=D,pe=p,Oe=O,me=m,je=j,ve=v,he=h,ye=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case ne:e=y;break;case ce:e=t.status!==Oe?re(re({},t),{},{status:Oe}):t;break;case oe:e=t.status!==me?re(re({},t),{},{status:me}):t;break;case fe:e=n!==t.quantity?re(re({},t),{},{quantity:n}):t;break;case de:e=re(re({},t),{},{requestParams:re(re({},t.requestParams),o)});break;case ue:e=re(re({},t),{},{processingResponse:o});break;case ae:e=!1===(e=t.status!==je?re(re({},t),{},{status:je,hasError:!1}):t).hasError?e:re(re({},e),{},{hasError:!1});break;case se:e=t.status!==ve?re(re({},t),{},{status:ve,hasError:!1}):t;break;case ie:e=t.status!==he?re(re({},t),{},{status:he}):t;break;case le:e=t.hasError?t:re(re({},t),{},{hasError:!0}),e=t.status===je||t.status===ve?re(re({},e),{},{status:Oe}):e;break;case be:e=t.hasError?re(re({},t),{},{hasError:!1}):t}return e!==t&&c!==ne&&e.status===pe&&(e.status=Oe),e},ge=r(152),Ee=r(378),we="add_to_cart_before_processing",Pe="add_to_cart_after_processing_with_success",ke="add_to_cart_after_processing_with_error",_e=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(Ee.a)(Pe,e),onAddToCartProcessingWithError:Object(Ee.a)(ke,e),onAddToCartBeforeProcessing:Object(Ee.a)(we,e)}},Ce=r(379),Ae=Object(n.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:function(e){},onAddToCartAfterProcessingWithError:function(e){},onAddToCartBeforeProcessing:function(e){}},dispatchActions:{resetForm:function(){},submitForm:function(){},setQuantity:function(e){},setHasError:function(e){},setAfterProcessing:function(e){},setRequestParams:function(e){}}}),Se=function(){return Object(n.useContext)(Ae)},xe=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=Object(n.useReducer)(ye,y),s=i()(o,2),p=s[0],g=s[1],E=Object(n.useReducer)(ge.b,{}),w=i()(E,2),P=w[0],k=w[1],_=Object(l.a)(P),C=Object(b.a)(),A=C.addErrorNotice,S=C.removeNotices,x=Object(a.b)().setValidationErrors,D=Object(f.a)(),q=D.isSuccessResponse,N=D.isErrorResponse,R=D.isFailResponse,T=Object(n.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:_e(k).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:_e(k).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:_e(k).onAddToCartBeforeProcessing}}),[k]),V=Object(n.useMemo)((function(){return{resetForm:function(){g(H())},submitForm:function(){g(J())},setQuantity:function(e){g($(e))},setHasError:function(e){g(X(e))},setRequestParams:function(e){g(K(e))},setAfterProcessing:function(e){g(G(e)),g(Y())}}}),[]);Object(n.useEffect)((function(){var e=p.status,t=!r.id||!Object(d.a)(r);e!==m||t?e!==m&&t&&g(U()):g(L())}),[p.status,r,g]),Object(n.useEffect)((function(){p.status===v&&(S("error"),Object(Ce.a)(_,we,{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&A(t),r&&x(r)})),g(L())):g(z())})))}),[p.status,x,A,S,g,_]),Object(n.useEffect)((function(){if(p.status===h){var e={processingResponse:p.processingResponse},t=function(e){if(e.message){var t=e.messageContext?{context:e.messageContext}:void 0;A(e.message,t)}};if(p.hasError)return void Object(Ce.b)(_,ke,e).then((function(r){if(N(r)||R(r))t(r);else{var n,c=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(u.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");A(c,{id:"add-to-cart"})}g(L())}));Object(Ce.b)(_,Pe,e).then((function(e){N(e)||R(e)?(t(e),g(X(!0))):g(L())}))}}),[p.status,p.hasError,p.processingResponse,V,A,N,R,q,_]);var F=Object(d.b)(r),I={product:r,productType:r.type||"simple",productIsPurchasable:Object(d.a)(r),productHasOptions:r.has_options||!1,supportsFormElements:F,showFormElements:c&&F,quantity:p.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:p.requestParams,isIdle:p.status===O,isDisabled:p.status===m,isProcessing:p.status===j,isBeforeProcessing:p.status===v,isAfterProcessing:p.status===h,hasError:p.hasError,eventRegistration:T,dispatchActions:V};return Object(n.createElement)(Ae.Provider,{value:I},t)},De=r(13),qe=r.n(De),Ne=r(133),Re=r(33),Te=r(515);function Ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var Fe=function(){var e=Se(),t=e.dispatchActions,r=e.product,c=e.quantity,o=e.eventRegistration,s=e.hasError,l=e.isProcessing,f=e.requestParams,d=Object(a.b)(),p=d.hasValidationErrors,O=d.showAllValidationErrors,m=Object(b.a)(),j=m.addErrorNotice,v=m.removeNotice,h=Object(Ne.a)().receiveCart,y=Object(n.useState)(!1),g=i()(y,2),E=g[0],w=g[1],P=!s&&l,k=Object(n.useCallback)((function(){return!p||(O(),{type:"error"})}),[p,O]);Object(n.useEffect)((function(){var e=o.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[o,k]);var _=Object(n.useCallback)((function(){w(!0),v("add-to-cart");var e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ve(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:r.id||0,quantity:c},f);qe()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){qe.a.setNonce(e.headers),e.json().then((function(r){e.ok?h(r):(r.body&&r.body.message?j(Object(Re.decodeEntities)(r.body.message),{id:"add-to-cart"}):j(Object(u.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),w(!1),Object(Te.c)()}))})).catch((function(e){e.json().then((function(e){var r;(null===(r=e.data)||void 0===r?void 0:r.cart)&&h(e.data.cart),t.setHasError(),t.setAfterProcessing(e),w(!1)}))}))}),[r,j,v,h,t,c,f]);return Object(n.useEffect)((function(){P&&!E&&_()}),[P,_,E]),null},Ie=function(e){var t=e.children,r=e.product,c=e.showFormElements;return Object(n.createElement)(a.a,null,Object(n.createElement)(xe,{product:r,showFormElements:c},t,Object(n.createElement)(Fe,null)))},Be=r(42),Qe=r(6),Me=r(72),We=(r(372),r(98)),He=r(60),Le=r(543),Ue=r(826),ze=function(e){var t=e.className,r=e.href,c=e.text;return Object(n.createElement)(We.a,{className:t,href:r,rel:"nofollow"},c)},Je=function(e){var t=e.className,r=e.quantityInCart,c=e.isProcessing,o=e.isDisabled,a=e.isDone,s=e.onClick;return Object(n.createElement)(We.a,{className:t,disabled:o,showSpinner:c,onClick:s},a&&r>0?Object(u.sprintf)(Object(u._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(u.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(He.a,{srcElement:Le.a,alt:Object(u.__)("Done","woo-gutenberg-products-block")}))},Ye=function(){var e=Se(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,s=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,f=e.hasError,d=e.dispatchActions,p=Object(Ue.a)(o.id||0).cartQuantity,O=Object(n.useState)(!1),m=i()(O,2),j=m[0],v=m[1],h=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return f||v(!0),!0}),0);return function(){e()}}),[b,f]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(Je,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:p,isDisabled:s,isProcessing:l,isDone:j,onClick:function(){return d.submitForm()}}):Object(n.createElement)(ze,{className:"wc-block-components-product-add-to-cart-button",href:h.url,text:h.text||Object(u.__)("View Product","woo-gutenberg-products-block")})},Ge=function(e){var t=e.disabled,r=e.min,c=e.max,o=e.value,a=e.onChange;return Object(n.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:o,min:r,max:c,hidden:1===c,disabled:t,onChange:function(e){a(e.target.value)}})},Xe=function(e){var t=e.reason,r=void 0===t?Object(u.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block"):t;return Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},r)},$e=function(){var e=Se(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.dispatchActions,s=e.isDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)(Xe,null):t.id&&!t.is_in_stock?Object(n.createElement)(Xe,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Ge,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(Ye,null))},Ke=(r(542),r(56)),Ze=r.n(Ke),et=r(4),tt=r(9),rt=r(226),nt={value:"",label:Object(u.__)("Select an option","woo-gutenberg-products-block")},ct=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,s=e.value,i=void 0===s?"":s,l=e.onChange,b=void 0===l?function(){}:l,f=e.errorMessage,d=void 0===f?Object(u.__)("Please select a value.","woo-gutenberg-products-block"):f,p=Object(a.b)(),O=p.getValidationError,m=p.setValidationErrors,j=p.clearValidationError,v=t,h=O(v)||{};return Object(tt.useEffect)((function(){i?j(v):m(ee()({},v,{message:d,hidden:!0}))}),[i,v,d,j,m]),Object(tt.useEffect)((function(){return function(){j(v)}}),[v,j]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(n.createElement)(et.SelectControl,{label:Object(Re.decodeEntities)(t),value:i||"",options:[nt].concat(Ze()(c)),onChange:b,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(rt.a,{propertyName:v,elementId:v}))};function ot(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function at(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ot(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ot(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var st=function(e,t,r){var n=Object.values(t).map((function(e){return e.id}));if(Object.values(r).every((function(e){return""===e})))return n;var c=Object.keys(e);return n.filter((function(e){return c.every((function(n){var c=r[n]||"",o=t["id:"+e].attributes[n];return""===c||(null===o||o===c)}))}))},it=function(e,t,r){var n={},c=Object.keys(e),o=Object.values(r).filter(Boolean).length>0;return c.forEach((function(c){var a=e[c],s=at(at({},r),{},ee()({},c,null)),i=o?st(e,t,s):null,u=null!==i?i.map((function(e){return t["id:"+e].attributes[c]})):null;n[c]=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map((function(e){var r=e.name,n=e.slug;return null===t||t.includes(null)||t.includes(n)?{value:n,label:Object(Re.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n};function ut(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function lt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ut(Object(r),!0).forEach((function(t){ee()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var bt=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(l.a)(t),a=Object(l.a)(r),s=Object(n.useState)(0),u=i()(s,2),b=u[0],f=u[1],d=Object(n.useState)({}),p=i()(d,2),O=p[0],m=p[1],j=Object(n.useMemo)((function(){return it(o,a,O)}),[O,o,a]);return Object(n.useEffect)((function(){Object.values(O).filter((function(e){return""!==e})).length===Object.keys(o).length?f(function(e,t,r){return st(e,t,r)[0]||0}(o,a,O)):b>0&&f(0)}),[O,b,o,a]),Object(n.useEffect)((function(){c({id:b,variation:Object.keys(O).map((function(e){return{attribute:e,value:O[e]}}))})}),[c,b,O]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(o).map((function(e){return Object(n.createElement)(ct,{key:e,attributeName:e,options:j[e],value:O[e],onChange:function(t){m(lt(lt({},O),{},ee()({},e,t)))}})})))},ft=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(Qe.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):{}}(t.attributes),o=function(e){if(!e)return{};var t={};return e.forEach((function(e){var r=e.id,n=e.attributes;t["id:".concat(r)]={id:r,attributes:n.reduce((function(e,t){var r=t.name,n=t.value;return e[r]=n,e}),{})}})),t}(t.variations);return 0===Object.keys(c).length||0===o.length?null:Object(n.createElement)(bt,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},dt=function(){var e=Se(),t=e.product,r=e.quantity,c=e.minQuantity,o=e.maxQuantity,a=e.dispatchActions,s=e.isDisabled;return t.id&&!t.is_purchasable?Object(n.createElement)(Xe,null):t.id&&!t.is_in_stock?Object(n.createElement)(Xe,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(ft,{product:t,dispatchers:a}),Object(n.createElement)(Ge,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(Ye,null))},pt=function(){return Object(n.createElement)(Ye,null)},Ot=function(){return Object(n.createElement)(et.Placeholder,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},mt=function(){return Object(n.createElement)(Ot,null)},jt=function(){var e=Se(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(dt,null):"grouped"===r?Object(n.createElement)(mt,null):"external"===r?Object(n.createElement)(pt,null):"simple"===r||"variation"===r?Object(n.createElement)($e,null):null:Object(n.createElement)(Ye,null)};t.a=Object(Me.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(Be.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(Qe.isEmpty)(c)});return Object(n.createElement)(Ie,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(jt,null)))}))},542:function(e,t){},543:function(e,t,r){"use strict";var n=r(0),c=r(59),o=Object(n.createElement)(c.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(n.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}));t.a=o},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(45),o=r.n(c),a=function(e){var t=Object(n.useRef)();return o()(e,t.current)||(t.current=e),t.current}},84:function(e,t,r){"use strict";r.d(t,"b",(function(){return p})),r.d(t,"a",(function(){return O}));var n=r(7),c=r.n(n),o=r(11),a=r.n(o),s=r(0),i=r(6),u=r(45),l=r.n(u);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d=Object(s.createContext)({getValidationError:function(){return""},setValidationErrors:function(e){},clearValidationError:function(e){},clearAllValidationErrors:function(){},hideValidationError:function(){},showValidationError:function(){},showAllValidationErrors:function(){},hasValidationErrors:!1,getValidationErrorId:function(e){return e}}),p=function(){return Object(s.useContext)(d)},O=function(e){var t=e.children,r=Object(s.useState)({}),n=a()(r,2),o=n[0],u=n[1],b=Object(s.useCallback)((function(e){return o[e]}),[o]),p=Object(s.useCallback)((function(e){var t=o[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[o]),O=Object(s.useCallback)((function(e){u((function(t){return t[e]?Object(i.omit)(t,[e]):t}))}),[]),m=Object(s.useCallback)((function(){u({})}),[]),j=Object(s.useCallback)((function(e){e&&u((function(t){return e=Object(i.pickBy)(e,(function(e,r){return"string"==typeof e.message&&(!t.hasOwnProperty(r)||!l()(t[r],e))})),0===Object.values(e).length?t:f(f({},t),e)}))}),[]),v=Object(s.useCallback)((function(e,t){u((function(r){if(!r.hasOwnProperty(e))return r;var n=f(f({},r[e]),t);return l()(r[e],n)?r:f(f({},r),{},c()({},e,n))}))}),[]),h={getValidationError:b,setValidationErrors:j,clearValidationError:O,clearAllValidationErrors:m,hideValidationError:Object(s.useCallback)((function(e){v(e,{hidden:!0})}),[v]),showValidationError:Object(s.useCallback)((function(e){v(e,{hidden:!1})}),[v]),showAllValidationErrors:Object(s.useCallback)((function(){u((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=f(f({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:f(f({},e),t)}))}),[]),hasValidationErrors:Object.keys(o).length>0,getValidationErrorId:p};return Object(s.createElement)(d.Provider,{value:h},t)}},917:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var n=function(e){return e.is_purchasable||!1},c=function(e){return["simple","variable"].includes(e.type||"simple")}},938:function(e,t,r){"use strict";r.r(t);var n=r(25),c=r(935),o=r(381),a=r(380);t.default=Object(n.compose)(Object(c.a)(a.a))(o.a)},98:function(e,t,r){"use strict";var n=r(10),c=r.n(n),o=r(27),a=r.n(o),s=r(0),i=r(273),u=(r(2),r(8)),l=r.n(u);r(231);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,["className","showSpinner","children"]),b=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(s.createElement)(i.a,c()({className:b},u),n&&Object(s.createElement)("span",{className:"wc-block-components-button__spinner","aria-hidden":"true"}),Object(s.createElement)("span",{className:"wc-block-components-button__text"},o))}}}]);
|
build/atomic-block-components/add-to-cart~atomic-block-components/button.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{133:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(40),c=n(36),o=n(260),i=n(33),a=n(6),s={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(o.b)(),n=t.isEditor,u=t.previewData,d=(null==u?void 0:u.previewCart)||{},l=e.shouldSelect,f=Object(c.useSelect)((function(e,t){var c=t.dispatch;if(!l)return s;if(n)return{cartCoupons:d.coupons,cartItems:d.items,cartItemsCount:d.items_count,cartItemsWeight:d.items_weight,cartNeedsPayment:d.needs_payment,cartNeedsShipping:d.needs_shipping,cartItemErrors:[],cartTotals:d.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:d.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==d?void 0:d.receiveCart)?d.receiveCart:function(){}};var o=e(r.CART_STORE_KEY),u=o.getCartData(),f=o.getCartErrors(),p=o.getCartTotals(),v=!o.hasFinishedResolution("getCartData"),m=o.areShippingRatesLoading(),b=c(r.CART_STORE_KEY).receiveCart,g=Object(a.mapValues)(u.shippingAddress,(function(e){return Object(i.decodeEntities)(e)}));return{cartCoupons:u.coupons,cartItems:u.items||[],cartItemsCount:u.itemsCount,cartItemsWeight:u.itemsWeight,cartNeedsPayment:u.needsPayment,cartNeedsShipping:u.needsShipping,cartItemErrors:u.errors||[],cartTotals:p,cartIsLoading:v,cartErrors:f,shippingAddress:g,shippingRates:u.shippingRates||[],shippingRatesLoading:m,hasShippingAddress:!!g.country,receiveCart:b}}),[l]);return f}},143:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(7),c=n.n(r),o=n(267),i=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=function(){var e=Object(o.b)(),t=e.notices,n=e.createNotice,r=e.removeNotice,c=e.createSnackbarNotice,a=e.setIsSuppressed,u=Object(i.useRef)(t);Object(i.useEffect)((function(){u.current=t}),[t]);var d=Object(i.useMemo)((function(){return{hasNoticesOfType:function(e){return u.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;u.current.map((function(t){return null!==e&&t.status!==e||r(t.id),!0}))},removeNotice:r}}),[r]),l=Object(i.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",e,s({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",e,s({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",e,s({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",e,s({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",e,s({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(e,t)}}}),[n,c]);return s(s(s({notices:t},d),l),{},{setIsSuppressed:a})}},228:function(e,t){},259:function(e,t,n){"use strict";var r=n(10),c=n.n(r),o=n(27),i=n.n(o),a=n(0),s=n(58),u=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=void 0===n?20:n,o=i()(e,["className","size"]);return Object(a.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},o),Object(a.createElement)("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))}),null),d=n(274);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=u;break;case"no-alt":t=d.a}return t?Object(a.cloneElement)(t,{size:e.size||20,className:e.className}):null}},260:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a}));var r=n(0),c=n(36),o=Object(r.createContext)({isEditor:!1,currentPostId:0,previewData:{}}),i=function(){return Object(r.useContext)(o)},a=function(e){var t=e.children,n=e.currentPostId,i=void 0===n?0:n,a=e.previewData,s=void 0===a?{}:a,u={isEditor:!0,currentPostId:Object(c.useSelect)((function(e){return i||e("core/editor").getCurrentPostId()}),[i]),previewData:s};return Object(r.createElement)(o.Provider,{value:u},t)}},267:function(e,t,n){"use strict";n.d(t,"b",(function(){return E})),n.d(t,"a",(function(){return N}));var r=n(7),c=n.n(r),o=n(11),i=n.n(o),a=n(0),s=(n(2),n(36)),u=n(10),d=n.n(u),l=n(8),f=n.n(l),p=n(925),v=(n(228),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),m=function(e){var t=e.className,n=e.notices,r=E().removeNotice,c=f()(t,"wc-block-components-notices"),o=n.filter((function(e){return"snackbar"!==e.type}));return o.length?Object(a.createElement)("div",{className:c},o.map((function(e){return Object(a.createElement)(p.a,d()({key:"store-notice-"+e.id},e,{className:f()("wc-block-components-notices__notice","woocommerce-message",v(e)),onRemove:function(){e.isDismissible&&r(e.id)}}),e.content)}))):null},b=n(929),g=n(143),h=n(260),O=function(){var e=Object(h.b)().isEditor,t=Object(g.a)(),n=t.notices,r=t.removeNotice,c=n.filter((function(e){return"snackbar"===e.type}));return e?null:Object(a.createElement)(b.a,{notices:c,className:"wc-block-components-notices__snackbar",onRemove:r})};function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=Object(a.createContext)({notices:[],createNotice:function(e,t,n){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),E=function(){return Object(a.useContext)(y)},N=function(e){var t=e.children,n=e.className,r=void 0===n?"":n,c=e.createNoticeContainer,o=void 0===c||c,u=e.context,d=void 0===u?"wc/core":u,l=Object(s.useDispatch)("core/notices"),f=l.createNotice,p=l.removeNotice,v=Object(a.useState)(!1),b=i()(v,2),g=b[0],h=b[1],j=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(e,t,w(w({},n),{},{context:n.context||d}))}),[f,d]),E=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;p(e,t)}),[p,d]),N=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};j("default",e,w(w({},t),{},{type:"snackbar"}))}),[j]),C={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(d)}}),[d]).notices,createNotice:j,createSnackbarNotice:N,removeNotice:E,context:d,setIsSuppressed:h},S=g?null:Object(a.createElement)(m,{className:r,notices:C.notices}),I=g?null:Object(a.createElement)(O,null);return Object(a.createElement)(y.Provider,{value:C},o&&S,t,I)}},274:function(e,t,n){"use strict";var r=n(10),c=n.n(r),o=n(27),i=n.n(o),a=n(0),s=n(58),u=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=i()(e,["className","size"]);return Object(a.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(a.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=u},511:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=window.Event||null,c=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("function"==typeof r){var c=new r(e,{bubbles:t,cancelable:n});document.body.dispatchEvent(c)}else{var o=document.createEvent("Event");o.initEvent(e,t,n),document.body.dispatchEvent(o)}},o=function(){c("wc_fragment_refresh",!0,!0)},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var o=function(){c(t,n,r)};return jQuery(document).on(e,o),function(){return jQuery(document).off(e,o)}}},822:function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r=n(11),c=n.n(r),o=n(0),i=n(36),a=n(133),s=n(40),u=n(33),d=n(143),l=function(e,t){var n=e.find((function(e){return e.id===t}));return n?n.quantity:0},f=function(e){var t=Object(i.useDispatch)(s.CART_STORE_KEY).addItemToCart,n=Object(a.a)(),r=n.cartItems,f=n.cartIsLoading,p=Object(d.a)(),v=p.addErrorNotice,m=p.removeNotice,b=Object(o.useState)(!1),g=c()(b,2),h=g[0],O=g[1],j=Object(o.useRef)(l(r,e));return Object(o.useEffect)((function(){var t=l(r,e);t!==j.current&&(j.current=t)}),[r,e]),{cartQuantity:Number.isFinite(j.current)?j.current:0,addingToCart:h,cartIsLoading:f,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;O(!0),t(e,n).then((function(e){!0===e&&m("add-to-cart")})).catch((function(e){v(Object(u.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){O(!1)}))}}}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{133:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(41),c=n(36),o=n(262),i=n(33),a=n(6),s={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(o.b)(),n=t.isEditor,u=t.previewData,d=(null==u?void 0:u.previewCart)||{},l=e.shouldSelect,f=Object(c.useSelect)((function(e,t){var c=t.dispatch;if(!l)return s;if(n)return{cartCoupons:d.coupons,cartItems:d.items,cartItemsCount:d.items_count,cartItemsWeight:d.items_weight,cartNeedsPayment:d.needs_payment,cartNeedsShipping:d.needs_shipping,cartItemErrors:[],cartTotals:d.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:d.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==d?void 0:d.receiveCart)?d.receiveCart:function(){}};var o=e(r.CART_STORE_KEY),u=o.getCartData(),f=o.getCartErrors(),p=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),v=o.areShippingRatesLoading(),m=c(r.CART_STORE_KEY).receiveCart,g=Object(a.mapValues)(u.shippingAddress,(function(e){return Object(i.decodeEntities)(e)}));return{cartCoupons:u.coupons,cartItems:u.items||[],cartItemsCount:u.itemsCount,cartItemsWeight:u.itemsWeight,cartNeedsPayment:u.needsPayment,cartNeedsShipping:u.needsShipping,cartItemErrors:u.errors||[],cartTotals:p,cartIsLoading:b,cartErrors:f,shippingAddress:g,shippingRates:u.shippingRates||[],shippingRatesLoading:v,hasShippingAddress:!!g.country,receiveCart:m}}),[l]);return f}},143:function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(7),c=n.n(r),o=n(269),i=n(0);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var u=function(){var e=Object(o.b)(),t=e.notices,n=e.createNotice,r=e.removeNotice,c=e.createSnackbarNotice,a=e.setIsSuppressed,u=Object(i.useRef)(t);Object(i.useEffect)((function(){u.current=t}),[t]);var d=Object(i.useMemo)((function(){return{hasNoticesOfType:function(e){return u.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;u.current.map((function(t){return null!==e&&t.status!==e||r(t.id),!0}))},removeNotice:r}}),[r]),l=Object(i.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",e,s({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",e,s({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",e,s({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",e,s({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",e,s({},t))},addSnackbarNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c(e,t)}}}),[n,c]);return s(s(s({notices:t},d),l),{},{setIsSuppressed:a})}},230:function(e,t){},261:function(e,t,n){"use strict";var r=n(10),c=n.n(r),o=n(27),i=n.n(o),a=n(0),s=n(59),u=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=void 0===n?20:n,o=i()(e,["className","size"]);return Object(a.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:r,height:r},o),Object(a.createElement)("path",{d:"M5 6l5 5 5-5 2 1-7 7-7-7z"}))}),null),d=n(275);t.a=function(e){let t;switch(e.icon){case"arrow-down-alt2":t=u;break;case"no-alt":t=d.a}return t?Object(a.cloneElement)(t,{size:e.size||20,className:e.className}):null}},262:function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return a}));var r=n(0),c=n(36),o=Object(r.createContext)({isEditor:!1,currentPostId:0,previewData:{}}),i=function(){return Object(r.useContext)(o)},a=function(e){var t=e.children,n=e.currentPostId,i=void 0===n?0:n,a=e.previewData,s=void 0===a?{}:a,u={isEditor:!0,currentPostId:Object(c.useSelect)((function(e){return i||e("core/editor").getCurrentPostId()}),[i]),previewData:s};return Object(r.createElement)(o.Provider,{value:u},t)}},269:function(e,t,n){"use strict";n.d(t,"b",(function(){return E})),n.d(t,"a",(function(){return N}));var r=n(7),c=n.n(r),o=n(11),i=n.n(o),a=n(0),s=(n(2),n(36)),u=n(10),d=n.n(u),l=n(8),f=n.n(l),p=n(929),b=(n(230),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-success";case"info":case"warning":return"woocommerce-info"}return""}),v=function(e){var t=e.className,n=e.notices,r=E().removeNotice,c=f()(t,"wc-block-components-notices"),o=n.filter((function(e){return"snackbar"!==e.type}));return o.length?Object(a.createElement)("div",{className:c},o.map((function(e){return Object(a.createElement)(p.a,d()({key:"store-notice-"+e.id},e,{className:f()("wc-block-components-notices__notice","woocommerce-message",b(e)),onRemove:function(){e.isDismissible&&r(e.id)}}),e.content)}))):null},m=n(933),g=n(143),h=n(262),O=function(){var e=Object(h.b)().isEditor,t=Object(g.a)(),n=t.notices,r=t.removeNotice,c=n.filter((function(e){return"snackbar"===e.type}));return e?null:Object(a.createElement)(m.a,{notices:c,className:"wc-block-components-notices__snackbar",onRemove:r})};function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){c()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=Object(a.createContext)({notices:[],createNotice:function(e,t,n){},createSnackbarNotice:function(e,t){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),E=function(){return Object(a.useContext)(y)},N=function(e){var t=e.children,n=e.className,r=void 0===n?"":n,c=e.createNoticeContainer,o=void 0===c||c,u=e.context,d=void 0===u?"wc/core":u,l=Object(s.useDispatch)("core/notices"),f=l.createNotice,p=l.removeNotice,b=Object(a.useState)(!1),m=i()(b,2),g=m[0],h=m[1],j=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};f(e,t,w(w({},n),{},{context:n.context||d}))}),[f,d]),E=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;p(e,t)}),[p,d]),N=Object(a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};j("default",e,w(w({},t),{},{type:"snackbar"}))}),[j]),C={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(d)}}),[d]).notices,createNotice:j,createSnackbarNotice:N,removeNotice:E,context:d,setIsSuppressed:h},S=g?null:Object(a.createElement)(v,{className:r,notices:C.notices}),I=g?null:Object(a.createElement)(O,null);return Object(a.createElement)(y.Provider,{value:C},o&&S,t,I)}},275:function(e,t,n){"use strict";var r=n(10),c=n.n(r),o=n(27),i=n.n(o),a=n(0),s=n(59),u=Object(a.createElement)((function(e){var t=e.className,n=e.size,r=i()(e,["className","size"]);return Object(a.createElement)(s.a,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),Object(a.createElement)("path",{d:"M14.95 6.46L11.41 10l3.54 3.54-1.41 1.41L10 11.42l-3.53 3.53-1.42-1.42L8.58 10 5.05 6.47l1.42-1.42L10 8.58l3.54-3.53z"}))}),null);t.a=u},515:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return i}));var r=window.Event||null,c=function(e,t){var n=t.bubbles,c=void 0!==n&&n,o=t.cancelable,i=void 0!==o&&o,a=t.element;if(a||(a=document.body),"function"==typeof r){var s=new r(e,{bubbles:c,cancelable:i});a.dispatchEvent(s)}else{var u=document.createEvent("Event");u.initEvent(e,c,i),a.dispatchEvent(u)}},o=function(){c("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var o=function(){c(t,{bubbles:n,cancelable:r})};return jQuery(document).on(e,o),function(){return jQuery(document).off(e,o)}}},826:function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r=n(11),c=n.n(r),o=n(0),i=n(36),a=n(133),s=n(41),u=n(33),d=n(143),l=function(e,t){var n=e.find((function(e){return e.id===t}));return n?n.quantity:0},f=function(e){var t=Object(i.useDispatch)(s.CART_STORE_KEY).addItemToCart,n=Object(a.a)(),r=n.cartItems,f=n.cartIsLoading,p=Object(d.a)(),b=p.addErrorNotice,v=p.removeNotice,m=Object(o.useState)(!1),g=c()(m,2),h=g[0],O=g[1],j=Object(o.useRef)(l(r,e));return Object(o.useEffect)((function(){var t=l(r,e);t!==j.current&&(j.current=t)}),[r,e]),{cartQuantity:Number.isFinite(j.current)?j.current:0,addingToCart:h,cartIsLoading:f,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;O(!0),t(e,n).then((function(e){!0===e&&v("add-to-cart")})).catch((function(e){b(Object(u.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){O(!1)}))}}}}}]);
|
build/atomic-block-components/add-to-cart~atomic-block-components/image~atomic-block-components/title.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{935:function(e,n,a){"use strict";var c=a(10),r=a.n(c),t=a(0),o=function(e,n){var a=[];return Object.keys(e).forEach((function(c){if(void 0!==n[c])switch(e[c].type){case"boolean":a[c]="false"!==n[c]&&!1!==n[c];break;case"number":a[c]=parseInt(n[c],10);break;case"array":case"object":a[c]=JSON.parse(n[c]);break;default:a[c]=n[c]}else a[c]=e[c].default})),a};n.a=function(e){return function(n){return function(a){var c=o(e,a);return Object(t.createElement)(n,r()({},a,c))}}}}}]);
|
build/atomic-block-components/button-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{270:function(t,e,n){"use strict";n.d(e,"a",(function(){return c})),n.d(e,"c",(function(){return a})),n.d(e,"b",(function(){return o}));var r=window.Event||null,c=function(t,e){var n=e.bubbles,c=void 0!==n&&n,a=e.cancelable,o=void 0!==a&&a,i=e.element;if(i||(i=document.body),"function"==typeof r){var s=new r(t,{bubbles:c,cancelable:o});i.dispatchEvent(s)}else{var u=document.createEvent("Event");u.initEvent(t,c,o),i.dispatchEvent(u)}},a=function(){c("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},o=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return function(){};var a=function(){c(e,{bubbles:n,cancelable:r})};return jQuery(document).on(t,a),function(){return jQuery(document).off(t,a)}}},283:function(t,e){},284:function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var r=n(10),c=n.n(r),a=n(0),o=n(13),i=n(80),s=n(14),u=n(16),d=n(79),p=function(t,e){var n=t.find((function(t){return t.id===e}));return n?n.quantity:0},l=function(t){var e=Object(o.useDispatch)(s.CART_STORE_KEY).addItemToCart,n=Object(i.a)(),r=n.cartItems,l=n.cartIsLoading,b=Object(d.a)(),f=b.addErrorNotice,m=b.removeNotice,g=Object(a.useState)(!1),h=c()(g,2),_=h[0],v=h[1],E=Object(a.useRef)(p(r,t));return Object(a.useEffect)((function(){var e=p(r,t);e!==E.current&&(E.current=e)}),[r,t]),{cartQuantity:Number.isFinite(E.current)?E.current:0,addingToCart:_,cartIsLoading:l,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;v(!0),e(t,n).then((function(t){!0===t&&m("add-to-cart")})).catch((function(t){f(Object(u.decodeEntities)(t.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){v(!1)}))}}}},294:function(t,e,n){"use strict";n.r(e);var r=n(11),c=n.n(r),a=n(6),o=n.n(a),i=(n(4),n(5)),s=n.n(i),u=n(1),d=n(0),p=n(284),l=n(16),b=n(270),f=n(67),m=n(179),g=(n(283),function(t){var e=t.product,n=Object(d.useRef)(!0),r=e.id,a=e.permalink,o=e.add_to_cart,i=e.has_options,f=e.is_purchasable,m=e.is_in_stock,g=Object(p.a)(r),h=g.cartQuantity,_=g.addingToCart,v=g.addToCart;Object(d.useEffect)((function(){n.current?n.current=!1:Object(b.c)()}),[h]);var E=Number.isFinite(h)&&h>0,C=!i&&f&&m,j=Object(l.decodeEntities)((null==o?void 0:o.description)||""),O=E?Object(u.sprintf)(Object(u._n)("%d in cart","%d in cart",h,"woo-gutenberg-products-block"),h):Object(l.decodeEntities)((null==o?void 0:o.text)||Object(u.__)("Add to cart","woo-gutenberg-products-block")),w=C?"button":"a",y={};return C?y.onClick=function(){v()}:(y.href=a,y.rel="nofollow"),React.createElement(w,c()({"aria-label":j,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:_,added:E}),disabled:_},y),O)}),h=function(){return React.createElement("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0})};e.default=Object(m.withProductDataContext)((function(t){var e=t.className,n=Object(f.useInnerBlockLayoutContext)().parentClassName,r=Object(f.useProductDataContext)().product;return React.createElement("div",{className:s()(e,"wp-block-button","wc-block-components-product-button",o()({},"".concat(n,"__product-add-to-cart"),n))},r.id?React.createElement(g,{product:r}):React.createElement(h,null))}))},80:function(t,e,n){"use strict";n.d(e,"a",(function(){return u}));var r=n(14),c=n(13),a=n(132),o=n(16),i=n(7),s={cartCoupons:[],cartItems:[],cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:[],cartTotals:{},cartIsLoading:!0,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:[],shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:function(){}},u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},e=Object(a.a)(),n=e.isEditor,u=e.previewData,d=(null==u?void 0:u.previewCart)||{},p=t.shouldSelect,l=Object(c.useSelect)((function(t,e){var c=e.dispatch;if(!p)return s;if(n)return{cartCoupons:d.coupons,cartItems:d.items,cartItemsCount:d.items_count,cartItemsWeight:d.items_weight,cartNeedsPayment:d.needs_payment,cartNeedsShipping:d.needs_shipping,cartItemErrors:[],cartTotals:d.totals,cartIsLoading:!1,cartErrors:[],shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},shippingRates:d.shipping_rates,shippingRatesLoading:!1,hasShippingAddress:!1,receiveCart:"function"==typeof(null==d?void 0:d.receiveCart)?d.receiveCart:function(){}};var a=t(r.CART_STORE_KEY),u=a.getCartData(),l=a.getCartErrors(),b=a.getCartTotals(),f=!a.hasFinishedResolution("getCartData"),m=a.areShippingRatesLoading(),g=c(r.CART_STORE_KEY).receiveCart,h=Object(i.mapValues)(u.shippingAddress,(function(t){return Object(o.decodeEntities)(t)}));return{cartCoupons:u.coupons,cartItems:u.items||[],cartItemsCount:u.itemsCount,cartItemsWeight:u.itemsWeight,cartNeedsPayment:u.needsPayment,cartNeedsShipping:u.needsShipping,cartItemErrors:u.errors||[],cartTotals:b,cartIsLoading:f,cartErrors:l,shippingAddress:h,shippingRates:u.shippingRates||[],shippingRatesLoading:m,hasShippingAddress:!!h.country,receiveCart:g}}),[p]);return l}}}]);
|
build/atomic-block-components/button.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{514:function(t,c,e){"use strict";e.r(c);var o=e(10),n=e.n(o),a=e(7),r=e.n(a),u=e(0),d=(e(2),e(8)),b=e.n(d),l=e(1),i=e(826),s=e(33),p=e(515),_=e(42),k=e(72),j=(e(536),function(t){var c=t.product,e=Object(u.useRef)(!0),o=c.id,a=c.permalink,r=c.add_to_cart,d=c.has_options,_=c.is_purchasable,k=c.is_in_stock,j=Object(i.a)(o),w=j.cartQuantity,O=j.addingToCart,m=j.addToCart;Object(u.useEffect)((function(){e.current?e.current=!1:Object(p.c)()}),[w]);var f=Number.isFinite(w)&&w>0,E=!d&&_&&k,v=Object(s.decodeEntities)((null==r?void 0:r.description)||""),C=f?Object(l.sprintf)(Object(l._n)("%d in cart","%d in cart",w,"woo-gutenberg-products-block"),w):Object(s.decodeEntities)((null==r?void 0:r.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),g=E?"button":"a",h={};return E?h.onClick=function(){m()}:(h.href=a,h.rel="nofollow"),Object(u.createElement)(g,n()({"aria-label":v,className:b()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:O,added:f}),disabled:O},h),C)}),w=function(){return Object(u.createElement)("button",{className:b()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder"),disabled:!0})};c.default=Object(k.withProductDataContext)((function(t){var c=t.className,e=Object(_.useInnerBlockLayoutContext)().parentClassName,o=Object(_.useProductDataContext)().product;return Object(u.createElement)("div",{className:b()(c,"wp-block-button","wc-block-components-product-button",r()({},"".concat(e,"__product-add-to-cart"),e))},o.id?Object(u.createElement)(j,{product:o}):Object(u.createElement)(w,null))}))},536:function(t,c){}}]);
|
build/atomic-block-components/category-list-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{287:function(e,t){},297:function(e,t,c){"use strict";c.r(t);var a=c(6),n=c.n(a),o=c(1),r=(c(4),c(5)),s=c.n(r),l=c(67),u=c(7),i=c(179);c(287);t.default=Object(i.withProductDataContext)((function(e){var t=e.className,c=Object(l.useInnerBlockLayoutContext)().parentClassName,a=Object(l.useProductDataContext)().product;return Object(u.isEmpty)(a.categories)?null:React.createElement("div",{className:s()(t,"wc-block-components-product-category-list",n()({},"".concat(c,"__product-category-list"),c))},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",React.createElement("ul",null,Object.values(a.categories).map((function(e){var t=e.name,c=e.link,a=e.slug;return React.createElement("li",{key:"category-list-item-".concat(a)},React.createElement("a",{href:c},t))}))))}))}}]);
|
build/atomic-block-components/category-list.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp|
|
|