Version Description
- 2022-03-28 =
Enhancements
- Product Ratings: Add Global Styles font size and spacing support. (5927)
- Add resource hinting for cart and checkout blocks to improve first time performance. (5553)
- Add Mini Cart block to feature plugin (6127)
- Allow memoized checkout filters to re-run if the default value changes between runs. (6102)
Bug Fixes
- Filter Products by Attribute: Make dropdown search case sensitive. (6096)
- Stop showing the price slider skeleton when moving the slider handles. (6078)
Various
- Rename Legacy Template block to Classic Template block. (6021)
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Gutenberg Products Block |
Version | 7.3.0 |
Comparing to | |
See all releases |
Code changes from version 7.2.1 to 7.3.0
- assets/js/atomic/blocks/product-elements/price/block.js +0 -6
- assets/js/atomic/blocks/product-elements/rating/block.js +12 -4
- assets/js/atomic/blocks/product-elements/rating/index.js +1 -0
- assets/js/atomic/blocks/product-elements/rating/support.js +17 -0
- assets/js/atomic/blocks/product-elements/sale-badge/style.scss +1 -0
- assets/js/atomic/blocks/product-elements/title/attributes.ts +0 -12
- assets/js/atomic/blocks/product-elements/title/block.tsx +0 -3
- assets/js/base/components/cart-checkout/totals/footer-item/stories/index.tsx +1 -1
- assets/js/base/components/drawer/style.scss +0 -1
- assets/js/base/components/dropdown-selector/index.js +15 -5
- assets/js/base/components/price-slider/style.scss +2 -4
- assets/js/base/components/textarea/index.js +0 -43
- assets/js/base/components/textarea/index.tsx +36 -0
- assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js +0 -3
- assets/js/base/utils/get-icons-from-payment-methods.ts +0 -2
- assets/js/blocks/cart-checkout/cart/inner-blocks/cart-accepted-payment-methods-block/block.tsx +1 -15
- assets/js/blocks/cart-checkout/cart/test/block.js +27 -15
- assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss +5 -0
- assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx +2 -2
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts +1 -0
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx +3 -5
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx +8 -4
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx +7 -3
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx +19 -2
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx +12 -2
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json +2 -2
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx +14 -2
- assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx +7 -2
- assets/js/blocks/cart-checkout/mini-cart/block.tsx +8 -9
- assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx +1 -1
- assets/js/blocks/cart-checkout/mini-cart/edit.tsx +42 -103
- assets/js/blocks/cart-checkout/mini-cart/index.tsx +6 -23
- assets/js/blocks/cart-checkout/mini-cart/quantity-badge/style.scss +1 -2
- assets/js/blocks/cart-checkout/mini-cart/style.scss +17 -17
- assets/js/blocks/cart-checkout/mini-cart/test/block.js +0 -2
- assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js +0 -2
- assets/js/blocks/checkout/order-notes/index.js +1 -9
- assets/js/blocks/{legacy-template → classic-template}/assets/doc-image-single-product-classic-block.png +0 -0
- assets/js/blocks/{legacy-template → classic-template}/constants.ts +0 -0
- assets/js/blocks/{legacy-template → classic-template}/editor.scss +4 -4
- assets/js/blocks/{legacy-template → classic-template}/index.tsx +15 -7
- assets/js/blocks/featured-category/index.js +0 -14
- assets/js/blocks/featured-category/style.scss +1 -0
- assets/js/blocks/featured-product/index.js +0 -14
- assets/js/blocks/featured-product/style.scss +1 -0
- assets/js/data/cart/actions.ts +6 -2
- assets/js/data/cart/resolvers.ts +3 -2
- assets/js/data/collections/resolvers.js +11 -8
- assets/js/data/collections/test/resolvers.js +10 -5
- assets/js/data/schema/resolvers.js +3 -2
- assets/js/data/schema/test/resolvers.js +4 -2
- assets/js/editor-components/feedback-prompt/index.js +2 -2
- assets/js/icons/library/mini-cart.tsx +18 -25
- assets/js/types/type-defs/cart.ts +6 -1
- assets/js/types/type-defs/currency.ts +167 -2
- assets/js/types/type-defs/taxes.ts +7 -0
- build/active-filters-frontend.asset.php +1 -1
- build/active-filters-frontend.js +3 -3
- build/active-filters.asset.php +1 -1
- build/active-filters.js +5 -5
- build/all-products-frontend.asset.php +1 -1
- build/all-products-frontend.js +4 -4
- build/all-products.asset.php +1 -1
- build/all-products.js +14 -14
- build/all-reviews.asset.php +1 -1
- build/all-reviews.js +3 -3
- build/attribute-filter-frontend.asset.php +1 -1
- build/attribute-filter-frontend.js +10 -10
- build/attribute-filter.asset.php +1 -1
- build/attribute-filter.js +12 -12
- build/blocks-checkout.asset.php +1 -1
- build/blocks-checkout.js +3 -3
- build/cart-blocks/accepted-payment-methods-frontend.js +1 -1
- build/cart-blocks/checkout-button-frontend.js +1 -1
- build/cart-blocks/empty-cart-frontend.js +1 -1
- build/cart-blocks/express-payment-frontend.js +2 -2
- build/cart-blocks/filled-cart-frontend.js +1 -1
- build/cart-blocks/items-frontend.js +1 -1
- build/cart-blocks/line-items-frontend.js +6 -6
- build/cart-blocks/order-summary-frontend.js +6 -6
assets/js/atomic/blocks/product-elements/price/block.js
CHANGED
@@ -25,8 +25,6 @@ import {
|
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {string} [props.textAlign] Text alignment.
|
28 |
-
* @param {string} [props.fontSize] Normal Price font size name.
|
29 |
-
* @param {string} [props.color] Normal Price text color.
|
30 |
* context will be used if this is not provided.
|
31 |
* @return {*} The component.
|
32 |
*/
|
@@ -91,10 +89,6 @@ Block.propTypes = {
|
|
91 |
className: PropTypes.string,
|
92 |
product: PropTypes.object,
|
93 |
textAlign: PropTypes.oneOf( [ 'left', 'right', 'center' ] ),
|
94 |
-
fontSize: PropTypes.string,
|
95 |
-
fontWidth: PropTypes.string,
|
96 |
-
fontStyle: PropTypes.string,
|
97 |
-
color: PropTypes.string,
|
98 |
};
|
99 |
|
100 |
export default withProductDataContext( Block );
|
25 |
* @param {Object} props Incoming props.
|
26 |
* @param {string} [props.className] CSS Class name for the component.
|
27 |
* @param {string} [props.textAlign] Text alignment.
|
|
|
|
|
28 |
* context will be used if this is not provided.
|
29 |
* @return {*} The component.
|
30 |
*/
|
89 |
className: PropTypes.string,
|
90 |
product: PropTypes.object,
|
91 |
textAlign: PropTypes.oneOf( [ 'left', 'right', 'center' ] ),
|
|
|
|
|
|
|
|
|
92 |
};
|
93 |
|
94 |
export default withProductDataContext( Block );
|
assets/js/atomic/blocks/product-elements/rating/block.js
CHANGED
@@ -14,7 +14,11 @@ import { withProductDataContext } from '@woocommerce/shared-hocs';
|
|
14 |
* Internal dependencies
|
15 |
*/
|
16 |
import './style.scss';
|
17 |
-
import {
|
|
|
|
|
|
|
|
|
18 |
|
19 |
/**
|
20 |
* Product Rating Block Component.
|
@@ -24,11 +28,12 @@ import { useColorProps } from '../../../../hooks/style-attributes';
|
|
24 |
* @return {*} The component.
|
25 |
*/
|
26 |
const Block = ( props ) => {
|
27 |
-
const { className } = props;
|
28 |
const { parentClassName } = useInnerBlockLayoutContext();
|
29 |
const { product } = useProductDataContext();
|
30 |
const rating = getAverageRating( product );
|
31 |
const colorProps = useColorProps( props );
|
|
|
|
|
32 |
|
33 |
if ( ! rating ) {
|
34 |
return null;
|
@@ -62,14 +67,17 @@ const Block = ( props ) => {
|
|
62 |
return (
|
63 |
<div
|
64 |
className={ classnames(
|
65 |
-
className,
|
66 |
colorProps.className,
|
67 |
'wc-block-components-product-rating',
|
68 |
{
|
69 |
[ `${ parentClassName }__product-rating` ]: parentClassName,
|
70 |
}
|
71 |
) }
|
72 |
-
style={
|
|
|
|
|
|
|
|
|
73 |
>
|
74 |
<div
|
75 |
className={ classnames(
|
14 |
* Internal dependencies
|
15 |
*/
|
16 |
import './style.scss';
|
17 |
+
import {
|
18 |
+
useColorProps,
|
19 |
+
useSpacingProps,
|
20 |
+
useTypographyProps,
|
21 |
+
} from '../../../../hooks/style-attributes';
|
22 |
|
23 |
/**
|
24 |
* Product Rating Block Component.
|
28 |
* @return {*} The component.
|
29 |
*/
|
30 |
const Block = ( props ) => {
|
|
|
31 |
const { parentClassName } = useInnerBlockLayoutContext();
|
32 |
const { product } = useProductDataContext();
|
33 |
const rating = getAverageRating( product );
|
34 |
const colorProps = useColorProps( props );
|
35 |
+
const typographyProps = useTypographyProps( props );
|
36 |
+
const spacingProps = useSpacingProps( props );
|
37 |
|
38 |
if ( ! rating ) {
|
39 |
return null;
|
67 |
return (
|
68 |
<div
|
69 |
className={ classnames(
|
|
|
70 |
colorProps.className,
|
71 |
'wc-block-components-product-rating',
|
72 |
{
|
73 |
[ `${ parentClassName }__product-rating` ]: parentClassName,
|
74 |
}
|
75 |
) }
|
76 |
+
style={ {
|
77 |
+
...colorProps.style,
|
78 |
+
...typographyProps.style,
|
79 |
+
...spacingProps.style,
|
80 |
+
} }
|
81 |
>
|
82 |
<div
|
83 |
className={ classnames(
|
assets/js/atomic/blocks/product-elements/rating/index.js
CHANGED
@@ -18,6 +18,7 @@ import { supports } from './support';
|
|
18 |
import { Save } from './save';
|
19 |
|
20 |
const blockConfig = {
|
|
|
21 |
title,
|
22 |
description,
|
23 |
icon: { src: icon },
|
18 |
import { Save } from './save';
|
19 |
|
20 |
const blockConfig = {
|
21 |
+
apiVersion: 2,
|
22 |
title,
|
23 |
description,
|
24 |
icon: { src: icon },
|
assets/js/atomic/blocks/product-elements/rating/support.js
CHANGED
@@ -3,12 +3,29 @@
|
|
3 |
*/
|
4 |
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
export const supports = {
|
7 |
...( isFeaturePluginBuild() && {
|
8 |
color: {
|
9 |
text: true,
|
10 |
background: false,
|
11 |
link: false,
|
|
|
|
|
|
|
|
|
|
|
12 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
} ),
|
14 |
};
|
3 |
*/
|
4 |
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
5 |
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import { hasSpacingStyleSupport } from '../../../../utils/global-style';
|
10 |
+
|
11 |
export const supports = {
|
12 |
...( isFeaturePluginBuild() && {
|
13 |
color: {
|
14 |
text: true,
|
15 |
background: false,
|
16 |
link: false,
|
17 |
+
__experimentalSkipSerialization: true,
|
18 |
+
},
|
19 |
+
typography: {
|
20 |
+
fontSize: true,
|
21 |
+
__experimentalSkipSerialization: true,
|
22 |
},
|
23 |
+
...( hasSpacingStyleSupport() && {
|
24 |
+
spacing: {
|
25 |
+
margin: true,
|
26 |
+
__experimentalSkipSerialization: true,
|
27 |
+
},
|
28 |
+
} ),
|
29 |
+
__experimentalSelector: '.wc-block-components-product-rating',
|
30 |
} ),
|
31 |
};
|
assets/js/atomic/blocks/product-elements/sale-badge/style.scss
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
width: auto;
|
7 |
border: 1px solid #43454b;
|
8 |
border-radius: 3px;
|
|
|
9 |
color: #43454b;
|
10 |
background: #fff;
|
11 |
text-align: center;
|
6 |
width: auto;
|
7 |
border: 1px solid #43454b;
|
8 |
border-radius: 3px;
|
9 |
+
box-sizing: border-box;
|
10 |
color: #43454b;
|
11 |
background: #fff;
|
12 |
text-align: center;
|
assets/js/atomic/blocks/product-elements/title/attributes.ts
CHANGED
@@ -24,18 +24,6 @@ if ( isFeaturePluginBuild() ) {
|
|
24 |
align: {
|
25 |
type: 'string',
|
26 |
},
|
27 |
-
color: {
|
28 |
-
type: 'string',
|
29 |
-
},
|
30 |
-
customColor: {
|
31 |
-
type: 'string',
|
32 |
-
},
|
33 |
-
fontSize: {
|
34 |
-
type: 'string',
|
35 |
-
},
|
36 |
-
customFontSize: {
|
37 |
-
type: 'number',
|
38 |
-
},
|
39 |
};
|
40 |
}
|
41 |
export default blockAttributes;
|
24 |
align: {
|
25 |
type: 'string',
|
26 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
};
|
28 |
}
|
29 |
export default blockAttributes;
|
assets/js/atomic/blocks/product-elements/title/block.tsx
CHANGED
@@ -47,9 +47,6 @@ const TagName = ( {
|
|
47 |
* @param {number} [props.headingLevel] Heading level (h1, h2 etc)
|
48 |
* @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
|
49 |
* @param {string} [props.align] Title alignment.
|
50 |
-
* @param {string} [props.textColor] Title color name.
|
51 |
-
* @param {string} [props.fontSize] Title font size name.
|
52 |
-
* @param {string} [props.style] Title inline style.
|
53 |
* will be used if this is not provided.
|
54 |
* @return {*} The component.
|
55 |
*/
|
47 |
* @param {number} [props.headingLevel] Heading level (h1, h2 etc)
|
48 |
* @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
|
49 |
* @param {string} [props.align] Title alignment.
|
|
|
|
|
|
|
50 |
* will be used if this is not provided.
|
51 |
* @return {*} The component.
|
52 |
*/
|
assets/js/base/components/cart-checkout/totals/footer-item/stories/index.tsx
CHANGED
@@ -11,7 +11,7 @@ import { Currency } from '@woocommerce/types';
|
|
11 |
import FooterItem, { TotalsFooterItemProps } from '..';
|
12 |
|
13 |
const NZD: Currency = {
|
14 |
-
code: '
|
15 |
symbol: '$',
|
16 |
thousandSeparator: ' ',
|
17 |
decimalSeparator: '.',
|
11 |
import FooterItem, { TotalsFooterItemProps } from '..';
|
12 |
|
13 |
const NZD: Currency = {
|
14 |
+
code: 'NZD',
|
15 |
symbol: '$',
|
16 |
thousandSeparator: ' ',
|
17 |
decimalSeparator: '.',
|
assets/js/base/components/drawer/style.scss
CHANGED
@@ -69,7 +69,6 @@ $drawer-width-mobile: 100vw;
|
|
69 |
display: block;
|
70 |
height: 100%;
|
71 |
left: 100%;
|
72 |
-
overflow: auto;
|
73 |
position: fixed;
|
74 |
right: 0;
|
75 |
top: 0;
|
69 |
display: block;
|
70 |
height: 100%;
|
71 |
left: 100%;
|
|
|
72 |
position: fixed;
|
73 |
right: 0;
|
74 |
top: 0;
|
assets/js/base/components/dropdown-selector/index.js
CHANGED
@@ -31,6 +31,7 @@ import './style.scss';
|
|
31 |
* @param {boolean} props.multiple Whether multi-select is allowed.
|
32 |
* @param {function():any} props.onChange Function to be called when onChange event fires.
|
33 |
* @param {Array} props.options The option values to show in the select.
|
|
|
34 |
*/
|
35 |
const DropdownSelector = ( {
|
36 |
attributeLabel = '',
|
@@ -43,6 +44,7 @@ const DropdownSelector = ( {
|
|
43 |
multiple = false,
|
44 |
onChange = () => {},
|
45 |
options = [],
|
|
|
46 |
} ) => {
|
47 |
const inputRef = useRef( null );
|
48 |
|
@@ -182,11 +184,18 @@ const DropdownSelector = ( {
|
|
182 |
getItemProps={ getItemProps }
|
183 |
getMenuProps={ getMenuProps }
|
184 |
highlightedIndex={ highlightedIndex }
|
185 |
-
options={ options.filter(
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
/>
|
191 |
) }
|
192 |
</div>
|
@@ -210,6 +219,7 @@ DropdownSelector.propTypes = {
|
|
210 |
value: PropTypes.string.isRequired,
|
211 |
} )
|
212 |
),
|
|
|
213 |
};
|
214 |
|
215 |
export default DropdownSelector;
|
31 |
* @param {boolean} props.multiple Whether multi-select is allowed.
|
32 |
* @param {function():any} props.onChange Function to be called when onChange event fires.
|
33 |
* @param {Array} props.options The option values to show in the select.
|
34 |
+
* @param {boolean} [props.isCaseSensitive=false] Whether the dropdown search should be case-sensitive.
|
35 |
*/
|
36 |
const DropdownSelector = ( {
|
37 |
attributeLabel = '',
|
44 |
multiple = false,
|
45 |
onChange = () => {},
|
46 |
options = [],
|
47 |
+
isCaseSensitive = false,
|
48 |
} ) => {
|
49 |
const inputRef = useRef( null );
|
50 |
|
184 |
getItemProps={ getItemProps }
|
185 |
getMenuProps={ getMenuProps }
|
186 |
highlightedIndex={ highlightedIndex }
|
187 |
+
options={ options.filter( ( option ) => {
|
188 |
+
let optionName = option.name;
|
189 |
+
let nameQuery = inputValue?.trim();
|
190 |
+
if ( ! isCaseSensitive ) {
|
191 |
+
optionName = optionName.toLowerCase();
|
192 |
+
nameQuery = nameQuery?.toLowerCase();
|
193 |
+
}
|
194 |
+
return (
|
195 |
+
! nameQuery ||
|
196 |
+
optionName.includes( nameQuery )
|
197 |
+
);
|
198 |
+
} ) }
|
199 |
/>
|
200 |
) }
|
201 |
</div>
|
219 |
value: PropTypes.string.isRequired,
|
220 |
} )
|
221 |
),
|
222 |
+
isCaseSensitive: PropTypes.bool,
|
223 |
};
|
224 |
|
225 |
export default DropdownSelector;
|
assets/js/base/components/price-slider/style.scss
CHANGED
@@ -63,8 +63,7 @@
|
|
63 |
}
|
64 |
}
|
65 |
|
66 |
-
&.is-loading
|
67 |
-
&.is-disabled {
|
68 |
.wc-block-components-price-slider__range-input-wrapper,
|
69 |
.wc-block-components-price-slider__amount,
|
70 |
.wc-block-components-price-slider__button {
|
@@ -267,8 +266,7 @@
|
|
267 |
}
|
268 |
|
269 |
.wc-block-components-price-slider {
|
270 |
-
&.is-loading
|
271 |
-
&.is-disabled {
|
272 |
.wc-block-components-price-slider__range-input-wrapper {
|
273 |
@include placeholder();
|
274 |
box-shadow: none;
|
63 |
}
|
64 |
}
|
65 |
|
66 |
+
&.is-loading.is-disabled {
|
|
|
67 |
.wc-block-components-price-slider__range-input-wrapper,
|
68 |
.wc-block-components-price-slider__amount,
|
69 |
.wc-block-components-price-slider__button {
|
266 |
}
|
267 |
|
268 |
.wc-block-components-price-slider {
|
269 |
+
&.is-loading.is-disabled {
|
|
|
270 |
.wc-block-components-price-slider__range-input-wrapper {
|
271 |
@include placeholder();
|
272 |
box-shadow: none;
|
assets/js/base/components/textarea/index.js
DELETED
@@ -1,43 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import classnames from 'classnames';
|
5 |
-
import PropTypes from 'prop-types';
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Internal dependencies
|
9 |
-
*/
|
10 |
-
import './style.scss';
|
11 |
-
|
12 |
-
const Textarea = ( {
|
13 |
-
className = '',
|
14 |
-
disabled = false,
|
15 |
-
onTextChange,
|
16 |
-
placeholder,
|
17 |
-
value = '',
|
18 |
-
} ) => {
|
19 |
-
return (
|
20 |
-
<textarea
|
21 |
-
className={ classnames(
|
22 |
-
'wc-block-components-textarea',
|
23 |
-
className
|
24 |
-
) }
|
25 |
-
disabled={ disabled }
|
26 |
-
onChange={ ( event ) => {
|
27 |
-
onTextChange( event.target.value );
|
28 |
-
} }
|
29 |
-
placeholder={ placeholder }
|
30 |
-
rows={ 2 }
|
31 |
-
value={ value }
|
32 |
-
/>
|
33 |
-
);
|
34 |
-
};
|
35 |
-
|
36 |
-
Textarea.propTypes = {
|
37 |
-
onTextChange: PropTypes.func.isRequired,
|
38 |
-
disabled: PropTypes.bool,
|
39 |
-
placeholder: PropTypes.string,
|
40 |
-
value: PropTypes.string,
|
41 |
-
};
|
42 |
-
|
43 |
-
export default Textarea;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/components/textarea/index.tsx
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import classnames from 'classnames';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import './style.scss';
|
10 |
+
|
11 |
+
interface TextareaProps {
|
12 |
+
className: string;
|
13 |
+
disabled: boolean;
|
14 |
+
onTextChange: ( newText: string ) => void;
|
15 |
+
placeholder: string;
|
16 |
+
value: string;
|
17 |
+
}
|
18 |
+
|
19 |
+
export const Textarea = ( {
|
20 |
+
className = '',
|
21 |
+
disabled = false,
|
22 |
+
onTextChange,
|
23 |
+
placeholder,
|
24 |
+
value = '',
|
25 |
+
}: TextareaProps ): JSX.Element => (
|
26 |
+
<textarea
|
27 |
+
className={ classnames( 'wc-block-components-textarea', className ) }
|
28 |
+
disabled={ disabled }
|
29 |
+
onChange={ ( event ) => {
|
30 |
+
onTextChange( event.target.value );
|
31 |
+
} }
|
32 |
+
placeholder={ placeholder }
|
33 |
+
rows={ 2 }
|
34 |
+
value={ value }
|
35 |
+
/>
|
36 |
+
);
|
assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js
CHANGED
@@ -208,9 +208,6 @@ describe( 'Testing Payment Method Data Context Provider', () => {
|
|
208 |
);
|
209 |
expect( activePaymentMethod ).not.toBeNull();
|
210 |
} );
|
211 |
-
|
212 |
-
// ["`select` control in `@wordpress/data-controls` is deprecated. Please use built-in `resolveSelect` control in `@wordpress/data` instead."]
|
213 |
-
expect( console ).toHaveWarned();
|
214 |
} );
|
215 |
} );
|
216 |
|
208 |
);
|
209 |
expect( activePaymentMethod ).not.toBeNull();
|
210 |
} );
|
|
|
|
|
|
|
211 |
} );
|
212 |
} );
|
213 |
|
assets/js/base/utils/get-icons-from-payment-methods.ts
CHANGED
@@ -9,8 +9,6 @@ import type {
|
|
9 |
/**
|
10 |
* Get the provider icons from payment methods data.
|
11 |
*
|
12 |
-
* @todo Refactor the Cart blocks to use getIconsFromPaymentMethods utility instead of the local copy.
|
13 |
-
*
|
14 |
* @param {PaymentMethods} paymentMethods Payment Method data
|
15 |
* @return {PaymentMethodIconsType} Payment Method icons data.
|
16 |
*/
|
9 |
/**
|
10 |
* Get the provider icons from payment methods data.
|
11 |
*
|
|
|
|
|
12 |
* @param {PaymentMethods} paymentMethods Payment Method data
|
13 |
* @return {PaymentMethodIconsType} Payment Method icons data.
|
14 |
*/
|
assets/js/blocks/cart-checkout/cart/inner-blocks/cart-accepted-payment-methods-block/block.tsx
CHANGED
@@ -3,21 +3,7 @@
|
|
3 |
*/
|
4 |
import { PaymentMethodIcons } from '@woocommerce/base-components/cart-checkout';
|
5 |
import { usePaymentMethods } from '@woocommerce/base-context/hooks';
|
6 |
-
import
|
7 |
-
PaymentMethods,
|
8 |
-
PaymentMethodIcons as PaymentMethodIconsType,
|
9 |
-
} from '@woocommerce/type-defs/payments';
|
10 |
-
|
11 |
-
const getIconsFromPaymentMethods = (
|
12 |
-
paymentMethods: PaymentMethods
|
13 |
-
): PaymentMethodIconsType => {
|
14 |
-
return Object.values( paymentMethods ).reduce( ( acc, paymentMethod ) => {
|
15 |
-
if ( paymentMethod.icons !== null ) {
|
16 |
-
acc = acc.concat( paymentMethod.icons );
|
17 |
-
}
|
18 |
-
return acc;
|
19 |
-
}, [] as PaymentMethodIconsType );
|
20 |
-
};
|
21 |
|
22 |
const Block = ( { className }: { className: string } ): JSX.Element => {
|
23 |
const { paymentMethods } = usePaymentMethods();
|
3 |
*/
|
4 |
import { PaymentMethodIcons } from '@woocommerce/base-components/cart-checkout';
|
5 |
import { usePaymentMethods } from '@woocommerce/base-context/hooks';
|
6 |
+
import { getIconsFromPaymentMethods } from '@woocommerce/base-utils';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
const Block = ( { className }: { className: string } ): JSX.Element => {
|
9 |
const { paymentMethods } = usePaymentMethods();
|
assets/js/blocks/cart-checkout/cart/test/block.js
CHANGED
@@ -83,22 +83,24 @@ describe( 'Testing cart', () => {
|
|
83 |
} );
|
84 |
|
85 |
it( 'renders cart if there are items in the cart', async () => {
|
86 |
-
|
|
|
|
|
87 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
88 |
expect(
|
89 |
screen.getByText( /Proceed to Checkout/i )
|
90 |
).toBeInTheDocument();
|
91 |
|
92 |
expect( fetchMock ).toHaveBeenCalledTimes( 1 );
|
93 |
-
// ["`select` control in `@wordpress/data-controls` is deprecated. Please use built-in `resolveSelect` control in `@wordpress/data` instead."]
|
94 |
-
expect( console ).toHaveWarned();
|
95 |
} );
|
96 |
|
97 |
it( 'Contains a Taxes section if Core options are set to show it', async () => {
|
98 |
allSettings.displayCartPricesIncludingTax = false;
|
99 |
// The criteria for showing the Taxes section is:
|
100 |
// Display prices during basket and checkout: 'Excluding tax'.
|
101 |
-
|
|
|
|
|
102 |
|
103 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
104 |
expect( screen.getByText( /Tax/i ) ).toBeInTheDocument();
|
@@ -110,7 +112,9 @@ describe( 'Testing cart', () => {
|
|
110 |
// The criteria for showing the lines in the Taxes section is:
|
111 |
// Display prices during basket and checkout: 'Excluding tax'.
|
112 |
// Display tax totals: 'Itemized';
|
113 |
-
|
|
|
|
|
114 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
115 |
expect( screen.getByText( /Sales tax/i ) ).toBeInTheDocument();
|
116 |
} );
|
@@ -133,15 +137,19 @@ describe( 'Testing cart', () => {
|
|
133 |
} );
|
134 |
|
135 |
it( 'renders empty cart if there are no items in the cart', async () => {
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
|
|
|
|
|
|
|
|
|
|
143 |
} );
|
144 |
-
render( <CartBlock /> );
|
145 |
|
146 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
147 |
expect( screen.getByText( /Empty Cart/i ) ).toBeInTheDocument();
|
@@ -173,7 +181,9 @@ describe( 'Testing cart', () => {
|
|
173 |
return Promise.resolve( JSON.stringify( cart ) );
|
174 |
}
|
175 |
} );
|
176 |
-
|
|
|
|
|
177 |
|
178 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
179 |
expect( screen.getAllByRole( 'cell' )[ 1 ] ).toHaveTextContent( '16€' );
|
@@ -191,7 +201,9 @@ describe( 'Testing cart', () => {
|
|
191 |
],
|
192 |
};
|
193 |
const itemName = cart.items[ 0 ].name;
|
194 |
-
|
|
|
|
|
195 |
|
196 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
197 |
const quantityInput = screen.getByLabelText(
|
83 |
} );
|
84 |
|
85 |
it( 'renders cart if there are items in the cart', async () => {
|
86 |
+
act( () => {
|
87 |
+
render( <CartBlock /> );
|
88 |
+
} );
|
89 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
90 |
expect(
|
91 |
screen.getByText( /Proceed to Checkout/i )
|
92 |
).toBeInTheDocument();
|
93 |
|
94 |
expect( fetchMock ).toHaveBeenCalledTimes( 1 );
|
|
|
|
|
95 |
} );
|
96 |
|
97 |
it( 'Contains a Taxes section if Core options are set to show it', async () => {
|
98 |
allSettings.displayCartPricesIncludingTax = false;
|
99 |
// The criteria for showing the Taxes section is:
|
100 |
// Display prices during basket and checkout: 'Excluding tax'.
|
101 |
+
act( () => {
|
102 |
+
render( <CartBlock /> );
|
103 |
+
} );
|
104 |
|
105 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
106 |
expect( screen.getByText( /Tax/i ) ).toBeInTheDocument();
|
112 |
// The criteria for showing the lines in the Taxes section is:
|
113 |
// Display prices during basket and checkout: 'Excluding tax'.
|
114 |
// Display tax totals: 'Itemized';
|
115 |
+
act( () => {
|
116 |
+
render( <CartBlock /> );
|
117 |
+
} );
|
118 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
119 |
expect( screen.getByText( /Sales tax/i ) ).toBeInTheDocument();
|
120 |
} );
|
137 |
} );
|
138 |
|
139 |
it( 'renders empty cart if there are no items in the cart', async () => {
|
140 |
+
act( () => {
|
141 |
+
fetchMock.mockResponse( ( req ) => {
|
142 |
+
if ( req.url.match( /wc\/store\/v1\/cart/ ) ) {
|
143 |
+
return Promise.resolve(
|
144 |
+
JSON.stringify( defaultCartState.cartData )
|
145 |
+
);
|
146 |
+
}
|
147 |
+
return Promise.resolve( '' );
|
148 |
+
} );
|
149 |
+
} );
|
150 |
+
act( () => {
|
151 |
+
render( <CartBlock /> );
|
152 |
} );
|
|
|
153 |
|
154 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
155 |
expect( screen.getByText( /Empty Cart/i ) ).toBeInTheDocument();
|
181 |
return Promise.resolve( JSON.stringify( cart ) );
|
182 |
}
|
183 |
} );
|
184 |
+
act( () => {
|
185 |
+
render( <CartBlock /> );
|
186 |
+
} );
|
187 |
|
188 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
189 |
expect( screen.getAllByRole( 'cell' )[ 1 ] ).toHaveTextContent( '16€' );
|
201 |
],
|
202 |
};
|
203 |
const itemName = cart.items[ 0 ].name;
|
204 |
+
act( () => {
|
205 |
+
render( <CartBlock /> );
|
206 |
+
} );
|
207 |
|
208 |
await waitFor( () => expect( fetchMock ).toHaveBeenCalled() );
|
209 |
const quantityInput = screen.getByLabelText(
|
assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss
CHANGED
@@ -4,6 +4,11 @@
|
|
4 |
the mini cart contents on the front end. */
|
5 |
margin: 0 auto !important;
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
.wp-block-woocommerce-filled-mini-cart-contents-block > .block-editor-inner-blocks > .block-editor-block-list__layout {
|
8 |
display: flex;
|
9 |
flex-direction: column;
|
4 |
the mini cart contents on the front end. */
|
5 |
margin: 0 auto !important;
|
6 |
|
7 |
+
.wp-block-woocommerce-empty-mini-cart-contents-block[hidden],
|
8 |
+
.wp-block-woocommerce-filled-mini-cart-contents-block[hidden] {
|
9 |
+
display: none;
|
10 |
+
}
|
11 |
+
|
12 |
.wp-block-woocommerce-filled-mini-cart-contents-block > .block-editor-inner-blocks > .block-editor-block-list__layout {
|
13 |
display: flex;
|
14 |
flex-direction: column;
|
assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { cart } from '@woocommerce/icons';
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
-
import {
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
@@ -63,4 +63,4 @@ const settings = {
|
|
63 |
save,
|
64 |
};
|
65 |
|
66 |
-
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { cart } from '@woocommerce/icons';
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
+
import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
63 |
save,
|
64 |
};
|
65 |
|
66 |
+
registerFeaturePluginBlockType( blockName, settings );
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts
CHANGED
@@ -19,6 +19,7 @@ const EXCLUDED_BLOCKS: readonly string[] = [
|
|
19 |
'core/post-comments-count',
|
20 |
'core/comments-pagination',
|
21 |
'core/post-navigation-link',
|
|
|
22 |
];
|
23 |
|
24 |
export const getMiniCartAllowedBlocks = (): string[] =>
|
19 |
'core/post-comments-count',
|
20 |
'core/comments-pagination',
|
21 |
'core/post-navigation-link',
|
22 |
+
'core/button',
|
23 |
];
|
24 |
|
25 |
export const getMiniCartAllowedBlocks = (): string[] =>
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx
CHANGED
@@ -10,10 +10,12 @@ import { useEffect, useRef } from 'react';
|
|
10 |
|
11 |
type EmptyMiniCartContentsBlockProps = {
|
12 |
children: JSX.Element | JSX.Element[];
|
|
|
13 |
};
|
14 |
|
15 |
const EmptyMiniCartContentsBlock = ( {
|
16 |
children,
|
|
|
17 |
}: EmptyMiniCartContentsBlockProps ): JSX.Element | null => {
|
18 |
const { cartItems, cartIsLoading } = useStoreCart();
|
19 |
|
@@ -30,11 +32,7 @@ const EmptyMiniCartContentsBlock = ( {
|
|
30 |
}
|
31 |
|
32 |
return (
|
33 |
-
<div
|
34 |
-
tabIndex={ -1 }
|
35 |
-
ref={ elementRef }
|
36 |
-
className="wp-block-woocommerce-empty-mini-cart-contents-block"
|
37 |
-
>
|
38 |
{ children }
|
39 |
</div>
|
40 |
);
|
10 |
|
11 |
type EmptyMiniCartContentsBlockProps = {
|
12 |
children: JSX.Element | JSX.Element[];
|
13 |
+
className: string;
|
14 |
};
|
15 |
|
16 |
const EmptyMiniCartContentsBlock = ( {
|
17 |
children,
|
18 |
+
className,
|
19 |
}: EmptyMiniCartContentsBlockProps ): JSX.Element | null => {
|
20 |
const { cartItems, cartIsLoading } = useStoreCart();
|
21 |
|
32 |
}
|
33 |
|
34 |
return (
|
35 |
+
<div tabIndex={ -1 } ref={ elementRef } className={ className }>
|
|
|
|
|
|
|
|
|
36 |
{ children }
|
37 |
</div>
|
38 |
);
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx
CHANGED
@@ -3,18 +3,22 @@
|
|
3 |
*/
|
4 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
const FilledMiniCartContentsBlock = ( {
|
7 |
children,
|
8 |
-
|
9 |
-
|
10 |
-
} ): JSX.Element | null => {
|
11 |
const { cartItems } = useStoreCart();
|
12 |
|
13 |
if ( cartItems.length === 0 ) {
|
14 |
return null;
|
15 |
}
|
16 |
|
17 |
-
return
|
18 |
};
|
19 |
|
20 |
export default FilledMiniCartContentsBlock;
|
3 |
*/
|
4 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
5 |
|
6 |
+
type FilledMiniCartContentsBlockProps = {
|
7 |
+
children: JSX.Element;
|
8 |
+
className: string;
|
9 |
+
};
|
10 |
+
|
11 |
const FilledMiniCartContentsBlock = ( {
|
12 |
children,
|
13 |
+
className,
|
14 |
+
}: FilledMiniCartContentsBlockProps ): JSX.Element | null => {
|
|
|
15 |
const { cartItems } = useStoreCart();
|
16 |
|
17 |
if ( cartItems.length === 0 ) {
|
18 |
return null;
|
19 |
}
|
20 |
|
21 |
+
return <div className={ className }>{ children }</div>;
|
22 |
};
|
23 |
|
24 |
export default FilledMiniCartContentsBlock;
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx
CHANGED
@@ -14,6 +14,7 @@ import { getSetting } from '@woocommerce/settings';
|
|
14 |
import { CART_URL, CHECKOUT_URL } from '@woocommerce/block-settings';
|
15 |
import Button from '@woocommerce/base-components/button';
|
16 |
import { PaymentMethodDataProvider } from '@woocommerce/base-context';
|
|
|
17 |
|
18 |
const PaymentMethodIconsElement = (): JSX.Element => {
|
19 |
const { paymentMethods } = usePaymentMethods();
|
@@ -27,16 +28,19 @@ const PaymentMethodIconsElement = (): JSX.Element => {
|
|
27 |
interface Props {
|
28 |
color?: string;
|
29 |
backgroundColor?: string;
|
|
|
30 |
}
|
31 |
|
32 |
-
const Block = ( { color, backgroundColor }: Props ): JSX.Element => {
|
33 |
const { cartTotals } = useStoreCart();
|
34 |
const subTotal = getSetting( 'displayCartPricesIncludingTax', false )
|
35 |
? parseInt( cartTotals.total_items, 10 ) +
|
36 |
parseInt( cartTotals.total_items_tax, 10 )
|
37 |
: parseInt( cartTotals.total_items, 10 );
|
38 |
return (
|
39 |
-
<div
|
|
|
|
|
40 |
<TotalsItem
|
41 |
className="wc-block-mini-cart__footer-subtotal"
|
42 |
currency={ getCurrencyFromPriceResponse( cartTotals ) }
|
@@ -54,7 +58,7 @@ const Block = ( { color, backgroundColor }: Props ): JSX.Element => {
|
|
54 |
href={ CART_URL }
|
55 |
style={ {
|
56 |
color,
|
57 |
-
|
58 |
} }
|
59 |
variant="outlined"
|
60 |
>
|
14 |
import { CART_URL, CHECKOUT_URL } from '@woocommerce/block-settings';
|
15 |
import Button from '@woocommerce/base-components/button';
|
16 |
import { PaymentMethodDataProvider } from '@woocommerce/base-context';
|
17 |
+
import classNames from 'classnames';
|
18 |
|
19 |
const PaymentMethodIconsElement = (): JSX.Element => {
|
20 |
const { paymentMethods } = usePaymentMethods();
|
28 |
interface Props {
|
29 |
color?: string;
|
30 |
backgroundColor?: string;
|
31 |
+
className: string;
|
32 |
}
|
33 |
|
34 |
+
const Block = ( { color, backgroundColor, className }: Props ): JSX.Element => {
|
35 |
const { cartTotals } = useStoreCart();
|
36 |
const subTotal = getSetting( 'displayCartPricesIncludingTax', false )
|
37 |
? parseInt( cartTotals.total_items, 10 ) +
|
38 |
parseInt( cartTotals.total_items_tax, 10 )
|
39 |
: parseInt( cartTotals.total_items, 10 );
|
40 |
return (
|
41 |
+
<div
|
42 |
+
className={ classNames( className, 'wc-block-mini-cart__footer' ) }
|
43 |
+
>
|
44 |
<TotalsItem
|
45 |
className="wc-block-mini-cart__footer-subtotal"
|
46 |
currency={ getCurrencyFromPriceResponse( cartTotals ) }
|
58 |
href={ CART_URL }
|
59 |
style={ {
|
60 |
color,
|
61 |
+
boxShadow: `inset 0 0 0 1px ${ color }`,
|
62 |
} }
|
63 |
variant="outlined"
|
64 |
>
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx
CHANGED
@@ -1,5 +1,22 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
};
|
4 |
|
5 |
export default Block;
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import classNames from 'classnames';
|
5 |
+
|
6 |
+
type MiniCartItemsBlockProps = {
|
7 |
+
children: JSX.Element;
|
8 |
+
className: string;
|
9 |
+
};
|
10 |
+
|
11 |
+
const Block = ( {
|
12 |
+
children,
|
13 |
+
className,
|
14 |
+
}: MiniCartItemsBlockProps ): JSX.Element => {
|
15 |
+
return (
|
16 |
+
<div className={ classNames( className, 'wc-block-mini-cart__items' ) }>
|
17 |
+
{ children }
|
18 |
+
</div>
|
19 |
+
);
|
20 |
};
|
21 |
|
22 |
export default Block;
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx
CHANGED
@@ -2,16 +2,26 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
9 |
import CartLineItemsTable from '../../../cart/cart-line-items-table';
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
const { cartItems, cartIsLoading } = useStoreCart();
|
13 |
return (
|
14 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
15 |
<CartLineItemsTable
|
16 |
lineItems={ cartItems }
|
17 |
isLoading={ cartIsLoading }
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
5 |
+
import classNames from 'classnames';
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
import CartLineItemsTable from '../../../cart/cart-line-items-table';
|
11 |
|
12 |
+
type MiniCartContentsBlockProps = {
|
13 |
+
className: string;
|
14 |
+
};
|
15 |
+
|
16 |
+
const Block = ( { className }: MiniCartContentsBlockProps ): JSX.Element => {
|
17 |
const { cartItems, cartIsLoading } = useStoreCart();
|
18 |
return (
|
19 |
+
<div
|
20 |
+
className={ classNames(
|
21 |
+
className,
|
22 |
+
'wc-block-mini-cart__products-table'
|
23 |
+
) }
|
24 |
+
>
|
25 |
<CartLineItemsTable
|
26 |
lineItems={ cartItems }
|
27 |
isLoading={ cartIsLoading }
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json
CHANGED
@@ -9,14 +9,14 @@
|
|
9 |
"html": false,
|
10 |
"multiple": false,
|
11 |
"reusable": false,
|
12 |
-
"inserter": true
|
13 |
},
|
14 |
"attributes": {
|
15 |
"lock": {
|
16 |
"type": "object",
|
17 |
"default": {
|
18 |
"remove": false,
|
19 |
-
"move": false
|
20 |
}
|
21 |
}
|
22 |
},
|
9 |
"html": false,
|
10 |
"multiple": false,
|
11 |
"reusable": false,
|
12 |
+
"inserter": true
|
13 |
},
|
14 |
"attributes": {
|
15 |
"lock": {
|
16 |
"type": "object",
|
17 |
"default": {
|
18 |
"remove": false,
|
19 |
+
"move": false
|
20 |
}
|
21 |
}
|
22 |
},
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx
CHANGED
@@ -3,18 +3,30 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { SHOP_URL } from '@woocommerce/block-settings';
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
if ( ! SHOP_URL ) {
|
13 |
return null;
|
14 |
}
|
15 |
|
16 |
return (
|
17 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
18 |
<a href={ SHOP_URL }>
|
19 |
{ __( 'Start shopping', 'woo-gutenberg-products-block' ) }
|
20 |
</a>
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { SHOP_URL } from '@woocommerce/block-settings';
|
6 |
+
import classNames from 'classnames';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
10 |
*/
|
11 |
|
12 |
+
type MiniCartShoppingButtonBlockProps = {
|
13 |
+
className: string;
|
14 |
+
};
|
15 |
+
|
16 |
+
const Block = ( {
|
17 |
+
className,
|
18 |
+
}: MiniCartShoppingButtonBlockProps ): JSX.Element | null => {
|
19 |
if ( ! SHOP_URL ) {
|
20 |
return null;
|
21 |
}
|
22 |
|
23 |
return (
|
24 |
+
<div
|
25 |
+
className={ classNames(
|
26 |
+
className,
|
27 |
+
'wc-block-mini-cart__shopping-button'
|
28 |
+
) }
|
29 |
+
>
|
30 |
<a href={ SHOP_URL }>
|
31 |
{ __( 'Start shopping', 'woo-gutenberg-products-block' ) }
|
32 |
</a>
|
assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx
CHANGED
@@ -3,15 +3,20 @@
|
|
3 |
*/
|
4 |
import { sprintf, _n, __ } from '@wordpress/i18n';
|
5 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
9 |
*/
|
10 |
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
const { cartItemsCount, cartIsLoading } = useStoreCart();
|
13 |
return (
|
14 |
-
<h2 className=
|
15 |
{ cartIsLoading
|
16 |
? __( 'Your cart', 'woo-gutenberg-products-block' )
|
17 |
: sprintf(
|
3 |
*/
|
4 |
import { sprintf, _n, __ } from '@wordpress/i18n';
|
5 |
import { useStoreCart } from '@woocommerce/base-context/hooks';
|
6 |
+
import classNames from 'classnames';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
10 |
*/
|
11 |
|
12 |
+
type MiniCartTitleBlockProps = {
|
13 |
+
className: string;
|
14 |
+
};
|
15 |
+
|
16 |
+
const Block = ( { className }: MiniCartTitleBlockProps ): JSX.Element => {
|
17 |
const { cartItemsCount, cartIsLoading } = useStoreCart();
|
18 |
return (
|
19 |
+
<h2 className={ classNames( className, 'wc-block-mini-cart__title' ) }>
|
20 |
{ cartIsLoading
|
21 |
? __( 'Your cart', 'woo-gutenberg-products-block' )
|
22 |
: sprintf(
|
assets/js/blocks/cart-checkout/mini-cart/block.tsx
CHANGED
@@ -37,10 +37,10 @@ import { blockName } from '../mini-cart-contents/attributes';
|
|
37 |
|
38 |
interface Props {
|
39 |
isInitiallyOpen?: boolean;
|
40 |
-
transparentButton: boolean;
|
41 |
colorClassNames?: string;
|
42 |
style?: Record< string, Record< string, string > >;
|
43 |
contents: string;
|
|
|
44 |
}
|
45 |
|
46 |
const MiniCartBlock = ( {
|
@@ -48,6 +48,7 @@ const MiniCartBlock = ( {
|
|
48 |
colorClassNames,
|
49 |
style,
|
50 |
contents = '',
|
|
|
51 |
}: Props ): JSX.Element => {
|
52 |
const {
|
53 |
cartItemsCount: cartItemsCountFromApi,
|
@@ -109,8 +110,10 @@ const MiniCartBlock = ( {
|
|
109 |
|
110 |
useEffect( () => {
|
111 |
const openMiniCart = () => {
|
112 |
-
|
113 |
-
|
|
|
|
|
114 |
};
|
115 |
|
116 |
// Make it so we can read jQuery events triggered by WC Core elements.
|
@@ -132,7 +135,7 @@ const MiniCartBlock = ( {
|
|
132 |
openMiniCart
|
133 |
);
|
134 |
};
|
135 |
-
}, [] );
|
136 |
|
137 |
const showIncludingTax = getSettingWithCoercion(
|
138 |
'displayCartPricesIncludingTax',
|
@@ -209,11 +212,7 @@ const MiniCartBlock = ( {
|
|
209 |
{ taxLabel }
|
210 |
</small>
|
211 |
) }
|
212 |
-
<QuantityBadge
|
213 |
-
count={ cartItemsCount }
|
214 |
-
colorClassNames={ colorClassNames }
|
215 |
-
style={ colorStyle }
|
216 |
-
/>
|
217 |
</button>
|
218 |
<Drawer
|
219 |
className={ classnames(
|
37 |
|
38 |
interface Props {
|
39 |
isInitiallyOpen?: boolean;
|
|
|
40 |
colorClassNames?: string;
|
41 |
style?: Record< string, Record< string, string > >;
|
42 |
contents: string;
|
43 |
+
addToCartBehaviour: string;
|
44 |
}
|
45 |
|
46 |
const MiniCartBlock = ( {
|
48 |
colorClassNames,
|
49 |
style,
|
50 |
contents = '',
|
51 |
+
addToCartBehaviour = 'none',
|
52 |
}: Props ): JSX.Element => {
|
53 |
const {
|
54 |
cartItemsCount: cartItemsCountFromApi,
|
110 |
|
111 |
useEffect( () => {
|
112 |
const openMiniCart = () => {
|
113 |
+
if ( addToCartBehaviour === 'open_drawer' ) {
|
114 |
+
setSkipSlideIn( false );
|
115 |
+
setIsOpen( true );
|
116 |
+
}
|
117 |
};
|
118 |
|
119 |
// Make it so we can read jQuery events triggered by WC Core elements.
|
135 |
openMiniCart
|
136 |
);
|
137 |
};
|
138 |
+
}, [ addToCartBehaviour ] );
|
139 |
|
140 |
const showIncludingTax = getSettingWithCoercion(
|
141 |
'displayCartPricesIncludingTax',
|
212 |
{ taxLabel }
|
213 |
</small>
|
214 |
) }
|
215 |
+
<QuantityBadge count={ cartItemsCount } />
|
|
|
|
|
|
|
|
|
216 |
</button>
|
217 |
<Drawer
|
218 |
className={ classnames(
|
assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx
CHANGED
@@ -41,10 +41,10 @@ const renderMiniCartFrontend = () => {
|
|
41 |
isInitiallyOpen: el.dataset.isInitiallyOpen === 'true',
|
42 |
colorClassNames,
|
43 |
style: el.dataset.style ? JSON.parse( el.dataset.style ) : {},
|
|
|
44 |
contents:
|
45 |
el.querySelector( '.wc-block-mini-cart__template-part' )
|
46 |
?.innerHTML ?? '',
|
47 |
-
transparentButton: false,
|
48 |
};
|
49 |
},
|
50 |
} );
|
41 |
isInitiallyOpen: el.dataset.isInitiallyOpen === 'true',
|
42 |
colorClassNames,
|
43 |
style: el.dataset.style ? JSON.parse( el.dataset.style ) : {},
|
44 |
+
addToCartBehaviour: el.dataset.addToCartBehaviour || 'none',
|
45 |
contents:
|
46 |
el.querySelector( '.wc-block-mini-cart__template-part' )
|
47 |
?.innerHTML ?? '',
|
|
|
48 |
};
|
49 |
},
|
50 |
} );
|
assets/js/blocks/cart-checkout/mini-cart/edit.tsx
CHANGED
@@ -1,21 +1,13 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
5 |
-
AlignmentControl,
|
6 |
-
BlockControls,
|
7 |
-
InspectorControls,
|
8 |
-
useBlockProps,
|
9 |
-
getColorClassName,
|
10 |
-
} from '@wordpress/block-editor';
|
11 |
import type { ReactElement } from 'react';
|
12 |
import { formatPrice } from '@woocommerce/price-format';
|
13 |
import { CartCheckoutCompatibilityNotice } from '@woocommerce/editor-components/compatibility-notices';
|
14 |
-
import { PanelBody, ExternalLink,
|
15 |
import { getSetting } from '@woocommerce/settings';
|
16 |
import { __ } from '@wordpress/i18n';
|
17 |
-
import { positionCenter, positionRight, positionLeft } from '@wordpress/icons';
|
18 |
-
import classnames from 'classnames';
|
19 |
import Noninteractive from '@woocommerce/base-components/noninteractive';
|
20 |
|
21 |
/**
|
@@ -24,12 +16,7 @@ import Noninteractive from '@woocommerce/base-components/noninteractive';
|
|
24 |
import QuantityBadge from './quantity-badge';
|
25 |
|
26 |
interface Attributes {
|
27 |
-
|
28 |
-
isInitiallyOpen?: boolean;
|
29 |
-
transparentButton: boolean;
|
30 |
-
backgroundColor?: string;
|
31 |
-
textColor?: string;
|
32 |
-
style?: Record< string, Record< string, string > >;
|
33 |
}
|
34 |
|
35 |
interface Props {
|
@@ -41,17 +28,9 @@ const MiniCartBlock = ( {
|
|
41 |
attributes,
|
42 |
setAttributes,
|
43 |
}: Props ): ReactElement => {
|
44 |
-
const {
|
45 |
-
transparentButton,
|
46 |
-
backgroundColor,
|
47 |
-
textColor,
|
48 |
-
style,
|
49 |
-
align,
|
50 |
-
} = attributes;
|
51 |
const blockProps = useBlockProps( {
|
52 |
-
className:
|
53 |
-
'is-transparent': transparentButton,
|
54 |
-
} ),
|
55 |
} );
|
56 |
|
57 |
const templatePartEditUri = getSetting(
|
@@ -59,95 +38,65 @@ const MiniCartBlock = ( {
|
|
59 |
''
|
60 |
) as string;
|
61 |
|
62 |
-
/**
|
63 |
-
* @todo Replace `getColorClassName` and manual style manipulation with
|
64 |
-
* `useColorProps` once the hook is no longer experimental.
|
65 |
-
*/
|
66 |
-
const backgroundClass = getColorClassName(
|
67 |
-
'background-color',
|
68 |
-
backgroundColor
|
69 |
-
);
|
70 |
-
const textColorClass = getColorClassName( 'color', textColor );
|
71 |
-
|
72 |
-
const colorStyle = {
|
73 |
-
backgroundColor: style?.color?.background,
|
74 |
-
color: style?.color?.text,
|
75 |
-
};
|
76 |
-
|
77 |
-
const colorClassNames = classnames( backgroundClass, textColorClass, {
|
78 |
-
'has-background': backgroundClass || style?.color?.background,
|
79 |
-
'has-text-color': textColorClass || style?.color?.text,
|
80 |
-
} );
|
81 |
-
|
82 |
const productCount = 0;
|
83 |
const productTotal = 0;
|
84 |
|
85 |
return (
|
86 |
<div { ...blockProps }>
|
87 |
-
<BlockControls>
|
88 |
-
<AlignmentControl
|
89 |
-
value={ align }
|
90 |
-
alignmentControls={ [
|
91 |
-
{
|
92 |
-
icon: positionLeft,
|
93 |
-
title: __(
|
94 |
-
'Align button left',
|
95 |
-
'woo-gutenberg-products-block'
|
96 |
-
),
|
97 |
-
align: 'left',
|
98 |
-
},
|
99 |
-
{
|
100 |
-
icon: positionCenter,
|
101 |
-
title: __(
|
102 |
-
'Align button center',
|
103 |
-
'woo-gutenberg-products-block'
|
104 |
-
),
|
105 |
-
align: 'center',
|
106 |
-
},
|
107 |
-
{
|
108 |
-
icon: positionRight,
|
109 |
-
title: __(
|
110 |
-
'Align button right',
|
111 |
-
'woo-gutenberg-products-block'
|
112 |
-
),
|
113 |
-
align: 'right',
|
114 |
-
},
|
115 |
-
] }
|
116 |
-
onChange={ ( newAlign: string ) =>
|
117 |
-
setAttributes( { align: newAlign } )
|
118 |
-
}
|
119 |
-
/>
|
120 |
-
</BlockControls>
|
121 |
<InspectorControls>
|
122 |
<PanelBody
|
123 |
title={ __(
|
124 |
-
'
|
125 |
'woo-gutenberg-products-block'
|
126 |
) }
|
127 |
>
|
128 |
-
<
|
129 |
label={ __(
|
130 |
-
'
|
131 |
'woo-gutenberg-products-block'
|
132 |
) }
|
133 |
-
|
134 |
-
onChange={ () =>
|
135 |
-
setAttributes( {
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
/>
|
140 |
</PanelBody>
|
141 |
{ templatePartEditUri && (
|
142 |
<PanelBody
|
143 |
title={ __(
|
144 |
-
'Template
|
145 |
'woo-gutenberg-products-block'
|
146 |
) }
|
147 |
>
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
<ExternalLink href={ templatePartEditUri }>
|
149 |
{ __(
|
150 |
-
'Edit template part',
|
151 |
'woo-gutenberg-products-block'
|
152 |
) }
|
153 |
</ExternalLink>
|
@@ -155,21 +104,11 @@ const MiniCartBlock = ( {
|
|
155 |
) }
|
156 |
</InspectorControls>
|
157 |
<Noninteractive>
|
158 |
-
<button
|
159 |
-
className={ classnames(
|
160 |
-
'wc-block-mini-cart__button',
|
161 |
-
colorClassNames
|
162 |
-
) }
|
163 |
-
style={ colorStyle }
|
164 |
-
>
|
165 |
<span className="wc-block-mini-cart__amount">
|
166 |
{ formatPrice( productTotal ) }
|
167 |
</span>
|
168 |
-
<QuantityBadge
|
169 |
-
count={ productCount }
|
170 |
-
colorClassNames={ colorClassNames }
|
171 |
-
style={ colorStyle }
|
172 |
-
/>
|
173 |
</button>
|
174 |
</Noninteractive>
|
175 |
<CartCheckoutCompatibilityNotice blockName="mini-cart" />
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import type { ReactElement } from 'react';
|
6 |
import { formatPrice } from '@woocommerce/price-format';
|
7 |
import { CartCheckoutCompatibilityNotice } from '@woocommerce/editor-components/compatibility-notices';
|
8 |
+
import { PanelBody, ExternalLink, SelectControl } from '@wordpress/components';
|
9 |
import { getSetting } from '@woocommerce/settings';
|
10 |
import { __ } from '@wordpress/i18n';
|
|
|
|
|
11 |
import Noninteractive from '@woocommerce/base-components/noninteractive';
|
12 |
|
13 |
/**
|
16 |
import QuantityBadge from './quantity-badge';
|
17 |
|
18 |
interface Attributes {
|
19 |
+
addToCartBehaviour: string;
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
interface Props {
|
28 |
attributes,
|
29 |
setAttributes,
|
30 |
}: Props ): ReactElement => {
|
31 |
+
const { addToCartBehaviour } = attributes;
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
const blockProps = useBlockProps( {
|
33 |
+
className: `wc-block-mini-cart`,
|
|
|
|
|
34 |
} );
|
35 |
|
36 |
const templatePartEditUri = getSetting(
|
38 |
''
|
39 |
) as string;
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
const productCount = 0;
|
42 |
const productTotal = 0;
|
43 |
|
44 |
return (
|
45 |
<div { ...blockProps }>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
<InspectorControls>
|
47 |
<PanelBody
|
48 |
title={ __(
|
49 |
+
'Mini Cart Settings',
|
50 |
'woo-gutenberg-products-block'
|
51 |
) }
|
52 |
>
|
53 |
+
<SelectControl
|
54 |
label={ __(
|
55 |
+
'Add-to-Cart behaviour',
|
56 |
'woo-gutenberg-products-block'
|
57 |
) }
|
58 |
+
value={ addToCartBehaviour }
|
59 |
+
onChange={ ( value ) => {
|
60 |
+
setAttributes( { addToCartBehaviour: value } );
|
61 |
+
} }
|
62 |
+
help={ __(
|
63 |
+
'Select what happens when a customer adds a product to the cart.',
|
64 |
+
'woo-gutenberg-products-block'
|
65 |
+
) }
|
66 |
+
options={ [
|
67 |
+
{
|
68 |
+
value: 'none',
|
69 |
+
label: __(
|
70 |
+
'Do nothing',
|
71 |
+
'woo-gutenberg-products-block'
|
72 |
+
),
|
73 |
+
},
|
74 |
+
{
|
75 |
+
value: 'open_drawer',
|
76 |
+
label: __(
|
77 |
+
'Open cart drawer',
|
78 |
+
'woo-gutenberg-products-block'
|
79 |
+
),
|
80 |
+
},
|
81 |
+
] }
|
82 |
/>
|
83 |
</PanelBody>
|
84 |
{ templatePartEditUri && (
|
85 |
<PanelBody
|
86 |
title={ __(
|
87 |
+
'Template settings',
|
88 |
'woo-gutenberg-products-block'
|
89 |
) }
|
90 |
>
|
91 |
+
<p>
|
92 |
+
{ __(
|
93 |
+
'Edit the appearance of your empty and filled mini cart contents.',
|
94 |
+
'woo-gutenberg-products-block'
|
95 |
+
) }
|
96 |
+
</p>
|
97 |
<ExternalLink href={ templatePartEditUri }>
|
98 |
{ __(
|
99 |
+
'Edit Mini Cart template part',
|
100 |
'woo-gutenberg-products-block'
|
101 |
) }
|
102 |
</ExternalLink>
|
104 |
) }
|
105 |
</InspectorControls>
|
106 |
<Noninteractive>
|
107 |
+
<button className="wc-block-mini-cart__button">
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
<span className="wc-block-mini-cart__amount">
|
109 |
{ formatPrice( productTotal ) }
|
110 |
</span>
|
111 |
+
<QuantityBadge count={ productCount } />
|
|
|
|
|
|
|
|
|
112 |
</button>
|
113 |
</Noninteractive>
|
114 |
<CartCheckoutCompatibilityNotice blockName="mini-cart" />
|
assets/js/blocks/cart-checkout/mini-cart/index.tsx
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { cart } from '@woocommerce/icons';
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
-
import {
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
@@ -31,20 +31,7 @@ const settings = {
|
|
31 |
supports: {
|
32 |
html: false,
|
33 |
multiple: false,
|
34 |
-
color:
|
35 |
-
/**
|
36 |
-
* Because we don't target the wrapper element, we don't need
|
37 |
-
* to add color classes and style to the wrapper.
|
38 |
-
*/
|
39 |
-
__experimentalSkipSerialization: true,
|
40 |
-
background: true,
|
41 |
-
},
|
42 |
-
/**
|
43 |
-
* We need this experimental flag because we don't want to style the
|
44 |
-
* wrapper but inner elements.
|
45 |
-
*/
|
46 |
-
__experimentalSelector:
|
47 |
-
'.wc-block-mini-cart__button, .wc-block-mini-cart__badge',
|
48 |
},
|
49 |
example: {
|
50 |
attributes: {
|
@@ -52,18 +39,14 @@ const settings = {
|
|
52 |
},
|
53 |
},
|
54 |
attributes: {
|
55 |
-
align: {
|
56 |
-
type: 'string',
|
57 |
-
default: 'right',
|
58 |
-
},
|
59 |
isPreview: {
|
60 |
type: 'boolean',
|
61 |
default: false,
|
62 |
save: false,
|
63 |
},
|
64 |
-
|
65 |
-
type: '
|
66 |
-
default:
|
67 |
},
|
68 |
},
|
69 |
|
@@ -74,4 +57,4 @@ const settings = {
|
|
74 |
},
|
75 |
};
|
76 |
|
77 |
-
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { cart } from '@woocommerce/icons';
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
+
import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
31 |
supports: {
|
32 |
html: false,
|
33 |
multiple: false,
|
34 |
+
color: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
},
|
36 |
example: {
|
37 |
attributes: {
|
39 |
},
|
40 |
},
|
41 |
attributes: {
|
|
|
|
|
|
|
|
|
42 |
isPreview: {
|
43 |
type: 'boolean',
|
44 |
default: false,
|
45 |
save: false,
|
46 |
},
|
47 |
+
addToCartBehaviour: {
|
48 |
+
type: 'string',
|
49 |
+
default: 'none',
|
50 |
},
|
51 |
},
|
52 |
|
57 |
},
|
58 |
};
|
59 |
|
60 |
+
registerFeaturePluginBlockType( 'woocommerce/mini-cart', settings );
|
assets/js/blocks/cart-checkout/mini-cart/quantity-badge/style.scss
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
|
6 |
.wc-block-mini-cart__badge {
|
7 |
align-items: center;
|
8 |
-
background:
|
9 |
border: 0.15em solid;
|
10 |
border-radius: 1em;
|
11 |
box-sizing: border-box;
|
@@ -27,5 +27,4 @@
|
|
27 |
display: block;
|
28 |
height: em(24px);
|
29 |
width: em(24px);
|
30 |
-
stroke: currentColor;
|
31 |
}
|
5 |
|
6 |
.wc-block-mini-cart__badge {
|
7 |
align-items: center;
|
8 |
+
background: transparent;
|
9 |
border: 0.15em solid;
|
10 |
border-radius: 1em;
|
11 |
box-sizing: border-box;
|
27 |
display: block;
|
28 |
height: em(24px);
|
29 |
width: em(24px);
|
|
|
30 |
}
|
assets/js/blocks/cart-checkout/mini-cart/style.scss
CHANGED
@@ -1,23 +1,10 @@
|
|
1 |
.wc-block-mini-cart {
|
2 |
-
|
3 |
-
display: flex;
|
4 |
-
justify-content: flex-end;
|
5 |
-
|
6 |
-
&.align-center {
|
7 |
-
justify-content: center;
|
8 |
-
}
|
9 |
-
|
10 |
-
&.align-left {
|
11 |
-
justify-content: flex-start;
|
12 |
-
}
|
13 |
-
|
14 |
-
&.is-transparent .wc-block-mini-cart__button {
|
15 |
-
background-color: transparent !important;
|
16 |
-
}
|
17 |
}
|
18 |
|
19 |
.wc-block-mini-cart__button {
|
20 |
align-items: center;
|
|
|
21 |
border: none;
|
22 |
color: inherit;
|
23 |
display: flex;
|
@@ -77,13 +64,26 @@
|
|
77 |
.wp-block-woocommerce-mini-cart-contents {
|
78 |
background: #fff;
|
79 |
box-sizing: border-box;
|
80 |
-
display: flex;
|
81 |
-
flex-direction: column;
|
82 |
height: 100vh;
|
83 |
padding: 0;
|
84 |
justify-content: center;
|
85 |
}
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
.wp-block-woocommerce-empty-mini-cart-contents-block {
|
88 |
overflow-y: auto;
|
89 |
padding: $gap-largest $gap $gap;
|
1 |
.wc-block-mini-cart {
|
2 |
+
display: inline-block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
}
|
4 |
|
5 |
.wc-block-mini-cart__button {
|
6 |
align-items: center;
|
7 |
+
background-color: transparent;
|
8 |
border: none;
|
9 |
color: inherit;
|
10 |
display: flex;
|
64 |
.wp-block-woocommerce-mini-cart-contents {
|
65 |
background: #fff;
|
66 |
box-sizing: border-box;
|
|
|
|
|
67 |
height: 100vh;
|
68 |
padding: 0;
|
69 |
justify-content: center;
|
70 |
}
|
71 |
|
72 |
+
.wp-block-woocommerce-empty-mini-cart-contents-block,
|
73 |
+
.wp-block-woocommerce-filled-mini-cart-contents-block {
|
74 |
+
height: 100%;
|
75 |
+
display: flex;
|
76 |
+
flex-direction: column;
|
77 |
+
}
|
78 |
+
|
79 |
+
.wp-block-woocommerce-empty-mini-cart-contents-block {
|
80 |
+
justify-content: center;
|
81 |
+
}
|
82 |
+
|
83 |
+
.wp-block-woocommerce-filled-mini-cart-contents-block {
|
84 |
+
justify-content: space-between;
|
85 |
+
}
|
86 |
+
|
87 |
.wp-block-woocommerce-empty-mini-cart-contents-block {
|
88 |
overflow-y: auto;
|
89 |
padding: $gap-largest $gap $gap;
|
assets/js/blocks/cart-checkout/mini-cart/test/block.js
CHANGED
@@ -72,8 +72,6 @@ describe( 'Testing Mini Cart', () => {
|
|
72 |
} );
|
73 |
|
74 |
expect( fetchMock ).toHaveBeenCalledTimes( 1 );
|
75 |
-
// ["`select` control in `@wordpress/data-controls` is deprecated. Please use built-in `resolveSelect` control in `@wordpress/data` instead."]
|
76 |
-
expect( console ).toHaveWarned();
|
77 |
} );
|
78 |
|
79 |
it( 'renders empty cart if there are no items in the cart', async () => {
|
72 |
} );
|
73 |
|
74 |
expect( fetchMock ).toHaveBeenCalledTimes( 1 );
|
|
|
|
|
75 |
} );
|
76 |
|
77 |
it( 'renders empty cart if there are no items in the cart', async () => {
|
assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js
CHANGED
@@ -99,8 +99,6 @@ describe( 'PaymentMethods', () => {
|
|
99 |
// creates an extra `div` with the notice contents used for a11y.
|
100 |
expect( noPaymentMethods.length ).toBeGreaterThanOrEqual( 1 );
|
101 |
} );
|
102 |
-
// ["`select` control in `@wordpress/data-controls` is deprecated. Please use built-in `resolveSelect` control in `@wordpress/data` instead."]
|
103 |
-
expect( console ).toHaveWarned();
|
104 |
} );
|
105 |
|
106 |
test( 'selecting new payment method', async () => {
|
99 |
// creates an extra `div` with the notice contents used for a11y.
|
100 |
expect( noPaymentMethods.length ).toBeGreaterThanOrEqual( 1 );
|
101 |
} );
|
|
|
|
|
102 |
} );
|
103 |
|
104 |
test( 'selecting new payment method', async () => {
|
assets/js/blocks/checkout/order-notes/index.js
CHANGED
@@ -4,8 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { useState } from '@wordpress/element';
|
6 |
import { CheckboxControl } from '@woocommerce/blocks-checkout';
|
7 |
-
import Textarea from '@woocommerce/base-components/textarea';
|
8 |
-
import PropTypes from 'prop-types';
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
@@ -58,11 +57,4 @@ const CheckoutOrderNotes = ( { disabled, onChange, placeholder, value } ) => {
|
|
58 |
);
|
59 |
};
|
60 |
|
61 |
-
Textarea.propTypes = {
|
62 |
-
onTextChange: PropTypes.func.isRequired,
|
63 |
-
disabled: PropTypes.bool,
|
64 |
-
placeholder: PropTypes.string,
|
65 |
-
value: PropTypes.string,
|
66 |
-
};
|
67 |
-
|
68 |
export default CheckoutOrderNotes;
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { useState } from '@wordpress/element';
|
6 |
import { CheckboxControl } from '@woocommerce/blocks-checkout';
|
7 |
+
import { Textarea } from '@woocommerce/base-components/textarea';
|
|
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
57 |
);
|
58 |
};
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
export default CheckoutOrderNotes;
|
assets/js/blocks/{legacy-template → classic-template}/assets/doc-image-single-product-classic-block.png
RENAMED
File without changes
|
assets/js/blocks/{legacy-template → classic-template}/constants.ts
RENAMED
File without changes
|
assets/js/blocks/{legacy-template → classic-template}/editor.scss
RENAMED
@@ -1,14 +1,14 @@
|
|
1 |
-
.wp-block-woocommerce-
|
2 |
max-width: 900px;
|
3 |
margin-bottom: 30px;
|
4 |
}
|
5 |
|
6 |
-
.wp-block-woocommerce-
|
7 |
border-left: 5px solid #2181d2;
|
8 |
padding-left: em(40px);
|
9 |
}
|
10 |
|
11 |
-
.wp-block-woocommerce-
|
12 |
width: 100%;
|
13 |
height: 250px;
|
14 |
background: #e5e5e5;
|
@@ -19,7 +19,7 @@
|
|
19 |
}
|
20 |
}
|
21 |
|
22 |
-
.wp-block-woocommerce-
|
23 |
display: none;
|
24 |
width: 100%;
|
25 |
height: auto;
|
1 |
+
.wp-block-woocommerce-classic-template__placeholder-copy {
|
2 |
max-width: 900px;
|
3 |
margin-bottom: 30px;
|
4 |
}
|
5 |
|
6 |
+
.wp-block-woocommerce-classic-template__placeholder-warning {
|
7 |
border-left: 5px solid #2181d2;
|
8 |
padding-left: em(40px);
|
9 |
}
|
10 |
|
11 |
+
.wp-block-woocommerce-classic-template__placeholder-wireframe {
|
12 |
width: 100%;
|
13 |
height: 250px;
|
14 |
background: #e5e5e5;
|
19 |
}
|
20 |
}
|
21 |
|
22 |
+
.wp-block-woocommerce-classic-template__placeholder .wp-block-woocommerce-classic-template__placeholder-image {
|
23 |
display: none;
|
24 |
width: 100%;
|
25 |
height: auto;
|
assets/js/blocks/{legacy-template → classic-template}/index.tsx
RENAMED
@@ -31,10 +31,10 @@ const Edit = ( { attributes }: Props ) => {
|
|
31 |
<Placeholder
|
32 |
icon={ box }
|
33 |
label={ templateTitle }
|
34 |
-
className="wp-block-woocommerce-
|
35 |
>
|
36 |
-
<div className="wp-block-woocommerce-
|
37 |
-
<p className="wp-block-woocommerce-
|
38 |
<strong>
|
39 |
{ __(
|
40 |
'Attention: Do not remove this block!',
|
@@ -57,9 +57,9 @@ const Edit = ( { attributes }: Props ) => {
|
|
57 |
) }
|
58 |
</p>
|
59 |
</div>
|
60 |
-
<div className="wp-block-woocommerce-
|
61 |
<img
|
62 |
-
className="wp-block-woocommerce-
|
63 |
src={ `${ WC_BLOCKS_IMAGE_URL }template-placeholders/${ templatePlaceholder }.svg` }
|
64 |
alt={ templateTitle }
|
65 |
/>
|
@@ -69,8 +69,16 @@ const Edit = ( { attributes }: Props ) => {
|
|
69 |
);
|
70 |
};
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
registerBlockType( 'woocommerce/legacy-template', {
|
73 |
-
title: __( 'WooCommerce
|
74 |
icon: (
|
75 |
<Icon icon={ box } className="wc-block-editor-components-block-icon" />
|
76 |
),
|
@@ -78,7 +86,7 @@ registerBlockType( 'woocommerce/legacy-template', {
|
|
78 |
apiVersion: 2,
|
79 |
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
80 |
description: __(
|
81 |
-
'Renders
|
82 |
'woo-gutenberg-products-block'
|
83 |
),
|
84 |
supports: {
|
31 |
<Placeholder
|
32 |
icon={ box }
|
33 |
label={ templateTitle }
|
34 |
+
className="wp-block-woocommerce-classic-template__placeholder"
|
35 |
>
|
36 |
+
<div className="wp-block-woocommerce-classic-template__placeholder-copy">
|
37 |
+
<p className="wp-block-woocommerce-classic-template__placeholder-warning">
|
38 |
<strong>
|
39 |
{ __(
|
40 |
'Attention: Do not remove this block!',
|
57 |
) }
|
58 |
</p>
|
59 |
</div>
|
60 |
+
<div className="wp-block-woocommerce-classic-template__placeholder-wireframe">
|
61 |
<img
|
62 |
+
className="wp-block-woocommerce-classic-template__placeholder-image"
|
63 |
src={ `${ WC_BLOCKS_IMAGE_URL }template-placeholders/${ templatePlaceholder }.svg` }
|
64 |
alt={ templateTitle }
|
65 |
/>
|
69 |
);
|
70 |
};
|
71 |
|
72 |
+
/**
|
73 |
+
* The 'WooCommerce Legacy Template' block was renamed to 'WooCommerce Classic Template', however, the internal block
|
74 |
+
* name 'woocommerce/legacy-template' needs to remain the same. Otherwise, it would result in a corrupt block when
|
75 |
+
* loaded for users who have customized templates using the legacy-template (since the internal block name is
|
76 |
+
* stored in the database).
|
77 |
+
*
|
78 |
+
* See https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5861 for more context
|
79 |
+
*/
|
80 |
registerBlockType( 'woocommerce/legacy-template', {
|
81 |
+
title: __( 'WooCommerce Classic Template', 'woo-gutenberg-products-block' ),
|
82 |
icon: (
|
83 |
<Icon icon={ box } className="wc-block-editor-components-block-icon" />
|
84 |
),
|
86 |
apiVersion: 2,
|
87 |
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
88 |
description: __(
|
89 |
+
'Renders classic WooCommerce PHP templates.',
|
90 |
'woo-gutenberg-products-block'
|
91 |
),
|
92 |
supports: {
|
assets/js/blocks/featured-category/index.js
CHANGED
@@ -107,20 +107,6 @@ registerBlockType( 'woocommerce/featured-category', {
|
|
107 |
default: '',
|
108 |
},
|
109 |
|
110 |
-
/**
|
111 |
-
* The overlay color, from the color list.
|
112 |
-
*/
|
113 |
-
overlayColor: {
|
114 |
-
type: 'string',
|
115 |
-
},
|
116 |
-
|
117 |
-
/**
|
118 |
-
* The overlay color, if a custom color value.
|
119 |
-
*/
|
120 |
-
customOverlayColor: {
|
121 |
-
type: 'string',
|
122 |
-
},
|
123 |
-
|
124 |
/**
|
125 |
* Text for the category link.
|
126 |
*/
|
107 |
default: '',
|
108 |
},
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
/**
|
111 |
* Text for the category link.
|
112 |
*/
|
assets/js/blocks/featured-category/style.scss
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
border-color: transparent;
|
4 |
color: #fff;
|
5 |
overflow: hidden;
|
|
|
6 |
}
|
7 |
|
8 |
.wc-block-featured-category {
|
3 |
border-color: transparent;
|
4 |
color: #fff;
|
5 |
overflow: hidden;
|
6 |
+
box-sizing: border-box;
|
7 |
}
|
8 |
|
9 |
.wc-block-featured-category {
|
assets/js/blocks/featured-product/index.js
CHANGED
@@ -105,20 +105,6 @@ registerBlockType( 'woocommerce/featured-product', {
|
|
105 |
default: '',
|
106 |
},
|
107 |
|
108 |
-
/**
|
109 |
-
* The overlay color, from the color list.
|
110 |
-
*/
|
111 |
-
overlayColor: {
|
112 |
-
type: 'string',
|
113 |
-
},
|
114 |
-
|
115 |
-
/**
|
116 |
-
* The overlay color, if a custom color value.
|
117 |
-
*/
|
118 |
-
customOverlayColor: {
|
119 |
-
type: 'string',
|
120 |
-
},
|
121 |
-
|
122 |
/**
|
123 |
* Text for the product link.
|
124 |
*/
|
105 |
default: '',
|
106 |
},
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Text for the product link.
|
110 |
*/
|
assets/js/blocks/featured-product/style.scss
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
border-color: transparent;
|
4 |
color: #fff;
|
5 |
overflow: hidden;
|
|
|
6 |
}
|
7 |
|
8 |
.wc-block-featured-product {
|
3 |
border-color: transparent;
|
4 |
color: #fff;
|
5 |
overflow: hidden;
|
6 |
+
box-sizing: border-box;
|
7 |
}
|
8 |
|
9 |
.wc-block-featured-product {
|
assets/js/data/cart/actions.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import { select } from '@wordpress/data-controls';
|
5 |
import type {
|
6 |
Cart,
|
7 |
CartResponse,
|
@@ -12,6 +11,7 @@ import type {
|
|
12 |
import { camelCase, mapKeys } from 'lodash';
|
13 |
import type { AddToCartEventDetail } from '@woocommerce/type-defs/events';
|
14 |
import { BillingAddress, ShippingAddress } from '@woocommerce/settings';
|
|
|
15 |
|
16 |
/**
|
17 |
* Internal dependencies
|
@@ -416,7 +416,11 @@ export function* changeCartItemQuantity(
|
|
416 |
quantity: number
|
417 |
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- unclear how to represent multiple different yields as type
|
418 |
): Generator< unknown, void, any > {
|
419 |
-
const cartItem = yield
|
|
|
|
|
|
|
|
|
420 |
if ( cartItem?.quantity === quantity ) {
|
421 |
return;
|
422 |
}
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import type {
|
5 |
Cart,
|
6 |
CartResponse,
|
11 |
import { camelCase, mapKeys } from 'lodash';
|
12 |
import type { AddToCartEventDetail } from '@woocommerce/type-defs/events';
|
13 |
import { BillingAddress, ShippingAddress } from '@woocommerce/settings';
|
14 |
+
import { controls } from '@wordpress/data';
|
15 |
|
16 |
/**
|
17 |
* Internal dependencies
|
416 |
quantity: number
|
417 |
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- unclear how to represent multiple different yields as type
|
418 |
): Generator< unknown, void, any > {
|
419 |
+
const cartItem = yield controls.resolveSelect(
|
420 |
+
CART_STORE_KEY,
|
421 |
+
'getCartItem',
|
422 |
+
cartItemKey
|
423 |
+
);
|
424 |
if ( cartItem?.quantity === quantity ) {
|
425 |
return;
|
426 |
}
|
assets/js/data/cart/resolvers.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
|
|
5 |
import { CartResponse, Cart } from '@woocommerce/types';
|
6 |
|
7 |
/**
|
@@ -32,5 +33,5 @@ export function* getCartData(): Generator< unknown, void, CartResponse > {
|
|
32 |
* Resolver for retrieving cart totals.
|
33 |
*/
|
34 |
export function* getCartTotals(): Generator< unknown, void, Cart > {
|
35 |
-
yield
|
36 |
}
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { apiFetch } from '@wordpress/data-controls';
|
5 |
+
import { controls } from '@wordpress/data';
|
6 |
import { CartResponse, Cart } from '@woocommerce/types';
|
7 |
|
8 |
/**
|
33 |
* Resolver for retrieving cart totals.
|
34 |
*/
|
35 |
export function* getCartTotals(): Generator< unknown, void, Cart > {
|
36 |
+
yield controls.resolveSelect( STORE_KEY, 'getCartData' );
|
37 |
}
|
assets/js/data/collections/resolvers.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
5 |
import { addQueryArgs } from '@wordpress/url';
|
6 |
|
7 |
/**
|
@@ -18,13 +18,16 @@ import { apiFetchWithHeaders } from '../shared-controls';
|
|
18 |
* @param {number} timestamp Last update timestamp.
|
19 |
*/
|
20 |
function* invalidateModifiedCollection( timestamp ) {
|
21 |
-
const lastModified = yield
|
|
|
|
|
|
|
22 |
|
23 |
if ( ! lastModified ) {
|
24 |
-
yield dispatch( STORE_KEY, 'receiveLastModified', timestamp );
|
25 |
} else if ( timestamp > lastModified ) {
|
26 |
-
yield dispatch( STORE_KEY, 'invalidateResolutionForStore' );
|
27 |
-
yield dispatch( STORE_KEY, 'receiveLastModified', timestamp );
|
28 |
}
|
29 |
}
|
30 |
|
@@ -37,7 +40,7 @@ function* invalidateModifiedCollection( timestamp ) {
|
|
37 |
* @param {Array} ids
|
38 |
*/
|
39 |
export function* getCollection( namespace, resourceName, query, ids ) {
|
40 |
-
const route = yield
|
41 |
SCHEMA_STORE_KEY,
|
42 |
'getRoute',
|
43 |
namespace,
|
@@ -104,6 +107,6 @@ export function* getCollectionHeader(
|
|
104 |
const args = [ namespace, resourceName, query, ids ].filter(
|
105 |
( arg ) => typeof arg !== 'undefined'
|
106 |
);
|
107 |
-
//we call this simply to do any resolution of the collection if necessary.
|
108 |
-
yield
|
109 |
}
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { controls } from '@wordpress/data';
|
5 |
import { addQueryArgs } from '@wordpress/url';
|
6 |
|
7 |
/**
|
18 |
* @param {number} timestamp Last update timestamp.
|
19 |
*/
|
20 |
function* invalidateModifiedCollection( timestamp ) {
|
21 |
+
const lastModified = yield controls.resolveSelect(
|
22 |
+
STORE_KEY,
|
23 |
+
'getCollectionLastModified'
|
24 |
+
);
|
25 |
|
26 |
if ( ! lastModified ) {
|
27 |
+
yield controls.dispatch( STORE_KEY, 'receiveLastModified', timestamp );
|
28 |
} else if ( timestamp > lastModified ) {
|
29 |
+
yield controls.dispatch( STORE_KEY, 'invalidateResolutionForStore' );
|
30 |
+
yield controls.dispatch( STORE_KEY, 'receiveLastModified', timestamp );
|
31 |
}
|
32 |
}
|
33 |
|
40 |
* @param {Array} ids
|
41 |
*/
|
42 |
export function* getCollection( namespace, resourceName, query, ids ) {
|
43 |
+
const route = yield controls.resolveSelect(
|
44 |
SCHEMA_STORE_KEY,
|
45 |
'getRoute',
|
46 |
namespace,
|
107 |
const args = [ namespace, resourceName, query, ids ].filter(
|
108 |
( arg ) => typeof arg !== 'undefined'
|
109 |
);
|
110 |
+
// we call this simply to do any resolution of the collection if necessary.
|
111 |
+
yield controls.resolveSelect( STORE_KEY, 'getCollection', ...args );
|
112 |
}
|
assets/js/data/collections/test/resolvers.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
@@ -12,7 +12,7 @@ import { STORE_KEY as SCHEMA_STORE_KEY } from '../../schema/constants';
|
|
12 |
import { STORE_KEY } from '../constants';
|
13 |
import { apiFetchWithHeaders } from '../../shared-controls';
|
14 |
|
15 |
-
jest.mock( '@wordpress/data
|
16 |
|
17 |
describe( 'getCollection', () => {
|
18 |
describe( 'yields with expected responses', () => {
|
@@ -27,7 +27,7 @@ describe( 'getCollection', () => {
|
|
27 |
test( 'with getRoute call invoked to retrieve route', () => {
|
28 |
rewind();
|
29 |
fulfillment.next();
|
30 |
-
expect(
|
31 |
SCHEMA_STORE_KEY,
|
32 |
'getRoute',
|
33 |
testArgs[ 0 ],
|
@@ -133,7 +133,12 @@ describe( 'getCollectionHeader', () => {
|
|
133 |
rewind( 'x-wp-total', '/wc/blocks', 'products' );
|
134 |
const { value } = fulfillment.next();
|
135 |
expect( value ).toEqual(
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
137 |
);
|
138 |
} );
|
139 |
it( 'yields expected select control when called with all args', () => {
|
@@ -147,7 +152,7 @@ describe( 'getCollectionHeader', () => {
|
|
147 |
rewind( ...args );
|
148 |
const { value } = fulfillment.next();
|
149 |
expect( value ).toEqual(
|
150 |
-
|
151 |
STORE_KEY,
|
152 |
'/wc/blocks',
|
153 |
'products/attributes',
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { controls } from '@wordpress/data';
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
12 |
import { STORE_KEY } from '../constants';
|
13 |
import { apiFetchWithHeaders } from '../../shared-controls';
|
14 |
|
15 |
+
jest.mock( '@wordpress/data' );
|
16 |
|
17 |
describe( 'getCollection', () => {
|
18 |
describe( 'yields with expected responses', () => {
|
27 |
test( 'with getRoute call invoked to retrieve route', () => {
|
28 |
rewind();
|
29 |
fulfillment.next();
|
30 |
+
expect( controls.resolveSelect ).toHaveBeenCalledWith(
|
31 |
SCHEMA_STORE_KEY,
|
32 |
'getRoute',
|
33 |
testArgs[ 0 ],
|
133 |
rewind( 'x-wp-total', '/wc/blocks', 'products' );
|
134 |
const { value } = fulfillment.next();
|
135 |
expect( value ).toEqual(
|
136 |
+
controls.resolveSelect(
|
137 |
+
STORE_KEY,
|
138 |
+
'getCollection',
|
139 |
+
'/wc/blocks',
|
140 |
+
'products'
|
141 |
+
)
|
142 |
);
|
143 |
} );
|
144 |
it( 'yields expected select control when called with all args', () => {
|
152 |
rewind( ...args );
|
153 |
const { value } = fulfillment.next();
|
154 |
expect( value ).toEqual(
|
155 |
+
controls.resolveSelect(
|
156 |
STORE_KEY,
|
157 |
'/wc/blocks',
|
158 |
'products/attributes',
|
assets/js/data/schema/resolvers.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
@@ -20,7 +21,7 @@ import { STORE_KEY } from './constants';
|
|
20 |
export function* getRoute( namespace ) {
|
21 |
// we call this simply to do any resolution of all endpoints if necessary.
|
22 |
// allows for jit population of routes for a given namespace.
|
23 |
-
yield
|
24 |
}
|
25 |
|
26 |
/**
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { apiFetch } from '@wordpress/data-controls';
|
5 |
+
import { controls } from '@wordpress/data';
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
21 |
export function* getRoute( namespace ) {
|
22 |
// we call this simply to do any resolution of all endpoints if necessary.
|
23 |
// allows for jit population of routes for a given namespace.
|
24 |
+
yield controls.resolveSelect( STORE_KEY, 'getRoutes', namespace );
|
25 |
}
|
26 |
|
27 |
/**
|
assets/js/data/schema/test/resolvers.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import {
|
|
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
@@ -11,12 +12,13 @@ import { receiveRoutes } from '../actions';
|
|
11 |
import { STORE_KEY } from '../constants';
|
12 |
|
13 |
jest.mock( '@wordpress/data-controls' );
|
|
|
14 |
|
15 |
describe( 'getRoute', () => {
|
16 |
it( 'yields select control response', () => {
|
17 |
const fulfillment = getRoute( 'wc/blocks' );
|
18 |
fulfillment.next();
|
19 |
-
expect(
|
20 |
STORE_KEY,
|
21 |
'getRoutes',
|
22 |
'wc/blocks'
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { apiFetch } from '@wordpress/data-controls';
|
5 |
+
import { controls } from '@wordpress/data';
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
12 |
import { STORE_KEY } from '../constants';
|
13 |
|
14 |
jest.mock( '@wordpress/data-controls' );
|
15 |
+
jest.mock( '@wordpress/data' );
|
16 |
|
17 |
describe( 'getRoute', () => {
|
18 |
it( 'yields select control response', () => {
|
19 |
const fulfillment = getRoute( 'wc/blocks' );
|
20 |
fulfillment.next();
|
21 |
+
expect( controls.resolveSelect ).toHaveBeenCalledWith(
|
22 |
STORE_KEY,
|
23 |
'getRoutes',
|
24 |
'wc/blocks'
|
assets/js/editor-components/feedback-prompt/index.js
CHANGED
@@ -64,9 +64,9 @@ export const CartCheckoutFeedbackPrompt = () => (
|
|
64 |
export const LegacyFeedbackPrompt = () => (
|
65 |
<FeedbackPrompt
|
66 |
text={ __(
|
67 |
-
'We are working on a better editing experience that will replace
|
68 |
'woo-gutenberg-products-block'
|
69 |
) }
|
70 |
-
url="https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/new?template=--
|
71 |
/>
|
72 |
);
|
64 |
export const LegacyFeedbackPrompt = () => (
|
65 |
<FeedbackPrompt
|
66 |
text={ __(
|
67 |
+
'We are working on a better editing experience that will replace classic blocks. Keep an eye out for updates!',
|
68 |
'woo-gutenberg-products-block'
|
69 |
) }
|
70 |
+
url="https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/new?template=--classic-block-feedback.md"
|
71 |
/>
|
72 |
);
|
assets/js/icons/library/mini-cart.tsx
CHANGED
@@ -5,31 +5,24 @@ import { SVG } from '@wordpress/primitives';
|
|
5 |
|
6 |
const miniCart = (
|
7 |
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
|
8 |
-
<
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
/>
|
27 |
-
</g>
|
28 |
-
<defs>
|
29 |
-
<clipPath id="clip0">
|
30 |
-
<rect width="20" height="20" fill="white" />
|
31 |
-
</clipPath>
|
32 |
-
</defs>
|
33 |
</SVG>
|
34 |
);
|
35 |
|
5 |
|
6 |
const miniCart = (
|
7 |
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none">
|
8 |
+
<path
|
9 |
+
fillRule="evenodd"
|
10 |
+
clipRule="evenodd"
|
11 |
+
d="M7.84614 18.2769C7.89712 18.2769 7.93845 18.2356 7.93845 18.1846C7.93845 18.1336 7.89712 18.0923 7.84614 18.0923C7.79516 18.0923 7.75384 18.1336 7.75384 18.1846C7.75384 18.2356 7.79516 18.2769 7.84614 18.2769ZM6.03076 18.1846C6.03076 17.182 6.84353 16.3692 7.84614 16.3692C8.84875 16.3692 9.66152 17.182 9.66152 18.1846C9.66152 19.1872 8.84875 20 7.84614 20C6.84353 20 6.03076 19.1872 6.03076 18.1846Z"
|
12 |
+
fill="currentColor"
|
13 |
+
/>
|
14 |
+
<path
|
15 |
+
fillRule="evenodd"
|
16 |
+
clipRule="evenodd"
|
17 |
+
d="M17.3231 18.2769C17.3741 18.2769 17.4154 18.2356 17.4154 18.1846C17.4154 18.1336 17.3741 18.0923 17.3231 18.0923C17.2721 18.0923 17.2308 18.1336 17.2308 18.1846C17.2308 18.2356 17.2721 18.2769 17.3231 18.2769ZM15.5077 18.1846C15.5077 17.182 16.3205 16.3692 17.3231 16.3692C18.3257 16.3692 19.1385 17.182 19.1385 18.1846C19.1385 19.1872 18.3257 20 17.3231 20C16.3205 20 15.5077 19.1872 15.5077 18.1846Z"
|
18 |
+
fill="currentColor"
|
19 |
+
/>
|
20 |
+
<path
|
21 |
+
fillRule="evenodd"
|
22 |
+
clipRule="evenodd"
|
23 |
+
d="M20.0631 9.53835L19.4662 12.6685L19.4648 12.6757L19.4648 12.6757C19.3424 13.2919 19.0072 13.8454 18.5178 14.2394C18.031 14.6312 17.4226 14.8404 16.798 14.8308H8.44017C7.81556 14.8404 7.20714 14.6312 6.72038 14.2394C6.2312 13.8456 5.89605 13.2924 5.77352 12.6765L5.77335 12.6757L4.33477 5.48814C4.3286 5.46282 4.32345 5.43711 4.31934 5.41104L3.61815 1.90768H0.953842C0.42705 1.90768 0 1.48063 0 0.953842C0 0.42705 0.42705 0 0.953842 0H4.4C4.85462 0 5.24607 0.320858 5.33529 0.766644L6.04403 4.30769H12.785C13.0114 4.99157 13.3319 5.63258 13.7312 6.21538H6.42585L7.64421 12.3026L7.64449 12.304C7.67966 12.4811 7.77599 12.6402 7.91662 12.7534C8.05725 12.8666 8.23322 12.9267 8.41372 12.9233L8.432 12.9231H16.8062L16.8244 12.9233C17.0049 12.9267 17.1809 12.8666 17.3215 12.7534C17.4614 12.6408 17.5575 12.4828 17.5931 12.3068L17.5937 12.304L18.1649 9.30867C18.762 9.45873 19.387 9.53842 20.0307 9.53842C20.0415 9.53842 20.0523 9.5384 20.0631 9.53835Z"
|
24 |
+
fill="currentColor"
|
25 |
+
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
</SVG>
|
27 |
);
|
28 |
|
assets/js/types/type-defs/cart.ts
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
@@ -10,7 +15,7 @@ import {
|
|
10 |
import { ProductResponseItemData } from './product-response';
|
11 |
|
12 |
export interface CurrencyInfo {
|
13 |
-
currency_code:
|
14 |
currency_symbol: string;
|
15 |
currency_minor_unit: number;
|
16 |
currency_decimal_separator: string;
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { CurrencyCode } from '@woocommerce/type-defs/currency';
|
5 |
+
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
15 |
import { ProductResponseItemData } from './product-response';
|
16 |
|
17 |
export interface CurrencyInfo {
|
18 |
+
currency_code: CurrencyCode;
|
19 |
currency_symbol: string;
|
20 |
currency_minor_unit: number;
|
21 |
currency_decimal_separator: string;
|
assets/js/types/type-defs/currency.ts
CHANGED
@@ -2,7 +2,7 @@ export interface Currency {
|
|
2 |
/**
|
3 |
* ISO 4217 Currency Code
|
4 |
*/
|
5 |
-
code:
|
6 |
/**
|
7 |
* String which separates the decimals from the integer
|
8 |
*/
|
@@ -34,7 +34,7 @@ export interface Currency {
|
|
34 |
}
|
35 |
|
36 |
export interface CurrencyResponse {
|
37 |
-
currency_code:
|
38 |
currency_symbol: string;
|
39 |
currency_minor_unit: number;
|
40 |
currency_decimal_separator: string;
|
@@ -44,3 +44,168 @@ export interface CurrencyResponse {
|
|
44 |
}
|
45 |
|
46 |
export type SymbolPosition = 'left' | 'left_space' | 'right' | 'right_space';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/**
|
3 |
* ISO 4217 Currency Code
|
4 |
*/
|
5 |
+
code: CurrencyCode;
|
6 |
/**
|
7 |
* String which separates the decimals from the integer
|
8 |
*/
|
34 |
}
|
35 |
|
36 |
export interface CurrencyResponse {
|
37 |
+
currency_code: CurrencyCode;
|
38 |
currency_symbol: string;
|
39 |
currency_minor_unit: number;
|
40 |
currency_decimal_separator: string;
|
44 |
}
|
45 |
|
46 |
export type SymbolPosition = 'left' | 'left_space' | 'right' | 'right_space';
|
47 |
+
|
48 |
+
export type CurrencyCode =
|
49 |
+
| 'AED'
|
50 |
+
| 'AFN'
|
51 |
+
| 'ALL'
|
52 |
+
| 'AMD'
|
53 |
+
| 'ANG'
|
54 |
+
| 'AOA'
|
55 |
+
| 'ARS'
|
56 |
+
| 'AUD'
|
57 |
+
| 'AWG'
|
58 |
+
| 'AZN'
|
59 |
+
| 'BAM'
|
60 |
+
| 'BBD'
|
61 |
+
| 'BDT'
|
62 |
+
| 'BGN'
|
63 |
+
| 'BHD'
|
64 |
+
| 'BIF'
|
65 |
+
| 'BMD'
|
66 |
+
| 'BND'
|
67 |
+
| 'BOB'
|
68 |
+
| 'BRL'
|
69 |
+
| 'BSD'
|
70 |
+
| 'BTC'
|
71 |
+
| 'BTN'
|
72 |
+
| 'BWP'
|
73 |
+
| 'BYR'
|
74 |
+
| 'BYN'
|
75 |
+
| 'BZD'
|
76 |
+
| 'CAD'
|
77 |
+
| 'CDF'
|
78 |
+
| 'CHF'
|
79 |
+
| 'CLP'
|
80 |
+
| 'CNY'
|
81 |
+
| 'COP'
|
82 |
+
| 'CRC'
|
83 |
+
| 'CUC'
|
84 |
+
| 'CUP'
|
85 |
+
| 'CVE'
|
86 |
+
| 'CZK'
|
87 |
+
| 'DJF'
|
88 |
+
| 'DKK'
|
89 |
+
| 'DOP'
|
90 |
+
| 'DZD'
|
91 |
+
| 'EGP'
|
92 |
+
| 'ERN'
|
93 |
+
| 'ETB'
|
94 |
+
| 'EUR'
|
95 |
+
| 'FJD'
|
96 |
+
| 'FKP'
|
97 |
+
| 'GBP'
|
98 |
+
| 'GEL'
|
99 |
+
| 'GGP'
|
100 |
+
| 'GHS'
|
101 |
+
| 'GIP'
|
102 |
+
| 'GMD'
|
103 |
+
| 'GNF'
|
104 |
+
| 'GTQ'
|
105 |
+
| 'GYD'
|
106 |
+
| 'HKD'
|
107 |
+
| 'HNL'
|
108 |
+
| 'HRK'
|
109 |
+
| 'HTG'
|
110 |
+
| 'HUF'
|
111 |
+
| 'IDR'
|
112 |
+
| 'ILS'
|
113 |
+
| 'IMP'
|
114 |
+
| 'INR'
|
115 |
+
| 'IQD'
|
116 |
+
| 'IRR'
|
117 |
+
| 'IRT'
|
118 |
+
| 'ISK'
|
119 |
+
| 'JEP'
|
120 |
+
| 'JMD'
|
121 |
+
| 'JOD'
|
122 |
+
| 'JPY'
|
123 |
+
| 'KES'
|
124 |
+
| 'KGS'
|
125 |
+
| 'KHR'
|
126 |
+
| 'KMF'
|
127 |
+
| 'KPW'
|
128 |
+
| 'KRW'
|
129 |
+
| 'KWD'
|
130 |
+
| 'KYD'
|
131 |
+
| 'KZT'
|
132 |
+
| 'LAK'
|
133 |
+
| 'LBP'
|
134 |
+
| 'LKR'
|
135 |
+
| 'LRD'
|
136 |
+
| 'LSL'
|
137 |
+
| 'LYD'
|
138 |
+
| 'MAD'
|
139 |
+
| 'MDL'
|
140 |
+
| 'MGA'
|
141 |
+
| 'MKD'
|
142 |
+
| 'MMK'
|
143 |
+
| 'MNT'
|
144 |
+
| 'MOP'
|
145 |
+
| 'MRU'
|
146 |
+
| 'MUR'
|
147 |
+
| 'MVR'
|
148 |
+
| 'MWK'
|
149 |
+
| 'MXN'
|
150 |
+
| 'MYR'
|
151 |
+
| 'MZN'
|
152 |
+
| 'NAD'
|
153 |
+
| 'NGN'
|
154 |
+
| 'NIO'
|
155 |
+
| 'NOK'
|
156 |
+
| 'NPR'
|
157 |
+
| 'NZD'
|
158 |
+
| 'OMR'
|
159 |
+
| 'PAB'
|
160 |
+
| 'PEN'
|
161 |
+
| 'PGK'
|
162 |
+
| 'PHP'
|
163 |
+
| 'PKR'
|
164 |
+
| 'PLN'
|
165 |
+
| 'PRB'
|
166 |
+
| 'PYG'
|
167 |
+
| 'QAR'
|
168 |
+
| 'RON'
|
169 |
+
| 'RSD'
|
170 |
+
| 'RUB'
|
171 |
+
| 'RWF'
|
172 |
+
| 'SAR'
|
173 |
+
| 'SBD'
|
174 |
+
| 'SCR'
|
175 |
+
| 'SDG'
|
176 |
+
| 'SEK'
|
177 |
+
| 'SGD'
|
178 |
+
| 'SHP'
|
179 |
+
| 'SLL'
|
180 |
+
| 'SOS'
|
181 |
+
| 'SRD'
|
182 |
+
| 'SSP'
|
183 |
+
| 'STN'
|
184 |
+
| 'SYP'
|
185 |
+
| 'SZL'
|
186 |
+
| 'THB'
|
187 |
+
| 'TJS'
|
188 |
+
| 'TMT'
|
189 |
+
| 'TND'
|
190 |
+
| 'TOP'
|
191 |
+
| 'TRY'
|
192 |
+
| 'TTD'
|
193 |
+
| 'TWD'
|
194 |
+
| 'TZS'
|
195 |
+
| 'UAH'
|
196 |
+
| 'UGX'
|
197 |
+
| 'USD'
|
198 |
+
| 'UYU'
|
199 |
+
| 'UZS'
|
200 |
+
| 'VEF'
|
201 |
+
| 'VES'
|
202 |
+
| 'VND'
|
203 |
+
| 'VUV'
|
204 |
+
| 'WST'
|
205 |
+
| 'XAF'
|
206 |
+
| 'XCD'
|
207 |
+
| 'XOF'
|
208 |
+
| 'XPF'
|
209 |
+
| 'YER'
|
210 |
+
| 'ZAR'
|
211 |
+
| 'ZMW';
|
assets/js/types/type-defs/taxes.ts
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export type TaxRate = {
|
2 |
+
country: string;
|
3 |
+
rate: string;
|
4 |
+
name: string;
|
5 |
+
shipping: boolean;
|
6 |
+
priority: number;
|
7 |
+
};
|
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-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-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => 'c5ea826aeef75bc16dd8bf9120d7191a');
|
build/active-filters-frontend.js
CHANGED
@@ -1,8 +1,8 @@
|
|
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=203)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10: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.
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
-
Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(p.formatPrice)(e),Object(p.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
|
8 |
/* translators: %s min price */
|
@@ -10,4 +10,4 @@ Object(c.__)("From %s","woo-gutenberg-products-block"),Object(p.formatPrice)(e))
|
|
10 |
/* translators: %s max price */
|
11 |
Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(p.formatPrice)(t)),f=e=>{let{type:t,name:r,prefix:n,removeCallback:s=(()=>{}),showLabel:a=!0,displayStyle:l}=e;const i=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(c.sprintf)(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
-
Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===l?Object(o.createElement)(d.a,{element:"span",text:i,onRemove:s,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},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)(u.a,{screenReaderLabel:b}))))};var g=r(64),O=r(19),j=r(110),_=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:a}=e;const{results:l,isLoading:i}=Object(g.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(s.b)("attributes",[]);if(i)return null;const p=t.label;return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=l.find(t=>t.slug===e);if(!s)return null;let i="";return r>0&&"and"===n&&(i=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("and","woo-gutenberg-products-block"))),f({type:p,name:Object(O.decodeEntities)(s.name||e),prefix:i,removeCallback:()=>{Object(j.a)(u,b,t,e)},showLabel:!1,displayStyle:a})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const[n,l]=Object(s.b)("attributes",[]),[p,d]=Object(s.b)("stock_status",[]),[g,O]=Object(s.b)("min_price"),[j,y]=Object(s.b)("max_price"),w=Object(a.getSetting)("stockStatusOptions",[]),E=Object(o.useMemo)(()=>{if(p.length>0)return p.map(e=>f({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:w[e],removeCallback:()=>{const t=p.filter(t=>t!==e);d(t)},displayStyle:t.displayStyle}))},[w,p,d,t.displayStyle]),h=Object(o.useMemo)(()=>Number.isFinite(g)||Number.isFinite(j)?f({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:m(g,j),removeCallback:()=>{O(void 0),y(void 0)},displayStyle:t.displayStyle}):null,[g,j,t.displayStyle,O,y]),v=Object(o.useMemo)(()=>n.map(e=>{const r=Object(b.b)(e.attribute);return Object(o.createElement)(_,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||p.length>0||Number.isFinite(g)||Number.isFinite(j)||r))return null;const k="h"+t.headingLevel,S=i()("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)(k,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:S},r?Object(o.createElement)(o.Fragment,null,f({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),f({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,h,E,v)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{O(void 0),y(void 0),l([]),d([])}},Object(o.createElement)(u.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3},isEditor:!1})})},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(11),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},3:function(e,t){e.exports=window.React},34:function(e,t){},36:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(5),o=r(9),c=r(0),s=r(11),a=r.n(s),l=r(28),i=r(59),u=r(23);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(c.useCallback)(t=>{l(r,e,t)},[r,e,l])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=b(t),s=Object(l.a)(n),p=Object(l.a)(e),d=Object(i.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(d,p)||(o(Object.assign({},s,p)),m.current=!0)},[s,p,d,o]),m.current?[n,o]:[e,o]}},38:function(e,t){e.exports=window.wc.priceFormat},4: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 s=o.apply(null,n);s&&e.push(s)}}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)}()},42:function(e,t,r){"use strict";var n=r(43);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,c,s){if(s!==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}},43:function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},47:function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return l})),r.d(t,"i",(function(){return i})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=c.pluginUrl+"images/",a=c.pluginUrl+"build/",l=c.buildPhase,i=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),d=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{})},5:function(e,t){e.exports=window.wc.wcBlocksData},51:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(10),o=r.n(n),c=r(0),s=r(15);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=n(e,r),i=a(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:l={}}=e;Object(c.render)(Object(c.createElement)(s.a,l,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:i})})},i=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const s=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const s=c.querySelectorAll(o);l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},59:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},6:function(e,t){e.exports=window.lodash},64:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),o=r(9),c=r(0),s=r(28),a=r(74);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(c.useRef)({results:[],isLoading:!0}),p=Object(s.a)(i),d=Object(s.a)(l),m=Object(a.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,d],s=o.getCollectionError(...c);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(s)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},74:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},8:function(e,t,r){e.exports=r(42)()},9:function(e,t){e.exports=window.wp.data}});
|
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=203)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10: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.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},102:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},107:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return s}));var n=r(2);const o=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const 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;var n;return r.id&&e.push(r),e},[]),c=e=>{if(e)return o.find(t=>t.id===e)},s=e=>{if(e)return o.find(t=>t.taxonomy===e)}},108:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c}));var n=r(6);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const c=e.filter(e=>e.attribute===r.taxonomy),s=c.length?c[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(o)))return;const a=s.slug.filter(e=>e!==o),l=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),l.push(s)),t(Object(n.sortBy)(l,"attribute"))},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},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";const s=e.filter(e=>e.attribute!==r.taxonomy);0===o.length?t(s):(s.push({attribute:r.taxonomy,operator:c,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute")))}},11:function(e,t){e.exports=window.wp.isShallowEqual},118:function(e,t){},14:function(e,t){e.exports=window.wp.primitives},15:function(e,t,r){"use strict";var n=r(17),o=r.n(n),c=r(0),s=r(3),a=r(1),l=r(45),i=e=>{let{imageUrl:t=l.l+"/block-error.svg",header:r=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:s=Object(a.__)("Error:","woo-gutenberg-products-block"),button:i,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",o),i&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i))):null};r(34);class u extends s.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:s,renderError:a,button:l}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(c.createElement)(i,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:s,button:l}):this.props.children}}t.a=u},17: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.__esModule=!0,e.exports.default=e.exports},178:function(e,t,r){"use strict";var n=r(0),o=r(14);const c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=c},182:function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0),s=r(4),a=r.n(s),l=r(1),i=r(102),u=r(178);r(118);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:l="small",children:i=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+l),d=Boolean(r&&r!==t);return Object(c.createElement)(b,o()({className:p},u),Object(c.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(c.createElement)("span",{className:"screen-reader-text"},r),i)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
+
Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},w=p?{"aria-hidden":!0}:O;return Object(c.createElement)(b,o()({},f,j,{className:a()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(c.createElement)(g,o()({className:"wc-block-components-chip__remove"},w),Object(c.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},19:function(e,t){e.exports=window.wp.htmlEntities},2:function(e,t){e.exports=window.wc.wcSettings},203:function(e,t,r){e.exports=r(223)},204:function(e,t){},22:function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const l=null!=r,i=null!=o;return!l&&i?(t=s||"span",a={...a,className:c()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,o)):(t=s||n.Fragment,l&&i&&r!==o?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,a,r))}},223:function(e,t,r){"use strict";r.r(t);var n=r(49),o=r(0),c=r(1),s=r(36),a=r(2),l=r(4),i=r.n(l),u=r(22),b=(r(204),r(107)),p=r(38),d=r(182);const m=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(p.formatPrice)(e),Object(p.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
|
8 |
/* translators: %s min price */
|
10 |
/* translators: %s max price */
|
11 |
Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(p.formatPrice)(t)),f=e=>{let{type:t,name:r,prefix:n,removeCallback:s=(()=>{}),showLabel:a=!0,displayStyle:l}=e;const i=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(c.sprintf)(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
+
Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===l?Object(o.createElement)(d.a,{element:"span",text:i,onRemove:s,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},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)(u.a,{screenReaderLabel:b}))))};var g=r(62),O=r(19),j=r(108),w=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:a}=e;const{results:l,isLoading:i}=Object(g.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(s.b)("attributes",[]);if(i)return null;const p=t.label;return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=l.find(t=>t.slug===e);if(!s)return null;let i="";return r>0&&"and"===n&&(i=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("and","woo-gutenberg-products-block"))),f({type:p,name:Object(O.decodeEntities)(s.name||e),prefix:i,removeCallback:()=>{Object(j.a)(u,b,t,e)},showLabel:!1,displayStyle:a})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const[n,l]=Object(s.b)("attributes",[]),[p,d]=Object(s.b)("stock_status",[]),[g,O]=Object(s.b)("min_price"),[j,_]=Object(s.b)("max_price"),E=Object(a.getSetting)("stockStatusOptions",[]),y=Object(o.useMemo)(()=>{if(p.length>0)return p.map(e=>f({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:E[e],removeCallback:()=>{const t=p.filter(t=>t!==e);d(t)},displayStyle:t.displayStyle}))},[E,p,d,t.displayStyle]),h=Object(o.useMemo)(()=>Number.isFinite(g)||Number.isFinite(j)?f({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:m(g,j),removeCallback:()=>{O(void 0),_(void 0)},displayStyle:t.displayStyle}):null,[g,j,t.displayStyle,O,_]),v=Object(o.useMemo)(()=>n.map(e=>{const r=Object(b.b)(e.attribute);return Object(o.createElement)(w,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||p.length>0||Number.isFinite(g)||Number.isFinite(j)||r))return null;const k="h"+t.headingLevel,S=i()("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)(k,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:S},r?Object(o.createElement)(o.Fragment,null,f({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),f({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,h,y,v)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{O(void 0),_(void 0),l([]),d([])}},Object(o.createElement)(u.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3},isEditor:!1})})},23:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(11),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},3:function(e,t){e.exports=window.React},34:function(e,t){},36:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(5),o=r(8),c=r(0),s=r(11),a=r.n(s),l=r(28),i=r(57),u=r(23);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(c.useCallback)(t=>{l(r,e,t)},[r,e,l])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=b(t),s=Object(l.a)(n),p=Object(l.a)(e),d=Object(i.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(d,p)||(o(Object.assign({},s,p)),m.current=!0)},[s,p,d,o]),m.current?[n,o]:[e,o]}},38:function(e,t){e.exports=window.wc.priceFormat},4: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 s=o.apply(null,n);s&&e.push(s)}}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)}()},45:function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return l})),r.d(t,"i",(function(){return i})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=c.pluginUrl+"images/",a=c.pluginUrl+"build/",l=c.buildPhase,i=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),d=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{})},49:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(10),o=r.n(n),c=r(0),s=r(15);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=n(e,r),i=a(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:l={}}=e;Object(c.render)(Object(c.createElement)(s.a,l,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:i})})},i=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const s=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const s=c.querySelectorAll(o);l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},5:function(e,t){e.exports=window.wc.wcBlocksData},57:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},6:function(e,t){e.exports=window.lodash},62:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(5),o=r(8),c=r(0),s=r(28),a=r(72);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(c.useRef)({results:[],isLoading:!0}),p=Object(s.a)(i),d=Object(s.a)(l),m=Object(a.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,d],s=o.getCollectionError(...c);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(s)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},72:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},8:function(e,t){e.exports=window.wp.data}});
|
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' => 'b1a7e6e11b48958edd76c7c40852d058');
|
build/active-filters.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,p=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(r,l)&&r[l]&&p.push(r[l][0]),r[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,i||[]),c()}function c(){for(var e,t=0;t<o.length;t++){for(var c=o[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==r[s]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},r={5:0},o=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
-
Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:o}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,o,a))})}}t.a=i},
|
4 |
/* translators: Remove chip. */
|
5 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
-
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const g={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},f=p?g:{},v=p?{"aria-hidden":!0}:g;return Object(o.createElement)(b,r()({},h,f,{className:a()(c,"is-removable"),element:p?"button":h.element,screenReaderText:m,text:d}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},v),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},25:function(e,t){e.exports=window.wp.isShallowEqual},29:function(e,t,c){"use strict";var n=c(0),r=c(4),o=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=r;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,r)):(t=l||n.Fragment,s&&i&&c!==r?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},r)):Object(n.createElement)(t,a,c))}},3:function(e,t){e.exports=window.wp.components},30:function(e,t){e.exports=window.wc.priceFormat},
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(_.formatPrice)(e),Object(_.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
|
10 |
/* translators: %s min price */
|
@@ -12,6 +12,6 @@ Object(l.__)("From %s","woo-gutenberg-products-block"),Object(_.formatPrice)(e))
|
|
12 |
/* translators: %s max price */
|
13 |
Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(_.formatPrice)(t)),E=e=>{let{type:t,name:c,prefix:n,removeCallback:r=(()=>{}),showLabel:a=!0,displayStyle:s}=e;const i=n?Object(o.createElement)(o.Fragment,null,n," ",c):c,u=Object(l.sprintf)(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+c},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(o.createElement)(y.a,{element:"span",text:i,onRemove:r,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:r},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)(j.a,{screenReaderLabel:u}))))};var x=c(
|
16 |
/* translators: "Chips" is a tag-like display style for chosen attributes. */
|
17 |
-
label:Object(l.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:e=>c({displayStyle:e})}),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(h.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:s,onChange:e=>c({headingLevel:e})}))),Object(o.createElement)(O.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>c({heading:e})}),Object(o.createElement)(m.Disabled,null,Object(o.createElement)(L,{attributes:t,isEditor:!0})))});Object(a.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:i,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("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,color:{text:!0,background:!1}},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:H,save(e){let{attributes:t}=e;const{className:c,displayStyle:n,heading:l,headingLevel:a}=t,s={"data-display-style":n,"data-heading":l,"data-heading-level":a};return Object(o.createElement)("div",r()({},d.useBlockProps.save({className:p()("is-loading",c)}),s),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,p=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(r,l)&&r[l]&&p.push(r[l][0]),r[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,i||[]),c()}function c(){for(var e,t=0;t<o.length;t++){for(var c=o[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==r[s]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},r={5:0},o=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([394,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},100:function(e,t,c){"use strict";var n=c(0),r=c(7),o=c(1),l=c(3),a=c(11);function s(e){let{level:t}=e;const c={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 c.hasOwnProperty(t)?Object(n.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(a.Path,{d:c[t]})):null}class i extends n.Component{createLevelControl(e,t,c){const r=e===t;return{icon:Object(n.createElement)(s,{level:e}),title:Object(o.sprintf)(
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
+
Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:o,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:o}),controls:Object(r.range)(t,c).map(e=>this.createLevelControl(e,o,a))})}}t.a=i},107:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(8);function r(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},11:function(e,t){e.exports=window.wp.primitives},119:function(e,t,c){"use strict";var n=c(0),r=c(6),o=c(9),l=c(1);c(155),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:o,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(r.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},124:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const r=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(15),r=c(13),o=c(0),l=c(49),a=c(124);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(i),d=Object(l.a)(s),m=Object(a.a)(),h=Object(r.useSelect)(e=>{if(!u)return null;const r=e(n.COLLECTIONS_STORE_KEY),o=[t,c,p,d],l=r.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(l)}return{results:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}},[t,c,d,p,u]);return null!==h&&(b.current=h),b.current}},13:function(e,t){e.exports=window.wp.data},14:function(e,t){e.exports=window.wp.blocks},15:function(e,t){e.exports=window.wc.wcBlocksData},155:function(e,t){},156:function(e,t){},17:function(e,t){e.exports=window.wp.htmlEntities},191:function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return l}));var n=c(2);const r=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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;var n;return c.id&&e.push(c),e},[]),o=e=>{if(e)return r.find(t=>t.id===e)},l=e=>{if(e)return r.find(t=>t.taxonomy===e)}},192:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));var n=c(7);const r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===c.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(r)))return;const a=l.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const l=e.filter(e=>e.attribute!==c.taxonomy);0===r.length?t(l):(l.push({attribute:c.taxonomy,operator:o,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute")))}},2:function(e,t){e.exports=window.wc.wcSettings},201:function(e,t,c){"use strict";var n=c(5),r=c.n(n),o=c(0),l=c(4),a=c.n(l),s=c(1),i=c(111),u=c(517);c(156);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=n,p=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),d=Boolean(c&&c!==t);return Object(o.createElement)(b,r()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...h}=e;const O=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
|
4 |
/* translators: Remove chip. */
|
5 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
+
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const g={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},f=p?g:{},v=p?{"aria-hidden":!0}:g;return Object(o.createElement)(b,r()({},h,f,{className:a()(c,"is-removable"),element:p?"button":h.element,screenReaderText:m,text:d}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},v),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},25:function(e,t){e.exports=window.wp.isShallowEqual},29:function(e,t,c){"use strict";var n=c(0),r=c(4),o=c.n(r);t.a=e=>{let t,{label:c,screenReaderLabel:r,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=r;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,r)):(t=l||n.Fragment,s&&i&&c!==r?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},r)):Object(n.createElement)(t,a,c))}},3:function(e,t){e.exports=window.wp.components},30:function(e,t){e.exports=window.wc.priceFormat},394:function(e,t,c){e.exports=c(460)},395:function(e,t){},460:function(e,t,c){"use strict";c.r(t);var n=c(5),r=c.n(n),o=c(0),l=c(1),a=c(14),s=c(11),i=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"})),u=c(111),b=c(4),p=c.n(b),d=c(6),m=c(3),h=c(100),O=c(119),g=c(60),f=c(78),v=c(2),j=c(29),w=(c(395),c(191)),_=c(30),y=c(201);const k=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(_.formatPrice)(e),Object(_.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
|
10 |
/* translators: %s min price */
|
12 |
/* translators: %s max price */
|
13 |
Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(_.formatPrice)(t)),E=e=>{let{type:t,name:c,prefix:n,removeCallback:r=(()=>{}),showLabel:a=!0,displayStyle:s}=e;const i=n?Object(o.createElement)(o.Fragment,null,n," ",c):c,u=Object(l.sprintf)(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+c},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(o.createElement)(y.a,{element:"span",text:i,onRemove:r,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},i,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:r},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)(j.a,{screenReaderLabel:u}))))};var x=c(125),S=c(17),C=c(192),N=e=>{let{attributeObject:t={},slugs:c=[],operator:n="in",displayStyle:r}=e;const{results:a,isLoading:s}=Object(x.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[i,u]=Object(f.b)("attributes",[]);if(s)return null;const b=t.label;return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(o.createElement)("ul",null,c.map((e,c)=>{const s=a.find(t=>t.slug===e);if(!s)return null;let p="";return c>0&&"and"===n&&(p=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("and","woo-gutenberg-products-block"))),E({type:b,name:Object(S.decodeEntities)(s.name||e),prefix:p,removeCallback:()=>{Object(C.a)(i,u,t,e)},showLabel:!1,displayStyle:r})})))},L=e=>{let{attributes:t,isEditor:c=!1}=e;const[n,r]=Object(f.b)("attributes",[]),[a,s]=Object(f.b)("stock_status",[]),[i,u]=Object(f.b)("min_price"),[b,d]=Object(f.b)("max_price"),m=Object(v.getSetting)("stockStatusOptions",[]),h=Object(o.useMemo)(()=>{if(a.length>0)return a.map(e=>E({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:m[e],removeCallback:()=>{const t=a.filter(t=>t!==e);s(t)},displayStyle:t.displayStyle}))},[m,a,s,t.displayStyle]),O=Object(o.useMemo)(()=>Number.isFinite(i)||Number.isFinite(b)?E({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:k(i,b),removeCallback:()=>{u(void 0),d(void 0)},displayStyle:t.displayStyle}):null,[i,b,t.displayStyle,u,d]),g=Object(o.useMemo)(()=>n.map(e=>{const c=Object(w.b)(e.attribute);return Object(o.createElement)(N,{attributeObject:c,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]);if(!(n.length>0||a.length>0||Number.isFinite(i)||Number.isFinite(b)||c))return null;const _="h"+t.headingLevel,y=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!c&&t.heading&&Object(o.createElement)(_,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:y},c?Object(o.createElement)(o.Fragment,null,E({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),E({type:Object(l.__)("Color","woo-gutenberg-products-block"),name:Object(l.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,O,h,g)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{u(void 0),d(void 0),r([]),s([])}},Object(o.createElement)(j.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))},H=Object(m.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c}=e;const{className:n,displayStyle:r,heading:a,headingLevel:s}=t,i=Object(d.useBlockProps)({className:n});return Object(o.createElement)("div",i,Object(o.createElement)(d.InspectorControls,{key:"inspector"},Object(o.createElement)(m.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(g.a,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:r,options:[{label:Object(l.__)("List","woo-gutenberg-products-block"),value:"list"},{
|
16 |
/* translators: "Chips" is a tag-like display style for chosen attributes. */
|
17 |
+
label:Object(l.__)("Chips","woo-gutenberg-products-block"),value:"chips"}],onChange:e=>c({displayStyle:e})}),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(h.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:s,onChange:e=>c({headingLevel:e})}))),Object(o.createElement)(O.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:a,onChange:e=>c({heading:e})}),Object(o.createElement)(m.Disabled,null,Object(o.createElement)(L,{attributes:t,isEditor:!0})))});Object(a.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:i,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("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,color:{text:!0,background:!1}},example:{attributes:{}},attributes:{displayStyle:{type:"string",default:"list"},heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3}},edit:H,save(e){let{attributes:t}=e;const{className:c,displayStyle:n,heading:l,headingLevel:a}=t,s={"data-display-style":n,"data-heading":l,"data-heading-level":a};return Object(o.createElement)("div",r()({},d.useBlockProps.save({className:p()("is-loading",c)}),s),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},49:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),r=c(25),o=c.n(r);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},52:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);const r=Object(n.createContext)("page"),o=()=>Object(n.useContext)(r);r.Provider},6:function(e,t){e.exports=window.wp.blockEditor},60:function(e,t,c){"use strict";var n=c(5),r=c.n(n),o=c(0),l=c(4),a=c.n(l),s=c(3),i=c(9);c(90);class u extends o.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:l,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let p;return l&&(p="function"==typeof l?l(t):l),Object(o.createElement)(s.BaseControl,{id:b,help:p,className:a()("components-toggle-button-control",n)},Object(o.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(o.createElement)(s.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const n={};return u===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(o.createElement)(s.Button,r()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(i.withInstanceId)(u)},7:function(e,t){e.exports=window.lodash},78:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return p})),c.d(t,"c",(function(){return d}));var n=c(15),r=c(13),o=c(0),l=c(25),a=c.n(l),s=c(49),i=c(107),u=c(52);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(r.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(r.useSelect)(r=>r(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(r.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(c,e,t)},[c,e,s])]},d=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,r]=b(t),l=Object(s.a)(n),p=Object(s.a)(e),d=Object(i.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(r(Object.assign({},l,p)),m.current=!0)},[l,p,d,r]),m.current?[n,r]:[e,r]}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.compose},90:function(e,t){}});
|
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-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-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'bfe6304075abbcef3bbc5c9b81b636bd');
|
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],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(a&&a(t);l.length;)l.shift()()}var r={},n={8:0,6: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,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--cart-blocks/line-items--cart-blocks/order-summary--checkout-blocks/order-summary--checkout--6efbf40e",1:"vendors--cart-blocks/order-summary--checkout-blocks/billing-address--checkout-blocks/order-summary---4f3822fa",43:"product-add-to-cart",44:"product-button",45:"product-category-list",46:"product-image",47:"product-price",48:"product-rating",49:"product-sale-badge",50:"product-sku",51:"product-stock-indicator",52:"product-summary",53:"product-tag-list",54:"product-title",58:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"6cac46a4162fecf78f20",1:"a08a70f6c49903d28adc",43:"0fd09edc080d65984ef6",44:"a3ad4f1a9b779bf906b8",45:"311002f7cdd4bd268d04",46:"63f58a0aaf97f9115eb8",47:"3cf315d2679f6efaefb6",48:"86c50b93087f31564e62",49:"b8a989317cd31b90a255",50:"bf356482906d82c6d00a",51:"a2580a355c8cdd1ef05d",52:"5f7d2c65b715892d36d9",53:"54be3871f8130a263aaa",54:"477e97137ba40eafd29f",58:"73c00a3ea4760e00b3d6"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);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;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,r[1](a)}n[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}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 s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=190)}([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){e.exports=window.React},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 s in n)r.call(n,s)&&n[s]&&e.push(s);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.wc.wcBlocksData},function(e,t){e.exports=window.lodash},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(42)()},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){e.exports=window.wp.isShallowEqual},,function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(17),o=r.n(n),c=r(0),i=r(3),s=r(1),a=r(47),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(34);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:i,renderError:s,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(c.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},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){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);r(9);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:i,wrapperProps:s={}}=e;const a=null!=r,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,o)):(t=i||n.Fragment,a&&l&&r!==o?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,s,r))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},function(e,t,r){"use strict";(function(e){var n=r(0);r(40);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(65))},function(e,t){e.exports=window.wp.apiFetch},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(11),c=r.n(o);function i(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(6),o=r(0),c=r(5),i=r(9),s=r(19),a=r(117),l=r(18),u=r(70);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...m,email:""},g={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:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();b();const p=Object(i.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:g}=n(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,j=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingAddress:Object(a.a)(O),shippingAddress:Object(a.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.deprecated},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(41),o=r(0),c=r(29);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t){e.exports=window.wp.url},,function(e,t){},,function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(5),o=r(9),c=r(0),i=r(11),s=r.n(i),a=r(28),l=r(59),u=r(23);const d=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,r)=>{const i=Object(u.a)();r=r||i;const s=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[s,Object(c.useCallback)(t=>{a(r,e,t)},[r,e,a])]},b=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=d(t),i=Object(a.a)(n),p=Object(a.a)(e),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[n,o]:[e,o]}},,function(e,t){e.exports=window.wc.priceFormat},,function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(43);function o(){}function c(){}c.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,c,i){if(i!==n){var s=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 s.name="Invariant Violation",s}}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,r){"use strict";var n=r(7),o=r(0),c=r(14),i=function({icon:e,className:t,...r}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:c},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(i,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...r});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...r}):e({size:t,...r});if(e&&("svg"===e.type||e.type===c.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(c.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return i})),r.d(t,"k",(function(){return s})),r.d(t,"m",(function(){return a})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return b})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return h})),r.d(t,"b",(function(){return E}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",s=c.pluginUrl+"build/",a=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),c=r(71),i=r(61);const s=Object(n.getSetting)("countryLocale",{}),a=e=>{const 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(o.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
-
Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(s).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,a(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=r&&void 0!==l[r]?l[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(10),o=r.n(n),c=r(0),i=r(15);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const a=n(e,r),l=s(e,r),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},,function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(4),i=r.n(c),s=r(6),a=r(30),l=r.n(a),u=r(13),d=r(54),p=r(94),b=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const c=o.getBoundingClientRect();return new n.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=r(24);function w(e){const t=Object(o.useContext)(O.a),r=t.slots[e]||{},n=t.fills[e],c=Object(o.useMemo)(()=>n||[],[n]);return{...r,updateSlot:Object(o.useCallback)(r=>{t.updateSlot(e,r)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(r=>{t.unregisterSlot(e,r)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(r=>{t.registerFill(e,r)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(r=>{t.unregisterFill(e,r)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:r,unregisterFill:n}){const c=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(j),[n,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),r(()=>{c(t(e))})),[e]),n})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,i.current),()=>n(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(n(i.current.name,i.current),i.current.name=e,r(e,i.current))},[e]),c&&c.node?(Object(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var y=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(v,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:r,registerSlot:n}=this.props;e.name!==t&&(r(e.name),n(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:r={},getFills:n}=this.props,c=Object(s.map)(n(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:c})=>Object(o.createElement)(_,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function C({name:e,children:t}){const r=w(e),n=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(r.registerFill(n),()=>{r.unregisterFill(n)}),[r.registerFill,r.unregisterFill]),r.ref&&r.ref.current?("function"==typeof t&&(t=t(r.fillProps)),Object(o.createPortal)(t,r.ref.current)):null}var S=Object(o.forwardRef)((function({name:e,fillProps:t={},as:r="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(C,e))}r(11),o.Component;const P=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(S,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function R(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=r?parseInt(r,10):0,a=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function B(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function A(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:v,getAnchorRect:y,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:C,__unstableStickyBoundaryElement:S,__unstableSlotName:P="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...W},H)=>{const z=Object(o.useRef)(null),V=Object(o.useRef)(null),U=Object(o.useRef)(),Y=Object(u.useViewportMatch)("medium","<"),[q,G]=Object(o.useState)(),K=w(P),X=_&&Y,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return A(U.current,"is-without-arrow",s),A(U.current,"is-alternate",a),L(U.current,"data-x-axis"),L(U.current,"data-y-axis"),B(U.current,"top"),B(U.current,"left"),B(V.current,"maxHeight"),void B(V.current,"maxWidth");const e=()=>{if(!U.current||!V.current)return;let e=function(e,t,r,n=!1,o,c){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==n?void 0:n.cloneRange))return m(Object(d.getRectangleFromRange)(n),n.endContainer.ownerDocument,c);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,c);return o?e:T(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(r.left,r.top,r.width,i.bottom-r.top),e.ownerDocument,c);return o?s:T(s,n)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(z,v,y,O,j,U.current);if(!e)return;const{offsetParent:t,ownerDocument:r}=U.current;let n,o=0;if(t&&t!==r.body){const r=t.getBoundingClientRect();o=r.top,e=new window.DOMRect(e.left-r.left,e.top-r.top,e.width,e.height)}var c;F&&(n=null===(c=U.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:V.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,r="top",n,o,c,i,s,a){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,c,i,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:r,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===n?l=e.bottom:"top"===n&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={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};let b,m=r,f=null;if(!o&&!s)if("middle"===r&&u.contentHeight===a)m="middle";else if("top"===r&&d.contentHeight===a)m="top";else if("bottom"===r&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,n,0,c,s);return{...function(e,t,r,n,o,c,i,s,a){const{width:l}=t;"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.isRTL)()&&(r="left"),"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===n?p=e.right:"middle"===c||a||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let h,E=r,O=null;if(!o&&!s)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&f.contentWidth===l)E="left";else if("right"===r&&g.contentWidth===l)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-l),Object(b.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,n,p.yAxis,i,s,a),...p}}(e,i,f,S,U.current,o,n,I,D);"number"==typeof l&&"number"==typeof u&&(B(U.current,"top",l+"px"),B(U.current,"left",u+"px")),A(U.current,"is-without-arrow",s||"center"===p&&"middle"===g),A(U.current,"is-alternate",a),L(U.current,"data-x-axis",p),L(U.current,"data-y-axis",g),B(V.current,"maxHeight","number"==typeof h?h+"px":""),B(V.current,"maxWidth","number"==typeof E?E+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=U.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const c=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",c),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new r.MutationObserver(e),l.observe(M,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",c),r.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[X,v,y,O,j,f,Z,S,M,F]);const $=(e,r)=>{if("focus-outside"===e&&C)C(r);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:$,onClose:$}),re=Object(u.useMergeRefs)([U,ee,H]),ne=Boolean(x&&q)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:r=R(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:i()("components-popover",c,ne,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},W,{ref:re},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(Q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:V,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(N,{name:P},oe)),O||v?oe:Object(o.createElement)("span",{ref:z},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(P,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(s.isString)(e)&&(r=e),Object(s.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const D=Object(o.createElement)("div",{className:"event-catcher"}),W=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:r}),","),e),H=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),z=(e,t,r)=>{if(1!==o.Children.count(e))return;const n=o.Children.only(e);"function"==typeof n.props[t]&&n.props[t](r)};var V=function({children:e,position:t,text:r,shortcut:n}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{z(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{z(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),g=(t,r)=>n=>{if(z(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],n.type);o!==a&&(r?d(o):l(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?W:H)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:r,shortcut:n})})},U=r(44),Y=r(45);const q=["onMouseDown","onClick"];var Q=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:v,text:y,variant:_,__experimentalIsFocusable:x,describedBy:k,...C}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),n&&(null!==(u=s)&&void 0!==u||(s="tertiary")),r&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),S=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),N=m&&!x,P=void 0===r||N?"button":"a",R="a"===P?{href:r,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(m&&x){R["aria-disabled"]=!0;for(const e of q)C[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!N&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=C["aria-describedby"]||L,A=Object(o.createElement)(P,Object(n.a)({},R,C,{className:S,"aria-label":C["aria-label"]||j,"aria-describedby":B,ref:t}),f&&"left"===g&&Object(o.createElement)(U.a,{icon:f,size:h}),y&&Object(o.createElement)(o.Fragment,null,y),f&&"right"===g&&Object(o.createElement)(U.a,{icon:f,size:h}),v);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(V,{text:k||j,shortcut:w,position:O},A),k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,A,k&&Object(o.createElement)(Y.a,null,Object(o.createElement)("span",{id:L},k)))}))},function(e,t){e.exports=window.wp.dom},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(5),o=r(9),c=r(0),i=r(28),s=r(74);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,b],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,b,p,u]);return null!==f&&(d.current=f),d.current}},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 s(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 a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!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 m(e,t){this.fun=e,this.array=t}function f(){}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];l.push(new m(e,t)),1!==l.length||u||s(b)},m.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=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,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,"a",(function(){return o})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return a}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!n)return;c||(c=document.body);const s=new n(e,{bubbles:r,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"number"==typeof e},function(e,t){e.exports=window.wp.blockEditor},,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0);r(106);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==r.current&&((e,t)=>{const{focusableSelector:r}=t||{};window&&Number.isFinite(window.innerHeight)&&(r?((e,t)=>{var r;const n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){const e=n[0];i(e),null==e||e.focus()}else i(e)})(e,r):i(e))})(r.current,e)}})))}},,,function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return g}));var n=r(0),o=(r(8),r(9)),c=r(31),i=r(18),s=r(10),a=r.n(s),l=r(4),u=r.n(l),d=r(121);r(78);const p=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""};var b=e=>{let{className:t,notices:r,removeNotice:o}=e;const c=r.filter(e=>"snackbar"!==e.type);if(!c.length)return null;const i=u()(t,"wc-block-components-notices");return Object(n.createElement)("div",{className:i},c.map(e=>Object(n.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(n.createContext)({notices:[],createNotice:(e,t,r)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),f=()=>Object(n.useContext)(m),g=e=>{let{children:t,className:r="",createNoticeContainer:s=!0,context:a="wc/core"}=e;const{createNotice:l,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,p]=Object(n.useState)(!1),{dispatchStoreEvent:f}=Object(c.a)(),{isEditor:g}=Object(i.a)(),h=Object(n.useCallback)((function(){let 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]:{};l(e,t,{...r,context:r.context||a}),f("store-notice-create",{status:e,content:t,options:r})}),[l,f,a]),E=Object(n.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;u(e,t)}),[u,a]),{notices:O}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),w={notices:O,createNotice:h,removeNotice:E,context:a,setIsSuppressed:p},j=d?null:Object(n.createElement)(b,{className:r,notices:w.notices,removeNotice:w.removeNotice,isEditor:g});return Object(n.createElement)(m.Provider,{value:w},s&&j,t)}},,,,,,,,,,,,,,,function(e,t,r){"use strict";var n=r(0),o=r(14);const 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){e.exports=window.wp.blocks},function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},,function(e,t){},,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o),i=r(22),s=r(13);r(122),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:o="",onChange:s,options:a,screenReaderLabel:l,value:u}=e;const d="wc-block-components-sort-select__select-"+r;return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.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:s,value:u},a&&a.map(e=>Object(n.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,,function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(48),o=(r(32),r(2));const c=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),i=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),c=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(c[r]="")}),c}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,function(e,t,r){"use strict";var n=r(0),o=r(6),c=r(4),i=r.n(c),s=r(1),a=r(20),l=r(94),u=r(53);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:r,spokenMessage:c=r,onRemove:p=o.noop,isDismissible:b=!0,actions:m=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(a.speak)(r,t)},[r,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});return g&&(r=Object(n.createElement)(n.RawHTML,null,r)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},r,Object(n.createElement)("div",{className:"components-notice__actions"},m.map(({className:e,label:t,isPrimary:r,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(d=a?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:s,className:i()("components-notice__action",e)},t)}))),b&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},function(e,t){},,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(16),o=r(0),c=r(47);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(47)]).then(r.bind(null,377)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(46).then(r.bind(null,416)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(54).then(r.bind(null,417)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(48).then(r.bind(null,378)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(44).then(r.bind(null,379)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(52).then(r.bind(null,380)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(49).then(r.bind(null,307)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(50).then(r.bind(null,381)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(45).then(r.bind(null,382)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(53).then(r.bind(null,383)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(51).then(r.bind(null,384)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(58),r.e(43)]).then(r.bind(null,404)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(215)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(79),c=r(51),i=r(3),s=(r(8),r(1)),a=r(6),l=r(4),u=r.n(l),d=r(22);r(193);var p=e=>{let{currentPage:t,displayFirstAndLastPages:r=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:i,totalPages:a}=e,{minIndex:l,maxIndex:p}=((e,t,r)=>{if(r<=2)return{minIndex:null,maxIndex:null};const 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}})(c,t,a);const b=r&&Boolean(1!==l),m=r&&Boolean(p!==a),f=r&&Boolean(l&&l>3),g=r&&Boolean(p&&p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const h=[];if(l&&p)for(let e=l;e<=p;e++)h.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(d.a,{screenReaderLabel:Object(s.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:u()("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:()=>i(1),disabled:1===t},Object(n.createElement)(d.a,{label:"1",screenReaderLabel:Object(s.sprintf)(
|
4 |
/* translators: %d is the page number (1, 2, 3...). */
|
5 |
Object(s.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(n.createElement)("button",{key:e,className:u()("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?void 0:()=>i(e),disabled:t===e},Object(n.createElement)(d.a,{label:e.toString(),screenReaderLabel:Object(s.sprintf)(
|
6 |
/* translators: %d is the page number (1, 2, 3...). */
|
7 |
Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),m&&Object(n.createElement)("button",{className:u()("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:()=>i(a),disabled:t===a},Object(n.createElement)(d.a,{label:a.toString(),screenReaderLabel:Object(s.sprintf)(
|
8 |
/* translators: %d is the page number (1, 2, 3...). */
|
9 |
-
Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(n.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))},b=r(
|
10 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
11 |
-
Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(B))},[null==V?void 0:V.totalQuery,B,o,H]);const{contentVisibility:
|
1 |
+
!function(e){function t(t){for(var r,o,c=t[0],i=t[1],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(a&&a(t);l.length;)l.shift()()}var r={},n={8:0,6: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,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--cart-blocks/line-items--cart-blocks/order-summary--checkout-blocks/order-summary--checkout--6efbf40e",1:"vendors--cart-blocks/order-summary--checkout-blocks/billing-address--checkout-blocks/order-summary---4f3822fa",43:"product-add-to-cart",44:"product-button",45:"product-category-list",46:"product-image",47:"product-price",48:"product-rating",49:"product-sale-badge",50:"product-sku",51:"product-stock-indicator",52:"product-summary",53:"product-tag-list",54:"product-title",58:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"34a44c5636fb696b3e6e",1:"71c3ba275d087142a4e4",43:"fa9302017364cdd8fbd0",44:"41fcd682c155e14f443f",45:"b5a24ff72f85caf3c0e9",46:"fb50925a4f6a212a9209",47:"1f06944784b2a69e0c7c",48:"b5e8c4b70339c7a8833b",49:"80d11d712ecd8d065568",50:"af9ca17f9403d039775c",51:"ddb398a565eb08438620",52:"3f41fe39cb2586efee2c",53:"e0043fc72c1ea5e60726",54:"34a56983553d592b4d1f",58:"b24c74df6337829012bd"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);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;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,r[1](a)}n[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}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 s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=188)}([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){e.exports=window.React},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 s in n)r.call(n,s)&&n[s]&&e.push(s);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.wc.wcBlocksData},function(e,t){e.exports=window.lodash},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.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.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},,function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(17),o=r.n(n),c=r(0),i=r(3),s=r(1),a=r(45),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(34);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:i,renderError:s,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(c.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},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.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);r(8);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:i,wrapperProps:s={}}=e;const a=null!=r,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,o)):(t=i||n.Fragment,a&&l&&r!==o?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,s,r))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},function(e,t,r){"use strict";(function(e){var n=r(0);r(40);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(63))},function(e,t){e.exports=window.wp.apiFetch},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(11),c=r.n(o);function i(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(6),o=r(0),c=r(5),i=r(8),s=r(19),a=r(115),l=r(18),u=r(68);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...m,email:""},g={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:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();b();const p=Object(i.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:g}=n(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,j=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingAddress:Object(a.a)(O),shippingAddress:Object(a.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){e.exports=window.wp.deprecated},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(41),o=r(0),c=r(29);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t){e.exports=window.wp.url},,function(e,t){},,function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(5),o=r(8),c=r(0),i=r(11),s=r.n(i),a=r(28),l=r(57),u=r(23);const d=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,r)=>{const i=Object(u.a)();r=r||i;const s=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[s,Object(c.useCallback)(t=>{a(r,e,t)},[r,e,a])]},b=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=d(t),i=Object(a.a)(n),p=Object(a.a)(e),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[n,o]:[e,o]}},,function(e,t){e.exports=window.wc.priceFormat},,function(e,t){e.exports=window.wp.warning},function(e,t){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(14),i=function({icon:e,className:t,...r}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:c},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(i,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...r});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...r}):e({size:t,...r});if(e&&("svg"===e.type||e.type===c.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(c.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return i})),r.d(t,"k",(function(){return s})),r.d(t,"m",(function(){return a})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return b})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return h})),r.d(t,"b",(function(){return E}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",s=c.pluginUrl+"build/",a=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),c=r(69),i=r(59);const s=Object(n.getSetting)("countryLocale",{}),a=e=>{const 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(o.sprintf)(
|
2 |
/* translators: %s Field label. */
|
3 |
+
Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(s).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,a(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=r&&void 0!==l[r]?l[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(10),o=r.n(n),c=r(0),i=r(15);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const a=n(e,r),l=s(e,r),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},,function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(4),i=r.n(c),s=r(6),a=r(30),l=r.n(a),u=r(13),d=r(52),p=r(92),b=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const c=o.getBoundingClientRect();return new n.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=r(24);function w(e){const t=Object(o.useContext)(O.a),r=t.slots[e]||{},n=t.fills[e],c=Object(o.useMemo)(()=>n||[],[n]);return{...r,updateSlot:Object(o.useCallback)(r=>{t.updateSlot(e,r)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(r=>{t.unregisterSlot(e,r)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(r=>{t.registerFill(e,r)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(r=>{t.unregisterFill(e,r)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:r,unregisterFill:n}){const c=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(j),[n,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),r(()=>{c(t(e))})),[e]),n})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,i.current),()=>n(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(n(i.current.name,i.current),i.current.name=e,r(e,i.current))},[e]),c&&c.node?(Object(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var y=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(v,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:r,registerSlot:n}=this.props;e.name!==t&&(r(e.name),n(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:r={},getFills:n}=this.props,c=Object(s.map)(n(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:c})=>Object(o.createElement)(_,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function C({name:e,children:t}){const r=w(e),n=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(r.registerFill(n),()=>{r.unregisterFill(n)}),[r.registerFill,r.unregisterFill]),r.ref&&r.ref.current?("function"==typeof t&&(t=t(r.fillProps)),Object(o.createPortal)(t,r.ref.current)):null}var S=Object(o.forwardRef)((function({name:e,fillProps:t={},as:r="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function N(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(C,e))}r(11),o.Component;const P=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(S,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function R(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=r?parseInt(r,10):0,a=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function B(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function A(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:v,getAnchorRect:y,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:C,__unstableStickyBoundaryElement:S,__unstableSlotName:P="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...z},H)=>{const W=Object(o.useRef)(null),V=Object(o.useRef)(null),Y=Object(o.useRef)(),U=Object(u.useViewportMatch)("medium","<"),[q,G]=Object(o.useState)(),K=w(P),X=_&&U,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return A(Y.current,"is-without-arrow",s),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis"),L(Y.current,"data-y-axis"),B(Y.current,"top"),B(Y.current,"left"),B(V.current,"maxHeight"),void B(V.current,"maxWidth");const e=()=>{if(!Y.current||!V.current)return;let e=function(e,t,r,n=!1,o,c){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==n?void 0:n.cloneRange))return m(Object(d.getRectangleFromRange)(n),n.endContainer.ownerDocument,c);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,c);return o?e:T(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(r.left,r.top,r.width,i.bottom-r.top),e.ownerDocument,c);return o?s:T(s,n)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(W,v,y,O,j,Y.current);if(!e)return;const{offsetParent:t,ownerDocument:r}=Y.current;let n,o=0;if(t&&t!==r.body){const r=t.getBoundingClientRect();o=r.top,e=new window.DOMRect(e.left-r.left,e.top-r.top,e.width,e.height)}var c;F&&(n=null===(c=Y.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:V.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,r="top",n,o,c,i,s,a){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,c,i,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:r,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===n?l=e.bottom:"top"===n&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={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};let b,m=r,f=null;if(!o&&!s)if("middle"===r&&u.contentHeight===a)m="middle";else if("top"===r&&d.contentHeight===a)m="top";else if("bottom"===r&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,n,0,c,s);return{...function(e,t,r,n,o,c,i,s,a){const{width:l}=t;"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.isRTL)()&&(r="left"),"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===n?p=e.right:"middle"===c||a||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let h,E=r,O=null;if(!o&&!s)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&f.contentWidth===l)E="left";else if("right"===r&&g.contentWidth===l)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-l),Object(b.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,n,p.yAxis,i,s,a),...p}}(e,i,f,S,Y.current,o,n,I,D);"number"==typeof l&&"number"==typeof u&&(B(Y.current,"top",l+"px"),B(Y.current,"left",u+"px")),A(Y.current,"is-without-arrow",s||"center"===p&&"middle"===g),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis",p),L(Y.current,"data-y-axis",g),B(V.current,"maxHeight","number"==typeof h?h+"px":""),B(V.current,"maxWidth","number"==typeof E?E+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const c=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",c),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new r.MutationObserver(e),l.observe(M,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",c),r.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[X,v,y,O,j,f,Z,S,M,F]);const $=(e,r)=>{if("focus-outside"===e&&C)C(r);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:$,onClose:$}),re=Object(u.useMergeRefs)([Y,ee,H]),ne=Boolean(x&&q)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:r=R(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:i()("components-popover",c,ne,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},z,{ref:re},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(Q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:V,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(N,{name:P},oe)),O||v?oe:Object(o.createElement)("span",{ref:W},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(P,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(s.isString)(e)&&(r=e),Object(s.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const D=Object(o.createElement)("div",{className:"event-catcher"}),z=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:r}),","),e),H=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),W=(e,t,r)=>{if(1!==o.Children.count(e))return;const n=o.Children.only(e);"function"==typeof n.props[t]&&n.props[t](r)};var V=function({children:e,position:t,text:r,shortcut:n}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{W(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{W(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),g=(t,r)=>n=>{if(W(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],n.type);o!==a&&(r?d(o):l(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?z:H)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:r,shortcut:n})})},Y=r(42),U=r(43);const q=["onMouseDown","onClick"];var Q=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:v,text:y,variant:_,__experimentalIsFocusable:x,describedBy:k,...C}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),n&&(null!==(u=s)&&void 0!==u||(s="tertiary")),r&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),S=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),N=m&&!x,P=void 0===r||N?"button":"a",R="a"===P?{href:r,target:c}:{type:"button",disabled:N,"aria-pressed":u};if(m&&x){R["aria-disabled"]=!0;for(const e of q)C[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!N&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=C["aria-describedby"]||L,A=Object(o.createElement)(P,Object(n.a)({},R,C,{className:S,"aria-label":C["aria-label"]||j,"aria-describedby":B,ref:t}),f&&"left"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),y&&Object(o.createElement)(o.Fragment,null,y),f&&"right"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),v);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(V,{text:k||j,shortcut:w,position:O},A),k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,A,k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k)))}))},function(e,t){e.exports=window.wp.dom},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(5),o=r(8),c=r(0),i=r(28),s=r(72);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,b],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,b,p,u]);return null!==f&&(d.current=f),d.current}},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 s(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 a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!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 m(e,t){this.fun=e,this.array=t}function f(){}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];l.push(new m(e,t)),1!==l.length||u||s(b)},m.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=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,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,"a",(function(){return o})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return a}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!n)return;c||(c=document.body);const s=new n(e,{bubbles:r,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"number"==typeof e},function(e,t){e.exports=window.wp.blockEditor},,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,r){"use strict";var n=r(10),o=r.n(n),c=r(0);r(104);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==r.current&&((e,t)=>{const{focusableSelector:r}=t||{};window&&Number.isFinite(window.innerHeight)&&(r?((e,t)=>{var r;const n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){const e=n[0];i(e),null==e||e.focus()}else i(e)})(e,r):i(e))})(r.current,e)}})))}},,,function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return g}));var n=r(0),o=r(8),c=r(31),i=r(18),s=r(10),a=r.n(s),l=r(4),u=r.n(l),d=r(119);r(76);const p=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""};var b=e=>{let{className:t,notices:r,removeNotice:o}=e;const c=r.filter(e=>"snackbar"!==e.type);if(!c.length)return null;const i=u()(t,"wc-block-components-notices");return Object(n.createElement)("div",{className:i},c.map(e=>Object(n.createElement)(d.a,a()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",p(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(n.createContext)({notices:[],createNotice:(e,t,r)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),f=()=>Object(n.useContext)(m),g=e=>{let{children:t,className:r="",createNoticeContainer:s=!0,context:a="wc/core"}=e;const{createNotice:l,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,p]=Object(n.useState)(!1),{dispatchStoreEvent:f}=Object(c.a)(),{isEditor:g}=Object(i.a)(),h=Object(n.useCallback)((function(){let 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]:{};l(e,t,{...r,context:r.context||a}),f("store-notice-create",{status:e,content:t,options:r})}),[l,f,a]),E=Object(n.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a;u(e,t)}),[u,a]),{notices:O}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(a)}),[a]),w={notices:O,createNotice:h,removeNotice:E,context:a,setIsSuppressed:p},j=d?null:Object(n.createElement)(b,{className:r,notices:w.notices,removeNotice:w.removeNotice,isEditor:g});return Object(n.createElement)(m.Provider,{value:w},s&&j,t)}},,,,,,,,,,,,,,,function(e,t,r){"use strict";var n=r(0),o=r(14);const 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){e.exports=window.wp.blocks},function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},,function(e,t){},,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o),i=r(22),s=r(13);r(120),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:o="",onChange:s,options:a,screenReaderLabel:l,value:u}=e;const d="wc-block-components-sort-select__select-"+r;return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.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:s,value:u},a&&a.map(e=>Object(n.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,,function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(46),o=(r(32),r(2));const c=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),i=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),c=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(c[r]="")}),c}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,function(e,t,r){"use strict";var n=r(0),o=r(6),c=r(4),i=r.n(c),s=r(1),a=r(20),l=r(92),u=r(51);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:r,spokenMessage:c=r,onRemove:p=o.noop,isDismissible:b=!0,actions:m=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(a.speak)(r,t)},[r,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});return g&&(r=Object(n.createElement)(n.RawHTML,null,r)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},r,Object(n.createElement)("div",{className:"components-notice__actions"},m.map(({className:e,label:t,isPrimary:r,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(d=a?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:s,className:i()("components-notice__action",e)},t)}))),b&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},function(e,t){},,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(16),o=r(0),c=r(45);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(47)]).then(r.bind(null,382)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(46).then(r.bind(null,422)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(54).then(r.bind(null,423)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(48).then(r.bind(null,383)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(44).then(r.bind(null,384)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(52).then(r.bind(null,385)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(49).then(r.bind(null,305)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(50).then(r.bind(null,386)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(45).then(r.bind(null,387)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(53).then(r.bind(null,388)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(51).then(r.bind(null,389)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(58),r.e(43)]).then(r.bind(null,410)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(215)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(77),c=r(49),i=r(3),s=r(1),a=r(6),l=r(4),u=r.n(l),d=r(22);r(191);var p=e=>{let{currentPage:t,displayFirstAndLastPages:r=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:i,totalPages:a}=e,{minIndex:l,maxIndex:p}=((e,t,r)=>{if(r<=2)return{minIndex:null,maxIndex:null};const 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}})(c,t,a);const b=r&&Boolean(1!==l),m=r&&Boolean(p!==a),f=r&&Boolean(l&&l>3),g=r&&Boolean(p&&p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const h=[];if(l&&p)for(let e=l;e<=p;e++)h.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(d.a,{screenReaderLabel:Object(s.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:u()("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:()=>i(1),disabled:1===t},Object(n.createElement)(d.a,{label:"1",screenReaderLabel:Object(s.sprintf)(
|
4 |
/* translators: %d is the page number (1, 2, 3...). */
|
5 |
Object(s.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(n.createElement)("button",{key:e,className:u()("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?void 0:()=>i(e),disabled:t===e},Object(n.createElement)(d.a,{label:e.toString(),screenReaderLabel:Object(s.sprintf)(
|
6 |
/* translators: %d is the page number (1, 2, 3...). */
|
7 |
Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),m&&Object(n.createElement)("button",{className:u()("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:()=>i(a),disabled:t===a},Object(n.createElement)(d.a,{label:a.toString(),screenReaderLabel:Object(s.sprintf)(
|
8 |
/* translators: %d is the page number (1, 2, 3...). */
|
9 |
+
Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(n.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))},b=r(57),m=r(36),f=r(62),g=r(5),h=r(8),E=r(28);var O=r(31),w=r(73),j=r(44),v=r(20),y=r(102),_=r(14),x=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(n.createElement)(_.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),k=()=>{const{parentClassName:e}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(y.a,{className:e+"__no-products-image",icon:x,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(s.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},C=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(_.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),S=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:r}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:r+"__no-products"},Object(n.createElement)(y.a,{className:r+"__no-products-image",icon:C,size:100}),Object(n.createElement)("strong",{className:r+"__no-products-title"},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:r+"__no-products-description"},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(s.__)("Reset Search","woo-gutenberg-products-block")))},N=r(106);r(190);var P=e=>{let{onChange:t,value:r}=e;return Object(n.createElement)(N.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",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")}],screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:r})},R=r(13),T=r(10),L=r.n(T),B=r(129);const A=(e,t,r,o)=>{if(!r)return;const c=Object(B.a)(e);return r.map((r,i)=>{let[s,a={}]=r,l=[];a.children&&a.children.length>0&&(l=A(e,t,a.children,o));const u=c[s];if(!u)return null;const d=t.id||0,p=["layout",s,i,o,d];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(u,L()({},a,{children:l,product:t})))})};var M=Object(R.withInstanceId)(e=>{let{product:t={},attributes:r,instanceId:o}=e;const{layoutConfig:c}=r,{parentClassName:i,parentName:s}=Object(j.useInnerBlockLayoutContext)(),a=0===Object.keys(t).length,l=u()(i+"__product","wc-block-layout",{"is-loading":a});return Object(n.createElement)("li",{className:l,"aria-hidden":a},A(s,t,c,o))});r(189);const F=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"}}},I=function(e){let{totalQuery:t,totalProducts:r}=e,{totalQuery:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(a.isEqual)(t,n)&&Number.isFinite(r)};var D=Object(w.a)(e=>{let{attributes:t,currentPage:r,onPageChange:o,onSortChange:c,sortValue:i,scrollToTop:l}=e;const[d,w]=Object(m.b)("attributes",[]),[y,_]=Object(m.b)("stock_status",[]),[x,C]=Object(m.b)("min_price"),[N,R]=Object(m.b)("max_price"),[T]=Object(m.c)((e=>{let{sortValue:t,currentPage:r,attributes:n}=e;const{columns:o,rows:c}=n;return{...F(t),catalog_visibility:"catalog",per_page:o*c,page:r}})({attributes:t,sortValue:i,currentPage:r})),{products:L,totalProducts:B,productsLoading:A}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:r,isLoading:n}=Object(f.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:r,resourceName:n,resourceValues:o=[],query:c={}}=t;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(E.a)(c),s=Object(E.a)(o),{value:a,isLoading:l=!0}=Object(h.useSelect)(e=>{const t=e(g.COLLECTIONS_STORE_KEY),o=["x-wp-total",r,n,i,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",r,n,s,i]);return{value:a,isLoading:l}})(0,{...t,query:e});return{products:r,totalProducts:parseInt(o,10),productsLoading:n}})(T),{parentClassName:D,parentName:z}=Object(j.useInnerBlockLayoutContext)(),H=(e=>{const{order:t,orderby:r,page:n,per_page:o,...c}=e;return c||{}})(T),{dispatchStoreEvent:W}=Object(O.a)(),V=Object(b.a)({totalQuery:H,totalProducts:B},I);Object(n.useEffect)(()=>{W("product-list-render",{products:L,listName:z})},[L,z,W]),Object(n.useEffect)(()=>{Object(a.isEqual)(H,null==V?void 0:V.totalQuery)||(o(1),null!=V&&V.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(v.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(v.speak)(Object(s.sprintf)(
|
10 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
11 |
+
Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(B))},[null==V?void 0:V.totalQuery,B,o,H]);const{contentVisibility:Y}=t,U=t.columns*t.rows,q=!Number.isFinite(B)&&Number.isFinite(null==V?void 0:V.totalProducts)&&Object(a.isEqual)(H,null==V?void 0:V.totalQuery)?Math.ceil(((null==V?void 0:V.totalProducts)||0)/U):Math.ceil(B/U),Q=L.length?L:Array.from({length:U}),G=0!==L.length||A,K=d.length>0||y.length>0||Number.isFinite(x)||Number.isFinite(N);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:r,alignButtons:n,align:o}=t,c=void 0!==o?"align"+o:"";return u()(D,c,"has-"+e+"-columns",{"has-multiple-rows":r>1,"has-aligned-buttons":n})})()},(null==Y?void 0:Y.orderBy)&&G&&Object(n.createElement)(P,{onChange:c,value:i}),!G&&K&&Object(n.createElement)(S,{resetCallback:()=>{w([]),_([]),C(null),R(null)}}),!G&&!K&&Object(n.createElement)(k,null),G&&Object(n.createElement)("ul",{className:D+"__products"},Q.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(M,{key:e.id||r,attributes:t,product:e})}))),q>1&&Object(n.createElement)(p,{currentPage:r,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:q}))}),z=e=>{let{attributes:t}=e;const[r,o]=Object(n.useState)(1),[c,i]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{i(t.orderby)},[t.orderby]),Object(n.createElement)(D,{attributes:t,currentPage:r,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const r=null==e||null===(t=e.target)||void 0===t?void 0:t.value;i(r),o(1)},sortValue:c})};const H=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"}));class W extends i.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?H:Object(n.createElement)(j.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(z,{attributes:e,urlParameterSuffix:t}))}}var V=W;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(n.createElement)(o.a,{context:"wc/all-products"},Object(n.createElement)(V,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
|
build/all-products.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-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', '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-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'fef6b89b8c6ba9b565baa8b316074bd7');
|
build/all-products.js
CHANGED
@@ -1,36 +1,36 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,20:0,23:0,27:0,28:0,30:0,31:0,32:0,34:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-add-to-cart--product-button--product-image--product-title",4:"product-sale-badge",18:"product-add-to-cart",20:"product-button",23:"product-category-list",24:"product-image",27:"product-price",28:"product-rating",30:"product-sku",31:"product-stock-indicator",32:"product-summary",34:"product-tag-list",35:"product-title"}[e]||e)+".js?ver="+{1:"
|
2 |
/* Translators: %s search term */
|
3 |
noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
|
4 |
/* translators: Number of items selected from list. */
|
5 |
-
Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(r.createElement)(r.Fragment,{key:c},Object(r.createElement)("strong",null,t),e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.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,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},,,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(18),o=c(12),n=c.n(o),a=c(7),s=c(2),l=c(22);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return n}));var r=c(1);const o=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},n=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(31);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c.n(r),n=c(0),a=c(20);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},,function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"c",(function(){return d}));var r=c(49);let o,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(o||(o={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,s=e=>a(e,o.SUCCESS),l=e=>a(e,o.ERROR),i=e=>a(e,o.FAIL),u=e=>!Object(r.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(127),s=c(4),l=c.n(s);c(130);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(7),o=c(0),n=c(15),a=c(13),s=c(17),l=c(218),i=c(44),u=c(217);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={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:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wc.wcBlocksRegistry},,function(e,t,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"a",(function(){return b}));var r=c(6),o=c(53),n=c(121),a=c(49),s=c(85);const l=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(a.a)(e)?e:{},i=e=>{if(!Object(o.b)()||!Object(s.a)())return{style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(a.a)(e)?e:{},c=l(t.style),r=Object(a.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},d=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})},b=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,function(e,t){e.exports=window.wp.a11y},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(13);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(114);const n=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:n}=Object(o.b)(),a=Object(r.useRef)(e);Object(r.useEffect)(()=>{a.current=e},[e]);const s=Object(r.useMemo)(()=>({hasNoticesOfType:e=>a.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),l=Object(r.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...s,...l,setIsSuppressed:n}}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(25),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(52),o=c(0),n=c(38);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},function(e,t){e.exports=window.wp.hooks},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var r=c(14),o=c(22);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=(e,t)=>{if(o.n>1)return Object(r.registerBlockType)(e,t)},s=()=>o.n>2,l=()=>o.n>1},,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(3),i=c(9);c(89);class u extends n.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:r,help:a,options:i,value:u}=this.props,d="inspector-toggle-button-control-"+c;let b;return a&&(b="function"==typeof a?a(t):a),Object(n.createElement)(l.BaseControl,{id:d,help:b,className:s()("components-toggle-button-control",r)},Object(n.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},e),Object(n.createElement)(l.ButtonGroup,{"aria-labelledby":d+"__label"},i.map((t,c)=>{const r={};return u===t.value?(r.isPrimary=!0,r["aria-pressed"]=!0):(r.isSecondary=!0,r["aria-pressed"]=!1),Object(n.createElement)(l.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},r),t.label)})))}}t.a=Object(i.withInstanceId)(u)},,function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.autop},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(7),a=(c(10),c(3));t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(o.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,,,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(135),s=c(4),l=c.n(s),i=c(91);c(148),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},,,,,,function(e,t){e.exports=window.wp.dom},,function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(15),o=c(13),n=c(0),a=c(25),s=c.n(a),l=c(48),i=c(108),u=c(51);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(6);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},function(e,t){e.exports=window.wp.wordcount},,,function(e,t){},function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(156),a=c(121);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const 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(o.sprintf)(
|
6 |
/* translators: %s Field label. */
|
7 |
-
Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
-
Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(7);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}}
|
10 |
Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(33),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";var r=c(0),o=c(7),n=c(1),a=c(3),s=c(11);function l(e){let{level:t}=e;const c={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 c.hasOwnProperty(t)?Object(r.createElement)(s.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:c[t]})):null}class i extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(l,{level:e}),title:Object(n.sprintf)(
|
11 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
12 |
-
Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:s}=this.props;return Object(r.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(l,{level:n}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,n,s))})}}t.a=i},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(
|
13 |
/* translators: %1$d is the number of variations of a product product. */
|
14 |
Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
|
15 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
16 |
-
Object(a._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)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},,,,function(e,t,c){"use strict";c.d(t,"b",(function(){return g})),c.d(t,"a",(function(){return O}));var r=c(0),o=(c(10),c(13)),n=c(50),a=c(44),s=c(5),l=c.n(s),i=c(4),u=c.n(i),d=c(504);c(145);const b=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""};var p=e=>{let{className:t,notices:c,removeNotice:o}=e;const n=c.filter(e=>"snackbar"!==e.type);if(!n.length)return null;const a=u()(t,"wc-block-components-notices");return Object(r.createElement)("div",{className:a},n.map(e=>Object(r.createElement)(d.a,l()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",b(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(r.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),g=()=>Object(r.useContext)(m),O=e=>{let{children:t,className:c="",createNoticeContainer:s=!0,context:l="wc/core"}=e;const{createNotice:i,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,b]=Object(r.useState)(!1),{dispatchStoreEvent:g}=Object(n.a)(),{isEditor:O}=Object(a.b)(),j=Object(r.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i(e,t,{...c,context:c.context||l}),g("store-notice-create",{status:e,content:t,options:c})}),[i,g,l]),h=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;u(e,t)}),[u,l]),{notices:_}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(l)}),[l]),E={notices:_,createNotice:j,removeNotice:h,context:l,setIsSuppressed:b},w=d?null:Object(r.createElement)(p,{className:c,notices:E.notices,removeNotice:E.removeNotice,isEditor:O});return Object(r.createElement)(m.Provider,{value:E},s&&w,t)}},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(17),s=c(4),l=c.n(s);c(146),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",rel:i,style:u,onClick:d,...b}=e;const p=l()("wc-block-components-product-name",t);if(c){const e=b;return Object(n.createElement)("span",o()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:p,href:s,rel:i},b,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:u}))}},function(e,t,c){"use strict";var r=c(0),o=c(86),n=c(61);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(25),a=c.n(n);const s=Object(r.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(r.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(r.useState)({}),l=Object(r.useCallback)(e=>c[e],[c]),i=Object(r.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(r.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...r}=t;return r})},[]),d=Object(r.useCallback)(()=>{n({})},[]),b=Object(r.useCallback)(e=>{e&&n(t=>(e=Object(o.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),p=Object(r.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const r={...c[e],...t};return a()(c[e],r)?c:{...c,[e]:r}})},[]),m={getValidationError:l,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!0})},[p]),showValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!1})},[p]),showAllValidationErrors:Object(r.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(r.createElement)(s.Provider,{value:m},t)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(29),s=c(9);c(153),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(15),o=c(13),n=c(0),a=c(48),s=c(125);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},,,,function(e,t){},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(173),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,function(e,t){},,function(e,t){},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,function(e,t){},,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(22),s=c(26),l=c(123),i=c(27);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t,c){"use strict";c.r(t);var r=c(0),o=(c(10),c(1)),n=c(4),a=c.n(n),s=c(29),l=c(28),i=c(57),u=(c(318),c(41));t.default=Object(i.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)(),d=Object(u.a)(e),b=Object(u.b)(e),p=Object(u.d)(e),m=Object(u.c)(e);if(!i.id||!i.on_sale)return null;const g="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,g,{[n+"__product-onsale"]:n},b.className,d.className),style:{...b.style,...d.style,...p.style,...m.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=(c(10),c(117));c(169);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(o.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:s(n)},t))}},,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(90),o=(c(18),c(2));const n=(e,t)=>Object.keys(o.defaultAddressFields).every(c=>e[c]===t[c]),a=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(93);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const r=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=c(35);const n=async(e,t,c)=>{const o=r(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=r(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(o.a)(t)||Object(o.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(11);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.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=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},,function(e,t,c){"use strict";var r=c(53);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"},color:{type:"string"},customColor:{type:"string"},fontSize:{type:"string"},customFontSize:{type:"number"}}),t.a=o},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(28),s=c(53),l=c(57),i=c(115),u=c(50),d=(c(317),c(41));const b=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,align:l}=e,{parentClassName:p}=Object(a.useInnerBlockLayoutContext)(),{product:m}=Object(a.useProductDataContext)(),{dispatchStoreEvent:g}=Object(u.a)(),O=Object(d.b)(e),j=Object(d.c)(e),h=Object(d.d)(e);return m.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...j.style,...h.style,...O.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:m.name,permalink:m.permalink,rel:o?"nofollow":"",onClick:()=>{g("product-view-link",{product:m})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...j.style,...h.style,...O.style}:{}})})},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}}},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=(c(10),c(1)),s=c(4),l=c.n(s),i=c(2),u=c(28),d=c(57),b=c(50),p=c(205),m=(c(319),c(41));const g=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),O=e=>{let{image:t,onLoad:c,loaded:r,showFullSize:a,fallbackAlt:s}=e;const{thumbnail:l,src:i,srcset:u,sizes:d,alt:b}=t||{},p={alt:b||s,onLoad:c,hidden:!r,src:l,...a&&{src:i,srcSet:u,sizes:d}};return Object(n.createElement)(n.Fragment,null,p.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},p)),!r&&Object(n.createElement)(g,null))};t.a=Object(d.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[j,h]=Object(n.useState)(!1),{dispatchStoreEvent:_}=Object(b.a)(),E=Object(m.d)(e),w=Object(m.a)(e),f=Object(m.c)(e);if(!d.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(g,null));const k=!!d.images.length,y=k?d.images[0]:null,v=r?"a":n.Fragment,S=Object(a.sprintf)(
|
17 |
/* translators: %s is referring to the product name */
|
18 |
-
Object(a.__)("Link to %s","woo-gutenberg-products-block"),d.name),C={href:d.permalink,rel:"nofollow",...!k&&{"aria-label":S},onClick:()=>{_("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(v,r&&C,!!o&&Object(n.createElement)(p.default,{align:s,product:d}),Object(n.createElement)(O,{fallbackAlt:d.name,image:y,onLoad:()=>h(!0),loaded:j,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var r=c(0),o=
|
19 |
/* translators: %s number of products in cart. */
|
20 |
-
Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(ue.a,{icon:de.a}))};var Oe=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=J(),{parentName:b}=Object(ae.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(be.a)(),{cartQuantity:m}=Object(pe.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm(),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},je=c(
|
21 |
/* translators: %f is referring to the average rating value */
|
22 |
-
Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),
|
23 |
/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
|
24 |
-
Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",
|
25 |
/* translators: %s number of products in cart. */
|
26 |
-
Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(d.decodeEntities)((null==j?void 0:j.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),x=S?"button":"a",P={};return S?P.onClick=()=>{y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(p.getSetting)("productsSettings");e&&(window.location.href=b.d)}:(P.href=O,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(x,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...m.style},disabled:k},P),N)},h=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(g.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(m.useInnerBlockLayoutContext)(),{product:r}=Object(m.useProductDataContext)(),o=Object(O.b)(e),a=Object(O.a)(e),l=Object(O.d)(e),i=Object(O.c)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(j,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(h,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=
|
27 |
/* translators: %d stock amount (number of items in stock for product) */
|
28 |
-
Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(b):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(d,p))})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var r=c(0),o=c(13),n=c(15),a=c(17),s=c(38),l=c(45);const i=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},u=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:u}=Object(s.a)(),{addErrorNotice:d,removeNotice:b}=Object(l.a)(),[p,m]=Object(r.useState)(!1),g=Object(r.useRef)(i(c,e));return Object(r.useEffect)(()=>{const t=i(c,e);t!==g.current&&(g.current=t)},[c,e]),{cartQuantity:Number.isFinite(g.current)?g.current:0,addingToCart:p,cartIsLoading:u,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return m(!0),t(e,c).then(()=>{b("add-to-cart")}).catch(e=>{d(Object(a.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{m(!1)})}}}},,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(22);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("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:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],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(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,,,function(e,t,c){e.exports=c(444)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"blockSettings",(function(){return $t}));var r=c(5),o=c.n(r),n=c(0),a=c(1),s=c(6),l=c(14),i=c(112),u=c(500),d=c(53),b=c(4),p=c.n(b),m={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},g=c(258),O=c(3),j=c(9),h=c(100),_=c(259),E=c(110),w=c(138),f=c(28);c(368);var k=e=>t=>c=>{const r=Object(f.useProductDataContext)(),{attributes:o,setAttributes:l}=c,{productId:i}=o,[u,d]=Object(n.useState)(!i);return r.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(O.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(E.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(O.Button,{isSecondary:!0,disabled:!i,onClick:()=>{d(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,null,Object(n.createElement)(w.a,{onClick:()=>d(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=c(501);const v=Object(a.__)("Product Title","woo-gutenberg-products-block"),S=Object(n.createElement)(i.a,{icon:y.a,className:"wc-block-editor-components-block-icon"}),C=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(369);const N=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i}=t;return Object(n.createElement)("div",r,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:o,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var x=Object(d.b)()?Object(j.compose)([k({icon:S,label:v,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(N):N;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(85);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:x,save:P,supports:{...m.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(269),A=c(502);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{icon:A.a,className:"wc-block-editor-components-block-icon"}),D=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block");var V=k({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)();return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(n.createElement)("div",r,Object(n.createElement)(I.default,t)))});let F={productId:{type:"number",default:0}};Object(d.b)()&&(F={...F,textAlign:{type:"string"}});var M=F;const z={...m,apiVersion:2,title:B,description:D,icon:{src:L},attributes:M,edit:V,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...m.supports,...Object(d.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(l.registerBlockType)("woocommerce/product-price",z);var H=c(260);const q={...Object(d.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var G=c(58),Q=c(2),Y=c(261),U=c(503);const W=Object(a.__)("Product Image","woo-gutenberg-products-block"),$=Object(n.createElement)(i.a,{icon:U.a,className:"wc-block-editor-components-block-icon"}),K=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var J=k({icon:$,label:W,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:r,imageSizing:o,showSaleBadge:l,saleBadgeAlign:i}=t,u=Object(s.useBlockProps)();return Object(n.createElement)("div",u,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:r,onChange:()=>c({showProductLink:!r})}),Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(G.a,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,options:[{label:Object(a.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(a.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(a.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:e=>c({saleBadgeAlign:e})}),Object(n.createElement)(G.a,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(Q.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,options:[{label:Object(a.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(a.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:e=>c({imageSizing:e})}))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Y.a,t)))});const X={apiVersion:2,title:W,description:K,icon:{src:$},attributes:H.a,edit:J,supports:q,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-image",{...m,...X});var Z=c(270),ee=c(496);const te=Object(a.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(n.createElement)(i.a,{icon:ee.a,className:"wc-block-editor-components-block-icon"}),re=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var oe=k({icon:ce,label:te,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(n.createElement)("div",c,Object(n.createElement)(Z.default,t))});const ne={title:te,description:re,icon:{src:ce},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1}}},edit:oe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-rating",{...m,...ne});var ae=c(271),se=c(505);const le=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),ie=Object(n.createElement)(i.a,{icon:se.a,className:"wc-block-editor-components-block-icon"}),ue=Object(a.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block");var de=k({icon:ie,label:le,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ae.default,t)))});const be={apiVersion:2,title:le,description:ue,icon:{src:ie},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:de,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...be});var pe=c(272),me=c(506);const ge=Object(a.__)("Product Summary","woo-gutenberg-products-block"),Oe=Object(n.createElement)(i.a,{icon:me.a,className:"wc-block-editor-components-block-icon"}),je=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(370);var he=k({icon:Oe,label:ge,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(pe.default,t))});const _e={apiVersion:2,title:ge,description:je,icon:{src:Oe},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:he,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...m,..._e});var Ee=c(205),we=c(494);const fe=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),ke=Object(n.createElement)(i.a,{icon:we.a,className:"wc-block-editor-components-block-icon"}),ye=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ve=k({icon:ke,label:fe,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ee.default,t))});const Se={title:fe,description:ye,icon:{src:ke},apiVersion:2,supports:{html:!1,...Object(d.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ve,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...m,...Se});var Ce=c(102),Ne=c(273),xe=c(11),Pe=Object(n.createElement)(xe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Te=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Re=Object(n.createElement)(i.a,{icon:Pe,className:"wc-block-editor-components-block-icon"}),Ie={title:Te,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Re},attributes:{productId:{type:"number",default:0}},edit:k({icon:Re,label:Te,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Ce.a,null),Object(n.createElement)(Ne.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Ie});var Ae=c(274),Be=c(507);const Le=Object(a.__)("Product Category List","woo-gutenberg-products-block"),De=Object(n.createElement)(i.a,{icon:Be.a,className:"wc-block-editor-components-block-icon"}),Ve=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Fe=k({icon:De,label:Le,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ae.default,t)))});const Me={...m,apiVersion:2,title:Le,description:Ve,icon:{src:De},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},edit:Fe};Object(d.c)("woocommerce/product-category-list",Me);var ze=c(275),He=c(499);const qe=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),Ge=Object(n.createElement)(i.a,{icon:He.a,className:"wc-block-editor-components-block-icon"}),Qe=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Ye=k({icon:Ge,label:qe,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ze.default,t)))});const Ue={apiVersion:2,title:qe,description:Qe,icon:{src:Ge},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:Ye,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-tag-list",{...m,...Ue});var We=c(276),$e=c(508);const Ke=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Je=Object(n.createElement)(i.a,{icon:$e.a,className:"wc-block-editor-components-block-icon"}),Xe=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Ze=k({icon:Je,label:Ke,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(We.default,t))});const et={apiVersion:2,title:Ke,description:Xe,icon:{src:Je},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Ze,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...m,...et});var tt=c(481),ct=(c(256),c(263)),rt=c(227);const ot=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),nt=Object(n.createElement)(i.a,{icon:rt.a,className:"wc-block-editor-components-block-icon"}),at={title:ot,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:nt},edit:k({icon:nt,label:ot,description:Object(a.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:r}=Object(f.useProductDataContext)(),{className:o,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(o,"wc-block-components-product-add-to-cart")},Object(n.createElement)(Ce.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(tt.b)(r)?Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(O.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(O.Disabled,null,Object(n.createElement)(ct.a,t)))}),attributes:c(262).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...at});var st=c(24),lt=c.n(st),it=c(13),ut=(c(10),c(64)),dt=c(473),bt=c(355),pt=c(22);const mt=(e,t)=>{const{className:c,contentVisibility:r}=t;return p()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})};var gt=c(216);const Ot=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],jt=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?jt(e.innerBlocks):[]}]):[];var ht=c(8),_t=c(7),Et=c(29);c(376);var wt=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:r=!0,pagesToDisplay:o=3,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(o,t,l);const d=c&&Boolean(1!==i),b=c&&Boolean(u!==l),m=c&&Boolean(i&&i>3),g=c&&Boolean(u&&u<l-2);d&&3===i&&(i-=1),b&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(Et.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(Et.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),d&&Object(n.createElement)("button",{className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>s(1),disabled:1===t},Object(n.createElement)(Et.a,{label:"1",screenReaderLabel:Object(a.sprintf)(
|
29 |
/* translators: %d is the page number (1, 2, 3...). */
|
30 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>s(e),disabled:t===e},Object(n.createElement)(Et.a,{label:e.toString(),screenReaderLabel:Object(a.sprintf)(
|
31 |
/* translators: %d is the page number (1, 2, 3...). */
|
32 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),b&&Object(n.createElement)("button",{className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===l,"wc-block-components-pagination__page--active":t===l}),onClick:()=>s(l),disabled:t===l},Object(n.createElement)(Et.a,{label:l.toString(),screenReaderLabel:Object(a.sprintf)(
|
33 |
/* translators: %d is the page number (1, 2, 3...). */
|
34 |
-
Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(Et.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},ft=c(
|
35 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
36 |
-
Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(E))},[null==C?void 0:C.totalQuery,E,r,v]);const{contentVisibility:N}=t,x=t.columns*t.rows,P=!Number.isFinite(E)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(_t.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/x):Math.ceil(E/x),T=_.length?_:Array.from({length:x}),R=0!==_.length||w,I=i.length>0||d.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return p()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==N?void 0:N.orderBy)&&R&&Object(n.createElement)(Bt,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(It,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Tt,null),R&&Object(n.createElement)("ul",{className:k+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Dt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(wt,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),r(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Mt,o()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];Nt(e),null==e||e.focus()}else Nt(e)})(e,c):Nt(e))})(t.current,e)}})))}),Ht=e=>{let{attributes:t}=e;const[c,r]=Object(n.useState)(1),[o,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(zt,{attributes:t,currentPage:c,onPageChange:e=>{r(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),r(1)},sortValue:o})},qt=c(137);class Gt extends ht.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?qt.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(Ht,{attributes:e,urlParameterSuffix:t}))}}var Qt=Gt;c(373);class Yt extends n.Component{constructor(){super(...arguments),lt()(this,"state",{isEditing:!1,innerBlocks:[]}),lt()(this,"blockMap",Object(dt.a)("woocommerce/all-products")),lt()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),lt()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),lt()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),lt()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),lt()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:r,alignButtons:o}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(ut.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(Q.getSetting)("min_columns",1),maxColumns:Object(Q.getSetting)("max_columns",6),minRows:Object(Q.getSetting)("min_rows",1),maxRows:Object(Q.getSetting)("max_rows",6)})),Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(O.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),lt()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),lt()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(n.createElement)(O.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(O.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(f.ProductDataContextProvider,{product:bt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(O.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:jt(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{icon:u.a}),label:Object(a.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];Ot.map(e=>{let[t,r]=e;return c.push(Object(l.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),lt()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,r=this.getTitle(),o=this.getIcon();return c?Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Qt,{attributes:e})):((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(r,o)}),lt()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===pt.o.productCount?((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:Q.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:gt.a})),Object(n.createElement)(O.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,r):Object(n.createElement)("div",{className:mt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Ut=Object(j.compose)(O.withSpokenMessages,Object(it.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(it.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Yt);const Wt={columns:Object(Q.getSetting)("default_columns",3),rows:Object(Q.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ot,isPreview:!1},$t={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("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:Wt,edit:e=>Object(n.createElement)(Ut,e),save(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const r={"data-attributes":JSON.stringify(c)};return Object(n.createElement)("div",o()({className:mt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...$t,deprecated:[{attributes:Object.assign({},$t.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",o()({className:mt("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(39),o=c(0),n=c(22);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(27)]).then(c.bind(null,269)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(24)]).then(c.bind(null,531)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(35)]).then(c.bind(null,532)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(28)]).then(c.bind(null,270)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(3),c.e(20)]).then(c.bind(null,271)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,272)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(4)]).then(c.bind(null,205)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(30).then(c.bind(null,273)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(23)]).then(c.bind(null,274)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,275)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(31)]).then(c.bind(null,276)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(3),c.e(18)]).then(c.bind(null,533)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")}]);
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,20:0,23:0,27:0,28:0,30:0,31:0,32:0,34:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-add-to-cart--product-button--product-image--product-title",4:"product-sale-badge",18:"product-add-to-cart",20:"product-button",23:"product-category-list",24:"product-image",27:"product-price",28:"product-rating",30:"product-sku",31:"product-stock-indicator",32:"product-summary",34:"product-tag-list",35:"product-title"}[e]||e)+".js?ver="+{1:"241feb8b8764ca1dce0d",2:"ccf1798287972d1635ea",3:"ddfcb7bbe595034f5abb",4:"fe62495aafa13fbaea22",18:"0dcfa394131517f5824d",20:"19774acd4a71d83c2e60",23:"1f47076673e80ef0a118",24:"137806418b0f60b9ace8",27:"36aeb638419c74555815",28:"6bfebd6520bc6db40bfb",30:"76ef98cda2a94a68e0fd",31:"977a24ca224987060580",32:"e653c42709a83d0bd55f",34:"09800fcd64c33e60b14c",35:"59b27b1321fb4d7fc492"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=o[e];if(0!==c){if(c){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",l.name="ChunkLoadError",l.type=r,l.request=n,c[1](l)}o[e]=void 0}};var i=setTimeout((function(){n({type:"timeout",target:s})}),12e4);s.onerror=s.onload=n,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=r,a.d=function(e,t,c){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(c,r,function(t){return e[t]}.bind(null,r));return c},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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var u=l;return n.push([369,0]),c()}([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){e.exports=window.wp.components},,,function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.compose},,function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wc.wcBlocksData},,function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},,function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"c",(function(){return l})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(7),n=c(1);const a={clear:Object(n.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(n.__)("No items found.","woo-gutenberg-products-block"),
|
2 |
/* Translators: %s search term */
|
3 |
noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
|
4 |
/* translators: Number of items selected from list. */
|
5 |
+
Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(r.createElement)(r.Fragment,{key:c},Object(r.createElement)("strong",null,t),e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.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,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},,,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(18),o=c(12),n=c.n(o),a=c(7),s=c(2),l=c(22);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return n}));var r=c(1);const o=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},n=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(31);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c.n(r),n=c(0),a=c(20);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},,function(e,t,c){"use strict";c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"c",(function(){return d}));var r=c(50);let o,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(o||(o={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,s=e=>a(e,o.SUCCESS),l=e=>a(e,o.ERROR),i=e=>a(e,o.FAIL),u=e=>!Object(r.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(126),s=c(4),l=c.n(s);c(129);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(7),o=c(0),n=c(15),a=c(13),s=c(17),l=c(221),i=c(45),u=c(220);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={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:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"a",(function(){return b}));var r=c(6),o=c(54),n=c(120),a=c(50),s=c(82);const l=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(a.a)(e)?e:{},i=e=>{if(!Object(o.b)()||!Object(s.a)())return{style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(a.a)(e)?e:{},c=l(t.style),r=Object(a.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},d=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})},b=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},function(e,t){e.exports=window.wc.wcBlocksRegistry},,,,function(e,t){e.exports=window.wp.a11y},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(13);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(113);const n=()=>{const{notices:e,createNotice:t,removeNotice:c,setIsSuppressed:n}=Object(o.b)(),a=Object(r.useRef)(e);Object(r.useEffect)(()=>{a.current=e},[e]);const s=Object(r.useMemo)(()=>({hasNoticesOfType:e=>a.current.some(t=>t.type===e),removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||c(t.id)})},removeNotice:c}),[c]),l=Object(r.useMemo)(()=>({addDefaultNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("default",e,{...c})},addErrorNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("error",e,{...c})},addWarningNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("warning",e,{...c})},addInfoNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("info",e,{...c})},addSuccessNotice:function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t("success",e,{...c})}}),[t]);return{notices:e,...s,...l,setIsSuppressed:n}}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(25),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(53),o=c(0),n=c(38);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},function(e,t){e.exports=window.wp.hooks},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var r=c(14),o=c(22);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=(e,t)=>{if(o.n>1)return Object(r.registerBlockType)(e,t)},s=()=>o.n>2,l=()=>o.n>1},,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(3),i=c(9);c(90);class u extends n.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:r,help:a,options:i,value:u}=this.props,d="inspector-toggle-button-control-"+c;let b;return a&&(b="function"==typeof a?a(t):a),Object(n.createElement)(l.BaseControl,{id:d,help:b,className:s()("components-toggle-button-control",r)},Object(n.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},e),Object(n.createElement)(l.ButtonGroup,{"aria-labelledby":d+"__label"},i.map((t,c)=>{const r={};return u===t.value?(r.isPrimary=!0,r["aria-pressed"]=!0):(r.isSecondary=!0,r["aria-pressed"]=!1),Object(n.createElement)(l.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},r),t.label)})))}}t.a=Object(i.withInstanceId)(u)},function(e,t){e.exports=window.wp.deprecated},function(e,t){e.exports=window.wp.autop},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(7),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(o.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,,,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(135),s=c(4),l=c.n(s),i=c(92);c(149),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},,,,,,function(e,t){e.exports=window.wp.dom},,function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(15),o=c(13),n=c(0),a=c(25),s=c.n(a),l=c(49),i=c(107),u=c(52);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(6);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},,,,,,function(e,t){e.exports=window.wp.wordcount},,function(e,t){},function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(157),a=c(120);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const 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(o.sprintf)(
|
6 |
/* translators: %s Field label. */
|
7 |
+
Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(150),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(36),a=c(4),s=c.n(a),l=c(30);c(148);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
+
Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(7);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var r=c(5),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(111),i=c(494),u=c(4),d=c.n(u),b=c(9),p=c(20),m=c(33),g=c(493),O=c(17);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,w=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},w),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label.
|
10 |
Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(33),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";var r=c(0),o=c(7),n=c(1),a=c(3),s=c(11);function l(e){let{level:t}=e;const c={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 c.hasOwnProperty(t)?Object(r.createElement)(s.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:c[t]})):null}class i extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(l,{level:e}),title:Object(n.sprintf)(
|
11 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
12 |
+
Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:s}=this.props;return Object(r.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(l,{level:n}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,n,s))})}}t.a=i},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(111),a=c(219),s=c(2),l=c(6),i=c(28);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(8);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(1),s=c(7),l=c(33),i=c(96),u=c(9),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(205),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(26),h=c(27),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){const{products:t}=this.props;return t.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0].id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(32),w=c(4),f=c.n(w),k=c(98);c(152);const y={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const w=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:d,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,o()({},e,{className:f()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,countLabel:t.variations.length>0?Object(a.sprintf)(
|
13 |
/* translators: %1$d is the number of variations of a product product. */
|
14 |
Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
|
15 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
16 |
+
Object(a._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)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},,,,function(e,t,c){"use strict";c.d(t,"b",(function(){return g})),c.d(t,"a",(function(){return O}));var r=c(0),o=c(13),n=c(51),a=c(45),s=c(5),l=c.n(s),i=c(4),u=c.n(i),d=c(509);c(146);const b=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""};var p=e=>{let{className:t,notices:c,removeNotice:o}=e;const n=c.filter(e=>"snackbar"!==e.type);if(!n.length)return null;const a=u()(t,"wc-block-components-notices");return Object(r.createElement)("div",{className:a},n.map(e=>Object(r.createElement)(d.a,l()({key:"store-notice-"+e.id},e,{className:u()("wc-block-components-notices__notice",b(e)),onRemove:()=>{e.isDismissible&&o(e.id)}}),e.content)))};const m=Object(r.createContext)({notices:[],createNotice:(e,t,c)=>{},removeNotice:(e,t)=>{},setIsSuppressed:e=>{},context:"wc/core"}),g=()=>Object(r.useContext)(m),O=e=>{let{children:t,className:c="",createNoticeContainer:s=!0,context:l="wc/core"}=e;const{createNotice:i,removeNotice:u}=Object(o.useDispatch)("core/notices"),[d,b]=Object(r.useState)(!1),{dispatchStoreEvent:g}=Object(n.a)(),{isEditor:O}=Object(a.b)(),j=Object(r.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};i(e,t,{...c,context:c.context||l}),g("store-notice-create",{status:e,content:t,options:c})}),[i,g,l]),h=Object(r.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;u(e,t)}),[u,l]),{notices:_}=Object(o.useSelect)(e=>({notices:e("core/notices").getNotices(l)}),[l]),E={notices:_,createNotice:j,removeNotice:h,context:l,setIsSuppressed:b},w=d?null:Object(r.createElement)(p,{className:c,notices:E.notices,removeNotice:E.removeNotice,isEditor:O});return Object(r.createElement)(m.Provider,{value:E},s&&w,t)}},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(17),s=c(4),l=c.n(s);c(147),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",rel:i,style:u,onClick:d,...b}=e;const p=l()("wc-block-components-product-name",t);if(c){const e=b;return Object(n.createElement)("span",o()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:p,href:s,rel:i},b,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:u}))}},function(e,t,c){"use strict";var r=c(0),o=c(88),n=c(62);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(25),a=c.n(n);const s=Object(r.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(r.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(r.useState)({}),l=Object(r.useCallback)(e=>c[e],[c]),i=Object(r.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(r.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...r}=t;return r})},[]),d=Object(r.useCallback)(()=>{n({})},[]),b=Object(r.useCallback)(e=>{e&&n(t=>(e=Object(o.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),p=Object(r.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const r={...c[e],...t};return a()(c[e],r)?c:{...c,[e]:r}})},[]),m={getValidationError:l,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!0})},[p]),showValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!1})},[p]),showAllValidationErrors:Object(r.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(r.createElement)(s.Provider,{value:m},t)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(29),s=c(9);c(154),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(15),o=c(13),n=c(0),a=c(49),s=c(124);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},,,,function(e,t){},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(176),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,function(e,t){},,function(e,t){},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,,,function(e,t){},,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(22),s=c(26),l=c(122),i=c(27);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(29),l=c(28),i=c(59),u=(c(322),c(39));t.default=Object(i.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)(),d=Object(u.a)(e),b=Object(u.b)(e),p=Object(u.d)(e),m=Object(u.c)(e);if(!i.id||!i.on_sale)return null;const g="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,g,{[n+"__product-onsale"]:n},b.className,d.className),style:{...b.style,...d.style,...p.style,...m.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(116);c(172);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(o.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:s(n)},t))}},,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(91),o=(c(18),c(2));const n=(e,t)=>Object.keys(o.defaultAddressFields).every(c=>e[c]===t[c]),a=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(94);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const r=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=c(35);const n=async(e,t,c)=>{const o=r(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=r(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(o.a)(t)||Object(o.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,,,function(e,t,c){"use strict";var r=c(0),o=c(11);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.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=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},,function(e,t,c){"use strict";var r=c(54);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(28),s=c(54),l=c(59),i=c(114),u=c(51),d=(c(321),c(39));const b=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,align:l}=e,{parentClassName:p}=Object(a.useInnerBlockLayoutContext)(),{product:m}=Object(a.useProductDataContext)(),{dispatchStoreEvent:g}=Object(u.a)(),O=Object(d.b)(e),j=Object(d.c)(e),h=Object(d.d)(e);return m.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...j.style,...h.style,...O.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:m.name,permalink:m.permalink,rel:o?"nofollow":"",onClick:()=>{g("product-view-link",{product:m})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,O.className,"wc-block-components-product-title",{[p+"__product-title"]:p,["wc-block-components-product-title--align-"+l]:l&&Object(s.b)()}),style:Object(s.b)()?{...j.style,...h.style,...O.style}:{}})})},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}}},function(e,t,c){"use strict";var r=c(5),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(28),d=c(59),b=c(51),p=c(206),m=(c(323),c(39));const g=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),O=e=>{let{image:t,onLoad:c,loaded:r,showFullSize:a,fallbackAlt:s}=e;const{thumbnail:l,src:i,srcset:u,sizes:d,alt:b}=t||{},p={alt:b||s,onLoad:c,hidden:!r,src:l,...a&&{src:i,srcSet:u,sizes:d}};return Object(n.createElement)(n.Fragment,null,p.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},p)),!r&&Object(n.createElement)(g,null))};t.a=Object(d.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[j,h]=Object(n.useState)(!1),{dispatchStoreEvent:_}=Object(b.a)(),E=Object(m.d)(e),w=Object(m.a)(e),f=Object(m.c)(e);if(!d.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(g,null));const k=!!d.images.length,y=k?d.images[0]:null,v=r?"a":n.Fragment,S=Object(a.sprintf)(
|
17 |
/* translators: %s is referring to the product name */
|
18 |
+
Object(a.__)("Link to %s","woo-gutenberg-products-block"),d.name),C={href:d.permalink,rel:"nofollow",...!k&&{"aria-label":S},onClick:()=>{_("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(v,r&&C,!!o&&Object(n.createElement)(p.default,{align:s,product:d}),Object(n.createElement)(O,{fallbackAlt:d.name,image:y,onLoad:()=>h(!0),loaded:j,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(49),l=c(486);const i={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},u={status:i.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},d={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:b,SET_IDLE:p,SET_DISABLED:m,SET_PROCESSING:g,SET_BEFORE_PROCESSING:O,SET_AFTER_PROCESSING:j,SET_PROCESSING_RESPONSE:h,SET_HAS_ERROR:_,SET_NO_ERROR:E,SET_QUANTITY:w,SET_REQUEST_PARAMS:f}=d,k=()=>({type:p}),y=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?_:E;return{type:t}},{SET_PRISTINE:v,SET_IDLE:S,SET_DISABLED:C,SET_PROCESSING:N,SET_BEFORE_PROCESSING:x,SET_AFTER_PROCESSING:P,SET_PROCESSING_RESPONSE:T,SET_HAS_ERROR:R,SET_NO_ERROR:I,SET_QUANTITY:A,SET_REQUEST_PARAMS:B}=d,{PRISTINE:L,IDLE:D,DISABLED:V,PROCESSING:F,BEFORE_PROCESSING:M,AFTER_PROCESSING:z}=i,H=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:u,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case v:e=u;break;case S:e=t.status!==D?{...t,status:D}:t;break;case C:e=t.status!==V?{...t,status:V}:t;break;case A:e=c!==t.quantity?{...t,quantity:c}:t;break;case B:e={...t,requestParams:{...t.requestParams,...o}};break;case T:e={...t,processingResponse:o};break;case N:e=t.status!==F?{...t,status:F,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case x:e=t.status!==M?{...t,status:M,hasError:!1}:t;break;case P:e=t.status!==z?{...t,status:z}:t;break;case R:e=t.hasError?t:{...t,hasError:!0},e=t.status===F||t.status===M?{...e,status:D}:e;break;case I:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==v&&e.status===L&&(e.status=D),e};var q=c(94),G=c(222);const Q=e=>({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)});var Y=c(223),U=c(116),W=c(46),$=c(35);const K=Object(r.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:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),J=()=>Object(r.useContext)(K),X=e=>{var t,c,o,n;let{children:d,product:p,showFormElements:_}=e;const[E,v]=Object(r.useReducer)(H,u),[S,C]=Object(r.useReducer)(q.b,{}),N=Object(s.a)(S),{addErrorNotice:x,removeNotices:P}=Object(W.a)(),{setValidationErrors:T}=Object(U.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object($.c)(),B=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Q(C).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Q(C).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Q(C).onAddToCartBeforeProcessing}),[C]),L=Object(r.useMemo)(()=>({resetForm:()=>{v({type:b})},submitForm:()=>{v({type:O})},setQuantity:e=>{v((e=>({type:w,quantity:e}))(e))},setHasError:e=>{v(y(e))},setRequestParams:e=>{v((e=>({type:f,data:e}))(e))},setAfterProcessing:e=>{v({type:h,data:e}),v({type:j})}}),[]);Object(r.useEffect)(()=>{const e=E.status,t=!p.id||!Object(l.a)(p);e!==i.DISABLED||t?e!==i.DISABLED&&t&&v({type:m}):v(k())},[E.status,p,v]),Object(r.useEffect)(()=>{E.status===i.BEFORE_PROCESSING&&(P("error"),Object(Y.a)(N,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&x(t),c&&T(c)}),v(k())):v({type:g})}))},[E.status,T,x,P,v,N]),Object(r.useEffect)(()=>{if(E.status===i.AFTER_PROCESSING){const e={processingResponse:E.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(I(e)||A(e))&&c&&(t=!0,x(c,r?{context:r}:void 0))}),t};if(E.hasError)return void Object(Y.b)(N,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");x(t,{id:"add-to-cart"})}v(k())});Object(Y.b)(N,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?v(y(!0)):v(k())})}},[E.status,E.hasError,E.processingResponse,L,x,I,A,R,N]);const D=Object(l.b)(p),V={product:p,productType:p.type||"simple",productIsPurchasable:Object(l.a)(p),productHasOptions:p.has_options||!1,supportsFormElements:D,showFormElements:_&&D,quantity:E.quantity||(null==p||null===(t=p.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==p||null===(c=p.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==p||null===(o=p.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==p||null===(n=p.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:E.requestParams,isIdle:E.status===i.IDLE,isDisabled:E.status===i.DISABLED,isProcessing:E.status===i.PROCESSING,isBeforeProcessing:E.status===i.BEFORE_PROCESSING,isAfterProcessing:E.status===i.AFTER_PROCESSING,hasError:E.hasError,eventRegistration:B,dispatchActions:L};return Object(r.createElement)(K.Provider,{value:V},d)};var Z=c(12),ee=c.n(Z),te=c(17),ce=c(220),re=c(38),oe=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=J(),{hasValidationErrors:i,showAllValidationErrors:u}=Object(U.b)(),{addErrorNotice:d,removeNotice:b}=Object(W.a)(),{receiveCart:p}=Object(re.a)(),[m,g]=Object(r.useState)(!1),O=!n&&s,j=Object(r.useCallback)(()=>!i||(u(),{type:"error"}),[i,u]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(j,0);return()=>{e()}},[o,j]);const h=Object(r.useCallback)(()=>{g(!0),b("add-to-cart");const r={id:t.id||0,quantity:c,...l};ee()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(t=>{ee.a.setNonce(t.headers),t.json().then((function(c){t.ok?p(c):(c.body&&c.body.message?d(Object(te.decodeEntities)(c.body.message),{id:"add-to-cart"}):d(Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart"}),e.setHasError()),Object(ce.b)({preserveCartData:!0}),e.setAfterProcessing(c),g(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&p(t.data.cart),e.setHasError(),e.setAfterProcessing(t),g(!1)}))})},[t,d,b,p,e,c,l]);return Object(r.useEffect)(()=>{O&&!m&&h()},[O,h,m]),null};const ne=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(U.a,null,Object(r.createElement)(X,{product:c,showFormElements:o},t,Object(r.createElement)(oe,null)))};var ae=c(28),se=c(7),le=c(59),ie=(c(260),c(70)),ue=c(111),de=c(514),be=c(51),pe=c(332);const me=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ie.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},ge=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ie.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)(
|
19 |
/* translators: %s number of products in cart. */
|
20 |
+
Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(ue.a,{icon:de.a}))};var Oe=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=J(),{parentName:b}=Object(ae.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(be.a)(),{cartQuantity:m}=Object(pe.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm(),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(me,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},je=c(122),he=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(je.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},_e=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},Ee=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},we=(c(331),c(530)),fe=c(8),ke=c(207);const ye={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var ve=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:i,setValidationErrors:u,clearValidationError:d}=Object(U.b)(),b=t,p=i(b)||{};return Object(fe.useEffect)(()=>{o?d(b):u({[b]:{message:l,hidden:!0}})},[o,b,l,d,u]),Object(fe.useEffect)(()=>()=>{d(b)},[b,d]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(we.a,{label:Object(te.decodeEntities)(t),value:o||"",options:[ye,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":p.message&&!p.hidden})}),Object(r.createElement)(ke.a,{propertyName:b,elementId:b}))},Se=c(50);const Ce=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var Ne=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?Ce(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(te.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Se.a)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const r=e[t],o=r.terms.filter(e=>e.default);var n;o.length>0&&(c[r.name]=null===(n=o[0])||void 0===n?void 0:n.slug)}),c}(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>Ce(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(ve,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},xe=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(se.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(t.variations);return 0===Object.keys(o).length||0===n.length?null:Object(r.createElement)(Ne,{attributes:o,variationAttributes:n,setRequestParams:c.setRequestParams})},Pe=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=J();return e.id&&!e.is_purchasable?Object(r.createElement)(_e,null):e.id&&!e.is_in_stock?Object(r.createElement)(_e,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(xe,{product:e,dispatchers:s}),Object(r.createElement)(he,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(Oe,null))},Te=()=>Object(r.createElement)(Oe,null),Re=c(516),Ie=()=>Object(r.createElement)(Re.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Ae=()=>Object(r.createElement)(Ie,null);const Be=()=>{const{showFormElements:e,productType:t}=J();return e?"variable"===t?Object(r.createElement)(Pe,null):"grouped"===t?Object(r.createElement)(Ae,null):"external"===t?Object(r.createElement)(Te,null):"simple"===t||"variation"===t?Object(r.createElement)(Ee,null):null:Object(r.createElement)(Oe,null)};t.a=Object(le.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(ae.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(se.isEmpty)(o)});return Object(r.createElement)(ne,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Be,null)))})},,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(93),s=c(30),l=c(28),i=c(59),u=c(39);t.default=Object(i.withProductDataContext)(e=>{var t,c;const{className:o,textAlign:i}=e,{parentClassName:d}=Object(l.useInnerBlockLayoutContext)(),{product:b}=Object(l.useProductDataContext)(),p=Object(u.b)(e),m=Object(u.d)(e),g=n()("wc-block-components-product-price",o,p.className,{[d+"__product-price"]:d}),O={...m.style,...p.style};if(!b.id)return Object(r.createElement)(a.a,{align:i,className:g});const j=b.prices,h=Object(s.getCurrencyFromPriceResponse)(j),_=j.price!==j.regular_price,E=n()({[d+"__product-price__value"]:d,[d+"__product-price__value--on-sale"]:_});return Object(r.createElement)(a.a,{align:i,className:g,priceStyle:O,regularPriceStyle:O,priceClassName:E,currency:h,price:j.price,minPrice:null==j||null===(t=j.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==j||null===(c=j.price_range)||void 0===c?void 0:c.max_amount,regularPrice:j.regular_price,regularPriceClassName:n()({[d+"__product-price__regular"]:d})})})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(59),i=(c(324),c(39));t.default=Object(l.withProductDataContext)(e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),n=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(c),l=Object(i.b)(e),u=Object(i.d)(e),d=Object(i.c)(e);if(!n)return null;const b={width:n/5*100+"%"},p=Object(o.sprintf)(
|
21 |
/* translators: %f is referring to the average rating value */
|
22 |
+
Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),m=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(c),g={__html:Object(o.sprintf)(
|
23 |
/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
|
24 |
+
Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",m,"woo-gutenberg-products-block"),Object(o.sprintf)('<strong class="rating">%f</strong>',n),Object(o.sprintf)('<span class="rating">%d</span>',m))};return Object(r.createElement)("div",{className:a()(l.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...l.style,...u.style,...d.style}},Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":p},Object(r.createElement)("span",{style:b,dangerouslySetInnerHTML:g})))})},function(e,t,c){"use strict";c.r(t);var r=c(5),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(51),u=c(332),d=c(17),b=c(22),p=c(2),m=c(28),g=c(59),O=(c(325),c(39));const j=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:m}=e;const{id:g,permalink:O,add_to_cart:j,has_options:h,is_purchasable:_,is_in_stock:E}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:f,addingToCart:k,addToCart:y}=Object(u.a)(g),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(d.decodeEntities)((null==j?void 0:j.description)||""),N=v?Object(l.sprintf)(
|
25 |
/* translators: %s number of products in cart. */
|
26 |
+
Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(d.decodeEntities)((null==j?void 0:j.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),x=S?"button":"a",P={};return S?P.onClick=()=>{y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(p.getSetting)("productsSettings");e&&(window.location.href=b.d)}:(P.href=O,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(x,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...m.style},disabled:k},P),N)},h=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(g.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(m.useInnerBlockLayoutContext)(),{product:r}=Object(m.useProductDataContext)(),o=Object(O.b)(e),a=Object(O.a)(e),l=Object(O.d)(e),i=Object(O.c)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(j,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(h,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(115),s=c(22),l=c(28),i=c(59),u=(c(326),c(39));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const b=o.short_description?o.short_description:o.description;return b?Object(r.createElement)(a.a,{className:n()(t,i.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:b,maxLength:150,countType:s.o.wordCountType||"words",style:{...i.style,...d.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(59);c(327),t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(7),i=c(59),u=(c(328),c(39));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",i.className,{[c+"__product-category-list"]:c}),style:{...i.style,...d.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(7),i=c(59),u=(c(329),c(39));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,i.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...i.style,...d.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(59),i=(c(330),c(39));t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=Object(i.b)(e),u=Object(i.d)(e);if(!n.id||!n.is_purchasable)return null;const d=!!n.is_in_stock,b=n.low_stock_remaining,p=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,l.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":d,"wc-block-components-product-stock-indicator--out-of-stock":!d,"wc-block-components-product-stock-indicator--low-stock":!!b,"wc-block-components-product-stock-indicator--available-on-backorder":!!p}),style:{...l.style,...u.style}},b?(e=>Object(o.sprintf)(
|
27 |
/* translators: %d stock amount (number of items in stock for product) */
|
28 |
+
Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(b):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(d,p))})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var r=c(0),o=c(13),n=c(15),a=c(17),s=c(38),l=c(46);const i=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},u=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:u}=Object(s.a)(),{addErrorNotice:d,removeNotice:b}=Object(l.a)(),[p,m]=Object(r.useState)(!1),g=Object(r.useRef)(i(c,e));return Object(r.useEffect)(()=>{const t=i(c,e);t!==g.current&&(g.current=t)},[c,e]),{cartQuantity:Number.isFinite(g.current)?g.current:0,addingToCart:p,cartIsLoading:u,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return m(!0),t(e,c).then(()=>{b("add-to-cart")}).catch(e=>{d(Object(a.decodeEntities)(e.message),{context:"wc/all-products",id:"add-to-cart",isDismissible:!0})}).finally(()=>{m(!1)})}}}},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(22);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("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:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],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(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,,,function(e,t,c){e.exports=c(449)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"blockSettings",(function(){return $t}));var r=c(5),o=c.n(r),n=c(0),a=c(1),s=c(6),l=c(14),i=c(111),u=c(505),d=c(54),b=c(4),p=c.n(b),m={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},g=c(262),O=c(3),j=c(9),h=c(100),_=c(263),E=c(109),w=c(138),f=c(28);c(370);var k=e=>t=>c=>{const r=Object(f.useProductDataContext)(),{attributes:o,setAttributes:l}=c,{productId:i}=o,[u,d]=Object(n.useState)(!i);return r.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(O.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(E.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(O.Button,{isSecondary:!0,disabled:!i,onClick:()=>{d(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,null,Object(n.createElement)(w.a,{onClick:()=>d(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=c(506);const v=Object(a.__)("Product Title","woo-gutenberg-products-block"),S=Object(n.createElement)(i.a,{icon:y.a,className:"wc-block-editor-components-block-icon"}),C=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(371);const N=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i}=t;return Object(n.createElement)("div",r,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:o,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var x=Object(d.b)()?Object(j.compose)([k({icon:S,label:v,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(N):N;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(82);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:x,save:P,supports:{...m.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(273),A=c(507);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{icon:A.a,className:"wc-block-editor-components-block-icon"}),D=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block");var V=k({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)();return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(n.createElement)("div",r,Object(n.createElement)(I.default,t)))});let F={productId:{type:"number",default:0}};Object(d.b)()&&(F={...F,textAlign:{type:"string"}});var M=F;const z={...m,apiVersion:2,title:B,description:D,icon:{src:L},attributes:M,edit:V,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...m.supports,...Object(d.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(l.registerBlockType)("woocommerce/product-price",z);var H=c(264);const q={...Object(d.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var G=c(60),Q=c(2),Y=c(265),U=c(508);const W=Object(a.__)("Product Image","woo-gutenberg-products-block"),$=Object(n.createElement)(i.a,{icon:U.a,className:"wc-block-editor-components-block-icon"}),K=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var J=k({icon:$,label:W,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:r,imageSizing:o,showSaleBadge:l,saleBadgeAlign:i}=t,u=Object(s.useBlockProps)();return Object(n.createElement)("div",u,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:r,onChange:()=>c({showProductLink:!r})}),Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(G.a,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,options:[{label:Object(a.__)("Left","woo-gutenberg-products-block"),value:"left"},{label:Object(a.__)("Center","woo-gutenberg-products-block"),value:"center"},{label:Object(a.__)("Right","woo-gutenberg-products-block"),value:"right"}],onChange:e=>c({saleBadgeAlign:e})}),Object(n.createElement)(G.a,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(Q.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,options:[{label:Object(a.__)("Full Size","woo-gutenberg-products-block"),value:"full-size"},{label:Object(a.__)("Cropped","woo-gutenberg-products-block"),value:"cropped"}],onChange:e=>c({imageSizing:e})}))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Y.a,t)))});const X={apiVersion:2,title:W,description:K,icon:{src:$},attributes:H.a,edit:J,supports:q,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-image",{...m,...X});var Z=c(274),ee=c(501);const te=Object(a.__)("Product Rating","woo-gutenberg-products-block"),ce=Object(n.createElement)(i.a,{icon:ee.a,className:"wc-block-editor-components-block-icon"}),re=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var oe=k({icon:ce,label:te,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(n.createElement)("div",c,Object(n.createElement)(Z.default,t))});const ne={apiVersion:2,title:te,description:re,icon:{src:ce},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:oe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-rating",{...m,...ne});var ae=c(275),se=c(510);const le=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),ie=Object(n.createElement)(i.a,{icon:se.a,className:"wc-block-editor-components-block-icon"}),ue=Object(a.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block");var de=k({icon:ie,label:le,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ae.default,t)))});const be={apiVersion:2,title:le,description:ue,icon:{src:ie},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:de,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...be});var pe=c(276),me=c(511);const ge=Object(a.__)("Product Summary","woo-gutenberg-products-block"),Oe=Object(n.createElement)(i.a,{icon:me.a,className:"wc-block-editor-components-block-icon"}),je=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(372);var he=k({icon:Oe,label:ge,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(pe.default,t))});const _e={apiVersion:2,title:ge,description:je,icon:{src:Oe},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:he,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...m,..._e});var Ee=c(206),we=c(499);const fe=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),ke=Object(n.createElement)(i.a,{icon:we.a,className:"wc-block-editor-components-block-icon"}),ye=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ve=k({icon:ke,label:fe,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ee.default,t))});const Se={title:fe,description:ye,icon:{src:ke},apiVersion:2,supports:{html:!1,...Object(d.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ve,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...m,...Se});var Ce=c(102),Ne=c(277),xe=c(11),Pe=Object(n.createElement)(xe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Te=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Re=Object(n.createElement)(i.a,{icon:Pe,className:"wc-block-editor-components-block-icon"}),Ie={title:Te,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Re},attributes:{productId:{type:"number",default:0}},edit:k({icon:Re,label:Te,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Ce.a,null),Object(n.createElement)(Ne.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Ie});var Ae=c(278),Be=c(512);const Le=Object(a.__)("Product Category List","woo-gutenberg-products-block"),De=Object(n.createElement)(i.a,{icon:Be.a,className:"wc-block-editor-components-block-icon"}),Ve=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Fe=k({icon:De,label:Le,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ae.default,t)))});const Me={...m,apiVersion:2,title:Le,description:Ve,icon:{src:De},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},edit:Fe};Object(d.c)("woocommerce/product-category-list",Me);var ze=c(279),He=c(504);const qe=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),Ge=Object(n.createElement)(i.a,{icon:He.a,className:"wc-block-editor-components-block-icon"}),Qe=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Ye=k({icon:Ge,label:qe,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ze.default,t)))});const Ue={apiVersion:2,title:qe,description:Qe,icon:{src:Ge},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:Ye,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-tag-list",{...m,...Ue});var We=c(280),$e=c(513);const Ke=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Je=Object(n.createElement)(i.a,{icon:$e.a,className:"wc-block-editor-components-block-icon"}),Xe=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Ze=k({icon:Je,label:Ke,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Ce.a,null),Object(n.createElement)(We.default,t))});const et={apiVersion:2,title:Ke,description:Xe,icon:{src:Je},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Ze,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...m,...et});var tt=c(486),ct=(c(260),c(267)),rt=c(230);const ot=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),nt=Object(n.createElement)(i.a,{icon:rt.a,className:"wc-block-editor-components-block-icon"}),at={title:ot,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:nt},edit:k({icon:nt,label:ot,description:Object(a.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:r}=Object(f.useProductDataContext)(),{className:o,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(o,"wc-block-components-product-add-to-cart")},Object(n.createElement)(Ce.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(tt.b)(r)?Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(O.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(O.Disabled,null,Object(n.createElement)(ct.a,t)))}),attributes:c(266).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...at});var st=c(24),lt=c.n(st),it=c(13),ut=c(65),dt=c(478),bt=c(357),pt=c(22);const mt=(e,t)=>{const{className:c,contentVisibility:r}=t;return p()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})};var gt=c(219);const Ot=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],jt=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?jt(e.innerBlocks):[]}]):[];var ht=c(8),_t=c(7),Et=c(29);c(378);var wt=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:r=!0,pagesToDisplay:o=3,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(o,t,l);const d=c&&Boolean(1!==i),b=c&&Boolean(u!==l),m=c&&Boolean(i&&i>3),g=c&&Boolean(u&&u<l-2);d&&3===i&&(i-=1),b&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(Et.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(Et.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),d&&Object(n.createElement)("button",{className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>s(1),disabled:1===t},Object(n.createElement)(Et.a,{label:"1",screenReaderLabel:Object(a.sprintf)(
|
29 |
/* translators: %d is the page number (1, 2, 3...). */
|
30 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>s(e),disabled:t===e},Object(n.createElement)(Et.a,{label:e.toString(),screenReaderLabel:Object(a.sprintf)(
|
31 |
/* translators: %d is the page number (1, 2, 3...). */
|
32 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),b&&Object(n.createElement)("button",{className:p()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===l,"wc-block-components-pagination__page--active":t===l}),onClick:()=>s(l),disabled:t===l},Object(n.createElement)(Et.a,{label:l.toString(),screenReaderLabel:Object(a.sprintf)(
|
33 |
/* translators: %d is the page number (1, 2, 3...). */
|
34 |
+
Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(Et.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},ft=c(107),kt=c(78),yt=c(125),vt=c(15),St=c(49);var Ct=c(51);c(379);const Nt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var xt=c(44),Pt=c(171),Tt=()=>{const{parentClassName:e}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(i.a,{className:e+"__no-products-image",icon:Pt.a,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Rt=c(503),It=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:c+"__no-products"},Object(n.createElement)(i.a,{className:c+"__no-products-image",icon:Rt.a,size:100}),Object(n.createElement)("strong",{className:c+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:c+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},At=c(118);c(377);var Bt=e=>{let{onChange:t,value:c}=e;return Object(n.createElement)(At.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Lt=(e,t,c,r)=>{if(!c)return;const a=Object(dt.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=Lt(e,t,i.children,r));const d=a[l];if(!d)return null;const b=t.id||0,p=["layout",l,s,r,b];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(d,o()({},i,{children:u,product:t})))})};var Dt=Object(j.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:r}=e;const{layoutConfig:o}=c,{parentClassName:a,parentName:s}=Object(f.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=p()(a+"__product","wc-block-layout",{"is-loading":l});return Object(n.createElement)("li",{className:i,"aria-hidden":l},Lt(s,t,o,r))});c(376);const Vt=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"}}},Ft=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(_t.isEqual)(t,r)&&Number.isFinite(c)};var Mt,zt=(Mt=e=>{let{attributes:t,currentPage:c,onPageChange:r,onSortChange:o,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(kt.b)("attributes",[]),[d,b]=Object(kt.b)("stock_status",[]),[m,g]=Object(kt.b)("min_price"),[O,j]=Object(kt.b)("max_price"),[h]=Object(kt.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...Vt(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:s,currentPage:c})),{products:_,totalProducts:E,productsLoading:w}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:r}=Object(yt.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:o=[],query:n={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(St.a)(n),s=Object(St.a)(o),{value:l,isLoading:i=!0}=Object(it.useSelect)(e=>{const t=e(vt.COLLECTIONS_STORE_KEY),o=["x-wp-total",c,r,a,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",c,r,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(o,10),productsLoading:r}})(h),{parentClassName:k,parentName:y}=Object(f.useInnerBlockLayoutContext)(),v=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(h),{dispatchStoreEvent:S}=Object(Ct.a)(),C=Object(ft.a)({totalQuery:v,totalProducts:E},Ft);Object(n.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(n.useEffect)(()=>{Object(_t.isEqual)(v,null==C?void 0:C.totalQuery)||(r(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(xt.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(xt.speak)(Object(a.sprintf)(
|
35 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
36 |
+
Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(E))},[null==C?void 0:C.totalQuery,E,r,v]);const{contentVisibility:N}=t,x=t.columns*t.rows,P=!Number.isFinite(E)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(_t.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/x):Math.ceil(E/x),T=_.length?_:Array.from({length:x}),R=0!==_.length||w,I=i.length>0||d.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return p()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==N?void 0:N.orderBy)&&R&&Object(n.createElement)(Bt,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(It,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Tt,null),R&&Object(n.createElement)("ul",{className:k+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Dt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(wt,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),r(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Mt,o()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];Nt(e),null==e||e.focus()}else Nt(e)})(e,c):Nt(e))})(t.current,e)}})))}),Ht=e=>{let{attributes:t}=e;const[c,r]=Object(n.useState)(1),[o,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(zt,{attributes:t,currentPage:c,onPageChange:e=>{r(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),r(1)},sortValue:o})},qt=c(137);class Gt extends ht.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?qt.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(Ht,{attributes:e,urlParameterSuffix:t}))}}var Qt=Gt;c(375);class Yt extends n.Component{constructor(){super(...arguments),lt()(this,"state",{isEditing:!1,innerBlocks:[]}),lt()(this,"blockMap",Object(dt.a)("woocommerce/all-products")),lt()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),lt()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),lt()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),lt()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),lt()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:r,alignButtons:o}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(ut.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(Q.getSetting)("min_columns",1),maxColumns:Object(Q.getSetting)("max_columns",6),minRows:Object(Q.getSetting)("min_rows",1),maxRows:Object(Q.getSetting)("max_rows",6)})),Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(O.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),lt()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),lt()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(n.createElement)(O.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(O.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(f.ProductDataContextProvider,{product:bt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(O.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:jt(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{icon:u.a}),label:Object(a.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];Ot.map(e=>{let[t,r]=e;return c.push(Object(l.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),lt()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,r=this.getTitle(),o=this.getIcon();return c?Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Qt,{attributes:e})):((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(r,o)}),lt()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===pt.o.productCount?((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:Q.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:gt.a})),Object(n.createElement)(O.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,r):Object(n.createElement)("div",{className:mt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Ut=Object(j.compose)(O.withSpokenMessages,Object(it.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(it.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Yt);const Wt={columns:Object(Q.getSetting)("default_columns",3),rows:Object(Q.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:Ot,isPreview:!1},$t={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("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:Wt,edit:e=>Object(n.createElement)(Ut,e),save(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const r={"data-attributes":JSON.stringify(c)};return Object(n.createElement)("div",o()({className:mt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...$t,deprecated:[{attributes:Object.assign({},$t.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",o()({className:mt("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(40),o=c(0),n=c(22);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(27)]).then(c.bind(null,273)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(24)]).then(c.bind(null,533)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(35)]).then(c.bind(null,534)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(28)]).then(c.bind(null,274)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(3),c.e(20)]).then(c.bind(null,275)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,276)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(4)]).then(c.bind(null,206)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(30).then(c.bind(null,277)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(23)]).then(c.bind(null,278)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,279)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(31)]).then(c.bind(null,280)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(3),c.e(18)]).then(c.bind(null,535)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")}]);
|
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' => 'b70685c1a87f74b3768736b5a1fc2509');
|
build/all-reviews.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,s=t[0],i=t[1],l=t[2],u=0,b=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o]);for(d&&d(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],o=!0,s=1;s<r.length;s++){var i=r[s];0!==n[i]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[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=o,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 o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var d=i;return c.push([
|
2 |
/* translators: An example person name used for the block previews. */
|
3 |
reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
|
4 |
/* translators: An example person name used for the block previews. */
|
5 |
-
reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},139: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}}},14:function(e,t){e.exports=window.wp.blocks},140:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(6),s=(r(
|
6 |
/* translators: %f is referring to the average rating value */
|
7 |
Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
|
8 |
/* translators: %s is referring to the average rating value */
|
9 |
-
Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),s&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(175);var S=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,s=c&&t.showReviewRating,i={...t,showReviewImage:a,showReviewRating:s};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(C,{attributes:i}):r.map((e,t)=>Object(o.createElement)(C,{key:e.id||t,attributes:i,review:e})))},N=r(5),P=r.n(N),T=r(25),L=r.n(T),x=r(56),A=r(27);class I extends i.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:s,totalReviews:i}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(S,{attributes:e,reviews:s}),e.showLoadMore&&i>s.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var M=(e=>{class t extends i.Component{constructor(){super(...arguments),v()(this,"isPreview",!!this.props.attributes.previewReviews),v()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),v()(this,"isMounted",!1),v()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),v()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};return t&&t.length&&(a.category_id=Array.isArray(t)?t.join(","):t),n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}v()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(I);t.a=e=>{let{attributes:t,icon:r,name:i,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:h,showReviewRating:v}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||v||p||m||h||w),f=Object(s.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:i},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(M,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},152:function(e,t){},153:function(e,t){},174:function(e,t){},175:function(e,t){},176:function(e,t){},177:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"n",(function(){return i})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",s=c.pluginUrl+"build/",i=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),h=Object(n.getSetting)("allowedCountries",{}),v=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var o=r(1);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},c=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},29:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:s={}}=e;const i=null!=r,l=null!=n;return!i&&l?(t=a||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,n)):(t=a||o.Fragment,i&&l&&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))}},3:function(e,t){e.exports=window.wp.components},31:function(e,t){e.exports=window.wp.escapeHtml},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(31);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},357:function(e,t,r){e.exports=r(462)},462:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(14),a=r(112),s=r(497),i=(r(152),r(6)),l=r(3),d=(r(10),r(142)),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("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")),b=r(104),w=r(139),p=r(140),m=r(122);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:s.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},56:function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(12),n=r.n(o),c=r(4),a=r.n(c),s=r(2);const i=e=>{if(Object(s.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=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:s,showProductName:i,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":s,"has-product-name":i})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:s,showOrderby:i}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":s,"data-show-orderby":i};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},58:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(4),s=r.n(a),i=r(3),l=r(9);r(89);class d extends c.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:r,className:o,help:a,options:l,value:d}=this.props,u="inspector-toggle-button-control-"+r;let b;return a&&(b="function"==typeof a?a(t):a),Object(c.createElement)(i.BaseControl,{id:u,help:b,className:s()("components-toggle-button-control",o)},Object(c.createElement)("label",{id:u+"__label",htmlFor:u,className:"components-toggle-button-control__label"},e),Object(c.createElement)(i.ButtonGroup,{"aria-labelledby":u+"__label"},l.map((t,r)=>{const o={};return d===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(c.createElement)(i.Button,n()({key:`${t.label}-${t.value}-${r}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(l.withInstanceId)(d)},6:function(e,t){e.exports=window.wp.blockEditor},7:function(e,t){e.exports=window.lodash},74:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(112),a=r(168),s=r(4),i=r.n(s),l=r(3),d=r(32);r(113),t.a=e=>{let{className:t,error:r,isLoading:s=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:i()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,s?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.React},89:function(e,t){},9:function(e,t){e.exports=window.wp.compose}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,s=t[0],i=t[1],l=t[2],u=0,b=[];u<s.length;u++)a=s[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o]);for(d&&d(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],o=!0,s=1;s<r.length;s++){var i=r[s];0!==n[i]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[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=o,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 o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=t,s=s.slice();for(var l=0;l<s.length;l++)t(s[l]);var d=i;return c.push([359,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},104:function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return u}));var o=r(0),n=r(1),c=r(3),a=r(6),s=r(2),i=r(60);const l=(e,t,r)=>Object(o.createElement)(a.BlockControls,null,Object(o.createElement)(c.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),d=(e,t)=>{const r=Object(s.getSetting)("showAvatars",!0),a=Object(s.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!a&&Object(o.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(s.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.a,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(n.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:e=>t({imageType:e})}),"reviewer"===e.imageType&&!r&&Object(o.createElement)(c.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(s.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},u=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(c.SelectControl,{label:Object(n.__)("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:e=>t({orderby:e})}),Object(o.createElement)(c.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(c.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(c.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},11:function(e,t){e.exports=window.wp.primitives},112:function(e,t){},118:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(29),s=r(9);r(154),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:s,options:i,screenReaderLabel:l,value:d}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:d},i&&i.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},12:function(e,t){e.exports=window.wp.apiFetch},121:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(22);const 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(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
|
2 |
/* translators: An example person name used for the block previews. */
|
3 |
reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
|
4 |
/* translators: An example person name used for the block previews. */
|
5 |
+
reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},139: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}}},14:function(e,t){e.exports=window.wp.blocks},140:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(6),s=(r(153),r(57));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(s.a)(t)}),Object(s.b)(t)))}},143:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(7),a=r(3),s=r(6),i=r(8),l=r(2),d=r(75),u=r(29);r(180);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(118);r(177);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),h=r(24),v=r.n(h),_=r(165),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"…",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends i.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(i.createRef)(),this.reviewSummary=Object(i.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}v()(R,"defaultProps",y);var E=R;r(179);var C=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:s,showReviewImage:i,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":i}),"aria-hidden":w},(u||a||s||i||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},i&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||s||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(
|
6 |
/* translators: %f is referring to the average rating value */
|
7 |
Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
|
8 |
/* translators: %s is referring to the average rating value */
|
9 |
+
Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),s&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(178);var S=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,s=c&&t.showReviewRating,i={...t,showReviewImage:a,showReviewRating:s};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(C,{attributes:i}):r.map((e,t)=>Object(o.createElement)(C,{key:e.id||t,attributes:i,review:e})))},N=r(5),P=r.n(N),T=r(25),L=r.n(T),x=r(57),A=r(27);class I extends i.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:s,totalReviews:i}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===s.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(S,{attributes:e,reviews:s}),e.showLoadMore&&i>s.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var M=(e=>{class t extends i.Component{constructor(){super(...arguments),v()(this,"isPreview",!!this.props.attributes.previewReviews),v()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),v()(this,"isMounted",!1),v()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),v()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};return t&&t.length&&(a.category_id=Array.isArray(t)?t.join(","):t),n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}v()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(I);t.a=e=>{let{attributes:t,icon:r,name:i,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:h,showReviewRating:v}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||v||p||m||h||w),f=Object(s.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:i},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(M,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},153:function(e,t){},154:function(e,t){},177:function(e,t){},178:function(e,t){},179:function(e,t){},180:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"n",(function(){return i})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return v})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",s=c.pluginUrl+"build/",i=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),h=Object(n.getSetting)("allowedCountries",{}),v=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));var o=r(1);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},c=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return(null==e?void 0:e.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},29:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:s={}}=e;const i=null!=r,l=null!=n;return!i&&l?(t=a||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,n)):(t=a||o.Fragment,i&&l&&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))}},3:function(e,t){e.exports=window.wp.components},31:function(e,t){e.exports=window.wp.escapeHtml},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(31);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},359:function(e,t,r){e.exports=r(467)},467:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(14),a=r(111),s=r(502),i=(r(153),r(6)),l=r(3),d=r(143),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("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")),b=r(104),w=r(139),p=r(140),m=r(121);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:s.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:s.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},57:function(e,t,r){"use strict";r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(12),n=r.n(o),c=r(4),a=r.n(c),s=r(2);const i=e=>{if(Object(s.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=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:s,showProductName:i,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":s,"has-product-name":i})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:s,showOrderby:i}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":s,"data-show-orderby":i};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},6:function(e,t){e.exports=window.wp.blockEditor},60:function(e,t,r){"use strict";var o=r(5),n=r.n(o),c=r(0),a=r(4),s=r.n(a),i=r(3),l=r(9);r(90);class d extends c.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:r,className:o,help:a,options:l,value:d}=this.props,u="inspector-toggle-button-control-"+r;let b;return a&&(b="function"==typeof a?a(t):a),Object(c.createElement)(i.BaseControl,{id:u,help:b,className:s()("components-toggle-button-control",o)},Object(c.createElement)("label",{id:u+"__label",htmlFor:u,className:"components-toggle-button-control__label"},e),Object(c.createElement)(i.ButtonGroup,{"aria-labelledby":u+"__label"},l.map((t,r)=>{const o={};return d===t.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isSecondary=!0,o["aria-pressed"]=!1),Object(c.createElement)(i.Button,n()({key:`${t.label}-${t.value}-${r}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},o),t.label)})))}}t.a=Object(l.withInstanceId)(d)},7:function(e,t){e.exports=window.lodash},75:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(111),a=r(171),s=r(4),i=r.n(s),l=r(3),d=r(32);r(112),t.a=e=>{let{className:t,error:r,isLoading:s=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:i()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,s?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.compose},90:function(e,t){}});
|
build/attribute-filter-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', '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-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => 'c96bd049c2988013d65f58ee7f1e0004');
|
build/attribute-filter-frontend.js
CHANGED
@@ -1,29 +1,29 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=197)}([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){e.exports=window.React},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var c=o.apply(null,r);c&&e.push(c)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.lodash},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(42)()},function(e,t){e.exports=window.wp.data},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wp.isShallowEqual},,,function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(17),o=n.n(r),i=n(0),c=n(3),a=n(1),s=n(47),u=e=>{let{imageUrl:t=s.l+"/block-error.svg",header:n=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:c=Object(a.__)("Error:","woo-gutenberg-products-block"),button:u,showErrorBlock:l=!0}=e;return l?Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},c?c+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u))):null};n(34);class l extends c.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:c,renderError:a,button:s}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof a?a({errorMessage:l}):Object(i.createElement)(u,{showErrorBlock:r,errorMessage:n?l:null,header:e,imageUrl:t,text:o,errorMessagePrefix:c,button:s}):this.props.children}}t.a=l},,function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},,function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},,function(e,t,n){"use strict";var r=n(0),o=n(4),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:c,wrapperProps:a={}}=e;const s=null!=n,u=null!=o;return!s&&u?(t=c||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=c||r.Fragment,s&&u&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n(11),i=n.n(o);function c(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,,,,,function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(5),o=n(9),i=n(0),c=n(11),a=n.n(c),s=n(28),u=n(59),l=n(23);const d=e=>{const t=Object(l.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:c}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(i.useCallback)(t=>{c(e,t)},[e,c])]},p=(e,t,n)=>{const c=Object(l.a)();n=n||c;const a=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(i.useCallback)(t=>{s(n,e,t)},[n,e,s])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),c=Object(s.a)(r),p=Object(s.a)(e),f=Object(u.a)(p),b=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{a()(f,p)||(o(Object.assign({},c,p)),b.current=!0)},[c,p,f,o]),b.current?[r,o]:[e,o]}},,,,,,function(e,t,n){"use strict";var r=n(43);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,c){if(c!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return c})),n.d(t,"k",(function(){return a})),n.d(t,"m",(function(){return s})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return v}));var r,o=n(2);const i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),c=i.pluginUrl+"images/",a=i.pluginUrl+"build/",s=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),c=Object(r.useRef)(0),a=Object(r.useRef)(null),s=Object(r.useRef)([]),u=Object(r.useRef)(),l=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,g="maxWait"in n,h=g?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=s.current,n=u.current;return s.current=u.current=null,c.current=e,l.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(a.current),a.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-i.current,r=e-c.current;return!i.current||n>=t||n<0||g&&r>=h},v=function(t){return a.current=null,m&&s.current?e(t):(s.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,a=e-c.current,s=t-o,u=g?Math.min(s,h-a):s;n(y,u)}},O=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),h=r(m);if(s.current=d,u.current=o,i.current=m,h){if(!a.current&&p.current)return c.current=i.current,n(y,t),b?e(i.current):l.current;if(g)return n(y,t),e(i.current)}return a.current||n(y,t),l.current};return O.cancel=function(){a.current&&(f?cancelAnimationFrame(a.current):clearTimeout(a.current)),c.current=0,s.current=i.current=u.current=a.current=null},O.isPending=function(){return!!a.current},O.flush=function(){return a.current?v(Date.now()):l.current},O}),[b,g,t,h,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(10),o=n.n(r),i=n(0),c=n(15);const a=[".wp-block-woocommerce-cart"],s=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const s=r(e,n),u=a(e,n),l={...e.dataset,...s.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:a={},errorBoundaryProps:s={}}=e;Object(i.render)(Object(i.createElement)(c.a,s,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},a,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:s,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const c=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(c,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),s({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:i}=e;const c=i.querySelectorAll(o);s({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t,n){"use strict";var r=n(0),o=n(1),i=n(22);n(123),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,Number.isFinite(n)&&Object(r.createElement)(i.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
|
2 |
/* translators: %s number of products. */
|
3 |
-
Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(5),o=n(
|
4 |
/* translators: Submit button text for filters. */
|
5 |
-
i=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:c()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:s},Object(r.createElement)(a.a,{label:i,screenReaderLabel:u}))}},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),o=n(
|
6 |
/* translators: %s is referring the remaining count of options */
|
7 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
8 |
/* translators: %s number of options to reveal. */
|
9 |
-
Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),m=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),g=Object(r.useMemo)(()=>{const e=i.length>l+5;return Object(r.createElement)(r.Fragment,null,i.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&o>=l&&{hidden:!0},Object(r.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{n(e.target.value)},checked:a.includes(t.value),disabled:u}),Object(r.createElement)("label",{htmlFor:t.value},t.label)),e&&o===l-1&&b)),e&&m)},[i,n,a,d,l,m,b,u]),h=c()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(r.createElement)("ul",{className:h},s?f:g)}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(
|
10 |
/* translators: Remove chip. */
|
11 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
12 |
/* translators: %s text of the chip to remove. */
|
13 |
-
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:r,onClick:c,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c()}},v=p?h:{},y=p?{"aria-hidden":!0}:h;return Object(i.createElement)(d,o()({},m,v,{className:a()(n,"is-removable"),element:p?"button":m.element,screenReaderText:b,text:f}),Object(i.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:l.a,size:16})))}},,,,,,,,,,,,,function(e,t,n){e.exports=n(216)},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,c=60108,a=60114,s=60109,u=60110,l=60112,d=60113,p=60120,f=60115,b=60116,m=60121,g=60122,h=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),c=O("react.strict_mode"),a=O("react.profiler"),s=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),b=O("react.lazy"),m=O("react.block"),g=O("react.server.block"),h=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case a:case c:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case b:case f:case s:return e;default:return t}}case o:return t}}}var j=s,E=r,I=l,_=i,S=b,k=f,x=o,C=a,P=c,R=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=I,t.Fragment=_,t.Lazy=S,t.Memo=k,t.Portal=x,t.Profiler=C,t.StrictMode=P,t.Suspense=R,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===b},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===a},t.isStrictMode=function(e){return w(e)===c},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===a||e===v||e===c||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===l||e.$$typeof===h||e.$$typeof===m||e[0]===g)},t.typeOf=w},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(51),o=n(0),i=n(1),c=n(20),a=n(28),s=n(59),u=n(36),l=n(64),d=n(142),p=n(111),f=n(8),b=n.n(f),m=n(4),g=n.n(m);function h(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var v=n(7);function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function I(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function _(e,t,n,r,o,i,c,a){return i<e&&c>t||i>e&&c<t?0:i<=e&&a<=n||c>=t&&a>=n?i-e-r:c>t&&a<n||i<e&&a>n?c-t+o:0}n(132);var S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var k=0;function x(e){return"function"==typeof e?e:C}function C(){}function P(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,c=t.boundary,a=t.skipOverflowHiddenElements,s="function"==typeof c?c:function(e){return e!==c};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&s(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&I(d)&&!I(document.documentElement)||null!=d&&I(d,a)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),h=g.height,v=g.width,y=g.top,O=g.right,w=g.bottom,E=g.left,S="start"===o||"nearest"===o?y:"end"===o?w:y+h/2,k="center"===i?E+v/2:"end"===i?O:E,x=[],C=0;C<l.length;C++){var P=l[C],R=P.getBoundingClientRect(),T=R.height,M=R.width,A=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=A&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),V=parseInt(B.borderTopWidth,10),F=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),U=0,q=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-F:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-V-K:0;if(u===P)U="start"===o?S:"end"===o?S-f:"nearest"===o?_(m,m+f,f,V,K,m+S,m+S+h,h):S-f/2,q="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:_(b,b+p,p,L,F,b+k,b+k+v,v),U=Math.max(0,U+m),q=Math.max(0,q+b);else{U="start"===o?S-A-V:"end"===o?S-N+K+W:"nearest"===o?_(A,N,T,V,K+W,S,S+h,h):S-(A+T/2)+W/2,q="start"===i?k-H-L:"center"===i?k-(H+M/2)+$/2:"end"===i?k-D+F+$:_(H,D,M,L,F+$,k,k+v,v);var G=P.scrollLeft,z=P.scrollTop;S+=z-(U=Math.max(0,Math.min(z+U,P.scrollHeight-T+W))),k+=G-(q=Math.max(0,Math.min(G+q,P.scrollWidth-M+$)))}x.push({el:P,top:U,left:q})}return x}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function R(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),c=0;c<o;c++)i[c]=arguments[c];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function D(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function N(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var H=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return H.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function L(e,t){return void 0!==e[t]}function V(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function F(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var c=t+e;c<0?c=o?i:0:c>i&&(c=o?0:i);var a=K(e,c,n,r,o);return-1===a?t>=n?-1:t:a}function K(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var c=t+1;c<n;c++)if(!r(c).hasAttribute("disabled"))return c}else for(var a=t-1;a>=0;a--)if(!r(a).hasAttribute("disabled"))return a;return o?e>0?K(1,0,n,r,!1):K(-1,n-1,n,r,!1):-1}function U(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(R(t,e,n)||r&&R(t,n.document.activeElement,n))}))}var q=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,q(t))}function W(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var G=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),z=["refKey","ref"],Y=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Q=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(k++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(Object(v.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=B(t),n.internalSetState(Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},c="function"==typeof e;return!c&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(v.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var a=c?e(t):e;a=n.props.stateReducer(t,a),r=a.hasOwnProperty("selectedItem");var s={},u={};return r&&a.selectedItem!==t.selectedItem&&(o=a.selectedItem),a.type=a.type||0,Object.keys(a).forEach((function(e){t[e]!==a[e]&&(i[e]=a[e]),"type"!==e&&(u[e]=a[e],L(n.props,e)||(s[e]=a[e]))})),c&&a.hasOwnProperty("inputValue")&&n.props.onInputValueChange(a.inputValue,Object(v.a)({},n.getStateAndHelpers(),a)),s}),(function(){x(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,a=o.ref,s=h(o,z),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=c,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(v.a)(((r={})[c]=A(a,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),s)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=F(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=F(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(v.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(v.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,c=t.onBlur,a=h(t,Y),s=n.getState().isOpen,u={onClick:M(r,n.buttonHandleClick),onKeyDown:M(o,n.buttonHandleKeyDown),onKeyUp:M(i,n.buttonHandleKeyUp),onBlur:M(c,n.buttonHandleBlur)},l=a.disabled?{}:u;return Object(v.a)({type:"button",role:"button","aria-label":s?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,a)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=V(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(y(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(v.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,c=t.onInput;t.onChangeText;var a,s=h(t,Q),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((a={}).onChange=M(i,c,n.inputHandleChange),a.onKeyDown=M(r,n.inputHandleKeyDown),a.onBlur=M(o,n.inputHandleBlur),u=a),Object(v.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,s)},n.inputHandleKeyDown=function(e){var t=V(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(y(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,a=o.ref,s=h(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=c,n.getMenuProps.suppressRefError=l,Object(v.a)(((r={})[c]=A(a,n.menuRef),r.role="listbox",r["aria-labelledby"]=s&&s["aria-label"]?null:n.labelId,r.id=n.menuId,r),s)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,c=r.onClick;r.onPress;var a=r.index,s=r.item,u=void 0===s?void 0:s,l=h(r,J);void 0===a?(n.items.push(u),a=n.items.indexOf(u)):n.items[a]=u;var d=c,p=((t={onMouseMove:M(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:M(i,(function(e){e.preventDefault()}))}).onClick=M(d,(function(){n.selectItemAtIndex(a,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(v.a)({id:n.getItemId(a),role:"option","aria-selected":n.getState().highlightedIndex===a},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(v.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.isOpen;return Object(v.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),x(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(v.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,$(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,c=void 0===i?o:i,a=r.defaultIsOpen,s=r.initialIsOpen,u=void 0===s?a:s,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,b=n.getState({highlightedIndex:c,isOpen:u,inputValue:d,selectedItem:f});return null!=b.selectedItem&&void 0===n.props.initialInputValue&&(b.inputValue=n.props.itemToString(b.selectedItem)),n.state=b,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,O(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=L(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=F(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,c=this.id,a=this.getRootProps,s=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,b=this.closeMenu,m=this.toggleMenu,g=this.selectItem,h=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:a,getToggleButtonProps:s,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:b,toggleMenu:m,selectItem:g,selectItemAtIndex:h,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:c,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!U(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=U(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},c=this.props.environment;c.addEventListener("mousedown",t),c.addEventListener("mouseup",n),c.addEventListener("touchstart",r),c.addEventListener("touchmove",o),c.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),c.removeEventListener("mousedown",t),c.removeEventListener("mouseup",n),c.removeEventListener("touchstart",r),c.removeEventListener("touchmove",o),c.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){L(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=N(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=N(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:D,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:P},e.stateChangeTypes=G,e}();T((function(e,t){$(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:P,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};b.a.array.isRequired,b.a.func,b.a.func,b.a.func,b.a.bool,b.a.number,b.a.number,b.a.number,b.a.bool,b.a.bool,b.a.bool,b.a.any,b.a.any,b.a.any,b.a.string,b.a.string,b.a.string,b.a.func,b.a.string,b.a.func,b.a.func,b.a.func,b.a.func,b.a.func,b.a.shape({addEventListener:b.a.func,removeEventListener:b.a.func,document:b.a.shape({getElementById:b.a.func,activeElement:b.a.any,body:b.a.any})}),S(S({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),b.a.array.isRequired,b.a.func,b.a.func,b.a.func,b.a.bool,b.a.number,b.a.number,b.a.number,b.a.bool,b.a.bool,b.a.bool,b.a.any,b.a.any,b.a.any,b.a.string,b.a.string,b.a.string,b.a.string,b.a.string,b.a.string,b.a.func,b.a.string,b.a.string,b.a.func,b.a.func,b.a.func,b.a.func,b.a.func,b.a.func,b.a.shape({addEventListener:b.a.func,removeEventListener:b.a.func,document:b.a.shape({getElementById:b.a.func,activeElement:b.a.any,body:b.a.any})}),Object(v.a)({},ee,{getA11yStatusMessage:D,circularNavigation:!0}),b.a.array,b.a.array,b.a.array,b.a.func,b.a.func,b.a.func,b.a.number,b.a.number,b.a.number,b.a.func,b.a.func,b.a.string,b.a.string,b.a.shape({addEventListener:b.a.func,removeEventListener:b.a.func,document:b.a.shape({getElementById:b.a.func,activeElement:b.a.any,body:b.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:c,onRemoveItem:a,placeholder:s,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:c,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:c,options:a}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,r)=>{const a=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:g()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":c===r}),index:r,item:e.value,"aria-label":a?Object(i.sprintf)(
|
14 |
/* translators: %s is referring to the filter option being removed. */
|
15 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(
|
16 |
/* translators: %s is referring to the filter option being removed. */
|
17 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},ce=n(
|
18 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
19 |
Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)},r.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(r.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(r.value)},"aria-label":Object(i.sprintf)(
|
20 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
21 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ce.a,{icon:ae.a,size:16})))};n(
|
22 |
/* translators: %s attribute name. */
|
23 |
-
Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!l&&c.length>0?"-1":"0",value:
|
24 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
25 |
Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,a)):o?Object(c.speak)(Object(i.sprintf)(
|
26 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
27 |
Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):a&&Object(c.speak)(Object(i.sprintf)(
|
28 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
29 |
-
Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),a))},o=f.includes(e);let a;M?(a=f.filter(t=>t!==e),o?r({filterRemoved:e}):(a.push(e),a.sort(),r({filterAdded:e}))):(a=o?[]:[e],r({filterAdded:o?null:e,filterRemoved:1===f.length?f[0]:null})),
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=195)}([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){e.exports=window.React},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var c=o.apply(null,r);c&&e.push(c)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.lodash},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=window.wp.data},function(e,t,n){e.exports=n(199)()},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.isShallowEqual},,,function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(17),o=n.n(r),i=n(0),c=n(3),a=n(1),s=n(45),u=e=>{let{imageUrl:t=s.l+"/block-error.svg",header:n=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:c=Object(a.__)("Error:","woo-gutenberg-products-block"),button:u,showErrorBlock:l=!0}=e;return l?Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},c?c+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u))):null};n(34);class l extends c.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:c,renderError:a,button:s}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof a?a({errorMessage:l}):Object(i.createElement)(u,{showErrorBlock:r,errorMessage:n?l:null,header:e,imageUrl:t,text:o,errorMessagePrefix:c,button:s}):this.props.children}}t.a=l},,function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},,function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.a11y},,function(e,t,n){"use strict";var r=n(0),o=n(4),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:c,wrapperProps:a={}}=e;const s=null!=n,u=null!=o;return!s&&u?(t=c||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=c||r.Fragment,s&&u&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n(11),i=n.n(o);function c(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,,,,,function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(5),o=n(8),i=n(0),c=n(11),a=n.n(c),s=n(28),u=n(57),l=n(23);const d=e=>{const t=Object(l.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:c}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(i.useCallback)(t=>{c(e,t)},[e,c])]},p=(e,t,n)=>{const c=Object(l.a)();n=n||c;const a=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(i.useCallback)(t=>{s(n,e,t)},[n,e,s])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),c=Object(s.a)(r),p=Object(s.a)(e),f=Object(u.a)(p),b=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{a()(f,p)||(o(Object.assign({},c,p)),b.current=!0)},[c,p,f,o]),b.current?[r,o]:[e,o]}},,,,,,,,,function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return c})),n.d(t,"k",(function(){return a})),n.d(t,"m",(function(){return s})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return v}));var r,o=n(2);const i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),c=i.pluginUrl+"images/",a=i.pluginUrl+"build/",s=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),c=Object(r.useRef)(0),a=Object(r.useRef)(null),s=Object(r.useRef)([]),u=Object(r.useRef)(),l=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,g="maxWait"in n,h=g?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=s.current,n=u.current;return s.current=u.current=null,c.current=e,l.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(a.current),a.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-i.current,r=e-c.current;return!i.current||n>=t||n<0||g&&r>=h},v=function(t){return a.current=null,m&&s.current?e(t):(s.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,a=e-c.current,s=t-o,u=g?Math.min(s,h-a):s;n(y,u)}},O=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),h=r(m);if(s.current=d,u.current=o,i.current=m,h){if(!a.current&&p.current)return c.current=i.current,n(y,t),b?e(i.current):l.current;if(g)return n(y,t),e(i.current)}return a.current||n(y,t),l.current};return O.cancel=function(){a.current&&(f?cancelAnimationFrame(a.current):clearTimeout(a.current)),c.current=0,s.current=i.current=u.current=a.current=null},O.isPending=function(){return!!a.current},O.flush=function(){return a.current?v(Date.now()):l.current},O}),[b,g,t,h,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(10),o=n.n(r),i=n(0),c=n(15);const a=[".wp-block-woocommerce-cart"],s=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const s=r(e,n),u=a(e,n),l={...e.dataset,...s.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:a={},errorBoundaryProps:s={}}=e;Object(i.render)(Object(i.createElement)(c.a,s,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},a,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:s,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const c=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(c,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),s({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:i}=e;const c=i.querySelectorAll(o);s({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t,n){"use strict";var r=n(0),o=n(1),i=n(22);n(121),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,Number.isFinite(n)&&Object(r.createElement)(i.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
|
2 |
/* translators: %s number of products. */
|
3 |
+
Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(3);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(5),o=n(8),i=n(0),c=n(28),a=n(72);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:u={},shouldSelect:l=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(i.useRef)({results:[],isLoading:!0}),p=Object(c.a)(u),f=Object(c.a)(s),b=Object(a.a)(),m=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),i=[t,n,p,f],c=o.getCollectionError(...i);if(c){if(!(c instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(c)}return{results:o.getCollection(...i),isLoading:!o.hasFinishedResolution("getCollection",i)}},[t,n,f,p,l]);return null!==m&&(d.current=m),d.current}},,,,,,,,function(e,t){e.exports=window.wp.blockEditor},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,function(e,t,n){"use strict";var r=n(0),o=n(1),i=n(4),c=n.n(i),a=n(22);n(105),t.a=e=>{let{className:t,disabled:n,label:
|
4 |
/* translators: Submit button text for filters. */
|
5 |
+
i=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:c()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:s},Object(r.createElement)(a.a,{label:i,screenReaderLabel:u}))}},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),o=n(48);function i(e,t){return e===t}function c(e){return"function"==typeof e?function(){return e}:e}function a(e,t,n){var a=n&&n.equalityFn||i,s=function(e){var t=Object(r.useState)(c(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(c(e))}),[])]}(e),u=s[0],l=s[1],d=Object(o.a)(Object(r.useCallback)((function(e){return l(e)}),[l]),t,n),p=Object(r.useRef)(e);return a(p.current,e)||(d(e),p.current=e),[u,d]}},function(e,t){e.exports=window.wp.components},,,function(e,t){e.exports=window.wp.blocks},function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return c}));var r=n(2);const o=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const 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;var r;return n.id&&e.push(n),e},[]),i=e=>{if(e)return o.find(t=>t.id===e)},c=e=>{if(e)return o.find(t=>t.taxonomy===e)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return i}));var r=n(6);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const i=e.filter(e=>e.attribute===n.taxonomy),c=i.length?i[0]:null;if(!(c&&c.slug&&Array.isArray(c.slug)&&c.slug.includes(o)))return;const a=c.slug.filter(e=>e!==o),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(c.slug=a.sort(),s.push(c)),t(Object(r.sortBy)(s,"attribute"))},i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const c=e.filter(e=>e.attribute!==n.taxonomy);0===o.length?t(c):(c.push({attribute:n.taxonomy,operator:i,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(c,"attribute")))}},function(e,t,n){"use strict";var r=n(0),o=n(1),i=n(4),c=n.n(i);n(122),t.a=e=>{let{className:t,onChange:n=(()=>{}),options:i=[],checked:a=[],isLoading:s=!1,isDisabled:u=!1,limit:l=10}=e;const[d,p]=Object(r.useState)(!1),f=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),b=Object(r.useMemo)(()=>{const e=i.length-l;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{p(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
|
6 |
/* translators: %s is referring the remaining count of options */
|
7 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
8 |
/* translators: %s number of options to reveal. */
|
9 |
+
Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),m=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),g=Object(r.useMemo)(()=>{const e=i.length>l+5;return Object(r.createElement)(r.Fragment,null,i.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&o>=l&&{hidden:!0},Object(r.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{n(e.target.value)},checked:a.includes(t.value),disabled:u}),Object(r.createElement)("label",{htmlFor:t.value},t.label)),e&&o===l-1&&b)),e&&m)},[i,n,a,d,l,m,b,u]),h=c()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":s},t);return Object(r.createElement)("ul",{className:h},s?f:g)}},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(101);var r=n(45);const o=()=>r.m>1},,,,,,function(e,t){},,,function(e,t){},function(e,t){},,,,,,,,function(e,t,n){"use strict";e.exports=n(198)},,,function(e,t,n){"use strict";n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return u})),n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return d}));var r=n(70),o=n(112),i=n(59),c=n(61);const a=e=>Object(i.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{},s=e=>{if(!Object(o.a)()||"function"!=typeof r.__experimentalGetSpacingClassesAndStyles)return{style:{}};const t=Object(c.a)(e)?e:{},n=a(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:n})},u=e=>{const t=Object(c.a)(e)?e:{},n=a(t.style),r=Object(c.a)(n.typography)?n.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},l=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(c.a)(e)?e:{},n=a(t.style);return Object(r.__experimentalUseColorProps)({...t,style:n})},d=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(c.a)(e)?e:{},n=a(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),o=n(97),i=n(6),c=n(28),a=n(36),s=n(62),u=n(23);const l=e=>{let{queryAttribute:t,queryPrices:n,queryStock:l,queryState:d}=e,p=Object(u.a)();p+="-collection-data";const[f]=Object(a.a)(p),[b,m]=Object(a.b)("calculate_attribute_counts",[],p),[g,h]=Object(a.b)("calculate_price_range",null,p),[v,y]=Object(a.b)("calculate_stock_status_counts",null,p),O=Object(c.a)(t||{}),w=Object(c.a)(n),j=Object(c.a)(l);Object(r.useEffect)(()=>{"object"==typeof O&&Object.keys(O).length&&(b.find(e=>e.taxonomy===O.taxonomy)||m([...b,O]))},[O,b,m]),Object(r.useEffect)(()=>{g!==w&&void 0!==w&&h(w)},[w,h,g]),Object(r.useEffect)(()=>{v!==j&&void 0!==j&&y(j)},[j,y,v]);const[E,I]=Object(r.useState)(!1),[_]=Object(o.a)(E,200);E||I(!0);const S=Object(r.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(i.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(f),[f]);return Object(s.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...d,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...S},shouldSelect:_})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const i=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=i},,,,function(e,t,n){"use strict";var r=n(10),o=n.n(r),i=n(0),c=n(4),a=n.n(c),s=n(1),u=n(102),l=n(178);n(118);var d=e=>{let{text:t,screenReaderText:n="",element:r="li",className:c="",radius:s="small",children:u=null,...l}=e;const d=r,p=a()(c,"wc-block-components-chip","wc-block-components-chip--radius-"+s),f=Boolean(n&&n!==t);return Object(i.createElement)(d,o()({className:p},l),Object(i.createElement)("span",{"aria-hidden":f,className:"wc-block-components-chip__text"},t),f&&Object(i.createElement)("span",{className:"screen-reader-text"},n),u)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:r=!1,onRemove:c=(()=>{}),removeOnAnyClick:p=!1,text:f,screenReaderText:b="",...m}=e;const g=p?"span":"button";if(!t){const e=b&&"string"==typeof b?b:f;t="string"!=typeof e?
|
10 |
/* translators: Remove chip. */
|
11 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
12 |
/* translators: %s text of the chip to remove. */
|
13 |
+
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:r,onClick:c,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c()}},v=p?h:{},y=p?{"aria-hidden":!0}:h;return Object(i.createElement)(d,o()({},m,v,{className:a()(n,"is-removable"),element:p?"button":m.element,screenReaderText:b,text:f}),Object(i.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:l.a,size:16})))}},,,,,,,,,,,,,function(e,t,n){e.exports=n(216)},function(e,t){},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,c=60108,a=60114,s=60109,u=60110,l=60112,d=60113,p=60120,f=60115,b=60116,m=60121,g=60122,h=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),c=O("react.strict_mode"),a=O("react.profiler"),s=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),b=O("react.lazy"),m=O("react.block"),g=O("react.server.block"),h=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case a:case c:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case b:case f:case s:return e;default:return t}}case o:return t}}}var j=s,E=r,I=l,_=i,S=b,k=f,x=o,C=a,P=c,R=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=I,t.Fragment=_,t.Lazy=S,t.Memo=k,t.Portal=x,t.Profiler=C,t.StrictMode=P,t.Suspense=R,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===b},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===a},t.isStrictMode=function(e){return w(e)===c},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===a||e===v||e===c||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===f||e.$$typeof===s||e.$$typeof===u||e.$$typeof===l||e.$$typeof===h||e.$$typeof===m||e[0]===g)},t.typeOf=w},function(e,t,n){"use strict";var r=n(200);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,c){if(c!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint: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:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(49),o=n(0),i=n(1),c=n(20),a=n(28),s=n(57),u=n(36),l=n(62),d=n(140),p=n(109),f=n(4),b=n.n(f);function m(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var g=n(7);function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=n(9),O=n.n(y),w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function I(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function _(e,t,n,r,o,i,c,a){return i<e&&c>t||i>e&&c<t?0:i<=e&&a<=n||c>=t&&a>=n?i-e-r:c>t&&a<n||i<e&&a>n?c-t+o:0}n(130);var S=function(){return(S=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var k=0;function x(e){return"function"==typeof e?e:C}function C(){}function P(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,c=t.boundary,a=t.skipOverflowHiddenElements,s="function"==typeof c?c:function(e){return e!==c};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&s(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&I(d)&&!I(document.documentElement)||null!=d&&I(d,a)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),h=g.height,v=g.width,y=g.top,O=g.right,w=g.bottom,E=g.left,S="start"===o||"nearest"===o?y:"end"===o?w:y+h/2,k="center"===i?E+v/2:"end"===i?O:E,x=[],C=0;C<l.length;C++){var P=l[C],R=P.getBoundingClientRect(),T=R.height,M=R.width,A=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=A&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),V=parseInt(B.borderTopWidth,10),F=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),U=0,q=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-F:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-V-K:0;if(u===P)U="start"===o?S:"end"===o?S-f:"nearest"===o?_(m,m+f,f,V,K,m+S,m+S+h,h):S-f/2,q="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:_(b,b+p,p,L,F,b+k,b+k+v,v),U=Math.max(0,U+m),q=Math.max(0,q+b);else{U="start"===o?S-A-V:"end"===o?S-N+K+W:"nearest"===o?_(A,N,T,V,K+W,S,S+h,h):S-(A+T/2)+W/2,q="start"===i?k-H-L:"center"===i?k-(H+M/2)+$/2:"end"===i?k-D+F+$:_(H,D,M,L,F+$,k,k+v,v);var G=P.scrollLeft,z=P.scrollTop;S+=z-(U=Math.max(0,Math.min(z+U,P.scrollHeight-T+W))),k+=G-(q=Math.max(0,Math.min(G+q,P.scrollWidth-M+$)))}x.push({el:P,top:U,left:q})}return x}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function R(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),c=0;c<o;c++)i[c]=arguments[c];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function D(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function N(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var H=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function B(e){void 0===e&&(e={});var t={};return H.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function L(e,t){return void 0!==e[t]}function V(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function F(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var c=t+e;c<0?c=o?i:0:c>i&&(c=o?0:i);var a=K(e,c,n,r,o);return-1===a?t>=n?-1:t:a}function K(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var c=t+1;c<n;c++)if(!r(c).hasAttribute("disabled"))return c}else for(var a=t-1;a>=0;a--)if(!r(a).hasAttribute("disabled"))return a;return o?e>0?K(1,0,n,r,!1):K(-1,n-1,n,r,!1):-1}function U(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(R(t,e,n)||r&&R(t,n.document.activeElement,n))}))}var q=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,q(t))}function W(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var G=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),z=["refKey","ref"],Y=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Q=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(k++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=B(t),n.internalSetState(Object(g.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=B(t),n.internalSetState(Object(g.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},c="function"==typeof e;return!c&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(g.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var a=c?e(t):e;a=n.props.stateReducer(t,a),r=a.hasOwnProperty("selectedItem");var s={},u={};return r&&a.selectedItem!==t.selectedItem&&(o=a.selectedItem),a.type=a.type||0,Object.keys(a).forEach((function(e){t[e]!==a[e]&&(i[e]=a[e]),"type"!==e&&(u[e]=a[e],L(n.props,e)||(s[e]=a[e]))})),c&&a.hasOwnProperty("inputValue")&&n.props.onInputValueChange(a.inputValue,Object(g.a)({},n.getStateAndHelpers(),a)),s}),(function(){x(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,a=o.ref,s=m(o,z),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=c,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(g.a)(((r={})[c]=A(a,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),s)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=F(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=F(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(g.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(g.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(g.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=K(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,c=t.onBlur,a=m(t,Y),s=n.getState().isOpen,u={onClick:M(r,n.buttonHandleClick),onKeyDown:M(o,n.buttonHandleKeyDown),onKeyUp:M(i,n.buttonHandleKeyUp),onBlur:M(c,n.buttonHandleBlur)},l=a.disabled?{}:u;return Object(g.a)({type:"button",role:"button","aria-label":s?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,a)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=V(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(h(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(g.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,c=t.onInput;t.onChangeText;var a,s=m(t,Q),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((a={}).onChange=M(i,c,n.inputHandleChange),a.onKeyDown=M(r,n.inputHandleKeyDown),a.onBlur=M(o,n.inputHandleBlur),u=a),Object(g.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,s)},n.inputHandleKeyDown=function(e){var t=V(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(h(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,a=o.ref,s=m(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=c,n.getMenuProps.suppressRefError=l,Object(g.a)(((r={})[c]=A(a,n.menuRef),r.role="listbox",r["aria-labelledby"]=s&&s["aria-label"]?null:n.labelId,r.id=n.menuId,r),s)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,c=r.onClick;r.onPress;var a=r.index,s=r.item,u=void 0===s?void 0:s,l=m(r,J);void 0===a?(n.items.push(u),a=n.items.indexOf(u)):n.items[a]=u;var d=c,p=((t={onMouseMove:M(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:M(i,(function(e){e.preventDefault()}))}).onClick=M(d,(function(){n.selectItemAtIndex(a,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(g.a)({id:n.getItemId(a),role:"option","aria-selected":n.getState().highlightedIndex===a},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(g.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=B(e),n.internalSetState((function(t){var r=t.isOpen;return Object(g.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),x(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(g.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,$(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,c=void 0===i?o:i,a=r.defaultIsOpen,s=r.initialIsOpen,u=void 0===s?a:s,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,b=n.getState({highlightedIndex:c,isOpen:u,inputValue:d,selectedItem:f});return null!=b.selectedItem&&void 0===n.props.initialInputValue&&(b.inputValue=n.props.itemToString(b.selectedItem)),n.state=b,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,v(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=L(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=F(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,c=this.id,a=this.getRootProps,s=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,b=this.closeMenu,m=this.toggleMenu,g=this.selectItem,h=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:a,getToggleButtonProps:s,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:b,toggleMenu:m,selectItem:g,selectItemAtIndex:h,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:c,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!U(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=U(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},c=this.props.environment;c.addEventListener("mousedown",t),c.addEventListener("mouseup",n),c.addEventListener("touchstart",r),c.addEventListener("touchmove",o),c.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),c.removeEventListener("mousedown",t),c.removeEventListener("mouseup",n),c.removeEventListener("touchstart",r),c.removeEventListener("touchmove",o),c.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){L(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=N(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=N(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:D,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:P},e.stateChangeTypes=G,e}();T((function(e,t){$(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:P,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),S(S({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),Object(g.a)({},ee,{getA11yStatusMessage:D,circularNavigation:!0}),O.a.array,O.a.array,O.a.array,O.a.func,O.a.func,O.a.func,O.a.number,O.a.number,O.a.number,O.a.func,O.a.func,O.a.string,O.a.string,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:c,onRemoveItem:a,placeholder:s,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:c,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:c,options:a}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,r)=>{const a=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:b()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":c===r}),index:r,item:e.value,"aria-label":a?Object(i.sprintf)(
|
14 |
/* translators: %s is referring to the filter option being removed. */
|
15 |
+
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(182),ie=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(oe.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(i.sprintf)(
|
16 |
/* translators: %s is referring to the filter option being removed. */
|
17 |
+
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},ce=n(102),ae=n(178),se=e=>{let{onClick:t,onRemoveItem:n,option:r}=e;const c=Object(o.useRef)(null);return Object(o.useEffect)(()=>{c.current.focus()},[c]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:c,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(r.value)},"aria-label":Object(i.sprintf)(
|
18 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
19 |
Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)},r.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(r.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(r.value)},"aria-label":Object(i.sprintf)(
|
20 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
21 |
+
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ce.a,{icon:ae.a,size:16})))};n(197);var ue=e=>{let{attributeLabel:t="",className:n,style:r={},checked:c=[],inputLabel:a="",isDisabled:s=!1,isLoading:u=!1,multiple:l=!1,onChange:d=(()=>{}),options:p=[],isCaseSensitive:f=!1}=e;const m=Object(o.useRef)(null),g=b()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":u}),h=Object(o.useCallback)((e,t)=>{switch(t.type){case Z.stateChangeTypes.keyDownEnter:case Z.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:l,inputValue:""};case Z.stateChangeTypes.blurInput:case Z.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[l]);return Object(o.createElement)(Z,{onChange:d,selectedItem:null,stateReducer:h},e=>{let{getInputProps:n,getItemProps:u,getLabelProps:h,getMenuProps:v,highlightedIndex:y,inputValue:O,isOpen:w,openMenu:j}=e;return Object(o.createElement)("div",{className:b()(g,{"is-multiple":l,"is-single":!l,"has-checked":c.length>0,"is-open":w}),style:r},Object(o.createElement)("label",h({className:"screen-reader-text"}),a),Object(o.createElement)(ne,{isOpen:w,onClick:()=>m.current.focus()},c.map(e=>{const t=p.find(t=>t.value===e),n=e=>{d(e),m.current.focus()};return l?Object(o.createElement)(ie,{key:e,onRemoveItem:n,option:t}):Object(o.createElement)(se,{key:e,onClick:()=>m.current.focus(),onRemoveItem:n,option:t})}),Object(o.createElement)(te,{checked:c,getInputProps:n,inputRef:m,isDisabled:s,onFocus:j,onRemoveItem:e=>{d(e),m.current.focus()},placeholder:c.length>0&&l?null:Object(i.sprintf)(
|
22 |
/* translators: %s attribute name. */
|
23 |
+
Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!l&&c.length>0?"-1":"0",value:O})),w&&!s&&Object(o.createElement)(re,{checked:c,getItemProps:u,getMenuProps:v,highlightedIndex:y,options:p.filter(e=>{let t=e.name,n=null==O?void 0:O.trim();var r;return f||(t=t.toLowerCase(),n=null===(r=n)||void 0===r?void 0:r.toLowerCase()),!n||t.includes(n)})}))})},le=n(50),de=n(74),pe=n(11),fe=n.n(pe),be=n(19),me=n(98),ge=n(107),he=n(108);const ve=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(le.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(le.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(le.a,{name:"Red",count:2})}],ye={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var Oe=n(133);n(196);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=t.isPreview&&!t.attributeId?ye:Object(ge.a)(t.attributeId),[f,m]=Object(o.useState)([]),[g,h]=Object(o.useState)(t.isPreview&&!t.attributeId?ve:[]),v=Object(Oe.a)(t),[y]=Object(u.a)(),[O,w]=Object(u.b)("attributes",[]),{results:j,isLoading:E}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==r?void 0:r.id)||0],shouldSelect:t.attributeId>0}),I="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:_,isLoading:S}=Object(d.a)({queryAttribute:{taxonomy:null==r?void 0:r.taxonomy,queryType:t.queryType},queryState:{...y,attributes:I?y.attributes:null}}),k=Object(o.useCallback)(e=>_.attribute_counts?_.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[_]);Object(o.useEffect)(()=>{if(E||S)return;const e=j.map(e=>{const n=k(e.id);if(!(n||f.includes(e.slug)||(i=e.slug,null!=y&&y.attributes&&y.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===r.taxonomy&&n.includes(i)}))))return null;var i;const c=n?n.count:0;return{value:e.slug,name:Object(be.decodeEntities)(e.name),label:Object(o.createElement)(le.a,{name:Object(be.decodeEntities)(e.name),count:t.showCounts?c:null})}}).filter(Boolean);h(e)},[null==r?void 0:r.taxonomy,j,E,t.showCounts,S,k,f,y.attributes]);const x=Object(o.useCallback)(e=>j.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]),[j]),C=Object(o.useCallback)(e=>{n||Object(he.b)(O,w,r,x(e),"or"===t.queryType?"in":"and")},[n,O,w,r,x,t.queryType]),P=Object(o.useMemo)(()=>O.filter(e=>{let{attribute:t}=e;return t===(null==r?void 0:r.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[O,null==r?void 0:r.taxonomy]),R=Object(a.a)(P),T=Object(s.a)(R);Object(o.useEffect)(()=>{fe()(T,R)||fe()(f,R)||(m(R),t.showFilterButton||C(R))},[f,R,T,C,t.showFilterButton]);const M="dropdown"!==t.displayStyle||"or"===t.queryType,A=Object(o.useCallback)(e=>{const n=e=>{const{name:t}=g.find(t=>t.value===e);return t},r=e=>{let{filterAdded:t,filterRemoved:r}=e;const o=t?n(t):null,a=r?n(r):null;o&&a?Object(c.speak)(Object(i.sprintf)(
|
24 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
25 |
Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,a)):o?Object(c.speak)(Object(i.sprintf)(
|
26 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
27 |
Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):a&&Object(c.speak)(Object(i.sprintf)(
|
28 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
29 |
+
Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),a))},o=f.includes(e);let a;M?(a=f.filter(t=>t!==e),o?r({filterRemoved:e}):(a.push(e),a.sort(),r({filterAdded:e}))):(a=o?[]:[e],r({filterAdded:o?null:e,filterRemoved:1===f.length?f[0]:null})),m(a),t.showFilterButton||C(a)},[f,g,M,C,t.showFilterButton]);if(!r)return n?Object(o.createElement)(me.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===g.length&&!E)return n?Object(o.createElement)(me.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const D="h"+t.headingLevel,N=!t.isPreview&&E,H=!t.isPreview&&S;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&g.length>0&&Object(o.createElement)(D,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(ue,{attributeLabel:r.label,checked:f,className:b()("wc-block-attribute-filter-dropdown",v.className),style:{...v.style,borderStyle:"none"},inputLabel:t.heading,isLoading:N,multiple:M,onChange:A,options:g}):Object(o.createElement)(p.a,{className:"wc-block-attribute-filter-list",options:g,checked:f,onChange:A,isLoading:N,isDisabled:H}),t.showFilterButton&&Object(o.createElement)(de.a,{className:"wc-block-attribute-filter__button",disabled:N||H,onClick:()=>C(f)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||0,10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType,heading:e.dataset.heading,headingLevel:e.dataset.headingLevel||3,displayStyle:e.dataset.displayStyle,showFilterButton:"true"===e.dataset.showFilterButton}})})}]);
|
build/attribute-filter.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', '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-settings', 'wp-a11y', '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' => '06fd937a761c22b112414054c5535c92');
|
build/attribute-filter.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&d.push(o[l][0]),o[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return r.push.apply(r,i||[]),c()}function c(){for(var e,t=0;t<r.length;t++){for(var c=r[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==o[s]&&(n=!1)}n&&(r.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},o={8:0,1:0,2:0},r=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return r.push([
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
-
Object(r.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:r,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:r}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,r,a))})}}t.a=i},105:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(29);c(
|
4 |
/* translators: %s number of products. */
|
5 |
-
Object(o._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},
|
6 |
/* translators: Submit button text for filters. */
|
7 |
-
r=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(n.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:c,onClick:s},Object(n.createElement)(a.a,{label:r,screenReaderLabel:i}))}},15:function(e,t){e.exports=window.wc.wcBlocksData},
|
8 |
/* translators: %s is referring the remaining count of options */
|
9 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
10 |
/* translators: %s number of options to reveal. */
|
@@ -12,29 +12,29 @@ Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e))
|
|
12 |
/* Translators: %s search term */
|
13 |
noResults:Object(r.__)("No results for %s","woo-gutenberg-products-block"),search:Object(r.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(r.sprintf)(
|
14 |
/* translators: Number of items selected from list. */
|
15 |
-
Object(r._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(r.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),n=Object(o.keyBy)(t,"id"),r=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(n[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return r.push(""+e.id),{...e,breadcrumbs:l(n[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;r.includes(t)||s.push(...a(c||[]))}),s},s=(e,t,c)=>{if(!t)return c?a(e):e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(n.createElement)(n.Fragment,{key:c},Object(n.createElement)("strong",null,t),e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},
|
16 |
/* translators: Remove chip. */
|
17 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
18 |
/* translators: %s text of the chip to remove. */
|
19 |
-
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},h=d?j:{},f=d?{"aria-hidden":!0}:j;return Object(r.createElement)(b,o()({},g,h,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(r.createElement)(O,o()({className:"wc-block-components-chip__remove"},f),Object(r.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},22:function(e,t,c){"use strict";c.d(t,"o",(function(){return r})),c.d(t,"m",(function(){return l})),c.d(t,"l",(function(){return a})),c.d(t,"n",(function(){return s})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return b})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return f}));var n,o=c(2);const r=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=r.pluginUrl+"images/",a=r.pluginUrl+"build/",s=r.buildPhase,i=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,m=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),p=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),f=Object(o.getSetting)("allowedStates",{})},
|
20 |
/* translators: %s is referring to the filter option being removed. */
|
21 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},I=c(
|
22 |
/* translators: %s is referring to the filter option being removed. */
|
23 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},
|
24 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
25 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(r.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{c(n.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c(n.value)},"aria-label":Object(l.sprintf)(
|
26 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
27 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(r.createElement)(u.a,{icon:
|
28 |
/* translators: %s attribute name. */
|
29 |
-
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&o.length>0?"-1":"0",value:
|
30 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
31 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,r)):o?Object(v.speak)(Object(l.sprintf)(
|
32 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
33 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),o)):r&&Object(v.speak)(Object(l.sprintf)(
|
34 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
35 |
-
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),r))},r=o.includes(e);let i;
|
36 |
/* translators: %s attribute name. */
|
37 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),r)})},R=e=>{let{isCompact:t}=e;const c={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
|
38 |
/* translators: %d is the number of attributes selected. */
|
39 |
-
Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},n=Object(j.sortBy)(Object(j.toArray)(Object(j.mapValues)(Q,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(r.createElement)(O.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===o}),onChange:P,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(Q).length?Object(r.createElement)(p.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(h.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(r.createElement)(u.a,{icon:g.a})),Object(r.createElement)(p.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(r.createElement)("div",N,Object(r.createElement)(s.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(r.createElement)(s.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:E?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:E,onChange:()=>c({showCounts:!E})}),Object(r.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(r.createElement)(f.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:v,onChange:e=>c({headingLevel:e})})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(r.createElement)(_.a,{label:Object(l.__)("Query Type","woo-gutenberg-products-block"),help:"and"===y?Object(l.__)("Products that have all of the selected attributes will be shown.","woo-gutenberg-products-block"):Object(l.__)("Products that have any of the selected attributes will be shown.","woo-gutenberg-products-block"),value:y,options:[{label:Object(l.__)("And","woo-gutenberg-products-block"),value:"and"},{label:Object(l.__)("Or","woo-gutenberg-products-block"),value:"or"}],onChange:e=>c({queryType:e})}),Object(r.createElement)(_.a,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,options:[{label:Object(l.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(l.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:e=>c({displayStyle:e})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:S?Object(l.__)("Products will only update when the button is pressed.","woo-gutenberg-products-block"):Object(l.__)("Products will update as options are selected.","woo-gutenberg-products-block"),checked:S,onChange:e=>c({showFilterButton:e})})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},R({isCompact:!0}))),C?Object(r.createElement)(p.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("div",{className:"wc-block-attribute-filter__selection"},R({isCompact:!1}),Object(r.createElement)(p.Button,{isPrimary:!0,onClick:()=>{x(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(r.createElement)(w.a,{className:"wc-block-attribute-filter__title",headingLevel:v,heading:d,onChange:e=>c({heading:e})}),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(K,{attributes:t,isEditor:!0}))))});Object(a.registerBlockType)("woocommerce/attribute-filter",{apiVersion:2,title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woo-gutenberg-products-block"),supports:{html:!1,color:{text:!0,background:!1},...Object(i.b)()&&{__experimentalBorder:{radius:!0,color:!0,width:!1}}},example:{attributes:{isPreview:!0}},attributes:{attributeId:{type:"number",default:0},showCounts:{type:"boolean",default:!0},queryType:{type:"string",default:"or"},heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3},displayStyle:{type:"string",default:"list"},showFilterButton:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},edit:W,save(e){let{attributes:t}=e;const{className:c,showCounts:n,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d}=t,p={"data-attribute-id":a,"data-show-counts":n,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(p["data-display-style"]=b),d&&(p["data-show-filter-button"]=d),Object(r.createElement)("div",o()({},s.useBlockProps.save({className:m()("is-loading",c)}),p),Object(r.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},48:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),o=c(25),r=c.n(o);function l(e){const t=Object(n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},49:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return o}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return n(e)&&t in e}},51:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)("page"),r=()=>Object(n.useContext)(o);o.Provider},53:function(e,t,c){"use strict";c.d(t,"c",(function(){return r})),c.d(t,"d",(function(){return l})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var n=c(14),o=c(22);const r=(e,t)=>{if(o.n>2)return Object(n.registerBlockType)(e,t)},l=(e,t)=>{if(o.n>1)return Object(n.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},58:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(3),i=c(9);c(89);class u extends r.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:l,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let d;return l&&(d="function"==typeof l?l(t):l),Object(r.createElement)(s.BaseControl,{id:b,help:d,className:a()("components-toggle-button-control",n)},Object(r.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(r.createElement)(s.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const n={};return u===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(r.createElement)(s.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(i.withInstanceId)(u)},6:function(e,t){e.exports=window.wp.blockEditor},7:function(e,t){e.exports=window.lodash},77:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var n=c(15),o=c(13),r=c(0),l=c(25),a=c.n(l),s=c(48),i=c(108),u=c(51);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(r.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(r.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,o]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(r.useRef)(!1);return Object(r.useEffect)(()=>{a()(m,d)||(o(Object.assign({},l,d)),p.current=!0)},[l,d,m,o]),p.current?[n,o]:[e,o]}},8:function(e,t){e.exports=window.React},85:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(6);const o=()=>"function"==typeof n.__experimentalGetSpacingClassesAndStyles},89:function(e,t){},9:function(e,t){e.exports=window.wp.compose},96:function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(3),s=c(112),i=c(489),u=c(4),b=c.n(u),d=c(9),m=c(20),p=c(33),g=c(488),O=c(17);const j=e=>{let{id:t,label:c,popoverContents:n,remove:o,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(r.useState)(!1),h=Object(d.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const f=b()("woocommerce-tag",u,{"has-remove":!!o}),w="woocommerce-tag__label-"+h,_=Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},i),Object(r.createElement)("span",{"aria-hidden":"true"},c));return Object(r.createElement)("span",{className:f},n?Object(r.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(r.createElement)("span",{className:"woocommerce-tag__text",id:w},_),n&&m&&Object(r.createElement)(a.Popover,{onClose:()=>p(!1)},n),o&&Object(r.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(l.sprintf)(// Translators: %s label.
|
40 |
Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":w},Object(r.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const f=e=>Object(r.createElement)(p.b,e),w=e=>{const{list:t,selected:c,renderItem:n,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(r.createElement)(r.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(r.createElement)(r.Fragment,{key:t.id},Object(r.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(r.createElement)(w,o()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:c,selected:n,messages:o,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(r.createElement)("div",{className:"woocommerce-search-list__selected"},Object(r.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(r.createElement)("strong",null,o.selected(u)),u>0?Object(r.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(r.createElement)("ul",null,n.map((e,t)=>Object(r.createElement)("li",{key:t},Object(r.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:o,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||f;return 0===t.length?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(r.createElement)(s.a,{icon:i.a})),Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(r.createElement)("ul",{className:"woocommerce-search-list__list"},Object(r.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:o,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:n,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,f]=Object(r.useState)(""),w=Object(d.useInstanceId)(k),y=Object(r.useMemo)(()=>({...m.a,...u}),[u]),E=Object(r.useMemo)(()=>Object(m.c)(i,h,n),[i,h,n]);Object(r.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(r.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(r.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(r.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(r.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(r.createElement)(_,o()({},e,{onRemove:S,messages:y})),Object(r.createElement)("div",{className:"woocommerce-search-list__search"},Object(r.createElement)(a.TextControl,{label:y.search,type:"search",value:h,onChange:e=>f(e)})),l?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(r.createElement)(a.Spinner,null)):Object(r.createElement)(v,o()({},e,{search:h,filteredList:E,messages:y,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(k)}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var n,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&d.push(o[l][0]),o[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);d.length;)d.shift()();return r.push.apply(r,i||[]),c()}function c(){for(var e,t=0;t<r.length;t++){for(var c=r[t],n=!0,a=1;a<c.length;a++){var s=c[a];0!==o[s]&&(n=!1)}n&&(r.splice(t--,1),e=l(l.s=c[0]))}return e}var n={},o={8:0,1:0,2:0},r=[];function l(t){if(n[t])return n[t].exports;var c=n[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,l),c.l=!0,c.exports}l.m=e,l.c=n,l.d=function(e,t,c){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(l.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(c,n,function(t){return e[t]}.bind(null,n));return c},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return r.push([384,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},100:function(e,t,c){"use strict";var n=c(0),o=c(7),r=c(1),l=c(3),a=c(11);function s(e){let{level:t}=e;const c={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 c.hasOwnProperty(t)?Object(n.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(a.Path,{d:c[t]})):null}class i extends n.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(n.createElement)(s,{level:e}),title:Object(r.sprintf)(
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
+
Object(r.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:r,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:r}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,r,a))})}}t.a=i},105:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(29);c(231),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,Number.isFinite(c)&&Object(n.createElement)(r.a,{label:c.toString(),screenReaderLabel:Object(o.sprintf)(
|
4 |
/* translators: %s number of products. */
|
5 |
+
Object(o._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},107:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(8);function o(e,t){const c=Object(n.useRef)();return Object(n.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},11:function(e,t){e.exports=window.wp.primitives},119:function(e,t,c){"use strict";var n=c(0),o=c(6),r=c(9),l=c(1);c(155),t.a=Object(r.withInstanceId)(e=>{let{className:t,headingLevel:c,onChange:r,heading:a,instanceId:s}=e;const i="h"+c;return Object(n.createElement)(i,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(o.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:r}))})},120:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},124:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(15),o=c(13),r=c(0),l=c(49),a=c(124);const s=e=>{const{namespace:t,resourceName:c,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(r.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),r=[t,c,d,m],l=o.getCollectionError(...r);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:o.getCollection(...r),isLoading:!o.hasFinishedResolution("getCollection",r)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},13:function(e,t){e.exports=window.wp.data},14:function(e,t){e.exports=window.wp.blocks},142:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),l=c.n(r),a=c(29);c(182),t.a=e=>{let{className:t,disabled:c,label:
|
6 |
/* translators: Submit button text for filters. */
|
7 |
+
r=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(n.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:c,onClick:s},Object(n.createElement)(a.a,{label:r,screenReaderLabel:i}))}},15:function(e,t){e.exports=window.wc.wcBlocksData},155:function(e,t){},156:function(e,t){},17:function(e,t){e.exports=window.wp.htmlEntities},182:function(e,t){},191:function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return l}));var n=c(2);const o=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const c=(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;var n;return c.id&&e.push(c),e},[]),r=e=>{if(e)return o.find(t=>t.id===e)},l=e=>{if(e)return o.find(t=>t.taxonomy===e)}},192:function(e,t,c){"use strict";c.d(t,"a",(function(){return o})),c.d(t,"b",(function(){return r}));var n=c(7);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const r=e.filter(e=>e.attribute===c.taxonomy),l=r.length?r[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(o)))return;const a=l.slug.filter(e=>e!==o),s=e.filter(e=>e.attribute!==c.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},r=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},c=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";const l=e.filter(e=>e.attribute!==c.taxonomy);0===o.length?t(l):(l.push({attribute:c.taxonomy,operator:r,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute")))}},193:function(e,t,c){"use strict";var n=c(0),o=c(1),r=c(4),l=c.n(r);c(232),t.a=e=>{let{className:t,onChange:c=(()=>{}),options:r=[],checked:a=[],isLoading:s=!1,isDisabled:i=!1,limit:u=10}=e;const[b,d]=Object(n.useState)(!1),m=Object(n.useMemo)(()=>[...Array(5)].map((e,t)=>Object(n.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),p=Object(n.useMemo)(()=>{const e=r.length-u;return!b&&Object(n.createElement)("li",{key:"show-more",className:"show-more"},Object(n.createElement)("button",{onClick:()=>{d(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
|
8 |
/* translators: %s is referring the remaining count of options */
|
9 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
10 |
/* translators: %s number of options to reveal. */
|
12 |
/* Translators: %s search term */
|
13 |
noResults:Object(r.__)("No results for %s","woo-gutenberg-products-block"),search:Object(r.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(r.sprintf)(
|
14 |
/* translators: Number of items selected from list. */
|
15 |
+
Object(r._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(r.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),n=Object(o.keyBy)(t,"id"),r=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(n[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=c[e.id];return r.push(""+e.id),{...e,breadcrumbs:l(n[e.parent]),children:t&&t.length?a(t):[]}}),s=a(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;r.includes(t)||s.push(...a(c||[]))}),s},s=(e,t,c)=>{if(!t)return c?a(e):e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(c).map((e,c)=>0===c?e:Object(n.createElement)(n.Fragment,{key:c},Object(n.createElement)("strong",null,t),e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},201:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(1),i=c(111),u=c(517);c(156);var b=e=>{let{text:t,screenReaderText:c="",element:n="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=n,d=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),m=Boolean(c&&c!==t);return Object(r.createElement)(b,o()({className:d},u),Object(r.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(r.createElement)("span",{className:"screen-reader-text"},c),i)};t.a=e=>{let{ariaLabel:t="",className:c="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:d=!1,text:m,screenReaderText:p="",...g}=e;const O=d?"span":"button";if(!t){const e=p&&"string"==typeof p?p:m;t="string"!=typeof e?
|
16 |
/* translators: Remove chip. */
|
17 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
18 |
/* translators: %s text of the chip to remove. */
|
19 |
+
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},h=d?j:{},f=d?{"aria-hidden":!0}:j;return Object(r.createElement)(b,o()({},g,h,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(r.createElement)(O,o()({className:"wc-block-components-chip__remove"},f),Object(r.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},22:function(e,t,c){"use strict";c.d(t,"o",(function(){return r})),c.d(t,"m",(function(){return l})),c.d(t,"l",(function(){return a})),c.d(t,"n",(function(){return s})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return b})),c.d(t,"g",(function(){return d})),c.d(t,"k",(function(){return m})),c.d(t,"c",(function(){return p})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return f}));var n,o=c(2);const r=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=r.pluginUrl+"images/",a=r.pluginUrl+"build/",s=r.buildPhase,i=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,m=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),p=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),f=Object(o.getSetting)("allowedStates",{})},231:function(e,t){},232:function(e,t){},25:function(e,t){e.exports=window.wp.isShallowEqual},281:function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var n=c(0),o=c(259),r=c(7),l=c(49),a=c(78),s=c(125),i=c(52);const u=e=>{let{queryAttribute:t,queryPrices:c,queryStock:u,queryState:b}=e,d=Object(i.a)();d+="-collection-data";const[m]=Object(a.a)(d),[p,g]=Object(a.b)("calculate_attribute_counts",[],d),[O,j]=Object(a.b)("calculate_price_range",null,d),[h,f]=Object(a.b)("calculate_stock_status_counts",null,d),w=Object(l.a)(t||{}),_=Object(l.a)(c),v=Object(l.a)(u);Object(n.useEffect)(()=>{"object"==typeof w&&Object.keys(w).length&&(p.find(e=>e.taxonomy===w.taxonomy)||g([...p,w]))},[w,p,g]),Object(n.useEffect)(()=>{O!==_&&void 0!==_&&j(_)},[_,j,O]),Object(n.useEffect)(()=>{h!==v&&void 0!==v&&f(v)},[v,f,h]);const[k,y]=Object(n.useState)(!1),[E]=Object(o.a)(k,200);k||y(!0);const S=Object(n.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(r.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:c}=e;return{taxonomy:t,query_type:c}}),["taxonomy","query_type"])),t})(m),[m]);return Object(s.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...b,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...S},shouldSelect:E})}},29:function(e,t,c){"use strict";var n=c(0),o=c(4),r=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=c,i=null!=o;return!s&&i?(t=l||"span",a={...a,className:r()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,o)):(t=l||n.Fragment,s&&i&&c!==o?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},c),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,a,c))}},3:function(e,t){e.exports=window.wp.components},33:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var n=c(5),o=c.n(n),r=c(0),l=c(20);const a=e=>{let{countLabel:t,className:c,depth:n=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+n),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=m.name||"search-list-item-"+a,h=`${j}-${s.id}`;return Object(r.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(r.createElement)("input",o()({type:"radio",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(r.createElement)("input",o()({type:"checkbox",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(r.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(r.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(r.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(r.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},384:function(e,t,c){e.exports=c(454)},385:function(e,t){},386:function(e,t){},387:function(e,t){},39:function(e,t,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return b})),c.d(t,"a",(function(){return d}));var n=c(6),o=c(54),r=c(120),l=c(50),a=c(82);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(l.a)(e)?e:{},i=e=>{if(!Object(o.b)()||!Object(a.a)())return{style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(l.a)(e)?e:{},c=s(t.style),n=Object(l.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}},b=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalUseColorProps)({...t,style:c})},d=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalUseBorderProps)({...t,style:c})}},44:function(e,t){e.exports=window.wp.a11y},454:function(e,t,c){"use strict";c.r(t);var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(14),s=c(6),i=c(54),u=c(111),b=c(500),d=c(4),m=c.n(d),p=c(3),g=c(219),O=c(96),j=c(7),h=c(2),f=c(100),w=c(119),_=c(60),v=c(44),k=c(49),y=c(107),E=c(78),S=c(125),C=c(281),x=c(193),N=c(170),P=e=>{let{checked:t,getInputProps:c,inputRef:n,isDisabled:o,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(r.createElement)("input",c({ref:n,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:o,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},R=e=>{let{children:t,onClick:c}=e;return Object(r.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:c},t)},T=e=>{let{checked:t,getItemProps:c,getMenuProps:n,highlightedIndex:o,options:a}=e;return Object(r.createElement)("ul",n({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,n)=>{const a=t.includes(e.value);return Object(r.createElement)("li",c({key:e.value,className:m()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":o===n}),index:n,item:e.value,"aria-label":a?Object(l.sprintf)(
|
20 |
/* translators: %s is referring to the filter option being removed. */
|
21 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},I=c(201),L=e=>{let{onRemoveItem:t,option:c}=e;return Object(r.createElement)(I.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(c.value)},ariaLabel:Object(l.sprintf)(
|
22 |
/* translators: %s is referring to the filter option being removed. */
|
23 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},B=c(517),A=e=>{let{onClick:t,onRemoveItem:c,option:n}=e;const o=Object(r.useRef)(null);return Object(r.useEffect)(()=>{o.current.focus()},[o]),Object(r.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(r.createElement)("button",{ref:o,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(n.value)},"aria-label":Object(l.sprintf)(
|
24 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
25 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(r.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{c(n.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c(n.value)},"aria-label":Object(l.sprintf)(
|
26 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
27 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(r.createElement)(u.a,{icon:B.a,size:16})))};c(387);var F=e=>{let{attributeLabel:t="",className:c,style:n={},checked:o=[],inputLabel:a="",isDisabled:s=!1,isLoading:i=!1,multiple:u=!1,onChange:b=(()=>{}),options:d=[],isCaseSensitive:p=!1}=e;const g=Object(r.useRef)(null),O=m()(c,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":i}),j=Object(r.useCallback)((e,t)=>{switch(t.type){case N.a.stateChangeTypes.keyDownEnter:case N.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case N.a.stateChangeTypes.blurInput:case N.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(r.createElement)(N.a,{onChange:b,selectedItem:null,stateReducer:j},e=>{let{getInputProps:c,getItemProps:i,getLabelProps:j,getMenuProps:h,highlightedIndex:f,inputValue:w,isOpen:_,openMenu:v}=e;return Object(r.createElement)("div",{className:m()(O,{"is-multiple":u,"is-single":!u,"has-checked":o.length>0,"is-open":_}),style:n},Object(r.createElement)("label",j({className:"screen-reader-text"}),a),Object(r.createElement)(R,{isOpen:_,onClick:()=>g.current.focus()},o.map(e=>{const t=d.find(t=>t.value===e),c=e=>{b(e),g.current.focus()};return u?Object(r.createElement)(L,{key:e,onRemoveItem:c,option:t}):Object(r.createElement)(A,{key:e,onClick:()=>g.current.focus(),onRemoveItem:c,option:t})}),Object(r.createElement)(P,{checked:o,getInputProps:c,inputRef:g,isDisabled:s,onFocus:v,onRemoveItem:e=>{b(e),g.current.focus()},placeholder:o.length>0&&u?null:Object(l.sprintf)(
|
28 |
/* translators: %s attribute name. */
|
29 |
+
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&o.length>0?"-1":"0",value:w})),_&&!s&&Object(r.createElement)(T,{checked:o,getItemProps:i,getMenuProps:h,highlightedIndex:f,options:d.filter(e=>{let t=e.name,c=null==w?void 0:w.trim();var n;return p||(t=t.toLowerCase(),c=null===(n=c)||void 0===n?void 0:n.toLowerCase()),!c||t.includes(c)})}))})},M=c(105),V=c(142),H=c(25),q=c.n(H),D=c(17),z=c(191),G=c(192);const $=[{value:"preview-1",name:"Blue",label:Object(r.createElement)(M.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(r.createElement)(M.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(r.createElement)(M.a,{name:"Red",count:2})}],U={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var Y=c(39);c(386);var K=e=>{let{attributes:t,isEditor:c=!1}=e;const n=t.isPreview&&!t.attributeId?U:Object(z.a)(t.attributeId),[o,a]=Object(r.useState)([]),[s,i]=Object(r.useState)(t.isPreview&&!t.attributeId?$:[]),u=Object(Y.a)(t),[b]=Object(E.a)(),[d,g]=Object(E.b)("attributes",[]),{results:O,isLoading:j}=Object(S.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==n?void 0:n.id)||0],shouldSelect:t.attributeId>0}),h="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:f,isLoading:w}=Object(C.a)({queryAttribute:{taxonomy:null==n?void 0:n.taxonomy,queryType:t.queryType},queryState:{...b,attributes:h?b.attributes:null}}),_=Object(r.useCallback)(e=>f.attribute_counts?f.attribute_counts.find(t=>{let{term:c}=t;return c===e}):null,[f]);Object(r.useEffect)(()=>{if(j||w)return;const e=O.map(e=>{const c=_(e.id);if(!(c||o.includes(e.slug)||(l=e.slug,null!=b&&b.attributes&&b.attributes.some(e=>{let{attribute:t,slug:c=[]}=e;return t===n.taxonomy&&c.includes(l)}))))return null;var l;const a=c?c.count:0;return{value:e.slug,name:Object(D.decodeEntities)(e.name),label:Object(r.createElement)(M.a,{name:Object(D.decodeEntities)(e.name),count:t.showCounts?a:null})}}).filter(Boolean);i(e)},[null==n?void 0:n.taxonomy,O,j,t.showCounts,w,_,o,b.attributes]);const N=Object(r.useCallback)(e=>O.reduce((t,c)=>(e.includes(c.slug)&&t.push(c),t),[]),[O]),P=Object(r.useCallback)(e=>{c||Object(G.b)(d,g,n,N(e),"or"===t.queryType?"in":"and")},[c,d,g,n,N,t.queryType]),R=Object(r.useMemo)(()=>d.filter(e=>{let{attribute:t}=e;return t===(null==n?void 0:n.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[d,null==n?void 0:n.taxonomy]),T=Object(k.a)(R),I=Object(y.a)(T);Object(r.useEffect)(()=>{q()(I,T)||q()(o,T)||(a(T),t.showFilterButton||P(T))},[o,T,I,P,t.showFilterButton]);const L="dropdown"!==t.displayStyle||"or"===t.queryType,B=Object(r.useCallback)(e=>{const c=e=>{const{name:t}=s.find(t=>t.value===e);return t},n=e=>{let{filterAdded:t,filterRemoved:n}=e;const o=t?c(t):null,r=n?c(n):null;o&&r?Object(v.speak)(Object(l.sprintf)(
|
30 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
31 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,r)):o?Object(v.speak)(Object(l.sprintf)(
|
32 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
33 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),o)):r&&Object(v.speak)(Object(l.sprintf)(
|
34 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
35 |
+
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),r))},r=o.includes(e);let i;L?(i=o.filter(t=>t!==e),r?n({filterRemoved:e}):(i.push(e),i.sort(),n({filterAdded:e}))):(i=r?[]:[e],n({filterAdded:r?null:e,filterRemoved:1===o.length?o[0]:null})),a(i),t.showFilterButton||P(i)},[o,s,L,P,t.showFilterButton]);if(!n)return c?Object(r.createElement)(p.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===s.length&&!j)return c?Object(r.createElement)(p.Notice,{status:"warning",isDismissible:!1},Object(r.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const A="h"+t.headingLevel,H=!t.isPreview&&j,K=!t.isPreview&&w;return Object(r.createElement)(r.Fragment,null,!c&&t.heading&&s.length>0&&Object(r.createElement)(A,{className:"wc-block-attribute-filter__title"},t.heading),Object(r.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(r.createElement)(F,{attributeLabel:n.label,checked:o,className:m()("wc-block-attribute-filter-dropdown",u.className),style:{...u.style,borderStyle:"none"},inputLabel:t.heading,isLoading:H,multiple:L,onChange:B,options:s}):Object(r.createElement)(x.a,{className:"wc-block-attribute-filter-list",options:s,checked:o,onChange:B,isLoading:H,isDisabled:K}),t.showFilterButton&&Object(r.createElement)(V.a,{className:"wc-block-attribute-filter__button",disabled:H||K,onClick:()=>P(o)})))};c(385);const Q=Object(h.getSetting)("attributes",[]);var W=Object(p.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c,debouncedSpeak:n}=e;const{attributeId:o,className:a,displayStyle:i,heading:d,headingLevel:v,isPreview:k,queryType:y,showCounts:E,showFilterButton:S}=t,[C,x]=Object(r.useState)(!o&&!k),N=Object(s.useBlockProps)(),P=e=>{if(!e||!e.length)return;const t=e[0].id,n=Q.find(e=>e.attribute_id===t.toString());if(!n||o===t)return;const r=n.attribute_label;c({attributeId:t,heading:Object(l.sprintf)(
|
36 |
/* translators: %s attribute name. */
|
37 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),r)})},R=e=>{let{isCompact:t}=e;const c={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
|
38 |
/* translators: %d is the number of attributes selected. */
|
39 |
+
Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},n=Object(j.sortBy)(Object(j.toArray)(Object(j.mapValues)(Q,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(r.createElement)(O.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===o}),onChange:P,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(Q).length?Object(r.createElement)(p.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(h.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(r.createElement)(u.a,{icon:g.a})),Object(r.createElement)(p.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(r.createElement)("div",N,Object(r.createElement)(s.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(r.createElement)(s.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:E?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:E,onChange:()=>c({showCounts:!E})}),Object(r.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(r.createElement)(f.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:v,onChange:e=>c({headingLevel:e})})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(r.createElement)(_.a,{label:Object(l.__)("Query Type","woo-gutenberg-products-block"),help:"and"===y?Object(l.__)("Products that have all of the selected attributes will be shown.","woo-gutenberg-products-block"):Object(l.__)("Products that have any of the selected attributes will be shown.","woo-gutenberg-products-block"),value:y,options:[{label:Object(l.__)("And","woo-gutenberg-products-block"),value:"and"},{label:Object(l.__)("Or","woo-gutenberg-products-block"),value:"or"}],onChange:e=>c({queryType:e})}),Object(r.createElement)(_.a,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,options:[{label:Object(l.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(l.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:e=>c({displayStyle:e})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:S?Object(l.__)("Products will only update when the button is pressed.","woo-gutenberg-products-block"):Object(l.__)("Products will update as options are selected.","woo-gutenberg-products-block"),checked:S,onChange:e=>c({showFilterButton:e})})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},R({isCompact:!0}))),C?Object(r.createElement)(p.Placeholder,{className:"wc-block-attribute-filter",icon:Object(r.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(r.createElement)("div",{className:"wc-block-attribute-filter__selection"},R({isCompact:!1}),Object(r.createElement)(p.Button,{isPrimary:!0,onClick:()=>{x(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(r.createElement)(w.a,{className:"wc-block-attribute-filter__title",headingLevel:v,heading:d,onChange:e=>c({heading:e})}),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(K,{attributes:t,isEditor:!0}))))});Object(a.registerBlockType)("woocommerce/attribute-filter",{apiVersion:2,title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woo-gutenberg-products-block"),supports:{html:!1,color:{text:!0,background:!1},...Object(i.b)()&&{__experimentalBorder:{radius:!0,color:!0,width:!1}}},example:{attributes:{isPreview:!0}},attributes:{attributeId:{type:"number",default:0},showCounts:{type:"boolean",default:!0},queryType:{type:"string",default:"or"},heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")},headingLevel:{type:"number",default:3},displayStyle:{type:"string",default:"list"},showFilterButton:{type:"boolean",default:!1},isPreview:{type:"boolean",default:!1}},edit:W,save(e){let{attributes:t}=e;const{className:c,showCounts:n,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d}=t,p={"data-attribute-id":a,"data-show-counts":n,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(p["data-display-style"]=b),d&&(p["data-show-filter-button"]=d),Object(r.createElement)("div",o()({},s.useBlockProps.save({className:m()("is-loading",c)}),p),Object(r.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},49:function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var n=c(0),o=c(25),r=c.n(o);function l(e){const t=Object(n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},50:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return o}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return n(e)&&t in e}},52:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(0);const o=Object(n.createContext)("page"),r=()=>Object(n.useContext)(o);o.Provider},54:function(e,t,c){"use strict";c.d(t,"c",(function(){return r})),c.d(t,"d",(function(){return l})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var n=c(14),o=c(22);const r=(e,t)=>{if(o.n>2)return Object(n.registerBlockType)(e,t)},l=(e,t)=>{if(o.n>1)return Object(n.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},6:function(e,t){e.exports=window.wp.blockEditor},60:function(e,t,c){"use strict";var n=c(5),o=c.n(n),r=c(0),l=c(4),a=c.n(l),s=c(3),i=c(9);c(90);class u extends r.Component{constructor(){super(...arguments),this.onClick=this.onClick.bind(this)}onClick(e){this.props.onChange&&this.props.onChange(e.target.value)}render(){const{label:e,checked:t,instanceId:c,className:n,help:l,options:i,value:u}=this.props,b="inspector-toggle-button-control-"+c;let d;return l&&(d="function"==typeof l?l(t):l),Object(r.createElement)(s.BaseControl,{id:b,help:d,className:a()("components-toggle-button-control",n)},Object(r.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},e),Object(r.createElement)(s.ButtonGroup,{"aria-labelledby":b+"__label"},i.map((t,c)=>{const n={};return u===t.value?(n.isPrimary=!0,n["aria-pressed"]=!0):(n.isSecondary=!0,n["aria-pressed"]=!1),Object(r.createElement)(s.Button,o()({key:`${t.label}-${t.value}-${c}`,value:t.value,onClick:this.onClick,"aria-label":e+": "+t.label},n),t.label)})))}}t.a=Object(i.withInstanceId)(u)},7:function(e,t){e.exports=window.lodash},78:function(e,t,c){"use strict";c.d(t,"a",(function(){return b})),c.d(t,"b",(function(){return d})),c.d(t,"c",(function(){return m}));var n=c(15),o=c(13),r=c(0),l=c(25),a=c.n(l),s=c(49),i=c(107),u=c(52);const b=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[c,Object(r.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,c)=>{const l=Object(u.a)();c=c||l;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(r.useCallback)(t=>{s(c,e,t)},[c,e,s])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,o]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(r.useRef)(!1);return Object(r.useEffect)(()=>{a()(m,d)||(o(Object.assign({},l,d)),p.current=!0)},[l,d,m,o]),p.current?[n,o]:[e,o]}},8:function(e,t){e.exports=window.React},82:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var n=c(6);const o=()=>"function"==typeof n.__experimentalGetSpacingClassesAndStyles},9:function(e,t){e.exports=window.wp.compose},90:function(e,t){},96:function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var n=c(5),o=c.n(n),r=c(0),l=c(1),a=c(3),s=c(111),i=c(494),u=c(4),b=c.n(u),d=c(9),m=c(20),p=c(33),g=c(493),O=c(17);const j=e=>{let{id:t,label:c,popoverContents:n,remove:o,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(r.useState)(!1),h=Object(d.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const f=b()("woocommerce-tag",u,{"has-remove":!!o}),w="woocommerce-tag__label-"+h,_=Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},i),Object(r.createElement)("span",{"aria-hidden":"true"},c));return Object(r.createElement)("span",{className:f},n?Object(r.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(r.createElement)("span",{className:"woocommerce-tag__text",id:w},_),n&&m&&Object(r.createElement)(a.Popover,{onClose:()=>p(!1)},n),o&&Object(r.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(l.sprintf)(// Translators: %s label.
|
40 |
Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":w},Object(r.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const f=e=>Object(r.createElement)(p.b,e),w=e=>{const{list:t,selected:c,renderItem:n,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(r.createElement)(r.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(r.createElement)(r.Fragment,{key:t.id},Object(r.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(r.createElement)(w,o()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:c,selected:n,messages:o,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(r.createElement)("div",{className:"woocommerce-search-list__selected"},Object(r.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(r.createElement)("strong",null,o.selected(u)),u>0?Object(r.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":o.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(r.createElement)("ul",null,n.map((e,t)=>Object(r.createElement)("li",{key:t},Object(r.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:o,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||f;return 0===t.length?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(r.createElement)(s.a,{icon:i.a})),Object(r.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(r.createElement)("ul",{className:"woocommerce-search-list__list"},Object(r.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:o,isSingle:m,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:n,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,f]=Object(r.useState)(""),w=Object(d.useInstanceId)(k),y=Object(r.useMemo)(()=>({...m.a,...u}),[u]),E=Object(r.useMemo)(()=>Object(m.c)(i,h,n),[i,h,n]);Object(r.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(r.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(r.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(r.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(r.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(r.createElement)(_,o()({},e,{onRemove:S,messages:y})),Object(r.createElement)("div",{className:"woocommerce-search-list__search"},Object(r.createElement)(a.TextControl,{label:y.search,type:"search",value:h,onChange:e=>f(e)})),l?Object(r.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(r.createElement)(a.Spinner,null)):Object(r.createElement)(v,o()({},e,{search:h,filteredList:E,messages:y,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(k)}});
|
build/blocks-checkout.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-warning'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-warning'), 'version' => '5615fbd112fea5928fe26e3878fae0c1');
|
build/blocks-checkout.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=136)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=n(1);const o="wc/store/cart",i={code:"cart_api_error",message:Object(r.__)("Unable to get cart data from the API.","woo-gutenberg-products-block"),data:{status:500}}},11:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},128:function(e,t){},129:function(e,t){},13:function(e,t){e.exports=window.wp.compose},130:function(e,t){},131:function(e,t){},132:function(e,t){},133:function(e,t){},134:function(e,t){},135:function(e,t){},136:function(e,t,n){"use strict";n.r(t),n.d(t,"TotalsItem",(function(){return k})),n.d(t,"Subtotal",(function(){return F})),n.d(t,"TotalsTaxes",(function(){return C})),n.d(t,"TotalsFees",(function(){return T})),n.d(t,"TotalsWrapper",(function(){return P})),n.d(t,"ExperimentalOrderMeta",(function(){return me})),n.d(t,"ExperimentalDiscountsMeta",(function(){return he})),n.d(t,"ExperimentalOrderShippingPackages",(function(){return ve})),n.d(t,"Panel",(function(){return je})),n.d(t,"Button",(function(){return Ze})),n.d(t,"Label",(function(){return Ye})),n.d(t,"CheckboxControl",(function(){return Je})),n.d(t,"mustContain",(function(){return Qe})),n.d(t,"extensionCartUpdate",(function(){return nt})),n.d(t,"hasValidFills",(function(){return ae})),n.d(t,"useSlot",(function(){return ce})),n.d(t,"createSlotFill",(function(){return le})),n.d(t,"__experimentalRegisterCheckoutFilters",(function(){return at})),n.d(t,"__experimentalApplyCheckoutFilter",(function(){return pt})),n.d(t,"hasInnerBlocks",(function(){return dt})),n.d(t,"getRegisteredBlocks",(function(){return ht})),n.d(t,"registerCheckoutBlock",(function(){return gt})),n.d(t,"innerBlockAreas",(function(){return mt})),n.d(t,"SlotFillProvider",(function(){return te}));var r=n(0),o=n(2),i=n.n(o),s=n(11),a=n.n(s),c=n(14),l=n.n(c);function u(){}function p(e){return!!(e||"").match(/\d/)}function m(e){return null==e}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function d(e,t){void 0===t&&(t=!0);var n="-"===e[0],r=n&&t,o=(e=e.replace("-","")).split(".");return{beforeDecimal:o[0],afterDecimal:o[1]||"",hasNagation:n,addNegation:r}}function h(e,t,n){for(var r="",o=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||o;return r}function b(e,t){return Array(t+1).join(e)}function g(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function v(e,t,n){return Math.min(Math.max(e,t),n)}function w(e){return Math.max(e.selectionStart,e.selectionEnd)}var O={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:u,onChange:u,onKeyDown:u,onMouseUp:u,onFocus:u,onBlur:u,isAllowed:function(){return!0}},y=function(e){function t(t){e.call(this,t);var n=t.defaultValue;this.validateProps();var r=this.formatValueProp(n);this.state={value:r,numAsString:this.removeFormatting(r),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.componentDidMount=function(){this.setState({mounted:!0})},t.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},t.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},t.prototype.updateValueIfRequired=function(e){var t=this.props,n=this.state,r=this.focusedElm,o=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==t){this.validateProps();var s=this.formatNumString(i),a=m(t.value)?s:this.formatValueProp(),c=this.removeFormatting(a),l=parseFloat(c),u=parseFloat(i);(isNaN(l)&&isNaN(u)||l===u)&&s===o&&(null!==r||a===o)||this.updateValue({formattedValue:a,numAsString:c,input:r,source:"prop",event:null})}},t.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,n=this.getSeparators().decimalSeparator,r=this.getNumberRegex(!0),o="-"===e[0];o&&(e=e.replace("-","")),n&&0===t&&(e=e.split(n)[0]);var i=(e=(e.match(r)||[]).join("").replace(n,".")).indexOf(".");return-1!==i&&(e=e.substring(0,i)+"."+e.substring(i+1,e.length).replace(new RegExp(f(n),"g"),"")),o&&(e="-"+e),e},t.prototype.getNumberRegex=function(e,t){var n=this.props,r=n.format,o=n.decimalScale,i=n.customNumerals,s=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(!s||0===o||t||r?"":"|"+f(s)),e?"g":void 0)},t.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,n=t.thousandSeparator,r=t.allowedDecimalSeparators;return!0===n&&(n=","),r||(r=[e,"."]),{decimalSeparator:e,thousandSeparator:n,allowedDecimalSeparators:r}},t.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},t.prototype.getValueObject=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},t.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),n=t.decimalSeparator,r=t.thousandSeparator;if(n===r)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},t.prototype.setPatchedCaretPosition=function(e,t,n){g(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===n&&g(e,t)}),0)},t.prototype.correctCaretPosition=function(e,t,n){var r=this.props,o=r.prefix,i=r.suffix,s=r.format;if(""===e)return 0;if(t=v(t,0,e.length),!s){var a="-"===e[0];return v(t,o.length+(a?1:0),e.length-i.length)}if("function"==typeof s)return t;if("#"===s[t]&&p(e[t]))return t;if("#"===s[t-1]&&p(e[t-1]))return t;var c=s.indexOf("#");t=v(t,c,s.lastIndexOf("#")+1);for(var l=s.substring(t,s.length).indexOf("#"),u=t,m=t+(-1===l?0:l);u>c&&("#"!==s[u]||!p(e[u]));)u-=1;return!p(e[m])||"left"===n&&t!==c||t-u<m-t?p(e[u])?u+1:u:m},t.prototype.getCaretPosition=function(e,t,n){var r,o,i=this.props.format,s=this.state.value,a=this.getNumberRegex(!0),c=(e.match(a)||[]).join(""),l=(t.match(a)||[]).join("");for(r=0,o=0;o<n;o++){var u=e[o]||"",p=t[r]||"";if((u.match(a)||u===p)&&("0"!==u||!p.match(a)||"0"===p||c.length===l.length)){for(;u!==t[r]&&r<t.length;)r++;r++}}return"string"!=typeof i||s||(r=t.length),this.correctCaretPosition(t,r)},t.prototype.removePrefixAndSuffix=function(e){var t=this.props,n=t.format,r=t.prefix,o=t.suffix;if(!n&&e){var i="-"===e[0];i&&(e=e.substring(1,e.length));var s=(e=r&&0===e.indexOf(r)?e.substring(r.length,e.length):e).lastIndexOf(o);e=o&&-1!==s&&s===e.length-o.length?e.substring(0,s):e,i&&(e="-"+e)}return e},t.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),n=0,r="",o=0,i=t.length;o<=i;o++){var s=t[o]||"",a=o===i?e.length:e.indexOf(s,n);if(-1===a){r=e;break}r+=e.substring(n,a),n=a+s.length}return(r.match(this.getNumberRegex(!0))||[]).join("")},t.prototype.removeFormatting=function(e){var t=this.props,n=t.format,r=t.removeFormatting;return e?(n?e="string"==typeof n?this.removePatternFormatting(e):"function"==typeof r?r(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},t.prototype.formatWithPattern=function(e){for(var t=this.props.format,n=0,r=t.split(""),o=0,i=t.length;o<i;o++)"#"===t[o]&&(r[o]=e[n]||this.getMaskAtIndex(n),n+=1);return r.join("")},t.prototype.formatAsNumber=function(e){var t=this.props,n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix,i=t.suffix,s=t.allowNegative,a=t.thousandsGroupStyle,c=this.getSeparators(),l=c.thousandSeparator,u=c.decimalSeparator,p=-1!==e.indexOf(".")||n&&r,m=d(e,s),f=m.beforeDecimal,b=m.afterDecimal,g=m.addNegation;return void 0!==n&&(b=h(b,n,r)),l&&(f=function(e,t,n){var r=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(n),o=e.search(/[1-9]/);return o=-1===o?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}(f,l,a)),o&&(f=o+f),i&&(b+=i),g&&(f="-"+f),f+(p&&u||"")+b},t.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,n=t.format,r=t.allowEmptyFormatting,o=t.customNumerals,i=e;if(o&&10===o.length){var s=new RegExp("["+o.join("")+"]","g");i=e.replace(s,(function(e){return o.indexOf(e).toString()}))}return""!==e||r?"-"!==e||n?"string"==typeof n?this.formatWithPattern(i):"function"==typeof n?n(i):this.formatAsNumber(i):"-":""},t.prototype.formatValueProp=function(e){var t=this.props,n=t.format,r=t.decimalScale,o=t.fixedDecimalScale,i=t.allowEmptyFormatting,s=this.props,a=s.value,c=s.isNumericString,l=!(a=m(a)?e:a)&&0!==a;return l&&i&&(a=""),l&&!i?"":("number"==typeof a&&(a=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var n=e.split(/[eE]/g),r=n[0],o=n[1];if(!(o=Number(o)))return t+r;var i=1+o,s=(r=r.replace(".","")).length;return i<0?r="0."+b("0",Math.abs(i))+r:i>=s?r+=b("0",i-s):r=(r.substring(0,i)||"0")+"."+r.substring(i),t+r}(a),c=!0),"Infinity"===a&&c&&(a=""),c&&!n&&"number"==typeof r&&(a=function(e,t,n){if(-1!==["","-"].indexOf(e))return e;var r=-1!==e.indexOf(".")&&t,o=d(e),i=o.beforeDecimal,s=o.afterDecimal,a=o.hasNagation,c=parseFloat("0."+(s||"0")),l=(s.length<=t?"0."+s:c.toFixed(t)).split(".");return(a?"-":"")+i.split("").reverse().reduce((function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),l[0])+(r?".":"")+h(l[1]||"",Math.min(t,s.length),n)}(a,r,o)),c?this.formatNumString(a):this.formatInput(a))},t.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),o&&!i&&t&&(e="-"+e),e},t.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},t.prototype.isCharacterAFormat=function(e,t){var n=this.props,r=n.format,o=n.prefix,i=n.suffix,s=n.decimalScale,a=n.fixedDecimalScale,c=this.getSeparators().decimalSeparator;return"string"==typeof r&&"#"!==r[e]||!(r||!(e<o.length||e>=t.length-i.length||s&&a&&t[e]===c))},t.prototype.correctInputValue=function(e,t,n){var r=this,o=this.props,i=o.format,s=o.allowNegative,a=o.prefix,c=o.suffix,l=o.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,f=this.state.numAsString||"",h=this.selectionBeforeInput,b=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var n=0,r=0,o=e.length,i=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[i-1-r]&&i-r>n&&o-r>n;)r++;return{start:n,end:o-r}}(t,n),w=v.start,O=v.end;if(!i&&w===O&&-1!==p.indexOf(n[b])){var y=0===l?"":m;return n.substr(0,b)+y+n.substr(b+1,n.length)}var j=i?0:a.length,E=t.length-(i?0:c.length);if(n.length>t.length||!n.length||w===O||0===b&&g===t.length||0===w&&O===t.length||b===j&&g===E)return n;var S=t.substr(w,O-w);if([].concat(S).find((function(e,n){return r.isCharacterAFormat(n+w,t)}))){var x=t.substr(w),k={},N=[];[].concat(x).forEach((function(e,n){r.isCharacterAFormat(n+w,t)?k[n]=e:n>S.length-1&&N.push(e)})),Object.keys(k).forEach((function(e){N.length>e?N.splice(e,0,k[e]):N.push(k[e])})),n=t.substr(0,w)+N.join("")}if(!i){var _=this.removeFormatting(n),F=d(_,s),C=F.beforeDecimal,T=F.afterDecimal,P=F.addNegation,R=e<n.indexOf(m)+1;if(_.length<f.length&&R&&""===C&&!parseFloat(T))return P?"-":""}return n},t.prototype.updateValue=function(e){var t=e.formattedValue,n=e.input,r=e.setCaretPosition;void 0===r&&(r=!0);var o=e.source,i=e.event,s=e.numAsString,a=e.caretPos,c=this.props.onValueChange,l=this.state.value;if(n){if(void 0===a&&r){var u=e.inputValue||n.value,p=w(n);n.value=t,a=this.getCaretPosition(u,t,p)}n.value=t,r&&this.setPatchedCaretPosition(n,a,t)}void 0===s&&(s=this.removeFormatting(t)),t!==l&&(this.setState({value:t,numAsString:s}),c(this.getValueObject(t,s),{event:i,source:o}))},t.prototype.onChange=function(e){var t=e.target,n=t.value,r=this.state,o=this.props,i=o.isAllowed,s=r.value||"",a=w(t);n=this.correctInputValue(a,s,n);var c=this.formatInput(n)||"",l=this.removeFormatting(c),u=i(this.getValueObject(c,l));u||(c=s),this.updateValue({formattedValue:c,numAsString:l,inputValue:n,input:t,event:e,source:"event"}),u&&o.onChange(e)},t.prototype.onBlur=function(e){var t=this.props,n=this.state,r=t.format,o=t.onBlur,i=t.allowLeadingZeros,s=n.numAsString,a=n.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!r){isNaN(parseFloat(s))&&(s=""),i||(s=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}(s));var c=this.formatNumString(s);if(c!==a)return this.updateValue({formattedValue:c,numAsString:s,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void o(e)}o(e)},t.prototype.onKeyDown=function(e){var t,n=e.target,r=e.key,o=n.selectionStart,i=n.selectionEnd,s=n.value;void 0===s&&(s="");var a=this.props,c=a.decimalScale,l=a.fixedDecimalScale,u=a.prefix,p=a.suffix,m=a.format,f=a.onKeyDown,d=void 0!==c&&l,h=this.getNumberRegex(!1,d),b=new RegExp("-"),g="string"==typeof m;if(this.selectionBeforeInput={selectionStart:o,selectionEnd:i},"ArrowLeft"===r||"Backspace"===r?t=o-1:"ArrowRight"===r?t=o+1:"Delete"===r&&(t=o),void 0!==t&&o===i){var v=t,w=g?m.indexOf("#"):u.length,O=g?m.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===r||"ArrowRight"===r){var y="ArrowLeft"===r?"left":"right";v=this.correctCaretPosition(s,t,y)}else if("Delete"!==r||h.test(s[t])||b.test(s[t])){if("Backspace"===r&&!h.test(s[t]))if(o<=w+1&&"-"===s[0]&&void 0===m){var j=s.substring(1);this.updateValue({formattedValue:j,caretPos:v,input:n,event:e,source:"event"})}else if(!b.test(s[t])){for(;!h.test(s[v-1])&&v>w;)v--;v=this.correctCaretPosition(s,v,"left")}}else for(;!h.test(s[v])&&v<O;)v++;(v!==t||t<w||t>O)&&(e.preventDefault(),this.setPatchedCaretPosition(n,v,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(n,v,s),f(e)}else f(e)},t.prototype.onMouseUp=function(e){var t=e.target,n=t.selectionStart,r=t.selectionEnd,o=t.value;if(void 0===o&&(o=""),n===r){var i=this.correctCaretPosition(o,n);i!==n&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)},t.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var n=e.target,r=n.selectionStart,o=n.selectionEnd,i=n.value;void 0===i&&(i="");var s=t.correctCaretPosition(i,r);s===r||0===r&&o===i.length||t.setPatchedCaretPosition(n,s,i),t.props.onFocus(e)}),0)},t.prototype.render=function(){var e=this.props,t=e.type,n=e.displayType,r=e.customInput,o=e.renderText,i=e.getInputRef,s=e.format,a=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),c=this.state,u=c.value,p=c.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(s)?"numeric":void 0,m=Object.assign({inputMode:p},a,{type:t,value:u,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return o?o(u,a)||null:l.a.createElement("span",Object.assign({},a,{ref:i}),u);if(r){var f=r;return l.a.createElement(f,Object.assign({},m,{ref:i}))}return l.a.createElement("input",Object.assign({},m,{ref:i}))},t}(l.a.Component);y.defaultProps=O;var j=y;n(129);const E=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});var S=e=>{let{className:t,value:n,currency:o,onValueChange:s,displayType:c="text",...l}=e;const u="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(u))return null;const p=u/10**o.minorUnit;if(!Number.isFinite(p))return null;const m=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...l,...E(o),value:void 0,currency:void 0,onValueChange:void 0},d=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(r.createElement)(j,a()({className:m,displayType:c},f,{value:p,onValueChange:d}))};n(128);const x=e=>{let{value:t,currency:n}=e;return Object(r.isValidElement)(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-item__value"},t):Number.isFinite(t)?Object(r.createElement)(S,{className:"wc-block-components-totals-item__value",currency:n||{},value:t}):null};var k=e=>{let{className:t,currency:n,label:o,value:s,description:a}=e;return Object(r.createElement)("div",{className:i()("wc-block-components-totals-item",t)},Object(r.createElement)("span",{className:"wc-block-components-totals-item__label"},o),Object(r.createElement)(x,{value:s,currency:n}),Object(r.createElement)("div",{className:"wc-block-components-totals-item__description"},a))},N=n(1),_=n(4),F=e=>{let{currency:t,values:n,className:o}=e;const{total_items:i,total_items_tax:s}=n,a=parseInt(i,10),c=parseInt(s,10);return Object(r.createElement)(k,{className:o,currency:t,label:Object(N.__)("Subtotal","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?a+c:a})};n(130);var C=e=>{let{currency:t,values:n,className:o,showRateAfterTaxName:s}=e;const{total_tax:a,tax_lines:c}=n;if(!Object(_.getSetting)("taxesEnabled",!0)&&parseInt(a,10)<=0)return null;const l=Object(_.getSetting)("displayItemizedTaxes",!1),u=l&&c.length>0?Object(r.createElement)("div",{className:i()("wc-block-components-totals-taxes",o)},c.map((e,n)=>{let{name:o,rate:i,price:a}=e;const c=`${o}${s?" "+i:""}`;return Object(r.createElement)(k,{key:"tax-line-"+n,className:"wc-block-components-totals-taxes__grouped-rate",currency:t,label:c,value:parseInt(a,10)})})," "):null;return l?u:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(k,{className:i()("wc-block-components-totals-taxes",o),currency:t,label:Object(N.__)("Taxes","woo-gutenberg-products-block"),value:parseInt(a,10),description:null}))},T=e=>{let{currency:t,cartFees:n,className:o}=e;return Object(r.createElement)(r.Fragment,null,n.map((e,n)=>{let{id:s,name:a,totals:c}=e;const l=parseInt(c.total,10);if(!l)return null;const u=parseInt(c.total_tax,10);return Object(r.createElement)(k,{key:s||`${n}-${a}`,className:i()("wc-block-components-totals-fees",o),currency:t,label:a||Object(N.__)("Fee","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?l+u:l})}))};n(131);var P=e=>{let{children:t,slotWrapper:n=!1}=e;return c.Children.count(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-wrapper"+(n?" slot-wrapper":"")},t):null},R=n(8),M=n.n(R),A=n(5),D=n(19);function I(e){const t=Object(r.useContext)(D.a),n=t.slots[e]||{},o=t.fills[e],i=Object(r.useMemo)(()=>o||[],[o]);return{...n,updateSlot:Object(r.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(r.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:i,registerFill:Object(r.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(r.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var L=n(9),V=n(3),B=Object(r.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function U({name:e,children:t,registerFill:n,unregisterFill:o}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(r.useContext)(B),[o,i]=Object(r.useState)(t(e));return Object(r.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),o})(e),s=Object(r.useRef)({name:e,children:t});return Object(r.useLayoutEffect)(()=>(n(e,s.current),()=>o(e,s.current)),[]),Object(r.useLayoutEffect)(()=>{s.current.children=t,i&&i.forceUpdate()},[t]),Object(r.useLayoutEffect)(()=>{e!==s.current.name&&(o(s.current.name,s.current),s.current.name=e,n(e,s.current))},[e]),i&&i.node?(Object(V.isFunction)(t)&&(t=t(i.props.fillProps)),Object(r.createPortal)(t,i.node)):null}var W=e=>Object(r.createElement)(B.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(r.createElement)(U,Object(L.a)({},e,{registerFill:t,unregisterFill:n})));class H extends r.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:o}=this.props,i=Object(V.map)(o(t,this),e=>{const t=Object(V.isFunction)(e.children)?e.children(n):e.children;return r.Children.map(t,(e,t)=>{if(!e||Object(V.isString)(e))return e;const n=e.key||t;return Object(r.cloneElement)(e,{key:n})})}).filter(Object(V.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(V.isFunction)(e)?e(i):i)}}var z=e=>Object(r.createElement)(B.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:o})=>Object(r.createElement)(H,Object(L.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:o})));function $(){const[,e]=Object(r.useState)({}),t=Object(r.useRef)(!0);return Object(r.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function G({name:e,children:t}){const n=I(e),o=Object(r.useRef)({rerender:$()});return Object(r.useEffect)(()=>(n.registerFill(o),()=>{n.unregisterFill(o)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(r.createPortal)(t,n.ref.current)):null}var K=n(13),q=Object(r.forwardRef)((function({name:e,fillProps:t={},as:n="div",...o},i){const s=Object(r.useContext)(D.a),a=Object(r.useRef)();return Object(r.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(r.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(r.createElement)(n,Object(L.a)({ref:Object(K.useMergeRefs)([i,a])},o))})),Z=n(16),Y=n.n(Z);function X({children:e}){const t=function(){const[e,t]=Object(r.useState)({}),[n,o]=Object(r.useState)({}),i=Object(r.useCallback)((e,n,r)=>{t(t=>{const o=t[e]||{};return{...t,[e]:{...o,ref:n||o.ref,fillProps:r||o.fillProps||{}}}})},[]),s=Object(r.useCallback)((e,n)=>{t(t=>{const{[e]:r,...o}=t;return(null==r?void 0:r.ref)===n?o:t})},[]),a=Object(r.useCallback)((t,r)=>{const o=e[t];if(o&&!Y()(o.fillProps,r)){o.fillProps=r;const e=n[t];e&&e.map(e=>e.current.rerender())}},[e,n]),c=Object(r.useCallback)((e,t)=>{o(n=>({...n,[e]:[...n[e]||[],t]}))},[]),l=Object(r.useCallback)((e,t)=>{o(n=>n[e]?{...n,[e]:n[e].filter(e=>e!==t)}:n)},[]);return Object(r.useMemo)(()=>({slots:e,fills:n,registerSlot:i,updateSlot:a,unregisterSlot:s,registerFill:c,unregisterFill:l}),[e,n,i,a,s,c,l])}();return Object(r.createElement)(D.a.Provider,{value:t},e)}class J extends r.Component{constructor(){super(...arguments),this.registerSlot=this.registerSlot.bind(this),this.registerFill=this.registerFill.bind(this),this.unregisterSlot=this.unregisterSlot.bind(this),this.unregisterFill=this.unregisterFill.bind(this),this.getSlot=this.getSlot.bind(this),this.getFills=this.getFills.bind(this),this.hasFills=this.hasFills.bind(this),this.subscribe=this.subscribe.bind(this),this.slots={},this.fills={},this.listeners=[],this.contextValue={registerSlot:this.registerSlot,unregisterSlot:this.unregisterSlot,registerFill:this.registerFill,unregisterFill:this.unregisterFill,getSlot:this.getSlot,getFills:this.getFills,hasFills:this.hasFills,subscribe:this.subscribe}}registerSlot(e,t){const n=this.slots[e];this.slots[e]=t,this.triggerListeners(),this.forceUpdateSlot(e),n&&n.forceUpdate()}registerFill(e,t){this.fills[e]=[...this.fills[e]||[],t],this.forceUpdateSlot(e)}unregisterSlot(e,t){this.slots[e]===t&&(delete this.slots[e],this.triggerListeners())}unregisterFill(e,t){this.fills[e]=Object(V.without)(this.fills[e],t),this.forceUpdateSlot(e)}getSlot(e){return this.slots[e]}getFills(e,t){return this.slots[e]!==t?[]:this.fills[e]}hasFills(e){return this.fills[e]&&!!this.fills[e].length}forceUpdateSlot(e){const t=this.getSlot(e);t&&t.forceUpdate()}triggerListeners(){this.listeners.forEach(e=>e())}subscribe(e){return this.listeners.push(e),()=>{this.listeners=Object(V.without)(this.listeners,e)}}render(){return Object(r.createElement)(B.Provider,{value:this.contextValue},this.props.children)}}function Q(e){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W,e),Object(r.createElement)(G,e))}const ee=Object(r.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(r.createElement)(q,Object(L.a)({},t,{ref:n})):Object(r.createElement)(z,t));function te({children:e,...t}){return Object(r.createElement)(J,t,Object(r.createElement)(X,null,e))}function ne(e){const t=t=>Object(r.createElement)(Q,Object(L.a)({name:e},t));t.displayName=e+"Fill";const n=t=>Object(r.createElement)(ee,Object(L.a)({name:e},t));return n.displayName=e+"Slot",n.__unstableName=e,{Fill:t,Slot:n}}var re=n(15),oe=n.n(re);class ie extends c.Component{constructor(){super(...arguments),oe()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(r.createElement)(r.Fragment,null,Object(r.createElement)("strong",null,e.status),": "+e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{renderError:e}=this.props,{errorMessage:t,hasError:n}=this.state;return n?"function"==typeof e?e(t):Object(r.createElement)("p",null,t):this.props.children}}var se=ie;const ae=e=>Array.isArray(e)&&e.filter(Boolean).length>0;let ce;ce=I;const le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const{Fill:n,Slot:o}=ne(e),i=e=>{let{children:o}=e;return Object(r.createElement)(n,null,e=>r.Children.map(o,n=>Object(r.createElement)(se,{renderError:_.CURRENT_USER_IS_ADMIN?t:()=>null},Object(r.cloneElement)(n,e))))},s=e=>Object(r.createElement)(o,a()({},e,{bubblesVirtually:!0}));return{Fill:i,Slot:s}},{Fill:ue,Slot:pe}=le("__experimentalOrderMeta");ue.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalOrderMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(pe,{className:i()(t,"wc-block-components-order-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var me=ue;const{Fill:fe,Slot:de}=le("__experimentalDiscountsMeta");fe.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalDiscountsMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(de,{className:i()(t,"wc-block-components-discounts-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var he=fe;const{Fill:be,Slot:ge}=le("__experimentalOrderShippingPackages");be.Slot=e=>{let{className:t,collapsible:n,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}=e;const{fills:p}=ce("__experimentalOrderShippingPackages"),m=p.length>1;return Object(r.createElement)(ge,{className:i()("wc-block-components-shipping-rates-control",t),fillProps:{collapsible:n,collapse:m,showItems:m,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}})};var ve=be,we=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})},Oe=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),ye=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));n(132);var je=e=>{let{children:t,className:n,initialOpen:o=!1,hasBorder:s=!1,title:a,titleTag:c="div"}=e;const[l,u]=Object(r.useState)(o);return Object(r.createElement)("div",{className:i()(n,"wc-block-components-panel",{"has-border":s})},Object(r.createElement)(c,null,Object(r.createElement)("button",{"aria-expanded":l,className:"wc-block-components-panel__button",onClick:()=>u(!l)},Object(r.createElement)(we,{"aria-hidden":"true",className:"wc-block-components-panel__button-icon",icon:l?Oe:ye}),a)),l&&Object(r.createElement)("div",{className:"wc-block-components-panel__content"},t))},Ee=n(33),Se=Object(r.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(A.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"}));function xe(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const i=o.getBoundingClientRect();return new r.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}let ke=0;function Ne(e){const t=document.scrollingElement||document.body;e&&(ke=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=ke)}let _e=0;function Fe(){return Object(r.useEffect)(()=>(0===_e&&Ne(!0),++_e,()=>{1===_e&&Ne(!1),--_e}),[]),null}function Ce(e){return"appear"===e?"top":"left"}function Te(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const a=n?parseInt(n,10):0,c=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+a,width:e.width-l-u,height:e.height-a-c,left:e.left+l,right:e.right-u,top:e.top+a,bottom:e.bottom-c}}function Pe(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function Re(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function Me(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const Ae=Object(r.forwardRef)(({headerTitle:e,onClose:t,children:n,className:o,noArrow:s=!0,isAlternate:a,position:c="bottom right",range:l,focusOnMount:u="firstElement",anchorRef:p,shouldAnchorIncludePadding:m,anchorRect:f,getAnchorRect:d,expandOnMobile:h,animate:b=!0,onClickOutside:g,onFocusOutside:v,__unstableStickyBoundaryElement:w,__unstableSlotName:O="Popover",__unstableObserveElement:y,__unstableBoundaryParent:j,__unstableForcePosition:E,__unstableForceXAlignment:S,...x},k)=>{const _=Object(r.useRef)(null),F=Object(r.useRef)(null),C=Object(r.useRef)(),T=Object(K.useViewportMatch)("medium","<"),[P,R]=Object(r.useState)(),A=I(O),D=h&&T,[V,B]=Object(K.useResizeObserver)();s=D||s,Object(r.useLayoutEffect)(()=>{if(D)return Me(C.current,"is-without-arrow",s),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis"),Pe(C.current,"data-y-axis"),Re(C.current,"top"),Re(C.current,"left"),Re(F.current,"maxHeight"),void Re(F.current,"maxWidth");const e=()=>{if(!C.current||!F.current)return;let e=function(e,t,n,r=!1,o,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return xe(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return xe(Object(Ee.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=xe(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:Te(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),a=xe(new window.DOMRect(n.left,n.top,n.width,s.bottom-n.top),e.ownerDocument,i);return o?a:Te(a,r)}if(!e.current)return;const{parentNode:s}=e.current,a=s.getBoundingClientRect();return o?a:Te(a,s)}(_,f,d,p,m,C.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=C.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var i;j&&(r=null===(i=C.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const l=B.height?B:F.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:h,xAxis:b,yAxis:g,contentHeight:v,contentWidth:O}=function(e,t,n="top",r,o,i,s,a,c){const[l,u="center",p]=n.split(" "),m=function(e,t,n,r,o,i,s,a){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-s;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},p={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},m={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,d=n,h=null;if(!o&&!a)if("middle"===n&&u.contentHeight===c)d="middle";else if("top"===n&&p.contentHeight===c)d="top";else if("bottom"===n&&m.contentHeight===c)d="bottom";else{d=p.contentHeight>m.contentHeight?"top":"bottom";const e="top"===d?p.contentHeight:m.contentHeight;h=e!==c?e:null}return f="middle"===d?u.popoverTop:"top"===d?p.popoverTop:m.popoverTop,{yAxis:d,popoverTop:f,contentHeight:h}}(e,t,l,p,r,0,i,a);return{...function(e,t,n,r,o,i,s,a,c){const{width:l}=t;"left"===n&&Object(N.isRTL)()?n="right":"right"===n&&Object(N.isRTL)()&&(n="left"),"left"===r&&Object(N.isRTL)()?r="right":"right"===r&&Object(N.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),p={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let m=e.left;"right"===r?m=e.right:"middle"===i||c||(m=u);let f=e.right;"left"===r?f=e.left:"middle"===i||c||(f=u);const d={popoverLeft:m,contentWidth:m-l>0?l:m},h={popoverLeft:f,contentWidth:f+l>window.innerWidth?window.innerWidth-f:l};let b,g=n,v=null;if(!o&&!a)if("center"===n&&p.contentWidth===l)g="center";else if("left"===n&&d.contentWidth===l)g="left";else if("right"===n&&h.contentWidth===l)g="right";else{g=d.contentWidth>h.contentWidth?"left":"right";const e="left"===g?d.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(g="center",p.popoverLeft=window.innerWidth/2)}if(b="center"===g?p.popoverLeft:"left"===g?d.popoverLeft:h.popoverLeft,s){const e=s.getBoundingClientRect();b=Math.min(b,e.right-l),Object(N.isRTL)()||(b=Math.max(b,0))}return{xAxis:g,popoverLeft:b,contentWidth:v}}(e,t,u,p,r,m.yAxis,s,a,c),...m}}(e,l,c,w,C.current,o,r,E,S);"number"==typeof u&&"number"==typeof h&&(Re(C.current,"top",u+"px"),Re(C.current,"left",h+"px")),Me(C.current,"is-without-arrow",s||"center"===b&&"middle"===g),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis",b),Pe(C.current,"data-y-axis",g),Re(F.current,"maxHeight","number"==typeof v?v+"px":""),Re(F.current,"maxWidth","number"==typeof O?O+"px":""),R(({left:"right",right:"left"}[b]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=C.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const i=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",i),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const l=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(p);let u;return l&&l!==t&&(l.defaultView.addEventListener("resize",e),l.defaultView.addEventListener("scroll",e,!0)),y&&(u=new n.MutationObserver(e),u.observe(y,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),l&&l!==t&&(l.defaultView.removeEventListener("resize",e),l.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[D,f,d,p,m,c,B,w,y,j]);const U=(e,n)=>{if("focus-outside"===e&&v)v(n);else if("focus-outside"===e&&g){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),M()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),g(e)}else t&&t()},[W,H]=Object(K.__experimentalUseDialog)({focusOnMount:u,__unstableOnClose:U,onClose:U}),z=Object(K.useMergeRefs)([C,W,k]),$=Boolean(b&&P)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=Ce(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:P});let G=Object(r.createElement)("div",Object(L.a)({className:i()("components-popover",o,$,{"is-expanded":D,"is-without-arrow":s,"is-alternate":a})},x,{ref:z},H,{tabIndex:"-1"}),D&&Object(r.createElement)(Fe,null),D&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},e),Object(r.createElement)(Ke,{className:"components-popover__close",icon:Se,onClick:t})),Object(r.createElement)("div",{ref:F,className:"components-popover__content"},Object(r.createElement)("div",{style:{position:"relative"}},V,n)));return A.ref&&(G=Object(r.createElement)(Q,{name:O},G)),p||f?G:Object(r.createElement)("span",{ref:_},G)});Ae.Slot=Object(r.forwardRef)((function({name:e="Popover"},t){return Object(r.createElement)(ee,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var De=Ae,Ie=function({shortcut:e,className:t}){if(!e)return null;let n,o;return Object(V.isString)(e)&&(n=e),Object(V.isObject)(e)&&(n=e.display,o=e.ariaLabel),Object(r.createElement)("span",{className:t,"aria-label":o},n)};const Le=Object(r.createElement)("div",{className:"event-catcher"}),Ve=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(r.cloneElement)(Object(r.createElement)("span",{className:"disabled-element-wrapper"},Object(r.cloneElement)(Le,e),Object(r.cloneElement)(t,{children:n}),","),e),Be=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(r.cloneElement)(e,{...t,children:n}),Ue=(e,t,n)=>{if(1!==r.Children.count(e))return;const o=r.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)};var We=function({children:e,position:t,text:n,shortcut:o}){const[i,s]=Object(r.useState)(!1),[a,c]=Object(r.useState)(!1),l=Object(K.useDebounce)(c,700),u=t=>{Ue(e,"onMouseDown",t),document.addEventListener("mouseup",f),s(!0)},p=t=>{Ue(e,"onMouseUp",t),document.removeEventListener("mouseup",f),s(!1)},m=e=>"mouseUp"===e?p:"mouseDown"===e?u:void 0,f=m("mouseUp"),d=(t,n)=>r=>{if(Ue(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;l.cancel();const o=Object(V.includes)(["focus","mouseenter"],r.type);o!==a&&(n?l(o):c(o))},h=()=>{l.cancel(),document.removeEventListener("mouseup",f)};if(Object(r.useEffect)(()=>h,[]),1!==r.Children.count(e))return e;const b={onMouseEnter:d("onMouseEnter",!0),onMouseLeave:d("onMouseLeave"),onClick:d("onClick"),onFocus:d("onFocus"),onBlur:d("onBlur"),onMouseDown:m("mouseDown")},g=r.Children.only(e),{children:v,disabled:w}=g.props;return(w?Ve:Be)({child:g,eventHandlers:b,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:o,shortcut:i})=>Object(r.concatChildren)(e,t&&Object(r.createElement)(De,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,Object(r.createElement)(Ie,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:v,isOver:a,position:t,text:n,shortcut:o})})},He=function({icon:e,className:t,...n}){const o=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(r.createElement)("span",Object(L.a)({className:o},n))},ze=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(r.createElement)(He,Object(L.a)({icon:e},n));if(Object(r.isValidElement)(e)&&He===e.type)return Object(r.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof r.Component?Object(r.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===A.SVG)){const o={width:t,height:t,...e.props,...n};return Object(r.createElement)(A.SVG,o)}return Object(r.isValidElement)(e)?Object(r.cloneElement)(e,{size:t,...n}):e},$e=Object(r.forwardRef)((function({as:e="div",className:t,...n},o){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(r.createElement)(e,t)}({as:e,className:i()("components-visually-hidden",t),...n,ref:o})}));const Ge=["onMouseDown","onClick"];var Ke=Object(r.forwardRef)((function(e,t){const{href:n,target:o,isSmall:s,isPressed:a,isBusy:c,isDestructive:l,className:u,disabled:p,icon:m,iconPosition:f="left",iconSize:d,showTooltip:h,tooltipPosition:b,shortcut:g,label:v,children:w,text:O,variant:y,__experimentalIsFocusable:j,describedBy:E,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...s}){let a=i;var c,l,u,p,m;return t&&(null!==(c=a)&&void 0!==c||(a="primary")),r&&(null!==(l=a)&&void 0!==l||(a="tertiary")),n&&(null!==(u=a)&&void 0!==u||(a="secondary")),e&&(M()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...s,variant:a}}(e),x=i()("components-button",u,{"is-secondary":"secondary"===y,"is-primary":"primary"===y,"is-small":s,"is-tertiary":"tertiary"===y,"is-pressed":a,"is-busy":c,"is-link":"link"===y,"is-destructive":l,"has-text":!!m&&!!w,"has-icon":!!m}),k=p&&!j,N=void 0===n||k?"button":"a",_="a"===N?{href:n,target:o}:{type:"button",disabled:k,"aria-pressed":a};if(p&&j){_["aria-disabled"]=!0;for(const e of Ge)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const F=!k&&(h&&v||g||!!v&&(!w||Object(V.isArray)(w)&&!w.length)&&!1!==h),C=E?Object(V.uniqueId)():null,T=S["aria-describedby"]||C,P=Object(r.createElement)(N,Object(L.a)({},_,S,{className:x,"aria-label":S["aria-label"]||v,"aria-describedby":T,ref:t}),m&&"left"===f&&Object(r.createElement)(ze,{icon:m,size:d}),O&&Object(r.createElement)(r.Fragment,null,O),m&&"right"===f&&Object(r.createElement)(ze,{icon:m,size:d}),w);return F?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(We,{text:E||v,shortcut:g,position:b},P),E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E))):Object(r.createElement)(r.Fragment,null,P,E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E)))}));n(134);var qe=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"});n(133);var Ze=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...c}=e;const l=i()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(r.createElement)(Ke,a()({className:l},c),n&&Object(r.createElement)(qe,null),Object(r.createElement)("span",{className:"wc-block-components-button__text"},o))},Ye=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const c=null!=n,l=null!=o;return!c&&l?(t=s||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=s||r.Fragment,c&&l&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))};n(135);const Xe=e=>{let{className:t,label:n,id:o,onChange:s,children:c,hasError:l=!1,checked:u=!1,...p}=e;const m=Object(K.useInstanceId)(Xe),f=o||"checkbox-control-"+m;return Object(r.createElement)("div",{className:i()("wc-block-components-checkbox",{"has-error":l},t)},Object(r.createElement)("label",{htmlFor:f},Object(r.createElement)("input",a()({id:f,className:"wc-block-components-checkbox__input",type:"checkbox",onChange:e=>s(e.target.checked),"aria-invalid":!0===l,checked:u},p)),Object(r.createElement)("svg",{className:"wc-block-components-checkbox__mark","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},Object(r.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})),n&&Object(r.createElement)("span",{className:"wc-block-components-checkbox__label"},n),c))};var Je=Xe;const Qe=(e,t)=>{if(!e.includes(t))throw Error(Object(N.sprintf)(
|
2 |
/* translators: %1$s value passed to filter, %2$s : value that must be included. */
|
3 |
-
Object(N.__)('Returned value must include %1$s, you passed "%2$s"',"woo-gutenberg-products-block"),t,e));return!0};var et=n(
|
4 |
/* translators: %1$s is the type of the variable passed to the filter function, %2$s is the type of the value returned by the filter function. */
|
5 |
-
Object(N.__)("The type returned by checkout filters must be the same as the type they receive. The function received %1$s but returned %2$s.","woo-gutenberg-products-block"),typeof r,typeof t));r=s(t)?t:r}catch(e){if(_.CURRENT_USER_IS_ADMIN)throw e;console.error(e)}}),a.current[t]=r,r},[t,n,o,i,s])};let mt;!function(e){e.CHECKOUT="woocommerce/checkout",e.CHECKOUT_FIELDS="woocommerce/checkout-fields-block",e.CHECKOUT_TOTALS="woocommerce/checkout-totals-block",e.CONTACT_INFORMATION="woocommerce/checkout-contact-information-block",e.SHIPPING_ADDRESS="woocommerce/checkout-shipping-address-block",e.BILLING_ADDRESS="woocommerce/checkout-billing-address-block",e.SHIPPING_METHODS="woocommerce/checkout-shipping-methods-block",e.PAYMENT_METHODS="woocommerce/checkout-payment-methods-block",e.CART="woocommerce/cart",e.EMPTY_CART="woocommerce/empty-cart-block",e.FILLED_CART="woocommerce/filled-cart-block",e.CART_ITEMS="woocommerce/cart-items-block",e.CART_TOTALS="woocommerce/cart-totals-block",e.MINI_CART="woocommerce/mini-cart-contents",e.EMPTY_MINI_CART="woocommerce/empty-mini-cart-contents-block",e.FILLED_MINI_CART="woocommerce/filled-mini-cart-contents-block",e.MINI_CART_ITEMS="woocommerce/mini-cart-items-block"}(mt||(mt={}));const ft={},dt=e=>Object.values(mt).includes(e),ht=e=>dt(e)?Object.values(ft).filter(t=>{let{metadata:n}=t;return((null==n?void 0:n.parent)||[]).includes(e)}):[];var bt=n(34);const gt=e=>{var t,n,r,o;((e,t,n)=>{if(!ot(e))return;const r=typeof e.metadata;if("object"!==r)throw new Error(`Incorrect value for the metadata argument when registering a block component. It was a ${r}, but must be a object.`)})(e),(e=>{if(((e,t,n)=>{const r=typeof t;if("string"!==r)throw new Error(`Incorrect value for the blockName argument when registering a checkout block. It was a ${r}, but must be a string.`)})(0,e),!e)throw new Error("Value for the blockName argument must not be empty.")})(e.metadata.name),(e=>{if("string"!=typeof e&&!Array.isArray(e))throw new Error(`Incorrect value for the parent argument when registering a checkout block. It was a ${typeof e}, but must be a string or array of strings.`);if("string"==typeof e&&!dt(e))throw new Error("When registering a checkout block, the parent must be a valid inner block area.");if(Array.isArray(e)&&!e.some(e=>dt(e)))throw new Error("When registering a checkout block, the parent must be a valid inner block area.")})(e.metadata.parent),((e,t)=>{const n=e.component;if(n){if("function"==typeof n)return;if(ot(n)&&n.$$typeof&&n.$$typeof===Symbol.for("react.lazy"))return}throw new Error("Incorrect value for the component argument when registering a block component. Component must be a valid React Element or Lazy callback.")})(e),Object(bt.registerBlockComponent)({blockName:e.metadata.name,component:e.component}),ft[e.metadata.name]={blockName:e.metadata.name,metadata:e.metadata,component:e.component,force:!(null===(t=e.metadata)||void 0===t||null===(n=t.attributes)||void 0===n||null===(r=n.lock)||void 0===r||null===(o=r.default)||void 0===o||!o.remove)}}},14:function(e,t){e.exports=window.React},15:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.
|
1 |
+
this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=136)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},12:function(e,t){e.exports=window.wp.compose},128:function(e,t){},129:function(e,t){},130:function(e,t){},131:function(e,t){},132:function(e,t){},133:function(e,t){},134:function(e,t){},135:function(e,t){},136:function(e,t,n){"use strict";n.r(t),n.d(t,"TotalsItem",(function(){return k})),n.d(t,"Subtotal",(function(){return F})),n.d(t,"TotalsTaxes",(function(){return C})),n.d(t,"TotalsFees",(function(){return T})),n.d(t,"TotalsWrapper",(function(){return P})),n.d(t,"ExperimentalOrderMeta",(function(){return me})),n.d(t,"ExperimentalDiscountsMeta",(function(){return he})),n.d(t,"ExperimentalOrderShippingPackages",(function(){return ve})),n.d(t,"Panel",(function(){return je})),n.d(t,"Button",(function(){return Ze})),n.d(t,"Label",(function(){return Ye})),n.d(t,"CheckboxControl",(function(){return Je})),n.d(t,"mustContain",(function(){return Qe})),n.d(t,"extensionCartUpdate",(function(){return nt})),n.d(t,"hasValidFills",(function(){return ae})),n.d(t,"useSlot",(function(){return ce})),n.d(t,"createSlotFill",(function(){return le})),n.d(t,"__experimentalRegisterCheckoutFilters",(function(){return at})),n.d(t,"__experimentalApplyCheckoutFilter",(function(){return pt})),n.d(t,"hasInnerBlocks",(function(){return dt})),n.d(t,"getRegisteredBlocks",(function(){return ht})),n.d(t,"registerCheckoutBlock",(function(){return gt})),n.d(t,"innerBlockAreas",(function(){return mt})),n.d(t,"SlotFillProvider",(function(){return te}));var r=n(0),o=n(3),i=n.n(o),s=n(10),a=n.n(s),c=n(14),l=n.n(c);function u(){}function p(e){return!!(e||"").match(/\d/)}function m(e){return null==e}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function d(e,t){void 0===t&&(t=!0);var n="-"===e[0],r=n&&t,o=(e=e.replace("-","")).split(".");return{beforeDecimal:o[0],afterDecimal:o[1]||"",hasNagation:n,addNegation:r}}function h(e,t,n){for(var r="",o=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||o;return r}function b(e,t){return Array(t+1).join(e)}function g(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function v(e,t,n){return Math.min(Math.max(e,t),n)}function w(e){return Math.max(e.selectionStart,e.selectionEnd)}var O={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:u,onChange:u,onKeyDown:u,onMouseUp:u,onFocus:u,onBlur:u,isAllowed:function(){return!0}},y=function(e){function t(t){e.call(this,t);var n=t.defaultValue;this.validateProps();var r=this.formatValueProp(n);this.state={value:r,numAsString:this.removeFormatting(r),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.componentDidMount=function(){this.setState({mounted:!0})},t.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},t.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},t.prototype.updateValueIfRequired=function(e){var t=this.props,n=this.state,r=this.focusedElm,o=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==t){this.validateProps();var s=this.formatNumString(i),a=m(t.value)?s:this.formatValueProp(),c=this.removeFormatting(a),l=parseFloat(c),u=parseFloat(i);(isNaN(l)&&isNaN(u)||l===u)&&s===o&&(null!==r||a===o)||this.updateValue({formattedValue:a,numAsString:c,input:r,source:"prop",event:null})}},t.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,n=this.getSeparators().decimalSeparator,r=this.getNumberRegex(!0),o="-"===e[0];o&&(e=e.replace("-","")),n&&0===t&&(e=e.split(n)[0]);var i=(e=(e.match(r)||[]).join("").replace(n,".")).indexOf(".");return-1!==i&&(e=e.substring(0,i)+"."+e.substring(i+1,e.length).replace(new RegExp(f(n),"g"),"")),o&&(e="-"+e),e},t.prototype.getNumberRegex=function(e,t){var n=this.props,r=n.format,o=n.decimalScale,i=n.customNumerals,s=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(!s||0===o||t||r?"":"|"+f(s)),e?"g":void 0)},t.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,n=t.thousandSeparator,r=t.allowedDecimalSeparators;return!0===n&&(n=","),r||(r=[e,"."]),{decimalSeparator:e,thousandSeparator:n,allowedDecimalSeparators:r}},t.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},t.prototype.getValueObject=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},t.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),n=t.decimalSeparator,r=t.thousandSeparator;if(n===r)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},t.prototype.setPatchedCaretPosition=function(e,t,n){g(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===n&&g(e,t)}),0)},t.prototype.correctCaretPosition=function(e,t,n){var r=this.props,o=r.prefix,i=r.suffix,s=r.format;if(""===e)return 0;if(t=v(t,0,e.length),!s){var a="-"===e[0];return v(t,o.length+(a?1:0),e.length-i.length)}if("function"==typeof s)return t;if("#"===s[t]&&p(e[t]))return t;if("#"===s[t-1]&&p(e[t-1]))return t;var c=s.indexOf("#");t=v(t,c,s.lastIndexOf("#")+1);for(var l=s.substring(t,s.length).indexOf("#"),u=t,m=t+(-1===l?0:l);u>c&&("#"!==s[u]||!p(e[u]));)u-=1;return!p(e[m])||"left"===n&&t!==c||t-u<m-t?p(e[u])?u+1:u:m},t.prototype.getCaretPosition=function(e,t,n){var r,o,i=this.props.format,s=this.state.value,a=this.getNumberRegex(!0),c=(e.match(a)||[]).join(""),l=(t.match(a)||[]).join("");for(r=0,o=0;o<n;o++){var u=e[o]||"",p=t[r]||"";if((u.match(a)||u===p)&&("0"!==u||!p.match(a)||"0"===p||c.length===l.length)){for(;u!==t[r]&&r<t.length;)r++;r++}}return"string"!=typeof i||s||(r=t.length),this.correctCaretPosition(t,r)},t.prototype.removePrefixAndSuffix=function(e){var t=this.props,n=t.format,r=t.prefix,o=t.suffix;if(!n&&e){var i="-"===e[0];i&&(e=e.substring(1,e.length));var s=(e=r&&0===e.indexOf(r)?e.substring(r.length,e.length):e).lastIndexOf(o);e=o&&-1!==s&&s===e.length-o.length?e.substring(0,s):e,i&&(e="-"+e)}return e},t.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),n=0,r="",o=0,i=t.length;o<=i;o++){var s=t[o]||"",a=o===i?e.length:e.indexOf(s,n);if(-1===a){r=e;break}r+=e.substring(n,a),n=a+s.length}return(r.match(this.getNumberRegex(!0))||[]).join("")},t.prototype.removeFormatting=function(e){var t=this.props,n=t.format,r=t.removeFormatting;return e?(n?e="string"==typeof n?this.removePatternFormatting(e):"function"==typeof r?r(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},t.prototype.formatWithPattern=function(e){for(var t=this.props.format,n=0,r=t.split(""),o=0,i=t.length;o<i;o++)"#"===t[o]&&(r[o]=e[n]||this.getMaskAtIndex(n),n+=1);return r.join("")},t.prototype.formatAsNumber=function(e){var t=this.props,n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix,i=t.suffix,s=t.allowNegative,a=t.thousandsGroupStyle,c=this.getSeparators(),l=c.thousandSeparator,u=c.decimalSeparator,p=-1!==e.indexOf(".")||n&&r,m=d(e,s),f=m.beforeDecimal,b=m.afterDecimal,g=m.addNegation;return void 0!==n&&(b=h(b,n,r)),l&&(f=function(e,t,n){var r=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(n),o=e.search(/[1-9]/);return o=-1===o?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}(f,l,a)),o&&(f=o+f),i&&(b+=i),g&&(f="-"+f),f+(p&&u||"")+b},t.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,n=t.format,r=t.allowEmptyFormatting,o=t.customNumerals,i=e;if(o&&10===o.length){var s=new RegExp("["+o.join("")+"]","g");i=e.replace(s,(function(e){return o.indexOf(e).toString()}))}return""!==e||r?"-"!==e||n?"string"==typeof n?this.formatWithPattern(i):"function"==typeof n?n(i):this.formatAsNumber(i):"-":""},t.prototype.formatValueProp=function(e){var t=this.props,n=t.format,r=t.decimalScale,o=t.fixedDecimalScale,i=t.allowEmptyFormatting,s=this.props,a=s.value,c=s.isNumericString,l=!(a=m(a)?e:a)&&0!==a;return l&&i&&(a=""),l&&!i?"":("number"==typeof a&&(a=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var n=e.split(/[eE]/g),r=n[0],o=n[1];if(!(o=Number(o)))return t+r;var i=1+o,s=(r=r.replace(".","")).length;return i<0?r="0."+b("0",Math.abs(i))+r:i>=s?r+=b("0",i-s):r=(r.substring(0,i)||"0")+"."+r.substring(i),t+r}(a),c=!0),"Infinity"===a&&c&&(a=""),c&&!n&&"number"==typeof r&&(a=function(e,t,n){if(-1!==["","-"].indexOf(e))return e;var r=-1!==e.indexOf(".")&&t,o=d(e),i=o.beforeDecimal,s=o.afterDecimal,a=o.hasNagation,c=parseFloat("0."+(s||"0")),l=(s.length<=t?"0."+s:c.toFixed(t)).split(".");return(a?"-":"")+i.split("").reverse().reduce((function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),l[0])+(r?".":"")+h(l[1]||"",Math.min(t,s.length),n)}(a,r,o)),c?this.formatNumString(a):this.formatInput(a))},t.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),o&&!i&&t&&(e="-"+e),e},t.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},t.prototype.isCharacterAFormat=function(e,t){var n=this.props,r=n.format,o=n.prefix,i=n.suffix,s=n.decimalScale,a=n.fixedDecimalScale,c=this.getSeparators().decimalSeparator;return"string"==typeof r&&"#"!==r[e]||!(r||!(e<o.length||e>=t.length-i.length||s&&a&&t[e]===c))},t.prototype.correctInputValue=function(e,t,n){var r=this,o=this.props,i=o.format,s=o.allowNegative,a=o.prefix,c=o.suffix,l=o.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,f=this.state.numAsString||"",h=this.selectionBeforeInput,b=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var n=0,r=0,o=e.length,i=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[i-1-r]&&i-r>n&&o-r>n;)r++;return{start:n,end:o-r}}(t,n),w=v.start,O=v.end;if(!i&&w===O&&-1!==p.indexOf(n[b])){var y=0===l?"":m;return n.substr(0,b)+y+n.substr(b+1,n.length)}var j=i?0:a.length,E=t.length-(i?0:c.length);if(n.length>t.length||!n.length||w===O||0===b&&g===t.length||0===w&&O===t.length||b===j&&g===E)return n;var S=t.substr(w,O-w);if([].concat(S).find((function(e,n){return r.isCharacterAFormat(n+w,t)}))){var x=t.substr(w),k={},N=[];[].concat(x).forEach((function(e,n){r.isCharacterAFormat(n+w,t)?k[n]=e:n>S.length-1&&N.push(e)})),Object.keys(k).forEach((function(e){N.length>e?N.splice(e,0,k[e]):N.push(k[e])})),n=t.substr(0,w)+N.join("")}if(!i){var _=this.removeFormatting(n),F=d(_,s),C=F.beforeDecimal,T=F.afterDecimal,P=F.addNegation,R=e<n.indexOf(m)+1;if(_.length<f.length&&R&&""===C&&!parseFloat(T))return P?"-":""}return n},t.prototype.updateValue=function(e){var t=e.formattedValue,n=e.input,r=e.setCaretPosition;void 0===r&&(r=!0);var o=e.source,i=e.event,s=e.numAsString,a=e.caretPos,c=this.props.onValueChange,l=this.state.value;if(n){if(void 0===a&&r){var u=e.inputValue||n.value,p=w(n);n.value=t,a=this.getCaretPosition(u,t,p)}n.value=t,r&&this.setPatchedCaretPosition(n,a,t)}void 0===s&&(s=this.removeFormatting(t)),t!==l&&(this.setState({value:t,numAsString:s}),c(this.getValueObject(t,s),{event:i,source:o}))},t.prototype.onChange=function(e){var t=e.target,n=t.value,r=this.state,o=this.props,i=o.isAllowed,s=r.value||"",a=w(t);n=this.correctInputValue(a,s,n);var c=this.formatInput(n)||"",l=this.removeFormatting(c),u=i(this.getValueObject(c,l));u||(c=s),this.updateValue({formattedValue:c,numAsString:l,inputValue:n,input:t,event:e,source:"event"}),u&&o.onChange(e)},t.prototype.onBlur=function(e){var t=this.props,n=this.state,r=t.format,o=t.onBlur,i=t.allowLeadingZeros,s=n.numAsString,a=n.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!r){isNaN(parseFloat(s))&&(s=""),i||(s=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}(s));var c=this.formatNumString(s);if(c!==a)return this.updateValue({formattedValue:c,numAsString:s,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void o(e)}o(e)},t.prototype.onKeyDown=function(e){var t,n=e.target,r=e.key,o=n.selectionStart,i=n.selectionEnd,s=n.value;void 0===s&&(s="");var a=this.props,c=a.decimalScale,l=a.fixedDecimalScale,u=a.prefix,p=a.suffix,m=a.format,f=a.onKeyDown,d=void 0!==c&&l,h=this.getNumberRegex(!1,d),b=new RegExp("-"),g="string"==typeof m;if(this.selectionBeforeInput={selectionStart:o,selectionEnd:i},"ArrowLeft"===r||"Backspace"===r?t=o-1:"ArrowRight"===r?t=o+1:"Delete"===r&&(t=o),void 0!==t&&o===i){var v=t,w=g?m.indexOf("#"):u.length,O=g?m.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===r||"ArrowRight"===r){var y="ArrowLeft"===r?"left":"right";v=this.correctCaretPosition(s,t,y)}else if("Delete"!==r||h.test(s[t])||b.test(s[t])){if("Backspace"===r&&!h.test(s[t]))if(o<=w+1&&"-"===s[0]&&void 0===m){var j=s.substring(1);this.updateValue({formattedValue:j,caretPos:v,input:n,event:e,source:"event"})}else if(!b.test(s[t])){for(;!h.test(s[v-1])&&v>w;)v--;v=this.correctCaretPosition(s,v,"left")}}else for(;!h.test(s[v])&&v<O;)v++;(v!==t||t<w||t>O)&&(e.preventDefault(),this.setPatchedCaretPosition(n,v,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(n,v,s),f(e)}else f(e)},t.prototype.onMouseUp=function(e){var t=e.target,n=t.selectionStart,r=t.selectionEnd,o=t.value;if(void 0===o&&(o=""),n===r){var i=this.correctCaretPosition(o,n);i!==n&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)},t.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var n=e.target,r=n.selectionStart,o=n.selectionEnd,i=n.value;void 0===i&&(i="");var s=t.correctCaretPosition(i,r);s===r||0===r&&o===i.length||t.setPatchedCaretPosition(n,s,i),t.props.onFocus(e)}),0)},t.prototype.render=function(){var e=this.props,t=e.type,n=e.displayType,r=e.customInput,o=e.renderText,i=e.getInputRef,s=e.format,a=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),c=this.state,u=c.value,p=c.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(s)?"numeric":void 0,m=Object.assign({inputMode:p},a,{type:t,value:u,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return o?o(u,a)||null:l.a.createElement("span",Object.assign({},a,{ref:i}),u);if(r){var f=r;return l.a.createElement(f,Object.assign({},m,{ref:i}))}return l.a.createElement("input",Object.assign({},m,{ref:i}))},t}(l.a.Component);y.defaultProps=O;var j=y;n(129);const E=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});var S=e=>{let{className:t,value:n,currency:o,onValueChange:s,displayType:c="text",...l}=e;const u="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(u))return null;const p=u/10**o.minorUnit;if(!Number.isFinite(p))return null;const m=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...l,...E(o),value:void 0,currency:void 0,onValueChange:void 0},d=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(r.createElement)(j,a()({className:m,displayType:c},f,{value:p,onValueChange:d}))};n(128);const x=e=>{let{value:t,currency:n}=e;return Object(r.isValidElement)(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-item__value"},t):Number.isFinite(t)?Object(r.createElement)(S,{className:"wc-block-components-totals-item__value",currency:n||{},value:t}):null};var k=e=>{let{className:t,currency:n,label:o,value:s,description:a}=e;return Object(r.createElement)("div",{className:i()("wc-block-components-totals-item",t)},Object(r.createElement)("span",{className:"wc-block-components-totals-item__label"},o),Object(r.createElement)(x,{value:s,currency:n}),Object(r.createElement)("div",{className:"wc-block-components-totals-item__description"},a))},N=n(1),_=n(5),F=e=>{let{currency:t,values:n,className:o}=e;const{total_items:i,total_items_tax:s}=n,a=parseInt(i,10),c=parseInt(s,10);return Object(r.createElement)(k,{className:o,currency:t,label:Object(N.__)("Subtotal","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?a+c:a})};n(130);var C=e=>{let{currency:t,values:n,className:o,showRateAfterTaxName:s}=e;const{total_tax:a,tax_lines:c}=n;if(!Object(_.getSetting)("taxesEnabled",!0)&&parseInt(a,10)<=0)return null;const l=Object(_.getSetting)("displayItemizedTaxes",!1),u=l&&c.length>0?Object(r.createElement)("div",{className:i()("wc-block-components-totals-taxes",o)},c.map((e,n)=>{let{name:o,rate:i,price:a}=e;const c=`${o}${s?" "+i:""}`;return Object(r.createElement)(k,{key:"tax-line-"+n,className:"wc-block-components-totals-taxes__grouped-rate",currency:t,label:c,value:parseInt(a,10)})})," "):null;return l?u:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(k,{className:i()("wc-block-components-totals-taxes",o),currency:t,label:Object(N.__)("Taxes","woo-gutenberg-products-block"),value:parseInt(a,10),description:null}))},T=e=>{let{currency:t,cartFees:n,className:o}=e;return Object(r.createElement)(r.Fragment,null,n.map((e,n)=>{let{id:s,name:a,totals:c}=e;const l=parseInt(c.total,10);if(!l)return null;const u=parseInt(c.total_tax,10);return Object(r.createElement)(k,{key:s||`${n}-${a}`,className:i()("wc-block-components-totals-fees",o),currency:t,label:a||Object(N.__)("Fee","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?l+u:l})}))};n(131);var P=e=>{let{children:t,slotWrapper:n=!1}=e;return c.Children.count(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-wrapper"+(n?" slot-wrapper":"")},t):null},R=n(7),M=n.n(R),A=n(6),D=n(19);function I(e){const t=Object(r.useContext)(D.a),n=t.slots[e]||{},o=t.fills[e],i=Object(r.useMemo)(()=>o||[],[o]);return{...n,updateSlot:Object(r.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(r.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:i,registerFill:Object(r.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(r.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var L=n(8),V=n(4),B=Object(r.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function U({name:e,children:t,registerFill:n,unregisterFill:o}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(r.useContext)(B),[o,i]=Object(r.useState)(t(e));return Object(r.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),o})(e),s=Object(r.useRef)({name:e,children:t});return Object(r.useLayoutEffect)(()=>(n(e,s.current),()=>o(e,s.current)),[]),Object(r.useLayoutEffect)(()=>{s.current.children=t,i&&i.forceUpdate()},[t]),Object(r.useLayoutEffect)(()=>{e!==s.current.name&&(o(s.current.name,s.current),s.current.name=e,n(e,s.current))},[e]),i&&i.node?(Object(V.isFunction)(t)&&(t=t(i.props.fillProps)),Object(r.createPortal)(t,i.node)):null}var W=e=>Object(r.createElement)(B.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(r.createElement)(U,Object(L.a)({},e,{registerFill:t,unregisterFill:n})));class H extends r.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:o}=this.props,i=Object(V.map)(o(t,this),e=>{const t=Object(V.isFunction)(e.children)?e.children(n):e.children;return r.Children.map(t,(e,t)=>{if(!e||Object(V.isString)(e))return e;const n=e.key||t;return Object(r.cloneElement)(e,{key:n})})}).filter(Object(V.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(V.isFunction)(e)?e(i):i)}}var z=e=>Object(r.createElement)(B.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:o})=>Object(r.createElement)(H,Object(L.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:o})));function $(){const[,e]=Object(r.useState)({}),t=Object(r.useRef)(!0);return Object(r.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function G({name:e,children:t}){const n=I(e),o=Object(r.useRef)({rerender:$()});return Object(r.useEffect)(()=>(n.registerFill(o),()=>{n.unregisterFill(o)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(r.createPortal)(t,n.ref.current)):null}var K=n(12),q=Object(r.forwardRef)((function({name:e,fillProps:t={},as:n="div",...o},i){const s=Object(r.useContext)(D.a),a=Object(r.useRef)();return Object(r.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(r.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(r.createElement)(n,Object(L.a)({ref:Object(K.useMergeRefs)([i,a])},o))})),Z=n(16),Y=n.n(Z);function X({children:e}){const t=function(){const[e,t]=Object(r.useState)({}),[n,o]=Object(r.useState)({}),i=Object(r.useCallback)((e,n,r)=>{t(t=>{const o=t[e]||{};return{...t,[e]:{...o,ref:n||o.ref,fillProps:r||o.fillProps||{}}}})},[]),s=Object(r.useCallback)((e,n)=>{t(t=>{const{[e]:r,...o}=t;return(null==r?void 0:r.ref)===n?o:t})},[]),a=Object(r.useCallback)((t,r)=>{const o=e[t];if(o&&!Y()(o.fillProps,r)){o.fillProps=r;const e=n[t];e&&e.map(e=>e.current.rerender())}},[e,n]),c=Object(r.useCallback)((e,t)=>{o(n=>({...n,[e]:[...n[e]||[],t]}))},[]),l=Object(r.useCallback)((e,t)=>{o(n=>n[e]?{...n,[e]:n[e].filter(e=>e!==t)}:n)},[]);return Object(r.useMemo)(()=>({slots:e,fills:n,registerSlot:i,updateSlot:a,unregisterSlot:s,registerFill:c,unregisterFill:l}),[e,n,i,a,s,c,l])}();return Object(r.createElement)(D.a.Provider,{value:t},e)}class J extends r.Component{constructor(){super(...arguments),this.registerSlot=this.registerSlot.bind(this),this.registerFill=this.registerFill.bind(this),this.unregisterSlot=this.unregisterSlot.bind(this),this.unregisterFill=this.unregisterFill.bind(this),this.getSlot=this.getSlot.bind(this),this.getFills=this.getFills.bind(this),this.hasFills=this.hasFills.bind(this),this.subscribe=this.subscribe.bind(this),this.slots={},this.fills={},this.listeners=[],this.contextValue={registerSlot:this.registerSlot,unregisterSlot:this.unregisterSlot,registerFill:this.registerFill,unregisterFill:this.unregisterFill,getSlot:this.getSlot,getFills:this.getFills,hasFills:this.hasFills,subscribe:this.subscribe}}registerSlot(e,t){const n=this.slots[e];this.slots[e]=t,this.triggerListeners(),this.forceUpdateSlot(e),n&&n.forceUpdate()}registerFill(e,t){this.fills[e]=[...this.fills[e]||[],t],this.forceUpdateSlot(e)}unregisterSlot(e,t){this.slots[e]===t&&(delete this.slots[e],this.triggerListeners())}unregisterFill(e,t){this.fills[e]=Object(V.without)(this.fills[e],t),this.forceUpdateSlot(e)}getSlot(e){return this.slots[e]}getFills(e,t){return this.slots[e]!==t?[]:this.fills[e]}hasFills(e){return this.fills[e]&&!!this.fills[e].length}forceUpdateSlot(e){const t=this.getSlot(e);t&&t.forceUpdate()}triggerListeners(){this.listeners.forEach(e=>e())}subscribe(e){return this.listeners.push(e),()=>{this.listeners=Object(V.without)(this.listeners,e)}}render(){return Object(r.createElement)(B.Provider,{value:this.contextValue},this.props.children)}}function Q(e){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W,e),Object(r.createElement)(G,e))}const ee=Object(r.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(r.createElement)(q,Object(L.a)({},t,{ref:n})):Object(r.createElement)(z,t));function te({children:e,...t}){return Object(r.createElement)(J,t,Object(r.createElement)(X,null,e))}function ne(e){const t=t=>Object(r.createElement)(Q,Object(L.a)({name:e},t));t.displayName=e+"Fill";const n=t=>Object(r.createElement)(ee,Object(L.a)({name:e},t));return n.displayName=e+"Slot",n.__unstableName=e,{Fill:t,Slot:n}}var re=n(15),oe=n.n(re);class ie extends c.Component{constructor(){super(...arguments),oe()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(r.createElement)(r.Fragment,null,Object(r.createElement)("strong",null,e.status),": "+e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{renderError:e}=this.props,{errorMessage:t,hasError:n}=this.state;return n?"function"==typeof e?e(t):Object(r.createElement)("p",null,t):this.props.children}}var se=ie;const ae=e=>Array.isArray(e)&&e.filter(Boolean).length>0;let ce;ce=I;const le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const{Fill:n,Slot:o}=ne(e),i=e=>{let{children:o}=e;return Object(r.createElement)(n,null,e=>r.Children.map(o,n=>Object(r.createElement)(se,{renderError:_.CURRENT_USER_IS_ADMIN?t:()=>null},Object(r.cloneElement)(n,e))))},s=e=>Object(r.createElement)(o,a()({},e,{bubblesVirtually:!0}));return{Fill:i,Slot:s}},{Fill:ue,Slot:pe}=le("__experimentalOrderMeta");ue.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalOrderMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(pe,{className:i()(t,"wc-block-components-order-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var me=ue;const{Fill:fe,Slot:de}=le("__experimentalDiscountsMeta");fe.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalDiscountsMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(de,{className:i()(t,"wc-block-components-discounts-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var he=fe;const{Fill:be,Slot:ge}=le("__experimentalOrderShippingPackages");be.Slot=e=>{let{className:t,collapsible:n,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}=e;const{fills:p}=ce("__experimentalOrderShippingPackages"),m=p.length>1;return Object(r.createElement)(ge,{className:i()("wc-block-components-shipping-rates-control",t),fillProps:{collapsible:n,collapse:m,showItems:m,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}})};var ve=be,we=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})},Oe=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),ye=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));n(132);var je=e=>{let{children:t,className:n,initialOpen:o=!1,hasBorder:s=!1,title:a,titleTag:c="div"}=e;const[l,u]=Object(r.useState)(o);return Object(r.createElement)("div",{className:i()(n,"wc-block-components-panel",{"has-border":s})},Object(r.createElement)(c,null,Object(r.createElement)("button",{"aria-expanded":l,className:"wc-block-components-panel__button",onClick:()=>u(!l)},Object(r.createElement)(we,{"aria-hidden":"true",className:"wc-block-components-panel__button-icon",icon:l?Oe:ye}),a)),l&&Object(r.createElement)("div",{className:"wc-block-components-panel__content"},t))},Ee=n(33),Se=Object(r.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(A.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"}));function xe(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const i=o.getBoundingClientRect();return new r.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}let ke=0;function Ne(e){const t=document.scrollingElement||document.body;e&&(ke=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=ke)}let _e=0;function Fe(){return Object(r.useEffect)(()=>(0===_e&&Ne(!0),++_e,()=>{1===_e&&Ne(!1),--_e}),[]),null}function Ce(e){return"appear"===e?"top":"left"}function Te(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const a=n?parseInt(n,10):0,c=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+a,width:e.width-l-u,height:e.height-a-c,left:e.left+l,right:e.right-u,top:e.top+a,bottom:e.bottom-c}}function Pe(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function Re(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function Me(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const Ae=Object(r.forwardRef)(({headerTitle:e,onClose:t,children:n,className:o,noArrow:s=!0,isAlternate:a,position:c="bottom right",range:l,focusOnMount:u="firstElement",anchorRef:p,shouldAnchorIncludePadding:m,anchorRect:f,getAnchorRect:d,expandOnMobile:h,animate:b=!0,onClickOutside:g,onFocusOutside:v,__unstableStickyBoundaryElement:w,__unstableSlotName:O="Popover",__unstableObserveElement:y,__unstableBoundaryParent:j,__unstableForcePosition:E,__unstableForceXAlignment:S,...x},k)=>{const _=Object(r.useRef)(null),F=Object(r.useRef)(null),C=Object(r.useRef)(),T=Object(K.useViewportMatch)("medium","<"),[P,R]=Object(r.useState)(),A=I(O),D=h&&T,[V,B]=Object(K.useResizeObserver)();s=D||s,Object(r.useLayoutEffect)(()=>{if(D)return Me(C.current,"is-without-arrow",s),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis"),Pe(C.current,"data-y-axis"),Re(C.current,"top"),Re(C.current,"left"),Re(F.current,"maxHeight"),void Re(F.current,"maxWidth");const e=()=>{if(!C.current||!F.current)return;let e=function(e,t,n,r=!1,o,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return xe(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return xe(Object(Ee.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=xe(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:Te(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),a=xe(new window.DOMRect(n.left,n.top,n.width,s.bottom-n.top),e.ownerDocument,i);return o?a:Te(a,r)}if(!e.current)return;const{parentNode:s}=e.current,a=s.getBoundingClientRect();return o?a:Te(a,s)}(_,f,d,p,m,C.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=C.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var i;j&&(r=null===(i=C.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const l=B.height?B:F.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:h,xAxis:b,yAxis:g,contentHeight:v,contentWidth:O}=function(e,t,n="top",r,o,i,s,a,c){const[l,u="center",p]=n.split(" "),m=function(e,t,n,r,o,i,s,a){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-s;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},p={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},m={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,d=n,h=null;if(!o&&!a)if("middle"===n&&u.contentHeight===c)d="middle";else if("top"===n&&p.contentHeight===c)d="top";else if("bottom"===n&&m.contentHeight===c)d="bottom";else{d=p.contentHeight>m.contentHeight?"top":"bottom";const e="top"===d?p.contentHeight:m.contentHeight;h=e!==c?e:null}return f="middle"===d?u.popoverTop:"top"===d?p.popoverTop:m.popoverTop,{yAxis:d,popoverTop:f,contentHeight:h}}(e,t,l,p,r,0,i,a);return{...function(e,t,n,r,o,i,s,a,c){const{width:l}=t;"left"===n&&Object(N.isRTL)()?n="right":"right"===n&&Object(N.isRTL)()&&(n="left"),"left"===r&&Object(N.isRTL)()?r="right":"right"===r&&Object(N.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),p={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let m=e.left;"right"===r?m=e.right:"middle"===i||c||(m=u);let f=e.right;"left"===r?f=e.left:"middle"===i||c||(f=u);const d={popoverLeft:m,contentWidth:m-l>0?l:m},h={popoverLeft:f,contentWidth:f+l>window.innerWidth?window.innerWidth-f:l};let b,g=n,v=null;if(!o&&!a)if("center"===n&&p.contentWidth===l)g="center";else if("left"===n&&d.contentWidth===l)g="left";else if("right"===n&&h.contentWidth===l)g="right";else{g=d.contentWidth>h.contentWidth?"left":"right";const e="left"===g?d.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(g="center",p.popoverLeft=window.innerWidth/2)}if(b="center"===g?p.popoverLeft:"left"===g?d.popoverLeft:h.popoverLeft,s){const e=s.getBoundingClientRect();b=Math.min(b,e.right-l),Object(N.isRTL)()||(b=Math.max(b,0))}return{xAxis:g,popoverLeft:b,contentWidth:v}}(e,t,u,p,r,m.yAxis,s,a,c),...m}}(e,l,c,w,C.current,o,r,E,S);"number"==typeof u&&"number"==typeof h&&(Re(C.current,"top",u+"px"),Re(C.current,"left",h+"px")),Me(C.current,"is-without-arrow",s||"center"===b&&"middle"===g),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis",b),Pe(C.current,"data-y-axis",g),Re(F.current,"maxHeight","number"==typeof v?v+"px":""),Re(F.current,"maxWidth","number"==typeof O?O+"px":""),R(({left:"right",right:"left"}[b]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=C.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const i=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",i),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const l=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(p);let u;return l&&l!==t&&(l.defaultView.addEventListener("resize",e),l.defaultView.addEventListener("scroll",e,!0)),y&&(u=new n.MutationObserver(e),u.observe(y,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),l&&l!==t&&(l.defaultView.removeEventListener("resize",e),l.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[D,f,d,p,m,c,B,w,y,j]);const U=(e,n)=>{if("focus-outside"===e&&v)v(n);else if("focus-outside"===e&&g){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),M()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),g(e)}else t&&t()},[W,H]=Object(K.__experimentalUseDialog)({focusOnMount:u,__unstableOnClose:U,onClose:U}),z=Object(K.useMergeRefs)([C,W,k]),$=Boolean(b&&P)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=Ce(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:P});let G=Object(r.createElement)("div",Object(L.a)({className:i()("components-popover",o,$,{"is-expanded":D,"is-without-arrow":s,"is-alternate":a})},x,{ref:z},H,{tabIndex:"-1"}),D&&Object(r.createElement)(Fe,null),D&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},e),Object(r.createElement)(Ke,{className:"components-popover__close",icon:Se,onClick:t})),Object(r.createElement)("div",{ref:F,className:"components-popover__content"},Object(r.createElement)("div",{style:{position:"relative"}},V,n)));return A.ref&&(G=Object(r.createElement)(Q,{name:O},G)),p||f?G:Object(r.createElement)("span",{ref:_},G)});Ae.Slot=Object(r.forwardRef)((function({name:e="Popover"},t){return Object(r.createElement)(ee,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var De=Ae,Ie=function({shortcut:e,className:t}){if(!e)return null;let n,o;return Object(V.isString)(e)&&(n=e),Object(V.isObject)(e)&&(n=e.display,o=e.ariaLabel),Object(r.createElement)("span",{className:t,"aria-label":o},n)};const Le=Object(r.createElement)("div",{className:"event-catcher"}),Ve=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(r.cloneElement)(Object(r.createElement)("span",{className:"disabled-element-wrapper"},Object(r.cloneElement)(Le,e),Object(r.cloneElement)(t,{children:n}),","),e),Be=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(r.cloneElement)(e,{...t,children:n}),Ue=(e,t,n)=>{if(1!==r.Children.count(e))return;const o=r.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)};var We=function({children:e,position:t,text:n,shortcut:o}){const[i,s]=Object(r.useState)(!1),[a,c]=Object(r.useState)(!1),l=Object(K.useDebounce)(c,700),u=t=>{Ue(e,"onMouseDown",t),document.addEventListener("mouseup",f),s(!0)},p=t=>{Ue(e,"onMouseUp",t),document.removeEventListener("mouseup",f),s(!1)},m=e=>"mouseUp"===e?p:"mouseDown"===e?u:void 0,f=m("mouseUp"),d=(t,n)=>r=>{if(Ue(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;l.cancel();const o=Object(V.includes)(["focus","mouseenter"],r.type);o!==a&&(n?l(o):c(o))},h=()=>{l.cancel(),document.removeEventListener("mouseup",f)};if(Object(r.useEffect)(()=>h,[]),1!==r.Children.count(e))return e;const b={onMouseEnter:d("onMouseEnter",!0),onMouseLeave:d("onMouseLeave"),onClick:d("onClick"),onFocus:d("onFocus"),onBlur:d("onBlur"),onMouseDown:m("mouseDown")},g=r.Children.only(e),{children:v,disabled:w}=g.props;return(w?Ve:Be)({child:g,eventHandlers:b,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:o,shortcut:i})=>Object(r.concatChildren)(e,t&&Object(r.createElement)(De,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,Object(r.createElement)(Ie,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:v,isOver:a,position:t,text:n,shortcut:o})})},He=function({icon:e,className:t,...n}){const o=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(r.createElement)("span",Object(L.a)({className:o},n))},ze=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(r.createElement)(He,Object(L.a)({icon:e},n));if(Object(r.isValidElement)(e)&&He===e.type)return Object(r.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof r.Component?Object(r.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===A.SVG)){const o={width:t,height:t,...e.props,...n};return Object(r.createElement)(A.SVG,o)}return Object(r.isValidElement)(e)?Object(r.cloneElement)(e,{size:t,...n}):e},$e=Object(r.forwardRef)((function({as:e="div",className:t,...n},o){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(r.createElement)(e,t)}({as:e,className:i()("components-visually-hidden",t),...n,ref:o})}));const Ge=["onMouseDown","onClick"];var Ke=Object(r.forwardRef)((function(e,t){const{href:n,target:o,isSmall:s,isPressed:a,isBusy:c,isDestructive:l,className:u,disabled:p,icon:m,iconPosition:f="left",iconSize:d,showTooltip:h,tooltipPosition:b,shortcut:g,label:v,children:w,text:O,variant:y,__experimentalIsFocusable:j,describedBy:E,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...s}){let a=i;var c,l,u,p,m;return t&&(null!==(c=a)&&void 0!==c||(a="primary")),r&&(null!==(l=a)&&void 0!==l||(a="tertiary")),n&&(null!==(u=a)&&void 0!==u||(a="secondary")),e&&(M()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...s,variant:a}}(e),x=i()("components-button",u,{"is-secondary":"secondary"===y,"is-primary":"primary"===y,"is-small":s,"is-tertiary":"tertiary"===y,"is-pressed":a,"is-busy":c,"is-link":"link"===y,"is-destructive":l,"has-text":!!m&&!!w,"has-icon":!!m}),k=p&&!j,N=void 0===n||k?"button":"a",_="a"===N?{href:n,target:o}:{type:"button",disabled:k,"aria-pressed":a};if(p&&j){_["aria-disabled"]=!0;for(const e of Ge)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const F=!k&&(h&&v||g||!!v&&(!w||Object(V.isArray)(w)&&!w.length)&&!1!==h),C=E?Object(V.uniqueId)():null,T=S["aria-describedby"]||C,P=Object(r.createElement)(N,Object(L.a)({},_,S,{className:x,"aria-label":S["aria-label"]||v,"aria-describedby":T,ref:t}),m&&"left"===f&&Object(r.createElement)(ze,{icon:m,size:d}),O&&Object(r.createElement)(r.Fragment,null,O),m&&"right"===f&&Object(r.createElement)(ze,{icon:m,size:d}),w);return F?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(We,{text:E||v,shortcut:g,position:b},P),E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E))):Object(r.createElement)(r.Fragment,null,P,E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E)))}));n(134);var qe=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"});n(133);var Ze=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...c}=e;const l=i()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(r.createElement)(Ke,a()({className:l},c),n&&Object(r.createElement)(qe,null),Object(r.createElement)("span",{className:"wc-block-components-button__text"},o))},Ye=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const c=null!=n,l=null!=o;return!c&&l?(t=s||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=s||r.Fragment,c&&l&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))};n(135);const Xe=e=>{let{className:t,label:n,id:o,onChange:s,children:c,hasError:l=!1,checked:u=!1,...p}=e;const m=Object(K.useInstanceId)(Xe),f=o||"checkbox-control-"+m;return Object(r.createElement)("div",{className:i()("wc-block-components-checkbox",{"has-error":l},t)},Object(r.createElement)("label",{htmlFor:f},Object(r.createElement)("input",a()({id:f,className:"wc-block-components-checkbox__input",type:"checkbox",onChange:e=>s(e.target.checked),"aria-invalid":!0===l,checked:u},p)),Object(r.createElement)("svg",{className:"wc-block-components-checkbox__mark","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},Object(r.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})),n&&Object(r.createElement)("span",{className:"wc-block-components-checkbox__label"},n),c))};var Je=Xe;const Qe=(e,t)=>{if(!e.includes(t))throw Error(Object(N.sprintf)(
|
2 |
/* translators: %1$s value passed to filter, %2$s : value that must be included. */
|
3 |
+
Object(N.__)('Returned value must include %1$s, you passed "%2$s"',"woo-gutenberg-products-block"),t,e));return!0};var et=n(2),tt=n(9);const nt=e=>{const{applyExtensionCartUpdate:t}=Object(et.dispatch)(tt.b);return t(e)},rt=e=>null===e,ot=e=>!rt(e)&&e instanceof Object&&e.constructor===Object,it=()=>!0;let st={};const at=(e,t)=>{Object.keys(t).includes("couponName")&&M()("snackbarNotices",{alternative:"snackbarNoticeVisibility",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4417"}),Object.keys(t).includes("couponName")&&M()("couponName",{alternative:"coupons",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons"}),st={...st,[e]:t}},ct={},lt=(e,t,n,r)=>{ct[e]={arg:t,extensions:n,defaultValue:r}},ut=(e,t)=>!(!rt(e)||!rt(t))||ot(e)&&ot(t)&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>{return o=n,ot(r=t)&&o in r&&Y()(e[n],t[n]);var r,o}),pt=e=>{let{filterName:t,defaultValue:n,extensions:o=null,arg:i=null,validation:s=it}=e;const a=Object(r.useRef)({});return Object(r.useMemo)(()=>{if(!((e,t,n,r)=>{const o=ct[e];if(!o)return lt(e,t,n,r),!0;const{arg:i={},extensions:s={},defaultValue:a=null}=o;return ut(t,i)?!(r===a&&ut(n,s)||(lt(e,t,n,r),0)):(lt(e,t,n,r),!0)})(t,i,o,n)&&void 0!==a.current[t])return a.current[t];const e=(e=>Object.keys(st).map(t=>st[t][e]).filter(Boolean))(t);let r=n;return e.forEach(e=>{try{const t=e(r,o||{},i);if(typeof t!=typeof r)throw new Error(Object(N.sprintf)(
|
4 |
/* translators: %1$s is the type of the variable passed to the filter function, %2$s is the type of the value returned by the filter function. */
|
5 |
+
Object(N.__)("The type returned by checkout filters must be the same as the type they receive. The function received %1$s but returned %2$s.","woo-gutenberg-products-block"),typeof r,typeof t));r=s(t)?t:r}catch(e){if(_.CURRENT_USER_IS_ADMIN)throw e;console.error(e)}}),a.current[t]=r,r},[t,n,o,i,s])};let mt;!function(e){e.CHECKOUT="woocommerce/checkout",e.CHECKOUT_FIELDS="woocommerce/checkout-fields-block",e.CHECKOUT_TOTALS="woocommerce/checkout-totals-block",e.CONTACT_INFORMATION="woocommerce/checkout-contact-information-block",e.SHIPPING_ADDRESS="woocommerce/checkout-shipping-address-block",e.BILLING_ADDRESS="woocommerce/checkout-billing-address-block",e.SHIPPING_METHODS="woocommerce/checkout-shipping-methods-block",e.PAYMENT_METHODS="woocommerce/checkout-payment-methods-block",e.CART="woocommerce/cart",e.EMPTY_CART="woocommerce/empty-cart-block",e.FILLED_CART="woocommerce/filled-cart-block",e.CART_ITEMS="woocommerce/cart-items-block",e.CART_TOTALS="woocommerce/cart-totals-block",e.MINI_CART="woocommerce/mini-cart-contents",e.EMPTY_MINI_CART="woocommerce/empty-mini-cart-contents-block",e.FILLED_MINI_CART="woocommerce/filled-mini-cart-contents-block",e.MINI_CART_ITEMS="woocommerce/mini-cart-items-block"}(mt||(mt={}));const ft={},dt=e=>Object.values(mt).includes(e),ht=e=>dt(e)?Object.values(ft).filter(t=>{let{metadata:n}=t;return((null==n?void 0:n.parent)||[]).includes(e)}):[];var bt=n(34);const gt=e=>{var t,n,r,o;((e,t,n)=>{if(!ot(e))return;const r=typeof e.metadata;if("object"!==r)throw new Error(`Incorrect value for the metadata argument when registering a block component. It was a ${r}, but must be a object.`)})(e),(e=>{if(((e,t,n)=>{const r=typeof t;if("string"!==r)throw new Error(`Incorrect value for the blockName argument when registering a checkout block. It was a ${r}, but must be a string.`)})(0,e),!e)throw new Error("Value for the blockName argument must not be empty.")})(e.metadata.name),(e=>{if("string"!=typeof e&&!Array.isArray(e))throw new Error(`Incorrect value for the parent argument when registering a checkout block. It was a ${typeof e}, but must be a string or array of strings.`);if("string"==typeof e&&!dt(e))throw new Error("When registering a checkout block, the parent must be a valid inner block area.");if(Array.isArray(e)&&!e.some(e=>dt(e)))throw new Error("When registering a checkout block, the parent must be a valid inner block area.")})(e.metadata.parent),((e,t)=>{const n=e.component;if(n){if("function"==typeof n)return;if(ot(n)&&n.$$typeof&&n.$$typeof===Symbol.for("react.lazy"))return}throw new Error("Incorrect value for the component argument when registering a block component. Component must be a valid React Element or Lazy callback.")})(e),Object(bt.registerBlockComponent)({blockName:e.metadata.name,component:e.component}),ft[e.metadata.name]={blockName:e.metadata.name,metadata:e.metadata,component:e.component,force:!(null===(t=e.metadata)||void 0===t||null===(n=t.attributes)||void 0===n||null===(r=n.lock)||void 0===r||null===(o=r.default)||void 0===o||!o.remove)}}},14:function(e,t){e.exports=window.React},15:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},16:function(e,t){e.exports=window.wp.isShallowEqual},19:function(e,t,n){"use strict";(function(e){var r=n(0);n(32);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(20))},2:function(e,t){e.exports=window.wp.data},20:function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,l=[],u=!1,p=-1;function m(){u&&c&&(u=!1,c.length?l=c.concat(l):p=-1,l.length&&f())}function f(){if(!u){var e=a(m);u=!0;for(var t=l.length;t;){for(c=l,l=[];++p<t;)c&&c[p].run();p=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new d(e,t)),1!==l.length||u||a(f)},d.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=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,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}},3:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var s=o.apply(null,r);s&&e.push(s)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},32:function(e,t){e.exports=window.wp.warning},33:function(e,t){e.exports=window.wp.dom},34:function(e,t){e.exports=window.wc.wcBlocksRegistry},4:function(e,t){e.exports=window.lodash},5:function(e,t){e.exports=window.wc.wcSettings},6:function(e,t){e.exports=window.wp.primitives},7:function(e,t){e.exports=window.wp.deprecated},8:function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},9:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=n(1);const o="wc/store/cart",i={code:"cart_api_error",message:Object(r.__)("Unable to get cart data from the API.","woo-gutenberg-products-block"),data:{status:500}}}});
|
build/cart-blocks/accepted-payment-methods-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{248:function(t,e){},250:function(t,e,s){"use strict";s.d(e,"b",(function(){return o})),s.d(e,"a",(function(){return l}));var a=s(28),n=s(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[11],{248:function(t,e){},250:function(t,e,s){"use strict";s.d(e,"b",(function(){return o})),s.d(e,"a",(function(){return l}));var a=s(28),n=s(183);const c=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:e,expressPaymentMethods:s,paymentMethodsInitialized:c,expressPaymentMethodsInitialized:o}=Object(n.b)(),l=Object(a.a)(e),i=Object(a.a)(s);return{paymentMethods:t?i:l,isInitialized:t?o:c}},o=()=>c(!1),l=()=>c(!0)},253:function(t,e,s){"use strict";var a=s(10),n=s.n(a),c=s(0),o=s(4),l=s.n(o);const i=t=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+t;var r=t=>{let{id:e,src:s=null,alt:a=""}=t;return s?Object(c.createElement)("img",{className:i(e),src:s,alt:a}):null},d=s(45);const m=[{id:"alipay",alt:"Alipay",src:d.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:d.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:d.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:d.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:d.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:d.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:d.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:d.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:d.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:d.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:d.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:d.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:d.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:d.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:d.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:d.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:d.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:d.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:d.l+"payment-methods/wechat.svg"}];var p=s(59);s(248),e.a=t=>{let{icons:e=[],align:s="center",className:a}=t;const o=(t=>{const e={};return t.forEach(t=>{let s={};"string"==typeof t&&(s={id:t,alt:t,src:null}),"object"==typeof t&&(s={id:t.id||"",alt:t.alt||"",src:t.src||null}),s.id&&Object(p.a)(s.id)&&!e[s.id]&&(e[s.id]=s)}),Object.values(e)})(e);if(0===o.length)return null;const i=l()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===s,"wc-block-components-payment-method-icons--align-right":"right"===s},a);return Object(c.createElement)("div",{className:i},o.map(t=>{const e={...t,...(s=t.id,m.find(t=>t.id===s)||{})};var s;return Object(c.createElement)(r,n()({key:"payment-method-icon-"+t.id},e))}))}},364:function(t,e,s){"use strict";s.d(e,"a",(function(){return a}));const a=t=>Object.values(t).reduce((t,e)=>(null!==e.icons&&(t=t.concat(e.icons)),t),[])},427:function(t,e,s){"use strict";s.r(e);var a=s(0),n=s(253),c=s(250),o=s(364);e.default=t=>{let{className:e}=t;const{paymentMethods:s}=Object(c.b)();return Object(a.createElement)(n.a,{className:e,icons:Object(o.a)(s)})}}}]);
|
build/cart-blocks/checkout-button-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{240:function(e,t,c){"use strict";var n=c(10),o=c.n(n),s=c(0),r=c(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{240:function(e,t,c){"use strict";var n=c(10),o=c.n(n),s=c(0),r=c(51),a=c(4),i=c.n(a),u=c(134);c(243),t.a=e=>{let{className:t,showSpinner:c=!1,children:n,variant:a="contained",...b}=e;const l=i()("wc-block-components-button",t,a,{"wc-block-components-button--loading":c});return Object(s.createElement)(r.a,o()({className:l},b),c&&Object(s.createElement)(u.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},n))}},243:function(e,t){},361:function(e,t,c){"use strict";(function(e){var n=c(0),o=c(1),s=c(4),r=c.n(s),a=c(240),i=c(45),u=c(35),b=c(400),l=c(2);c(363),t.a=t=>{let{checkoutPageId:c,className:s}=t;const d=Object(l.getSetting)("page-"+c,!1),{isCalculating:m}=Object(u.b)(),[f,w]=Object(b.a)(),[p,v]=Object(n.useState)(!1);Object(n.useEffect)(()=>{if("function"!=typeof e.addEventListener||"function"!=typeof e.removeEventListener)return;const t=()=>{v(!1)};return e.addEventListener("pageshow",t),()=>{e.removeEventListener("pageshow",t)}},[]);const j=Object(n.createElement)(a.a,{className:"wc-block-cart__submit-button",href:d||i.d,disabled:m,onClick:()=>v(!0),showSpinner:p},Object(o.__)("Proceed to Checkout","woo-gutenberg-products-block"));return Object(n.createElement)("div",{className:r()("wc-block-cart__submit",s)},f,Object(n.createElement)("div",{className:"wc-block-cart__submit-container"},j),"below"===w&&Object(n.createElement)("div",{className:"wc-block-cart__submit-container wc-block-cart__submit-container--sticky"},j))}}).call(this,c(362))},362:function(e,t){var c;c=function(){return this}();try{c=c||new Function("return this")()}catch(e){"object"==typeof window&&(c=window)}e.exports=c},363:function(e,t){},400:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(0);const o={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1},s=()=>{const[e,t]=Object(n.useState)(""),c=Object(n.useRef)(null),s=Object(n.useRef)(new IntersectionObserver(e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")},{threshold:1}));return Object(n.useLayoutEffect)(()=>{const e=c.current,t=s.current;return e&&t.observe(e),()=>{t.unobserve(e)}},[]),[Object(n.createElement)("div",{"aria-hidden":!0,ref:c,style:o}),e]}},426:function(e,t,c){"use strict";c.r(t);var n=c(116),o=c(361);t.default=Object(n.withFilteredAttributes)({checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}}})(o.a)}}]);
|
build/cart-blocks/empty-cart-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{351:function(e,c){},396:function(e,c,t){"use strict";t.r(c);var n=t(0),o=t(29),s=t(68);t(351),c.default=e=>{let{children:c,className:t}=e;const{cartItems:l,cartIsLoading:r}=Object(o.a)();return Object(n.useEffect)(()=>{Object(s.a)("wc-blocks_render_blocks_frontend",{element:document.body.querySelector(".wp-block-woocommerce-cart")})},[]),r||0!==l.length?null:Object(n.createElement)("div",{className:t},c)}}}]);
|
build/cart-blocks/express-payment-frontend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{
|
2 |
/* translators: %s coupon code. */
|
3 |
Object(s.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{m({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),b("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&d(Object(s.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
-
Object(s.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),b("")})},isApplyingCoupon:i,isRemovingCoupon:l}},[n,d])}}},275:function(e,t){},276:function(e,t,n){"use strict";var s=n(17),c=n.n(s),o=n(0),r=n(1),a=n(3),i=(n(8),n(2)),l=n(96);class p extends a.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(r.__)("This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.StoreNoticesContainer,{notices:s})}return this.props.children}}p.defaultProps={isEditor:!1},t.a=p},299:function(e,t){},300:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(323),r=n(250),a=n(18),i=n(185),l=n(30),p=n.n(l),u=n(276);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(s.useRef)(l),v=Object(s.useRef)(d),j=Object(s.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),y=Object(s.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(s.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(s.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?O(e):n("")}),[n,O]),f=Object.entries(h),k=f.length>0?f.map(t=>{let[n,c]=t;const o=e?c.edit:c.content;return Object(s.isValidElement)(o)?Object(s.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(s.cloneElement)(o,{...b,onClick:j(n),onClose:y,onError:O,setExpressPaymentError:E})):null}):Object(s.createElement)("li",{key:"noneRegistered"},Object(c.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(s.createElement)(u.a,{isEditor:e},Object(s.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},k))}},318:function(e,t,n){"use strict";var s=n(0),c=n(14);const o=Object(s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(c.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=o},323:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var s=n(1),c=n(38),o=n(0),r=n(4),a=n.n(r),i=n(14),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(o.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(318),m=n(104),b=n(61),h=n(63);n(275);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const s=!!t,c=Object(o.useCallback)(e=>s&&Object(b.a)(e)&&Object(h.b)(g,e),[s]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":s});return Object(o.createElement)("span",{className:r},c(t)?Object(o.createElement)(m.a,{icon:g[t]}):t,n)},j=n(252),y=n(2),O=n(30),E=n.n(O),f=n(137),k=n(258),w=n(29),S=n(261),P=n(27),C=n(35),_=n(185),x=n(68),R=n(49);const M=(e,t)=>{const n=[],c=(t,n)=>{const s=n+"_tax",c=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:c,valueWithTax:c+(Object(h.b)(e,s)&&Object(b.a)(e[s])?parseInt(e[s],10):0)}};return n.push(c(Object(s.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(c(Object(s.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(c(Object(s.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(s.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(c(Object(s.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var I=n(66);const z=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(C.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(_.b)(),{shippingErrorStatus:z,shippingErrorTypes:N,onShippingRateSuccess:T,onShippingRateFail:A,onShippingRateSelectSuccess:V,onShippingRateSelectFail:B}=Object(x.b)(),{shippingRates:D,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingData:J,shippingAddress:U,setShippingAddress:Y}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(w.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.c)(),te=Object(o.useRef)(M(q,G)),ne=Object(o.useRef)({label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(o.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const se=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";E()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),g(e)}),[g]);return{activePaymentMethod:b,billing:{appliedCoupons:Z,billingData:J,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(c.getCurrencyFromPriceResponse)(q),customerId:d,displayPricesIncludingTax:Object(y.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:K,cartFees:X,extensions:Q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:f.a,PaymentMethodIcons:j.a,PaymentMethodLabel:v,ValidationInputError:k.a},emitResponse:{noticeContexts:$,responseTypes:ee},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:A,onShippingRateSelectFail:B,onShippingRateSelectSuccess:V,onShippingRateSuccess:T},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:Y,shippingAddress:U,shippingRates:D,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:N},shouldSavePayment:O}}},419:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(29),o=n(4),r=n.n(o),a=n(1),i=n(250),l=n(27),p=n(35),u=n(185),d=n(79),m=n(137),b=n(300);n(299);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.c)(),{isCalculating:c,isProcessing:o,isAfterProcessing:r,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:j}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const y=o||r||h||g&&!v;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(m.a,{isLoading:c||y||j.isDoingExpressPayment},Object(s.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(s.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(s.createElement)(d.a,{context:n.EXPRESS_PAYMENTS},Object(s.createElement)(b.a,null))))),Object(s.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},Object(a.__)("Or","woo-gutenberg-products-block")))};t.default=e=>{let{className:t}=e;const{cartNeedsPayment:n}=Object(c.a)();return n?Object(s.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(s.createElement)(h,null)):null}},96:function(e,t,n){}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[14],{102:function(e,t,n){"use strict";var s=n(0);t.a=function(e){let{icon:t,size:n=24,...c}=e;return Object(s.cloneElement)(t,{width:n,height:n,...c})}},237:function(e,t){},248:function(e,t){},250:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var s=n(28),c=n(183);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:o,expressPaymentMethodsInitialized:r}=Object(c.b)(),a=Object(s.a)(t),i=Object(s.a)(n);return{paymentMethods:e?i:a,isInitialized:e?r:o}},r=()=>o(!1),a=()=>o(!0)},253:function(e,t,n){"use strict";var s=n(10),c=n.n(s),o=n(0),r=n(4),a=n.n(r);const i=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var l=e=>{let{id:t,src:n=null,alt:s=""}=e;return n?Object(o.createElement)("img",{className:i(t),src:n,alt:s}):null},p=n(45);const u=[{id:"alipay",alt:"Alipay",src:p.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:p.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:p.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:p.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:p.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:p.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:p.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:p.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:p.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:p.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:p.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:p.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:p.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:p.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:p.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:p.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:p.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:p.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:p.l+"payment-methods/wechat.svg"}];var d=n(59);n(248),t.a=e=>{let{icons:t=[],align:n="center",className:s}=e;const r=(e=>{const t={};return e.forEach(e=>{let n={};"string"==typeof e&&(n={id:e,alt:e,src:null}),"object"==typeof e&&(n={id:e.id||"",alt:e.alt||"",src:e.src||null}),n.id&&Object(d.a)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===r.length)return null;const i=a()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===n,"wc-block-components-payment-method-icons--align-right":"right"===n},s);return Object(o.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(o.createElement)(l,c()({key:"payment-method-icon-"+e.id},t))}))}},258:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(0),c=n(175);n(237);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:r,getValidationErrorId:a}=Object(c.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:a(o)},t))}},261:function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var s=n(1),c=n(8),o=n(5),r=n(19),a=n(29),i=n(0),l=n(226),p=n(175),u=n(39);const d=()=>{const{cartCoupons:e,cartIsLoading:t}=Object(a.a)(),{addErrorNotice:n}=Object(u.a)(),{addSnackbarNotice:d}=(()=>{const{notices:e,createSnackbarNotice:t,removeSnackbarNotice:n,setIsSuppressed:s}=Object(l.b)(),c=Object(i.useRef)(e);Object(i.useEffect)(()=>{c.current=e},[e]);const o=Object(i.useMemo)(()=>({removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;c.current.forEach(t=>{null!==e&&t.status!==e||n(t.id)})},removeSnackbarNotice:n}),[n]),r=Object(i.useMemo)(()=>({addSnackbarNotice:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(e,n)}}),[t]);return{notices:e,...o,...r,setIsSuppressed:s}})(),{setValidationErrors:m}=Object(p.b)();return{appliedCoupons:e,isLoading:t,...Object(c.useSelect)((e,t)=>{let{dispatch:c}=t;const a=e(o.CART_STORE_KEY),i=a.isApplyingCoupon(),l=a.isRemovingCoupon(),{applyCoupon:p,removeCoupon:u,receiveApplyingCoupon:b}=c(o.CART_STORE_KEY);return{applyCoupon:e=>{p(e).then(t=>{!0===t&&d(Object(s.sprintf)(
|
2 |
/* translators: %s coupon code. */
|
3 |
Object(s.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{m({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),b("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&d(Object(s.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
+
Object(s.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),b("")})},isApplyingCoupon:i,isRemovingCoupon:l}},[n,d])}}},275:function(e,t){},276:function(e,t,n){"use strict";var s=n(17),c=n.n(s),o=n(0),r=n(1),a=n(3),i=n(2),l=n(94);class p extends a.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(r.__)("This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.StoreNoticesContainer,{notices:s})}return this.props.children}}p.defaultProps={isEditor:!1},t.a=p},297:function(e,t){},298:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(327),r=n(250),a=n(18),i=n(183),l=n(30),p=n.n(l),u=n(276);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(s.useRef)(l),v=Object(s.useRef)(d),j=Object(s.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),y=Object(s.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(s.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(s.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?O(e):n("")}),[n,O]),f=Object.entries(h),k=f.length>0?f.map(t=>{let[n,c]=t;const o=e?c.edit:c.content;return Object(s.isValidElement)(o)?Object(s.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(s.cloneElement)(o,{...b,onClick:j(n),onClose:y,onError:O,setExpressPaymentError:E})):null}):Object(s.createElement)("li",{key:"noneRegistered"},Object(c.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(s.createElement)(u.a,{isEditor:e},Object(s.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},k))}},322:function(e,t,n){"use strict";var s=n(0),c=n(14);const o=Object(s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(c.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=o},327:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var s=n(1),c=n(38),o=n(0),r=n(4),a=n.n(r),i=n(14),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(o.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(322),m=n(102),b=n(59),h=n(61);n(275);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const s=!!t,c=Object(o.useCallback)(e=>s&&Object(b.a)(e)&&Object(h.b)(g,e),[s]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":s});return Object(o.createElement)("span",{className:r},c(t)?Object(o.createElement)(m.a,{icon:g[t]}):t,n)},j=n(253),y=n(2),O=n(30),E=n.n(O),f=n(135),k=n(258),w=n(29),S=n(261),P=n(27),C=n(35),_=n(183),x=n(66),R=n(47);const M=(e,t)=>{const n=[],c=(t,n)=>{const s=n+"_tax",c=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:c,valueWithTax:c+(Object(h.b)(e,s)&&Object(b.a)(e[s])?parseInt(e[s],10):0)}};return n.push(c(Object(s.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(c(Object(s.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(c(Object(s.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(s.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(c(Object(s.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var I=n(64);const z=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(C.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(_.b)(),{shippingErrorStatus:z,shippingErrorTypes:N,onShippingRateSuccess:T,onShippingRateFail:A,onShippingRateSelectSuccess:V,onShippingRateSelectFail:B}=Object(x.b)(),{shippingRates:D,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingData:J,shippingAddress:U,setShippingAddress:Y}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(w.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.c)(),te=Object(o.useRef)(M(q,G)),ne=Object(o.useRef)({label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(o.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const se=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";E()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),g(e)}),[g]);return{activePaymentMethod:b,billing:{appliedCoupons:Z,billingData:J,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(c.getCurrencyFromPriceResponse)(q),customerId:d,displayPricesIncludingTax:Object(y.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:K,cartFees:X,extensions:Q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:f.a,PaymentMethodIcons:j.a,PaymentMethodLabel:v,ValidationInputError:k.a},emitResponse:{noticeContexts:$,responseTypes:ee},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:A,onShippingRateSelectFail:B,onShippingRateSelectSuccess:V,onShippingRateSuccess:T},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:Y,shippingAddress:U,shippingRates:D,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:N},shouldSavePayment:O}}},425:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(29),o=n(4),r=n.n(o),a=n(1),i=n(250),l=n(27),p=n(35),u=n(183),d=n(77),m=n(135),b=n(298);n(297);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.c)(),{isCalculating:c,isProcessing:o,isAfterProcessing:r,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:j}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const y=o||r||h||g&&!v;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(m.a,{isLoading:c||y||j.isDoingExpressPayment},Object(s.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(s.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(s.createElement)(d.a,{context:n.EXPRESS_PAYMENTS},Object(s.createElement)(b.a,null))))),Object(s.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},Object(a.__)("Or","woo-gutenberg-products-block")))};t.default=e=>{let{className:t}=e;const{cartNeedsPayment:n}=Object(c.a)();return n?Object(s.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(s.createElement)(h,null)):null}},94:function(e,t,n){}}]);
|
build/cart-blocks/filled-cart-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{180:function(e,t){},227:function(e,t,s){"use strict";s.d(t,"b",(function(){return l})),s.d(t,"a",(function(){return o}));var a=s(0),c=s(13),i=s(4),r=s.n(i);const n=Object(a.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),l=()=>Object(a.useContext)(n),o=e=>{let{children:t,className:s=""}=e;const[i,l]=(()=>{const[e,{width:t}]=Object(c.useResizeObserver)();let s="";return t>700?s="is-large":t>520?s="is-medium":t>400?s="is-small":t&&(s="is-mobile"),[e,s]})(),o={hasContainerWidth:""!==l,containerClassName:l,isMobile:"is-mobile"===l,isSmall:"is-small"===l,isMedium:"is-medium"===l,isLarge:"is-large"===l};return Object(a.createElement)(n.Provider,{value:o},Object(a.createElement)("div",{className:r()(s,l)},i,t))}},230:function(e,t,s){"use strict";var a=s(0),c=s(4),i=s.n(c),r=s(227);s(180),t.a=e=>{let{children:t,className:s}=e;return Object(a.createElement)(r.a,{className:i()("wc-block-components-sidebar-layout",s)},t)}},395:function(e,t,s){"use strict";s.r(t);var a=s(0),c=s(4),i=s.n(c),r=s(230),n=s(29),l=s(39),o=s(19),m=s(142);t.default=e=>{let{children:t,className:s}=e;const{cartItems:c,cartIsLoading:u,cartItemErrors:d}=Object(n.a)(),{hasDarkControls:b}=Object(m.b)(),{addErrorNotice:h}=Object(l.a)();return Object(a.useEffect)(()=>{d.forEach(e=>{h(Object(o.decodeEntities)(e.message),{isDismissible:!0,id:e.code})})},[h,d]),u||c.length>=1?Object(a.createElement)(r.a,{className:i()("wc-block-cart",s,{"has-dark-controls":b})},t):null}}}]);
|
build/cart-blocks/items-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{352:function(e,c,a){"use strict";var n=a(0),t=a(3),s=a(4),r=a.n(s);const l=Object(t.forwardRef)((e,c)=>{let{children:a,className:t=""}=e;return Object(n.createElement)("div",{ref:c,className:r()("wc-block-components-main",t)},a)});c.a=l},397:function(e,c,a){"use strict";a.r(c);var n=a(0),t=a(352),s=a(4),r=a.n(s);c.default=e=>{let{children:c,className:a}=e;return Object(n.createElement)(t.a,{className:r()("wc-block-cart__main",a)},c)}}}]);
|
build/cart-blocks/line-items-frontend.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
-
Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(c))),Object(a.createElement)("span",{"aria-hidden":!0},Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:l,style:u})," — ",Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("del",{className:o()("wc-block-components-product-price__regular",c),style:l},e),value:i}),Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};t.a=e=>{let{align:t,className:c,currency:r,format:l="<price/>",maxPrice:i,minPrice:m,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}=e;const y=o()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const f=O&&b!==O;let g=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return f?g=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?g=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(g=Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",p),currency:r,value:b,style:d})),Object(a.createElement)("span",{className:y},Object(a.createInterpolateElement)(l,{price:g}))}},255:function(e,t){},256:function(e,t,c){"use strict";var a=c(10),r=c.n(a),n=c(0),l=c(19),o=c(4),i=c.n(o);c(257),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",rel:s,style:u,onClick:m,...b}=e;const p=i()("wc-block-components-product-name",t);if(c){const e=b;return Object(n.createElement)("span",r()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:p,href:o,rel:s},b,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:u}))}},257:function(e,t){},262:function(e,t,c){"use strict";var a=c(0),r=c(
|
4 |
/* translators: %d stock amount (number of items in stock for product) */
|
5 |
-
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),t)):null}},
|
6 |
/* translators: %s refers to the item name in the cart. */
|
7 |
Object(l.__)("Quantity of %s in your cart.","woo-gutenberg-products-block"),p)}),Object(a.createElement)("button",{"aria-label":Object(l.__)("Reduce quantity","woo-gutenberg-products-block"),className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus",disabled:d||!_,onClick:()=>{const e=c-b;m(e),Object(o.speak)(Object(l.sprintf)(
|
8 |
/* translators: %s refers to the item name in the cart. */
|
9 |
Object(l.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),f(e)}},"-"),Object(a.createElement)("button",{"aria-label":Object(l.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(o.speak)(Object(l.sprintf)(
|
10 |
/* translators: %s refers to the item name in the cart. */
|
11 |
-
Object(l.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),f(e)}},"+"))},m=c(254),b=c(256),p=c(
|
12 |
/* translators: %s will be replaced by the discount amount */
|
13 |
-
Object(l.__)("Save %s","woo-gutenberg-products-block"),r);return Object(a.createElement)(x.a,{className:"wc-block-components-sale-badge"},Object(a.createInterpolateElement)(n,{price:Object(a.createElement)(C.a,{currency:t,value:c})}))},P=c(
|
14 |
/* translators: %s refers to the item name in the cart. */
|
15 |
-
Object(l.__)("%s has been removed from your cart.","woo-gutenberg-products-block"),re))},disabled:X},Object(l.__)("Remove item","woo-gutenberg-products-block"))))),Object(a.createElement)("td",{className:"wc-block-cart-item__total"},Object(a.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},Object(a.createElement)(m.a,{currency:se,format:Oe,price:me.getAmount()}),Y>1&&Object(a.createElement)(I,{currency:ae,saleAmount:R(ie,ae),format:_e}))))});const L=[...Array(3)].map((_x,e)=>Object(a.createElement)(F,{lineItem:{},key:e})),M=e=>{const t={};return e.forEach(e=>{let{key:c}=e;t[c]=Object(a.createRef)()}),t};t.a=e=>{let{lineItems:t=[],isLoading:c=!1,className:r}=e;const o=Object(a.useRef)(null),i=Object(a.useRef)(M(t));Object(a.useEffect)(()=>{i.current=M(t)},[t]);const s=e=>()=>{null!=i&&i.current&&e&&i.current[e].current instanceof HTMLElement?i.current[e].current.focus():o.current instanceof HTMLElement&&o.current.focus()},u=c?L:t.map((e,c)=>{const r=t.length>c+1?t[c+1].key:null;return Object(a.createElement)(F,{key:e.key,lineItem:e,onRemove:s(r),ref:i.current[e.key],tabIndex:-1})});return Object(a.createElement)("table",{className:n()("wc-block-cart-items",r),ref:o,tabIndex:-1},Object(a.createElement)("thead",null,Object(a.createElement)("tr",{className:"wc-block-cart-items__header"},Object(a.createElement)("th",{className:"wc-block-cart-items__header-image"},Object(a.createElement)("span",null,Object(l.__)("Product","woo-gutenberg-products-block"))),Object(a.createElement)("th",{className:"wc-block-cart-items__header-product"},Object(a.createElement)("span",null,Object(l.__)("Details","woo-gutenberg-products-block"))),Object(a.createElement)("th",{className:"wc-block-cart-items__header-total"},Object(a.createElement)("span",null,Object(l.__)("Total","woo-gutenberg-products-block"))))),Object(a.createElement)("tbody",null,u))}},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[17],{173:function(e,t){},245:function(e,t,c){"use strict";var a=c(0),r=c(4),n=c.n(r);c(267),t.a=e=>{let{children:t,className:c}=e;return Object(a.createElement)("div",{className:n()("wc-block-components-product-badge",c)},t)}},254:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(99),l=c(4),o=c.n(l),i=c(38);c(255);const s=e=>{let{currency:t,maxPrice:c,minPrice:l,priceClassName:s,priceStyle:u={}}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.sprintf)(
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
+
Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(c))),Object(a.createElement)("span",{"aria-hidden":!0},Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:l,style:u})," — ",Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("del",{className:o()("wc-block-components-product-price__regular",c),style:l},e),value:i}),Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};t.a=e=>{let{align:t,className:c,currency:r,format:l="<price/>",maxPrice:i,minPrice:m,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}=e;const y=o()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const f=O&&b!==O;let g=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return f?g=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?g=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(g=Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",p),currency:r,value:b,style:d})),Object(a.createElement)("span",{className:y},Object(a.createInterpolateElement)(l,{price:g}))}},255:function(e,t){},256:function(e,t,c){"use strict";var a=c(10),r=c.n(a),n=c(0),l=c(19),o=c(4),i=c.n(o);c(257),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",rel:s,style:u,onClick:m,...b}=e;const p=i()("wc-block-components-product-name",t);if(c){const e=b;return Object(n.createElement)("span",r()({className:p},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:p,href:o,rel:s},b,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:u}))}},257:function(e,t){},262:function(e,t,c){"use strict";var a=c(0),r=c(113),n=c(114);const l=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},o=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),i=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,s=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…";const a=o(e),r=a.split(" ").splice(0,t).join(" ");return Object(n.autop)(i(r,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";const r=o(e),l=r.slice(0,t);if(c)return Object(n.autop)(i(l,a));const s=l.match(/([\s]+)/g),u=s?s.length:0,m=r.slice(0,t+u);return Object(n.autop)(i(m,a))};t.a=e=>{let{source:t,maxLength:c=15,countType:o="words",className:i="",style:m={}}=e;const b=Object(a.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const a=Object(n.autop)(e),o=Object(r.count)(a,c);if(o<=t)return a;const i=l(a),m=Object(r.count)(i,c);return m<=t?i:"words"===c?s(i,t):u(i,t,"characters_including_spaces"===c)}(t,c,o),[t,c,o]);return Object(a.createElement)(a.RawHTML,{style:m,className:i},b)}},266:function(e,t){},267:function(e,t){},268:function(e,t){},269:function(e,t){},289:function(e,t,c){"use strict";var a=c(10),r=c.n(a),n=c(0),l=c(19),o=c(2);c(266),t.a=e=>{let{image:t={},fallbackAlt:c=""}=e;const a=t.thumbnail?{src:t.thumbnail,alt:Object(l.decodeEntities)(t.alt)||c||"Product Image"}:{src:o.PLACEHOLDER_IMG_SRC,alt:""};return Object(n.createElement)("img",r()({className:"wc-block-components-product-image"},a,{alt:a.alt}))}},290:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(245);t.a=()=>Object(a.createElement)(n.a,{className:"wc-block-components-product-backorder-badge"},Object(r.__)("Available on backorder","woo-gutenberg-products-block"))},291:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(245);t.a=e=>{let{lowStockRemaining:t}=e;return t?Object(a.createElement)(n.a,{className:"wc-block-components-product-low-stock-badge"},Object(r.sprintf)(
|
4 |
/* translators: %d stock amount (number of items in stock for product) */
|
5 |
+
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),t)):null}},292:function(e,t){},299:function(e,t,c){"use strict";var a=c(0),r=c(4),n=c.n(r),l=c(1),o=c(20),i=c(138),s=c(48);c(292);var u=e=>{let{className:t,quantity:c=1,minimum:r=1,maximum:u,onChange:m=(()=>{}),step:b=1,itemName:p="",disabled:d}=e;const O=n()("wc-block-components-quantity-selector",t),j=void 0!==u,_=c-b>=r,y=!j||c+b<=u,f=Object(a.useCallback)(e=>{let t=e;j&&(t=Math.min(t,Math.floor(u/b)*b)),t=Math.max(t,Math.ceil(r/b)*b),t=Math.floor(t/b)*b,t!==e&&m(t)},[j,u,r,m,b]),g=Object(s.a)(f,300);Object(a.useLayoutEffect)(()=>{f(c)},[c,f]);const k=Object(a.useCallback)(e=>{const t=void 0!==typeof e.key?"ArrowDown"===e.key:e.keyCode===i.DOWN,a=void 0!==typeof e.key?"ArrowUp"===e.key:e.keyCode===i.UP;t&&_&&(e.preventDefault(),m(c-b)),a&&y&&(e.preventDefault(),m(c+b))},[c,m,y,_,b]);return Object(a.createElement)("div",{className:O},Object(a.createElement)("input",{className:"wc-block-components-quantity-selector__input",disabled:d,type:"number",step:b,min:r,max:u,value:c,onKeyDown:k,onChange:e=>{let t=parseInt(e.target.value,10);t=isNaN(t)?c:t,t!==c&&(m(t),g(t))},"aria-label":Object(l.sprintf)(
|
6 |
/* translators: %s refers to the item name in the cart. */
|
7 |
Object(l.__)("Quantity of %s in your cart.","woo-gutenberg-products-block"),p)}),Object(a.createElement)("button",{"aria-label":Object(l.__)("Reduce quantity","woo-gutenberg-products-block"),className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus",disabled:d||!_,onClick:()=>{const e=c-b;m(e),Object(o.speak)(Object(l.sprintf)(
|
8 |
/* translators: %s refers to the item name in the cart. */
|
9 |
Object(l.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),f(e)}},"-"),Object(a.createElement)("button",{"aria-label":Object(l.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(o.speak)(Object(l.sprintf)(
|
10 |
/* translators: %s refers to the item name in the cart. */
|
11 |
+
Object(l.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),f(e)}},"+"))},m=c(254),b=c(256),p=c(8),d=c(5),O=c(97),j=c(57),_=c(68),y=c(61),f=c(59),g=c(69),k=c(29),E=c(35);var w=c(31),v=c(289),N=c(290),h=c(291),C=c(99),x=c(245),I=e=>{let{currency:t,saleAmount:c,format:r="<price/>"}=e;if(!c||c<=0)return null;r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const n=Object(l.sprintf)(
|
12 |
/* translators: %s will be replaced by the discount amount */
|
13 |
+
Object(l.__)("Save %s","woo-gutenberg-products-block"),r);return Object(a.createElement)(x.a,{className:"wc-block-components-sale-badge"},Object(a.createInterpolateElement)(n,{price:Object(a.createElement)(C.a,{currency:t,value:c})}))},P=c(300),S=c(38),q=c(12),D=c(288),A=c(2);const R=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),T=e=>Object(q.mustContain)(e,"<price/>");var F=Object(a.forwardRef)((e,t)=>{let{lineItem:c,onRemove:r=(()=>{}),tabIndex:i=null}=e;const{name:s="",catalog_visibility:C="visible",short_description:x="",description:F="",low_stock_remaining:L=null,show_backorder_badge:M=!1,quantity_limits:U={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:Q=!1,permalink:V="",images:$=[],variation:H=[],item_data:B=[],prices:K={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:W={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:J}=c,{quantity:Y,setItemQuantity:z,removeItem:G,isPendingDelete:X}=(e=>{const t={key:"",quantity:1};(e=>Object(y.a)(e)&&Object(y.b)(e,"key")&&Object(y.b)(e,"quantity")&&Object(f.a)(e.key)&&Object(g.a)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:c="",quantity:r=1}=t,{cartErrors:n}=Object(k.a)(),{dispatchActions:l}=Object(E.b)(),[o,i]=Object(a.useState)(r),[s]=Object(O.a)(o,400),u=Object(j.a)(s),{removeItemFromCart:m,changeCartItemQuantity:b}=Object(p.useDispatch)(d.CART_STORE_KEY);Object(a.useEffect)(()=>i(r),[r]);const w=Object(p.useSelect)(e=>{if(!c)return{quantity:!1,delete:!1};const t=e(d.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(c),delete:t.isItemPendingDelete(c)}},[c]),v=Object(a.useCallback)(()=>c?m(c).then(()=>(Object(_.d)(),!0)):Promise.resolve(!1),[c,m]);return Object(a.useEffect)(()=>{c&&Object(g.a)(u)&&Number.isFinite(u)&&u!==s&&b(c,s)},[c,b,s,u]),Object(a.useEffect)(()=>(w.delete?l.incrementCalculating():l.decrementCalculating(),()=>{w.delete&&l.decrementCalculating()}),[l,w.delete]),Object(a.useEffect)(()=>(w.quantity||s!==o?l.incrementCalculating():l.decrementCalculating(),()=>{(w.quantity||s!==o)&&l.decrementCalculating()}),[l,w.quantity,s,o]),{isPendingDelete:w.delete,quantity:o,setItemQuantity:i,removeItem:v,cartItemQuantityErrors:n}})(c),{dispatchStoreEvent:Z}=Object(w.a)(),{receiveCart:ee,...te}=Object(k.a)(),ce=Object(a.useMemo)(()=>({context:"cart",cartItem:c,cart:te}),[c,te]),ae=Object(S.getCurrencyFromPriceResponse)(K),re=Object(q.__experimentalApplyCheckoutFilter)({filterName:"itemName",defaultValue:s,extensions:J,arg:ce}),ne=Object(D.a)({amount:parseInt(K.raw_prices.regular_price,10),precision:K.raw_prices.precision}),le=Object(D.a)({amount:parseInt(K.raw_prices.price,10),precision:K.raw_prices.precision}),oe=ne.subtract(le),ie=oe.multiply(Y),se=Object(S.getCurrencyFromPriceResponse)(W);let ue=parseInt(W.line_subtotal,10);Object(A.getSetting)("displayCartPricesIncludingTax",!1)&&(ue+=parseInt(W.line_subtotal_tax,10));const me=Object(D.a)({amount:ue,precision:se.minorUnit}),be=$.length?$[0]:{},pe="hidden"===C||"search"===C,de=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:J,arg:ce}),Oe=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),je=Object(q.__experimentalApplyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),_e=Object(q.__experimentalApplyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T});return Object(a.createElement)("tr",{className:n()("wc-block-cart-items__row",de,{"is-disabled":X}),ref:t,tabIndex:i},Object(a.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Object(y.b)(be,"alt")||!be.alt},pe?Object(a.createElement)(v.a,{image:be,fallbackAlt:re}):Object(a.createElement)("a",{href:V,tabIndex:-1},Object(a.createElement)(v.a,{image:be,fallbackAlt:re}))),Object(a.createElement)("td",{className:"wc-block-cart-item__product"},Object(a.createElement)("div",{className:"wc-block-cart-item__wrap"},Object(a.createElement)(b.a,{disabled:X||pe,name:re,permalink:V}),M?Object(a.createElement)(N.a,null):!!L&&Object(a.createElement)(h.a,{lowStockRemaining:L}),Object(a.createElement)("div",{className:"wc-block-cart-item__prices"},Object(a.createElement)(m.a,{currency:ae,regularPrice:R(ne,ae),price:R(le,ae),format:je})),Object(a.createElement)(I,{currency:ae,saleAmount:R(oe,ae),format:_e}),Object(a.createElement)(P.a,{shortDescription:x,fullDescription:F,itemData:B,variation:H}),Object(a.createElement)("div",{className:"wc-block-cart-item__quantity"},!Q&&!!U.editable&&Object(a.createElement)(u,{disabled:X,quantity:Y,minimum:U.minimum,maximum:U.maximum,step:U.multiple_of,onChange:e=>{z(e),Z("cart-set-item-quantity",{product:c,quantity:e})},itemName:re}),Object(a.createElement)("button",{className:"wc-block-cart-item__remove-link",onClick:()=>{r(),G(),Z("cart-remove-item",{product:c,quantity:Y}),Object(o.speak)(Object(l.sprintf)(
|
14 |
/* translators: %s refers to the item name in the cart. */
|
15 |
+
Object(l.__)("%s has been removed from your cart.","woo-gutenberg-products-block"),re))},disabled:X},Object(l.__)("Remove item","woo-gutenberg-products-block"))))),Object(a.createElement)("td",{className:"wc-block-cart-item__total"},Object(a.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},Object(a.createElement)(m.a,{currency:se,format:Oe,price:me.getAmount()}),Y>1&&Object(a.createElement)(I,{currency:ae,saleAmount:R(ie,ae),format:_e}))))});const L=[...Array(3)].map((_x,e)=>Object(a.createElement)(F,{lineItem:{},key:e})),M=e=>{const t={};return e.forEach(e=>{let{key:c}=e;t[c]=Object(a.createRef)()}),t};t.a=e=>{let{lineItems:t=[],isLoading:c=!1,className:r}=e;const o=Object(a.useRef)(null),i=Object(a.useRef)(M(t));Object(a.useEffect)(()=>{i.current=M(t)},[t]);const s=e=>()=>{null!=i&&i.current&&e&&i.current[e].current instanceof HTMLElement?i.current[e].current.focus():o.current instanceof HTMLElement&&o.current.focus()},u=c?L:t.map((e,c)=>{const r=t.length>c+1?t[c+1].key:null;return Object(a.createElement)(F,{key:e.key,lineItem:e,onRemove:s(r),ref:i.current[e.key],tabIndex:-1})});return Object(a.createElement)("table",{className:n()("wc-block-cart-items",r),ref:o,tabIndex:-1},Object(a.createElement)("thead",null,Object(a.createElement)("tr",{className:"wc-block-cart-items__header"},Object(a.createElement)("th",{className:"wc-block-cart-items__header-image"},Object(a.createElement)("span",null,Object(l.__)("Product","woo-gutenberg-products-block"))),Object(a.createElement)("th",{className:"wc-block-cart-items__header-product"},Object(a.createElement)("span",null,Object(l.__)("Details","woo-gutenberg-products-block"))),Object(a.createElement)("th",{className:"wc-block-cart-items__header-total"},Object(a.createElement)("span",null,Object(l.__)("Total","woo-gutenberg-products-block"))))),Object(a.createElement)("tbody",null,u))}},300:function(e,t,c){"use strict";var a=c(0),r=c(6),n=c(19);c(269);var l=e=>{let{details:t=[]}=e;return Array.isArray(t)?(t=t.filter(e=>!e.hidden),0===t.length?null:Object(a.createElement)("ul",{className:"wc-block-components-product-details"},t.map(e=>{const t=(null==e?void 0:e.key)||e.name||"",c=t?"wc-block-components-product-details__"+Object(r.kebabCase)(t):"";return Object(a.createElement)("li",{key:t+(e.display||e.value),className:c},t&&Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"wc-block-components-product-details__name"},Object(n.decodeEntities)(t),":")," "),Object(a.createElement)("span",{className:"wc-block-components-product-details__value"},Object(n.decodeEntities)(e.display||e.value)))}))):null},o=c(262),i=c(45),s=e=>{let{className:t,shortDescription:c="",fullDescription:r=""}=e;const n=c||r;return n?Object(a.createElement)(o.a,{className:t,source:n,maxLength:15,countType:i.n.wordCountType||"words"}):null};c(268),t.a=e=>{let{shortDescription:t="",fullDescription:c="",itemData:r=[],variation:n=[]}=e;return Object(a.createElement)("div",{className:"wc-block-components-product-metadata"},Object(a.createElement)(s,{className:"wc-block-components-product-metadata__description",shortDescription:t,fullDescription:c}),Object(a.createElement)(l,{details:r}),Object(a.createElement)(l,{details:n.map(e=>{let{attribute:t="",value:c}=e;return{key:t,value:c}})}))}},398:function(e,t,c){"use strict";c.r(t);var a=c(0),r=c(29),n=c(299);t.default=e=>{let{className:t}=e;const{cartItems:c,cartIsLoading:l}=Object(r.a)();return Object(a.createElement)(n.a,{className:t,lineItems:c,isLoading:l})}},97:function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var a=c(3),r=c(48);function n(e,t){return e===t}function l(e){return"function"==typeof e?function(){return e}:e}function o(e,t,c){var o=c&&c.equalityFn||n,i=function(e){var t=Object(a.useState)(l(e)),c=t[0],r=t[1];return[c,Object(a.useCallback)((function(e){return r(l(e))}),[])]}(e),s=i[0],u=i[1],m=Object(r.a)(Object(a.useCallback)((function(e){return u(e)}),[u]),t,c),b=Object(a.useRef)(e);return o(b.current,e)||(m(e),b.current=e),[s,m]}},99:function(e,t,c){"use strict";var a=c(10),r=c.n(a),n=c(0),l=c(136),o=c(4),i=c.n(o);c(173);const s=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:a,onValueChange:o,displayType:u="text",...m}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**a.minorUnit;if(!Number.isFinite(p))return null;const d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...m,...s(a),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const t=+e.value*10**a.minorUnit;o(t)}:()=>{};return Object(n.createElement)(l.a,r()({className:d,displayType:u},O,{value:p,onValueChange:j}))}}}]);
|
build/cart-blocks/order-summary-frontend.js
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
-
Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:c,onClick:r,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||r()}},h=b?j:{},E=b?{"aria-hidden":!0}:j;return Object(o.createElement)(u,a()({},g,h,{className:s()(n,"is-removable"),element:b?"button":g.element,screenReaderText:m,text:d}),Object(o.createElement)(O,a()({className:"wc-block-components-chip__remove"},E),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:p.a,size:16})))}},22:function(e,t,n){"use strict";var c=n(0),a=n(4),o=n.n(a);t.a=e=>{let t,{label:n,screenReaderLabel:a,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=n,i=null!=a;return!l&&i?(t=r||"span",s={...s,className:o()(s.className,"screen-reader-text")},Object(c.createElement)(t,s,a)):(t=r||c.Fragment,l&&i&&n!==a?Object(c.createElement)(t,s,Object(c.createElement)("span",{"aria-hidden":"true"},n),Object(c.createElement)("span",{className:"screen-reader-text"},a)):Object(c.createElement)(t,s,n))}},236:function(e,t,n){"use strict";var c=n(0),a=n(4),o=n.n(a),r=n(238);t.a=e=>{let{checked:t,name:n,onChange:a,option:s}=e;const{value:l,label:i,description:p,secondaryLabel:u,secondaryDescription:b}=s;return Object(c.createElement)("label",{className:o()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${n}-${l}`},Object(c.createElement)("input",{id:`${n}-${l}`,className:"wc-block-components-radio-control__input",type:"radio",name:n,value:l,onChange:e=>a(e.target.value),checked:t,"aria-describedby":o()({[`${n}-${l}__label`]:i,[`${n}-${l}__secondary-label`]:u,[`${n}-${l}__description`]:p,[`${n}-${l}__secondary-description`]:b})}),Object(c.createElement)(r.a,{id:`${n}-${l}`,label:i,secondaryLabel:u,description:p,secondaryDescription:b}))}},237:function(e,t){},238:function(e,t,n){"use strict";var c=n(0);t.a=e=>{let{label:t,secondaryLabel:n,description:a,secondaryDescription:o,id:r}=e;return Object(c.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},Object(c.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&Object(c.createElement)("span",{id:r&&r+"__label",className:"wc-block-components-radio-control__label"},t),n&&Object(c.createElement)("span",{id:r&&r+"__secondary-label",className:"wc-block-components-radio-control__secondary-label"},n)),Object(c.createElement)("div",{className:"wc-block-components-radio-control__description-group"},a&&Object(c.createElement)("span",{id:r&&r+"__description",className:"wc-block-components-radio-control__description"},a),o&&Object(c.createElement)("span",{id:r&&r+"__secondary-description",className:"wc-block-components-radio-control__secondary-description"},o)))}},240:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(
|
6 |
/* translators: %s coupon code. */
|
7 |
Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{d({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),m("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&b(Object(c.sprintf)(
|
8 |
/* translators: %s coupon code. */
|
9 |
-
Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),m("")})},isApplyingCoupon:l,isRemovingCoupon:i}},[n,b])}}},270:function(e,t){},271:function(e,t){},272:function(e,t){},273:function(e,t){},274:function(e,t){},282:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(20),r=n(
|
10 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
11 |
Object(a._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),h=Object(c.createElement)(k,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:r});return i?Object(c.createElement)(s.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:j},h):Object(c.createElement)("div",{className:b()("wc-block-components-shipping-rates-control__package",n)},j,h)};const w=e=>{let{packages:t,collapse:n,showItems:a,collapsible:o,noResultsMessage:r,renderOption:s}=e;return t.length?Object(c.createElement)(c.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(c.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:a,noResultsMessage:r,renderOption:s})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:b=!1,noResultsMessage:d,renderOption:m,context:g}=e;Object(c.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),c=Object(l.b)(t);1===e?Object(o.speak)(Object(a.sprintf)(
|
12 |
/* translators: %d number of shipping options found. */
|
@@ -14,10 +14,10 @@ Object(a._n)("%d shipping option was found.","%d shipping options were found.",c
|
|
14 |
/* translators: %d number of shipping packages packages. */
|
15 |
Object(a._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(a.sprintf)(
|
16 |
/* translators: %d number of shipping options available. */
|
17 |
-
Object(a._n)("%d shipping option was found","%d shipping options were found",c,"woo-gutenberg-products-block"),c))},[n,t]);const{extensions:O,receiveCart:j,...h}=Object(i.a)(),E={className:u,collapsible:b,noResultsMessage:d,renderOption:m,extensions:O,cart:h,components:{ShippingRatesControlPackage:v},context:g},{isEditor:f}=Object(p.a)();return Object(c.createElement)(r.a,{isLoading:n,screenReaderLabel:Object(a.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},f?Object(c.createElement)(w,{packages:t,noResultsMessage:d,renderOption:m}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ExperimentalOrderShippingPackages.Slot,E),Object(c.createElement)(s.ExperimentalOrderShippingPackages,null,Object(c.createElement)(w,{packages:t,noResultsMessage:d,renderOption:m}))))}},295:function(e,t){},296:function(e,t){},297:function(e,t){},298:function(e,t){},303:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(1),s=n(3),l=n(4),i=n.n(l),p=n(177),u=n(258),b=n(13),d=n(61),m=n(22);n(244);var g=Object(s.forwardRef)((e,t)=>{let{className:n,id:c,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:b,help:d,autoCapitalize:g="off",autoComplete:O="off",value:j="",onChange:h,required:E=!1,onBlur:f=(()=>{}),feedback:_,...k}=e;const[v,w]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||j})},Object(o.createElement)("input",a()({type:r,id:c,value:j,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{h(e.target.value)},onFocus:()=>w(!0),onBlur:e=>{f(e.target.value),w(!1)},"aria-label":s||p,disabled:b,"aria-describedby":d&&!l?c+"__help":l,required:E},k)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:c},htmlFor:c}),!!d&&Object(o.createElement)("p",{id:c+"__help",className:"wc-block-components-text-input__help"},d),_)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:c,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:O,showError:j=!0,errorMessage:h="",value:E="",...f}=e;const[_,k]=Object(s.useState)(!0),v=Object(s.useRef)(null),{getValidationError:w,hideValidationError:y,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),x=void 0!==c?c:"textinput-"+n,R=void 0!==b?b:x,I=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=v.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(R):C({[R]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,R,C]);Object(s.useEffect)(()=>{var e;_&&m&&(null===(e=v.current)||void 0===e||e.focus()),k(!1)},[m,_,k]),Object(s.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&I(!0)},[E,I]),Object(s.useEffect)(()=>()=>{N(R)},[N,R]);const L=w(R)||{};Object(d.a)(h)&&""!==h&&(L.message=h);const M=L.message&&!L.hidden,T=j&&M&&S(R)?S(R):l;return Object(o.createElement)(g,a()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:x,onBlur:()=>{I(!1)},feedback:j&&Object(o.createElement)(u.a,{errorMessage:h,propertyName:R}),ref:v,onChange:e=>{y(R),O(e)},ariaDescribedBy:T,value:E},f))})},317:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));const c=e=>e.length,a=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},322:function(e,t,n){"use strict";var c=n(0),a=n(303),o=n(10),r=n.n(o),s=n(47),l=n(1),i=n(19),p=n(4),u=n.n(p),b=n(13),d=n(407),m=n(177),g=n(258),O=n(63);n(272);var j=Object(b.withInstanceId)(e=>{let{id:t,className:n,label:a,onChange:o,options:r,value:s,required:i=!1,errorMessage:p=Object(l.__)("Please select a value.","woo-gutenberg-products-block"),errorId:b,instanceId:j="0",autoComplete:h="off"}=e;const{getValidationError:E,setValidationErrors:f,clearValidationError:_}=Object(m.b)(),k=Object(c.useRef)(null),v=t||"control-"+j,w=b||v,y=E(w)||{message:"",hidden:!1};return Object(c.useEffect)(()=>(!i||s?_(w):f({[w]:{message:p,hidden:!0}}),()=>{_(w)}),[_,s,w,p,i,f]),Object(c.createElement)("div",{id:v,className:u()("wc-block-components-combobox",n,{"is-active":s,"has-error":y.message&&!y.hidden}),ref:k},Object(c.createElement)(d.a,{className:"wc-block-components-combobox-control",label:a,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(O.a)(k.current)?k.current.ownerDocument.activeElement:void 0;if(t&&Object(O.a)(k.current)&&k.current.contains(t))return;const n=e.toLocaleUpperCase(),c=r.find(e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n);c&&o(c.value)}},options:r,value:s||"",allowReset:!1,autoComplete:h,"aria-invalid":y.message&&!y.hidden}),Object(c.createElement)(g.a,{propertyName:w}))});n(271);var h=e=>{let{className:t,countries:n,id:a,label:o,onChange:r,value:s="",autoComplete:p="off",required:b=!1,errorId:d,errorMessage:m=Object(l.__)("Please select a country.","woo-gutenberg-products-block")}=e;const g=Object(c.useMemo)(()=>Object.entries(n).map(e=>{let[t,n]=e;return{value:t,label:Object(i.decodeEntities)(n)}}),[n]);return Object(c.createElement)("div",{className:u()(t,"wc-block-components-country-input")},Object(c.createElement)(j,{id:a,label:o,onChange:r,options:g,value:s,errorId:d,errorMessage:m,required:b,autoComplete:p}),"off"!==p&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:p,value:s,onChange:e=>{const t=e.target.value.toLocaleUpperCase(),n=g.find(e=>2!==t.length&&e.label.toLocaleUpperCase()===t||2===t.length&&e.value.toLocaleUpperCase()===t);r(n?n.value:"")},style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1}))},E=e=>Object(c.createElement)(h,r()({countries:s.g},e)),f=e=>Object(c.createElement)(h,r()({countries:s.a},e));n(273);const _=(e,t)=>{const n=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return n?n.value:""};var k=e=>{let{className:t,id:n,states:o,country:r,label:s,onChange:p,autoComplete:b="off",value:d="",required:m=!1}=e;const g=o[r],O=Object(c.useMemo)(()=>g?Object.keys(g).map(e=>({value:e,label:Object(i.decodeEntities)(g[e])})):[],[g]),h=Object(c.useCallback)(e=>{p(O.length>0?_(e,O):e)},[p,O]),E=Object(c.useRef)(d);return Object(c.useEffect)(()=>{E.current!==d&&(E.current=d)},[d]),Object(c.useEffect)(()=>{if(O.length>0&&E.current){const e=_(E.current,O);e!==E.current&&h(e)}},[O,h]),O.length>0?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j,{className:u()(t,"wc-block-components-state-input"),id:n,label:s,onChange:h,options:O,value:d,errorMessage:Object(l.__)("Please select a state.","woo-gutenberg-products-block"),required:m,autoComplete:b}),"off"!==b&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:b,value:d,onChange:e=>h(e.target.value),style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1})):Object(c.createElement)(a.a,{className:t,id:n,label:s,onChange:h,autoComplete:b,value:d,required:m})},v=e=>Object(c.createElement)(k,r()({states:s.h},e)),w=e=>Object(c.createElement)(k,r()({states:s.b},e)),y=n(28),C=n(2),N=n(48);t.a=Object(b.withInstanceId)(e=>{let{id:t="",fields:n=Object.keys(C.defaultAddressFields),fieldConfig:o={},instanceId:r,onChange:s,type:i="shipping",values:p}=e;const{getValidationError:u,setValidationErrors:b,clearValidationError:d}=Object(m.b)(),g=Object(y.a)(n),O=u("shipping-missing-country")||{},j=Object(c.useMemo)(()=>Object(N.a)(g,o,p.country),[g,o,p.country]);return Object(c.useEffect)(()=>{j.forEach(e=>{e.hidden&&p[e.key]&&s({...p,[e.key]:""})})},[j,s,p]),Object(c.useEffect)(()=>{"shipping"===i&&((e,t,n,c)=>{c||e.country||!(e.city||e.state||e.postcode)||t({"shipping-missing-country":{message:Object(l.__)("Please select a country to calculate rates.","woo-gutenberg-products-block"),hidden:!1}}),c&&e.country&&n("shipping-missing-country")})(p,b,d,!!O.message&&!O.hidden)},[p,O.message,O.hidden,b,d,i]),t=t||r,Object(c.createElement)("div",{id:t,className:"wc-block-components-address-form"},j.map(e=>{if(e.hidden)return null;if("country"===e.key){const n="shipping"===i?E:f;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,label:e.required?e.label:e.optionalLabel,value:p.country,autoComplete:e.autocomplete,onChange:e=>s({...p,country:e,state:""}),errorId:"shipping"===i?"shipping-missing-country":null,errorMessage:e.errorMessage,required:e.required})}if("state"===e.key){const n="shipping"===i?v:w;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,country:p.country,label:e.required?e.label:e.optionalLabel,value:p.state,autoComplete:e.autocomplete,onChange:e=>s({...p,state:e}),errorMessage:e.errorMessage,required:e.required})}return Object(c.createElement)(a.a,{key:e.key,id:`${t}-${e.key}`,className:"wc-block-components-address-form__"+e.key,label:e.required?e.label:e.optionalLabel,value:p[e.key],autoCapitalize:e.autocapitalize,autoComplete:e.autocomplete,onChange:t=>s({...p,[e.key]:t}),errorMessage:e.errorMessage,required:e.required})}))})},351:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(137),r=n(184),s=n(12),l=n(2);n(295);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:n,isRemovingCoupon:p,removeCoupon:u,values:b}=e;const{total_discount:d,total_discount_tax:m}=b,g=parseInt(d,10);if(!g&&0===t.length)return null;const O=parseInt(m,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,h=Object(s.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(c.createElement)(s.TotalsItem,{className:"wc-block-components-totals-discount",currency:n,description:0!==h.length&&Object(c.createElement)(o.a,{screenReaderLabel:Object(a.__)("Removing coupon…","woo-gutenberg-products-block"),isLoading:p,showSpinner:!1},Object(c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},h.map(e=>Object(c.createElement)(r.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(a.sprintf)(
|
18 |
/* translators: %s Coupon code. */
|
19 |
Object(a.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:p,onRemove:()=>{u(e.code)},radius:"large",ariaLabel:Object(a.sprintf)(
|
20 |
/* translators: %s is a coupon code. */
|
21 |
-
Object(a.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(a.__)("Discount","woo-gutenberg-products-block"):Object(a.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},
|
22 |
/* translators: %s location. */
|
23 |
-
Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[18],{102:function(e,t,n){"use strict";var c=n(0);t.a=function(e){let{icon:t,size:n=24,...a}=e;return Object(c.cloneElement)(t,{width:n,height:n,...a})}},118:function(e,t){},173:function(e,t){},178:function(e,t,n){"use strict";var c=n(0),a=n(14);const o=Object(c.createElement)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(a.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=o},182:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(4),s=n.n(r),l=n(1),i=n(102),p=n(178);n(118);var u=e=>{let{text:t,screenReaderText:n="",element:c="li",className:r="",radius:l="small",children:i=null,...p}=e;const u=c,b=s()(r,"wc-block-components-chip","wc-block-components-chip--radius-"+l),d=Boolean(n&&n!==t);return Object(o.createElement)(u,a()({className:b},p),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},n),i)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:c=!1,onRemove:r=(()=>{}),removeOnAnyClick:b=!1,text:d,screenReaderText:m="",...g}=e;const O=b?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
5 |
+
Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:c,onClick:r,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||r()}},h=b?j:{},E=b?{"aria-hidden":!0}:j;return Object(o.createElement)(u,a()({},g,h,{className:s()(n,"is-removable"),element:b?"button":g.element,screenReaderText:m,text:d}),Object(o.createElement)(O,a()({className:"wc-block-components-chip__remove"},E),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:p.a,size:16})))}},22:function(e,t,n){"use strict";var c=n(0),a=n(4),o=n.n(a);t.a=e=>{let t,{label:n,screenReaderLabel:a,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=n,i=null!=a;return!l&&i?(t=r||"span",s={...s,className:o()(s.className,"screen-reader-text")},Object(c.createElement)(t,s,a)):(t=r||c.Fragment,l&&i&&n!==a?Object(c.createElement)(t,s,Object(c.createElement)("span",{"aria-hidden":"true"},n),Object(c.createElement)("span",{className:"screen-reader-text"},a)):Object(c.createElement)(t,s,n))}},236:function(e,t,n){"use strict";var c=n(0),a=n(4),o=n.n(a),r=n(238);t.a=e=>{let{checked:t,name:n,onChange:a,option:s}=e;const{value:l,label:i,description:p,secondaryLabel:u,secondaryDescription:b}=s;return Object(c.createElement)("label",{className:o()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${n}-${l}`},Object(c.createElement)("input",{id:`${n}-${l}`,className:"wc-block-components-radio-control__input",type:"radio",name:n,value:l,onChange:e=>a(e.target.value),checked:t,"aria-describedby":o()({[`${n}-${l}__label`]:i,[`${n}-${l}__secondary-label`]:u,[`${n}-${l}__description`]:p,[`${n}-${l}__secondary-description`]:b})}),Object(c.createElement)(r.a,{id:`${n}-${l}`,label:i,secondaryLabel:u,description:p,secondaryDescription:b}))}},237:function(e,t){},238:function(e,t,n){"use strict";var c=n(0);t.a=e=>{let{label:t,secondaryLabel:n,description:a,secondaryDescription:o,id:r}=e;return Object(c.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},Object(c.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&Object(c.createElement)("span",{id:r&&r+"__label",className:"wc-block-components-radio-control__label"},t),n&&Object(c.createElement)("span",{id:r&&r+"__secondary-label",className:"wc-block-components-radio-control__secondary-label"},n)),Object(c.createElement)("div",{className:"wc-block-components-radio-control__description-group"},a&&Object(c.createElement)("span",{id:r&&r+"__description",className:"wc-block-components-radio-control__description"},a),o&&Object(c.createElement)("span",{id:r&&r+"__secondary-description",className:"wc-block-components-radio-control__secondary-description"},o)))}},240:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(51),s=n(4),l=n.n(s),i=n(134);n(243),t.a=e=>{let{className:t,showSpinner:n=!1,children:c,variant:s="contained",...p}=e;const u=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(o.createElement)(r.a,a()({className:u},p),n&&Object(o.createElement)(i.a,null),Object(o.createElement)("span",{className:"wc-block-components-button__text"},c))}},241:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(4),s=n.n(r);n(242),t.a=e=>{let{children:t,className:n,headingLevel:c,...r}=e;const l=s()("wc-block-components-title",n),i="h"+c;return Object(o.createElement)(i,a()({className:l},r),t)}},242:function(e,t){},243:function(e,t){},244:function(e,t){},258:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0),a=n(175);n(237);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:r,getValidationErrorId:s}=Object(a.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(c.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(c.createElement)("p",{id:s(o)},t))}},259:function(e,t,n){"use strict";var c=n(0),a=n(4),o=n.n(a),r=n(13),s=n(236);n(260);const l=e=>{let{className:t="",id:n,selected:a,onChange:i=(()=>{}),options:p=[]}=e;const u=Object(r.useInstanceId)(l),b=n||u;return p.length?Object(c.createElement)("div",{className:o()("wc-block-components-radio-control",t)},p.map(e=>Object(c.createElement)(s.a,{key:`${b}-${e.value}`,name:"radio-control-"+b,checked:e.value===a,option:e,onChange:t=>{i(t),"function"==typeof e.onChange&&e.onChange(t)}}))):null};t.a=l},260:function(e,t){},261:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var c=n(1),a=n(8),o=n(5),r=n(19),s=n(29),l=n(0),i=n(226),p=n(175),u=n(39);const b=()=>{const{cartCoupons:e,cartIsLoading:t}=Object(s.a)(),{addErrorNotice:n}=Object(u.a)(),{addSnackbarNotice:b}=(()=>{const{notices:e,createSnackbarNotice:t,removeSnackbarNotice:n,setIsSuppressed:c}=Object(i.b)(),a=Object(l.useRef)(e);Object(l.useEffect)(()=>{a.current=e},[e]);const o=Object(l.useMemo)(()=>({removeNotices:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;a.current.forEach(t=>{null!==e&&t.status!==e||n(t.id)})},removeSnackbarNotice:n}),[n]),r=Object(l.useMemo)(()=>({addSnackbarNotice:function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(e,n)}}),[t]);return{notices:e,...o,...r,setIsSuppressed:c}})(),{setValidationErrors:d}=Object(p.b)();return{appliedCoupons:e,isLoading:t,...Object(a.useSelect)((e,t)=>{let{dispatch:a}=t;const s=e(o.CART_STORE_KEY),l=s.isApplyingCoupon(),i=s.isRemovingCoupon(),{applyCoupon:p,removeCoupon:u,receiveApplyingCoupon:m}=a(o.CART_STORE_KEY);return{applyCoupon:e=>{p(e).then(t=>{!0===t&&b(Object(c.sprintf)(
|
6 |
/* translators: %s coupon code. */
|
7 |
Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{d({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),m("")})},removeCoupon:e=>{u(e).then(t=>{!0===t&&b(Object(c.sprintf)(
|
8 |
/* translators: %s coupon code. */
|
9 |
+
Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),e),{id:"coupon-form"})}).catch(e=>{n(e.message,{id:"coupon-form"}),m("")})},isApplyingCoupon:l,isRemovingCoupon:i}},[n,b])}}},270:function(e,t){},271:function(e,t){},272:function(e,t){},273:function(e,t){},274:function(e,t){},282:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(20),r=n(135),s=n(12),l=n(321),i=n(29),p=n(18),u=n(4),b=n.n(u),d=n(19),m=n(22),g=n(67),O=n(259),j=n(238),h=n(38),E=n(99),f=n(2);const _=e=>{const t=Object(f.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:Object(d.decodeEntities)(e.name),value:e.rate_id,description:Object(c.createElement)(c.Fragment,null,Number.isFinite(t)&&Object(c.createElement)(E.a,{currency:Object(h.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,Object(d.decodeEntities)(e.delivery_time))}};var k=e=>{let{className:t="",noResultsMessage:n,onSelectRate:a,rates:o,renderOption:r=_,selectedRate:s}=e;const l=(null==s?void 0:s.rate_id)||"",[i,p]=Object(c.useState)(l);if(Object(c.useEffect)(()=>{l&&p(l)},[l]),0===o.length)return n;if(o.length>1)return Object(c.createElement)(O.a,{className:t,onChange:e=>{p(e),a(e)},selected:i,options:o.map(r)});const{label:u,secondaryLabel:b,description:d,secondaryDescription:m}=r(o[0]);return Object(c.createElement)(j.a,{label:u,secondaryLabel:b,description:d,secondaryDescription:m})};n(274);var v=e=>{let{packageId:t,className:n="",noResultsMessage:o,renderOption:r,packageData:l,collapsible:i=!1,collapse:p=!1,showItems:u=!1}=e;const{selectShippingRate:O}=Object(g.a)(),j=Object(c.createElement)(c.Fragment,null,(u||i)&&Object(c.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title"},l.name),u&&Object(c.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(l.items).map(e=>{const t=Object(d.decodeEntities)(e.name),n=e.quantity;return Object(c.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},Object(c.createElement)(m.a,{label:n>1?`${t} × ${n}`:""+t,screenReaderLabel:Object(a.sprintf)(
|
10 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
11 |
Object(a._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),h=Object(c.createElement)(k,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:r});return i?Object(c.createElement)(s.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:j},h):Object(c.createElement)("div",{className:b()("wc-block-components-shipping-rates-control__package",n)},j,h)};const w=e=>{let{packages:t,collapse:n,showItems:a,collapsible:o,noResultsMessage:r,renderOption:s}=e;return t.length?Object(c.createElement)(c.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(c.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:a,noResultsMessage:r,renderOption:s})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:b=!1,noResultsMessage:d,renderOption:m,context:g}=e;Object(c.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),c=Object(l.b)(t);1===e?Object(o.speak)(Object(a.sprintf)(
|
12 |
/* translators: %d number of shipping options found. */
|
14 |
/* translators: %d number of shipping packages packages. */
|
15 |
Object(a._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(a.sprintf)(
|
16 |
/* translators: %d number of shipping options available. */
|
17 |
+
Object(a._n)("%d shipping option was found","%d shipping options were found",c,"woo-gutenberg-products-block"),c))},[n,t]);const{extensions:O,receiveCart:j,...h}=Object(i.a)(),E={className:u,collapsible:b,noResultsMessage:d,renderOption:m,extensions:O,cart:h,components:{ShippingRatesControlPackage:v},context:g},{isEditor:f}=Object(p.a)();return Object(c.createElement)(r.a,{isLoading:n,screenReaderLabel:Object(a.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},f?Object(c.createElement)(w,{packages:t,noResultsMessage:d,renderOption:m}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ExperimentalOrderShippingPackages.Slot,E),Object(c.createElement)(s.ExperimentalOrderShippingPackages,null,Object(c.createElement)(w,{packages:t,noResultsMessage:d,renderOption:m}))))}},293:function(e,t){},294:function(e,t){},295:function(e,t){},296:function(e,t){},301:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(1),s=n(3),l=n(4),i=n.n(l),p=n(175),u=n(258),b=n(13),d=n(59),m=n(22);n(244);var g=Object(s.forwardRef)((e,t)=>{let{className:n,id:c,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:b,help:d,autoCapitalize:g="off",autoComplete:O="off",value:j="",onChange:h,required:E=!1,onBlur:f=(()=>{}),feedback:_,...k}=e;const[v,w]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||j})},Object(o.createElement)("input",a()({type:r,id:c,value:j,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{h(e.target.value)},onFocus:()=>w(!0),onBlur:e=>{f(e.target.value),w(!1)},"aria-label":s||p,disabled:b,"aria-describedby":d&&!l?c+"__help":l,required:E},k)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:c},htmlFor:c}),!!d&&Object(o.createElement)("p",{id:c+"__help",className:"wc-block-components-text-input__help"},d),_)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:c,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:O,showError:j=!0,errorMessage:h="",value:E="",...f}=e;const[_,k]=Object(s.useState)(!0),v=Object(s.useRef)(null),{getValidationError:w,hideValidationError:y,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),x=void 0!==c?c:"textinput-"+n,R=void 0!==b?b:x,I=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=v.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(R):C({[R]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,R,C]);Object(s.useEffect)(()=>{var e;_&&m&&(null===(e=v.current)||void 0===e||e.focus()),k(!1)},[m,_,k]),Object(s.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&I(!0)},[E,I]),Object(s.useEffect)(()=>()=>{N(R)},[N,R]);const L=w(R)||{};Object(d.a)(h)&&""!==h&&(L.message=h);const M=L.message&&!L.hidden,T=j&&M&&S(R)?S(R):l;return Object(o.createElement)(g,a()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:x,onBlur:()=>{I(!1)},feedback:j&&Object(o.createElement)(u.a,{errorMessage:h,propertyName:R}),ref:v,onChange:e=>{y(R),O(e)},ariaDescribedBy:T,value:E},f))})},321:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return a}));const c=e=>e.length,a=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},326:function(e,t,n){"use strict";var c=n(0),a=n(301),o=n(10),r=n.n(o),s=n(45),l=n(1),i=n(19),p=n(4),u=n.n(p),b=n(13),d=n(413),m=n(175),g=n(258),O=n(61);n(272);var j=Object(b.withInstanceId)(e=>{let{id:t,className:n,label:a,onChange:o,options:r,value:s,required:i=!1,errorMessage:p=Object(l.__)("Please select a value.","woo-gutenberg-products-block"),errorId:b,instanceId:j="0",autoComplete:h="off"}=e;const{getValidationError:E,setValidationErrors:f,clearValidationError:_}=Object(m.b)(),k=Object(c.useRef)(null),v=t||"control-"+j,w=b||v,y=E(w)||{message:"",hidden:!1};return Object(c.useEffect)(()=>(!i||s?_(w):f({[w]:{message:p,hidden:!0}}),()=>{_(w)}),[_,s,w,p,i,f]),Object(c.createElement)("div",{id:v,className:u()("wc-block-components-combobox",n,{"is-active":s,"has-error":y.message&&!y.hidden}),ref:k},Object(c.createElement)(d.a,{className:"wc-block-components-combobox-control",label:a,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(O.a)(k.current)?k.current.ownerDocument.activeElement:void 0;if(t&&Object(O.a)(k.current)&&k.current.contains(t))return;const n=e.toLocaleUpperCase(),c=r.find(e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n);c&&o(c.value)}},options:r,value:s||"",allowReset:!1,autoComplete:h,"aria-invalid":y.message&&!y.hidden}),Object(c.createElement)(g.a,{propertyName:w}))});n(271);var h=e=>{let{className:t,countries:n,id:a,label:o,onChange:r,value:s="",autoComplete:p="off",required:b=!1,errorId:d,errorMessage:m=Object(l.__)("Please select a country.","woo-gutenberg-products-block")}=e;const g=Object(c.useMemo)(()=>Object.entries(n).map(e=>{let[t,n]=e;return{value:t,label:Object(i.decodeEntities)(n)}}),[n]);return Object(c.createElement)("div",{className:u()(t,"wc-block-components-country-input")},Object(c.createElement)(j,{id:a,label:o,onChange:r,options:g,value:s,errorId:d,errorMessage:m,required:b,autoComplete:p}),"off"!==p&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:p,value:s,onChange:e=>{const t=e.target.value.toLocaleUpperCase(),n=g.find(e=>2!==t.length&&e.label.toLocaleUpperCase()===t||2===t.length&&e.value.toLocaleUpperCase()===t);r(n?n.value:"")},style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1}))},E=e=>Object(c.createElement)(h,r()({countries:s.g},e)),f=e=>Object(c.createElement)(h,r()({countries:s.a},e));n(273);const _=(e,t)=>{const n=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return n?n.value:""};var k=e=>{let{className:t,id:n,states:o,country:r,label:s,onChange:p,autoComplete:b="off",value:d="",required:m=!1}=e;const g=o[r],O=Object(c.useMemo)(()=>g?Object.keys(g).map(e=>({value:e,label:Object(i.decodeEntities)(g[e])})):[],[g]),h=Object(c.useCallback)(e=>{p(O.length>0?_(e,O):e)},[p,O]),E=Object(c.useRef)(d);return Object(c.useEffect)(()=>{E.current!==d&&(E.current=d)},[d]),Object(c.useEffect)(()=>{if(O.length>0&&E.current){const e=_(E.current,O);e!==E.current&&h(e)}},[O,h]),O.length>0?Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j,{className:u()(t,"wc-block-components-state-input"),id:n,label:s,onChange:h,options:O,value:d,errorMessage:Object(l.__)("Please select a state.","woo-gutenberg-products-block"),required:m,autoComplete:b}),"off"!==b&&Object(c.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:b,value:d,onChange:e=>h(e.target.value),style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1})):Object(c.createElement)(a.a,{className:t,id:n,label:s,onChange:h,autoComplete:b,value:d,required:m})},v=e=>Object(c.createElement)(k,r()({states:s.h},e)),w=e=>Object(c.createElement)(k,r()({states:s.b},e)),y=n(28),C=n(2),N=n(46);t.a=Object(b.withInstanceId)(e=>{let{id:t="",fields:n=Object.keys(C.defaultAddressFields),fieldConfig:o={},instanceId:r,onChange:s,type:i="shipping",values:p}=e;const{getValidationError:u,setValidationErrors:b,clearValidationError:d}=Object(m.b)(),g=Object(y.a)(n),O=u("shipping-missing-country")||{},j=Object(c.useMemo)(()=>Object(N.a)(g,o,p.country),[g,o,p.country]);return Object(c.useEffect)(()=>{j.forEach(e=>{e.hidden&&p[e.key]&&s({...p,[e.key]:""})})},[j,s,p]),Object(c.useEffect)(()=>{"shipping"===i&&((e,t,n,c)=>{c||e.country||!(e.city||e.state||e.postcode)||t({"shipping-missing-country":{message:Object(l.__)("Please select a country to calculate rates.","woo-gutenberg-products-block"),hidden:!1}}),c&&e.country&&n("shipping-missing-country")})(p,b,d,!!O.message&&!O.hidden)},[p,O.message,O.hidden,b,d,i]),t=t||r,Object(c.createElement)("div",{id:t,className:"wc-block-components-address-form"},j.map(e=>{if(e.hidden)return null;if("country"===e.key){const n="shipping"===i?E:f;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,label:e.required?e.label:e.optionalLabel,value:p.country,autoComplete:e.autocomplete,onChange:e=>s({...p,country:e,state:""}),errorId:"shipping"===i?"shipping-missing-country":null,errorMessage:e.errorMessage,required:e.required})}if("state"===e.key){const n="shipping"===i?v:w;return Object(c.createElement)(n,{key:e.key,id:`${t}-${e.key}`,country:p.country,label:e.required?e.label:e.optionalLabel,value:p.state,autoComplete:e.autocomplete,onChange:e=>s({...p,state:e}),errorMessage:e.errorMessage,required:e.required})}return Object(c.createElement)(a.a,{key:e.key,id:`${t}-${e.key}`,className:"wc-block-components-address-form__"+e.key,label:e.required?e.label:e.optionalLabel,value:p[e.key],autoCapitalize:e.autocapitalize,autoComplete:e.autocomplete,onChange:t=>s({...p,[e.key]:t}),errorMessage:e.errorMessage,required:e.required})}))})},355:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(135),r=n(182),s=n(12),l=n(2);n(293);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:n,isRemovingCoupon:p,removeCoupon:u,values:b}=e;const{total_discount:d,total_discount_tax:m}=b,g=parseInt(d,10);if(!g&&0===t.length)return null;const O=parseInt(m,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,h=Object(s.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(c.createElement)(s.TotalsItem,{className:"wc-block-components-totals-discount",currency:n,description:0!==h.length&&Object(c.createElement)(o.a,{screenReaderLabel:Object(a.__)("Removing coupon…","woo-gutenberg-products-block"),isLoading:p,showSpinner:!1},Object(c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},h.map(e=>Object(c.createElement)(r.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(a.sprintf)(
|
18 |
/* translators: %s Coupon code. */
|
19 |
Object(a.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:p,onRemove:()=>{u(e.code)},radius:"large",ariaLabel:Object(a.sprintf)(
|
20 |
/* translators: %s is a coupon code. */
|
21 |
+
Object(a.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(a.__)("Discount","woo-gutenberg-products-block"):Object(a.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},356:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(240),r=n(301),s=n(22),l=n(135),i=n(13),p=n(175),u=n(258),b=n(12);n(294),t.a=Object(i.withInstanceId)(e=>{let{instanceId:t,isLoading:n=!1,initialOpen:i=!1,onSubmit:d=(()=>{})}=e;const[m,g]=Object(c.useState)(""),O=Object(c.useRef)(!1),{getValidationError:j,getValidationErrorId:h}=Object(p.b)(),E=j("coupon");Object(c.useEffect)(()=>{O.current!==n&&(n||!m||E||g(""),O.current=n)},[n,m,E]);const f="wc-block-components-totals-coupon__input-"+t;return Object(c.createElement)(b.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:i,title:Object(c.createElement)(s.a,{label:Object(a.__)("Coupon code","woo-gutenberg-products-block"),screenReaderLabel:Object(a.__)("Apply a coupon code","woo-gutenberg-products-block"),htmlFor:f})},Object(c.createElement)(l.a,{screenReaderLabel:Object(a.__)("Applying coupon…","woo-gutenberg-products-block"),isLoading:n,showSpinner:!1},Object(c.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(c.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(c.createElement)(r.a,{id:f,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(a.__)("Enter code","woo-gutenberg-products-block"),value:m,ariaDescribedBy:h(f),onChange:e=>{g(e)},focusOnMount:!0,showError:!1}),Object(c.createElement)(o.a,{className:"wc-block-components-totals-coupon__button",disabled:n||!m,showSpinner:n,onClick:e=>{e.preventDefault(),d(m)},type:"submit"},Object(a.__)("Apply","woo-gutenberg-products-block"))),Object(c.createElement)(u.a,{propertyName:"coupon",elementId:f}))))})},360:function(e,t,n){"use strict";var c=n(0),a=n(1),o=n(99),r=n(12),s=n(29),l=n(2);n(296),t.a=e=>{let{currency:t,values:n}=e;const i=Object(l.getSetting)("taxesEnabled",!0)&&Object(l.getSetting)("displayCartPricesIncludingTax",!1),{total_price:p,total_tax:u}=n,{receiveCart:b,...d}=Object(s.a)(),m=Object(r.__experimentalApplyCheckoutFilter)({filterName:"totalLabel",defaultValue:Object(a.__)("Total","woo-gutenberg-products-block"),extensions:d.extensions,arg:{cart:d}}),g=parseInt(u,10);return Object(c.createElement)(r.TotalsItem,{className:"wc-block-components-totals-footer-item",currency:t,label:m,value:parseInt(p,10),description:i&&0!==g&&Object(c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},Object(c.createInterpolateElement)(Object(a.__)("Including <TaxAmount/> in taxes","woo-gutenberg-products-block"),{TaxAmount:Object(c.createElement)(o.a,{className:"wc-block-components-totals-footer-item-tax-value",currency:t,value:g})}))})}},377:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(4),s=n.n(r),l=n(1),i=n(29),p=n(12),u=n(2),b=n(19);const d=e=>{let{selectedShippingRates:t}=e;return Object(o.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},Object(l.__)("via","woo-gutenberg-products-block")," ",Object(b.decodeEntities)(t.join(", ")))};var m=n(119),g=n(282),O=e=>{let{hasRates:t,shippingRates:n,isLoadingRates:c}=e;const a=t?Object(l.__)("Shipping options","woo-gutenberg-products-block"):Object(l.__)("Choose a shipping option","woo-gutenberg-products-block");return Object(o.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},Object(o.createElement)("legend",{className:"screen-reader-text"},a),Object(o.createElement)(g.a,{className:"wc-block-components-totals-shipping__options",collapsible:!0,noResultsMessage:Object(o.createElement)(m.a,{isDismissible:!1,className:s()("wc-block-components-shipping-rates-control__no-results-notice","woocommerce-error")},Object(l.__)("No shipping options were found.","woo-gutenberg-products-block")),shippingRates:n,isLoadingRates:c,context:"woocommerce/cart"}))},j=n(65),h=n(240),E=n(11),f=n.n(E),_=n(175),k=(n(270),n(326)),v=e=>{let{address:t,onUpdate:n,addressFields:c}=e;const[a,r]=Object(o.useState)(t),{hasValidationErrors:s,showAllValidationErrors:i}=Object(_.b)();return Object(o.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},Object(o.createElement)(k.a,{fields:c,onChange:r,values:a}),Object(o.createElement)(h.a,{className:"wc-block-components-shipping-calculator-address__button",disabled:f()(a,t),onClick:e=>{if(e.preventDefault(),i(),!s)return n(a)},type:"submit"},Object(l.__)("Update","woo-gutenberg-products-block")))},w=e=>{let{onUpdate:t=(()=>{}),addressFields:n=["country","state","city","postcode"]}=e;const{shippingAddress:c,setShippingAddress:a}=Object(j.a)();return Object(o.createElement)("div",{className:"wc-block-components-shipping-calculator"},Object(o.createElement)(v,{address:c,addressFields:n,onUpdate:e=>{a(e),t(e)}}))},y=e=>{let{address:t}=e;if(0===Object.values(t).length)return null;const n=Object(u.getSetting)("shippingCountries",{}),c=Object(u.getSetting)("shippingStates",{}),a="string"==typeof n[t.country]?Object(b.decodeEntities)(n[t.country]):"",r="object"==typeof c[t.country]&&"string"==typeof c[t.country][t.state]?Object(b.decodeEntities)(c[t.country][t.state]):t.state,s=[];s.push(t.postcode.toUpperCase()),s.push(t.city),s.push(r),s.push(a);const i=s.filter(Boolean).join(", ");return i?Object(o.createElement)("span",{className:"wc-block-components-shipping-address"},Object(l.sprintf)(
|
22 |
/* translators: %s location. */
|
23 |
+
Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(295);const C=e=>{let{label:t=Object(l.__)("Calculate","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}=e;return Object(o.createElement)("button",{className:"wc-block-components-totals-shipping__change-address-button",onClick:()=>{c(!n)},"aria-expanded":n},t)},N=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,shippingAddress:a}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,{address:a}),t&&Object(o.createElement)(C,{label:Object(l.__)("(change address)","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}))},S=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c,isCheckout:a=!1}=e;return t?Object(o.createElement)(C,{isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:c}):Object(o.createElement)("em",null,a?Object(l.__)("No shipping options available","woo-gutenberg-products-block"):Object(l.__)("Calculated during checkout","woo-gutenberg-products-block"))};t.a=e=>{let{currency:t,values:n,showCalculator:c=!0,showRateSelector:r=!0,isCheckout:b=!1,className:m}=e;const[g,j]=Object(o.useState)(!1),{shippingAddress:h,cartHasCalculatedShipping:E,shippingRates:f,isLoadingRates:_}=Object(i.a)(),k=Object(u.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(n.total_shipping,10)+parseInt(n.total_shipping_tax,10):parseInt(n.total_shipping,10),v=f.some(e=>e.shipping_rates.length)||k,y={isShippingCalculatorOpen:g,setIsShippingCalculatorOpen:j},C=f.flatMap(e=>e.shipping_rates.filter(e=>e.selected).flatMap(e=>e.name));return Object(o.createElement)("div",{className:s()("wc-block-components-totals-shipping",m)},Object(o.createElement)(p.TotalsItem,{label:Object(l.__)("Shipping","woo-gutenberg-products-block"),value:v&&E?k:Object(o.createElement)(S,a()({showCalculator:c,isCheckout:b},y)),description:v&&E?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(d,{selectedShippingRates:C}),Object(o.createElement)(N,a()({shippingAddress:h,showCalculator:c},y))):null,currency:t}),c&&g&&Object(o.createElement)(w,{onUpdate:()=>{j(!1)}}),r&&E&&Object(o.createElement)(O,{hasRates:v,shippingRates:f,isLoadingRates:_}))}},417:function(e,t,n){"use strict";n.r(t);var c=n(116),a=n(0),o=n(1),r=n(355),s=n(356),l=n(377),i=n(360),p=n(12),u=n(38),b=n(29),d=n(261),m=n(2),g=n(241),O={isShippingCalculatorEnabled:{type:"boolean",default:Object(m.getSetting)("isShippingCalculatorEnabled",!0)},showRateAfterTaxName:{type:"boolean",default:Object(m.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{move:!0,remove:!0}}};t.default=Object(c.withFilteredAttributes)(O)(e=>{let{className:t,showRateAfterTaxName:n=!1,isShippingCalculatorEnabled:c=!0}=e;const{cartFees:O,cartTotals:j,cartNeedsShipping:h}=Object(b.a)(),{applyCoupon:E,removeCoupon:f,isApplyingCoupon:_,isRemovingCoupon:k,appliedCoupons:v}=Object(d.a)(),w=Object(u.getCurrencyFromPriceResponse)(j),{extensions:y,receiveCart:C,...N}=Object(b.a)(),S={extensions:y,cart:N,context:"woocommerce/cart"},x={extensions:y,cart:N,context:"woocommerce/cart"};return Object(a.createElement)("div",{className:t},Object(a.createElement)(g.a,{headingLevel:"2",className:"wc-block-cart__totals-title"},Object(o.__)("Cart totals","woo-gutenberg-products-block")),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.Subtotal,{currency:w,values:j}),Object(a.createElement)(p.TotalsFees,{currency:w,cartFees:O}),Object(a.createElement)(r.a,{cartCoupons:v,currency:w,isRemovingCoupon:k,removeCoupon:f,values:j})),Object(m.getSetting)("couponsEnabled",!0)&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(s.a,{onSubmit:E,isLoading:_})),Object(a.createElement)(p.ExperimentalDiscountsMeta.Slot,x),h&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(l.a,{showCalculator:c,showRateSelector:!0,values:j,currency:w})),!Object(m.getSetting)("displayCartPricesIncludingTax",!1)&&parseInt(j.total_tax,10)>0&&Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(p.TotalsTaxes,{showRateAfterTaxName:n,currency:w,values:j})),Object(a.createElement)(p.TotalsWrapper,null,Object(a.createElement)(i.a,{currency:w,values:j})),Object(a.createElement)(p.ExperimentalOrderMeta.Slot,S))})},99:function(e,t,n){"use strict";var c=n(10),a=n.n(c),o=n(0),r=n(136),s=n(4),l=n.n(s);n(173);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:n,currency:c,onValueChange:s,displayType:p="text",...u}=e;const b="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(b))return null;const d=b/10**c.minorUnit;if(!Number.isFinite(d))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...u,...i(c),value:void 0,currency:void 0,onValueChange
|