Version Description
- 2021-08-31 =
Enhancements
- Introduced the
__experimental_woocommerce_blocks_checkout_update_order_from_request
hook to the Checkout Store API. (4610) - Add "Filter Products by Stock" block. (4145)
Bug Fixes
- Prevent Product Category List from displaying incorrectly when used on the shop page. (4587)
- Add label element to
<BlockTitle>
component. (4585)
Documentation
- Add Extensibility info to Store API readme. (4605)
- Update documentation for the snackbarNoticeVisibility filter. (4508)
- Add documentation for
extensionCartUpdate
method - this allows extensions to update the client-side cart after it has been modified on the server. (4377)
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Gutenberg Products Block |
Version | 5.8.0 |
Comparing to | |
See all releases |
Code changes from version 5.7.0 to 5.8.0
- assets/css/abstracts/_mixins.scss +1 -1
- assets/css/editor.scss +1 -1
- assets/js/atomic/blocks/product-elements/image/attributes.js +1 -1
- assets/js/atomic/blocks/product-elements/image/block.js +3 -3
- assets/js/atomic/blocks/product-elements/image/edit.js +3 -3
- assets/js/atomic/blocks/product-elements/image/style.scss +5 -5
- assets/js/atomic/blocks/product-elements/image/test/block.test.js +4 -4
- assets/js/atomic/blocks/product-elements/title/attributes.js +1 -1
- assets/js/atomic/blocks/product-elements/title/block.js +5 -5
- assets/js/atomic/blocks/product-elements/title/edit.js +3 -3
- assets/js/base/components/cart-checkout/form-step/style.scss +3 -3
- assets/js/base/components/cart-checkout/order-summary/style.scss +1 -1
- assets/js/base/components/cart-checkout/payment-method-icons/{common-icons.js → common-icons.ts} +5 -2
- assets/js/base/components/cart-checkout/payment-method-icons/{index.js → index.tsx} +9 -1
- assets/js/base/components/cart-checkout/payment-method-icons/{payment-method-icon.js → payment-method-icon.tsx} +11 -2
- assets/js/base/components/cart-checkout/payment-method-icons/utils.js +0 -34
- assets/js/base/components/cart-checkout/payment-method-icons/utils.ts +40 -0
- assets/js/base/components/cart-checkout/payment-method-label/{index.js → index.tsx} +33 -5
- assets/js/base/components/cart-checkout/place-order-button/{index.js → index.tsx} +1 -1
- assets/js/base/components/chip/style.scss +1 -1
- assets/js/base/components/dropdown-selector/style.scss +6 -5
- assets/js/{blocks/attribute-filter/label.js → base/components/filter-element-label/index.js} +10 -5
- assets/js/base/components/filter-element-label/style.scss +9 -0
- assets/js/base/components/product-list/container.js +1 -5
- assets/js/base/components/product-list/product-list.js +15 -20
- assets/js/base/components/product-list/product-sort-select/index.js +1 -10
- assets/js/base/components/product-list/style.scss +8 -8
- assets/js/base/components/reviews/review-list-item/style.scss +3 -3
- assets/js/base/components/reviews/review-sort-select/index.js +1 -7
- assets/js/base/components/sidebar-layout/style.scss +2 -2
- assets/js/base/components/sort-select/index.js +0 -4
- assets/js/base/context/hooks/collections/use-collection-data.js +19 -0
- assets/js/base/context/hooks/index.js +1 -0
- assets/js/base/context/hooks/use-checkout-extension-data.ts +51 -0
- assets/js/base/context/providers/cart-checkout/cart/index.js +1 -1
- assets/js/base/context/providers/cart-checkout/{checkout/processor/index.js → checkout-processor.js} +70 -79
- assets/js/base/context/providers/cart-checkout/{checkout/index.js → checkout-provider.js} +5 -5
- assets/js/base/context/providers/cart-checkout/checkout-state/actions.ts +12 -10
- assets/js/base/context/providers/cart-checkout/checkout-state/constants.ts +3 -0
- assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx +3 -0
- assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts +15 -13
- assets/js/base/context/providers/cart-checkout/checkout-state/types.ts +23 -15
- assets/js/base/context/providers/cart-checkout/checkout/processor/utils.js +0 -30
- assets/js/base/context/providers/cart-checkout/index.js +3 -2
- assets/js/base/context/providers/cart-checkout/utils.ts +63 -0
- assets/js/base/utils/lazy-load-script.ts +82 -0
- assets/js/base/utils/preload-script.ts +30 -0
- assets/js/base/utils/render-frontend.js +3 -3
- assets/js/blocks/active-filters/block.js +34 -0
- assets/js/blocks/active-filters/style.scss +2 -2
- assets/js/blocks/attribute-filter/block.js +1 -1
- assets/js/blocks/attribute-filter/preview.js +2 -2
- assets/js/blocks/attribute-filter/style.scss +0 -13
- assets/js/blocks/cart-checkout/cart/checkout-button/{index.js → index.tsx} +5 -2
- assets/js/blocks/cart-checkout/cart/full-cart/style.scss +39 -42
- assets/js/blocks/cart-checkout/checkout-i2/frontend.tsx +3 -0
- assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-express-payment-block/edit.tsx +56 -3
- assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-express-payment-block/editor.scss +21 -4
- assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-sample-block/index.tsx +0 -1
- assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/index.tsx +0 -1
- assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/register-components.ts +5 -0
- assets/js/blocks/cart-checkout/checkout-i2/styles/style.scss +3 -2
- assets/js/blocks/cart-checkout/checkout/form/style.scss +4 -4
- assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx +37 -0
- assets/js/blocks/cart-checkout/mini-cart/edit.tsx +33 -0
- assets/js/blocks/cart-checkout/mini-cart/frontend.ts +75 -0
- assets/js/blocks/cart-checkout/mini-cart/index.tsx +50 -0
- assets/js/blocks/featured-category/style.scss +1 -1
- assets/js/blocks/featured-product/style.scss +1 -1
- assets/js/blocks/products/all-products/block.js +0 -4
- assets/js/blocks/reviews/frontend-block.js +3 -3
- assets/js/blocks/reviews/frontend-container-block.js +1 -0
- assets/js/blocks/stock-filter/block.js +278 -0
- assets/js/blocks/stock-filter/edit.js +130 -0
- assets/js/blocks/stock-filter/editor.scss +36 -0
- assets/js/blocks/stock-filter/frontend.js +27 -0
- assets/js/blocks/stock-filter/index.js +93 -0
- assets/js/blocks/stock-filter/preview.js +22 -0
- assets/js/blocks/stock-filter/style.scss +29 -0
- assets/js/editor-components/block-title/index.js +17 -2
- assets/js/icons/icon/index.tsx +3 -2
- assets/js/types/type-defs/index.ts +1 -0
- assets/js/types/type-defs/payment-method-icon.ts +5 -0
- build/active-filters-frontend.asset.php +1 -1
- build/active-filters-frontend.js +7 -7
- build/active-filters.asset.php +1 -1
- build/active-filters.js +8 -8
- build/all-products-frontend.asset.php +1 -1
- build/all-products-frontend.js +6 -6
- build/all-products.asset.php +1 -1
- build/all-products.js +13 -13
- build/all-reviews.asset.php +1 -1
- build/all-reviews.js +3 -3
- build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js +2 -2
- 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/add-to-cart-frontend.js +2 -2
- build/atomic-block-components/add-to-cart.js +2 -2
- build/atomic-block-components/button-frontend.js +2 -2
- build/atomic-block-components/button.js +2 -2
- build/atomic-block-components/category-list-frontend.js +1 -1
- build/atomic-block-components/category-list.js +1 -1
- build/atomic-block-components/image-frontend.js +2 -2
- build/atomic-block-components/image.js +2 -2
- build/atomic-block-components/price-frontend.js +2 -2
- build/atomic-block-components/price.js +2 -2
- build/atomic-block-components/rating-frontend.js +1 -1
- build/atomic-block-components/rating.js +2 -2
- build/atomic-block-components/sale-badge-frontend.js +1 -1
- build/atomic-block-components/sale-badge.js +1 -1
- build/atomic-block-components/sku-frontend.js +1 -1
- build/atomic-block-components/sku.js +1 -1
- build/atomic-block-components/stock-indicator-frontend.js +1 -1
- build/atomic-block-components/stock-indicator.js +2 -2
- build/atomic-block-components/summary-frontend.js +1 -1
- build/atomic-block-components/summary.js +1 -1
- build/atomic-block-components/tag-list-frontend.js +1 -1
- build/atomic-block-components/tag-list.js +1 -1
- build/atomic-block-components/title-frontend.js +1 -1
assets/css/abstracts/_mixins.scss
CHANGED
@@ -179,7 +179,7 @@ $fontSizes: (
|
|
179 |
|
180 |
// Converts a px unit to em.
|
181 |
@function em($size, $base: 16px) {
|
182 |
-
@return $size
|
183 |
}
|
184 |
|
185 |
// Encodes hex colors so they can be used in URL content.
|
179 |
|
180 |
// Converts a px unit to em.
|
181 |
@function em($size, $base: 16px) {
|
182 |
+
@return math.div($size, $base) * 1em;
|
183 |
}
|
184 |
|
185 |
// Encodes hex colors so they can be used in URL content.
|
assets/css/editor.scss
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
.wc-block-grid {
|
19 |
.wc-block-grid__products {
|
20 |
list-style: none;
|
21 |
-
margin: 0 (-$gap
|
22 |
padding: 0;
|
23 |
|
24 |
.wc-block-grid__product {
|
18 |
.wc-block-grid {
|
19 |
.wc-block-grid__products {
|
20 |
list-style: none;
|
21 |
+
margin: 0 (-$gap*0.5) $gap;
|
22 |
padding: 0;
|
23 |
|
24 |
.wc-block-grid__product {
|
assets/js/atomic/blocks/product-elements/image/attributes.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
export const blockAttributes = {
|
2 |
-
|
3 |
type: 'boolean',
|
4 |
default: true,
|
5 |
},
|
1 |
export const blockAttributes = {
|
2 |
+
showProductLink: {
|
3 |
type: 'boolean',
|
4 |
default: true,
|
5 |
},
|
assets/js/atomic/blocks/product-elements/image/block.js
CHANGED
@@ -25,7 +25,7 @@ import './style.scss';
|
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {string} [props.imageSizing] Size of image to use.
|
28 |
-
* @param {boolean} [props.
|
29 |
* @param {boolean} [props.showSaleBadge] Whether or not to display the on sale badge.
|
30 |
* @param {string} [props.saleBadgeAlign] How should the sale badge be aligned if displayed.
|
31 |
* @return {*} The component.
|
@@ -33,7 +33,7 @@ import './style.scss';
|
|
33 |
export const Block = ( {
|
34 |
className,
|
35 |
imageSizing = 'full-size',
|
36 |
-
|
37 |
showSaleBadge,
|
38 |
saleBadgeAlign = 'right',
|
39 |
} ) => {
|
@@ -136,7 +136,7 @@ const Image = ( { image, onLoad, loaded, showFullSize, fallbackAlt } ) => {
|
|
136 |
Block.propTypes = {
|
137 |
className: PropTypes.string,
|
138 |
fallbackAlt: PropTypes.string,
|
139 |
-
|
140 |
showSaleBadge: PropTypes.bool,
|
141 |
saleBadgeAlign: PropTypes.string,
|
142 |
};
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {string} [props.imageSizing] Size of image to use.
|
28 |
+
* @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
|
29 |
* @param {boolean} [props.showSaleBadge] Whether or not to display the on sale badge.
|
30 |
* @param {string} [props.saleBadgeAlign] How should the sale badge be aligned if displayed.
|
31 |
* @return {*} The component.
|
33 |
export const Block = ( {
|
34 |
className,
|
35 |
imageSizing = 'full-size',
|
36 |
+
showProductLink = true,
|
37 |
showSaleBadge,
|
38 |
saleBadgeAlign = 'right',
|
39 |
} ) => {
|
136 |
Block.propTypes = {
|
137 |
className: PropTypes.string,
|
138 |
fallbackAlt: PropTypes.string,
|
139 |
+
showProductLink: PropTypes.bool,
|
140 |
showSaleBadge: PropTypes.bool,
|
141 |
saleBadgeAlign: PropTypes.string,
|
142 |
};
|
assets/js/atomic/blocks/product-elements/image/edit.js
CHANGED
@@ -17,7 +17,7 @@ import { BLOCK_TITLE, BLOCK_ICON } from './constants';
|
|
17 |
|
18 |
const Edit = ( { attributes, setAttributes } ) => {
|
19 |
const {
|
20 |
-
|
21 |
imageSizing,
|
22 |
showSaleBadge,
|
23 |
saleBadgeAlign,
|
@@ -38,10 +38,10 @@ const Edit = ( { attributes, setAttributes } ) => {
|
|
38 |
'Links the image to the single product listing.',
|
39 |
'woo-gutenberg-products-block'
|
40 |
) }
|
41 |
-
checked={
|
42 |
onChange={ () =>
|
43 |
setAttributes( {
|
44 |
-
|
45 |
} )
|
46 |
}
|
47 |
/>
|
17 |
|
18 |
const Edit = ( { attributes, setAttributes } ) => {
|
19 |
const {
|
20 |
+
showProductLink,
|
21 |
imageSizing,
|
22 |
showSaleBadge,
|
23 |
saleBadgeAlign,
|
38 |
'Links the image to the single product listing.',
|
39 |
'woo-gutenberg-products-block'
|
40 |
) }
|
41 |
+
checked={ showProductLink }
|
42 |
onChange={ () =>
|
43 |
setAttributes( {
|
44 |
+
showProductLink: ! showProductLink,
|
45 |
} )
|
46 |
}
|
47 |
/>
|
assets/js/atomic/blocks/product-elements/image/style.scss
CHANGED
@@ -25,14 +25,14 @@
|
|
25 |
.wc-block-components-product-sale-badge {
|
26 |
&--align-left {
|
27 |
position: absolute;
|
28 |
-
left: $gap-smaller
|
29 |
-
top: $gap-smaller
|
30 |
right: auto;
|
31 |
margin: 0;
|
32 |
}
|
33 |
&--align-center {
|
34 |
position: absolute;
|
35 |
-
top: $gap-smaller
|
36 |
left: 50%;
|
37 |
right: auto;
|
38 |
transform: translateX(-50%);
|
@@ -40,8 +40,8 @@
|
|
40 |
}
|
41 |
&--align-right {
|
42 |
position: absolute;
|
43 |
-
right: $gap-smaller
|
44 |
-
top: $gap-smaller
|
45 |
left: auto;
|
46 |
margin: 0;
|
47 |
}
|
25 |
.wc-block-components-product-sale-badge {
|
26 |
&--align-left {
|
27 |
position: absolute;
|
28 |
+
left: $gap-smaller*0.5;
|
29 |
+
top: $gap-smaller*0.5;
|
30 |
right: auto;
|
31 |
margin: 0;
|
32 |
}
|
33 |
&--align-center {
|
34 |
position: absolute;
|
35 |
+
top: $gap-smaller*0.5;
|
36 |
left: 50%;
|
37 |
right: auto;
|
38 |
transform: translateX(-50%);
|
40 |
}
|
41 |
&--align-right {
|
42 |
position: absolute;
|
43 |
+
right: $gap-smaller*0.5;
|
44 |
+
top: $gap-smaller*0.5;
|
45 |
left: auto;
|
46 |
margin: 0;
|
47 |
}
|
assets/js/atomic/blocks/product-elements/image/test/block.test.js
CHANGED
@@ -56,7 +56,7 @@ describe( 'Product Image Block', () => {
|
|
56 |
test( 'should render an anchor with the product image', () => {
|
57 |
const component = render(
|
58 |
<ProductDataContextProvider product={ productWithImages }>
|
59 |
-
<Block
|
60 |
</ProductDataContextProvider>
|
61 |
);
|
62 |
|
@@ -80,7 +80,7 @@ describe( 'Product Image Block', () => {
|
|
80 |
test( 'should render an anchor with the placeholder image', () => {
|
81 |
const component = render(
|
82 |
<ProductDataContextProvider product={ productWithoutImages }>
|
83 |
-
<Block
|
84 |
</ProductDataContextProvider>
|
85 |
);
|
86 |
|
@@ -103,7 +103,7 @@ describe( 'Product Image Block', () => {
|
|
103 |
test( 'should render the product image without an anchor wrapper', () => {
|
104 |
const component = render(
|
105 |
<ProductDataContextProvider product={ productWithImages }>
|
106 |
-
<Block
|
107 |
</ProductDataContextProvider>
|
108 |
);
|
109 |
const image = component.getByTestId( 'product-image' );
|
@@ -123,7 +123,7 @@ describe( 'Product Image Block', () => {
|
|
123 |
test( 'should render the placeholder image without an anchor wrapper', () => {
|
124 |
const component = render(
|
125 |
<ProductDataContextProvider product={ productWithoutImages }>
|
126 |
-
<Block
|
127 |
</ProductDataContextProvider>
|
128 |
);
|
129 |
|
56 |
test( 'should render an anchor with the product image', () => {
|
57 |
const component = render(
|
58 |
<ProductDataContextProvider product={ productWithImages }>
|
59 |
+
<Block showProductLink={ true } />
|
60 |
</ProductDataContextProvider>
|
61 |
);
|
62 |
|
80 |
test( 'should render an anchor with the placeholder image', () => {
|
81 |
const component = render(
|
82 |
<ProductDataContextProvider product={ productWithoutImages }>
|
83 |
+
<Block showProductLink={ true } />
|
84 |
</ProductDataContextProvider>
|
85 |
);
|
86 |
|
103 |
test( 'should render the product image without an anchor wrapper', () => {
|
104 |
const component = render(
|
105 |
<ProductDataContextProvider product={ productWithImages }>
|
106 |
+
<Block showProductLink={ false } />
|
107 |
</ProductDataContextProvider>
|
108 |
);
|
109 |
const image = component.getByTestId( 'product-image' );
|
123 |
test( 'should render the placeholder image without an anchor wrapper', () => {
|
124 |
const component = render(
|
125 |
<ProductDataContextProvider product={ productWithoutImages }>
|
126 |
+
<Block showProductLink={ false } />
|
127 |
</ProductDataContextProvider>
|
128 |
);
|
129 |
|
assets/js/atomic/blocks/product-elements/title/attributes.js
CHANGED
@@ -8,7 +8,7 @@ let blockAttributes = {
|
|
8 |
type: 'number',
|
9 |
default: 2,
|
10 |
},
|
11 |
-
|
12 |
type: 'boolean',
|
13 |
default: true,
|
14 |
},
|
8 |
type: 'number',
|
9 |
default: 2,
|
10 |
},
|
11 |
+
showProductLink: {
|
12 |
type: 'boolean',
|
13 |
default: true,
|
14 |
},
|
assets/js/atomic/blocks/product-elements/title/block.js
CHANGED
@@ -25,7 +25,7 @@ import './style.scss';
|
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {number} [props.headingLevel] Heading level (h1, h2 etc)
|
28 |
-
* @param {boolean} [props.
|
29 |
* @param {string} [props.align] Title alignment.
|
30 |
* @param {string} [props.color] Title color name.
|
31 |
* @param {string} [props.customColor] Custom title color value.
|
@@ -37,7 +37,7 @@ import './style.scss';
|
|
37 |
export const Block = ( {
|
38 |
className,
|
39 |
headingLevel = 2,
|
40 |
-
|
41 |
align,
|
42 |
color,
|
43 |
customColor,
|
@@ -98,10 +98,10 @@ export const Block = ( {
|
|
98 |
className={ classnames( {
|
99 |
[ titleClasses ]: isFeaturePluginBuild(),
|
100 |
} ) }
|
101 |
-
disabled={ !
|
102 |
name={ product.name }
|
103 |
permalink={ product.permalink }
|
104 |
-
rel={
|
105 |
style={ gatedStyledText( {
|
106 |
color: customColor,
|
107 |
fontSize: customFontSize,
|
@@ -119,7 +119,7 @@ export const Block = ( {
|
|
119 |
Block.propTypes = {
|
120 |
className: PropTypes.string,
|
121 |
headingLevel: PropTypes.number,
|
122 |
-
|
123 |
align: PropTypes.string,
|
124 |
color: PropTypes.string,
|
125 |
customColor: PropTypes.string,
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {number} [props.headingLevel] Heading level (h1, h2 etc)
|
28 |
+
* @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
|
29 |
* @param {string} [props.align] Title alignment.
|
30 |
* @param {string} [props.color] Title color name.
|
31 |
* @param {string} [props.customColor] Custom title color value.
|
37 |
export const Block = ( {
|
38 |
className,
|
39 |
headingLevel = 2,
|
40 |
+
showProductLink = true,
|
41 |
align,
|
42 |
color,
|
43 |
customColor,
|
98 |
className={ classnames( {
|
99 |
[ titleClasses ]: isFeaturePluginBuild(),
|
100 |
} ) }
|
101 |
+
disabled={ ! showProductLink }
|
102 |
name={ product.name }
|
103 |
permalink={ product.permalink }
|
104 |
+
rel={ showProductLink ? 'nofollow' : null }
|
105 |
style={ gatedStyledText( {
|
106 |
color: customColor,
|
107 |
fontSize: customFontSize,
|
119 |
Block.propTypes = {
|
120 |
className: PropTypes.string,
|
121 |
headingLevel: PropTypes.number,
|
122 |
+
showProductLink: PropTypes.bool,
|
123 |
align: PropTypes.string,
|
124 |
color: PropTypes.string,
|
125 |
customColor: PropTypes.string,
|
assets/js/atomic/blocks/product-elements/title/edit.js
CHANGED
@@ -31,7 +31,7 @@ const TitleEdit = ( {
|
|
31 |
attributes,
|
32 |
setAttributes,
|
33 |
} ) => {
|
34 |
-
const { headingLevel,
|
35 |
return (
|
36 |
<>
|
37 |
<BlockControls>
|
@@ -66,10 +66,10 @@ const TitleEdit = ( {
|
|
66 |
'Links the image to the single product listing.',
|
67 |
'woo-gutenberg-products-block'
|
68 |
) }
|
69 |
-
checked={
|
70 |
onChange={ () =>
|
71 |
setAttributes( {
|
72 |
-
|
73 |
} )
|
74 |
}
|
75 |
/>
|
31 |
attributes,
|
32 |
setAttributes,
|
33 |
} ) => {
|
34 |
+
const { headingLevel, showProductLink, align } = attributes;
|
35 |
return (
|
36 |
<>
|
37 |
<BlockControls>
|
66 |
'Links the image to the single product listing.',
|
67 |
'woo-gutenberg-products-block'
|
68 |
) }
|
69 |
+
checked={ showProductLink }
|
70 |
onChange={ () =>
|
71 |
setAttributes( {
|
72 |
+
showProductLink: ! showProductLink,
|
73 |
} )
|
74 |
}
|
75 |
/>
|
assets/js/base/components/cart-checkout/form-step/style.scss
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
border-left: 1px solid;
|
19 |
opacity: 0.3;
|
20 |
position: absolute;
|
21 |
-
left: -$gap-larger
|
22 |
top: 2.5em;
|
23 |
bottom: em($gap) * -1;
|
24 |
}
|
@@ -83,7 +83,7 @@
|
|
83 |
content: "\00a0" counter(checkout-step) "." / "";
|
84 |
position: absolute;
|
85 |
width: $gap-larger;
|
86 |
-
left: -$gap-larger
|
87 |
top: 0;
|
88 |
text-align: center;
|
89 |
transform: translateX(-50%);
|
@@ -95,7 +95,7 @@
|
|
95 |
border-left: 1px solid;
|
96 |
opacity: 0.3;
|
97 |
position: absolute;
|
98 |
-
left: -$gap-larger
|
99 |
top: 0;
|
100 |
}
|
101 |
}
|
18 |
border-left: 1px solid;
|
19 |
opacity: 0.3;
|
20 |
position: absolute;
|
21 |
+
left: -$gap-larger*0.5;
|
22 |
top: 2.5em;
|
23 |
bottom: em($gap) * -1;
|
24 |
}
|
83 |
content: "\00a0" counter(checkout-step) "." / "";
|
84 |
position: absolute;
|
85 |
width: $gap-larger;
|
86 |
+
left: -$gap-larger*0.5;
|
87 |
top: 0;
|
88 |
text-align: center;
|
89 |
transform: translateX(-50%);
|
95 |
border-left: 1px solid;
|
96 |
opacity: 0.3;
|
97 |
position: absolute;
|
98 |
+
left: -$gap-larger*0.5;
|
99 |
top: 0;
|
100 |
}
|
101 |
}
|
assets/js/base/components/cart-checkout/order-summary/style.scss
CHANGED
@@ -88,7 +88,7 @@
|
|
88 |
p,
|
89 |
.wc-block-components-product-metadata {
|
90 |
line-height: 1.375;
|
91 |
-
margin-top: #{ ( $gap-large - $gap )
|
92 |
}
|
93 |
}
|
94 |
|
88 |
p,
|
89 |
.wc-block-components-product-metadata {
|
90 |
line-height: 1.375;
|
91 |
+
margin-top: #{ ( $gap-large - $gap ) * 0.5 };
|
92 |
}
|
93 |
}
|
94 |
|
assets/js/base/components/cart-checkout/payment-method-icons/{common-icons.js → common-icons.ts}
RENAMED
@@ -2,11 +2,12 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings';
|
|
|
5 |
|
6 |
/**
|
7 |
* Array of common assets.
|
8 |
*/
|
9 |
-
export const commonIcons = [
|
10 |
{
|
11 |
id: 'alipay',
|
12 |
alt: 'Alipay',
|
@@ -109,7 +110,9 @@ export const commonIcons = [
|
|
109 |
*
|
110 |
* @param {string} id Icon ID.
|
111 |
*/
|
112 |
-
export const getCommonIconProps = (
|
|
|
|
|
113 |
return (
|
114 |
commonIcons.find( ( icon ) => {
|
115 |
return icon.id === id;
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { WC_BLOCKS_IMAGE_URL } from '@woocommerce/block-settings';
|
5 |
+
import type { PaymentMethodIcon } from '@woocommerce/type-defs/payment-method-icon';
|
6 |
|
7 |
/**
|
8 |
* Array of common assets.
|
9 |
*/
|
10 |
+
export const commonIcons: PaymentMethodIcon[] = [
|
11 |
{
|
12 |
id: 'alipay',
|
13 |
alt: 'Alipay',
|
110 |
*
|
111 |
* @param {string} id Icon ID.
|
112 |
*/
|
113 |
+
export const getCommonIconProps = (
|
114 |
+
id: string
|
115 |
+
): PaymentMethodIcon | Record< string, unknown > => {
|
116 |
return (
|
117 |
commonIcons.find( ( icon ) => {
|
118 |
return icon.id === id;
|
assets/js/base/components/cart-checkout/payment-method-icons/{index.js → index.tsx}
RENAMED
@@ -2,6 +2,7 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import classnames from 'classnames';
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
@@ -11,6 +12,10 @@ import { getCommonIconProps } from './common-icons';
|
|
11 |
import { normalizeIconConfig } from './utils';
|
12 |
import './style.scss';
|
13 |
|
|
|
|
|
|
|
|
|
14 |
/**
|
15 |
* For a given list of icons, render each as a list item, using common icons
|
16 |
* where available.
|
@@ -19,7 +24,10 @@ import './style.scss';
|
|
19 |
* @param {Array} props.icons Array of icons object configs or ids as strings.
|
20 |
* @param {string} props.align How to align the icon.
|
21 |
*/
|
22 |
-
export const PaymentMethodIcons = ( {
|
|
|
|
|
|
|
23 |
const iconConfigs = normalizeIconConfig( icons );
|
24 |
|
25 |
if ( iconConfigs.length === 0 ) {
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import classnames from 'classnames';
|
5 |
+
import type { PaymentMethodIcon as PaymentMethodIconType } from '@woocommerce/type-defs/payment-method-icon';
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
12 |
import { normalizeIconConfig } from './utils';
|
13 |
import './style.scss';
|
14 |
|
15 |
+
interface PaymentMethodIconsProps {
|
16 |
+
icons: PaymentMethodIconType[];
|
17 |
+
align: string;
|
18 |
+
}
|
19 |
/**
|
20 |
* For a given list of icons, render each as a list item, using common icons
|
21 |
* where available.
|
24 |
* @param {Array} props.icons Array of icons object configs or ids as strings.
|
25 |
* @param {string} props.align How to align the icon.
|
26 |
*/
|
27 |
+
export const PaymentMethodIcons = ( {
|
28 |
+
icons = [],
|
29 |
+
align = 'center',
|
30 |
+
}: PaymentMethodIconsProps ): JSX.Element | null => {
|
31 |
const iconConfigs = normalizeIconConfig( icons );
|
32 |
|
33 |
if ( iconConfigs.length === 0 ) {
|
assets/js/base/components/cart-checkout/payment-method-icons/{payment-method-icon.js → payment-method-icon.tsx}
RENAMED
@@ -3,10 +3,15 @@
|
|
3 |
*
|
4 |
* @param {string} id Icon ID.
|
5 |
*/
|
6 |
-
const getIconClassName = ( id ) => {
|
7 |
return `wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${ id }`;
|
8 |
};
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
/**
|
11 |
* Return an element for an icon.
|
12 |
*
|
@@ -15,7 +20,11 @@ const getIconClassName = ( id ) => {
|
|
15 |
* @param {string|null} props.src Optional src value for icon.
|
16 |
* @param {string} props.alt Optional alt value for icon.
|
17 |
*/
|
18 |
-
const PaymentMethodIcon = ( {
|
|
|
|
|
|
|
|
|
19 |
if ( ! src ) {
|
20 |
return null;
|
21 |
}
|
3 |
*
|
4 |
* @param {string} id Icon ID.
|
5 |
*/
|
6 |
+
const getIconClassName = ( id: string ): string => {
|
7 |
return `wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${ id }`;
|
8 |
};
|
9 |
|
10 |
+
interface PaymentMethodIconProps {
|
11 |
+
id: string;
|
12 |
+
src?: string | null;
|
13 |
+
alt?: string;
|
14 |
+
}
|
15 |
/**
|
16 |
* Return an element for an icon.
|
17 |
*
|
20 |
* @param {string|null} props.src Optional src value for icon.
|
21 |
* @param {string} props.alt Optional alt value for icon.
|
22 |
*/
|
23 |
+
const PaymentMethodIcon = ( {
|
24 |
+
id,
|
25 |
+
src = null,
|
26 |
+
alt = '',
|
27 |
+
}: PaymentMethodIconProps ): JSX.Element | null => {
|
28 |
if ( ! src ) {
|
29 |
return null;
|
30 |
}
|
assets/js/base/components/cart-checkout/payment-method-icons/utils.js
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* For an array of icons, normalize into objects and remove duplicates.
|
3 |
-
*
|
4 |
-
* @param {Array} icons Array of icon objects or string based ids.
|
5 |
-
*/
|
6 |
-
export const normalizeIconConfig = ( icons ) => {
|
7 |
-
const normalizedIcons = {};
|
8 |
-
|
9 |
-
icons.forEach( ( raw ) => {
|
10 |
-
let icon = {};
|
11 |
-
|
12 |
-
if ( typeof raw === 'string' ) {
|
13 |
-
icon = {
|
14 |
-
id: raw,
|
15 |
-
alt: raw,
|
16 |
-
src: null,
|
17 |
-
};
|
18 |
-
}
|
19 |
-
|
20 |
-
if ( typeof raw === 'object' ) {
|
21 |
-
icon = {
|
22 |
-
id: raw.id || '',
|
23 |
-
alt: raw.alt || '',
|
24 |
-
src: raw.src || null,
|
25 |
-
};
|
26 |
-
}
|
27 |
-
|
28 |
-
if ( icon.id && ! normalizedIcons[ icon.id ] ) {
|
29 |
-
normalizedIcons[ icon.id ] = icon;
|
30 |
-
}
|
31 |
-
} );
|
32 |
-
|
33 |
-
return Object.values( normalizedIcons );
|
34 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/components/cart-checkout/payment-method-icons/utils.ts
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import type { PaymentMethodIcon } from '@woocommerce/type-defs/payment-method-icon';
|
5 |
+
import { isString } from '@woocommerce/types';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* For an array of icons, normalize into objects and remove duplicates.
|
9 |
+
*/
|
10 |
+
export const normalizeIconConfig = (
|
11 |
+
icons: ( PaymentMethodIcon | string )[]
|
12 |
+
): PaymentMethodIcon[] => {
|
13 |
+
const normalizedIcons: Record< string, PaymentMethodIcon > = {};
|
14 |
+
|
15 |
+
icons.forEach( ( raw ) => {
|
16 |
+
let icon: Partial< PaymentMethodIcon > = {};
|
17 |
+
|
18 |
+
if ( typeof raw === 'string' ) {
|
19 |
+
icon = {
|
20 |
+
id: raw,
|
21 |
+
alt: raw,
|
22 |
+
src: null,
|
23 |
+
};
|
24 |
+
}
|
25 |
+
|
26 |
+
if ( typeof raw === 'object' ) {
|
27 |
+
icon = {
|
28 |
+
id: raw.id || '',
|
29 |
+
alt: raw.alt || '',
|
30 |
+
src: raw.src || null,
|
31 |
+
};
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( icon.id && isString( icon.id ) && ! normalizedIcons[ icon.id ] ) {
|
35 |
+
normalizedIcons[ icon.id ] = <PaymentMethodIcon>icon;
|
36 |
+
}
|
37 |
+
} );
|
38 |
+
|
39 |
+
return Object.values( normalizedIcons );
|
40 |
+
};
|
assets/js/base/components/cart-checkout/payment-method-label/{index.js → index.tsx}
RENAMED
@@ -3,19 +3,33 @@
|
|
3 |
*/
|
4 |
import classnames from 'classnames';
|
5 |
import { Icon, bank, bill, card, checkPayment } from '@woocommerce/icons';
|
|
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
import './style.scss';
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
bank,
|
14 |
bill,
|
15 |
card,
|
16 |
checkPayment,
|
17 |
};
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
/**
|
20 |
* Exposed to payment methods for the label shown on checkout. Allows icons to be added as well as
|
21 |
* text.
|
@@ -25,17 +39,31 @@ const namedIcons = {
|
|
25 |
* icon, or an SVG element.
|
26 |
* @param {string} props.text Text shown next to icon.
|
27 |
*/
|
28 |
-
export const PaymentMethodLabel = ( {
|
|
|
|
|
|
|
29 |
const hasIcon = !! icon;
|
30 |
-
const hasNamedIcon =
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
const className = classnames( 'wc-block-components-payment-method-label', {
|
33 |
'wc-block-components-payment-method-label--with-icon': hasIcon,
|
34 |
} );
|
35 |
|
36 |
return (
|
37 |
<span className={ className }>
|
38 |
-
{ hasNamedIcon
|
|
|
|
|
|
|
|
|
39 |
{ text }
|
40 |
</span>
|
41 |
);
|
3 |
*/
|
4 |
import classnames from 'classnames';
|
5 |
import { Icon, bank, bill, card, checkPayment } from '@woocommerce/icons';
|
6 |
+
import { isString, objectHasProp } from '@woocommerce/types';
|
7 |
+
import { useCallback } from '@wordpress/element';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
11 |
*/
|
12 |
import './style.scss';
|
13 |
|
14 |
+
interface NamedIcons {
|
15 |
+
bank: JSX.Element;
|
16 |
+
bill: JSX.Element;
|
17 |
+
card: JSX.Element;
|
18 |
+
checkPayment: JSX.Element;
|
19 |
+
}
|
20 |
+
|
21 |
+
const namedIcons: NamedIcons = {
|
22 |
bank,
|
23 |
bill,
|
24 |
card,
|
25 |
checkPayment,
|
26 |
};
|
27 |
|
28 |
+
interface PaymentMethodLabelProps {
|
29 |
+
icon: '' | keyof NamedIcons | SVGElement;
|
30 |
+
text: string;
|
31 |
+
}
|
32 |
+
|
33 |
/**
|
34 |
* Exposed to payment methods for the label shown on checkout. Allows icons to be added as well as
|
35 |
* text.
|
39 |
* icon, or an SVG element.
|
40 |
* @param {string} props.text Text shown next to icon.
|
41 |
*/
|
42 |
+
export const PaymentMethodLabel = ( {
|
43 |
+
icon = '',
|
44 |
+
text = '',
|
45 |
+
}: PaymentMethodLabelProps ): JSX.Element => {
|
46 |
const hasIcon = !! icon;
|
47 |
+
const hasNamedIcon = useCallback(
|
48 |
+
(
|
49 |
+
iconToCheck: '' | keyof NamedIcons | SVGElement
|
50 |
+
): iconToCheck is keyof NamedIcons =>
|
51 |
+
hasIcon &&
|
52 |
+
isString( iconToCheck ) &&
|
53 |
+
objectHasProp( namedIcons, iconToCheck ),
|
54 |
+
[ hasIcon ]
|
55 |
+
);
|
56 |
const className = classnames( 'wc-block-components-payment-method-label', {
|
57 |
'wc-block-components-payment-method-label--with-icon': hasIcon,
|
58 |
} );
|
59 |
|
60 |
return (
|
61 |
<span className={ className }>
|
62 |
+
{ hasNamedIcon( icon ) ? (
|
63 |
+
<Icon srcElement={ namedIcons[ icon ] } />
|
64 |
+
) : (
|
65 |
+
icon
|
66 |
+
) }
|
67 |
{ text }
|
68 |
</span>
|
69 |
);
|
assets/js/base/components/cart-checkout/place-order-button/{index.js → index.tsx}
RENAMED
@@ -6,7 +6,7 @@ import { useCheckoutSubmit } from '@woocommerce/base-context/hooks';
|
|
6 |
import { Icon, done } from '@woocommerce/icons';
|
7 |
import Button from '@woocommerce/base-components/button';
|
8 |
|
9 |
-
const PlaceOrderButton = () => {
|
10 |
const {
|
11 |
submitButtonText,
|
12 |
onSubmit,
|
6 |
import { Icon, done } from '@woocommerce/icons';
|
7 |
import Button from '@woocommerce/base-components/button';
|
8 |
|
9 |
+
const PlaceOrderButton = (): JSX.Element => {
|
10 |
const {
|
11 |
submitButtonText,
|
12 |
onSubmit,
|
assets/js/base/components/chip/style.scss
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
align-items: center;
|
4 |
border: 0;
|
5 |
display: inline-flex;
|
6 |
-
padding: em($gap-smallest
|
7 |
margin: 0 0.365em 0.365em 0;
|
8 |
border-radius: 0;
|
9 |
line-height: 1;
|
3 |
align-items: center;
|
4 |
border: 0;
|
5 |
display: inline-flex;
|
6 |
+
padding: em($gap-smallest * 0.5) 0.5em em($gap-smallest);
|
7 |
margin: 0 0.365em 0.365em 0;
|
8 |
border-radius: 0;
|
9 |
line-height: 1;
|
assets/js/base/components/dropdown-selector/style.scss
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
// 18px is the minimum input field line-height and 14px is the font-size of
|
2 |
// the drop down selector elements.
|
3 |
-
|
|
|
4 |
|
5 |
.wc-block-components-dropdown-selector {
|
6 |
max-width: 300px;
|
@@ -35,7 +36,7 @@ $dropdown-selector-line-height: 18/14;
|
|
35 |
.wc-block-components-dropdown-selector__input {
|
36 |
@include font-size(small);
|
37 |
line-height: $dropdown-selector-line-height;
|
38 |
-
margin: em($gap-small
|
39 |
min-width: 0;
|
40 |
padding: em($gap-smallest * 0.75) 0 em($gap-smallest * 0.75);
|
41 |
|
@@ -104,7 +105,7 @@ $dropdown-selector-line-height: 18/14;
|
|
104 |
align-items: center;
|
105 |
color: $gray-700;
|
106 |
display: inline-flex;
|
107 |
-
margin: em($gap-small
|
108 |
padding: em($gap-smallest * 0.75) 0 em($gap-smallest * 0.75);
|
109 |
width: 100%;
|
110 |
}
|
@@ -130,8 +131,8 @@ $dropdown-selector-line-height: 18/14;
|
|
130 |
|
131 |
.wc-block-components-dropdown-selector__selected-chip {
|
132 |
@include font-size(small);
|
133 |
-
margin-top: em($gap-small
|
134 |
-
margin-bottom: em($gap-small
|
135 |
line-height: $dropdown-selector-line-height;
|
136 |
}
|
137 |
}
|
1 |
// 18px is the minimum input field line-height and 14px is the font-size of
|
2 |
// the drop down selector elements.
|
3 |
+
|
4 |
+
$dropdown-selector-line-height: math.div(18, 14);
|
5 |
|
6 |
.wc-block-components-dropdown-selector {
|
7 |
max-width: 300px;
|
36 |
.wc-block-components-dropdown-selector__input {
|
37 |
@include font-size(small);
|
38 |
line-height: $dropdown-selector-line-height;
|
39 |
+
margin: em($gap-small*0.25) 0;
|
40 |
min-width: 0;
|
41 |
padding: em($gap-smallest * 0.75) 0 em($gap-smallest * 0.75);
|
42 |
|
105 |
align-items: center;
|
106 |
color: $gray-700;
|
107 |
display: inline-flex;
|
108 |
+
margin: em($gap-small*0.25) 0;
|
109 |
padding: em($gap-smallest * 0.75) 0 em($gap-smallest * 0.75);
|
110 |
width: 100%;
|
111 |
}
|
131 |
|
132 |
.wc-block-components-dropdown-selector__selected-chip {
|
133 |
@include font-size(small);
|
134 |
+
margin-top: em($gap-small*0.25);
|
135 |
+
margin-bottom: em($gap-small*0.25);
|
136 |
line-height: $dropdown-selector-line-height;
|
137 |
}
|
138 |
}
|
assets/js/{blocks/attribute-filter/label.js → base/components/filter-element-label/index.js}
RENAMED
@@ -5,13 +5,18 @@ import { _n, sprintf } from '@wordpress/i18n';
|
|
5 |
import Label from '@woocommerce/base-components/label';
|
6 |
|
7 |
/**
|
8 |
-
*
|
|
|
|
|
|
|
|
|
|
|
9 |
*
|
10 |
* @param {Object} props Incoming props for the component.
|
11 |
* @param {string} props.name The name for the label.
|
12 |
-
* @param {number} props.count The count of products this
|
13 |
*/
|
14 |
-
const
|
15 |
return (
|
16 |
<>
|
17 |
{ name }
|
@@ -30,7 +35,7 @@ const AttributeFilterLabel = ( { name, count } ) => {
|
|
30 |
) }
|
31 |
wrapperElement="span"
|
32 |
wrapperProps={ {
|
33 |
-
className: 'wc-
|
34 |
} }
|
35 |
/>
|
36 |
) }
|
@@ -38,4 +43,4 @@ const AttributeFilterLabel = ( { name, count } ) => {
|
|
38 |
);
|
39 |
};
|
40 |
|
41 |
-
export default
|
5 |
import Label from '@woocommerce/base-components/label';
|
6 |
|
7 |
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import './style.scss';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* The label for an filter elements.
|
14 |
*
|
15 |
* @param {Object} props Incoming props for the component.
|
16 |
* @param {string} props.name The name for the label.
|
17 |
+
* @param {number} props.count The count of products this status is attached to.
|
18 |
*/
|
19 |
+
const FilterElementLabel = ( { name, count } ) => {
|
20 |
return (
|
21 |
<>
|
22 |
{ name }
|
35 |
) }
|
36 |
wrapperElement="span"
|
37 |
wrapperProps={ {
|
38 |
+
className: 'wc-filter-element-label-list-count',
|
39 |
} }
|
40 |
/>
|
41 |
) }
|
43 |
);
|
44 |
};
|
45 |
|
46 |
+
export default FilterElementLabel;
|
assets/js/base/components/filter-element-label/style.scss
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-filter-element-label-list-count {
|
2 |
+
&::before {
|
3 |
+
content: " (";
|
4 |
+
}
|
5 |
+
&::after {
|
6 |
+
content: ")";
|
7 |
+
}
|
8 |
+
opacity: 0.6;
|
9 |
+
}
|
assets/js/base/components/product-list/container.js
CHANGED
@@ -9,10 +9,7 @@ import PropTypes from 'prop-types';
|
|
9 |
*/
|
10 |
import ProductList from './product-list';
|
11 |
|
12 |
-
const ProductListContainer = ( {
|
13 |
-
attributes,
|
14 |
-
hideOutOfStockItems = false,
|
15 |
-
} ) => {
|
16 |
const [ currentPage, setPage ] = useState( 1 );
|
17 |
const [ currentSort, setSort ] = useState( attributes.orderby );
|
18 |
useEffect( () => {
|
@@ -31,7 +28,6 @@ const ProductListContainer = ( {
|
|
31 |
return (
|
32 |
<ProductList
|
33 |
attributes={ attributes }
|
34 |
-
hideOutOfStockItems={ hideOutOfStockItems }
|
35 |
currentPage={ currentPage }
|
36 |
onPageChange={ onPageChange }
|
37 |
onSortChange={ onSortChange }
|
9 |
*/
|
10 |
import ProductList from './product-list';
|
11 |
|
12 |
+
const ProductListContainer = ( { attributes } ) => {
|
|
|
|
|
|
|
13 |
const [ currentPage, setPage ] = useState( 1 );
|
14 |
const [ currentSort, setSort ] = useState( attributes.orderby );
|
15 |
useEffect( () => {
|
28 |
return (
|
29 |
<ProductList
|
30 |
attributes={ attributes }
|
|
|
31 |
currentPage={ currentPage }
|
32 |
onPageChange={ onPageChange }
|
33 |
onSortChange={ onSortChange }
|
assets/js/base/components/product-list/product-list.js
CHANGED
@@ -27,12 +27,7 @@ import ProductSortSelect from './product-sort-select';
|
|
27 |
import ProductListItem from './product-list-item';
|
28 |
import './style.scss';
|
29 |
|
30 |
-
const generateQuery = ( {
|
31 |
-
sortValue,
|
32 |
-
currentPage,
|
33 |
-
attributes,
|
34 |
-
hideOutOfStockItems,
|
35 |
-
} ) => {
|
36 |
const { columns, rows } = attributes;
|
37 |
const getSortArgs = ( orderName ) => {
|
38 |
switch ( orderName ) {
|
@@ -62,9 +57,6 @@ const generateQuery = ( {
|
|
62 |
catalog_visibility: 'catalog',
|
63 |
per_page: columns * rows,
|
64 |
page: currentPage,
|
65 |
-
...( hideOutOfStockItems && {
|
66 |
-
stock_status: [ 'instock', 'onbackorder' ],
|
67 |
-
} ),
|
68 |
};
|
69 |
};
|
70 |
|
@@ -118,14 +110,24 @@ const ProductList = ( {
|
|
118 |
onSortChange,
|
119 |
sortValue,
|
120 |
scrollToTop,
|
121 |
-
hideOutOfStockItems = false,
|
122 |
} ) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
const [ queryState ] = useSynchronizedQueryState(
|
124 |
generateQuery( {
|
125 |
attributes,
|
126 |
sortValue,
|
127 |
currentPage,
|
128 |
-
hideOutOfStockItems,
|
129 |
} )
|
130 |
);
|
131 |
const { products, totalProducts, productsLoading } = useStoreProducts(
|
@@ -135,14 +137,6 @@ const ProductList = ( {
|
|
135 |
const totalQuery = extractPaginationAndSortAttributes( queryState );
|
136 |
const { dispatchStoreEvent } = useStoreEvents();
|
137 |
|
138 |
-
// These are possible filters.
|
139 |
-
const [ productAttributes, setProductAttributes ] = useQueryStateByKey(
|
140 |
-
'attributes',
|
141 |
-
[]
|
142 |
-
);
|
143 |
-
const [ minPrice, setMinPrice ] = useQueryStateByKey( 'min_price' );
|
144 |
-
const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
|
145 |
-
|
146 |
// Only update previous query totals if the query is different and the total number of products is a finite number.
|
147 |
const previousQueryTotals = usePrevious(
|
148 |
{ totalQuery, totalProducts },
|
@@ -209,6 +203,7 @@ const ProductList = ( {
|
|
209 |
const hasProducts = products.length !== 0 || productsLoading;
|
210 |
const hasFilters =
|
211 |
productAttributes.length > 0 ||
|
|
|
212 |
Number.isFinite( minPrice ) ||
|
213 |
Number.isFinite( maxPrice );
|
214 |
|
@@ -224,6 +219,7 @@ const ProductList = ( {
|
|
224 |
<NoMatchingProducts
|
225 |
resetCallback={ () => {
|
226 |
setProductAttributes( [] );
|
|
|
227 |
setMinPrice( null );
|
228 |
setMaxPrice( null );
|
229 |
} }
|
@@ -254,7 +250,6 @@ const ProductList = ( {
|
|
254 |
|
255 |
ProductList.propTypes = {
|
256 |
attributes: PropTypes.object.isRequired,
|
257 |
-
hideOutOfStockItems: PropTypes.bool,
|
258 |
// From withScrollToTop.
|
259 |
scrollToTop: PropTypes.func,
|
260 |
};
|
27 |
import ProductListItem from './product-list-item';
|
28 |
import './style.scss';
|
29 |
|
30 |
+
const generateQuery = ( { sortValue, currentPage, attributes } ) => {
|
|
|
|
|
|
|
|
|
|
|
31 |
const { columns, rows } = attributes;
|
32 |
const getSortArgs = ( orderName ) => {
|
33 |
switch ( orderName ) {
|
57 |
catalog_visibility: 'catalog',
|
58 |
per_page: columns * rows,
|
59 |
page: currentPage,
|
|
|
|
|
|
|
60 |
};
|
61 |
};
|
62 |
|
110 |
onSortChange,
|
111 |
sortValue,
|
112 |
scrollToTop,
|
|
|
113 |
} ) => {
|
114 |
+
// These are possible filters.
|
115 |
+
const [ productAttributes, setProductAttributes ] = useQueryStateByKey(
|
116 |
+
'attributes',
|
117 |
+
[]
|
118 |
+
);
|
119 |
+
const [ productStockStatus, setProductStockStatus ] = useQueryStateByKey(
|
120 |
+
'stock_status',
|
121 |
+
[]
|
122 |
+
);
|
123 |
+
const [ minPrice, setMinPrice ] = useQueryStateByKey( 'min_price' );
|
124 |
+
const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
|
125 |
+
|
126 |
const [ queryState ] = useSynchronizedQueryState(
|
127 |
generateQuery( {
|
128 |
attributes,
|
129 |
sortValue,
|
130 |
currentPage,
|
|
|
131 |
} )
|
132 |
);
|
133 |
const { products, totalProducts, productsLoading } = useStoreProducts(
|
137 |
const totalQuery = extractPaginationAndSortAttributes( queryState );
|
138 |
const { dispatchStoreEvent } = useStoreEvents();
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
// Only update previous query totals if the query is different and the total number of products is a finite number.
|
141 |
const previousQueryTotals = usePrevious(
|
142 |
{ totalQuery, totalProducts },
|
203 |
const hasProducts = products.length !== 0 || productsLoading;
|
204 |
const hasFilters =
|
205 |
productAttributes.length > 0 ||
|
206 |
+
productStockStatus.length > 0 ||
|
207 |
Number.isFinite( minPrice ) ||
|
208 |
Number.isFinite( maxPrice );
|
209 |
|
219 |
<NoMatchingProducts
|
220 |
resetCallback={ () => {
|
221 |
setProductAttributes( [] );
|
222 |
+
setProductStockStatus( [] );
|
223 |
setMinPrice( null );
|
224 |
setMaxPrice( null );
|
225 |
} }
|
250 |
|
251 |
ProductList.propTypes = {
|
252 |
attributes: PropTypes.object.isRequired,
|
|
|
253 |
// From withScrollToTop.
|
254 |
scrollToTop: PropTypes.func,
|
255 |
};
|
assets/js/base/components/product-list/product-sort-select/index.js
CHANGED
@@ -10,11 +10,10 @@ import SortSelect from '@woocommerce/base-components/sort-select';
|
|
10 |
*/
|
11 |
import './style.scss';
|
12 |
|
13 |
-
const ProductSortSelect = ( {
|
14 |
return (
|
15 |
<SortSelect
|
16 |
className="wc-block-product-sort-select wc-block-components-product-sort-select"
|
17 |
-
defaultValue={ defaultValue }
|
18 |
name="orderby"
|
19 |
onChange={ onChange }
|
20 |
options={ [
|
@@ -66,14 +65,6 @@ const ProductSortSelect = ( { defaultValue, onChange, readOnly, value } ) => {
|
|
66 |
};
|
67 |
|
68 |
ProductSortSelect.propTypes = {
|
69 |
-
defaultValue: PropTypes.oneOf( [
|
70 |
-
'menu_order',
|
71 |
-
'popularity',
|
72 |
-
'rating',
|
73 |
-
'date',
|
74 |
-
'price',
|
75 |
-
'price-desc',
|
76 |
-
] ),
|
77 |
onChange: PropTypes.func,
|
78 |
readOnly: PropTypes.bool,
|
79 |
value: PropTypes.oneOf( [
|
10 |
*/
|
11 |
import './style.scss';
|
12 |
|
13 |
+
const ProductSortSelect = ( { onChange, readOnly, value } ) => {
|
14 |
return (
|
15 |
<SortSelect
|
16 |
className="wc-block-product-sort-select wc-block-components-product-sort-select"
|
|
|
17 |
name="orderby"
|
18 |
onChange={ onChange }
|
19 |
options={ [
|
65 |
};
|
66 |
|
67 |
ProductSortSelect.propTypes = {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
onChange: PropTypes.func,
|
69 |
readOnly: PropTypes.bool,
|
70 |
value: PropTypes.oneOf( [
|
assets/js/base/components/product-list/style.scss
CHANGED
@@ -37,7 +37,7 @@
|
|
37 |
display: flex;
|
38 |
flex-wrap: wrap;
|
39 |
padding: 0;
|
40 |
-
margin: 0 (-$gap
|
41 |
background-clip: padding-box;
|
42 |
}
|
43 |
|
@@ -49,8 +49,8 @@
|
|
49 |
width: auto;
|
50 |
position: relative;
|
51 |
text-align: center;
|
52 |
-
border-left: $gap
|
53 |
-
border-right: $gap
|
54 |
border-bottom: $gap solid transparent;
|
55 |
list-style: none;
|
56 |
}
|
@@ -75,8 +75,8 @@
|
|
75 |
}
|
76 |
@for $i from 1 to 9 {
|
77 |
&.has-#{$i}-columns .wc-block-grid__product {
|
78 |
-
flex: 1 0 calc(#{ 100
|
79 |
-
max-width: 100
|
80 |
}
|
81 |
}
|
82 |
// Adjust font size as more cols are added.
|
@@ -130,12 +130,12 @@
|
|
130 |
margin: 0 0 $gap-large 0;
|
131 |
}
|
132 |
.wc-block-grid__product:nth-child(odd) {
|
133 |
-
padding-right: $gap
|
134 |
}
|
135 |
.wc-block-grid__product:nth-child(even) {
|
136 |
-
padding-left: $gap
|
137 |
.wc-block-grid__product-onsale {
|
138 |
-
left: $gap
|
139 |
}
|
140 |
}
|
141 |
}
|
37 |
display: flex;
|
38 |
flex-wrap: wrap;
|
39 |
padding: 0;
|
40 |
+
margin: 0 (-$gap*0.5) $gap;
|
41 |
background-clip: padding-box;
|
42 |
}
|
43 |
|
49 |
width: auto;
|
50 |
position: relative;
|
51 |
text-align: center;
|
52 |
+
border-left: $gap*0.5 solid transparent;
|
53 |
+
border-right: $gap*0.5 solid transparent;
|
54 |
border-bottom: $gap solid transparent;
|
55 |
list-style: none;
|
56 |
}
|
75 |
}
|
76 |
@for $i from 1 to 9 {
|
77 |
&.has-#{$i}-columns .wc-block-grid__product {
|
78 |
+
flex: 1 0 calc(#{ math.div(100%, $i) });
|
79 |
+
max-width: math.div(100%, $i);
|
80 |
}
|
81 |
}
|
82 |
// Adjust font size as more cols are added.
|
130 |
margin: 0 0 $gap-large 0;
|
131 |
}
|
132 |
.wc-block-grid__product:nth-child(odd) {
|
133 |
+
padding-right: $gap*0.5;
|
134 |
}
|
135 |
.wc-block-grid__product:nth-child(even) {
|
136 |
+
padding-left: $gap*0.5;
|
137 |
.wc-block-grid__product-onsale {
|
138 |
+
left: $gap*0.5;
|
139 |
}
|
140 |
}
|
141 |
}
|
assets/js/base/components/reviews/review-list-item/style.scss
CHANGED
@@ -122,14 +122,14 @@
|
|
122 |
display: block;
|
123 |
font-weight: bold;
|
124 |
order: 1;
|
125 |
-
margin-right: $gap
|
126 |
}
|
127 |
|
128 |
.wc-block-components-review-list-item__author {
|
129 |
display: block;
|
130 |
font-weight: bold;
|
131 |
order: 1;
|
132 |
-
margin-right: $gap
|
133 |
}
|
134 |
|
135 |
.wc-block-components-review-list-item__product + .wc-block-components-review-list-item__author {
|
@@ -147,7 +147,7 @@
|
|
147 |
&::before {
|
148 |
content: "";
|
149 |
display: inline-block;
|
150 |
-
margin-right: $gap
|
151 |
border-right: 1px solid #ddd;
|
152 |
height: 1em;
|
153 |
vertical-align: middle;
|
122 |
display: block;
|
123 |
font-weight: bold;
|
124 |
order: 1;
|
125 |
+
margin-right: $gap*0.5;
|
126 |
}
|
127 |
|
128 |
.wc-block-components-review-list-item__author {
|
129 |
display: block;
|
130 |
font-weight: bold;
|
131 |
order: 1;
|
132 |
+
margin-right: $gap*0.5;
|
133 |
}
|
134 |
|
135 |
.wc-block-components-review-list-item__product + .wc-block-components-review-list-item__author {
|
147 |
&::before {
|
148 |
content: "";
|
149 |
display: inline-block;
|
150 |
+
margin-right: $gap*0.5;
|
151 |
border-right: 1px solid #ddd;
|
152 |
height: 1em;
|
153 |
vertical-align: middle;
|
assets/js/base/components/reviews/review-sort-select/index.js
CHANGED
@@ -10,11 +10,10 @@ import SortSelect from '@woocommerce/base-components/sort-select';
|
|
10 |
*/
|
11 |
import './style.scss';
|
12 |
|
13 |
-
const ReviewSortSelect = ( {
|
14 |
return (
|
15 |
<SortSelect
|
16 |
className="wc-block-review-sort-select wc-block-components-review-sort-select"
|
17 |
-
defaultValue={ defaultValue }
|
18 |
label={ __( 'Order by', 'woo-gutenberg-products-block' ) }
|
19 |
onChange={ onChange }
|
20 |
options={ [
|
@@ -48,11 +47,6 @@ const ReviewSortSelect = ( { defaultValue, onChange, readOnly, value } ) => {
|
|
48 |
};
|
49 |
|
50 |
ReviewSortSelect.propTypes = {
|
51 |
-
defaultValue: PropTypes.oneOf( [
|
52 |
-
'most-recent',
|
53 |
-
'highest-rating',
|
54 |
-
'lowest-rating',
|
55 |
-
] ),
|
56 |
onChange: PropTypes.func,
|
57 |
readOnly: PropTypes.bool,
|
58 |
value: PropTypes.oneOf( [
|
10 |
*/
|
11 |
import './style.scss';
|
12 |
|
13 |
+
const ReviewSortSelect = ( { onChange, readOnly, value } ) => {
|
14 |
return (
|
15 |
<SortSelect
|
16 |
className="wc-block-review-sort-select wc-block-components-review-sort-select"
|
|
|
17 |
label={ __( 'Order by', 'woo-gutenberg-products-block' ) }
|
18 |
onChange={ onChange }
|
19 |
options={ [
|
47 |
};
|
48 |
|
49 |
ReviewSortSelect.propTypes = {
|
|
|
|
|
|
|
|
|
|
|
50 |
onChange: PropTypes.func,
|
51 |
readOnly: PropTypes.bool,
|
52 |
value: PropTypes.oneOf( [
|
assets/js/base/components/sidebar-layout/style.scss
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
.wc-block-components-main {
|
8 |
box-sizing: border-box;
|
9 |
margin: 0;
|
10 |
-
padding-right: percentage($gap-largest
|
11 |
width: 65%;
|
12 |
}
|
13 |
}
|
@@ -15,7 +15,7 @@
|
|
15 |
.wc-block-components-sidebar {
|
16 |
box-sizing: border-box;
|
17 |
margin: 0;
|
18 |
-
padding-left: percentage($gap-large
|
19 |
width: 35%;
|
20 |
|
21 |
.wc-block-components-panel > h2 {
|
7 |
.wc-block-components-main {
|
8 |
box-sizing: border-box;
|
9 |
margin: 0;
|
10 |
+
padding-right: percentage(math.div($gap-largest, 1060px)); // ~1060px is the default width of the content area in Storefront.
|
11 |
width: 65%;
|
12 |
}
|
13 |
}
|
15 |
.wc-block-components-sidebar {
|
16 |
box-sizing: border-box;
|
17 |
margin: 0;
|
18 |
+
padding-left: percentage(math.div($gap-large, 1060px));
|
19 |
width: 35%;
|
20 |
|
21 |
.wc-block-components-panel > h2 {
|
assets/js/base/components/sort-select/index.js
CHANGED
@@ -18,7 +18,6 @@ import './style.scss';
|
|
18 |
* @param {Object} props Incoming props for the component.
|
19 |
* @param {string} props.className CSS class used.
|
20 |
* @param {string} props.instanceId Unique id for component instance.
|
21 |
-
* @param {string} props.defaultValue Default value for the select.
|
22 |
* @param {string} props.label Label for the select.
|
23 |
* @param {function():any} props.onChange Function to call on the change event.
|
24 |
* @param {Array} props.options Option values for the select.
|
@@ -29,7 +28,6 @@ import './style.scss';
|
|
29 |
const SortSelect = ( {
|
30 |
className,
|
31 |
instanceId,
|
32 |
-
defaultValue,
|
33 |
label,
|
34 |
onChange,
|
35 |
options,
|
@@ -60,7 +58,6 @@ const SortSelect = ( {
|
|
60 |
<select // eslint-disable-line jsx-a11y/no-onchange
|
61 |
id={ selectId }
|
62 |
className="wc-block-sort-select__select wc-block-components-sort-select__select"
|
63 |
-
defaultValue={ defaultValue }
|
64 |
onChange={ onChange }
|
65 |
readOnly={ readOnly }
|
66 |
value={ value }
|
@@ -76,7 +73,6 @@ const SortSelect = ( {
|
|
76 |
};
|
77 |
|
78 |
SortSelect.propTypes = {
|
79 |
-
defaultValue: PropTypes.string,
|
80 |
label: PropTypes.string,
|
81 |
onChange: PropTypes.func,
|
82 |
options: PropTypes.arrayOf(
|
18 |
* @param {Object} props Incoming props for the component.
|
19 |
* @param {string} props.className CSS class used.
|
20 |
* @param {string} props.instanceId Unique id for component instance.
|
|
|
21 |
* @param {string} props.label Label for the select.
|
22 |
* @param {function():any} props.onChange Function to call on the change event.
|
23 |
* @param {Array} props.options Option values for the select.
|
28 |
const SortSelect = ( {
|
29 |
className,
|
30 |
instanceId,
|
|
|
31 |
label,
|
32 |
onChange,
|
33 |
options,
|
58 |
<select // eslint-disable-line jsx-a11y/no-onchange
|
59 |
id={ selectId }
|
60 |
className="wc-block-sort-select__select wc-block-components-sort-select__select"
|
|
|
61 |
onChange={ onChange }
|
62 |
readOnly={ readOnly }
|
63 |
value={ value }
|
73 |
};
|
74 |
|
75 |
SortSelect.propTypes = {
|
|
|
76 |
label: PropTypes.string,
|
77 |
onChange: PropTypes.func,
|
78 |
options: PropTypes.arrayOf(
|
assets/js/base/context/hooks/collections/use-collection-data.js
CHANGED
@@ -36,6 +36,7 @@ const buildCollectionDataQuery = ( collectionDataQueryState ) => {
|
|
36 |
export const useCollectionData = ( {
|
37 |
queryAttribute,
|
38 |
queryPrices,
|
|
|
39 |
queryState,
|
40 |
} ) => {
|
41 |
let context = useQueryStateContext();
|
@@ -50,9 +51,14 @@ export const useCollectionData = ( {
|
|
50 |
calculatePriceRangeQueryState,
|
51 |
setCalculatePriceRangeQueryState,
|
52 |
] = useQueryStateByKey( 'calculate_price_range', null, context );
|
|
|
|
|
|
|
|
|
53 |
|
54 |
const currentQueryAttribute = useShallowEqual( queryAttribute || {} );
|
55 |
const currentQueryPrices = useShallowEqual( queryPrices );
|
|
|
56 |
|
57 |
useEffect( () => {
|
58 |
if (
|
@@ -93,6 +99,19 @@ export const useCollectionData = ( {
|
|
93 |
calculatePriceRangeQueryState,
|
94 |
] );
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
// Defer the select query so all collection-data query vars can be gathered.
|
97 |
const [ shouldSelect, setShouldSelect ] = useState( false );
|
98 |
const [ debouncedShouldSelect ] = useDebounce( shouldSelect, 200 );
|
36 |
export const useCollectionData = ( {
|
37 |
queryAttribute,
|
38 |
queryPrices,
|
39 |
+
queryStock,
|
40 |
queryState,
|
41 |
} ) => {
|
42 |
let context = useQueryStateContext();
|
51 |
calculatePriceRangeQueryState,
|
52 |
setCalculatePriceRangeQueryState,
|
53 |
] = useQueryStateByKey( 'calculate_price_range', null, context );
|
54 |
+
const [
|
55 |
+
calculateStockStatusQueryState,
|
56 |
+
setCalculateStockStatusQueryState,
|
57 |
+
] = useQueryStateByKey( 'calculate_stock_status_counts', null, context );
|
58 |
|
59 |
const currentQueryAttribute = useShallowEqual( queryAttribute || {} );
|
60 |
const currentQueryPrices = useShallowEqual( queryPrices );
|
61 |
+
const currentQueryStock = useShallowEqual( queryStock );
|
62 |
|
63 |
useEffect( () => {
|
64 |
if (
|
99 |
calculatePriceRangeQueryState,
|
100 |
] );
|
101 |
|
102 |
+
useEffect( () => {
|
103 |
+
if (
|
104 |
+
calculateStockStatusQueryState !== currentQueryStock &&
|
105 |
+
currentQueryStock !== undefined
|
106 |
+
) {
|
107 |
+
setCalculateStockStatusQueryState( currentQueryStock );
|
108 |
+
}
|
109 |
+
}, [
|
110 |
+
currentQueryStock,
|
111 |
+
setCalculateStockStatusQueryState,
|
112 |
+
calculateStockStatusQueryState,
|
113 |
+
] );
|
114 |
+
|
115 |
// Defer the select query so all collection-data query vars can be gathered.
|
116 |
const [ shouldSelect, setShouldSelect ] = useState( false );
|
117 |
const [ debouncedShouldSelect ] = useDebounce( shouldSelect, 200 );
|
assets/js/base/context/hooks/index.js
CHANGED
@@ -12,3 +12,4 @@ export * from './use-checkout-address';
|
|
12 |
export * from './use-checkout-notices';
|
13 |
export * from './use-checkout-submit';
|
14 |
export * from './use-emit-response';
|
|
12 |
export * from './use-checkout-notices';
|
13 |
export * from './use-checkout-submit';
|
14 |
export * from './use-emit-response';
|
15 |
+
export * from './use-checkout-extension-data';
|
assets/js/base/context/hooks/use-checkout-extension-data.ts
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { useCallback, useEffect, useRef } from '@wordpress/element';
|
5 |
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import { useCheckoutContext } from '../providers/cart-checkout/checkout-state';
|
11 |
+
import type { CheckoutStateContextState } from '../providers/cart-checkout/checkout-state/types';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Custom hook for setting custom checkout data which is passed to the wc/store/checkout endpoint when processing orders.
|
15 |
+
*/
|
16 |
+
export const useCheckoutExtensionData = (): {
|
17 |
+
extensionData: CheckoutStateContextState[ 'extensionData' ];
|
18 |
+
setExtensionData: (
|
19 |
+
namespace: string,
|
20 |
+
key: string,
|
21 |
+
value: unknown
|
22 |
+
) => void;
|
23 |
+
} => {
|
24 |
+
const { dispatchActions, extensionData } = useCheckoutContext();
|
25 |
+
const extensionDataRef = useRef( extensionData );
|
26 |
+
|
27 |
+
useEffect( () => {
|
28 |
+
if ( ! isShallowEqual( extensionData, extensionDataRef.current ) ) {
|
29 |
+
extensionDataRef.current = extensionData;
|
30 |
+
}
|
31 |
+
}, [ extensionData ] );
|
32 |
+
|
33 |
+
const setExtensionDataWithNamespace = useCallback(
|
34 |
+
( namespace, key, value ) => {
|
35 |
+
const currentData = extensionDataRef.current[ namespace ] || {};
|
36 |
+
dispatchActions.setExtensionData( {
|
37 |
+
...extensionDataRef.current,
|
38 |
+
[ namespace ]: {
|
39 |
+
...currentData,
|
40 |
+
[ key ]: value,
|
41 |
+
},
|
42 |
+
} );
|
43 |
+
},
|
44 |
+
[ dispatchActions ]
|
45 |
+
);
|
46 |
+
|
47 |
+
return {
|
48 |
+
extensionData: extensionDataRef.current,
|
49 |
+
setExtensionData: setExtensionDataWithNamespace,
|
50 |
+
};
|
51 |
+
};
|
assets/js/base/context/providers/cart-checkout/cart/index.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
-
import { CheckoutProvider } from '../checkout';
|
5 |
|
6 |
/**
|
7 |
* Cart provider
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
+
import { CheckoutProvider } from '../checkout-provider';
|
5 |
|
6 |
/**
|
7 |
* Cart provider
|
assets/js/base/context/providers/cart-checkout/{checkout/processor/index.js → checkout-processor.js}
RENAMED
@@ -18,20 +18,18 @@ import {
|
|
18 |
/**
|
19 |
* Internal dependencies
|
20 |
*/
|
21 |
-
import { preparePaymentData } from './utils';
|
22 |
-
import { useCheckoutContext } from '
|
23 |
-
import { useShippingDataContext } from '
|
24 |
-
import { useCustomerDataContext } from '
|
25 |
-
import { usePaymentMethodDataContext } from '
|
26 |
-
import { useValidationContext } from '
|
27 |
-
import { useStoreCart } from '
|
28 |
-
import { useStoreNotices } from '
|
29 |
|
30 |
/**
|
31 |
* CheckoutProcessor component.
|
32 |
*
|
33 |
-
* @todo Needs to consume all contexts.
|
34 |
-
*
|
35 |
* Subscribes to checkout context and triggers processing via the API.
|
36 |
*/
|
37 |
const CheckoutProcessor = () => {
|
@@ -45,6 +43,7 @@ const CheckoutProcessor = () => {
|
|
45 |
isComplete: checkoutIsComplete,
|
46 |
orderNotes,
|
47 |
shouldCreateAccount,
|
|
|
48 |
} = useCheckoutContext();
|
49 |
const { hasValidationErrors } = useValidationContext();
|
50 |
const { shippingErrorStatus } = useShippingDataContext();
|
@@ -75,11 +74,18 @@ const CheckoutProcessor = () => {
|
|
75 |
currentPaymentStatus.hasError ||
|
76 |
shippingErrorStatus.hasError;
|
77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
// If express payment method is active, let's suppress notices
|
79 |
useEffect( () => {
|
80 |
setIsSuppressed( isExpressPaymentMethodActive );
|
81 |
}, [ isExpressPaymentMethodActive, setIsSuppressed ] );
|
82 |
|
|
|
83 |
useEffect( () => {
|
84 |
if (
|
85 |
checkoutWillHaveError !== checkoutHasError &&
|
@@ -97,12 +103,6 @@ const CheckoutProcessor = () => {
|
|
97 |
dispatchActions,
|
98 |
] );
|
99 |
|
100 |
-
const paidAndWithoutErrors =
|
101 |
-
! checkoutHasError &&
|
102 |
-
! checkoutWillHaveError &&
|
103 |
-
( currentPaymentStatus.isSuccessful || ! cartNeedsPayment ) &&
|
104 |
-
checkoutIsProcessing;
|
105 |
-
|
106 |
useEffect( () => {
|
107 |
currentBillingData.current = billingData;
|
108 |
currentShippingAddress.current = shippingAddress;
|
@@ -156,10 +156,32 @@ const CheckoutProcessor = () => {
|
|
156 |
isExpressPaymentMethodActive,
|
157 |
] );
|
158 |
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
setIsProcessingOrder( true );
|
161 |
removeNotice( 'checkout' );
|
162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
billing_address: emptyHiddenAddressFields(
|
164 |
currentBillingData.current
|
165 |
),
|
@@ -168,18 +190,10 @@ const CheckoutProcessor = () => {
|
|
168 |
),
|
169 |
customer_note: orderNotes,
|
170 |
should_create_account: shouldCreateAccount,
|
|
|
|
|
171 |
};
|
172 |
-
|
173 |
-
data = {
|
174 |
-
...data,
|
175 |
-
payment_method: paymentMethodId,
|
176 |
-
payment_data: preparePaymentData(
|
177 |
-
paymentMethodData,
|
178 |
-
shouldSavePayment,
|
179 |
-
activePaymentMethod
|
180 |
-
),
|
181 |
-
};
|
182 |
-
}
|
183 |
triggerFetch( {
|
184 |
path: '/wc/store/checkout',
|
185 |
method: 'POST',
|
@@ -187,43 +201,26 @@ const CheckoutProcessor = () => {
|
|
187 |
cache: 'no-store',
|
188 |
parse: false,
|
189 |
} )
|
190 |
-
.then( (
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
// Update user using headers.
|
195 |
-
dispatchActions.setCustomerId(
|
196 |
-
fetchResponse.headers.get( 'X-WC-Store-API-User' )
|
197 |
);
|
198 |
-
|
199 |
-
|
200 |
-
fetchResponse.json().then( function ( response ) {
|
201 |
-
if ( ! fetchResponse.ok ) {
|
202 |
-
// We received an error response.
|
203 |
-
addErrorNotice(
|
204 |
-
formatStoreApiErrorMessage( response ),
|
205 |
-
{
|
206 |
-
id: 'checkout',
|
207 |
-
}
|
208 |
-
);
|
209 |
-
dispatchActions.setHasError();
|
210 |
-
}
|
211 |
-
dispatchActions.setAfterProcessing( response );
|
212 |
-
setIsProcessingOrder( false );
|
213 |
-
} );
|
214 |
-
} )
|
215 |
-
.catch( ( errorResponse ) => {
|
216 |
-
// Update nonce.
|
217 |
-
triggerFetch.setNonce( errorResponse.headers );
|
218 |
-
|
219 |
-
// If new customer ID returned, update the store.
|
220 |
-
if ( errorResponse.headers?.get( 'X-WC-Store-API-User' ) ) {
|
221 |
-
dispatchActions.setCustomerId(
|
222 |
-
errorResponse.headers.get( 'X-WC-Store-API-User' )
|
223 |
-
);
|
224 |
}
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
// If updated cart state was returned, update the store.
|
228 |
if ( response.data?.cart ) {
|
229 |
receiveCart( response.data.cart );
|
@@ -231,7 +228,6 @@ const CheckoutProcessor = () => {
|
|
231 |
addErrorNotice( formatStoreApiErrorMessage( response ), {
|
232 |
id: 'checkout',
|
233 |
} );
|
234 |
-
|
235 |
response.additional_errors?.forEach?.(
|
236 |
( additionalError ) => {
|
237 |
addErrorNotice( additionalError.message, {
|
@@ -239,31 +235,26 @@ const CheckoutProcessor = () => {
|
|
239 |
} );
|
240 |
}
|
241 |
);
|
242 |
-
|
243 |
-
dispatchActions.setHasError();
|
244 |
dispatchActions.setAfterProcessing( response );
|
245 |
setIsProcessingOrder( false );
|
246 |
} );
|
247 |
} );
|
248 |
}, [
|
249 |
-
|
250 |
removeNotice,
|
|
|
|
|
|
|
251 |
paymentMethodId,
|
252 |
-
activePaymentMethod,
|
253 |
paymentMethodData,
|
254 |
shouldSavePayment,
|
255 |
-
|
256 |
-
|
257 |
dispatchActions,
|
258 |
-
|
259 |
-
|
260 |
] );
|
261 |
-
// redirect when checkout is complete and there is a redirect url.
|
262 |
-
useEffect( () => {
|
263 |
-
if ( currentRedirectUrl.current ) {
|
264 |
-
window.location.href = currentRedirectUrl.current;
|
265 |
-
}
|
266 |
-
}, [ checkoutIsComplete ] );
|
267 |
|
268 |
// process order if conditions are good.
|
269 |
useEffect( () => {
|
18 |
/**
|
19 |
* Internal dependencies
|
20 |
*/
|
21 |
+
import { preparePaymentData, processCheckoutResponseHeaders } from './utils';
|
22 |
+
import { useCheckoutContext } from './checkout-state';
|
23 |
+
import { useShippingDataContext } from './shipping';
|
24 |
+
import { useCustomerDataContext } from './customer';
|
25 |
+
import { usePaymentMethodDataContext } from './payment-methods';
|
26 |
+
import { useValidationContext } from '../validation';
|
27 |
+
import { useStoreCart } from '../../hooks/cart/use-store-cart';
|
28 |
+
import { useStoreNotices } from '../../hooks/use-store-notices';
|
29 |
|
30 |
/**
|
31 |
* CheckoutProcessor component.
|
32 |
*
|
|
|
|
|
33 |
* Subscribes to checkout context and triggers processing via the API.
|
34 |
*/
|
35 |
const CheckoutProcessor = () => {
|
43 |
isComplete: checkoutIsComplete,
|
44 |
orderNotes,
|
45 |
shouldCreateAccount,
|
46 |
+
extensionData,
|
47 |
} = useCheckoutContext();
|
48 |
const { hasValidationErrors } = useValidationContext();
|
49 |
const { shippingErrorStatus } = useShippingDataContext();
|
74 |
currentPaymentStatus.hasError ||
|
75 |
shippingErrorStatus.hasError;
|
76 |
|
77 |
+
const paidAndWithoutErrors =
|
78 |
+
! checkoutHasError &&
|
79 |
+
! checkoutWillHaveError &&
|
80 |
+
( currentPaymentStatus.isSuccessful || ! cartNeedsPayment ) &&
|
81 |
+
checkoutIsProcessing;
|
82 |
+
|
83 |
// If express payment method is active, let's suppress notices
|
84 |
useEffect( () => {
|
85 |
setIsSuppressed( isExpressPaymentMethodActive );
|
86 |
}, [ isExpressPaymentMethodActive, setIsSuppressed ] );
|
87 |
|
88 |
+
// Determine if checkout has an error.
|
89 |
useEffect( () => {
|
90 |
if (
|
91 |
checkoutWillHaveError !== checkoutHasError &&
|
103 |
dispatchActions,
|
104 |
] );
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
useEffect( () => {
|
107 |
currentBillingData.current = billingData;
|
108 |
currentShippingAddress.current = shippingAddress;
|
156 |
isExpressPaymentMethodActive,
|
157 |
] );
|
158 |
|
159 |
+
// redirect when checkout is complete and there is a redirect url.
|
160 |
+
useEffect( () => {
|
161 |
+
if ( currentRedirectUrl.current ) {
|
162 |
+
window.location.href = currentRedirectUrl.current;
|
163 |
+
}
|
164 |
+
}, [ checkoutIsComplete ] );
|
165 |
+
|
166 |
+
const processOrder = useCallback( async () => {
|
167 |
+
if ( isProcessingOrder ) {
|
168 |
+
return;
|
169 |
+
}
|
170 |
setIsProcessingOrder( true );
|
171 |
removeNotice( 'checkout' );
|
172 |
+
|
173 |
+
const paymentData = cartNeedsPayment
|
174 |
+
? {
|
175 |
+
payment_method: paymentMethodId,
|
176 |
+
payment_data: preparePaymentData(
|
177 |
+
paymentMethodData,
|
178 |
+
shouldSavePayment,
|
179 |
+
activePaymentMethod
|
180 |
+
),
|
181 |
+
}
|
182 |
+
: {};
|
183 |
+
|
184 |
+
const data = {
|
185 |
billing_address: emptyHiddenAddressFields(
|
186 |
currentBillingData.current
|
187 |
),
|
190 |
),
|
191 |
customer_note: orderNotes,
|
192 |
should_create_account: shouldCreateAccount,
|
193 |
+
...paymentData,
|
194 |
+
extensions: { ...extensionData },
|
195 |
};
|
196 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
triggerFetch( {
|
198 |
path: '/wc/store/checkout',
|
199 |
method: 'POST',
|
201 |
cache: 'no-store',
|
202 |
parse: false,
|
203 |
} )
|
204 |
+
.then( ( response ) => {
|
205 |
+
processCheckoutResponseHeaders(
|
206 |
+
response.headers,
|
207 |
+
dispatchActions
|
|
|
|
|
|
|
208 |
);
|
209 |
+
if ( ! response.ok ) {
|
210 |
+
throw new Error( response );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
}
|
212 |
+
return response.json();
|
213 |
+
} )
|
214 |
+
.then( ( response ) => {
|
215 |
+
dispatchActions.setAfterProcessing( response );
|
216 |
+
setIsProcessingOrder( false );
|
217 |
+
} )
|
218 |
+
.catch( ( fetchResponse ) => {
|
219 |
+
processCheckoutResponseHeaders(
|
220 |
+
fetchResponse.headers,
|
221 |
+
dispatchActions
|
222 |
+
);
|
223 |
+
fetchResponse.json().then( ( response ) => {
|
224 |
// If updated cart state was returned, update the store.
|
225 |
if ( response.data?.cart ) {
|
226 |
receiveCart( response.data.cart );
|
228 |
addErrorNotice( formatStoreApiErrorMessage( response ), {
|
229 |
id: 'checkout',
|
230 |
} );
|
|
|
231 |
response.additional_errors?.forEach?.(
|
232 |
( additionalError ) => {
|
233 |
addErrorNotice( additionalError.message, {
|
235 |
} );
|
236 |
}
|
237 |
);
|
238 |
+
dispatchActions.setHasError( true );
|
|
|
239 |
dispatchActions.setAfterProcessing( response );
|
240 |
setIsProcessingOrder( false );
|
241 |
} );
|
242 |
} );
|
243 |
}, [
|
244 |
+
isProcessingOrder,
|
245 |
removeNotice,
|
246 |
+
orderNotes,
|
247 |
+
shouldCreateAccount,
|
248 |
+
cartNeedsPayment,
|
249 |
paymentMethodId,
|
|
|
250 |
paymentMethodData,
|
251 |
shouldSavePayment,
|
252 |
+
activePaymentMethod,
|
253 |
+
extensionData,
|
254 |
dispatchActions,
|
255 |
+
addErrorNotice,
|
256 |
+
receiveCart,
|
257 |
] );
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
// process order if conditions are good.
|
260 |
useEffect( () => {
|
assets/js/base/context/providers/cart-checkout/{checkout/index.js → checkout-provider.js}
RENAMED
@@ -7,11 +7,11 @@ import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundar
|
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
-
import { PaymentMethodDataProvider } from '
|
11 |
-
import { ShippingDataProvider } from '
|
12 |
-
import { CustomerDataProvider } from '
|
13 |
-
import { CheckoutStateProvider } from '
|
14 |
-
import CheckoutProcessor from './processor';
|
15 |
|
16 |
/**
|
17 |
* Checkout provider
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
+
import { PaymentMethodDataProvider } from './payment-methods';
|
11 |
+
import { ShippingDataProvider } from './shipping';
|
12 |
+
import { CustomerDataProvider } from './customer';
|
13 |
+
import { CheckoutStateProvider } from './checkout-state';
|
14 |
+
import CheckoutProcessor from './checkout-processor';
|
15 |
|
16 |
/**
|
17 |
* Checkout provider
|
assets/js/base/context/providers/cart-checkout/checkout-state/actions.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
-
import type { PaymentResultDataType } from './types';
|
5 |
|
6 |
export enum ACTION {
|
7 |
SET_IDLE = 'set_idle',
|
@@ -20,20 +20,15 @@ export enum ACTION {
|
|
20 |
INCREMENT_CALCULATING = 'increment_calculating',
|
21 |
DECREMENT_CALCULATING = 'decrement_calculating',
|
22 |
SET_SHOULD_CREATE_ACCOUNT = 'set_should_create_account',
|
|
|
23 |
}
|
24 |
|
25 |
-
export interface ActionType {
|
26 |
type: ACTION;
|
27 |
data?:
|
28 |
| Record< string, unknown >
|
29 |
| Record< string, never >
|
30 |
| PaymentResultDataType;
|
31 |
-
url?: string;
|
32 |
-
customerId?: number;
|
33 |
-
orderId?: number;
|
34 |
-
shouldCreateAccount?: boolean;
|
35 |
-
hasError?: boolean;
|
36 |
-
orderNotes?: string;
|
37 |
}
|
38 |
|
39 |
/**
|
@@ -52,10 +47,10 @@ export const actions = {
|
|
52 |
( {
|
53 |
type: ACTION.SET_PROCESSING,
|
54 |
} as const ),
|
55 |
-
setRedirectUrl: (
|
56 |
( {
|
57 |
type: ACTION.SET_REDIRECT_URL,
|
58 |
-
|
59 |
} as const ),
|
60 |
setProcessingResponse: ( data: PaymentResultDataType ) =>
|
61 |
( {
|
@@ -107,4 +102,11 @@ export const actions = {
|
|
107 |
type: ACTION.SET_ORDER_NOTES,
|
108 |
orderNotes,
|
109 |
} as const ),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
};
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
4 |
+
import type { PaymentResultDataType, CheckoutStateContextState } from './types';
|
5 |
|
6 |
export enum ACTION {
|
7 |
SET_IDLE = 'set_idle',
|
20 |
INCREMENT_CALCULATING = 'increment_calculating',
|
21 |
DECREMENT_CALCULATING = 'decrement_calculating',
|
22 |
SET_SHOULD_CREATE_ACCOUNT = 'set_should_create_account',
|
23 |
+
SET_EXTENSION_DATA = 'set_extension_data',
|
24 |
}
|
25 |
|
26 |
+
export interface ActionType extends Partial< CheckoutStateContextState > {
|
27 |
type: ACTION;
|
28 |
data?:
|
29 |
| Record< string, unknown >
|
30 |
| Record< string, never >
|
31 |
| PaymentResultDataType;
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
/**
|
47 |
( {
|
48 |
type: ACTION.SET_PROCESSING,
|
49 |
} as const ),
|
50 |
+
setRedirectUrl: ( redirectUrl: string ) =>
|
51 |
( {
|
52 |
type: ACTION.SET_REDIRECT_URL,
|
53 |
+
redirectUrl,
|
54 |
} as const ),
|
55 |
setProcessingResponse: ( data: PaymentResultDataType ) =>
|
56 |
( {
|
102 |
type: ACTION.SET_ORDER_NOTES,
|
103 |
orderNotes,
|
104 |
} as const ),
|
105 |
+
setExtensionData: (
|
106 |
+
extensionData: Record< string, Record< string, unknown > >
|
107 |
+
) =>
|
108 |
+
( {
|
109 |
+
type: ACTION.SET_EXTENSION_DATA,
|
110 |
+
extensionData,
|
111 |
+
} as const ),
|
112 |
};
|
assets/js/base/context/providers/cart-checkout/checkout-state/constants.ts
CHANGED
@@ -48,6 +48,7 @@ export const DEFAULT_CHECKOUT_STATE_DATA: CheckoutStateContextType = {
|
|
48 |
setCustomerId: ( id ) => void id,
|
49 |
setOrderId: ( id ) => void id,
|
50 |
setOrderNotes: ( orderNotes ) => void orderNotes,
|
|
|
51 |
},
|
52 |
onSubmit: () => void null,
|
53 |
isComplete: false,
|
@@ -69,6 +70,7 @@ export const DEFAULT_CHECKOUT_STATE_DATA: CheckoutStateContextType = {
|
|
69 |
isCart: false,
|
70 |
shouldCreateAccount: false,
|
71 |
setShouldCreateAccount: ( value ) => void value,
|
|
|
72 |
};
|
73 |
|
74 |
export const DEFAULT_STATE: CheckoutStateContextState = {
|
@@ -81,4 +83,5 @@ export const DEFAULT_STATE: CheckoutStateContextState = {
|
|
81 |
customerId: checkoutData.customer_id,
|
82 |
shouldCreateAccount: false,
|
83 |
processingResponse: null,
|
|
|
84 |
};
|
48 |
setCustomerId: ( id ) => void id,
|
49 |
setOrderId: ( id ) => void id,
|
50 |
setOrderNotes: ( orderNotes ) => void orderNotes,
|
51 |
+
setExtensionData: ( extensionData ) => void extensionData,
|
52 |
},
|
53 |
onSubmit: () => void null,
|
54 |
isComplete: false,
|
70 |
isCart: false,
|
71 |
shouldCreateAccount: false,
|
72 |
setShouldCreateAccount: ( value ) => void value,
|
73 |
+
extensionData: {},
|
74 |
};
|
75 |
|
76 |
export const DEFAULT_STATE: CheckoutStateContextState = {
|
83 |
customerId: checkoutData.customer_id,
|
84 |
shouldCreateAccount: false,
|
85 |
processingResponse: null,
|
86 |
+
extensionData: {},
|
87 |
};
|
assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx
CHANGED
@@ -142,6 +142,8 @@ export const CheckoutStateProvider = ( {
|
|
142 |
void dispatch( actions.setOrderId( orderId ) ),
|
143 |
setOrderNotes: ( orderNotes ) =>
|
144 |
void dispatch( actions.setOrderNotes( orderNotes ) ),
|
|
|
|
|
145 |
setAfterProcessing: ( response ) => {
|
146 |
const paymentResult = getPaymentResultFromCheckoutResponse(
|
147 |
response
|
@@ -385,6 +387,7 @@ export const CheckoutStateProvider = ( {
|
|
385 |
shouldCreateAccount: checkoutState.shouldCreateAccount,
|
386 |
setShouldCreateAccount: ( value ) =>
|
387 |
dispatch( actions.setShouldCreateAccount( value ) ),
|
|
|
388 |
};
|
389 |
return (
|
390 |
<CheckoutContext.Provider value={ checkoutData }>
|
142 |
void dispatch( actions.setOrderId( orderId ) ),
|
143 |
setOrderNotes: ( orderNotes ) =>
|
144 |
void dispatch( actions.setOrderNotes( orderNotes ) ),
|
145 |
+
setExtensionData: ( extensionData ) =>
|
146 |
+
void dispatch( actions.setExtensionData( extensionData ) ),
|
147 |
setAfterProcessing: ( response ) => {
|
148 |
const paymentResult = getPaymentResultFromCheckoutResponse(
|
149 |
response
|
387 |
shouldCreateAccount: checkoutState.shouldCreateAccount,
|
388 |
setShouldCreateAccount: ( value ) =>
|
389 |
dispatch( actions.setShouldCreateAccount( value ) ),
|
390 |
+
extensionData: checkoutState.extensionData,
|
391 |
};
|
392 |
return (
|
393 |
<CheckoutContext.Provider value={ checkoutData }>
|
assets/js/base/context/providers/cart-checkout/checkout-state/reducer.ts
CHANGED
@@ -7,25 +7,16 @@ import type { CheckoutStateContextState, PaymentResultDataType } from './types';
|
|
7 |
|
8 |
/**
|
9 |
* Reducer for the checkout state
|
10 |
-
*
|
11 |
-
* @param {Object} state Current state.
|
12 |
-
* @param {Object} action Incoming action object.
|
13 |
-
* @param {string} action.url URL passed in.
|
14 |
-
* @param {string} action.type Type of action.
|
15 |
-
* @param {string} action.customerId Customer ID.
|
16 |
-
* @param {string} action.orderId Order ID.
|
17 |
-
* @param {Array} action.orderNotes Order notes.
|
18 |
-
* @param {boolean} action.shouldCreateAccount True if shopper has requested a user account (sign-up checkbox).
|
19 |
-
* @param {Object} action.data Other action payload.
|
20 |
*/
|
21 |
export const reducer = (
|
22 |
state = DEFAULT_STATE,
|
23 |
{
|
24 |
-
|
25 |
type,
|
26 |
customerId,
|
27 |
orderId,
|
28 |
orderNotes,
|
|
|
29 |
shouldCreateAccount,
|
30 |
data,
|
31 |
}: ActionType
|
@@ -46,10 +37,10 @@ export const reducer = (
|
|
46 |
break;
|
47 |
case ACTION.SET_REDIRECT_URL:
|
48 |
newState =
|
49 |
-
|
50 |
? {
|
51 |
...state,
|
52 |
-
redirectUrl
|
53 |
}
|
54 |
: state;
|
55 |
break;
|
@@ -183,6 +174,17 @@ export const reducer = (
|
|
183 |
};
|
184 |
}
|
185 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
187 |
// automatically update state to idle from pristine as soon as it
|
188 |
// initially changes.
|
7 |
|
8 |
/**
|
9 |
* Reducer for the checkout state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
*/
|
11 |
export const reducer = (
|
12 |
state = DEFAULT_STATE,
|
13 |
{
|
14 |
+
redirectUrl,
|
15 |
type,
|
16 |
customerId,
|
17 |
orderId,
|
18 |
orderNotes,
|
19 |
+
extensionData,
|
20 |
shouldCreateAccount,
|
21 |
data,
|
22 |
}: ActionType
|
37 |
break;
|
38 |
case ACTION.SET_REDIRECT_URL:
|
39 |
newState =
|
40 |
+
redirectUrl !== undefined && redirectUrl !== state.redirectUrl
|
41 |
? {
|
42 |
...state,
|
43 |
+
redirectUrl,
|
44 |
}
|
45 |
: state;
|
46 |
break;
|
174 |
};
|
175 |
}
|
176 |
break;
|
177 |
+
case ACTION.SET_EXTENSION_DATA:
|
178 |
+
if (
|
179 |
+
extensionData !== undefined &&
|
180 |
+
state.extensionData !== extensionData
|
181 |
+
) {
|
182 |
+
newState = {
|
183 |
+
...state,
|
184 |
+
extensionData,
|
185 |
+
};
|
186 |
+
}
|
187 |
+
break;
|
188 |
}
|
189 |
// automatically update state to idle from pristine as soon as it
|
190 |
// initially changes.
|
assets/js/base/context/providers/cart-checkout/checkout-state/types.ts
CHANGED
@@ -33,7 +33,11 @@ export interface PaymentResultDataType {
|
|
33 |
redirectUrl: string;
|
34 |
}
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
redirectUrl: string;
|
38 |
status: STATUS;
|
39 |
hasError: boolean;
|
@@ -43,7 +47,8 @@ export type CheckoutStateContextState = {
|
|
43 |
customerId: number;
|
44 |
shouldCreateAccount: boolean;
|
45 |
processingResponse: PaymentResultDataType | null;
|
46 |
-
|
|
|
47 |
|
48 |
export type CheckoutStateDispatchActions = {
|
49 |
resetCheckout: () => void;
|
@@ -55,6 +60,7 @@ export type CheckoutStateDispatchActions = {
|
|
55 |
setCustomerId: ( id: number ) => void;
|
56 |
setOrderId: ( id: number ) => void;
|
57 |
setOrderNotes: ( orderNotes: string ) => void;
|
|
|
58 |
};
|
59 |
|
60 |
export type CheckoutStateContextType = {
|
@@ -74,16 +80,6 @@ export type CheckoutStateContextType = {
|
|
74 |
isBeforeProcessing: boolean;
|
75 |
// True when checkout status is AFTER_PROCESSING.
|
76 |
isAfterProcessing: boolean;
|
77 |
-
// True when the checkout is in an error state. Whatever caused the error (validation/payment method) will likely have triggered a notice.
|
78 |
-
hasError: boolean;
|
79 |
-
// This is the url that checkout will redirect to when it's ready.
|
80 |
-
redirectUrl: string;
|
81 |
-
// This is the ID for the draft order if one exists.
|
82 |
-
orderId: number;
|
83 |
-
// Order notes introduced by the user in the checkout form.
|
84 |
-
orderNotes: string;
|
85 |
-
// This is the ID of the customer the draft order belongs to.
|
86 |
-
customerId: number;
|
87 |
// Used to register a callback that will fire after checkout has been processed and there are no errors.
|
88 |
onCheckoutAfterProcessingWithSuccess: ReturnType< typeof emitterCallback >;
|
89 |
// Used to register a callback that will fire when the checkout has been processed and has an error.
|
@@ -92,12 +88,24 @@ export type CheckoutStateContextType = {
|
|
92 |
onCheckoutBeforeProcessing: ReturnType< typeof emitterCallback >;
|
93 |
// Used to register a callback that will fire when the checkout has been submitted before being sent off to the server.
|
94 |
onCheckoutValidationBeforeProcessing: ReturnType< typeof emitterCallback >;
|
|
|
|
|
95 |
// True when the checkout has a draft order from the API.
|
96 |
hasOrder: boolean;
|
97 |
// When true, means the provider is providing data for the cart.
|
98 |
isCart: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
// Should a user account be created?
|
100 |
-
shouldCreateAccount:
|
101 |
-
//
|
102 |
-
|
103 |
};
|
33 |
redirectUrl: string;
|
34 |
}
|
35 |
|
36 |
+
type extensionDataNamespace = string;
|
37 |
+
type extensionDataItem = Record< string, unknown >;
|
38 |
+
export type extensionData = Record< extensionDataNamespace, extensionDataItem >;
|
39 |
+
|
40 |
+
export interface CheckoutStateContextState {
|
41 |
redirectUrl: string;
|
42 |
status: STATUS;
|
43 |
hasError: boolean;
|
47 |
customerId: number;
|
48 |
shouldCreateAccount: boolean;
|
49 |
processingResponse: PaymentResultDataType | null;
|
50 |
+
extensionData: extensionData;
|
51 |
+
}
|
52 |
|
53 |
export type CheckoutStateDispatchActions = {
|
54 |
resetCheckout: () => void;
|
60 |
setCustomerId: ( id: number ) => void;
|
61 |
setOrderId: ( id: number ) => void;
|
62 |
setOrderNotes: ( orderNotes: string ) => void;
|
63 |
+
setExtensionData: ( extensionData: extensionData ) => void;
|
64 |
};
|
65 |
|
66 |
export type CheckoutStateContextType = {
|
80 |
isBeforeProcessing: boolean;
|
81 |
// True when checkout status is AFTER_PROCESSING.
|
82 |
isAfterProcessing: boolean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
// Used to register a callback that will fire after checkout has been processed and there are no errors.
|
84 |
onCheckoutAfterProcessingWithSuccess: ReturnType< typeof emitterCallback >;
|
85 |
// Used to register a callback that will fire when the checkout has been processed and has an error.
|
88 |
onCheckoutBeforeProcessing: ReturnType< typeof emitterCallback >;
|
89 |
// Used to register a callback that will fire when the checkout has been submitted before being sent off to the server.
|
90 |
onCheckoutValidationBeforeProcessing: ReturnType< typeof emitterCallback >;
|
91 |
+
// Set if user account should be created.
|
92 |
+
setShouldCreateAccount: ( shouldCreateAccount: boolean ) => void;
|
93 |
// True when the checkout has a draft order from the API.
|
94 |
hasOrder: boolean;
|
95 |
// When true, means the provider is providing data for the cart.
|
96 |
isCart: boolean;
|
97 |
+
// True when the checkout is in an error state. Whatever caused the error (validation/payment method) will likely have triggered a notice.
|
98 |
+
hasError: CheckoutStateContextState[ 'hasError' ];
|
99 |
+
// This is the url that checkout will redirect to when it's ready.
|
100 |
+
redirectUrl: CheckoutStateContextState[ 'redirectUrl' ];
|
101 |
+
// This is the ID for the draft order if one exists.
|
102 |
+
orderId: CheckoutStateContextState[ 'orderId' ];
|
103 |
+
// Order notes introduced by the user in the checkout form.
|
104 |
+
orderNotes: CheckoutStateContextState[ 'orderNotes' ];
|
105 |
+
// This is the ID of the customer the draft order belongs to.
|
106 |
+
customerId: CheckoutStateContextState[ 'customerId' ];
|
107 |
// Should a user account be created?
|
108 |
+
shouldCreateAccount: CheckoutStateContextState[ 'shouldCreateAccount' ];
|
109 |
+
// Custom checkout data passed to the store API on processing.
|
110 |
+
extensionData: CheckoutStateContextState[ 'extensionData' ];
|
111 |
};
|
assets/js/base/context/providers/cart-checkout/checkout/processor/utils.js
DELETED
@@ -1,30 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* @typedef {import('@woocommerce/type-defs/payments').PaymentDataItem} PaymentDataItem
|
3 |
-
*/
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Utility function for preparing payment data for the request.
|
7 |
-
*
|
8 |
-
* @param {Object} paymentData Arbitrary payment data provided by the payment method.
|
9 |
-
* @param {boolean} shouldSave Whether to save the payment method info to user account.
|
10 |
-
* @param {Object} activePaymentMethod The current active payment method.
|
11 |
-
*
|
12 |
-
* @return {PaymentDataItem[]} Returns the payment data as an array of
|
13 |
-
* PaymentDataItem objects.
|
14 |
-
*/
|
15 |
-
export const preparePaymentData = (
|
16 |
-
paymentData,
|
17 |
-
shouldSave,
|
18 |
-
activePaymentMethod
|
19 |
-
) => {
|
20 |
-
const apiData = Object.keys( paymentData ).map( ( property ) => {
|
21 |
-
const value = paymentData[ property ];
|
22 |
-
return { key: property, value };
|
23 |
-
}, [] );
|
24 |
-
const savePaymentMethodKey = `wc-${ activePaymentMethod }-new-payment-method`;
|
25 |
-
apiData.push( {
|
26 |
-
key: savePaymentMethodKey,
|
27 |
-
value: shouldSave,
|
28 |
-
} );
|
29 |
-
return apiData;
|
30 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/context/providers/cart-checkout/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
export * from './payment-methods';
|
2 |
export * from './shipping';
|
3 |
export * from './customer';
|
4 |
-
export * from './checkout';
|
5 |
export * from './cart';
|
6 |
-
export
|
|
1 |
export * from './payment-methods';
|
2 |
export * from './shipping';
|
3 |
export * from './customer';
|
4 |
+
export * from './checkout-state';
|
5 |
export * from './cart';
|
6 |
+
export * from './checkout-processor';
|
7 |
+
export * from './checkout-provider';
|
assets/js/base/context/providers/cart-checkout/utils.ts
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import triggerFetch from '@wordpress/api-fetch';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import type { CheckoutStateDispatchActions } from './checkout-state/types';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Utility function for preparing payment data for the request.
|
13 |
+
*/
|
14 |
+
export const preparePaymentData = (
|
15 |
+
//Arbitrary payment data provided by the payment method.
|
16 |
+
paymentData: Record< string, unknown >,
|
17 |
+
//Whether to save the payment method info to user account.
|
18 |
+
shouldSave: boolean,
|
19 |
+
//The current active payment method.
|
20 |
+
activePaymentMethod: string
|
21 |
+
): { key: string; value: unknown }[] => {
|
22 |
+
const apiData = Object.keys( paymentData ).map( ( property ) => {
|
23 |
+
const value = paymentData[ property ];
|
24 |
+
return { key: property, value };
|
25 |
+
}, [] );
|
26 |
+
const savePaymentMethodKey = `wc-${ activePaymentMethod }-new-payment-method`;
|
27 |
+
apiData.push( {
|
28 |
+
key: savePaymentMethodKey,
|
29 |
+
value: shouldSave,
|
30 |
+
} );
|
31 |
+
return apiData;
|
32 |
+
};
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Process headers from an API response an dispatch updates.
|
36 |
+
*/
|
37 |
+
export const processCheckoutResponseHeaders = (
|
38 |
+
headers: Headers,
|
39 |
+
dispatchActions: CheckoutStateDispatchActions
|
40 |
+
): void => {
|
41 |
+
if (
|
42 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
43 |
+
// @ts-ignore -- this does exist because it's monkey patched in
|
44 |
+
// middleware/store-api-nonce.
|
45 |
+
triggerFetch.setNonce &&
|
46 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
47 |
+
// @ts-ignore -- this does exist because it's monkey patched in
|
48 |
+
// middleware/store-api-nonce.
|
49 |
+
typeof triggerFetch.setNonce === 'function'
|
50 |
+
) {
|
51 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
52 |
+
// @ts-ignore -- this does exist because it's monkey patched in
|
53 |
+
// middleware/store-api-nonce.
|
54 |
+
triggerFetch.setNonce( headers );
|
55 |
+
}
|
56 |
+
|
57 |
+
// Update user using headers.
|
58 |
+
if ( headers?.get( 'X-WC-Store-API-User' ) ) {
|
59 |
+
dispatchActions.setCustomerId(
|
60 |
+
parseInt( headers.get( 'X-WC-Store-API-User' ) || '0', 10 )
|
61 |
+
);
|
62 |
+
}
|
63 |
+
};
|
assets/js/base/utils/lazy-load-script.ts
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
interface lazyLoadScriptParams {
|
2 |
+
handle: string;
|
3 |
+
src: string;
|
4 |
+
version?: string;
|
5 |
+
after?: string;
|
6 |
+
before?: string;
|
7 |
+
translations?: string;
|
8 |
+
}
|
9 |
+
|
10 |
+
/**
|
11 |
+
* In WP, registered scripts are loaded into the page with an element like this:
|
12 |
+
* `<script src='...' id='[SCRIPT_ID]'></script>`
|
13 |
+
* This function checks whether an element matching that selector exists.
|
14 |
+
* Useful to know if a script has already been appended to the page.
|
15 |
+
*/
|
16 |
+
const isScriptTagInDOM = ( scriptId: string ): boolean => {
|
17 |
+
const scriptElements = document.querySelectorAll( `script#${ scriptId }` );
|
18 |
+
return scriptElements.length > 0;
|
19 |
+
};
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Appends a `<script>` tag to the document body based on the src and handle
|
23 |
+
* parameters. In addition, it appends additional script tags to load the code
|
24 |
+
* needed for translations and any before and after inline scripts. See these
|
25 |
+
* documentation pages for more information:
|
26 |
+
*
|
27 |
+
* https://developer.wordpress.org/reference/functions/wp_set_script_translations/
|
28 |
+
* https://developer.wordpress.org/reference/functions/wp_add_inline_script/
|
29 |
+
*/
|
30 |
+
const lazyLoadScript = ( {
|
31 |
+
handle,
|
32 |
+
src,
|
33 |
+
version,
|
34 |
+
after,
|
35 |
+
before,
|
36 |
+
translations,
|
37 |
+
}: lazyLoadScriptParams ): Promise< void > => {
|
38 |
+
return new Promise( ( resolve, reject ) => {
|
39 |
+
// Append script translations if they doesn't exist yet in the page.
|
40 |
+
if (
|
41 |
+
translations &&
|
42 |
+
! isScriptTagInDOM( `${ handle }-js-translations` )
|
43 |
+
) {
|
44 |
+
const handleTranslations = document.createElement( 'script' );
|
45 |
+
handleTranslations.innerHTML = translations;
|
46 |
+
handleTranslations.id = `${ handle }-js-translations`;
|
47 |
+
document.body.appendChild( handleTranslations );
|
48 |
+
}
|
49 |
+
// Append before inline script if it doesn't exist yet in the page.
|
50 |
+
if ( before && ! isScriptTagInDOM( `${ handle }-js-before` ) ) {
|
51 |
+
const handleBeforeScript = document.createElement( 'script' );
|
52 |
+
handleBeforeScript.innerHTML = before;
|
53 |
+
handleBeforeScript.id = `${ handle }-js-before`;
|
54 |
+
document.body.appendChild( handleBeforeScript );
|
55 |
+
}
|
56 |
+
|
57 |
+
if ( isScriptTagInDOM( `${ handle }-js` ) ) {
|
58 |
+
resolve();
|
59 |
+
} else {
|
60 |
+
// Append script.
|
61 |
+
const handleScript = document.createElement( 'script' );
|
62 |
+
handleScript.src = version ? `${ src }?${ version }` : src;
|
63 |
+
handleScript.id = `${ handle }-js`;
|
64 |
+
handleScript.onerror = reject;
|
65 |
+
handleScript.onload = () => {
|
66 |
+
// Append after inline script if it doesn't exist yet in the page.
|
67 |
+
if ( after && ! isScriptTagInDOM( `${ handle }-js-after` ) ) {
|
68 |
+
const handleAfterScript = document.createElement(
|
69 |
+
'script'
|
70 |
+
);
|
71 |
+
handleAfterScript.innerHTML = after;
|
72 |
+
handleAfterScript.id = `${ handle }-js-after`;
|
73 |
+
document.body.appendChild( handleAfterScript );
|
74 |
+
}
|
75 |
+
resolve();
|
76 |
+
};
|
77 |
+
document.body.appendChild( handleScript );
|
78 |
+
}
|
79 |
+
} );
|
80 |
+
};
|
81 |
+
|
82 |
+
export default lazyLoadScript;
|
assets/js/base/utils/preload-script.ts
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
interface preloadScriptParams {
|
2 |
+
handle: string;
|
3 |
+
src: string;
|
4 |
+
version?: string;
|
5 |
+
}
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Appends a `<link>` tag to the document head to preload a script based on the
|
9 |
+
* src and handle parameters.
|
10 |
+
*/
|
11 |
+
const preloadScript = ( {
|
12 |
+
handle,
|
13 |
+
src,
|
14 |
+
version,
|
15 |
+
}: preloadScriptParams ): void => {
|
16 |
+
const handleScriptElements = document.querySelectorAll(
|
17 |
+
`#${ handle }-js, #${ handle }-js-prefetch`
|
18 |
+
);
|
19 |
+
|
20 |
+
if ( handleScriptElements.length === 0 ) {
|
21 |
+
const prefetchLink = document.createElement( 'link' );
|
22 |
+
prefetchLink.href = version ? `${ src }?${ version }` : src;
|
23 |
+
prefetchLink.rel = 'preload';
|
24 |
+
prefetchLink.as = 'script';
|
25 |
+
prefetchLink.id = `${ handle }-js-prefetch`;
|
26 |
+
document.head.appendChild( prefetchLink );
|
27 |
+
}
|
28 |
+
};
|
29 |
+
|
30 |
+
export default preloadScript;
|
assets/js/base/utils/render-frontend.js
CHANGED
@@ -36,8 +36,8 @@ const isElementInsideWrappers = ( el, wrappers ) => {
|
|
36 |
const renderBlockInContainers = ( {
|
37 |
Block,
|
38 |
containers,
|
39 |
-
getProps = () => {},
|
40 |
-
getErrorBoundaryProps = () => {},
|
41 |
} ) => {
|
42 |
if ( containers.length === 0 ) {
|
43 |
return;
|
@@ -49,7 +49,7 @@ const renderBlockInContainers = ( {
|
|
49 |
const errorBoundaryProps = getErrorBoundaryProps( el, i );
|
50 |
const attributes = {
|
51 |
...el.dataset,
|
52 |
-
...props.attributes,
|
53 |
};
|
54 |
el.classList.remove( 'is-loading' );
|
55 |
|
36 |
const renderBlockInContainers = ( {
|
37 |
Block,
|
38 |
containers,
|
39 |
+
getProps = () => ( {} ),
|
40 |
+
getErrorBoundaryProps = () => ( {} ),
|
41 |
} ) => {
|
42 |
if ( containers.length === 0 ) {
|
43 |
return;
|
49 |
const errorBoundaryProps = getErrorBoundaryProps( el, i );
|
50 |
const attributes = {
|
51 |
...el.dataset,
|
52 |
+
...( props.attributes || {} ),
|
53 |
};
|
54 |
el.classList.remove( 'is-loading' );
|
55 |
|
assets/js/blocks/active-filters/block.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { useQueryStateByKey } from '@woocommerce/base-context/hooks';
|
|
|
6 |
import { useMemo } from '@wordpress/element';
|
7 |
import classnames from 'classnames';
|
8 |
import PropTypes from 'prop-types';
|
@@ -31,9 +32,39 @@ const ActiveFiltersBlock = ( {
|
|
31 |
'attributes',
|
32 |
[]
|
33 |
);
|
|
|
|
|
|
|
|
|
34 |
const [ minPrice, setMinPrice ] = useQueryStateByKey( 'min_price' );
|
35 |
const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
const activePriceFilters = useMemo( () => {
|
38 |
if ( ! Number.isFinite( minPrice ) && ! Number.isFinite( maxPrice ) ) {
|
39 |
return null;
|
@@ -75,6 +106,7 @@ const ActiveFiltersBlock = ( {
|
|
75 |
const hasFilters = () => {
|
76 |
return (
|
77 |
productAttributes.length > 0 ||
|
|
|
78 |
Number.isFinite( minPrice ) ||
|
79 |
Number.isFinite( maxPrice )
|
80 |
);
|
@@ -125,6 +157,7 @@ const ActiveFiltersBlock = ( {
|
|
125 |
) : (
|
126 |
<>
|
127 |
{ activePriceFilters }
|
|
|
128 |
{ activeAttributeFilters }
|
129 |
</>
|
130 |
) }
|
@@ -135,6 +168,7 @@ const ActiveFiltersBlock = ( {
|
|
135 |
setMinPrice( undefined );
|
136 |
setMaxPrice( undefined );
|
137 |
setProductAttributes( [] );
|
|
|
138 |
} }
|
139 |
>
|
140 |
<Label
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { useQueryStateByKey } from '@woocommerce/base-context/hooks';
|
6 |
+
import { getSetting } from '@woocommerce/settings';
|
7 |
import { useMemo } from '@wordpress/element';
|
8 |
import classnames from 'classnames';
|
9 |
import PropTypes from 'prop-types';
|
32 |
'attributes',
|
33 |
[]
|
34 |
);
|
35 |
+
const [ productStockStatus, setProductStockStatus ] = useQueryStateByKey(
|
36 |
+
'stock_status',
|
37 |
+
[]
|
38 |
+
);
|
39 |
const [ minPrice, setMinPrice ] = useQueryStateByKey( 'min_price' );
|
40 |
const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
|
41 |
|
42 |
+
const STOCK_STATUS_OPTIONS = getSetting( 'stockStatusOptions', [] );
|
43 |
+
const activeStockStatusFilters = useMemo( () => {
|
44 |
+
if ( productStockStatus.length > 0 ) {
|
45 |
+
return productStockStatus.map( ( slug ) => {
|
46 |
+
return renderRemovableListItem( {
|
47 |
+
type: __( 'Stock Status', 'woo-gutenberg-products-block' ),
|
48 |
+
name: STOCK_STATUS_OPTIONS[ slug ],
|
49 |
+
removeCallback: () => {
|
50 |
+
const newStatuses = productStockStatus.filter(
|
51 |
+
( status ) => {
|
52 |
+
return status !== slug;
|
53 |
+
}
|
54 |
+
);
|
55 |
+
setProductStockStatus( newStatuses );
|
56 |
+
},
|
57 |
+
displayStyle: blockAttributes.displayStyle,
|
58 |
+
} );
|
59 |
+
} );
|
60 |
+
}
|
61 |
+
}, [
|
62 |
+
STOCK_STATUS_OPTIONS,
|
63 |
+
productStockStatus,
|
64 |
+
setProductStockStatus,
|
65 |
+
blockAttributes.displayStyle,
|
66 |
+
] );
|
67 |
+
|
68 |
const activePriceFilters = useMemo( () => {
|
69 |
if ( ! Number.isFinite( minPrice ) && ! Number.isFinite( maxPrice ) ) {
|
70 |
return null;
|
106 |
const hasFilters = () => {
|
107 |
return (
|
108 |
productAttributes.length > 0 ||
|
109 |
+
productStockStatus.length > 0 ||
|
110 |
Number.isFinite( minPrice ) ||
|
111 |
Number.isFinite( maxPrice )
|
112 |
);
|
157 |
) : (
|
158 |
<>
|
159 |
{ activePriceFilters }
|
160 |
+
{ activeStockStatusFilters }
|
161 |
{ activeAttributeFilters }
|
162 |
</>
|
163 |
) }
|
168 |
setMinPrice( undefined );
|
169 |
setMaxPrice( undefined );
|
170 |
setProductAttributes( [] );
|
171 |
+
setProductStockStatus( [] );
|
172 |
} }
|
173 |
>
|
174 |
<Label
|
assets/js/blocks/active-filters/style.scss
CHANGED
@@ -91,8 +91,8 @@
|
|
91 |
|
92 |
.wc-block-components-chip {
|
93 |
@include font-size(small);
|
94 |
-
margin-top: em($gap-small
|
95 |
-
margin-bottom: em($gap-small
|
96 |
}
|
97 |
}
|
98 |
}
|
91 |
|
92 |
.wc-block-components-chip {
|
93 |
@include font-size(small);
|
94 |
+
margin-top: em($gap-small*0.25);
|
95 |
+
margin-bottom: em($gap-small*0.25);
|
96 |
}
|
97 |
}
|
98 |
}
|
assets/js/blocks/attribute-filter/block.js
CHANGED
@@ -13,6 +13,7 @@ import {
|
|
13 |
import { useCallback, useEffect, useState, useMemo } from '@wordpress/element';
|
14 |
import CheckboxList from '@woocommerce/base-components/checkbox-list';
|
15 |
import DropdownSelector from '@woocommerce/base-components/dropdown-selector';
|
|
|
16 |
import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
|
17 |
import isShallowEqual from '@wordpress/is-shallow-equal';
|
18 |
import { decodeEntities } from '@wordpress/html-entities';
|
@@ -22,7 +23,6 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
22 |
*/
|
23 |
import { getAttributeFromID } from '../../utils/attributes';
|
24 |
import { updateAttributeFilter } from '../../utils/attributes-query';
|
25 |
-
import Label from './label';
|
26 |
import { previewAttributeObject, previewOptions } from './preview';
|
27 |
import './style.scss';
|
28 |
|
13 |
import { useCallback, useEffect, useState, useMemo } from '@wordpress/element';
|
14 |
import CheckboxList from '@woocommerce/base-components/checkbox-list';
|
15 |
import DropdownSelector from '@woocommerce/base-components/dropdown-selector';
|
16 |
+
import Label from '@woocommerce/base-components/filter-element-label';
|
17 |
import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
|
18 |
import isShallowEqual from '@wordpress/is-shallow-equal';
|
19 |
import { decodeEntities } from '@wordpress/html-entities';
|
23 |
*/
|
24 |
import { getAttributeFromID } from '../../utils/attributes';
|
25 |
import { updateAttributeFilter } from '../../utils/attributes-query';
|
|
|
26 |
import { previewAttributeObject, previewOptions } from './preview';
|
27 |
import './style.scss';
|
28 |
|
assets/js/blocks/attribute-filter/preview.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
-
*
|
3 |
*/
|
4 |
-
import Label from '
|
5 |
|
6 |
export const previewOptions = [
|
7 |
{
|
1 |
/**
|
2 |
+
* External dependencies
|
3 |
*/
|
4 |
+
import Label from '@woocommerce/base-components/filter-element-label';
|
5 |
|
6 |
export const previewOptions = [
|
7 |
{
|
assets/js/blocks/attribute-filter/style.scss
CHANGED
@@ -1,15 +1,6 @@
|
|
1 |
.wc-block-attribute-filter {
|
2 |
margin-bottom: $gap-large;
|
3 |
|
4 |
-
.wc-block-attribute-filter-list-count {
|
5 |
-
&::before {
|
6 |
-
content: " (";
|
7 |
-
}
|
8 |
-
&::after {
|
9 |
-
content: ")";
|
10 |
-
}
|
11 |
-
}
|
12 |
-
|
13 |
.wc-block-attribute-filter-list {
|
14 |
margin: 0;
|
15 |
|
@@ -25,10 +16,6 @@
|
|
25 |
display: inline-block;
|
26 |
}
|
27 |
}
|
28 |
-
|
29 |
-
.wc-block-attribute-filter-list-count {
|
30 |
-
float: right;
|
31 |
-
}
|
32 |
}
|
33 |
|
34 |
.is-single .wc-block-attribute-filter-list-count,
|
1 |
.wc-block-attribute-filter {
|
2 |
margin-bottom: $gap-large;
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
.wc-block-attribute-filter-list {
|
5 |
margin: 0;
|
6 |
|
16 |
display: inline-block;
|
17 |
}
|
18 |
}
|
|
|
|
|
|
|
|
|
19 |
}
|
20 |
|
21 |
.is-single .wc-block-attribute-filter-list-count,
|
assets/js/blocks/cart-checkout/cart/checkout-button/{index.js → index.tsx}
RENAMED
@@ -14,8 +14,11 @@ import { usePositionRelativeToViewport } from '@woocommerce/base-hooks';
|
|
14 |
* Internal dependencies
|
15 |
*/
|
16 |
import './style.scss';
|
|
|
17 |
|
18 |
-
const getIconsFromPaymentMethods = (
|
|
|
|
|
19 |
return Object.values( paymentMethods ).reduce( ( acc, paymentMethod ) => {
|
20 |
if ( paymentMethod.icons !== null ) {
|
21 |
acc = acc.concat( paymentMethod.icons );
|
@@ -30,7 +33,7 @@ const getIconsFromPaymentMethods = ( paymentMethods ) => {
|
|
30 |
* @param {Object} props Incoming props for the component.
|
31 |
* @param {string} props.link What the button is linked to.
|
32 |
*/
|
33 |
-
const CheckoutButton = ( { link } ) => {
|
34 |
const { isCalculating } = useCheckoutContext();
|
35 |
const [
|
36 |
positionReferenceElement,
|
14 |
* Internal dependencies
|
15 |
*/
|
16 |
import './style.scss';
|
17 |
+
import type PaymentMethodConfig from '../../../../blocks-registry/payment-methods/payment-method-config';
|
18 |
|
19 |
+
const getIconsFromPaymentMethods = (
|
20 |
+
paymentMethods: PaymentMethodConfig[]
|
21 |
+
) => {
|
22 |
return Object.values( paymentMethods ).reduce( ( acc, paymentMethod ) => {
|
23 |
if ( paymentMethod.icons !== null ) {
|
24 |
acc = acc.concat( paymentMethod.icons );
|
33 |
* @param {Object} props Incoming props for the component.
|
34 |
* @param {string} props.link What the button is linked to.
|
35 |
*/
|
36 |
+
const CheckoutButton = ( { link }: { link: string } ): JSX.Element => {
|
37 |
const { isCalculating } = useCheckoutContext();
|
38 |
const [
|
39 |
positionReferenceElement,
|
assets/js/blocks/cart-checkout/cart/full-cart/style.scss
CHANGED
@@ -86,7 +86,8 @@ table.wc-block-cart-items {
|
|
86 |
}
|
87 |
|
88 |
// Loading placeholder state.
|
89 |
-
.wc-block-cart--is-loading
|
|
|
90 |
th span,
|
91 |
h2 span {
|
92 |
@include placeholder();
|
@@ -97,47 +98,43 @@ table.wc-block-cart-items {
|
|
97 |
h2 span {
|
98 |
min-width: 33%;
|
99 |
}
|
100 |
-
.wc-block-cart-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
@include force-content();
|
138 |
-
display: block;
|
139 |
-
}
|
140 |
-
}
|
141 |
}
|
142 |
}
|
143 |
.wc-block-cart__sidebar .components-card {
|
86 |
}
|
87 |
|
88 |
// Loading placeholder state.
|
89 |
+
.wc-block-cart--is-loading,
|
90 |
+
.wc-block-mini-cart-items--is-loading {
|
91 |
th span,
|
92 |
h2 span {
|
93 |
@include placeholder();
|
98 |
h2 span {
|
99 |
min-width: 33%;
|
100 |
}
|
101 |
+
.wc-block-cart-item__price,
|
102 |
+
.wc-block-cart-item__individual-price,
|
103 |
+
.wc-block-cart-item__product-metadata,
|
104 |
+
.wc-block-cart-item__image > *,
|
105 |
+
.wc-block-components-quantity-selector {
|
106 |
+
@include placeholder();
|
107 |
+
}
|
108 |
+
.wc-block-cart-item__product-name {
|
109 |
+
@include placeholder();
|
110 |
+
@include force-content();
|
111 |
+
min-width: 84px;
|
112 |
+
display: inline-block;
|
113 |
+
}
|
114 |
+
.wc-block-cart-item__product-metadata {
|
115 |
+
margin-top: 0.25em;
|
116 |
+
min-width: 8em;
|
117 |
+
}
|
118 |
+
.wc-block-cart-item__remove-link {
|
119 |
+
visibility: hidden;
|
120 |
+
}
|
121 |
+
.wc-block-cart-item__image a {
|
122 |
+
display: block;
|
123 |
+
}
|
124 |
+
.wc-block-cart-item__individual-price {
|
125 |
+
@include force-content();
|
126 |
+
max-width: 3em;
|
127 |
+
display: block;
|
128 |
+
margin-top: 0.25em;
|
129 |
+
}
|
130 |
+
.wc-block-cart-item__total {
|
131 |
+
> span,
|
132 |
+
> div {
|
133 |
+
display: none;
|
134 |
+
}
|
135 |
+
.wc-block-cart-item__price {
|
136 |
+
@include force-content();
|
137 |
+
display: block;
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
}
|
140 |
.wc-block-cart__sidebar .components-card {
|
assets/js/blocks/cart-checkout/checkout-i2/frontend.tsx
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { Children, cloneElement, isValidElement } from '@wordpress/element';
|
5 |
import { getValidBlockAttributes } from '@woocommerce/base-utils';
|
6 |
import { useStoreCart } from '@woocommerce/base-context';
|
|
|
7 |
import { getRegisteredBlockComponents } from '@woocommerce/blocks-registry';
|
8 |
import {
|
9 |
withStoreCartApiHydration,
|
@@ -36,12 +37,14 @@ const Wrapper = ( {
|
|
36 |
// we need to pluck out receiveCart.
|
37 |
// eslint-disable-next-line no-unused-vars
|
38 |
const { extensions, receiveCart, ...cart } = useStoreCart();
|
|
|
39 |
|
40 |
return Children.map( children, ( child ) => {
|
41 |
if ( isValidElement( child ) ) {
|
42 |
const componentProps = {
|
43 |
extensions,
|
44 |
cart,
|
|
|
45 |
};
|
46 |
return cloneElement( child, componentProps );
|
47 |
}
|
4 |
import { Children, cloneElement, isValidElement } from '@wordpress/element';
|
5 |
import { getValidBlockAttributes } from '@woocommerce/base-utils';
|
6 |
import { useStoreCart } from '@woocommerce/base-context';
|
7 |
+
import { useCheckoutExtensionData } from '@woocommerce/base-context/hooks';
|
8 |
import { getRegisteredBlockComponents } from '@woocommerce/blocks-registry';
|
9 |
import {
|
10 |
withStoreCartApiHydration,
|
37 |
// we need to pluck out receiveCart.
|
38 |
// eslint-disable-next-line no-unused-vars
|
39 |
const { extensions, receiveCart, ...cart } = useStoreCart();
|
40 |
+
const checkoutExtensionData = useCheckoutExtensionData();
|
41 |
|
42 |
return Children.map( children, ( child ) => {
|
43 |
if ( isValidElement( child ) ) {
|
44 |
const componentProps = {
|
45 |
extensions,
|
46 |
cart,
|
47 |
+
checkoutExtensionData,
|
48 |
};
|
49 |
return cloneElement( child, componentProps );
|
50 |
}
|
assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-express-payment-block/edit.tsx
CHANGED
@@ -1,7 +1,13 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { useBlockProps } from '@wordpress/block-editor';
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
@@ -10,6 +16,38 @@ import Block from './block';
|
|
10 |
import './editor.scss';
|
11 |
import { useBlockPropsWithLocking } from '../../hacks';
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
export const Edit = ( {
|
14 |
attributes,
|
15 |
}: {
|
@@ -19,12 +57,27 @@ export const Edit = ( {
|
|
19 |
remove: boolean;
|
20 |
};
|
21 |
};
|
22 |
-
} ): JSX.Element => {
|
23 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
return (
|
26 |
<div { ...blockProps }>
|
27 |
-
|
|
|
|
|
|
|
|
|
28 |
</div>
|
29 |
);
|
30 |
};
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
import { useBlockProps } from '@wordpress/block-editor';
|
6 |
+
import { Placeholder, Button } from 'wordpress-components';
|
7 |
+
import { useExpressPaymentMethods } from '@woocommerce/base-context/hooks';
|
8 |
+
import { Icon, card } from '@woocommerce/icons';
|
9 |
+
import { ADMIN_URL } from '@woocommerce/settings';
|
10 |
+
import classnames from 'classnames';
|
11 |
|
12 |
/**
|
13 |
* Internal dependencies
|
16 |
import './editor.scss';
|
17 |
import { useBlockPropsWithLocking } from '../../hacks';
|
18 |
|
19 |
+
/**
|
20 |
+
* Renders a placeholder in the editor.
|
21 |
+
*/
|
22 |
+
const NoExpressPaymentMethodsPlaceholder = () => {
|
23 |
+
return (
|
24 |
+
<Placeholder
|
25 |
+
icon={ <Icon srcElement={ card } /> }
|
26 |
+
label={ __( 'Express Checkout', 'woo-gutenberg-products-block' ) }
|
27 |
+
className="wp-block-woocommerce-checkout-express-payment-block-placeholder"
|
28 |
+
>
|
29 |
+
<span className="wp-block-woocommerce-checkout-express-payment-block-placeholder__description">
|
30 |
+
{ __(
|
31 |
+
"Your store doesn't have any Payment Methods that support the Express Checkout Block. If they are added, they will be shown here.",
|
32 |
+
'woo-gutenberg-products-block'
|
33 |
+
) }
|
34 |
+
</span>
|
35 |
+
<Button
|
36 |
+
isPrimary
|
37 |
+
href={ `${ ADMIN_URL }admin.php?page=wc-settings&tab=checkout` }
|
38 |
+
target="_blank"
|
39 |
+
rel="noopener noreferrer"
|
40 |
+
className="wp-block-woocommerce-checkout-express-payment-block-placeholder__button"
|
41 |
+
>
|
42 |
+
{ __(
|
43 |
+
'Configure Payment Methods',
|
44 |
+
'woo-gutenberg-products-block'
|
45 |
+
) }
|
46 |
+
</Button>
|
47 |
+
</Placeholder>
|
48 |
+
);
|
49 |
+
};
|
50 |
+
|
51 |
export const Edit = ( {
|
52 |
attributes,
|
53 |
}: {
|
57 |
remove: boolean;
|
58 |
};
|
59 |
};
|
60 |
+
} ): JSX.Element | null => {
|
61 |
+
const { paymentMethods, isInitialized } = useExpressPaymentMethods();
|
62 |
+
const hasExpressPaymentMethods = Object.keys( paymentMethods ).length > 0;
|
63 |
+
const blockProps = useBlockPropsWithLocking( {
|
64 |
+
className: classnames( {
|
65 |
+
'wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods': hasExpressPaymentMethods,
|
66 |
+
} ),
|
67 |
+
attributes,
|
68 |
+
} );
|
69 |
+
|
70 |
+
if ( ! isInitialized ) {
|
71 |
+
return null;
|
72 |
+
}
|
73 |
|
74 |
return (
|
75 |
<div { ...blockProps }>
|
76 |
+
{ hasExpressPaymentMethods ? (
|
77 |
+
<Block />
|
78 |
+
) : (
|
79 |
+
<NoExpressPaymentMethodsPlaceholder />
|
80 |
+
) }
|
81 |
</div>
|
82 |
);
|
83 |
};
|
assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-express-payment-block/editor.scss
CHANGED
@@ -1,11 +1,28 @@
|
|
1 |
// Adjust padding and margins in the editor to improve selected block outlines.
|
2 |
.wp-block-woocommerce-checkout-express-payment-block {
|
3 |
-
margin
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
7 |
|
8 |
.wc-block-components-express-payment-continue-rule--checkout {
|
9 |
margin-bottom: 0;
|
10 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
1 |
// Adjust padding and margins in the editor to improve selected block outlines.
|
2 |
.wp-block-woocommerce-checkout-express-payment-block {
|
3 |
+
margin: 14px 0 28px;
|
4 |
+
|
5 |
+
.components-placeholder__label svg {
|
6 |
+
font-size: 1em;
|
7 |
+
}
|
8 |
|
9 |
.wc-block-components-express-payment-continue-rule--checkout {
|
10 |
margin-bottom: 0;
|
11 |
}
|
12 |
+
|
13 |
+
&.wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods {
|
14 |
+
padding: 14px 0;
|
15 |
+
margin: 14px 0;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
|
19 |
+
.wp-block-woocommerce-checkout-express-payment-block-placeholder {
|
20 |
+
* {
|
21 |
+
pointer-events: all; // Overrides parent disabled component in editor context
|
22 |
+
}
|
23 |
+
|
24 |
+
.wp-block-woocommerce-checkout-express-payment-block-placeholder__description {
|
25 |
+
display: block;
|
26 |
+
margin: 0 0 1em;
|
27 |
+
}
|
28 |
}
|
assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/checkout-sample-block/index.tsx
CHANGED
@@ -16,7 +16,6 @@ __webpack_public_path__ = WC_BLOCKS_BUILD_URL;
|
|
16 |
*/
|
17 |
import { Edit, Save } from './edit';
|
18 |
|
19 |
-
// @todo Sample block should only be visible in correct areas, not top level.
|
20 |
registerCheckoutBlock( 'woocommerce/checkout-sample-block', {
|
21 |
component: lazy( () =>
|
22 |
import( /* webpackChunkName: "checkout-blocks/sample" */ './frontend' )
|
16 |
*/
|
17 |
import { Edit, Save } from './edit';
|
18 |
|
|
|
19 |
registerCheckoutBlock( 'woocommerce/checkout-sample-block', {
|
20 |
component: lazy( () =>
|
21 |
import( /* webpackChunkName: "checkout-blocks/sample" */ './frontend' )
|
assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/index.tsx
CHANGED
@@ -13,4 +13,3 @@ import './checkout-order-summary-block';
|
|
13 |
import './checkout-payment-block';
|
14 |
import './checkout-express-payment-block';
|
15 |
import './checkout-shipping-methods-block';
|
16 |
-
import './checkout-sample-block';
|
13 |
import './checkout-payment-block';
|
14 |
import './checkout-express-payment-block';
|
15 |
import './checkout-shipping-methods-block';
|
|
assets/js/blocks/cart-checkout/checkout-i2/inner-blocks/register-components.ts
CHANGED
@@ -9,6 +9,11 @@ import { WC_BLOCKS_BUILD_URL } from '@woocommerce/block-settings';
|
|
9 |
// eslint-disable-next-line no-undef,camelcase
|
10 |
__webpack_public_path__ = WC_BLOCKS_BUILD_URL;
|
11 |
|
|
|
|
|
|
|
|
|
|
|
12 |
registerBlockComponent( {
|
13 |
blockName: 'woocommerce/checkout-fields-block',
|
14 |
component: lazy( () =>
|
9 |
// eslint-disable-next-line no-undef,camelcase
|
10 |
__webpack_public_path__ = WC_BLOCKS_BUILD_URL;
|
11 |
|
12 |
+
/**
|
13 |
+
* Internal dependencies
|
14 |
+
*/
|
15 |
+
import './checkout-sample-block';
|
16 |
+
|
17 |
registerBlockComponent( {
|
18 |
blockName: 'woocommerce/checkout-fields-block',
|
19 |
component: lazy( () =>
|
assets/js/blocks/cart-checkout/checkout-i2/styles/style.scss
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
// Loading skeleton.
|
|
|
2 |
.is-loading.wp-block-woocommerce-checkout-i2 {
|
3 |
.wp-block-woocommerce-checkout-totals-block,
|
4 |
.wp-block-woocommerce-checkout-fields-block {
|
@@ -39,13 +40,13 @@
|
|
39 |
.wp-block-woocommerce-checkout-fields-block {
|
40 |
box-sizing: border-box;
|
41 |
margin: 0;
|
42 |
-
padding-right: percentage($gap-largest
|
43 |
width: 65%;
|
44 |
}
|
45 |
.wp-block-woocommerce-checkout-totals-block {
|
46 |
box-sizing: border-box;
|
47 |
margin: 0;
|
48 |
-
padding-left: percentage($gap-large
|
49 |
width: 35%;
|
50 |
|
51 |
.wc-block-components-panel > h2 {
|
1 |
// Loading skeleton.
|
2 |
+
|
3 |
.is-loading.wp-block-woocommerce-checkout-i2 {
|
4 |
.wp-block-woocommerce-checkout-totals-block,
|
5 |
.wp-block-woocommerce-checkout-fields-block {
|
40 |
.wp-block-woocommerce-checkout-fields-block {
|
41 |
box-sizing: border-box;
|
42 |
margin: 0;
|
43 |
+
padding-right: percentage(math.div($gap-largest, 1060px)); // ~1060px is the default width of the content area in Storefront.
|
44 |
width: 65%;
|
45 |
}
|
46 |
.wp-block-woocommerce-checkout-totals-block {
|
47 |
box-sizing: border-box;
|
48 |
margin: 0;
|
49 |
+
padding-left: percentage(math.div($gap-large, 1060px));
|
50 |
width: 35%;
|
51 |
|
52 |
.wc-block-components-panel > h2 {
|
assets/js/blocks/cart-checkout/checkout/form/style.scss
CHANGED
@@ -25,8 +25,8 @@
|
|
25 |
.wc-block-checkout__billing-fields,
|
26 |
.wc-block-checkout__shipping-fields {
|
27 |
.wc-block-components-address-form {
|
28 |
-
margin-left: #{-$gap-small
|
29 |
-
margin-right: #{-$gap-small
|
30 |
|
31 |
&::after {
|
32 |
content: "";
|
@@ -38,8 +38,8 @@
|
|
38 |
.wc-block-components-country-input,
|
39 |
.wc-block-components-state-input {
|
40 |
float: left;
|
41 |
-
margin-left: #{$gap-small
|
42 |
-
margin-right: #{$gap-small
|
43 |
position: relative;
|
44 |
width: calc(50% - #{$gap-small});
|
45 |
|
25 |
.wc-block-checkout__billing-fields,
|
26 |
.wc-block-checkout__shipping-fields {
|
27 |
.wc-block-components-address-form {
|
28 |
+
margin-left: #{-$gap-small * 0.5};
|
29 |
+
margin-right: #{-$gap-small * 0.5};
|
30 |
|
31 |
&::after {
|
32 |
content: "";
|
38 |
.wc-block-components-country-input,
|
39 |
.wc-block-components-state-input {
|
40 |
float: left;
|
41 |
+
margin-left: #{$gap-small * 0.5};
|
42 |
+
margin-right: #{$gap-small * 0.5};
|
43 |
position: relative;
|
44 |
width: calc(50% - #{$gap-small});
|
45 |
|
assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { renderFrontend } from '@woocommerce/base-utils';
|
6 |
+
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
7 |
+
import {
|
8 |
+
withStoreCartApiHydration,
|
9 |
+
withRestApiHydration,
|
10 |
+
} from '@woocommerce/block-hocs';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Internal dependencies
|
14 |
+
*/
|
15 |
+
import CartLineItemsTable from '../cart/full-cart/cart-line-items-table';
|
16 |
+
|
17 |
+
const MiniCartContents = () => {
|
18 |
+
const { cartItems, cartIsLoading } = useStoreCart();
|
19 |
+
|
20 |
+
if ( cartItems.length === 0 ) {
|
21 |
+
return <>{ __( 'Cart is empty', 'woo-gutenberg-products-block' ) }</>;
|
22 |
+
}
|
23 |
+
|
24 |
+
return (
|
25 |
+
<CartLineItemsTable
|
26 |
+
lineItems={ cartItems }
|
27 |
+
isLoading={ cartIsLoading }
|
28 |
+
/>
|
29 |
+
);
|
30 |
+
};
|
31 |
+
|
32 |
+
renderFrontend( {
|
33 |
+
selector: '.wc-block-mini-cart__contents',
|
34 |
+
Block: withStoreCartApiHydration(
|
35 |
+
withRestApiHydration( MiniCartContents )
|
36 |
+
),
|
37 |
+
} );
|
assets/js/blocks/cart-checkout/mini-cart/edit.tsx
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { _n, sprintf } from '@wordpress/i18n';
|
5 |
+
import { useBlockProps } from '@wordpress/block-editor';
|
6 |
+
import type { ReactElement } from 'react';
|
7 |
+
|
8 |
+
const MiniCartBlock = (): ReactElement => {
|
9 |
+
const blockProps = useBlockProps( {
|
10 |
+
className: 'wc-block-mini-cart',
|
11 |
+
} );
|
12 |
+
|
13 |
+
const productCount = 0;
|
14 |
+
|
15 |
+
return (
|
16 |
+
<div { ...blockProps }>
|
17 |
+
<button className="wc-block-mini-cart__button">
|
18 |
+
{ sprintf(
|
19 |
+
/* translators: %d is the number of products in the cart. */
|
20 |
+
_n(
|
21 |
+
'%d product',
|
22 |
+
'%d products',
|
23 |
+
productCount,
|
24 |
+
'woo-gutenberg-products-block'
|
25 |
+
),
|
26 |
+
productCount
|
27 |
+
) }
|
28 |
+
</button>
|
29 |
+
</div>
|
30 |
+
);
|
31 |
+
};
|
32 |
+
|
33 |
+
export default MiniCartBlock;
|
assets/js/blocks/cart-checkout/mini-cart/frontend.ts
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { getSetting } from '@woocommerce/settings';
|
5 |
+
import preloadScript from '@woocommerce/base-utils/preload-script';
|
6 |
+
import lazyLoadScript from '@woocommerce/base-utils/lazy-load-script';
|
7 |
+
|
8 |
+
interface dependencyData {
|
9 |
+
src: string;
|
10 |
+
version?: string;
|
11 |
+
after?: string;
|
12 |
+
before?: string;
|
13 |
+
translations?: string;
|
14 |
+
}
|
15 |
+
|
16 |
+
// eslint-disable-next-line @wordpress/no-global-event-listener
|
17 |
+
window.onload = () => {
|
18 |
+
const miniCartBlocks = document.querySelectorAll( '.wc-block-mini-cart' );
|
19 |
+
|
20 |
+
if ( miniCartBlocks.length === 0 ) {
|
21 |
+
return;
|
22 |
+
}
|
23 |
+
|
24 |
+
const dependencies = getSetting(
|
25 |
+
'mini_cart_block_frontend_dependencies',
|
26 |
+
{}
|
27 |
+
) as Record< string, dependencyData >;
|
28 |
+
|
29 |
+
// Preload scripts
|
30 |
+
for ( const dependencyHandle in dependencies ) {
|
31 |
+
const dependency = dependencies[ dependencyHandle ];
|
32 |
+
preloadScript( {
|
33 |
+
handle: dependencyHandle,
|
34 |
+
...dependency,
|
35 |
+
} );
|
36 |
+
}
|
37 |
+
|
38 |
+
miniCartBlocks.forEach( ( miniCartBlock ) => {
|
39 |
+
const miniCartButton = miniCartBlock.querySelector(
|
40 |
+
'.wc-block-mini-cart__button'
|
41 |
+
);
|
42 |
+
const miniCartContents = miniCartBlock.querySelector(
|
43 |
+
'.wc-block-mini-cart__contents'
|
44 |
+
);
|
45 |
+
|
46 |
+
if ( ! miniCartButton || ! miniCartContents ) {
|
47 |
+
// Markup is not correct, abort.
|
48 |
+
return;
|
49 |
+
}
|
50 |
+
|
51 |
+
const showContents = async () => {
|
52 |
+
miniCartContents.removeAttribute( 'hidden' );
|
53 |
+
|
54 |
+
// Load scripts
|
55 |
+
for ( const dependencyHandle in dependencies ) {
|
56 |
+
const dependency = dependencies[ dependencyHandle ];
|
57 |
+
await lazyLoadScript( {
|
58 |
+
handle: dependencyHandle,
|
59 |
+
...dependency,
|
60 |
+
} );
|
61 |
+
}
|
62 |
+
};
|
63 |
+
const hideContents = () =>
|
64 |
+
miniCartContents.setAttribute( 'hidden', 'true' );
|
65 |
+
|
66 |
+
miniCartButton.addEventListener( 'mouseover', showContents );
|
67 |
+
miniCartButton.addEventListener( 'mouseleave', hideContents );
|
68 |
+
|
69 |
+
miniCartContents.addEventListener( 'mouseover', showContents );
|
70 |
+
miniCartContents.addEventListener( 'mouseleave', hideContents );
|
71 |
+
|
72 |
+
miniCartButton.addEventListener( 'focus', showContents );
|
73 |
+
miniCartButton.addEventListener( 'blur', hideContents );
|
74 |
+
} );
|
75 |
+
};
|
assets/js/blocks/cart-checkout/mini-cart/index.tsx
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Icon, cart } from '@woocommerce/icons';
|
6 |
+
import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Internal dependencies
|
10 |
+
*/
|
11 |
+
import edit from './edit';
|
12 |
+
|
13 |
+
const settings = {
|
14 |
+
apiVersion: 2,
|
15 |
+
title: __( 'Mini Cart', 'woo-gutenberg-products-block' ),
|
16 |
+
icon: {
|
17 |
+
src: <Icon srcElement={ cart } />,
|
18 |
+
foreground: '#96588a',
|
19 |
+
},
|
20 |
+
category: 'woocommerce',
|
21 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
22 |
+
description: __(
|
23 |
+
'Display a mini cart widget.',
|
24 |
+
'woo-gutenberg-products-block'
|
25 |
+
),
|
26 |
+
supports: {
|
27 |
+
html: false,
|
28 |
+
multiple: false,
|
29 |
+
},
|
30 |
+
example: {
|
31 |
+
attributes: {
|
32 |
+
isPreview: true,
|
33 |
+
},
|
34 |
+
},
|
35 |
+
attributes: {
|
36 |
+
isPreview: {
|
37 |
+
type: 'boolean',
|
38 |
+
default: false,
|
39 |
+
save: false,
|
40 |
+
},
|
41 |
+
},
|
42 |
+
|
43 |
+
edit,
|
44 |
+
|
45 |
+
save() {
|
46 |
+
return null;
|
47 |
+
},
|
48 |
+
};
|
49 |
+
|
50 |
+
registerFeaturePluginBlockType( 'woocommerce/mini-cart', settings );
|
assets/js/blocks/featured-category/style.scss
CHANGED
@@ -107,7 +107,7 @@
|
|
107 |
// Apply max-width to floated items that have no intrinsic width
|
108 |
&.alignleft,
|
109 |
&.alignright {
|
110 |
-
max-width: $content-width
|
111 |
width: 100%;
|
112 |
}
|
113 |
|
107 |
// Apply max-width to floated items that have no intrinsic width
|
108 |
&.alignleft,
|
109 |
&.alignright {
|
110 |
+
max-width: $content-width * 0.5;
|
111 |
width: 100%;
|
112 |
}
|
113 |
|
assets/js/blocks/featured-product/style.scss
CHANGED
@@ -119,7 +119,7 @@
|
|
119 |
// Apply max-width to floated items that have no intrinsic width
|
120 |
&.alignleft,
|
121 |
&.alignright {
|
122 |
-
max-width: $content-width
|
123 |
width: 100%;
|
124 |
}
|
125 |
|
119 |
// Apply max-width to floated items that have no intrinsic width
|
120 |
&.alignleft,
|
121 |
&.alignright {
|
122 |
+
max-width: $content-width * 0.5;
|
123 |
width: 100%;
|
124 |
}
|
125 |
|
assets/js/blocks/products/all-products/block.js
CHANGED
@@ -6,7 +6,6 @@ import PropTypes from 'prop-types';
|
|
6 |
import { ProductListContainer } from '@woocommerce/base-components/product-list';
|
7 |
import { InnerBlockLayoutContextProvider } from '@woocommerce/shared-context';
|
8 |
import { gridBlockPreview } from '@woocommerce/resource-previews';
|
9 |
-
import { getSetting } from '@woocommerce/settings';
|
10 |
|
11 |
/**
|
12 |
* The All Products Block.
|
@@ -26,8 +25,6 @@ class Block extends Component {
|
|
26 |
return gridBlockPreview;
|
27 |
}
|
28 |
|
29 |
-
const hideOutOfStockItems = getSetting( 'hideOutOfStockItems', false );
|
30 |
-
|
31 |
/**
|
32 |
* Todo classes
|
33 |
*
|
@@ -42,7 +39,6 @@ class Block extends Component {
|
|
42 |
<ProductListContainer
|
43 |
attributes={ attributes }
|
44 |
urlParameterSuffix={ urlParameterSuffix }
|
45 |
-
hideOutOfStockItems={ hideOutOfStockItems }
|
46 |
/>
|
47 |
</InnerBlockLayoutContextProvider>
|
48 |
);
|
6 |
import { ProductListContainer } from '@woocommerce/base-components/product-list';
|
7 |
import { InnerBlockLayoutContextProvider } from '@woocommerce/shared-context';
|
8 |
import { gridBlockPreview } from '@woocommerce/resource-previews';
|
|
|
9 |
|
10 |
/**
|
11 |
* The All Products Block.
|
25 |
return gridBlockPreview;
|
26 |
}
|
27 |
|
|
|
|
|
28 |
/**
|
29 |
* Todo classes
|
30 |
*
|
39 |
<ProductListContainer
|
40 |
attributes={ attributes }
|
41 |
urlParameterSuffix={ urlParameterSuffix }
|
|
|
42 |
/>
|
43 |
</InnerBlockLayoutContextProvider>
|
44 |
);
|
assets/js/blocks/reviews/frontend-block.js
CHANGED
@@ -19,6 +19,7 @@ import withReviews from '@woocommerce/base-hocs/with-reviews';
|
|
19 |
* @param {function(any):any} props.onAppendReviews Function called when appending review.
|
20 |
* @param {function(any):any} props.onChangeOrderby
|
21 |
* @param {Array} props.reviews
|
|
|
22 |
* @param {number} props.totalReviews
|
23 |
*/
|
24 |
const FrontendBlock = ( {
|
@@ -26,10 +27,9 @@ const FrontendBlock = ( {
|
|
26 |
onAppendReviews,
|
27 |
onChangeOrderby,
|
28 |
reviews,
|
|
|
29 |
totalReviews,
|
30 |
} ) => {
|
31 |
-
const { orderby } = attributes;
|
32 |
-
|
33 |
if ( reviews.length === 0 ) {
|
34 |
return null;
|
35 |
}
|
@@ -40,7 +40,7 @@ const FrontendBlock = ( {
|
|
40 |
<>
|
41 |
{ attributes.showOrderby !== 'false' && reviewRatingsEnabled && (
|
42 |
<ReviewSortSelect
|
43 |
-
|
44 |
onChange={ onChangeOrderby }
|
45 |
/>
|
46 |
) }
|
19 |
* @param {function(any):any} props.onAppendReviews Function called when appending review.
|
20 |
* @param {function(any):any} props.onChangeOrderby
|
21 |
* @param {Array} props.reviews
|
22 |
+
* @param {string} props.sortSelectValue
|
23 |
* @param {number} props.totalReviews
|
24 |
*/
|
25 |
const FrontendBlock = ( {
|
27 |
onAppendReviews,
|
28 |
onChangeOrderby,
|
29 |
reviews,
|
30 |
+
sortSelectValue,
|
31 |
totalReviews,
|
32 |
} ) => {
|
|
|
|
|
33 |
if ( reviews.length === 0 ) {
|
34 |
return null;
|
35 |
}
|
40 |
<>
|
41 |
{ attributes.showOrderby !== 'false' && reviewRatingsEnabled && (
|
42 |
<ReviewSortSelect
|
43 |
+
value={ sortSelectValue }
|
44 |
onChange={ onChangeOrderby }
|
45 |
/>
|
46 |
) }
|
assets/js/blocks/reviews/frontend-container-block.js
CHANGED
@@ -95,6 +95,7 @@ class FrontendContainerBlock extends Component {
|
|
95 |
orderby={ orderby }
|
96 |
productId={ productId }
|
97 |
reviewsToDisplay={ reviewsToDisplay }
|
|
|
98 |
/>
|
99 |
);
|
100 |
}
|
95 |
orderby={ orderby }
|
96 |
productId={ productId }
|
97 |
reviewsToDisplay={ reviewsToDisplay }
|
98 |
+
sortSelectValue={ this.state.orderby }
|
99 |
/>
|
100 |
);
|
101 |
}
|
assets/js/blocks/stock-filter/block.js
ADDED
@@ -0,0 +1,278 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, sprintf } from '@wordpress/i18n';
|
5 |
+
import { speak } from '@wordpress/a11y';
|
6 |
+
import { usePrevious, useShallowEqual } from '@woocommerce/base-hooks';
|
7 |
+
import {
|
8 |
+
useQueryStateByKey,
|
9 |
+
useQueryStateByContext,
|
10 |
+
useCollectionData,
|
11 |
+
} from '@woocommerce/base-context/hooks';
|
12 |
+
import { getSetting } from '@woocommerce/settings';
|
13 |
+
import { useCallback, useEffect, useState, useMemo } from '@wordpress/element';
|
14 |
+
import CheckboxList from '@woocommerce/base-components/checkbox-list';
|
15 |
+
import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
|
16 |
+
import Label from '@woocommerce/base-components/filter-element-label';
|
17 |
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
18 |
+
import { decodeEntities } from '@wordpress/html-entities';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Internal dependencies
|
22 |
+
*/
|
23 |
+
import { previewOptions } from './preview';
|
24 |
+
import './style.scss';
|
25 |
+
|
26 |
+
const hideOutOfStockItems = getSetting( 'hideOutOfStockItems', false );
|
27 |
+
const { outofstock, ...otherStockStatusOptions } = getSetting(
|
28 |
+
'stockStatusOptions',
|
29 |
+
{}
|
30 |
+
);
|
31 |
+
const STOCK_STATUS_OPTIONS = hideOutOfStockItems
|
32 |
+
? otherStockStatusOptions
|
33 |
+
: { outofstock, ...otherStockStatusOptions };
|
34 |
+
// Filter added to handle if there are slugs without a corresponding name defined.
|
35 |
+
const initialOptions = Object.entries( STOCK_STATUS_OPTIONS )
|
36 |
+
.map( ( [ slug, name ] ) => ( { slug, name } ) )
|
37 |
+
.filter( ( status ) => !! status.name )
|
38 |
+
.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Component displaying an stock status filter.
|
42 |
+
*
|
43 |
+
* @param {Object} props Incoming props for the component.
|
44 |
+
* @param {Object} props.attributes Incoming block attributes.
|
45 |
+
* @param {boolean} props.isEditor
|
46 |
+
*/
|
47 |
+
const StockStatusFilterBlock = ( {
|
48 |
+
attributes: blockAttributes,
|
49 |
+
isEditor = false,
|
50 |
+
} ) => {
|
51 |
+
const [ checked, setChecked ] = useState( [] );
|
52 |
+
const [ displayedOptions, setDisplayedOptions ] = useState(
|
53 |
+
blockAttributes.isPreview ? previewOptions : []
|
54 |
+
);
|
55 |
+
|
56 |
+
const [ queryState ] = useQueryStateByContext();
|
57 |
+
const [
|
58 |
+
productStockStatusQuery,
|
59 |
+
setProductStockStatusQuery,
|
60 |
+
] = useQueryStateByKey( 'stock_status', [] );
|
61 |
+
|
62 |
+
const {
|
63 |
+
results: filteredCounts,
|
64 |
+
isLoading: filteredCountsLoading,
|
65 |
+
} = useCollectionData( {
|
66 |
+
queryStock: true,
|
67 |
+
queryState,
|
68 |
+
} );
|
69 |
+
|
70 |
+
/**
|
71 |
+
* Get count data about a given status by slug.
|
72 |
+
*/
|
73 |
+
const getFilteredStock = useCallback(
|
74 |
+
( slug ) => {
|
75 |
+
if ( ! filteredCounts.stock_status_counts ) {
|
76 |
+
return null;
|
77 |
+
}
|
78 |
+
return filteredCounts.stock_status_counts.find(
|
79 |
+
( { status, count } ) =>
|
80 |
+
status === slug && Number( count ) !== 0
|
81 |
+
);
|
82 |
+
},
|
83 |
+
[ filteredCounts ]
|
84 |
+
);
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Compare intersection of all stock statuses and filtered counts to get a list of options to display.
|
88 |
+
*/
|
89 |
+
useEffect( () => {
|
90 |
+
/**
|
91 |
+
* Checks if a status slug is in the query state.
|
92 |
+
*
|
93 |
+
* @param {string} queryStatus The status slug to check.
|
94 |
+
*/
|
95 |
+
const isStockStatusInQueryState = ( queryStatus ) => {
|
96 |
+
if ( ! queryState?.stock_status ) {
|
97 |
+
return false;
|
98 |
+
}
|
99 |
+
return queryState.stock_status.some( ( { status = [] } ) =>
|
100 |
+
status.includes( queryStatus )
|
101 |
+
);
|
102 |
+
};
|
103 |
+
|
104 |
+
if ( filteredCountsLoading || blockAttributes.isPreview ) {
|
105 |
+
return;
|
106 |
+
}
|
107 |
+
|
108 |
+
const newOptions = initialOptions
|
109 |
+
.map( ( status ) => {
|
110 |
+
const filteredStock = getFilteredStock( status.slug );
|
111 |
+
|
112 |
+
if (
|
113 |
+
! filteredStock &&
|
114 |
+
! checked.includes( status.slug ) &&
|
115 |
+
! isStockStatusInQueryState( status.slug )
|
116 |
+
) {
|
117 |
+
return null;
|
118 |
+
}
|
119 |
+
|
120 |
+
const count = filteredStock ? Number( filteredStock.count ) : 0;
|
121 |
+
|
122 |
+
return {
|
123 |
+
value: status.slug,
|
124 |
+
name: decodeEntities( status.name ),
|
125 |
+
label: (
|
126 |
+
<Label
|
127 |
+
name={ decodeEntities( status.name ) }
|
128 |
+
count={ blockAttributes.showCounts ? count : null }
|
129 |
+
/>
|
130 |
+
),
|
131 |
+
};
|
132 |
+
} )
|
133 |
+
.filter( Boolean );
|
134 |
+
|
135 |
+
setDisplayedOptions( newOptions );
|
136 |
+
}, [
|
137 |
+
blockAttributes.showCounts,
|
138 |
+
blockAttributes.isPreview,
|
139 |
+
filteredCountsLoading,
|
140 |
+
getFilteredStock,
|
141 |
+
checked,
|
142 |
+
queryState.stock_status,
|
143 |
+
] );
|
144 |
+
|
145 |
+
const onSubmit = useCallback(
|
146 |
+
( isChecked ) => {
|
147 |
+
if ( isEditor ) {
|
148 |
+
return;
|
149 |
+
}
|
150 |
+
if ( isChecked ) {
|
151 |
+
setProductStockStatusQuery( checked );
|
152 |
+
}
|
153 |
+
},
|
154 |
+
[ isEditor, setProductStockStatusQuery, checked ]
|
155 |
+
);
|
156 |
+
|
157 |
+
// Track checked STATE changes - if state changes, update the query.
|
158 |
+
useEffect( () => {
|
159 |
+
if ( ! blockAttributes.showFilterButton ) {
|
160 |
+
onSubmit( checked );
|
161 |
+
}
|
162 |
+
}, [ blockAttributes.showFilterButton, checked, onSubmit ] );
|
163 |
+
|
164 |
+
const checkedQuery = useMemo( () => {
|
165 |
+
return productStockStatusQuery;
|
166 |
+
}, [ productStockStatusQuery ] );
|
167 |
+
|
168 |
+
const currentCheckedQuery = useShallowEqual( checkedQuery );
|
169 |
+
const previousCheckedQuery = usePrevious( currentCheckedQuery );
|
170 |
+
// Track Stock query changes so the block reflects current filters.
|
171 |
+
useEffect( () => {
|
172 |
+
if (
|
173 |
+
! isShallowEqual( previousCheckedQuery, currentCheckedQuery ) && // Checked query changed.
|
174 |
+
! isShallowEqual( checked, currentCheckedQuery ) // Checked query doesn't match the UI.
|
175 |
+
) {
|
176 |
+
setChecked( currentCheckedQuery );
|
177 |
+
}
|
178 |
+
}, [ checked, currentCheckedQuery, previousCheckedQuery ] );
|
179 |
+
|
180 |
+
/**
|
181 |
+
* When a checkbox in the list changes, update state.
|
182 |
+
*/
|
183 |
+
const onChange = useCallback(
|
184 |
+
( checkedValue ) => {
|
185 |
+
const getFilterNameFromValue = ( filterValue ) => {
|
186 |
+
const { name } = displayedOptions.find(
|
187 |
+
( option ) => option.value === filterValue
|
188 |
+
);
|
189 |
+
|
190 |
+
return name;
|
191 |
+
};
|
192 |
+
|
193 |
+
const announceFilterChange = ( { filterAdded, filterRemoved } ) => {
|
194 |
+
const filterAddedName = filterAdded
|
195 |
+
? getFilterNameFromValue( filterAdded )
|
196 |
+
: null;
|
197 |
+
const filterRemovedName = filterRemoved
|
198 |
+
? getFilterNameFromValue( filterRemoved )
|
199 |
+
: null;
|
200 |
+
if ( filterAddedName ) {
|
201 |
+
speak(
|
202 |
+
sprintf(
|
203 |
+
/* translators: %s stock statuses (for example: 'instock'...) */
|
204 |
+
__(
|
205 |
+
'%s filter added.',
|
206 |
+
'woo-gutenberg-products-block'
|
207 |
+
),
|
208 |
+
filterAddedName
|
209 |
+
)
|
210 |
+
);
|
211 |
+
} else if ( filterRemovedName ) {
|
212 |
+
speak(
|
213 |
+
sprintf(
|
214 |
+
/* translators: %s stock statuses (for example:'instock'...) */
|
215 |
+
__(
|
216 |
+
'%s filter removed.',
|
217 |
+
'woo-gutenberg-products-block'
|
218 |
+
),
|
219 |
+
filterRemovedName
|
220 |
+
)
|
221 |
+
);
|
222 |
+
}
|
223 |
+
};
|
224 |
+
|
225 |
+
const previouslyChecked = checked.includes( checkedValue );
|
226 |
+
|
227 |
+
const newChecked = checked.filter(
|
228 |
+
( value ) => value !== checkedValue
|
229 |
+
);
|
230 |
+
|
231 |
+
if ( ! previouslyChecked ) {
|
232 |
+
newChecked.push( checkedValue );
|
233 |
+
newChecked.sort();
|
234 |
+
announceFilterChange( { filterAdded: checkedValue } );
|
235 |
+
} else {
|
236 |
+
announceFilterChange( { filterRemoved: checkedValue } );
|
237 |
+
}
|
238 |
+
|
239 |
+
setChecked( newChecked );
|
240 |
+
},
|
241 |
+
[ checked, displayedOptions ]
|
242 |
+
);
|
243 |
+
|
244 |
+
if ( displayedOptions.length === 0 ) {
|
245 |
+
return null;
|
246 |
+
}
|
247 |
+
|
248 |
+
const TagName = `h${ blockAttributes.headingLevel }`;
|
249 |
+
const isLoading = ! blockAttributes.isPreview && ! STOCK_STATUS_OPTIONS;
|
250 |
+
const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
|
251 |
+
|
252 |
+
return (
|
253 |
+
<>
|
254 |
+
{ ! isEditor && blockAttributes.heading && (
|
255 |
+
<TagName>{ blockAttributes.heading }</TagName>
|
256 |
+
) }
|
257 |
+
<div className="wc-block-stock-filter">
|
258 |
+
<CheckboxList
|
259 |
+
className={ 'wc-block-stock-filter-list' }
|
260 |
+
options={ displayedOptions }
|
261 |
+
checked={ checked }
|
262 |
+
onChange={ onChange }
|
263 |
+
isLoading={ isLoading }
|
264 |
+
isDisabled={ isDisabled }
|
265 |
+
/>
|
266 |
+
{ blockAttributes.showFilterButton && (
|
267 |
+
<FilterSubmitButton
|
268 |
+
className="wc-block-stock-filter__button"
|
269 |
+
disabled={ isLoading || isDisabled }
|
270 |
+
onClick={ () => onSubmit( checked ) }
|
271 |
+
/>
|
272 |
+
) }
|
273 |
+
</div>
|
274 |
+
</>
|
275 |
+
);
|
276 |
+
};
|
277 |
+
|
278 |
+
export default StockStatusFilterBlock;
|
assets/js/blocks/stock-filter/edit.js
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { InspectorControls } from '@wordpress/block-editor';
|
6 |
+
import {
|
7 |
+
Disabled,
|
8 |
+
PanelBody,
|
9 |
+
ToggleControl,
|
10 |
+
withSpokenMessages,
|
11 |
+
} from '@wordpress/components';
|
12 |
+
import HeadingToolbar from '@woocommerce/editor-components/heading-toolbar';
|
13 |
+
import BlockTitle from '@woocommerce/editor-components/block-title';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Internal dependencies
|
17 |
+
*/
|
18 |
+
import Block from './block.js';
|
19 |
+
import './editor.scss';
|
20 |
+
|
21 |
+
const Edit = ( { attributes, setAttributes } ) => {
|
22 |
+
const {
|
23 |
+
className,
|
24 |
+
heading,
|
25 |
+
headingLevel,
|
26 |
+
showCounts,
|
27 |
+
showFilterButton,
|
28 |
+
} = attributes;
|
29 |
+
|
30 |
+
const getInspectorControls = () => {
|
31 |
+
return (
|
32 |
+
<InspectorControls key="inspector">
|
33 |
+
<PanelBody
|
34 |
+
title={ __( 'Content', 'woo-gutenberg-products-block' ) }
|
35 |
+
>
|
36 |
+
<ToggleControl
|
37 |
+
label={ __(
|
38 |
+
'Product count',
|
39 |
+
'woo-gutenberg-products-block'
|
40 |
+
) }
|
41 |
+
help={
|
42 |
+
showCounts
|
43 |
+
? __(
|
44 |
+
'Product count is visible.',
|
45 |
+
'woo-gutenberg-products-block'
|
46 |
+
)
|
47 |
+
: __(
|
48 |
+
'Product count is hidden.',
|
49 |
+
'woo-gutenberg-products-block'
|
50 |
+
)
|
51 |
+
}
|
52 |
+
checked={ showCounts }
|
53 |
+
onChange={ () =>
|
54 |
+
setAttributes( {
|
55 |
+
showCounts: ! showCounts,
|
56 |
+
} )
|
57 |
+
}
|
58 |
+
/>
|
59 |
+
<p>
|
60 |
+
{ __(
|
61 |
+
'Heading Level',
|
62 |
+
'woo-gutenberg-products-block'
|
63 |
+
) }
|
64 |
+
</p>
|
65 |
+
<HeadingToolbar
|
66 |
+
isCollapsed={ false }
|
67 |
+
minLevel={ 2 }
|
68 |
+
maxLevel={ 7 }
|
69 |
+
selectedLevel={ headingLevel }
|
70 |
+
onChange={ ( newLevel ) =>
|
71 |
+
setAttributes( { headingLevel: newLevel } )
|
72 |
+
}
|
73 |
+
/>
|
74 |
+
</PanelBody>
|
75 |
+
<PanelBody
|
76 |
+
title={ __(
|
77 |
+
'Block Settings',
|
78 |
+
'woo-gutenberg-products-block'
|
79 |
+
) }
|
80 |
+
>
|
81 |
+
<ToggleControl
|
82 |
+
label={ __(
|
83 |
+
'Filter button',
|
84 |
+
'woo-gutenberg-products-block'
|
85 |
+
) }
|
86 |
+
help={
|
87 |
+
showFilterButton
|
88 |
+
? __(
|
89 |
+
'Products will only update when the button is pressed.',
|
90 |
+
'woo-gutenberg-products-block'
|
91 |
+
)
|
92 |
+
: __(
|
93 |
+
'Products will update as options are selected.',
|
94 |
+
'woo-gutenberg-products-block'
|
95 |
+
)
|
96 |
+
}
|
97 |
+
checked={ showFilterButton }
|
98 |
+
onChange={ ( value ) =>
|
99 |
+
setAttributes( {
|
100 |
+
showFilterButton: value,
|
101 |
+
} )
|
102 |
+
}
|
103 |
+
/>
|
104 |
+
</PanelBody>
|
105 |
+
</InspectorControls>
|
106 |
+
);
|
107 |
+
};
|
108 |
+
|
109 |
+
return (
|
110 |
+
<>
|
111 |
+
{ getInspectorControls() }
|
112 |
+
{
|
113 |
+
<div className={ className }>
|
114 |
+
<BlockTitle
|
115 |
+
headingLevel={ headingLevel }
|
116 |
+
heading={ heading }
|
117 |
+
onChange={ ( value ) =>
|
118 |
+
setAttributes( { heading: value } )
|
119 |
+
}
|
120 |
+
/>
|
121 |
+
<Disabled>
|
122 |
+
<Block attributes={ attributes } isEditor={ true } />
|
123 |
+
</Disabled>
|
124 |
+
</div>
|
125 |
+
}
|
126 |
+
</>
|
127 |
+
);
|
128 |
+
};
|
129 |
+
|
130 |
+
export default withSpokenMessages( Edit );
|
assets/js/blocks/stock-filter/editor.scss
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-stock-filter {
|
2 |
+
.components-placeholder__instructions {
|
3 |
+
border-bottom: 1px solid #e0e2e6;
|
4 |
+
width: 100%;
|
5 |
+
padding-bottom: 1em;
|
6 |
+
margin-bottom: 2em;
|
7 |
+
}
|
8 |
+
.components-placeholder__label svg {
|
9 |
+
fill: currentColor;
|
10 |
+
margin-right: 1ch;
|
11 |
+
}
|
12 |
+
.components-placeholder__fieldset {
|
13 |
+
display: block; /* Disable flex box */
|
14 |
+
}
|
15 |
+
.woocommerce-search-list__search {
|
16 |
+
border-top: 0;
|
17 |
+
margin-top: 0;
|
18 |
+
padding-top: 0;
|
19 |
+
}
|
20 |
+
.wc-block-stock-filter__add-stock-button {
|
21 |
+
margin: 0 0 1em;
|
22 |
+
vertical-align: middle;
|
23 |
+
height: auto;
|
24 |
+
padding: 0.5em 1em;
|
25 |
+
|
26 |
+
svg {
|
27 |
+
fill: currentColor;
|
28 |
+
margin-left: 0.5ch;
|
29 |
+
vertical-align: middle;
|
30 |
+
}
|
31 |
+
}
|
32 |
+
.wc-block-stock-filter__read_more_button {
|
33 |
+
display: block;
|
34 |
+
margin-bottom: 1em;
|
35 |
+
}
|
36 |
+
}
|
assets/js/blocks/stock-filter/frontend.js
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { withRestApiHydration } from '@woocommerce/block-hocs';
|
5 |
+
import { renderFrontend } from '@woocommerce/base-utils';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import Block from './block.js';
|
11 |
+
|
12 |
+
const getProps = ( el ) => {
|
13 |
+
return {
|
14 |
+
attributes: {
|
15 |
+
showCounts: el.dataset.showCounts === 'true',
|
16 |
+
heading: el.dataset.heading,
|
17 |
+
headingLevel: el.dataset.headingLevel || 3,
|
18 |
+
showFilterButton: el.dataset.showFilterButton === 'true',
|
19 |
+
},
|
20 |
+
};
|
21 |
+
};
|
22 |
+
|
23 |
+
renderFrontend( {
|
24 |
+
selector: '.wp-block-woocommerce-stock-filter',
|
25 |
+
Block: withRestApiHydration( Block ),
|
26 |
+
getProps,
|
27 |
+
} );
|
assets/js/blocks/stock-filter/index.js
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
import { Icon, server } from '@woocommerce/icons';
|
7 |
+
import classNames from 'classnames';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Internal dependencies
|
11 |
+
*/
|
12 |
+
import edit from './edit.js';
|
13 |
+
|
14 |
+
registerBlockType( 'woocommerce/stock-filter', {
|
15 |
+
title: __( 'Filter Products by Stock', 'woo-gutenberg-products-block' ),
|
16 |
+
icon: {
|
17 |
+
src: <Icon srcElement={ server } />,
|
18 |
+
foreground: '#96588a',
|
19 |
+
},
|
20 |
+
category: 'woocommerce',
|
21 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
22 |
+
description: __(
|
23 |
+
'Allow customers to filter the grid by products stock status. Works in combination with the All Products block.',
|
24 |
+
'woo-gutenberg-products-block'
|
25 |
+
),
|
26 |
+
supports: {
|
27 |
+
html: false,
|
28 |
+
multiple: false,
|
29 |
+
},
|
30 |
+
example: {
|
31 |
+
attributes: {
|
32 |
+
isPreview: true,
|
33 |
+
},
|
34 |
+
},
|
35 |
+
attributes: {
|
36 |
+
heading: {
|
37 |
+
type: 'string',
|
38 |
+
default: __(
|
39 |
+
'Filter by stock status',
|
40 |
+
'woo-gutenberg-products-block'
|
41 |
+
),
|
42 |
+
},
|
43 |
+
headingLevel: {
|
44 |
+
type: 'number',
|
45 |
+
default: 3,
|
46 |
+
},
|
47 |
+
showCounts: {
|
48 |
+
type: 'boolean',
|
49 |
+
default: true,
|
50 |
+
},
|
51 |
+
showFilterButton: {
|
52 |
+
type: 'boolean',
|
53 |
+
default: false,
|
54 |
+
},
|
55 |
+
/**
|
56 |
+
* Are we previewing?
|
57 |
+
*/
|
58 |
+
isPreview: {
|
59 |
+
type: 'boolean',
|
60 |
+
default: false,
|
61 |
+
},
|
62 |
+
},
|
63 |
+
edit,
|
64 |
+
// Save the props to post content.
|
65 |
+
save( { attributes } ) {
|
66 |
+
const {
|
67 |
+
className,
|
68 |
+
showCounts,
|
69 |
+
heading,
|
70 |
+
headingLevel,
|
71 |
+
showFilterButton,
|
72 |
+
} = attributes;
|
73 |
+
const data = {
|
74 |
+
'data-show-counts': showCounts,
|
75 |
+
'data-heading': heading,
|
76 |
+
'data-heading-level': headingLevel,
|
77 |
+
};
|
78 |
+
if ( showFilterButton ) {
|
79 |
+
data[ 'data-show-filter-button' ] = showFilterButton;
|
80 |
+
}
|
81 |
+
return (
|
82 |
+
<div
|
83 |
+
className={ classNames( 'is-loading', className ) }
|
84 |
+
{ ...data }
|
85 |
+
>
|
86 |
+
<span
|
87 |
+
aria-hidden
|
88 |
+
className="wc-block-product-stock-filter__placeholder"
|
89 |
+
/>
|
90 |
+
</div>
|
91 |
+
);
|
92 |
+
},
|
93 |
+
} );
|
assets/js/blocks/stock-filter/preview.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import Label from '@woocommerce/base-components/filter-element-label';
|
5 |
+
|
6 |
+
export const previewOptions = [
|
7 |
+
{
|
8 |
+
value: 'preview-1',
|
9 |
+
name: 'In Stock',
|
10 |
+
label: <Label name="In Stock" count={ 3 } />,
|
11 |
+
},
|
12 |
+
{
|
13 |
+
value: 'preview-2',
|
14 |
+
name: 'Out of sotck',
|
15 |
+
label: <Label name="Out of stock" count={ 3 } />,
|
16 |
+
},
|
17 |
+
{
|
18 |
+
value: 'preview-3',
|
19 |
+
name: 'On backorder',
|
20 |
+
label: <Label name="On backorder" count={ 2 } />,
|
21 |
+
},
|
22 |
+
];
|
assets/js/blocks/stock-filter/style.scss
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-stock-filter {
|
2 |
+
margin-bottom: $gap-large;
|
3 |
+
|
4 |
+
.wc-block-stock-filter-list {
|
5 |
+
margin: 0;
|
6 |
+
|
7 |
+
li {
|
8 |
+
text-decoration: underline;
|
9 |
+
|
10 |
+
label {
|
11 |
+
cursor: pointer;
|
12 |
+
}
|
13 |
+
|
14 |
+
input {
|
15 |
+
cursor: pointer;
|
16 |
+
display: inline-block;
|
17 |
+
}
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
.is-single,
|
22 |
+
.wc-block-dropdown-selector .wc-block-dropdown-selector__list {
|
23 |
+
opacity: 0.6;
|
24 |
+
}
|
25 |
+
|
26 |
+
.wc-block-stock-filter__button {
|
27 |
+
margin-top: $gap-smaller;
|
28 |
+
}
|
29 |
+
}
|
assets/js/editor-components/block-title/index.js
CHANGED
@@ -4,17 +4,32 @@
|
|
4 |
import PropTypes from 'prop-types';
|
5 |
import { PlainText } from '@wordpress/block-editor';
|
6 |
import classnames from 'classnames';
|
|
|
|
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
10 |
*/
|
11 |
import './editor.scss';
|
12 |
|
13 |
-
const BlockTitle = ( {
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
const TagName = `h${ headingLevel }`;
|
15 |
return (
|
16 |
<TagName>
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
<PlainText
|
|
|
18 |
className={ classnames(
|
19 |
'wc-block-editor-components-title',
|
20 |
className
|
@@ -45,4 +60,4 @@ BlockTitle.propTypes = {
|
|
45 |
headingLevel: PropTypes.number,
|
46 |
};
|
47 |
|
48 |
-
export default BlockTitle;
|
4 |
import PropTypes from 'prop-types';
|
5 |
import { PlainText } from '@wordpress/block-editor';
|
6 |
import classnames from 'classnames';
|
7 |
+
import { withInstanceId } from '@wordpress/compose';
|
8 |
+
import { __ } from '@wordpress/i18n';
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
12 |
*/
|
13 |
import './editor.scss';
|
14 |
|
15 |
+
const BlockTitle = ( {
|
16 |
+
className,
|
17 |
+
headingLevel,
|
18 |
+
onChange,
|
19 |
+
heading,
|
20 |
+
instanceId,
|
21 |
+
} ) => {
|
22 |
const TagName = `h${ headingLevel }`;
|
23 |
return (
|
24 |
<TagName>
|
25 |
+
<label
|
26 |
+
className="screen-reader-text"
|
27 |
+
htmlFor={ `block-title-${ instanceId }` }
|
28 |
+
>
|
29 |
+
{ __( 'Block title', 'woo-gutenberg-products-block' ) }
|
30 |
+
</label>
|
31 |
<PlainText
|
32 |
+
id={ `block-title-${ instanceId }` }
|
33 |
className={ classnames(
|
34 |
'wc-block-editor-components-title',
|
35 |
className
|
60 |
headingLevel: PropTypes.number,
|
61 |
};
|
62 |
|
63 |
+
export default withInstanceId( BlockTitle );
|
assets/js/icons/icon/index.tsx
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { cloneElement, isValidElement } from '@wordpress/element';
|
5 |
-
import type { ReactElement } from 'react';
|
6 |
|
7 |
interface IconProps {
|
8 |
srcElement?: ReactElement;
|
@@ -14,7 +14,8 @@ function Icon( {
|
|
14 |
srcElement,
|
15 |
size = 24,
|
16 |
...props
|
17 |
-
}: IconProps
|
|
|
18 |
if ( ! isValidElement( srcElement ) ) {
|
19 |
return null;
|
20 |
}
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { cloneElement, isValidElement } from '@wordpress/element';
|
5 |
+
import type { HTMLProps, ReactElement } from 'react';
|
6 |
|
7 |
interface IconProps {
|
8 |
srcElement?: ReactElement;
|
14 |
srcElement,
|
15 |
size = 24,
|
16 |
...props
|
17 |
+
}: IconProps &
|
18 |
+
HTMLProps< HTMLImageElement | SVGElement > ): ReactElement | null {
|
19 |
if ( ! isValidElement( srcElement ) ) {
|
20 |
return null;
|
21 |
}
|
assets/js/types/type-defs/index.ts
CHANGED
@@ -3,3 +3,4 @@ export * from './product-response';
|
|
3 |
export * from './cart';
|
4 |
export * from './hooks';
|
5 |
export * from './currency';
|
|
3 |
export * from './cart';
|
4 |
export * from './hooks';
|
5 |
export * from './currency';
|
6 |
+
export * from './payment-method-icon';
|
assets/js/types/type-defs/payment-method-icon.ts
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export interface PaymentMethodIcon {
|
2 |
+
id: string;
|
3 |
+
src: string | null;
|
4 |
+
alt: string;
|
5 |
+
}
|
build/active-filters-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-blocks', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-blocks', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => 'fcb5c29d786d066c0f2da2ca29bc7211');
|
build/active-filters-frontend.js
CHANGED
@@ -1,13 +1,13 @@
|
|
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=267)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wc.wcBlocksData},103:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(6),o=r.n(n),c=r(0),a=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return Object(c.useCallback)((function(e){t((function(){throw e}))}),[])}},117: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 m}));var n=r(6),o=r.n(n),c=r(10),a=r(13),i=r(0),s=r(27),u=r.n(s),l=r(66),p=r(122),f=r(70),b=function(e){var t=Object(f.a)();e=e||t;var r=Object(a.useSelect)((function(t){return t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),n=Object(a.useDispatch)(c.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[r,Object(i.useCallback)((function(t){n(e,t)}),[e,n])]},d=function(e,t,r){var n=Object(f.a)();r=r||n;var o=Object(a.useSelect)((function(n){return n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),s=Object(a.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(i.useCallback)((function(t){s(r,e,t)}),[r,e,s])]},m=function(e,t){var r=Object(f.a)(),n=b(t=t||r),c=o()(n,2),a=c[0],s=c[1],d=Object(l.a)(a),m=Object(l.a)(e),y=Object(p.a)(m),v=Object(i.useRef)(!1);return Object(i.useEffect)((function(){u()(y,m)||(s(Object.assign({},d,m)),v.current=!0)}),[d,m,y,s]),v.current?[a,s]:[e,s]}},12: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},e.exports.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},121:function(e,t,r){"use strict";r.d(t,"a",(function(){return b}));var n=r(12),o=r.n(n),c=r(5),a=r.n(c),i=r(0),s=r(54);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){a()(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 p=[".wp-block-woocommerce-cart"],f=function(e){var t=e.Block,r=e.containers,n=e.getProps,c=void 0===n?function(){}:n,a=e.getErrorBoundaryProps,u=void 0===a?function(){}:a;0!==r.length&&Array.prototype.forEach.call(r,(function(e,r){var n=c(e,r),a=u(e,r),p=l(l({},e.dataset),n.attributes);e.classList.remove("is-loading"),Object(i.render)(React.createElement(s.a,a,React.createElement(i.Suspense,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},n,{attributes:p})))),e)}))},b=function(e){var t,r,n,o,c,a,i,s=document.body.querySelectorAll(p.join(","));t=l(l({},e),{},{wrappers:s}),r=t.Block,n=t.getProps,o=t.getErrorBoundaryProps,c=t.selector,a=t.wrappers,i=document.body.querySelectorAll(c),a.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,a)})),f({Block:r,containers:i,getProps:n,getErrorBoundaryProps:o}),Array.prototype.forEach.call(s,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var r,n,o,c,a,i;n=(r=l(l({},e),{},{wrapper:t})).Block,o=r.getProps,c=r.getErrorBoundaryProps,a=r.selector,i=r.wrapper.querySelectorAll(a),f({Block:n,containers:i,getProps:o,getErrorBoundaryProps:c})}))}))}},122:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(4);function o(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},13:function(e,t){e.exports=window.wp.data},14:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"n",(function(){return a})),r.d(t,"m",(function(){return i})),r.d(t,"j",(function(){return u})),r.d(t,"d",(function(){return l})),r.d(t,"g",(function(){return p})),r.d(t,"f",(function(){return f})),r.d(t,"l",(function(){return b})),r.d(t,"k",(function(){return d})),r.d(t,"c",(function(){return m})),r.d(t,"e",(function(){return y})),r.d(t,"h",(function(){return v})),r.d(t,"a",(function(){return g})),r.d(t,"i",(function(){return O})),r.d(t,"b",(function(){return _})),r.d(t,"p",(function(){return h}));var n,o=r(2),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,u=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),p=o.STORE_PAGES.privacy.permalink,f=o.STORE_PAGES.privacy.title,b=o.STORE_PAGES.terms.permalink,d=o.STORE_PAGES.terms.title,m=(o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),y=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),v=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{}),h=(r(57),function(){return s>1})},143:function(e,t){},145:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(10),o=r(13),c=r(0),a=r(66),i=r(103),s=function(e){var t=e.namespace,r=e.resourceName,s=e.resourceValues,u=void 0===s?[]:s,l=e.query,p=void 0===l?{}:l,f=e.shouldSelect,b=void 0===f||f;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}),m=Object(a.a)(p),y=Object(a.a)(u),v=Object(i.a)(),g=Object(o.useSelect)((function(e){if(!b)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,m,y],a=o.getCollectionError.apply(o,c);return a&&v(a),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,y,m,b]);return null!==g&&(d.current=g),d.current}},150:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(17),a=r.n(c),i=r(0),s=["srcElement","size"];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=a()(e,s);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){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)):null}},151:function(e,t,r){"use strict";var n=r(0),o=r(10),c=r(13),a=r(14);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(a.o.restApiRoutes||{}),Object(c.useSelect)((function(e,t){if(r.current){var n=e(o.SCHEMA_STORE_KEY),c=n.isResolving,a=n.hasFinishedResolution,i=t.dispatch(o.SCHEMA_STORE_KEY),s=i.receiveRoutes,u=i.startResolution,l=i.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];c("getRoutes",[e])||a("getRoutes",[e])||(u("getRoutes",[e]),s(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},17:function(e,t,r){var n=r(85);e.exports=function(e,t){if(null==e)return{};var r,o,c=n(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c},e.exports.default=e.exports,e.exports.__esModule=!0},173:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var n=r(2),o=Object(n.getSetting)("attributes",[]).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}))},a=function(e){if(e)return o.find((function(t){return t.taxonomy===e}))}},174: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})),a=c.length?c[0]:null;if(a&&a.slug&&Array.isArray(a.slug)&&a.slug.includes(o)){var i=a.slug.filter((function(e){return e!==o})),s=e.filter((function(e){return e.attribute!==r.taxonomy}));i.length>0&&(a.slug=i.sort(),s.push(a)),t(Object(n.sortBy)(s,"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",a=e.filter((function(e){return e.attribute!==r.taxonomy}));0===o.length?t(a):(a.push({attribute:r.taxonomy,operator:c,slug:o.map((function(e){return e.slug})).sort()}),t(Object(n.sortBy)(a,"attribute")))}},180:function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(17),a=r.n(c),i=(r(8),r(3)),s=r.n(i),u=r(1),l=r(150),p=r(194),f=(r(143),["text","screenReaderText","element","className","radius","children"]),b=function(e){var t=e.text,r=e.screenReaderText,n=void 0===r?"":r,c=e.element,i=void 0===c?"li":c,u=e.className,l=void 0===u?"":u,p=e.radius,b=void 0===p?"small":p,d=e.children,m=void 0===d?null:d,y=a()(e,f),v=i,g=s()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+b),O=Boolean(n&&n!==t);return React.createElement(v,o()({className:g},y),React.createElement("span",{"aria-hidden":O,className:"wc-block-components-chip__text"},t),O&&React.createElement("span",{className:"screen-reader-text"},n),m)},d=["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"];t.a=function(e){var t=e.ariaLabel,r=void 0===t?"":t,n=e.className,c=void 0===n?"":n,i=e.disabled,f=void 0!==i&&i,m=e.onRemove,y=void 0===m?function(){}:m,v=e.removeOnAnyClick,g=void 0!==v&&v,O=e.text,_=e.screenReaderText,h=void 0===_?"":_,w=a()(e,d),x=g?"span":"button";if(!r){var E=h&&"string"==typeof h?h:O;r="string"!=typeof E?
|
2 |
/* translators: Remove chip. */
|
3 |
-
Object(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
-
Object(
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
-
Object(i.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(
|
8 |
/* translators: %s min price */
|
9 |
-
Object(i.__)("From %s","woo-gutenberg-products-block"),Object(
|
10 |
/* translators: %s max price */
|
11 |
-
Object(i.__)("Up to %s","woo-gutenberg-products-block"),Object(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r);return React.createElement("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},s&&React.createElement("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===u?React.createElement(m.a,{element:"span",text:l,onRemove:c,radius:"large",ariaLabel:p}):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},React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),React.createElement("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),React.createElement("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),React.createElement(f.a,{screenReaderLabel:p}))))},g=r(145),O=r(24),_=r(174),h=function(e){var t=e.attributeObject,r=void 0===t?{}:t,n=e.slugs,o=void 0===n?[]:n,c=e.operator,u=void 0===c?"in":c,l=e.displayStyle,p=Object(g.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[r.id]}),f=p.results,b=p.isLoading,d=Object(s.b)("attributes",[]),m=a()(d,2),y=m[0],h=m[1];if(b)return null;var w=r.label;return React.createElement("li",null,React.createElement("span",{className:"wc-block-active-filters__list-item-type"},w,":"),React.createElement("ul",null,o.map((function(e,t){var n=f.find((function(t){return t.slug===e}));if(!n)return null;var o="";return t>0&&"and"===u&&(o=React.createElement("span",{className:"wc-block-active-filters__list-item-operator"},Object(i.__)("and","woo-gutenberg-products-block"))),v({type:w,name:Object(O.decodeEntities)(n.name||e),prefix:o,removeCallback:function(){Object(_.a)(y,h,r,e)},showLabel:!1,displayStyle:l})}))))};Object(o.a)({selector:".wp-block-woocommerce-active-filters",Block:Object(n.a)((function(e){var t=e.attributes,r=e.isEditor,n=void 0!==r&&r,o=Object(s.b)("attributes",[]),c=a()(o,2),l=c[0],d=c[1],m=Object(s.b)("min_price"),g=a()(m,2),O=g[0],_=g[1],w=Object(s.b)("max_price"),x=a()(w,2),E=x[0],j=x[1],R=Object(u.useMemo)((function(){return Number.isFinite(O)||Number.isFinite(E)?v({type:Object(i.__)("Price","woo-gutenberg-products-block"),name:y(O,E),removeCallback:function(){_(void 0),j(void 0)},displayStyle:t.displayStyle}):null}),[O,E,t.displayStyle,_,j]),S=Object(u.useMemo)((function(){return l.map((function(e){var r=Object(b.b)(e.attribute);return React.createElement(h,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[l,t.displayStyle]);if(!(l.length>0||Number.isFinite(O)||Number.isFinite(E)||n))return null;var k="h".concat(t.headingLevel),P=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return React.createElement(React.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(React.Fragment,null,v({type:Object(i.__)("Size","woo-gutenberg-products-block"),name:Object(i.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),v({type:Object(i.__)("Color","woo-gutenberg-products-block"),name:Object(i.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):React.createElement(React.Fragment,null,R,S)),React.createElement("button",{className:"wc-block-active-filters__clear-all",onClick:function(){_(void 0),j(void 0),d([])}},React.createElement(f.a,{label:Object(i.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(i.__)("Clear All Filters","woo-gutenberg-products-block")}))))})),getProps:function(e){return{attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3}}}})},31: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},e.exports.default=e.exports,e.exports.__esModule=!0},33:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},34:function(e,t){e.exports=window.wp.primitives},4:function(e,t){e.exports=window.React},40:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),a=r(3),i=r.n(a);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){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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,s=void 0===a?{}:a,l=null!=r,p=null!=n;return!l&&p?(t=o||"span",s=u(u({},s),{},{className:i()(s.className,"screen-reader-text")}),React.createElement(t,s,n)):(t=o||c.Fragment,l&&p&&r!==n?React.createElement(t,s,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,s,r))}},43:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},44: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},e.exports.default=e.exports,e.exports.__esModule=!0},45:function(e,t,r){var n=r(80);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)},e.exports.default=e.exports,e.exports.__esModule=!0},46:function(e,t,r){var n=r(23).default,o=r(31);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},5: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},e.exports.default=e.exports,e.exports.__esModule=!0},51:function(e,t){e.exports=window.wc.priceFormat},54:function(e,t,r){"use strict";var n=r(43),o=r.n(n),c=r(44),a=r.n(c),i=r(31),s=r.n(i),u=r(45),l=r.n(u),p=r(46),f=r.n(p),b=r(33),d=r.n(b),m=r(5),y=r.n(m),v=(r(8),r(4)),g=r(1),O=r(14),_=function(e){var t=e.imageUrl,r=void 0===t?"".concat(O.n,"/block-error.svg"):t,n=e.header,o=void 0===n?Object(g.__)("Oops!","woo-gutenberg-products-block"):n,c=e.text,a=void 0===c?Object(g.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,i=e.errorMessage,s=e.errorMessagePrefix,u=void 0===s?Object(g.__)("Error:","woo-gutenberg-products-block"):s,l=e.button;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),a&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},a),i&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},u?u+" ":"",i),l&&React.createElement("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(91);var h=function(e){l()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=d()(t);if(r){var o=d()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return f()(this,e)});function c(){var e;o()(this,c);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return e=n.call.apply(n,[this].concat(r)),y()(s()(e),"state",{errorMessage:"",hasError:!1}),e}return a()(c,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,a=e.renderError,i=e.button,s=this.state,u=s.errorMessage;return s.hasError?"function"==typeof a?a({errorMessage:u}):React.createElement(_,{errorMessage:n?u:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c,button:i}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(React.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),c}(v.Component);h.defaultProps={showErrorMessage:!0},t.a=h},57:function(e,t){e.exports=window.wp.blocks},6:function(e,t,r){var n=r(93),o=r(94),c=r(72),a=r(95);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},66:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),o=r(27),c=r.n(o);function a(e){var t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},7:function(e,t){e.exports=window.lodash},70: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},72:function(e,t,r){var n=r(73);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}},e.exports.default=e.exports,e.exports.__esModule=!0},73: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},e.exports.default=e.exports,e.exports.__esModule=!0},8:function(e,t,r){e.exports=r(89)()},80:function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,r(t,n)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},85: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},e.exports.default=e.exports,e.exports.__esModule=!0},89:function(e,t,r){"use strict";var n=r(90);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,c,a){if(a!==n){var i=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 i.name="Invariant Violation",i}}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}},90:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},91:function(e,t){},93:function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},94:function(e,t){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,a=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){a=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(a)throw o}}return c}},e.exports.default=e.exports,e.exports.__esModule=!0},95: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.")},e.exports.default=e.exports,e.exports.__esModule=!0}});
|
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=274)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t,r){e.exports=r(82)()},107:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(6),o=r.n(n),c=r(0),a=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return Object(c.useCallback)((function(e){t((function(){throw e}))}),[])}},115:function(e,t,r){"use strict";r.d(t,"a",(function(){return b}));var n=r(13),o=r.n(n),c=r(5),a=r.n(c),i=r(0),u=r(54);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){a()(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=[".wp-block-woocommerce-cart"],f=function(e){var t=e.Block,r=e.containers,n=e.getProps,c=void 0===n?function(){return{}}:n,a=e.getErrorBoundaryProps,s=void 0===a?function(){return{}}:a;0!==r.length&&Array.prototype.forEach.call(r,(function(e,r){var n=c(e,r),a=s(e,r),p=l(l({},e.dataset),n.attributes||{});e.classList.remove("is-loading"),Object(i.render)(React.createElement(u.a,a,React.createElement(i.Suspense,{fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(t,o()({},n,{attributes:p})))),e)}))},b=function(e){var t,r,n,o,c,a,i,u=document.body.querySelectorAll(p.join(","));t=l(l({},e),{},{wrappers:u}),r=t.Block,n=t.getProps,o=t.getErrorBoundaryProps,c=t.selector,a=t.wrappers,i=document.body.querySelectorAll(c),a.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,a)})),f({Block:r,containers:i,getProps:n,getErrorBoundaryProps:o}),Array.prototype.forEach.call(u,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var r,n,o,c,a,i;n=(r=l(l({},e),{},{wrapper:t})).Block,o=r.getProps,c=r.getErrorBoundaryProps,a=r.selector,i=r.wrapper.querySelectorAll(a),f({Block:n,containers:i,getProps:o,getErrorBoundaryProps:c})}))}))}},118:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(4);function o(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},12:function(e,t){e.exports=window.wp.data},13: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},e.exports.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},130:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(8),o=r(12),c=r(0),a=r(60),i=r(107),u=function(e){var t=e.namespace,r=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,p=void 0===l?{}:l,f=e.shouldSelect,b=void 0===f||f;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}),m=Object(a.a)(p),y=Object(a.a)(s),g=Object(i.a)(),v=Object(o.useSelect)((function(e){if(!b)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,m,y],a=o.getCollectionError.apply(o,c);return a&&g(a),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,y,m,b]);return null!==v&&(d.current=v),d.current}},132:function(e,t,r){"use strict";var n=r(0),o=r(8),c=r(12),a=r(15);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(a.o.restApiRoutes||{}),Object(c.useSelect)((function(e,t){if(r.current){var n=e(o.SCHEMA_STORE_KEY),c=n.isResolving,a=n.hasFinishedResolution,i=t.dispatch(o.SCHEMA_STORE_KEY),u=i.receiveRoutes,s=i.startResolution,l=i.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];c("getRoutes",[e])||a("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},15:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"n",(function(){return a})),r.d(t,"m",(function(){return i})),r.d(t,"j",(function(){return s})),r.d(t,"d",(function(){return l})),r.d(t,"g",(function(){return p})),r.d(t,"f",(function(){return f})),r.d(t,"l",(function(){return b})),r.d(t,"k",(function(){return d})),r.d(t,"c",(function(){return m})),r.d(t,"e",(function(){return y})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return v})),r.d(t,"i",(function(){return O})),r.d(t,"b",(function(){return _})),r.d(t,"p",(function(){return h}));var n,o=r(2),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),p=o.STORE_PAGES.privacy.permalink,f=o.STORE_PAGES.privacy.title,b=o.STORE_PAGES.terms.permalink,d=o.STORE_PAGES.terms.title,m=(o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),y=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),g=Object(o.getSetting)("shippingCountries",{}),v=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{}),h=(r(53),function(){return u>1})},153:function(e,t){},157:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(17),a=r.n(c),i=r(0),u=["srcElement","size"];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=a()(e,u);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){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)):null}},17:function(e,t,r){var n=r(81);e.exports=function(e,t){if(null==e)return{};var r,o,c=n(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c},e.exports.default=e.exports,e.exports.__esModule=!0},181:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var n=r(2),o=Object(n.getSetting)("attributes",[]).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}))},a=function(e){if(e)return o.find((function(t){return t.taxonomy===e}))}},182: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})),a=c.length?c[0]:null;if(a&&a.slug&&Array.isArray(a.slug)&&a.slug.includes(o)){var i=a.slug.filter((function(e){return e!==o})),u=e.filter((function(e){return e.attribute!==r.taxonomy}));i.length>0&&(a.slug=i.sort(),u.push(a)),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",a=e.filter((function(e){return e.attribute!==r.taxonomy}));0===o.length?t(a):(a.push({attribute:r.taxonomy,operator:c,slug:o.map((function(e){return e.slug})).sort()}),t(Object(n.sortBy)(a,"attribute")))}},190:function(e,t,r){"use strict";var n=r(13),o=r.n(n),c=r(17),a=r.n(c),i=(r(10),r(3)),u=r.n(i),s=r(1),l=r(157),p=r(208),f=(r(153),["text","screenReaderText","element","className","radius","children"]),b=function(e){var t=e.text,r=e.screenReaderText,n=void 0===r?"":r,c=e.element,i=void 0===c?"li":c,s=e.className,l=void 0===s?"":s,p=e.radius,b=void 0===p?"small":p,d=e.children,m=void 0===d?null:d,y=a()(e,f),g=i,v=u()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+b),O=Boolean(n&&n!==t);return React.createElement(g,o()({className:v},y),React.createElement("span",{"aria-hidden":O,className:"wc-block-components-chip__text"},t),O&&React.createElement("span",{className:"screen-reader-text"},n),m)},d=["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"];t.a=function(e){var t=e.ariaLabel,r=void 0===t?"":t,n=e.className,c=void 0===n?"":n,i=e.disabled,f=void 0!==i&&i,m=e.onRemove,y=void 0===m?function(){}:m,g=e.removeOnAnyClick,v=void 0!==g&&g,O=e.text,_=e.screenReaderText,h=void 0===_?"":_,w=a()(e,d),x=v?"span":"button";if(!r){var j=h&&"string"==typeof h?h:O;r="string"!=typeof j?
|
2 |
/* translators: Remove chip. */
|
3 |
+
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
+
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),j)}var E={"aria-label":r,disabled:f,onClick:y,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||y()}},R=v?E:{},S=v?{"aria-hidden":!0}:E;return React.createElement(b,o()({},w,R,{className:u()(c,"is-removable"),element:v?"button":w.element,screenReaderText:h,text:O}),React.createElement(x,o()({className:"wc-block-components-chip__remove"},S),React.createElement(l.a,{className:"wc-block-components-chip__remove-icon",srcElement:p.a,size:16})))}},2:function(e,t){e.exports=window.wc.wcSettings},208:function(e,t,r){"use strict";var n=r(13),o=r.n(n),c=r(17),a=r.n(c),i=r(34),u=["className","size"],s=function(e){var t=e.className,r=e.size,n=a()(e,u);return React.createElement(i.SVG,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"}))},l=React.createElement(s,null);t.a=l},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.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},24:function(e,t){e.exports=window.wp.htmlEntities},27:function(e,t){e.exports=window.wp.isShallowEqual},274:function(e,t,r){e.exports=r(318)},275:function(e,t){},3:function(e,t,r){var n;!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)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},30: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},e.exports.default=e.exports,e.exports.__esModule=!0},318:function(e,t,r){"use strict";r.r(t);var n=r(132),o=r(115),c=r(6),a=r.n(c),i=r(1),u=r(97),s=r(2),l=r(0),p=r(3),f=r.n(p),b=(r(10),r(37)),d=(r(275),r(181)),m=r(50),y=r(190),g=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(i.sprintf)(
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
+
Object(i.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(m.formatPrice)(e),Object(m.formatPrice)(t)):Number.isFinite(e)?Object(i.sprintf)(
|
8 |
/* translators: %s min price */
|
9 |
+
Object(i.__)("From %s","woo-gutenberg-products-block"),Object(m.formatPrice)(e)):Object(i.sprintf)(
|
10 |
/* translators: %s max price */
|
11 |
+
Object(i.__)("Up to %s","woo-gutenberg-products-block"),Object(m.formatPrice)(t))},v=function(e){var t=e.type,r=e.name,n=e.prefix,o=e.removeCallback,c=void 0===o?function(){}:o,a=e.showLabel,u=void 0===a||a,s=e.displayStyle,l=n?React.createElement(React.Fragment,null,n," ",r):r,p=Object(i.sprintf)(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
+
Object(i.__)("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(y.a,{element:"span",text:l,onRemove:c,radius:"large",ariaLabel:p}):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},React.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),React.createElement("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),React.createElement("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),React.createElement(b.a,{screenReaderLabel:p}))))},O=r(130),_=r(24),h=r(182),w=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,p=Object(O.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[r.id]}),f=p.results,b=p.isLoading,d=Object(u.b)("attributes",[]),m=a()(d,2),y=m[0],g=m[1];if(b)return null;var w=r.label;return React.createElement("li",null,React.createElement("span",{className:"wc-block-active-filters__list-item-type"},w,":"),React.createElement("ul",null,o.map((function(e,t){var n=f.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(i.__)("and","woo-gutenberg-products-block"))),v({type:w,name:Object(_.decodeEntities)(n.name||e),prefix:o,removeCallback:function(){Object(h.a)(y,g,r,e)},showLabel:!1,displayStyle:l})}))))};Object(o.a)({selector:".wp-block-woocommerce-active-filters",Block:Object(n.a)((function(e){var t=e.attributes,r=e.isEditor,n=void 0!==r&&r,o=Object(u.b)("attributes",[]),c=a()(o,2),p=c[0],m=c[1],y=Object(u.b)("stock_status",[]),O=a()(y,2),_=O[0],h=O[1],x=Object(u.b)("min_price"),j=a()(x,2),E=j[0],R=j[1],S=Object(u.b)("max_price"),k=a()(S,2),P=k[0],T=k[1],M=Object(s.getSetting)("stockStatusOptions",[]),N=Object(l.useMemo)((function(){if(_.length>0)return _.map((function(e){return v({type:Object(i.__)("Stock Status","woo-gutenberg-products-block"),name:M[e],removeCallback:function(){var t=_.filter((function(t){return t!==e}));h(t)},displayStyle:t.displayStyle})}))}),[M,_,h,t.displayStyle]),A=Object(l.useMemo)((function(){return Number.isFinite(E)||Number.isFinite(P)?v({type:Object(i.__)("Price","woo-gutenberg-products-block"),name:g(E,P),removeCallback:function(){R(void 0),T(void 0)},displayStyle:t.displayStyle}):null}),[E,P,t.displayStyle,R,T]),C=Object(l.useMemo)((function(){return p.map((function(e){var r=Object(d.b)(e.attribute);return React.createElement(w,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[p,t.displayStyle]);if(!(p.length>0||_.length>0||Number.isFinite(E)||Number.isFinite(P)||n))return null;var L="h".concat(t.headingLevel),B=f()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return React.createElement(React.Fragment,null,!n&&t.heading&&React.createElement(L,null,t.heading),React.createElement("div",{className:"wc-block-active-filters"},React.createElement("ul",{className:B},n?React.createElement(React.Fragment,null,v({type:Object(i.__)("Size","woo-gutenberg-products-block"),name:Object(i.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),v({type:Object(i.__)("Color","woo-gutenberg-products-block"),name:Object(i.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):React.createElement(React.Fragment,null,A,N,C)),React.createElement("button",{className:"wc-block-active-filters__clear-all",onClick:function(){R(void 0),T(void 0),m([]),h([])}},React.createElement(b.a,{label:Object(i.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(i.__)("Clear All Filters","woo-gutenberg-products-block")}))))})),getProps:function(e){return{attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3}}}})},32:function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},34:function(e,t){e.exports=window.wp.primitives},37:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),a=r(3),i=r.n(a);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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,u=void 0===a?{}:a,l=null!=r,p=null!=n;return!l&&p?(t=o||"span",u=s(s({},u),{},{className:i()(u.className,"screen-reader-text")}),React.createElement(t,u,n)):(t=o||c.Fragment,l&&p&&r!==n?React.createElement(t,u,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,u,r))}},4:function(e,t){e.exports=window.React},44:function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},45: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},e.exports.default=e.exports,e.exports.__esModule=!0},46:function(e,t,r){var n=r(76);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)},e.exports.default=e.exports,e.exports.__esModule=!0},47:function(e,t,r){var n=r(22).default,o=r(30);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},5: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},e.exports.default=e.exports,e.exports.__esModule=!0},50:function(e,t){e.exports=window.wc.priceFormat},53:function(e,t){e.exports=window.wp.blocks},54:function(e,t,r){"use strict";var n=r(44),o=r.n(n),c=r(45),a=r.n(c),i=r(30),u=r.n(i),s=r(46),l=r.n(s),p=r(47),f=r.n(p),b=r(32),d=r.n(b),m=r(5),y=r.n(m),g=(r(10),r(4)),v=r(1),O=r(15),_=function(e){var t=e.imageUrl,r=void 0===t?"".concat(O.n,"/block-error.svg"):t,n=e.header,o=void 0===n?Object(v.__)("Oops!","woo-gutenberg-products-block"):n,c=e.text,a=void 0===c?Object(v.__)("There was an error loading the content.","woo-gutenberg-products-block"):c,i=e.errorMessage,u=e.errorMessagePrefix,s=void 0===u?Object(v.__)("Error:","woo-gutenberg-products-block"):u,l=e.button;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),a&&React.createElement("p",{className:"wc-block-error__text wc-block-components-error__text"},a),i&&React.createElement("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",i),l&&React.createElement("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(84);var h=function(e){l()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=d()(t);if(r){var o=d()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return f()(this,e)});function c(){var e;o()(this,c);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return e=n.call.apply(n,[this].concat(r)),y()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return a()(c,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,a=e.renderError,i=e.button,u=this.state,s=u.errorMessage;return u.hasError?"function"==typeof a?a({errorMessage:s}):React.createElement(_,{errorMessage:n?s:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c,button:i}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(React.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),c}(g.Component);h.defaultProps={showErrorMessage:!0},t.a=h},6:function(e,t,r){var n=r(90),o=r(91),c=r(72),a=r(92);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),o=r(27),c=r.n(o);function a(e){var t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},7:function(e,t){e.exports=window.lodash},70: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},72:function(e,t,r){var n=r(73);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}},e.exports.default=e.exports,e.exports.__esModule=!0},73: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},e.exports.default=e.exports,e.exports.__esModule=!0},76:function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,r(t,n)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},8:function(e,t){e.exports=window.wc.wcBlocksData},81: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},e.exports.default=e.exports,e.exports.__esModule=!0},82:function(e,t,r){"use strict";var n=r(83);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,c,a){if(a!==n){var i=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 i.name="Invariant Violation",i}}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}},83:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},84:function(e,t){},90:function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},91:function(e,t){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,a=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){a=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(a)throw o}}return c}},e.exports.default=e.exports,e.exports.__esModule=!0},92: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.")},e.exports.default=e.exports,e.exports.__esModule=!0},97: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 m}));var n=r(6),o=r.n(n),c=r(8),a=r(12),i=r(0),u=r(27),s=r.n(u),l=r(60),p=r(118),f=r(70),b=function(e){var t=Object(f.a)();e=e||t;var r=Object(a.useSelect)((function(t){return t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),n=Object(a.useDispatch)(c.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[r,Object(i.useCallback)((function(t){n(e,t)}),[e,n])]},d=function(e,t,r){var n=Object(f.a)();r=r||n;var o=Object(a.useSelect)((function(n){return n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),u=Object(a.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(i.useCallback)((function(t){u(r,e,t)}),[r,e,u])]},m=function(e,t){var r=Object(f.a)(),n=b(t=t||r),c=o()(n,2),a=c[0],u=c[1],d=Object(l.a)(a),m=Object(l.a)(e),y=Object(p.a)(m),g=Object(i.useRef)(!1);return Object(i.useEffect)((function(){s()(y,m)||(u(Object.assign({},d,m)),g.current=!0)}),[d,m,y,u]),g.current?[a,u]:[e,u]}}});
|
build/active-filters.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', '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', 'wp-primitives'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', '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', 'wp-primitives'), 'version' => '04c22c82a4116b53661b45acc46cad84');
|
build/active-filters.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var r,a,i=t[0],l=t[1],s=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(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,i=1;i<n.length;i++){var l=n[i];0!==c[l]&&(r=!1)}r&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},c={5:0},o=[];function a(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,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},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="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return o.push([
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
-
title:Object(m.sprintf)(Object(m.__)("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,o=t.maxLevel,a=t.selectedLevel,i=t.onChange;return Object(f.createElement)(v.ToolbarGroup,{isCollapsed:r,icon:Object(f.createElement)(O,{level:a}),controls:Object(d.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),o}(f.Component);t.a=h},
|
4 |
/* translators: Remove chip. */
|
5 |
Object(u.__)("Remove","woo-gutenberg-products-block"):Object(u.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
-
Object(u.__)('Remove "%s"',"woo-gutenberg-products-block"),k)}var x={"aria-label":n,disabled:f,onClick:O,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||O()}},S=j?x:{},C=j?{"aria-hidden":!0}:x;return Object(i.createElement)(d,c()({},_,S,{className:s()(o,"is-removable"),element:j?"button":_.element,screenReaderText:y,text:g}),Object(i.createElement)(E,c()({className:"wc-block-components-chip__remove"},C),Object(i.createElement)(b.a,{className:"wc-block-components-chip__remove-icon",srcElement:p.a,size:16})))}},
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
-
Object(a.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(
|
10 |
/* translators: %s min price */
|
11 |
-
Object(a.__)("From %s","woo-gutenberg-products-block"),Object(
|
12 |
/* translators: %s max price */
|
13 |
-
Object(a.__)("Up to %s","woo-gutenberg-products-block"),Object(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
-
Object(a.__)("Remove %s filter","woo-gutenberg-products-block"),n);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+n},s&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===u?Object(o.createElement)(
|
16 |
/* translators: "Chips" is a tag-like display style for chosen attributes. */
|
17 |
-
label:Object(a.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:function(e){return n({displayStyle:e})}}),Object(o.createElement)("p",null,Object(a.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:l,onChange:function(e){return n({headingLevel:e})}}))),Object(o.createElement)(v.a,{headingLevel:l,heading:i,onChange:function(e){return n({heading:e})}}),Object(o.createElement)(d.Disabled,null,Object(o.createElement)(
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var r,a,i=t[0],l=t[1],s=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(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,i=1;i<n.length;i++){var l=n[i];0!==c[l]&&(r=!1)}r&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var r={},c={5:0},o=[];function a(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,a),n.l=!0,n.exports}a.m=e,a.c=r,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},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 n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(n,r,function(t){return e[t]}.bind(null,r));return n},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="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return o.push([788,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},109:function(e,t,n){"use strict";n.d(t,"a",(function(){return f})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(8),c=n.n(r),o=n(27),a=n(17),i=n(0),l=n(34),s=n.n(l),u=n(61),b=n(151),p=n(76),f=function(e){var t=Object(p.a)();e=e||t;var n=Object(a.useSelect)((function(t){return t(o.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)}),[e]),r=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setValueForQueryContext;return[n,Object(i.useCallback)((function(t){r(e,t)}),[e,r])]},d=function(e,t,n){var r=Object(p.a)();n=n||r;var c=Object(a.useSelect)((function(r){return r(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)}),[n,e]),l=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(i.useCallback)((function(t){l(n,e,t)}),[n,e,l])]},m=function(e,t){var n=Object(p.a)(),r=f(t=t||n),o=c()(r,2),a=o[0],l=o[1],d=Object(u.a)(a),m=Object(u.a)(e),v=Object(b.a)(m),O=Object(i.useRef)(!1);return Object(i.useEffect)((function(){s()(v,m)||(l(Object.assign({},d,m)),O.current=!0)}),[d,m,v,l]),O.current?[a,l]:[e,l]}},12:function(e,t){e.exports=window.React},125:function(e,t){},131:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(8),c=n.n(r),o=n(0),a=function(){var e=Object(o.useState)(),t=c()(e,2)[1];return Object(o.useCallback)((function(e){t((function(){throw e}))}),[])}},137:function(e,t,n){"use strict";var r=n(16),c=n.n(r),o=n(18),a=n.n(o),i=n(19),l=n.n(i),s=n(20),u=n.n(s),b=n(10),p=n.n(b),f=n(0),d=n(7),m=n(1),v=n(4);function O(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(f.createElement)(v.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(f.createElement)(v.Path,{d:n[t]})):null}var h=function(e){l()(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=p()(t);if(n){var c=p()(this).constructor;e=Reflect.construct(r,arguments,c)}else e=r.apply(this,arguments);return u()(this,e)});function o(){return c()(this,o),r.apply(this,arguments)}return a()(o,[{key:"createLevelControl",value:function(e,t,n){var r=e===t;return{icon:Object(f.createElement)(O,{level:e}),
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
+
title:Object(m.sprintf)(Object(m.__)("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,o=t.maxLevel,a=t.selectedLevel,i=t.onChange;return Object(f.createElement)(v.ToolbarGroup,{isCollapsed:r,icon:Object(f.createElement)(O,{level:a}),controls:Object(d.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),o}(f.Component);t.a=h},151:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(12);function c(e,t){var n=Object(r.useRef)();return Object(r.useEffect)((function(){n.current===e||t&&!t(e,n.current)||(n.current=e)}),[e,t]),n.current}},163:function(e,t,n){"use strict";var r=n(0),c=(n(2),n(21)),o=n(6),a=n.n(o),i=n(22),l=n(1);n(217),t.a=Object(i.withInstanceId)((function(e){var t=e.className,n=e.headingLevel,o=e.onChange,i=e.heading,s=e.instanceId,u="h".concat(n);return Object(r.createElement)(u,null,Object(r.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-".concat(s)},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(r.createElement)(c.PlainText,{id:"block-title-".concat(s),className:a()("wc-block-editor-components-title",t),value:i,onChange:o}))}))},168:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(27),c=n(17),o=n(0),a=n(61),i=n(131),l=function(e){var t=e.namespace,n=e.resourceName,l=e.resourceValues,s=void 0===l?[]:l,u=e.query,b=void 0===u?{}:u,p=e.shouldSelect,f=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 d=Object(o.useRef)({results:[],isLoading:!0}),m=Object(a.a)(b),v=Object(a.a)(s),O=Object(i.a)(),h=Object(c.useSelect)((function(e){if(!f)return null;var c=e(r.COLLECTIONS_STORE_KEY),o=[t,n,m,v],a=c.getCollectionError.apply(c,o);return a&&O(a),{results:c.getCollection.apply(c,o),isLoading:!c.hasFinishedResolution("getCollection",o)}}),[t,n,v,m,f]);return null!==h&&(d.current=h),d.current}},17:function(e,t){e.exports=window.wp.data},180:function(e,t){},21:function(e,t){e.exports=window.wp.blockEditor},217:function(e,t){},22:function(e,t){e.exports=window.wp.compose},220:function(e,t,n){"use strict";var r=n(9),c=n.n(r),o=n(14),a=n.n(o),i=n(0),l=(n(2),n(6)),s=n.n(l),u=n(1),b=n(62),p=n(307),f=(n(180),["text","screenReaderText","element","className","radius","children"]),d=function(e){var t=e.text,n=e.screenReaderText,r=void 0===n?"":n,o=e.element,l=void 0===o?"li":o,u=e.className,b=void 0===u?"":u,p=e.radius,d=void 0===p?"small":p,m=e.children,v=void 0===m?null:m,O=a()(e,f),h=l,j=s()(b,"wc-block-components-chip","wc-block-components-chip--radius-"+d),g=Boolean(r&&r!==t);return Object(i.createElement)(h,c()({className:j},O),Object(i.createElement)("span",{"aria-hidden":g,className:"wc-block-components-chip__text"},t),g&&Object(i.createElement)("span",{className:"screen-reader-text"},r),v)},m=["ariaLabel","className","disabled","onRemove","removeOnAnyClick","text","screenReaderText"];t.a=function(e){var t=e.ariaLabel,n=void 0===t?"":t,r=e.className,o=void 0===r?"":r,l=e.disabled,f=void 0!==l&&l,v=e.onRemove,O=void 0===v?function(){}:v,h=e.removeOnAnyClick,j=void 0!==h&&h,g=e.text,w=e.screenReaderText,y=void 0===w?"":w,_=a()(e,m),E=j?"span":"button";if(!n){var k=y&&"string"==typeof y?y:g;n="string"!=typeof k?
|
4 |
/* translators: Remove chip. */
|
5 |
Object(u.__)("Remove","woo-gutenberg-products-block"):Object(u.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
+
Object(u.__)('Remove "%s"',"woo-gutenberg-products-block"),k)}var x={"aria-label":n,disabled:f,onClick:O,onKeyDown:function(e){"Backspace"!==e.key&&"Delete"!==e.key||O()}},S=j?x:{},C=j?{"aria-hidden":!0}:x;return Object(i.createElement)(d,c()({},_,S,{className:s()(o,"is-removable"),element:j?"button":_.element,screenReaderText:y,text:g}),Object(i.createElement)(E,c()({className:"wc-block-components-chip__remove"},C),Object(i.createElement)(b.a,{className:"wc-block-components-chip__remove-icon",srcElement:p.a,size:16})))}},25:function(e,t){e.exports=window.wp.blocks},26:function(e,t){e.exports=window.wp.htmlEntities},27:function(e,t){e.exports=window.wc.wcBlocksData},279:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return a}));var r=n(3),c=Object(r.getSetting)("attributes",[]).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}),[]),o=function(e){if(e)return c.find((function(t){return t.id===e}))},a=function(e){if(e)return c.find((function(t){return t.taxonomy===e}))}},280:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return o}));var r=n(7),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]:"",o=e.filter((function(e){return e.attribute===n.taxonomy})),a=o.length?o[0]:null;if(a&&a.slug&&Array.isArray(a.slug)&&a.slug.includes(c)){var i=a.slug.filter((function(e){return e!==c})),l=e.filter((function(e){return e.attribute!==n.taxonomy}));i.length>0&&(a.slug=i.sort(),l.push(a)),t(Object(r.sortBy)(l,"attribute"))}},o=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]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in",a=e.filter((function(e){return e.attribute!==n.taxonomy}));0===c.length?t(a):(a.push({attribute:n.taxonomy,operator:o,slug:c.map((function(e){return e.slug})).sort()}),t(Object(r.sortBy)(a,"attribute")))}},3:function(e,t){e.exports=window.wc.wcSettings},307:function(e,t,n){"use strict";var r=n(9),c=n.n(r),o=n(14),a=n.n(o),i=n(0),l=n(33),s=["className","size"],u=Object(i.createElement)((function(e){var t=e.className,n=e.size,r=a()(e,s);return Object(i.createElement)(l.SVG,c()({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",className:t,width:n,height:n},r),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},33:function(e,t){e.exports=window.wp.primitives},34:function(e,t){e.exports=window.wp.isShallowEqual},4:function(e,t){e.exports=window.wp.components},41:function(e,t,n){"use strict";var r=n(5),c=n.n(r),o=n(0),a=n(6),i=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}t.a=function(e){var t,n=e.label,r=e.screenReaderLabel,c=e.wrapperElement,a=e.wrapperProps,l=void 0===a?{}:a,u=null!=n,b=null!=r;return!u&&b?(t=c||"span",l=s(s({},l),{},{className:i()(l.className,"screen-reader-text")}),Object(o.createElement)(t,l,r)):(t=c||o.Fragment,u&&b&&n!==r?Object(o.createElement)(t,l,Object(o.createElement)("span",{"aria-hidden":"true"},n),Object(o.createElement)("span",{className:"screen-reader-text"},r)):Object(o.createElement)(t,l,n))}},47:function(e,t){e.exports=window.wc.priceFormat},61:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(0),c=n(34),o=n.n(c);function a(e){var t=Object(r.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},62:function(e,t,n){"use strict";var r=n(5),c=n.n(r),o=n(14),a=n.n(o),i=n(0),l=["srcElement","size"];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}t.a=function(e){var t=e.srcElement,n=e.size,r=void 0===n?24:n,o=a()(e,l);return Object(i.isValidElement)(t)?Object(i.cloneElement)(t,function(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){c()(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}({width:r,height:r},o)):null}},7:function(e,t){e.exports=window.lodash},76:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0),c=Object(r.createContext)("page"),o=function(){return Object(r.useContext)(c)};c.Provider},788:function(e,t,n){e.exports=n(831)},789:function(e,t){},831:function(e,t,n){"use strict";n.r(t);var r=n(9),c=n.n(r),o=n(0),a=n(1),i=n(25),l=n(62),s=n(33),u=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.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(6),p=n.n(b),f=n(21),d=n(4),m=n(137),v=n(163),O=n(86),h=n(8),j=n.n(h),g=n(109),w=n(3),y=(n(2),n(41)),_=(n(789),n(279)),E=n(47),k=n(220),x=function(e,t){return Number.isFinite(e)&&Number.isFinite(t)?Object(a.sprintf)(
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
+
Object(a.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(E.formatPrice)(e),Object(E.formatPrice)(t)):Number.isFinite(e)?Object(a.sprintf)(
|
10 |
/* translators: %s min price */
|
11 |
+
Object(a.__)("From %s","woo-gutenberg-products-block"),Object(E.formatPrice)(e)):Object(a.sprintf)(
|
12 |
/* translators: %s max price */
|
13 |
+
Object(a.__)("Up to %s","woo-gutenberg-products-block"),Object(E.formatPrice)(t))},S=function(e){var t=e.type,n=e.name,r=e.prefix,c=e.removeCallback,i=void 0===c?function(){}:c,l=e.showLabel,s=void 0===l||l,u=e.displayStyle,b=r?Object(o.createElement)(o.Fragment,null,r," ",n):n,p=Object(a.sprintf)(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
+
Object(a.__)("Remove %s filter","woo-gutenberg-products-block"),n);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+n},s&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===u?Object(o.createElement)(k.a,{element:"span",text:b,onRemove:i,radius:"large",ariaLabel:p}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},b,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:i},Object(o.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(o.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(o.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(o.createElement)(y.a,{screenReaderLabel:p}))))},C=n(168),N=n(26),P=n(280),R=function(e){var t=e.attributeObject,n=void 0===t?{}:t,r=e.slugs,c=void 0===r?[]:r,i=e.operator,l=void 0===i?"in":i,s=e.displayStyle,u=Object(C.a)({namespace:"/wc/store",resourceName:"products/attributes/terms",resourceValues:[n.id]}),b=u.results,p=u.isLoading,f=Object(g.b)("attributes",[]),d=j()(f,2),m=d[0],v=d[1];if(p)return null;var O=n.label;return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},O,":"),Object(o.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"===l&&(c=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(a.__)("and","woo-gutenberg-products-block"))),S({type:O,name:Object(N.decodeEntities)(r.name||e),prefix:c,removeCallback:function(){Object(P.a)(m,v,n,e)},showLabel:!1,displayStyle:s})}))))},L=function(e){var t=e.attributes,n=e.isEditor,r=void 0!==n&&n,c=Object(g.b)("attributes",[]),i=j()(c,2),l=i[0],s=i[1],u=Object(g.b)("stock_status",[]),b=j()(u,2),f=b[0],d=b[1],m=Object(g.b)("min_price"),v=j()(m,2),O=v[0],h=v[1],E=Object(g.b)("max_price"),k=j()(E,2),C=k[0],N=k[1],P=Object(w.getSetting)("stockStatusOptions",[]),L=Object(o.useMemo)((function(){if(f.length>0)return f.map((function(e){return S({type:Object(a.__)("Stock Status","woo-gutenberg-products-block"),name:P[e],removeCallback:function(){var t=f.filter((function(t){return t!==e}));d(t)},displayStyle:t.displayStyle})}))}),[P,f,d,t.displayStyle]),V=Object(o.useMemo)((function(){return Number.isFinite(O)||Number.isFinite(C)?S({type:Object(a.__)("Price","woo-gutenberg-products-block"),name:x(O,C),removeCallback:function(){h(void 0),N(void 0)},displayStyle:t.displayStyle}):null}),[O,C,t.displayStyle,h,N]),H=Object(o.useMemo)((function(){return l.map((function(e){var n=Object(_.b)(e.attribute);return Object(o.createElement)(R,{attributeObject:n,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}))}),[l,t.displayStyle]);if(!(l.length>0||f.length>0||Number.isFinite(O)||Number.isFinite(C)||r))return null;var z="h".concat(t.headingLevel),T=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&Object(o.createElement)(z,null,t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:T},r?Object(o.createElement)(o.Fragment,null,S({type:Object(a.__)("Size","woo-gutenberg-products-block"),name:Object(a.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),S({type:Object(a.__)("Color","woo-gutenberg-products-block"),name:Object(a.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,V,L,H)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:function(){h(void 0),N(void 0),s([]),d([])}},Object(o.createElement)(y.a,{label:Object(a.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=Object(d.withSpokenMessages)((function(e){var t=e.attributes,n=e.setAttributes,r=t.className,c=t.displayStyle,i=t.heading,l=t.headingLevel;return Object(o.createElement)("div",{className:r},Object(o.createElement)(f.InspectorControls,{key:"inspector"},Object(o.createElement)(d.PanelBody,{title:Object(a.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(O.a,{label:Object(a.__)("Display Style","woo-gutenberg-products-block"),value:c,options:[{label:Object(a.__)("List","woo-gutenberg-products-block"),value:"list"},{
|
16 |
/* translators: "Chips" is a tag-like display style for chosen attributes. */
|
17 |
+
label:Object(a.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:function(e){return n({displayStyle:e})}}),Object(o.createElement)("p",null,Object(a.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:l,onChange:function(e){return n({headingLevel:e})}}))),Object(o.createElement)(v.a,{headingLevel:l,heading:i,onChange:function(e){return n({heading:e})}}),Object(o.createElement)(d.Disabled,null,Object(o.createElement)(L,{attributes:t,isEditor:!0})))}));Object(i.registerBlockType)("woocommerce/active-filters",{title:Object(a.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(l.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("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(a.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:V,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(o.createElement)("div",c()({className:p()("is-loading",n)},r),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},86:function(e,t,n){"use strict";var r=n(9),c=n.n(r),o=n(16),a=n.n(o),i=n(18),l=n.n(i),s=n(13),u=n.n(s),b=n(19),p=n.n(b),f=n(20),d=n.n(f),m=n(10),v=n.n(m),O=n(0),h=n(7),j=n(6),g=n.n(j),w=n(4),y=n(22);n(125);var _=function(e){p()(o,e);var t,n,r=(t=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=v()(t);if(n){var c=v()(this).constructor;e=Reflect.construct(r,arguments,c)}else e=r.apply(this,arguments);return d()(this,e)});function o(){var e;return a()(this,o),(e=r.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return l()(o,[{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,o=n.checked,a=n.instanceId,i=n.className,l=n.help,s=n.options,u=n.value,b="inspector-toggle-button-control-".concat(a);return l&&(e=Object(h.isFunction)(l)?l(o):l),Object(O.createElement)(w.BaseControl,{id:b,help:e,className:g()("components-toggle-button-control",i)},Object(O.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},r),Object(O.createElement)(w.ButtonGroup,{"aria-labelledby":b+"__label"},s.map((function(e,n){var o={};return u===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(O.createElement)(w.Button,c()({key:"".concat(e.label,"-").concat(e.value,"-").concat(n),value:e.value,onClick:t.onClick,"aria-label":r+": "+e.label},o),e.label)}))))}}]),o}(O.Component);t.a=Object(y.withInstanceId)(_)}});
|
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-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'd30b4b407cd5e36baf0508147ae39ac2');
|
build/all-products-frontend.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
!function(e){function t(t){for(var r,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&s.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(u&&u(t);s.length;)s.shift()()}var r={},n={1:0};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.e=function(e){var t=[],r=n[e];if(0!==r)if(r)t.push(r[2]);else{var c=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[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",21:"vendors--atomic-block-components/add-to-cart",22:"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 r=n[e];if(0!==r){if(r){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,r[1](u)}n[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=r,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},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=255)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t,r){var n;!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)){if(n.length){var i=o.apply(null,n);i&&e.push(i)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.React},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(93),o=r(94),c=r(72),i=r(95);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.lodash},function(e,t,r){e.exports=r(89)()},function(e,t,r){"use strict";function n(){return(n=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}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t,r){"use strict";function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,"a",(function(){return n}))},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},e.exports.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.data},function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"n",(function(){return i})),r.d(t,"m",(function(){return a})),r.d(t,"j",(function(){return s})),r.d(t,"d",(function(){return l})),r.d(t,"g",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"l",(function(){return d})),r.d(t,"k",(function(){return b})),r.d(t,"c",(function(){return m})),r.d(t,"e",(function(){return h})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return O})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return y})),r.d(t,"p",(function(){return w}));var n,o=r(2),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),f=o.STORE_PAGES.privacy.permalink,p=o.STORE_PAGES.privacy.title,d=o.STORE_PAGES.terms.permalink,b=o.STORE_PAGES.terms.title,m=(o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),h=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),g=Object(o.getSetting)("shippingCountries",{}),O=Object(o.getSetting)("allowedCountries",{}),v=Object(o.getSetting)("shippingStates",{}),y=Object(o.getSetting)("allowedStates",{}),w=(r(57),function(){return u>1})},function(e,t,r){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(62);function o(e,t){if(null==e)return{};var r,o,c=Object(n.a)(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}},function(e,t,r){var n=r(85);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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.compose},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";function n(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)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return o}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(74);function o(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&&Object(n.a)(e,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(23),o=r.n(n),c=r(15);function i(e,t){return!t||"object"!==o()(t)&&"function"!=typeof t?Object(c.a)(e):t}},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=r=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.htmlEntities},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}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(69);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){i=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return c}}(e,t)||Object(n.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){e.exports=window.wp.isShallowEqual},,function(e,t){e.exports=window.regeneratorRuntime},,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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var n=r(6),o=r.n(n),c=r(5),i=r.n(c),a=r(7),u=r(0),s=r(10),l=r(13),f=r(24),p=r(97),d=r(100),b=r(41);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 h(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){i()(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={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O=h(h({},g),{},{email:""}),v={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},y=function(e){return Object(p.a)(Object.entries(e).map((function(e){var t=o()(e,2),r=t[0],n=t[1];return[r,Object(f.decodeEntities)(n)]})))},w={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:v,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,shippingRates:s.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:function(){},extensions:s.EMPTY_EXTENSIONS},j=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(b.a)(),r=t.isEditor,n=t.previewData,o=null==n?void 0:n.previewCart,c=e.shouldSelect,i=Object(u.useRef)(),f=Object(l.useSelect)((function(e,t){var n=t.dispatch;if(!c)return w;if(r)return{cartCoupons:o.coupons,cartItems:o.items,cartFees:o.fees,cartItemsCount:o.items_count,cartItemsWeight:o.items_weight,cartNeedsPayment:o.needs_payment,cartNeedsShipping:o.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:o.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,extensions:s.EMPTY_EXTENSIONS,shippingRates:o.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:o.has_calculated_shipping,paymentRequirements:o.paymentRequirements,receiveCart:"function"==typeof(null==o?void 0:o.receiveCart)?o.receiveCart:function(){}};var i=e(s.CART_STORE_KEY),a=i.getCartData(),u=i.getCartErrors(),l=i.getCartTotals(),f=!i.hasFinishedResolution("getCartData"),p=i.isCustomerDataUpdating(),b=n(s.CART_STORE_KEY).receiveCart,m=y(a.billingAddress),v=a.needsShipping?y(a.shippingAddress):m,j=a.fees.length>0?a.fees.map((function(e){return y(e)})):s.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map((function(e){return h(h({},e),{},{label:e.code})})):s.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:j,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:l,cartIsLoading:f,cartErrors:u,billingAddress:Object(d.a)(m),shippingAddress:Object(d.a)(v),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:b}}),[c]);return i.current&&Object(a.isEqual)(i.current,f)||(i.current=f),i.current}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(67),o=r(69);function c(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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){e.exports=window.wp.a11y},,function(e,t){e.exports=window.wc.wcBlocksRegistry},,function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),i=r(3),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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=void 0===i?{}:i,l=null!=r,f=null!=n;return!l&&f?(t=o||"span",u=s(s({},u),{},{className:a()(u.className,"screen-reader-text")}),React.createElement(t,u,n)):(t=o||c.Fragment,l&&f&&r!==n?React.createElement(t,u,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,u,r))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),o=(r(13),Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{},getPreviewData:function(){}})),c=function(){return Object(n.useContext)(o)}},,function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(80);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)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(23).default,o=r(31);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},,,function(e,t){e.exports=window.wp.dom},function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.keycodes},,function(e,t,r){"use strict";var n=r(43),o=r.n(n),c=r(44),i=r.n(c),a=r(31),u=r.n(a),s=r(45),l=r.n(s),f=r(46),p=r.n(f),d=r(33),b=r.n(d),m=r(5),h=r.n(m),g=(r(8),r(4)),O=r(1),v=r(14),y=function(e){var t=e.imageUrl,r=void 0===t?"".concat(v.n,"/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,l=e.button;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),l&&React.createElement("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(91);var w=function(e){l()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=b()(t);if(r){var o=b()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return p()(this,e)});function c(){var e;o()(this,c);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e=n.call.apply(n,[this].concat(r)),h()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(c,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=e.renderError,a=e.button,u=this.state,s=u.errorMessage;return u.hasError?"function"==typeof i?i({errorMessage:s}):React.createElement(y,{errorMessage:n?s:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c,button:a}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(React.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),c}(g.Component);w.defaultProps={showErrorMessage:!0},t.a=w},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),o=r.n(n),c=r(84),i=r(0),a=r(32);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(){var e=Object(a.a)(),t=Object(i.useRef)(e);return Object(i.useEffect)((function(){t.current=e}),[e]),{dispatchStoreEvent:Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-".concat(e),t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(i.useCallback)((function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-checkout-".concat(e),s(s({},r),{},{storeCart:t.current}))}catch(e){console.error(e)}}),[])}}},,function(e,t){e.exports=window.wp.blocks},function(e,t,r){"use strict";(function(e){var n=r(0),o=(r(81),Object(n.createContext)({slots:{},fills:{},registerSlot:function(){void 0!==e&&e.env},updateSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){}}));t.a=o}).call(this,r(107))},,,,function(e,t,r){"use strict";function n(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}r.d(t,"a",(function(){return n}))},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(27),c=r.n(o);function i(e){var t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";function n(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}r.d(t,"a",(function(){return n}))},function(e,t){e.exports=window.wp.apiFetch},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(67);function o(e,t){if(e){if("string"==typeof e)return Object(n.a)(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)?Object(n.a)(e,t):void 0}}},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},function(e,t,r){"use strict";var n=r(9),o=r(16),c=r(0),i=r(3),a=r.n(i),u=r(7),s=r(50),l=r.n(s),f=r(19),p=r(20),d=r(21),b=r(22),m=r(11),h=r(26),g=r(49),O=r(52),v=r(18),y=r(130),w=r(25);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 E(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){Object(w.a)(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}function _(e,t,r,n,o,c,i){var a=t.width,u="rtl"===document.documentElement.dir;"left"===r&&u?r="right":"right"===r&&u&&(r="left"),"left"===n&&u?n="right":"right"===n&&u&&(n="left");var s=Math.round(e.left+e.width/2),l={popoverLeft:s,contentWidth:(s-a/2>0?a/2:s)+(s+a/2>window.innerWidth?window.innerWidth-s:a/2)},f=e.left;"right"===n?f=e.right:"middle"!==c&&(f=s);var p=e.right;"left"===n?p=e.left:"middle"!==c&&(p=s);var d,b={popoverLeft:f,contentWidth:f-a>0?a:f},m={popoverLeft:p,contentWidth:p+a>window.innerWidth?window.innerWidth-p:a},h=r,g=null;if(!o)if("center"===r&&l.contentWidth===a)h="center";else if("left"===r&&b.contentWidth===a)h="left";else if("right"===r&&m.contentWidth===a)h="right";else{var O="left"==(h=b.contentWidth>m.contentWidth?"left":"right")?b.contentWidth:m.contentWidth;g=O!==a?O:null}if(d="center"===h?l.popoverLeft:"left"===h?b.popoverLeft:m.popoverLeft,i){var v=i.getBoundingClientRect();d=Math.min(d,v.right-a)}return{xAxis:h,popoverLeft:d,contentWidth:g}}function x(e,t,r,n,o,c,i){var a=t.height;if(o){var u=(Object(g.getScrollContainer)(c)||document.body).getBoundingClientRect().top+a-i;if(e.top<=u)return{yAxis:r,popoverTop:Math.min(e.bottom,u)}}var s=e.top+e.height/2;"bottom"===n?s=e.bottom:"top"===n&&(s=e.top);var l={popoverTop:s,contentHeight:(s-a/2>0?a/2:s)+(s+a/2>window.innerHeight?window.innerHeight-s:a/2)},f={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a},d=r,b=null;if(!o)if("middle"===r&&l.contentHeight===a)d="middle";else if("top"===r&&f.contentHeight===a)d="top";else if("bottom"===r&&p.contentHeight===a)d="bottom";else{var m="top"==(d=f.contentHeight>p.contentHeight?"top":"bottom")?f.contentHeight:p.contentHeight;b=m!==a?m:null}return{yAxis:d,popoverTop:"middle"===d?l.popoverTop:"top"===d?f.popoverTop:p.popoverTop,contentHeight:b}}var R=r(35),k=r(15);var P=Object(c.createContext)({focusHistory:[]}),S=P.Provider,C=P.Consumer;S.displayName="FocusReturnProvider",C.displayName="FocusReturnConsumer",c.Component;var T=Object(v.createHigherOrderComponent)((function e(t){if((n=t)instanceof c.Component||"function"==typeof n){var r=t;return e({})(r)}var n,o=t.onFocusReturn,i=void 0===o?u.stubTrue:o;return function(e){var t=function(t){Object(d.a)(a,t);var r,n,o=(r=a,n=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}}(),function(){var e,t=Object(m.a)(r);if(n){var o=Object(m.a)(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return Object(b.a)(this,e)});function a(){var e;return Object(f.a)(this,a),(e=o.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 Object(p.a)(a,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,r=this.ownFocusedElements;if(t&&!1!==i())for(var n,o=[].concat(Object(R.a)(u.without.apply(void 0,[this.props.focus.focusHistory].concat(Object(R.a)(r)))),[e]);n=o.pop();)if(document.body.contains(n))return void n.focus()}},{key:"render",value:function(){return Object(c.createElement)("div",{onFocus:this.setIsFocusedTrue,onBlur:this.setIsFocusedFalse},Object(c.createElement)(e,this.props.childProps))}}]),a}(c.Component);return function(e){return Object(c.createElement)(C,null,(function(r){return Object(c.createElement)(t,{childProps:e,focus:r})}))}}}),"withFocusReturn");var N=Object(v.createHigherOrderComponent)((function(e){return function(t){Object(d.a)(i,t);var r,n,o=(r=i,n=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}}(),function(){var e,t=Object(m.a)(r);if(n){var o=Object(m.a)(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return Object(b.a)(this,e)});function i(){var e;return Object(f.a)(this,i),(e=o.apply(this,arguments)).focusContainRef=Object(c.createRef)(),e.handleTabBehaviour=e.handleTabBehaviour.bind(Object(k.a)(e)),e}return Object(p.a)(i,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===O.TAB){var t=g.focus.tabbable.find(this.focusContainRef.current);if(t.length){var r=t[0],n=t[t.length-1];e.shiftKey&&e.target===r?(e.preventDefault(),n.focus()):(e.shiftKey||e.target!==n)&&t.includes(e.target)||(e.preventDefault(),r.focus())}}}},{key:"render",value:function(){return Object(c.createElement)("div",{onKeyDown:this.handleTabBehaviour,ref:this.focusContainRef,tabIndex:"-1"},Object(c.createElement)(e,this.props))}}]),i}(c.Component)}),"withConstrainedTabbing"),D=r(87);var M=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){return Object(f.a)(this,o),n.apply(this,arguments)}return Object(p.a)(o,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),o}(c.Component),A=Object(D.a)(M);function I(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=Object(m.a)(e);if(t){var o=Object(m.a)(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Object(b.a)(this,r)}}var F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.htmlDocument,r=void 0===t?document:t,n=e.className,o=void 0===n?"lockscroll":n,i=0,a=0;function u(e){var t=r.scrollingElement||r.body;e&&(a=t.scrollTop);var n=e?"add":"remove";t.classList[n](o),r.documentElement.classList[n](o),e||(t.scrollTop=a)}function s(){0===i&&u(!0),++i}function l(){1===i&&u(!1),--i}return function(e){Object(d.a)(r,e);var t=I(r);function r(){return Object(f.a)(this,r),t.apply(this,arguments)}return Object(p.a)(r,[{key:"componentDidMount",value:function(){s()}},{key:"componentWillUnmount",value:function(){l()}},{key:"render",value:function(){return null}}]),r}(c.Component)}();function B(e){e.stopPropagation()}var L=Object(c.forwardRef)((function(e,t){var r=e.children,i=Object(o.a)(e,["children"]);return Object(c.createElement)("div",Object(n.a)({},i,{ref:t,onMouseDown:B}),r)})),z=r(58);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 U(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){Object(w.a)(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}function W(e){var t=Object(c.useContext)(z.a),r=t.slots[e]||{},n=t.fills[e],o=Object(c.useMemo)((function(){return n||[]}),[n]),i=Object(c.useCallback)((function(r){t.updateSlot(e,r)}),[e,t.updateSlot]),a=Object(c.useCallback)((function(r){t.unregisterSlot(e,r)}),[e,t.unregisterSlot]),u=Object(c.useCallback)((function(r){t.registerFill(e,r)}),[e,t.registerFill]),s=Object(c.useCallback)((function(r){t.unregisterFill(e,r)}),[e,t.unregisterFill]);return U(U({},r),{},{updateSlot:i,unregisterSlot:a,fills:o,registerFill:u,unregisterFill:s})}function V(e,t,r){return(V="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Object(m.a)(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}r(27);var Y=Object(c.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),q=(Y.Provider,Y.Consumer);c.Component;var G=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){var e;return Object(f.a)(this,o),(e=n.apply(this,arguments)).isUnmounted=!1,e.bindNode=e.bindNode.bind(Object(k.a)(e)),e}return Object(p.a)(o,[{key:"componentDidMount",value:function(){(0,this.props.registerSlot)(this.props.name,this)}},{key:"componentWillUnmount",value:function(){var e=this.props.unregisterSlot;this.isUnmounted=!0,e(this.props.name,this)}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.name,n=t.unregisterSlot,o=t.registerSlot;e.name!==r&&(n(e.name),o(r,this))}},{key:"bindNode",value:function(e){this.node=e}},{key:"forceUpdate",value:function(){this.isUnmounted||V(Object(m.a)(o.prototype),"forceUpdate",this).call(this)}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.name,n=e.fillProps,o=void 0===n?{}:n,i=e.getFills,a=Object(u.map)(i(r,this),(function(e){var t=e.occurrence,r=Object(u.isFunction)(e.children)?e.children(o):e.children;return c.Children.map(r,(function(e,r){if(!e||Object(u.isString)(e))return e;var n="".concat(t,"---").concat(e.key||r);return Object(c.cloneElement)(e,{key:n})}))})).filter(Object(u.negate)(c.isEmptyElement));return Object(c.createElement)(c.Fragment,null,Object(u.isFunction)(t)?t(a):a)}}]),o}(c.Component),K=function(e){return Object(c.createElement)(q,null,(function(t){var r=t.registerSlot,o=t.unregisterSlot,i=t.getFills;return Object(c.createElement)(G,Object(n.a)({},e,{registerSlot:r,unregisterSlot:o,getFills:i}))}))},Q=0;function J(e){var t=e.name,r=e.children,n=e.registerFill,o=e.unregisterFill,i=function(e){var t=Object(c.useContext)(Y),r=t.getSlot,n=t.subscribe,o=Object(c.useState)(r(e)),i=Object(h.a)(o,2),a=i[0],u=i[1];return Object(c.useEffect)((function(){return u(r(e)),n((function(){u(r(e))}))}),[e]),a}(t),a=Object(c.useRef)({name:t,children:r});return a.current.occurrence||(a.current.occurrence=++Q),Object(c.useLayoutEffect)((function(){return n(t,a.current),function(){return o(t,a.current)}}),[]),Object(c.useLayoutEffect)((function(){a.current.children=r,i&&i.forceUpdate()}),[r]),Object(c.useLayoutEffect)((function(){t!==a.current.name&&(o(a.current.name,a.current),a.current.name=t,n(t,a.current))}),[t]),i&&i.node?(Object(u.isFunction)(r)&&(r=r(i.props.fillProps)),Object(c.createPortal)(r,i.node)):null}var X=function(e){return Object(c.createElement)(q,null,(function(t){var r=t.registerFill,o=t.unregisterFill;return Object(c.createElement)(J,Object(n.a)({},e,{registerFill:r,unregisterFill:o}))}))};function $(e){var t=e.name,r=e.fillProps,i=void 0===r?{}:r,a=e.as,u=void 0===a?"div":a,s=Object(o.a)(e,["name","fillProps","as"]),l=Object(c.useContext)(z.a),f=Object(c.useRef)();return Object(c.useLayoutEffect)((function(){return l.registerSlot(t,f,i),function(){l.unregisterSlot(t,f)}}),[l.registerSlot,l.unregisterSlot,t]),Object(c.useLayoutEffect)((function(){l.updateSlot(t,i)})),Object(c.createElement)(u,Object(n.a)({ref:f},s))}function Z(e){var t,r,n=e.name,o=e.children,i=W(n),a=Object(c.useRef)({rerender:(t=Object(c.useState)({}),r=Object(h.a)(t,2)[1],function(){return r({})})});return Object(c.useEffect)((function(){return i.registerFill(a),function(){i.unregisterFill(a)}}),[i.registerFill,i.unregisterFill]),i.ref&&i.ref.current?("function"==typeof o&&(o=o(i.fillProps)),Object(c.createPortal)(o,i.ref.current)):null}function ee(e){var t=e.bubblesVirtually,r=Object(o.a)(e,["bubblesVirtually"]);return t?Object(c.createElement)($,r):Object(c.createElement)(K,r)}function te(e){return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(X,e),Object(c.createElement)(Z,e))}function re(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 ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){Object(w.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oe(e){var t=e.type,r=e.origin,n=void 0===r?function(e){return"appear"===e?"top":"left"}(t):r;if("appear"===t){var o,c=n.split(" "),i=Object(h.a)(c,2),u=i[0],s=i[1],l=void 0===s?"center":s;return a()("components-animate__appear",(o={},Object(w.a)(o,"is-from-"+l,"center"!==l),Object(w.a)(o,"is-from-"+u,"middle"!==u),o))}return"slide-in"===t?a()("components-animate__slide-in","is-from-"+n):"loading"===t?a()("components-animate__loading"):void 0}function ce(e){var t=e.type,r=e.options,n=void 0===r?{}:r;return(0,e.children)({className:oe(ne({type:t},n))})}var ie=N(T((function(e){return e.children})));function ae(e,t){var r,n=(r=t).ownerDocument.defaultView.getComputedStyle(r),o=n.paddingTop,c=n.paddingBottom,i=n.paddingLeft,a=n.paddingRight,u=o?parseInt(o,10):0,s=c?parseInt(c,10):0,l=i?parseInt(i,10):0,f=a?parseInt(a,10):0;return{x:e.left+l,y:e.top+u,width:e.width-l-f,height:e.height-u-s,left:e.left+l,right:e.right-f,top:e.top+u,bottom:e.bottom-s}}function ue(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function se(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==r&&(e.style[t]=r)}function le(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var fe=function(e){var t=e.headerTitle,r=e.onClose,i=e.onKeyDown,u=e.children,s=e.className,f=e.noArrow,p=void 0===f||f,d=e.isAlternate,b=e.position,m=void 0===b?"bottom right":b,w=(e.range,e.focusOnMount),j=void 0===w?"firstElement":w,R=e.anchorRef,k=e.shouldAnchorIncludePadding,P=e.anchorRect,S=e.getAnchorRect,C=e.expandOnMobile,T=e.animate,N=void 0===T||T,D=e.onClickOutside,M=e.onFocusOutside,I=e.__unstableSticky,B=e.__unstableSlotName,z=void 0===B?"Popover":B,H=e.__unstableObserveElement,U=e.__unstableBoundaryParent,V=Object(o.a)(e,["headerTitle","onClose","onKeyDown","children","className","noArrow","isAlternate","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside","__unstableSticky","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent"]),Y=Object(c.useRef)(null),q=Object(c.useRef)(null),G=Object(c.useRef)(),K=Object(v.useViewportMatch)("medium","<"),Q=Object(c.useState)(),J=Object(h.a)(Q,2),X=J[0],$=J[1],Z=W(z),ee=C&&K,re=Object(v.useResizeObserver)(),ne=Object(h.a)(re,2),oe=ne[0],fe=ne[1];p=ee||p,Object(c.useLayoutEffect)((function(){if(ee)return le(G.current,"is-without-arrow",p),le(G.current,"is-alternate",d),ue(G.current,"data-x-axis"),ue(G.current,"data-y-axis"),se(G.current,"top"),se(G.current,"left"),se(q.current,"maxHeight"),void se(q.current,"maxWidth");var e=function(){if(G.current&&q.current){var e=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(t)return t;if(r){if(!e.current)return;return r(e.current)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if(n instanceof window.Range)return Object(g.getRectangleFromRange)(n);if(n instanceof window.Element){var c=n.getBoundingClientRect();return o?c:ae(c,n)}var i=n.top,a=n.bottom,u=i.getBoundingClientRect(),s=a.getBoundingClientRect(),l=new window.DOMRect(u.left,u.top,u.width,s.bottom-u.top);return o?l:ae(l,n)}if(e.current){var f=e.current.parentNode,p=f.getBoundingClientRect();return o?p:ae(p,f)}}(Y,P,S,R,k);if(e){var t,r,n=G.current,o=n.offsetParent,c=n.ownerDocument,i=0;if(o&&o!==c.body){var a=o.getBoundingClientRect();i=a.top,e=new window.DOMRect(e.left-a.left,e.top-a.top,e.width,e.height)}U&&(t=null===(r=G.current.closest(".popover-slot"))||void 0===r?void 0:r.parentNode);var u=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,c=arguments.length>5?arguments[5]:void 0,i=arguments.length>6?arguments[6]:void 0,a=r.split(" "),u=Object(h.a)(a,3),s=u[0],l=u[1],f=void 0===l?"center":l,p=u[2],d=x(e,t,s,p,n,o,c),b=_(e,t,f,p,n,d.yAxis,i);return E(E({},b),d)}(e,fe.height?fe:q.current.getBoundingClientRect(),m,I,G.current,i,t),s=u.popoverTop,l=u.popoverLeft,f=u.xAxis,b=u.yAxis,O=u.contentHeight,v=u.contentWidth;"number"==typeof s&&"number"==typeof l&&(se(G.current,"top",s+"px"),se(G.current,"left",l+"px")),le(G.current,"is-without-arrow",p||"center"===f&&"middle"===b),le(G.current,"is-alternate",d),ue(G.current,"data-x-axis",f),ue(G.current,"data-y-axis",b),se(q.current,"maxHeight","number"==typeof O?O+"px":""),se(q.current,"maxWidth","number"==typeof v?v+"px":""),$(({left:"right",right:"left"}[f]||"center")+" "+({top:"bottom",bottom:"top"}[b]||"middle"))}}};e();var t,r,n=window.setInterval(e,500),o=function(){window.cancelAnimationFrame(t),t=window.requestAnimationFrame(e)};return window.addEventListener("click",o),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),H&&(r=new window.MutationObserver(e)).observe(H,{attributes:!0}),function(){window.clearInterval(n),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0),window.removeEventListener("click",o),window.cancelAnimationFrame(t),r&&r.disconnect()}}),[ee,P,S,R,k,m,fe,I,H,U]),function(e,t){Object(c.useEffect)((function(){var r=setTimeout((function(){if(e&&t.current)if("firstElement"!==e)"container"===e&&t.current.focus();else{var r=g.focus.tabbable.find(t.current)[0];r?r.focus():t.current.focus()}}),0);return function(){return clearTimeout(r)}}),[])}(j,q);var pe=function(e){e.keyCode===O.ESCAPE&&r&&(e.stopPropagation(),r()),i&&i(e)},de=Object(c.createElement)(A,{onFocusOutside:function(e){if(M)M(e);else if(D){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}}),l()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),D(t)}else r&&r()}},Object(c.createElement)(ce,{type:N&&X?"appear":null,options:{origin:X}},(function(e){var o=e.className;return Object(c.createElement)(L,Object(n.a)({className:a()("components-popover",s,o,{"is-expanded":ee,"is-without-arrow":p,"is-alternate":d})},V,{onKeyDown:pe,ref:G}),ee&&Object(c.createElement)(F,null),ee&&Object(c.createElement)("div",{className:"components-popover__header"},Object(c.createElement)("span",{className:"components-popover__header-title"},t),Object(c.createElement)(Oe,{className:"components-popover__close",icon:y.a,onClick:r})),Object(c.createElement)("div",{ref:q,className:"components-popover__content",tabIndex:"-1"},Object(c.createElement)("div",{style:{position:"relative"}},oe,u)))})));return j&&(de=Object(c.createElement)(ie,null,de)),Z.ref&&(de=Object(c.createElement)(te,{name:z},de)),R||P?de:Object(c.createElement)("span",{ref:Y},de)};fe.Slot=function(e){var t=e.name,r=void 0===t?"Popover":t;return Object(c.createElement)(ee,{bubblesVirtually:!0,name:r,className:"popover-slot"})};var pe=fe,de=function(e){var t,r,n=e.shortcut,o=e.className;return n?(Object(u.isString)(n)&&(t=n),Object(u.isObject)(n)&&(t=n.display,r=n.ariaLabel),Object(c.createElement)("span",{className:o,"aria-label":r},t)):null};var be=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){var e;return Object(f.a)(this,o),(e=n.apply(this,arguments)).delayedSetIsOver=Object(u.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return Object(p.a)(o,[{key:"componentWillUnmount",value:function(){this.delayedSetIsOver.cancel(),document.removeEventListener("mouseup",this.cancelIsMouseDown)}},{key:"emitToChild",value:function(e,t){var r=this.props.children;if(1===c.Children.count(r)){var n=c.Children.only(r);"function"==typeof n.props[e]&&n.props[e](t)}}},{key:"createToggleIsOver",value:function(e,t){var r=this;return function(n){if(r.emitToChild(e,n),!(n.currentTarget.disabled||"focus"===n.type&&r.isInMouseDown)){r.delayedSetIsOver.cancel();var o=Object(u.includes)(["focus","mouseenter"],n.type);o!==r.state.isOver&&(t?r.delayedSetIsOver(o):r.setState({isOver:o}))}}}},{key:"createSetIsMouseDown",value:function(e){var t=this;return function(r){t.emitToChild(e?"onMouseDown":"onMouseUp",r),document[e?"addEventListener":"removeEventListener"]("mouseup",t.cancelIsMouseDown),t.isInMouseDown=e}}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.position,n=e.text,o=e.shortcut;if(1!==c.Children.count(t))return t;var i=c.Children.only(t),a=this.state.isOver;return Object(c.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(c.concatChildren)(i.props.children,a&&Object(c.createElement)(pe,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(c.createElement)(de,{className:"components-tooltip__shortcut",shortcut:o})))})}}]),o}(c.Component),me=r(92);function he(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 ge=["onMouseDown","onClick"],Oe=t.a=Object(c.forwardRef)((function(e,t){var r=e.href,i=e.target,s=e.isPrimary,f=e.isSmall,p=e.isTertiary,d=e.isPressed,b=e.isBusy,m=e.isDefault,h=e.isSecondary,g=e.isLink,O=e.isDestructive,v=e.className,y=e.disabled,w=e.icon,j=e.iconSize,E=e.showTooltip,_=e.tooltipPosition,x=e.shortcut,R=e.label,k=e.children,P=e.__experimentalIsFocusable,S=Object(o.a)(e,["href","target","isPrimary","isSmall","isTertiary","isPressed","isBusy","isDefault","isSecondary","isLink","isDestructive","className","disabled","icon","iconSize","showTooltip","tooltipPosition","shortcut","label","children","__experimentalIsFocusable"]);m&&l()("Button isDefault prop",{alternative:"isSecondary"});var C=a()("components-button",v,{"is-secondary":m||h,"is-primary":s,"is-small":f,"is-tertiary":p,"is-pressed":d,"is-busy":b,"is-link":g,"is-destructive":O,"has-text":!!w&&!!k,"has-icon":!!w}),T=y&&!P,N=void 0===r||T?"button":"a",D="a"===N?{href:r,target:i}:{type:"button",disabled:T,"aria-pressed":d};if(y&&P){D["aria-disabled"]=!0;var M,A=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return he(e,void 0);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)?he(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}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,i=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,c=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw c}}}}(ge);try{for(A.s();!(M=A.n()).done;)S[M.value]=function(e){e.stopPropagation(),e.preventDefault()}}catch(e){A.e(e)}finally{A.f()}}var I=!T&&(E&&R||x||!!R&&(!k||Object(u.isArray)(k)&&!k.length)&&!1!==E),F=Object(c.createElement)(N,Object(n.a)({},D,S,{className:C,"aria-label":S["aria-label"]||R,ref:t}),w&&Object(c.createElement)(me.a,{icon:w,size:j}),k);return I?Object(c.createElement)(be,{text:R,shortcut:x,position:_},F):F}))},function(e,t,r){var n=r(73);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}},e.exports.default=e.exports,e.exports.__esModule=!0},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}r.d(t,"a",(function(){return n}))},,,function(e,t){e.exports=window.wp.url},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return a})),r.d(t,"d",(function(){return u}));var n=r(23),o=r.n(n),c=function(e){return"number"==typeof e},i=function(e){return"string"==typeof e},a=function(e){return!function(e){return null===e}(e)&&"object"===o()(e)};function u(e,t){return a(e)&&t in e}},,function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,r(t,n)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.warning},,,function(e,t){e.exports=window.wp.hooks},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(6),i=r.n(c),a=r(2),u=r(1),s=r(78);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 f(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 p=Object(a.getSetting)("countryLocale",{}),d=function(e){var t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(u.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
-
Object(u.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(s.a)(e.priority)&&(t.index=e.priority),Object(s.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},b=Object.entries(p).map((function(e){var t=i()(e,2),r=t[0],n=t[1];return[r,Object.entries(n).map((function(e){var t=i()(e,2),r=t[0],n=t[1];return[r,d(n)]})).reduce((function(e,t){var r=i()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{})]})).reduce((function(e,t){var r=i()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{});t.a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==b[r]?b[r]:{};return e.map((function(e){var r=a.defaultAddressFields[e]||{},o=n[e]||{},c=t[e]||{};return f(f(f({key:e},r),o),c)})).sort((function(e,t){return e.index-t.index}))}},function(e,t,r){"use strict";var n=r(9),o=r(19),c=r(20),i=r(15),a=r(21),u=r(22),s=r(11),l=r(0),f=r(7),p=r(18);var d=["button","submit"];t.a=Object(p.createHigherOrderComponent)((function(e){return function(t){Object(a.a)(m,t);var r,p,b=(r=m,p=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}}(),function(){var e,t=Object(s.a)(r);if(p){var n=Object(s.a)(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Object(u.a)(this,e)});function m(){var e;return Object(o.a)(this,m),(e=b.apply(this,arguments)).bindNode=e.bindNode.bind(Object(i.a)(e)),e.cancelBlurCheck=e.cancelBlurCheck.bind(Object(i.a)(e)),e.queueBlurCheck=e.queueBlurCheck.bind(Object(i.a)(e)),e.normalizeButtonFocus=e.normalizeButtonFocus.bind(Object(i.a)(e)),e}return Object(c.a)(m,[{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,r=e.target;Object(f.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return Object(f.includes)(d,e.type)}return!1}(r)&&(this.preventBlurCheck=!0)}},{key:"render",value:function(){return Object(l.createElement)("div",{onFocus:this.cancelBlurCheck,onMouseDown:this.normalizeButtonFocus,onMouseUp:this.normalizeButtonFocus,onTouchStart:this.normalizeButtonFocus,onTouchEnd:this.normalizeButtonFocus,onBlur:this.queueBlurCheck},Object(l.createElement)(e,Object(n.a)({ref:this.bindNode},this.props)))}}]),m}(l.Component)}),"withFocusOutside")},,function(e,t,r){"use strict";var n=r(90);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}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){},function(e,t,r){"use strict";var n=r(25),o=r(9),c=r(16),i=r(0),a=r(34),u=function(e){var t=e.icon,r=e.className,n=Object(c.a)(e,["icon","className"]),a=["dashicon","dashicons","dashicons-"+t,r].filter(Boolean).join(" ");return Object(i.createElement)("span",Object(o.a)({className:a},n))};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){Object(n.a)(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}t.a=function(e){var t=e.icon,r=void 0===t?null:t,n=e.size,s=Object(c.a)(e,["icon","size"]);if("string"==typeof r)return Object(i.createElement)(u,Object(o.a)({icon:r},s));if(r&&u===r.type)return Object(i.cloneElement)(r,l({},s));var f=n||24;if("function"==typeof r)return r.prototype instanceof i.Component?Object(i.createElement)(r,l({size:f},s)):r(l({size:f},s));if(r&&("svg"===r.type||r.type===a.SVG)){var p=l(l({width:f,height:f},r.props),s);return Object(i.createElement)(a.SVG,p)}return Object(i.isValidElement)(r)?Object(i.cloneElement)(r,l({size:f},s)):r}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){i=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return c}},e.exports.default=e.exports,e.exports.__esModule=!0},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.")},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(6),o=r.n(n),c=function(e){return e.reduce((function(e,t){var r=o()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{})}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return u}));var n=r(2),o=r(86),c=r(77),i=function(e){var t=e.country,r=void 0===t?"":t,n=e.state,o=void 0===n?"":n,c=e.city,i=void 0===c?"":c,a=e.postcode,u=void 0===a?"":a;return{country:r.trim(),state:o.trim(),city:i.trim(),postcode:u?u.replace(" ","").toUpperCase():""}},a=function(e){var t=e.email,r=void 0===t?"":t;return Object(c.isEmail)(r)?r.trim():""},u=function(e){var t=Object.keys(n.defaultAddressFields),r=Object(o.a)(t,{},e.country),c=Object.assign({},e);return r.forEach((function(t){var r=t.key,n=void 0===r?"":r,o=t.hidden;void 0!==o&&o&&function(e,t){return e in t}(n,e)&&(c[n]="")})),c}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(6),o=r.n(n),c=r(0),i=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return Object(c.useCallback)((function(e){t((function(){throw e}))}),[])}},function(e,t){e.exports=window.wp.autop},,,function(e,t){var r,n,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===c||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:c}catch(e){r=c}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,s=[],l=!1,f=-1;function p(){l&&u&&(l=!1,u.length?s=u.concat(s):f=-1,s.length&&d())}function d(){if(!l){var e=a(p);l=!0;for(var t=s.length;t;){for(u=s,s=[];++f<t;)u&&u[f].run();f=-1,t=s.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new b(e,t)),1!==s.length||l||a(d)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,,,,function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(0),i=(r(142),function(e){if(e){var t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()}});t.a=function(e){return function(t){var r=Object(c.useRef)(null);return React.createElement(React.Fragment,null,React.createElement("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),React.createElement(e,o()({},t,{scrollToTop:function(e){var t,n;null!==r.current&&(t=r.current,n=(e||{}).focusableSelector,window&&Number.isFinite(window.innerHeight)&&(n?function(e,t){var r,n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){var o=n[0];i(o),null==o||o.focus()}else i(e)}(t,n):i(t)))}})))}}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return m}));var n=r(6),o=r.n(n),c=r(10),i=r(13),a=r(0),u=r(27),s=r.n(u),l=r(66),f=r(122),p=r(70),d=function(e){var t=Object(p.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,n])]},b=function(e,t,r){var n=Object(p.a)();r=r||n;var o=Object(i.useSelect)((function(n){return n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),u=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(a.useCallback)((function(t){u(r,e,t)}),[r,e,u])]},m=function(e,t){var r=Object(p.a)(),n=d(t=t||r),c=o()(n,2),i=c[0],u=c[1],b=Object(l.a)(i),m=Object(l.a)(e),h=Object(f.a)(m),g=Object(a.useRef)(!1);return Object(a.useEffect)((function(){s()(h,m)||(u(Object.assign({},b,m)),g.current=!0)}),[b,m,h,u]),g.current?[i,u]:[e,u]}},,,function(e,t,r){"use strict";r.d(t,"b",(function(){return w})),r.d(t,"a",(function(){return j}));var n=r(5),o=r.n(n),c=r(6),i=r.n(c),a=(r(8),r(0)),u=r(13),s=r(55),l=r(41),f=r(12),p=r.n(f),d=r(3),b=r.n(d),m=r(182),h=(r(123),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""}),g=function(e){var t=e.className,r=e.notices,n=e.removeNotice,o=r.filter((function(e){return"snackbar"!==e.type}));if(!o.length)return null;var c=b()(t,"wc-block-components-notices");return React.createElement("div",{className:c},o.map((function(e){return React.createElement(m.a,p()({key:"store-notice-"+e.id},e,{className:b()("wc-block-components-notices__notice",h(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)})))};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 v(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}var y=Object(a.createContext)({notices:[],createNotice:function(e,t,r){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),w=function(){return Object(a.useContext)(y)},j=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,o=e.createNoticeContainer,c=void 0===o||o,f=e.context,p=void 0===f?"wc/core":f,d=Object(u.useDispatch)("core/notices"),b=d.createNotice,m=d.removeNotice,h=Object(a.useState)(!1),O=i()(h,2),w=O[0],j=O[1],E=Object(s.a)().dispatchStoreEvent,_=Object(l.a)().isEditor,x=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]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};b(e,t,v(v({},r),{},{context:r.context||p})),E("store-notice-create",{status:e,content:t,options:r})}),[b,E,p]),R=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;m(e,t)}),[m,p]),k={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(p)}}),[p]).notices,createNotice:x,removeNotice:R,context:p,setIsSuppressed:j},P=w?null:React.createElement(g,{className:n,notices:k.notices,removeNotice:k.removeNotice,isEditor:_});return React.createElement(y.Provider,{value:k},c&&P,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(12),o=r.n(n),c=r(5),i=r.n(c),a=r(0),u=r(54);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)}))},d=function(e){var t,r,n,o,c,i,a,u=document.body.querySelectorAll(f.join(","));t=l(l({},e),{},{wrappers:u}),r=t.Block,n=t.getProps,o=t.getErrorBoundaryProps,c=t.selector,i=t.wrappers,a=document.body.querySelectorAll(c),i.length>0&&Array.prototype.filter.call(a,(function(e){return!function(e,t){return Array.prototype.some.call(t,(function(t){return t.contains(e)&&!t.isSameNode(e)}))}(e,i)})),p({Block:r,containers:a,getProps:n,getErrorBoundaryProps:o}),Array.prototype.forEach.call(u,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var r,n,o,c,i,a;n=(r=l(l({},e),{},{wrapper:t})).Block,o=r.getProps,c=r.getErrorBoundaryProps,i=r.selector,a=r.wrapper.querySelectorAll(i),p({Block:n,containers:a,getProps:o,getErrorBoundaryProps:c})}))}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(4);function o(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},function(e,t){},,,,function(e,t){e.exports=window.wp.wordcount},,,function(e,t,r){"use strict";var n=r(0),o=r(34),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},,,,,,,,,,,,function(e,t){},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(10),o=r(13),c=r(0),i=r(66),a=r(103),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,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 b=Object(c.useRef)({results:[],isLoading:!0}),m=Object(i.a)(f),h=Object(i.a)(s),g=Object(a.a)(),O=Object(o.useSelect)((function(e){if(!d)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,m,h],i=o.getCollectionError.apply(o,c);return i&&g(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,h,m,d]);return null!==O&&(b.current=O),b.current}},,,,,function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(17),i=r.n(c),a=r(0),u=["srcElement","size"];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,u);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)):null}},function(e,t,r){"use strict";var n=r(0),o=r(10),c=r(13),i=r(14);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(i.o.restApiRoutes||{}),Object(c.useSelect)((function(e,t){if(r.current){var n=e(o.SCHEMA_STORE_KEY),c=n.isResolving,i=n.hasFinishedResolution,a=t.dispatch(o.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];c("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r(8);var n=r(3),o=r.n(n),c=r(40),i=r(18);r(192),t.a=Object(i.withInstanceId)((function(e){var t=e.className,r=e.instanceId,n=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(r);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:n,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,r){"use strict";var n=r(0),o=r(7),c=r(3),i=r.n(c),a=r(1),u=r(36),s=r(130),l=r(71);t.a=function(e){var t=e.className,r=e.status,c=void 0===r?"info":r,f=e.children,p=e.spokenMessage,d=void 0===p?f:p,b=e.onRemove,m=void 0===b?o.noop:b,h=e.isDismissible,g=void 0===h||h,O=e.actions,v=void 0===O?[]:O,y=e.politeness,w=void 0===y?function(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}(c):y,j=e.__unstableHTML;!function(e,t){var r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)((function(){r&&Object(u.speak)(r,t)}),[r,t])}(d,w);var E=i()(t,"components-notice","is-"+c,{"is-dismissible":g});return j&&(f=Object(n.createElement)(n.RawHTML,null,f)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},f,v.map((function(e,t){var r=e.className,o=e.label,c=e.isPrimary,a=e.noDefaultClasses,u=void 0!==a&&a,s=e.onClick,f=e.url;return Object(n.createElement)(l.a,{key:t,href:f,isPrimary:c,isSecondary:!u&&!f,isLink:!u&&!!f,onClick:f?void 0:s,className:i()("components-notice__action",r)},o)}))),g&&Object(n.createElement)(l.a,{className:"components-notice__dismiss",icon:s.a,label:Object(a.__)("Dismiss this notice"),onClick:m,showTooltip:!1}))}},,,,,,,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(38),o=r(0),c=r(14);r.p=c.m,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)((function(){return Promise.all([r.e(22),r.e(6)]).then(r.bind(null,334))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)((function(){return r.e(5).then(r.bind(null,345))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)((function(){return r.e(13).then(r.bind(null,344))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return r.e(7).then(r.bind(null,335))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)((function(){return r.e(3).then(r.bind(null,336))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return r.e(11).then(r.bind(null,337))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return r.e(8).then(r.bind(null,320))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return r.e(9).then(r.bind(null,338))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return r.e(4).then(r.bind(null,339))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return r.e(12).then(r.bind(null,340))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return r.e(10).then(r.bind(null,341))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)((function(){return Promise.all([r.e(21),r.e(2)]).then(r.bind(null,342))}))});var i=function(e){return Object(n.getRegisteredBlockComponents)(e)}},,,,,,,,,,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t){e.exports=window.wp.blockEditor},,,,,,,,,,function(e,t,r){e.exports=r(300)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(151),o=r(120),c=r(121),i=r(43),a=r.n(i),u=r(44),s=r.n(u),l=r(45),f=r.n(l),p=r(46),d=r.n(p),b=r(33),m=r.n(b),h=r(4),g=(r(8),r(6)),O=r.n(g),v=r(0),y=r(17),w=r.n(y),j=r(5),E=r.n(j),_=r(1),x=r(7),R=r(3),k=r.n(R),P=r(40),S=(r(258),function(e){var t=e.currentPage,r=e.displayFirstAndLastPages,n=e.displayNextAndPreviousArrows,o=e.pagesToDisplay,c=e.onPageChange,i=e.totalPages,a=function(e,t,r){if(r<=2)return{minIndex:null,maxIndex:null};var n=e-1,o=Math.max(Math.floor(t-n/2),2),c=Math.min(Math.ceil(t+(n-(t-o))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(c-t))),2),maxIndex:c}}(o,t,i),u=a.minIndex,s=a.maxIndex,l=r&&Boolean(1!==u),f=r&&Boolean(s!==i),p=r&&Boolean(u>3),d=r&&Boolean(s<i-2);l&&3===u&&(u-=1),f&&s===i-2&&(s+=1);var b=[];if(u&&s)for(var m=u;m<=s;m++)b.push(m);return React.createElement("div",{className:"wc-block-pagination wc-block-components-pagination"},React.createElement(P.a,{screenReaderLabel:Object(_.__)("Navigate to another page","woo-gutenberg-products-block")}),n&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return c(t-1)},title:Object(_.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},React.createElement(P.a,{label:"←",screenReaderLabel:Object(_.__)("Previous page","woo-gutenberg-products-block")})),l&&React.createElement("button",{className:k()("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(P.a,{label:1,screenReaderLabel:Object(_.sprintf)(
|
4 |
/* translators: %d is the page number (1, 2, 3...). */
|
5 |
-
Object(_.__)("Page %d","woo-gutenberg-products-block"),1)})),
|
6 |
/* translators: %d is the page number (1, 2, 3...). */
|
7 |
-
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")),
|
8 |
/* translators: %d is the page number (1, 2, 3...). */
|
9 |
-
Object(_.__)("Page %d","woo-gutenberg-products-block"),i)})),n&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return c(t+1)},title:Object(_.__)("Next page","woo-gutenberg-products-block"),disabled:t>=i},React.createElement(P.a,{label:"→",screenReaderLabel:Object(_.__)("Next page","woo-gutenberg-products-block")})))});S.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var C=S,T=r(
|
10 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
11 |
-
Object(_._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(
|
1 |
+
!function(e){function t(t){for(var r,o,c=t[0],i=t[1],a=0,s=[];a<c.length;a++)o=c[a],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&s.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(u&&u(t);s.length;)s.shift()()}var r={},n={1:0};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.e=function(e){var t=[],r=n[e];if(0!==r)if(r)t.push(r[2]);else{var c=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[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",24:"vendors--atomic-block-components/add-to-cart",25:"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 r=n[e];if(0!==r){if(r){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,r[1](u)}n[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=r,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},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=262)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t,r){var n;!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)){if(n.length){var i=o.apply(null,n);i&&e.push(i)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.React},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(90),o=r(91),c=r(72),i=r(92);e.exports=function(e,t){return n(e)||o(e,t)||c(e,t)||i()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t,r){"use strict";function n(){return(n=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}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},function(e,t,r){e.exports=r(82)()},function(e,t,r){"use strict";function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}r.d(t,"a",(function(){return n}))},function(e,t){e.exports=window.wp.data},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},e.exports.default=e.exports,e.exports.__esModule=!0,r.apply(this,arguments)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";function n(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"n",(function(){return i})),r.d(t,"m",(function(){return a})),r.d(t,"j",(function(){return s})),r.d(t,"d",(function(){return l})),r.d(t,"g",(function(){return p})),r.d(t,"f",(function(){return f})),r.d(t,"l",(function(){return d})),r.d(t,"k",(function(){return b})),r.d(t,"c",(function(){return m})),r.d(t,"e",(function(){return h})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return O})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return y})),r.d(t,"p",(function(){return w}));var n,o=r(2),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",a=c.pluginUrl+"build/",u=c.buildPhase,s=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),p=o.STORE_PAGES.privacy.permalink,f=o.STORE_PAGES.privacy.title,d=o.STORE_PAGES.terms.permalink,b=o.STORE_PAGES.terms.title,m=(o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),h=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),g=Object(o.getSetting)("shippingCountries",{}),O=Object(o.getSetting)("allowedCountries",{}),v=Object(o.getSetting)("shippingStates",{}),y=Object(o.getSetting)("allowedStates",{}),w=(r(53),function(){return u>1})},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(66);function o(e,t){if(null==e)return{};var r,o,c=Object(n.a)(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}},function(e,t,r){var n=r(81);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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";function n(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)}}function o(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}r.d(t,"a",(function(){return o}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(77);function o(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&&Object(n.a)(e,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(22),o=r.n(n),c=r(14);function i(e,t){return!t||"object"!==o()(t)&&"function"!=typeof t?Object(c.a)(e):t}},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=r=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.htmlEntities},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}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(71);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){i=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return c}}(e,t)||Object(n.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){e.exports=window.wp.isShallowEqual},,function(e,t){e.exports=window.regeneratorRuntime},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},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,r(t)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var n=r(6),o=r.n(n),c=r(5),i=r.n(c),a=r(7),u=r(0),s=r(8),l=r(12),p=r(24),f=r(100),d=r(101),b=r(39);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 h(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){i()(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={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},O=h(h({},g),{},{email:""}),v={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},y=function(e){return Object(f.a)(Object.entries(e).map((function(e){var t=o()(e,2),r=t[0],n=t[1];return[r,Object(p.decodeEntities)(n)]})))},w={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:v,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,shippingRates:s.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:function(){},extensions:s.EMPTY_EXTENSIONS},j=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(b.a)(),r=t.isEditor,n=t.previewData,o=null==n?void 0:n.previewCart,c=e.shouldSelect,i=Object(u.useRef)(),p=Object(l.useSelect)((function(e,t){var n=t.dispatch;if(!c)return w;if(r)return{cartCoupons:o.coupons,cartItems:o.items,cartFees:o.fees,cartItemsCount:o.items_count,cartItemsWeight:o.items_weight,cartNeedsPayment:o.needs_payment,cartNeedsShipping:o.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:o.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:O,shippingAddress:g,extensions:s.EMPTY_EXTENSIONS,shippingRates:o.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:o.has_calculated_shipping,paymentRequirements:o.paymentRequirements,receiveCart:"function"==typeof(null==o?void 0:o.receiveCart)?o.receiveCart:function(){}};var i=e(s.CART_STORE_KEY),a=i.getCartData(),u=i.getCartErrors(),l=i.getCartTotals(),p=!i.hasFinishedResolution("getCartData"),f=i.isCustomerDataUpdating(),b=n(s.CART_STORE_KEY).receiveCart,m=y(a.billingAddress),v=a.needsShipping?y(a.shippingAddress):m,j=a.fees.length>0?a.fees.map((function(e){return y(e)})):s.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map((function(e){return h(h({},e),{},{label:e.code})})):s.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:j,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:l,cartIsLoading:p,cartErrors:u,billingAddress:Object(d.a)(m),shippingAddress:Object(d.a)(v),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:f,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:b}}),[c]);return i.current&&Object(a.isEqual)(i.current,p)||(i.current=p),i.current}},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(65),o=r(71);function c(e){return function(e){if(Array.isArray(e))return Object(n.a)(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])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){e.exports=window.wp.a11y},function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),i=r(3),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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,i=e.wrapperProps,u=void 0===i?{}:i,l=null!=r,p=null!=n;return!l&&p?(t=o||"span",u=s(s({},u),{},{className:a()(u.className,"screen-reader-text")}),React.createElement(t,u,n)):(t=o||c.Fragment,l&&p&&r!==n?React.createElement(t,u,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,u,r))}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),o=(r(12),Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{},getPreviewData:function(){}})),c=function(){return Object(n.useContext)(o)}},,,function(e,t){e.exports=window.wp.dom},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(76);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)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){var n=r(22).default,o=r(30);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.keycodes},,function(e,t){e.exports=window.wp.blocks},function(e,t,r){"use strict";var n=r(44),o=r.n(n),c=r(45),i=r.n(c),a=r(30),u=r.n(a),s=r(46),l=r.n(s),p=r(47),f=r.n(p),d=r(32),b=r.n(d),m=r(5),h=r.n(m),g=(r(10),r(4)),O=r(1),v=r(15),y=function(e){var t=e.imageUrl,r=void 0===t?"".concat(v.n,"/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,l=e.button;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),l&&React.createElement("p",{className:"wc-block-error__button wc-block-components-error__button"},l)))};r(84);var w=function(e){l()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=b()(t);if(r){var o=b()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return f()(this,e)});function c(){var e;o()(this,c);for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e=n.call.apply(n,[this].concat(r)),h()(u()(e),"state",{errorMessage:"",hasError:!1}),e}return i()(c,[{key:"render",value:function(){var e=this.props,t=e.header,r=e.imageUrl,n=e.showErrorMessage,o=e.text,c=e.errorMessagePrefix,i=e.renderError,a=e.button,u=this.state,s=u.errorMessage;return u.hasError?"function"==typeof i?i({errorMessage:s}):React.createElement(y,{errorMessage:n?s:null,header:t,imageUrl:r,text:o,errorMessagePrefix:c,button:a}):this.props.children}}],[{key:"getDerivedStateFromError",value:function(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:React.createElement(React.Fragment,null,React.createElement("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}}]),c}(g.Component);w.defaultProps={showErrorMessage:!0},t.a=w},,function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),o=r.n(n),c=r(80),i=r(0),a=r(33);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(){var e=Object(a.a)(),t=Object(i.useRef)(e);return Object(i.useEffect)((function(){t.current=e}),[e]),{dispatchStoreEvent:Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-".concat(e),t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(i.useCallback)((function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-checkout-".concat(e),s(s({},r),{},{storeCart:t.current}))}catch(e){console.error(e)}}),[])}}},function(e,t,r){"use strict";(function(e){var n=r(0),o=(r(79),Object(n.createContext)({slots:{},fills:{},registerSlot:function(){void 0!==e&&e.env},updateSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){}}));t.a=o}).call(this,r(109))},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(27),c=r.n(o);function i(e){var t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},,,,,function(e,t,r){"use strict";function n(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}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";function n(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}r.d(t,"a",(function(){return n}))},function(e,t){e.exports=window.wp.apiFetch},,,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},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(65);function o(e,t){if(e){if("string"==typeof e)return Object(n.a)(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)?Object(n.a)(e,t):void 0}}},function(e,t,r){var n=r(73);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}},e.exports.default=e.exports,e.exports.__esModule=!0},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(9),o=r(16),c=r(0),i=r(3),a=r.n(i),u=r(7),s=r(49),l=r.n(s),p=r(18),f=r(19),d=r(20),b=r(21),m=r(11),h=r(26),g=r(42),O=r(51),v=r(23),y=r(127),w=r(25);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 E(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){Object(w.a)(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}function _(e,t,r,n,o,c,i){var a=t.width,u="rtl"===document.documentElement.dir;"left"===r&&u?r="right":"right"===r&&u&&(r="left"),"left"===n&&u?n="right":"right"===n&&u&&(n="left");var s=Math.round(e.left+e.width/2),l={popoverLeft:s,contentWidth:(s-a/2>0?a/2:s)+(s+a/2>window.innerWidth?window.innerWidth-s:a/2)},p=e.left;"right"===n?p=e.right:"middle"!==c&&(p=s);var f=e.right;"left"===n?f=e.left:"middle"!==c&&(f=s);var d,b={popoverLeft:p,contentWidth:p-a>0?a:p},m={popoverLeft:f,contentWidth:f+a>window.innerWidth?window.innerWidth-f:a},h=r,g=null;if(!o)if("center"===r&&l.contentWidth===a)h="center";else if("left"===r&&b.contentWidth===a)h="left";else if("right"===r&&m.contentWidth===a)h="right";else{var O="left"==(h=b.contentWidth>m.contentWidth?"left":"right")?b.contentWidth:m.contentWidth;g=O!==a?O:null}if(d="center"===h?l.popoverLeft:"left"===h?b.popoverLeft:m.popoverLeft,i){var v=i.getBoundingClientRect();d=Math.min(d,v.right-a)}return{xAxis:h,popoverLeft:d,contentWidth:g}}function x(e,t,r,n,o,c,i){var a=t.height;if(o){var u=(Object(g.getScrollContainer)(c)||document.body).getBoundingClientRect().top+a-i;if(e.top<=u)return{yAxis:r,popoverTop:Math.min(e.bottom,u)}}var s=e.top+e.height/2;"bottom"===n?s=e.bottom:"top"===n&&(s=e.top);var l={popoverTop:s,contentHeight:(s-a/2>0?a/2:s)+(s+a/2>window.innerHeight?window.innerHeight-s:a/2)},p={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},f={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a},d=r,b=null;if(!o)if("middle"===r&&l.contentHeight===a)d="middle";else if("top"===r&&p.contentHeight===a)d="top";else if("bottom"===r&&f.contentHeight===a)d="bottom";else{var m="top"==(d=p.contentHeight>f.contentHeight?"top":"bottom")?p.contentHeight:f.contentHeight;b=m!==a?m:null}return{yAxis:d,popoverTop:"middle"===d?l.popoverTop:"top"===d?p.popoverTop:f.popoverTop,contentHeight:b}}var R=r(35),k=r(14);var P=Object(c.createContext)({focusHistory:[]}),S=P.Provider,C=P.Consumer;S.displayName="FocusReturnProvider",C.displayName="FocusReturnConsumer",c.Component;var T=Object(v.createHigherOrderComponent)((function e(t){if((n=t)instanceof c.Component||"function"==typeof n){var r=t;return e({})(r)}var n,o=t.onFocusReturn,i=void 0===o?u.stubTrue:o;return function(e){var t=function(t){Object(d.a)(a,t);var r,n,o=(r=a,n=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}}(),function(){var e,t=Object(m.a)(r);if(n){var o=Object(m.a)(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return Object(b.a)(this,e)});function a(){var e;return Object(p.a)(this,a),(e=o.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 Object(f.a)(a,[{key:"componentWillUnmount",value:function(){var e=this.activeElementOnMount,t=this.isFocused,r=this.ownFocusedElements;if(t&&!1!==i())for(var n,o=[].concat(Object(R.a)(u.without.apply(void 0,[this.props.focus.focusHistory].concat(Object(R.a)(r)))),[e]);n=o.pop();)if(document.body.contains(n))return void n.focus()}},{key:"render",value:function(){return Object(c.createElement)("div",{onFocus:this.setIsFocusedTrue,onBlur:this.setIsFocusedFalse},Object(c.createElement)(e,this.props.childProps))}}]),a}(c.Component);return function(e){return Object(c.createElement)(C,null,(function(r){return Object(c.createElement)(t,{childProps:e,focus:r})}))}}}),"withFocusReturn");var N=Object(v.createHigherOrderComponent)((function(e){return function(t){Object(d.a)(i,t);var r,n,o=(r=i,n=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}}(),function(){var e,t=Object(m.a)(r);if(n){var o=Object(m.a)(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return Object(b.a)(this,e)});function i(){var e;return Object(p.a)(this,i),(e=o.apply(this,arguments)).focusContainRef=Object(c.createRef)(),e.handleTabBehaviour=e.handleTabBehaviour.bind(Object(k.a)(e)),e}return Object(f.a)(i,[{key:"handleTabBehaviour",value:function(e){if(e.keyCode===O.TAB){var t=g.focus.tabbable.find(this.focusContainRef.current);if(t.length){var r=t[0],n=t[t.length-1];e.shiftKey&&e.target===r?(e.preventDefault(),n.focus()):(e.shiftKey||e.target!==n)&&t.includes(e.target)||(e.preventDefault(),r.focus())}}}},{key:"render",value:function(){return Object(c.createElement)("div",{onKeyDown:this.handleTabBehaviour,ref:this.focusContainRef,tabIndex:"-1"},Object(c.createElement)(e,this.props))}}]),i}(c.Component)}),"withConstrainedTabbing"),D=r(87);var M=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){return Object(p.a)(this,o),n.apply(this,arguments)}return Object(f.a)(o,[{key:"handleFocusOutside",value:function(e){this.props.onFocusOutside(e)}},{key:"render",value:function(){return this.props.children}}]),o}(c.Component),A=Object(D.a)(M);function F(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=Object(m.a)(e);if(t){var o=Object(m.a)(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return Object(b.a)(this,r)}}var I=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.htmlDocument,r=void 0===t?document:t,n=e.className,o=void 0===n?"lockscroll":n,i=0,a=0;function u(e){var t=r.scrollingElement||r.body;e&&(a=t.scrollTop);var n=e?"add":"remove";t.classList[n](o),r.documentElement.classList[n](o),e||(t.scrollTop=a)}function s(){0===i&&u(!0),++i}function l(){1===i&&u(!1),--i}return function(e){Object(d.a)(r,e);var t=F(r);function r(){return Object(p.a)(this,r),t.apply(this,arguments)}return Object(f.a)(r,[{key:"componentDidMount",value:function(){s()}},{key:"componentWillUnmount",value:function(){l()}},{key:"render",value:function(){return null}}]),r}(c.Component)}();function B(e){e.stopPropagation()}var L=Object(c.forwardRef)((function(e,t){var r=e.children,i=Object(o.a)(e,["children"]);return Object(c.createElement)("div",Object(n.a)({},i,{ref:t,onMouseDown:B}),r)})),z=r(57);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 U(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){Object(w.a)(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}function W(e){var t=Object(c.useContext)(z.a),r=t.slots[e]||{},n=t.fills[e],o=Object(c.useMemo)((function(){return n||[]}),[n]),i=Object(c.useCallback)((function(r){t.updateSlot(e,r)}),[e,t.updateSlot]),a=Object(c.useCallback)((function(r){t.unregisterSlot(e,r)}),[e,t.unregisterSlot]),u=Object(c.useCallback)((function(r){t.registerFill(e,r)}),[e,t.registerFill]),s=Object(c.useCallback)((function(r){t.unregisterFill(e,r)}),[e,t.unregisterFill]);return U(U({},r),{},{updateSlot:i,unregisterSlot:a,fills:o,registerFill:u,unregisterFill:s})}function Y(e,t,r){return(Y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Object(m.a)(e)););return e}(e,t);if(n){var o=Object.getOwnPropertyDescriptor(n,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}r(27);var q=Object(c.createContext)({registerSlot:function(){},unregisterSlot:function(){},registerFill:function(){},unregisterFill:function(){},getSlot:function(){},getFills:function(){},subscribe:function(){}}),V=(q.Provider,q.Consumer);c.Component;var G=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){var e;return Object(p.a)(this,o),(e=n.apply(this,arguments)).isUnmounted=!1,e.bindNode=e.bindNode.bind(Object(k.a)(e)),e}return Object(f.a)(o,[{key:"componentDidMount",value:function(){(0,this.props.registerSlot)(this.props.name,this)}},{key:"componentWillUnmount",value:function(){var e=this.props.unregisterSlot;this.isUnmounted=!0,e(this.props.name,this)}},{key:"componentDidUpdate",value:function(e){var t=this.props,r=t.name,n=t.unregisterSlot,o=t.registerSlot;e.name!==r&&(n(e.name),o(r,this))}},{key:"bindNode",value:function(e){this.node=e}},{key:"forceUpdate",value:function(){this.isUnmounted||Y(Object(m.a)(o.prototype),"forceUpdate",this).call(this)}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.name,n=e.fillProps,o=void 0===n?{}:n,i=e.getFills,a=Object(u.map)(i(r,this),(function(e){var t=e.occurrence,r=Object(u.isFunction)(e.children)?e.children(o):e.children;return c.Children.map(r,(function(e,r){if(!e||Object(u.isString)(e))return e;var n="".concat(t,"---").concat(e.key||r);return Object(c.cloneElement)(e,{key:n})}))})).filter(Object(u.negate)(c.isEmptyElement));return Object(c.createElement)(c.Fragment,null,Object(u.isFunction)(t)?t(a):a)}}]),o}(c.Component),K=function(e){return Object(c.createElement)(V,null,(function(t){var r=t.registerSlot,o=t.unregisterSlot,i=t.getFills;return Object(c.createElement)(G,Object(n.a)({},e,{registerSlot:r,unregisterSlot:o,getFills:i}))}))},Q=0;function J(e){var t=e.name,r=e.children,n=e.registerFill,o=e.unregisterFill,i=function(e){var t=Object(c.useContext)(q),r=t.getSlot,n=t.subscribe,o=Object(c.useState)(r(e)),i=Object(h.a)(o,2),a=i[0],u=i[1];return Object(c.useEffect)((function(){return u(r(e)),n((function(){u(r(e))}))}),[e]),a}(t),a=Object(c.useRef)({name:t,children:r});return a.current.occurrence||(a.current.occurrence=++Q),Object(c.useLayoutEffect)((function(){return n(t,a.current),function(){return o(t,a.current)}}),[]),Object(c.useLayoutEffect)((function(){a.current.children=r,i&&i.forceUpdate()}),[r]),Object(c.useLayoutEffect)((function(){t!==a.current.name&&(o(a.current.name,a.current),a.current.name=t,n(t,a.current))}),[t]),i&&i.node?(Object(u.isFunction)(r)&&(r=r(i.props.fillProps)),Object(c.createPortal)(r,i.node)):null}var X=function(e){return Object(c.createElement)(V,null,(function(t){var r=t.registerFill,o=t.unregisterFill;return Object(c.createElement)(J,Object(n.a)({},e,{registerFill:r,unregisterFill:o}))}))};function $(e){var t=e.name,r=e.fillProps,i=void 0===r?{}:r,a=e.as,u=void 0===a?"div":a,s=Object(o.a)(e,["name","fillProps","as"]),l=Object(c.useContext)(z.a),p=Object(c.useRef)();return Object(c.useLayoutEffect)((function(){return l.registerSlot(t,p,i),function(){l.unregisterSlot(t,p)}}),[l.registerSlot,l.unregisterSlot,t]),Object(c.useLayoutEffect)((function(){l.updateSlot(t,i)})),Object(c.createElement)(u,Object(n.a)({ref:p},s))}function Z(e){var t,r,n=e.name,o=e.children,i=W(n),a=Object(c.useRef)({rerender:(t=Object(c.useState)({}),r=Object(h.a)(t,2)[1],function(){return r({})})});return Object(c.useEffect)((function(){return i.registerFill(a),function(){i.unregisterFill(a)}}),[i.registerFill,i.unregisterFill]),i.ref&&i.ref.current?("function"==typeof o&&(o=o(i.fillProps)),Object(c.createPortal)(o,i.ref.current)):null}function ee(e){var t=e.bubblesVirtually,r=Object(o.a)(e,["bubblesVirtually"]);return t?Object(c.createElement)($,r):Object(c.createElement)(K,r)}function te(e){return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(X,e),Object(c.createElement)(Z,e))}function re(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 ne(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?re(Object(r),!0).forEach((function(t){Object(w.a)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):re(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function oe(e){var t=e.type,r=e.origin,n=void 0===r?function(e){return"appear"===e?"top":"left"}(t):r;if("appear"===t){var o,c=n.split(" "),i=Object(h.a)(c,2),u=i[0],s=i[1],l=void 0===s?"center":s;return a()("components-animate__appear",(o={},Object(w.a)(o,"is-from-"+l,"center"!==l),Object(w.a)(o,"is-from-"+u,"middle"!==u),o))}return"slide-in"===t?a()("components-animate__slide-in","is-from-"+n):"loading"===t?a()("components-animate__loading"):void 0}function ce(e){var t=e.type,r=e.options,n=void 0===r?{}:r;return(0,e.children)({className:oe(ne({type:t},n))})}var ie=N(T((function(e){return e.children})));function ae(e,t){var r,n=(r=t).ownerDocument.defaultView.getComputedStyle(r),o=n.paddingTop,c=n.paddingBottom,i=n.paddingLeft,a=n.paddingRight,u=o?parseInt(o,10):0,s=c?parseInt(c,10):0,l=i?parseInt(i,10):0,p=a?parseInt(a,10):0;return{x:e.left+l,y:e.top+u,width:e.width-l-p,height:e.height-u-s,left:e.left+l,right:e.right-p,top:e.top+u,bottom:e.bottom-s}}function ue(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function se(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";e.style[t]!==r&&(e.style[t]=r)}function le(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}var pe=function(e){var t=e.headerTitle,r=e.onClose,i=e.onKeyDown,u=e.children,s=e.className,p=e.noArrow,f=void 0===p||p,d=e.isAlternate,b=e.position,m=void 0===b?"bottom right":b,w=(e.range,e.focusOnMount),j=void 0===w?"firstElement":w,R=e.anchorRef,k=e.shouldAnchorIncludePadding,P=e.anchorRect,S=e.getAnchorRect,C=e.expandOnMobile,T=e.animate,N=void 0===T||T,D=e.onClickOutside,M=e.onFocusOutside,F=e.__unstableSticky,B=e.__unstableSlotName,z=void 0===B?"Popover":B,H=e.__unstableObserveElement,U=e.__unstableBoundaryParent,Y=Object(o.a)(e,["headerTitle","onClose","onKeyDown","children","className","noArrow","isAlternate","position","range","focusOnMount","anchorRef","shouldAnchorIncludePadding","anchorRect","getAnchorRect","expandOnMobile","animate","onClickOutside","onFocusOutside","__unstableSticky","__unstableSlotName","__unstableObserveElement","__unstableBoundaryParent"]),q=Object(c.useRef)(null),V=Object(c.useRef)(null),G=Object(c.useRef)(),K=Object(v.useViewportMatch)("medium","<"),Q=Object(c.useState)(),J=Object(h.a)(Q,2),X=J[0],$=J[1],Z=W(z),ee=C&&K,re=Object(v.useResizeObserver)(),ne=Object(h.a)(re,2),oe=ne[0],pe=ne[1];f=ee||f,Object(c.useLayoutEffect)((function(){if(ee)return le(G.current,"is-without-arrow",f),le(G.current,"is-alternate",d),ue(G.current,"data-x-axis"),ue(G.current,"data-y-axis"),se(G.current,"top"),se(G.current,"left"),se(V.current,"maxHeight"),void se(V.current,"maxWidth");var e=function(){if(G.current&&V.current){var e=function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(t)return t;if(r){if(!e.current)return;return r(e.current)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if(n instanceof window.Range)return Object(g.getRectangleFromRange)(n);if(n instanceof window.Element){var c=n.getBoundingClientRect();return o?c:ae(c,n)}var i=n.top,a=n.bottom,u=i.getBoundingClientRect(),s=a.getBoundingClientRect(),l=new window.DOMRect(u.left,u.top,u.width,s.bottom-u.top);return o?l:ae(l,n)}if(e.current){var p=e.current.parentNode,f=p.getBoundingClientRect();return o?f:ae(f,p)}}(q,P,S,R,k);if(e){var t,r,n=G.current,o=n.offsetParent,c=n.ownerDocument,i=0;if(o&&o!==c.body){var a=o.getBoundingClientRect();i=a.top,e=new window.DOMRect(e.left-a.left,e.top-a.top,e.width,e.height)}U&&(t=null===(r=G.current.closest(".popover-slot"))||void 0===r?void 0:r.parentNode);var u=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0,c=arguments.length>5?arguments[5]:void 0,i=arguments.length>6?arguments[6]:void 0,a=r.split(" "),u=Object(h.a)(a,3),s=u[0],l=u[1],p=void 0===l?"center":l,f=u[2],d=x(e,t,s,f,n,o,c),b=_(e,t,p,f,n,d.yAxis,i);return E(E({},b),d)}(e,pe.height?pe:V.current.getBoundingClientRect(),m,F,G.current,i,t),s=u.popoverTop,l=u.popoverLeft,p=u.xAxis,b=u.yAxis,O=u.contentHeight,v=u.contentWidth;"number"==typeof s&&"number"==typeof l&&(se(G.current,"top",s+"px"),se(G.current,"left",l+"px")),le(G.current,"is-without-arrow",f||"center"===p&&"middle"===b),le(G.current,"is-alternate",d),ue(G.current,"data-x-axis",p),ue(G.current,"data-y-axis",b),se(V.current,"maxHeight","number"==typeof O?O+"px":""),se(V.current,"maxWidth","number"==typeof v?v+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[b]||"middle"))}}};e();var t,r,n=window.setInterval(e,500),o=function(){window.cancelAnimationFrame(t),t=window.requestAnimationFrame(e)};return window.addEventListener("click",o),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),H&&(r=new window.MutationObserver(e)).observe(H,{attributes:!0}),function(){window.clearInterval(n),window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0),window.removeEventListener("click",o),window.cancelAnimationFrame(t),r&&r.disconnect()}}),[ee,P,S,R,k,m,pe,F,H,U]),function(e,t){Object(c.useEffect)((function(){var r=setTimeout((function(){if(e&&t.current)if("firstElement"!==e)"container"===e&&t.current.focus();else{var r=g.focus.tabbable.find(t.current)[0];r?r.focus():t.current.focus()}}),0);return function(){return clearTimeout(r)}}),[])}(j,V);var fe=function(e){e.keyCode===O.ESCAPE&&r&&(e.stopPropagation(),r()),i&&i(e)},de=Object(c.createElement)(A,{onFocusOutside:function(e){if(M)M(e);else if(D){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}}),l()("Popover onClickOutside prop",{alternative:"onFocusOutside"}),D(t)}else r&&r()}},Object(c.createElement)(ce,{type:N&&X?"appear":null,options:{origin:X}},(function(e){var o=e.className;return Object(c.createElement)(L,Object(n.a)({className:a()("components-popover",s,o,{"is-expanded":ee,"is-without-arrow":f,"is-alternate":d})},Y,{onKeyDown:fe,ref:G}),ee&&Object(c.createElement)(I,null),ee&&Object(c.createElement)("div",{className:"components-popover__header"},Object(c.createElement)("span",{className:"components-popover__header-title"},t),Object(c.createElement)(Oe,{className:"components-popover__close",icon:y.a,onClick:r})),Object(c.createElement)("div",{ref:V,className:"components-popover__content",tabIndex:"-1"},Object(c.createElement)("div",{style:{position:"relative"}},oe,u)))})));return j&&(de=Object(c.createElement)(ie,null,de)),Z.ref&&(de=Object(c.createElement)(te,{name:z},de)),R||P?de:Object(c.createElement)("span",{ref:q},de)};pe.Slot=function(e){var t=e.name,r=void 0===t?"Popover":t;return Object(c.createElement)(ee,{bubblesVirtually:!0,name:r,className:"popover-slot"})};var fe=pe,de=function(e){var t,r,n=e.shortcut,o=e.className;return n?(Object(u.isString)(n)&&(t=n),Object(u.isObject)(n)&&(t=n.display,r=n.ariaLabel),Object(c.createElement)("span",{className:o,"aria-label":r},t)):null};var be=function(e){Object(d.a)(o,e);var t,r,n=(t=o,r=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}}(),function(){var e,n=Object(m.a)(t);if(r){var o=Object(m.a)(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return Object(b.a)(this,e)});function o(){var e;return Object(p.a)(this,o),(e=n.apply(this,arguments)).delayedSetIsOver=Object(u.debounce)((function(t){return e.setState({isOver:t})}),700),e.cancelIsMouseDown=e.createSetIsMouseDown(!1),e.isInMouseDown=!1,e.state={isOver:!1},e}return Object(f.a)(o,[{key:"componentWillUnmount",value:function(){this.delayedSetIsOver.cancel(),document.removeEventListener("mouseup",this.cancelIsMouseDown)}},{key:"emitToChild",value:function(e,t){var r=this.props.children;if(1===c.Children.count(r)){var n=c.Children.only(r);"function"==typeof n.props[e]&&n.props[e](t)}}},{key:"createToggleIsOver",value:function(e,t){var r=this;return function(n){if(r.emitToChild(e,n),!(n.currentTarget.disabled||"focus"===n.type&&r.isInMouseDown)){r.delayedSetIsOver.cancel();var o=Object(u.includes)(["focus","mouseenter"],n.type);o!==r.state.isOver&&(t?r.delayedSetIsOver(o):r.setState({isOver:o}))}}}},{key:"createSetIsMouseDown",value:function(e){var t=this;return function(r){t.emitToChild(e?"onMouseDown":"onMouseUp",r),document[e?"addEventListener":"removeEventListener"]("mouseup",t.cancelIsMouseDown),t.isInMouseDown=e}}},{key:"render",value:function(){var e=this.props,t=e.children,r=e.position,n=e.text,o=e.shortcut;if(1!==c.Children.count(t))return t;var i=c.Children.only(t),a=this.state.isOver;return Object(c.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(c.concatChildren)(i.props.children,a&&Object(c.createElement)(fe,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(c.createElement)(de,{className:"components-tooltip__shortcut",shortcut:o})))})}}]),o}(c.Component),me=r(93);function he(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 ge=["onMouseDown","onClick"],Oe=t.a=Object(c.forwardRef)((function(e,t){var r=e.href,i=e.target,s=e.isPrimary,p=e.isSmall,f=e.isTertiary,d=e.isPressed,b=e.isBusy,m=e.isDefault,h=e.isSecondary,g=e.isLink,O=e.isDestructive,v=e.className,y=e.disabled,w=e.icon,j=e.iconSize,E=e.showTooltip,_=e.tooltipPosition,x=e.shortcut,R=e.label,k=e.children,P=e.__experimentalIsFocusable,S=Object(o.a)(e,["href","target","isPrimary","isSmall","isTertiary","isPressed","isBusy","isDefault","isSecondary","isLink","isDestructive","className","disabled","icon","iconSize","showTooltip","tooltipPosition","shortcut","label","children","__experimentalIsFocusable"]);m&&l()("Button isDefault prop",{alternative:"isSecondary"});var C=a()("components-button",v,{"is-secondary":m||h,"is-primary":s,"is-small":p,"is-tertiary":f,"is-pressed":d,"is-busy":b,"is-link":g,"is-destructive":O,"has-text":!!w&&!!k,"has-icon":!!w}),T=y&&!P,N=void 0===r||T?"button":"a",D="a"===N?{href:r,target:i}:{type:"button",disabled:T,"aria-pressed":d};if(y&&P){D["aria-disabled"]=!0;var M,A=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return he(e,void 0);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)?he(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}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,i=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,c=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)throw c}}}}(ge);try{for(A.s();!(M=A.n()).done;)S[M.value]=function(e){e.stopPropagation(),e.preventDefault()}}catch(e){A.e(e)}finally{A.f()}}var F=!T&&(E&&R||x||!!R&&(!k||Object(u.isArray)(k)&&!k.length)&&!1!==E),I=Object(c.createElement)(N,Object(n.a)({},D,S,{className:C,"aria-label":S["aria-label"]||R,ref:t}),w&&Object(c.createElement)(me.a,{icon:w,size:j}),k);return F?Object(c.createElement)(be,{text:R,shortcut:x,position:_},I):I}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return a})),r.d(t,"d",(function(){return u}));var n=r(22),o=r.n(n),c=function(e){return"number"==typeof e},i=function(e){return"string"==typeof e},a=function(e){return!function(e){return null===e}(e)&&"object"===o()(e)};function u(e,t){return a(e)&&t in e}},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,r(t,n)}e.exports=r,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}r.d(t,"a",(function(){return n}))},function(e,t){e.exports=window.wp.url},function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wp.hooks},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},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(83);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}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){},,function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(6),i=r.n(c),a=r(2),u=r(1),s=r(75);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 p(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 f=Object(a.getSetting)("countryLocale",{}),d=function(e){var t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(u.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
+
Object(u.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(s.a)(e.priority)&&(t.index=e.priority),Object(s.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},b=Object.entries(f).map((function(e){var t=i()(e,2),r=t[0],n=t[1];return[r,Object.entries(n).map((function(e){var t=i()(e,2),r=t[0],n=t[1];return[r,d(n)]})).reduce((function(e,t){var r=i()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{})]})).reduce((function(e,t){var r=i()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{});t.a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==b[r]?b[r]:{};return e.map((function(e){var r=a.defaultAddressFields[e]||{},o=n[e]||{},c=t[e]||{};return p(p(p({key:e},r),o),c)})).sort((function(e,t){return e.index-t.index}))}},function(e,t,r){"use strict";var n=r(9),o=r(18),c=r(19),i=r(14),a=r(20),u=r(21),s=r(11),l=r(0),p=r(7),f=r(23);var d=["button","submit"];t.a=Object(f.createHigherOrderComponent)((function(e){return function(t){Object(a.a)(m,t);var r,f,b=(r=m,f=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}}(),function(){var e,t=Object(s.a)(r);if(f){var n=Object(s.a)(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return Object(u.a)(this,e)});function m(){var e;return Object(o.a)(this,m),(e=b.apply(this,arguments)).bindNode=e.bindNode.bind(Object(i.a)(e)),e.cancelBlurCheck=e.cancelBlurCheck.bind(Object(i.a)(e)),e.queueBlurCheck=e.queueBlurCheck.bind(Object(i.a)(e)),e.normalizeButtonFocus=e.normalizeButtonFocus.bind(Object(i.a)(e)),e}return Object(c.a)(m,[{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,r=e.target;Object(p.includes)(["mouseup","touchend"],t)?this.preventBlurCheck=!1:function(e){switch(e.nodeName){case"A":case"BUTTON":return!0;case"INPUT":return Object(p.includes)(d,e.type)}return!1}(r)&&(this.preventBlurCheck=!0)}},{key:"render",value:function(){return Object(l.createElement)("div",{onFocus:this.cancelBlurCheck,onMouseDown:this.normalizeButtonFocus,onMouseUp:this.normalizeButtonFocus,onTouchStart:this.normalizeButtonFocus,onTouchEnd:this.normalizeButtonFocus,onBlur:this.queueBlurCheck},Object(l.createElement)(e,Object(n.a)({ref:this.bindNode},this.props)))}}]),m}(l.Component)}),"withFocusOutside")},,,function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],_n=!0,i=!1;try{for(r=r.call(e);!(_n=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);_n=!0);}catch(e){i=!0,o=e}finally{try{_n||null==r.return||r.return()}finally{if(i)throw o}}return c}},e.exports.default=e.exports,e.exports.__esModule=!0},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.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,r){"use strict";var n=r(25),o=r(9),c=r(16),i=r(0),a=r(34),u=function(e){var t=e.icon,r=e.className,n=Object(c.a)(e,["icon","className"]),a=["dashicon","dashicons","dashicons-"+t,r].filter(Boolean).join(" ");return Object(i.createElement)("span",Object(o.a)({className:a},n))};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){Object(n.a)(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}t.a=function(e){var t=e.icon,r=void 0===t?null:t,n=e.size,s=Object(c.a)(e,["icon","size"]);if("string"==typeof r)return Object(i.createElement)(u,Object(o.a)({icon:r},s));if(r&&u===r.type)return Object(i.cloneElement)(r,l({},s));var p=n||24;if("function"==typeof r)return r.prototype instanceof i.Component?Object(i.createElement)(r,l({size:p},s)):r(l({size:p},s));if(r&&("svg"===r.type||r.type===a.SVG)){var f=l(l({width:p,height:p},r.props),s);return Object(i.createElement)(a.SVG,f)}return Object(i.isValidElement)(r)?Object(i.cloneElement)(r,l({size:p},s)):r}},,,function(e,t){e.exports=window.wp.autop},function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return m}));var n=r(6),o=r.n(n),c=r(8),i=r(12),a=r(0),u=r(27),s=r.n(u),l=r(60),p=r(118),f=r(70),d=function(e){var t=Object(f.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,n])]},b=function(e,t,r){var n=Object(f.a)();r=r||n;var o=Object(i.useSelect)((function(n){return n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),u=Object(i.useDispatch)(c.QUERY_STATE_STORE_KEY).setQueryValue;return[o,Object(a.useCallback)((function(t){u(r,e,t)}),[r,e,u])]},m=function(e,t){var r=Object(f.a)(),n=d(t=t||r),c=o()(n,2),i=c[0],u=c[1],b=Object(l.a)(i),m=Object(l.a)(e),h=Object(p.a)(m),g=Object(a.useRef)(!1);return Object(a.useEffect)((function(){s()(h,m)||(u(Object.assign({},b,m)),g.current=!0)}),[b,m,h,u]),g.current?[i,u]:[e,u]}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(6),o=r.n(n),c=function(e){return e.reduce((function(e,t){var r=o()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{})}},function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return u}));var n=r(2),o=r(86),c=r(78),i=function(e){var t=e.country,r=void 0===t?"":t,n=e.state,o=void 0===n?"":n,c=e.city,i=void 0===c?"":c,a=e.postcode,u=void 0===a?"":a;return{country:r.trim(),state:o.trim(),city:i.trim(),postcode:u?u.replace(" ","").toUpperCase():""}},a=function(e){var t=e.email,r=void 0===t?"":t;return Object(c.isEmail)(r)?r.trim():""},u=function(e){var t=Object.keys(n.defaultAddressFields),r=Object(o.a)(t,{},e.country),c=Object.assign({},e);return r.forEach((function(t){var r=t.key,n=void 0===r?"":r,o=t.hidden;void 0!==o&&o&&function(e,t){return e in t}(n,e)&&(c[n]="")})),c}},,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(6),o=r.n(n),c=r(0),i=function(){var e=Object(c.useState)(),t=o()(e,2)[1];return Object(c.useCallback)((function(e){t((function(){throw e}))}),[])}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t){var r,n,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===c||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:c}catch(e){r=c}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var u,s=[],l=!1,p=-1;function f(){l&&u&&(l=!1,u.length?s=u.concat(s):p=-1,s.length&&d())}function d(){if(!l){var e=a(f);l=!0;for(var t=s.length;t;){for(u=s,s=[];++p<t;)u&&u[p].run();p=-1,t=s.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];s.push(new b(e,t)),1!==s.length||l||a(d)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,,function(e,t,r){"use strict";r.d(t,"b",(function(){return w})),r.d(t,"a",(function(){return j}));var n=r(5),o=r.n(n),c=r(6),i=r.n(c),a=(r(10),r(0)),u=r(12),s=r(56),l=r(39),p=r(13),f=r.n(p),d=r(3),b=r.n(d),m=r(166),h=(r(123),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""}),g=function(e){var t=e.className,r=e.notices,n=e.removeNotice,o=r.filter((function(e){return"snackbar"!==e.type}));if(!o.length)return null;var c=b()(t,"wc-block-components-notices");return React.createElement("div",{className:c},o.map((function(e){return React.createElement(m.a,f()({key:"store-notice-"+e.id},e,{className:b()("wc-block-components-notices__notice",h(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)})))};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 v(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}var y=Object(a.createContext)({notices:[],createNotice:function(e,t,r){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),w=function(){return Object(a.useContext)(y)},j=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,o=e.createNoticeContainer,c=void 0===o||o,p=e.context,f=void 0===p?"wc/core":p,d=Object(u.useDispatch)("core/notices"),b=d.createNotice,m=d.removeNotice,h=Object(a.useState)(!1),O=i()(h,2),w=O[0],j=O[1],E=Object(s.a)().dispatchStoreEvent,_=Object(l.a)().isEditor,x=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]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};b(e,t,v(v({},r),{},{context:r.context||f})),E("store-notice-create",{status:e,content:t,options:r})}),[b,E,f]),R=Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;m(e,t)}),[m,f]),k={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(f)}}),[f]).notices,createNotice:x,removeNotice:R,context:f,setIsSuppressed:j},P=w?null:React.createElement(g,{className:n,notices:k.notices,removeNotice:k.removeNotice,isEditor:_});return React.createElement(y.Provider,{value:k},c&&P,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(13),o=r.n(n),c=r(5),i=r.n(c),a=r(0),u=r(54);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 p=[".wp-block-woocommerce-cart"],f=function(e){var t=e.Block,r=e.containers,n=e.getProps,c=void 0===n?function(){return{}}:n,i=e.getErrorBoundaryProps,s=void 0===i?function(){return{}}:i;0!==r.length&&Array.prototype.forEach.call(r,(function(e,r){var n=c(e,r),i=s(e,r),p=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:p})))),e)}))},d=function(e){var t,r,n,o,c,i,a,u=document.body.querySelectorAll(p.join(","));t=l(l({},e),{},{wrappers:u}),r=t.Block,n=t.getProps,o=t.getErrorBoundaryProps,c=t.selector,i=t.wrappers,a=document.body.querySelectorAll(c),i.length>0&&Array.prototype.filter.call(a,(function(e){return!function(e,t){return Array.prototype.some.call(t,(function(t){return t.contains(e)&&!t.isSameNode(e)}))}(e,i)})),f({Block:r,containers:a,getProps:n,getErrorBoundaryProps:o}),Array.prototype.forEach.call(u,(function(t){t.addEventListener("wc-blocks_render_blocks_frontend",(function(){var r,n,o,c,i,a;n=(r=l(l({},e),{},{wrapper:t})).Block,o=r.getProps,c=r.getErrorBoundaryProps,i=r.selector,a=r.wrapper.querySelectorAll(i),f({Block:n,containers:a,getProps:o,getErrorBoundaryProps:c})}))}))}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(4);function o(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},function(e,t){e.exports=window.wp.wordcount},,,,function(e,t){},,function(e,t,r){"use strict";var n=r(13),o=r.n(n),c=r(0),i=(r(152),function(e){if(e){var t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()}});t.a=function(e){return function(t){var r=Object(c.useRef)(null);return React.createElement(React.Fragment,null,React.createElement("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),React.createElement(e,o()({},t,{scrollToTop:function(e){var t,n;null!==r.current&&(t=r.current,n=(e||{}).focusableSelector,window&&Number.isFinite(window.innerHeight)&&(n?function(e,t){var r,n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){var o=n[0];i(o),null==o||o.focus()}else i(e)}(t,n):i(t)))}})))}}},,function(e,t,r){"use strict";var n=r(0),o=r(34),c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(8),o=r(12),c=r(0),i=r(60),a=r(107),u=function(e){var t=e.namespace,r=e.resourceName,u=e.resourceValues,s=void 0===u?[]:u,l=e.query,p=void 0===l?{}:l,f=e.shouldSelect,d=void 0===f||f;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");var b=Object(c.useRef)({results:[],isLoading:!0}),m=Object(i.a)(p),h=Object(i.a)(s),g=Object(a.a)(),O=Object(o.useSelect)((function(e){if(!d)return null;var o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,m,h],i=o.getCollectionError.apply(o,c);return i&&g(i),{results:o.getCollection.apply(o,c),isLoading:!o.hasFinishedResolution("getCollection",c)}}),[t,r,h,m,d]);return null!==O&&(b.current=O),b.current}},,function(e,t,r){"use strict";var n=r(0),o=r(8),c=r(12),i=r(15);t.a=function(e){return function(t){var r;return r=Object(n.useRef)(i.o.restApiRoutes||{}),Object(c.useSelect)((function(e,t){if(r.current){var n=e(o.SCHEMA_STORE_KEY),c=n.isResolving,i=n.hasFinishedResolution,a=t.dispatch(o.SCHEMA_STORE_KEY),u=a.receiveRoutes,s=a.startResolution,l=a.finishResolution;Object.keys(r.current).forEach((function(e){var t=r.current[e];c("getRoutes",[e])||i("getRoutes",[e])||(s("getRoutes",[e]),u(t,[e]),l("getRoutes",[e]))}))}}),[]),React.createElement(e,t)}}},,,,,,,,,,,,,,,,,,,,function(e,t){},,,,,function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(17),i=r.n(c),a=r(0),u=["srcElement","size"];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,u);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)):null}},,,,,,,,,function(e,t,r){"use strict";var n=r(0),o=r(7),c=r(3),i=r.n(c),a=r(1),u=r(36),s=r(127),l=r(74);t.a=function(e){var t=e.className,r=e.status,c=void 0===r?"info":r,p=e.children,f=e.spokenMessage,d=void 0===f?p:f,b=e.onRemove,m=void 0===b?o.noop:b,h=e.isDismissible,g=void 0===h||h,O=e.actions,v=void 0===O?[]:O,y=e.politeness,w=void 0===y?function(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}(c):y,j=e.__unstableHTML;!function(e,t){var r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)((function(){r&&Object(u.speak)(r,t)}),[r,t])}(d,w);var E=i()(t,"components-notice","is-"+c,{"is-dismissible":g});return j&&(p=Object(n.createElement)(n.RawHTML,null,p)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},p,v.map((function(e,t){var r=e.className,o=e.label,c=e.isPrimary,a=e.noDefaultClasses,u=void 0!==a&&a,s=e.onClick,p=e.url;return Object(n.createElement)(l.a,{key:t,href:p,isPrimary:c,isSecondary:!u&&!p,isLink:!u&&!!p,onClick:p?void 0:s,className:i()("components-notice__action",r)},o)}))),g&&Object(n.createElement)(l.a,{className:"components-notice__dismiss",icon:s.a,label:Object(a.__)("Dismiss this notice"),onClick:m,showTooltip:!1}))}},,,,,,,,,,,,,,function(e,t,r){"use strict";r(10);var n=r(3),o=r.n(n),c=r(37),i=r(23);r(206),t.a=Object(i.withInstanceId)((function(e){var t=e.className,r=e.instanceId,n=e.label,i=e.onChange,a=e.options,u=e.screenReaderLabel,s=e.readOnly,l=e.value,p="wc-block-components-sort-select__select-".concat(r);return React.createElement("div",{className:o()("wc-block-sort-select","wc-block-components-sort-select",t)},React.createElement(c.a,{label:n,screenReaderLabel:u,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",onChange:i,readOnly:s,value:l},a.map((function(e){return React.createElement("option",{key:e.key,value:e.key},e.label)}))))}))},,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(43),o=r(0),c=r(15);r.p=c.m,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)((function(){return Promise.all([r.e(25),r.e(6)]).then(r.bind(null,345))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)((function(){return r.e(5).then(r.bind(null,356))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)((function(){return r.e(13).then(r.bind(null,355))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)((function(){return r.e(7).then(r.bind(null,346))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)((function(){return r.e(3).then(r.bind(null,347))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)((function(){return r.e(11).then(r.bind(null,348))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)((function(){return r.e(8).then(r.bind(null,331))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)((function(){return r.e(9).then(r.bind(null,349))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)((function(){return r.e(4).then(r.bind(null,350))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)((function(){return r.e(12).then(r.bind(null,351))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)((function(){return r.e(10).then(r.bind(null,352))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)((function(){return Promise.all([r.e(24),r.e(2)]).then(r.bind(null,353))}))});var i=function(e){return Object(n.getRegisteredBlockComponents)(e)}},,,,,,,,,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t){e.exports=window.wp.blockEditor},,,,,,,,,function(e,t,r){e.exports=r(309)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(132),o=r(114),c=r(115),i=r(44),a=r.n(i),u=r(45),s=r.n(u),l=r(46),p=r.n(l),f=r(47),d=r.n(f),b=r(32),m=r.n(b),h=r(4),g=(r(10),r(6)),O=r.n(g),v=r(0),y=r(17),w=r.n(y),j=r(5),E=r.n(j),_=r(1),x=r(7),R=r(3),k=r.n(R),P=r(37),S=(r(265),function(e){var t=e.currentPage,r=e.displayFirstAndLastPages,n=e.displayNextAndPreviousArrows,o=e.pagesToDisplay,c=e.onPageChange,i=e.totalPages,a=function(e,t,r){if(r<=2)return{minIndex:null,maxIndex:null};var n=e-1,o=Math.max(Math.floor(t-n/2),2),c=Math.min(Math.ceil(t+(n-(t-o))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(c-t))),2),maxIndex:c}}(o,t,i),u=a.minIndex,s=a.maxIndex,l=r&&Boolean(1!==u),p=r&&Boolean(s!==i),f=r&&Boolean(u>3),d=r&&Boolean(s<i-2);l&&3===u&&(u-=1),p&&s===i-2&&(s+=1);var b=[];if(u&&s)for(var m=u;m<=s;m++)b.push(m);return React.createElement("div",{className:"wc-block-pagination wc-block-components-pagination"},React.createElement(P.a,{screenReaderLabel:Object(_.__)("Navigate to another page","woo-gutenberg-products-block")}),n&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return c(t-1)},title:Object(_.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},React.createElement(P.a,{label:"←",screenReaderLabel:Object(_.__)("Previous page","woo-gutenberg-products-block")})),l&&React.createElement("button",{className:k()("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(P.a,{label:1,screenReaderLabel:Object(_.sprintf)(
|
4 |
/* translators: %d is the page number (1, 2, 3...). */
|
5 |
+
Object(_.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&React.createElement("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(_.__)("…","woo-gutenberg-products-block")),b.map((function(e){return React.createElement("button",{key:e,className:k()("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(P.a,{label:e,screenReaderLabel:Object(_.sprintf)(
|
6 |
/* translators: %d is the page number (1, 2, 3...). */
|
7 |
+
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")),p&&React.createElement("button",{className:k()("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(P.a,{label:i,screenReaderLabel:Object(_.sprintf)(
|
8 |
/* translators: %d is the page number (1, 2, 3...). */
|
9 |
+
Object(_.__)("Page %d","woo-gutenberg-products-block"),i)})),n&&React.createElement("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return c(t+1)},title:Object(_.__)("Next page","woo-gutenberg-products-block"),disabled:t>=i},React.createElement(P.a,{label:"→",screenReaderLabel:Object(_.__)("Next page","woo-gutenberg-products-block")})))});S.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var C=S,T=r(118),N=r(97),D=r(130),M=r(8),A=r(12),F=r(60);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 B(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){E()(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=r(56),z=r(125),H=r(108),U=r(36),W=r(157),Y=r(34),q=React.createElement(Y.SVG,{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"})),V=function(){var e=Object(H.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(e,"__no-products")},React.createElement(W.a,{className:"".concat(e,"__no-products-image"),alt:"",srcElement:q,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")))},G=React.createElement(Y.SVG,{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"})),K=function(e){var t=e.resetCallback,r=void 0===t?function(){}:t,n=Object(H.useInnerBlockLayoutContext)().parentClassName;return React.createElement("div",{className:"".concat(n,"__no-products")},React.createElement(W.a,{className:"".concat(n,"__no-products-image"),alt:"",srcElement:G,size:100}),React.createElement("strong",{className:"".concat(n,"__no-products-title")},Object(_.__)("No products found","woo-gutenberg-products-block")),React.createElement("p",{className:"".concat(n,"__no-products-description")},Object(_.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),React.createElement("button",{onClick:r},Object(_.__)("Reset Search","woo-gutenberg-products-block")))},Q=r(180),J=(r(264),function(e){var t=e.onChange,r=e.readOnly,n=e.value;return React.createElement(Q.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,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:n})}),X=r(23),$=r(13),Z=r.n($),ee=r(240),te=Object(X.withInstanceId)((function(e){var t=e.product,r=e.attributes,n=e.instanceId,o=r.layoutConfig,c=Object(H.useInnerBlockLayoutContext)(),i=c.parentClassName,a=c.parentName,u=0===Object.keys(t).length,s=k()("".concat(i,"__product"),"wc-block-layout",{"is-loading":u});return React.createElement("li",{className:s,"aria-hidden":u},function e(t,r,n,o){if(n){var c=Object(ee.a)(t);return n.map((function(n,i){var a=O()(n,2),u=a[0],s=a[1],l=void 0===s?{}:s,p=[];l.children&&l.children.length>0&&(p=e(t,r,l.children,o));var f=c[u];if(!f)return null;var d=r.id||0,b=["layout",u,i,o,d];return React.createElement(v.Suspense,{key:b.join("_"),fallback:React.createElement("div",{className:"wc-block-placeholder"})},React.createElement(f,Z()({},l,{children:p,product:r})))}))}}(a,t,o,n))})),re=(r(263),["order","orderby","page","per_page"]);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 oe(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){E()(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=function(e){var t=e.totalQuery,r=e.totalProducts,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.totalQuery;return!Object(x.isEqual)(t,o)&&Number.isFinite(r)},ie=Object(z.a)((function(e){var t,r=e.attributes,n=e.currentPage,o=e.onPageChange,c=e.onSortChange,i=e.sortValue,a=e.scrollToTop,u=Object(N.b)("attributes",[]),s=O()(u,2),l=s[0],p=s[1],f=Object(N.b)("stock_status",[]),d=O()(f,2),b=d[0],m=d[1],h=Object(N.b)("min_price"),g=O()(h,2),y=g[0],j=g[1],E=Object(N.b)("max_price"),R=O()(E,2),P=R[0],S=R[1],I=Object(N.c)(function(e){var t=e.sortValue,r=e.currentPage,n=e.attributes,o=n.columns,c=n.rows;return oe(oe({},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:r})}({attributes:r,sortValue:i,currentPage:n})),z=O()(I,1)[0],W=function(e){var t={namespace:"/wc/store",resourceName:"products"},r=Object(D.a)(B(B({},t),{},{query:e})),n=r.results,o=r.isLoading,c=function(e,t){var r=t.namespace,n=t.resourceName,o=t.resourceValues,c=void 0===o?[]:o,i=t.query,a=void 0===i?{}:i;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");var u=Object(F.a)(a),s=Object(F.a)(c),l=Object(A.useSelect)((function(e){var t=e(M.COLLECTIONS_STORE_KEY),o=["x-wp-total",r,n,u,s];return{value:t.getCollectionHeader.apply(t,o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}}),["x-wp-total",r,n,s,u]),p=l.value,f=l.isLoading;return{value:p,isLoading:void 0===f||f}}(0,B(B({},t),{},{query:e})).value;return{products:n,totalProducts:parseInt(c,10),productsLoading:o}}(z),Y=W.products,q=W.totalProducts,G=W.productsLoading,Q=Object(H.useInnerBlockLayoutContext)(),X=Q.parentClassName,$=Q.parentName,Z=((t=z).order,t.orderby,t.page,t.per_page,w()(t,re)||{}),ee=Object(L.a)().dispatchStoreEvent,ne=Object(T.a)({totalQuery:Z,totalProducts:q},ce);Object(v.useEffect)((function(){ee("product-list-render",{products:Y,listName:$})}),[Y,$,ee]),Object(v.useEffect)((function(){Object(x.isEqual)(Z,null==ne?void 0:ne.totalQuery)||(o(1),null!=ne&&ne.totalQuery&&function(e){Number.isFinite(e)&&(0===e?Object(U.speak)(Object(_.__)("No products found","woo-gutenberg-products-block")):Object(U.speak)(Object(_.sprintf)(
|
10 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
11 |
+
Object(_._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(q))}),[null==ne?void 0:ne.totalQuery,q,o,Z]);var ie,ae,ue,se,le,pe=r.contentVisibility,fe=r.columns*r.rows,de=!Number.isFinite(q)&&Number.isFinite(null==ne?void 0:ne.totalProducts)&&Object(x.isEqual)(Z,null==ne?void 0:ne.totalQuery)?Math.ceil(ne.totalProducts/fe):Math.ceil(q/fe),be=Y.length?Y:Array.from({length:fe}),me=0!==Y.length||G,he=l.length>0||b.length>0||Number.isFinite(y)||Number.isFinite(P);return React.createElement("div",{className:(ie=r.columns,ae=r.rows,ue=r.alignButtons,se=r.align,le=void 0!==se?"align"+se:"",k()(X,le,"has-"+ie+"-columns",{"has-multiple-rows":ae>1,"has-aligned-buttons":ue}))},pe.orderBy&&me&&React.createElement(J,{onChange:c,value:i}),!me&&he&&React.createElement(K,{resetCallback:function(){p([]),m([]),j(null),S(null)}}),!me&&!he&&React.createElement(V,null),me&&React.createElement("ul",{className:"".concat(X,"__products")},be.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return React.createElement(te,{key:e.id||t,attributes:r,product:e})}))),de>1&&React.createElement(C,{currentPage:n,onPageChange:function(e){a({focusableSelector:"a, button"}),o(e)},totalPages:de}))})),ae=function(e){var t=e.attributes,r=Object(v.useState)(1),n=O()(r,2),o=n[0],c=n[1],i=Object(v.useState)(t.orderby),a=O()(i,2),u=a[0],s=a[1];return Object(v.useEffect)((function(){s(t.orderby)}),[t.orderby]),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=React.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},React.createElement("title",null,"Grid Block Preview"),React.createElement("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),React.createElement("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),React.createElement("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var se=function(e){p()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=m()(t);if(r){var o=m()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return d()(this,e)});function o(){return a()(this,o),n.apply(this,arguments)}return s()(o,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.urlParameterSuffix;return t.isPreview?ue:React.createElement(H.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},React.createElement(ae,{attributes:t,urlParameterSuffix:r}))}}]),o}(h.Component);Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:Object(n.a)((function(e){return React.createElement(o.a,{context:"wc/all-products"},React.createElement(se,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-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', '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-primitives', 'wp-url', 'wp-viewport', 'wp-warning', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', '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-primitives', 'wp-url', 'wp-viewport', 'wp-warning', 'wp-wordcount'), 'version' => 'ad54aa20550e11bc7cb965591ef435d5');
|
build/all-products.js
CHANGED
@@ -1,29 +1,29 @@
|
|
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={6:0,1:0,3:0,4:0,9:0,10:0,12:0,13:0,14:0,15:0,16:0,17: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/button--atomic-block-components/image---a7e2bb9b",2:"atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title",3:"atomic-block-components/add-to-cart--atomic-block-components/button",4:"atomic-block-components/sale-badge",8:"atomic-block-components/add-to-cart",9:"atomic-block-components/button",10:"atomic-block-components/category-list",11:"atomic-block-components/image",12:"atomic-block-components/price",13:"atomic-block-components/rating",14:"atomic-block-components/sku",15:"atomic-block-components/stock-indicator",16:"atomic-block-components/summary",17:"atomic-block-components/tag-list",18:"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([
|
2 |
/* translators: %s Field label. */
|
3 |
-
Object(s.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(u.a)(e.priority)&&(t.index=e.priority),Object(u.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},f=Object.entries(p).map((function(e){var t=a()(e,2),r=t[0],n=t[1];return[r,Object.entries(n).map((function(e){var t=a()(e,2),r=t[0],n=t[1];return[r,d(n)]})).reduce((function(e,t){var r=a()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{})]})).reduce((function(e,t){var r=a()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{});t.a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==f[r]?f[r]:{};return e.map((function(e){var r=i.defaultAddressFields[e]||{},c=n[e]||{},o=t[e]||{};return b(b(b({key:e},r),c),o)})).sort((function(e,t){return e.index-t.index}))}},
|
4 |
/* translators: %1$s min price, %2$s max price */
|
5 |
-
Object(a.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(n),Object(l.formatPrice)(r))),Object(o.createElement)("span",{"aria-hidden":!0},Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",c),currency:t,value:n,style:s})," — ",Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",c),currency:t,value:r,style:s})))}),p=function(e){var t=e.currency,r=e.regularPriceClassName,n=e.regularPriceStyle,c=e.regularPrice,s=e.priceClassName,l=e.priceStyle,b=e.price;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Previous price:","woo-gutenberg-products-block")),Object(o.createElement)(i.a,{currency:t,renderText:function(e){return Object(o.createElement)("del",{className:u()("wc-block-components-product-price__regular",r),style:n},e)},value:c}),Object(o.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Discounted price:","woo-gutenberg-products-block")),Object(o.createElement)(i.a,{currency:t,renderText:function(e){return Object(o.createElement)("ins",{className:u()("wc-block-components-product-price__value","is-discounted",s),style:l},e)},value:b}))};t.a=function(e){var t=e.align,r=e.className,n=e.currency,a=e.format,s=void 0===a?"<price/>":a,l=e.maxPrice,d=void 0===l?null:l,f=e.minPrice,m=void 0===f?null:f,O=e.price,g=void 0===O?null:O,j=e.priceClassName,h=e.priceStyle,v=e.regularPrice,w=e.regularPriceClassName,y=e.regularPriceStyle,E=u()(r,"price","wc-block-components-product-price",c()({},"wc-block-components-product-price--align-".concat(t),t));s.includes("<price/>")||(s="<price/>",console.error("Price formats need to include the `<price/>` tag."));var _=v&&g!==v,k=Object(o.createElement)("span",{className:u()("wc-block-components-product-price__value",j)});return _?k=Object(o.createElement)(p,{currency:n,price:g,priceClassName:j,priceStyle:h,regularPrice:v,regularPriceClassName:w,regularPriceStyle:y}):null!==m&&null!==d?k=Object(o.createElement)(b,{currency:n,maxPrice:d,minPrice:m,priceClassName:j,priceStyle:h}):null!==g&&(k=Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",j),currency:n,value:g,style:h})),Object(o.createElement)("span",{className:E},Object(o.createInterpolateElement)(s,{price:k}))}},128:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b}));var n,c=r(5),o=r.n(c),a=r(7);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){o()(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,i=t.callback,u=t.priority,b=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return b.set(a,{priority:u,callback:i}),s(s({},e),{},o()({},c,b));case n.REMOVE_EVENT_CALLBACK:return b.delete(a),s(s({},e),{},o()({},c,b))}}},129:function(e,t,r){"use strict";r.d(t,"b",(function(){return w})),r.d(t,"a",(function(){return y}));var n=r(5),c=r.n(n),o=r(9),a=r.n(o),i=r(0),s=(r(2),r(20)),u=r(65),l=r(59),b=r(8),p=r.n(b),d=r(6),f=r.n(d),m=r(859),O=(r(204),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""}),g=function(e){var t=e.className,r=e.notices,n=e.removeNotice,c=r.filter((function(e){return"snackbar"!==e.type}));if(!c.length)return null;var o=f()(t,"wc-block-components-notices");return Object(i.createElement)("div",{className:o},c.map((function(e){return Object(i.createElement)(m.a,p()({key:"store-notice-"+e.id},e,{className:f()("wc-block-components-notices__notice",O(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)})))};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 h(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){c()(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 v=Object(i.createContext)({notices:[],createNotice:function(e,t,r){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),w=function(){return Object(i.useContext)(v)},y=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,c=e.createNoticeContainer,o=void 0===c||c,b=e.context,p=void 0===b?"wc/core":b,d=Object(s.useDispatch)("core/notices"),f=d.createNotice,m=d.removeNotice,O=Object(i.useState)(!1),j=a()(O,2),w=j[0],y=j[1],E=Object(u.a)().dispatchStoreEvent,_=Object(l.b)().isEditor,k=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]:{};f(e,t,h(h({},r),{},{context:r.context||p})),E("store-notice-create",{status:e,content:t,options:r})}),[f,E,p]),P=Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;m(e,t)}),[m,p]),C={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(p)}}),[p]).notices,createNotice:k,removeNotice:P,context:p,setIsSuppressed:y},S=w?null:Object(i.createElement)(g,{className:n,notices:C.notices,removeNotice:C.removeNotice,isEditor:_});return Object(i.createElement)(v.Provider,{value:C},o&&S,t)}},133:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(47),u=r(4),l=r(6),b=r.n(l),p=["className","item","isSelected","isLoading","onSelect","disabled"];t.a=function(e){var t=e.className,r=e.item,n=e.isSelected,o=e.isLoading,l=e.onSelect,d=e.disabled,f=a()(e,p);return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(s.c,c()({},f,{key:r.id,className:t,isSelected:n,item:r,onSelect:l,isSingle:!0,disabled:d})),n&&o&&Object(i.createElement)("div",{key:"loading",className:b()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(i.createElement)(u.Spinner,null)))}},134:function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return v}));var n=r(38),c=r.n(n),o=r(5),a=r.n(o),i=r(14),s=r.n(i),u=r(9),l=r.n(u),b=r(0),p=r(7),d=r(36),f=r.n(d);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){a()(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}function g(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var j=Object(b.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}}),h=function(){return Object(b.useContext)(j)},v=function(e){var t=e.children,r=Object(b.useState)({}),n=l()(r,2),c=n[0],o=n[1],i=Object(b.useCallback)((function(e){return c[e]}),[c]),u=Object(b.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),d=Object(b.useCallback)((function(e){o((function(t){return t[e]?(t[e],s()(t,[e].map(g))):t}))}),[]),m=Object(b.useCallback)((function(){o({})}),[]),h=Object(b.useCallback)((function(e){e&&o((function(t){return e=Object(p.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&f()(t[r],e))})),0===Object.values(e).length?t:O(O({},t),e)}))}),[]),v=Object(b.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=O(O({},r[e]),t);return f()(r[e],n)?r:O(O({},r),{},a()({},e,n))}))}),[]),w={getValidationError:i,setValidationErrors:h,clearValidationError:d,clearAllValidationErrors:m,hideValidationError:Object(b.useCallback)((function(e){v(e,{hidden:!0})}),[v]),showValidationError:Object(b.useCallback)((function(e){v(e,{hidden:!1})}),[v]),showAllValidationErrors:Object(b.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=O(O({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:O(O({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return Object(b.createElement)(j.Provider,{value:w},t)}},140:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(9),c=r.n(n),o=function(e){return e.reduce((function(e,t){var r=c()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{})}},141:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(63),a=r(160),i=r(3),s=r(21),u=r(44);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}},142:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(9),c=r.n(n),o=r(0),a=function(){var e=Object(o.useState)(),t=c()(e,2)[1];return Object(o.useCallback)((function(e){t((function(){throw e}))}),[])}},149:function(e,t,r){"use strict";var n=r(35),c=r.n(n),o=r(5),a=r.n(o),i=r(8),s=r.n(i),u=r(0),l=r(1),b=r(7),p=(r(2),r(47)),d=r(22),f=r(16),m=r.n(f),O=r(17),g=r.n(O),j=r(18),h=r.n(j),v=r(19),w=r.n(v),y=r(10),E=r.n(y);var _=Object(d.createHigherOrderComponent)((function(e){var t=function(t){h()(o,t);var r,n,c=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E()(r);if(n){var c=E()(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return w()(this,e)});function o(){return m()(this,o),c.apply(this,arguments)}return g()(o,[{key:"render",value:function(){var t=this.props.selected,r=null==t;return Object(u.createElement)(e,s()({},this.props,{selected:r?[]:[t]}))}}]),o}(u.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),k=r(301),P=r(31),C=r.n(P),S=r(13),x=r.n(S),N=r(24),D=r.n(N),B=r(36),R=r.n(B),T=r(40),A=r(43);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 L(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){a()(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 V=Object(d.createHigherOrderComponent)((function(e){var t=function(t){h()(o,t);var r,n,c=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E()(r);if(n){var c=E()(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return w()(this,e)});function o(){var e;m()(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=c.call.apply(c,[this].concat(r)),a()(x()(e),"state",{error:null,loading:!1,variations:{}}),a()(x()(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 i=t.find((function(e){return e.id===o}));i.variations&&0!==i.variations.length?(e.setState({loading:!0}),Object(T.g)(o).then((function(t){var r=t.map((function(e){return L(L({},e),{},{parent:o})}));e.setState({variations:L(L({},e.state.variations),{},a()({},o,r)),loading:!1,error:null})})).catch(function(){var t=C()(D.a.mark((function t(r){var n;return D.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:L(L({},e.state.variations),{},a()({},o,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}())):e.setState({variations:L(L({},e.state.variations),{},a()({},o,null)),loading:!1,error:null})}}})),e}return g()(o,[{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,a=c.loading,i=c.variations;return Object(u.createElement)(e,s()({},this.props,{error:o||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:i,variationsLoading:a}))}}]),o}(u.Component);return a()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),z=r(52),F=r(6),M=r.n(F),H=r(133);function q(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?q(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}r(211);var Q={list:Object(l.__)("Products","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(l.__)("Product search results updated.","woo-gutenberg-products-block")},Y=function(e){var t=e.expandedProduct,r=e.error,n=e.instanceId,o=e.isCompact,a=e.isLoading,i=e.onChange,d=e.onSearch,f=e.products,m=e.renderItem,O=e.selected,g=e.showVariations,j=e.variations,h=e.variationsLoading;if(r)return Object(u.createElement)(z.a,{error:r});var v=j&&j[t]?j[t]:[],w=[].concat(c()(f),c()(v));return Object(u.createElement)(p.b,{className:"woocommerce-products",list:w,isCompact:o,isLoading:a,isSingle:!0,selected:w.filter((function(e){var t=e.id;return O.includes(t)})),onChange:i,renderItem:m||(g?function(e){var t=e.item,r=e.search,c=e.depth,o=void 0===c?0:c,i=e.isSelected,d=e.onSelect,f=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=M()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(o),"has-count",{"is-searching":r.length>0,"is-skip-level":0===o&&0!==t.parent,"is-variable":f>0});if(!t.breadcrumbs.length)return Object(u.createElement)(H.a,s()({},e,{className:M()(m,{"is-selected":i}),isSelected:i,item:t,onSelect:function(){return function(){d(t)()}},isLoading:a||h,countLabel:t.variations.length>0?Object(l.sprintf)(
|
|
|
|
|
6 |
/* translators: %1$d is the number of variations of a product product. */
|
7 |
Object(l.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-".concat(n),"aria-label":Object(l.sprintf)(
|
8 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
9 |
-
Object(l._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));var O=Object(b.isEmpty)(t.variation)?e:G(G({},e),{},{item:G(G({},e.item),{},{name:t.variation}),"aria-label":"".concat(t.breadcrumbs[0],": ").concat(t.variation)});return Object(u.createElement)(p.c,s()({},O,{className:m,name:"variations-".concat(n)}))}:null),onSearch:d,messages:Q,isHierarchical:!0})};Y.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=_(Object(k.a)(V(Object(d.withInstanceId)(Y))))},15:function(e,t){e.exports=window.wp.apiFetch},150:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},156:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(26),u=r(6),l=r.n(u),b=(r(202),["className","disabled","name","permalink"]);t.a=function(e){var t=e.className,r=void 0===t?"":t,n=e.disabled,o=void 0!==n&&n,u=e.name,p=e.permalink,d=void 0===p?"":p,f=a()(e,b),m=l()("wc-block-components-product-name",r);return o?Object(i.createElement)("span",c()({className:m},f,{dangerouslySetInnerHTML:{__html:Object(s.decodeEntities)(u)}})):Object(i.createElement)("a",c()({className:m,href:d},f,{dangerouslySetInnerHTML:{__html:Object(s.decodeEntities)(u)}}))}},157:function(e,t,r){"use strict";var n=r(0),c=r(118),o=r(88),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)}},158:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(6)),o=r.n(c),a=r(42),i=r(22);r(213),t.a=Object(i.withInstanceId)((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)}))))}))},159:function(e,t,r){"use strict";var n=r(16),c=r.n(n),o=r(17),a=r.n(o),i=r(18),s=r.n(i),u=r(19),l=r.n(u),b=r(10),p=r.n(b),d=r(0),f=r(7),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}var j=function(e){s()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=p()(t);if(r){var c=p()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return l()(this,e)});function o(){return c()(this,o),n.apply(this,arguments)}return a()(o,[{key:"createLevelControl",value:function(e,t,r){var n=e===t;return{icon:Object(d.createElement)(g,{level:e}),
|
10 |
-
/* translators: %s: heading level e.g: "2", "3", "4" */
|
11 |
-
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.ToolbarGroup,{isCollapsed:n,icon:Object(d.createElement)(g,{level:a}),controls:Object(f.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),o}(d.Component);t.a=j},160:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},161:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"c",(function(){return m}));var n=r(9),c=r.n(n),o=r(27),a=r(20),i=r(0),s=r(36),u=r.n(s),l=r(71),b=r(166),p=r(92),d=function(e){var t=Object(p.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,n])]},f=function(e,t,r){var n=Object(p.a)();r=r||n;var c=Object(a.useSelect)((function(n){return n(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),s=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(i.useCallback)((function(t){s(r,e,t)}),[r,e,s])]},m=function(e,t){var r=Object(p.a)(),n=d(t=t||r),o=c()(n,2),a=o[0],s=o[1],f=Object(l.a)(a),m=Object(l.a)(e),O=Object(b.a)(m),g=Object(i.useRef)(!1);return Object(i.useEffect)((function(){u()(O,m)||(s(Object.assign({},f,m)),g.current=!0)}),[f,m,O,s]),g.current?[a,s]:[e,s]}},164:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return s}));var n=r(3),c=r(113),o=r(23),a=function(e){var t=e.country,r=void 0===t?"":t,n=e.state,c=void 0===n?"":n,o=e.city,a=void 0===o?"":o,i=e.postcode,s=void 0===i?"":i;return{country:r.trim(),state:c.trim(),city:a.trim(),postcode:s?s.replace(" ","").toUpperCase():""}},i=function(e){var t=e.email,r=void 0===t?"":t;return Object(o.isEmail)(r)?r.trim():""},s=function(e){var t=Object.keys(n.defaultAddressFields),r=Object(c.a)(t,{},e.country),o=Object.assign({},e);return r.forEach((function(t){var r=t.key,n=void 0===r?"":r,c=t.hidden;void 0!==c&&c&&function(e,t){return e in t}(n,e)&&(o[n]="")})),o}},166:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},172:function(e,t){},186:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),c=Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(n.createElement)("title",null,"Grid Block Preview"),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},189:function(e,t){e.exports=window.wp.warning},192:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(0),a=(r(255),function(e){if(e){var t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()}});t.a=function(e){return function(t){var r=Object(o.useRef)(null);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(o.createElement)(e,c()({},t,{scrollToTop:function(e){var t,n;null!==r.current&&(t=r.current,n=(e||{}).focusableSelector,window&&Number.isFinite(window.innerHeight)&&(n?function(e,t){var r,n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){var c=n[0];a(c),null==c||c.focus()}else a(e)}(t,n):a(t)))}})))}}},20:function(e,t){e.exports=window.wp.data},202:function(e,t){},203:function(e,t){},204:function(e,t){},205:function(e,t){},206:function(e,t){},207:function(e,t){},21:function(e,t){e.exports=window.wp.blockEditor},211:function(e,t){},213:function(e,t){},216:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(27),c=r(20),o=r(0),a=r(71),i=r(142),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(a.a)(b),O=Object(a.a)(u),g=Object(i.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}},22:function(e,t){e.exports=window.wp.compose},229:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=(r(2),r(134)),o=(r(207),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||"string"!=typeof 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))})},23:function(e,t){e.exports=window.wp.url},24:function(e,t){e.exports=window.regeneratorRuntime},25:function(e,t){e.exports=window.wp.blocks},255:function(e,t){},26:function(e,t){e.exports=window.wp.htmlEntities},27:function(e,t){e.exports=window.wc.wcBlocksData},29:function(e,t){e.exports=window.moment},3:function(e,t){e.exports=window.wc.wcSettings},301:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(31),a=r.n(o),i=r(9),s=r.n(i),u=r(14),l=r.n(u),b=r(0),p=r(24),d=r.n(p),f=r(11),m=r(40),O=r(219),g=r(43),j=["selected"];t.a=function(e){return function(t){var r=t.selected,n=l()(t,j),o=Object(b.useState)(!0),i=s()(o,2),u=i[0],p=i[1],h=Object(b.useState)(null),v=s()(h,2),w=v[0],y=v[1],E=Object(b.useState)([]),_=s()(E,2),k=_[0],P=_[1],C=f.q.productCount>100,S=function(){var e=a()(d.a.mark((function e(t){var r;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(g.a)(t);case 2:r=e.sent,y(r),p(!1);case 5:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();Object(b.useEffect)((function(){Object(m.h)({selected:r}).then((function(e){P(e),p(!1)})).catch(S)}),[r]);var x=Object(O.a)((function(e){Object(m.h)({selected:r,search:e}).then((function(e){P(e),p(!1)})).catch(S)}),400),N=s()(x,1)[0],D=Object(b.useCallback)((function(e){p(!0),N(e)}),[p,N]);return Object(b.createElement)(e,c()({},n,{selected:r,error:w,products:k,isLoading:u,onSearch:C?D:null}))}}},302:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},303:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(6),s=r.n(i),u=r(42),l=r(44),b=r(82);r(534),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")}))}))},306:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},318:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(128),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))}}}},319:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f}));var n=r(38),c=r.n(n),o=r(31),a=r.n(o),i=r(24),s=r.n(i),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(51);function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);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)?p(e,void 0):void 0}}(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=r.call(e)},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 p(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(){var e=a()(s.a.mark((function e(t,r,n){var o,a,i,l,p,d;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],i=b(o),e.prev=3,i.s();case 5:if((l=i.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"===c()(d)&&a.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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),f=function(){var e=a()(s.a.mark((function e(t,r,n){var o,a,i,p,d,f;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),i=b(a),e.prev=3,i.s();case 5:if((p=i.n()).done){e.next=28;break}return d=p.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:if(f=e.sent,"object"===c()(f)&&null!==f){e.next=13;break}return e.abrupt("continue",26);case 13:if(f.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(f)&&!Object(l.b)(f)){e.next=18;break}return o.push(f),e.abrupt("return",o);case 18:o.push(f),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),i.e(e.t1);case 33:return e.prev=33,i.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},33:function(e,t){e.exports=window.wp.primitives},36:function(e,t){e.exports=window.wp.isShallowEqual},369:function(e,t){},37:function(e,t){e.exports=window.wp.dataControls},370:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(11);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.s)()&&(s=i(i({},s),{},{align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}})),t.a=s},371: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}}},372:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(5),a=r.n(o),i=r(9),s=r.n(i),u=r(0),l=(r(2),r(1)),b=r(6),p=r.n(b),d=r(3),f=r(44),m=r(82),O=r(65),g=r(303);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 h(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){a()(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}r(535);var v=function(){return Object(u.createElement)("img",{src:d.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500})},w=function(e){var t=e.image,r=e.onLoad,n=e.loaded,o=e.showFullSize,a=e.fallbackAlt,i=t||{},s=i.thumbnail,l=i.src,b=i.srcset,p=i.sizes,d=h({alt:i.alt||a,onLoad:r,hidden:!n,src:s},o&&{src:l,srcSet:b,sizes:p});return Object(u.createElement)(u.Fragment,null,d.src&&Object(u.createElement)("img",c()({"data-testid":"product-image"},d)),!n&&Object(u.createElement)(v,null))};t.a=Object(m.withProductDataContext)((function(e){var t=e.className,r=e.imageSizing,n=void 0===r?"full-size":r,c=e.productLink,o=void 0===c||c,i=e.showSaleBadge,b=e.saleBadgeAlign,d=void 0===b?"right":b,m=Object(f.useInnerBlockLayoutContext)().parentClassName,j=Object(f.useProductDataContext)().product,y=Object(u.useState)(!1),E=s()(y,2),_=E[0],k=E[1],P=Object(O.a)().dispatchStoreEvent;if(!j.id)return Object(u.createElement)("div",{className:p()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",a()({},"".concat(m,"__product-image"),m))},Object(u.createElement)(v,null));var C=!!j.images.length,S=C?j.images[0]:null,x=o?"a":u.Fragment,N=Object(l.sprintf)(
|
12 |
/* translators: %s is referring to the product name */
|
13 |
-
Object(l.__)("Link to %s","woo-gutenberg-products-block"),j.name),D=h(h({href:j.permalink,rel:"nofollow"},!C&&{"aria-label":N}),{},{onClick:function(){P("product-view-link",{product:j})}});return Object(u.createElement)("div",{className:p()(t,"wc-block-components-product-image",a()({},"".concat(m,"__product-image"),m))},Object(u.createElement)(x,o&&D,!!i&&Object(u.createElement)(g.default,{align:d,product:j}),Object(u.createElement)(w,{fallbackAlt:j.name,image:S,onLoad:function(){return k(!0)},loaded:_,showFullSize:"cropped"!==n})))}))},
|
14 |
/* translators: %s number of products in cart. */
|
15 |
-
Object(s._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(s.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(F.a,{srcElement:M.a,alt:Object(s.__)("Done","woo-gutenberg-products-block")}))},Y=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,u=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,p=e.hasError,d=e.dispatchActions,f=Object(I.useInnerBlockLayoutContext)().parentName,m=Object(H.a)().dispatchStoreEvent,O=Object(q.a)(o.id||0).cartQuantity,g=Object(n.useState)(!1),j=i()(g,2),h=j[0],v=j[1],w=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return p||v(!0),!0}),0);return function(){e()}}),[b,p]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(Q,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:O,isDisabled:u,isProcessing:l,isDone:h,onClick:function(){d.submitForm(),m("cart-add-item",{product:o,listName:f})}}):Object(n.createElement)(G,{className:"wc-block-components-product-add-to-cart-button",href:w.url,text:w.text||Object(s.__)("View Product","woo-gutenberg-products-block"),onClick:function(){m("product-view-link",{product:o,listName:f})}})},U=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)}})},W=function(e){var t=e.reason,r=void 0===t?Object(s.__)("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)},K=function(){var e=C(),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)(W,null):t.id&&!t.is_in_stock?Object(n.createElement)(W,{reason:Object(s.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(U,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Y,null))},$=(r(543),r(35)),J=r.n($),X=r(862),Z=r(12),ee=r(229),te={value:"",label:Object(s.__)("Select an option","woo-gutenberg-products-block")},re=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,a=e.value,i=void 0===a?"":a,u=e.onChange,l=void 0===u?function(){}:u,b=e.errorMessage,p=void 0===b?Object(s.__)("Please select a value.","woo-gutenberg-products-block"):b,d=Object(E.b)(),m=d.getValidationError,O=d.setValidationErrors,g=d.clearValidationError,j=t,h=m(j)||{};return Object(Z.useEffect)((function(){i?g(j):O(f()({},j,{message:p,hidden:!0}))}),[i,j,p,g,O]),Object(Z.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)(X.a,{label:Object(D.decodeEntities)(t),value:i||"",options:[te].concat(J()(c)),onChange:l,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(ee.a,{propertyName:j,elementId:j}))};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 ce(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){f()(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 oe=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}))}))};function ae(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?ae(Object(r),!0).forEach((function(t){f()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var se=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(u.a)(t),a=Object(u.a)(r),s=Object(n.useState)(0),l=i()(s,2),b=l[0],p=l[1],d=Object(n.useState)({}),m=i()(d,2),O=m[0],g=m[1],j=Object(n.useMemo)((function(){return 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=ce(ce({},r),{},f()({},c,null)),s=o?oe(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(o,a,O)}),[O,o,a]);return Object(n.useEffect)((function(){Object.values(O).filter((function(e){return""!==e})).length===Object.keys(o).length?p(function(e,t,r){return oe(e,t,r)[0]||0}(o,a,O)):b>0&&p(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)(re,{key:e,attributeName:e,options:j[e],value:O[e],onChange:function(t){g(ie(ie({},O),{},f()({},e,t)))}})})))},ue=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(L.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)(se,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},le=function(){var e=C(),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)(W,null):t.id&&!t.is_in_stock?Object(n.createElement)(W,{reason:Object(s.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(ue,{product:t,dispatchers:a}),Object(n.createElement)(U,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Y,null))},be=function(){return Object(n.createElement)(Y,null)},pe=r(860),de=function(){return Object(n.createElement)(pe.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},fe=function(){return Object(n.createElement)(de,null)},me=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(le,null):"grouped"===r?Object(n.createElement)(fe,null):"external"===r?Object(n.createElement)(be,null):"simple"===r||"variation"===r?Object(n.createElement)(K,null):null:Object(n.createElement)(Y,null)};t.a=Object(V.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(I.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(L.isEmpty)(c)});return Object(n.createElement)(A,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(me,null)))}))},375:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(6)),i=r.n(a),s=r(44),u=r(21),l=r(11),b=function(e){var t=e.color,r=e.fontSize;return Object(l.s)()?{color:t,fontSize:r}:{}},p=r(82),d=r(156),f=r(65);r(533),t.a=Object(p.withProductDataContext)((function(e){var t,r,n,a=e.className,p=e.headingLevel,m=void 0===p?2:p,O=e.productLink,g=void 0===O||O,j=e.align,h=e.color,v=e.customColor,w=e.fontSize,y=e.customFontSize,E=Object(s.useInnerBlockLayoutContext)().parentClassName,_=Object(s.useProductDataContext)().product,k=Object(f.a)().dispatchStoreEvent,P="h".concat(m),C=Object(u.getColorClassName)("color",h),S=Object(u.getFontSizeClass)(w),x=i()((t={"has-text-color":h||v,"has-font-size":w||y},c()(t,C,C),c()(t,S,S),t));return _.id?Object(o.createElement)(P,{className:i()(a,"wc-block-components-product-title",(r={},c()(r,"".concat(E,"__product-title"),E),c()(r,"wc-block-components-product-title--align-".concat(j),j&&Object(l.s)()),r))},Object(o.createElement)(d.a,{className:i()(c()({},x,Object(l.s)())),disabled:!g,name:_.name,permalink:_.permalink,rel:g?"nofollow":null,style:b({color:v,fontSize:y}),onClick:function(){k("product-view-link",{product:_})}})):Object(o.createElement)(P,{className:i()(a,"wc-block-components-product-title",(n={},c()(n,"".concat(E,"__product-title"),E),c()(n,"wc-block-components-product-title--align-".concat(j),j&&Object(l.s)()),c()(n,x,Object(l.s)()),n)),style:b({color:v,fontSize:y})})}))},4:function(e,t){e.exports=window.wp.components},40:function(e,t,r){"use strict";r.d(t,"h",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"b",(function(){return m})),r.d(t,"i",(function(){return O})),r.d(t,"f",(function(){return g})),r.d(t,"c",(function(){return j})),r.d(t,"d",(function(){return h})),r.d(t,"g",(function(){return v})),r.d(t,"a",(function(){return w}));var n=r(5),c=r.n(n),o=r(23),a=r(15),i=r.n(a),s=r(7),u=r(3),l=r(11);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=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,u=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=l.q.productCount>100,u={per_page:s?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},b=[Object(o.addQueryArgs)("/wc/store/products",p(p({},u),i))];return s&&r.length&&b.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r,per_page:0})),b}({selected:r,search:c,queryArgs:void 0===a?{}:a});return Promise.all(u.map((function(e){return i()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return p(p({},e),{},{parent:0})}))})).catch((function(e){throw e}))},f=function(e){return i()({path:"/wc/store/products/".concat(e)})},m=function(){return i()({path:"wc/store/products/attributes"})},O=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},g=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=Object(u.getSetting)("limitTags",!1),a=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:c?100:0,orderby:c?"count":"name",order:c?"desc":"asc",search:n})];return c&&r.length&&a.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:r})),a}({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")}))},j=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products/categories",p({per_page:0},e))})},h=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})})},w=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))}},42:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(0),a=r(6),i=r.n(a);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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,c=e.wrapperElement,a=e.wrapperProps,s=void 0===a?{}:a,l=null!=r,b=null!=n;return!l&&b?(t=c||"span",s=u(u({},s),{},{className:i()(s.className,"screen-reader-text")}),Object(o.createElement)(t,s,n)):(t=c||o.Fragment,l&&b&&r!==n?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,s,r))}},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(31),c=r.n(n),o=r(24),a=r.n(o),i=r(1),s=function(){var e=c()(a.a.mark((function e(t){var r;return a.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(_x){return e.apply(this,arguments)}}(),u=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},44:function(e,t){e.exports=window.wc.wcBlocksSharedContext},45:function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(9),c=r.n(n),o=r(5),a=r.n(o),i=r(7),s=r(0),u=r(27),l=r(20),b=r(26),p=r(140),d=r(164),f=r(59);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){a()(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={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},j=O(O({},g),{},{email:""}),h={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:u.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},v=function(e){return Object(p.a)(Object.entries(e).map((function(e){var t=c()(e,2),r=t[0],n=t[1];return[r,Object(b.decodeEntities)(n)]})))},w={cartCoupons:u.EMPTY_CART_COUPONS,cartItems:u.EMPTY_CART_ITEMS,cartFees:u.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:j,shippingAddress:g,shippingRates:u.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:u.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:function(){},extensions:u.EMPTY_EXTENSIONS},y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(f.b)(),r=t.isEditor,n=t.previewData,c=null==n?void 0:n.previewCart,o=e.shouldSelect,a=Object(s.useRef)(),b=Object(l.useSelect)((function(e,t){var n=t.dispatch;if(!o)return w;if(r)return{cartCoupons:c.coupons,cartItems:c.items,cartFees:c.fees,cartItemsCount:c.items_count,cartItemsWeight:c.items_weight,cartNeedsPayment:c.needs_payment,cartNeedsShipping:c.needs_shipping,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:c.totals,cartIsLoading:!1,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:j,shippingAddress:g,extensions:u.EMPTY_EXTENSIONS,shippingRates:c.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:c.has_calculated_shipping,paymentRequirements:c.paymentRequirements,receiveCart:"function"==typeof(null==c?void 0:c.receiveCart)?c.receiveCart:function(){}};var a=e(u.CART_STORE_KEY),i=a.getCartData(),s=a.getCartErrors(),l=a.getCartTotals(),b=!a.hasFinishedResolution("getCartData"),p=a.isCustomerDataUpdating(),f=n(u.CART_STORE_KEY).receiveCart,m=v(i.billingAddress),h=i.needsShipping?v(i.shippingAddress):m,y=i.fees.length>0?i.fees.map((function(e){return v(e)})):u.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map((function(e){return O(O({},e),{},{label:e.code})})):u.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:y,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:l,cartIsLoading:b,cartErrors:s,billingAddress:Object(d.a)(m),shippingAddress:Object(d.a)(h),extensions:i.extensions,shippingRates:i.shippingRates,shippingRatesLoading:p,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:f}}),[o]);return a.current&&Object(i.isEqual)(a.current,b)||(a.current=b),a.current}},46:function(e,t){e.exports=window.wc.priceFormat},479:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(6)),i=r.n(a),s=r(126),u=r(46),l=r(44),b=r(21),p=r(11),d=r(82);t.default=Object(d.withProductDataContext)((function(e){var t,r,n,a,d,f,m,O=e.className,g=e.align,j=e.fontSize,h=e.customFontSize,v=e.saleFontSize,w=e.customSaleFontSize,y=e.color,E=e.customColor,_=e.saleColor,k=e.customSaleColor,P=Object(l.useInnerBlockLayoutContext)().parentClassName,C=Object(l.useProductDataContext)().product,S=i()(O,c()({},"".concat(P,"__product-price"),P));if(!C.id)return Object(o.createElement)(s.a,{align:g,className:S});var x=Object(b.getColorClassName)("color",y),N=Object(b.getFontSizeClass)(j),D=Object(b.getColorClassName)("color",_),B=Object(b.getFontSizeClass)(v),R=i()((t={"has-text-color":y||E,"has-font-size":j||h},c()(t,x,x),c()(t,N,N),t)),T=i()((r={"has-text-color":_||k,"has-font-size":v||w},c()(r,D,D),c()(r,B,B),r)),A={color:E,fontSize:h},I={color:k,fontSize:w},L=C.prices,V=Object(u.getCurrencyFromPriceResponse)(L),z=L.price!==L.regular_price,F=z?i()((n={},c()(n,"".concat(P,"__product-price__value"),P),c()(n,T,Object(p.s)()),n)):i()((a={},c()(a,"".concat(P,"__product-price__value"),P),c()(a,R,Object(p.s)()),a)),M=z?I:A;return Object(o.createElement)(s.a,{align:g,className:S,currency:V,price:L.price,priceClassName:F,priceStyle:Object(p.s)()?M:{},minPrice:null==L||null===(d=L.price_range)||void 0===d?void 0:d.min_amount,maxPrice:null==L||null===(f=L.price_range)||void 0===f?void 0:f.max_amount,regularPrice:L.regular_price,regularPriceClassName:i()((m={},c()(m,"".concat(P,"__product-price__regular"),P),c()(m,R,Object(p.s)()),m)),regularPriceStyle:Object(p.s)()?A:{}})}))},480:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(6),s=r.n(i),u=r(44),l=r(82),b=(r(536),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)(
|
16 |
/* translators: %f is referring to the average rating value */
|
17 |
-
Object(a.__)("Rated %f out of 5","woo-gutenberg-products-block"),i);return Object(o.createElement)("div",{className:s()(t,"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)))}))},
|
18 |
/* translators: %s number of products in cart. */
|
19 |
-
Object(l._n)("%d in cart","%d in cart",g,"woo-gutenberg-products-block"),g):Object(d.decodeEntities)((null==o?void 0:o.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),_=w?"button":"a",k={};return w?k.onClick=function(){h(),m("cart-add-item",{product:t})}:(k.href=n,k.rel="nofollow",k.onClick=function(){m("product-view-link",{product:t})}),Object(i.createElement)(_,c()({"aria-label":y,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))}))},
|
20 |
/* translators: %d stock amount (number of items in stock for product) */
|
21 |
-
Object(a.__)("%d left in stock","woo-gutenberg-products-block"),e)});t.default=Object(l.withProductDataContext)((function(e){var t,r=e.className,n=Object(u.useInnerBlockLayoutContext)().parentClassName,i=Object(u.useProductDataContext)().product;if(!i.id||!i.is_purchasable)return null;var l=!!i.is_in_stock,p=i.low_stock_remaining,d=i.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",l),c()(t,"wc-block-components-product-stock-indicator--out-of-stock",!l),c()(t,"wc-block-components-product-stock-indicator--low-stock",!!p),c()(t,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),t))},p?b(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")}(l,d))}))},49:function(e,t){e.exports=window.wp.escapeHtml},50:function(e,t){e.exports=window.wp.keycodes},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return b}));var n,c,o=r(105);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},i=function(e){return a(e,n.SUCCESS)},s=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},b=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:i,isErrorResponse:s,isFailResponse:u}}},52:function(e,t,r){"use strict";var n=r(0),c=r(1),o=(r(2),r(49));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")))}},53:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(5),a=r.n(o),i=r(14),s=r.n(i),u=r(0),l=r(165),b=r(6),p=r.n(b),d=(r(172),["className","value","currency","onValueChange","displayType"]);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){a()(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}t.a=function(e){var t=e.className,r=e.value,n=e.currency,o=e.onValueChange,a=e.displayType,i=void 0===a?"text":a,b=s()(e,d),f="string"==typeof r?parseInt(r,10):r;if(!Number.isFinite(f))return null;var O=f/Math.pow(10,n.minorUnit);if(!Number.isFinite(O))return null;var g=p()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),j=m(m(m({},b),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}),h=o?function(e){var t=e.value*Math.pow(10,n.minorUnit);o(t)}:function(){};return Object(u.createElement)(l.a,c()({className:g,displayType:i},j,{value:O,onValueChange:h}))}},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){e.exports=window.wp.deprecated},540:function(e,t){},541:function(e,t){},542:function(e,t){},543:function(e,t){},55:function(e,t){e.exports=window.wp.hooks},56:function(e,t){e.exports=window.wc.wcBlocksRegistry},57:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(5),c=r.n(n),o=r(0),a=r(129);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(a.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.setIsSuppressed,i=Object(o.useRef)(t);Object(o.useEffect)((function(){i.current=t}),[t]);var u=Object(o.useMemo)((function(){return{hasNoticesOfType:function(e){return i.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;i.current.forEach((function(t){null!==e&&t.status!==e||n(t.id)}))},removeNotice:n}}),[n]),l=Object(o.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))}}}),[r]);return s(s(s({notices:t},u),l),{},{setIsSuppressed:c})}},59: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(20),o=Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{},getPreviewData:function(){}}),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=Object(c.useSelect)((function(e){return a||e("core/editor").getCurrentPostId()}),[a]),l=Object(n.useCallback)((function(e){return e in s?s[e]:{}}),[s]),b={isEditor:!0,currentPostId:u,previewData:s,getPreviewData:l};return Object(n.createElement)(o.Provider,{value:b},t)}},63:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=["srcElement","size"];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,s);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)):null}},65:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),c=r.n(n),o=r(55),a=r(0),i=r(45);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=function(){var e=Object(i.a)(),t=Object(a.useRef)(e);return Object(a.useEffect)((function(){t.current=e}),[e]),{dispatchStoreEvent:Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-".concat(e),t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(a.useCallback)((function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-checkout-".concat(e),u(u({},r),{},{storeCart:t.current}))}catch(e){console.error(e)}}),[])}}},7:function(e,t){e.exports=window.lodash},71:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(36),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},734:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},74:function(e,t){e.exports=window.wp.a11y},741:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},749:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},75:function(e,t){e.exports=window.wp.dom},750:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1),c=r(11),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.p+"previews/pennant.jpg",thumbnail:c.p+"previews/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}]},755:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},762:function(e,t,r){e.exports=r(816)},763:function(e,t){},764:function(e,t){},765:function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(9),c=r.n(n),o=r(0),a=r(20),i=r(27),s=r(26),u=r(45),l=r(57),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)(i.CART_STORE_KEY).addItemToCart,r=Object(u.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;return h(!0),t(e,r).then((function(){m("add-to-cart")})).catch((function(e){f(Object(s.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){h(!1)}))}}}},766:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},767:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},Object(n.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(n.createElement)("path",{stroke:"currentColor",strokeWidth:"1.5",d:"M2 .75h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H2c-.69 0-1.25-.56-1.25-1.25V2C.75 1.31 1.31.75 2 .75z"}),Object(n.createElement)("path",{fill:"currentColor",d:"M12 6H4V4.75h8zM12 9H4V7.75h8zM10 12H4v-1.25h6z"})));t.a=o},768:function(e,t){},769:function(e,t){},770:function(e,t){},771:function(e,t){},816:function(e,t,r){"use strict";r.r(t),r.d(t,"blockSettings",(function(){return Dr}));var n=r(5),c=r.n(n),o=r(8),a=r.n(o),i=r(0),s=r(1),u=r(21),l=r(25),b=r(63),p=r(33),d=Object(i.createElement)(p.SVG,{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(11),m=r(6),O=r.n(m),g={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.r)()?null:["@woocommerce/all-products","@woocommerce/single-product"],save:function(e){var t=e.attributes;return Object(i.createElement)("div",{className:O()("is-loading",t.className)})},deprecated:[{save:function(){}}]},j=r(370),h=r(4),v=r(22),w=r(159),y=r(375),E=r(9),_=r.n(E),k=r(149),P=r(14),C=r.n(P),S=(r(764),["className"]),x=function(e){var t=e.className,r=void 0===t?"":t,n=C()(e,S),c=O()("wc-block-text-toolbar-button",r);return Object(i.createElement)(h.Button,a()({className:c},n))},N=r(44),D=(r(763),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=_()(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)(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)(k.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,{isSecondary:!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)(h.ToolbarGroup,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.SVG,{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"})),R=Object(s.__)("Product Title","woo-gutenberg-products-block"),T=Object(i.createElement)(b.a,{srcElement:B}),A=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.s)()&&Object(i.createElement)(u.AlignmentToolbar,{value:p,onChange:function(e){a({align:e})}})),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.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.s)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.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)(h.Disabled,null,Object(i.createElement)(y.a,o)))},L=Object(f.s)()?Object(v.compose)([Object(u.withFontSizes)("fontSize"),Object(u.withColors)("color",{textColor:"color"}),D({icon:T,label:R,description:Object(s.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(I):I;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){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 F={title:R,description:A,icon:{src:T,foreground:"#874FB9"},attributes:j.a,edit:L};Object(l.registerBlockType)("woocommerce/product-title",z(z({},g),F));var M=r(479),H=r(302),q=Object(s.__)("Product Price","woo-gutenberg-products-block"),G=Object(i.createElement)(b.a,{srcElement:H.a}),Q=Object(s.__)("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)(u.FontSizePicker,{value:t.size,onChange:r}),Object(i.createElement)(h.BaseControl,{label:o},Object(i.createElement)(u.ColorPalette,{value:n.color,onChange:c,label:Object(s.__)("Color")})))},U=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.s)()&&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.s)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:o,setColor:l,fontSize:t,setFontSize:n,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})),Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Sale price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:a,setColor:b,fontSize:r,setFontSize:c,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})))),Object(i.createElement)(M.default,p))},W=Object(f.s)()?Object(v.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:G,label:q,description:Object(s.__)("Choose a product to display its price.","woo-gutenberg-products-block")})])(U):U;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.s)()&&(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:G,foreground:"#874FB9"},attributes:J,edit:W};Object(l.registerBlockType)("woocommerce/product-price",Z(Z({},g),ee));var te=r(371),re=r(84),ne=r(3),ce=r(372),oe=Object(i.createElement)(p.SVG,{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"})),ae=Object(s.__)("Product Image","woo-gutenberg-products-block"),ie=Object(i.createElement)(b.a,{srcElement:oe}),se=Object(s.__)("Display the main product image","woo-gutenberg-products-block"),ue=D({icon:ie,label:ae,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)(h.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.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)(h.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)(re.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)(re.a,{label:Object(s.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(i.createInterpolateElement)(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(ne.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)(h.Disabled,null,Object(i.createElement)(ce.a,t)))}));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 be(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 pe={title:ae,description:se,icon:{src:ie,foreground:"#874FB9"},attributes:te.a,edit:ue};Object(l.registerBlockType)("woocommerce/product-image",be(be({},g),pe));var de=r(480),fe=r(749),me=Object(s.__)("Product Rating","woo-gutenberg-products-block"),Oe=Object(i.createElement)(b.a,{srcElement:fe.a});function ge(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 je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var he={title:me,description:Object(s.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:Oe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Oe,label:me,description:Object(s.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(de.default,t)}))};Object(l.registerBlockType)("woocommerce/product-rating",je(je({},g),he));var ve=r(481),we=r(766),ye=Object(s.__)("Add to Cart Button","woo-gutenberg-products-block"),Ee=Object(i.createElement)(b.a,{srcElement:we.a});function _e(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 ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_e(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Pe={title:ye,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:Ee,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Ee,label:ye,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)(h.Disabled,null,Object(i.createElement)(ve.default,t))}))};Object(l.registerBlockType)("woocommerce/product-button",ke(ke({},g),Pe));var Ce=r(483),Se=r(767),xe=Object(s.__)("Product Summary","woo-gutenberg-products-block"),Ne=Object(i.createElement)(b.a,{srcElement:Se.a});function De(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 Be(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?De(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Re={title:xe,description:Object(s.__)("Display a short description about a product.","woo-gutenberg-products-block"),icon:{src:Ne,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Ne,label:xe,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)(Ce.default,t)}))};Object(l.registerBlockType)("woocommerce/product-summary",Be(Be({},g),Re));var Te=r(303),Ae=r(741),Ie=Object(s.__)("On-Sale Badge","woo-gutenberg-products-block"),Le=Object(i.createElement)(b.a,{srcElement:Ae.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 ze(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 Fe={title:Ie,description:Object(s.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:Le,foreground:"#874FB9"},supports:{html:!1},attributes:{productId:{type:"number",default:0}},edit:D({icon:Le,label:Ie,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)(Te.default,t)}))};Object(l.registerBlockType)("woocommerce/product-sale-badge",ze(ze({},g),Fe));var Me=r(141),He=r(484),qe=Object(i.createElement)(p.SVG,{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"})),Ge=Object(s.__)("Product SKU","woo-gutenberg-products-block"),Qe=Object(i.createElement)(b.a,{srcElement:qe});function Ye(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?Ye(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var We={title:Ge,description:Object(s.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Qe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Qe,label:Ge,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)(Me.a,null),Object(i.createElement)(He.default,t))}))};Object(f.t)("woocommerce/product-sku",Ue(Ue({},g),We));var Ke=r(485),$e=r(734),Je=Object(s.__)("Product Category List","woo-gutenberg-products-block"),Xe=Object(i.createElement)(b.a,{srcElement:$e.a});function Ze(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 et(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var tt={title:Je,description:Object(s.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block"),icon:{src:Xe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Xe,label:Je,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)(Me.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(Ke.default,t)))}))};Object(f.t)("woocommerce/product-category-list",et(et({},g),tt));var rt=r(486),nt=Object(s.__)("Product Tag List","woo-gutenberg-products-block"),ct=Object(i.createElement)(b.a,{srcElement:Ae.a});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){c()(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={title:nt,description:Object(s.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:ct,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:ct,label:nt,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)(Me.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(rt.default,t)))}))};Object(f.t)("woocommerce/product-tag-list",at(at({},g),it));var st=r(487),ut=Object(i.createElement)(p.SVG,{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"}))),lt=Object(s.__)("Product Stock Indicator","woo-gutenberg-products-block"),bt=Object(i.createElement)(b.a,{srcElement:ut});function pt(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 dt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ft={title:lt,description:Object(s.__)("Display product stock status.","woo-gutenberg-products-block"),icon:{src:bt,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:bt,label:lt,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)(Me.a,null),Object(i.createElement)(st.default,t))}))};Object(f.t)("woocommerce/product-stock-indicator",dt(dt({},g),ft));var mt=r(847),Ot=(r(369),r(374)),gt=Object(s.__)("Add to Cart","woo-gutenberg-products-block"),jt=Object(i.createElement)(b.a,{srcElement:we.a});function ht(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 vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ht(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wt={title:gt,description:Object(s.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:jt,foreground:"#874FB9"},edit:D({icon:jt,label:gt,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)(Me.a,{productId:n.id}),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Layout","woo-gutenberg-products-block")},Object(mt.b)(n)?Object(i.createElement)(h.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)(h.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)(h.Disabled,null,Object(i.createElement)(Ot.a,t)))})),attributes:r(373).a};Object(f.t)("woocommerce/product-add-to-cart",vt(vt({},g),wt));var yt=r(16),Et=r.n(yt),_t=r(13),kt=r.n(_t),Pt=r(18),Ct=r.n(Pt),St=r(19),xt=r.n(St),Nt=r(10),Dt=r.n(Nt),Bt=r(20),Rt=(r(2),r(91)),Tt=r(842),At=r(750),It=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})},Lt=r(160),Vt=function(e,t){return Object(i.createElement)(h.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)(h.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:ne.ADMIN_URL+"post-new.php?post_type=product"},Object(s.__)("Add new product","woo-gutenberg-products-block")+" ",Object(i.createElement)(b.a,{srcElement:Lt.a})),Object(i.createElement)(h.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")))},zt=function(e,t){return Object(i.createElement)(h.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 Ft(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 Mt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ft(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ft(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ht=[["woocommerce/product-image"],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],qt=function e(t){return t&&0!==t.length?t.map((function(t){return[t.name,Mt(Mt({},t.attributes),{},{product:void 0,children:t.innerBlocks.length>0?e(t.innerBlocks):[]})]})):[]};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 Qt(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 Yt=function(e,t){var r=e.contentVisibility;return Object(i.createElement)(h.ToggleControl,{label:Object(s.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:r.orderBy,onChange:function(){return t({contentVisibility:Qt(Qt({},r),{},{orderBy:!r.orderBy})})}})},Ut=function(e,t){return Object(i.createElement)(h.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})}})},Wt=r(17),Kt=r.n(Wt),$t=r(12),Jt=r(7),Xt=r(42),Zt=(r(771),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)(Xt.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 wc-block-components-pagination-page--arrow",onClick:function(){return o(t-1)},title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(i.createElement)(Xt.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)(Xt.a,{label:1,screenReaderLabel:Object(s.sprintf)(
|
22 |
/* translators: %d is the page number (1, 2, 3...). */
|
23 |
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)(Xt.a,{label:e,screenReaderLabel:Object(s.sprintf)(
|
24 |
/* translators: %d is the page number (1, 2, 3...). */
|
25 |
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)(Xt.a,{label:a,screenReaderLabel:Object(s.sprintf)(
|
26 |
/* translators: %d is the page number (1, 2, 3...). */
|
27 |
-
Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return o(t+1)},title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(i.createElement)(Xt.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))});Zt.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var er=Zt,tr=r(
|
28 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
29 |
-
Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(g))}),[null==z?void 0:z.totalQuery,g,c,y]);var F,M,H,q,G,Q=r.contentVisibility,Y=r.columns*r.rows,U=!Number.isFinite(g)&&Number.isFinite(null==z?void 0:z.totalProducts)&&Object(Jt.isEqual)(y,null==z?void 0:z.totalQuery)?Math.ceil(z.totalProducts/Y):Math.ceil(g/Y),W=m.length?m:Array.from({length:Y}),K=0!==m.length||j,$=S.length>0||Number.isFinite(R)||Number.isFinite(L);return Object(i.createElement)("div",{className:(F=r.columns,M=r.rows,H=r.alignButtons,q=r.align,G=void 0!==q?"align"+q:"",O()(v,G,"has-"+F+"-columns",{"has-multiple-rows":M>1,"has-aligned-buttons":H}))},Q.orderBy&&K&&Object(i.createElement)(Or,{onChange:o,value:a}),!K&&$&&Object(i.createElement)(fr,{resetCallback:function(){x([]),T(null),V(null)}}),!K&&!$&&Object(i.createElement)(pr,null),K&&Object(i.createElement)("ul",{className:"".concat(v,"__products")},W.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return Object(i.createElement)(gr,{key:e.id||t,attributes:r,product:e})}))),U>1&&Object(i.createElement)(er,{currentPage:n,onPageChange:function(e){u({focusableSelector:"a, button"}),c(e)},totalPages:U}))})),Er=function(e){var t=e.attributes,r=e.hideOutOfStockItems,n=void 0!==r&&r,c=Object(i.useState)(1),o=_()(c,2),a=o[0],s=o[1],u=Object(i.useState)(t.orderby),l=_()(u,2),b=l[0],p=l[1];return Object(i.useEffect)((function(){p(t.orderby)}),[t.orderby]),Object(i.createElement)(yr,{attributes:t,hideOutOfStockItems:n,currentPage:a,onPageChange:function(e){s(e)},onSortChange:function(e){var t=e.target.value;p(t),s(1)},sortValue:b})},_r=r(186);var kr=function(e){Ct()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=Dt()(t);if(r){var c=Dt()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return xt()(this,e)});function c(){return Et()(this,c),n.apply(this,arguments)}return Kt()(c,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.urlParameterSuffix;if(t.isPreview)return _r.a;var n=Object(ne.getSetting)("hideOutOfStockItems",!1);return Object(i.createElement)(N.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)(Er,{attributes:t,urlParameterSuffix:r,hideOutOfStockItems:n}))}}]),c}($t.Component);r(768);var Pr=function(e){Ct()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=Dt()(t);if(r){var c=Dt()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return xt()(this,e)});function o(){var e;Et()(this,o);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return e=n.call.apply(n,[this].concat(r)),c()(kt()(e),"state",{isEditing:!1,innerBlocks:[]}),c()(kt()(e),"blockMap",Object(Tt.a)("woocommerce/all-products")),c()(kt()(e),"componentDidMount",(function(){var t=e.props.block;e.setState({innerBlocks:t.innerBlocks})})),c()(kt()(e),"getTitle",(function(){return Object(s.__)("All Products","woo-gutenberg-products-block")})),c()(kt()(e),"getIcon",(function(){return Object(i.createElement)(b.a,{srcElement:d})})),c()(kt()(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()(kt()(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)(h.PanelBody,{title:Object(s.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(i.createElement)(Rt.a,{columns:c,rows:o,alignButtons:a,setAttributes:n,minColumns:Object(ne.getSetting)("min_columns",1),maxColumns:Object(ne.getSetting)("max_columns",6),minRows:Object(ne.getSetting)("min_rows",1),maxRows:Object(ne.getSetting)("max_rows",6)})),Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Content Settings","woo-gutenberg-products-block")},Yt(r,n),Ut(r,n)))})),c()(kt()(e),"getBlockControls",(function(){var t=e.state.isEditing;return Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(h.ToolbarGroup,{controls:[{icon:"edit",title:Object(s.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return e.togglePreview()},isActive:t}]}))})),c()(kt()(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(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)(h.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:At.a[0]},Object(i.createElement)(u.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,onClick:function(){var t=e.props,r=t.block;(0,t.setAttributes)({layoutConfig:qt(r.innerBlocks)}),e.setState({innerBlocks:r.innerBlocks}),e.togglePreview()}},Object(s.__)("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(s.__)("Cancel","woo-gutenberg-products-block")),Object(i.createElement)(h.Button,{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=[];Ht.map((function(e){var t=_()(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()(kt()(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)(kr,{attributes:t})):zt(c,o)})),c()(kt()(e),"render",(function(){var t=e.props.attributes,r=e.state.isEditing,n=e.getTitle(),c=e.getIcon();return 0===f.q.productCount?Vt(n,c):Object(i.createElement)("div",{className:It("wc-block-all-products",t)},e.getBlockControls(),e.getInspectorControls(),r?e.renderEditMode():e.renderViewMode())})),e}return o}(i.Component),Cr=Object(v.compose)(h.withSpokenMessages,Object(Bt.withSelect)((function(e,t){var r=t.clientId;return{block:(0,e("core/block-editor").getBlock)(r)}})),Object(Bt.withDispatch)((function(e){return{replaceInnerBlocks:e("core/block-editor").replaceInnerBlocks}})))(Pr),Sr={columns:Object(ne.getSetting)("default_columns",3),rows:Object(ne.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ht,isPreview:!1};function xr(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 Nr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Dr={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:Sr,edit:function(e){return Object(i.createElement)(Cr,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:It("wc-block-all-products",t)},n),Object(i.createElement)(u.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",Nr(Nr({},Dr),{},{deprecated:[{attributes:Object.assign({},Dr.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:It("wc-block-all-products",t)},r),Object(i.createElement)(u.InnerBlocks.Content,null))}}]}))},82:function(e,t){e.exports=window.wc.wcBlocksSharedHocs},83:function(e,t){e.exports=window.ReactDOM},84:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(16),a=r.n(o),i=r(17),s=r.n(i),u=r(13),l=r.n(u),b=r(18),p=r.n(b),d=r(19),f=r.n(d),m=r(10),O=r.n(m),g=r(0),j=r(7),h=r(6),v=r.n(h),w=r(4),y=r(22);r(124);var E=function(e){p()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=O()(t);if(r){var c=O()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return f()(this,e)});function o(){var e;return a()(this,o),(e=n.apply(this,arguments)).onClick=e.onClick.bind(l()(e)),e}return s()(o,[{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)(w.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)(w.ButtonGroup,{"aria-labelledby":b+"__label"},u.map((function(e,r){var o={};return l===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!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)}))))}}]),o}(g.Component);t.a=Object(y.withInstanceId)(E)},842:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(56),c=r(0),o=r(11);r.p=o.o,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(12)]).then(r.bind(null,479))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(4),r.e(11)]).then(r.bind(null,866))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(18)]).then(r.bind(null,867))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(c.lazy)((function(){return r.e(13).then(r.bind(null,480))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(3),r.e(9)]).then(r.bind(null,481))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(c.lazy)((function(){return r.e(16).then(r.bind(null,483))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(c.lazy)((function(){return r.e(4).then(r.bind(null,303))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(c.lazy)((function(){return r.e(14).then(r.bind(null,484))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(c.lazy)((function(){return r.e(10).then(r.bind(null,485))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(c.lazy)((function(){return r.e(17).then(r.bind(null,486))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(c.lazy)((function(){return r.e(15).then(r.bind(null,487))}))}),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(3),r.e(8)]).then(r.bind(null,868))}))});var a=function(e){return Object(n.getRegisteredBlockComponents)(e)}},847: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")}},86:function(e,t){e.exports=window.wp.viewport},87:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(181),u=r(6),l=r.n(u),b=r(114),p=(r(205),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,p),d=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(i.createElement)(s.a,c()({className:d},u),n&&Object(i.createElement)(b.a,null),Object(i.createElement)("span",{className:"wc-block-components-button__text"},o))}},88:function(e,t){e.exports=window.wp.autop},91:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(7),a=(r(2),r(4));t.a=function(e){var t=e.columns,r=e.rows,i=e.setAttributes,s=e.alignButtons,u=e.minColumns,l=void 0===u?1:u,b=e.maxColumns,p=void 0===b?6:b,d=e.minRows,f=void 0===d?1:d,m=e.maxRows,O=void 0===m?6:m;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,l,p);i({columns:Number.isNaN(t)?"":t})},min:l,max:p}),Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Rows","woo-gutenberg-products-block"),value:r,onChange:function(e){var t=Object(o.clamp)(e,f,O);i({rows:Number.isNaN(t)?"":t})},min:f,max:O}),Object(n.createElement)(a.ToggleControl,{label:Object(c.__)("Align Last Block","woo-gutenberg-products-block"),help:s?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:s,onChange:function(){return i({alignButtons:!s})}}))}},92: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},95:function(e,t){e.exports=window.wp.date}});
|
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={6:0,1:0,3:0,4:0,9:0,10:0,12:0,13:0,14:0,15:0,16:0,17: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/button--atomic-block-components/image---a7e2bb9b",2:"atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title",3:"atomic-block-components/add-to-cart--atomic-block-components/button",4:"atomic-block-components/sale-badge",8:"atomic-block-components/add-to-cart",9:"atomic-block-components/button",10:"atomic-block-components/category-list",11:"atomic-block-components/image",12:"atomic-block-components/price",13:"atomic-block-components/rating",14:"atomic-block-components/sku",15:"atomic-block-components/stock-indicator",16:"atomic-block-components/summary",17:"atomic-block-components/tag-list",18:"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([767,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},105:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"c",(function(){return a})),r.d(t,"b",(function(){return i})),r.d(t,"d",(function(){return s}));var n=r(38),c=r.n(n),o=function(e){return"number"==typeof e},a=function(e){return"string"==typeof e},i=function(e){return!function(e){return null===e}(e)&&"object"===c()(e)};function s(e,t){return i(e)&&t in e}},109:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"c",(function(){return m}));var n=r(8),c=r.n(n),o=r(27),a=r(17),i=r(0),s=r(34),u=r.n(s),l=r(61),b=r(151),p=r(76),d=function(e){var t=Object(p.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,n])]},f=function(e,t,r){var n=Object(p.a)();r=r||n;var c=Object(a.useSelect)((function(n){return n(o.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)}),[r,e]),s=Object(a.useDispatch)(o.QUERY_STATE_STORE_KEY).setQueryValue;return[c,Object(i.useCallback)((function(t){s(r,e,t)}),[r,e,s])]},m=function(e,t){var r=Object(p.a)(),n=d(t=t||r),o=c()(n,2),a=o[0],s=o[1],f=Object(l.a)(a),m=Object(l.a)(e),O=Object(b.a)(m),g=Object(i.useRef)(!1);return Object(i.useEffect)((function(){u()(O,m)||(s(Object.assign({},f,m)),g.current=!0)}),[f,m,O,s]),g.current?[a,s]:[e,s]}},11:function(e,t,r){"use strict";r.d(t,"q",(function(){return o})),r.d(t,"p",(function(){return a})),r.d(t,"o",(function(){return i})),r.d(t,"l",(function(){return u})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return b})),r.d(t,"i",(function(){return p})),r.d(t,"h",(function(){return d})),r.d(t,"n",(function(){return f})),r.d(t,"m",(function(){return m})),r.d(t,"c",(function(){return O})),r.d(t,"d",(function(){return g})),r.d(t,"g",(function(){return j})),r.d(t,"j",(function(){return h})),r.d(t,"a",(function(){return v})),r.d(t,"k",(function(){return w})),r.d(t,"b",(function(){return y})),r.d(t,"t",(function(){return _})),r.d(t,"u",(function(){return k})),r.d(t,"r",(function(){return P})),r.d(t,"s",(function(){return C}));var n,c=r(3),o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=o.pluginUrl+"images/",i=o.pluginUrl+"build/",s=o.buildPhase,u=null===(n=c.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,l=c.STORE_PAGES.checkout.id,b=c.STORE_PAGES.checkout.permalink,p=c.STORE_PAGES.privacy.permalink,d=c.STORE_PAGES.privacy.title,f=c.STORE_PAGES.terms.permalink,m=c.STORE_PAGES.terms.title,O=c.STORE_PAGES.cart.id,g=c.STORE_PAGES.cart.permalink,j=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),h=Object(c.getSetting)("shippingCountries",{}),v=Object(c.getSetting)("allowedCountries",{}),w=Object(c.getSetting)("shippingStates",{}),y=Object(c.getSetting)("allowedStates",{}),E=r(25),_=function(e,t){if(s>2)return Object(E.registerBlockType)(e,t)},k=function(e,t){if(s>1)return Object(E.registerBlockType)(e,t)},P=function(){return s>2},C=function(){return s>1}},114:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(8),a=r.n(o),i=r(3),s=r(1),u=r(105);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=Object(i.getSetting)("countryLocale",{}),d=function(e){var t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(s.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
+
Object(s.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(u.a)(e.priority)&&(t.index=e.priority),Object(u.c)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},f=Object.entries(p).map((function(e){var t=a()(e,2),r=t[0],n=t[1];return[r,Object.entries(n).map((function(e){var t=a()(e,2),r=t[0],n=t[1];return[r,d(n)]})).reduce((function(e,t){var r=a()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{})]})).reduce((function(e,t){var r=a()(t,2),n=r[0],c=r[1];return e[n]=c,e}),{});t.a=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==f[r]?f[r]:{};return e.map((function(e){var r=i.defaultAddressFields[e]||{},c=n[e]||{},o=t[e]||{};return b(b(b({key:e},r),c),o)})).sort((function(e,t){return e.index-t.index}))}},115:function(e,t,r){"use strict";var n=r(0);r(209),t.a=function(){return Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})}},119:function(e,t){e.exports=window.wp.wordcount},12:function(e,t){e.exports=window.React},123:function(e,t){},124:function(e,t){e.exports=window.wp.coreData},125:function(e,t){},127:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(0),a=r(1),i=r(53),s=r(6),u=r.n(s),l=(r(2),r(47)),b=(r(206),function(e){var t=e.currency,r=e.maxPrice,n=e.minPrice,c=e.priceClassName,s=e.priceStyle;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(a.sprintf)(
|
4 |
/* translators: %1$s min price, %2$s max price */
|
5 |
+
Object(a.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(n),Object(l.formatPrice)(r))),Object(o.createElement)("span",{"aria-hidden":!0},Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",c),currency:t,value:n,style:s})," — ",Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",c),currency:t,value:r,style:s})))}),p=function(e){var t=e.currency,r=e.regularPriceClassName,n=e.regularPriceStyle,c=e.regularPrice,s=e.priceClassName,l=e.priceStyle,b=e.price;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Previous price:","woo-gutenberg-products-block")),Object(o.createElement)(i.a,{currency:t,renderText:function(e){return Object(o.createElement)("del",{className:u()("wc-block-components-product-price__regular",r),style:n},e)},value:c}),Object(o.createElement)("span",{className:"screen-reader-text"},Object(a.__)("Discounted price:","woo-gutenberg-products-block")),Object(o.createElement)(i.a,{currency:t,renderText:function(e){return Object(o.createElement)("ins",{className:u()("wc-block-components-product-price__value","is-discounted",s),style:l},e)},value:b}))};t.a=function(e){var t=e.align,r=e.className,n=e.currency,a=e.format,s=void 0===a?"<price/>":a,l=e.maxPrice,d=void 0===l?null:l,f=e.minPrice,m=void 0===f?null:f,O=e.price,g=void 0===O?null:O,j=e.priceClassName,h=e.priceStyle,v=e.regularPrice,w=e.regularPriceClassName,y=e.regularPriceStyle,E=u()(r,"price","wc-block-components-product-price",c()({},"wc-block-components-product-price--align-".concat(t),t));s.includes("<price/>")||(s="<price/>",console.error("Price formats need to include the `<price/>` tag."));var _=v&&g!==v,k=Object(o.createElement)("span",{className:u()("wc-block-components-product-price__value",j)});return _?k=Object(o.createElement)(p,{currency:n,price:g,priceClassName:j,priceStyle:h,regularPrice:v,regularPriceClassName:w,regularPriceStyle:y}):null!==m&&null!==d?k=Object(o.createElement)(b,{currency:n,maxPrice:d,minPrice:m,priceClassName:j,priceStyle:h}):null!==g&&(k=Object(o.createElement)(i.a,{className:u()("wc-block-components-product-price__value",j),currency:n,value:g,style:h})),Object(o.createElement)("span",{className:E},Object(o.createInterpolateElement)(s,{price:k}))}},129:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b}));var n,c=r(5),o=r.n(c),a=r(7);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){o()(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,i=t.callback,u=t.priority,b=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return b.set(a,{priority:u,callback:i}),s(s({},e),{},o()({},c,b));case n.REMOVE_EVENT_CALLBACK:return b.delete(a),s(s({},e),{},o()({},c,b))}}},130:function(e,t,r){"use strict";r.d(t,"b",(function(){return w})),r.d(t,"a",(function(){return y}));var n=r(5),c=r.n(n),o=r(8),a=r.n(o),i=r(0),s=(r(2),r(17)),u=r(66),l=r(60),b=r(9),p=r.n(b),d=r(6),f=r.n(d),m=r(868),O=(r(207),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""}),g=function(e){var t=e.className,r=e.notices,n=e.removeNotice,c=r.filter((function(e){return"snackbar"!==e.type}));if(!c.length)return null;var o=f()(t,"wc-block-components-notices");return Object(i.createElement)("div",{className:o},c.map((function(e){return Object(i.createElement)(m.a,p()({key:"store-notice-"+e.id},e,{className:f()("wc-block-components-notices__notice",O(e)),onRemove:function(){e.isDismissible&&n(e.id)}}),e.content)})))};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 h(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){c()(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 v=Object(i.createContext)({notices:[],createNotice:function(e,t,r){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),w=function(){return Object(i.useContext)(v)},y=function(e){var t=e.children,r=e.className,n=void 0===r?"":r,c=e.createNoticeContainer,o=void 0===c||c,b=e.context,p=void 0===b?"wc/core":b,d=Object(s.useDispatch)("core/notices"),f=d.createNotice,m=d.removeNotice,O=Object(i.useState)(!1),j=a()(O,2),w=j[0],y=j[1],E=Object(u.a)().dispatchStoreEvent,_=Object(l.b)().isEditor,k=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]:{};f(e,t,h(h({},r),{},{context:r.context||p})),E("store-notice-create",{status:e,content:t,options:r})}),[f,E,p]),P=Object(i.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;m(e,t)}),[m,p]),C={notices:Object(s.useSelect)((function(e){return{notices:e("core/notices").getNotices(p)}}),[p]).notices,createNotice:k,removeNotice:P,context:p,setIsSuppressed:y},S=w?null:Object(i.createElement)(g,{className:n,notices:C.notices,removeNotice:C.removeNotice,isEditor:_});return Object(i.createElement)(v.Provider,{value:C},o&&S,t)}},131:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(8),c=r.n(n),o=r(0),a=function(){var e=Object(o.useState)(),t=c()(e,2)[1];return Object(o.useCallback)((function(e){t((function(){throw e}))}),[])}},135:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(48),u=r(4),l=r(6),b=r.n(l),p=["className","item","isSelected","isLoading","onSelect","disabled"];t.a=function(e){var t=e.className,r=e.item,n=e.isSelected,o=e.isLoading,l=e.onSelect,d=e.disabled,f=a()(e,p);return Object(i.createElement)(i.Fragment,null,Object(i.createElement)(s.c,c()({},f,{key:r.id,className:t,isSelected:n,item:r,onSelect:l,isSingle:!0,disabled:d})),n&&o&&Object(i.createElement)("div",{key:"loading",className:b()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(i.createElement)(u.Spinner,null)))}},136:function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return v}));var n=r(38),c=r.n(n),o=r(5),a=r.n(o),i=r(14),s=r.n(i),u=r(8),l=r.n(u),b=r(0),p=r(7),d=r(34),f=r.n(d);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){a()(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}function g(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var j=Object(b.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}}),h=function(){return Object(b.useContext)(j)},v=function(e){var t=e.children,r=Object(b.useState)({}),n=l()(r,2),c=n[0],o=n[1],i=Object(b.useCallback)((function(e){return c[e]}),[c]),u=Object(b.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),d=Object(b.useCallback)((function(e){o((function(t){return t[e]?(t[e],s()(t,[e].map(g))):t}))}),[]),m=Object(b.useCallback)((function(){o({})}),[]),h=Object(b.useCallback)((function(e){e&&o((function(t){return e=Object(p.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&f()(t[r],e))})),0===Object.values(e).length?t:O(O({},t),e)}))}),[]),v=Object(b.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=O(O({},r[e]),t);return f()(r[e],n)?r:O(O({},r),{},a()({},e,n))}))}),[]),w={getValidationError:i,setValidationErrors:h,clearValidationError:d,clearAllValidationErrors:m,hideValidationError:Object(b.useCallback)((function(e){v(e,{hidden:!0})}),[v]),showValidationError:Object(b.useCallback)((function(e){v(e,{hidden:!1})}),[v]),showAllValidationErrors:Object(b.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=O(O({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:O(O({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return Object(b.createElement)(j.Provider,{value:w},t)}},137:function(e,t,r){"use strict";var n=r(16),c=r.n(n),o=r(18),a=r.n(o),i=r(19),s=r.n(i),u=r(20),l=r.n(u),b=r(10),p=r.n(b),d=r(0),f=r(7),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}var j=function(e){s()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=p()(t);if(r){var c=p()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return l()(this,e)});function o(){return c()(this,o),n.apply(this,arguments)}return a()(o,[{key:"createLevelControl",value:function(e,t,r){var n=e===t;return{icon:Object(d.createElement)(g,{level:e}),
|
6 |
+
/* translators: %s: heading level e.g: "2", "3", "4" */
|
7 |
+
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.ToolbarGroup,{isCollapsed:n,icon:Object(d.createElement)(g,{level:a}),controls:Object(f.range)(c,o).map((function(t){return e.createLevelControl(t,a,i)}))})}}]),o}(d.Component);t.a=j},143:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(8),c=r.n(n),o=function(e){return e.reduce((function(e,t){var r=c()(t,2),n=r[0],o=r[1];return e[n]=o,e}),{})}},144:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(62),a=r(164),i=r(3),s=r(21),u=r(44);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}},15:function(e,t){e.exports=window.wp.apiFetch},151:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){var r=Object(n.useRef)();return Object(n.useEffect)((function(){r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},154:function(e,t,r){"use strict";var n=r(35),c=r.n(n),o=r(5),a=r.n(o),i=r(9),s=r.n(i),u=r(0),l=r(1),b=r(7),p=(r(2),r(48)),d=r(22),f=r(16),m=r.n(f),O=r(18),g=r.n(O),j=r(19),h=r.n(j),v=r(20),w=r.n(v),y=r(10),E=r.n(y);var _=Object(d.createHigherOrderComponent)((function(e){var t=function(t){h()(o,t);var r,n,c=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E()(r);if(n){var c=E()(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return w()(this,e)});function o(){return m()(this,o),c.apply(this,arguments)}return g()(o,[{key:"render",value:function(){var t=this.props.selected,r=null==t;return Object(u.createElement)(e,s()({},this.props,{selected:r?[]:[t]}))}}]),o}(u.Component);return t.defaultProps={selected:null},t}),"withTransformSingleSelectToMultipleSelect"),k=r(304),P=r(28),C=r.n(P),S=r(13),x=r.n(S),N=r(23),D=r.n(N),B=r(34),R=r.n(B),T=r(40),A=r(43);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 L(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){a()(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 z=Object(d.createHigherOrderComponent)((function(e){var t=function(t){h()(o,t);var r,n,c=(r=o,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=E()(r);if(n){var c=E()(this).constructor;e=Reflect.construct(t,arguments,c)}else e=t.apply(this,arguments);return w()(this,e)});function o(){var e;m()(this,o);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=c.call.apply(c,[this].concat(r)),a()(x()(e),"state",{error:null,loading:!1,variations:{}}),a()(x()(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 i=t.find((function(e){return e.id===o}));i.variations&&0!==i.variations.length?(e.setState({loading:!0}),Object(T.g)(o).then((function(t){var r=t.map((function(e){return L(L({},e),{},{parent:o})}));e.setState({variations:L(L({},e.state.variations),{},a()({},o,r)),loading:!1,error:null})})).catch(function(){var t=C()(D.a.mark((function t(r){var n;return D.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:L(L({},e.state.variations),{},a()({},o,null)),loading:!1,error:n});case 4:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}())):e.setState({variations:L(L({},e.state.variations),{},a()({},o,null)),loading:!1,error:null})}}})),e}return g()(o,[{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,a=c.loading,i=c.variations;return Object(u.createElement)(e,s()({},this.props,{error:o||r,expandedProduct:this.getExpandedProduct(),isLoading:n,variations:i,variationsLoading:a}))}}]),o}(u.Component);return a()(t,"defaultProps",{selected:[],showVariations:!1}),t}),"withProductVariations"),V=r(52),F=r(6),M=r.n(F),H=r(135);function q(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?q(Object(r),!0).forEach((function(t){a()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}r(214);var Q={list:Object(l.__)("Products","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(l.__)("Product search results updated.","woo-gutenberg-products-block")},Y=function(e){var t=e.expandedProduct,r=e.error,n=e.instanceId,o=e.isCompact,a=e.isLoading,i=e.onChange,d=e.onSearch,f=e.products,m=e.renderItem,O=e.selected,g=e.showVariations,j=e.variations,h=e.variationsLoading;if(r)return Object(u.createElement)(V.a,{error:r});var v=j&&j[t]?j[t]:[],w=[].concat(c()(f),c()(v));return Object(u.createElement)(p.b,{className:"woocommerce-products",list:w,isCompact:o,isLoading:a,isSingle:!0,selected:w.filter((function(e){var t=e.id;return O.includes(t)})),onChange:i,renderItem:m||(g?function(e){var t=e.item,r=e.search,c=e.depth,o=void 0===c?0:c,i=e.isSelected,d=e.onSelect,f=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=M()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(o),"has-count",{"is-searching":r.length>0,"is-skip-level":0===o&&0!==t.parent,"is-variable":f>0});if(!t.breadcrumbs.length)return Object(u.createElement)(H.a,s()({},e,{className:M()(m,{"is-selected":i}),isSelected:i,item:t,onSelect:function(){return function(){d(t)()}},isLoading:a||h,countLabel:t.variations.length>0?Object(l.sprintf)(
|
8 |
/* translators: %1$d is the number of variations of a product product. */
|
9 |
Object(l.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-".concat(n),"aria-label":Object(l.sprintf)(
|
10 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
11 |
+
Object(l._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));var O=Object(b.isEmpty)(t.variation)?e:G(G({},e),{},{item:G(G({},e.item),{},{name:t.variation}),"aria-label":"".concat(t.breadcrumbs[0],": ").concat(t.variation)});return Object(u.createElement)(p.c,s()({},O,{className:m,name:"variations-".concat(n)}))}:null),onSearch:d,messages:Q,isHierarchical:!0})};Y.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=_(Object(k.a)(z(Object(d.withInstanceId)(Y))))},155:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},160:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(26),u=r(6),l=r.n(u),b=(r(205),["className","disabled","name","permalink"]);t.a=function(e){var t=e.className,r=void 0===t?"":t,n=e.disabled,o=void 0!==n&&n,u=e.name,p=e.permalink,d=void 0===p?"":p,f=a()(e,b),m=l()("wc-block-components-product-name",r);return o?Object(i.createElement)("span",c()({className:m},f,{dangerouslySetInnerHTML:{__html:Object(s.decodeEntities)(u)}})):Object(i.createElement)("a",c()({className:m,href:d},f,{dangerouslySetInnerHTML:{__html:Object(s.decodeEntities)(u)}}))}},161:function(e,t,r){"use strict";var n=r(0),c=r(119),o=r(90),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)}},162:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(6)),o=r.n(c),a=r(41),i=r(22);r(216),t.a=Object(i.withInstanceId)((function(e){var t=e.className,r=e.instanceId,c=e.label,i=e.onChange,s=e.options,u=e.screenReaderLabel,l=e.readOnly,b=e.value,p="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:c,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",onChange:i,readOnly:l,value:b},s.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},164:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},167:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return s}));var n=r(3),c=r(114),o=r(24),a=function(e){var t=e.country,r=void 0===t?"":t,n=e.state,c=void 0===n?"":n,o=e.city,a=void 0===o?"":o,i=e.postcode,s=void 0===i?"":i;return{country:r.trim(),state:c.trim(),city:a.trim(),postcode:s?s.replace(" ","").toUpperCase():""}},i=function(e){var t=e.email,r=void 0===t?"":t;return Object(o.isEmail)(r)?r.trim():""},s=function(e){var t=Object.keys(n.defaultAddressFields),r=Object(c.a)(t,{},e.country),o=Object.assign({},e);return r.forEach((function(t){var r=t.key,n=void 0===r?"":r,c=t.hidden;void 0!==c&&c&&function(e,t){return e in t}(n,e)&&(o[n]="")})),o}},168:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(27),c=r(17),o=r(0),a=r(61),i=r(131),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(a.a)(b),O=Object(a.a)(u),g=Object(i.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}},17:function(e,t){e.exports=window.wp.data},175:function(e,t){},189:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),c=Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(n.createElement)("title",null,"Grid Block Preview"),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},192:function(e,t){e.exports=window.wp.warning},195:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(0),a=(r(258),function(e){if(e){var t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()}});t.a=function(e){return function(t){var r=Object(o.useRef)(null);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(o.createElement)(e,c()({},t,{scrollToTop:function(e){var t,n;null!==r.current&&(t=r.current,n=(e||{}).focusableSelector,window&&Number.isFinite(window.innerHeight)&&(n?function(e,t){var r,n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){var c=n[0];a(c),null==c||c.focus()}else a(e)}(t,n):a(t)))}})))}}},205:function(e,t){},206:function(e,t){},207:function(e,t){},208:function(e,t){},209:function(e,t){},21:function(e,t){e.exports=window.wp.blockEditor},210:function(e,t){},214:function(e,t){},216:function(e,t){},22:function(e,t){e.exports=window.wp.compose},23:function(e,t){e.exports=window.regeneratorRuntime},232:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=(r(2),r(136)),o=(r(210),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||"string"!=typeof 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))})},24:function(e,t){e.exports=window.wp.url},25:function(e,t){e.exports=window.wp.blocks},258:function(e,t){},26:function(e,t){e.exports=window.wp.htmlEntities},27:function(e,t){e.exports=window.wc.wcBlocksData},3:function(e,t){e.exports=window.wc.wcSettings},304:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(28),a=r.n(o),i=r(8),s=r.n(i),u=r(14),l=r.n(u),b=r(0),p=r(23),d=r.n(p),f=r(11),m=r(40),O=r(222),g=r(43),j=["selected"];t.a=function(e){return function(t){var r=t.selected,n=l()(t,j),o=Object(b.useState)(!0),i=s()(o,2),u=i[0],p=i[1],h=Object(b.useState)(null),v=s()(h,2),w=v[0],y=v[1],E=Object(b.useState)([]),_=s()(E,2),k=_[0],P=_[1],C=f.q.productCount>100,S=function(){var e=a()(d.a.mark((function e(t){var r;return d.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(g.a)(t);case 2:r=e.sent,y(r),p(!1);case 5:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}();Object(b.useEffect)((function(){Object(m.h)({selected:r}).then((function(e){P(e),p(!1)})).catch(S)}),[r]);var x=Object(O.a)((function(e){Object(m.h)({selected:r,search:e}).then((function(e){P(e),p(!1)})).catch(S)}),400),N=s()(x,1)[0],D=Object(b.useCallback)((function(e){p(!0),N(e)}),[p,N]);return Object(b.createElement)(e,c()({},n,{selected:r,error:w,products:k,isLoading:u,onSearch:C?D:null}))}}},305:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},306:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(6),s=r.n(i),u=r(41),l=r(44),b=r(84);r(539),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")}))}))},309:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},31:function(e,t){e.exports=window.moment},321:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(129),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))}}}},322:function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f}));var n=r(38),c=r.n(n),o=r(28),a=r.n(o),i=r(23),s=r.n(i),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(51);function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return p(e,void 0);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)?p(e,void 0):void 0}}(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=r.call(e)},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 p(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(){var e=a()(s.a.mark((function e(t,r,n){var o,a,i,l,p,d;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],i=b(o),e.prev=3,i.s();case 5:if((l=i.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"===c()(d)&&a.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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),f=function(){var e=a()(s.a.mark((function e(t,r,n){var o,a,i,p,d,f;return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),i=b(a),e.prev=3,i.s();case 5:if((p=i.n()).done){e.next=28;break}return d=p.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:if(f=e.sent,"object"===c()(f)&&null!==f){e.next=13;break}return e.abrupt("continue",26);case 13:if(f.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(f)&&!Object(l.b)(f)){e.next=18;break}return o.push(f),e.abrupt("return",o);case 18:o.push(f),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),i.e(e.t1);case 33:return e.prev=33,i.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},33:function(e,t){e.exports=window.wp.primitives},34:function(e,t){e.exports=window.wp.isShallowEqual},37:function(e,t){e.exports=window.wp.dataControls},374:function(e,t){},375:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(11);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},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(o.s)()&&(s=i(i({},s),{},{align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}})),t.a=s},376:function(e,t,r){"use strict";t.a={showProductLink:{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}}},377:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(5),a=r.n(o),i=r(8),s=r.n(i),u=r(0),l=(r(2),r(1)),b=r(6),p=r.n(b),d=r(3),f=r(44),m=r(84),O=r(66),g=r(306);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 h(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){a()(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}r(540);var v=function(){return Object(u.createElement)("img",{src:d.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500})},w=function(e){var t=e.image,r=e.onLoad,n=e.loaded,o=e.showFullSize,a=e.fallbackAlt,i=t||{},s=i.thumbnail,l=i.src,b=i.srcset,p=i.sizes,d=h({alt:i.alt||a,onLoad:r,hidden:!n,src:s},o&&{src:l,srcSet:b,sizes:p});return Object(u.createElement)(u.Fragment,null,d.src&&Object(u.createElement)("img",c()({"data-testid":"product-image"},d)),!n&&Object(u.createElement)(v,null))};t.a=Object(m.withProductDataContext)((function(e){var t=e.className,r=e.imageSizing,n=void 0===r?"full-size":r,c=e.showProductLink,o=void 0===c||c,i=e.showSaleBadge,b=e.saleBadgeAlign,d=void 0===b?"right":b,m=Object(f.useInnerBlockLayoutContext)().parentClassName,j=Object(f.useProductDataContext)().product,y=Object(u.useState)(!1),E=s()(y,2),_=E[0],k=E[1],P=Object(O.a)().dispatchStoreEvent;if(!j.id)return Object(u.createElement)("div",{className:p()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",a()({},"".concat(m,"__product-image"),m))},Object(u.createElement)(v,null));var C=!!j.images.length,S=C?j.images[0]:null,x=o?"a":u.Fragment,N=Object(l.sprintf)(
|
|
|
|
|
12 |
/* translators: %s is referring to the product name */
|
13 |
+
Object(l.__)("Link to %s","woo-gutenberg-products-block"),j.name),D=h(h({href:j.permalink,rel:"nofollow"},!C&&{"aria-label":N}),{},{onClick:function(){P("product-view-link",{product:j})}});return Object(u.createElement)("div",{className:p()(t,"wc-block-components-product-image",a()({},"".concat(m,"__product-image"),m))},Object(u.createElement)(x,o&&D,!!i&&Object(u.createElement)(g.default,{align:d,product:j}),Object(u.createElement)(w,{fallbackAlt:j.name,image:S,onLoad:function(){return k(!0)},loaded:_,showFullSize:"cropped"!==n})))}))},378:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},379:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(6)),o=r.n(c),a=r(8),i=r.n(a),s=r(1),u=r(61),l=r(856),b={status:"pristine",hasError:!1,quantity:1,processingResponse:null,requestParams:{}},p=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"set_has_error":"set_no_error";return{type:t}},d=r(5),f=r.n(d);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){f()(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="idle",j=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case"set_pristine":e=b;break;case"set_idle":e=t.status!==g?O(O({},t),{},{status:g}):t;break;case"set_disabled":e="disabled"!==t.status?O(O({},t),{},{status:"disabled"}):t;break;case"set_quantity":e=n!==t.quantity?O(O({},t),{},{quantity:n}):t;break;case"set_request_params":e=O(O({},t),{},{requestParams:O(O({},t.requestParams),o)});break;case"set_processing_response":e=O(O({},t),{},{processingResponse:o});break;case"set_processing":e=!1===(e="processing"!==t.status?O(O({},t),{},{status:"processing",hasError:!1}):t).hasError?e:O(O({},e),{},{hasError:!1});break;case"set_before_processing":e="before_processing"!==t.status?O(O({},t),{},{status:"before_processing",hasError:!1}):t;break;case"set_after_processing":e="after_processing"!==t.status?O(O({},t),{},{status:"after_processing"}):t;break;case"set_has_error":e=t.hasError?t:O(O({},t),{},{hasError:!0}),e="processing"===t.status||"before_processing"===t.status?O(O({},e),{},{status:g}):e;break;case"set_no_error":e=t.hasError?O(O({},t),{},{hasError:!1}):t}return e!==t&&"set_pristine"!==c&&"pristine"===e.status&&(e.status=g),e},h=r(129),v=r(321),w=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(v.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(v.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(v.a)("add_to_cart_before_processing",e)}},y=r(322),E=r(136),_=r(57),k=r(51),P=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){}}}),C=function(){return Object(n.useContext)(P)},S=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=Object(n.useReducer)(j,b),a=i()(o,2),d=a[0],f=a[1],m=Object(n.useReducer)(h.b,{}),O=i()(m,2),g=O[0],v=O[1],C=Object(u.a)(g),S=Object(_.a)(),x=S.addErrorNotice,N=S.removeNotices,D=Object(E.b)().setValidationErrors,B=Object(k.c)(),R=B.isSuccessResponse,T=B.isErrorResponse,A=B.isFailResponse,I=Object(n.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:w(v).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:w(v).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:w(v).onAddToCartBeforeProcessing}}),[v]),L=Object(n.useMemo)((function(){return{resetForm:function(){f({type:"set_pristine"})},submitForm:function(){f({type:"set_before_processing"})},setQuantity:function(e){f(function(e){return{type:"set_quantity",quantity:e}}(e))},setHasError:function(e){f(p(e))},setRequestParams:function(e){f(function(e){return{type:"set_request_params",data:e}}(e))},setAfterProcessing:function(e){f({type:"set_processing_response",data:e}),f({type:"set_after_processing"})}}}),[]);Object(n.useEffect)((function(){var e=d.status,t=!r.id||!Object(l.a)(r);"disabled"!==e||t?"disabled"!==e&&t&&f({type:"set_disabled"}):f({type:"set_idle"})}),[d.status,r,f]),Object(n.useEffect)((function(){"before_processing"===d.status&&(N("error"),Object(y.a)(C,"add_to_cart_before_processing",{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&x(t),r&&D(r)})),f({type:"set_idle"})):f({type:"set_processing"})})))}),[d.status,D,x,N,f,C]),Object(n.useEffect)((function(){if("after_processing"===d.status){var e={processingResponse:d.processingResponse},t=function(e){var t=!1;return e.forEach((function(e){var r=e.message,n=e.messageContext;(T(e)||A(e))&&r&&(t=!0,x(r,n?{context:n}:void 0))})),t};if(d.hasError)return void Object(y.b)(C,"add_to_cart_after_processing_with_error",e).then((function(r){if(!t(r)){var n,c=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(s.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");x(c,{id:"add-to-cart"})}f({type:"set_idle"})}));Object(y.b)(C,"add_to_cart_after_processing_with_success",e).then((function(e){t(e)?f(p(!0)):f({type:"set_idle"})}))}}),[d.status,d.hasError,d.processingResponse,L,x,T,A,R,C]);var z=Object(l.b)(r),V={product:r,productType:r.type||"simple",productIsPurchasable:Object(l.a)(r),productHasOptions:r.has_options||!1,supportsFormElements:z,showFormElements:c&&z,quantity:d.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:d.requestParams,isIdle:"idle"===d.status,isDisabled:"disabled"===d.status,isProcessing:"processing"===d.status,isBeforeProcessing:"before_processing"===d.status,isAfterProcessing:"after_processing"===d.status,hasError:d.hasError,eventRegistration:I,dispatchActions:L};return Object(n.createElement)(P.Provider,{value:V},t)},x=r(15),N=r.n(x),D=r(26),B=r(45);function R(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 T=function(){var e=C(),t=e.dispatchActions,r=e.product,c=e.quantity,o=e.eventRegistration,a=e.hasError,u=e.isProcessing,l=e.requestParams,b=Object(E.b)(),p=b.hasValidationErrors,d=b.showAllValidationErrors,m=Object(_.a)(),O=m.addErrorNotice,g=m.removeNotice,j=Object(B.a)().receiveCart,h=Object(n.useState)(!1),v=i()(h,2),w=v[0],y=v[1],k=!a&&u,P=Object(n.useCallback)((function(){return!p||(d(),{type:"error"})}),[p,d]);Object(n.useEffect)((function(){var e=o.onAddToCartBeforeProcessing(P,0);return function(){e()}}),[o,P]);var S=Object(n.useCallback)((function(){y(!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?R(Object(r),!0).forEach((function(t){f()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({id:r.id||0,quantity:c},l);N()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){N.a.setNonce(e.headers),e.json().then((function(r){e.ok?j(r):(r.body&&r.body.message?O(Object(D.decodeEntities)(r.body.message),{id:"add-to-cart"}):O(Object(s.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),y(!1)}))})).catch((function(e){e.json().then((function(e){var r;null!==(r=e.data)&&void 0!==r&&r.cart&&j(e.data.cart),t.setHasError(),t.setAfterProcessing(e),y(!1)}))}))}),[r,O,g,j,t,c,l]);return Object(n.useEffect)((function(){k&&!w&&S()}),[k,S,w]),null},A=function(e){var t=e.children,r=e.product,c=e.showFormElements;return Object(n.createElement)(E.a,null,Object(n.createElement)(S,{product:r,showFormElements:c},t,Object(n.createElement)(T,null)))},I=r(44),L=r(7),z=r(84),V=(r(374),r(89)),F=r(62),M=r(309),H=r(66),q=r(770),G=function(e){var t=e.className,r=e.href,c=e.text,o=e.onClick;return Object(n.createElement)(V.a,{className:t,href:r,onClick:o,rel:"nofollow"},c)},Q=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)(V.a,{className:t,disabled:o,showSpinner:c,onClick:i},a&&r>0?Object(s.sprintf)(
|
14 |
/* translators: %s number of products in cart. */
|
15 |
+
Object(s._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(s.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(F.a,{srcElement:M.a,alt:Object(s.__)("Done","woo-gutenberg-products-block")}))},Y=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,u=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,p=e.hasError,d=e.dispatchActions,f=Object(I.useInnerBlockLayoutContext)().parentName,m=Object(H.a)().dispatchStoreEvent,O=Object(q.a)(o.id||0).cartQuantity,g=Object(n.useState)(!1),j=i()(g,2),h=j[0],v=j[1],w=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return p||v(!0),!0}),0);return function(){e()}}),[b,p]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(Q,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:O,isDisabled:u,isProcessing:l,isDone:h,onClick:function(){d.submitForm(),m("cart-add-item",{product:o,listName:f})}}):Object(n.createElement)(G,{className:"wc-block-components-product-add-to-cart-button",href:w.url,text:w.text||Object(s.__)("View Product","woo-gutenberg-products-block"),onClick:function(){m("product-view-link",{product:o,listName:f})}})},U=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)}})},W=function(e){var t=e.reason,r=void 0===t?Object(s.__)("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)},K=function(){var e=C(),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)(W,null):t.id&&!t.is_in_stock?Object(n.createElement)(W,{reason:Object(s.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(U,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Y,null))},$=(r(548),r(35)),J=r.n($),X=r(871),Z=r(12),ee=r(232),te={value:"",label:Object(s.__)("Select an option","woo-gutenberg-products-block")},re=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,a=e.value,i=void 0===a?"":a,u=e.onChange,l=void 0===u?function(){}:u,b=e.errorMessage,p=void 0===b?Object(s.__)("Please select a value.","woo-gutenberg-products-block"):b,d=Object(E.b)(),m=d.getValidationError,O=d.setValidationErrors,g=d.clearValidationError,j=t,h=m(j)||{};return Object(Z.useEffect)((function(){i?g(j):O(f()({},j,{message:p,hidden:!0}))}),[i,j,p,g,O]),Object(Z.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)(X.a,{label:Object(D.decodeEntities)(t),value:i||"",options:[te].concat(J()(c)),onChange:l,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(ee.a,{propertyName:j,elementId:j}))};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 ce(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){f()(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 oe=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}))}))};function ae(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?ae(Object(r),!0).forEach((function(t){f()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var se=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(u.a)(t),a=Object(u.a)(r),s=Object(n.useState)(0),l=i()(s,2),b=l[0],p=l[1],d=Object(n.useState)({}),m=i()(d,2),O=m[0],g=m[1],j=Object(n.useMemo)((function(){return 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=ce(ce({},r),{},f()({},c,null)),s=o?oe(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(o,a,O)}),[O,o,a]);return Object(n.useEffect)((function(){Object.values(O).filter((function(e){return""!==e})).length===Object.keys(o).length?p(function(e,t,r){return oe(e,t,r)[0]||0}(o,a,O)):b>0&&p(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)(re,{key:e,attributeName:e,options:j[e],value:O[e],onChange:function(t){g(ie(ie({},O),{},f()({},e,t)))}})})))},ue=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(L.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)(se,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},le=function(){var e=C(),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)(W,null):t.id&&!t.is_in_stock?Object(n.createElement)(W,{reason:Object(s.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(ue,{product:t,dispatchers:a}),Object(n.createElement)(U,{value:r,min:c,max:o,disabled:i,onChange:a.setQuantity}),Object(n.createElement)(Y,null))},be=function(){return Object(n.createElement)(Y,null)},pe=r(869),de=function(){return Object(n.createElement)(pe.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},fe=function(){return Object(n.createElement)(de,null)},me=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(le,null):"grouped"===r?Object(n.createElement)(fe,null):"external"===r?Object(n.createElement)(be,null):"simple"===r||"variation"===r?Object(n.createElement)(K,null):null:Object(n.createElement)(Y,null)};t.a=Object(z.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(I.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(L.isEmpty)(c)});return Object(n.createElement)(A,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(me,null)))}))},380:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(6)),i=r.n(a),s=r(44),u=r(21),l=r(11),b=function(e){var t=e.color,r=e.fontSize;return Object(l.s)()?{color:t,fontSize:r}:{}},p=r(84),d=r(160),f=r(66);r(538),t.a=Object(p.withProductDataContext)((function(e){var t,r,n,a=e.className,p=e.headingLevel,m=void 0===p?2:p,O=e.showProductLink,g=void 0===O||O,j=e.align,h=e.color,v=e.customColor,w=e.fontSize,y=e.customFontSize,E=Object(s.useInnerBlockLayoutContext)().parentClassName,_=Object(s.useProductDataContext)().product,k=Object(f.a)().dispatchStoreEvent,P="h".concat(m),C=Object(u.getColorClassName)("color",h),S=Object(u.getFontSizeClass)(w),x=i()((t={"has-text-color":h||v,"has-font-size":w||y},c()(t,C,C),c()(t,S,S),t));return _.id?Object(o.createElement)(P,{className:i()(a,"wc-block-components-product-title",(r={},c()(r,"".concat(E,"__product-title"),E),c()(r,"wc-block-components-product-title--align-".concat(j),j&&Object(l.s)()),r))},Object(o.createElement)(d.a,{className:i()(c()({},x,Object(l.s)())),disabled:!g,name:_.name,permalink:_.permalink,rel:g?"nofollow":null,style:b({color:v,fontSize:y}),onClick:function(){k("product-view-link",{product:_})}})):Object(o.createElement)(P,{className:i()(a,"wc-block-components-product-title",(n={},c()(n,"".concat(E,"__product-title"),E),c()(n,"wc-block-components-product-title--align-".concat(j),j&&Object(l.s)()),c()(n,x,Object(l.s)()),n)),style:b({color:v,fontSize:y})})}))},4:function(e,t){e.exports=window.wp.components},40:function(e,t,r){"use strict";r.d(t,"h",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"b",(function(){return m})),r.d(t,"i",(function(){return O})),r.d(t,"f",(function(){return g})),r.d(t,"c",(function(){return j})),r.d(t,"d",(function(){return h})),r.d(t,"g",(function(){return v})),r.d(t,"a",(function(){return w}));var n=r(5),c=r.n(n),o=r(24),a=r(15),i=r.n(a),s=r(7),u=r(3),l=r(11);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=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=void 0===n?"":n,a=e.queryArgs,u=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=l.q.productCount>100,u={per_page:s?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},b=[Object(o.addQueryArgs)("/wc/store/products",p(p({},u),i))];return s&&r.length&&b.push(Object(o.addQueryArgs)("/wc/store/products",{catalog_visibility:"any",include:r,per_page:0})),b}({selected:r,search:c,queryArgs:void 0===a?{}:a});return Promise.all(u.map((function(e){return i()({path:e})}))).then((function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id").map((function(e){return p(p({},e),{},{parent:0})}))})).catch((function(e){throw e}))},f=function(e){return i()({path:"/wc/store/products/".concat(e)})},m=function(){return i()({path:"wc/store/products/attributes"})},O=function(e){return i()({path:"wc/store/products/attributes/".concat(e,"/terms")})},g=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,c=Object(u.getSetting)("limitTags",!1),a=[Object(o.addQueryArgs)("wc/store/products/tags",{per_page:c?100:0,orderby:c?"count":"name",order:c?"desc":"asc",search:n})];return c&&r.length&&a.push(Object(o.addQueryArgs)("wc/store/products/tags",{include:r})),a}({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")}))},j=function(e){return i()({path:Object(o.addQueryArgs)("wc/store/products/categories",p({per_page:0},e))})},h=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})})},w=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,r){"use strict";var n=r(5),c=r.n(n),o=r(0),a=r(6),i=r.n(a);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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,c=e.wrapperElement,a=e.wrapperProps,s=void 0===a?{}:a,l=null!=r,b=null!=n;return!l&&b?(t=c||"span",s=u(u({},s),{},{className:i()(s.className,"screen-reader-text")}),Object(o.createElement)(t,s,n)):(t=c||o.Fragment,l&&b&&r!==n?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,s,r))}},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(28),c=r.n(n),o=r(23),a=r.n(o),i=r(1),s=function(){var e=c()(a.a.mark((function e(t){var r;return a.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(_x){return e.apply(this,arguments)}}(),u=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},44:function(e,t){e.exports=window.wc.wcBlocksSharedContext},45:function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(8),c=r.n(n),o=r(5),a=r.n(o),i=r(7),s=r(0),u=r(27),l=r(17),b=r(26),p=r(143),d=r(167),f=r(60);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){a()(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={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},j=O(O({},g),{},{email:""}),h={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:u.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},v=function(e){return Object(p.a)(Object.entries(e).map((function(e){var t=c()(e,2),r=t[0],n=t[1];return[r,Object(b.decodeEntities)(n)]})))},w={cartCoupons:u.EMPTY_CART_COUPONS,cartItems:u.EMPTY_CART_ITEMS,cartFees:u.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:h,cartIsLoading:!0,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:j,shippingAddress:g,shippingRates:u.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:u.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:function(){},extensions:u.EMPTY_EXTENSIONS},y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},t=Object(f.b)(),r=t.isEditor,n=t.previewData,c=null==n?void 0:n.previewCart,o=e.shouldSelect,a=Object(s.useRef)(),b=Object(l.useSelect)((function(e,t){var n=t.dispatch;if(!o)return w;if(r)return{cartCoupons:c.coupons,cartItems:c.items,cartFees:c.fees,cartItemsCount:c.items_count,cartItemsWeight:c.items_weight,cartNeedsPayment:c.needs_payment,cartNeedsShipping:c.needs_shipping,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:c.totals,cartIsLoading:!1,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:j,shippingAddress:g,extensions:u.EMPTY_EXTENSIONS,shippingRates:c.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:c.has_calculated_shipping,paymentRequirements:c.paymentRequirements,receiveCart:"function"==typeof(null==c?void 0:c.receiveCart)?c.receiveCart:function(){}};var a=e(u.CART_STORE_KEY),i=a.getCartData(),s=a.getCartErrors(),l=a.getCartTotals(),b=!a.hasFinishedResolution("getCartData"),p=a.isCustomerDataUpdating(),f=n(u.CART_STORE_KEY).receiveCart,m=v(i.billingAddress),h=i.needsShipping?v(i.shippingAddress):m,y=i.fees.length>0?i.fees.map((function(e){return v(e)})):u.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map((function(e){return O(O({},e),{},{label:e.code})})):u.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:y,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:l,cartIsLoading:b,cartErrors:s,billingAddress:Object(d.a)(m),shippingAddress:Object(d.a)(h),extensions:i.extensions,shippingRates:i.shippingRates,shippingRatesLoading:p,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:f}}),[o]);return a.current&&Object(i.isEqual)(a.current,b)||(a.current=b),a.current}},47:function(e,t){e.exports=window.wc.priceFormat},484:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(6)),i=r.n(a),s=r(127),u=r(47),l=r(44),b=r(21),p=r(11),d=r(84);t.default=Object(d.withProductDataContext)((function(e){var t,r,n,a,d,f,m,O=e.className,g=e.align,j=e.fontSize,h=e.customFontSize,v=e.saleFontSize,w=e.customSaleFontSize,y=e.color,E=e.customColor,_=e.saleColor,k=e.customSaleColor,P=Object(l.useInnerBlockLayoutContext)().parentClassName,C=Object(l.useProductDataContext)().product,S=i()(O,c()({},"".concat(P,"__product-price"),P));if(!C.id)return Object(o.createElement)(s.a,{align:g,className:S});var x=Object(b.getColorClassName)("color",y),N=Object(b.getFontSizeClass)(j),D=Object(b.getColorClassName)("color",_),B=Object(b.getFontSizeClass)(v),R=i()((t={"has-text-color":y||E,"has-font-size":j||h},c()(t,x,x),c()(t,N,N),t)),T=i()((r={"has-text-color":_||k,"has-font-size":v||w},c()(r,D,D),c()(r,B,B),r)),A={color:E,fontSize:h},I={color:k,fontSize:w},L=C.prices,z=Object(u.getCurrencyFromPriceResponse)(L),V=L.price!==L.regular_price,F=V?i()((n={},c()(n,"".concat(P,"__product-price__value"),P),c()(n,T,Object(p.s)()),n)):i()((a={},c()(a,"".concat(P,"__product-price__value"),P),c()(a,R,Object(p.s)()),a)),M=V?I:A;return Object(o.createElement)(s.a,{align:g,className:S,currency:z,price:L.price,priceClassName:F,priceStyle:Object(p.s)()?M:{},minPrice:null==L||null===(d=L.price_range)||void 0===d?void 0:d.min_amount,maxPrice:null==L||null===(f=L.price_range)||void 0===f?void 0:f.max_amount,regularPrice:L.regular_price,regularPriceClassName:i()((m={},c()(m,"".concat(P,"__product-price__regular"),P),c()(m,R,Object(p.s)()),m)),regularPriceStyle:Object(p.s)()?A:{}})}))},485:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(1)),i=r(6),s=r.n(i),u=r(44),l=r(84),b=(r(541),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)(
|
16 |
/* translators: %f is referring to the average rating value */
|
17 |
+
Object(a.__)("Rated %f out of 5","woo-gutenberg-products-block"),i);return Object(o.createElement)("div",{className:s()(t,"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)))}))},486:function(e,t,r){"use strict";r.r(t);var n=r(9),c=r.n(n),o=r(5),a=r.n(o),i=r(0),s=(r(2),r(6)),u=r.n(s),l=r(1),b=r(66),p=r(770),d=r(26),f=r(44),m=r(84),O=(r(542),function(e){var t=e.product,r=t.id,n=t.permalink,o=t.add_to_cart,a=t.has_options,s=t.is_purchasable,f=t.is_in_stock,m=Object(b.a)().dispatchStoreEvent,O=Object(p.a)(r),g=O.cartQuantity,j=O.addingToCart,h=O.addToCart,v=Number.isFinite(g)&&g>0,w=!a&&s&&f,y=Object(d.decodeEntities)((null==o?void 0:o.description)||""),E=v?Object(l.sprintf)(
|
18 |
/* translators: %s number of products in cart. */
|
19 |
+
Object(l._n)("%d in cart","%d in cart",g,"woo-gutenberg-products-block"),g):Object(d.decodeEntities)((null==o?void 0:o.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),_=w?"button":"a",k={};return w?k.onClick=function(){h(),m("cart-add-item",{product:t})}:(k.href=n,k.rel="nofollow",k.onClick=function(){m("product-view-link",{product:t})}),Object(i.createElement)(_,c()({"aria-label":y,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))}))},488:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},489:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=(r(2),r(6)),i=r.n(a),s=r(161),u=r(11),l=r(44),b=r(84);r(543),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;return a?Object(o.createElement)(s.a,{className:i()(t,"wc-block-components-product-summary",c()({},"".concat(r,"__product-summary"),r)),source:a,maxLength:150,countType:u.q.wordCountType||"words"}):null}))},49:function(e,t){e.exports=window.wp.escapeHtml},490:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(6)),s=r.n(i),u=r(44),l=r(84);r(544),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}))},491:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(6)),s=r.n(i),u=r(44),l=r(7),b=r(84);r(545),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))}))))}))},492:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(6)),s=r.n(i),u=r(44),l=r(7),b=r(84);r(546),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))}))))}))},493:function(e,t,r){"use strict";r.r(t);var n=r(5),c=r.n(n),o=r(0),a=r(1),i=(r(2),r(6)),s=r.n(i),u=r(44),l=r(84),b=(r(547),function(e){return Object(a.sprintf)(
|
20 |
/* translators: %d stock amount (number of items in stock for product) */
|
21 |
+
Object(a.__)("%d left in stock","woo-gutenberg-products-block"),e)});t.default=Object(l.withProductDataContext)((function(e){var t,r=e.className,n=Object(u.useInnerBlockLayoutContext)().parentClassName,i=Object(u.useProductDataContext)().product;if(!i.id||!i.is_purchasable)return null;var l=!!i.is_in_stock,p=i.low_stock_remaining,d=i.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",l),c()(t,"wc-block-components-product-stock-indicator--out-of-stock",!l),c()(t,"wc-block-components-product-stock-indicator--low-stock",!!p),c()(t,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),t))},p?b(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")}(l,d))}))},50:function(e,t){e.exports=window.wp.keycodes},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return b}));var n,c,o=r(105);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},i=function(e){return a(e,n.SUCCESS)},s=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},b=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:i,isErrorResponse:s,isFailResponse:u}}},52:function(e,t,r){"use strict";var n=r(0),c=r(1),o=(r(2),r(49));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")))}},53:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(5),a=r.n(o),i=r(14),s=r.n(i),u=r(0),l=r(169),b=r(6),p=r.n(b),d=(r(175),["className","value","currency","onValueChange","displayType"]);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){a()(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}t.a=function(e){var t=e.className,r=e.value,n=e.currency,o=e.onValueChange,a=e.displayType,i=void 0===a?"text":a,b=s()(e,d),f="string"==typeof r?parseInt(r,10):r;if(!Number.isFinite(f))return null;var O=f/Math.pow(10,n.minorUnit);if(!Number.isFinite(O))return null;var g=p()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),j=m(m(m({},b),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}),h=o?function(e){var t=e.value*Math.pow(10,n.minorUnit);o(t)}:function(){};return Object(u.createElement)(l.a,c()({className:g,displayType:i},j,{value:O,onValueChange:h}))}},538:function(e,t){},539:function(e,t){},54:function(e,t){e.exports=window.wp.deprecated},540:function(e,t){},541:function(e,t){},542:function(e,t){},543:function(e,t){},544:function(e,t){},545:function(e,t){},546:function(e,t){},547:function(e,t){},548:function(e,t){},55:function(e,t){e.exports=window.wp.hooks},56:function(e,t){e.exports=window.wc.wcBlocksRegistry},57:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(5),c=r.n(n),o=r(0),a=r(130);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(a.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.setIsSuppressed,i=Object(o.useRef)(t);Object(o.useEffect)((function(){i.current=t}),[t]);var u=Object(o.useMemo)((function(){return{hasNoticesOfType:function(e){return i.current.some((function(t){return t.type===e}))},removeNotices:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;i.current.forEach((function(t){null!==e&&t.status!==e||n(t.id)}))},removeNotice:n}}),[n]),l=Object(o.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))}}}),[r]);return s(s(s({notices:t},u),l),{},{setIsSuppressed:c})}},60: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(17),o=Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{},getPreviewData:function(){}}),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=Object(c.useSelect)((function(e){return a||e("core/editor").getCurrentPostId()}),[a]),l=Object(n.useCallback)((function(e){return e in s?s[e]:{}}),[s]),b={isEditor:!0,currentPostId:u,previewData:s,getPreviewData:l};return Object(n.createElement)(o.Provider,{value:b},t)}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(34),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},62:function(e,t,r){"use strict";var n=r(5),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=["srcElement","size"];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,s);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)):null}},66:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),c=r.n(n),o=r(55),a=r(0),i=r(45);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=function(){var e=Object(i.a)(),t=Object(a.useRef)(e);return Object(a.useEffect)((function(){t.current=e}),[e]),{dispatchStoreEvent:Object(a.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-".concat(e),t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(a.useCallback)((function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(o.doAction)("experimental__woocommerce_blocks-checkout-".concat(e),u(u({},r),{},{storeCart:t.current}))}catch(e){console.error(e)}}),[])}}},69:function(e,t){e.exports=window.wp.a11y},7:function(e,t){e.exports=window.lodash},739:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},746:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},75:function(e,t){e.exports=window.wp.dom},754:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},755:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1),c=r(11),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.p+"previews/pennant.jpg",thumbnail:c.p+"previews/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}]},76: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},760:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},767:function(e,t,r){e.exports=r(823)},768:function(e,t){},769:function(e,t){},770:function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(8),c=r.n(n),o=r(0),a=r(17),i=r(27),s=r(26),u=r(45),l=r(57),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)(i.CART_STORE_KEY).addItemToCart,r=Object(u.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;return h(!0),t(e,r).then((function(){m("add-to-cart")})).catch((function(e){f(Object(s.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){h(!1)}))}}}},771:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16"},Object(n.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(n.createElement)("path",{stroke:"currentColor",strokeWidth:"1.5",d:"M2 .75h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H2c-.69 0-1.25-.56-1.25-1.25V2C.75 1.31 1.31.75 2 .75z"}),Object(n.createElement)("path",{fill:"currentColor",d:"M12 6H4V4.75h8zM12 9H4V7.75h8zM10 12H4v-1.25h6z"})));t.a=o},772:function(e,t){},773:function(e,t){},774:function(e,t){},775:function(e,t){},823:function(e,t,r){"use strict";r.r(t),r.d(t,"blockSettings",(function(){return Dr}));var n=r(5),c=r.n(n),o=r(9),a=r.n(o),i=r(0),s=r(1),u=r(21),l=r(25),b=r(62),p=r(33),d=Object(i.createElement)(p.SVG,{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(11),m=r(6),O=r.n(m),g={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.r)()?null:["@woocommerce/all-products","@woocommerce/single-product"],save:function(e){var t=e.attributes;return Object(i.createElement)("div",{className:O()("is-loading",t.className)})},deprecated:[{save:function(){}}]},j=r(375),h=r(4),v=r(22),w=r(137),y=r(380),E=r(8),_=r.n(E),k=r(154),P=r(14),C=r.n(P),S=(r(769),["className"]),x=function(e){var t=e.className,r=void 0===t?"":t,n=C()(e,S),c=O()("wc-block-text-toolbar-button",r);return Object(i.createElement)(h.Button,a()({className:c},n))},N=r(44),D=(r(768),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=_()(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)(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)(k.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,{isSecondary:!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)(h.ToolbarGroup,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.SVG,{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"})),R=Object(s.__)("Product Title","woo-gutenberg-products-block"),T=Object(i.createElement)(b.a,{srcElement:B}),A=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.showProductLink,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.s)()&&Object(i.createElement)(u.AlignmentToolbar,{value:p,onChange:function(e){a({align:e})}})),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.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({showProductLink:!b})}})),Object(f.s)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.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)(h.Disabled,null,Object(i.createElement)(y.a,o)))},L=Object(f.s)()?Object(v.compose)([Object(u.withFontSizes)("fontSize"),Object(u.withColors)("color",{textColor:"color"}),D({icon:T,label:R,description:Object(s.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(I):I;function z(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 V(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?z(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var F={title:R,description:A,icon:{src:T,foreground:"#874FB9"},attributes:j.a,edit:L};Object(l.registerBlockType)("woocommerce/product-title",V(V({},g),F));var M=r(484),H=r(305),q=Object(s.__)("Product Price","woo-gutenberg-products-block"),G=Object(i.createElement)(b.a,{srcElement:H.a}),Q=Object(s.__)("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)(u.FontSizePicker,{value:t.size,onChange:r}),Object(i.createElement)(h.BaseControl,{label:o},Object(i.createElement)(u.ColorPalette,{value:n.color,onChange:c,label:Object(s.__)("Color")})))},U=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.s)()&&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.s)()&&Object(i.createElement)(i.Fragment,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:o,setColor:l,fontSize:t,setFontSize:n,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})),Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Sale price","woo-gutenberg-products-block")},Object(i.createElement)(Y,{color:a,setColor:b,fontSize:r,setFontSize:c,colorLabel:Object(s.__)("Color","woo-gutenberg-products-block")})))),Object(i.createElement)(M.default,p))},W=Object(f.s)()?Object(v.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:G,label:q,description:Object(s.__)("Choose a product to display its price.","woo-gutenberg-products-block")})])(U):U;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.s)()&&(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:G,foreground:"#874FB9"},attributes:J,edit:W};Object(l.registerBlockType)("woocommerce/product-price",Z(Z({},g),ee));var te=r(376),re=r(86),ne=r(3),ce=r(377),oe=Object(i.createElement)(p.SVG,{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"})),ae=Object(s.__)("Product Image","woo-gutenberg-products-block"),ie=Object(i.createElement)(b.a,{srcElement:oe}),se=Object(s.__)("Display the main product image","woo-gutenberg-products-block"),ue=D({icon:ie,label:ae,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.showProductLink,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)(h.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block")},Object(i.createElement)(h.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({showProductLink:!n})}}),Object(i.createElement)(h.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)(re.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)(re.a,{label:Object(s.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(i.createInterpolateElement)(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(ne.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)(h.Disabled,null,Object(i.createElement)(ce.a,t)))}));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 be(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 pe={title:ae,description:se,icon:{src:ie,foreground:"#874FB9"},attributes:te.a,edit:ue};Object(l.registerBlockType)("woocommerce/product-image",be(be({},g),pe));var de=r(485),fe=r(754),me=Object(s.__)("Product Rating","woo-gutenberg-products-block"),Oe=Object(i.createElement)(b.a,{srcElement:fe.a});function ge(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 je(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ge(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ge(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var he={title:me,description:Object(s.__)("Display the average rating of a product.","woo-gutenberg-products-block"),icon:{src:Oe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Oe,label:me,description:Object(s.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})((function(e){var t=e.attributes;return Object(i.createElement)(de.default,t)}))};Object(l.registerBlockType)("woocommerce/product-rating",je(je({},g),he));var ve=r(486),we=r(488),ye=Object(s.__)("Add to Cart Button","woo-gutenberg-products-block"),Ee=Object(i.createElement)(b.a,{srcElement:we.a});function _e(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 ke(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_e(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_e(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Pe={title:ye,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:Ee,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Ee,label:ye,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)(h.Disabled,null,Object(i.createElement)(ve.default,t))}))};Object(l.registerBlockType)("woocommerce/product-button",ke(ke({},g),Pe));var Ce=r(489),Se=r(771),xe=Object(s.__)("Product Summary","woo-gutenberg-products-block"),Ne=Object(i.createElement)(b.a,{srcElement:Se.a});function De(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 Be(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?De(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Re={title:xe,description:Object(s.__)("Display a short description about a product.","woo-gutenberg-products-block"),icon:{src:Ne,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Ne,label:xe,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)(Ce.default,t)}))};Object(l.registerBlockType)("woocommerce/product-summary",Be(Be({},g),Re));var Te=r(306),Ae=r(746),Ie=Object(s.__)("On-Sale Badge","woo-gutenberg-products-block"),Le=Object(i.createElement)(b.a,{srcElement:Ae.a});function ze(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?ze(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Fe={title:Ie,description:Object(s.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block"),icon:{src:Le,foreground:"#874FB9"},supports:{html:!1},attributes:{productId:{type:"number",default:0}},edit:D({icon:Le,label:Ie,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)(Te.default,t)}))};Object(l.registerBlockType)("woocommerce/product-sale-badge",Ve(Ve({},g),Fe));var Me=r(144),He=r(490),qe=Object(i.createElement)(p.SVG,{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"})),Ge=Object(s.__)("Product SKU","woo-gutenberg-products-block"),Qe=Object(i.createElement)(b.a,{srcElement:qe});function Ye(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?Ye(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ye(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var We={title:Ge,description:Object(s.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Qe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Qe,label:Ge,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)(Me.a,null),Object(i.createElement)(He.default,t))}))};Object(f.t)("woocommerce/product-sku",Ue(Ue({},g),We));var Ke=r(491),$e=r(739),Je=Object(s.__)("Product Category List","woo-gutenberg-products-block"),Xe=Object(i.createElement)(b.a,{srcElement:$e.a});function Ze(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 et(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var tt={title:Je,description:Object(s.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block"),icon:{src:Xe,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:Xe,label:Je,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)(Me.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(Ke.default,t)))}))};Object(f.t)("woocommerce/product-category-list",et(et({},g),tt));var rt=r(492),nt=Object(s.__)("Product Tag List","woo-gutenberg-products-block"),ct=Object(i.createElement)(b.a,{srcElement:Ae.a});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){c()(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={title:nt,description:Object(s.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block"),icon:{src:ct,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:ct,label:nt,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)(Me.a,null),Object(i.createElement)(h.Disabled,null,Object(i.createElement)(rt.default,t)))}))};Object(f.t)("woocommerce/product-tag-list",at(at({},g),it));var st=r(493),ut=Object(i.createElement)(p.SVG,{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"}))),lt=Object(s.__)("Product Stock Indicator","woo-gutenberg-products-block"),bt=Object(i.createElement)(b.a,{srcElement:ut});function pt(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 dt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?pt(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):pt(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ft={title:lt,description:Object(s.__)("Display product stock status.","woo-gutenberg-products-block"),icon:{src:bt,foreground:"#874FB9"},attributes:{productId:{type:"number",default:0}},edit:D({icon:bt,label:lt,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)(Me.a,null),Object(i.createElement)(st.default,t))}))};Object(f.t)("woocommerce/product-stock-indicator",dt(dt({},g),ft));var mt=r(856),Ot=(r(374),r(379)),gt=Object(s.__)("Add to Cart","woo-gutenberg-products-block"),jt=Object(i.createElement)(b.a,{srcElement:we.a});function ht(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 vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ht(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wt={title:gt,description:Object(s.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:jt,foreground:"#874FB9"},edit:D({icon:jt,label:gt,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)(Me.a,{productId:n.id}),Object(i.createElement)(u.InspectorControls,null,Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Layout","woo-gutenberg-products-block")},Object(mt.b)(n)?Object(i.createElement)(h.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)(h.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)(h.Disabled,null,Object(i.createElement)(Ot.a,t)))})),attributes:r(378).a};Object(f.t)("woocommerce/product-add-to-cart",vt(vt({},g),wt));var yt=r(16),Et=r.n(yt),_t=r(13),kt=r.n(_t),Pt=r(19),Ct=r.n(Pt),St=r(20),xt=r.n(St),Nt=r(10),Dt=r.n(Nt),Bt=r(17),Rt=(r(2),r(92)),Tt=r(851),At=r(755),It=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})},Lt=r(164),zt=function(e,t){return Object(i.createElement)(h.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)(h.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:ne.ADMIN_URL+"post-new.php?post_type=product"},Object(s.__)("Add new product","woo-gutenberg-products-block")+" ",Object(i.createElement)(b.a,{srcElement:Lt.a})),Object(i.createElement)(h.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")))},Vt=function(e,t){return Object(i.createElement)(h.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 Ft(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 Mt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ft(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ft(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Ht=[["woocommerce/product-image"],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],qt=function e(t){return t&&0!==t.length?t.map((function(t){return[t.name,Mt(Mt({},t.attributes),{},{product:void 0,children:t.innerBlocks.length>0?e(t.innerBlocks):[]})]})):[]};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 Qt(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 Yt=function(e,t){var r=e.contentVisibility;return Object(i.createElement)(h.ToggleControl,{label:Object(s.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:r.orderBy,onChange:function(){return t({contentVisibility:Qt(Qt({},r),{},{orderBy:!r.orderBy})})}})},Ut=function(e,t){return Object(i.createElement)(h.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})}})},Wt=r(18),Kt=r.n(Wt),$t=r(12),Jt=r(7),Xt=r(41),Zt=(r(775),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)(Xt.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 wc-block-components-pagination-page--arrow",onClick:function(){return o(t-1)},title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(i.createElement)(Xt.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)(Xt.a,{label:1,screenReaderLabel:Object(s.sprintf)(
|
22 |
/* translators: %d is the page number (1, 2, 3...). */
|
23 |
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)(Xt.a,{label:e,screenReaderLabel:Object(s.sprintf)(
|
24 |
/* translators: %d is the page number (1, 2, 3...). */
|
25 |
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)(Xt.a,{label:a,screenReaderLabel:Object(s.sprintf)(
|
26 |
/* translators: %d is the page number (1, 2, 3...). */
|
27 |
+
Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),n&&Object(i.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:function(){return o(t+1)},title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(i.createElement)(Xt.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))});Zt.defaultProps={displayFirstAndLastPages:!0,displayNextAndPreviousArrows:!0,pagesToDisplay:3};var er=Zt,tr=r(151),rr=r(109),nr=r(168),cr=r(27),or=r(61);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 ir(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 sr=r(66),ur=r(195),lr=r(69),br=r(155),pr=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:br.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")))},dr=r(760),fr=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:dr.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")))},mr=r(162),Or=(r(774),function(e){var t=e.onChange,r=e.readOnly,n=e.value;return Object(i.createElement)(mr.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",name:"orderby",onChange:t,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:n})}),gr=Object(v.withInstanceId)((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(Tt.a)(t);return n.map((function(n,s){var u=_()(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))})),jr=(r(773),["order","orderby","page","per_page"]);function hr(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 vr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wr=function(e){var t=e.totalQuery,r=e.totalProducts,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=n.totalQuery;return!Object(Jt.isEqual)(t,c)&&Number.isFinite(r)},yr=Object(ur.a)((function(e){var t,r=e.attributes,n=e.currentPage,c=e.onPageChange,o=e.onSortChange,a=e.sortValue,u=e.scrollToTop,l=Object(rr.b)("attributes",[]),b=_()(l,2),p=b[0],d=b[1],f=Object(rr.b)("stock_status",[]),m=_()(f,2),g=m[0],j=m[1],h=Object(rr.b)("min_price"),v=_()(h,2),w=v[0],y=v[1],E=Object(rr.b)("max_price"),k=_()(E,2),P=k[0],S=k[1],x=Object(rr.c)(function(e){var t=e.sortValue,r=e.currentPage,n=e.attributes,c=n.columns,o=n.rows;return vr(vr({},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:r,sortValue:a,currentPage:n})),D=_()(x,1)[0],B=function(e){var t={namespace:"/wc/store",resourceName:"products"},r=Object(nr.a)(ir(ir({},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(or.a)(i),u=Object(or.a)(o),l=Object(Bt.useSelect)((function(e){var t=e(cr.COLLECTIONS_STORE_KEY),c=["x-wp-total",r,n,s,u];return{value:t.getCollectionHeader.apply(t,c),isLoading:t.hasFinishedResolution("getCollectionHeader",c)}}),["x-wp-total",r,n,u,s]),b=l.value,p=l.isLoading;return{value:b,isLoading:void 0===p||p}}(0,ir(ir({},t),{},{query:e})).value;return{products:n,totalProducts:parseInt(o,10),productsLoading:c}}(D),R=B.products,T=B.totalProducts,A=B.productsLoading,I=Object(N.useInnerBlockLayoutContext)(),L=I.parentClassName,z=I.parentName,V=((t=D).order,t.orderby,t.page,t.per_page,C()(t,jr)||{}),F=Object(sr.a)().dispatchStoreEvent,M=Object(tr.a)({totalQuery:V,totalProducts:T},wr);Object(i.useEffect)((function(){F("product-list-render",{products:R,listName:z})}),[R,z,F]),Object(i.useEffect)((function(){Object(Jt.isEqual)(V,null==M?void 0:M.totalQuery)||(c(1),null!=M&&M.totalQuery&&function(e){Number.isFinite(e)&&(0===e?Object(lr.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(lr.speak)(Object(s.sprintf)(
|
28 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
29 |
+
Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))}(T))}),[null==M?void 0:M.totalQuery,T,c,V]);var H,q,G,Q,Y,U=r.contentVisibility,W=r.columns*r.rows,K=!Number.isFinite(T)&&Number.isFinite(null==M?void 0:M.totalProducts)&&Object(Jt.isEqual)(V,null==M?void 0:M.totalQuery)?Math.ceil(M.totalProducts/W):Math.ceil(T/W),$=R.length?R:Array.from({length:W}),J=0!==R.length||A,X=p.length>0||g.length>0||Number.isFinite(w)||Number.isFinite(P);return Object(i.createElement)("div",{className:(H=r.columns,q=r.rows,G=r.alignButtons,Q=r.align,Y=void 0!==Q?"align"+Q:"",O()(L,Y,"has-"+H+"-columns",{"has-multiple-rows":q>1,"has-aligned-buttons":G}))},U.orderBy&&J&&Object(i.createElement)(Or,{onChange:o,value:a}),!J&&X&&Object(i.createElement)(fr,{resetCallback:function(){d([]),j([]),y(null),S(null)}}),!J&&!X&&Object(i.createElement)(pr,null),J&&Object(i.createElement)("ul",{className:"".concat(L,"__products")},$.map((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return Object(i.createElement)(gr,{key:e.id||t,attributes:r,product:e})}))),K>1&&Object(i.createElement)(er,{currentPage:n,onPageChange:function(e){u({focusableSelector:"a, button"}),c(e)},totalPages:K}))})),Er=function(e){var t=e.attributes,r=Object(i.useState)(1),n=_()(r,2),c=n[0],o=n[1],a=Object(i.useState)(t.orderby),s=_()(a,2),u=s[0],l=s[1];return Object(i.useEffect)((function(){l(t.orderby)}),[t.orderby]),Object(i.createElement)(yr,{attributes:t,currentPage:c,onPageChange:function(e){o(e)},onSortChange:function(e){var t=e.target.value;l(t),o(1)},sortValue:u})},_r=r(189);var kr=function(e){Ct()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=Dt()(t);if(r){var c=Dt()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return xt()(this,e)});function c(){return Et()(this,c),n.apply(this,arguments)}return Kt()(c,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.urlParameterSuffix;return t.isPreview?_r.a:Object(i.createElement)(N.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(i.createElement)(Er,{attributes:t,urlParameterSuffix:r}))}}]),c}($t.Component);r(772);var Pr=function(e){Ct()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=Dt()(t);if(r){var c=Dt()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return xt()(this,e)});function o(){var e;Et()(this,o);for(var t=arguments.length,r=new Array(t),a=0;a<t;a++)r[a]=arguments[a];return e=n.call.apply(n,[this].concat(r)),c()(kt()(e),"state",{isEditing:!1,innerBlocks:[]}),c()(kt()(e),"blockMap",Object(Tt.a)("woocommerce/all-products")),c()(kt()(e),"componentDidMount",(function(){var t=e.props.block;e.setState({innerBlocks:t.innerBlocks})})),c()(kt()(e),"getTitle",(function(){return Object(s.__)("All Products","woo-gutenberg-products-block")})),c()(kt()(e),"getIcon",(function(){return Object(i.createElement)(b.a,{srcElement:d})})),c()(kt()(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()(kt()(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)(h.PanelBody,{title:Object(s.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(i.createElement)(Rt.a,{columns:c,rows:o,alignButtons:a,setAttributes:n,minColumns:Object(ne.getSetting)("min_columns",1),maxColumns:Object(ne.getSetting)("max_columns",6),minRows:Object(ne.getSetting)("min_rows",1),maxRows:Object(ne.getSetting)("max_rows",6)})),Object(i.createElement)(h.PanelBody,{title:Object(s.__)("Content Settings","woo-gutenberg-products-block")},Yt(r,n),Ut(r,n)))})),c()(kt()(e),"getBlockControls",(function(){var t=e.state.isEditing;return Object(i.createElement)(u.BlockControls,null,Object(i.createElement)(h.ToolbarGroup,{controls:[{icon:"edit",title:Object(s.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return e.togglePreview()},isActive:t}]}))})),c()(kt()(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(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)(h.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:At.a[0]},Object(i.createElement)(u.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,onClick:function(){var t=e.props,r=t.block;(0,t.setAttributes)({layoutConfig:qt(r.innerBlocks)}),e.setState({innerBlocks:r.innerBlocks}),e.togglePreview()}},Object(s.__)("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(s.__)("Cancel","woo-gutenberg-products-block")),Object(i.createElement)(h.Button,{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=[];Ht.map((function(e){var t=_()(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()(kt()(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)(kr,{attributes:t})):Vt(c,o)})),c()(kt()(e),"render",(function(){var t=e.props.attributes,r=e.state.isEditing,n=e.getTitle(),c=e.getIcon();return 0===f.q.productCount?zt(n,c):Object(i.createElement)("div",{className:It("wc-block-all-products",t)},e.getBlockControls(),e.getInspectorControls(),r?e.renderEditMode():e.renderViewMode())})),e}return o}(i.Component),Cr=Object(v.compose)(h.withSpokenMessages,Object(Bt.withSelect)((function(e,t){var r=t.clientId;return{block:(0,e("core/block-editor").getBlock)(r)}})),Object(Bt.withDispatch)((function(e){return{replaceInnerBlocks:e("core/block-editor").replaceInnerBlocks}})))(Pr),Sr={columns:Object(ne.getSetting)("default_columns",3),rows:Object(ne.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ht,isPreview:!1};function xr(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 Nr(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xr(Object(r),!0).forEach((function(t){c()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xr(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Dr={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:Sr,edit:function(e){return Object(i.createElement)(Cr,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:It("wc-block-all-products",t)},n),Object(i.createElement)(u.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",Nr(Nr({},Dr),{},{deprecated:[{attributes:Object.assign({},Dr.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:It("wc-block-all-products",t)},r),Object(i.createElement)(u.InnerBlocks.Content,null))}}]}))},84:function(e,t){e.exports=window.wc.wcBlocksSharedHocs},85:function(e,t){e.exports=window.ReactDOM},851:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(56),c=r(0),o=r(11);r.p=o.o,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(12)]).then(r.bind(null,484))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(4),r.e(11)]).then(r.bind(null,875))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(c.lazy)((function(){return Promise.all([r.e(1),r.e(2),r.e(18)]).then(r.bind(null,876))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(c.lazy)((function(){return r.e(13).then(r.bind(null,485))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(c.lazy)((function(){return Promise.all([r.e(0),r.e(1),r.e(3),r.e(9)]).then(r.bind(null,486))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(c.lazy)((function(){return r.e(16).then(r.bind(null,489))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(c.lazy)((function(){return r.e(4).then(r.bind(null,306))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(c.lazy)((function(){return r.e(14).then(r.bind(null,490))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(c.lazy)((function(){return r.e(10).then(r.bind(null,491))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(c.lazy)((function(){return r.e(17).then(r.bind(null,492))}))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(c.lazy)((function(){return r.e(15).then(r.bind(null,493))}))}),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(3),r.e(8)]).then(r.bind(null,877))}))});var a=function(e){return Object(n.getRegisteredBlockComponents)(e)}},856: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")}},86:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(16),a=r.n(o),i=r(18),s=r.n(i),u=r(13),l=r.n(u),b=r(19),p=r.n(b),d=r(20),f=r.n(d),m=r(10),O=r.n(m),g=r(0),j=r(7),h=r(6),v=r.n(h),w=r(4),y=r(22);r(125);var E=function(e){p()(o,e);var t,r,n=(t=o,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=O()(t);if(r){var c=O()(this).constructor;e=Reflect.construct(n,arguments,c)}else e=n.apply(this,arguments);return f()(this,e)});function o(){var e;return a()(this,o),(e=n.apply(this,arguments)).onClick=e.onClick.bind(l()(e)),e}return s()(o,[{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)(w.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)(w.ButtonGroup,{"aria-labelledby":b+"__label"},u.map((function(e,r){var o={};return l===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!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)}))))}}]),o}(g.Component);t.a=Object(y.withInstanceId)(E)},88:function(e,t){e.exports=window.wp.viewport},89:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(14),a=r.n(o),i=r(0),s=r(184),u=r(6),l=r.n(u),b=r(115),p=(r(208),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,p),d=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(i.createElement)(s.a,c()({className:d},u),n&&Object(i.createElement)(b.a,null),Object(i.createElement)("span",{className:"wc-block-components-button__text"},o))}},90:function(e,t){e.exports=window.wp.autop},92:function(e,t,r){"use strict";var n=r(0),c=r(1),o=r(7),a=(r(2),r(4));t.a=function(e){var t=e.columns,r=e.rows,i=e.setAttributes,s=e.alignButtons,u=e.minColumns,l=void 0===u?1:u,b=e.maxColumns,p=void 0===b?6:b,d=e.minRows,f=void 0===d?1:d,m=e.maxRows,O=void 0===m?6:m;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,l,p);i({columns:Number.isNaN(t)?"":t})},min:l,max:p}),Object(n.createElement)(a.RangeControl,{label:Object(c.__)("Rows","woo-gutenberg-products-block"),value:r,onChange:function(e){var t=Object(o.clamp)(e,f,O);i({rows:Number.isNaN(t)?"":t})},min:f,max:O}),Object(n.createElement)(a.ToggleControl,{label:Object(c.__)("Align Last Block","woo-gutenberg-products-block"),help:s?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:s,onChange:function(){return i({alignButtons:!s})}}))}},95:function(e,t){e.exports=window.wp.date}});
|
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', 'wp-primitives'), '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', 'wp-primitives'), 'version' => 'ac224eb4903a6799cfbc8a7db7fb3772');
|
build/all-reviews.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],l=t[2],d=0,b=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);b.length;)b.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,i=1;i<r.length;i++){var s=r[i];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={7:0},c=[];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.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="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;return c.push([751,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},106:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(63)),a=r(150),i=r(6),s=r.n(i),l=r(4),u=r(52);r(155),t.a=function(e){var t=e.className,r=e.error,i=e.isLoading,d=e.onRetry;return Object(n.createElement)(l.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:a.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}),d&&Object(n.createElement)(n.Fragment,null,i?Object(n.createElement)(l.Spinner,null):Object(n.createElement)(l.Button,{isSecondary:!0,onClick:d},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},11:function(e,t,r){"use strict";r.d(t,"q",(function(){return c})),r.d(t,"p",(function(){return a})),r.d(t,"o",(function(){return i})),r.d(t,"l",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"i",(function(){return b})),r.d(t,"h",(function(){return p})),r.d(t,"n",(function(){return w})),r.d(t,"m",(function(){return v})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return f})),r.d(t,"g",(function(){return g})),r.d(t,"j",(function(){return h})),r.d(t,"a",(function(){return O})),r.d(t,"k",(function(){return y})),r.d(t,"b",(function(){return j})),r.d(t,"t",(function(){return k})),r.d(t,"u",(function(){return R})),r.d(t,"r",(function(){return E})),r.d(t,"s",(function(){return P}));var n,o=r(3),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,p=o.STORE_PAGES.privacy.title,w=o.STORE_PAGES.terms.permalink,v=o.STORE_PAGES.terms.title,m=o.STORE_PAGES.cart.id,f=o.STORE_PAGES.cart.permalink,g=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),h=Object(o.getSetting)("shippingCountries",{}),O=Object(o.getSetting)("allowedCountries",{}),y=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{}),_=r(25),k=function(e,t){if(s>2)return Object(_.registerBlockType)(e,t)},R=function(e,t){if(s>1)return Object(_.registerBlockType)(e,t)},E=function(){return s>2},P=function(){return s>1}},12:function(e,t){e.exports=window.React},124:function(e,t){},143:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return d}));var n=r(0),o=r(1),c=r(4),a=r(21),i=r(3),s=r(84),l=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(c.ToolbarGroup,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},u=function(e,t){var r=Object(i.getSetting)("showAvatars",!0),a=Object(i.getSetting)("reviewRatingsEnabled",!0);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!a&&Object(n.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(n.createInterpolateElement)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(i.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(c.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)(s.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&&!r&&Object(n.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(n.createInterpolateElement)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(i.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(c.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)(c.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)(c.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)(c.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}))}},15:function(e,t){e.exports=window.wp.apiFetch},150:function(e,t,r){"use strict";var n=r(0),o=r(33),c=Object(n.createElement)(o.SVG,{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},155:function(e,t){},158:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(6)),c=r.n(o),a=r(42),i=r(22);r(213),t.a=Object(i.withInstanceId)((function(e){var t=e.className,r=e.instanceId,o=e.defaultValue,i=e.label,s=e.onChange,l=e.options,u=e.screenReaderLabel,d=e.readOnly,b=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)(a.a,{label:i,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:d,value:b},l.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},163:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(11),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:"#",
|
2 |
/* translators: An example person name used for the block previews. */
|
3 |
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.defaultAvatar,96:o.q.defaultAvatar},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:"#",
|
4 |
/* translators: An example person name used for the block previews. */
|
5 |
-
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.defaultAvatar,96:o.q.defaultAvatar},rating:null,verified:!1}]}}},
|
6 |
/* translators: %f is referring to the average rating value */
|
7 |
-
Object(w.__)("Rated %f out of 5","woo-gutenberg-products-block"),t);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","aria-label":n},Object(p.createElement)("span",{style:r},n)))}(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),a&&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)(B,{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))};function G(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 V(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){E()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}r(252);var F=function(e){var t=e.attributes,r=e.reviews,n=Object(g.getSetting)("showAvatars",!0),o=Object(g.getSetting)("reviewRatingsEnabled",!0),c=(n||"product"===t.imageType)&&t.showReviewImage,a=o&&t.showReviewRating,i=V(V({},t),{},{showReviewImage:c,showReviewRating:a});return Object(p.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(p.createElement)(H,{attributes:i}):r.map((function(e,t){return Object(p.createElement)(H,{key:e.id||t,attributes:i,review:e})})))},z=r(8),W=r.n(z),q=r(31),U=r.n(q),J=r(24),Y=r.n(J),K=r(36),Q=r.n(K),X=r(81),Z=r(43);var $=function(e){var t=function(t){s()(i,t);var r,n,c=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=b()(r);if(n){var o=b()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return u()(this,e)});function i(){var e;o()(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=c.call.apply(c,[this].concat(r)),E()(N()(e),"isPreview",!!e.props.attributes.previewReviews),E()(N()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),E()(N()(e),"isMounted",!1),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=U()(Y.a.mark((function t(r){var n,o;return Y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.isMounted){t.next=2;break}return t.abrupt("return");case 2:return n=e.props.onReviewsLoadError,t.next=5,Object(Z.a)(r);case 5:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 8:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}()),e}return a()(i,[{key:"componentDidMount",value:function(){this.isMounted=!0,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||!Q()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnmount",value:function(){this.isMounted=!1,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,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{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(X.c)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.isMounted&&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,a=r.totalReviews;return Object(p.createElement)(e,W()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),i}(v.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()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=b()(t);if(r){var o=b()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return u()(this,e)});function c(){return o()(this,c),n.apply(this,arguments)}return a()(c,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;if(r)return Object(p.createElement)(h.a,{className:"wc-block-featured-product-error",error:r,isLoading:n});if(0===c.length&&!n)return Object(p.createElement)(o,{attributes:t});var i=Object(g.getSetting)("reviewRatingsEnabled",!0);return Object(p.createElement)(f.Disabled,null,t.showOrderby&&i&&Object(p.createElement)(k,{readOnly:!0,value:t.orderby}),Object(p.createElement)(F,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(p.createElement)(j,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")}))}}]),c}(v.Component));var ee=function(e){s()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=b()(t);if(r){var o=b()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return u()(this,e)});function c(){return o()(this,c),n.apply(this,arguments)}return a()(c,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(f.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,a=t.showProductName,i=t.showReviewDate,s=t.showReviewerName,l=t.showReviewContent,u=t.showReviewImage,d=t.showReviewRating,b=Object(X.d)(t.orderby),w=b.order,v=b.orderby;return l||d||i||s||u||a?Object(p.createElement)("div",{className:Object(X.a)(t)},Object(p.createElement)($,{attributes:t,categoryIds:n,delayFunction:function(e){return Object(m.debounce)(e,400)},noReviewsPlaceholder:r,orderby:v,order:w,productId:o,reviewsToDisplay:c})):this.renderHiddenContentPlaceholder()}}]),c}(v.Component);t.a=ee},21:function(e,t){e.exports=window.wp.blockEditor},212:function(e,t){},213:function(e,t){},22:function(e,t){e.exports=window.wp.compose},24:function(e,t){e.exports=window.regeneratorRuntime},25:function(e,t){e.exports=window.wp.blocks},251:function(e,t){},252:function(e,t){},253:function(e,t){},254:function(e,t){},3:function(e,t){e.exports=window.wc.wcSettings},33:function(e,t){e.exports=window.wp.primitives},36:function(e,t){e.exports=window.wp.isShallowEqual},4:function(e,t){e.exports=window.wp.components},42:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),a=r(6),i=r.n(a);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){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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,s=void 0===a?{}:a,u=null!=r,d=null!=n;return!u&&d?(t=o||"span",s=l(l({},s),{},{className:i()(s.className,"screen-reader-text")}),Object(c.createElement)(t,s,n)):(t=o||c.Fragment,u&&d&&r!==n?Object(c.createElement)(t,s,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,s,r))}},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l}));var n=r(31),o=r.n(n),c=r(24),a=r.n(c),i=r(1),s=function(){var e=o()(a.a.mark((function e(t){var r;return a.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(_x){return e.apply(this,arguments)}}(),l=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},49:function(e,t){e.exports=window.wp.escapeHtml},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(49));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(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"===a?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")))}},63:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(14),a=r.n(c),i=r(0),s=["srcElement","size"];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}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=a()(e,s);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?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}({width:n,height:n},c)):null}},7:function(e,t){e.exports=window.lodash},751:function(e,t,r){e.exports=r(830)},81: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 d}));var n=r(15),o=r.n(n),c=r(6),a=r.n(c),i=r(3),s=function(e){if(Object(i.getSetting)("reviewRatingsEnabled",!0)){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,i=e.showReviewContent,s=e.showProductName,l=e.showReviewImage,u=e.showReviewRating,d="wc-block-all-reviews";return n&&(d="wc-block-reviews-by-product"),Array.isArray(r)&&(d="wc-block-reviews-by-category"),a()(d,t,{"has-image":l,"has-name":c,"has-date":o,"has-rating":u,"has-content":i,"has-product-name":s})},d=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}},830:function(e,t,r){"use strict";r.r(t);var n=r(5),o=r.n(n),c=r(0),a=r(1),i=r(25),s=r(63),l=r(33),u=Object(c.createElement)(l.SVG,{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"})),d=(r(212),r(21)),b=r(4),p=(r(2),r(198)),w=function(){return Object(c.createElement)(b.Placeholder,{className:"wc-block-all-reviews",icon:Object(c.createElement)(s.a,{srcElement:u,className:"block-editor-block-icon"}),label:Object(a.__)("All Reviews","woo-gutenberg-products-block")},Object(a.__)("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"))},v=r(143),m=function(e){var t=e.attributes,r=e.setAttributes;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(d.InspectorControls,{key:"inspector"},Object(c.createElement)(b.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(b.ToggleControl,{label:Object(a.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(v.b)(t,r)),Object(c.createElement)(b.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block")},Object(v.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(a.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))},f=r(190),g=r(191),h=r(163);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 y(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(i.registerBlockType)("woocommerce/all-reviews",{title:Object(a.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(s.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1},example:y(y({},h.a),{},{attributes:y(y({},h.a.attributes),{},{showProductName:!0})}),attributes:y(y({},f.a),{},{showProductName:{type:"boolean",default:!0}}),transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:function(e){var t=e.instance;return Object(i.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:function(e){return Object(c.createElement)(m,e)},save:g.a})},84:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(16),a=r.n(c),i=r(17),s=r.n(i),l=r(13),u=r.n(l),d=r(18),b=r.n(d),p=r(19),w=r.n(p),v=r(10),m=r.n(v),f=r(0),g=r(7),h=r(6),O=r.n(h),y=r(4),j=r(22);r(124);var _=function(e){b()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=m()(t);if(r){var o=m()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return w()(this,e)});function c(){var e;return a()(this,c),(e=n.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return s()(c,[{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,a=r.instanceId,i=r.className,s=r.help,l=r.options,u=r.value,d="inspector-toggle-button-control-".concat(a);return s&&(e=Object(g.isFunction)(s)?s(c):s),Object(f.createElement)(y.BaseControl,{id:d,help:e,className:O()("components-toggle-button-control",i)},Object(f.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},n),Object(f.createElement)(y.ButtonGroup,{"aria-labelledby":d+"__label"},l.map((function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isSecondary=!0,c["aria-pressed"]=!1),Object(f.createElement)(y.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)}))))}}]),c}(f.Component);t.a=Object(j.withInstanceId)(_)}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],l=t[2],b=0,d=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=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,i=1;i<r.length;i++){var s=r[i];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={7:0},c=[];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.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="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;return c.push([756,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},106:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(62)),a=r(155),i=r(6),s=r.n(i),l=r(4),u=r(52);r(159),t.a=function(e){var t=e.className,r=e.error,i=e.isLoading,b=e.onRetry;return Object(n.createElement)(l.Placeholder,{icon:Object(n.createElement)(c.a,{srcElement:a.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,i?Object(n.createElement)(l.Spinner,null):Object(n.createElement)(l.Button,{isSecondary:!0,onClick:b},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},11:function(e,t,r){"use strict";r.d(t,"q",(function(){return c})),r.d(t,"p",(function(){return a})),r.d(t,"o",(function(){return i})),r.d(t,"l",(function(){return l})),r.d(t,"e",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"i",(function(){return d})),r.d(t,"h",(function(){return p})),r.d(t,"n",(function(){return w})),r.d(t,"m",(function(){return v})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return f})),r.d(t,"g",(function(){return g})),r.d(t,"j",(function(){return h})),r.d(t,"a",(function(){return O})),r.d(t,"k",(function(){return y})),r.d(t,"b",(function(){return j})),r.d(t,"t",(function(){return k})),r.d(t,"u",(function(){return R})),r.d(t,"r",(function(){return E})),r.d(t,"s",(function(){return P}));var n,o=r(3),c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=o.STORE_PAGES.checkout.id,b=o.STORE_PAGES.checkout.permalink,d=o.STORE_PAGES.privacy.permalink,p=o.STORE_PAGES.privacy.title,w=o.STORE_PAGES.terms.permalink,v=o.STORE_PAGES.terms.title,m=o.STORE_PAGES.cart.id,f=o.STORE_PAGES.cart.permalink,g=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),h=Object(o.getSetting)("shippingCountries",{}),O=Object(o.getSetting)("allowedCountries",{}),y=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{}),_=r(25),k=function(e,t){if(s>2)return Object(_.registerBlockType)(e,t)},R=function(e,t){if(s>1)return Object(_.registerBlockType)(e,t)},E=function(){return s>2},P=function(){return s>1}},12:function(e,t){e.exports=window.React},125:function(e,t){},145:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return b}));var n=r(0),o=r(1),c=r(4),a=r(21),i=r(3),s=r(86),l=function(e,t){return Object(n.createElement)(a.BlockControls,null,Object(n.createElement)(c.ToolbarGroup,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},u=function(e,t){var r=Object(i.getSetting)("showAvatars",!0),a=Object(i.getSetting)("reviewRatingsEnabled",!0);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!a&&Object(n.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(n.createInterpolateElement)(Object(o.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(i.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(c.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)(s.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&&!r&&Object(n.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(n.createInterpolateElement)(Object(o.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(i.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},b=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(c.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(c.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)(c.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)(c.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)(c.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}))}},15:function(e,t){e.exports=window.wp.apiFetch},155:function(e,t,r){"use strict";var n=r(0),o=r(33),c=Object(n.createElement)(o.SVG,{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},159:function(e,t){},162:function(e,t,r){"use strict";var n=r(0),o=(r(2),r(6)),c=r.n(o),a=r(41),i=r(22);r(216),t.a=Object(i.withInstanceId)((function(e){var t=e.className,r=e.instanceId,o=e.label,i=e.onChange,s=e.options,l=e.screenReaderLabel,u=e.readOnly,b=e.value,d="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)(a.a,{label:o,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",onChange:i,readOnly:u,value:b},s.map((function(e){return Object(n.createElement)("option",{key:e.key,value:e.key},e.label)}))))}))},166:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(1),o=r(11),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:"#",
|
2 |
/* translators: An example person name used for the block previews. */
|
3 |
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.defaultAvatar,96:o.q.defaultAvatar},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:"#",
|
4 |
/* translators: An example person name used for the block previews. */
|
5 |
+
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.defaultAvatar,96:o.q.defaultAvatar},rating:null,verified:!1}]}}},193: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}}},194:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(0),a=(r(215),r(83));t.a=function(e){var t=e.attributes;return Object(c.createElement)("div",o()({className:Object(a.a)(t)},Object(a.b)(t)))}},201:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(18),a=r.n(c),i=r(19),s=r.n(i),l=r(20),u=r.n(l),b=r(10),d=r.n(b),p=r(0),w=r(1),v=r(12),m=(r(2),r(7)),f=r(4),g=r(3),h=r(106),O=r(41),y=(r(257),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})))});y.defaultProps={label:Object(w.__)("Load more","woo-gutenberg-products-block")};var j=y,_=r(162),k=(r(254),function(e){var t=e.onChange,r=e.readOnly,n=e.value;return Object(p.createElement)(_.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(w.__)("Order by","woo-gutenberg-products-block"),onChange:t,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:r,screenReaderLabel:Object(w.__)("Order reviews by","woo-gutenberg-products-block"),value:n})}),R=r(5),E=r.n(R),P=r(6),S=r.n(P),C=r(13),N=r.n(C),T=r(237),x=r.n(T),L=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=x()(e,{suffix:r,limit:t});return n.html},A=function(e,t,r,n){var o=M(e,t,r);return L(e,o-n.length,n)},M=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=I(n,t.clientHeight,r);return n.middle},I=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e};var D=function(e){s()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=d()(t);if(r){var o=d()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return u()(this,e)});function c(e){var t;return o()(this,c),(t=n.apply(this,arguments)).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},t.reviewSummary=Object(v.createRef)(),t.reviewContent=Object(v.createRef)(),t.getButton=t.getButton.bind(N()(t)),t.onClick=t.onClick.bind(N()(t)),t}return a()(c,[{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:A(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}}]),c}(v.Component);D.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 B=D;r(256);var H=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,a=t.showReviewerName,i=t.showReviewImage,s=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,v=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||a||i||v)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},i&&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||a||v||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},v&&function(e){var t=e.rating,r={width:t/5*100+"%"},n=Object(w.sprintf)(
|
6 |
/* translators: %f is referring to the average rating value */
|
7 |
+
Object(w.__)("Rated %f out of 5","woo-gutenberg-products-block"),t);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","aria-label":n},Object(p.createElement)("span",{style:r},n)))}(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),a&&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)(B,{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))};function G(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?G(Object(r),!0).forEach((function(t){E()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}r(255);var V=function(e){var t=e.attributes,r=e.reviews,n=Object(g.getSetting)("showAvatars",!0),o=Object(g.getSetting)("reviewRatingsEnabled",!0),c=(n||"product"===t.imageType)&&t.showReviewImage,a=o&&t.showReviewRating,i=F(F({},t),{},{showReviewImage:c,showReviewRating:a});return Object(p.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(p.createElement)(H,{attributes:i}):r.map((function(e,t){return Object(p.createElement)(H,{key:e.id||t,attributes:i,review:e})})))},z=r(9),W=r.n(z),q=r(28),U=r.n(q),J=r(23),Y=r.n(J),K=r(34),Q=r.n(K),X=r(83),Z=r(43);var $=function(e){var t=function(t){s()(i,t);var r,n,c=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=d()(r);if(n){var o=d()(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return u()(this,e)});function i(){var e;o()(this,i);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return e=c.call.apply(c,[this].concat(r)),E()(N()(e),"isPreview",!!e.props.attributes.previewReviews),E()(N()(e),"delayedAppendReviews",e.props.delayFunction(e.appendReviews)),E()(N()(e),"isMounted",!1),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=U()(Y.a.mark((function t(r){var n,o;return Y.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.isMounted){t.next=2;break}return t.abrupt("return");case 2:return n=e.props.onReviewsLoadError,t.next=5,Object(Z.a)(r);case 5:o=t.sent,e.setState({reviews:[],loading:!1,error:o}),n(o);case 8:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}()),e}return a()(i,[{key:"componentDidMount",value:function(){this.isMounted=!0,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||!Q()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnmount",value:function(){this.isMounted=!1,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,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{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(X.c)(this.getArgs(t.length)).then((function(r){var n=r.reviews,o=r.totalReviews;return e.isMounted&&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,a=r.totalReviews;return Object(p.createElement)(e,W()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),i}(v.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()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=d()(t);if(r){var o=d()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return u()(this,e)});function c(){return o()(this,c),n.apply(this,arguments)}return a()(c,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;if(r)return Object(p.createElement)(h.a,{className:"wc-block-featured-product-error",error:r,isLoading:n});if(0===c.length&&!n)return Object(p.createElement)(o,{attributes:t});var i=Object(g.getSetting)("reviewRatingsEnabled",!0);return Object(p.createElement)(f.Disabled,null,t.showOrderby&&i&&Object(p.createElement)(k,{readOnly:!0,value:t.orderby}),Object(p.createElement)(V,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(p.createElement)(j,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")}))}}]),c}(v.Component));var ee=function(e){s()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=d()(t);if(r){var o=d()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return u()(this,e)});function c(){return o()(this,c),n.apply(this,arguments)}return a()(c,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(f.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,a=t.showProductName,i=t.showReviewDate,s=t.showReviewerName,l=t.showReviewContent,u=t.showReviewImage,b=t.showReviewRating,d=Object(X.d)(t.orderby),w=d.order,v=d.orderby;return l||b||i||s||u||a?Object(p.createElement)("div",{className:Object(X.a)(t)},Object(p.createElement)($,{attributes:t,categoryIds:n,delayFunction:function(e){return Object(m.debounce)(e,400)},noReviewsPlaceholder:r,orderby:v,order:w,productId:o,reviewsToDisplay:c})):this.renderHiddenContentPlaceholder()}}]),c}(v.Component);t.a=ee},21:function(e,t){e.exports=window.wp.blockEditor},215:function(e,t){},216:function(e,t){},22:function(e,t){e.exports=window.wp.compose},23:function(e,t){e.exports=window.regeneratorRuntime},25:function(e,t){e.exports=window.wp.blocks},254:function(e,t){},255:function(e,t){},256:function(e,t){},257:function(e,t){},3:function(e,t){e.exports=window.wc.wcSettings},33:function(e,t){e.exports=window.wp.primitives},34:function(e,t){e.exports=window.wp.isShallowEqual},4:function(e,t){e.exports=window.wp.components},41:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(0),a=r(6),i=r.n(a);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){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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,a=e.wrapperProps,s=void 0===a?{}:a,u=null!=r,b=null!=n;return!u&&b?(t=o||"span",s=l(l({},s),{},{className:i()(s.className,"screen-reader-text")}),Object(c.createElement)(t,s,n)):(t=o||c.Fragment,u&&b&&r!==n?Object(c.createElement)(t,s,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,s,r))}},43:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l}));var n=r(28),o=r.n(n),c=r(23),a=r.n(c),i=r(1),s=function(){var e=o()(a.a.mark((function e(t){var r;return a.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(_x){return e.apply(this,arguments)}}(),l=function(e){if(e.data&&"rest_invalid_param"===e.code){var t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},49:function(e,t){e.exports=window.wp.escapeHtml},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(49));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(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"===a?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")))}},62:function(e,t,r){"use strict";var n=r(5),o=r.n(n),c=r(14),a=r.n(c),i=r(0),s=["srcElement","size"];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}t.a=function(e){var t=e.srcElement,r=e.size,n=void 0===r?24:r,c=a()(e,s);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?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}({width:n,height:n},c)):null}},7:function(e,t){e.exports=window.lodash},756:function(e,t,r){e.exports=r(837)},83: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(15),o=r.n(n),c=r(6),a=r.n(c),i=r(3),s=function(e){if(Object(i.getSetting)("reviewRatingsEnabled",!0)){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,i=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"),a()(b,t,{"has-image":l,"has-name":c,"has-date":o,"has-rating":u,"has-content":i,"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}},837:function(e,t,r){"use strict";r.r(t);var n=r(5),o=r.n(n),c=r(0),a=r(1),i=r(25),s=r(62),l=r(33),u=Object(c.createElement)(l.SVG,{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(215),r(21)),d=r(4),p=(r(2),r(201)),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(a.__)("All Reviews","woo-gutenberg-products-block")},Object(a.__)("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"))},v=r(145),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(a.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(d.ToggleControl,{label:Object(a.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(v.b)(t,r)),Object(c.createElement)(d.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block")},Object(v.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(a.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))},f=r(193),g=r(194),h=r(166);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 y(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(i.registerBlockType)("woocommerce/all-reviews",{title:Object(a.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(s.a,{srcElement:u}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1},example:y(y({},h.a),{},{attributes:y(y({},h.a.attributes),{},{showProductName:!0})}),attributes:y(y({},f.a),{},{showProductName:{type:"boolean",default:!0}}),transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:function(e){var t=e.idBase,r=e.instance;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:function(e){var t=e.instance;return Object(i.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:function(e){return Object(c.createElement)(m,e)},save:g.a})},86:function(e,t,r){"use strict";var n=r(9),o=r.n(n),c=r(16),a=r.n(c),i=r(18),s=r.n(i),l=r(13),u=r.n(l),b=r(19),d=r.n(b),p=r(20),w=r.n(p),v=r(10),m=r.n(v),f=r(0),g=r(7),h=r(6),O=r.n(h),y=r(4),j=r(22);r(125);var _=function(e){d()(c,e);var t,r,n=(t=c,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,n=m()(t);if(r){var o=m()(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return w()(this,e)});function c(){var e;return a()(this,c),(e=n.apply(this,arguments)).onClick=e.onClick.bind(u()(e)),e}return s()(c,[{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,a=r.instanceId,i=r.className,s=r.help,l=r.options,u=r.value,b="inspector-toggle-button-control-".concat(a);return s&&(e=Object(g.isFunction)(s)?s(c):s),Object(f.createElement)(y.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",i)},Object(f.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(f.createElement)(y.ButtonGroup,{"aria-labelledby":b+"__label"},l.map((function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isSecondary=!0,c["aria-pressed"]=!1),Object(f.createElement)(y.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)}))))}}]),c}(f.Component);t.a=Object(j.withInstanceId)(_)}});
|
build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{105:function(t,e,r){"use strict";r.d(e,"a",(function(){return c})),r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"d",(function(){return s}));var n=r(38),i=r.n(n),c=function(t){return"number"==typeof t},o=function(t){return"string"==typeof t},a=function(t){return!function(t){return null===t}(t)&&"object"===i()(t)};function s(t,e){return a(t)&&e in t}},
|
2 |
/* translators: %s Field label. */
|
3 |
-
Object(s.__)("%s (optional)","woo-gutenberg-products-block"),t.label)),t.priority&&(Object(u.a)(t.priority)&&(e.index=t.priority),Object(u.c)(t.priority)&&(e.index=parseInt(t.priority,10))),t.hidden&&(e.required=!1),e},b=Object.entries(l).map((function(t){var e=o()(t,2),r=e[0],n=e[1];return[r,Object.entries(n).map((function(t){var e=o()(t,2),r=e[0],n=e[1];return[r,f(n)]})).reduce((function(t,e){var r=o()(e,2),n=r[0],i=r[1];return t[n]=i,t}),{})]})).reduce((function(t,e){var r=o()(e,2),n=r[0],i=r[1];return t[n]=i,t}),{});e.a=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==b[r]?b[r]:{};return t.map((function(t){var r=a.defaultAddressFields[t]||{},i=n[t]||{},c=e[t]||{};return d(d(d({key:t},r),i),c)})).sort((function(t,e){return t.index-e.index}))}},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[1],{105:function(t,e,r){"use strict";r.d(e,"a",(function(){return c})),r.d(e,"c",(function(){return o})),r.d(e,"b",(function(){return a})),r.d(e,"d",(function(){return s}));var n=r(38),i=r.n(n),c=function(t){return"number"==typeof t},o=function(t){return"string"==typeof t},a=function(t){return!function(t){return null===t}(t)&&"object"===i()(t)};function s(t,e){return a(t)&&e in t}},114:function(t,e,r){"use strict";var n=r(5),i=r.n(n),c=r(8),o=r.n(c),a=r(3),s=r(1),u=r(105);function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var l=Object(a.getSetting)("countryLocale",{}),f=function(t){var e={};return void 0!==t.label&&(e.label=t.label),void 0!==t.required&&(e.required=t.required),void 0!==t.hidden&&(e.hidden=t.hidden),void 0===t.label||t.optionalLabel||(e.optionalLabel=Object(s.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
+
Object(s.__)("%s (optional)","woo-gutenberg-products-block"),t.label)),t.priority&&(Object(u.a)(t.priority)&&(e.index=t.priority),Object(u.c)(t.priority)&&(e.index=parseInt(t.priority,10))),t.hidden&&(e.required=!1),e},b=Object.entries(l).map((function(t){var e=o()(t,2),r=e[0],n=e[1];return[r,Object.entries(n).map((function(t){var e=o()(t,2),r=e[0],n=e[1];return[r,f(n)]})).reduce((function(t,e){var r=o()(e,2),n=r[0],i=r[1];return t[n]=i,t}),{})]})).reduce((function(t,e){var r=o()(e,2),n=r[0],i=r[1];return t[n]=i,t}),{});e.a=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=r&&void 0!==b[r]?b[r]:{};return t.map((function(t){var r=a.defaultAddressFields[t]||{},i=n[t]||{},c=e[t]||{};return d(d(d({key:t},r),i),c)})).sort((function(t,e){return t.index-e.index}))}},143:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(8),i=r.n(n),c=function(t){return t.reduce((function(t,e){var r=i()(e,2),n=r[0],c=r[1];return t[n]=c,t}),{})}},167:function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"c",(function(){return a})),r.d(e,"a",(function(){return s}));var n=r(3),i=r(114),c=r(24),o=function(t){var e=t.country,r=void 0===e?"":e,n=t.state,i=void 0===n?"":n,c=t.city,o=void 0===c?"":c,a=t.postcode,s=void 0===a?"":a;return{country:r.trim(),state:i.trim(),city:o.trim(),postcode:s?s.replace(" ","").toUpperCase():""}},a=function(t){var e=t.email,r=void 0===e?"":e;return Object(c.isEmail)(r)?r.trim():""},s=function(t){var e=Object.keys(n.defaultAddressFields),r=Object(i.a)(e,{},t.country),c=Object.assign({},t);return r.forEach((function(e){var r=e.key,n=void 0===r?"":r,i=e.hidden;void 0!==i&&i&&function(t,e){return t in e}(n,t)&&(c[n]="")})),c}},45:function(t,e,r){"use strict";r.d(e,"a",(function(){return j}));var n=r(8),i=r.n(n),c=r(5),o=r.n(c),a=r(7),s=r(0),u=r(27),p=r(17),d=r(26),l=r(143),f=r(167),b=r(60);function O(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var v={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},_=g(g({},v),{},{email:""}),y={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:u.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},m=function(t){return Object(l.a)(Object.entries(t).map((function(t){var e=i()(t,2),r=e[0],n=e[1];return[r,Object(d.decodeEntities)(n)]})))},h={cartCoupons:u.EMPTY_CART_COUPONS,cartItems:u.EMPTY_CART_ITEMS,cartFees:u.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:y,cartIsLoading:!0,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:_,shippingAddress:v,shippingRates:u.EMPTY_SHIPPING_RATES,shippingRatesLoading:!1,cartHasCalculatedShipping:!1,paymentRequirements:u.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:function(){},extensions:u.EMPTY_EXTENSIONS},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0},e=Object(b.b)(),r=e.isEditor,n=e.previewData,i=null==n?void 0:n.previewCart,c=t.shouldSelect,o=Object(s.useRef)(),d=Object(p.useSelect)((function(t,e){var n=e.dispatch;if(!c)return h;if(r)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:u.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:u.EMPTY_CART_ERRORS,billingAddress:_,shippingAddress:v,extensions:u.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,shippingRatesLoading:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:function(){}};var o=t(u.CART_STORE_KEY),a=o.getCartData(),s=o.getCartErrors(),p=o.getCartTotals(),d=!o.hasFinishedResolution("getCartData"),l=o.isCustomerDataUpdating(),b=n(u.CART_STORE_KEY).receiveCart,O=m(a.billingAddress),y=a.needsShipping?m(a.shippingAddress):O,j=a.fees.length>0?a.fees.map((function(t){return m(t)})):u.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map((function(t){return g(g({},t),{},{label:t.code})})):u.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:j,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:p,cartIsLoading:d,cartErrors:s,billingAddress:Object(f.a)(O),shippingAddress:Object(f.a)(y),extensions:a.extensions,shippingRates:a.shippingRates,shippingRatesLoading:l,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:b}}),[c]);return o.current&&Object(a.isEqual)(o.current,d)||(o.current=d),o.current}},60:function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a}));var n=r(0),i=r(17),c=Object(n.createContext)({isEditor:!1,currentPostId:0,previewData:{},getPreviewData:function(){}}),o=function(){return Object(n.useContext)(c)},a=function(t){var e=t.children,r=t.currentPostId,o=void 0===r?0:r,a=t.previewData,s=void 0===a?{}:a,u=Object(i.useSelect)((function(t){return o||t("core/editor").getCurrentPostId()}),[o]),p=Object(n.useCallback)((function(t){return t in s?s[t]:{}}),[s]),d={isEditor:!0,currentPostId:u,previewData:s,getPreviewData:p};return Object(n.createElement)(c.Provider,{value:d},e)}},66:function(t,e,r){"use strict";r.d(e,"a",(function(){return p}));var n=r(5),i=r.n(n),c=r(55),o=r(0),a=r(45);function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function u(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach((function(e){i()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var p=function(){var t=Object(a.a)(),e=Object(o.useRef)(t);return Object(o.useEffect)((function(){e.current=t}),[t]),{dispatchStoreEvent:Object(o.useCallback)((function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-".concat(t),e)}catch(t){console.error(t)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(c.doAction)("experimental__woocommerce_blocks-checkout-".concat(t),u(u({},r),{},{storeCart:e.current}))}catch(t){console.error(t)}}),[])}}}}]);
|
build/atomic-block-components/add-to-cart--atomic-block-components/button.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{130:function(e,t,n){"use strict";n.d(t,"b",(function(){return w})),n.d(t,"a",(function(){return y}));var c=n(5),r=n.n(c),o=n(8),i=n.n(o),s=n(0),u=(n(2),n(17)),a=n(66),f=n(60),d=n(9),l=n.n(d),b=n(6),v=n.n(b),O=n(868),p=(n(207),function(e){var t=e.status;switch(void 0===t?"default":t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""}),j=function(e){var t=e.className,n=e.notices,c=e.removeNotice,r=n.filter((function(e){return"snackbar"!==e.type}));if(!r.length)return null;var o=v()(t,"wc-block-components-notices");return Object(s.createElement)("div",{className:o},r.map((function(e){return Object(s.createElement)(O.a,l()({key:"store-notice-"+e.id},e,{className:v()("wc-block-components-notices__notice",p(e)),onRemove:function(){e.isDismissible&&c(e.id)}}),e.content)})))};function m(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function g(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach((function(t){r()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var h=Object(s.createContext)({notices:[],createNotice:function(e,t,n){},removeNotice:function(e,t){},setIsSuppressed:function(e){},context:"wc/core"}),w=function(){return Object(s.useContext)(h)},y=function(e){var t=e.children,n=e.className,c=void 0===n?"":n,r=e.createNoticeContainer,o=void 0===r||r,d=e.context,l=void 0===d?"wc/core":d,b=Object(u.useDispatch)("core/notices"),v=b.createNotice,O=b.removeNotice,p=Object(s.useState)(!1),m=i()(p,2),w=m[0],y=m[1],N=Object(a.a)().dispatchStoreEvent,E=Object(f.b)().isEditor,P=Object(s.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]:{};v(e,t,g(g({},n),{},{context:n.context||l})),N("store-notice-create",{status:e,content:t,options:n})}),[v,N,l]),S=Object(s.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;O(e,t)}),[O,l]),D={notices:Object(u.useSelect)((function(e){return{notices:e("core/notices").getNotices(l)}}),[l]).notices,createNotice:P,removeNotice:S,context:l,setIsSuppressed:y},k=w?null:Object(s.createElement)(j,{className:c,notices:D.notices,removeNotice:D.removeNotice,isEditor:E});return Object(s.createElement)(h.Provider,{value:D},o&&k,t)}},207:function(e,t){},57:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(5),r=n.n(c),o=n(0),i=n(130);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function u(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){r()(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 a=function(){var e=Object(i.b)(),t=e.notices,n=e.createNotice,c=e.removeNotice,r=e.setIsSuppressed,s=Object(o.useRef)(t);Object(o.useEffect)((function(){s.current=t}),[t]);var a=Object(o.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.forEach((function(t){null!==e&&t.status!==e||c(t.id)}))},removeNotice:c}}),[c]),f=Object(o.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))}}}),[n]);return u(u(u({notices:t},a),f),{},{setIsSuppressed:r})}},770:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var c=n(8),r=n.n(c),o=n(0),i=n(17),s=n(27),u=n(26),a=n(45),f=n(57),d=function(e,t){var n=e.find((function(e){return e.id===t}));return n?n.quantity:0},l=function(e){var t=Object(i.useDispatch)(s.CART_STORE_KEY).addItemToCart,n=Object(a.a)(),c=n.cartItems,l=n.cartIsLoading,b=Object(f.a)(),v=b.addErrorNotice,O=b.removeNotice,p=Object(o.useState)(!1),j=r()(p,2),m=j[0],g=j[1],h=Object(o.useRef)(d(c,e));return Object(o.useEffect)((function(){var t=d(c,e);t!==h.current&&(h.current=t)}),[c,e]),{cartQuantity:Number.isFinite(h.current)?h.current:0,addingToCart:m,cartIsLoading:l,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return g(!0),t(e,n).then((function(){O("add-to-cart")})).catch((function(e){v(Object(u.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){g(!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([[2],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{874:function(e,n,a){"use strict";var c=a(9),r=a.n(c),t=a(0);n.a=function(e){return function(n){return function(a){var c=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}(e,a);return Object(t.createElement)(n,r()({},a,c))}}}}}]);
|
build/atomic-block-components/add-to-cart-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{102:function(e,t,r){"use strict";var n=r(12),c=r.n(n),o=r(17),a=r.n(o),s=r(71),i=r(3),u=r.n(i),l=r(125),f=(r(189),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,i=a()(e,f),d=u()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return React.createElement(s.a,c()({className:d},i),n&&React.createElement(l.a,null),React.createElement("span",{className:"wc-block-components-button__text"},o))}},115:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return f}));var n,c=r(5),o=r.n(c),a=r(7);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 i(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,s=t.callback,u=t.priority,f=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return f.set(a,{priority:u,callback:s}),i(i({},e),{},o()({},c,f));case n.REMOVE_EVENT_CALLBACK:return f.delete(a),i(i({},e),{},o()({},c,f))}}},125:function(e,t,r){"use strict";r(185),t.a=function(){return React.createElement("span",{className:"wc-block-components-spinner","aria-hidden":"true"})}},136:function(e,t,r){"use strict";r.d(t,"b",(function(){return g})),r.d(t,"a",(function(){return y}));var n=r(23),c=r.n(n),o=r(5),a=r.n(o),s=r(17),i=r.n(s),u=r(6),l=r.n(u),f=r(0),d=r(7),b=r(27),p=r.n(b);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 v(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){a()(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}function O(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var h=Object(f.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}}),g=function(){return Object(f.useContext)(h)},y=function(e){var t=e.children,r=Object(f.useState)({}),n=l()(r,2),c=n[0],o=n[1],s=Object(f.useCallback)((function(e){return c[e]}),[c]),u=Object(f.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),b=Object(f.useCallback)((function(e){o((function(t){return t[e]?(t[e],i()(t,[e].map(O))):t}))}),[]),m=Object(f.useCallback)((function(){o({})}),[]),g=Object(f.useCallback)((function(e){e&&o((function(t){return e=Object(d.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&p()(t[r],e))})),0===Object.values(e).length?t:v(v({},t),e)}))}),[]),y=Object(f.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=v(v({},r[e]),t);return p()(r[e],n)?r:v(v({},r),{},a()({},e,n))}))}),[]),j={getValidationError:s,setValidationErrors:g,clearValidationError:b,clearAllValidationErrors:m,hideValidationError:Object(f.useCallback)((function(e){y(e,{hidden:!0})}),[y]),showValidationError:Object(f.useCallback)((function(e){y(e,{hidden:!1})}),[y]),showAllValidationErrors:Object(f.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=v(v({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:v(v({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return React.createElement(h.Provider,{value:j},t)}},184: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}},185:function(e,t){},188:function(e,t){},189:function(e,t){},229:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r(8);var n=r(136),c=(r(188),function(e){var t=e.errorMessage,r=void 0===t?"":t,c=e.propertyName,o=void 0===c?"":c,a=e.elementId,s=void 0===a?"":a,i=Object(n.b)(),u=i.getValidationError,l=i.getValidationErrorId;if(!r||"string"!=typeof r){var f=u(o)||{};if(!f.message||f.hidden)return null;r=f.message}return React.createElement("div",{className:"wc-block-components-validation-error",role:"alert"},React.createElement("p",{id:l(s)},r))})},235:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(115),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))}}}},236:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p}));var n=r(23),c=r.n(n),o=r(59),a=r.n(o),s=r(29),i=r.n(s),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(42);function f(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return d(e,void 0);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)?d(e,void 0):void 0}}(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=r.call(e)},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 d(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(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,l,d,b;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],s=f(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=19;break}return d=l.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:b=e.sent,"object"===c()(b)&&a.push(b),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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),p=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,d,b,p;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),s=f(a),e.prev=3,s.s();case 5:if((d=s.n()).done){e.next=28;break}return b=d.value,e.prev=7,e.next=10,Promise.resolve(b.callback(n));case 10:if(p=e.sent,"object"===c()(p)&&null!==p){e.next=13;break}return e.abrupt("continue",26);case 13:if(p.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(p)&&!Object(l.b)(p)){e.next=18;break}return o.push(p),e.abrupt("return",o);case 18:o.push(p),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),s.e(e.t1);case 33:return e.prev=33,s.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},312:function(e,t,r){"use strict";var n=r(34),c=React.createElement(n.SVG,{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=c},318:function(e,t,r){"use strict";var n=r(12),c=r.n(n),o=r(184);t.a=function(e){return function(t){return function(r){var n=Object(o.a)(e,r);return React.createElement(t,c()({},r,n))}}}},326:function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(6),c=r.n(n),o=r(0),a=r(13),s=r(10),i=r(24),u=r(32),l=r(53),f=function(e,t){var r=e.find((function(e){return e.id===t}));return r?r.quantity:0},d=function(e){var t=Object(a.useDispatch)(s.CART_STORE_KEY).addItemToCart,r=Object(u.a)(),n=r.cartItems,d=r.cartIsLoading,b=Object(l.a)(),p=b.addErrorNotice,m=b.removeNotice,v=Object(o.useState)(!1),O=c()(v,2),h=O[0],g=O[1],y=Object(o.useRef)(f(n,e));return Object(o.useEffect)((function(){var t=f(n,e);t!==y.current&&(y.current=t)}),[n,e]),{cartQuantity:Number.isFinite(y.current)?y.current:0,addingToCart:h,cartIsLoading:d,addToCart:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return g(!0),t(e,r).then((function(){m("add-to-cart")})).catch((function(e){p(Object(i.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){g(!1)}))}}}},332:function(e,t){},333:function(e,t){},342:function(e,t,r){"use strict";r.r(t);var n=r(318),c=(r(8),r(3)),o=r.n(c),a=r(6),s=r.n(a),i=r(0),u=r(1),l=r(66),f=function(e){return e.is_purchasable||!1},d={status:"pristine",hasError:!1,quantity:1,processingResponse:null,requestParams:{}},b=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"set_has_error":"set_no_error";return{type:t}},p=r(5),m=r.n(p);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 O(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){m()(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 h="idle",g=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case"set_pristine":e=d;break;case"set_idle":e=t.status!==h?O(O({},t),{},{status:h}):t;break;case"set_disabled":e="disabled"!==t.status?O(O({},t),{},{status:"disabled"}):t;break;case"set_quantity":e=n!==t.quantity?O(O({},t),{},{quantity:n}):t;break;case"set_request_params":e=O(O({},t),{},{requestParams:O(O({},t.requestParams),o)});break;case"set_processing_response":e=O(O({},t),{},{processingResponse:o});break;case"set_processing":e=!1===(e="processing"!==t.status?O(O({},t),{},{status:"processing",hasError:!1}):t).hasError?e:O(O({},e),{},{hasError:!1});break;case"set_before_processing":e="before_processing"!==t.status?O(O({},t),{},{status:"before_processing",hasError:!1}):t;break;case"set_after_processing":e="after_processing"!==t.status?O(O({},t),{},{status:"after_processing"}):t;break;case"set_has_error":e=t.hasError?t:O(O({},t),{},{hasError:!0}),e="processing"===t.status||"before_processing"===t.status?O(O({},e),{},{status:h}):e;break;case"set_no_error":e=t.hasError?O(O({},t),{},{hasError:!1}):t}return e!==t&&"set_pristine"!==c&&"pristine"===e.status&&(e.status=h),e},y=r(115),j=r(235),E=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(j.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(j.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(j.a)("add_to_cart_before_processing",e)}},w=r(236),_=r(136),P=r(53),k=r(42),R=Object(i.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){}}}),C=function(){return Object(i.useContext)(R)},A=function(e){var t=e.children,r=e.product,n=e.showFormElements,c=Object(i.useReducer)(g,d),o=s()(c,2),a=o[0],p=o[1],m=Object(i.useReducer)(y.b,{}),v=s()(m,2),O=v[0],h=v[1],j=Object(l.a)(O),C=Object(P.a)(),A=C.addErrorNotice,S=C.removeNotices,N=Object(_.b)().setValidationErrors,D=Object(k.c)(),x=D.isSuccessResponse,T=D.isErrorResponse,V=D.isFailResponse,q=Object(i.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:E(h).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:E(h).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:E(h).onAddToCartBeforeProcessing}}),[h]),I=Object(i.useMemo)((function(){return{resetForm:function(){p({type:"set_pristine"})},submitForm:function(){p({type:"set_before_processing"})},setQuantity:function(e){p(function(e){return{type:"set_quantity",quantity:e}}(e))},setHasError:function(e){p(b(e))},setRequestParams:function(e){p(function(e){return{type:"set_request_params",data:e}}(e))},setAfterProcessing:function(e){p({type:"set_processing_response",data:e}),p({type:"set_after_processing"})}}}),[]);Object(i.useEffect)((function(){var e=a.status,t=!r.id||!f(r);"disabled"!==e||t?"disabled"!==e&&t&&p({type:"set_disabled"}):p({type:"set_idle"})}),[a.status,r,p]),Object(i.useEffect)((function(){"before_processing"===a.status&&(S("error"),Object(w.a)(j,"add_to_cart_before_processing",{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&A(t),r&&N(r)})),p({type:"set_idle"})):p({type:"set_processing"})})))}),[a.status,N,A,S,p,j]),Object(i.useEffect)((function(){if("after_processing"===a.status){var e={processingResponse:a.processingResponse},t=function(e){var t=!1;return e.forEach((function(e){var r=e.message,n=e.messageContext;(T(e)||V(e))&&r&&(t=!0,A(r,n?{context:n}:void 0))})),t};if(a.hasError)return void Object(w.b)(j,"add_to_cart_after_processing_with_error",e).then((function(r){if(!t(r)){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"})}p({type:"set_idle"})}));Object(w.b)(j,"add_to_cart_after_processing_with_success",e).then((function(e){t(e)?p(b(!0)):p({type:"set_idle"})}))}}),[a.status,a.hasError,a.processingResponse,I,A,T,V,x,j]);var F=function(e){return["simple","variable"].includes(e.type||"simple")}(r),B={product:r,productType:r.type||"simple",productIsPurchasable:f(r),productHasOptions:r.has_options||!1,supportsFormElements:F,showFormElements:n&&F,quantity:a.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:a.requestParams,isIdle:"idle"===a.status,isDisabled:"disabled"===a.status,isProcessing:"processing"===a.status,isBeforeProcessing:"before_processing"===a.status,isAfterProcessing:"after_processing"===a.status,hasError:a.hasError,eventRegistration:q,dispatchActions:I};return React.createElement(R.Provider,{value:B},t)},S=r(68),N=r.n(S),D=r(24),x=r(32);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}var V=function(){var e=C(),t=e.dispatchActions,r=e.product,n=e.quantity,c=e.eventRegistration,o=e.hasError,a=e.isProcessing,l=e.requestParams,f=Object(_.b)(),d=f.hasValidationErrors,b=f.showAllValidationErrors,p=Object(P.a)(),v=p.addErrorNotice,O=p.removeNotice,h=Object(x.a)().receiveCart,g=Object(i.useState)(!1),y=s()(g,2),j=y[0],E=y[1],w=!o&&a,k=Object(i.useCallback)((function(){return!d||(b(),{type:"error"})}),[d,b]);Object(i.useEffect)((function(){var e=c.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[c,k]);var R=Object(i.useCallback)((function(){E(!0),O("add-to-cart");var e=function(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){m()(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}({id:r.id||0,quantity:n},l);N()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){N.a.setNonce(e.headers),e.json().then((function(r){e.ok?h(r):(r.body&&r.body.message?v(Object(D.decodeEntities)(r.body.message),{id:"add-to-cart"}):v(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)}))})).catch((function(e){e.json().then((function(e){var r;null!==(r=e.data)&&void 0!==r&&r.cart&&h(e.data.cart),t.setHasError(),t.setAfterProcessing(e),E(!1)}))}))}),[r,v,O,h,t,n,l]);return Object(i.useEffect)((function(){w&&!j&&R()}),[w,R,j]),null},q=function(e){var t=e.children,r=e.product,n=e.showFormElements;return React.createElement(_.a,null,React.createElement(A,{product:r,showFormElements:n},t,React.createElement(V,null)))},I=r(98),F=r(7),B=r(244),L=(r(332),r(102)),M=r(150),Q=r(312),W=r(55),H=r(326),K=function(e){var t=e.className,r=e.href,n=e.text,c=e.onClick;return React.createElement(L.a,{className:t,href:r,onClick:c,rel:"nofollow"},n)},J=function(e){var t=e.className,r=e.quantityInCart,n=e.isProcessing,c=e.isDisabled,o=e.isDone,a=e.onClick;return React.createElement(L.a,{className:t,disabled:c,showSpinner:n,onClick:a},o&&r>0?Object(u.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
-
Object(u._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(u.__)("Add to cart","woo-gutenberg-products-block"),!!o&&React.createElement(M.a,{srcElement:Q.a,alt:Object(u.__)("Done","woo-gutenberg-products-block")}))},U=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,n=e.productHasOptions,c=e.product,o=e.productType,a=e.isDisabled,l=e.isProcessing,f=e.eventRegistration,d=e.hasError,b=e.dispatchActions,p=Object(I.useInnerBlockLayoutContext)().parentName,m=Object(W.a)().dispatchStoreEvent,v=Object(H.a)(c.id||0).cartQuantity,O=Object(i.useState)(!1),h=s()(O,2),g=h[0],y=h[1],j=c.add_to_cart||{url:"",text:""};return Object(i.useEffect)((function(){var e=f.onAddToCartAfterProcessingWithSuccess((function(){return d||y(!0),!0}),0);return function(){e()}}),[f,d]),(t||!n&&"simple"===o)&&r?React.createElement(J,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:v,isDisabled:a,isProcessing:l,isDone:g,onClick:function(){b.submitForm(),m("cart-add-item",{product:c,listName:p})}}):React.createElement(K,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(u.__)("View Product","woo-gutenberg-products-block"),onClick:function(){m("product-view-link",{product:c,listName:p})}})},Y=function(e){var t=e.disabled,r=e.min,n=e.max,c=e.value,o=e.onChange;return React.createElement("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:c,min:r,max:n,hidden:1===n,disabled:t,onChange:function(e){o(e.target.value)}})},z=function(e){var t=e.reason,r=void 0===t?Object(u.__)("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)},G=function(){var e=C(),t=e.product,r=e.quantity,n=e.minQuantity,c=e.maxQuantity,o=e.dispatchActions,a=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement(z,null):t.id&&!t.is_in_stock?React.createElement(z,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(Y,{value:r,min:n,max:c,disabled:a,onChange:o.setQuantity}),React.createElement(U,null))},X=(r(333),r(60)),$=r.n(X),Z=r(343),ee=r(4),te=r(229),re={value:"",label:Object(u.__)("Select an option","woo-gutenberg-products-block")},ne=function(e){var t=e.attributeName,r=e.options,n=void 0===r?[]:r,c=e.value,a=void 0===c?"":c,s=e.onChange,i=void 0===s?function(){}:s,l=e.errorMessage,f=void 0===l?Object(u.__)("Please select a value.","woo-gutenberg-products-block"):l,d=Object(_.b)(),b=d.getValidationError,p=d.setValidationErrors,v=d.clearValidationError,O=t,h=b(O)||{};return Object(ee.useEffect)((function(){a?v(O):p(m()({},O,{message:f,hidden:!0}))}),[a,O,f,v,p]),Object(ee.useEffect)((function(){return function(){v(O)}}),[O,v]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},React.createElement(Z.a,{label:Object(D.decodeEntities)(t),value:a||"",options:[re].concat($()(n)),onChange:i,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),React.createElement(te.a,{propertyName:O,elementId:O}))};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 oe(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){m()(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 ae=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}))}))};function se(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?se(Object(r),!0).forEach((function(t){m()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ue=function(e){var t=e.attributes,r=e.variationAttributes,n=e.setRequestParams,c=Object(l.a)(t),o=Object(l.a)(r),a=Object(i.useState)(0),u=s()(a,2),f=u[0],d=u[1],b=Object(i.useState)({}),p=s()(b,2),v=p[0],O=p[1],h=Object(i.useMemo)((function(){return 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=oe(oe({},r),{},m()({},c,null)),i=o?ae(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(c,o,v)}),[v,c,o]);return Object(i.useEffect)((function(){Object.values(v).filter((function(e){return""!==e})).length===Object.keys(c).length?d(function(e,t,r){return ae(e,t,r)[0]||0}(c,o,v)):f>0&&d(0)}),[v,f,c,o]),Object(i.useEffect)((function(){n({id:f,variation:Object.keys(v).map((function(e){return{attribute:e,value:v[e]}}))})}),[n,f,v]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(c).map((function(e){return React.createElement(ne,{key:e,attributeName:e,options:h[e],value:v[e],onChange:function(t){O(ie(ie({},v),{},m()({},e,t)))}})})))},le=function(e){var t=e.product,r=e.dispatchers,n=function(e){return e?Object(F.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):{}}(t.attributes),c=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===c.length?null:React.createElement(ue,{attributes:n,variationAttributes:c,setRequestParams:r.setRequestParams})},fe=function(){var e=C(),t=e.product,r=e.quantity,n=e.minQuantity,c=e.maxQuantity,o=e.dispatchActions,a=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement(z,null):t.id&&!t.is_in_stock?React.createElement(z,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(le,{product:t,dispatchers:o}),React.createElement(Y,{value:r,min:n,max:c,disabled:a,onChange:o.setQuantity}),React.createElement(U,null))},de=function(){return React.createElement(U,null)},be=r(311),pe=function(){return React.createElement(be.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},me=function(){return React.createElement(pe,null)},ve=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?React.createElement(fe,null):"grouped"===r?React.createElement(me,null):"external"===r?React.createElement(de,null):"simple"===r||"variation"===r?React.createElement(G,null):null:React.createElement(U,null)},Oe=Object(B.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,n=Object(I.useProductDataContext)().product,c=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(F.isEmpty)(n)});return React.createElement(q,{product:n,showFormElements:r},React.createElement("div",{className:c},React.createElement(ve,null)))}));t.default=Object(n.a)({showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}})(Oe)},42:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return f}));var n,c,o=r(78);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},s=function(e){return a(e,n.SUCCESS)},i=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},f=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:s,isErrorResponse:i,isFailResponse:u}}},53:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(5),c=r.n(n),o=r(0),a=r(120);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 i(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 u=function(){var e=Object(a.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.setIsSuppressed,s=Object(o.useRef)(t);Object(o.useEffect)((function(){s.current=t}),[t]);var u=Object(o.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.forEach((function(t){null!==e&&t.status!==e||n(t.id)}))},removeNotice:n}}),[n]),l=Object(o.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("default",e,i({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("error",e,i({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("warning",e,i({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("info",e,i({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("success",e,i({},t))}}}),[r]);return i(i(i({notices:t},u),l),{},{setIsSuppressed:c})}},66:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(27),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[2],{106:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return f}));var n,c=r(5),o=r.n(c),a=r(7);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 i(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},f=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,s=t.callback,u=t.priority,f=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return f.set(a,{priority:u,callback:s}),i(i({},e),{},o()({},c,f));case n.REMOVE_EVENT_CALLBACK:return f.delete(a),i(i({},e),{},o()({},c,f))}}},117:function(e,t,r){"use strict";var n=r(13),c=r.n(n),o=r(17),a=r.n(o),s=r(74),i=r(3),u=r.n(i),l=r(135),f=(r(201),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,i=a()(e,f),d=u()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return React.createElement(s.a,c()({className:d},i),n&&React.createElement(l.a,null),React.createElement("span",{className:"wc-block-components-button__text"},o))}},134:function(e,t,r){"use strict";r.d(t,"b",(function(){return g})),r.d(t,"a",(function(){return y}));var n=r(22),c=r.n(n),o=r(5),a=r.n(o),s=r(17),i=r.n(s),u=r(6),l=r.n(u),f=r(0),d=r(7),b=r(27),p=r.n(b);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 v(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){a()(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}function O(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var h=Object(f.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}}),g=function(){return Object(f.useContext)(h)},y=function(e){var t=e.children,r=Object(f.useState)({}),n=l()(r,2),c=n[0],o=n[1],s=Object(f.useCallback)((function(e){return c[e]}),[c]),u=Object(f.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),b=Object(f.useCallback)((function(e){o((function(t){return t[e]?(t[e],i()(t,[e].map(O))):t}))}),[]),m=Object(f.useCallback)((function(){o({})}),[]),g=Object(f.useCallback)((function(e){e&&o((function(t){return e=Object(d.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&p()(t[r],e))})),0===Object.values(e).length?t:v(v({},t),e)}))}),[]),y=Object(f.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=v(v({},r[e]),t);return p()(r[e],n)?r:v(v({},r),{},a()({},e,n))}))}),[]),j={getValidationError:s,setValidationErrors:g,clearValidationError:b,clearAllValidationErrors:m,hideValidationError:Object(f.useCallback)((function(e){y(e,{hidden:!0})}),[y]),showValidationError:Object(f.useCallback)((function(e){y(e,{hidden:!1})}),[y]),showAllValidationErrors:Object(f.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=v(v({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:v(v({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return React.createElement(h.Provider,{value:j},t)}},135:function(e,t,r){"use strict";r(199),t.a=function(){return React.createElement("span",{className:"wc-block-components-spinner","aria-hidden":"true"})}},198: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}},199:function(e,t){},200:function(e,t){},201:function(e,t){},203:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(106),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))}}}},204:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p}));var n=r(22),c=r.n(n),o=r(48),a=r.n(o),s=r(29),i=r.n(s),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(38);function f(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return d(e,void 0);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)?d(e,void 0):void 0}}(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=r.call(e)},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 d(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(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,l,d,b;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],s=f(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=19;break}return d=l.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:b=e.sent,"object"===c()(b)&&a.push(b),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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),p=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,d,b,p;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),s=f(a),e.prev=3,s.s();case 5:if((d=s.n()).done){e.next=28;break}return b=d.value,e.prev=7,e.next=10,Promise.resolve(b.callback(n));case 10:if(p=e.sent,"object"===c()(p)&&null!==p){e.next=13;break}return e.abrupt("continue",26);case 13:if(p.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(p)&&!Object(l.b)(p)){e.next=18;break}return o.push(p),e.abrupt("return",o);case 18:o.push(p),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),s.e(e.t1);case 33:return e.prev=33,s.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},239:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r(10);var n=r(134),c=(r(200),function(e){var t=e.errorMessage,r=void 0===t?"":t,c=e.propertyName,o=void 0===c?"":c,a=e.elementId,s=void 0===a?"":a,i=Object(n.b)(),u=i.getValidationError,l=i.getValidationErrorId;if(!r||"string"!=typeof r){var f=u(o)||{};if(!f.message||f.hidden)return null;r=f.message}return React.createElement("div",{className:"wc-block-components-validation-error",role:"alert"},React.createElement("p",{id:l(s)},r))})},323:function(e,t,r){"use strict";var n=r(34),c=React.createElement(n.SVG,{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=c},329:function(e,t,r){"use strict";var n=r(13),c=r.n(n),o=r(198);t.a=function(e){return function(t){return function(r){var n=Object(o.a)(e,r);return React.createElement(t,c()({},r,n))}}}},337:function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(6),c=r.n(n),o=r(0),a=r(12),s=r(8),i=r(24),u=r(33),l=r(61),f=function(e,t){var r=e.find((function(e){return e.id===t}));return r?r.quantity:0},d=function(e){var t=Object(a.useDispatch)(s.CART_STORE_KEY).addItemToCart,r=Object(u.a)(),n=r.cartItems,d=r.cartIsLoading,b=Object(l.a)(),p=b.addErrorNotice,m=b.removeNotice,v=Object(o.useState)(!1),O=c()(v,2),h=O[0],g=O[1],y=Object(o.useRef)(f(n,e));return Object(o.useEffect)((function(){var t=f(n,e);t!==y.current&&(y.current=t)}),[n,e]),{cartQuantity:Number.isFinite(y.current)?y.current:0,addingToCart:h,cartIsLoading:d,addToCart:function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return g(!0),t(e,r).then((function(){m("add-to-cart")})).catch((function(e){p(Object(i.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){g(!1)}))}}}},343:function(e,t){},344:function(e,t){},353:function(e,t,r){"use strict";r.r(t);var n=r(329),c=(r(10),r(3)),o=r.n(c),a=r(6),s=r.n(a),i=r(0),u=r(1),l=r(60),f=function(e){return e.is_purchasable||!1},d={status:"pristine",hasError:!1,quantity:1,processingResponse:null,requestParams:{}},b=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"set_has_error":"set_no_error";return{type:t}},p=r(5),m=r.n(p);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 O(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){m()(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 h="idle",g=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case"set_pristine":e=d;break;case"set_idle":e=t.status!==h?O(O({},t),{},{status:h}):t;break;case"set_disabled":e="disabled"!==t.status?O(O({},t),{},{status:"disabled"}):t;break;case"set_quantity":e=n!==t.quantity?O(O({},t),{},{quantity:n}):t;break;case"set_request_params":e=O(O({},t),{},{requestParams:O(O({},t.requestParams),o)});break;case"set_processing_response":e=O(O({},t),{},{processingResponse:o});break;case"set_processing":e=!1===(e="processing"!==t.status?O(O({},t),{},{status:"processing",hasError:!1}):t).hasError?e:O(O({},e),{},{hasError:!1});break;case"set_before_processing":e="before_processing"!==t.status?O(O({},t),{},{status:"before_processing",hasError:!1}):t;break;case"set_after_processing":e="after_processing"!==t.status?O(O({},t),{},{status:"after_processing"}):t;break;case"set_has_error":e=t.hasError?t:O(O({},t),{},{hasError:!0}),e="processing"===t.status||"before_processing"===t.status?O(O({},e),{},{status:h}):e;break;case"set_no_error":e=t.hasError?O(O({},t),{},{hasError:!1}):t}return e!==t&&"set_pristine"!==c&&"pristine"===e.status&&(e.status=h),e},y=r(106),j=r(203),E=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(j.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(j.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(j.a)("add_to_cart_before_processing",e)}},w=r(204),_=r(134),P=r(61),k=r(38),R=Object(i.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){}}}),C=function(){return Object(i.useContext)(R)},A=function(e){var t=e.children,r=e.product,n=e.showFormElements,c=Object(i.useReducer)(g,d),o=s()(c,2),a=o[0],p=o[1],m=Object(i.useReducer)(y.b,{}),v=s()(m,2),O=v[0],h=v[1],j=Object(l.a)(O),C=Object(P.a)(),A=C.addErrorNotice,S=C.removeNotices,N=Object(_.b)().setValidationErrors,D=Object(k.c)(),x=D.isSuccessResponse,T=D.isErrorResponse,V=D.isFailResponse,q=Object(i.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:E(h).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:E(h).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:E(h).onAddToCartBeforeProcessing}}),[h]),I=Object(i.useMemo)((function(){return{resetForm:function(){p({type:"set_pristine"})},submitForm:function(){p({type:"set_before_processing"})},setQuantity:function(e){p(function(e){return{type:"set_quantity",quantity:e}}(e))},setHasError:function(e){p(b(e))},setRequestParams:function(e){p(function(e){return{type:"set_request_params",data:e}}(e))},setAfterProcessing:function(e){p({type:"set_processing_response",data:e}),p({type:"set_after_processing"})}}}),[]);Object(i.useEffect)((function(){var e=a.status,t=!r.id||!f(r);"disabled"!==e||t?"disabled"!==e&&t&&p({type:"set_disabled"}):p({type:"set_idle"})}),[a.status,r,p]),Object(i.useEffect)((function(){"before_processing"===a.status&&(S("error"),Object(w.a)(j,"add_to_cart_before_processing",{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&A(t),r&&N(r)})),p({type:"set_idle"})):p({type:"set_processing"})})))}),[a.status,N,A,S,p,j]),Object(i.useEffect)((function(){if("after_processing"===a.status){var e={processingResponse:a.processingResponse},t=function(e){var t=!1;return e.forEach((function(e){var r=e.message,n=e.messageContext;(T(e)||V(e))&&r&&(t=!0,A(r,n?{context:n}:void 0))})),t};if(a.hasError)return void Object(w.b)(j,"add_to_cart_after_processing_with_error",e).then((function(r){if(!t(r)){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"})}p({type:"set_idle"})}));Object(w.b)(j,"add_to_cart_after_processing_with_success",e).then((function(e){t(e)?p(b(!0)):p({type:"set_idle"})}))}}),[a.status,a.hasError,a.processingResponse,I,A,T,V,x,j]);var F=function(e){return["simple","variable"].includes(e.type||"simple")}(r),B={product:r,productType:r.type||"simple",productIsPurchasable:f(r),productHasOptions:r.has_options||!1,supportsFormElements:F,showFormElements:n&&F,quantity:a.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:a.requestParams,isIdle:"idle"===a.status,isDisabled:"disabled"===a.status,isProcessing:"processing"===a.status,isBeforeProcessing:"before_processing"===a.status,isAfterProcessing:"after_processing"===a.status,hasError:a.hasError,eventRegistration:q,dispatchActions:I};return React.createElement(R.Provider,{value:B},t)},S=r(67),N=r.n(S),D=r(24),x=r(33);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}var V=function(){var e=C(),t=e.dispatchActions,r=e.product,n=e.quantity,c=e.eventRegistration,o=e.hasError,a=e.isProcessing,l=e.requestParams,f=Object(_.b)(),d=f.hasValidationErrors,b=f.showAllValidationErrors,p=Object(P.a)(),v=p.addErrorNotice,O=p.removeNotice,h=Object(x.a)().receiveCart,g=Object(i.useState)(!1),y=s()(g,2),j=y[0],E=y[1],w=!o&&a,k=Object(i.useCallback)((function(){return!d||(b(),{type:"error"})}),[d,b]);Object(i.useEffect)((function(){var e=c.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[c,k]);var R=Object(i.useCallback)((function(){E(!0),O("add-to-cart");var e=function(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){m()(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}({id:r.id||0,quantity:n},l);N()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){N.a.setNonce(e.headers),e.json().then((function(r){e.ok?h(r):(r.body&&r.body.message?v(Object(D.decodeEntities)(r.body.message),{id:"add-to-cart"}):v(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)}))})).catch((function(e){e.json().then((function(e){var r;null!==(r=e.data)&&void 0!==r&&r.cart&&h(e.data.cart),t.setHasError(),t.setAfterProcessing(e),E(!1)}))}))}),[r,v,O,h,t,n,l]);return Object(i.useEffect)((function(){w&&!j&&R()}),[w,R,j]),null},q=function(e){var t=e.children,r=e.product,n=e.showFormElements;return React.createElement(_.a,null,React.createElement(A,{product:r,showFormElements:n},t,React.createElement(V,null)))},I=r(108),F=r(7),B=r(252),L=(r(343),r(117)),M=r(157),Q=r(323),W=r(56),H=r(337),K=function(e){var t=e.className,r=e.href,n=e.text,c=e.onClick;return React.createElement(L.a,{className:t,href:r,onClick:c,rel:"nofollow"},n)},J=function(e){var t=e.className,r=e.quantityInCart,n=e.isProcessing,c=e.isDisabled,o=e.isDone,a=e.onClick;return React.createElement(L.a,{className:t,disabled:c,showSpinner:n,onClick:a},o&&r>0?Object(u.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
+
Object(u._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(u.__)("Add to cart","woo-gutenberg-products-block"),!!o&&React.createElement(M.a,{srcElement:Q.a,alt:Object(u.__)("Done","woo-gutenberg-products-block")}))},U=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,n=e.productHasOptions,c=e.product,o=e.productType,a=e.isDisabled,l=e.isProcessing,f=e.eventRegistration,d=e.hasError,b=e.dispatchActions,p=Object(I.useInnerBlockLayoutContext)().parentName,m=Object(W.a)().dispatchStoreEvent,v=Object(H.a)(c.id||0).cartQuantity,O=Object(i.useState)(!1),h=s()(O,2),g=h[0],y=h[1],j=c.add_to_cart||{url:"",text:""};return Object(i.useEffect)((function(){var e=f.onAddToCartAfterProcessingWithSuccess((function(){return d||y(!0),!0}),0);return function(){e()}}),[f,d]),(t||!n&&"simple"===o)&&r?React.createElement(J,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:v,isDisabled:a,isProcessing:l,isDone:g,onClick:function(){b.submitForm(),m("cart-add-item",{product:c,listName:p})}}):React.createElement(K,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(u.__)("View Product","woo-gutenberg-products-block"),onClick:function(){m("product-view-link",{product:c,listName:p})}})},Y=function(e){var t=e.disabled,r=e.min,n=e.max,c=e.value,o=e.onChange;return React.createElement("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:c,min:r,max:n,hidden:1===n,disabled:t,onChange:function(e){o(e.target.value)}})},z=function(e){var t=e.reason,r=void 0===t?Object(u.__)("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)},G=function(){var e=C(),t=e.product,r=e.quantity,n=e.minQuantity,c=e.maxQuantity,o=e.dispatchActions,a=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement(z,null):t.id&&!t.is_in_stock?React.createElement(z,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(Y,{value:r,min:n,max:c,disabled:a,onChange:o.setQuantity}),React.createElement(U,null))},X=(r(344),r(58)),$=r.n(X),Z=r(354),ee=r(4),te=r(239),re={value:"",label:Object(u.__)("Select an option","woo-gutenberg-products-block")},ne=function(e){var t=e.attributeName,r=e.options,n=void 0===r?[]:r,c=e.value,a=void 0===c?"":c,s=e.onChange,i=void 0===s?function(){}:s,l=e.errorMessage,f=void 0===l?Object(u.__)("Please select a value.","woo-gutenberg-products-block"):l,d=Object(_.b)(),b=d.getValidationError,p=d.setValidationErrors,v=d.clearValidationError,O=t,h=b(O)||{};return Object(ee.useEffect)((function(){a?v(O):p(m()({},O,{message:f,hidden:!0}))}),[a,O,f,v,p]),Object(ee.useEffect)((function(){return function(){v(O)}}),[O,v]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},React.createElement(Z.a,{label:Object(D.decodeEntities)(t),value:a||"",options:[re].concat($()(n)),onChange:i,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),React.createElement(te.a,{propertyName:O,elementId:O}))};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 oe(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){m()(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 ae=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}))}))};function se(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?se(Object(r),!0).forEach((function(t){m()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):se(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ue=function(e){var t=e.attributes,r=e.variationAttributes,n=e.setRequestParams,c=Object(l.a)(t),o=Object(l.a)(r),a=Object(i.useState)(0),u=s()(a,2),f=u[0],d=u[1],b=Object(i.useState)({}),p=s()(b,2),v=p[0],O=p[1],h=Object(i.useMemo)((function(){return 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=oe(oe({},r),{},m()({},c,null)),i=o?ae(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(c,o,v)}),[v,c,o]);return Object(i.useEffect)((function(){Object.values(v).filter((function(e){return""!==e})).length===Object.keys(c).length?d(function(e,t,r){return ae(e,t,r)[0]||0}(c,o,v)):f>0&&d(0)}),[v,f,c,o]),Object(i.useEffect)((function(){n({id:f,variation:Object.keys(v).map((function(e){return{attribute:e,value:v[e]}}))})}),[n,f,v]),React.createElement("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(c).map((function(e){return React.createElement(ne,{key:e,attributeName:e,options:h[e],value:v[e],onChange:function(t){O(ie(ie({},v),{},m()({},e,t)))}})})))},le=function(e){var t=e.product,r=e.dispatchers,n=function(e){return e?Object(F.keyBy)(Object.values(e).filter((function(e){return e.has_variations})),"name"):{}}(t.attributes),c=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===c.length?null:React.createElement(ue,{attributes:n,variationAttributes:c,setRequestParams:r.setRequestParams})},fe=function(){var e=C(),t=e.product,r=e.quantity,n=e.minQuantity,c=e.maxQuantity,o=e.dispatchActions,a=e.isDisabled;return t.id&&!t.is_purchasable?React.createElement(z,null):t.id&&!t.is_in_stock?React.createElement(z,{reason:Object(u.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):React.createElement(React.Fragment,null,React.createElement(le,{product:t,dispatchers:o}),React.createElement(Y,{value:r,min:n,max:c,disabled:a,onChange:o.setQuantity}),React.createElement(U,null))},de=function(){return React.createElement(U,null)},be=r(322),pe=function(){return React.createElement(be.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},me=function(){return React.createElement(pe,null)},ve=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?React.createElement(fe,null):"grouped"===r?React.createElement(me,null):"external"===r?React.createElement(de,null):"simple"===r||"variation"===r?React.createElement(G,null):null:React.createElement(U,null)},Oe=Object(B.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,n=Object(I.useProductDataContext)().product,c=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(F.isEmpty)(n)});return React.createElement(q,{product:n,showFormElements:r},React.createElement("div",{className:c},React.createElement(ve,null)))}));t.default=Object(n.a)({showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}})(Oe)},38:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return f}));var n,c,o=r(75);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},s=function(e){return a(e,n.SUCCESS)},i=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},f=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:s,isErrorResponse:i,isFailResponse:u}}},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(27),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(5),c=r.n(n),o=r(0),a=r(114);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 i(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 u=function(){var e=Object(a.b)(),t=e.notices,r=e.createNotice,n=e.removeNotice,c=e.setIsSuppressed,s=Object(o.useRef)(t);Object(o.useEffect)((function(){s.current=t}),[t]);var u=Object(o.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.forEach((function(t){null!==e&&t.status!==e||n(t.id)}))},removeNotice:n}}),[n]),l=Object(o.useMemo)((function(){return{addDefaultNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("default",e,i({},t))},addErrorNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("error",e,i({},t))},addWarningNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("warning",e,i({},t))},addInfoNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("info",e,i({},t))},addSuccessNotice:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};r("success",e,i({},t))}}}),[r]);return i(i(i({notices:t},u),l),{},{setIsSuppressed:c})}}}]);
|
build/atomic-block-components/add-to-cart.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{114:function(e,t,r){"use strict";var n=r(0);r(206),t.a=function(){return Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})}},128:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b}));var n,c=r(5),o=r.n(c),a=r(7);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 i(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,s=t.callback,u=t.priority,b=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return b.set(a,{priority:u,callback:s}),i(i({},e),{},o()({},c,b));case n.REMOVE_EVENT_CALLBACK:return b.delete(a),i(i({},e),{},o()({},c,b))}}},134:function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return g}));var n=r(38),c=r.n(n),o=r(5),a=r.n(o),s=r(14),i=r.n(s),u=r(9),l=r.n(u),b=r(0),d=r(7),f=r(36),p=r.n(f);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 m(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}function v(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var j=Object(b.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}}),h=function(){return Object(b.useContext)(j)},g=function(e){var t=e.children,r=Object(b.useState)({}),n=l()(r,2),c=n[0],o=n[1],s=Object(b.useCallback)((function(e){return c[e]}),[c]),u=Object(b.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),f=Object(b.useCallback)((function(e){o((function(t){return t[e]?(t[e],i()(t,[e].map(v))):t}))}),[]),O=Object(b.useCallback)((function(){o({})}),[]),h=Object(b.useCallback)((function(e){e&&o((function(t){return e=Object(d.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&p()(t[r],e))})),0===Object.values(e).length?t:m(m({},t),e)}))}),[]),g=Object(b.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=m(m({},r[e]),t);return p()(r[e],n)?r:m(m({},r),{},a()({},e,n))}))}),[]),y={getValidationError:s,setValidationErrors:h,clearValidationError:f,clearAllValidationErrors:O,hideValidationError:Object(b.useCallback)((function(e){g(e,{hidden:!0})}),[g]),showValidationError:Object(b.useCallback)((function(e){g(e,{hidden:!1})}),[g]),showAllValidationErrors:Object(b.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=m(m({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:m(m({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return Object(b.createElement)(j.Provider,{value:y},t)}},205:function(e,t){},206:function(e,t){},207:function(e,t){},229:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=(r(2),r(134)),o=(r(207),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||"string"!=typeof r){var d=l(a)||{};if(!d.message||d.hidden)return null;r=d.message}return Object(n.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(n.createElement)("p",{id:b(i)},r))})},306:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},318:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(128),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))}}}},319:function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p}));var n=r(38),c=r.n(n),o=r(31),a=r.n(o),s=r(24),i=r.n(s),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(51);function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return d(e,void 0);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)?d(e,void 0):void 0}}(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=r.call(e)},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 d(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 f=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,l,d,f;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],s=b(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=19;break}return d=l.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:f=e.sent,"object"===c()(f)&&a.push(f),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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),p=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,d,f,p;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),s=b(a),e.prev=3,s.s();case 5:if((d=s.n()).done){e.next=28;break}return f=d.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:if(p=e.sent,"object"===c()(p)&&null!==p){e.next=13;break}return e.abrupt("continue",26);case 13:if(p.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(p)&&!Object(l.b)(p)){e.next=18;break}return o.push(p),e.abrupt("return",o);case 18:o.push(p),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),s.e(e.t1);case 33:return e.prev=33,s.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},369:function(e,t){},373:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},374:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(6)),o=r.n(c),a=r(9),s=r.n(a),i=r(1),u=r(71),l=r(847),b={status:"pristine",hasError:!1,quantity:1,processingResponse:null,requestParams:{}},d=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"set_has_error":"set_no_error";return{type:t}},f=r(5),p=r.n(f);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 m(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){p()(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 v="idle",j=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case"set_pristine":e=b;break;case"set_idle":e=t.status!==v?m(m({},t),{},{status:v}):t;break;case"set_disabled":e="disabled"!==t.status?m(m({},t),{},{status:"disabled"}):t;break;case"set_quantity":e=n!==t.quantity?m(m({},t),{},{quantity:n}):t;break;case"set_request_params":e=m(m({},t),{},{requestParams:m(m({},t.requestParams),o)});break;case"set_processing_response":e=m(m({},t),{},{processingResponse:o});break;case"set_processing":e=!1===(e="processing"!==t.status?m(m({},t),{},{status:"processing",hasError:!1}):t).hasError?e:m(m({},e),{},{hasError:!1});break;case"set_before_processing":e="before_processing"!==t.status?m(m({},t),{},{status:"before_processing",hasError:!1}):t;break;case"set_after_processing":e="after_processing"!==t.status?m(m({},t),{},{status:"after_processing"}):t;break;case"set_has_error":e=t.hasError?t:m(m({},t),{},{hasError:!0}),e="processing"===t.status||"before_processing"===t.status?m(m({},e),{},{status:v}):e;break;case"set_no_error":e=t.hasError?m(m({},t),{},{hasError:!1}):t}return e!==t&&"set_pristine"!==c&&"pristine"===e.status&&(e.status=v),e},h=r(128),g=r(318),y=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(g.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(g.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(g.a)("add_to_cart_before_processing",e)}},E=r(319),_=r(134),w=r(57),P=r(51),k=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){}}}),C=function(){return Object(n.useContext)(k)},A=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=Object(n.useReducer)(j,b),a=s()(o,2),f=a[0],p=a[1],O=Object(n.useReducer)(h.b,{}),m=s()(O,2),v=m[0],g=m[1],C=Object(u.a)(v),A=Object(w.a)(),S=A.addErrorNotice,x=A.removeNotices,D=Object(_.b)().setValidationErrors,N=Object(P.c)(),V=N.isSuccessResponse,R=N.isErrorResponse,T=N.isFailResponse,q=Object(n.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:y(g).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:y(g).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:y(g).onAddToCartBeforeProcessing}}),[g]),F=Object(n.useMemo)((function(){return{resetForm:function(){p({type:"set_pristine"})},submitForm:function(){p({type:"set_before_processing"})},setQuantity:function(e){p(function(e){return{type:"set_quantity",quantity:e}}(e))},setHasError:function(e){p(d(e))},setRequestParams:function(e){p(function(e){return{type:"set_request_params",data:e}}(e))},setAfterProcessing:function(e){p({type:"set_processing_response",data:e}),p({type:"set_after_processing"})}}}),[]);Object(n.useEffect)((function(){var e=f.status,t=!r.id||!Object(l.a)(r);"disabled"!==e||t?"disabled"!==e&&t&&p({type:"set_disabled"}):p({type:"set_idle"})}),[f.status,r,p]),Object(n.useEffect)((function(){"before_processing"===f.status&&(x("error"),Object(E.a)(C,"add_to_cart_before_processing",{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&S(t),r&&D(r)})),p({type:"set_idle"})):p({type:"set_processing"})})))}),[f.status,D,S,x,p,C]),Object(n.useEffect)((function(){if("after_processing"===f.status){var e={processingResponse:f.processingResponse},t=function(e){var t=!1;return e.forEach((function(e){var r=e.message,n=e.messageContext;(R(e)||T(e))&&r&&(t=!0,S(r,n?{context:n}:void 0))})),t};if(f.hasError)return void Object(E.b)(C,"add_to_cart_after_processing_with_error",e).then((function(r){if(!t(r)){var n,c=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");S(c,{id:"add-to-cart"})}p({type:"set_idle"})}));Object(E.b)(C,"add_to_cart_after_processing_with_success",e).then((function(e){t(e)?p(d(!0)):p({type:"set_idle"})}))}}),[f.status,f.hasError,f.processingResponse,F,S,R,T,V,C]);var B=Object(l.b)(r),I={product:r,productType:r.type||"simple",productIsPurchasable:Object(l.a)(r),productHasOptions:r.has_options||!1,supportsFormElements:B,showFormElements:c&&B,quantity:f.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:f.requestParams,isIdle:"idle"===f.status,isDisabled:"disabled"===f.status,isProcessing:"processing"===f.status,isBeforeProcessing:"before_processing"===f.status,isAfterProcessing:"after_processing"===f.status,hasError:f.hasError,eventRegistration:q,dispatchActions:F};return Object(n.createElement)(k.Provider,{value:I},t)},S=r(15),x=r.n(S),D=r(26),N=r(45);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}var R=function(){var e=C(),t=e.dispatchActions,r=e.product,c=e.quantity,o=e.eventRegistration,a=e.hasError,u=e.isProcessing,l=e.requestParams,b=Object(_.b)(),d=b.hasValidationErrors,f=b.showAllValidationErrors,O=Object(w.a)(),m=O.addErrorNotice,v=O.removeNotice,j=Object(N.a)().receiveCart,h=Object(n.useState)(!1),g=s()(h,2),y=g[0],E=g[1],P=!a&&u,k=Object(n.useCallback)((function(){return!d||(f(),{type:"error"})}),[d,f]);Object(n.useEffect)((function(){var e=o.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[o,k]);var A=Object(n.useCallback)((function(){E(!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?V(Object(r),!0).forEach((function(t){p()(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}({id:r.id||0,quantity:c},l);x()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){x.a.setNonce(e.headers),e.json().then((function(r){e.ok?j(r):(r.body&&r.body.message?m(Object(D.decodeEntities)(r.body.message),{id:"add-to-cart"}):m(Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),E(!1)}))})).catch((function(e){e.json().then((function(e){var r;null!==(r=e.data)&&void 0!==r&&r.cart&&j(e.data.cart),t.setHasError(),t.setAfterProcessing(e),E(!1)}))}))}),[r,m,v,j,t,c,l]);return Object(n.useEffect)((function(){P&&!y&&A()}),[P,A,y]),null},T=function(e){var t=e.children,r=e.product,c=e.showFormElements;return Object(n.createElement)(_.a,null,Object(n.createElement)(A,{product:r,showFormElements:c},t,Object(n.createElement)(R,null)))},q=r(44),F=r(7),B=r(82),I=(r(369),r(87)),L=r(63),M=r(306),Q=r(65),W=r(765),H=function(e){var t=e.className,r=e.href,c=e.text,o=e.onClick;return Object(n.createElement)(I.a,{className:t,href:r,onClick:o,rel:"nofollow"},c)},K=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)(I.a,{className:t,disabled:o,showSpinner:c,onClick:s},a&&r>0?Object(i.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
-
Object(i._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(i.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(L.a,{srcElement:M.a,alt:Object(i.__)("Done","woo-gutenberg-products-block")}))},U=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,u=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,d=e.hasError,f=e.dispatchActions,p=Object(q.useInnerBlockLayoutContext)().parentName,O=Object(Q.a)().dispatchStoreEvent,m=Object(W.a)(o.id||0).cartQuantity,v=Object(n.useState)(!1),j=s()(v,2),h=j[0],g=j[1],y=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return d||g(!0),!0}),0);return function(){e()}}),[b,d]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(K,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:u,isProcessing:l,isDone:h,onClick:function(){f.submitForm(),O("cart-add-item",{product:o,listName:p})}}):Object(n.createElement)(H,{className:"wc-block-components-product-add-to-cart-button",href:y.url,text:y.text||Object(i.__)("View Product","woo-gutenberg-products-block"),onClick:function(){O("product-view-link",{product:o,listName:p})}})},z=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)}})},G=function(e){var t=e.reason,r=void 0===t?Object(i.__)("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)},J=function(){var e=C(),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)(G,null):t.id&&!t.is_in_stock?Object(n.createElement)(G,{reason:Object(i.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(z,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(U,null))},Y=(r(543),r(35)),X=r.n(Y),$=r(862),Z=r(12),ee=r(229),te={value:"",label:Object(i.__)("Select an option","woo-gutenberg-products-block")},re=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,a=e.value,s=void 0===a?"":a,u=e.onChange,l=void 0===u?function(){}:u,b=e.errorMessage,d=void 0===b?Object(i.__)("Please select a value.","woo-gutenberg-products-block"):b,f=Object(_.b)(),O=f.getValidationError,m=f.setValidationErrors,v=f.clearValidationError,j=t,h=O(j)||{};return Object(Z.useEffect)((function(){s?v(j):m(p()({},j,{message:d,hidden:!0}))}),[s,j,d,v,m]),Object(Z.useEffect)((function(){return function(){v(j)}}),[j,v]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(n.createElement)($.a,{label:Object(D.decodeEntities)(t),value:s||"",options:[te].concat(X()(c)),onChange:l,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(ee.a,{propertyName:j,elementId:j}))};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 ce(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){p()(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 oe=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}))}))};function ae(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?ae(Object(r),!0).forEach((function(t){p()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ie=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(u.a)(t),a=Object(u.a)(r),i=Object(n.useState)(0),l=s()(i,2),b=l[0],d=l[1],f=Object(n.useState)({}),O=s()(f,2),m=O[0],v=O[1],j=Object(n.useMemo)((function(){return 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=ce(ce({},r),{},p()({},c,null)),i=o?oe(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(o,a,m)}),[m,o,a]);return Object(n.useEffect)((function(){Object.values(m).filter((function(e){return""!==e})).length===Object.keys(o).length?d(function(e,t,r){return oe(e,t,r)[0]||0}(o,a,m)):b>0&&d(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)(re,{key:e,attributeName:e,options:j[e],value:m[e],onChange:function(t){v(se(se({},m),{},p()({},e,t)))}})})))},ue=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(F.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)(ie,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},le=function(){var e=C(),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)(G,null):t.id&&!t.is_in_stock?Object(n.createElement)(G,{reason:Object(i.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(ue,{product:t,dispatchers:a}),Object(n.createElement)(z,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(U,null))},be=function(){return Object(n.createElement)(U,null)},de=r(860),fe=function(){return Object(n.createElement)(de.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},pe=function(){return Object(n.createElement)(fe,null)},Oe=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(le,null):"grouped"===r?Object(n.createElement)(pe,null):"external"===r?Object(n.createElement)(be,null):"simple"===r||"variation"===r?Object(n.createElement)(J,null):null:Object(n.createElement)(U,null)};t.a=Object(B.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(q.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(F.isEmpty)(c)});return Object(n.createElement)(T,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(Oe,null)))}))},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return b}));var n,c,o=r(105);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},s=function(e){return a(e,n.SUCCESS)},i=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},b=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:s,isErrorResponse:i,isFailResponse:u}}},543:function(e,t){},71:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(36),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},847: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")}},868:function(e,t,r){"use strict";r.r(t);var n=r(865),c=r(374),o=r(373);t.default=Object(n.a)(o.a)(c.a)},87:function(e,t,r){"use strict";var n=r(8),c=r.n(n),o=r(14),a=r.n(o),s=r(0),i=r(181),u=r(6),l=r.n(u),b=r(114),d=(r(205),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,d),f=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(s.createElement)(i.a,c()({className:f},u),n&&Object(s.createElement)(b.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},o))}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{115:function(e,t,r){"use strict";var n=r(0);r(209),t.a=function(){return Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})}},129:function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return b}));var n,c=r(5),o=r.n(c),a=r(7);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 i(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}!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(n||(n={}));var u={addEventCallback:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(a.uniqueId)(),type:n.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:function(e,t){return{id:t,type:n.REMOVE_EVENT_CALLBACK,eventType:e}}},l={},b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l,t=arguments.length>1?arguments[1]:void 0,r=t.type,c=t.eventType,a=t.id,s=t.callback,u=t.priority,b=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(r){case n.ADD_EVENT_CALLBACK:return b.set(a,{priority:u,callback:s}),i(i({},e),{},o()({},c,b));case n.REMOVE_EVENT_CALLBACK:return b.delete(a),i(i({},e),{},o()({},c,b))}}},136:function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return g}));var n=r(38),c=r.n(n),o=r(5),a=r.n(o),s=r(14),i=r.n(s),u=r(8),l=r.n(u),b=r(0),d=r(7),f=r(34),p=r.n(f);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 m(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}function v(e){var t=function(e,t){if("object"!==c()(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!==c()(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===c()(t)?t:String(t)}var j=Object(b.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}}),h=function(){return Object(b.useContext)(j)},g=function(e){var t=e.children,r=Object(b.useState)({}),n=l()(r,2),c=n[0],o=n[1],s=Object(b.useCallback)((function(e){return c[e]}),[c]),u=Object(b.useCallback)((function(e){var t=c[e];return!t||t.hidden?"":"validate-error-".concat(e)}),[c]),f=Object(b.useCallback)((function(e){o((function(t){return t[e]?(t[e],i()(t,[e].map(v))):t}))}),[]),O=Object(b.useCallback)((function(){o({})}),[]),h=Object(b.useCallback)((function(e){e&&o((function(t){return e=Object(d.pickBy)(e,(function(e,r){return!("string"!=typeof e.message||t.hasOwnProperty(r)&&p()(t[r],e))})),0===Object.values(e).length?t:m(m({},t),e)}))}),[]),g=Object(b.useCallback)((function(e,t){o((function(r){if(!r.hasOwnProperty(e))return r;var n=m(m({},r[e]),t);return p()(r[e],n)?r:m(m({},r),{},a()({},e,n))}))}),[]),y={getValidationError:s,setValidationErrors:h,clearValidationError:f,clearAllValidationErrors:O,hideValidationError:Object(b.useCallback)((function(e){g(e,{hidden:!0})}),[g]),showValidationError:Object(b.useCallback)((function(e){g(e,{hidden:!1})}),[g]),showAllValidationErrors:Object(b.useCallback)((function(){o((function(e){var t={};return Object.keys(e).forEach((function(r){e[r].hidden&&(t[r]=m(m({},e[r]),{},{hidden:!1}))})),0===Object.values(t).length?e:m(m({},e),t)}))}),[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:u};return Object(b.createElement)(j.Provider,{value:y},t)}},208:function(e,t){},209:function(e,t){},210:function(e,t){},232:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),c=(r(2),r(136)),o=(r(210),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||"string"!=typeof r){var d=l(a)||{};if(!d.message||d.hidden)return null;r=d.message}return Object(n.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(n.createElement)("p",{id:b(i)},r))})},309:function(e,t,r){"use strict";var n=r(0),c=r(33),o=Object(n.createElement)(c.SVG,{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},321:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(129),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))}}}},322:function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return p}));var n=r(38),c=r.n(n),o=r(28),a=r.n(o),s=r(23),i=r.n(s),u=function(e,t){return e[t]?Array.from(e[t].values()).sort((function(e,t){return e.priority-t.priority})):[]},l=r(51);function b(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return d(e,void 0);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)?d(e,void 0):void 0}}(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=r.call(e)},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 d(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 f=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,l,d,f;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=u(t,r),a=[],s=b(o),e.prev=3,s.s();case 5:if((l=s.n()).done){e.next=19;break}return d=l.value,e.prev=7,e.next=10,Promise.resolve(d.callback(n));case 10:f=e.sent,"object"===c()(f)&&a.push(f),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",!a.length||a);case 28:case"end":return e.stop()}}),e,null,[[3,21,24,27],[7,14]])})));return function(_x,t,r){return e.apply(this,arguments)}}(),p=function(){var e=a()(i.a.mark((function e(t,r,n){var o,a,s,d,f,p;return i.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=[],a=u(t,r),s=b(a),e.prev=3,s.s();case 5:if((d=s.n()).done){e.next=28;break}return f=d.value,e.prev=7,e.next=10,Promise.resolve(f.callback(n));case 10:if(p=e.sent,"object"===c()(p)&&null!==p){e.next=13;break}return e.abrupt("continue",26);case 13:if(p.hasOwnProperty("type")){e.next=15;break}throw new Error("Returned objects from event emitter observers must return an object with a type property");case 15:if(!Object(l.a)(p)&&!Object(l.b)(p)){e.next=18;break}return o.push(p),e.abrupt("return",o);case 18:o.push(p),e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(7),console.error(e.t0),o.push({type:"error"}),e.abrupt("return",o);case 26:e.next=5;break;case 28:e.next=33;break;case 30:e.prev=30,e.t1=e.catch(3),s.e(e.t1);case 33:return e.prev=33,s.f(),e.finish(33);case 36:return e.abrupt("return",o);case 37:case"end":return e.stop()}}),e,null,[[3,30,33,36],[7,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()},374:function(e,t){},378:function(e,t,r){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},379:function(e,t,r){"use strict";var n=r(0),c=(r(2),r(6)),o=r.n(c),a=r(8),s=r.n(a),i=r(1),u=r(61),l=r(856),b={status:"pristine",hasError:!1,quantity:1,processingResponse:null,requestParams:{}},d=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e?"set_has_error":"set_no_error";return{type:t}},f=r(5),p=r.n(f);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 m(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){p()(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 v="idle",j=function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,r=arguments.length>1?arguments[1]:void 0,n=r.quantity,c=r.type,o=r.data;switch(c){case"set_pristine":e=b;break;case"set_idle":e=t.status!==v?m(m({},t),{},{status:v}):t;break;case"set_disabled":e="disabled"!==t.status?m(m({},t),{},{status:"disabled"}):t;break;case"set_quantity":e=n!==t.quantity?m(m({},t),{},{quantity:n}):t;break;case"set_request_params":e=m(m({},t),{},{requestParams:m(m({},t.requestParams),o)});break;case"set_processing_response":e=m(m({},t),{},{processingResponse:o});break;case"set_processing":e=!1===(e="processing"!==t.status?m(m({},t),{},{status:"processing",hasError:!1}):t).hasError?e:m(m({},e),{},{hasError:!1});break;case"set_before_processing":e="before_processing"!==t.status?m(m({},t),{},{status:"before_processing",hasError:!1}):t;break;case"set_after_processing":e="after_processing"!==t.status?m(m({},t),{},{status:"after_processing"}):t;break;case"set_has_error":e=t.hasError?t:m(m({},t),{},{hasError:!0}),e="processing"===t.status||"before_processing"===t.status?m(m({},e),{},{status:v}):e;break;case"set_no_error":e=t.hasError?m(m({},t),{},{hasError:!1}):t}return e!==t&&"set_pristine"!==c&&"pristine"===e.status&&(e.status=v),e},h=r(129),g=r(321),y=function(e){return{onAddToCartAfterProcessingWithSuccess:Object(g.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(g.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(g.a)("add_to_cart_before_processing",e)}},E=r(322),_=r(136),w=r(57),P=r(51),k=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){}}}),C=function(){return Object(n.useContext)(k)},A=function(e){var t=e.children,r=e.product,c=e.showFormElements,o=Object(n.useReducer)(j,b),a=s()(o,2),f=a[0],p=a[1],O=Object(n.useReducer)(h.b,{}),m=s()(O,2),v=m[0],g=m[1],C=Object(u.a)(v),A=Object(w.a)(),S=A.addErrorNotice,x=A.removeNotices,D=Object(_.b)().setValidationErrors,N=Object(P.c)(),V=N.isSuccessResponse,R=N.isErrorResponse,T=N.isFailResponse,q=Object(n.useMemo)((function(){return{onAddToCartAfterProcessingWithSuccess:y(g).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:y(g).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:y(g).onAddToCartBeforeProcessing}}),[g]),F=Object(n.useMemo)((function(){return{resetForm:function(){p({type:"set_pristine"})},submitForm:function(){p({type:"set_before_processing"})},setQuantity:function(e){p(function(e){return{type:"set_quantity",quantity:e}}(e))},setHasError:function(e){p(d(e))},setRequestParams:function(e){p(function(e){return{type:"set_request_params",data:e}}(e))},setAfterProcessing:function(e){p({type:"set_processing_response",data:e}),p({type:"set_after_processing"})}}}),[]);Object(n.useEffect)((function(){var e=f.status,t=!r.id||!Object(l.a)(r);"disabled"!==e||t?"disabled"!==e&&t&&p({type:"set_disabled"}):p({type:"set_idle"})}),[f.status,r,p]),Object(n.useEffect)((function(){"before_processing"===f.status&&(x("error"),Object(E.a)(C,"add_to_cart_before_processing",{}).then((function(e){!0!==e?(Array.isArray(e)&&e.forEach((function(e){var t=e.errorMessage,r=e.validationErrors;t&&S(t),r&&D(r)})),p({type:"set_idle"})):p({type:"set_processing"})})))}),[f.status,D,S,x,p,C]),Object(n.useEffect)((function(){if("after_processing"===f.status){var e={processingResponse:f.processingResponse},t=function(e){var t=!1;return e.forEach((function(e){var r=e.message,n=e.messageContext;(R(e)||T(e))&&r&&(t=!0,S(r,n?{context:n}:void 0))})),t};if(f.hasError)return void Object(E.b)(C,"add_to_cart_after_processing_with_error",e).then((function(r){if(!t(r)){var n,c=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");S(c,{id:"add-to-cart"})}p({type:"set_idle"})}));Object(E.b)(C,"add_to_cart_after_processing_with_success",e).then((function(e){t(e)?p(d(!0)):p({type:"set_idle"})}))}}),[f.status,f.hasError,f.processingResponse,F,S,R,T,V,C]);var B=Object(l.b)(r),I={product:r,productType:r.type||"simple",productIsPurchasable:Object(l.a)(r),productHasOptions:r.has_options||!1,supportsFormElements:B,showFormElements:c&&B,quantity:f.quantity,minQuantity:1,maxQuantity:r.quantity_limit||99,requestParams:f.requestParams,isIdle:"idle"===f.status,isDisabled:"disabled"===f.status,isProcessing:"processing"===f.status,isBeforeProcessing:"before_processing"===f.status,isAfterProcessing:"after_processing"===f.status,hasError:f.hasError,eventRegistration:q,dispatchActions:F};return Object(n.createElement)(k.Provider,{value:I},t)},S=r(15),x=r.n(S),D=r(26),N=r(45);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}var R=function(){var e=C(),t=e.dispatchActions,r=e.product,c=e.quantity,o=e.eventRegistration,a=e.hasError,u=e.isProcessing,l=e.requestParams,b=Object(_.b)(),d=b.hasValidationErrors,f=b.showAllValidationErrors,O=Object(w.a)(),m=O.addErrorNotice,v=O.removeNotice,j=Object(N.a)().receiveCart,h=Object(n.useState)(!1),g=s()(h,2),y=g[0],E=g[1],P=!a&&u,k=Object(n.useCallback)((function(){return!d||(f(),{type:"error"})}),[d,f]);Object(n.useEffect)((function(){var e=o.onAddToCartBeforeProcessing(k,0);return function(){e()}}),[o,k]);var A=Object(n.useCallback)((function(){E(!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?V(Object(r),!0).forEach((function(t){p()(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}({id:r.id||0,quantity:c},l);x()({path:"/wc/store/cart/add-item",method:"POST",data:e,cache:"no-store",parse:!1}).then((function(e){x.a.setNonce(e.headers),e.json().then((function(r){e.ok?j(r):(r.body&&r.body.message?m(Object(D.decodeEntities)(r.body.message),{id:"add-to-cart"}):m(Object(i.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),t.setHasError()),t.setAfterProcessing(r),E(!1)}))})).catch((function(e){e.json().then((function(e){var r;null!==(r=e.data)&&void 0!==r&&r.cart&&j(e.data.cart),t.setHasError(),t.setAfterProcessing(e),E(!1)}))}))}),[r,m,v,j,t,c,l]);return Object(n.useEffect)((function(){P&&!y&&A()}),[P,A,y]),null},T=function(e){var t=e.children,r=e.product,c=e.showFormElements;return Object(n.createElement)(_.a,null,Object(n.createElement)(A,{product:r,showFormElements:c},t,Object(n.createElement)(R,null)))},q=r(44),F=r(7),B=r(84),I=(r(374),r(89)),L=r(62),M=r(309),Q=r(66),W=r(770),H=function(e){var t=e.className,r=e.href,c=e.text,o=e.onClick;return Object(n.createElement)(I.a,{className:t,href:r,onClick:o,rel:"nofollow"},c)},K=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)(I.a,{className:t,disabled:o,showSpinner:c,onClick:s},a&&r>0?Object(i.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
+
Object(i._n)("%d in cart","%d in cart",r,"woo-gutenberg-products-block"),r):Object(i.__)("Add to cart","woo-gutenberg-products-block"),!!a&&Object(n.createElement)(L.a,{srcElement:M.a,alt:Object(i.__)("Done","woo-gutenberg-products-block")}))},U=function(){var e=C(),t=e.showFormElements,r=e.productIsPurchasable,c=e.productHasOptions,o=e.product,a=e.productType,u=e.isDisabled,l=e.isProcessing,b=e.eventRegistration,d=e.hasError,f=e.dispatchActions,p=Object(q.useInnerBlockLayoutContext)().parentName,O=Object(Q.a)().dispatchStoreEvent,m=Object(W.a)(o.id||0).cartQuantity,v=Object(n.useState)(!1),j=s()(v,2),h=j[0],g=j[1],y=o.add_to_cart||{url:"",text:""};return Object(n.useEffect)((function(){var e=b.onAddToCartAfterProcessingWithSuccess((function(){return d||g(!0),!0}),0);return function(){e()}}),[b,d]),(t||!c&&"simple"===a)&&r?Object(n.createElement)(K,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:u,isProcessing:l,isDone:h,onClick:function(){f.submitForm(),O("cart-add-item",{product:o,listName:p})}}):Object(n.createElement)(H,{className:"wc-block-components-product-add-to-cart-button",href:y.url,text:y.text||Object(i.__)("View Product","woo-gutenberg-products-block"),onClick:function(){O("product-view-link",{product:o,listName:p})}})},z=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)}})},G=function(e){var t=e.reason,r=void 0===t?Object(i.__)("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)},J=function(){var e=C(),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)(G,null):t.id&&!t.is_in_stock?Object(n.createElement)(G,{reason:Object(i.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(z,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(U,null))},Y=(r(548),r(35)),X=r.n(Y),$=r(871),Z=r(12),ee=r(232),te={value:"",label:Object(i.__)("Select an option","woo-gutenberg-products-block")},re=function(e){var t=e.attributeName,r=e.options,c=void 0===r?[]:r,a=e.value,s=void 0===a?"":a,u=e.onChange,l=void 0===u?function(){}:u,b=e.errorMessage,d=void 0===b?Object(i.__)("Please select a value.","woo-gutenberg-products-block"):b,f=Object(_.b)(),O=f.getValidationError,m=f.setValidationErrors,v=f.clearValidationError,j=t,h=O(j)||{};return Object(Z.useEffect)((function(){s?v(j):m(p()({},j,{message:d,hidden:!0}))}),[s,j,d,v,m]),Object(Z.useEffect)((function(){return function(){v(j)}}),[j,v]),Object(n.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(n.createElement)($.a,{label:Object(D.decodeEntities)(t),value:s||"",options:[te].concat(X()(c)),onChange:l,required:!0,className:o()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":h.message&&!h.hidden})}),Object(n.createElement)(ee.a,{propertyName:j,elementId:j}))};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 ce(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){p()(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 oe=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}))}))};function ae(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?ae(Object(r),!0).forEach((function(t){p()(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ae(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var ie=function(e){var t=e.attributes,r=e.variationAttributes,c=e.setRequestParams,o=Object(u.a)(t),a=Object(u.a)(r),i=Object(n.useState)(0),l=s()(i,2),b=l[0],d=l[1],f=Object(n.useState)({}),O=s()(f,2),m=O[0],v=O[1],j=Object(n.useMemo)((function(){return 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=ce(ce({},r),{},p()({},c,null)),i=o?oe(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(D.decodeEntities)(r)}:null})).filter(Boolean)}(a.terms,u)})),n}(o,a,m)}),[m,o,a]);return Object(n.useEffect)((function(){Object.values(m).filter((function(e){return""!==e})).length===Object.keys(o).length?d(function(e,t,r){return oe(e,t,r)[0]||0}(o,a,m)):b>0&&d(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)(re,{key:e,attributeName:e,options:j[e],value:m[e],onChange:function(t){v(se(se({},m),{},p()({},e,t)))}})})))},ue=function(e){var t=e.product,r=e.dispatchers,c=function(e){return e?Object(F.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)(ie,{attributes:c,variationAttributes:o,setRequestParams:r.setRequestParams})},le=function(){var e=C(),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)(G,null):t.id&&!t.is_in_stock?Object(n.createElement)(G,{reason:Object(i.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(ue,{product:t,dispatchers:a}),Object(n.createElement)(z,{value:r,min:c,max:o,disabled:s,onChange:a.setQuantity}),Object(n.createElement)(U,null))},be=function(){return Object(n.createElement)(U,null)},de=r(869),fe=function(){return Object(n.createElement)(de.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element.")},pe=function(){return Object(n.createElement)(fe,null)},Oe=function(){var e=C(),t=e.showFormElements,r=e.productType;return t?"variable"===r?Object(n.createElement)(le,null):"grouped"===r?Object(n.createElement)(pe,null):"external"===r?Object(n.createElement)(be,null):"simple"===r||"variation"===r?Object(n.createElement)(J,null):null:Object(n.createElement)(U,null)};t.a=Object(B.withProductDataContext)((function(e){var t=e.className,r=e.showFormElements,c=Object(q.useProductDataContext)().product,a=o()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(F.isEmpty)(c)});return Object(n.createElement)(T,{product:c,showFormElements:r},Object(n.createElement)("div",{className:a},Object(n.createElement)(Oe,null)))}))},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return b}));var n,c,o=r(105);!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(n||(n={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(c||(c={}));var a=function(e,t){return Object(o.b)(e)&&"type"in e&&e.type===t},s=function(e){return a(e,n.SUCCESS)},i=function(e){return a(e,n.ERROR)},u=function(e){return a(e,n.FAIL)},l=function(e){return!Object(o.b)(e)||void 0===e.retry||!0===e.retry},b=function(){return{responseTypes:n,noticeContexts:c,shouldRetry:l,isSuccessResponse:s,isErrorResponse:i,isFailResponse:u}}},548:function(e,t){},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),c=r(34),o=r.n(c);function a(e){var t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},856: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")}},877:function(e,t,r){"use strict";r.r(t);var n=r(874),c=r(379),o=r(378);t.default=Object(n.a)(o.a)(c.a)},89:function(e,t,r){"use strict";var n=r(9),c=r.n(n),o=r(14),a=r.n(o),s=r(0),i=r(184),u=r(6),l=r.n(u),b=r(115),d=(r(208),["className","showSpinner","children"]);t.a=function(e){var t=e.className,r=e.showSpinner,n=void 0!==r&&r,o=e.children,u=a()(e,d),f=l()("wc-block-components-button",t,{"wc-block-components-button--loading":n});return Object(s.createElement)(i.a,c()({className:f},u),n&&Object(s.createElement)(b.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},o))}}}]);
|
build/atomic-block-components/button-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{
|
2 |
/* translators: %s number of products in cart. */
|
3 |
-
Object(d._n)("%d in cart","%d in cart",v,"woo-gutenberg-products-block"),v):Object(b.decodeEntities)((null==r?void 0:r.text)||Object(d.__)("Add to cart","woo-gutenberg-products-block")),k=g?"button":"a",N={};return g?N.onClick=function(){m(),p("cart-add-item",{product:e})}:(N.href=c,N.rel="nofollow",N.onClick=function(){p("product-view-link",{product:e})}),React.createElement(k,o()({"aria-label":w,className:u()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:_}),disabled:j},N),h)}),v=function(){return React.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})};e.default=Object(p.withProductDataContext)((function(t){var e=t.className,n=Object(f.useInnerBlockLayoutContext)().parentClassName,c=Object(f.useProductDataContext)().product;return React.createElement("div",{className:u()(e,"wp-block-button","wc-block-components-product-button",a()({},"".concat(n,"__product-add-to-cart"),n))},c.id?React.createElement(O,{product:c}):React.createElement(v,null))}))},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[3],{336:function(t,e){},337:function(t,e,n){"use strict";n.d(e,"a",(function(){return b}));var c=n(6),o=n.n(c),r=n(0),a=n(12),i=n(8),u=n(24),d=n(33),s=n(61),l=function(t,e){var n=t.find((function(t){return t.id===e}));return n?n.quantity:0},b=function(t){var e=Object(a.useDispatch)(i.CART_STORE_KEY).addItemToCart,n=Object(d.a)(),c=n.cartItems,b=n.cartIsLoading,f=Object(s.a)(),p=f.addErrorNotice,O=f.removeNotice,v=Object(r.useState)(!1),j=o()(v,2),m=j[0],_=j[1],g=Object(r.useRef)(l(c,t));return Object(r.useEffect)((function(){var e=l(c,t);e!==g.current&&(g.current=e)}),[c,t]),{cartQuantity:Number.isFinite(g.current)?g.current:0,addingToCart:m,cartIsLoading:b,addToCart:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return _(!0),e(t,n).then((function(){O("add-to-cart")})).catch((function(t){p(Object(u.decodeEntities)(t.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})})).finally((function(){_(!1)}))}}}},347:function(t,e,n){"use strict";n.r(e);var c=n(13),o=n.n(c),r=n(5),a=n.n(r),i=(n(10),n(3)),u=n.n(i),d=n(1),s=n(56),l=n(337),b=n(24),f=n(108),p=n(252),O=(n(336),function(t){var e=t.product,n=e.id,c=e.permalink,r=e.add_to_cart,a=e.has_options,i=e.is_purchasable,f=e.is_in_stock,p=Object(s.a)().dispatchStoreEvent,O=Object(l.a)(n),v=O.cartQuantity,j=O.addingToCart,m=O.addToCart,_=Number.isFinite(v)&&v>0,g=!a&&i&&f,w=Object(b.decodeEntities)((null==r?void 0:r.description)||""),h=_?Object(d.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
+
Object(d._n)("%d in cart","%d in cart",v,"woo-gutenberg-products-block"),v):Object(b.decodeEntities)((null==r?void 0:r.text)||Object(d.__)("Add to cart","woo-gutenberg-products-block")),k=g?"button":"a",N={};return g?N.onClick=function(){m(),p("cart-add-item",{product:e})}:(N.href=c,N.rel="nofollow",N.onClick=function(){p("product-view-link",{product:e})}),React.createElement(k,o()({"aria-label":w,className:u()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:_}),disabled:j},N),h)}),v=function(){return React.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})};e.default=Object(p.withProductDataContext)((function(t){var e=t.className,n=Object(f.useInnerBlockLayoutContext)().parentClassName,c=Object(f.useProductDataContext)().product;return React.createElement("div",{className:u()(e,"wp-block-button","wc-block-components-product-button",a()({},"".concat(n,"__product-add-to-cart"),n))},c.id?React.createElement(O,{product:c}):React.createElement(v,null))}))},61:function(t,e,n){"use strict";n.d(e,"a",(function(){return d}));var c=n(5),o=n.n(c),r=n(0),a=n(114);function i(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 u(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){o()(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var d=function(){var t=Object(a.b)(),e=t.notices,n=t.createNotice,c=t.removeNotice,o=t.setIsSuppressed,i=Object(r.useRef)(e);Object(r.useEffect)((function(){i.current=e}),[e]);var d=Object(r.useMemo)((function(){return{hasNoticesOfType:function(t){return i.current.some((function(e){return e.type===t}))},removeNotices:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;i.current.forEach((function(e){null!==t&&e.status!==t||c(e.id)}))},removeNotice:c}}),[c]),s=Object(r.useMemo)((function(){return{addDefaultNotice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("default",t,u({},e))},addErrorNotice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("error",t,u({},e))},addWarningNotice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("warning",t,u({},e))},addInfoNotice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("info",t,u({},e))},addSuccessNotice:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n("success",t,u({},e))}}}),[n]);return u(u(u({notices:e},d),s),{},{setIsSuppressed:o})}}}]);
|
build/atomic-block-components/button.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{
|
2 |
/* translators: %s number of products in cart. */
|
3 |
-
Object(i._n)("%d in cart","%d in cart",m,"woo-gutenberg-products-block"),m):Object(p.decodeEntities)((null==a?void 0:a.text)||Object(i.__)("Add to cart","woo-gutenberg-products-block")),h=v?"button":"a",g={};return v?g.onClick=function(){O(),k("cart-add-item",{product:o})}:(g.href=e,g.rel="nofollow",g.onClick=function(){k("product-view-link",{product:o})}),Object(r.createElement)(h,n()({"aria-label":C,className:b()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:f}),disabled:j},g),E)}),m=function(){return Object(r.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})};o.default=Object(k.withProductDataContext)((function(t){var o=t.className,c=Object(_.useInnerBlockLayoutContext)().parentClassName,e=Object(_.useProductDataContext)().product;return Object(r.createElement)("div",{className:b()(o,"wp-block-button","wc-block-components-product-button",d()({},"".concat(c,"__product-add-to-cart"),c))},e.id?Object(r.createElement)(w,{product:e}):Object(r.createElement)(m,null))}))},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{486:function(t,o,c){"use strict";c.r(o);var e=c(9),n=c.n(e),a=c(5),d=c.n(a),r=c(0),u=(c(2),c(6)),b=c.n(u),i=c(1),l=c(66),s=c(770),p=c(26),_=c(44),k=c(84),w=(c(542),function(t){var o=t.product,c=o.id,e=o.permalink,a=o.add_to_cart,d=o.has_options,u=o.is_purchasable,_=o.is_in_stock,k=Object(l.a)().dispatchStoreEvent,w=Object(s.a)(c),m=w.cartQuantity,j=w.addingToCart,O=w.addToCart,f=Number.isFinite(m)&&m>0,v=!d&&u&&_,C=Object(p.decodeEntities)((null==a?void 0:a.description)||""),E=f?Object(i.sprintf)(
|
2 |
/* translators: %s number of products in cart. */
|
3 |
+
Object(i._n)("%d in cart","%d in cart",m,"woo-gutenberg-products-block"),m):Object(p.decodeEntities)((null==a?void 0:a.text)||Object(i.__)("Add to cart","woo-gutenberg-products-block")),h=v?"button":"a",g={};return v?g.onClick=function(){O(),k("cart-add-item",{product:o})}:(g.href=e,g.rel="nofollow",g.onClick=function(){k("product-view-link",{product:o})}),Object(r.createElement)(h,n()({"aria-label":C,className:b()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",{loading:j,added:f}),disabled:j},g),E)}),m=function(){return Object(r.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})};o.default=Object(k.withProductDataContext)((function(t){var o=t.className,c=Object(_.useInnerBlockLayoutContext)().parentClassName,e=Object(_.useProductDataContext)().product;return Object(r.createElement)("div",{className:b()(o,"wp-block-button","wc-block-components-product-button",d()({},"".concat(c,"__product-add-to-cart"),c))},e.id?Object(r.createElement)(w,{product:e}):Object(r.createElement)(m,null))}))},542:function(t,o){}}]);
|
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],{340:function(e,t){},350:function(e,t,c){"use strict";c.r(t);var a=c(5),n=c.n(a),o=c(1),r=(c(10),c(3)),s=c.n(r),l=c(108),u=c(7),i=c(252);c(340),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||[]).push([[10],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[10],{491:function(e,t,c){"use strict";c.r(t);var n=c(5),o=c.n(n),a=c(0),r=c(1),s=(c(2),c(6)),l=c.n(s),u=c(44),i=c(7),b=c(84);c(545),t.default=Object(b.withProductDataContext)((function(e){var t=e.className,c=Object(u.useInnerBlockLayoutContext)().parentClassName,n=Object(u.useProductDataContext)().product;return Object(i.isEmpty)(n.categories)?null:Object(a.createElement)("div",{className:l()(t,"wc-block-components-product-category-list",o()({},"".concat(c,"__product-category-list"),c))},Object(r.__)("Categories:","woo-gutenberg-products-block")," ",Object(a.createElement)("ul",null,Object.values(n.categories).map((function(e){var t=e.name,c=e.link,n=e.slug;return Object(a.createElement)("li",{key:"category-list-item-".concat(n)},Object(a.createElement)("a",{href:c},t))}))))}))},545:function(e,t){}}]);
|
build/atomic-block-components/image-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5,8],{
|
2 |
/* translators: %s is referring to the product name */
|
3 |
-
Object(p.__)("Link to %s","woo-gutenberg-products-block"),g.name),C=y(y({href:g.permalink,rel:"nofollow"},!S&&{"aria-label":L}),{},{onClick:function(){R("product-view-link",{product:g})}});return React.createElement("div",{className:b()(t,"wc-block-components-product-image",l()({},"".concat(f,"__product-image"),f))},React.createElement(D,c&&C,!!o&&React.createElement(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5,8],{198: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}},329:function(e,t,r){"use strict";var n=r(13),a=r.n(n),c=r(198);t.a=function(e){return function(t){return function(r){var n=Object(c.a)(e,r);return React.createElement(t,a()({},r,n))}}}},330:function(e,t){},331:function(e,t,r){"use strict";r.r(t);var n=r(5),a=r.n(n),c=(r(10),r(1)),o=r(3),l=r.n(o),s=r(37),i=r(108),u=r(252);r(330),t.default=Object(u.withProductDataContext)((function(e){var t=e.className,r=e.align,n=Object(i.useInnerBlockLayoutContext)().parentClassName,o=Object(i.useProductDataContext)().product;if(!o.id||!o.on_sale)return null;var u="string"==typeof r?"wc-block-components-product-sale-badge--align-".concat(r):"";return React.createElement("div",{className:l()("wc-block-components-product-sale-badge",t,u,a()({},"".concat(n,"__product-onsale"),n))},React.createElement(s.a,{label:Object(c.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Product on sale","woo-gutenberg-products-block")}))}))},333:function(e,t){},356:function(e,t,r){"use strict";r.r(t);var n=r(329),a=r(13),c=r.n(a),o=r(5),l=r.n(o),s=r(6),i=r.n(s),u=(r(10),r(0)),p=r(1),d=r(3),b=r.n(d),f=r(2),m=r(108),g=r(252),O=r(56),w=r(331);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 y(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){l()(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}r(333);var v=function(){return React.createElement("img",{src:f.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500})},h=function(e){var t=e.image,r=e.onLoad,n=e.loaded,a=e.showFullSize,o=e.fallbackAlt,l=t||{},s=l.thumbnail,i=l.src,u=l.srcset,p=l.sizes,d=y({alt:l.alt||o,onLoad:r,hidden:!n,src:s},a&&{src:i,srcSet:u,sizes:p});return React.createElement(React.Fragment,null,d.src&&React.createElement("img",c()({"data-testid":"product-image"},d)),!n&&React.createElement(v,null))},k=Object(g.withProductDataContext)((function(e){var t=e.className,r=e.imageSizing,n=void 0===r?"full-size":r,a=e.showProductLink,c=void 0===a||a,o=e.showSaleBadge,s=e.saleBadgeAlign,d=void 0===s?"right":s,f=Object(m.useInnerBlockLayoutContext)().parentClassName,g=Object(m.useProductDataContext)().product,j=Object(u.useState)(!1),k=i()(j,2),E=k[0],P=k[1],R=Object(O.a)().dispatchStoreEvent;if(!g.id)return React.createElement("div",{className:b()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",l()({},"".concat(f,"__product-image"),f))},React.createElement(v,null));var S=!!g.images.length,_=S?g.images[0]:null,D=c?"a":u.Fragment,L=Object(p.sprintf)(
|
2 |
/* translators: %s is referring to the product name */
|
3 |
+
Object(p.__)("Link to %s","woo-gutenberg-products-block"),g.name),C=y(y({href:g.permalink,rel:"nofollow"},!S&&{"aria-label":L}),{},{onClick:function(){R("product-view-link",{product:g})}});return React.createElement("div",{className:b()(t,"wc-block-components-product-image",l()({},"".concat(f,"__product-image"),f))},React.createElement(D,c&&C,!!o&&React.createElement(w.default,{align:d,product:g}),React.createElement(h,{fallbackAlt:g.name,image:_,onLoad:function(){return P(!0)},loaded:E,showFullSize:"cropped"!==n})))}));t.default=Object(n.a)({showProductLink:{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}})(k)},37:function(e,t,r){"use strict";var n=r(5),a=r.n(n),c=r(0),o=r(3),l=r.n(o);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 i(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){a()(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}t.a=function(e){var t,r=e.label,n=e.screenReaderLabel,a=e.wrapperElement,o=e.wrapperProps,s=void 0===o?{}:o,u=null!=r,p=null!=n;return!u&&p?(t=a||"span",s=i(i({},s),{},{className:l()(s.className,"screen-reader-text")}),React.createElement(t,s,n)):(t=a||c.Fragment,u&&p&&r!==n?React.createElement(t,s,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,s,r))}}}]);
|
build/atomic-block-components/image.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{
|
2 |
/* translators: %s is referring to the product name */
|
3 |
-
Object(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{376:function(e,t,c){"use strict";t.a={showProductLink:{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}}},377:function(e,t,c){"use strict";var n=c(9),r=c.n(n),a=c(5),o=c.n(a),l=c(8),i=c.n(l),s=c(0),u=(c(2),c(1)),d=c(6),p=c.n(d),b=c(3),m=c(44),g=c(84),f=c(66),O=c(306);function j(e,t){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),c.push.apply(c,n)}return c}function w(e){for(var t=1;t<arguments.length;t++){var c=null!=arguments[t]?arguments[t]:{};t%2?j(Object(c),!0).forEach((function(t){o()(e,t,c[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(c)):j(Object(c)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(c,t))}))}return e}c(540);var h=function(){return Object(s.createElement)("img",{src:b.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500})},k=function(e){var t=e.image,c=e.onLoad,n=e.loaded,a=e.showFullSize,o=e.fallbackAlt,l=t||{},i=l.thumbnail,u=l.src,d=l.srcset,p=l.sizes,b=w({alt:l.alt||o,onLoad:c,hidden:!n,src:i},a&&{src:u,srcSet:d,sizes:p});return Object(s.createElement)(s.Fragment,null,b.src&&Object(s.createElement)("img",r()({"data-testid":"product-image"},b)),!n&&Object(s.createElement)(h,null))};t.a=Object(g.withProductDataContext)((function(e){var t=e.className,c=e.imageSizing,n=void 0===c?"full-size":c,r=e.showProductLink,a=void 0===r||r,l=e.showSaleBadge,d=e.saleBadgeAlign,b=void 0===d?"right":d,g=Object(m.useInnerBlockLayoutContext)().parentClassName,j=Object(m.useProductDataContext)().product,v=Object(s.useState)(!1),y=i()(v,2),E=y[0],P=y[1],S=Object(f.a)().dispatchStoreEvent;if(!j.id)return Object(s.createElement)("div",{className:p()(t,"wc-block-components-product-image","wc-block-components-product-image--placeholder",o()({},"".concat(g,"__product-image"),g))},Object(s.createElement)(h,null));var L=!!j.images.length,z=L?j.images[0]:null,_=a?"a":s.Fragment,B=Object(u.sprintf)(
|
2 |
/* translators: %s is referring to the product name */
|
3 |
+
Object(u.__)("Link to %s","woo-gutenberg-products-block"),j.name),C=w(w({href:j.permalink,rel:"nofollow"},!L&&{"aria-label":B}),{},{onClick:function(){S("product-view-link",{product:j})}});return Object(s.createElement)("div",{className:p()(t,"wc-block-components-product-image",o()({},"".concat(g,"__product-image"),g))},Object(s.createElement)(_,a&&C,!!l&&Object(s.createElement)(O.default,{align:b,product:j}),Object(s.createElement)(k,{fallbackAlt:j.name,image:z,onLoad:function(){return P(!0)},loaded:E,showFullSize:"cropped"!==n})))}))},540:function(e,t){},875:function(e,t,c){"use strict";c.r(t);var n=c(874),r=c(377),a=c(376);t.default=Object(n.a)(a.a)(r.a)}}]);
|
build/atomic-block-components/price-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[6],{
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
-
Object(n.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(s.formatPrice)(t),Object(s.formatPrice)(c))),React.createElement("span",{"aria-hidden":!0},React.createElement(o.a,{className:i()("wc-block-components-product-price__value",a),currency:r,value:t,style:l})," — ",React.createElement(o.a,{className:i()("wc-block-components-product-price__value",a),currency:r,value:c,style:l})))}),m=function(e){var r=e.currency,c=e.regularPriceClassName,t=e.regularPriceStyle,a=e.regularPrice,l=e.priceClassName,s=e.priceStyle,u=e.price;return React.createElement(React.Fragment,null,React.createElement("span",{className:"screen-reader-text"},Object(n.__)("Previous price:","woo-gutenberg-products-block")),React.createElement(o.a,{currency:r,renderText:function(e){return React.createElement("del",{className:i()("wc-block-components-product-price__regular",c),style:t},e)},value:a}),React.createElement("span",{className:"screen-reader-text"},Object(n.__)("Discounted price:","woo-gutenberg-products-block")),React.createElement(o.a,{currency:r,renderText:function(e){return React.createElement("ins",{className:i()("wc-block-components-product-price__value","is-discounted",l),style:s},e)},value:u}))};r.a=function(e){var r=e.align,c=e.className,t=e.currency,n=e.format,l=void 0===n?"<price/>":n,s=e.maxPrice,d=void 0===s?null:s,b=e.minPrice,f=void 0===b?null:b,y=e.price,g=void 0===y?null:y,v=e.priceClassName,_=e.priceStyle,O=e.regularPrice,P=e.regularPriceClassName,N=e.regularPriceStyle,j=i()(c,"price","wc-block-components-product-price",a()({},"wc-block-components-product-price--align-".concat(r),r));l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));var w=O&&g!==O,S=React.createElement("span",{className:i()("wc-block-components-product-price__value",v)});return w?S=React.createElement(m,{currency:t,price:g,priceClassName:v,priceStyle:_,regularPrice:O,regularPriceClassName:P,regularPriceStyle:N}):null!==f&&null!==d?S=React.createElement(p,{currency:t,maxPrice:d,minPrice:f,priceClassName:v,priceStyle:_}):null!==g&&(S=React.createElement(o.a,{className:i()("wc-block-components-product-price__value",v),currency:t,value:g,style:_})),React.createElement("span",{className:j},Object(u.createInterpolateElement)(l,{price:S}))}},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[6],{126:function(e,r,c){"use strict";var t=c(5),a=c.n(t),n=c(1),o=c(59),l=c(3),i=c.n(l),s=(c(10),c(50)),u=c(0),p=(c(163),function(e){var r=e.currency,c=e.maxPrice,t=e.minPrice,a=e.priceClassName,l=e.priceStyle;return React.createElement(React.Fragment,null,React.createElement("span",{className:"screen-reader-text"},Object(n.sprintf)(
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
+
Object(n.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(s.formatPrice)(t),Object(s.formatPrice)(c))),React.createElement("span",{"aria-hidden":!0},React.createElement(o.a,{className:i()("wc-block-components-product-price__value",a),currency:r,value:t,style:l})," — ",React.createElement(o.a,{className:i()("wc-block-components-product-price__value",a),currency:r,value:c,style:l})))}),m=function(e){var r=e.currency,c=e.regularPriceClassName,t=e.regularPriceStyle,a=e.regularPrice,l=e.priceClassName,s=e.priceStyle,u=e.price;return React.createElement(React.Fragment,null,React.createElement("span",{className:"screen-reader-text"},Object(n.__)("Previous price:","woo-gutenberg-products-block")),React.createElement(o.a,{currency:r,renderText:function(e){return React.createElement("del",{className:i()("wc-block-components-product-price__regular",c),style:t},e)},value:a}),React.createElement("span",{className:"screen-reader-text"},Object(n.__)("Discounted price:","woo-gutenberg-products-block")),React.createElement(o.a,{currency:r,renderText:function(e){return React.createElement("ins",{className:i()("wc-block-components-product-price__value","is-discounted",l),style:s},e)},value:u}))};r.a=function(e){var r=e.align,c=e.className,t=e.currency,n=e.format,l=void 0===n?"<price/>":n,s=e.maxPrice,d=void 0===s?null:s,b=e.minPrice,f=void 0===b?null:b,y=e.price,g=void 0===y?null:y,v=e.priceClassName,_=e.priceStyle,O=e.regularPrice,P=e.regularPriceClassName,N=e.regularPriceStyle,j=i()(c,"price","wc-block-components-product-price",a()({},"wc-block-components-product-price--align-".concat(r),r));l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));var w=O&&g!==O,S=React.createElement("span",{className:i()("wc-block-components-product-price__value",v)});return w?S=React.createElement(m,{currency:t,price:g,priceClassName:v,priceStyle:_,regularPrice:O,regularPriceClassName:P,regularPriceStyle:N}):null!==f&&null!==d?S=React.createElement(p,{currency:t,maxPrice:d,minPrice:f,priceClassName:v,priceStyle:_}):null!==g&&(S=React.createElement(o.a,{className:i()("wc-block-components-product-price__value",v),currency:t,value:g,style:_})),React.createElement("span",{className:j},Object(u.createInterpolateElement)(l,{price:S}))}},149:function(e,r){},163:function(e,r){},345:function(e,r,c){"use strict";c.r(r);var t=c(5),a=c.n(t),n=(c(10),c(3)),o=c.n(n),l=c(126),i=c(50),s=c(108),u=c(253),p=c(15),m=c(252);r.default=Object(m.withProductDataContext)((function(e){var r,c,t,n,m,d,b,f=e.className,y=e.align,g=e.fontSize,v=e.customFontSize,_=e.saleFontSize,O=e.customSaleFontSize,P=e.color,N=e.customColor,j=e.saleColor,w=e.customSaleColor,S=Object(s.useInnerBlockLayoutContext)().parentClassName,C=Object(s.useProductDataContext)().product,E=o()(f,a()({},"".concat(S,"__product-price"),S));if(!C.id)return React.createElement(l.a,{align:y,className:E});var R=Object(u.getColorClassName)("color",P),x=Object(u.getFontSizeClass)(g),h=Object(u.getColorClassName)("color",j),k=Object(u.getFontSizeClass)(_),z=o()((r={"has-text-color":P||N,"has-font-size":g||v},a()(r,R,R),a()(r,x,x),r)),F=o()((c={"has-text-color":j||w,"has-font-size":_||O},a()(c,h,h),a()(c,k,k),c)),D={color:N,fontSize:v},T={color:w,fontSize:O},V=C.prices,B=Object(i.getCurrencyFromPriceResponse)(V),I=V.price!==V.regular_price,U=I?o()((t={},a()(t,"".concat(S,"__product-price__value"),S),a()(t,F,Object(p.p)()),t)):o()((n={},a()(n,"".concat(S,"__product-price__value"),S),a()(n,z,Object(p.p)()),n)),J=I?T:D;return React.createElement(l.a,{align:y,className:E,currency:B,price:V.price,priceClassName:U,priceStyle:Object(p.p)()?J:{},minPrice:null==V||null===(m=V.price_range)||void 0===m?void 0:m.min_amount,maxPrice:null==V||null===(d=V.price_range)||void 0===d?void 0:d.max_amount,regularPrice:V.regular_price,regularPriceClassName:o()((b={},a()(b,"".concat(S,"__product-price__regular"),S),a()(b,z,Object(p.p)()),b)),regularPriceStyle:Object(p.p)()?D:{}})}))},59:function(e,r,c){"use strict";var t=c(13),a=c.n(t),n=c(5),o=c.n(n),l=c(17),i=c.n(l),s=c(124),u=c(3),p=c.n(u),m=(c(149),["className","value","currency","onValueChange","displayType"]);function d(e,r){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),c.push.apply(c,t)}return c}function b(e){for(var r=1;r<arguments.length;r++){var c=null!=arguments[r]?arguments[r]:{};r%2?d(Object(c),!0).forEach((function(r){o()(e,r,c[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(c)):d(Object(c)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(c,r))}))}return e}r.a=function(e){var r=e.className,c=e.value,t=e.currency,n=e.onValueChange,o=e.displayType,l=void 0===o?"text":o,u=i()(e,m),d="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(d))return null;var f=d/Math.pow(10,t.minorUnit);if(!Number.isFinite(f))return null;var y=p()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",r),g=b(b(b({},u),function(e){return{thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0}}(t)),{},{value:void 0,currency:void 0,onValueChange:void 0}),v=n?function(e){var r=e.value*Math.pow(10,t.minorUnit);n(r)}:function(){};return React.createElement(s.a,a()({className:y,displayType:l},g,{value:f,onValueChange:v}))}}}]);
|
build/atomic-block-components/price.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
-
Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(u.formatPrice)(t),Object(u.formatPrice)(c))),Object(n.createElement)("span",{"aria-hidden":!0},Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:t,style:i})," — ",Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:c,style:i})))}),m=function(e){var r=e.currency,c=e.regularPriceClassName,t=e.regularPriceStyle,a=e.regularPrice,i=e.priceClassName,u=e.priceStyle,p=e.price;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:t},e)},value:a}),Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e)},value:p}))};r.a=function(e){var r=e.align,c=e.className,t=e.currency,o=e.format,i=void 0===o?"<price/>":o,u=e.maxPrice,b=void 0===u?null:u,d=e.minPrice,O=void 0===d?null:d,f=e.price,j=void 0===f?null:f,y=e.priceClassName,g=e.priceStyle,v=e.regularPrice,_=e.regularPriceClassName,P=e.regularPriceStyle,N=s()(c,"price","wc-block-components-product-price",a()({},"wc-block-components-product-price--align-".concat(r),r));i.includes("<price/>")||(i="<price/>",console.error("Price formats need to include the `<price/>` tag."));var w=v&&j!==v,S=Object(n.createElement)("span",{className:s()("wc-block-components-product-price__value",y)});return w?S=Object(n.createElement)(m,{currency:t,price:j,priceClassName:y,priceStyle:g,regularPrice:v,regularPriceClassName:_,regularPriceStyle:P}):null!==O&&null!==b?S=Object(n.createElement)(p,{currency:t,maxPrice:b,minPrice:O,priceClassName:y,priceStyle:g}):null!==j&&(S=Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",y),currency:t,value:j,style:g})),Object(n.createElement)("span",{className:N},Object(n.createInterpolateElement)(i,{price:S}))}},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{127:function(e,r,c){"use strict";var t=c(5),a=c.n(t),n=c(0),o=c(1),l=c(53),i=c(6),s=c.n(i),u=(c(2),c(47)),p=(c(206),function(e){var r=e.currency,c=e.maxPrice,t=e.minPrice,a=e.priceClassName,i=e.priceStyle;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
+
Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(u.formatPrice)(t),Object(u.formatPrice)(c))),Object(n.createElement)("span",{"aria-hidden":!0},Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:t,style:i})," — ",Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",a),currency:r,value:c,style:i})))}),m=function(e){var r=e.currency,c=e.regularPriceClassName,t=e.regularPriceStyle,a=e.regularPrice,i=e.priceClassName,u=e.priceStyle,p=e.price;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:t},e)},value:a}),Object(n.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(n.createElement)(l.a,{currency:r,renderText:function(e){return Object(n.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e)},value:p}))};r.a=function(e){var r=e.align,c=e.className,t=e.currency,o=e.format,i=void 0===o?"<price/>":o,u=e.maxPrice,b=void 0===u?null:u,d=e.minPrice,O=void 0===d?null:d,f=e.price,j=void 0===f?null:f,y=e.priceClassName,g=e.priceStyle,v=e.regularPrice,_=e.regularPriceClassName,P=e.regularPriceStyle,N=s()(c,"price","wc-block-components-product-price",a()({},"wc-block-components-product-price--align-".concat(r),r));i.includes("<price/>")||(i="<price/>",console.error("Price formats need to include the `<price/>` tag."));var w=v&&j!==v,S=Object(n.createElement)("span",{className:s()("wc-block-components-product-price__value",y)});return w?S=Object(n.createElement)(m,{currency:t,price:j,priceClassName:y,priceStyle:g,regularPrice:v,regularPriceClassName:_,regularPriceStyle:P}):null!==O&&null!==b?S=Object(n.createElement)(p,{currency:t,maxPrice:b,minPrice:O,priceClassName:y,priceStyle:g}):null!==j&&(S=Object(n.createElement)(l.a,{className:s()("wc-block-components-product-price__value",y),currency:t,value:j,style:g})),Object(n.createElement)("span",{className:N},Object(n.createInterpolateElement)(i,{price:S}))}},175:function(e,r){},206:function(e,r){},484:function(e,r,c){"use strict";c.r(r);var t=c(5),a=c.n(t),n=c(0),o=(c(2),c(6)),l=c.n(o),i=c(127),s=c(47),u=c(44),p=c(21),m=c(11),b=c(84);r.default=Object(b.withProductDataContext)((function(e){var r,c,t,o,b,d,O,f=e.className,j=e.align,y=e.fontSize,g=e.customFontSize,v=e.saleFontSize,_=e.customSaleFontSize,P=e.color,N=e.customColor,w=e.saleColor,S=e.customSaleColor,C=Object(u.useInnerBlockLayoutContext)().parentClassName,E=Object(u.useProductDataContext)().product,x=l()(f,a()({},"".concat(C,"__product-price"),C));if(!E.id)return Object(n.createElement)(i.a,{align:j,className:x});var h=Object(p.getColorClassName)("color",P),k=Object(p.getFontSizeClass)(y),z=Object(p.getColorClassName)("color",w),F=Object(p.getFontSizeClass)(v),D=l()((r={"has-text-color":P||N,"has-font-size":y||g},a()(r,h,h),a()(r,k,k),r)),T=l()((c={"has-text-color":w||S,"has-font-size":v||_},a()(c,z,z),a()(c,F,F),c)),V={color:N,fontSize:g},B={color:S,fontSize:_},I=E.prices,U=Object(s.getCurrencyFromPriceResponse)(I),J=I.price!==I.regular_price,M=J?l()((t={},a()(t,"".concat(C,"__product-price__value"),C),a()(t,T,Object(m.s)()),t)):l()((o={},a()(o,"".concat(C,"__product-price__value"),C),a()(o,D,Object(m.s)()),o)),W=J?B:V;return Object(n.createElement)(i.a,{align:j,className:x,currency:U,price:I.price,priceClassName:M,priceStyle:Object(m.s)()?W:{},minPrice:null==I||null===(b=I.price_range)||void 0===b?void 0:b.min_amount,maxPrice:null==I||null===(d=I.price_range)||void 0===d?void 0:d.max_amount,regularPrice:I.regular_price,regularPriceClassName:l()((O={},a()(O,"".concat(C,"__product-price__regular"),C),a()(O,D,Object(m.s)()),O)),regularPriceStyle:Object(m.s)()?V:{}})}))},53:function(e,r,c){"use strict";var t=c(9),a=c.n(t),n=c(5),o=c.n(n),l=c(14),i=c.n(l),s=c(0),u=c(169),p=c(6),m=c.n(p),b=(c(175),["className","value","currency","onValueChange","displayType"]);function d(e,r){var c=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),c.push.apply(c,t)}return c}function O(e){for(var r=1;r<arguments.length;r++){var c=null!=arguments[r]?arguments[r]:{};r%2?d(Object(c),!0).forEach((function(r){o()(e,r,c[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(c)):d(Object(c)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(c,r))}))}return e}r.a=function(e){var r=e.className,c=e.value,t=e.currency,n=e.onValueChange,o=e.displayType,l=void 0===o?"text":o,p=i()(e,b),d="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(d))return null;var f=d/Math.pow(10,t.minorUnit);if(!Number.isFinite(f))return null;var j=m()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",r),y=O(O(O({},p),function(e){return{thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0}}(t)),{},{value:void 0,currency:void 0,onValueChange:void 0}),g=n?function(e){var r=e.value*Math.pow(10,t.minorUnit);n(r)}:function(){};return Object(s.createElement)(u.a,a()({className:j,displayType:l},y,{value:f,onValueChange:g}))}}}]);
|
build/atomic-block-components/rating-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[7],{
|
2 |
/* translators: %f is referring to the average rating value */
|
3 |
Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),o);return React.createElement("div",{className:s()(e,"wc-block-components-product-rating",n()({},"".concat(a,"__product-rating"),a))},React.createElement("div",{className:s()("wc-block-components-product-rating__stars","".concat(a,"__product-rating__stars")),role:"img","aria-label":p},React.createElement("span",{style:i},p)))}))}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[7],{335:function(t,e){},346:function(t,e,a){"use strict";a.r(e);var c=a(5),n=a.n(c),r=(a(10),a(1)),o=a(3),s=a.n(o),u=a(108),i=a(252),l=(a(335),function(t){var e=parseFloat(t.average_rating);return Number.isFinite(e)&&e>0?e:0});e.default=Object(i.withProductDataContext)((function(t){var e=t.className,a=Object(u.useInnerBlockLayoutContext)().parentClassName,c=Object(u.useProductDataContext)().product,o=l(c);if(!o)return null;var i={width:o/5*100+"%"},p=Object(r.sprintf)(
|
2 |
/* translators: %f is referring to the average rating value */
|
3 |
Object(r.__)("Rated %f out of 5","woo-gutenberg-products-block"),o);return React.createElement("div",{className:s()(e,"wc-block-components-product-rating",n()({},"".concat(a,"__product-rating"),a))},React.createElement("div",{className:s()("wc-block-components-product-rating__stars","".concat(a,"__product-rating__stars")),role:"img","aria-label":p},React.createElement("span",{style:i},p)))}))}}]);
|
build/atomic-block-components/rating.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{
|
2 |
/* translators: %f is referring to the average rating value */
|
3 |
-
Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),s);return Object(r.createElement)("div",{className:u()(e,"wc-block-components-product-rating",n()({},"".concat(c,"__product-rating"),c))},Object(r.createElement)("div",{className:u()("wc-block-components-product-rating__stars","".concat(c,"__product-rating__stars")),role:"img","aria-label":b},Object(r.createElement)("span",{style:l},b)))}))},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{485:function(t,e,c){"use strict";c.r(e);var a=c(5),n=c.n(a),r=c(0),o=(c(2),c(1)),s=c(6),u=c.n(s),i=c(44),l=c(84),p=(c(541),function(t){var e=parseFloat(t.average_rating);return Number.isFinite(e)&&e>0?e:0});e.default=Object(l.withProductDataContext)((function(t){var e=t.className,c=Object(i.useInnerBlockLayoutContext)().parentClassName,a=Object(i.useProductDataContext)().product,s=p(a);if(!s)return null;var l={width:s/5*100+"%"},b=Object(o.sprintf)(
|
2 |
/* translators: %f is referring to the average rating value */
|
3 |
+
Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),s);return Object(r.createElement)("div",{className:u()(e,"wc-block-components-product-rating",n()({},"".concat(c,"__product-rating"),c))},Object(r.createElement)("div",{className:u()("wc-block-components-product-rating__stars","".concat(c,"__product-rating__stars")),role:"img","aria-label":b},Object(r.createElement)("span",{style:l},b)))}))},541:function(t,e){}}]);
|
build/atomic-block-components/sale-badge-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[8],{330:function(e,t){},331:function(e,t,r){"use strict";r.r(t);var c=r(5),n=r.n(c),a=(r(10),r(1)),o=r(3),s=r.n(o),l=r(37),u=r(108),p=r(252);r(330),t.default=Object(p.withProductDataContext)((function(e){var t=e.className,r=e.align,c=Object(u.useInnerBlockLayoutContext)().parentClassName,o=Object(u.useProductDataContext)().product;if(!o.id||!o.on_sale)return null;var p="string"==typeof r?"wc-block-components-product-sale-badge--align-".concat(r):"";return React.createElement("div",{className:s()("wc-block-components-product-sale-badge",t,p,n()({},"".concat(c,"__product-onsale"),c))},React.createElement(l.a,{label:Object(a.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Product on sale","woo-gutenberg-products-block")}))}))},37:function(e,t,r){"use strict";var c=r(5),n=r.n(c),a=r(0),o=r(3),s=r.n(o);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,c)}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){n()(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}t.a=function(e){var t,r=e.label,c=e.screenReaderLabel,n=e.wrapperElement,o=e.wrapperProps,l=void 0===o?{}:o,p=null!=r,b=null!=c;return!p&&b?(t=n||"span",l=u(u({},l),{},{className:s()(l.className,"screen-reader-text")}),React.createElement(t,l,c)):(t=n||a.Fragment,p&&b&&r!==c?React.createElement(t,l,React.createElement("span",{"aria-hidden":"true"},r),React.createElement("span",{className:"screen-reader-text"},c)):React.createElement(t,l,r))}}}]);
|
build/atomic-block-components/sale-badge.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{306:function(e,t,r){"use strict";r.r(t);var c=r(5),n=r.n(c),a=r(0),o=(r(2),r(1)),s=r(6),l=r.n(s),u=r(41),b=r(44),p=r(84);r(539),t.default=Object(p.withProductDataContext)((function(e){var t=e.className,r=e.align,c=Object(b.useInnerBlockLayoutContext)().parentClassName,s=Object(b.useProductDataContext)().product;if(!s.id||!s.on_sale)return null;var p="string"==typeof r?"wc-block-components-product-sale-badge--align-".concat(r):"";return Object(a.createElement)("div",{className:l()("wc-block-components-product-sale-badge",t,p,n()({},"".concat(c,"__product-onsale"),c))},Object(a.createElement)(u.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))}))},41:function(e,t,r){"use strict";var c=r(5),n=r.n(c),a=r(0),o=r(6),s=r.n(o);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,c)}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){n()(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}t.a=function(e){var t,r=e.label,c=e.screenReaderLabel,n=e.wrapperElement,o=e.wrapperProps,l=void 0===o?{}:o,b=null!=r,p=null!=c;return!b&&p?(t=n||"span",l=u(u({},l),{},{className:s()(l.className,"screen-reader-text")}),Object(a.createElement)(t,l,c)):(t=n||a.Fragment,b&&p&&r!==c?Object(a.createElement)(t,l,Object(a.createElement)("span",{"aria-hidden":"true"},r),Object(a.createElement)("span",{className:"screen-reader-text"},c)):Object(a.createElement)(t,l,r))}},539:function(e,t){}}]);
|
build/atomic-block-components/sku-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[9],{339:function(t,c){},349:function(t,c,e){"use strict";e.r(c);var n=e(5),o=e.n(n),a=e(1),u=(e(10),e(3)),s=e.n(u),r=e(108),l=e(252);e(339),c.default=Object(l.withProductDataContext)((function(t){var c=t.className,e=Object(r.useInnerBlockLayoutContext)().parentClassName,n=Object(r.useProductDataContext)().product.sku;return n?React.createElement("div",{className:s()(c,"wc-block-components-product-sku",o()({},"".concat(e,"__product-sku"),e))},Object(a.__)("SKU:","woo-gutenberg-products-block")," ",React.createElement("strong",null,n)):null}))}}]);
|
build/atomic-block-components/sku.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{490:function(t,c,e){"use strict";e.r(c);var n=e(5),o=e.n(n),u=e(0),s=e(1),a=(e(2),e(6)),r=e.n(a),l=e(44),b=e(84);e(544),c.default=Object(b.withProductDataContext)((function(t){var c=t.className,e=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product.sku;return n?Object(u.createElement)("div",{className:r()(c,"wc-block-components-product-sku",o()({},"".concat(e,"__product-sku"),e))},Object(s.__)("SKU:","woo-gutenberg-products-block")," ",Object(u.createElement)("strong",null,n)):null}))},544:function(t,c){}}]);
|
build/atomic-block-components/stock-indicator-frontend.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[10],{
|
2 |
/* translators: %d stock amount (number of items in stock for product) */
|
3 |
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),o)});c.default=Object(u.withProductDataContext)((function(o){var c,t=o.className,n=Object(i.useInnerBlockLayoutContext)().parentClassName,s=Object(i.useProductDataContext)().product;if(!s.id||!s.is_purchasable)return null;var u=!!s.is_in_stock,b=s.low_stock_remaining,d=s.is_on_backorder;return React.createElement("div",{className:a()(t,"wc-block-components-product-stock-indicator",(c={},e()(c,"".concat(n,"__stock-indicator"),n),e()(c,"wc-block-components-product-stock-indicator--in-stock",u),e()(c,"wc-block-components-product-stock-indicator--out-of-stock",!u),e()(c,"wc-block-components-product-stock-indicator--low-stock",!!b),e()(c,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),c))},b?k(b):function(o,c){return c?Object(r.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(r.__)("In Stock","woo-gutenberg-products-block"):Object(r.__)("Out of Stock","woo-gutenberg-products-block")}(u,d))}))}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[10],{342:function(o,c){},352:function(o,c,t){"use strict";t.r(c);var n=t(5),e=t.n(n),r=t(1),s=(t(10),t(3)),a=t.n(s),i=t(108),u=t(252),k=(t(342),function(o){return Object(r.sprintf)(
|
2 |
/* translators: %d stock amount (number of items in stock for product) */
|
3 |
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),o)});c.default=Object(u.withProductDataContext)((function(o){var c,t=o.className,n=Object(i.useInnerBlockLayoutContext)().parentClassName,s=Object(i.useProductDataContext)().product;if(!s.id||!s.is_purchasable)return null;var u=!!s.is_in_stock,b=s.low_stock_remaining,d=s.is_on_backorder;return React.createElement("div",{className:a()(t,"wc-block-components-product-stock-indicator",(c={},e()(c,"".concat(n,"__stock-indicator"),n),e()(c,"wc-block-components-product-stock-indicator--in-stock",u),e()(c,"wc-block-components-product-stock-indicator--out-of-stock",!u),e()(c,"wc-block-components-product-stock-indicator--low-stock",!!b),e()(c,"wc-block-components-product-stock-indicator--available-on-backorder",!!d),c))},b?k(b):function(o,c){return c?Object(r.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(r.__)("In Stock","woo-gutenberg-products-block"):Object(r.__)("Out of Stock","woo-gutenberg-products-block")}(u,d))}))}}]);
|
build/atomic-block-components/stock-indicator.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{
|
2 |
/* translators: %d stock amount (number of items in stock for product) */
|
3 |
-
Object(s.__)("%d left in stock","woo-gutenberg-products-block"),o)});c.default=Object(k.withProductDataContext)((function(o){var c,t=o.className,n=Object(u.useInnerBlockLayoutContext)().parentClassName,a=Object(u.useProductDataContext)().product;if(!a.id||!a.is_purchasable)return null;var k=!!a.is_in_stock,d=a.low_stock_remaining,l=a.is_on_backorder;return Object(r.createElement)("div",{className:i()(t,"wc-block-components-product-stock-indicator",(c={},e()(c,"".concat(n,"__stock-indicator"),n),e()(c,"wc-block-components-product-stock-indicator--in-stock",k),e()(c,"wc-block-components-product-stock-indicator--out-of-stock",!k),e()(c,"wc-block-components-product-stock-indicator--low-stock",!!d),e()(c,"wc-block-components-product-stock-indicator--available-on-backorder",!!l),c))},d?b(d):function(o,c){return c?Object(s.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(s.__)("In Stock","woo-gutenberg-products-block"):Object(s.__)("Out of Stock","woo-gutenberg-products-block")}(k,l))}))},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{493:function(o,c,t){"use strict";t.r(c);var n=t(5),e=t.n(n),r=t(0),s=t(1),a=(t(2),t(6)),i=t.n(a),u=t(44),k=t(84),b=(t(547),function(o){return Object(s.sprintf)(
|
2 |
/* translators: %d stock amount (number of items in stock for product) */
|
3 |
+
Object(s.__)("%d left in stock","woo-gutenberg-products-block"),o)});c.default=Object(k.withProductDataContext)((function(o){var c,t=o.className,n=Object(u.useInnerBlockLayoutContext)().parentClassName,a=Object(u.useProductDataContext)().product;if(!a.id||!a.is_purchasable)return null;var k=!!a.is_in_stock,d=a.low_stock_remaining,l=a.is_on_backorder;return Object(r.createElement)("div",{className:i()(t,"wc-block-components-product-stock-indicator",(c={},e()(c,"".concat(n,"__stock-indicator"),n),e()(c,"wc-block-components-product-stock-indicator--in-stock",k),e()(c,"wc-block-components-product-stock-indicator--out-of-stock",!k),e()(c,"wc-block-components-product-stock-indicator--low-stock",!!d),e()(c,"wc-block-components-product-stock-indicator--available-on-backorder",!!l),c))},d?b(d):function(o,c){return c?Object(s.__)("Available on backorder","woo-gutenberg-products-block"):o?Object(s.__)("In Stock","woo-gutenberg-products-block"):Object(s.__)("Out of Stock","woo-gutenberg-products-block")}(k,l))}))},547:function(o,c){}}]);
|
build/atomic-block-components/summary-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{144:function(t,e,c){"use strict";var n=c(0),r=c(119),o=c(96),a=function(t){var e=t.indexOf("</p>");return-1===e?t:t.substr(0,e+4)},u=function(t){return t.replace(/<\/?[a-z][^>]*?>/gi,"")},s=function(t,e){return t.replace(/[\s|\.\,]+$/i,"")+e},i=function(t,e){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",n=u(t),r=n.split(" ").splice(0,e).join(" ");return Object(o.autop)(s(r,c))},l=function(t,e){var c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…",r=u(t),a=r.slice(0,e);if(c)return Object(o.autop)(s(a,n));var i=a.match(/([\s]+)/g),l=i?i.length:0,p=r.slice(0,e+l);return Object(o.autop)(s(p,n))};e.a=function(t){var e=t.source,c=t.maxLength,u=void 0===c?15:c,s=t.countType,p=void 0===s?"words":s,d=t.className,m=void 0===d?"":d,v=Object(n.useMemo)((function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words",n=Object(o.autop)(t),u=Object(r.count)(n,c);if(u<=e)return n;var s=a(n),p=Object(r.count)(s,c);return p<=e?s:"words"===c?i(s,e):l(s,e,"characters_including_spaces"===c)}(e,u,p)}),[e,u,p]);return React.createElement(n.RawHTML,{className:m},v)}},338:function(t,e){},348:function(t,e,c){"use strict";c.r(e);var n=c(5),r=c.n(n),o=(c(10),c(3)),a=c.n(o),u=c(144),s=c(15),i=c(108),l=c(252);c(338),e.default=Object(l.withProductDataContext)((function(t){var e=t.className,c=Object(i.useInnerBlockLayoutContext)().parentClassName,n=Object(i.useProductDataContext)().product;if(!n)return React.createElement("div",{className:a()(e,"wc-block-components-product-summary",r()({},"".concat(c,"__product-summary"),c))});var o=n.short_description?n.short_description:n.description;return o?React.createElement(u.a,{className:a()(e,"wc-block-components-product-summary",r()({},"".concat(c,"__product-summary"),c)),source:o,maxLength:150,countType:s.o.wordCountType||"words"}):null}))}}]);
|
build/atomic-block-components/summary.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{161:function(t,e,c){"use strict";var n=c(0),r=c(119),o=c(90),a=function(t){var e=t.indexOf("</p>");return-1===e?t:t.substr(0,e+4)},u=function(t){return t.replace(/<\/?[a-z][^>]*?>/gi,"")},s=function(t,e){return t.replace(/[\s|\.\,]+$/i,"")+e},i=function(t,e){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…",n=u(t),r=n.split(" ").splice(0,e).join(" ");return Object(o.autop)(s(r,c))},l=function(t,e){var c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…",r=u(t),a=r.slice(0,e);if(c)return Object(o.autop)(s(a,n));var i=a.match(/([\s]+)/g),l=i?i.length:0,p=r.slice(0,e+l);return Object(o.autop)(s(p,n))};e.a=function(t){var e=t.source,c=t.maxLength,u=void 0===c?15:c,s=t.countType,p=void 0===s?"words":s,d=t.className,m=void 0===d?"":d,v=Object(n.useMemo)((function(){return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words",n=Object(o.autop)(t),u=Object(r.count)(n,c);if(u<=e)return n;var s=a(n),p=Object(r.count)(s,c);return p<=e?s:"words"===c?i(s,e):l(s,e,"characters_including_spaces"===c)}(e,u,p)}),[e,u,p]);return Object(n.createElement)(n.RawHTML,{className:m},v)}},489:function(t,e,c){"use strict";c.r(e);var n=c(5),r=c.n(n),o=c(0),a=(c(2),c(6)),u=c.n(a),s=c(161),i=c(11),l=c(44),p=c(84);c(543),e.default=Object(p.withProductDataContext)((function(t){var e=t.className,c=Object(l.useInnerBlockLayoutContext)().parentClassName,n=Object(l.useProductDataContext)().product;if(!n)return Object(o.createElement)("div",{className:u()(e,"wc-block-components-product-summary",r()({},"".concat(c,"__product-summary"),c))});var a=n.short_description?n.short_description:n.description;return a?Object(o.createElement)(s.a,{className:u()(e,"wc-block-components-product-summary",r()({},"".concat(c,"__product-summary"),c)),source:a,maxLength:150,countType:i.q.wordCountType||"words"}):null}))},543:function(t,e){}}]);
|
build/atomic-block-components/tag-list-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{341:function(t,e){},351:function(t,e,c){"use strict";c.r(e);var a=c(5),n=c.n(a),o=c(1),s=(c(10),c(3)),l=c.n(s),u=c(108),r=c(7),i=c(252);c(341),e.default=Object(i.withProductDataContext)((function(t){var e=t.className,c=Object(u.useInnerBlockLayoutContext)().parentClassName,a=Object(u.useProductDataContext)().product;return Object(r.isEmpty)(a.tags)?null:React.createElement("div",{className:l()(e,"wc-block-components-product-tag-list",n()({},"".concat(c,"__product-tag-list"),c))},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",React.createElement("ul",null,Object.values(a.tags).map((function(t){var e=t.name,c=t.link,a=t.slug;return React.createElement("li",{key:"tag-list-item-".concat(a)},React.createElement("a",{href:c},e))}))))}))}}]);
|
build/atomic-block-components/tag-list.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{492:function(t,e,c){"use strict";c.r(e);var n=c(5),a=c.n(n),o=c(0),s=c(1),l=(c(2),c(6)),u=c.n(l),r=c(44),i=c(7),b=c(84);c(546),e.default=Object(b.withProductDataContext)((function(t){var e=t.className,c=Object(r.useInnerBlockLayoutContext)().parentClassName,n=Object(r.useProductDataContext)().product;return Object(i.isEmpty)(n.tags)?null:Object(o.createElement)("div",{className:u()(e,"wc-block-components-product-tag-list",a()({},"".concat(c,"__product-tag-list"),c))},Object(s.__)("Tags:","woo-gutenberg-products-block")," ",Object(o.createElement)("ul",null,Object.values(n.tags).map((function(t){var e=t.name,c=t.link,n=t.slug;return Object(o.createElement)("li",{key:"tag-list-item-".concat(n)},Object(o.createElement)("a",{href:c},e))}))))}))},546:function(t,e){}}]);
|
build/atomic-block-components/title-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{143:function(e,t,n){"use strict";var c=n(13),o=n.n(c),r=n(17),a=n.n(r),i=n(24),s=n(3),l=n.n(s),u=(n(162),["className","disabled","name","permalink"]);t.a=function(e){var t=e.className,n=void 0===t?"":t,c=e.disabled,r=void 0!==c&&c,s=e.name,p=e.permalink,b=void 0===p?"":p,d=a()(e,u),f=l()("wc-block-components-product-name",n);return r?React.createElement("span",o()({className:f},d,{dangerouslySetInnerHTML:{__html:Object(i.decodeEntities)(s)}})):React.createElement("a",o()({className:f,href:b},d,{dangerouslySetInnerHTML:{__html:Object(i.decodeEntities)(s)}}))}},162:function(e,t){},198:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var c=function(e,t){var n=[];return Object.keys(e).forEach((function(c){if(void 0!==t[c])switch(e[c].type){case"boolean":n[c]="false"!==t[c]&&!1!==t[c];break;case"number":n[c]=parseInt(t[c],10);break;case"array":case"object":n[c]=JSON.parse(t[c]);break;default:n[c]=t[c]}else n[c]=e[c].default})),n}},329:function(e,t,n){"use strict";var c=n(13),o=n.n(c),r=n(198);t.a=function(e){return function(t){return function(n){var c=Object(r.a)(e,n);return React.createElement(t,o()({},n,c))}}}},334:function(e,t){},355:function(e,t,n){"use strict";n.r(t);var c=n(329),o=n(5),r=n.n(o),a=(n(10),n(3)),i=n.n(a),s=n(108),l=n(253),u=n(15),p=function(e){var t=e.color,n=e.fontSize;return Object(u.p)()?{color:t,fontSize:n}:{}},b=n(252),d=n(143),f=n(56),m=(n(334),Object(b.withProductDataContext)((function(e){var t,n,c,o=e.className,a=e.headingLevel,b=void 0===a?2:a,m=e.showProductLink,O=void 0===m||m,j=e.align,y=e.color,v=e.customColor,k=e.fontSize,w=e.customFontSize,g=Object(s.useInnerBlockLayoutContext)().parentClassName,h=Object(s.useProductDataContext)().product,S=Object(f.a)().dispatchStoreEvent,E="h".concat(b),P=Object(l.getColorClassName)("color",y),N=Object(l.getFontSizeClass)(k),z=i()((t={"has-text-color":y||v,"has-font-size":k||w},r()(t,P,P),r()(t,N,N),t));return h.id?React.createElement(E,{className:i()(o,"wc-block-components-product-title",(n={},r()(n,"".concat(g,"__product-title"),g),r()(n,"wc-block-components-product-title--align-".concat(j),j&&Object(u.p)()),n))},React.createElement(d.a,{className:i()(r()({},z,Object(u.p)())),disabled:!O,name:h.name,permalink:h.permalink,rel:O?"nofollow":null,style:p({color:v,fontSize:w}),onClick:function(){S("product-view-link",{product:h})}})):React.createElement(E,{className:i()(o,"wc-block-components-product-title",(c={},r()(c,"".concat(g,"__product-title"),g),r()(c,"wc-block-components-product-title--align-".concat(j),j&&Object(u.p)()),r()(c,z,Object(u.p)()),c)),style:p({color:v,fontSize:w})})})));function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,c)}return n}function j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){
|