Version Description
- 2022-06-06 =
Enhancements
- Filter Products by Price: Decrease price slider step sequence from 10 to 1. (6486)
- Add the
Fixed image
andRepeated image
media controls to the Featured Category block. (6440)
Bug Fixes
- Featured Item Blocks: Fix an issue where the default color could be overridden by a theme, and where custom colors were not applied correctly. (6492)
- Fix: Only enqueue the relevant translations script. (6478)
- Fix: All Products block: New product is missing in the Cart block if
Redirect to the cart page after successful addition
is enabled. (6466) - Respect low stock visibility setting in Cart/Checkout. (6444)
- Decouple Store API payment handling from Checkout block loading code. (6519)
Various
- Add support for
Font size
andFont family
for theMini Cart
block. (6396)
Download this release
Release Info
Developer | gigitux |
Plugin | WooCommerce Gutenberg Products Block |
Version | 7.8.0 |
Comparing to | |
See all releases |
Code changes from version 7.7.0 to 7.8.0
- assets/css/abstracts/_mixins.scss +1 -1
- assets/js/atomic/blocks/product-elements/button/block.js +2 -2
- assets/js/base/components/price-slider/index.tsx +2 -2
- assets/js/base/context/hooks/cart/use-store-cart-coupons.ts +10 -5
- assets/js/base/context/hooks/test/use-store-snackbar-notices.js +0 -51
- assets/js/base/context/hooks/use-store-snackbar-notices.js +0 -52
- assets/js/base/context/providers/store-snackbar-notices/components/snackbar-notices-container.js +36 -6
- assets/js/base/context/providers/store-snackbar-notices/context.js +0 -125
- assets/js/base/context/providers/store-snackbar-notices/index.ts +1 -1
- assets/js/blocks/cart/block.js +11 -12
- assets/js/blocks/checkout/block.tsx +24 -32
- assets/js/blocks/featured-items/{block-controls.js → block-controls.tsx} +64 -6
- assets/js/blocks/featured-items/{call-to-action.js → call-to-action.tsx} +11 -1
- assets/js/blocks/featured-items/{constants.js → constants.ts} +2 -2
- assets/js/blocks/featured-items/{constrained-resizable.js → constrained-resizable.tsx} +7 -5
- assets/js/blocks/featured-items/featured-category/block.json +107 -93
- assets/js/blocks/featured-items/featured-category/{block.js → block.tsx} +4 -58
- assets/js/blocks/featured-items/featured-category/example.js +0 -11
- assets/js/blocks/featured-items/featured-category/example.ts +19 -0
- assets/js/blocks/featured-items/featured-category/utils.js +0 -32
- assets/js/blocks/featured-items/featured-category/utils.ts +29 -0
- assets/js/blocks/featured-items/featured-product/block.json +113 -105
- assets/js/blocks/featured-items/featured-product/{block.js → block.tsx} +4 -58
- assets/js/blocks/featured-items/featured-product/example.js +0 -11
- assets/js/blocks/featured-items/featured-product/example.ts +19 -0
- assets/js/blocks/featured-items/{image-editor.js → image-editor.tsx} +44 -3
- assets/js/blocks/featured-items/{inspector-controls.js → inspector-controls.tsx} +88 -24
- assets/js/blocks/featured-items/register.tsx +35 -2
- assets/js/blocks/featured-items/style.scss +2 -1
- assets/js/blocks/featured-items/types.ts +33 -0
- assets/js/blocks/featured-items/{use-background-image.js → use-background-image.ts} +24 -5
- assets/js/blocks/featured-items/{utils.js → utils.ts} +31 -24
- assets/js/blocks/featured-items/with-api-error.js +0 -33
- assets/js/blocks/featured-items/with-api-error.tsx +59 -0
- assets/js/blocks/featured-items/with-edit-mode.js +0 -81
- assets/js/blocks/featured-items/with-edit-mode.tsx +133 -0
- assets/js/blocks/featured-items/with-editing-image.js +0 -20
- assets/js/blocks/featured-items/with-editing-image.tsx +34 -0
- assets/js/blocks/featured-items/{with-featured-item.js → with-featured-item.tsx} +93 -7
- assets/js/blocks/featured-items/with-update-button-attributes.tsx +90 -0
- assets/js/blocks/mini-cart/index.tsx +7 -0
- assets/js/blocks/mini-cart/style.scss +2 -0
- assets/js/hocs/with-transform-single-select-to-multiple-select.js +4 -1
- assets/js/types/type-defs/contexts.ts +5 -0
- assets/js/utils/useThrottle.ts +4 -1
- 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 +4 -4
- build/all-products-frontend.asset.php +1 -1
- build/all-products-frontend.js +3 -3
- build/all-products.asset.php +1 -1
- build/all-products.js +13 -13
- build/all-reviews.asset.php +1 -1
- build/all-reviews.js +3 -3
- build/attribute-filter-frontend.asset.php +1 -1
- build/attribute-filter-frontend.js +6 -6
- build/attribute-filter.asset.php +1 -1
- build/attribute-filter.js +12 -12
- build/cart-blocks/cart-accepted-payment-methods-frontend.js +1 -1
- build/cart-blocks/cart-express-payment-frontend.js +3 -3
- build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js +4 -4
- build/cart-blocks/cart-line-items-frontend.js +1 -1
- build/cart-blocks/cart-order-summary-frontend.js +1 -1
- build/cart-blocks/filled-cart-frontend.js +1 -1
- build/cart-blocks/order-summary-coupon-form-frontend.js +3 -3
- build/cart-blocks/order-summary-discount-frontend.js +5 -5
- build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js +2 -2
- build/cart-blocks/proceed-to-checkout-frontend.js +1 -1
- build/cart-frontend.asset.php +1 -1
- build/cart-frontend.js +1 -3
assets/css/abstracts/_mixins.scss
CHANGED
@@ -217,7 +217,7 @@ $fontSizes: (
|
|
217 |
left: 0;
|
218 |
bottom: 0;
|
219 |
right: 0;
|
220 |
-
background
|
221 |
border-radius: inherit;
|
222 |
opacity: $opacity;
|
223 |
z-index: 1;
|
217 |
left: 0;
|
218 |
bottom: 0;
|
219 |
right: 0;
|
220 |
+
background: inherit;
|
221 |
border-radius: inherit;
|
222 |
opacity: $opacity;
|
223 |
z-index: 1;
|
assets/js/atomic/blocks/product-elements/button/block.js
CHANGED
@@ -142,8 +142,8 @@ const AddToCartButton = ( {
|
|
142 |
} );
|
143 |
};
|
144 |
} else {
|
145 |
-
buttonProps.onClick = () => {
|
146 |
-
addToCart();
|
147 |
dispatchStoreEvent( 'cart-add-item', {
|
148 |
product,
|
149 |
} );
|
142 |
} );
|
143 |
};
|
144 |
} else {
|
145 |
+
buttonProps.onClick = async () => {
|
146 |
+
await addToCart();
|
147 |
dispatchStoreEvent( 'cart-add-item', {
|
148 |
product,
|
149 |
} );
|
assets/js/base/components/price-slider/index.tsx
CHANGED
@@ -84,8 +84,8 @@ const PriceSlider = ( {
|
|
84 |
const minRange = useRef< HTMLInputElement >( null );
|
85 |
const maxRange = useRef< HTMLInputElement >( null );
|
86 |
|
87 |
-
// We want step to default to
|
88 |
-
const stepValue = step ? step : 10
|
89 |
|
90 |
const [ minPriceInput, setMinPriceInput ] = useState( minPrice );
|
91 |
const [ maxPriceInput, setMaxPriceInput ] = useState( maxPrice );
|
84 |
const minRange = useRef< HTMLInputElement >( null );
|
85 |
const maxRange = useRef< HTMLInputElement >( null );
|
86 |
|
87 |
+
// We want step to default to 1 major unit, e.g. $1.
|
88 |
+
const stepValue = step ? step : 10 ** currency.minorUnit;
|
89 |
|
90 |
const [ minPriceInput, setMinPriceInput ] = useState( minPrice );
|
91 |
const [ maxPriceInput, setMaxPriceInput ] = useState( maxPrice );
|
assets/js/base/context/hooks/cart/use-store-cart-coupons.ts
CHANGED
@@ -13,7 +13,6 @@ import type { StoreCartCoupon } from '@woocommerce/types';
|
|
13 |
* Internal dependencies
|
14 |
*/
|
15 |
import { useStoreCart } from './use-store-cart';
|
16 |
-
import { useStoreSnackbarNotices } from '../use-store-snackbar-notices';
|
17 |
import { useValidationContext } from '../../providers/validation';
|
18 |
|
19 |
/**
|
@@ -27,7 +26,7 @@ import { useValidationContext } from '../../providers/validation';
|
|
27 |
export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
28 |
const { cartCoupons, cartIsLoading } = useStoreCart();
|
29 |
const { createErrorNotice } = useDispatch( 'core/notices' );
|
30 |
-
const {
|
31 |
const { setValidationErrors } = useValidationContext();
|
32 |
|
33 |
const results: Pick<
|
@@ -52,7 +51,8 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
|
52 |
applyCoupon( couponCode )
|
53 |
.then( ( result ) => {
|
54 |
if ( result === true ) {
|
55 |
-
|
|
|
56 |
sprintf(
|
57 |
/* translators: %s coupon code. */
|
58 |
__(
|
@@ -63,6 +63,8 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
|
63 |
),
|
64 |
{
|
65 |
id: 'coupon-form',
|
|
|
|
|
66 |
}
|
67 |
);
|
68 |
}
|
@@ -83,7 +85,8 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
|
83 |
removeCoupon( couponCode )
|
84 |
.then( ( result ) => {
|
85 |
if ( result === true ) {
|
86 |
-
|
|
|
87 |
sprintf(
|
88 |
/* translators: %s coupon code. */
|
89 |
__(
|
@@ -94,6 +97,8 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
|
94 |
),
|
95 |
{
|
96 |
id: 'coupon-form',
|
|
|
|
|
97 |
}
|
98 |
);
|
99 |
}
|
@@ -115,7 +120,7 @@ export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
|
115 |
isRemovingCoupon,
|
116 |
};
|
117 |
},
|
118 |
-
[ createErrorNotice,
|
119 |
);
|
120 |
|
121 |
return {
|
13 |
* Internal dependencies
|
14 |
*/
|
15 |
import { useStoreCart } from './use-store-cart';
|
|
|
16 |
import { useValidationContext } from '../../providers/validation';
|
17 |
|
18 |
/**
|
26 |
export const useStoreCartCoupons = ( context = '' ): StoreCartCoupon => {
|
27 |
const { cartCoupons, cartIsLoading } = useStoreCart();
|
28 |
const { createErrorNotice } = useDispatch( 'core/notices' );
|
29 |
+
const { createNotice } = useDispatch( 'core/notices' );
|
30 |
const { setValidationErrors } = useValidationContext();
|
31 |
|
32 |
const results: Pick<
|
51 |
applyCoupon( couponCode )
|
52 |
.then( ( result ) => {
|
53 |
if ( result === true ) {
|
54 |
+
createNotice(
|
55 |
+
'info',
|
56 |
sprintf(
|
57 |
/* translators: %s coupon code. */
|
58 |
__(
|
63 |
),
|
64 |
{
|
65 |
id: 'coupon-form',
|
66 |
+
type: 'snackbar',
|
67 |
+
context,
|
68 |
}
|
69 |
);
|
70 |
}
|
85 |
removeCoupon( couponCode )
|
86 |
.then( ( result ) => {
|
87 |
if ( result === true ) {
|
88 |
+
createNotice(
|
89 |
+
'info',
|
90 |
sprintf(
|
91 |
/* translators: %s coupon code. */
|
92 |
__(
|
97 |
),
|
98 |
{
|
99 |
id: 'coupon-form',
|
100 |
+
type: 'snackbar',
|
101 |
+
context,
|
102 |
}
|
103 |
);
|
104 |
}
|
120 |
isRemovingCoupon,
|
121 |
};
|
122 |
},
|
123 |
+
[ createErrorNotice, createNotice ]
|
124 |
);
|
125 |
|
126 |
return {
|
assets/js/base/context/hooks/test/use-store-snackbar-notices.js
DELETED
@@ -1,51 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { render, act } from '@testing-library/react';
|
5 |
-
import { StoreSnackbarNoticesProvider } from '@woocommerce/base-context/providers';
|
6 |
-
|
7 |
-
/**
|
8 |
-
* Internal dependencies
|
9 |
-
*/
|
10 |
-
import { useStoreSnackbarNotices } from '../use-store-snackbar-notices';
|
11 |
-
|
12 |
-
describe( 'useStoreNoticesWithSnackbar', () => {
|
13 |
-
function setup() {
|
14 |
-
const returnVal = {};
|
15 |
-
|
16 |
-
function TestComponent() {
|
17 |
-
Object.assign( returnVal, useStoreSnackbarNotices() );
|
18 |
-
|
19 |
-
return null;
|
20 |
-
}
|
21 |
-
|
22 |
-
render(
|
23 |
-
<StoreSnackbarNoticesProvider>
|
24 |
-
<TestComponent />
|
25 |
-
</StoreSnackbarNoticesProvider>
|
26 |
-
);
|
27 |
-
|
28 |
-
return returnVal;
|
29 |
-
}
|
30 |
-
|
31 |
-
test( 'allows adding and removing notices and checking if there are notices of a specific type', () => {
|
32 |
-
const storeNoticesData = setup();
|
33 |
-
|
34 |
-
// Assert initial state.
|
35 |
-
expect( storeNoticesData.notices ).toEqual( [] );
|
36 |
-
|
37 |
-
// Add snackbar notice.
|
38 |
-
act( () => {
|
39 |
-
storeNoticesData.addSnackbarNotice( 'Snackbar notice' );
|
40 |
-
} );
|
41 |
-
|
42 |
-
expect( storeNoticesData.notices.length ).toBe( 1 );
|
43 |
-
|
44 |
-
// Remove all remaining notices.
|
45 |
-
act( () => {
|
46 |
-
storeNoticesData.removeNotices();
|
47 |
-
} );
|
48 |
-
|
49 |
-
expect( storeNoticesData.notices.length ).toBe( 0 );
|
50 |
-
} );
|
51 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/context/hooks/use-store-snackbar-notices.js
DELETED
@@ -1,52 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { useMemo, useRef, useEffect } from '@wordpress/element';
|
5 |
-
import { useStoreSnackbarNoticesContext } from '@woocommerce/base-context/providers';
|
6 |
-
|
7 |
-
export const useStoreSnackbarNotices = () => {
|
8 |
-
const {
|
9 |
-
notices,
|
10 |
-
createSnackbarNotice,
|
11 |
-
removeSnackbarNotice,
|
12 |
-
setIsSuppressed,
|
13 |
-
} = useStoreSnackbarNoticesContext();
|
14 |
-
// Added to a ref so the surface for notices doesn't change frequently
|
15 |
-
// and thus can be used as dependencies on effects.
|
16 |
-
const currentNotices = useRef( notices );
|
17 |
-
|
18 |
-
// Update notices ref whenever they change
|
19 |
-
useEffect( () => {
|
20 |
-
currentNotices.current = notices;
|
21 |
-
}, [ notices ] );
|
22 |
-
|
23 |
-
const noticesApi = useMemo(
|
24 |
-
() => ( {
|
25 |
-
removeNotices: ( status = null ) => {
|
26 |
-
currentNotices.current.forEach( ( notice ) => {
|
27 |
-
if ( status === null || notice.status === status ) {
|
28 |
-
removeSnackbarNotice( notice.id );
|
29 |
-
}
|
30 |
-
} );
|
31 |
-
},
|
32 |
-
removeSnackbarNotice,
|
33 |
-
} ),
|
34 |
-
[ removeSnackbarNotice ]
|
35 |
-
);
|
36 |
-
|
37 |
-
const noticeCreators = useMemo(
|
38 |
-
() => ( {
|
39 |
-
addSnackbarNotice: ( text, noticeProps = {} ) => {
|
40 |
-
createSnackbarNotice( text, noticeProps );
|
41 |
-
},
|
42 |
-
} ),
|
43 |
-
[ createSnackbarNotice ]
|
44 |
-
);
|
45 |
-
|
46 |
-
return {
|
47 |
-
notices,
|
48 |
-
...noticesApi,
|
49 |
-
...noticeCreators,
|
50 |
-
setIsSuppressed,
|
51 |
-
};
|
52 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/context/providers/store-snackbar-notices/components/snackbar-notices-container.js
CHANGED
@@ -1,18 +1,33 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { SnackbarList } from 'wordpress-components';
|
5 |
import classnames from 'classnames';
|
6 |
import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout';
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
const EMPTY_SNACKBAR_NOTICES = {};
|
9 |
|
10 |
-
const SnackbarNoticesContainer = ( {
|
11 |
className,
|
12 |
-
|
13 |
-
removeNotice,
|
14 |
-
isEditor,
|
15 |
} ) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
if ( isEditor ) {
|
17 |
return null;
|
18 |
}
|
@@ -47,9 +62,24 @@ const SnackbarNoticesContainer = ( {
|
|
47 |
<SnackbarList
|
48 |
notices={ visibleNotices }
|
49 |
className={ wrapperClass }
|
50 |
-
onRemove={
|
|
|
|
|
|
|
|
|
51 |
/>
|
52 |
);
|
53 |
};
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import PropTypes from 'prop-types';
|
5 |
import { SnackbarList } from 'wordpress-components';
|
6 |
import classnames from 'classnames';
|
7 |
import { __experimentalApplyCheckoutFilter } from '@woocommerce/blocks-checkout';
|
8 |
+
import { useDispatch, useSelect } from '@wordpress/data';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import { useEditorContext } from '../../editor-context';
|
14 |
|
15 |
const EMPTY_SNACKBAR_NOTICES = {};
|
16 |
|
17 |
+
export const SnackbarNoticesContainer = ( {
|
18 |
className,
|
19 |
+
context = 'default',
|
|
|
|
|
20 |
} ) => {
|
21 |
+
const { isEditor } = useEditorContext();
|
22 |
+
|
23 |
+
const { notices } = useSelect( ( select ) => {
|
24 |
+
const store = select( 'core/notices' );
|
25 |
+
return {
|
26 |
+
notices: store.getNotices( context ),
|
27 |
+
};
|
28 |
+
} );
|
29 |
+
const { removeNotice } = useDispatch( 'core/notices' );
|
30 |
+
|
31 |
if ( isEditor ) {
|
32 |
return null;
|
33 |
}
|
62 |
<SnackbarList
|
63 |
notices={ visibleNotices }
|
64 |
className={ wrapperClass }
|
65 |
+
onRemove={ () => {
|
66 |
+
visibleNotices.forEach( ( notice ) =>
|
67 |
+
removeNotice( notice.id, context )
|
68 |
+
);
|
69 |
+
} }
|
70 |
/>
|
71 |
);
|
72 |
};
|
73 |
|
74 |
+
SnackbarNoticesContainer.propTypes = {
|
75 |
+
className: PropTypes.string,
|
76 |
+
notices: PropTypes.arrayOf(
|
77 |
+
PropTypes.shape( {
|
78 |
+
content: PropTypes.string.isRequired,
|
79 |
+
id: PropTypes.string.isRequired,
|
80 |
+
status: PropTypes.string.isRequired,
|
81 |
+
isDismissible: PropTypes.bool,
|
82 |
+
type: PropTypes.oneOf( [ 'default', 'snackbar' ] ),
|
83 |
+
} )
|
84 |
+
),
|
85 |
+
};
|
assets/js/base/context/providers/store-snackbar-notices/context.js
DELETED
@@ -1,125 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import PropTypes from 'prop-types';
|
5 |
-
import {
|
6 |
-
createContext,
|
7 |
-
useContext,
|
8 |
-
useCallback,
|
9 |
-
useState,
|
10 |
-
} from '@wordpress/element';
|
11 |
-
import { useSelect, useDispatch } from '@wordpress/data';
|
12 |
-
import SnackbarNoticesContainer from '@woocommerce/base-context/providers/store-snackbar-notices/components/snackbar-notices-container';
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Internal dependencies
|
16 |
-
*/
|
17 |
-
import { useStoreEvents } from '../../hooks/use-store-events';
|
18 |
-
import { useEditorContext } from '../editor-context';
|
19 |
-
|
20 |
-
/**
|
21 |
-
* @typedef {import('@woocommerce/type-defs/contexts').NoticeContext} NoticeContext
|
22 |
-
* @typedef {import('react')} React
|
23 |
-
*/
|
24 |
-
|
25 |
-
const StoreSnackbarNoticesContext = createContext( {
|
26 |
-
notices: [],
|
27 |
-
createSnackbarNotice: ( content, options ) => void { content, options },
|
28 |
-
removeSnackbarNotice: ( id, ctxt ) => void { id, ctxt },
|
29 |
-
setIsSuppressed: ( val ) => void { val },
|
30 |
-
context: 'wc/core',
|
31 |
-
} );
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Returns the notices context values.
|
35 |
-
*
|
36 |
-
* @return {NoticeContext} The notice context value from the notice context.
|
37 |
-
*/
|
38 |
-
export const useStoreSnackbarNoticesContext = () => {
|
39 |
-
return useContext( StoreSnackbarNoticesContext );
|
40 |
-
};
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Provides an interface for blocks to add notices to the frontend UI.
|
44 |
-
*
|
45 |
-
* Statuses map to https://github.com/WordPress/gutenberg/tree/master/packages/components/src/notice
|
46 |
-
* - Default (no status)
|
47 |
-
* - Error
|
48 |
-
* - Warning
|
49 |
-
* - Info
|
50 |
-
* - Success
|
51 |
-
*
|
52 |
-
* @param {Object} props Incoming props for the component.
|
53 |
-
* @param {React.ReactChildren} props.children The Elements wrapped by this component.
|
54 |
-
* @param {string} props.context The notice context for notices being rendered.
|
55 |
-
*/
|
56 |
-
export const StoreSnackbarNoticesProvider = ( {
|
57 |
-
children,
|
58 |
-
context = 'wc/core',
|
59 |
-
} ) => {
|
60 |
-
const { createNotice, removeNotice } = useDispatch( 'core/notices' );
|
61 |
-
const [ isSuppressed, setIsSuppressed ] = useState( false );
|
62 |
-
const { dispatchStoreEvent } = useStoreEvents();
|
63 |
-
const { isEditor } = useEditorContext();
|
64 |
-
|
65 |
-
const createSnackbarNotice = useCallback(
|
66 |
-
( content = '', options = {} ) => {
|
67 |
-
createNotice( 'default', content, {
|
68 |
-
...options,
|
69 |
-
type: 'snackbar',
|
70 |
-
context: options.context || context,
|
71 |
-
} );
|
72 |
-
dispatchStoreEvent( 'store-notice-create', {
|
73 |
-
status: 'default',
|
74 |
-
content,
|
75 |
-
options,
|
76 |
-
} );
|
77 |
-
},
|
78 |
-
[ createNotice, dispatchStoreEvent, context ]
|
79 |
-
);
|
80 |
-
|
81 |
-
const removeSnackbarNotice = useCallback(
|
82 |
-
( id, ctxt = context ) => {
|
83 |
-
removeNotice( id, ctxt );
|
84 |
-
},
|
85 |
-
[ removeNotice, context ]
|
86 |
-
);
|
87 |
-
|
88 |
-
const { notices } = useSelect(
|
89 |
-
( select ) => {
|
90 |
-
return {
|
91 |
-
notices: select( 'core/notices' ).getNotices( context ),
|
92 |
-
};
|
93 |
-
},
|
94 |
-
[ context ]
|
95 |
-
);
|
96 |
-
|
97 |
-
const contextValue = {
|
98 |
-
notices,
|
99 |
-
createSnackbarNotice,
|
100 |
-
removeSnackbarNotice,
|
101 |
-
context,
|
102 |
-
setIsSuppressed,
|
103 |
-
};
|
104 |
-
|
105 |
-
const snackbarNoticeOutput = isSuppressed ? null : (
|
106 |
-
<SnackbarNoticesContainer
|
107 |
-
notices={ contextValue.notices }
|
108 |
-
removeNotice={ contextValue.removeSnackbarNotice }
|
109 |
-
isEditor={ isEditor }
|
110 |
-
/>
|
111 |
-
);
|
112 |
-
|
113 |
-
return (
|
114 |
-
<StoreSnackbarNoticesContext.Provider value={ contextValue }>
|
115 |
-
{ children }
|
116 |
-
{ snackbarNoticeOutput }
|
117 |
-
</StoreSnackbarNoticesContext.Provider>
|
118 |
-
);
|
119 |
-
};
|
120 |
-
|
121 |
-
StoreSnackbarNoticesProvider.propTypes = {
|
122 |
-
className: PropTypes.string,
|
123 |
-
children: PropTypes.node,
|
124 |
-
context: PropTypes.string,
|
125 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/base/context/providers/store-snackbar-notices/index.ts
CHANGED
@@ -1 +1 @@
|
|
1 |
-
export * from './
|
1 |
+
export * from './components/snackbar-notices-container';
|
assets/js/blocks/cart/block.js
CHANGED
@@ -8,6 +8,7 @@ import LoadingMask from '@woocommerce/base-components/loading-mask';
|
|
8 |
import {
|
9 |
ValidationContextProvider,
|
10 |
StoreNoticesContainer,
|
|
|
11 |
} from '@woocommerce/base-context';
|
12 |
import { CURRENT_USER_IS_ADMIN } from '@woocommerce/settings';
|
13 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
@@ -15,7 +16,6 @@ import { translateJQueryEventToNative } from '@woocommerce/base-utils';
|
|
15 |
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
|
16 |
import {
|
17 |
StoreNoticesProvider,
|
18 |
-
StoreSnackbarNoticesProvider,
|
19 |
CartProvider,
|
20 |
} from '@woocommerce/base-context/providers';
|
21 |
import { SlotFillProvider } from '@woocommerce/blocks-checkout';
|
@@ -86,17 +86,16 @@ const Block = ( { attributes, children, scrollToTop } ) => (
|
|
86 |
}
|
87 |
showErrorMessage={ CURRENT_USER_IS_ADMIN }
|
88 |
>
|
89 |
-
<
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
</StoreSnackbarNoticesProvider>
|
100 |
</BlockErrorBoundary>
|
101 |
);
|
102 |
export default withScrollToTop( Block );
|
8 |
import {
|
9 |
ValidationContextProvider,
|
10 |
StoreNoticesContainer,
|
11 |
+
SnackbarNoticesContainer,
|
12 |
} from '@woocommerce/base-context';
|
13 |
import { CURRENT_USER_IS_ADMIN } from '@woocommerce/settings';
|
14 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
16 |
import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top';
|
17 |
import {
|
18 |
StoreNoticesProvider,
|
|
|
19 |
CartProvider,
|
20 |
} from '@woocommerce/base-context/providers';
|
21 |
import { SlotFillProvider } from '@woocommerce/blocks-checkout';
|
86 |
}
|
87 |
showErrorMessage={ CURRENT_USER_IS_ADMIN }
|
88 |
>
|
89 |
+
<SnackbarNoticesContainer context="wc/cart" />
|
90 |
+
<StoreNoticesProvider>
|
91 |
+
<StoreNoticesContainer context="wc/cart" />
|
92 |
+
<SlotFillProvider>
|
93 |
+
<CartProvider>
|
94 |
+
<Cart attributes={ attributes }>{ children }</Cart>
|
95 |
+
<ScrollOnError scrollToTop={ scrollToTop } />
|
96 |
+
</CartProvider>
|
97 |
+
</SlotFillProvider>
|
98 |
+
</StoreNoticesProvider>
|
|
|
99 |
</BlockErrorBoundary>
|
100 |
);
|
101 |
export default withScrollToTop( Block );
|
assets/js/blocks/checkout/block.tsx
CHANGED
@@ -10,11 +10,9 @@ import {
|
|
10 |
useValidationContext,
|
11 |
ValidationContextProvider,
|
12 |
CheckoutProvider,
|
|
|
13 |
} from '@woocommerce/base-context';
|
14 |
-
import {
|
15 |
-
StoreSnackbarNoticesProvider,
|
16 |
-
StoreNoticesContainer,
|
17 |
-
} from '@woocommerce/base-context/providers';
|
18 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
19 |
import { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';
|
20 |
import { CURRENT_USER_IS_ADMIN, getSetting } from '@woocommerce/settings';
|
@@ -170,34 +168,28 @@ const Block = ( {
|
|
170 |
) }
|
171 |
showErrorMessage={ CURRENT_USER_IS_ADMIN }
|
172 |
>
|
173 |
-
<
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
>
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
</SidebarLayout>
|
196 |
-
</CheckoutProvider>
|
197 |
-
</SlotFillProvider>
|
198 |
-
</ValidationContextProvider>
|
199 |
-
</StoreNoticesProvider>
|
200 |
-
</StoreSnackbarNoticesProvider>
|
201 |
</BlockErrorBoundary>
|
202 |
);
|
203 |
};
|
10 |
useValidationContext,
|
11 |
ValidationContextProvider,
|
12 |
CheckoutProvider,
|
13 |
+
SnackbarNoticesContainer,
|
14 |
} from '@woocommerce/base-context';
|
15 |
+
import { StoreNoticesContainer } from '@woocommerce/base-context/providers';
|
|
|
|
|
|
|
16 |
import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary';
|
17 |
import { SidebarLayout } from '@woocommerce/base-components/sidebar-layout';
|
18 |
import { CURRENT_USER_IS_ADMIN, getSetting } from '@woocommerce/settings';
|
168 |
) }
|
169 |
showErrorMessage={ CURRENT_USER_IS_ADMIN }
|
170 |
>
|
171 |
+
<SnackbarNoticesContainer context="wc/checkout" />
|
172 |
+
<StoreNoticesProvider>
|
173 |
+
<StoreNoticesContainer context="wc/checkout" />
|
174 |
+
<ValidationContextProvider>
|
175 |
+
{ /* SlotFillProvider need to be defined before CheckoutProvider so fills have the SlotFill context ready when they mount. */ }
|
176 |
+
<SlotFillProvider>
|
177 |
+
<CheckoutProvider>
|
178 |
+
<SidebarLayout
|
179 |
+
className={ classnames( 'wc-block-checkout', {
|
180 |
+
'has-dark-controls':
|
181 |
+
attributes.hasDarkControls,
|
182 |
+
} ) }
|
183 |
+
>
|
184 |
+
<Checkout attributes={ attributes }>
|
185 |
+
{ children }
|
186 |
+
</Checkout>
|
187 |
+
<ScrollOnError scrollToTop={ scrollToTop } />
|
188 |
+
</SidebarLayout>
|
189 |
+
</CheckoutProvider>
|
190 |
+
</SlotFillProvider>
|
191 |
+
</ValidationContextProvider>
|
192 |
+
</StoreNoticesProvider>
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
</BlockErrorBoundary>
|
194 |
);
|
195 |
};
|
assets/js/blocks/featured-items/{block-controls.js → block-controls.tsx}
RENAMED
@@ -1,20 +1,75 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import {
|
6 |
AlignmentToolbar,
|
7 |
BlockControls as BlockControlsWrapper,
|
8 |
MediaReplaceFlow,
|
9 |
} from '@wordpress/block-editor';
|
|
|
10 |
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
11 |
import { crop } from '@wordpress/icons';
|
|
|
|
|
12 |
import TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
|
13 |
|
14 |
/**
|
15 |
* Internal dependencies
|
16 |
*/
|
17 |
import { useBackgroundImage } from './use-background-image';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
export const BlockControls = ( {
|
20 |
backgroundImageId,
|
@@ -27,12 +82,12 @@ export const BlockControls = ( {
|
|
27 |
mediaSrc,
|
28 |
setAttributes,
|
29 |
setIsEditingImage,
|
30 |
-
} ) => {
|
31 |
return (
|
32 |
<BlockControlsWrapper>
|
33 |
<AlignmentToolbar
|
34 |
value={ contentAlign }
|
35 |
-
onChange={ ( nextAlign ) => {
|
36 |
setAttributes( { contentAlign: nextAlign } );
|
37 |
} }
|
38 |
/>
|
@@ -48,7 +103,7 @@ export const BlockControls = ( {
|
|
48 |
mediaId={ backgroundImageId }
|
49 |
mediaURL={ mediaSrc }
|
50 |
accept="image/*"
|
51 |
-
onSelect={ ( media ) => {
|
52 |
setAttributes( {
|
53 |
mediaId: media.id,
|
54 |
mediaSrc: media.url,
|
@@ -81,9 +136,12 @@ export const BlockControls = ( {
|
|
81 |
);
|
82 |
};
|
83 |
|
84 |
-
export const withBlockControls = ( {
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
87 |
const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
|
88 |
const { attributes, category, name, product, setAttributes } = props;
|
89 |
const { contentAlign, editMode, mediaId, mediaSrc } = attributes;
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { ComponentType, Dispatch, SetStateAction } from 'react';
|
5 |
import { __ } from '@wordpress/i18n';
|
6 |
import {
|
7 |
AlignmentToolbar,
|
8 |
BlockControls as BlockControlsWrapper,
|
9 |
MediaReplaceFlow,
|
10 |
} from '@wordpress/block-editor';
|
11 |
+
import type { BlockAlignment } from '@wordpress/blocks';
|
12 |
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
13 |
import { crop } from '@wordpress/icons';
|
14 |
+
import { WP_REST_API_Category } from 'wp-types';
|
15 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
16 |
import TextToolbarButton from '@woocommerce/editor-components/text-toolbar-button';
|
17 |
|
18 |
/**
|
19 |
* Internal dependencies
|
20 |
*/
|
21 |
import { useBackgroundImage } from './use-background-image';
|
22 |
+
import { EditorBlock, GenericBlockUIConfig } from './types';
|
23 |
+
|
24 |
+
type Media = { id: number; url: string };
|
25 |
+
|
26 |
+
interface WithBlockControlsRequiredProps< T > {
|
27 |
+
attributes: BlockControlRequiredAttributes &
|
28 |
+
EditorBlock< T >[ 'attributes' ];
|
29 |
+
setAttributes: ( attrs: Partial< BlockControlRequiredAttributes > ) => void;
|
30 |
+
useEditingImage: [ boolean, Dispatch< SetStateAction< boolean > > ];
|
31 |
+
}
|
32 |
+
|
33 |
+
interface WithBlockControlsCategoryProps< T >
|
34 |
+
extends WithBlockControlsRequiredProps< T > {
|
35 |
+
category: WP_REST_API_Category;
|
36 |
+
product: never;
|
37 |
+
}
|
38 |
+
|
39 |
+
interface WithBlockControlsProductProps< T >
|
40 |
+
extends WithBlockControlsRequiredProps< T > {
|
41 |
+
category: never;
|
42 |
+
product: ProductResponseItem;
|
43 |
+
}
|
44 |
+
|
45 |
+
type WithBlockControlsProps< T extends EditorBlock< T > > =
|
46 |
+
| ( T & WithBlockControlsCategoryProps< T > )
|
47 |
+
| ( T & WithBlockControlsProductProps< T > );
|
48 |
+
|
49 |
+
type BlockControlRequiredAttributes = {
|
50 |
+
contentAlign: BlockAlignment;
|
51 |
+
editMode: boolean;
|
52 |
+
mediaId: number;
|
53 |
+
mediaSrc: string;
|
54 |
+
};
|
55 |
+
|
56 |
+
interface BlockControlsProps {
|
57 |
+
backgroundImageId: number;
|
58 |
+
backgroundImageSrc: string;
|
59 |
+
contentAlign: BlockAlignment;
|
60 |
+
cropLabel: string;
|
61 |
+
editLabel: string;
|
62 |
+
editMode: boolean;
|
63 |
+
isEditingImage: boolean;
|
64 |
+
mediaSrc: string;
|
65 |
+
setAttributes: ( attrs: Partial< BlockControlRequiredAttributes > ) => void;
|
66 |
+
setIsEditingImage: ( value: boolean ) => void;
|
67 |
+
}
|
68 |
+
|
69 |
+
interface BlockControlsConfiguration extends GenericBlockUIConfig {
|
70 |
+
cropLabel: string;
|
71 |
+
editLabel: string;
|
72 |
+
}
|
73 |
|
74 |
export const BlockControls = ( {
|
75 |
backgroundImageId,
|
82 |
mediaSrc,
|
83 |
setAttributes,
|
84 |
setIsEditingImage,
|
85 |
+
}: BlockControlsProps ) => {
|
86 |
return (
|
87 |
<BlockControlsWrapper>
|
88 |
<AlignmentToolbar
|
89 |
value={ contentAlign }
|
90 |
+
onChange={ ( nextAlign: BlockAlignment ) => {
|
91 |
setAttributes( { contentAlign: nextAlign } );
|
92 |
} }
|
93 |
/>
|
103 |
mediaId={ backgroundImageId }
|
104 |
mediaURL={ mediaSrc }
|
105 |
accept="image/*"
|
106 |
+
onSelect={ ( media: Media ) => {
|
107 |
setAttributes( {
|
108 |
mediaId: media.id,
|
109 |
mediaSrc: media.url,
|
136 |
);
|
137 |
};
|
138 |
|
139 |
+
export const withBlockControls = ( {
|
140 |
+
cropLabel,
|
141 |
+
editLabel,
|
142 |
+
}: BlockControlsConfiguration ) => < T extends EditorBlock< T > >(
|
143 |
+
Component: ComponentType< T >
|
144 |
+
) => ( props: WithBlockControlsProps< T > ) => {
|
145 |
const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
|
146 |
const { attributes, category, name, product, setAttributes } = props;
|
147 |
const { contentAlign, editMode, mediaId, mediaSrc } = attributes;
|
assets/js/blocks/featured-items/{call-to-action.js → call-to-action.tsx}
RENAMED
@@ -5,7 +5,17 @@ import classnames from 'classnames';
|
|
5 |
import { RichText, InnerBlocks } from '@wordpress/block-editor';
|
6 |
import { __ } from '@wordpress/i18n';
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
const buttonClasses = classnames(
|
10 |
'wp-block-button__link',
|
11 |
'is-style-fill'
|
5 |
import { RichText, InnerBlocks } from '@wordpress/block-editor';
|
6 |
import { __ } from '@wordpress/i18n';
|
7 |
|
8 |
+
interface CallToActionProps {
|
9 |
+
itemId: number | 'preview';
|
10 |
+
linkText: string;
|
11 |
+
permalink: string;
|
12 |
+
}
|
13 |
+
|
14 |
+
export const CallToAction = ( {
|
15 |
+
itemId,
|
16 |
+
linkText,
|
17 |
+
permalink,
|
18 |
+
}: CallToActionProps ) => {
|
19 |
const buttonClasses = classnames(
|
20 |
'wp-block-button__link',
|
21 |
'is-style-fill'
|
assets/js/blocks/featured-items/{constants.js → constants.ts}
RENAMED
@@ -1,9 +1,9 @@
|
|
1 |
export const DEFAULT_EDITOR_SIZE = {
|
2 |
height: 500,
|
3 |
width: 500,
|
4 |
-
};
|
5 |
|
6 |
export const BLOCK_NAMES = {
|
7 |
featuredCategory: 'woocommerce/featured-category',
|
8 |
featuredProduct: 'woocommerce/featured-product',
|
9 |
-
};
|
1 |
export const DEFAULT_EDITOR_SIZE = {
|
2 |
height: 500,
|
3 |
width: 500,
|
4 |
+
} as const;
|
5 |
|
6 |
export const BLOCK_NAMES = {
|
7 |
featuredCategory: 'woocommerce/featured-category',
|
8 |
featuredProduct: 'woocommerce/featured-product',
|
9 |
+
} as const;
|
assets/js/blocks/featured-items/{constrained-resizable.js → constrained-resizable.tsx}
RENAMED
@@ -10,20 +10,22 @@ import { ResizableBox } from '@wordpress/components';
|
|
10 |
*/
|
11 |
import { useThrottle } from '../../utils/useThrottle';
|
12 |
|
|
|
|
|
13 |
export const ConstrainedResizable = ( {
|
14 |
className = '',
|
15 |
onResize,
|
16 |
...props
|
17 |
-
} ) => {
|
18 |
const [ isResizing, setIsResizing ] = useState( false );
|
19 |
|
20 |
const classNames = classnames( className, {
|
21 |
'is-resizing': isResizing,
|
22 |
} );
|
23 |
-
const throttledResize = useThrottle(
|
24 |
-
( event, direction, elt ) => {
|
25 |
if ( ! isResizing ) setIsResizing( true );
|
26 |
-
onResize( event, direction, elt );
|
27 |
},
|
28 |
50,
|
29 |
{ leading: true }
|
@@ -35,7 +37,7 @@ export const ConstrainedResizable = ( {
|
|
35 |
enable={ { bottom: true } }
|
36 |
onResize={ throttledResize }
|
37 |
onResizeStop={ ( ...args ) => {
|
38 |
-
onResize( ...args );
|
39 |
setIsResizing( false );
|
40 |
} }
|
41 |
{ ...props }
|
10 |
*/
|
11 |
import { useThrottle } from '../../utils/useThrottle';
|
12 |
|
13 |
+
type ResizeCallback = Exclude< ResizableBox.Props[ 'onResize' ], undefined >;
|
14 |
+
|
15 |
export const ConstrainedResizable = ( {
|
16 |
className = '',
|
17 |
onResize,
|
18 |
...props
|
19 |
+
}: ResizableBox.Props ): JSX.Element => {
|
20 |
const [ isResizing, setIsResizing ] = useState( false );
|
21 |
|
22 |
const classNames = classnames( className, {
|
23 |
'is-resizing': isResizing,
|
24 |
} );
|
25 |
+
const throttledResize = useThrottle< ResizeCallback >(
|
26 |
+
( event, direction, elt, _delta ) => {
|
27 |
if ( ! isResizing ) setIsResizing( true );
|
28 |
+
onResize?.( event, direction, elt, _delta );
|
29 |
},
|
30 |
50,
|
31 |
{ leading: true }
|
37 |
enable={ { bottom: true } }
|
38 |
onResize={ throttledResize }
|
39 |
onResizeStop={ ( ...args ) => {
|
40 |
+
onResize?.( ...args );
|
41 |
setIsResizing( false );
|
42 |
} }
|
43 |
{ ...props }
|
assets/js/blocks/featured-items/featured-category/block.json
CHANGED
@@ -1,96 +1,110 @@
|
|
1 |
{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
},
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
"default": true
|
92 |
-
}
|
93 |
-
},
|
94 |
-
"textdomain": "woo-gutenberg-products-block",
|
95 |
-
"apiVersion": 2
|
96 |
}
|
1 |
{
|
2 |
+
"name": "woocommerce/featured-category",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"title": "Featured Category",
|
5 |
+
"category": "woocommerce",
|
6 |
+
"keywords": [ "WooCommerce" ],
|
7 |
+
"description": "Visually highlight a product category and encourage prompt action.",
|
8 |
+
"supports": {
|
9 |
+
"align": [ "wide", "full" ],
|
10 |
+
"html": false,
|
11 |
+
"color": {
|
12 |
+
"background": true,
|
13 |
+
"text": true,
|
14 |
+
"__experimentalDuotone": ".wc-block-featured-category__background-image"
|
15 |
+
},
|
16 |
+
"spacing": {
|
17 |
+
"padding": true,
|
18 |
+
"__experimentalDefaultControls": {
|
19 |
+
"padding": true
|
20 |
+
},
|
21 |
+
"__experimentalSkipSerialization": true
|
22 |
+
},
|
23 |
+
"__experimentalBorder": {
|
24 |
+
"color": true,
|
25 |
+
"radius": true,
|
26 |
+
"width": true,
|
27 |
+
"__experimentalSkipSerialization": true
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"attributes": {
|
31 |
+
"alt": {
|
32 |
+
"type": "string",
|
33 |
+
"default": ""
|
34 |
+
},
|
35 |
+
"contentAlign": {
|
36 |
+
"type": "string",
|
37 |
+
"default": "center"
|
38 |
+
},
|
39 |
+
"dimRatio": {
|
40 |
+
"type": "number",
|
41 |
+
"default": 50
|
42 |
+
},
|
43 |
+
"editMode": {
|
44 |
+
"type": "boolean",
|
45 |
+
"default": true
|
46 |
+
},
|
47 |
+
"focalPoint": {
|
48 |
+
"type": "object",
|
49 |
+
"default": {
|
50 |
+
"x": 0.5,
|
51 |
+
"y": 0.5
|
52 |
+
}
|
53 |
},
|
54 |
+
"imageFit": {
|
55 |
+
"type": "string",
|
56 |
+
"default": "none"
|
57 |
+
},
|
58 |
+
"hasParallax": {
|
59 |
+
"type": "boolean",
|
60 |
+
"default": false
|
61 |
+
},
|
62 |
+
"isRepeated": {
|
63 |
+
"type": "boolean",
|
64 |
+
"default": false
|
65 |
+
},
|
66 |
+
"mediaId": {
|
67 |
+
"type": "number",
|
68 |
+
"default": 0
|
69 |
+
},
|
70 |
+
"mediaSrc": {
|
71 |
+
"type": "string",
|
72 |
+
"default": ""
|
73 |
+
},
|
74 |
+
"minHeight": {
|
75 |
+
"type": "number",
|
76 |
+
"default": 500
|
77 |
+
},
|
78 |
+
"linkText": {
|
79 |
+
"type": "string"
|
80 |
+
},
|
81 |
+
"categoryId": {
|
82 |
+
"type": "number"
|
83 |
+
},
|
84 |
+
"overlayColor": {
|
85 |
+
"type": "string",
|
86 |
+
"default": "#000000"
|
87 |
+
},
|
88 |
+
"overlayGradient": {
|
89 |
+
"type": "string"
|
90 |
+
},
|
91 |
+
"previewCategory": {
|
92 |
+
"type": "object",
|
93 |
+
"default": null
|
94 |
+
},
|
95 |
+
"showDesc": {
|
96 |
+
"type": "boolean",
|
97 |
+
"default": true
|
98 |
+
},
|
99 |
+
"style": {
|
100 |
+
"type": "object",
|
101 |
+
"default": {
|
102 |
+
"color": {
|
103 |
+
"text": "#ffffff"
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
},
|
108 |
+
"textdomain": "woo-gutenberg-products-block",
|
109 |
+
"apiVersion": 2
|
|
|
|
|
|
|
|
|
|
|
110 |
}
|
assets/js/blocks/featured-items/featured-category/{block.js → block.tsx}
RENAMED
@@ -3,9 +3,7 @@
|
|
3 |
*/
|
4 |
import { withCategory } from '@woocommerce/block-hocs';
|
5 |
import { withSpokenMessages } from '@wordpress/components';
|
6 |
-
import { compose
|
7 |
-
import { withSelect } from '@wordpress/data';
|
8 |
-
import { Component } from '@wordpress/element';
|
9 |
import { __ } from '@wordpress/i18n';
|
10 |
import { folderStarred } from '@woocommerce/icons';
|
11 |
|
@@ -19,6 +17,7 @@ import { withApiError } from '../with-api-error';
|
|
19 |
import { withEditMode } from '../with-edit-mode';
|
20 |
import { withEditingImage } from '../with-editing-image';
|
21 |
import { withFeaturedItem } from '../with-featured-item';
|
|
|
22 |
|
23 |
const GENERIC_CONFIG = {
|
24 |
icon: folderStarred,
|
@@ -26,6 +25,7 @@ const GENERIC_CONFIG = {
|
|
26 |
};
|
27 |
|
28 |
const BLOCK_CONTROL_CONFIG = {
|
|
|
29 |
cropLabel: __( 'Edit category image', 'woo-gutenberg-products-block' ),
|
30 |
editLabel: __( 'Edit selected category', 'woo-gutenberg-products-block' ),
|
31 |
};
|
@@ -53,61 +53,7 @@ const EDIT_MODE_CONFIG = {
|
|
53 |
export default compose( [
|
54 |
withCategory,
|
55 |
withSpokenMessages,
|
56 |
-
|
57 |
-
const Block = select( 'core/block-editor' ).getBlock( clientId );
|
58 |
-
const buttonBlockId = Block?.innerBlocks[ 0 ]?.clientId || '';
|
59 |
-
const currentButtonAttributes =
|
60 |
-
Block?.innerBlocks[ 0 ]?.attributes || {};
|
61 |
-
const updateBlockAttributes = ( attributes ) => {
|
62 |
-
if ( buttonBlockId ) {
|
63 |
-
dispatch( 'core/block-editor' ).updateBlockAttributes(
|
64 |
-
buttonBlockId,
|
65 |
-
attributes
|
66 |
-
);
|
67 |
-
}
|
68 |
-
};
|
69 |
-
return { updateBlockAttributes, currentButtonAttributes };
|
70 |
-
} ),
|
71 |
-
createHigherOrderComponent( ( ProductComponent ) => {
|
72 |
-
class WrappedComponent extends Component {
|
73 |
-
state = {
|
74 |
-
doUrlUpdate: false,
|
75 |
-
};
|
76 |
-
componentDidUpdate() {
|
77 |
-
const {
|
78 |
-
attributes,
|
79 |
-
updateBlockAttributes,
|
80 |
-
currentButtonAttributes,
|
81 |
-
category,
|
82 |
-
} = this.props;
|
83 |
-
if (
|
84 |
-
this.state.doUrlUpdate &&
|
85 |
-
! attributes.editMode &&
|
86 |
-
category?.permalink &&
|
87 |
-
currentButtonAttributes?.url &&
|
88 |
-
category.permalink !== currentButtonAttributes.url
|
89 |
-
) {
|
90 |
-
updateBlockAttributes( {
|
91 |
-
...currentButtonAttributes,
|
92 |
-
url: category.permalink,
|
93 |
-
} );
|
94 |
-
this.setState( { doUrlUpdate: false } );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
triggerUrlUpdate = () => {
|
98 |
-
this.setState( { doUrlUpdate: true } );
|
99 |
-
};
|
100 |
-
render() {
|
101 |
-
return (
|
102 |
-
<ProductComponent
|
103 |
-
triggerUrlUpdate={ this.triggerUrlUpdate }
|
104 |
-
{ ...this.props }
|
105 |
-
/>
|
106 |
-
);
|
107 |
-
}
|
108 |
-
}
|
109 |
-
return WrappedComponent;
|
110 |
-
}, 'withUpdateButtonAttributes' ),
|
111 |
withEditingImage,
|
112 |
withEditMode( EDIT_MODE_CONFIG ),
|
113 |
withFeaturedItem( CONTENT_CONFIG ),
|
3 |
*/
|
4 |
import { withCategory } from '@woocommerce/block-hocs';
|
5 |
import { withSpokenMessages } from '@wordpress/components';
|
6 |
+
import { compose } from '@wordpress/compose';
|
|
|
|
|
7 |
import { __ } from '@wordpress/i18n';
|
8 |
import { folderStarred } from '@woocommerce/icons';
|
9 |
|
17 |
import { withEditMode } from '../with-edit-mode';
|
18 |
import { withEditingImage } from '../with-editing-image';
|
19 |
import { withFeaturedItem } from '../with-featured-item';
|
20 |
+
import { withUpdateButtonAttributes } from '../with-update-button-attributes';
|
21 |
|
22 |
const GENERIC_CONFIG = {
|
23 |
icon: folderStarred,
|
25 |
};
|
26 |
|
27 |
const BLOCK_CONTROL_CONFIG = {
|
28 |
+
...GENERIC_CONFIG,
|
29 |
cropLabel: __( 'Edit category image', 'woo-gutenberg-products-block' ),
|
30 |
editLabel: __( 'Edit selected category', 'woo-gutenberg-products-block' ),
|
31 |
};
|
53 |
export default compose( [
|
54 |
withCategory,
|
55 |
withSpokenMessages,
|
56 |
+
withUpdateButtonAttributes,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
withEditingImage,
|
58 |
withEditMode( EDIT_MODE_CONFIG ),
|
59 |
withFeaturedItem( CONTENT_CONFIG ),
|
assets/js/blocks/featured-items/featured-category/example.js
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { previewCategories } from '@woocommerce/resource-previews';
|
5 |
-
|
6 |
-
export const example = {
|
7 |
-
attributes: {
|
8 |
-
categoryId: 'preview',
|
9 |
-
previewCategory: previewCategories[ 0 ],
|
10 |
-
},
|
11 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/featured-category/example.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { previewCategories } from '@woocommerce/resource-previews';
|
5 |
+
import type { Block } from '@wordpress/blocks';
|
6 |
+
|
7 |
+
type ExampleBlock = Block[ 'example' ] & {
|
8 |
+
attributes: {
|
9 |
+
categoryId: 'preview' | number;
|
10 |
+
previewCategory: typeof previewCategories[ number ];
|
11 |
+
};
|
12 |
+
};
|
13 |
+
|
14 |
+
export const example: ExampleBlock = {
|
15 |
+
attributes: {
|
16 |
+
categoryId: 'preview',
|
17 |
+
previewCategory: previewCategories[ 0 ],
|
18 |
+
},
|
19 |
+
} as const;
|
assets/js/blocks/featured-items/featured-category/utils.js
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { isObject } from 'lodash';
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Get the src from a category object, unless null (no image).
|
8 |
-
*
|
9 |
-
* @param {Object|null} category A product category object from the API.
|
10 |
-
* @return {string} The src of the category image.
|
11 |
-
*/
|
12 |
-
function getCategoryImageSrc( category ) {
|
13 |
-
if ( category && isObject( category.image ) ) {
|
14 |
-
return category.image.src;
|
15 |
-
}
|
16 |
-
return '';
|
17 |
-
}
|
18 |
-
|
19 |
-
/**
|
20 |
-
* Get the attachment ID from a category object, unless null (no image).
|
21 |
-
*
|
22 |
-
* @param {Object|null} category A product category object from the API.
|
23 |
-
* @return {number} The id of the category image.
|
24 |
-
*/
|
25 |
-
function getCategoryImageId( category ) {
|
26 |
-
if ( category && isObject( category.image ) ) {
|
27 |
-
return category.image.id;
|
28 |
-
}
|
29 |
-
return 0;
|
30 |
-
}
|
31 |
-
|
32 |
-
export { getCategoryImageSrc, getCategoryImageId };
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/featured-category/utils.ts
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { WP_REST_API_Category } from 'wp-types';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import { isImageObject } from '../types';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Get the src from a category object, unless null (no image).
|
13 |
+
*/
|
14 |
+
export function getCategoryImageSrc( category: WP_REST_API_Category ) {
|
15 |
+
if ( category && isImageObject( category.image ) ) {
|
16 |
+
return category.image.src;
|
17 |
+
}
|
18 |
+
return '';
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Get the attachment ID from a category object, unless null (no image).
|
23 |
+
*/
|
24 |
+
export function getCategoryImageId( category: WP_REST_API_Category ) {
|
25 |
+
if ( category && isImageObject( category.image ) ) {
|
26 |
+
return category.image.id;
|
27 |
+
}
|
28 |
+
return 0;
|
29 |
+
}
|
assets/js/blocks/featured-items/featured-product/block.json
CHANGED
@@ -1,108 +1,116 @@
|
|
1 |
{
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
},
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
"default": null
|
96 |
-
},
|
97 |
-
"showDesc": {
|
98 |
-
"type": "boolean",
|
99 |
-
"default": true
|
100 |
-
},
|
101 |
-
"showPrice": {
|
102 |
-
"type": "boolean",
|
103 |
-
"default": true
|
104 |
-
}
|
105 |
-
},
|
106 |
-
"textdomain": "woo-gutenberg-products-block",
|
107 |
-
"apiVersion": 2
|
108 |
}
|
1 |
{
|
2 |
+
"name": "woocommerce/featured-product",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"title": "Featured Product",
|
5 |
+
"description": "Visually highlight a product or variation and encourage prompt action.",
|
6 |
+
"category": "woocommerce",
|
7 |
+
"keywords": [ "WooCommerce" ],
|
8 |
+
"supports": {
|
9 |
+
"align": [ "wide", "full" ],
|
10 |
+
"html": false,
|
11 |
+
"color": {
|
12 |
+
"background": true,
|
13 |
+
"text": true,
|
14 |
+
"__experimentalDuotone": ".wc-block-featured-product__background-image"
|
15 |
+
},
|
16 |
+
"spacing": {
|
17 |
+
"padding": true,
|
18 |
+
"__experimentalDefaultControls": {
|
19 |
+
"padding": true
|
20 |
+
},
|
21 |
+
"__experimentalSkipSerialization": true
|
22 |
+
},
|
23 |
+
"__experimentalBorder": {
|
24 |
+
"color": true,
|
25 |
+
"radius": true,
|
26 |
+
"width": true,
|
27 |
+
"__experimentalSkipSerialization": true
|
28 |
+
},
|
29 |
+
"multiple": true
|
30 |
+
},
|
31 |
+
"attributes": {
|
32 |
+
"alt": {
|
33 |
+
"type": "string",
|
34 |
+
"default": ""
|
35 |
+
},
|
36 |
+
"contentAlign": {
|
37 |
+
"type": "string",
|
38 |
+
"default": "center"
|
39 |
+
},
|
40 |
+
"dimRatio": {
|
41 |
+
"type": "number",
|
42 |
+
"default": 50
|
43 |
+
},
|
44 |
+
"editMode": {
|
45 |
+
"type": "boolean",
|
46 |
+
"default": true
|
47 |
+
},
|
48 |
+
"focalPoint": {
|
49 |
+
"type": "object",
|
50 |
+
"default": {
|
51 |
+
"x": 0.5,
|
52 |
+
"y": 0.5
|
53 |
+
}
|
54 |
},
|
55 |
+
"imageFit": {
|
56 |
+
"type": "string",
|
57 |
+
"default": "none"
|
58 |
+
},
|
59 |
+
"hasParallax": {
|
60 |
+
"type": "boolean",
|
61 |
+
"default": false
|
62 |
+
},
|
63 |
+
"isRepeated": {
|
64 |
+
"type": "boolean",
|
65 |
+
"default": false
|
66 |
+
},
|
67 |
+
"mediaId": {
|
68 |
+
"type": "number",
|
69 |
+
"default": 0
|
70 |
+
},
|
71 |
+
"mediaSrc": {
|
72 |
+
"type": "string",
|
73 |
+
"default": ""
|
74 |
+
},
|
75 |
+
"minHeight": {
|
76 |
+
"type": "number",
|
77 |
+
"default": 500
|
78 |
+
},
|
79 |
+
"linkText": {
|
80 |
+
"type": "string",
|
81 |
+
"default": "Shop now"
|
82 |
+
},
|
83 |
+
"overlayColor": {
|
84 |
+
"type": "string",
|
85 |
+
"default": "#000000"
|
86 |
+
},
|
87 |
+
"overlayGradient": {
|
88 |
+
"type": "string"
|
89 |
+
},
|
90 |
+
"productId": {
|
91 |
+
"type": "number"
|
92 |
+
},
|
93 |
+
"previewProduct": {
|
94 |
+
"type": "object",
|
95 |
+
"default": null
|
96 |
+
},
|
97 |
+
"showDesc": {
|
98 |
+
"type": "boolean",
|
99 |
+
"default": true
|
100 |
+
},
|
101 |
+
"showPrice": {
|
102 |
+
"type": "boolean",
|
103 |
+
"default": true
|
104 |
+
},
|
105 |
+
"style": {
|
106 |
+
"type": "object",
|
107 |
+
"default": {
|
108 |
+
"color": {
|
109 |
+
"text": "#ffffff"
|
110 |
+
}
|
111 |
+
}
|
112 |
+
}
|
113 |
+
},
|
114 |
+
"textdomain": "woo-gutenberg-products-block",
|
115 |
+
"apiVersion": 2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
assets/js/blocks/featured-items/featured-product/{block.js → block.tsx}
RENAMED
@@ -3,9 +3,7 @@
|
|
3 |
*/
|
4 |
import { withProduct } from '@woocommerce/block-hocs';
|
5 |
import { withSpokenMessages } from '@wordpress/components';
|
6 |
-
import { compose
|
7 |
-
import { withSelect } from '@wordpress/data';
|
8 |
-
import { Component } from '@wordpress/element';
|
9 |
import { __ } from '@wordpress/i18n';
|
10 |
import { starEmpty } from '@wordpress/icons';
|
11 |
|
@@ -19,6 +17,7 @@ import { withApiError } from '../with-api-error';
|
|
19 |
import { withEditMode } from '../with-edit-mode';
|
20 |
import { withEditingImage } from '../with-editing-image';
|
21 |
import { withFeaturedItem } from '../with-featured-item';
|
|
|
22 |
|
23 |
const GENERIC_CONFIG = {
|
24 |
icon: starEmpty,
|
@@ -26,6 +25,7 @@ const GENERIC_CONFIG = {
|
|
26 |
};
|
27 |
|
28 |
const BLOCK_CONTROL_CONFIG = {
|
|
|
29 |
cropLabel: __( 'Edit product image', 'woo-gutenberg-products-block' ),
|
30 |
editLabel: __( 'Edit selected product', 'woo-gutenberg-products-block' ),
|
31 |
};
|
@@ -53,61 +53,7 @@ const EDIT_MODE_CONFIG = {
|
|
53 |
export default compose( [
|
54 |
withProduct,
|
55 |
withSpokenMessages,
|
56 |
-
|
57 |
-
const Block = select( 'core/block-editor' ).getBlock( clientId );
|
58 |
-
const buttonBlockId = Block?.innerBlocks[ 0 ]?.clientId || '';
|
59 |
-
const currentButtonAttributes =
|
60 |
-
Block?.innerBlocks[ 0 ]?.attributes || {};
|
61 |
-
const updateBlockAttributes = ( attributes ) => {
|
62 |
-
if ( buttonBlockId ) {
|
63 |
-
dispatch( 'core/block-editor' ).updateBlockAttributes(
|
64 |
-
buttonBlockId,
|
65 |
-
attributes
|
66 |
-
);
|
67 |
-
}
|
68 |
-
};
|
69 |
-
return { updateBlockAttributes, currentButtonAttributes };
|
70 |
-
} ),
|
71 |
-
createHigherOrderComponent( ( ProductComponent ) => {
|
72 |
-
class WrappedComponent extends Component {
|
73 |
-
state = {
|
74 |
-
doUrlUpdate: false,
|
75 |
-
};
|
76 |
-
componentDidUpdate() {
|
77 |
-
const {
|
78 |
-
attributes,
|
79 |
-
updateBlockAttributes,
|
80 |
-
currentButtonAttributes,
|
81 |
-
product,
|
82 |
-
} = this.props;
|
83 |
-
if (
|
84 |
-
this.state.doUrlUpdate &&
|
85 |
-
! attributes.editMode &&
|
86 |
-
product?.permalink &&
|
87 |
-
currentButtonAttributes?.url &&
|
88 |
-
product.permalink !== currentButtonAttributes.url
|
89 |
-
) {
|
90 |
-
updateBlockAttributes( {
|
91 |
-
...currentButtonAttributes,
|
92 |
-
url: product.permalink,
|
93 |
-
} );
|
94 |
-
this.setState( { doUrlUpdate: false } );
|
95 |
-
}
|
96 |
-
}
|
97 |
-
triggerUrlUpdate = () => {
|
98 |
-
this.setState( { doUrlUpdate: true } );
|
99 |
-
};
|
100 |
-
render() {
|
101 |
-
return (
|
102 |
-
<ProductComponent
|
103 |
-
triggerUrlUpdate={ this.triggerUrlUpdate }
|
104 |
-
{ ...this.props }
|
105 |
-
/>
|
106 |
-
);
|
107 |
-
}
|
108 |
-
}
|
109 |
-
return WrappedComponent;
|
110 |
-
}, 'withUpdateButtonAttributes' ),
|
111 |
withEditingImage,
|
112 |
withEditMode( EDIT_MODE_CONFIG ),
|
113 |
withFeaturedItem( CONTENT_CONFIG ),
|
3 |
*/
|
4 |
import { withProduct } from '@woocommerce/block-hocs';
|
5 |
import { withSpokenMessages } from '@wordpress/components';
|
6 |
+
import { compose } from '@wordpress/compose';
|
|
|
|
|
7 |
import { __ } from '@wordpress/i18n';
|
8 |
import { starEmpty } from '@wordpress/icons';
|
9 |
|
17 |
import { withEditMode } from '../with-edit-mode';
|
18 |
import { withEditingImage } from '../with-editing-image';
|
19 |
import { withFeaturedItem } from '../with-featured-item';
|
20 |
+
import { withUpdateButtonAttributes } from '../with-update-button-attributes';
|
21 |
|
22 |
const GENERIC_CONFIG = {
|
23 |
icon: starEmpty,
|
25 |
};
|
26 |
|
27 |
const BLOCK_CONTROL_CONFIG = {
|
28 |
+
...GENERIC_CONFIG,
|
29 |
cropLabel: __( 'Edit product image', 'woo-gutenberg-products-block' ),
|
30 |
editLabel: __( 'Edit selected product', 'woo-gutenberg-products-block' ),
|
31 |
};
|
53 |
export default compose( [
|
54 |
withProduct,
|
55 |
withSpokenMessages,
|
56 |
+
withUpdateButtonAttributes,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
withEditingImage,
|
58 |
withEditMode( EDIT_MODE_CONFIG ),
|
59 |
withFeaturedItem( CONTENT_CONFIG ),
|
assets/js/blocks/featured-items/featured-product/example.js
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { previewProducts } from '@woocommerce/resource-previews';
|
5 |
-
|
6 |
-
export const example = {
|
7 |
-
attributes: {
|
8 |
-
productId: 'preview',
|
9 |
-
previewProduct: previewProducts[ 0 ],
|
10 |
-
},
|
11 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/featured-product/example.ts
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { previewProducts } from '@woocommerce/resource-previews';
|
5 |
+
import type { Block } from '@wordpress/blocks';
|
6 |
+
|
7 |
+
type ExampleBlock = Block[ 'example' ] & {
|
8 |
+
attributes: {
|
9 |
+
productId: 'preview' | number;
|
10 |
+
previewProduct: typeof previewProducts[ number ];
|
11 |
+
};
|
12 |
+
};
|
13 |
+
|
14 |
+
export const example: ExampleBlock = {
|
15 |
+
attributes: {
|
16 |
+
productId: 'preview',
|
17 |
+
previewProduct: previewProducts[ 0 ],
|
18 |
+
},
|
19 |
+
} as const;
|
assets/js/blocks/featured-items/{image-editor.js → image-editor.tsx}
RENAMED
@@ -3,6 +3,9 @@
|
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
|
|
|
|
|
|
6 |
import {
|
7 |
__experimentalImageEditingProvider as ImageEditingProvider,
|
8 |
__experimentalImageEditor as GutenbergImageEditor,
|
@@ -12,8 +15,44 @@ import {
|
|
12 |
* Internal dependencies
|
13 |
*/
|
14 |
import { BLOCK_NAMES, DEFAULT_EDITOR_SIZE } from './constants';
|
|
|
15 |
import { useBackgroundImage } from './use-background-image';
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
export const ImageEditor = ( {
|
18 |
backgroundImageId,
|
19 |
backgroundImageSize,
|
@@ -21,7 +60,7 @@ export const ImageEditor = ( {
|
|
21 |
isEditingImage,
|
22 |
setAttributes,
|
23 |
setIsEditingImage,
|
24 |
-
} ) => {
|
25 |
return (
|
26 |
<>
|
27 |
<ImageEditingProvider
|
@@ -33,7 +72,7 @@ export const ImageEditor = ( {
|
|
33 |
naturalWidth={
|
34 |
backgroundImageSize.width || DEFAULT_EDITOR_SIZE.width
|
35 |
}
|
36 |
-
onSaveImage={ ( { id, url } ) => {
|
37 |
setAttributes( { mediaId: id, mediaSrc: url } );
|
38 |
} }
|
39 |
isEditing={ isEditingImage }
|
@@ -53,7 +92,9 @@ export const ImageEditor = ( {
|
|
53 |
);
|
54 |
};
|
55 |
|
56 |
-
export const withImageEditor =
|
|
|
|
|
57 |
const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
|
58 |
|
59 |
const { attributes, backgroundImageSize, name, setAttributes } = props;
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
6 |
+
import { ComponentType, Dispatch, SetStateAction } from 'react';
|
7 |
+
import { WP_REST_API_Category } from 'wp-types';
|
8 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
9 |
import {
|
10 |
__experimentalImageEditingProvider as ImageEditingProvider,
|
11 |
__experimentalImageEditor as GutenbergImageEditor,
|
15 |
* Internal dependencies
|
16 |
*/
|
17 |
import { BLOCK_NAMES, DEFAULT_EDITOR_SIZE } from './constants';
|
18 |
+
import { EditorBlock } from './types';
|
19 |
import { useBackgroundImage } from './use-background-image';
|
20 |
|
21 |
+
type MediaAttributes = { mediaId: number; mediaSrc: string };
|
22 |
+
type MediaSize = { height: number; width: number };
|
23 |
+
|
24 |
+
interface WithImageEditorRequiredProps< T > {
|
25 |
+
attributes: MediaAttributes & EditorBlock< T >[ 'attributes' ];
|
26 |
+
backgroundImageSize: MediaSize;
|
27 |
+
setAttributes: ( attrs: Partial< MediaAttributes > ) => void;
|
28 |
+
useEditingImage: [ boolean, Dispatch< SetStateAction< boolean > > ];
|
29 |
+
}
|
30 |
+
|
31 |
+
interface WithImageEditorCategoryProps< T >
|
32 |
+
extends WithImageEditorRequiredProps< T > {
|
33 |
+
category: WP_REST_API_Category;
|
34 |
+
product: never;
|
35 |
+
}
|
36 |
+
|
37 |
+
interface WithImageEditorProductProps< T >
|
38 |
+
extends WithImageEditorRequiredProps< T > {
|
39 |
+
category: never;
|
40 |
+
product: ProductResponseItem;
|
41 |
+
}
|
42 |
+
|
43 |
+
type WithImageEditorProps< T extends EditorBlock< T > > =
|
44 |
+
| ( T & WithImageEditorCategoryProps< T > )
|
45 |
+
| ( T & WithImageEditorProductProps< T > );
|
46 |
+
|
47 |
+
interface ImageEditorProps {
|
48 |
+
backgroundImageId: number;
|
49 |
+
backgroundImageSize: MediaSize;
|
50 |
+
backgroundImageSrc: string;
|
51 |
+
isEditingImage: boolean;
|
52 |
+
setAttributes: ( attrs: MediaAttributes ) => void;
|
53 |
+
setIsEditingImage: ( value: boolean ) => void;
|
54 |
+
}
|
55 |
+
|
56 |
export const ImageEditor = ( {
|
57 |
backgroundImageId,
|
58 |
backgroundImageSize,
|
60 |
isEditingImage,
|
61 |
setAttributes,
|
62 |
setIsEditingImage,
|
63 |
+
}: ImageEditorProps ) => {
|
64 |
return (
|
65 |
<>
|
66 |
<ImageEditingProvider
|
72 |
naturalWidth={
|
73 |
backgroundImageSize.width || DEFAULT_EDITOR_SIZE.width
|
74 |
}
|
75 |
+
onSaveImage={ ( { id, url }: { id: number; url: string } ) => {
|
76 |
setAttributes( { mediaId: id, mediaSrc: url } );
|
77 |
} }
|
78 |
isEditing={ isEditingImage }
|
92 |
);
|
93 |
};
|
94 |
|
95 |
+
export const withImageEditor = < T extends EditorBlock< T > >(
|
96 |
+
Component: ComponentType< T >
|
97 |
+
) => ( props: WithImageEditorProps< T > ) => {
|
98 |
const [ isEditingImage, setIsEditingImage ] = props.useEditingImage;
|
99 |
|
100 |
const { attributes, backgroundImageSize, name, setAttributes } = props;
|
assets/js/blocks/featured-items/{inspector-controls.js → inspector-controls.tsx}
RENAMED
@@ -3,6 +3,8 @@
|
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
|
|
|
|
6 |
import { __ } from '@wordpress/i18n';
|
7 |
import {
|
8 |
InspectorControls as GutenbergInspectorControls,
|
@@ -19,28 +21,82 @@ import {
|
|
19 |
TextareaControl,
|
20 |
ExternalLink,
|
21 |
} from '@wordpress/components';
|
|
|
22 |
|
23 |
/**
|
24 |
* Internal dependencies
|
25 |
*/
|
26 |
import { useBackgroundImage } from './use-background-image';
|
27 |
import { BLOCK_NAMES } from './constants';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
export const InspectorControls = ( {
|
30 |
alt,
|
31 |
backgroundImageSrc,
|
32 |
contentPanel,
|
33 |
dimRatio,
|
34 |
-
focalPoint
|
35 |
hasParallax,
|
36 |
-
isRepeated,
|
37 |
imageFit,
|
|
|
38 |
overlayColor,
|
39 |
overlayGradient,
|
40 |
setAttributes,
|
41 |
setGradient,
|
42 |
showDesc,
|
43 |
-
} ) => {
|
44 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
45 |
// so we need to check if it exists before using it.
|
46 |
const focalPointPickerExists = typeof FocalPointPicker === 'function';
|
@@ -99,18 +155,23 @@ export const InspectorControls = ( {
|
|
99 |
<ToggleGroupControl
|
100 |
help={
|
101 |
<>
|
102 |
-
<
|
|
|
|
|
|
|
|
|
|
|
103 |
{ __(
|
104 |
'Choose “Cover” if you want the image to scale automatically to always fit its container.',
|
105 |
'woo-gutenberg-products-block'
|
106 |
) }
|
107 |
-
</
|
108 |
-
<
|
109 |
{ __(
|
110 |
'Note: by choosing “Cover” you will lose the ability to freely move the focal point precisely.',
|
111 |
'woo-gutenberg-products-block'
|
112 |
) }
|
113 |
-
</
|
114 |
</>
|
115 |
}
|
116 |
label={ __(
|
@@ -118,7 +179,7 @@ export const InspectorControls = ( {
|
|
118 |
'woo-gutenberg-products-block'
|
119 |
) }
|
120 |
value={ imageFit }
|
121 |
-
onChange={ ( value ) =>
|
122 |
setAttributes( {
|
123 |
imageFit: value,
|
124 |
} )
|
@@ -161,7 +222,7 @@ export const InspectorControls = ( {
|
|
161 |
'woo-gutenberg-products-block'
|
162 |
) }
|
163 |
value={ alt }
|
164 |
-
onChange={ ( value ) => {
|
165 |
setAttributes( { alt: value } );
|
166 |
} }
|
167 |
help={
|
@@ -190,9 +251,9 @@ export const InspectorControls = ( {
|
|
190 |
{
|
191 |
colorValue: overlayColor,
|
192 |
gradientValue: overlayGradient,
|
193 |
-
onColorChange: ( value ) =>
|
194 |
setAttributes( { overlayColor: value } ),
|
195 |
-
onGradientChange: ( value ) => {
|
196 |
setGradient( value );
|
197 |
setAttributes( {
|
198 |
overlayGradient: value,
|
@@ -212,7 +273,7 @@ export const InspectorControls = ( {
|
|
212 |
) }
|
213 |
value={ dimRatio }
|
214 |
onChange={ ( value ) =>
|
215 |
-
setAttributes( { dimRatio: value } )
|
216 |
}
|
217 |
min={ 0 }
|
218 |
max={ 100 }
|
@@ -226,7 +287,9 @@ export const InspectorControls = ( {
|
|
226 |
);
|
227 |
};
|
228 |
|
229 |
-
export const withInspectorControls =
|
|
|
|
|
230 |
const { attributes, name, setAttributes } = props;
|
231 |
const {
|
232 |
alt,
|
@@ -257,17 +320,18 @@ export const withInspectorControls = ( Component ) => ( props ) => {
|
|
257 |
blockName: name,
|
258 |
} );
|
259 |
|
260 |
-
const contentPanel =
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
271 |
|
272 |
return (
|
273 |
<>
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
6 |
+
import { ComponentType } from 'react';
|
7 |
+
import { WP_REST_API_Category } from 'wp-types';
|
8 |
import { __ } from '@wordpress/i18n';
|
9 |
import {
|
10 |
InspectorControls as GutenbergInspectorControls,
|
21 |
TextareaControl,
|
22 |
ExternalLink,
|
23 |
} from '@wordpress/components';
|
24 |
+
import { LooselyMustHave, ProductResponseItem } from '@woocommerce/types';
|
25 |
|
26 |
/**
|
27 |
* Internal dependencies
|
28 |
*/
|
29 |
import { useBackgroundImage } from './use-background-image';
|
30 |
import { BLOCK_NAMES } from './constants';
|
31 |
+
import { FeaturedItemRequiredAttributes } from './with-featured-item';
|
32 |
+
import { EditorBlock, ImageFit } from './types';
|
33 |
+
|
34 |
+
type InspectorControlRequiredKeys =
|
35 |
+
| 'dimRatio'
|
36 |
+
| 'focalPoint'
|
37 |
+
| 'hasParallax'
|
38 |
+
| 'imageFit'
|
39 |
+
| 'isRepeated'
|
40 |
+
| 'overlayColor'
|
41 |
+
| 'overlayGradient'
|
42 |
+
| 'showDesc';
|
43 |
+
|
44 |
+
interface InspectorControlsRequiredAttributes
|
45 |
+
extends LooselyMustHave<
|
46 |
+
FeaturedItemRequiredAttributes,
|
47 |
+
InspectorControlRequiredKeys
|
48 |
+
> {
|
49 |
+
alt: string;
|
50 |
+
backgroundImageSrc: string;
|
51 |
+
contentPanel: JSX.Element | undefined;
|
52 |
+
}
|
53 |
+
|
54 |
+
interface InspectorControlsProps extends InspectorControlsRequiredAttributes {
|
55 |
+
setAttributes: (
|
56 |
+
attrs: Partial< InspectorControlsRequiredAttributes >
|
57 |
+
) => void;
|
58 |
+
// Gutenberg doesn't provide some types, so we have to hard-code them here
|
59 |
+
setGradient: ( newGradientValue: string ) => void;
|
60 |
+
}
|
61 |
+
|
62 |
+
interface WithInspectorControlsRequiredProps< T > {
|
63 |
+
attributes: InspectorControlsRequiredAttributes &
|
64 |
+
EditorBlock< T >[ 'attributes' ];
|
65 |
+
setAttributes: InspectorControlsProps[ 'setAttributes' ];
|
66 |
+
}
|
67 |
+
|
68 |
+
interface WithInspectorControlsCategoryProps< T >
|
69 |
+
extends WithInspectorControlsRequiredProps< T > {
|
70 |
+
category: WP_REST_API_Category;
|
71 |
+
product: never;
|
72 |
+
}
|
73 |
+
|
74 |
+
interface WithInspectorControlsProductProps< T >
|
75 |
+
extends WithInspectorControlsRequiredProps< T > {
|
76 |
+
category: never;
|
77 |
+
product: ProductResponseItem;
|
78 |
+
showPrice: boolean;
|
79 |
+
}
|
80 |
+
|
81 |
+
type WithInspectorControlsProps< T extends EditorBlock< T > > =
|
82 |
+
| ( T & WithInspectorControlsCategoryProps< T > )
|
83 |
+
| ( T & WithInspectorControlsProductProps< T > );
|
84 |
|
85 |
export const InspectorControls = ( {
|
86 |
alt,
|
87 |
backgroundImageSrc,
|
88 |
contentPanel,
|
89 |
dimRatio,
|
90 |
+
focalPoint,
|
91 |
hasParallax,
|
|
|
92 |
imageFit,
|
93 |
+
isRepeated,
|
94 |
overlayColor,
|
95 |
overlayGradient,
|
96 |
setAttributes,
|
97 |
setGradient,
|
98 |
showDesc,
|
99 |
+
}: InspectorControlsProps ) => {
|
100 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
101 |
// so we need to check if it exists before using it.
|
102 |
const focalPointPickerExists = typeof FocalPointPicker === 'function';
|
155 |
<ToggleGroupControl
|
156 |
help={
|
157 |
<>
|
158 |
+
<span
|
159 |
+
style={ {
|
160 |
+
display: 'block',
|
161 |
+
marginBottom: '1em',
|
162 |
+
} }
|
163 |
+
>
|
164 |
{ __(
|
165 |
'Choose “Cover” if you want the image to scale automatically to always fit its container.',
|
166 |
'woo-gutenberg-products-block'
|
167 |
) }
|
168 |
+
</span>
|
169 |
+
<span>
|
170 |
{ __(
|
171 |
'Note: by choosing “Cover” you will lose the ability to freely move the focal point precisely.',
|
172 |
'woo-gutenberg-products-block'
|
173 |
) }
|
174 |
+
</span>
|
175 |
</>
|
176 |
}
|
177 |
label={ __(
|
179 |
'woo-gutenberg-products-block'
|
180 |
) }
|
181 |
value={ imageFit }
|
182 |
+
onChange={ ( value: ImageFit ) =>
|
183 |
setAttributes( {
|
184 |
imageFit: value,
|
185 |
} )
|
222 |
'woo-gutenberg-products-block'
|
223 |
) }
|
224 |
value={ alt }
|
225 |
+
onChange={ ( value: string ) => {
|
226 |
setAttributes( { alt: value } );
|
227 |
} }
|
228 |
help={
|
251 |
{
|
252 |
colorValue: overlayColor,
|
253 |
gradientValue: overlayGradient,
|
254 |
+
onColorChange: ( value: string ) =>
|
255 |
setAttributes( { overlayColor: value } ),
|
256 |
+
onGradientChange: ( value: string ) => {
|
257 |
setGradient( value );
|
258 |
setAttributes( {
|
259 |
overlayGradient: value,
|
273 |
) }
|
274 |
value={ dimRatio }
|
275 |
onChange={ ( value ) =>
|
276 |
+
setAttributes( { dimRatio: value as number } )
|
277 |
}
|
278 |
min={ 0 }
|
279 |
max={ 100 }
|
287 |
);
|
288 |
};
|
289 |
|
290 |
+
export const withInspectorControls = < T extends EditorBlock< T > >(
|
291 |
+
Component: ComponentType< T >
|
292 |
+
) => ( props: WithInspectorControlsProps< T > ) => {
|
293 |
const { attributes, name, setAttributes } = props;
|
294 |
const {
|
295 |
alt,
|
320 |
blockName: name,
|
321 |
} );
|
322 |
|
323 |
+
const contentPanel =
|
324 |
+
name === BLOCK_NAMES.featuredProduct ? (
|
325 |
+
<ToggleControl
|
326 |
+
label={ __( 'Show price', 'woo-gutenberg-products-block' ) }
|
327 |
+
checked={ showPrice }
|
328 |
+
onChange={ () =>
|
329 |
+
setAttributes( {
|
330 |
+
showPrice: ! showPrice,
|
331 |
+
} )
|
332 |
+
}
|
333 |
+
/>
|
334 |
+
) : undefined;
|
335 |
|
336 |
return (
|
337 |
<>
|
assets/js/blocks/featured-items/register.tsx
CHANGED
@@ -1,9 +1,13 @@
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
4 |
import { FunctionComponent } from 'react';
|
5 |
import { InnerBlocks } from '@wordpress/block-editor';
|
6 |
-
import {
|
7 |
import { getSetting } from '@woocommerce/settings';
|
8 |
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
9 |
|
@@ -12,10 +16,39 @@ import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
|
12 |
*/
|
13 |
import { Edit } from './edit';
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
export function register(
|
16 |
Block: FunctionComponent,
|
17 |
example: { attributes: Record< string, unknown > },
|
18 |
-
metadata: BlockConfiguration,
|
19 |
settings: Partial< BlockConfiguration >
|
20 |
): void {
|
21 |
const DEFAULT_SETTINGS = {
|
1 |
+
// Disabling because of `__experimental` property names.
|
2 |
+
/* eslint-disable @typescript-eslint/naming-convention */
|
3 |
+
|
4 |
/**
|
5 |
* External dependencies
|
6 |
*/
|
7 |
+
import type { BlockConfiguration } from '@wordpress/blocks';
|
8 |
import { FunctionComponent } from 'react';
|
9 |
import { InnerBlocks } from '@wordpress/block-editor';
|
10 |
+
import { registerBlockType } from '@wordpress/blocks';
|
11 |
import { getSetting } from '@woocommerce/settings';
|
12 |
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
13 |
|
16 |
*/
|
17 |
import { Edit } from './edit';
|
18 |
|
19 |
+
type CSSDirections = 'top' | 'right' | 'bottom' | 'left';
|
20 |
+
|
21 |
+
interface ExtendedBlockSupports {
|
22 |
+
supports: {
|
23 |
+
color?: {
|
24 |
+
background: string;
|
25 |
+
gradients: boolean;
|
26 |
+
link: boolean;
|
27 |
+
text: string;
|
28 |
+
__experimentalDuotone?: string;
|
29 |
+
};
|
30 |
+
spacing?: {
|
31 |
+
margin: boolean | CSSDirections[];
|
32 |
+
padding: boolean | CSSDirections[];
|
33 |
+
__experimentalDefaultControls?: {
|
34 |
+
margin?: boolean;
|
35 |
+
padding?: boolean;
|
36 |
+
};
|
37 |
+
__experimentalSkipSerialization?: boolean;
|
38 |
+
};
|
39 |
+
__experimentalBorder?: {
|
40 |
+
color: boolean;
|
41 |
+
radius: boolean;
|
42 |
+
width: boolean;
|
43 |
+
__experimentalSkipSerialization?: boolean;
|
44 |
+
};
|
45 |
+
};
|
46 |
+
}
|
47 |
+
|
48 |
export function register(
|
49 |
Block: FunctionComponent,
|
50 |
example: { attributes: Record< string, unknown > },
|
51 |
+
metadata: BlockConfiguration & ExtendedBlockSupports,
|
52 |
settings: Partial< BlockConfiguration >
|
53 |
): void {
|
54 |
const DEFAULT_SETTINGS = {
|
assets/js/blocks/featured-items/style.scss
CHANGED
@@ -152,7 +152,8 @@
|
|
152 |
}
|
153 |
}
|
154 |
|
155 |
-
&__title {
|
|
|
156 |
margin-top: 0;
|
157 |
|
158 |
div {
|
152 |
}
|
153 |
}
|
154 |
|
155 |
+
& &__title {
|
156 |
+
color: inherit;
|
157 |
margin-top: 0;
|
158 |
|
159 |
div {
|
assets/js/blocks/featured-items/types.ts
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import type { Block, BlockEditProps } from '@wordpress/blocks';
|
5 |
+
import { isNumber } from 'lodash';
|
6 |
+
|
7 |
+
export type EditorBlock< T > = Block< T > & BlockEditProps< T >;
|
8 |
+
|
9 |
+
export interface Coordinates {
|
10 |
+
x: number;
|
11 |
+
y: number;
|
12 |
+
}
|
13 |
+
|
14 |
+
export interface GenericBlockUIConfig {
|
15 |
+
icon: JSX.Element;
|
16 |
+
label: string;
|
17 |
+
}
|
18 |
+
|
19 |
+
export type ImageFit = 'cover' | 'none';
|
20 |
+
|
21 |
+
export interface ImageObject {
|
22 |
+
id: number;
|
23 |
+
src: string;
|
24 |
+
}
|
25 |
+
|
26 |
+
export function isImageObject( obj: unknown ): obj is ImageObject {
|
27 |
+
if ( ! obj ) return false;
|
28 |
+
|
29 |
+
return (
|
30 |
+
isNumber( ( obj as ImageObject ).id ) &&
|
31 |
+
typeof ( obj as ImageObject ).src === 'string'
|
32 |
+
);
|
33 |
+
}
|
assets/js/blocks/featured-items/{use-background-image.js → use-background-image.ts}
RENAMED
@@ -1,6 +1,8 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
|
|
|
|
4 |
import {
|
5 |
getImageSrcFromProduct,
|
6 |
getImageIdFromProduct,
|
@@ -16,7 +18,24 @@ import {
|
|
16 |
getCategoryImageId,
|
17 |
} from './featured-category/utils';
|
18 |
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
const [ backgroundImageId, setBackgroundImageId ] = useState( 0 );
|
21 |
const [ backgroundImageSrc, setBackgroundImageSrc ] = useState( '' );
|
22 |
|
@@ -26,8 +45,8 @@ export function useBackgroundImage( { blockName, item, mediaId, mediaSrc } ) {
|
|
26 |
} else {
|
27 |
setBackgroundImageId(
|
28 |
blockName === BLOCK_NAMES.featuredProduct
|
29 |
-
? getImageIdFromProduct( item )
|
30 |
-
: getCategoryImageId( item )
|
31 |
);
|
32 |
}
|
33 |
}, [ blockName, item, mediaId ] );
|
@@ -38,8 +57,8 @@ export function useBackgroundImage( { blockName, item, mediaId, mediaSrc } ) {
|
|
38 |
} else {
|
39 |
setBackgroundImageSrc(
|
40 |
blockName === BLOCK_NAMES.featuredProduct
|
41 |
-
? getImageSrcFromProduct( item )
|
42 |
-
: getCategoryImageSrc( item )
|
43 |
);
|
44 |
}
|
45 |
}, [ blockName, item, mediaSrc ] );
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import { WP_REST_API_Category } from 'wp-types';
|
5 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
6 |
import {
|
7 |
getImageSrcFromProduct,
|
8 |
getImageIdFromProduct,
|
18 |
getCategoryImageId,
|
19 |
} from './featured-category/utils';
|
20 |
|
21 |
+
interface BackgroundProps {
|
22 |
+
blockName: string;
|
23 |
+
item: ProductResponseItem | WP_REST_API_Category;
|
24 |
+
mediaId: number | undefined;
|
25 |
+
mediaSrc: string | undefined;
|
26 |
+
}
|
27 |
+
|
28 |
+
interface BackgroundImage {
|
29 |
+
backgroundImageId: number;
|
30 |
+
backgroundImageSrc: string;
|
31 |
+
}
|
32 |
+
|
33 |
+
export function useBackgroundImage( {
|
34 |
+
blockName,
|
35 |
+
item,
|
36 |
+
mediaId,
|
37 |
+
mediaSrc,
|
38 |
+
}: BackgroundProps ): BackgroundImage {
|
39 |
const [ backgroundImageId, setBackgroundImageId ] = useState( 0 );
|
40 |
const [ backgroundImageSrc, setBackgroundImageSrc ] = useState( '' );
|
41 |
|
45 |
} else {
|
46 |
setBackgroundImageId(
|
47 |
blockName === BLOCK_NAMES.featuredProduct
|
48 |
+
? getImageIdFromProduct( item as ProductResponseItem )
|
49 |
+
: getCategoryImageId( item as WP_REST_API_Category )
|
50 |
);
|
51 |
}
|
52 |
}, [ blockName, item, mediaId ] );
|
57 |
} else {
|
58 |
setBackgroundImageSrc(
|
59 |
blockName === BLOCK_NAMES.featuredProduct
|
60 |
+
? getImageSrcFromProduct( item as ProductResponseItem )
|
61 |
+
: getCategoryImageSrc( item as WP_REST_API_Category )
|
62 |
);
|
63 |
}
|
64 |
}, [ blockName, item, mediaSrc ] );
|
assets/js/blocks/featured-items/{utils.js → utils.ts}
RENAMED
@@ -1,12 +1,14 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
objectPosition: calculatePercentPositionFromCoordinates( coords ),
|
6 |
-
};
|
7 |
-
}
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
if ( ! coords ) return '';
|
11 |
|
12 |
const x = Math.round( coords.x * 100 );
|
@@ -15,20 +17,22 @@ export function calculatePercentPositionFromCoordinates( coords ) {
|
|
15 |
return `${ x }% ${ y }%`;
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
/**
|
19 |
* Generate the style object of the background image of the block.
|
20 |
*
|
21 |
* It outputs styles for either an `img` element or a `div` with a background,
|
22 |
* depending on what is needed.
|
23 |
-
*
|
24 |
-
* @param {Object} opts Options for the element.
|
25 |
-
* @param {Object} opts.focalPoint X and Y coordinates of the image.
|
26 |
-
* @param {'cover' | 'none'} opts.imageFit How to fit the image in the wrapper.
|
27 |
-
* @param {boolean} opts.isImgElement Whether the rendered background is an `img` element.
|
28 |
-
* @param {boolean} opts.isRepeated Whether the background is repeated (no effect if `isImgElement` is `true`).
|
29 |
-
* @param {string} opts.url The url of the image.
|
30 |
-
*
|
31 |
-
* @return {Object} A style object with a backgroundImage set (if a valid image is provided).
|
32 |
*/
|
33 |
export function getBackgroundImageStyles( {
|
34 |
focalPoint,
|
@@ -36,6 +40,12 @@ export function getBackgroundImageStyles( {
|
|
36 |
isImgElement,
|
37 |
isRepeated,
|
38 |
url,
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
} ) {
|
40 |
let styles = {};
|
41 |
|
@@ -66,21 +76,18 @@ export function getBackgroundImageStyles( {
|
|
66 |
|
67 |
/**
|
68 |
* Generates the CSS class prefix for scoping elements to a block.
|
69 |
-
*
|
70 |
-
* @param {string} blockName The name of the block.
|
71 |
-
* @return {string} The prefix for the HTML elements belonging to that block.
|
72 |
*/
|
73 |
-
export function getClassPrefixFromName( blockName ) {
|
74 |
return `wc-block-${ blockName.split( '/' )[ 1 ] }`;
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
* Convert the selected ratio to the correct background class.
|
79 |
*
|
80 |
-
* @param
|
81 |
-
* @return
|
82 |
*/
|
83 |
-
export function dimRatioToClass( ratio ) {
|
84 |
return ratio === 0 || ratio === 50
|
85 |
? null
|
86 |
: `has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { Coordinates, ImageFit } from './types';
|
|
|
|
|
|
|
5 |
|
6 |
+
/**
|
7 |
+
* Given x and y coordinates between 0 and 1 returns a rounded percentage string.
|
8 |
+
*
|
9 |
+
* Useful for converting to a CSS-compatible position string.
|
10 |
+
*/
|
11 |
+
export function calculatePercentPositionFromCoordinates( coords: Coordinates ) {
|
12 |
if ( ! coords ) return '';
|
13 |
|
14 |
const x = Math.round( coords.x * 100 );
|
17 |
return `${ x }% ${ y }%`;
|
18 |
}
|
19 |
|
20 |
+
/**
|
21 |
+
* Given x and y coordinates between 0 and 1 returns a CSS `objectPosition`.
|
22 |
+
*/
|
23 |
+
export function calculateBackgroundImagePosition( coords: Coordinates ) {
|
24 |
+
if ( ! coords ) return {};
|
25 |
+
|
26 |
+
return {
|
27 |
+
objectPosition: calculatePercentPositionFromCoordinates( coords ),
|
28 |
+
};
|
29 |
+
}
|
30 |
+
|
31 |
/**
|
32 |
* Generate the style object of the background image of the block.
|
33 |
*
|
34 |
* It outputs styles for either an `img` element or a `div` with a background,
|
35 |
* depending on what is needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
*/
|
37 |
export function getBackgroundImageStyles( {
|
38 |
focalPoint,
|
40 |
isImgElement,
|
41 |
isRepeated,
|
42 |
url,
|
43 |
+
}: {
|
44 |
+
focalPoint: Coordinates;
|
45 |
+
imageFit: ImageFit;
|
46 |
+
isImgElement: boolean;
|
47 |
+
isRepeated: boolean;
|
48 |
+
url: string;
|
49 |
} ) {
|
50 |
let styles = {};
|
51 |
|
76 |
|
77 |
/**
|
78 |
* Generates the CSS class prefix for scoping elements to a block.
|
|
|
|
|
|
|
79 |
*/
|
80 |
+
export function getClassPrefixFromName( blockName: string ) {
|
81 |
return `wc-block-${ blockName.split( '/' )[ 1 ] }`;
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
* Convert the selected ratio to the correct background class.
|
86 |
*
|
87 |
+
* @param ratio Selected opacity from 0 to 100.
|
88 |
+
* @return The class name, if applicable (not used for ratio 0 or 50).
|
89 |
*/
|
90 |
+
export function dimRatioToClass( ratio: number ) {
|
91 |
return ratio === 0 || ratio === 50
|
92 |
? null
|
93 |
: `has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
assets/js/blocks/featured-items/with-api-error.js
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import ErrorPlaceholder from '@woocommerce/editor-components/error-placeholder';
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Internal dependencies
|
8 |
-
*/
|
9 |
-
import { BLOCK_NAMES } from './constants';
|
10 |
-
import { getClassPrefixFromName } from './utils';
|
11 |
-
|
12 |
-
export const withApiError = ( Component ) => ( props ) => {
|
13 |
-
const { error, isLoading, name } = props;
|
14 |
-
|
15 |
-
const className = getClassPrefixFromName( name );
|
16 |
-
const onRetry =
|
17 |
-
name === BLOCK_NAMES.featuredCategory
|
18 |
-
? props.getCategory
|
19 |
-
: props.getProduct;
|
20 |
-
|
21 |
-
if ( error ) {
|
22 |
-
return (
|
23 |
-
<ErrorPlaceholder
|
24 |
-
className={ `${ className }-error` }
|
25 |
-
error={ error }
|
26 |
-
isLoading={ isLoading }
|
27 |
-
onRetry={ onRetry }
|
28 |
-
/>
|
29 |
-
);
|
30 |
-
}
|
31 |
-
|
32 |
-
return <Component { ...props } />;
|
33 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/with-api-error.tsx
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import ErrorPlaceholder, {
|
5 |
+
ErrorObject,
|
6 |
+
} from '@woocommerce/editor-components/error-placeholder';
|
7 |
+
import type { Block } from '@wordpress/blocks';
|
8 |
+
import { ComponentType } from 'react';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import { BLOCK_NAMES } from './constants';
|
14 |
+
import { getClassPrefixFromName } from './utils';
|
15 |
+
|
16 |
+
interface APIErrorRequiredProps {
|
17 |
+
error: ErrorObject;
|
18 |
+
isLoading: boolean;
|
19 |
+
name: string;
|
20 |
+
}
|
21 |
+
|
22 |
+
interface APIErrorProductProps extends APIErrorRequiredProps {
|
23 |
+
getCategory: never;
|
24 |
+
getProduct(): void;
|
25 |
+
}
|
26 |
+
|
27 |
+
interface APIErrorCategoryProps extends APIErrorRequiredProps {
|
28 |
+
getCategory(): void;
|
29 |
+
getProduct: never;
|
30 |
+
}
|
31 |
+
|
32 |
+
type APIErrorProps< T extends Block > =
|
33 |
+
| ( T & APIErrorProductProps )
|
34 |
+
| ( T & APIErrorCategoryProps );
|
35 |
+
|
36 |
+
export const withApiError = < T extends Block >(
|
37 |
+
Component: ComponentType< T >
|
38 |
+
) => ( props: APIErrorProps< T > ) => {
|
39 |
+
const { error, isLoading, name } = props;
|
40 |
+
|
41 |
+
const className = getClassPrefixFromName( name );
|
42 |
+
const onRetry =
|
43 |
+
name === BLOCK_NAMES.featuredCategory
|
44 |
+
? props.getCategory
|
45 |
+
: props.getProduct;
|
46 |
+
|
47 |
+
if ( error ) {
|
48 |
+
return (
|
49 |
+
<ErrorPlaceholder
|
50 |
+
className={ `${ className }-error` }
|
51 |
+
error={ error }
|
52 |
+
isLoading={ isLoading }
|
53 |
+
onRetry={ onRetry }
|
54 |
+
/>
|
55 |
+
);
|
56 |
+
}
|
57 |
+
|
58 |
+
return <Component { ...props } />;
|
59 |
+
};
|
assets/js/blocks/featured-items/with-edit-mode.js
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { Placeholder, Icon, Button } from '@wordpress/components';
|
5 |
-
import { __ } from '@wordpress/i18n';
|
6 |
-
import ProductCategoryControl from '@woocommerce/editor-components/product-category-control';
|
7 |
-
import ProductControl from '@woocommerce/editor-components/product-control';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* Internal dependencies
|
11 |
-
*/
|
12 |
-
import { getClassPrefixFromName } from './utils';
|
13 |
-
import { BLOCK_NAMES } from './constants';
|
14 |
-
|
15 |
-
export const withEditMode = ( { description, editLabel, icon, label } ) => (
|
16 |
-
Component
|
17 |
-
) => ( props ) => {
|
18 |
-
const {
|
19 |
-
attributes,
|
20 |
-
debouncedSpeak,
|
21 |
-
name,
|
22 |
-
setAttributes,
|
23 |
-
triggerUrlUpdate = () => void null,
|
24 |
-
} = props;
|
25 |
-
|
26 |
-
const className = getClassPrefixFromName( name );
|
27 |
-
|
28 |
-
const onDone = () => {
|
29 |
-
setAttributes( { editMode: false } );
|
30 |
-
debouncedSpeak( editLabel );
|
31 |
-
};
|
32 |
-
|
33 |
-
if ( attributes.editMode ) {
|
34 |
-
return (
|
35 |
-
<Placeholder
|
36 |
-
icon={ <Icon icon={ icon } /> }
|
37 |
-
label={ label }
|
38 |
-
className={ className }
|
39 |
-
>
|
40 |
-
{ description }
|
41 |
-
<div className={ `${ className }__selection` }>
|
42 |
-
{ name === BLOCK_NAMES.featuredCategory && (
|
43 |
-
<ProductCategoryControl
|
44 |
-
selected={ [ attributes.categoryId ] }
|
45 |
-
onChange={ ( value = [] ) => {
|
46 |
-
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
47 |
-
setAttributes( {
|
48 |
-
categoryId: id,
|
49 |
-
mediaId: 0,
|
50 |
-
mediaSrc: '',
|
51 |
-
} );
|
52 |
-
triggerUrlUpdate();
|
53 |
-
} }
|
54 |
-
isSingle
|
55 |
-
/>
|
56 |
-
) }
|
57 |
-
{ name === BLOCK_NAMES.featuredProduct && (
|
58 |
-
<ProductControl
|
59 |
-
selected={ attributes.productId || 0 }
|
60 |
-
showVariations
|
61 |
-
onChange={ ( value = [] ) => {
|
62 |
-
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
63 |
-
setAttributes( {
|
64 |
-
productId: id,
|
65 |
-
mediaId: 0,
|
66 |
-
mediaSrc: '',
|
67 |
-
} );
|
68 |
-
triggerUrlUpdate();
|
69 |
-
} }
|
70 |
-
/>
|
71 |
-
) }
|
72 |
-
<Button isPrimary onClick={ onDone }>
|
73 |
-
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
74 |
-
</Button>
|
75 |
-
</div>
|
76 |
-
</Placeholder>
|
77 |
-
);
|
78 |
-
}
|
79 |
-
|
80 |
-
return <Component { ...props } />;
|
81 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/with-edit-mode.tsx
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
|
5 |
+
import { WP_REST_API_Category } from 'wp-types';
|
6 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
7 |
+
import { Placeholder, Icon, Button } from '@wordpress/components';
|
8 |
+
import { __ } from '@wordpress/i18n';
|
9 |
+
import ProductCategoryControl from '@woocommerce/editor-components/product-category-control';
|
10 |
+
import ProductControl from '@woocommerce/editor-components/product-control';
|
11 |
+
import { ComponentType } from 'react';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Internal dependencies
|
15 |
+
*/
|
16 |
+
import { BLOCK_NAMES } from './constants';
|
17 |
+
import { EditorBlock, GenericBlockUIConfig } from './types';
|
18 |
+
import { getClassPrefixFromName } from './utils';
|
19 |
+
|
20 |
+
interface EditModeConfiguration extends GenericBlockUIConfig {
|
21 |
+
description: string;
|
22 |
+
editLabel: string;
|
23 |
+
}
|
24 |
+
|
25 |
+
type EditModeRequiredAttributes = {
|
26 |
+
categoryId?: number;
|
27 |
+
editMode: boolean;
|
28 |
+
mediaId: number;
|
29 |
+
mediaSrc: string;
|
30 |
+
productId?: number;
|
31 |
+
};
|
32 |
+
|
33 |
+
interface EditModeRequiredProps< T > {
|
34 |
+
attributes: EditModeRequiredAttributes & EditorBlock< T >[ 'attributes' ];
|
35 |
+
debouncedSpeak: ( label: string ) => void;
|
36 |
+
setAttributes: ( attrs: Partial< EditModeRequiredAttributes > ) => void;
|
37 |
+
triggerUrlUpdate: () => void;
|
38 |
+
}
|
39 |
+
|
40 |
+
type EditModeProps< T extends EditorBlock< T > > = T &
|
41 |
+
EditModeRequiredProps< T >;
|
42 |
+
|
43 |
+
export const withEditMode = ( {
|
44 |
+
description,
|
45 |
+
editLabel,
|
46 |
+
icon,
|
47 |
+
label,
|
48 |
+
}: EditModeConfiguration ) => < T extends EditorBlock< T > >(
|
49 |
+
Component: ComponentType< T >
|
50 |
+
) => ( props: EditModeProps< T > ) => {
|
51 |
+
const {
|
52 |
+
attributes,
|
53 |
+
debouncedSpeak,
|
54 |
+
name,
|
55 |
+
setAttributes,
|
56 |
+
triggerUrlUpdate = () => void null,
|
57 |
+
} = props;
|
58 |
+
|
59 |
+
const className = getClassPrefixFromName( name );
|
60 |
+
|
61 |
+
const onDone = () => {
|
62 |
+
setAttributes( { editMode: false } );
|
63 |
+
debouncedSpeak( editLabel );
|
64 |
+
};
|
65 |
+
|
66 |
+
if ( attributes.editMode ) {
|
67 |
+
return (
|
68 |
+
<Placeholder
|
69 |
+
icon={ <Icon icon={ icon } /> }
|
70 |
+
label={ label }
|
71 |
+
className={ className }
|
72 |
+
>
|
73 |
+
{ description }
|
74 |
+
<div className={ `${ className }__selection` }>
|
75 |
+
{ name === BLOCK_NAMES.featuredCategory && (
|
76 |
+
// Ignoring this TS error for now as it seems that `ProductCategoryControl`
|
77 |
+
// types might be too strict.
|
78 |
+
// @todo Convert `ProductCategoryControl` to TypeScript
|
79 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
80 |
+
// @ts-ignore
|
81 |
+
<ProductCategoryControl
|
82 |
+
selected={ [ attributes.categoryId ] }
|
83 |
+
onChange={ (
|
84 |
+
value: WP_REST_API_Category[] = []
|
85 |
+
) => {
|
86 |
+
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
87 |
+
setAttributes( {
|
88 |
+
categoryId: id,
|
89 |
+
mediaId: 0,
|
90 |
+
mediaSrc: '',
|
91 |
+
} );
|
92 |
+
triggerUrlUpdate();
|
93 |
+
} }
|
94 |
+
isSingle
|
95 |
+
/>
|
96 |
+
) }
|
97 |
+
{ name === BLOCK_NAMES.featuredProduct && (
|
98 |
+
<ProductControl
|
99 |
+
selected={
|
100 |
+
attributes.productId
|
101 |
+
? [ attributes.productId ]
|
102 |
+
: []
|
103 |
+
}
|
104 |
+
// `ProductControl` is not yet a TypeScript file and the types
|
105 |
+
// are incorrectly generated for the wrapped HOC, so `showVariation`
|
106 |
+
// doesn't appear in the allowed props
|
107 |
+
// @todo Convert `ProductControl` to TypeScript
|
108 |
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
109 |
+
// @ts-ignore
|
110 |
+
showVariations
|
111 |
+
onChange={ (
|
112 |
+
value: ProductResponseItem[] = []
|
113 |
+
) => {
|
114 |
+
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
115 |
+
setAttributes( {
|
116 |
+
productId: id,
|
117 |
+
mediaId: 0,
|
118 |
+
mediaSrc: '',
|
119 |
+
} );
|
120 |
+
triggerUrlUpdate();
|
121 |
+
} }
|
122 |
+
/>
|
123 |
+
) }
|
124 |
+
<Button isPrimary onClick={ onDone }>
|
125 |
+
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
126 |
+
</Button>
|
127 |
+
</div>
|
128 |
+
</Placeholder>
|
129 |
+
);
|
130 |
+
}
|
131 |
+
|
132 |
+
return <Component { ...props } />;
|
133 |
+
};
|
assets/js/blocks/featured-items/with-editing-image.js
DELETED
@@ -1,20 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* External dependencies
|
3 |
-
*/
|
4 |
-
import { useEffect, useState } from 'react';
|
5 |
-
|
6 |
-
export const withEditingImage = ( Component ) => ( props ) => {
|
7 |
-
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
8 |
-
const { isSelected } = props;
|
9 |
-
|
10 |
-
useEffect( () => {
|
11 |
-
setIsEditingImage( false );
|
12 |
-
}, [ isSelected ] );
|
13 |
-
|
14 |
-
return (
|
15 |
-
<Component
|
16 |
-
{ ...props }
|
17 |
-
useEditingImage={ [ isEditingImage, setIsEditingImage ] }
|
18 |
-
/>
|
19 |
-
);
|
20 |
-
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/js/blocks/featured-items/with-editing-image.tsx
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { ComponentType, useEffect, useState } from 'react';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import { EditorBlock } from './types';
|
10 |
+
|
11 |
+
interface EditingImageRequiredProps {
|
12 |
+
isSelected: boolean;
|
13 |
+
}
|
14 |
+
|
15 |
+
type EditingImageProps< T extends EditorBlock< T > > = T &
|
16 |
+
EditingImageRequiredProps;
|
17 |
+
|
18 |
+
export const withEditingImage = < T extends EditorBlock< T > >(
|
19 |
+
Component: ComponentType< T >
|
20 |
+
) => ( props: EditingImageProps< T > ) => {
|
21 |
+
const [ isEditingImage, setIsEditingImage ] = useState( false );
|
22 |
+
const { isSelected } = props;
|
23 |
+
|
24 |
+
useEffect( () => {
|
25 |
+
setIsEditingImage( false );
|
26 |
+
}, [ isSelected ] );
|
27 |
+
|
28 |
+
return (
|
29 |
+
<Component
|
30 |
+
{ ...props }
|
31 |
+
useEditingImage={ [ isEditingImage, setIsEditingImage ] }
|
32 |
+
/>
|
33 |
+
);
|
34 |
+
};
|
assets/js/blocks/featured-items/{with-featured-item.js → with-featured-item.tsx}
RENAMED
@@ -3,17 +3,27 @@
|
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
|
|
|
|
6 |
import { __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles } from '@wordpress/block-editor';
|
7 |
import { Icon, Placeholder, Spinner } from '@wordpress/components';
|
8 |
import classnames from 'classnames';
|
9 |
import { isEmpty } from 'lodash';
|
10 |
-
import {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
/**
|
13 |
* Internal dependencies
|
14 |
*/
|
15 |
import { CallToAction } from './call-to-action';
|
16 |
import { ConstrainedResizable } from './constrained-resizable';
|
|
|
17 |
import { useBackgroundImage } from './use-background-image';
|
18 |
import {
|
19 |
dimRatioToClass,
|
@@ -21,9 +31,79 @@ import {
|
|
21 |
getClassPrefixFromName,
|
22 |
} from './utils';
|
23 |
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
const [ isEditingImage ] = props.useEditingImage;
|
28 |
|
29 |
const {
|
@@ -62,7 +142,7 @@ export const withFeaturedItem = ( { emptyMessage, icon, label } ) => (
|
|
62 |
<CallToAction
|
63 |
itemId={ categoryId || productId }
|
64 |
linkText={ linkText }
|
65 |
-
permalink={ ( category || product ).permalink }
|
66 |
/>
|
67 |
);
|
68 |
};
|
@@ -91,6 +171,7 @@ export const withFeaturedItem = ( { emptyMessage, icon, label } ) => (
|
|
91 |
showDesc,
|
92 |
showPrice,
|
93 |
style,
|
|
|
94 |
} = attributes;
|
95 |
|
96 |
const classes = classnames(
|
@@ -111,6 +192,9 @@ export const withFeaturedItem = ( { emptyMessage, icon, label } ) => (
|
|
111 |
|
112 |
const containerStyle = {
|
113 |
borderRadius: style?.border?.radius,
|
|
|
|
|
|
|
114 |
};
|
115 |
|
116 |
const wrapperStyle = {
|
@@ -159,8 +243,10 @@ export const withFeaturedItem = ( { emptyMessage, icon, label } ) => (
|
|
159 |
style={ backgroundImageStyle }
|
160 |
onLoad={ ( e ) => {
|
161 |
setBackgroundImageSize( {
|
162 |
-
height:
|
163 |
-
|
|
|
|
|
164 |
} );
|
165 |
} }
|
166 |
/>
|
3 |
/**
|
4 |
* External dependencies
|
5 |
*/
|
6 |
+
import type { BlockAlignment } from '@wordpress/blocks';
|
7 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
8 |
import { __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles } from '@wordpress/block-editor';
|
9 |
import { Icon, Placeholder, Spinner } from '@wordpress/components';
|
10 |
import classnames from 'classnames';
|
11 |
import { isEmpty } from 'lodash';
|
12 |
+
import {
|
13 |
+
ComponentType,
|
14 |
+
Dispatch,
|
15 |
+
SetStateAction,
|
16 |
+
useCallback,
|
17 |
+
useState,
|
18 |
+
} from 'react';
|
19 |
+
import { WP_REST_API_Category } from 'wp-types';
|
20 |
|
21 |
/**
|
22 |
* Internal dependencies
|
23 |
*/
|
24 |
import { CallToAction } from './call-to-action';
|
25 |
import { ConstrainedResizable } from './constrained-resizable';
|
26 |
+
import { EditorBlock, GenericBlockUIConfig } from './types';
|
27 |
import { useBackgroundImage } from './use-background-image';
|
28 |
import {
|
29 |
dimRatioToClass,
|
31 |
getClassPrefixFromName,
|
32 |
} from './utils';
|
33 |
|
34 |
+
interface WithFeaturedItemConfig extends GenericBlockUIConfig {
|
35 |
+
emptyMessage: string;
|
36 |
+
}
|
37 |
+
|
38 |
+
export interface FeaturedItemRequiredAttributes {
|
39 |
+
contentAlign: BlockAlignment;
|
40 |
+
dimRatio: number;
|
41 |
+
focalPoint: { x: number; y: number };
|
42 |
+
hasParallax: boolean;
|
43 |
+
imageFit: 'cover' | 'none';
|
44 |
+
isRepeated: boolean;
|
45 |
+
linkText: string;
|
46 |
+
mediaId: number;
|
47 |
+
mediaSrc: string;
|
48 |
+
minHeight: number;
|
49 |
+
overlayColor: string;
|
50 |
+
overlayGradient: string;
|
51 |
+
showDesc: boolean;
|
52 |
+
showPrice: boolean;
|
53 |
+
}
|
54 |
+
|
55 |
+
interface FeaturedCategoryRequiredAttributes
|
56 |
+
extends FeaturedItemRequiredAttributes {
|
57 |
+
categoryId: number | 'preview';
|
58 |
+
productId: never;
|
59 |
+
}
|
60 |
+
|
61 |
+
interface FeaturedProductRequiredAttributes
|
62 |
+
extends FeaturedItemRequiredAttributes {
|
63 |
+
categoryId: never;
|
64 |
+
productId: number | 'preview';
|
65 |
+
}
|
66 |
+
|
67 |
+
interface FeaturedItemRequiredProps< T > {
|
68 |
+
attributes: (
|
69 |
+
| FeaturedCategoryRequiredAttributes
|
70 |
+
| FeaturedProductRequiredAttributes
|
71 |
+
) &
|
72 |
+
EditorBlock< T >[ 'attributes' ] & {
|
73 |
+
// This is hardcoded because border and color are not yet included
|
74 |
+
// in Gutenberg's official types.
|
75 |
+
style: {
|
76 |
+
border?: { radius?: number };
|
77 |
+
color?: { text?: string };
|
78 |
+
};
|
79 |
+
textColor?: string;
|
80 |
+
};
|
81 |
+
isLoading: boolean;
|
82 |
+
setAttributes: ( attrs: Partial< FeaturedItemRequiredAttributes > ) => void;
|
83 |
+
useEditingImage: [ boolean, Dispatch< SetStateAction< boolean > > ];
|
84 |
+
}
|
85 |
+
|
86 |
+
interface FeaturedCategoryProps< T > extends FeaturedItemRequiredProps< T > {
|
87 |
+
category: WP_REST_API_Category;
|
88 |
+
product: never;
|
89 |
+
}
|
90 |
+
|
91 |
+
interface FeaturedProductProps< T > extends FeaturedItemRequiredProps< T > {
|
92 |
+
category: never;
|
93 |
+
product: ProductResponseItem;
|
94 |
+
}
|
95 |
+
|
96 |
+
type FeaturedItemProps< T extends EditorBlock< T > > =
|
97 |
+
| ( T & FeaturedCategoryProps< T > )
|
98 |
+
| ( T & FeaturedProductProps< T > );
|
99 |
+
|
100 |
+
export const withFeaturedItem = ( {
|
101 |
+
emptyMessage,
|
102 |
+
icon,
|
103 |
+
label,
|
104 |
+
}: WithFeaturedItemConfig ) => < T extends EditorBlock< T > >(
|
105 |
+
Component: ComponentType< T >
|
106 |
+
) => ( props: FeaturedItemProps< T > ) => {
|
107 |
const [ isEditingImage ] = props.useEditingImage;
|
108 |
|
109 |
const {
|
142 |
<CallToAction
|
143 |
itemId={ categoryId || productId }
|
144 |
linkText={ linkText }
|
145 |
+
permalink={ ( category || product ).permalink as string }
|
146 |
/>
|
147 |
);
|
148 |
};
|
171 |
showDesc,
|
172 |
showPrice,
|
173 |
style,
|
174 |
+
textColor,
|
175 |
} = attributes;
|
176 |
|
177 |
const classes = classnames(
|
192 |
|
193 |
const containerStyle = {
|
194 |
borderRadius: style?.border?.radius,
|
195 |
+
color: textColor
|
196 |
+
? `var(--wp--preset--color--${ textColor })`
|
197 |
+
: style?.color?.text,
|
198 |
};
|
199 |
|
200 |
const wrapperStyle = {
|
243 |
style={ backgroundImageStyle }
|
244 |
onLoad={ ( e ) => {
|
245 |
setBackgroundImageSize( {
|
246 |
+
height:
|
247 |
+
e.currentTarget?.naturalHeight,
|
248 |
+
width:
|
249 |
+
e.currentTarget?.naturalWidth,
|
250 |
} );
|
251 |
} }
|
252 |
/>
|
assets/js/blocks/featured-items/with-update-button-attributes.tsx
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { ComponentType, useEffect, useMemo, useState } from 'react';
|
5 |
+
import { WP_REST_API_Category } from 'wp-types';
|
6 |
+
import { ProductResponseItem } from '@woocommerce/types';
|
7 |
+
import { useDispatch, useSelect } from '@wordpress/data';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Internal dependencies
|
11 |
+
*/
|
12 |
+
import { EditorBlock } from './types';
|
13 |
+
|
14 |
+
interface WithUpdateButtonRequiredAttributes {
|
15 |
+
editMode: boolean;
|
16 |
+
}
|
17 |
+
|
18 |
+
interface WithUpdateButtonAttributes< T > {
|
19 |
+
attributes: WithUpdateButtonRequiredAttributes &
|
20 |
+
EditorBlock< T >[ 'attributes' ];
|
21 |
+
}
|
22 |
+
|
23 |
+
interface WithUpdateButtonCategoryProps< T >
|
24 |
+
extends WithUpdateButtonAttributes< T > {
|
25 |
+
category: WP_REST_API_Category;
|
26 |
+
product: never;
|
27 |
+
}
|
28 |
+
|
29 |
+
interface WithUpdateButtonProductProps< T >
|
30 |
+
extends WithUpdateButtonAttributes< T > {
|
31 |
+
category: never;
|
32 |
+
product: ProductResponseItem;
|
33 |
+
}
|
34 |
+
|
35 |
+
type WithUpdateButtonProps< T extends EditorBlock< T > > =
|
36 |
+
| ( T & WithUpdateButtonCategoryProps< T > )
|
37 |
+
| ( T & WithUpdateButtonProductProps< T > );
|
38 |
+
|
39 |
+
export const withUpdateButtonAttributes = < T extends EditorBlock< T > >(
|
40 |
+
Component: ComponentType< T >
|
41 |
+
) => ( props: WithUpdateButtonProps< T > ) => {
|
42 |
+
const [ doUrlUpdate, setDoUrlUpdate ] = useState( false );
|
43 |
+
const { attributes, category, clientId, product } = props;
|
44 |
+
const item = category || product;
|
45 |
+
|
46 |
+
const { editMode } = attributes;
|
47 |
+
const permalink =
|
48 |
+
( item as WP_REST_API_Category )?.link ||
|
49 |
+
( item as ProductResponseItem )?.permalink;
|
50 |
+
|
51 |
+
const Block = useSelect( ( select ) => {
|
52 |
+
return select( 'core/block-editor' ).getBlock( clientId );
|
53 |
+
} );
|
54 |
+
const InnerButton = Block?.innerBlocks[ 0 ];
|
55 |
+
const buttonBlockId = InnerButton?.clientId || '';
|
56 |
+
const currentButtonAttributes = useMemo(
|
57 |
+
() => InnerButton?.attributes || {},
|
58 |
+
[ InnerButton ]
|
59 |
+
);
|
60 |
+
const { url } = currentButtonAttributes;
|
61 |
+
|
62 |
+
const { updateBlockAttributes } = useDispatch( 'core/block-editor' );
|
63 |
+
|
64 |
+
useEffect( () => {
|
65 |
+
if (
|
66 |
+
doUrlUpdate &&
|
67 |
+
buttonBlockId &&
|
68 |
+
! editMode &&
|
69 |
+
permalink &&
|
70 |
+
url &&
|
71 |
+
permalink !== url
|
72 |
+
) {
|
73 |
+
updateBlockAttributes( buttonBlockId, {
|
74 |
+
url: permalink,
|
75 |
+
} );
|
76 |
+
setDoUrlUpdate( false );
|
77 |
+
}
|
78 |
+
}, [
|
79 |
+
buttonBlockId,
|
80 |
+
doUrlUpdate,
|
81 |
+
editMode,
|
82 |
+
permalink,
|
83 |
+
updateBlockAttributes,
|
84 |
+
url,
|
85 |
+
] );
|
86 |
+
|
87 |
+
const triggerUrlUpdate = () => setDoUrlUpdate( true );
|
88 |
+
|
89 |
+
return <Component { ...props } triggerUrlUpdate={ triggerUrlUpdate } />;
|
90 |
+
};
|
assets/js/blocks/mini-cart/index.tsx
CHANGED
@@ -6,6 +6,7 @@ import { cart } from '@woocommerce/icons';
|
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
import { registerBlockType } from '@wordpress/blocks';
|
8 |
import type { BlockConfiguration } from '@wordpress/blocks';
|
|
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
@@ -33,6 +34,12 @@ const settings: BlockConfiguration = {
|
|
33 |
html: false,
|
34 |
multiple: false,
|
35 |
color: true,
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
},
|
37 |
example: {
|
38 |
attributes: {
|
6 |
import { Icon } from '@wordpress/icons';
|
7 |
import { registerBlockType } from '@wordpress/blocks';
|
8 |
import type { BlockConfiguration } from '@wordpress/blocks';
|
9 |
+
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
10 |
|
11 |
/**
|
12 |
* Internal dependencies
|
34 |
html: false,
|
35 |
multiple: false,
|
36 |
color: true,
|
37 |
+
typography: {
|
38 |
+
fontSize: true,
|
39 |
+
...( isFeaturePluginBuild() && {
|
40 |
+
__experimentalFontFamily: true,
|
41 |
+
} ),
|
42 |
+
},
|
43 |
},
|
44 |
example: {
|
45 |
attributes: {
|
assets/js/blocks/mini-cart/style.scss
CHANGED
@@ -8,6 +8,8 @@
|
|
8 |
border: none;
|
9 |
color: inherit;
|
10 |
display: flex;
|
|
|
|
|
11 |
font-weight: 400;
|
12 |
padding: em($gap-small) em($gap-smaller);
|
13 |
|
8 |
border: none;
|
9 |
color: inherit;
|
10 |
display: flex;
|
11 |
+
font-size: inherit;
|
12 |
+
font-family: inherit;
|
13 |
font-weight: 400;
|
14 |
padding: em($gap-small) em($gap-smaller);
|
15 |
|
assets/js/hocs/with-transform-single-select-to-multiple-select.js
CHANGED
@@ -16,7 +16,10 @@ const withTransformSingleSelectToMultipleSelect = createHigherOrderComponent(
|
|
16 |
render() {
|
17 |
const { selected } = this.props;
|
18 |
const isNil = selected === null || selected === undefined;
|
19 |
-
|
|
|
|
|
|
|
20 |
<OriginalComponent
|
21 |
{ ...this.props }
|
22 |
selected={ isNil ? [] : [ selected ] }
|
16 |
render() {
|
17 |
const { selected } = this.props;
|
18 |
const isNil = selected === null || selected === undefined;
|
19 |
+
|
20 |
+
return Array.isArray( selected ) ? (
|
21 |
+
<OriginalComponent { ...this.props } />
|
22 |
+
) : (
|
23 |
<OriginalComponent
|
24 |
{ ...this.props }
|
25 |
selected={ isNil ? [] : [ selected ] }
|
assets/js/types/type-defs/contexts.ts
CHANGED
@@ -18,3 +18,8 @@ export enum SHIPPING_ERROR_TYPES {
|
|
18 |
INVALID_ADDRESS = 'invalid_address',
|
19 |
UNKNOWN = 'unknown_error',
|
20 |
}
|
|
|
|
|
|
|
|
|
|
18 |
INVALID_ADDRESS = 'invalid_address',
|
19 |
UNKNOWN = 'unknown_error',
|
20 |
}
|
21 |
+
|
22 |
+
export type NoticeContext = {
|
23 |
+
setIsSuppressed: ( val: boolean ) => undefined;
|
24 |
+
isSuppressed: boolean;
|
25 |
+
};
|
assets/js/utils/useThrottle.ts
CHANGED
@@ -9,7 +9,10 @@ import { useCallback, useEffect, useRef } from 'react';
|
|
9 |
/**
|
10 |
* Throttles a function inside a React functional component
|
11 |
*/
|
12 |
-
|
|
|
|
|
|
|
13 |
cb: T,
|
14 |
delay: number,
|
15 |
options?: ThrottleSettings
|
9 |
/**
|
10 |
* Throttles a function inside a React functional component
|
11 |
*/
|
12 |
+
// Disabling this as lodash expects this and I didn't make using `unknown`
|
13 |
+
// work in practice.
|
14 |
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
15 |
+
export function useThrottle< T extends ( ...args: any[] ) => any >(
|
16 |
cb: T,
|
17 |
delay: number,
|
18 |
options?: ThrottleSettings
|
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', 'wp-url'), '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', 'wp-url'), 'version' => 'a84c34c12883b22b0545a7929958c80e');
|
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=222)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},101: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);return 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"))),s}},105: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})}},11:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},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},110: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)}},119:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},12:function(e,t){e.exports=window.wp.isShallowEqual},122:function(e,t){},14:function(e,t){e.exports=window.wp.url},15:function(e,t){e.exports=window.wp.primitives},16:function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),s=r(3),a=r(1),l=r(
|
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:{},_=p?{"aria-hidden":!0}:O;return Object(c.createElement)(b,o()({},m,j,{className:a()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(c.createElement)(g,o()({className:"wc-block-components-chip__remove"},_),Object(c.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},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))}},222:function(e,t,r){e.exports=r(243)},223:function(e,t){},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},243:function(e,t,r){"use strict";r.r(t);var n=r(
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(f.formatPrice)(e),Object(f.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
|
8 |
/* translators: %s min price */
|
@@ -12,4 +12,4 @@ Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(f.formatPrice)(t)
|
|
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)(m.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}))))},_=function(){const e=window.location.href,t=Object(g.getQueryArgs)(e),r=Object(g.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];o.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t}));window.location.href=Object(g.addQueryArgs)(r,s)};var y=r(62),w=r(18),h=r(101),E=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:l}=e;const{results:i,isLoading:u}=Object(y.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,d]=Object(s.b)("attributes",[]);if(u)return null;const f=t.label,m=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},f,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=i.find(t=>t.slug===e);if(!s)return null;let a="";return r>0&&"and"===n&&(a=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("and","woo-gutenberg-products-block"))),j({type:f,name:Object(w.decodeEntities)(s.name||e),prefix:a,removeCallback:()=>{if(m)return 1===p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name}).slug.length?_("query_type_"+t.name,"filter_"+t.name):_({["filter_"+t.name]:e});Object(h.a)(p,d,t,e)},showLabel:!1,displayStyle:l})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a),[l,f]=Object(s.b)("attributes",[]),[m,y]=Object(s.b)("stock_status",[]),[w,h]=Object(s.b)("min_price"),[v,k]=Object(s.b)("max_price"),S=Object(a.getSetting)("stockStatusOptions",[]),x=Object(o.useMemo)(()=>{if(m.length>0)return m.map(e=>j({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:S[e],removeCallback:()=>{if(n)return _({filter_stock_status:e});const t=m.filter(t=>t!==e);y(t)},displayStyle:t.displayStyle}))},[S,m,y,t.displayStyle,n]),P=Object(o.useMemo)(()=>Number.isFinite(w)||Number.isFinite(v)?j({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:O(w,v),removeCallback:()=>{if(n)return _("max_price","min_price");h(void 0),k(void 0)},displayStyle:t.displayStyle}):null,[w,v,t.displayStyle,h,k,n]),N=Object(o.useMemo)(()=>l.map(e=>{const r=Object(d.b)(e.attribute);return Object(o.createElement)(E,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[l,t.displayStyle]),[R,A]=Object(s.b)("ratings");Object(o.useEffect)(()=>{var e;if(!n)return;if(R.length&&R.length>0)return;const t=null===(e=Object(p.c)("rating_filter"))||void 0===e?void 0:e.toString();t&&A(t.split(","))},[n,R,A]);const T=Object(o.useMemo)(()=>{if(R.length>0)return R.map(e=>j({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
|
14 |
/* translators: %s is referring to the average rating value */
|
15 |
-
Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(n)return _({rating_filter:e});const t=R.filter(t=>t!==e);A(t)},displayStyle:t.displayStyle}))},[R,A,t.displayStyle,n]);if(!(l.length>0||m.length>0||R.length>0||Number.isFinite(w)||Number.isFinite(v)||r))return null;const C="h"+t.headingLevel;if(!Object(a.getSettingWithCoercion)("has_filterable_products",!1,b.a))return null;const B=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)(C,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:B},r?Object(o.createElement)(o.Fragment,null,j({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),j({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,P,x,N,T)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{if(n)return(()=>{const e=window.location.href,t=Object(g.getQueryArgs)(e),r=Object(g.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]]));window.location.href=Object(g.addQueryArgs)(r,n)})();h(void 0),k(void 0),f([]),y([])}},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})})},3:function(e,t){e.exports=window.React},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(12),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},33:function(e,t){},35: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(7),c=r(0),s=r(12),a=r.n(s),l=r(30),i=r(58),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),f=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(d,p)||(o(Object.assign({},s,p)),f.current=!0)},[s,p,d,o]),f.current?[n,o]:[e,o]}},37: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)}()},
|
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=222)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},101: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);return 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"))),s}},105: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})}},11:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},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},110: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)}},119:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},12:function(e,t){e.exports=window.wp.isShallowEqual},122:function(e,t){},14:function(e,t){e.exports=window.wp.url},15:function(e,t){e.exports=window.wp.primitives},16:function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),s=r(3),a=r(1),l=r(43),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(33);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},18:function(e,t){e.exports=window.wp.htmlEntities},19: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},196:function(e,t,r){"use strict";var n=r(0),o=r(15);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},2:function(e,t){e.exports=window.wc.wcSettings},200:function(e,t,r){"use strict";var n=r(11),o=r.n(n),c=r(0),s=r(4),a=r.n(s),l=r(1),i=r(105),u=r(196);r(122);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:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f: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:{},_=p?{"aria-hidden":!0}:O;return Object(c.createElement)(b,o()({},m,j,{className:a()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(c.createElement)(g,o()({className:"wc-block-components-chip__remove"},_),Object(c.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},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))}},222:function(e,t,r){e.exports=r(243)},223:function(e,t){},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},243:function(e,t,r){"use strict";r.r(t);var n=r(47),o=r(0),c=r(1),s=r(35),a=r(2),l=r(4),i=r.n(l),u=r(22),b=r(119),p=r(98),d=(r(223),r(110)),f=r(37),m=r(200),g=r(14);const O=(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(f.formatPrice)(e),Object(f.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
|
8 |
/* translators: %s min price */
|
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)(m.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}))))},_=function(){const e=window.location.href,t=Object(g.getQueryArgs)(e),r=Object(g.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];o.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t}));window.location.href=Object(g.addQueryArgs)(r,s)};var y=r(62),w=r(18),h=r(101),E=e=>{let{attributeObject:t={},slugs:r=[],operator:n="in",displayStyle:l}=e;const{results:i,isLoading:u}=Object(y.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,d]=Object(s.b)("attributes",[]);if(u)return null;const f=t.label,m=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},f,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=i.find(t=>t.slug===e);if(!s)return null;let a="";return r>0&&"and"===n&&(a=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("and","woo-gutenberg-products-block"))),j({type:f,name:Object(w.decodeEntities)(s.name||e),prefix:a,removeCallback:()=>{if(m)return 1===p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name}).slug.length?_("query_type_"+t.name,"filter_"+t.name):_({["filter_"+t.name]:e});Object(h.a)(p,d,t,e)},showLabel:!1,displayStyle:l})})))};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a),[l,f]=Object(s.b)("attributes",[]),[m,y]=Object(s.b)("stock_status",[]),[w,h]=Object(s.b)("min_price"),[v,k]=Object(s.b)("max_price"),S=Object(a.getSetting)("stockStatusOptions",[]),x=Object(o.useMemo)(()=>{if(m.length>0)return m.map(e=>j({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:S[e],removeCallback:()=>{if(n)return _({filter_stock_status:e});const t=m.filter(t=>t!==e);y(t)},displayStyle:t.displayStyle}))},[S,m,y,t.displayStyle,n]),P=Object(o.useMemo)(()=>Number.isFinite(w)||Number.isFinite(v)?j({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:O(w,v),removeCallback:()=>{if(n)return _("max_price","min_price");h(void 0),k(void 0)},displayStyle:t.displayStyle}):null,[w,v,t.displayStyle,h,k,n]),N=Object(o.useMemo)(()=>l.map(e=>{const r=Object(d.b)(e.attribute);return Object(o.createElement)(E,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[l,t.displayStyle]),[R,A]=Object(s.b)("ratings");Object(o.useEffect)(()=>{var e;if(!n)return;if(R.length&&R.length>0)return;const t=null===(e=Object(p.c)("rating_filter"))||void 0===e?void 0:e.toString();t&&A(t.split(","))},[n,R,A]);const T=Object(o.useMemo)(()=>{if(R.length>0)return R.map(e=>j({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
|
14 |
/* translators: %s is referring to the average rating value */
|
15 |
+
Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(n)return _({rating_filter:e});const t=R.filter(t=>t!==e);A(t)},displayStyle:t.displayStyle}))},[R,A,t.displayStyle,n]);if(!(l.length>0||m.length>0||R.length>0||Number.isFinite(w)||Number.isFinite(v)||r))return null;const C="h"+t.headingLevel;if(!Object(a.getSettingWithCoercion)("has_filterable_products",!1,b.a))return null;const B=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)(C,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:B},r?Object(o.createElement)(o.Fragment,null,j({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),j({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,P,x,N,T)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{if(n)return(()=>{const e=window.location.href,t=Object(g.getQueryArgs)(e),r=Object(g.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]]));window.location.href=Object(g.addQueryArgs)(r,n)})();h(void 0),k(void 0),f([]),y([])}},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})})},3:function(e,t){e.exports=window.React},30:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(12),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},33:function(e,t){},35: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(7),c=r(0),s=r(12),a=r.n(s),l=r(30),i=r(58),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),f=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(d,p)||(o(Object.assign({},s,p)),f.current=!0)},[s,p,d,o]),f.current?[n,o]:[e,o]}},37: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)}()},43: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 f})),r.d(t,"g",(function(){return m})),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),f=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",{}),O=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{})},47:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(11),o=r.n(n),c=r(0),s=r(16);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},58: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(7),c=r(0),s=r(30),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),f=Object(a.a)(),m=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");f(s)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},7:function(e,t){e.exports=window.wp.data},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})},[])}},98:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return s}));var n=r(14);const o="query_type_",c="filter_";function s(e){return window?Object(n.getQueryArg)(window.location.href,e):null}}});
|
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', 'wp-url'), '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', 'wp-url'), 'version' => 'b7912191d96d670a63a55689fe435e86');
|
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 c,l,i=t[0],a=t[1],s=t[2],b=0,p=[];b<i.length;b++)l=i[b],Object.prototype.hasOwnProperty.call(n,l)&&n[l]&&p.push(n[l][0]),n[l]=0;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],c=!0,i=1;i<r.length;i++){var a=r[i];0!==n[a]&&(c=!1)}c&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var c={},n={6:0},o=[];function l(t){if(c[t])return c[t].exports;var r=c[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=c,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)l.d(r,c,function(t){return e[t]}.bind(null,c));return r},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 i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=a;return o.push([
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
-
Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:n,onClick:()=>r(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:r,selectedLevel:o,onChange:i}=this.props;return Object(c.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(c.createElement)(a,{level:o}),controls:Object(n.range)(t,r).map(e=>this.createLevelControl(e,o,i))})}}t.a=s},
|
4 |
/* translators: Remove chip. */
|
5 |
Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
-
Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:c,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},h=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,n()({},f,j,{className:i()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(o.createElement)(g,n()({className:"wc-block-components-chip__remove"},h),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(y.formatPrice)(e),Object(y.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
|
10 |
/* translators: %s min price */
|
@@ -14,4 +14,4 @@ Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(y.formatPrice)(t)
|
|
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"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===a?Object(o.createElement)(k.a,{element:"span",text:s,onRemove:n,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},s,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:n},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)(h.a,{screenReaderLabel:u}))))},C=function(){const e=window.location.href,t=Object(E.getQueryArgs)(e),r=Object(E.removeQueryArgs)(e,...Object.keys(t));for(var c=arguments.length,n=new Array(c),o=0;o<c;o++)n[o]=arguments[o];n.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],c=t[r].split(",");t[r]=c.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t}));window.location.href=Object(E.addQueryArgs)(r,l)};var N=r(125),L=r(14),R=r(170),T=e=>{let{attributeObject:t={},slugs:r=[],operator:c="in",displayStyle:n}=e;const{results:i,isLoading:a}=Object(N.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[s,u]=Object(O.b)("attributes",[]);if(a)return null;const b=t.label,p=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,w.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const a=i.find(t=>t.slug===e);if(!a)return null;let d="";return r>0&&"and"===c&&(d=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("and","woo-gutenberg-products-block"))),S({type:b,name:Object(L.decodeEntities)(a.name||e),prefix:d,removeCallback:()=>{if(p)return 1===s.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name}).slug.length?C("query_type_"+t.name,"filter_"+t.name):C({["filter_"+t.name]:e});Object(R.a)(s,u,t,e)},showLabel:!1,displayStyle:n})})))},H=e=>{let{attributes:t,isEditor:r=!1}=e;const c=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,w.a),[n,i]=Object(O.b)("attributes",[]),[a,s]=Object(O.b)("stock_status",[]),[u,b]=Object(O.b)("min_price"),[d,m]=Object(O.b)("max_price"),f=Object(j.getSetting)("stockStatusOptions",[]),g=Object(o.useMemo)(()=>{if(a.length>0)return a.map(e=>S({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:f[e],removeCallback:()=>{if(c)return C({filter_stock_status:e});const t=a.filter(t=>t!==e);s(t)},displayStyle:t.displayStyle}))},[f,a,s,t.displayStyle,c]),y=Object(o.useMemo)(()=>Number.isFinite(u)||Number.isFinite(d)?S({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:x(u,d),removeCallback:()=>{if(c)return C("max_price","min_price");b(void 0),m(void 0)},displayStyle:t.displayStyle}):null,[u,d,t.displayStyle,b,m,c]),k=Object(o.useMemo)(()=>n.map(e=>{const r=Object(_.b)(e.attribute);return Object(o.createElement)(T,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]),[N,L]=Object(O.b)("ratings");Object(o.useEffect)(()=>{var e;if(!c)return;if(N.length&&N.length>0)return;const t=null===(e=Object(v.c)("rating_filter"))||void 0===e?void 0:e.toString();t&&L(t.split(","))},[c,N,L]);const R=Object(o.useMemo)(()=>{if(N.length>0)return N.map(e=>S({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
|
16 |
/* translators: %s is referring to the average rating value */
|
17 |
-
Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(c)return C({rating_filter:e});const t=N.filter(t=>t!==e);L(t)},displayStyle:t.displayStyle}))},[N,L,t.displayStyle,c]);if(!(n.length>0||a.length>0||N.length>0||Number.isFinite(u)||Number.isFinite(d)||r))return null;const H="h"+t.headingLevel;if(!Object(j.getSettingWithCoercion)("has_filterable_products",!1,w.a))return null;const V=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&Object(o.createElement)(H,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:V},r?Object(o.createElement)(o.Fragment,null,S({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),S({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,y,g,k,R)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{if(c)return(()=>{const e=window.location.href,t=Object(E.getQueryArgs)(e),r=Object(E.removeQueryArgs)(e,...Object.keys(t)),c=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]]));window.location.href=Object(E.addQueryArgs)(r,c)})();b(void 0),m(void 0),i([]),s([])}},Object(o.createElement)(h.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=Object(g.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r}=e;const{className:c,displayStyle:n,heading:i,headingLevel:a}=t,s=Object(d.useBlockProps)({className:c});return Object(o.createElement)("div",s,Object(o.createElement)(d.InspectorControls,{key:"inspector"},Object(o.createElement)(g.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(g.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:n,onChange:e=>r({displayStyle:e})},Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:a,onChange:e=>r({headingLevel:e})}))),Object(o.createElement)(f.a,{className:"wc-block-active-filters__title",headingLevel:a,heading:i,onChange:e=>r({heading:e})}),Object(o.createElement)(g.Disabled,null,Object(o.createElement)(H,{attributes:t,isEditor:!0})))});Object(i.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:s,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}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(i.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:V,save(e){let{attributes:t}=e;const{className:r,displayStyle:c,heading:l,headingLevel:i}=t,a={"data-display-style":c,"data-heading":l,"data-heading-level":i};return Object(o.createElement)("div",n()({},d.useBlockProps.save({className:p()("is-loading",r)}),a),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var c=r(0);const n=Object(c.createContext)("page"),o=()=>Object(c.useContext)(n);n.Provider},7:function(e,t){e.exports=window.lodash},
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var c,l,i=t[0],a=t[1],s=t[2],b=0,p=[];b<i.length;b++)l=i[b],Object.prototype.hasOwnProperty.call(n,l)&&n[l]&&p.push(n[l][0]),n[l]=0;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],c=!0,i=1;i<r.length;i++){var a=r[i];0!==n[a]&&(c=!1)}c&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var c={},n={6:0},o=[];function l(t){if(c[t])return c[t].exports;var r=c[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=c,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)l.d(r,c,function(t){return e[t]}.bind(null,c));return r},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 i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=a;return o.push([426,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},102:function(e,t,r){"use strict";var c=r(0),n=r(7),o=r(1),l=r(3),i=r(11);function a(e){let{level:t}=e;const r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?Object(c.createElement)(i.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(i.Path,{d:r[t]})):null}class s extends c.Component{createLevelControl(e,t,r){const n=e===t;return{icon:Object(c.createElement)(a,{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:n,onClick:()=>r(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:r,selectedLevel:o,onChange:i}=this.props;return Object(c.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(c.createElement)(a,{level:o}),controls:Object(n.range)(t,r).map(e=>this.createLevelControl(e,o,i))})}}t.a=s},11:function(e,t){e.exports=window.wp.primitives},110:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var c=r(8);function n(e,t){const r=Object(c.useRef)();return Object(c.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},121:function(e,t,r){"use strict";var c=r(0),n=r(5),o=r(10),l=r(1);r(155),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:i,instanceId:a}=e;const s="h"+r;return Object(c.createElement)(s,{className:t},Object(c.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+a},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(c.createElement)(n.PlainText,{id:"block-title-"+a,className:"wc-block-editor-components-title",value:i,onChange:o}))})},124:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var c=r(0);const n=()=>{const[,e]=Object(c.useState)();return Object(c.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var c=r(18),n=r(9),o=r(0),l=r(49),i=r(124);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:s={},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(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(s),d=Object(l.a)(a),m=Object(i.a)(),f=Object(n.useSelect)(e=>{if(!u)return null;const n=e(c.COLLECTIONS_STORE_KEY),o=[t,r,p,d],l=n.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:n.getCollection(...o),isLoading:!n.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},13:function(e,t){e.exports=window.wp.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},155:function(e,t){},156:function(e,t){},16:function(e,t){e.exports=window.wp.url},166:function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return o})),r.d(t,"c",(function(){return l}));var c=r(16);const n="query_type_",o="filter_";function l(e){return window?Object(c.getQueryArg)(window.location.href,e):null}},170:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return o}));var c=r(7);const n=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,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(n)))return;const i=l.slug.filter(e=>e!==n),a=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(l.slug=i.sort(),a.push(l)),t(Object(c.sortBy)(a,"attribute"))},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,n=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!==r.taxonomy);return 0===n.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:n.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(c.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wc.wcBlocksData},2:function(e,t){e.exports=window.wc.wcSettings},201:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var c=r(2);const n=Object(c.getSetting)("attributes",[]).reduce((e,t)=>{const r=(c=t)&&c.attribute_name?{id:parseInt(c.attribute_id,10),name:c.attribute_name,taxonomy:"pa_"+c.attribute_name,label:c.attribute_label}:null;var c;return r.id&&e.push(r),e},[]),o=e=>{if(e)return n.find(t=>t.id===e)},l=e=>{if(e)return n.find(t=>t.taxonomy===e)}},212:function(e,t,r){"use strict";var c=r(6),n=r.n(c),o=r(0),l=r(4),i=r.n(l),a=r(1),s=r(114),u=r(546);r(156);var b=e=>{let{text:t,screenReaderText:r="",element:c="li",className:l="",radius:a="small",children:s=null,...u}=e;const b=c,p=i()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+a),d=Boolean(r&&r!==t);return Object(o.createElement)(b,n()({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"},r),s)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:c=!1,onRemove:l=(()=>{}),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?
|
4 |
/* translators: Remove chip. */
|
5 |
Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
+
Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:c,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},h=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,n()({},f,j,{className:i()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(o.createElement)(g,n()({className:"wc-block-components-chip__remove"},h),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},242:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));const c=e=>"boolean"==typeof e},25:function(e,t){e.exports=window.wp.isShallowEqual},27:function(e,t){e.exports=window.wc.priceFormat},3:function(e,t){e.exports=window.wp.components},30:function(e,t,r){"use strict";var c=r(0),n=r(4),o=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:l,wrapperProps:i={}}=e;const a=null!=r,s=null!=n;return!a&&s?(t=l||"span",i={...i,className:o()(i.className,"screen-reader-text")},Object(c.createElement)(t,i,n)):(t=l||c.Fragment,a&&s&&r!==n?Object(c.createElement)(t,i,Object(c.createElement)("span",{"aria-hidden":"true"},r),Object(c.createElement)("span",{className:"screen-reader-text"},n)):Object(c.createElement)(t,i,r))}},426:function(e,t,r){e.exports=r(491)},427:function(e,t){},49:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var c=r(0),n=r(25),o=r.n(n);function l(e){const t=Object(c.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},491:function(e,t,r){"use strict";r.r(t);var c=r(6),n=r.n(c),o=r(0),l=r(1),i=r(13),a=r(11),s=Object(o.createElement)(a.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=r(114),b=r(4),p=r.n(b),d=r(5),m=r(102),f=r(121),g=r(3),O=r(75),j=r(2),h=r(30),w=r(242),v=r(166),_=(r(427),r(201)),y=r(27),k=r(212),E=r(16);const x=(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(y.formatPrice)(e),Object(y.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
|
10 |
/* translators: %s min price */
|
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"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===a?Object(o.createElement)(k.a,{element:"span",text:s,onRemove:n,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},s,Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:n},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)(h.a,{screenReaderLabel:u}))))},C=function(){const e=window.location.href,t=Object(E.getQueryArgs)(e),r=Object(E.removeQueryArgs)(e,...Object.keys(t));for(var c=arguments.length,n=new Array(c),o=0;o<c;o++)n[o]=arguments[o];n.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],c=t[r].split(",");t[r]=c.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t}));window.location.href=Object(E.addQueryArgs)(r,l)};var N=r(125),L=r(14),R=r(170),T=e=>{let{attributeObject:t={},slugs:r=[],operator:c="in",displayStyle:n}=e;const{results:i,isLoading:a}=Object(N.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[s,u]=Object(O.b)("attributes",[]);if(a)return null;const b=t.label,p=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,w.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const a=i.find(t=>t.slug===e);if(!a)return null;let d="";return r>0&&"and"===c&&(d=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("and","woo-gutenberg-products-block"))),S({type:b,name:Object(L.decodeEntities)(a.name||e),prefix:d,removeCallback:()=>{if(p)return 1===s.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name}).slug.length?C("query_type_"+t.name,"filter_"+t.name):C({["filter_"+t.name]:e});Object(R.a)(s,u,t,e)},showLabel:!1,displayStyle:n})})))},H=e=>{let{attributes:t,isEditor:r=!1}=e;const c=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,w.a),[n,i]=Object(O.b)("attributes",[]),[a,s]=Object(O.b)("stock_status",[]),[u,b]=Object(O.b)("min_price"),[d,m]=Object(O.b)("max_price"),f=Object(j.getSetting)("stockStatusOptions",[]),g=Object(o.useMemo)(()=>{if(a.length>0)return a.map(e=>S({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:f[e],removeCallback:()=>{if(c)return C({filter_stock_status:e});const t=a.filter(t=>t!==e);s(t)},displayStyle:t.displayStyle}))},[f,a,s,t.displayStyle,c]),y=Object(o.useMemo)(()=>Number.isFinite(u)||Number.isFinite(d)?S({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:x(u,d),removeCallback:()=>{if(c)return C("max_price","min_price");b(void 0),m(void 0)},displayStyle:t.displayStyle}):null,[u,d,t.displayStyle,b,m,c]),k=Object(o.useMemo)(()=>n.map(e=>{const r=Object(_.b)(e.attribute);return Object(o.createElement)(T,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator})}),[n,t.displayStyle]),[N,L]=Object(O.b)("ratings");Object(o.useEffect)(()=>{var e;if(!c)return;if(N.length&&N.length>0)return;const t=null===(e=Object(v.c)("rating_filter"))||void 0===e?void 0:e.toString();t&&L(t.split(","))},[c,N,L]);const R=Object(o.useMemo)(()=>{if(N.length>0)return N.map(e=>S({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
|
16 |
/* translators: %s is referring to the average rating value */
|
17 |
+
Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(c)return C({rating_filter:e});const t=N.filter(t=>t!==e);L(t)},displayStyle:t.displayStyle}))},[N,L,t.displayStyle,c]);if(!(n.length>0||a.length>0||N.length>0||Number.isFinite(u)||Number.isFinite(d)||r))return null;const H="h"+t.headingLevel;if(!Object(j.getSettingWithCoercion)("has_filterable_products",!1,w.a))return null;const V=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&Object(o.createElement)(H,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:V},r?Object(o.createElement)(o.Fragment,null,S({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),S({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,y,g,k,R)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{if(c)return(()=>{const e=window.location.href,t=Object(E.getQueryArgs)(e),r=Object(E.removeQueryArgs)(e,...Object.keys(t)),c=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]]));window.location.href=Object(E.addQueryArgs)(r,c)})();b(void 0),m(void 0),i([]),s([])}},Object(o.createElement)(h.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))},V=Object(g.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r}=e;const{className:c,displayStyle:n,heading:i,headingLevel:a}=t,s=Object(d.useBlockProps)({className:c});return Object(o.createElement)("div",s,Object(o.createElement)(d.InspectorControls,{key:"inspector"},Object(o.createElement)(g.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(g.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:n,onChange:e=>r({displayStyle:e})},Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:a,onChange:e=>r({headingLevel:e})}))),Object(o.createElement)(f.a,{className:"wc-block-active-filters__title",headingLevel:a,heading:i,onChange:e=>r({heading:e})}),Object(o.createElement)(g.Disabled,null,Object(o.createElement)(H,{attributes:t,isEditor:!0})))});Object(i.registerBlockType)("woocommerce/active-filters",{apiVersion:2,title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:s,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}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(i.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:V,save(e){let{attributes:t}=e;const{className:r,displayStyle:c,heading:l,headingLevel:i}=t,a={"data-display-style":c,"data-heading":l,"data-heading-level":i};return Object(o.createElement)("div",n()({},d.useBlockProps.save({className:p()("is-loading",r)}),a),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var c=r(0);const n=Object(c.createContext)("page"),o=()=>Object(c.useContext)(n);n.Provider},7:function(e,t){e.exports=window.lodash},75: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 c=r(18),n=r(9),o=r(0),l=r(25),i=r.n(l),a=r(49),s=r(110),u=r(50);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(n.useSelect)(t=>t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(n.useDispatch)(c.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const i=Object(n.useSelect)(n=>n(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(n.useDispatch)(c.QUERY_STATE_STORE_KEY);return[i,Object(o.useCallback)(t=>{a(r,e,t)},[r,e,a])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[c,n]=b(t),l=Object(a.a)(c),p=Object(a.a)(e),d=Object(s.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{i()(d,p)||(n(Object.assign({},l,p)),m.current=!0)},[l,p,d,n]),m.current?[c,n]:[e,n]}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.data}});
|
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' => '23e45b092c86207e63ebd052fb9ed578');
|
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={9:0,73: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/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",58:"product-add-to-cart",59:"product-button",60:"product-category-list",61:"product-image",62:"product-price",63:"product-rating",64:"product-sale-badge",65:"product-sku",66:"product-stock-indicator",67:"product-summary",68:"product-tag-list",69:"product-title",74:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"1d36f73838f02eb72b0e",1:"e2dda84269ff5f357820",58:"a1f5c37ffde9d75afc47",59:"31d91954dd894b010db7",60:"bdcd55f6a78f3780a8c9",61:"1ec1ff9f0e063d3f63ae",62:"36221c05f2759b8bd8fd",63:"09acab57fd9a8594caac",64:"c6ec41b82cb1fe4af0c7",65:"f04dd44c9314944f232b",66:"1e1f4698349331747d15",67:"d613d9c8a37c5b8d3b1a",68:"d655fde20ee518912eb5",69:"9275c1cccdfd844d56f7",74:"d4bf9e962fb49977699e"}[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=207)}([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){e.exports=window.wp.data},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){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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),i=r(3),s=r(1),a=r(44),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(33);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=window.wp.htmlEntities},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){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(38);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 c}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(12),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(7),s=r(18),a=r(118),l=r(27),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){},,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(7),c=r(0),i=r(12),s=r.n(i),a=r(30),l=r(58),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";r.d(t,"a",(function(){return i}));var n=r(39),o=r(0),c=r(31);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,r){"use strict";var n=r(8),o=r(0),c=r(15),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(52);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(11),o=r.n(n),c=r(0),i=r(16);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(8),o=r(0),c=r(4),i=r.n(c),s=r(6),a=r(32),l=r.n(a),u=r(13),d=r(51),p=r(93),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 S({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 C=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 P(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(S,e))}r(12),o.Component;const R=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function N(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:S,__unstableStickyBoundaryElement:C,__unstableSlotName:R="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(R),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,C,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,C,M,F]);const $=(e,r)=>{if("focus-outside"===e&&S)S(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=N(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)(P,{name:R},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)(R,{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(41),U=r(42);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,...S}=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),C=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}),P=m&&!x,R=void 0===r||P?"button":"a",N="a"===R?{href:r,target:c}:{type:"button",disabled:P,"aria-pressed":u};if(m&&x){N["aria-disabled"]=!0;for(const e of q)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!P&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=S["aria-describedby"]||L,A=Object(o.createElement)(R,Object(n.a)({},N,S,{className:C,"aria-label":S["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 n}));const n=e=>"string"==typeof e},,,,,function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),c=()=>Object(n.useContext)(o),i=e=>{let{children:t}=e;const[r,c]=Object(n.useState)(!1),i={setIsSuppressed:c,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:i},t)}},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 a}));var n=r(5),o=r(7),c=r(0),i=r(30),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(11),o=r.n(n),c=r(0);r(107);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";var n=r(0),o=r(15);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,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(93),u=r(50);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){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(123),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(45),o=(r(14),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){},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(11),o=r.n(n),c=r(0),i=r(4),s=r.n(i),a=r(94),l=r(7),u=(r(78),r(57));const d=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""},p=e=>{let{className:t,context:r="default",additionalNotices:n=[]}=e;const{isSuppressed:i}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:b}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const f=s()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:f},m.map(e=>Object(c.createElement)(a.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&b(e.id,r)}}),e.content)))}},,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(17),o=r(0),c=r(44);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(62)]).then(r.bind(null,399)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,443)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,444)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,400)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,401)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,402)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,312)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,403)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,404)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,405)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(74),r.e(58)]).then(r.bind(null,426)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(235)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(57),c=r(48),i=r(3),s=r(1),a=r(6),l=r(4),u=r.n(l),d=r(22);r(210);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(58),m=r(35),f=r(62),g=r(5),h=r(7),E=r(30);var O=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: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(P);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)(R,{onChange:c,value:i}),!G&&K&&Object(n.createElement)(C,{resetCallback:()=>{w([]),_([]),S(null),N(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"}));var W=r(124);class V 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)(o.a,null,Object(n.createElement)(W.a,{context:"wc/all-products"})),Object(n.createElement)(z,{attributes:e,urlParameterSuffix:t}))}}var Y=V;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(n.createElement)(o.a,{context:"wc/all-products"},Object(n.createElement)(Y,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
|
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={9:0,73: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/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",58:"product-add-to-cart",59:"product-button",60:"product-category-list",61:"product-image",62:"product-price",63:"product-rating",64:"product-sale-badge",65:"product-sku",66:"product-stock-indicator",67:"product-summary",68:"product-tag-list",69:"product-title",74:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"4cd1d7b80996e87c4732",1:"435b3501d50007652e66",58:"105a3bb88017d80c2a56",59:"ec5234e454192c849c2c",60:"c82f9b862341ad2e9ca7",61:"f857bed110cc68691ef9",62:"886c597bad75c850de41",63:"0252e5fd9553c93cac32",64:"3f523c37ba7467b85fa3",65:"c3732ff60b95547e2cf1",66:"43d9c185ee22afad8ec6",67:"5e3ea6ba89da8ddb0307",68:"26556f5bd2c35d338f4d",69:"912f94e222c23abf5944",74:"f9c981e797d85c304bd4"}[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=207)}([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){e.exports=window.wp.data},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){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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),i=r(3),s=r(1),a=r(43),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(33);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=window.wp.htmlEntities},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){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(38);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 c}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(12),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(7),s=r(18),a=r(118),l=r(27),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){},,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(7),c=r(0),i=r(12),s=r.n(i),a=r(30),l=r(58),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(8),o=r(0),c=r(15),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(51);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(11),o=r.n(n),c=r(0),i=r(16);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(8),o=r(0),c=r(4),i=r.n(c),s=r(6),a=r(32),l=r.n(a),u=r(13),d=r(50),p=r(93),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 S({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 C=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 P(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(S,e))}r(12),o.Component;const R=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function N(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:S,__unstableStickyBoundaryElement:C,__unstableSlotName:R="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(R),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,C,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,C,M,F]);const $=(e,r)=>{if("focus-outside"===e&&S)S(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=N(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)(P,{name:R},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)(R,{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(40),U=r(41);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,...S}=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),C=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}),P=m&&!x,R=void 0===r||P?"button":"a",N="a"===R?{href:r,target:c}:{type:"button",disabled:P,"aria-pressed":u};if(m&&x){N["aria-disabled"]=!0;for(const e of q)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!P&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=S["aria-describedby"]||L,A=Object(o.createElement)(R,Object(n.a)({},N,S,{className:C,"aria-label":S["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 n}));const n=e=>"string"==typeof e},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(39),o=r(0),c=r(31);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,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),c=()=>Object(n.useContext)(o),i=e=>{let{children:t}=e;const[r,c]=Object(n.useState)(!1),i={setIsSuppressed:c,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:i},t)}},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 a}));var n=r(5),o=r(7),c=r(0),i=r(30),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(11),o=r.n(n),c=r(0);r(107);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";var n=r(0),o=r(15);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,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(93),u=r(49);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){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(123),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(44),o=(r(14),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){},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(11),o=r.n(n),c=r(0),i=r(4),s=r.n(i),a=r(94),l=r(7),u=(r(78),r(57));const d=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""},p=e=>{let{className:t,context:r="default",additionalNotices:n=[]}=e;const{isSuppressed:i}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:b}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const f=s()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:f},m.map(e=>Object(c.createElement)(a.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&b(e.id,r)}}),e.content)))}},,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(17),o=r(0),c=r(43);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(62)]).then(r.bind(null,399)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,443)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,444)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,400)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,401)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,402)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,312)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,403)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,404)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,405)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(74),r.e(58)]).then(r.bind(null,426)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(235)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(57),c=r(47),i=r(3),s=r(1),a=r(6),l=r(4),u=r.n(l),d=r(22);r(210);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(58),m=r(35),f=r(62),g=r(5),h=r(7),E=r(30);var O=r(56),w=r(73),j=r(42),v=r(20),y=r(105),_=r(15),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")))},S=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"})),C=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:S,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")))},P=r(109);r(209);var R=e=>{let{onChange:t,value:r}=e;return Object(n.createElement)(P.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})},N=r(13),T=r(11),L=r.n(T),B=r(133);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(N.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(208);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,S]=Object(m.b)("min_price"),[P,N]=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(P);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)(R,{onChange:c,value:i}),!G&&K&&Object(n.createElement)(C,{resetCallback:()=>{w([]),_([]),S(null),N(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"}));var W=r(124);class V 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)(o.a,null,Object(n.createElement)(W.a,{context:"wc/all-products"})),Object(n.createElement)(z,{attributes:e,urlParameterSuffix:t}))}}var Y=V;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(n.createElement)(o.a,{context:"wc/all-products"},Object(n.createElement)(Y,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' => '4d7eac1b4553a384bf65c0d51a9e5941');
|
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={7:0,1:0,2:0,3:0,4:0,5:0,21:0,24:0,28:0,29:0,31:0,32:0,33:0,35: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-add-to-cart--product-button",5:"product-sale-badge",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",29:"product-rating",31:"product-sku",32:"product-stock-indicator",33:"product-summary",35:"product-tag-list",36:"product-title"}[e]||e)+".js?ver="+{1:"fe377732e70f1d828d69",2:"
|
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(16),o=c(15),n=c.n(o),a=c(7),s=c(2),l=c(23);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){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(14);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"}},a=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&&e.message?Object(o.decodeEntities)(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,c){"use strict";var r=c(0),o=c(1),n=c(33);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){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(21);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,"c",(function(){return n})),c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"d",(function(){return d}));var r=c(59);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(6),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(18),a=c(9),s=c(14),l=c(232),i=c(51),u=c(231);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(5),o=c(71),n=c(122),a=c(59),s=c(95);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,"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 n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},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(9);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){e.exports=window.wp.hooks},,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,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){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";c.d(t,"a",(function(){return a}));var r=c(52),o=c(0),n=c(39);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";var r=c(6),o=c.n(r),n=c(0),a=c(135),s=c(4),l=c.n(s),i=c(94);c(150),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,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(13),o=c(23);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.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(18),o=c(9),n=c(0),a=c(25),s=c.n(a),l=c(49),i=c(109),u=c(50);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";var r=c(6),o=c.n(r),n=c(0),a=c(34),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.wordcount},,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(157),a=c(122);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(151),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},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(27);c(149);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";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(7),l=c(34),i=c(100),u=c(10),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(178),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(26),h=c(28),_=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(85);c(131);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)(
|
10 |
/* translators: %1$d is the number of variations of a product product. */
|
11 |
Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
|
12 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
13 |
-
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,"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(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(
|
14 |
-
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
|
15 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
16 |
-
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(113),a=c(230),s=c(2),l=c(5),i=c(29);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(6),o=c.n(r),n=c(0),a=c(14),s=c(4),l=c.n(s);c(148),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(9);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(r.select)("core/notices").getNotices(),{removeNotice:o}=Object(r.dispatch)("core/notices"),n=c.filter(t=>t.status===e);n.forEach(e=>o(e.id,t))}},function(e,t,c){"use strict";var r=c(0),o=c(90),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(30),s=c(10);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(18),o=c(9),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){},,,,,,,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(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(179),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,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(0);const o=Object(r.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),n=()=>Object(r.useContext)(o),a=e=>{let{children:t}=e;const[c,n]=Object(r.useState)(!1),a={setIsSuppressed:n,isSuppressed:c};return Object(r.createElement)(o.Provider,{value:a},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,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(23),s=c(26),l=c(112),i=c(28);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){},,,,,,function(e,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(30),l=c(29),i=c(57),u=(c(356),c(43));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";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,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(118);c(175);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,"a",(function(){return b}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(273),i=c(9),u=(c(185),c(143));const d=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""},b=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const{isSuppressed:a}=Object(u.b)(),{notices:b}=Object(i.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:p}=Object(i.useDispatch)("core/notices"),m=b.filter(e=>"snackbar"!==e.type).concat(r);if(!m.length)return null;const g=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:g},m.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&p(e.id,c)}}),e.content)))}},,,,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(93),o=(c(16),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(98);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){},function(e,t,c){"use strict";var r=c(71);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},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(29),s=c(71),l=c(57),i=c(115),u=c(66),d=(c(355),c(43));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,linkTarget:l,align:p}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:g}=Object(a.useProductDataContext)(),{dispatchStoreEvent:O}=Object(u.a)(),j=Object(d.b)(e),h=Object(d.c)(e),_=Object(d.d)(e);return g.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:g.name,permalink:g.permalink,target:l,onClick:()=>{O("product-view-link",{product:g})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.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(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(29),d=c(57),b=c(66),p=c(216),m=(c(357),c(43));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,...!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(
|
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)(de.a,{icon:be.a}))};var je=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(se.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(pe.a)(),{cartQuantity:m}=Object(me.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)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(ge,{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})}})},he=c(
|
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(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(
|
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")),N=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)(N,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),x)},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(
|
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 n}));var r=c(1),o=c(23);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(486)},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(9),n=c(18),a=c(14),s=c(39);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},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 Kt}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(5),l=c(13),i=c(113),u=c(541),d=c(71),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(276),O=c(3),j=c(10),h=c(103),_=c(277),E=c(97),w=c(139),f=c(29);c(403);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(542);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(404);const x=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i,linkTarget:u}=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.__)("Link settings","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Make title a link","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}),l&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var N=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")})])(x):x;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(95);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:N,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(290),A=c(543);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(278);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(2),Q=c(279),Y=c(544);const U=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{icon:Y.a,className:"wc-block-editor-components-block-icon"}),$=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var K=k({icon:W,label:U,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)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"left",label:Object(a.__)("Left","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"center",label:Object(a.__)("Center","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"right",label:Object(a.__)("Right","woo-gutenberg-products-block")})),Object(n.createElement)(O.__experimentalToggleGroupControl,{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(G.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,onChange:e=>c({imageSizing:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(a.__)("Full Size","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(a.__)("Cropped","woo-gutenberg-products-block")})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Q.a,t)))});const J={apiVersion:2,title:U,description:$,icon:{src:W},attributes:H.a,edit:K,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,...J});var X=c(291),Z=c(537);const ee=Object(a.__)("Product Rating","woo-gutenberg-products-block"),te=Object(n.createElement)(i.a,{icon:Z.a,className:"wc-block-editor-components-block-icon"}),ce=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var re=k({icon:te,label:ee,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)(X.default,t))});const oe={apiVersion:2,title:ee,description:ce,icon:{src:te},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:re,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,...oe});var ne=c(292),ae=c(545);const se=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),le=Object(n.createElement)(i.a,{icon:ae.a,className:"wc-block-editor-components-block-icon"}),ie=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 ue=k({icon:le,label:se,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)(ne.default,t)))});const de={apiVersion:2,title:se,description:ie,icon:{src:le},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:ue,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...de});var be=c(293),pe=c(546);const me=Object(a.__)("Product Summary","woo-gutenberg-products-block"),ge=Object(n.createElement)(i.a,{icon:pe.a,className:"wc-block-editor-components-block-icon"}),Oe=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(406);var je=k({icon:ge,label:me,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)(be.default,t))});const he={apiVersion:2,title:me,description:Oe,icon:{src:ge},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:je,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,...he});var _e=c(216),Ee=c(535);const we=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),fe=Object(n.createElement)(i.a,{icon:Ee.a,className:"wc-block-editor-components-block-icon"}),ke=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ye=k({icon:fe,label:we,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)(_e.default,t))});const ve={title:we,description:ke,icon:{src:fe},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:ye,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,...ve});var Se=c(104),Ce=c(294),xe=c(11),Ne=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 Pe=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Te=Object(n.createElement)(i.a,{icon:Ne,className:"wc-block-editor-components-block-icon"}),Re={title:Pe,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Te},attributes:{productId:{type:"number",default:0}},edit:k({icon:Te,label:Pe,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)(Se.a,null),Object(n.createElement)(Ce.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Re});var Ie=c(295),Ae=c(547);const Be=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{icon:Ae.a,className:"wc-block-editor-components-block-icon"}),De=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Ve=k({icon:Le,label:Be,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)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ie.default,t)))});const Fe={...m,apiVersion:2,title:Be,description:De,icon:{src:Le},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:Ve};Object(d.c)("woocommerce/product-category-list",Fe);var Me=c(296),ze=c(540);const He=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),qe=Object(n.createElement)(i.a,{icon:ze.a,className:"wc-block-editor-components-block-icon"}),Ge=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Qe=k({icon:qe,label:He,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)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Me.default,t)))});const Ye={apiVersion:2,title:He,description:Ge,icon:{src:qe},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:Qe,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,...Ye});var Ue=c(297),We=c(548);const $e=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Ke=Object(n.createElement)(i.a,{icon:We.a,className:"wc-block-editor-components-block-icon"}),Je=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Xe=k({icon:Ke,label:$e,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)(Se.a,null),Object(n.createElement)(Ue.default,t))});const Ze={apiVersion:2,title:$e,description:Je,icon:{src:Ke},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:Xe,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,...Ze});var et=c(522),tt=(c(275),c(281)),ct=c(217);const rt=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),ot=Object(n.createElement)(i.a,{icon:ct.a,className:"wc-block-editor-components-block-icon"}),nt={title:rt,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ot},edit:k({icon:ot,label:rt,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)(Se.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(et.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)(tt.a,t)))}),attributes:c(280).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...nt});var at=c(24),st=c.n(at),lt=c(9),it=c(64),ut=c(514),dt=c(392),bt=c(23);const pt=(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 mt=c(230);const gt=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],Ot=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?Ot(e.innerBlocks):[]}]):[];var jt=c(8),ht=c(7),_t=c(30);c(412);var Et=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)(_t.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)(_t.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)(_t.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)(_t.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)(_t.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)(_t.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},wt=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:x}=t,N=t.columns*t.rows,P=!Number.isFinite(E)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/N):Math.ceil(E/N),T=_.length?_:Array.from({length:N}),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==x?void 0:x.orderBy)&&R&&Object(n.createElement)(At,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(Rt,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Pt,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)(Lt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(Et,{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)(Ft,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];Ct(e),null==e||e.focus()}else Ct(e)})(e,c):Ct(e))})(t.current,e)}})))}),zt=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)(Mt,{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})},Ht=c(138),qt=c(143),Gt=c(227);class Qt extends jt.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Ht.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(qt.a,null,Object(n.createElement)(Gt.a,{context:"wc/all-products"})),Object(n.createElement)(zt,{attributes:e,urlParameterSuffix:t}))}}var Yt=Qt;c(409);class Ut extends n.Component{constructor(){super(...arguments),st()(this,"state",{isEditing:!1,innerBlocks:[]}),st()(this,"blockMap",Object(ut.a)("woocommerce/all-products")),st()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),st()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),st()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),st()(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"))}),st()(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)(it.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(G.getSetting)("min_columns",1),maxColumns:Object(G.getSetting)("max_columns",6),minRows:Object(G.getSetting)("min_rows",1),maxRows:Object(G.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)))}),st()(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}]}))}),st()(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:dt.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:Ot(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=[];gt.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")))))}),st()(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)(Yt,{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)}),st()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===bt.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:G.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:mt.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:pt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Wt=Object(j.compose)(O.withSpokenMessages,Object(lt.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(lt.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ut);const $t={columns:Object(G.getSetting)("default_columns",3),rows:Object(G.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:gt,isPreview:!1},Kt={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:$t,edit:e=>Object(n.createElement)(Wt,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:pt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...Kt,deprecated:[{attributes:Object.assign({},Kt.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:pt("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(23);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(28)]).then(c.bind(null,290)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(5),c.e(25)]).then(c.bind(null,568)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(36)]).then(c.bind(null,569)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(29)]).then(c.bind(null,291)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(21)]).then(c.bind(null,292)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,293)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5)]).then(c.bind(null,216)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(31).then(c.bind(null,294)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,295)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,296)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,297)))}),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(4),c.e(19)]).then(c.bind(null,570)))});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={7:0,1:0,2:0,3:0,4:0,5:0,21:0,24:0,28:0,29:0,31:0,32:0,33:0,35: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-add-to-cart--product-button",5:"product-sale-badge",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",29:"product-rating",31:"product-sku",32:"product-stock-indicator",33:"product-summary",35:"product-tag-list",36:"product-title"}[e]||e)+".js?ver="+{1:"fe377732e70f1d828d69",2:"aae0ab3aec524bc39685",3:"f4d032cb365381346878",4:"2cdaf1a0dc42c5e596de",5:"a9a8eecd9ea81dba121c",19:"c049cc8501a0d1e37c2d",21:"021805f768c99fae3b88",24:"c16bc2154158773d1da8",25:"f6236db823f1baa30ee5",28:"e673a13e661b183da8c9",29:"4ab6a0ebab75a24dfaf2",31:"474a1834a542f411329f",32:"560b0cd9e903a7ada4dc",33:"2c427cbc1e9bdfde2a18",35:"98e647ff2521c025ba13",36:"8639f54bf1245af4b1bb"}[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([400,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.data},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},,function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.url},,function(e,t){e.exports=window.wc.wcBlocksData},,,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(16),o=c(15),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){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(14);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"}},a=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&&e.message?Object(o.decodeEntities)(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,c){"use strict";var r=c(0),o=c(1),n=c(33);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){e.exports=window.wp.escapeHtml},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(21);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,"c",(function(){return n})),c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"d",(function(){return d}));var r=c(59);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(6),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(18),a=c(9),s=c(14),l=c(233),i=c(57),u=c(232);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(5),o=c(66),n=c(122),a=c(59),s=c(95);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,"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 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){e.exports=window.wc.wcBlocksSharedHocs},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(9);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 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){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";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(13),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,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(147),s=c(4),l=c.n(s),i=c(94);c(150),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(18),o=c(9),n=c(0),a=c(25),s=c.n(a),l=c(49),i=c(110),u=c(50);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 a}));var r=c(51),o=c(0),n=c(39);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";var r=c(6),o=c.n(r),n=c(0),a=c(34),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.wordcount},,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(157),a=c(122);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(151),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},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(27);c(149);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";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(7),l=c(34),i=c(100),u=c(10),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(178),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(26),h=c(28),_=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(85);c(131);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)(
|
10 |
/* translators: %1$d is the number of variations of a product product. */
|
11 |
Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
|
12 |
/* translators: %1$s is the product name, %2$d is the number of variations of that product. */
|
13 |
+
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,"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(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(114),i=c(524),u=c(4),d=c.n(u),b=c(10),p=c(21),m=c(34),g=c(523),O=c(14);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.
|
14 |
+
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(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)(
|
15 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
16 |
+
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";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(1),n=c(114),a=c(231),s=c(2),l=c(5),i=c(29);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){e.exports=window.wp.warning},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(6),o=c.n(r),n=c(0),a=c(14),s=c(4),l=c.n(s);c(148),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(9);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(r.select)("core/notices").getNotices(),{removeNotice:o}=Object(r.dispatch)("core/notices"),n=c.filter(t=>t.status===e);n.forEach(e=>o(e.id,t))}},function(e,t,c){"use strict";var r=c(0),o=c(90),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";var r=c(0),o=c(4),n=c.n(o),a=c(30),s=c(10);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(18),o=c(9),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){},,,,,,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(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(179),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,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(0);const o=Object(r.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),n=()=>Object(r.useContext)(o),a=e=>{let{children:t}=e;const[c,n]=Object(r.useState)(!1),a={setIsSuppressed:n,isSuppressed:c};return Object(r.createElement)(o.Provider,{value:a},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,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(22),s=c(26),l=c(113),i=c(28);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){},,,,,function(e,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(30),l=c(29),i=c(56),u=(c(355),c(43));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";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,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(103);c(175);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,"a",(function(){return b}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(273),i=c(9),u=(c(184),c(142));const d=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""},b=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const{isSuppressed:a}=Object(u.b)(),{notices:b}=Object(i.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:p}=Object(i.useDispatch)("core/notices"),m=b.filter(e=>"snackbar"!==e.type).concat(r);if(!m.length)return null;const g=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:g},m.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&p(e.id,c)}}),e.content)))}},,,,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(93),o=(c(16),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(98);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){},function(e,t,c){"use strict";var r=c(66);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},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(29),s=c(66),l=c(56),i=c(116),u=c(81),d=(c(354),c(43));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,linkTarget:l,align:p}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:g}=Object(a.useProductDataContext)(),{dispatchStoreEvent:O}=Object(u.a)(),j=Object(d.b)(e),h=Object(d.c)(e),_=Object(d.d)(e);return g.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:g.name,permalink:g.permalink,target:l,onClick:()=>{O("product-view-link",{product:g})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.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(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(29),d=c(56),b=c(81),p=c(216),m=(c(356),c(43));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,...!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(516),i=c(9);const u={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},d={status:u.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},b={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:p,SET_IDLE:m,SET_DISABLED:g,SET_PROCESSING:O,SET_BEFORE_PROCESSING:j,SET_AFTER_PROCESSING:h,SET_PROCESSING_RESPONSE:_,SET_HAS_ERROR:E,SET_NO_ERROR:w,SET_QUANTITY:f,SET_REQUEST_PARAMS:k}=b,y=()=>({type:m}),v=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?E:w;return{type:t}},{SET_PRISTINE:S,SET_IDLE:C,SET_DISABLED:x,SET_PROCESSING:N,SET_BEFORE_PROCESSING:P,SET_AFTER_PROCESSING:T,SET_PROCESSING_RESPONSE:R,SET_HAS_ERROR:I,SET_NO_ERROR:A,SET_QUANTITY:B,SET_REQUEST_PARAMS:L}=b,{PRISTINE:D,IDLE:V,DISABLED:F,PROCESSING:M,BEFORE_PROCESSING:z,AFTER_PROCESSING:H}=u,q=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case S:e=d;break;case C:e=t.status!==V?{...t,status:V}:t;break;case x:e=t.status!==F?{...t,status:F}:t;break;case B:e=c!==t.quantity?{...t,quantity:c}:t;break;case L:e={...t,requestParams:{...t.requestParams,...o}};break;case R:e={...t,processingResponse:o};break;case N:e=t.status!==M?{...t,status:M,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case P:e=t.status!==z?{...t,status:z,hasError:!1}:t;break;case T:e=t.status!==H?{...t,status:H}:t;break;case I:e=t.hasError?t:{...t,hasError:!0},e=t.status===M||t.status===z?{...e,status:V}:e;break;case A:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==S&&e.status===D&&(e.status=V),e};var G=c(98),Q=c(234);const Y=e=>({onAddToCartAfterProcessingWithSuccess:Object(Q.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Q.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Q.a)("add_to_cart_before_processing",e)});var U=c(235),W=c(103),$=c(35),K=c(117);const J=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=>{}}}),X=()=>Object(r.useContext)(J),Z=e=>{var t,c,o,n;let{children:b,product:m,showFormElements:E}=e;const[w,S]=Object(r.useReducer)(q,d),[C,x]=Object(r.useReducer)(G.b,{}),N=Object(s.a)(C),{createErrorNotice:P}=Object(i.useDispatch)("core/notices"),{setValidationErrors:T}=Object(W.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object($.d)(),B=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Y(x).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Y(x).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Y(x).onAddToCartBeforeProcessing}),[x]),L=Object(r.useMemo)(()=>({resetForm:()=>{S({type:p})},submitForm:()=>{S({type:j})},setQuantity:e=>{S((e=>({type:f,quantity:e}))(e))},setHasError:e=>{S(v(e))},setRequestParams:e=>{S((e=>({type:k,data:e}))(e))},setAfterProcessing:e=>{S({type:_,data:e}),S({type:h})}}),[]);Object(r.useEffect)(()=>{const e=w.status,t=!m.id||!Object(l.a)(m);e!==u.DISABLED||t?e!==u.DISABLED&&t&&S({type:g}):S(y())},[w.status,m,S]),Object(r.useEffect)(()=>{w.status===u.BEFORE_PROCESSING&&(Object(K.a)("error","wc/add-to-cart"),Object(U.a)(N,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&P(t,{context:"wc/add-to-cart"}),c&&T(c)}),S(y())):S({type:O})}))},[w.status,T,P,S,N,null==m?void 0:m.id]),Object(r.useEffect)(()=>{if(w.status===u.AFTER_PROCESSING){const e={processingResponse:w.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(I(e)||A(e))&&c&&(t=!0,P(c,r?{context:r}:void 0))}),t};if(w.hasError)return void Object(U.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");P(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==m?void 0:m.id)||0)})}S(y())});Object(U.b)(N,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?S(v(!0)):S(y())})}},[w.status,w.hasError,w.processingResponse,L,P,I,A,R,N,null==m?void 0:m.id]);const D=Object(l.b)(m),V={product:m,productType:m.type||"simple",productIsPurchasable:Object(l.a)(m),productHasOptions:m.has_options||!1,supportsFormElements:D,showFormElements:E&&D,quantity:w.quantity||(null==m||null===(t=m.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==m||null===(c=m.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==m||null===(o=m.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==m||null===(n=m.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:w.requestParams,isIdle:w.status===u.IDLE,isDisabled:w.status===u.DISABLED,isProcessing:w.status===u.PROCESSING,isBeforeProcessing:w.status===u.BEFORE_PROCESSING,isAfterProcessing:w.status===u.AFTER_PROCESSING,hasError:w.hasError,eventRegistration:B,dispatchActions:L};return Object(r.createElement)(J.Provider,{value:V},b)};var ee=c(15),te=c.n(ee),ce=c(14),re=c(232),oe=c(39),ne=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=X(),{hasValidationErrors:u,showAllValidationErrors:d}=Object(W.b)(),{createErrorNotice:b,removeNotice:p}=Object(i.useDispatch)("core/notices"),{receiveCart:m}=Object(oe.a)(),[g,O]=Object(r.useState)(!1),j=!n&&s,h=Object(r.useCallback)(()=>!u||(d(),{type:"error"}),[u,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(h,0);return()=>{e()}},[o,h]);const _=Object(r.useCallback)(()=>{O(!0),p("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};te()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{te.a.setNonce(c.headers),c.json().then((function(r){c.ok?m(r):(r.body&&r.body.message?b(Object(ce.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):b(Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(re.b)({preserveCartData:!0}),e.setAfterProcessing(r),O(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),O(!1)}))})},[t,b,p,m,e,c,l]);return Object(r.useEffect)(()=>{j&&!g&&_()},[j,_,g]),null};const ae=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(W.a,null,Object(r.createElement)(Z,{product:c,showFormElements:o},t,Object(r.createElement)(ne,null)))};var se=c(29),le=c(7),ie=c(56),ue=(c(275),c(69)),de=c(114),be=c(543),pe=c(81),me=c(403);const ge=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ue.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},Oe=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ue.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)(de.a,{icon:be.a}))};var je=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(se.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(pe.a)(),{cartQuantity:m}=Object(me.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)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(ge,{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})}})},he=c(113),_e=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(he.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)}})},Ee=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)},we=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{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)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},fe=(c(364),c(558)),ke=c(8),ye=c(219);const ve={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var Se=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(W.b)(),b=t,p=i(b)||{};return Object(ke.useEffect)(()=>{o?d(b):u({[b]:{message:l,hidden:!0}})},[o,b,l,d,u]),Object(ke.useEffect)(()=>()=>{d(b)},[b,d]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(fe.a,{label:Object(ce.decodeEntities)(t),value:o||"",options:[ve,...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)(ye.a,{propertyName:b,elementId:b}))},Ce=c(59);const xe=(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?xe(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(ce.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(Ce.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)=>xe(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)(Se,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Pe=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(le.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})},Te=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{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)(Pe,{product:e,dispatchers:s}),Object(r.createElement)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},Re=()=>Object(r.createElement)(je,null),Ie=c(545),Ae=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Be=()=>Object(r.createElement)(Ae,null);const Le=()=>{const{showFormElements:e,productType:t}=X();return e?"variable"===t?Object(r.createElement)(Te,null):"grouped"===t?Object(r.createElement)(Be,null):"external"===t?Object(r.createElement)(Re,null):"simple"===t||"variation"===t?Object(r.createElement)(we,null):null:Object(r.createElement)(je,null)};t.a=Object(ie.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(se.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(le.isEmpty)(o)});return Object(r.createElement)(ae,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Le,null)))})},,,,,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(96),s=c(27),l=c(29),i=c(56),u=c(43);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(29),l=c(56),i=(c(357),c(43));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(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(81),u=c(403),d=c(14),b=c(22),p=c(2),m=c(29),g=c(56),O=(c(358),c(43));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,"woocommerce/single-product/"+(g||0)),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(d.decodeEntities)((null==j?void 0:j.description)||""),x=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")),N=S?"button":"a",P={};return S?P.onClick=async()=>{await 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)(N,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),x)},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(118),s=c(22),l=c(29),i=c(56),u=(c(359),c(43));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(29),l=c(56);c(360),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(29),l=c(7),i=c(56),u=(c(361),c(43));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(29),l=c(7),i=c(56),u=(c(362),c(43));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(29),l=c(56),i=(c(363),c(43));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 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(480)},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(9),n=c(18),a=c(14),s=c(39);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},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 Kt}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(5),l=c(13),i=c(114),u=c(535),d=c(66),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(276),O=c(3),j=c(10),h=c(102),_=c(277),E=c(97),w=c(138),f=c(29);c(401);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(536);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(402);const x=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i,linkTarget:u}=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.__)("Link settings","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Make title a link","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}),l&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var N=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")})])(x):x;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(95);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:N,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(290),A=c(537);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(278);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(2),Q=c(279),Y=c(538);const U=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{icon:Y.a,className:"wc-block-editor-components-block-icon"}),$=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var K=k({icon:W,label:U,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)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"left",label:Object(a.__)("Left","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"center",label:Object(a.__)("Center","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"right",label:Object(a.__)("Right","woo-gutenberg-products-block")})),Object(n.createElement)(O.__experimentalToggleGroupControl,{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(G.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,onChange:e=>c({imageSizing:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(a.__)("Full Size","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(a.__)("Cropped","woo-gutenberg-products-block")})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Q.a,t)))});const J={apiVersion:2,title:U,description:$,icon:{src:W},attributes:H.a,edit:K,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,...J});var X=c(291),Z=c(531);const ee=Object(a.__)("Product Rating","woo-gutenberg-products-block"),te=Object(n.createElement)(i.a,{icon:Z.a,className:"wc-block-editor-components-block-icon"}),ce=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var re=k({icon:te,label:ee,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)(X.default,t))});const oe={apiVersion:2,title:ee,description:ce,icon:{src:te},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:re,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,...oe});var ne=c(292),ae=c(539);const se=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),le=Object(n.createElement)(i.a,{icon:ae.a,className:"wc-block-editor-components-block-icon"}),ie=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 ue=k({icon:le,label:se,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)(ne.default,t)))});const de={apiVersion:2,title:se,description:ie,icon:{src:le},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:ue,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...de});var be=c(293),pe=c(540);const me=Object(a.__)("Product Summary","woo-gutenberg-products-block"),ge=Object(n.createElement)(i.a,{icon:pe.a,className:"wc-block-editor-components-block-icon"}),Oe=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(404);var je=k({icon:ge,label:me,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)(be.default,t))});const he={apiVersion:2,title:me,description:Oe,icon:{src:ge},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:je,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,...he});var _e=c(216),Ee=c(529);const we=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),fe=Object(n.createElement)(i.a,{icon:Ee.a,className:"wc-block-editor-components-block-icon"}),ke=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ye=k({icon:fe,label:we,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)(_e.default,t))});const ve={title:we,description:ke,icon:{src:fe},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:ye,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,...ve});var Se=c(104),Ce=c(294),xe=c(11),Ne=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 Pe=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Te=Object(n.createElement)(i.a,{icon:Ne,className:"wc-block-editor-components-block-icon"}),Re={title:Pe,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Te},attributes:{productId:{type:"number",default:0}},edit:k({icon:Te,label:Pe,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)(Se.a,null),Object(n.createElement)(Ce.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Re});var Ie=c(295),Ae=c(541);const Be=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{icon:Ae.a,className:"wc-block-editor-components-block-icon"}),De=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Ve=k({icon:Le,label:Be,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)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ie.default,t)))});const Fe={...m,apiVersion:2,title:Be,description:De,icon:{src:Le},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:Ve};Object(d.c)("woocommerce/product-category-list",Fe);var Me=c(296),ze=c(534);const He=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),qe=Object(n.createElement)(i.a,{icon:ze.a,className:"wc-block-editor-components-block-icon"}),Ge=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Qe=k({icon:qe,label:He,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)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Me.default,t)))});const Ye={apiVersion:2,title:He,description:Ge,icon:{src:qe},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:Qe,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,...Ye});var Ue=c(297),We=c(542);const $e=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Ke=Object(n.createElement)(i.a,{icon:We.a,className:"wc-block-editor-components-block-icon"}),Je=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Xe=k({icon:Ke,label:$e,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)(Se.a,null),Object(n.createElement)(Ue.default,t))});const Ze={apiVersion:2,title:$e,description:Je,icon:{src:Ke},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:Xe,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,...Ze});var et=c(516),tt=(c(275),c(281)),ct=c(218);const rt=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),ot=Object(n.createElement)(i.a,{icon:ct.a,className:"wc-block-editor-components-block-icon"}),nt={title:rt,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ot},edit:k({icon:ot,label:rt,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)(Se.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(et.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)(tt.a,t)))}),attributes:c(280).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...nt});var at=c(24),st=c.n(at),lt=c(9),it=c(64),ut=c(508),dt=c(390),bt=c(22);const pt=(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 mt=c(231);const gt=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],Ot=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?Ot(e.innerBlocks):[]}]):[];var jt=c(8),ht=c(7),_t=c(30);c(410);var Et=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)(_t.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)(_t.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)(_t.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)(_t.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)(_t.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)(_t.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},wt=c(110),ft=c(75),kt=c(125),yt=c(18),vt=c(49);var St=c(81);c(411);const Ct=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var xt=c(45),Nt=c(174),Pt=()=>{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:Nt.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")))},Tt=c(533),Rt=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:Tt.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")))},It=c(120);c(409);var At=e=>{let{onChange:t,value:c}=e;return Object(n.createElement)(It.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 Bt=(e,t,c,r)=>{if(!c)return;const a=Object(ut.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=Bt(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 Lt=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},Bt(s,t,o,r))});c(408);const Dt=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"}}},Vt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(ht.isEqual)(t,r)&&Number.isFinite(c)};var Ft,Mt=(Ft=e=>{let{attributes:t,currentPage:c,onPageChange:r,onSortChange:o,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(ft.b)("attributes",[]),[d,b]=Object(ft.b)("stock_status",[]),[m,g]=Object(ft.b)("min_price"),[O,j]=Object(ft.b)("max_price"),[h]=Object(ft.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...Dt(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(kt.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(vt.a)(n),s=Object(vt.a)(o),{value:l,isLoading:i=!0}=Object(lt.useSelect)(e=>{const t=e(yt.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(St.a)(),C=Object(wt.a)({totalQuery:v,totalProducts:E},Vt);Object(n.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(n.useEffect)(()=>{Object(ht.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:x}=t,N=t.columns*t.rows,P=!Number.isFinite(E)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/N):Math.ceil(E/N),T=_.length?_:Array.from({length:N}),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==x?void 0:x.orderBy)&&R&&Object(n.createElement)(At,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(Rt,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Pt,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)(Lt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(Et,{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)(Ft,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];Ct(e),null==e||e.focus()}else Ct(e)})(e,c):Ct(e))})(t.current,e)}})))}),zt=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)(Mt,{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})},Ht=c(137),qt=c(142),Gt=c(228);class Qt extends jt.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Ht.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(qt.a,null,Object(n.createElement)(Gt.a,{context:"wc/all-products"})),Object(n.createElement)(zt,{attributes:e,urlParameterSuffix:t}))}}var Yt=Qt;c(407);class Ut extends n.Component{constructor(){super(...arguments),st()(this,"state",{isEditing:!1,innerBlocks:[]}),st()(this,"blockMap",Object(ut.a)("woocommerce/all-products")),st()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),st()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),st()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),st()(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"))}),st()(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)(it.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(G.getSetting)("min_columns",1),maxColumns:Object(G.getSetting)("max_columns",6),minRows:Object(G.getSetting)("min_rows",1),maxRows:Object(G.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)))}),st()(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}]}))}),st()(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:dt.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:Ot(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=[];gt.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")))))}),st()(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)(Yt,{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)}),st()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===bt.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:G.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:mt.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:pt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Wt=Object(j.compose)(O.withSpokenMessages,Object(lt.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(lt.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ut);const $t={columns:Object(G.getSetting)("default_columns",3),rows:Object(G.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:gt,isPreview:!1},Kt={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:$t,edit:e=>Object(n.createElement)(Wt,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:pt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...Kt,deprecated:[{attributes:Object.assign({},Kt.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:pt("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(28)]).then(c.bind(null,290)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(5),c.e(25)]).then(c.bind(null,561)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(36)]).then(c.bind(null,562)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(29)]).then(c.bind(null,291)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(21)]).then(c.bind(null,292)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,293)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5)]).then(c.bind(null,216)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(31).then(c.bind(null,294)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,295)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,296)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,297)))}),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(4),c.e(19)]).then(c.bind(null,563)))});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-html-entities', '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-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '4c646af38dea2ec098a5d27c4a509d7b');
|
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,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[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,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={8: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 i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;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}]}}},13:function(e,t){e.exports=window.wp.blocks},
|
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),i&&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(181);var C=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,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(25),L=r.n(N),x=r(55),A=r(28);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.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)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(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};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return 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}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},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)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},15:function(e,t){e.exports=window.wp.apiFetch},153:function(e,t){},154:function(e,t){},180:function(e,t){},181:function(e,t){},182:function(e,t){},183:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},23: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 i})),r.d(t,"n",(function(){return s})),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 v})),r.d(t,"i",(function(){return h})),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/",i=c.pluginUrl+"build/",s=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",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(14);const c=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"}},a=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&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},3:function(e,t){e.exports=window.wp.components},30: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:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(33);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))}},33:function(e,t){e.exports=window.wp.escapeHtml},393:function(e,t,r){e.exports=r(504)},5:function(e,t){e.exports=window.wp.blockEditor},504:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(13),a=r(113),i=r(538),s=(r(153),r(5)),l=r(3),d=r(145),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.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(106),w=r(140),p=r(141),m=r(123);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:i.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)(s.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:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},55:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(15),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=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:i,showProductName:s,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":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=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":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},7:function(e,t){e.exports=window.lodash},74:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(113),a=r(174),i=r(4),s=r.n(i),l=r(3),d=r(32);r(114),t.a=e=>{let{className:t,error:r,isLoading:i=!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:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?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}});
|
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,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[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,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={8: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 i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;return c.push([391,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},106:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(2),i=r(3);const s=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.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(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.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.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.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(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.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)(i.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)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.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},115:function(e,t){},120:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(30),i=r(10);r(154),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,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:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},123: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}]}}},13:function(e,t){e.exports=window.wp.blocks},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.htmlEntities},140:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(153),r(54));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},144:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(7),a=r(3),i=r(5),s=r(8),l=r(2),d=r(72),u=r(30);r(183);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(120);r(180);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),v=r(24),h=r.n(v),_=r(167),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 s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.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}}h()(R,"defaultProps",y);var E=R;r(182);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,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":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&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||i||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),i&&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(181);var C=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,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(25),L=r.n(N),x=r(54),A=r(28);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.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)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(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};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return 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}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},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)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},15:function(e,t){e.exports=window.wp.apiFetch},153:function(e,t){},154:function(e,t){},180:function(e,t){},181:function(e,t){},182:function(e,t){},183: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 i})),r.d(t,"n",(function(){return s})),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 v})),r.d(t,"i",(function(){return h})),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/",i=c.pluginUrl+"build/",s=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",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(14);const c=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"}},a=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&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},3:function(e,t){e.exports=window.wp.components},30: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:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(33);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))}},33:function(e,t){e.exports=window.wp.escapeHtml},391:function(e,t,r){e.exports=r(498)},498:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(13),a=r(114),i=r(532),s=(r(153),r(5)),l=r(3),d=r(144),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.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(106),w=r(139),p=r(140),m=r(123);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:i.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)(s.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:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},5:function(e,t){e.exports=window.wp.blockEditor},54:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(15),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=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:i,showProductName:s,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":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=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":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},7:function(e,t){e.exports=window.lodash},72:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(114),a=r(174),i=r(4),s=r.n(i),l=r(3),d=r(32);r(115),t.a=e=>{let{className:t,error:r,isLoading:i=!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:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?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}});
|
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', 'wp-url'), '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', 'wp-url'), 'version' => 'b61c3ab47d0ecdd5877e71da0f3f790b');
|
build/attribute-filter-frontend.js
CHANGED
@@ -1,16 +1,16 @@
|
|
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=214)}([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){e.exports=window.wp.data},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(218)()},,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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(19),o=n.n(r),i=n(0),c=n(3),a=n(1),s=n(44),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(33);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=window.wp.htmlEntities},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.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(12),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(7),i=n(0),c=n(12),a=n.n(c),s=n(30),u=n(58),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(11),o=n.n(r),i=n(0),c=n(16);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(125),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 r}));const r=e=>"string"==typeof e}
|
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,"b",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return c}));var r=n(14);const o="query_type_",i="filter_";function c(e){return window?Object(r.getQueryArg)(window.location.href,e):null}},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(103);var r=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(234)},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(219);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(48),o=n(0),i=n(1),c=n(20),a=n(30),s=n(58),u=n(35),l=n(62),d=n(143),p=n(111),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(8);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(134);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,A=R.width,M=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=M&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),F=parseInt(B.borderTopWidth,10),V=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),q=0,U=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-V:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-F-K:0;if(u===P)q="start"===o?S:"end"===o?S-f:"nearest"===o?_(m,m+f,f,F,K,m+S,m+S+h,h):S-f/2,U="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:_(b,b+p,p,L,V,b+k,b+k+v,v),q=Math.max(0,q+m),U=Math.max(0,U+b);else{q="start"===o?S-M-F:"end"===o?S-N+K+W:"nearest"===o?_(M,N,T,F,K+W,S,S+h,h):S-(M+T/2)+W/2,U="start"===i?k-H-L:"center"===i?k-(H+A/2)+$/2:"end"===i?k-D+V+$:_(H,D,A,L,V+$,k,k+v,v);var G=P.scrollLeft,Q=P.scrollTop;S+=Q-(q=Math.max(0,Math.min(Q+q,P.scrollHeight-T+W))),k+=G-(U=Math.max(0,Math.min(G+U,P.scrollWidth-A+$)))}x.push({el:P,top:q,left:U})}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 A(){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 M(){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 F(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function V(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 q(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 U=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,U(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}),Q=["refKey","ref"],z=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Y=["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,Q),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]=M(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=V(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=V(-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,z),s=n.getState().isOpen,u={onClick:A(r,n.buttonHandleClick),onKeyDown:A(o,n.buttonHandleKeyDown),onKeyUp:A(i,n.buttonHandleKeyUp),onBlur:A(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=F(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,Y),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((a={}).onChange=A(i,c,n.inputHandleChange),a.onKeyDown=A(r,n.inputHandleKeyDown),a.onBlur=A(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=F(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]=M(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:A(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:A(i,(function(e){e.preventDefault()}))}).onClick=A(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=V(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,!q(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=q(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(200),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. */
|
@@ -20,7 +20,7 @@ Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)
|
|
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(216);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);if(!t)return null;const 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(
|
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'...) */
|
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=214)}([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){e.exports=window.wp.data},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(218)()},,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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,n){"use strict";var r=n(19),o=n.n(r),i=n(0),c=n(3),a=n(1),s=n(43),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(33);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=window.wp.htmlEntities},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.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(12),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(7),i=n(0),c=n(12),a=n.n(c),s=n(30),u=n(58),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(11),o=n.n(r),i=n(0),c=n(16);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(125),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 r}));const r=e=>"string"==typeof e},,,,,,,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})),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(7),i=n(0),c=n(30),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(108),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,"b",(function(){return o})),n.d(t,"a",(function(){return i})),n.d(t,"c",(function(){return c}));var r=n(14);const o="query_type_",i="filter_";function c(e){return window?Object(r.getQueryArg)(window.location.href,e):null}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(3),o=n(46);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,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);return 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"))),c}},,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";var r=n(0),o=n(1),i=n(4),c=n.n(i);n(126),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(103);var r=n(43);const o=()=>r.m>1},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,,function(e,t){},,,function(e,t){},function(e,t){},,,,,,,,function(e,t,n){"use strict";e.exports=n(217)},,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(114),i=n(51),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(99),i=n(6),c=n(30),a=n(35),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(15);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(11),o=n.n(r),i=n(0),c=n(4),a=n.n(c),s=n(1),u=n(105),l=n(196);n(122);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(234)},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(219);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(47),o=n(0),i=n(1),c=n(20),a=n(30),s=n(58),u=n(35),l=n(62),d=n(143),p=n(111),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(8);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(134);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,A=R.width,M=R.top,D=R.right,N=R.bottom,H=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=M&&w<=N&&E>=H&&O<=D)return x;var B=getComputedStyle(P),L=parseInt(B.borderLeftWidth,10),F=parseInt(B.borderTopWidth,10),V=parseInt(B.borderRightWidth,10),K=parseInt(B.borderBottomWidth,10),q=0,U=0,$="offsetWidth"in P?P.offsetWidth-P.clientWidth-L-V:0,W="offsetHeight"in P?P.offsetHeight-P.clientHeight-F-K:0;if(u===P)q="start"===o?S:"end"===o?S-f:"nearest"===o?_(m,m+f,f,F,K,m+S,m+S+h,h):S-f/2,U="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:_(b,b+p,p,L,V,b+k,b+k+v,v),q=Math.max(0,q+m),U=Math.max(0,U+b);else{q="start"===o?S-M-F:"end"===o?S-N+K+W:"nearest"===o?_(M,N,T,F,K+W,S,S+h,h):S-(M+T/2)+W/2,U="start"===i?k-H-L:"center"===i?k-(H+A/2)+$/2:"end"===i?k-D+V+$:_(H,D,A,L,V+$,k,k+v,v);var G=P.scrollLeft,Q=P.scrollTop;S+=Q-(q=Math.max(0,Math.min(Q+q,P.scrollHeight-T+W))),k+=G-(U=Math.max(0,Math.min(G+U,P.scrollWidth-A+$)))}x.push({el:P,top:q,left:U})}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 A(){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 M(){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 F(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function V(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 q(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 U=T((function(e){W(e).textContent=""}),500);function $(e,t){var n=W(t);e&&(n.textContent=e,U(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}),Q=["refKey","ref"],z=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Y=["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,Q),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]=M(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=V(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=V(-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,z),s=n.getState().isOpen,u={onClick:A(r,n.buttonHandleClick),onKeyDown:A(o,n.buttonHandleKeyDown),onKeyUp:A(i,n.buttonHandleKeyUp),onBlur:A(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=F(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,Y),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return s.disabled||((a={}).onChange=A(i,c,n.inputHandleChange),a.onKeyDown=A(r,n.inputHandleKeyDown),a.onBlur=A(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=F(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]=M(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:A(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:A(i,(function(e){e.preventDefault()}))}).onClick=A(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=V(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,!q(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=q(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(200),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. */
|
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(216);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);if(!t)return null;const 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(48),de=n(74),pe=n(12),fe=n.n(pe),be=n(18),me=n(100),ge=n(2),he=n(14),ve=n(119),ye=n(51),Oe=n(98),we=n(110),je=n(101);const Ee=[{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})}],Ie={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var _e=n(136);n(215);const Se=e=>e.replace("pa_",""),ke=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:o}=e,i=Se(t),c=r.join(","),a=`${Oe.b}${i}`,s="in"===o?"or":"and";n[`${Oe.a}${i}`]=c,n[a]=s});const r=Object(he.removeQueryArgs)(e,...Object.keys(n));return Object(he.addQueryArgs)(r,n)},xe=(e,t)=>{if(e&&t){const e=Object(Oe.c)("filter_"+t.name);return"string"==typeof e?e.split(","):[]}return[]},Ce=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)};Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(ge.getSettingWithCoercion)("has_filterable_products",!1,ve.a),f=Object(ge.getSettingWithCoercion)("is_rendering_php_template",!1,ve.a),m=Object(ge.getSettingWithCoercion)("page_url",window.location.href,ye.a),[g,h]=Object(o.useState)(!1),v=t.isPreview&&!t.attributeId?Ie:Object(we.a)(t.attributeId),[y,O]=Object(o.useState)(xe(f,v)),[w,j]=Object(o.useState)(t.isPreview&&!t.attributeId?Ee:[]),E=Object(_e.a)(t),[I]=Object(u.a)(),[_,S]=Object(u.b)("attributes",[]),{results:k,isLoading:x}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==v?void 0:v.id)||0],shouldSelect:t.attributeId>0}),C="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:P,isLoading:R}=Object(d.a)({queryAttribute:{taxonomy:null==v?void 0:v.taxonomy,queryType:t.queryType},queryState:{...I,attributes:C?I.attributes:null}}),T=Object(o.useCallback)(e=>P.attribute_counts?P.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[P]);Object(o.useEffect)(()=>{if(x||R)return;const e=k.map(e=>{const n=T(e.id);if(!(n||y.includes(e.slug)||(r=e.slug,null!=I&&I.attributes&&I.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===v.taxonomy&&n.includes(r)}))))return null;var r;const i=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?i:null})}}).filter(Boolean);j(e)},[null==v?void 0:v.taxonomy,k,x,t.showCounts,R,T,y,I.attributes]);const A=Object(o.useCallback)(e=>k.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]),[k]),M=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){const t=Object.keys(Object(he.getQueryArgs)(window.location.href)),n=Se(null==v?void 0:v.taxonomy),r=t.reduce((e,t)=>t.includes(Oe.b+n)||t.includes(Oe.a+n)?Object(he.removeQueryArgs)(e,t):e,window.location.href),o=ke(r,e);window.location.href=o}else{const t=ke(m,e),n=Object(he.getQueryArgs)(window.location.href),r=Object(he.getQueryArgs)(t);Ce(n,r)||(window.location.href=t)}}),[m,null==v?void 0:v.taxonomy]),D=Object(o.useCallback)(e=>{n||(O(e),t.showFilterButton||Object(je.b)(_,S,v,A(e),"or"===t.queryType?"in":"and"))},[n,O,_,S,v,A,t.queryType,t.showFilterButton]),N=Object(o.useMemo)(()=>_.filter(e=>{let{attribute:t}=e;return t===(null==v?void 0:v.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[_,null==v?void 0:v.taxonomy]),H=Object(a.a)(N),B=Object(s.a)(H);Object(o.useEffect)(()=>{fe()(B,H)||fe()(y,H)||D(H)},[y,H,B,D]);const L="dropdown"!==t.displayStyle||"or"===t.queryType,F=Object(o.useCallback)(e=>{const t=e=>{const{name:t}=w.find(t=>t.value===e);return t},n=e=>{let{filterAdded:n,filterRemoved:r}=e;const o=n?t(n):null,a=r?t(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'...) */
|
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', 'wp-url'), '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', 'wp-url'), 'version' => '267e63eb44224efd12dd45986b60c3f4');
|
build/attribute-filter.js
CHANGED
@@ -1,11 +1,11 @@
|
|
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(r,l)&&r[l]&&d.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);d.length;)d.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={9:0,1:0,2: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 |
-
Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const f=e=>Object(o.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(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:c,selected:n,messages:r,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,n.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||f;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:r,isSingle:m,search:c}))},y=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(o.useState)(""),w=Object(d.useInstanceId)(y),k=Object(o.useMemo)(()=>({...m.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(m.c)(i,h,n),[i,h,n]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(o.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(o.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(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.search,type:"search",value:h,onChange:e=>f(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(v,r()({},e,{search:h,filteredList:E,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(y)},
|
3 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
4 |
-
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";var n=c(0),r=c(1),o=c(30);c(
|
5 |
/* translators: %s number of products. */
|
6 |
-
Object(r._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},
|
7 |
/* translators: Submit button text for filters. */
|
8 |
-
o=Object(r.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(r.__)("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:o,screenReaderLabel:i}))}},155:function(e,t){},156:function(e,t){},16:function(e,t){e.exports=window.wp.url},166:function(e,t,c){"use strict";c.d(t,"b",(function(){return r})),c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return l}));var n=c(16);const r="query_type_",o="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}},170: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);return 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"))),l}},18:function(e,t){e.exports=window.wc.wcBlocksData},
|
9 |
/* translators: %s is referring the remaining count of options */
|
10 |
Object(r._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(r.sprintf)(
|
11 |
/* translators: %s number of options to reveal. */
|
@@ -13,28 +13,28 @@ Object(r._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e))
|
|
13 |
/* Translators: %s search term */
|
14 |
noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
|
15 |
/* translators: Number of items selected from list. */
|
16 |
-
Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("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(r.groupBy)(e,"parent"),n=Object(r.keyBy)(t,"id"),o=["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 o.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;o.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"),r=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(r,e):r},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()},212:function(e,t,c){"use strict";var n=c(6),r=c.n(n),o=c(0),l=c(4),a=c.n(l),s=c(1),i=c(
|
17 |
/* translators: Remove chip. */
|
18 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
19 |
/* translators: %s text of the chip to remove. */
|
20 |
-
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(o.createElement)(b,r()({},g,h,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},f),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},
|
21 |
/* translators: %s is referring to the filter option being removed. */
|
22 |
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},R=c(212),I=e=>{let{onRemoveItem:t,option:c}=e;return Object(o.createElement)(R.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)(
|
23 |
/* translators: %s is referring to the filter option being removed. */
|
24 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},A=c(
|
25 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
26 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(o.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)(
|
27 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
28 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(o.createElement)(u.a,{icon:A.a,size:16})))};c(
|
29 |
/* translators: %s attribute name. */
|
30 |
-
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:w})),_&&!s&&Object(o.createElement)(T,{checked:r,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)})}))})},F=c(107),M=c(
|
31 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
32 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),r,o)):r?Object(_.speak)(Object(l.sprintf)(
|
33 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
34 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),r)):o&&Object(_.speak)(Object(l.sprintf)(
|
35 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
36 |
-
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),o))},n=b.includes(e);let r;oe?(r=b.filter(t=>t!==e),n?c({filterRemoved:e}):(r.push(e),r.sort(),c({filterAdded:e}))):(r=n?[]:[e],c({filterAdded:n?null:e,filterRemoved:1===b.length?b[0]:null})),te(r)},[b,p,oe,te]);if(Object(o.useEffect)(()=>{r&&u&&((e=>{let{currentCheckedFilters:t,hasSetPhpFilterDefaults:c}=e;return c&&0===t.length})({currentCheckedFilters:b,hasSetPhpFilterDefaults:s})&&(t.showFilterButton||(d([]),V(f,!0))),t.showFilterButton||(d(b),V(f,!1)))},[s,V,r,f,u,b,t.showFilterButton]),Object(o.useEffect)(()=>{if(r){const e=Z(r,u);e.length>0&&!s&&!P&&(i(!0),te(e))}},[u,r,s,P,te]),!n)return null;if(!u)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===p.length&&!P)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const ae="h"+t.headingLevel,se=!t.isPreview&&P,ie=!t.isPreview&&I;return Object(o.createElement)(o.Fragment,null,!c&&t.heading&&p.length>0&&Object(o.createElement)(ae,{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)(B,{attributeLabel:u.label,checked:b,className:m()("wc-block-attribute-filter-dropdown",O.className),style:{...O.style,borderStyle:"none"},inputLabel:t.heading,isLoading:se,multiple:oe,onChange:le,options:p}):Object(o.createElement)(C.a,{className:"wc-block-attribute-filter-list",options:p,checked:b,onChange:le,isLoading:se,isDisabled:ie}),t.showFilterButton&&Object(o.createElement)(M.a,{className:"wc-block-attribute-filter__button",disabled:se||ie,onClick:()=>(e=>{const c=Object(U.b)(f,x,u,L(e),"or"===t.queryType?"in":"and");r&&V(c,0===e.length)})(b)})))};c(
|
37 |
/* translators: %s attribute name. */
|
38 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},P=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)(
|
39 |
/* translators: %d is the number of attributes selected. */
|
40 |
-
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(O.sortBy)(Object(O.toArray)(Object(O.mapValues)(ce,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===r}),onChange:N,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(ce).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.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(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.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(o.createElement)("div",x,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>C(!S),isActive:S}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:k?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:k,onChange:()=>c({showCounts:!k})}),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:_,onChange:e=>c({headingLevel:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.__experimentalToggleGroupControl,{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,onChange:e=>c({queryType:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("And","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Or","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>c({displayStyle:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:E?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:E,onChange:e=>c({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},P({isCompact:!0}))),S?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.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(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},P({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{C(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(o.createElement)(f.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:d,onChange:e=>c({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(te,{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(o.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}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:c}=e;return"woocommerce_layered_nav"===t&&!(null==c||!c.raw)},transform:e=>{var t,c,n;let{instance:r}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==r||null===(t=r.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==r||null===(c=r.raw)||void 0===c?void 0:c.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==r||null===(n=r.raw)||void 0===n?void 0:n.display_type)||"list",showFilterButton:!1,isPreview:!1})}}]},edit:ne,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(o.createElement)("div",r()({},s.useBlockProps.save({className:m()("is-loading",c)}),p),Object(o.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),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}},5:function(e,t){e.exports=window.wp.blockEditor},50: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},59:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return r}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function r(e,t){return n(e)&&t in e}},
|
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(r,l)&&r[l]&&d.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);d.length;)d.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={9:0,1:0,2: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([416,0]),c()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},100:function(e,t,c){"use strict";c.d(t,"a",(function(){return y}));var n=c(6),r=c.n(n),o=c(0),l=c(1),a=c(3),s=c(114),i=c(524),u=c(4),b=c.n(u),d=c(10),m=c(21),p=c(34),g=c(523),O=c(14);const j=e=>{let{id:t,label:c,popoverContents:n,remove:r,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.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":!!r}),w="woocommerce-tag__label-"+h,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},c));return Object(o.createElement)("span",{className:f},n?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),n&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},n),r&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(l.sprintf)(// Translators: %s label.
|
2 |
+
Object(l.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const f=e=>Object(o.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(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,n({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:c,selected:n,messages:r,onChange:s,onRemove:i}=e;if(t||c||!n)return null;const u=n.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,n.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},v=e=>{let{filteredList:t,search:c,onSelect:n,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||f;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(l.sprintf)(u.noResults,c):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:n,instanceId:r,isSingle:m,search:c}))},y=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(o.useState)(""),w=Object(d.useInstanceId)(y),k=Object(o.useMemo)(()=>({...m.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(m.c)(i,h,n),[i,h,n]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(o.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(o.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(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":c})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.search,type:"search",value:h,onChange:e=>f(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(v,r()({},e,{search:h,filteredList:E,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(y)},102: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)(
|
3 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
4 |
+
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";var n=c(0),r=c(1),o=c(30);c(243),t.a=e=>{let{name:t,count:c}=e;return Object(n.createElement)(n.Fragment,null,t,Number.isFinite(c)&&Object(n.createElement)(o.a,{label:c.toString(),screenReaderLabel:Object(r.sprintf)(
|
5 |
/* translators: %s number of products. */
|
6 |
+
Object(r._n)("%s product","%s products",c,"woo-gutenberg-products-block"),c),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},11:function(e,t){e.exports=window.wp.primitives},110: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}},121:function(e,t,c){"use strict";var n=c(0),r=c(5),o=c(10),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}))})},122: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 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(18),r=c(9),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}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(r.useSelect)(e=>{if(!u)return null;const r=e(n.COLLECTIONS_STORE_KEY),o=[t,c,d,m],l=r.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}},[t,c,m,d,u]);return null!==g&&(b.current=g),b.current}},13:function(e,t){e.exports=window.wp.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},143:function(e,t,c){"use strict";var n=c(0),r=c(1),o=c(4),l=c.n(o),a=c(30);c(185),t.a=e=>{let{className:t,disabled:c,label:
|
7 |
/* translators: Submit button text for filters. */
|
8 |
+
o=Object(r.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(r.__)("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:o,screenReaderLabel:i}))}},155:function(e,t){},156:function(e,t){},16:function(e,t){e.exports=window.wp.url},166:function(e,t,c){"use strict";c.d(t,"b",(function(){return r})),c.d(t,"a",(function(){return o})),c.d(t,"c",(function(){return l}));var n=c(16);const r="query_type_",o="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}},170: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);return 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"))),l}},18:function(e,t){e.exports=window.wc.wcBlocksData},185:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},201: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)}},202:function(e,t,c){"use strict";var n=c(0),r=c(1),o=c(4),l=c.n(o);c(244),t.a=e=>{let{className:t,onChange:c=(()=>{}),options:o=[],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=o.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(r.sprintf)(
|
9 |
/* translators: %s is referring the remaining count of options */
|
10 |
Object(r._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(r.sprintf)(
|
11 |
/* translators: %s number of options to reveal. */
|
13 |
/* Translators: %s search term */
|
14 |
noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
|
15 |
/* translators: Number of items selected from list. */
|
16 |
+
Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("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(r.groupBy)(e,"parent"),n=Object(r.keyBy)(t,"id"),o=["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 o.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;o.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"),r=e.map(e=>!!n.test(e.name)&&e).filter(Boolean);return c?a(r,e):r},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()},212:function(e,t,c){"use strict";var n=c(6),r=c.n(n),o=c(0),l=c(4),a=c.n(l),s=c(1),i=c(114),u=c(546);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(o.createElement)(b,r()({className:d},u),Object(o.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(o.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?
|
17 |
/* translators: Remove chip. */
|
18 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
19 |
/* translators: %s text of the chip to remove. */
|
20 |
+
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(o.createElement)(b,r()({},g,h,{className:a()(c,"is-removable"),element:d?"button":g.element,screenReaderText:p,text:m}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},f),Object(o.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 o})),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,r=c(2);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(n=r.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,m=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),p=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),j=Object(r.getSetting)("allowedCountries",{}),h=Object(r.getSetting)("shippingStates",{}),f=Object(r.getSetting)("allowedStates",{})},242:function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},243:function(e,t){},244:function(e,t){},25:function(e,t){e.exports=window.wp.isShallowEqual},298:function(e,t,c){"use strict";c.d(t,"a",(function(){return u}));var n=c(0),r=c(274),o=c(7),l=c(49),a=c(75),s=c(125),i=c(50);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[y,k]=Object(n.useState)(!1),[E]=Object(r.a)(y,200);y||k(!0);const S=Object(n.useMemo)(()=>(e=>{const t=e;return e.calculate_attribute_counts&&(t.calculate_attribute_counts=Object(o.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})}},3:function(e,t){e.exports=window.wp.components},30: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))}},34:function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var n=c(6),r=c.n(n),o=c(0),l=c(21);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(o.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(o.createElement)("input",r()({type:"radio",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",r()({type:"checkbox",id:h,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},416:function(e,t,c){e.exports=c(483)},417:function(e,t){},418:function(e,t){},419:function(e,t){},43: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(5),r=c(66),o=c(122),l=c(59),a=c(95);const s=e=>Object(o.a)(e)?JSON.parse(e)||{}:Object(l.a)(e)?e:{},i=e=>{if(!Object(r.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(r.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(r.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},c=s(t.style);return Object(n.__experimentalUseBorderProps)({...t,style:c})}},45:function(e,t){e.exports=window.wp.a11y},483:function(e,t,c){"use strict";c.r(t);var n=c(6),r=c.n(n),o=c(0),l=c(1),a=c(13),s=c(5),i=c(66),u=c(114),b=c(530),d=c(4),m=c.n(d),p=c(231),g=c(100),O=c(7),j=c(2),h=c(102),f=c(121),w=c(3),_=c(45),v=c(49),y=c(110),k=c(75),E=c(125),S=c(298),C=c(202),x=c(173),N=e=>{let{checked:t,getInputProps:c,inputRef:n,isDisabled:r,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(o.createElement)("input",c({ref:n,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:r,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},P=e=>{let{children:t,onClick:c}=e;return Object(o.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:r,options:a}=e;return Object(o.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(o.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":r===n}),index:n,item:e.value,"aria-label":a?Object(l.sprintf)(
|
21 |
/* translators: %s is referring to the filter option being removed. */
|
22 |
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},R=c(212),I=e=>{let{onRemoveItem:t,option:c}=e;return Object(o.createElement)(R.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)(
|
23 |
/* translators: %s is referring to the filter option being removed. */
|
24 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name),text:c.label,radius:"large"})},A=c(546),L=e=>{let{onClick:t,onRemoveItem:c,option:n}=e;const r=Object(o.useRef)(null);return Object(o.useEffect)(()=>{r.current.focus()},[r]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:r,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)(
|
25 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
26 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),n.name)},n.label),Object(o.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)(
|
27 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
28 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name)},Object(o.createElement)(u.a,{icon:A.a,size:16})))};c(419);var B=e=>{let{attributeLabel:t="",className:c,style:n={},checked:r=[],inputLabel:a="",isDisabled:s=!1,isLoading:i=!1,multiple:u=!1,onChange:b=(()=>{}),options:d=[],isCaseSensitive:p=!1}=e;const g=Object(o.useRef)(null),O=m()(c,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":i}),j=Object(o.useCallback)((e,t)=>{switch(t.type){case x.a.stateChangeTypes.keyDownEnter:case x.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case x.a.stateChangeTypes.blurInput:case x.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(x.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(o.createElement)("div",{className:m()(O,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":_}),style:n},Object(o.createElement)("label",j({className:"screen-reader-text"}),a),Object(o.createElement)(P,{isOpen:_,onClick:()=>g.current.focus()},r.map(e=>{const t=d.find(t=>t.value===e);if(!t)return null;const c=e=>{b(e),g.current.focus()};return u?Object(o.createElement)(I,{key:e,onRemoveItem:c,option:t}):Object(o.createElement)(L,{key:e,onClick:()=>g.current.focus(),onRemoveItem:c,option:t})}),Object(o.createElement)(N,{checked:r,getInputProps:c,inputRef:g,isDisabled:s,onFocus:v,onRemoveItem:e=>{b(e),g.current.focus()},placeholder:r.length>0&&u?null:Object(l.sprintf)(
|
29 |
/* translators: %s attribute name. */
|
30 |
+
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:w})),_&&!s&&Object(o.createElement)(T,{checked:r,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)})}))})},F=c(107),M=c(143),V=c(25),q=c.n(V),H=c(14),D=c(16),G=c(242),z=c(122),Q=c(166),$=c(201),U=c(170);const Y=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(F.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(F.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(F.a,{name:"Red",count:2})}],K={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var W=c(43);c(418);const J=e=>e.replace("pa_",""),X=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const c={};t.forEach(e=>{const{attribute:t,slug:n,operator:r}=e,o=J(t),l=n.join(","),a=`${Q.b}${o}`,s="in"===r?"or":"and";c[`${Q.a}${o}`]=l,c[a]=s});const n=Object(D.removeQueryArgs)(e,...Object.keys(c));return Object(D.addQueryArgs)(n,c)},Z=(e,t)=>{if(e&&t){const e=Object(Q.c)("filter_"+t.name);return"string"==typeof e?e.split(","):[]}return[]},ee=(e,t)=>{const c=Object.entries(t).reduce((e,t)=>{let[c,n]=t;return c.includes("query_type")?e:{...e,[c]:n}},{});return Object.entries(c).reduce((t,c)=>{let[n,r]=c;return e[n]===r&&t},!0)};var te=e=>{let{attributes:t,isEditor:c=!1}=e;const n=Object(j.getSettingWithCoercion)("has_filterable_products",!1,G.a),r=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,G.a),a=Object(j.getSettingWithCoercion)("page_url",window.location.href,z.a),[s,i]=Object(o.useState)(!1),u=t.isPreview&&!t.attributeId?K:Object($.a)(t.attributeId),[b,d]=Object(o.useState)(Z(r,u)),[p,g]=Object(o.useState)(t.isPreview&&!t.attributeId?Y:[]),O=Object(W.a)(t),[h]=Object(k.a)(),[f,x]=Object(k.b)("attributes",[]),{results:N,isLoading:P}=Object(E.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==u?void 0:u.id)||0],shouldSelect:t.attributeId>0}),T="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:R,isLoading:I}=Object(S.a)({queryAttribute:{taxonomy:null==u?void 0:u.taxonomy,queryType:t.queryType},queryState:{...h,attributes:T?h.attributes:null}}),A=Object(o.useCallback)(e=>R.attribute_counts?R.attribute_counts.find(t=>{let{term:c}=t;return c===e}):null,[R]);Object(o.useEffect)(()=>{if(P||I)return;const e=N.map(e=>{const c=A(e.id);if(!(c||b.includes(e.slug)||(n=e.slug,null!=h&&h.attributes&&h.attributes.some(e=>{let{attribute:t,slug:c=[]}=e;return t===u.taxonomy&&c.includes(n)}))))return null;var n;const r=c?c.count:0;return{value:e.slug,name:Object(H.decodeEntities)(e.name),label:Object(o.createElement)(F.a,{name:Object(H.decodeEntities)(e.name),count:t.showCounts?r:null})}}).filter(Boolean);g(e)},[null==u?void 0:u.taxonomy,N,P,t.showCounts,I,A,b,h.attributes]);const L=Object(o.useCallback)(e=>N.reduce((t,c)=>(e.includes(c.slug)&&t.push(c),t),[]),[N]),V=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){const t=Object.keys(Object(D.getQueryArgs)(window.location.href)),c=J(null==u?void 0:u.taxonomy),n=t.reduce((e,t)=>t.includes(Q.b+c)||t.includes(Q.a+c)?Object(D.removeQueryArgs)(e,t):e,window.location.href),r=X(n,e);window.location.href=r}else{const t=X(a,e),c=Object(D.getQueryArgs)(window.location.href),n=Object(D.getQueryArgs)(t);ee(c,n)||(window.location.href=t)}}),[a,null==u?void 0:u.taxonomy]),te=Object(o.useCallback)(e=>{c||(d(e),t.showFilterButton||Object(U.b)(f,x,u,L(e),"or"===t.queryType?"in":"and"))},[c,d,f,x,u,L,t.queryType,t.showFilterButton]),ce=Object(o.useMemo)(()=>f.filter(e=>{let{attribute:t}=e;return t===(null==u?void 0:u.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}),[f,null==u?void 0:u.taxonomy]),ne=Object(v.a)(ce),re=Object(y.a)(ne);Object(o.useEffect)(()=>{q()(re,ne)||q()(b,ne)||te(ne)},[b,ne,re,te]);const oe="dropdown"!==t.displayStyle||"or"===t.queryType,le=Object(o.useCallback)(e=>{const t=e=>{const{name:t}=p.find(t=>t.value===e);return t},c=e=>{let{filterAdded:c,filterRemoved:n}=e;const r=c?t(c):null,o=n?t(n):null;r&&o?Object(_.speak)(Object(l.sprintf)(
|
31 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
32 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),r,o)):r?Object(_.speak)(Object(l.sprintf)(
|
33 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
34 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),r)):o&&Object(_.speak)(Object(l.sprintf)(
|
35 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
36 |
+
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),o))},n=b.includes(e);let r;oe?(r=b.filter(t=>t!==e),n?c({filterRemoved:e}):(r.push(e),r.sort(),c({filterAdded:e}))):(r=n?[]:[e],c({filterAdded:n?null:e,filterRemoved:1===b.length?b[0]:null})),te(r)},[b,p,oe,te]);if(Object(o.useEffect)(()=>{r&&u&&((e=>{let{currentCheckedFilters:t,hasSetPhpFilterDefaults:c}=e;return c&&0===t.length})({currentCheckedFilters:b,hasSetPhpFilterDefaults:s})&&(t.showFilterButton||(d([]),V(f,!0))),t.showFilterButton||(d(b),V(f,!1)))},[s,V,r,f,u,b,t.showFilterButton]),Object(o.useEffect)(()=>{if(r){const e=Z(r,u);e.length>0&&!s&&!P&&(i(!0),te(e))}},[u,r,s,P,te]),!n)return null;if(!u)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===p.length&&!P)return c?Object(o.createElement)(w.Notice,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const ae="h"+t.headingLevel,se=!t.isPreview&&P,ie=!t.isPreview&&I;return Object(o.createElement)(o.Fragment,null,!c&&t.heading&&p.length>0&&Object(o.createElement)(ae,{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)(B,{attributeLabel:u.label,checked:b,className:m()("wc-block-attribute-filter-dropdown",O.className),style:{...O.style,borderStyle:"none"},inputLabel:t.heading,isLoading:se,multiple:oe,onChange:le,options:p}):Object(o.createElement)(C.a,{className:"wc-block-attribute-filter-list",options:p,checked:b,onChange:le,isLoading:se,isDisabled:ie}),t.showFilterButton&&Object(o.createElement)(M.a,{className:"wc-block-attribute-filter__button",disabled:se||ie,onClick:()=>(e=>{const c=Object(U.b)(f,x,u,L(e),"or"===t.queryType?"in":"and");r&&V(c,0===e.length)})(b)})))};c(417);const ce=Object(j.getSetting)("attributes",[]);var ne=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:c,debouncedSpeak:n}=e;const{attributeId:r,className:a,displayStyle:i,heading:d,headingLevel:_,isPreview:v,queryType:y,showCounts:k,showFilterButton:E}=t,[S,C]=Object(o.useState)(!r&&!v),x=Object(s.useBlockProps)(),N=e=>{if(!e||!e.length)return;const t=e[0].id,n=ce.find(e=>e.attribute_id===t.toString());if(!n||r===t)return;const o=n.attribute_label;c({attributeId:t,heading:Object(l.sprintf)(
|
37 |
/* translators: %s attribute name. */
|
38 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},P=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)(
|
39 |
/* translators: %d is the number of attributes selected. */
|
40 |
+
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(O.sortBy)(Object(O.toArray)(Object(O.mapValues)(ce,e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label}))),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:n,selected:n.filter(e=>{let{id:t}=e;return t===r}),onChange:N,messages:c,isSingle:!0,isCompact:t})};return 0===Object.keys(ce).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.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(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.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(o.createElement)("div",x,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>C(!S),isActive:S}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:k?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:k,onChange:()=>c({showCounts:!k})}),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:_,onChange:e=>c({headingLevel:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.__experimentalToggleGroupControl,{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,onChange:e=>c({queryType:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("And","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Or","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>c({displayStyle:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Filter button","woo-gutenberg-products-block"),help:E?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:E,onChange:e=>c({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},P({isCompact:!0}))),S?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.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(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},P({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{C(!1),n(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(o.createElement)(f.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:d,onChange:e=>c({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(te,{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(o.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}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:c}=e;return"woocommerce_layered_nav"===t&&!(null==c||!c.raw)},transform:e=>{var t,c,n;let{instance:r}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==r||null===(t=r.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==r||null===(c=r.raw)||void 0===c?void 0:c.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==r||null===(n=r.raw)||void 0===n?void 0:n.display_type)||"list",showFilterButton:!1,isPreview:!1})}}]},edit:ne,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(o.createElement)("div",r()({},s.useBlockProps.save({className:m()("is-loading",c)}),p),Object(o.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),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}},5:function(e,t){e.exports=window.wp.blockEditor},50: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},59:function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return r}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function r(e,t){return n(e)&&t in e}},66:function(e,t,c){"use strict";c.d(t,"c",(function(){return o})),c.d(t,"d",(function(){return l})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var n=c(13),r=c(22);const o=(e,t)=>{if(r.n>2)return Object(n.registerBlockType)(e,t)},l=(e,t)=>{if(r.n>1)return Object(n.registerBlockType)(e,t)},a=()=>r.n>2,s=()=>r.n>1},7:function(e,t){e.exports=window.lodash},75: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(18),r=c(9),o=c(0),l=c(25),a=c.n(l),s=c(49),i=c(110),u=c(50);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])]},d=(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])]},m=(e,t)=>{const c=Object(u.a)();t=t||c;const[n,r]=b(t),l=Object(s.a)(n),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(r(Object.assign({},l,d)),p.current=!0)},[l,d,m,r]),p.current?[n,r]:[e,r]}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.data},95:function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));var n=c(5);const r=()=>"function"==typeof n.__experimentalGetSpacingClassesAndStyles}});
|
build/cart-blocks/cart-accepted-payment-methods-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{266:function(t,e){},269:function(t,e,s){"use strict";s.d(e,"b",(function(){return o})),s.d(e,"a",(function(){return l}));var a=s(30),n=s(201);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)},272:function(t,e,s){"use strict";var a=s(11),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(43);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(51);s(266),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))}))}},372: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),[])},448:function(t,e,s){"use strict";s.r(e);var a=s(0),n=s(272),c=s(269),o=s(372);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/cart-express-payment-frontend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{105: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})}},256:function(e,t){},265:function(e,t
|
2 |
/* translators: %s coupon code. */
|
3 |
-
Object(s.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),
|
4 |
/* translators: %s coupon code. */
|
5 |
-
Object(s.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form"})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),h("")})},isApplyingCoupon:p,isRemovingCoupon:u}},[i,l]);return{appliedCoupons:t,isLoading:n,...m}}},268:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(0),c=n(194);n(256);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))}},269:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var s=n(30),c=n(201);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)},272:function(e,t,n){"use strict";var s=n(11),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(44);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(52);n(265),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))}))}},282:function(e,t){},283:function(e,t,n){"use strict";var s=n(19),c=n.n(s),o=n(0),r=n(1),a=n(3),i=n(2),l=n(124),p=n(29);class u 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.a,{additionalNotices:s,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},302:function(e,t){},303:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(335),r=n(269),a=n(27),i=n(201),l=n(32),p=n.n(l),u=n(283);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))}},330:function(e,t,n){"use strict";var s=n(0),c=n(15);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},335:function(e,t,n){"use strict";n.d(t,"a",(function(){return N}));var s=n(1),c=n(37),o=n(0),r=n(4),a=n.n(r),i=n(15),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(330),m=n(105),b=n(52),h=n(61);n(282);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(272),y=n(2),O=n(32),E=n.n(O),f=n(137),k=n(268),w=n(31),S=n(267),P=n(29),_=n(34),C=n(201),x=n(66),R=n(46);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 N=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(_.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(C.b)(),{shippingErrorStatus:N,shippingErrorTypes:z,onShippingRateSuccess:T,onShippingRateFail:A,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(x.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingData:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(w.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.d)(),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:Y,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:D,onShippingRateSelectSuccess:V,onShippingRateSuccess:T},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:U,shippingAddress:J,shippingRates:B,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:N,shippingErrorTypes:z},shouldSavePayment:O}}},435:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(31),o=n(4),r=n.n(o),a=n(1),i=n(269),l=n(29),p=n(34),u=n(201),d=n(124),m=n(137),b=n(303);n(302);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.d)(),{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}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{105: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})}},256:function(e,t){},265:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var s=n(1),c=n(7),o=n(5),a=n(18),r=n(31),i=n(194);const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(r.a)(),{createErrorNotice:l}=Object(c.useDispatch)("core/notices"),{createNotice:p}=Object(c.useDispatch)("core/notices"),{setValidationErrors:u}=Object(i.b)(),d=Object(c.useSelect)((t,n)=>{let{dispatch:c}=n;const r=t(o.CART_STORE_KEY),i=r.isApplyingCoupon(),d=r.isRemovingCoupon(),{applyCoupon:m,removeCoupon:b,receiveApplyingCoupon:h}=c(o.CART_STORE_KEY);return{applyCoupon:t=>{m(t).then(n=>{!0===n&&p("info",Object(s.sprintf)(
|
2 |
/* translators: %s coupon code. */
|
3 |
+
Object(s.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{u({coupon:{message:Object(a.decodeEntities)(e.message),hidden:!1}}),h("")})},removeCoupon:t=>{b(t).then(n=>{!0===n&&p("info",Object(s.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
+
Object(s.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{l(t.message,{id:"coupon-form",context:e}),h("")})},isApplyingCoupon:i,isRemovingCoupon:d}},[l,p]);return{appliedCoupons:t,isLoading:n,...d}}},266:function(e,t){},268:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(0),c=n(194);n(256);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:a,getValidationErrorId:r}=Object(c.b)();if(!t||"string"!=typeof t){const e=a(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:r(o)},t))}},269:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return r}));var s=n(30),c=n(201);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:o,expressPaymentMethodsInitialized:a}=Object(c.b)(),r=Object(s.a)(t),i=Object(s.a)(n);return{paymentMethods:e?i:r,isInitialized:e?a:o}},a=()=>o(!1),r=()=>o(!0)},272:function(e,t,n){"use strict";var s=n(11),c=n.n(s),o=n(0),a=n(4),r=n.n(a);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(43);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(51);n(266),t.a=e=>{let{icons:t=[],align:n="center",className:s}=e;const a=(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===a.length)return null;const i=r()("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},a.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))}))}},282:function(e,t){},283:function(e,t,n){"use strict";var s=n(19),c=n.n(s),o=n(0),a=n(1),r=n(3),i=n(2),l=n(124),p=n(29);class u extends r.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(a.__)("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(a.__)("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.a,{additionalNotices:s,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},302:function(e,t){},303:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(335),a=n(269),r=n(27),i=n(201),l=n(32),p=n.n(l),u=n(283);t.a=()=>{const{isEditor:e}=Object(r.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(a.a)(),g=Object(s.useRef)(l),v=Object(s.useRef)(d),y=Object(s.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),j=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),w=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:y(n),onClose:j,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"},w))}},330:function(e,t,n){"use strict";var s=n(0),c=n(15);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},335:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var s=n(1),c=n(37),o=n(0),a=n(4),r=n.n(a),i=n(15),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(330),m=n(105),b=n(51),h=n(61);n(282);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]),a=r()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":s});return Object(o.createElement)("span",{className:a},c(t)?Object(o.createElement)(m.a,{icon:g[t]}):t,n)},y=n(272),j=n(2),O=n(32),E=n.n(O),f=n(137),w=n(268),k=n(31),S=n(265),P=n(29),x=n(34),_=n(201),C=n(66),R=n(45);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:a,onCheckoutBeforeProcessing:r,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(x.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(_.b)(),{shippingErrorStatus:z,shippingErrorTypes:T,onShippingRateSuccess:N,onShippingRateFail:A,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(C.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingData:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(k.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.d)(),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:Y,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(c.getCurrencyFromPriceResponse)(q),customerId:d,displayPricesIncludingTax:Object(j.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:K,cartFees:X,extensions:Q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:a},components:{LoadingMask:f.a,PaymentMethodIcons:y.a,PaymentMethodLabel:v,ValidationInputError:w.a},emitResponse:{noticeContexts:$,responseTypes:ee},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:r,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:A,onShippingRateSelectFail:D,onShippingRateSelectSuccess:V,onShippingRateSuccess:N},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:U,shippingAddress:J,shippingRates:B,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:T},shouldSavePayment:O}}},435:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(31),o=n(4),a=n.n(o),r=n(1),i=n(269),l=n(29),p=n(34),u=n(201),d=n(124),m=n(137),b=n(303);n(302);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.d)(),{isCalculating:c,isProcessing:o,isAfterProcessing:a,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:y}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const j=o||a||h||g&&!v;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(m.a,{isLoading:c||j||y.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(r.__)("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:a()("wc-block-cart__payment-options",t)},Object(s.createElement)(h,null)):null}}}]);
|
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{102:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(
|
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 g=O&&b!==O;let f=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return g?f=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?f=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(f=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:f}))}},278:function(e,t){},279:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(18),o=c(4),i=c.n(o);c(280),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",target:s,rel:u,style:m,onClick:b,...p}=e;const d=i()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",r()({className:d},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:d,href:o,target:s},p,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:m}))}},280:function(e,t){},286:function(e,t,c){"use strict";var a=c(0),r=c(115),n=c(116);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)}},298:function(e,t){},299:function(e,t){},300:function(e,t){},301:function(e,t){},327:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(18),o=c(2);c(298),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}))}},328:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(275);t.a=()=>Object(a.createElement)(n.a,{className:"wc-block-components-product-backorder-badge"},Object(r.__)("Available on backorder","woo-gutenberg-products-block"))},329:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(275);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}},336: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(
|
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)),g(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)),g(e)}},"+"))},m=c(277),b=c(279),p=c(7),d=c(5),O=c(99),j=c(58),_=c(68),y=c(61),g=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})}))},I=c(339),S=c(37),q=c(10),D=c(326),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:M=null,show_backorder_badge:L=!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(g.a)(e.key)&&Object(f.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(f.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}),L?Object(a.createElement)(N.a,null):!!M&&Object(a.createElement)(h.a,{lowStockRemaining:M}),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)(P,{currency:ae,saleAmount:R(oe,ae),format:_e}),Object(a.createElement)(I.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)(P,{currency:ae,saleAmount:R(ie,ae),format:_e}))))});const M=[...Array(3)].map((_x,e)=>Object(a.createElement)(F,{lineItem:{},key:e})),L=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)(L(t));Object(a.useEffect)(()=>{i.current=L(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?M: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))}},339:function(e,t,c){"use strict";var a=c(0),r=c(6),n=c(18);c(301);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(286),i=c(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{102:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(138),o=c(4),i=c.n(o);c(192);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}))}},192:function(e,t){},275:function(e,t,c){"use strict";var a=c(0),r=c(4),n=c.n(r);c(299),t.a=e=>{let{children:t,className:c}=e;return Object(a.createElement)("div",{className:n()("wc-block-components-product-badge",c)},t)}},277:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(102),l=c(4),o=c.n(l),i=c(37);c(278);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 g=O&&b!==O;let f=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return g?f=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?f=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(f=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:f}))}},278:function(e,t){},279:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(18),o=c(4),i=c.n(o);c(280),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",target:s,rel:u,style:m,onClick:b,...p}=e;const d=i()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",r()({className:d},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:d,href:o,target:s},p,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:m}))}},280:function(e,t){},286:function(e,t,c){"use strict";var a=c(0),r=c(115),n=c(116);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)}},298:function(e,t){},299:function(e,t){},300:function(e,t){},301:function(e,t){},327:function(e,t,c){"use strict";var a=c(11),r=c.n(a),n=c(0),l=c(18),o=c(2);c(298),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}))}},328:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(275);t.a=()=>Object(a.createElement)(n.a,{className:"wc-block-components-product-backorder-badge"},Object(r.__)("Available on backorder","woo-gutenberg-products-block"))},329:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(275);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}},336: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(141),s=c(46);c(366);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,g=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]),f=Object(s.a)(g,300);Object(a.useLayoutEffect)(()=>{g(c)},[c,g]);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),f(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)),g(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)),g(e)}},"+"))},m=c(277),b=c(279),p=c(7),d=c(5),O=c(99),j=c(58),_=c(68),y=c(61),g=c(51),f=c(69),k=c(31),E=c(34);var w=c(56),v=c(327),N=c(328),h=c(329),C=c(102),x=c(275),P=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})}))},I=c(339),S=c(37),q=c(10),D=c(326),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:M=null,show_backorder_badge:L=!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(g.a)(e.key)&&Object(f.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(f.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}),L?Object(a.createElement)(N.a,null):!!M&&Object(a.createElement)(h.a,{lowStockRemaining:M}),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)(P,{currency:ae,saleAmount:R(oe,ae),format:_e}),Object(a.createElement)(I.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)(P,{currency:ae,saleAmount:R(ie,ae),format:_e}))))});const M=[...Array(3)].map((_x,e)=>Object(a.createElement)(F,{lineItem:{},key:e})),L=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)(L(t));Object(a.useEffect)(()=>{i.current=L(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?M: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))}},339:function(e,t,c){"use strict";var a=c(0),r=c(6),n=c(18);c(301);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(286),i=c(43),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(300),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}})}))}},366:function(e,t){}}]);
|
build/cart-blocks/cart-line-items-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{446:function(t,n,e){"use strict";e.r(n);var c=e(0),r=e(31),u=e(336);n.default=t=>{let{className:n}=t;const{cartItems:e,cartIsLoading:a}=Object(r.a)();return Object(c.createElement)(u.a,{className:n,lineItems:e,isLoading:a})}},99:function(t,n,e){"use strict";e.d(n,"a",(function(){return s}));var c=e(3),r=e(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{446:function(t,n,e){"use strict";e.r(n);var c=e(0),r=e(31),u=e(336);n.default=t=>{let{className:n}=t;const{cartItems:e,cartIsLoading:a}=Object(r.a)();return Object(c.createElement)(u.a,{className:n,lineItems:e,isLoading:a})}},99:function(t,n,e){"use strict";e.d(n,"a",(function(){return s}));var c=e(3),r=e(46);function u(t,n){return t===n}function a(t){return"function"==typeof t?function(){return t}:t}function s(t,n,e){var s=e&&e.equalityFn||u,o=function(t){var n=Object(c.useState)(a(t)),e=n[0],r=n[1];return[e,Object(c.useCallback)((function(t){return r(a(t))}),[])]}(t),i=o[0],f=o[1],l=Object(r.a)(Object(c.useCallback)((function(t){return f(t)}),[f]),n,e),b=Object(c.useRef)(t);return s(b.current,t)||(l(t),b.current=t),[i,l]}}}]);
|
build/cart-blocks/cart-order-summary-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{102:function(e,t,a){"use strict";var c=a(11),n=a.n(c),r=a(0),o=a(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{102:function(e,t,a){"use strict";var c=a(11),n=a.n(c),r=a(0),o=a(138),l=a(4),s=a.n(l);a(192);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:a,currency:c,onValueChange:l,displayType:u="text",...m}=e;const p="string"==typeof a?parseInt(a,10):a;if(!Number.isFinite(p))return null;const b=p/10**c.minorUnit;if(!Number.isFinite(b))return null;const d=s()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...m,...i(c),value:void 0,currency:void 0,onValueChange:void 0},x=l?e=>{const t=+e.value*10**c.minorUnit;l(t)}:()=>{};return Object(r.createElement)(o.a,n()({className:d,displayType:u},f,{value:b,onValueChange:x}))}},192:function(e,t){},304:function(e,t){},373:function(e,t,a){"use strict";var c=a(0),n=a(1),r=a(4),o=a.n(r),l=a(102),s=a(10),i=a(31),u=a(2);a(304),t.a=e=>{let{currency:t,values:a,className:r}=e;const m=Object(u.getSetting)("taxesEnabled",!0)&&Object(u.getSetting)("displayCartPricesIncludingTax",!1),{total_price:p,total_tax:b}=a,{receiveCart:d,...f}=Object(i.a)(),x=Object(s.__experimentalApplyCheckoutFilter)({filterName:"totalLabel",defaultValue:Object(n.__)("Total","woo-gutenberg-products-block"),extensions:f.extensions,arg:{cart:f}}),O=parseInt(b,10);return Object(c.createElement)(s.TotalsItem,{className:o()("wc-block-components-totals-footer-item",r),currency:t,label:x,value:parseInt(p,10),description:m&&0!==O&&Object(c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},Object(c.createInterpolateElement)(Object(n.__)("Including <TaxAmount/> in taxes","woo-gutenberg-products-block"),{TaxAmount:Object(c.createElement)(l.a,{className:"wc-block-components-totals-footer-item-tax-value",currency:t,value:O})}))})}},449:function(e,t,a){"use strict";a.r(t);var c=a(0),n=a(373),r=a(37),o=a(31),l=a(10);const s=()=>{const{extensions:e,receiveCart:t,...a}=Object(o.a)(),n={extensions:e,cart:a,context:"woocommerce/cart"};return Object(c.createElement)(l.ExperimentalOrderMeta.Slot,n)};t.default=e=>{let{children:t,className:a=""}=e;const{cartTotals:l}=Object(o.a)(),i=Object(r.getCurrencyFromPriceResponse)(l);return Object(c.createElement)("div",{className:a},t,Object(c.createElement)("div",{className:"wc-block-components-totals-wrapper"},Object(c.createElement)(n.a,{currency:i,values:l})),Object(c.createElement)(s,null))}}}]);
|
build/cart-blocks/filled-cart-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{198:function(e,t){},
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[19],{198:function(e,t){},245:function(e,t,s){"use strict";s.d(t,"b",(function(){return l})),s.d(t,"a",(function(){return o}));var c=s(0),a=s(13),i=s(4),r=s.n(i);const n=Object(c.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),l=()=>Object(c.useContext)(n),o=e=>{let{children:t,className:s=""}=e;const[i,l]=(()=>{const[e,{width:t}]=Object(a.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(c.createElement)(n.Provider,{value:o},Object(c.createElement)("div",{className:r()(s,l)},i,t))}},249:function(e,t,s){"use strict";var c=s(0),a=s(4),i=s.n(a),r=s(245);s(198),t.a=e=>{let{children:t,className:s}=e;return Object(c.createElement)(r.a,{className:i()("wc-block-components-sidebar-layout",s)},t)}},412:function(e,t,s){"use strict";s.r(t);var c=s(0),a=s(4),i=s.n(a),r=s(249),n=s(31),l=s(18),o=s(7),m=s(145);t.default=e=>{let{children:t,className:s}=e;const{cartItems:a,cartIsLoading:u,cartItemErrors:b}=Object(n.a)(),{hasDarkControls:d}=Object(m.b)(),{createErrorNotice:h}=Object(o.useDispatch)("core/notices");return Object(c.useEffect)(()=>{b.forEach(e=>{h(Object(l.decodeEntities)(e.message),{isDismissible:!0,id:e.code,context:"wc/cart"})})},[h,b]),u||a.length>=1?Object(c.createElement)(r.a,{className:i()("wc-block-cart",s,{"has-dark-controls":d})},t):null}}}]);
|
build/cart-blocks/order-summary-coupon-form-frontend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[20],{22:function(e,t,n){"use strict";var o=n(0),c=n(4),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=r||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,c)):(t=r||o.Fragment,l&&i&&n!==c?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},n),Object(o.createElement)("span",{className:"screen-reader-text"},c)):Object(o.createElement)(t,s,n))}},256:function(e,t){},257:function(e,t){},258:function(e,t,n){"use strict";var o=n(11),c=n.n(o),a=n(0),r=n(
|
2 |
/* translators: %s coupon code. */
|
3 |
-
Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),
|
4 |
/* translators: %s coupon code. */
|
5 |
-
Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form"})}).catch(t=>{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[20],{22:function(e,t,n){"use strict";var o=n(0),c=n(4),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=r||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,c)):(t=r||o.Fragment,l&&i&&n!==c?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},n),Object(o.createElement)("span",{className:"screen-reader-text"},c)):Object(o.createElement)(t,s,n))}},256:function(e,t){},257:function(e,t){},258:function(e,t,n){"use strict";var o=n(11),c=n.n(o),a=n(0),r=n(49),s=n(4),l=n.n(s),i=n(135);n(259),t.a=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...u}=e;const p=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(a.createElement)(r.a,c()({className:p},u),n&&Object(a.createElement)(i.a,null),Object(a.createElement)("span",{className:"wc-block-components-button__text"},o))}},259:function(e,t){},265:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=n(1),c=n(7),a=n(5),r=n(18),s=n(31),l=n(194);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(s.a)(),{createErrorNotice:i}=Object(c.useDispatch)("core/notices"),{createNotice:u}=Object(c.useDispatch)("core/notices"),{setValidationErrors:p}=Object(l.b)(),b=Object(c.useSelect)((t,n)=>{let{dispatch:c}=n;const s=t(a.CART_STORE_KEY),l=s.isApplyingCoupon(),b=s.isRemovingCoupon(),{applyCoupon:d,removeCoupon:m,receiveApplyingCoupon:O}=c(a.CART_STORE_KEY);return{applyCoupon:t=>{d(t).then(n=>{!0===n&&u("info",Object(o.sprintf)(
|
2 |
/* translators: %s coupon code. */
|
3 |
+
Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{p({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),O("")})},removeCoupon:t=>{m(t).then(n=>{!0===n&&u("info",Object(o.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
+
Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),O("")})},isApplyingCoupon:l,isRemovingCoupon:b}},[i,u]);return{appliedCoupons:t,isLoading:n,...b}}},268:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var o=n(0),c=n(194);n(256);const a=e=>{let{errorMessage:t="",propertyName:n="",elementId:a=""}=e;const{getValidationError:r,getValidationErrorId:s}=Object(c.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:s(a)},t))}},292:function(e,t,n){"use strict";var o=n(11),c=n.n(o),a=n(0),r=n(1),s=n(3),l=n(4),i=n.n(l),u=n(194),p=n(268),b=n(13),d=n(51),m=n(22);n(257);var O=Object(s.forwardRef)((e,t)=>{let{className:n,id:o,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:u,screenReaderLabel:p,disabled:b,help:d,autoCapitalize:O="off",autoComplete:j="off",value:g="",onChange:f,required:E=!1,onBlur:v=(()=>{}),feedback:h,...w}=e;const[_,k]=Object(a.useState)(!1);return Object(a.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":_||g})},Object(a.createElement)("input",c()({type:r,id:o,value:g,ref:t,autoCapitalize:O,autoComplete:j,onChange:e=>{f(e.target.value)},onFocus:()=>k(!0),onBlur:e=>{v(e.target.value),k(!1)},"aria-label":s||u,disabled:b,"aria-describedby":d&&!l?o+"__help":l,required:E},w)),Object(a.createElement)(m.a,{label:u,screenReaderLabel:p||u,wrapperElement:"label",wrapperProps:{htmlFor:o},htmlFor:o}),!!d&&Object(a.createElement)("p",{id:o+"__help",className:"wc-block-components-text-input__help"},d),h)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:o,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:j,showError:g=!0,errorMessage:f="",value:E="",...v}=e;const[h,w]=Object(s.useState)(!0),_=Object(s.useRef)(null),{getValidationError:k,hideValidationError:C,setValidationErrors:y,clearValidationError:N,getValidationErrorId:I}=Object(u.b)(),R=void 0!==o?o:"textinput-"+n,S=void 0!==b?b:R,L=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=_.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(S):y({[S]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,S,y]);Object(s.useEffect)(()=>{var e;h&&m&&(null===(e=_.current)||void 0===e||e.focus()),w(!1)},[m,h,w]),Object(s.useEffect)(()=>{var e,t;(null===(e=_.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==_.current&&L(!0)},[E,L]),Object(s.useEffect)(()=>()=>{N(S)},[N,S]);const V=k(S)||{};Object(d.a)(f)&&""!==f&&(V.message=f);const x=V.message&&!V.hidden,B=g&&x&&I(S)?I(S):l;return Object(a.createElement)(O,c()({className:i()(t,{"has-error":x}),"aria-invalid":!0===x,id:R,onBlur:()=>{L(!1)},feedback:g&&Object(a.createElement)(p.a,{errorMessage:f,propertyName:S}),ref:_,onChange:e=>{C(S),j(e)},ariaDescribedBy:B,value:E},v))})},306:function(e,t){},375:function(e,t,n){"use strict";var o=n(0),c=n(1),a=n(258),r=n(292),s=n(22),l=n(137),i=n(13),u=n(194),p=n(268),b=n(10);n(306),t.a=Object(i.withInstanceId)(e=>{let{instanceId:t,isLoading:n=!1,initialOpen:i=!1,onSubmit:d=(()=>{})}=e;const[m,O]=Object(o.useState)(""),j=Object(o.useRef)(!1),{getValidationError:g,getValidationErrorId:f}=Object(u.b)(),E=g("coupon");Object(o.useEffect)(()=>{j.current!==n&&(n||!m||E||O(""),j.current=n)},[n,m,E]);const v="wc-block-components-totals-coupon__input-"+t;return Object(o.createElement)(b.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:i,title:Object(o.createElement)(s.a,{label:Object(c.__)("Coupon code","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Apply a coupon code","woo-gutenberg-products-block"),htmlFor:v})},Object(o.createElement)(l.a,{screenReaderLabel:Object(c.__)("Applying coupon…","woo-gutenberg-products-block"),isLoading:n,showSpinner:!1},Object(o.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(o.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(o.createElement)(r.a,{id:v,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(c.__)("Enter code","woo-gutenberg-products-block"),value:m,ariaDescribedBy:f(v),onChange:e=>{O(e)},focusOnMount:!0,showError:!1}),Object(o.createElement)(a.a,{className:"wc-block-components-totals-coupon__button",disabled:n||!m,showSpinner:n,onClick:e=>{e.preventDefault(),d(m)},type:"submit"},Object(c.__)("Apply","woo-gutenberg-products-block"))),Object(o.createElement)(p.a,{propertyName:"coupon",elementId:v}))))})},453:function(e,t,n){"use strict";n.r(t);var o=n(0),c=n(375),a=n(265),r=n(2),s=n(10);t.default=e=>{let{className:t}=e;const n=Object(r.getSetting)("couponsEnabled",!0),{applyCoupon:l,isApplyingCoupon:i}=Object(a.a)("wc/cart");return n?Object(o.createElement)(s.TotalsWrapper,{className:t},Object(o.createElement)(c.a,{onSubmit:l,isLoading:i})):null}}}]);
|
build/cart-blocks/order-summary-discount-frontend.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[21],{105:function(e,t,o){"use strict";var c=o(0);t.a=function(e){let{icon:t,size:o=24,...n}=e;return Object(c.cloneElement)(t,{width:o,height:o,...n})}},122:function(e,t){},196:function(e,t,o){"use strict";var c=o(0),n=o(15);const s=Object(c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(n.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=s},200:function(e,t,o){"use strict";var c=o(11),n=o.n(c),s=o(0),
|
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:
|
6 |
/* translators: %s coupon code. */
|
7 |
-
Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),
|
8 |
/* translators: %s coupon code. */
|
9 |
-
Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form"})}).catch(t=>{
|
10 |
/* translators: %s Coupon code. */
|
11 |
Object(n.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:u,onRemove:()=>{p(e.code)},radius:"large",ariaLabel:Object(n.sprintf)(
|
12 |
/* translators: %s is a coupon code. */
|
13 |
-
Object(n.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(n.__)("Discount","woo-gutenberg-products-block"):Object(n.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},452:function(e,t,o){"use strict";o.r(t);var c=o(0),n=o(374),s=o(37),
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[21],{105:function(e,t,o){"use strict";var c=o(0);t.a=function(e){let{icon:t,size:o=24,...n}=e;return Object(c.cloneElement)(t,{width:o,height:o,...n})}},122:function(e,t){},196:function(e,t,o){"use strict";var c=o(0),n=o(15);const s=Object(c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(n.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=s},200:function(e,t,o){"use strict";var c=o(11),n=o.n(c),s=o(0),a=o(4),r=o.n(a),l=o(1),i=o(105),u=o(196);o(122);var p=e=>{let{text:t,screenReaderText:o="",element:c="li",className:a="",radius:l="small",children:i=null,...u}=e;const p=c,b=r()(a,"wc-block-components-chip","wc-block-components-chip--radius-"+l),m=Boolean(o&&o!==t);return Object(s.createElement)(p,n()({className:b},u),Object(s.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(s.createElement)("span",{className:"screen-reader-text"},o),i)};t.a=e=>{let{ariaLabel:t="",className:o="",disabled:c=!1,onRemove:a=(()=>{}),removeOnAnyClick:b=!1,text:m,screenReaderText:d="",...g}=e;const O=b?"span":"button";if(!t){const e=d&&"string"==typeof d?d:m;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:a,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||a()}},_=b?j:{},v=b?{"aria-hidden":!0}:j;return Object(s.createElement)(p,n()({},g,_,{className:r()(o,"is-removable"),element:b?"button":g.element,screenReaderText:d,text:m}),Object(s.createElement)(O,n()({className:"wc-block-components-chip__remove"},v),Object(s.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},265:function(e,t,o){"use strict";o.d(t,"a",(function(){return i}));var c=o(1),n=o(7),s=o(5),a=o(18),r=o(31),l=o(194);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:o}=Object(r.a)(),{createErrorNotice:i}=Object(n.useDispatch)("core/notices"),{createNotice:u}=Object(n.useDispatch)("core/notices"),{setValidationErrors:p}=Object(l.b)(),b=Object(n.useSelect)((t,o)=>{let{dispatch:n}=o;const r=t(s.CART_STORE_KEY),l=r.isApplyingCoupon(),b=r.isRemovingCoupon(),{applyCoupon:m,removeCoupon:d,receiveApplyingCoupon:g}=n(s.CART_STORE_KEY);return{applyCoupon:t=>{m(t).then(o=>{!0===o&&u("info",Object(c.sprintf)(
|
6 |
/* translators: %s coupon code. */
|
7 |
+
Object(c.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{p({coupon:{message:Object(a.decodeEntities)(e.message),hidden:!1}}),g("")})},removeCoupon:t=>{d(t).then(o=>{!0===o&&u("info",Object(c.sprintf)(
|
8 |
/* translators: %s coupon code. */
|
9 |
+
Object(c.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{i(t.message,{id:"coupon-form",context:e}),g("")})},isApplyingCoupon:l,isRemovingCoupon:b}},[i,u]);return{appliedCoupons:t,isLoading:o,...b}}},305:function(e,t){},374:function(e,t,o){"use strict";var c=o(0),n=o(1),s=o(137),a=o(200),r=o(10),l=o(2);o(305);const i={context:"summary"};t.a=e=>{let{cartCoupons:t=[],currency:o,isRemovingCoupon:u,removeCoupon:p,values:b}=e;const{total_discount:m,total_discount_tax:d}=b,g=parseInt(m,10);if(!g&&0===t.length)return null;const O=parseInt(d,10),j=Object(l.getSetting)("displayCartPricesIncludingTax",!1)?g+O:g,_=Object(r.__experimentalApplyCheckoutFilter)({arg:i,filterName:"coupons",defaultValue:t});return Object(c.createElement)(r.TotalsItem,{className:"wc-block-components-totals-discount",currency:o,description:0!==_.length&&Object(c.createElement)(s.a,{screenReaderLabel:Object(n.__)("Removing coupon…","woo-gutenberg-products-block"),isLoading:u,showSpinner:!1},Object(c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},_.map(e=>Object(c.createElement)(a.a,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:Object(n.sprintf)(
|
10 |
/* translators: %s Coupon code. */
|
11 |
Object(n.__)("Coupon: %s","woo-gutenberg-products-block"),e.label),disabled:u,onRemove:()=>{p(e.code)},radius:"large",ariaLabel:Object(n.sprintf)(
|
12 |
/* translators: %s is a coupon code. */
|
13 |
+
Object(n.__)('Remove coupon "%s"',"woo-gutenberg-products-block"),e.label)})))),label:j?Object(n.__)("Discount","woo-gutenberg-products-block"):Object(n.__)("Coupons","woo-gutenberg-products-block"),value:j?-1*j:"-"})}},452:function(e,t,o){"use strict";o.r(t);var c=o(0),n=o(374),s=o(37),a=o(31),r=o(265),l=o(10);const i=()=>{const{extensions:e,receiveCart:t,...o}=Object(a.a)(),n={extensions:e,cart:o,context:"woocommerce/cart"};return Object(c.createElement)(l.ExperimentalDiscountsMeta.Slot,n)};t.default=e=>{let{className:t}=e;const{cartTotals:o,cartCoupons:u}=Object(a.a)(),{removeCoupon:p,isRemovingCoupon:b}=Object(r.a)("wc/cart"),m=Object(s.getCurrencyFromPriceResponse)(o);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(l.TotalsWrapper,{className:t},Object(c.createElement)(n.a,{cartCoupons:u,currency:m,isRemovingCoupon:b,removeCoupon:p,values:o})),Object(c.createElement)(i,null))}}}]);
|
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{102:function(e,t,n){"use strict";var a=n(11),c=n.n(a),o=n(0),s=n(
|
2 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
3 |
Object(c._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),j=Object(a.createElement)(_,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:s});return i?Object(a.createElement)(r.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:h},j):Object(a.createElement)("div",{className:d()("wc-block-components-shipping-rates-control__package",n)},h,j)};const y=e=>{let{packages:t,collapse:n,showItems:c,collapsible:o,noResultsMessage:s,renderOption:r}=e;return t.length?Object(a.createElement)(a.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(a.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:c,noResultsMessage:s,renderOption:r})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:d=!1,noResultsMessage:b,renderOption:m,context:g}=e;Object(a.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),a=Object(l.b)(t);1===e?Object(o.speak)(Object(c.sprintf)(
|
4 |
/* translators: %d number of shipping options found. */
|
@@ -6,6 +6,6 @@ Object(c._n)("%d shipping option was found.","%d shipping options were found.",a
|
|
6 |
/* translators: %d number of shipping packages packages. */
|
7 |
Object(c._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(c.sprintf)(
|
8 |
/* translators: %d number of shipping options available. */
|
9 |
-
Object(c._n)("%d shipping option was found","%d shipping options were found",a,"woo-gutenberg-products-block"),a))},[n,t]);const{extensions:O,receiveCart:h,...j}=Object(i.a)(),f={className:u,collapsible:d,noResultsMessage:b,renderOption:m,extensions:O,cart:j,components:{ShippingRatesControlPackage:v},context:g},{isEditor:E}=Object(p.a)();return Object(a.createElement)(s.a,{isLoading:n,screenReaderLabel:Object(c.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},E?Object(a.createElement)(y,{packages:t,noResultsMessage:b,renderOption:m}):Object(a.createElement)(a.Fragment,null,Object(a.createElement)(r.ExperimentalOrderShippingPackages.Slot,f),Object(a.createElement)(r.ExperimentalOrderShippingPackages,null,Object(a.createElement)(y,{packages:t,noResultsMessage:b,renderOption:m}))))}},376:function(e,t){},380:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return c}));const a=e=>e.length,c=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},393:function(e,t,n){"use strict";var a=n(0),c=n(292),o=n(11),s=n.n(o),r=n(
|
10 |
/* translators: %s location. */
|
11 |
Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(376);const C=e=>{let{label:t=Object(l.__)("Calculate","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}=e;return Object(o.createElement)("button",{className:"wc-block-components-totals-shipping__change-address-button",onClick:()=>{a(!n)},"aria-expanded":n},t)},N=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a,shippingAddress:c}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w,{address:c}),t&&Object(o.createElement)(C,{label:Object(l.__)("(change address)","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}))},S=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a,isCheckout:c=!1}=e;return t?Object(o.createElement)(C,{isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}):Object(o.createElement)("em",null,c?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:a=!0,showRateSelector:s=!0,isCheckout:d=!1,className:m}=e;const[g,h]=Object(o.useState)(!1),{shippingAddress:j,cartHasCalculatedShipping:f,shippingRates:E,isLoadingRates:k}=Object(i.a)(),_=Object(u.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(n.total_shipping,10)+parseInt(n.total_shipping_tax,10):parseInt(n.total_shipping,10),v=E.some(e=>e.shipping_rates.length)||_,w={isShippingCalculatorOpen:g,setIsShippingCalculatorOpen:h},C=E.flatMap(e=>e.shipping_rates.filter(e=>e.selected).flatMap(e=>e.name));return Object(o.createElement)("div",{className:r()("wc-block-components-totals-shipping",m)},Object(o.createElement)(p.TotalsItem,{label:Object(l.__)("Shipping","woo-gutenberg-products-block"),value:v&&f?_:Object(o.createElement)(S,c()({showCalculator:a,isCheckout:d},w)),description:v&&f?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(b,{selectedShippingRates:C}),Object(o.createElement)(N,c()({shippingAddress:j,showCalculator:a},w))):null,currency:t}),a&&g&&Object(o.createElement)(y,{onUpdate:()=>{h(!1)}}),s&&f&&Object(o.createElement)(O,{hasRates:v,shippingRates:E,isLoadingRates:k}))}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{102:function(e,t,n){"use strict";var a=n(11),c=n.n(a),o=n(0),s=n(138),r=n(4),l=n.n(r);n(192);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:a,onValueChange:r,displayType:p="text",...u}=e;const d="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(d))return null;const b=d/10**a.minorUnit;if(!Number.isFinite(b))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...u,...i(a),value:void 0,currency:void 0,onValueChange:void 0},O=r?e=>{const t=+e.value*10**a.minorUnit;r(t)}:()=>{};return Object(o.createElement)(s.a,c()({className:m,displayType:p},g,{value:b,onValueChange:O}))}},192:function(e,t){},22:function(e,t,n){"use strict";var a=n(0),c=n(4),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:s,wrapperProps:r={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=s||"span",r={...r,className:o()(r.className,"screen-reader-text")},Object(a.createElement)(t,r,c)):(t=s||a.Fragment,l&&i&&n!==c?Object(a.createElement)(t,r,Object(a.createElement)("span",{"aria-hidden":"true"},n),Object(a.createElement)("span",{className:"screen-reader-text"},c)):Object(a.createElement)(t,r,n))}},256:function(e,t){},257:function(e,t){},258:function(e,t,n){"use strict";var a=n(11),c=n.n(a),o=n(0),s=n(49),r=n(4),l=n.n(r),i=n(135);n(259),t.a=e=>{let{className:t,showSpinner:n=!1,children:a,variant:r="contained",...p}=e;const u=l()("wc-block-components-button",t,r,{"wc-block-components-button--loading":n});return Object(o.createElement)(s.a,c()({className:u},p),n&&Object(o.createElement)(i.a,null),Object(o.createElement)("span",{className:"wc-block-components-button__text"},a))}},259:function(e,t){},262:function(e,t,n){"use strict";var a=n(0),c=n(4),o=n.n(c),s=n(263);t.a=e=>{let{checked:t,name:n,onChange:c,option:r}=e;const{value:l,label:i,description:p,secondaryLabel:u,secondaryDescription:d}=r;return Object(a.createElement)("label",{className:o()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${n}-${l}`},Object(a.createElement)("input",{id:`${n}-${l}`,className:"wc-block-components-radio-control__input",type:"radio",name:n,value:l,onChange:e=>c(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`]:d})}),Object(a.createElement)(s.a,{id:`${n}-${l}`,label:i,secondaryLabel:u,description:p,secondaryDescription:d}))}},263:function(e,t,n){"use strict";var a=n(0);t.a=e=>{let{label:t,secondaryLabel:n,description:c,secondaryDescription:o,id:s}=e;return Object(a.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},Object(a.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&Object(a.createElement)("span",{id:s&&s+"__label",className:"wc-block-components-radio-control__label"},t),n&&Object(a.createElement)("span",{id:s&&s+"__secondary-label",className:"wc-block-components-radio-control__secondary-label"},n)),Object(a.createElement)("div",{className:"wc-block-components-radio-control__description-group"},c&&Object(a.createElement)("span",{id:s&&s+"__description",className:"wc-block-components-radio-control__description"},c),o&&Object(a.createElement)("span",{id:s&&s+"__secondary-description",className:"wc-block-components-radio-control__secondary-description"},o)))}},268:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var a=n(0),c=n(194);n(256);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:s,getValidationErrorId:r}=Object(c.b)();if(!t||"string"!=typeof t){const e=s(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(a.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(a.createElement)("p",{id:r(o)},t))}},284:function(e,t,n){"use strict";var a=n(0),c=n(4),o=n.n(c),s=n(13),r=n(262);n(285);const l=e=>{let{className:t="",id:n,selected:c,onChange:i=(()=>{}),options:p=[]}=e;const u=Object(s.useInstanceId)(l),d=n||u;return p.length?Object(a.createElement)("div",{className:o()("wc-block-components-radio-control",t)},p.map(e=>Object(a.createElement)(r.a,{key:`${d}-${e.value}`,name:"radio-control-"+d,checked:e.value===c,option:e,onChange:t=>{i(t),"function"==typeof e.onChange&&e.onChange(t)}}))):null};t.a=l},285:function(e,t){},292:function(e,t,n){"use strict";var a=n(11),c=n.n(a),o=n(0),s=n(1),r=n(3),l=n(4),i=n.n(l),p=n(194),u=n(268),d=n(13),b=n(51),m=n(22);n(257);var g=Object(r.forwardRef)((e,t)=>{let{className:n,id:a,type:s="text",ariaLabel:r,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:d,help:b,autoCapitalize:g="off",autoComplete:O="off",value:h="",onChange:j,required:f=!1,onBlur:E=(()=>{}),feedback:k,..._}=e;const[v,y]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||h})},Object(o.createElement)("input",c()({type:s,id:a,value:h,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{j(e.target.value)},onFocus:()=>y(!0),onBlur:e=>{E(e.target.value),y(!1)},"aria-label":r||p,disabled:d,"aria-describedby":b&&!l?a+"__help":l,required:f},_)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:a},htmlFor:a}),!!b&&Object(o.createElement)("p",{id:a+"__help",className:"wc-block-components-text-input__help"},b),k)});t.a=Object(d.withInstanceId)(e=>{let{className:t,instanceId:n,id:a,ariaDescribedBy:l,errorId:d,focusOnMount:m=!1,onChange:O,showError:h=!0,errorMessage:j="",value:f="",...E}=e;const[k,_]=Object(r.useState)(!0),v=Object(r.useRef)(null),{getValidationError:y,hideValidationError:w,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),I=void 0!==a?a:"textinput-"+n,R=void 0!==d?d:I,x=Object(r.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(s.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,R,C]);Object(r.useEffect)(()=>{var e;k&&m&&(null===(e=v.current)||void 0===e||e.focus()),_(!1)},[m,k,_]),Object(r.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&x(!0)},[f,x]),Object(r.useEffect)(()=>()=>{N(R)},[N,R]);const L=y(R)||{};Object(b.a)(j)&&""!==j&&(L.message=j);const M=L.message&&!L.hidden,$=h&&M&&S(R)?S(R):l;return Object(o.createElement)(g,c()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:I,onBlur:()=>{x(!1)},feedback:h&&Object(o.createElement)(u.a,{errorMessage:j,propertyName:R}),ref:v,onChange:e=>{w(R),O(e)},ariaDescribedBy:$,value:f},E))})},307:function(e,t){},308:function(e,t){},309:function(e,t){},310:function(e,t){},331:function(e,t){},337:function(e,t,n){"use strict";var a=n(0),c=n(1),o=n(20),s=n(137),r=n(10),l=n(380),i=n(31),p=n(27),u=n(4),d=n.n(u),b=n(18),m=n(22),g=n(67),O=n(284),h=n(263),j=n(37),f=n(102),E=n(2);const k=e=>{const t=Object(E.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:Object(b.decodeEntities)(e.name),value:e.rate_id,description:Object(a.createElement)(a.Fragment,null,Number.isFinite(t)&&Object(a.createElement)(f.a,{currency:Object(j.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,Object(b.decodeEntities)(e.delivery_time))}};var _=e=>{let{className:t="",noResultsMessage:n,onSelectRate:c,rates:o,renderOption:s=k,selectedRate:r}=e;const l=(null==r?void 0:r.rate_id)||"",[i,p]=Object(a.useState)(l);if(Object(a.useEffect)(()=>{l&&p(l)},[l]),0===o.length)return n;if(o.length>1)return Object(a.createElement)(O.a,{className:t,onChange:e=>{p(e),c(e)},selected:i,options:o.map(s)});const{label:u,secondaryLabel:d,description:b,secondaryDescription:m}=s(o[0]);return Object(a.createElement)(h.a,{label:u,secondaryLabel:d,description:b,secondaryDescription:m})};n(310);var v=e=>{let{packageId:t,className:n="",noResultsMessage:o,renderOption:s,packageData:l,collapsible:i=!1,collapse:p=!1,showItems:u=!1}=e;const{selectShippingRate:O}=Object(g.a)(),h=Object(a.createElement)(a.Fragment,null,(u||i)&&Object(a.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title"},l.name),u&&Object(a.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(l.items).map(e=>{const t=Object(b.decodeEntities)(e.name),n=e.quantity;return Object(a.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},Object(a.createElement)(m.a,{label:n>1?`${t} × ${n}`:""+t,screenReaderLabel:Object(c.sprintf)(
|
2 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
3 |
Object(c._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),j=Object(a.createElement)(_,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:s});return i?Object(a.createElement)(r.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:h},j):Object(a.createElement)("div",{className:d()("wc-block-components-shipping-rates-control__package",n)},h,j)};const y=e=>{let{packages:t,collapse:n,showItems:c,collapsible:o,noResultsMessage:s,renderOption:r}=e;return t.length?Object(a.createElement)(a.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(a.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:c,noResultsMessage:s,renderOption:r})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:d=!1,noResultsMessage:b,renderOption:m,context:g}=e;Object(a.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),a=Object(l.b)(t);1===e?Object(o.speak)(Object(c.sprintf)(
|
4 |
/* translators: %d number of shipping options found. */
|
6 |
/* translators: %d number of shipping packages packages. */
|
7 |
Object(c._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",e,"woo-gutenberg-products-block"),e)+" "+Object(c.sprintf)(
|
8 |
/* translators: %d number of shipping options available. */
|
9 |
+
Object(c._n)("%d shipping option was found","%d shipping options were found",a,"woo-gutenberg-products-block"),a))},[n,t]);const{extensions:O,receiveCart:h,...j}=Object(i.a)(),f={className:u,collapsible:d,noResultsMessage:b,renderOption:m,extensions:O,cart:j,components:{ShippingRatesControlPackage:v},context:g},{isEditor:E}=Object(p.a)();return Object(a.createElement)(s.a,{isLoading:n,screenReaderLabel:Object(c.__)("Loading shipping rates…","woo-gutenberg-products-block"),showSpinner:!0},E?Object(a.createElement)(y,{packages:t,noResultsMessage:b,renderOption:m}):Object(a.createElement)(a.Fragment,null,Object(a.createElement)(r.ExperimentalOrderShippingPackages.Slot,f),Object(a.createElement)(r.ExperimentalOrderShippingPackages,null,Object(a.createElement)(y,{packages:t,noResultsMessage:b,renderOption:m}))))}},376:function(e,t){},380:function(e,t,n){"use strict";n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return c}));const a=e=>e.length,c=e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0)},393:function(e,t,n){"use strict";var a=n(0),c=n(292),o=n(11),s=n.n(o),r=n(43),l=n(1),i=n(18),p=n(4),u=n.n(p),d=n(13),b=n(430),m=n(194),g=n(268),O=n(61);n(308);var h=Object(d.withInstanceId)(e=>{let{id:t,className:n,label:c,onChange:o,options:s,value:r,required:i=!1,errorMessage:p=Object(l.__)("Please select a value.","woo-gutenberg-products-block"),errorId:d,instanceId:h="0",autoComplete:j="off"}=e;const{getValidationError:f,setValidationErrors:E,clearValidationError:k}=Object(m.b)(),_=Object(a.useRef)(null),v=t||"control-"+h,y=d||v,w=f(y)||{message:"",hidden:!1};return Object(a.useEffect)(()=>(!i||r?k(y):E({[y]:{message:p,hidden:!0}}),()=>{k(y)}),[k,r,y,p,i,E]),Object(a.createElement)("div",{id:v,className:u()("wc-block-components-combobox",n,{"is-active":r,"has-error":w.message&&!w.hidden}),ref:_},Object(a.createElement)(b.a,{className:"wc-block-components-combobox-control",label:c,onChange:o,onFilterValueChange:e=>{if(e.length){const t=Object(O.a)(_.current)?_.current.ownerDocument.activeElement:void 0;if(t&&Object(O.a)(_.current)&&_.current.contains(t))return;const n=e.toLocaleUpperCase(),a=s.find(e=>e.label.toLocaleUpperCase().startsWith(n)||e.value.toLocaleUpperCase()===n);a&&o(a.value)}},options:s,value:r||"",allowReset:!1,autoComplete:j,"aria-invalid":w.message&&!w.hidden}),Object(a.createElement)(g.a,{propertyName:y}))});n(307);var j=e=>{let{className:t,countries:n,id:c,label:o,onChange:s,value:r="",autoComplete:p="off",required:d=!1,errorId:b,errorMessage:m=Object(l.__)("Please select a country.","woo-gutenberg-products-block")}=e;const g=Object(a.useMemo)(()=>Object.entries(n).map(e=>{let[t,n]=e;return{value:t,label:Object(i.decodeEntities)(n)}}),[n]);return Object(a.createElement)("div",{className:u()(t,"wc-block-components-country-input")},Object(a.createElement)(h,{id:c,label:o,onChange:s,options:g,value:r,errorId:b,errorMessage:m,required:d,autoComplete:p}),"off"!==p&&Object(a.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:p,value:r,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);s(n?n.value:"")},style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1}))},f=e=>Object(a.createElement)(j,s()({countries:r.g},e)),E=e=>Object(a.createElement)(j,s()({countries:r.a},e));n(309);const k=(e,t)=>{const n=t.find(t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase());return n?n.value:""};var _=e=>{let{className:t,id:n,states:o,country:s,label:r,onChange:p,autoComplete:d="off",value:b="",required:m=!1}=e;const g=o[s],O=Object(a.useMemo)(()=>g?Object.keys(g).map(e=>({value:e,label:Object(i.decodeEntities)(g[e])})):[],[g]),j=Object(a.useCallback)(e=>{p(O.length>0?k(e,O):e)},[p,O]),f=Object(a.useRef)(b);return Object(a.useEffect)(()=>{f.current!==b&&(f.current=b)},[b]),Object(a.useEffect)(()=>{if(O.length>0&&f.current){const e=k(f.current,O);e!==f.current&&j(e)}},[O,j]),O.length>0?Object(a.createElement)(a.Fragment,null,Object(a.createElement)(h,{className:u()(t,"wc-block-components-state-input"),id:n,label:r,onChange:j,options:O,value:b,errorMessage:Object(l.__)("Please select a state.","woo-gutenberg-products-block"),required:m,autoComplete:d}),"off"!==d&&Object(a.createElement)("input",{type:"text","aria-hidden":!0,autoComplete:d,value:b,onChange:e=>j(e.target.value),style:{minHeight:"0",height:"0",border:"0",padding:"0",position:"absolute"},tabIndex:-1})):Object(a.createElement)(c.a,{className:t,id:n,label:r,onChange:j,autoComplete:d,value:b,required:m})},v=e=>Object(a.createElement)(_,s()({states:r.h},e)),y=e=>Object(a.createElement)(_,s()({states:r.b},e)),w=n(30),C=n(2),N=n(44);t.a=Object(d.withInstanceId)(e=>{let{id:t="",fields:n=Object.keys(C.defaultAddressFields),fieldConfig:o={},instanceId:s,onChange:r,type:i="shipping",values:p}=e;const{getValidationError:u,setValidationErrors:d,clearValidationError:b}=Object(m.b)(),g=Object(w.a)(n),O=u("shipping-missing-country")||{},h=Object(a.useMemo)(()=>Object(N.a)(g,o,p.country),[g,o,p.country]);return Object(a.useEffect)(()=>{h.forEach(e=>{e.hidden&&p[e.key]&&r({...p,[e.key]:""})})},[h,r,p]),Object(a.useEffect)(()=>{"shipping"===i&&((e,t,n,a)=>{a||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}}),a&&e.country&&n("shipping-missing-country")})(p,d,b,!!O.message&&!O.hidden)},[p,O.message,O.hidden,d,b,i]),t=t||s,Object(a.createElement)("div",{id:t,className:"wc-block-components-address-form"},h.map(e=>{if(e.hidden)return null;if("country"===e.key){const n="shipping"===i?f:E;return Object(a.createElement)(n,{key:e.key,id:`${t}-${e.key}`,label:e.required?e.label:e.optionalLabel,value:p.country,autoComplete:e.autocomplete,onChange:e=>r({...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:y;return Object(a.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=>r({...p,state:e}),errorMessage:e.errorMessage,required:e.required})}return Object(a.createElement)(c.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=>r({...p,[e.key]:t}),errorMessage:e.errorMessage,required:e.required})}))})},429:function(e,t,n){"use strict";var a=n(11),c=n.n(a),o=n(0),s=n(4),r=n.n(s),l=n(1),i=n(31),p=n(10),u=n(2),d=n(18);const b=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(d.decodeEntities)(t.join(", ")))};var m=n(94),g=n(337),O=e=>{let{hasRates:t,shippingRates:n,isLoadingRates:a}=e;const c=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"},c),Object(o.createElement)(g.a,{className:"wc-block-components-totals-shipping__options",collapsible:!0,noResultsMessage:Object(o.createElement)(m.a,{isDismissible:!1,className:r()("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:a,context:"woocommerce/cart"}))},h=n(65),j=n(258),f=n(12),E=n.n(f),k=n(194),_=(n(331),n(393)),v=e=>{let{address:t,onUpdate:n,addressFields:a}=e;const[c,s]=Object(o.useState)(t),{hasValidationErrors:r,showAllValidationErrors:i}=Object(k.b)();return Object(o.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},Object(o.createElement)(_.a,{fields:a,onChange:s,values:c}),Object(o.createElement)(j.a,{className:"wc-block-components-shipping-calculator-address__button",disabled:E()(c,t),onClick:e=>{if(e.preventDefault(),i(),!r)return n(c)},type:"submit"},Object(l.__)("Update","woo-gutenberg-products-block")))},y=e=>{let{onUpdate:t=(()=>{}),addressFields:n=["country","state","city","postcode"]}=e;const{shippingAddress:a,setShippingAddress:c}=Object(h.a)();return Object(o.createElement)("div",{className:"wc-block-components-shipping-calculator"},Object(o.createElement)(v,{address:a,addressFields:n,onUpdate:e=>{c(e),t(e)}}))},w=e=>{let{address:t}=e;if(0===Object.values(t).length)return null;const n=Object(u.getSetting)("shippingCountries",{}),a=Object(u.getSetting)("shippingStates",{}),c="string"==typeof n[t.country]?Object(d.decodeEntities)(n[t.country]):"",s="object"==typeof a[t.country]&&"string"==typeof a[t.country][t.state]?Object(d.decodeEntities)(a[t.country][t.state]):t.state,r=[];r.push(t.postcode.toUpperCase()),r.push(t.city),r.push(s),r.push(c);const i=r.filter(Boolean).join(", ");return i?Object(o.createElement)("span",{className:"wc-block-components-shipping-address"},Object(l.sprintf)(
|
10 |
/* translators: %s location. */
|
11 |
Object(l.__)("Shipping to %s","woo-gutenberg-products-block"),i)+" "):null};n(376);const C=e=>{let{label:t=Object(l.__)("Calculate","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}=e;return Object(o.createElement)("button",{className:"wc-block-components-totals-shipping__change-address-button",onClick:()=>{a(!n)},"aria-expanded":n},t)},N=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a,shippingAddress:c}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(w,{address:c}),t&&Object(o.createElement)(C,{label:Object(l.__)("(change address)","woo-gutenberg-products-block"),isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}))},S=e=>{let{showCalculator:t,isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a,isCheckout:c=!1}=e;return t?Object(o.createElement)(C,{isShippingCalculatorOpen:n,setIsShippingCalculatorOpen:a}):Object(o.createElement)("em",null,c?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:a=!0,showRateSelector:s=!0,isCheckout:d=!1,className:m}=e;const[g,h]=Object(o.useState)(!1),{shippingAddress:j,cartHasCalculatedShipping:f,shippingRates:E,isLoadingRates:k}=Object(i.a)(),_=Object(u.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(n.total_shipping,10)+parseInt(n.total_shipping_tax,10):parseInt(n.total_shipping,10),v=E.some(e=>e.shipping_rates.length)||_,w={isShippingCalculatorOpen:g,setIsShippingCalculatorOpen:h},C=E.flatMap(e=>e.shipping_rates.filter(e=>e.selected).flatMap(e=>e.name));return Object(o.createElement)("div",{className:r()("wc-block-components-totals-shipping",m)},Object(o.createElement)(p.TotalsItem,{label:Object(l.__)("Shipping","woo-gutenberg-products-block"),value:v&&f?_:Object(o.createElement)(S,c()({showCalculator:a,isCheckout:d},w)),description:v&&f?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(b,{selectedShippingRates:C}),Object(o.createElement)(N,c()({shippingAddress:j,showCalculator:a},w))):null,currency:t}),a&&g&&Object(o.createElement)(y,{onUpdate:()=>{h(!1)}}),s&&f&&Object(o.createElement)(O,{hasRates:v,shippingRates:E,isLoadingRates:k}))}}}]);
|
build/cart-blocks/proceed-to-checkout-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[27],{258:function(e,t,c){"use strict";var n=c(11),o=c.n(n),s=c(0),r=c(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[27],{258:function(e,t,c){"use strict";var n=c(11),o=c.n(n),s=c(0),r=c(49),a=c(4),i=c.n(a),u=c(135);c(259),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))}},259:function(e,t){},369:function(e,t,c){"use strict";(function(e){var n=c(0),o=c(1),s=c(4),r=c.n(s),a=c(258),i=c(43),u=c(34),b=c(416),l=c(2);c(371),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(370))},370: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},371:function(e,t){},416: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]}},447:function(e,t,c){"use strict";c.r(t);var n=c(120),o=c(369);t.default=Object(n.withFilteredAttributes)({checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}}})(o.a)}}]);
|
build/cart-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'b915f81468f6078fde7fd862a67da371');
|
build/cart-frontend.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){function t(t){for(var r,o,a=t[0],s=t[1],i=0,l=[];i<a.length;i++)o=a[i],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(c&&c(t);l.length;)l.shift()()}var r={},n={11:0,7:0,73: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 a=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=a);var s,i=document.createElement("script");i.charset="utf-8",i.timeout=120,o.nc&&i.setAttribute("nonce",o.nc),i.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",2:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b",3:"vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542",4:"cart-blocks/cart-line-items--mini-cart-contents-block/products-table",5:"cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping",12:"cart-blocks/cart-accepted-payment-methods",13:"cart-blocks/cart-express-payment",14:"cart-blocks/cart-items",15:"cart-blocks/cart-line-items",16:"cart-blocks/cart-order-summary",17:"cart-blocks/cart-totals",18:"cart-blocks/empty-cart",19:"cart-blocks/filled-cart",20:"cart-blocks/order-summary-coupon-form",21:"cart-blocks/order-summary-discount",22:"cart-blocks/order-summary-fee",23:"cart-blocks/order-summary-heading",24:"cart-blocks/order-summary-shipping",25:"cart-blocks/order-summary-subtotal",26:"cart-blocks/order-summary-taxes",27:"cart-blocks/proceed-to-checkout"}[e]||e)+"-frontend.js?ver="+{0:"1d36f73838f02eb72b0e",1:"e2dda84269ff5f357820",2:"bb568a01ffa114ca1394",3:"deab3ee0c5c13d3addc8",4:"89f09ba23bc79f34d574",5:"4633d7aaf0d614913380",12:"7346fa68956c1d3ee462",13:"5d5d2d138986a6bdc2ee",14:"497cd8ab48255af9b50d",15:"c50926eca8955679669f",16:"5acf6f9df18d8fe0570e",17:"beabb36f9afc88b4feb3",18:"f6628e966e355c915de9",19:"fd0392dda43dda02525c",20:"a0f83c5f3f9e75cd858f",21:"2fbcc787732cb9b65f30",22:"7f685f8beac3d104e331",23:"14f6290bb0565b065a38",24:"3e736b89e04324e8d78a",25:"a348afa0fb9493cb1f39",26:"7034e6f77b9b5139aafa",27:"357d370510f29a97ef5b"}[e]}(e);var c=new Error;s=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+a+")",c.name="ChunkLoadError",c.type=o,c.request=a,r[1](c)}n[e]=void 0}};var l=setTimeout((function(){s({type:"timeout",target:i})}),12e4);i.onerror=i.onload=s,document.head.appendChild(i)}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 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 c=s;o(o.s=224)}([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 a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var s=o.apply(null,n);s&&e.push(s)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.data},function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},,function(e,t){e.exports=window.wc.blocksCheckout},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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(19),o=r.n(n),a=r(0),s=r(3),i=r(1),c=r(44),l=e=>{let{imageUrl:t=c.l+"/block-error.svg",header:r=Object(i.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(i.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:s=Object(i.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(a.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(a.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(a.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(a.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(a.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(a.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",o),l&&Object(a.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(33);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(a.createElement)(a.Fragment,null,Object(a.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:i,button:c}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof i?i({errorMessage:u}):Object(a.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:s,button:c}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=window.wp.htmlEntities},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){e.exports=window.wp.a11y},,,,function(e,t,r){"use strict";(function(e){var n=r(0);r(38);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 a}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return d}));var n=r(61);let o,a;!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"}(a||(a={}));const s=(e,t)=>Object(n.a)(e)&&"type"in e&&e.type===t,i=e=>s(e,o.SUCCESS),c=e=>s(e,o.ERROR),l=e=>s(e,o.FAIL),u=e=>!Object(n.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:a,shouldRetry:u,isSuccessResponse:i,isErrorResponse:c,isFailResponse:l})},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(12),a=r.n(o);function s(e){const t=Object(n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(6),o=r(0),a=r(5),s=r(7),i=r(18),c=r(118),l=r(27),u=r(68);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(s.dispatch)(a.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},f=()=>{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:""},h={...m,email:""},b={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:a.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),E={cartCoupons:a.EMPTY_CART_COUPONS,cartItems:a.EMPTY_CART_ITEMS,cartFees:a.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:a.EMPTY_CART_ITEM_ERRORS,cartTotals:b,cartIsLoading:!0,cartErrors:a.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,shippingRates:a.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:a.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:a.EMPTY_EXTENSIONS},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),i=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();f();const p=Object(s.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:a.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:a.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,extensions:a.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const o=e(a.CART_STORE_KEY),s=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),f=o.isCustomerDataUpdating(),{receiveCart:b}=n(a.CART_STORE_KEY),y=g(s.billingAddress),v=s.needsShipping?g(s.shippingAddress):y,O=s.fees.length>0?s.fees.map(e=>g(e)):a.EMPTY_CART_FEES;return{cartCoupons:s.coupons.length>0?s.coupons.map(e=>({...e,label:e.code})):a.EMPTY_CART_COUPONS,cartItems:s.items,cartFees:O,cartItemsCount:s.itemsCount,cartItemsWeight:s.itemsWeight,cartNeedsPayment:s.needsPayment,cartNeedsShipping:s.needsShipping,cartItemErrors:s.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingAddress:Object(c.a)(y),shippingAddress:Object(c.a)(v),extensions:s.extensions,shippingRates:s.shippingRates,isLoadingRates:f,cartHasCalculatedShipping:s.hasCalculatedShipping,paymentRequirements:s.paymentRequirements,receiveCart:b}},[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){},function(e,t,r){"use strict";r.d(t,"b",(function(){return x})),r.d(t,"a",(function(){return P}));var n=r(0),o=r(1),a=r(58),s=r(32),i=r.n(s),c=r(52),l=r(61),u=r(7);let d;!function(e){e.SET_IDLE="set_idle",e.SET_PRISTINE="set_pristine",e.SET_REDIRECT_URL="set_redirect_url",e.SET_COMPLETE="set_checkout_complete",e.SET_BEFORE_PROCESSING="set_before_processing",e.SET_AFTER_PROCESSING="set_after_processing",e.SET_PROCESSING_RESPONSE="set_processing_response",e.SET_PROCESSING="set_checkout_is_processing",e.SET_HAS_ERROR="set_checkout_has_error",e.SET_NO_ERROR="set_checkout_no_error",e.SET_CUSTOMER_ID="set_checkout_customer_id",e.SET_ORDER_ID="set_checkout_order_id",e.SET_ORDER_NOTES="set_checkout_order_notes",e.INCREMENT_CALCULATING="increment_calculating",e.DECREMENT_CALCULATING="decrement_calculating",e.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS="set_shipping_address_as_billing_address",e.SET_SHOULD_CREATE_ACCOUNT="set_should_create_account",e.SET_EXTENSION_DATA="set_extension_data"}(d||(d={}));const p=()=>({type:d.SET_IDLE}),f=e=>({type:d.SET_REDIRECT_URL,redirectUrl:e}),m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:d.SET_COMPLETE,data:e}},h=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:e?d.SET_HAS_ERROR:d.SET_NO_ERROR}};var b=r(2),g=r(118);let E;!function(e){e.PRISTINE="pristine",e.IDLE="idle",e.PROCESSING="processing",e.COMPLETE="complete",e.BEFORE_PROCESSING="before_processing",e.AFTER_PROCESSING="after_processing"}(E||(E={}));const y={order_id:0,customer_id:0,billing_address:{},shipping_address:{},...Object(b.getSetting)("checkoutData",{})||{}},v={redirectUrl:"",status:E.PRISTINE,hasError:!1,calculatingCount:0,orderId:y.order_id,orderNotes:"",customerId:y.customer_id,useShippingAsBilling:Object(g.b)(y.billing_address,y.shipping_address),shouldCreateAccount:!1,processingResponse:null,extensionData:{}},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,{redirectUrl:t,type:r,customerId:n,orderId:o,orderNotes:a,extensionData:s,useShippingAsBilling:i,shouldCreateAccount:c,data:l}=arguments.length>1?arguments[1]:void 0,u=e;switch(r){case d.SET_PRISTINE:u=v;break;case d.SET_IDLE:u=e.status!==E.IDLE?{...e,status:E.IDLE}:e;break;case d.SET_REDIRECT_URL:u=void 0!==t&&t!==e.redirectUrl?{...e,redirectUrl:t}:e;break;case d.SET_PROCESSING_RESPONSE:u={...e,processingResponse:l};break;case d.SET_COMPLETE:u=e.status!==E.COMPLETE?{...e,status:E.COMPLETE,redirectUrl:"string"==typeof(null==l?void 0:l.redirectUrl)?l.redirectUrl:e.redirectUrl}:e;break;case d.SET_PROCESSING:u=e.status!==E.PROCESSING?{...e,status:E.PROCESSING,hasError:!1}:e,u=!1===u.hasError?u:{...u,hasError:!1};break;case d.SET_BEFORE_PROCESSING:u=e.status!==E.BEFORE_PROCESSING?{...e,status:E.BEFORE_PROCESSING,hasError:!1}:e;break;case d.SET_AFTER_PROCESSING:u=e.status!==E.AFTER_PROCESSING?{...e,status:E.AFTER_PROCESSING}:e;break;case d.SET_HAS_ERROR:u=e.hasError?e:{...e,hasError:!0},u=e.status===E.PROCESSING||e.status===E.BEFORE_PROCESSING?{...u,status:E.IDLE}:u;break;case d.SET_NO_ERROR:u=e.hasError?{...e,hasError:!1}:e;break;case d.INCREMENT_CALCULATING:u={...e,calculatingCount:e.calculatingCount+1};break;case d.DECREMENT_CALCULATING:u={...e,calculatingCount:Math.max(0,e.calculatingCount-1)};break;case d.SET_CUSTOMER_ID:u=void 0!==n?{...e,customerId:n}:e;break;case d.SET_ORDER_ID:u=void 0!==o?{...e,orderId:o}:e;break;case d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS:void 0!==i&&i!==e.useShippingAsBilling&&(u={...e,useShippingAsBilling:i});break;case d.SET_SHOULD_CREATE_ACCOUNT:void 0!==c&&c!==e.shouldCreateAccount&&(u={...e,shouldCreateAccount:c});break;case d.SET_ORDER_NOTES:void 0!==a&&e.orderNotes!==a&&(u={...e,orderNotes:a});break;case d.SET_EXTENSION_DATA:void 0!==s&&e.extensionData!==s&&(u={...e,extensionData:s})}return u!==e&&r!==d.SET_PRISTINE&&u.status===E.PRISTINE&&(u.status=E.IDLE),u};var S=r(18),_=r(91),k=r(197);var w=r(199),j=r(194),R=r(40),C=r(29),T=r(77);const A=Object(n.createContext)({dispatchActions:{resetCheckout:()=>{},setRedirectUrl:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},incrementCalculating:()=>{},decrementCalculating:()=>{},setCustomerId:e=>{},setOrderId:e=>{},setOrderNotes:e=>{},setExtensionData:e=>{}},onSubmit:()=>{},isComplete:!1,isIdle:!1,isCalculating:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,redirectUrl:"",orderId:0,orderNotes:"",customerId:0,onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},hasOrder:!1,isCart:!1,useShippingAsBilling:!1,setUseShippingAsBilling:e=>{},shouldCreateAccount:!1,setShouldCreateAccount:e=>{},extensionData:{}}),x=()=>Object(n.useContext)(A),P=e=>{let{children:t,redirectUrl:r,isCart:s=!1}=e;v.redirectUrl=r;const[b,g]=Object(n.useReducer)(O,v),{setValidationErrors:y}=Object(j.b)(),{createErrorNotice:x}=Object(u.useDispatch)("core/notices"),{dispatchCheckoutEvent:P}=Object(R.a)(),M=b.calculatingCount>0,{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D,shouldRetry:L}=Object(C.d)(),{checkoutNotices:F,paymentNotices:V,expressPaymentNotices:B}=(()=>{const{noticeContexts:e}=Object(C.d)();return{checkoutNotices:Object(u.useSelect)(e=>e("core/notices").getNotices("wc/checkout"),[]),expressPaymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.EXPRESS_PAYMENTS),[e.EXPRESS_PAYMENTS]),paymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.PAYMENTS),[e.PAYMENTS])}})(),[U,H]=Object(n.useReducer)(_.b,{}),G=Object(n.useRef)(U),{onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,onCheckoutValidationBeforeProcessing:q}=(e=>Object(n.useMemo)(()=>({onCheckoutAfterProcessingWithSuccess:Object(k.a)("checkout_after_processing_with_success",e),onCheckoutAfterProcessingWithError:Object(k.a)("checkout_after_processing_with_error",e),onCheckoutValidationBeforeProcessing:Object(k.a)("checkout_validation_before_processing",e)}),[e]))(H);Object(n.useEffect)(()=>{G.current=U},[U]);const W=Object(n.useMemo)(()=>function(){return i()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidationBeforeProcessing",plugin:"WooCommerce Blocks"}),q(...arguments)},[q]),X=Object(n.useMemo)(()=>({resetCheckout:()=>{g({type:d.SET_PRISTINE})},setRedirectUrl:e=>{g(f(e))},setHasError:e=>{g(h(e))},incrementCalculating:()=>{g({type:d.INCREMENT_CALCULATING})},decrementCalculating:()=>{g({type:d.DECREMENT_CALCULATING})},setCustomerId:e=>{var t;g((t=e,{type:d.SET_CUSTOMER_ID,customerId:t}))},setOrderId:e=>{g((e=>({type:d.SET_ORDER_ID,orderId:e}))(e))},setOrderNotes:e=>{g((e=>({type:d.SET_ORDER_NOTES,orderNotes:e}))(e))},setExtensionData:e=>{g((e=>({type:d.SET_EXTENSION_DATA,extensionData:e}))(e))},setAfterProcessing:e=>{const t=(e=>{const t={message:"",paymentStatus:"",redirectUrl:"",paymentDetails:{}};return"payment_result"in e&&(t.paymentStatus=e.payment_result.payment_status,t.redirectUrl=e.payment_result.redirect_url,e.payment_result.hasOwnProperty("payment_details")&&Array.isArray(e.payment_result.payment_details)&&e.payment_result.payment_details.forEach(e=>{let{key:r,value:n}=e;t.paymentDetails[r]=Object(S.decodeEntities)(n)})),"message"in e&&(t.message=Object(S.decodeEntities)(e.message)),!t.message&&"data"in e&&"status"in e.data&&e.data.status>299&&(t.message=Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")),t})(e);var r;g(f((null==t?void 0:t.redirectUrl)||"")),g((r=t,{type:d.SET_PROCESSING_RESPONSE,data:r})),g({type:d.SET_AFTER_PROCESSING})}}),[]);Object(n.useEffect)(()=>{b.status===E.BEFORE_PROCESSING&&(Object(T.b)("error"),Object(w.a)(G.current,"checkout_validation_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;x(t,{context:"wc/checkout"}),y(r)}),g(p()),g(h())):g({type:d.SET_PROCESSING})}))},[b.status,y,x,g]);const K=Object(a.a)(b.status),$=Object(a.a)(b.hasError);Object(n.useEffect)(()=>{if((b.status!==K||b.hasError!==$)&&b.status===E.AFTER_PROCESSING){const e={redirectUrl:b.redirectUrl,orderId:b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,processingResponse:b.processingResponse};b.hasError?Object(w.b)(G.current,"checkout_after_processing_with_error",e).then(t=>{const r=(e=>{let t=null;return e.forEach(e=>{if((I(e)||D(e))&&e.message&&Object(c.a)(e.message)){const r=e.messageContext&&Object(c.a)(e.messageContent)?{context:e.messageContext}:void 0;t=e,x(e.message,r)}}),t})(t);if(null!==r)L(r)?g(p()):g(m(r));else{if(!(F.some(e=>"error"===e.status)||B.some(e=>"error"===e.status)||V.some(e=>"error"===e.status))){var n;const t=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");x(t,{id:"checkout",context:"wc/checkout"})}g(p())}}):Object(w.b)(G.current,"checkout_after_processing_with_success",e).then(e=>{let t=null,r=null;if(e.forEach(e=>{N(e)&&(t=e),(I(e)||D(e))&&(r=e)}),t&&!r)g(m(t));else if(Object(l.a)(r)){if(r.message&&Object(c.a)(r.message)){const e=r.messageContext&&Object(c.a)(r.messageContext)?{context:r.messageContext}:void 0;x(r.message,e)}L(r)?g(h(!0)):g(m(r))}else g(m())})}},[b.status,b.hasError,b.redirectUrl,b.orderId,b.customerId,b.orderNotes,b.processingResponse,K,$,X,x,I,D,N,L,F,B,V]);const J={onSubmit:Object(n.useCallback)(()=>{P("submit"),g({type:d.SET_BEFORE_PROCESSING})},[P]),isComplete:b.status===E.COMPLETE,isIdle:b.status===E.IDLE,isCalculating:M,isProcessing:b.status===E.PROCESSING,isBeforeProcessing:b.status===E.BEFORE_PROCESSING,isAfterProcessing:b.status===E.AFTER_PROCESSING,hasError:b.hasError,redirectUrl:b.redirectUrl,onCheckoutBeforeProcessing:W,onCheckoutValidationBeforeProcessing:q,onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,dispatchActions:X,isCart:s,orderId:b.orderId,hasOrder:!!b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,useShippingAsBilling:b.useShippingAsBilling,setUseShippingAsBilling:e=>{return g((t=e,{type:d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS,useShippingAsBilling:t}));var t},shouldCreateAccount:b.shouldCreateAccount,setShouldCreateAccount:e=>{return g((t=e,{type:d.SET_SHOULD_CREATE_ACCOUNT,shouldCreateAccount:t}));var t},extensionData:b.extensionData};return Object(n.createElement)(A.Provider,{value:J},t)}},,,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";r.d(t,"a",(function(){return s}));var n=r(39),o=r(0),a=r(31);const s=()=>{const e=Object(a.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,r){"use strict";var n=r(8),o=r(0),a=r(15),s=function({icon:e,className:t,...r}){const a=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:a},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(s,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&s===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===a.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(a.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),a=r(0);t.a=Object(a.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(a.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},,function(e,t,r){"use strict";r.d(t,"n",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return i})),r.d(t,"m",(function(){return c})),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 f})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return b})),r.d(t,"h",(function(){return g})),r.d(t,"b",(function(){return E}));var n,o=r(2);const a=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=a.pluginUrl+"images/",i=a.pluginUrl+"build/",c=a.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),f=(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"),h=Object(o.getSetting)("shippingCountries",{}),b=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),a=r(69),s=r(52);const i=Object(n.getSetting)("countryLocale",{}),c=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(a.a)(e.priority)&&(t.index=e.priority),Object(s.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(i).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,c(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,"b",(function(){return s})),r.d(t,"a",(function(){return i}));var n=r(0),o=r(65);const a=Object(n.createContext)({isInitialized:!1,billingData:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},setBillingData:()=>{},setShippingAddress:()=>{}}),s=()=>Object(n.useContext)(a),i=e=>{let{children:t}=e;const r=Object(o.a)();return Object(n.createElement)(a.Provider,{value:r},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t,r){var o=this,a=Object(n.useRef)(null),s=Object(n.useRef)(0),i=Object(n.useRef)(null),c=Object(n.useRef)([]),l=Object(n.useRef)(),u=Object(n.useRef)(),d=Object(n.useRef)(e),p=Object(n.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 m=!!(r=r||{}).leading,h=!("trailing"in r)||!!r.trailing,b="maxWait"in r,g=b?Math.max(+r.maxWait||0,t):null;return Object(n.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(n.useMemo)((function(){var e=function(e){var t=c.current,r=l.current;return c.current=l.current=null,s.current=e,u.current=d.current.apply(r,t)},r=function(e,t){f&&cancelAnimationFrame(i.current),i.current=f?requestAnimationFrame(e):setTimeout(e,t)},n=function(e){if(!p.current)return!1;var r=e-a.current,n=e-s.current;return!a.current||r>=t||r<0||b&&n>=g},E=function(t){return i.current=null,h&&c.current?e(t):(c.current=l.current=null,u.current)},y=function(){var e=Date.now();if(n(e))return E(e);if(p.current){var o=e-a.current,i=e-s.current,c=t-o,l=b?Math.min(c,g-i):c;r(y,l)}},v=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var h=Date.now(),g=n(h);if(c.current=d,l.current=o,a.current=h,g){if(!i.current&&p.current)return s.current=a.current,r(y,t),m?e(a.current):u.current;if(b)return r(y,t),e(a.current)}return i.current||r(y,t),u.current};return v.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,c.current=a.current=l.current=i.current=null},v.isPending=function(){return!!i.current},v.flush=function(){return i.current?E(Date.now()):u.current},v}),[m,b,t,g,h,f])}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(11),o=r.n(n),a=r(0),s=r(16);const i=[".wp-block-woocommerce-cart"],c=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:i=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const c=n(e,r),l=i(e,r),u={...e.dataset,...c.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:i={},errorBoundaryProps:c={}}=e;Object(a.render)(Object(a.createElement)(s.a,c,Object(a.createElement)(a.Suspense,{fallback:Object(a.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(a.createElement)(t,o()({},i,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:c,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(i.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:a}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:a}=e;const s=document.body.querySelectorAll(o);a&&a.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,a)),c({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:a,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:a}=e;const s=a.querySelectorAll(o);c({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},,function(e,t,r){"use strict";var n=r(8),o=r(0),a=r(4),s=r.n(a),i=r(6),c=r(32),l=r.n(c),u=r(13),d=r(51),p=r(93),f=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const a=o.getBoundingClientRect();return new n.DOMRect(e.left+a.left,e.top+a.top,e.width,e.height)}let h=0;function b(e){const t=document.scrollingElement||document.body;e&&(h=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=h)}let g=0;function E(){return Object(o.useEffect)(()=>(0===g&&b(!0),++g,()=>{1===g&&b(!1),--g}),[]),null}var y=r(24);function v(e){const t=Object(o.useContext)(y.a),r=t.slots[e]||{},n=t.fills[e],a=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:a,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 O=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function S({name:e,children:t,registerFill:r,unregisterFill:n}){const a=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(O),[n,a]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(a(t(e)),r(()=>{a(t(e))})),[e]),n})(e),s=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,s.current),()=>n(e,s.current)),[]),Object(o.useLayoutEffect)(()=>{s.current.children=t,a&&a.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==s.current.name&&(n(s.current.name,s.current),s.current.name=e,r(e,s.current))},[e]),a&&a.node?(Object(i.isFunction)(t)&&(t=t(a.props.fillProps)),Object(o.createPortal)(t,a.node)):null}var _=e=>Object(o.createElement)(O.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(S,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));class k 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,a=Object(i.map)(n(t,this),e=>{const t=Object(i.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(i.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(i.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(i.isFunction)(e)?e(a):a)}}var w=e=>Object(o.createElement)(O.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:a})=>Object(o.createElement)(k,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:a})));function j(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function R({name:e,children:t}){const r=v(e),n=Object(o.useRef)({rerender:j()});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 C=Object(o.forwardRef)((function({name:e,fillProps:t={},as:r="div",...a},s){const i=Object(o.useContext)(y.a),c=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(i.registerSlot(e,c,t),()=>{i.unregisterSlot(e,c)}),[i.registerSlot,i.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{i.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([s,c])},a))}));function T(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(_,e),Object(o.createElement)(R,e))}r(12),o.Component;const A=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(w,t));function x(e){return"appear"===e?"top":"left"}function P(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:a}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const i=r?parseInt(r,10):0,c=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=a?parseInt(a,10):0;return{x:e.left+l,y:e.top+i,width:e.width-l-u,height:e.height-i-c,left:e.left+l,right:e.right-u,top:e.top+i,bottom:e.bottom-c}}function M(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function N(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function I(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:a,noArrow:i=!0,isAlternate:c,position:h="bottom right",range:b,focusOnMount:g="firstElement",anchorRef:y,shouldAnchorIncludePadding:O,anchorRect:S,getAnchorRect:_,expandOnMobile:k,animate:w=!0,onClickOutside:j,onFocusOutside:R,__unstableStickyBoundaryElement:C,__unstableSlotName:A="Popover",__unstableObserveElement:D,__unstableBoundaryParent:L,__unstableForcePosition:F,__unstableForceXAlignment:V,...B},U)=>{const H=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(),z=Object(u.useViewportMatch)("medium","<"),[q,X]=Object(o.useState)(),K=v(A),$=k&&z,[J,Q]=Object(u.useResizeObserver)();i=$||i,Object(o.useLayoutEffect)(()=>{if($)return I(Y.current,"is-without-arrow",i),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis"),M(Y.current,"data-y-axis"),N(Y.current,"top"),N(Y.current,"left"),N(G.current,"maxHeight"),void N(G.current,"maxWidth");const e=()=>{if(!Y.current||!G.current)return;let e=function(e,t,r,n=!1,o,a){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,a)}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,a);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,a);return o?e:P(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),s=t.getBoundingClientRect(),i=m(new window.DOMRect(r.left,r.top,r.width,s.bottom-r.top),e.ownerDocument,a);return o?i:P(i,n)}if(!e.current)return;const{parentNode:s}=e.current,i=s.getBoundingClientRect();return o?i:P(i,s)}(H,S,_,y,O,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 a;L&&(n=null===(a=Y.current.closest(".popover-slot"))||void 0===a?void 0:a.parentNode);const s=Q.height?Q:G.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:b,contentHeight:g,contentWidth:E}=function(e,t,r="top",n,o,a,s,i,c){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,a,s,i){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-s;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-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},d={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,m=r,h=null;if(!o&&!i)if("middle"===r&&u.contentHeight===c)m="middle";else if("top"===r&&d.contentHeight===c)m="top";else if("bottom"===r&&p.contentHeight===c)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;h=e!==c?e:null}return f="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:f,contentHeight:h}}(e,t,l,d,n,0,a,i);return{...function(e,t,r,n,o,a,s,i,c){const{width:l}=t;"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left"),"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.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"===a||c||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===a||c||(m=u);const h={popoverLeft:p,contentWidth:p-l>0?l:p},b={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let g,E=r,y=null;if(!o&&!i)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&h.contentWidth===l)E="left";else if("right"===r&&b.contentWidth===l)E="right";else{E=h.contentWidth>b.contentWidth?"left":"right";const e="left"===E?h.contentWidth:b.contentWidth;l>window.innerWidth&&(y=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===E?d.popoverLeft:"left"===E?h.popoverLeft:b.popoverLeft,s){const e=s.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:E,popoverLeft:g,contentWidth:y}}(e,t,u,d,n,p.yAxis,s,i,c),...p}}(e,s,h,C,Y.current,o,n,F,V);"number"==typeof l&&"number"==typeof u&&(N(Y.current,"top",l+"px"),N(Y.current,"left",u+"px")),I(Y.current,"is-without-arrow",i||"center"===p&&"middle"===b),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis",p),M(Y.current,"data-y-axis",b),N(G.current,"maxHeight","number"==typeof g?g+"px":""),N(G.current,"maxWidth","number"==typeof E?E+"px":""),X(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[b]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const a=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",a),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const s=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(y);let l;return s&&s!==t&&(s.defaultView.addEventListener("resize",e),s.defaultView.addEventListener("scroll",e,!0)),D&&(l=new r.MutationObserver(e),l.observe(D,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",a),r.cancelAnimationFrame(o),s&&s!==t&&(s.defaultView.removeEventListener("resize",e),s.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[$,S,_,y,O,h,Q,C,D,L]);const Z=(e,r)=>{if("focus-outside"===e&&R)R(r);else if("focus-outside"===e&&j){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),j(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),re=Object(u.useMergeRefs)([Y,ee,U]),ne=Boolean(w&&q)&&function(e){if("loading"===e.type)return s()("components-animate__loading");const{type:t,origin:r=x(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return s()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?s()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:s()("components-popover",a,ne,{"is-expanded":$,"is-without-arrow":i,"is-alternate":c})},B,{ref:re},te,{tabIndex:"-1"}),$&&Object(o.createElement)(E,null),$&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(W,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:G,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(T,{name:A},oe)),y||S?oe:Object(o.createElement)("span",{ref:H},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(A,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var L=D,F=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(i.isString)(e)&&(r=e),Object(i.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const V=Object(o.createElement)("div",{className:"event-catcher"}),B=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(V,e),Object(o.cloneElement)(t,{children:r}),","),e),U=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),H=(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 G=function({children:e,position:t,text:r,shortcut:n}){const[a,s]=Object(o.useState)(!1),[c,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",h),s(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",h),s(!1)},m=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,h=m("mouseUp"),b=(t,r)=>n=>{if(H(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&a)return;d.cancel();const o=Object(i.includes)(["focus","mouseenter"],n.type);o!==c&&(r?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",h)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:b("onMouseEnter",!0),onMouseLeave:b("onMouseLeave"),onClick:b("onClick"),onFocus:b("onFocus"),onBlur:b("onBlur"),onMouseDown:m("mouseDown")},y=o.Children.only(e),{children:v,disabled:O}=y.props;return(O?B:U)({child:y,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:a})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(L,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(F,{className:"components-tooltip__shortcut",shortcut:a}))))({grandchildren:v,isOver:c,position:t,text:r,shortcut:n})})},Y=r(41),z=r(42);const q=["onMouseDown","onClick"];var W=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:a,isSmall:c,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:m,icon:h,iconPosition:b="left",iconSize:g,showTooltip:E,tooltipPosition:y,shortcut:v,label:O,children:S,text:_,variant:k,__experimentalIsFocusable:w,describedBy:j,...R}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:a,...s}){let i=a;var c,u,d,p,f;return t&&(null!==(c=i)&&void 0!==c||(i="primary")),n&&(null!==(u=i)&&void 0!==u||(i="tertiary")),r&&(null!==(d=i)&&void 0!==d||(i="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=i)&&void 0!==p||(i="secondary")),o&&(null!==(f=i)&&void 0!==f||(i="link")),{...s,variant:i}}(e),C=s()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":c,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!h&&!!S,"has-icon":!!h}),T=m&&!w,A=void 0===r||T?"button":"a",x="a"===A?{href:r,target:a}:{type:"button",disabled:T,"aria-pressed":u};if(m&&w){x["aria-disabled"]=!0;for(const e of q)R[e]=e=>{e.stopPropagation(),e.preventDefault()}}const P=!T&&(E&&O||v||!!O&&(!S||Object(i.isArray)(S)&&!S.length)&&!1!==E),M=j?Object(i.uniqueId)():null,N=R["aria-describedby"]||M,I=Object(o.createElement)(A,Object(n.a)({},x,R,{className:C,"aria-label":R["aria-label"]||O,"aria-describedby":N,ref:t}),h&&"left"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),_&&Object(o.createElement)(o.Fragment,null,_),h&&"right"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),S);return P?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(G,{text:j||O,shortcut:v,position:y},I),j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j))):Object(o.createElement)(o.Fragment,null,I,j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j)))}))},function(e,t){e.exports=window.wp.dom},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,function(e,t,r){var n=r(80),o=r(55),a=o.setStyleProp,s=n.html,i=n.svg,c=n.isCustomAttribute,l=Object.prototype.hasOwnProperty;e.exports=function(e){var t,r,n,u;e=e||{};var d={};for(t in e)n=e[t],c(t)?d[t]=n:(r=t.toLowerCase(),l.call(s,r)?d[(u=s[r]).propertyName]=!!(u.hasBooleanValue||u.hasOverloadedBooleanValue&&!n)||n:l.call(i,t)?d[(u=i[t]).propertyName]=n:o.PRESERVE_CUSTOM_ATTRIBUTES&&(d[t]=n));return a(e.style,d),d}},function(e,t,r){var n=r(3),o=r(84).default,a={reactCompat:!0},s=n.version.split(".")[0]>=16;e.exports={PRESERVE_CUSTOM_ATTRIBUTES:s,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,o="function"==typeof t,a={},s={};for(r in e)n=e[r],o&&(a=t(r,n))&&2===a.length?s[a[0]]=a[1]:"string"==typeof n&&(s[n]=r);return s},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){null!=e&&(t.style=o(e,a))}}},function(e,t,r){for(var n,o=r(90).CASE_SENSITIVE_TAG_NAMES,a={},s=0,i=o.length;s<i;s++)n=o[s],a[n.toLowerCase()]=n;function c(e){for(var t,r={},n=0,o=e.length;n<o;n++)r[(t=e[n]).name]=t.value;return r}function l(e){return function(e){return a[e]}(e=e.toLowerCase())||e}e.exports={formatAttributes:c,formatDOM:function e(t,r,n){r=r||null;for(var o,a,s,i=[],u=0,d=t.length;u<d;u++){switch(o=t[u],s={next:null,prev:i[u-1]||null,parent:r},(a=i[u-1])&&(a.next=s),"#"!==o.nodeName[0]&&(s.name=l(o.nodeName),s.attribs={},o.attributes&&o.attributes.length&&(s.attribs=c(o.attributes))),o.nodeType){case 1:"script"===s.name||"style"===s.name?s.type=s.name:s.type="tag",s.children=e(o.childNodes,s);break;case 3:s.type="text",s.data=o.nodeValue;break;case 8:s.type="comment",s.data=o.nodeValue}i.push(s)}return n&&(i.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:i[0]?i[0]:null,prev:null,parent:r}),i[1]&&(i[1].prev=i[0])),i},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return s}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),a=()=>Object(n.useContext)(o),s=e=>{let{children:t}=e;const[r,a]=Object(n.useState)(!1),s={setIsSuppressed:a,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:s},t)}},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){var n=r(79),o=r(54),a=r(88),s={decodeEntities:!0,lowerCaseAttributeNames:!1};function i(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:n(a(e,(t=t||{}).htmlparser2||s),t)}i.domToReact=n,i.htmlToDOM=a,i.attributesToProps=o,e.exports=i,e.exports.default=i},,function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.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}},,function(e,t){var r,n,o=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function i(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!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:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=i(p);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!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 h(){}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||i(f)},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=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}},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(5),o=r(7),a=r(0),s=r(12),i=r.n(s),c=r(61),l=r(67);const u=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:s}=Object(o.useSelect)(e=>{const t=e(n.CART_STORE_KEY);return{shippingRates:t.getShippingRates(),needsShipping:t.getNeedsShipping(),hasCalculatedShipping:t.getHasCalculatedShipping(),isLoadingRates:t.isCustomerDataUpdating()}}),{isSelectingRate:u,selectShippingRate:d}=Object(l.a)(),p=Object(a.useRef)({});return Object(a.useEffect)(()=>{const t=(e=>Object.fromEntries(e.map(e=>{var t;let{package_id:r,shipping_rates:n}=e;return[r,null===(t=n.find(e=>e.selected))||void 0===t?void 0:t.rate_id]})))(e);Object(c.a)(t)&&!i()(p.current,t)&&(p.current=t)},[e]),{isSelectingRate:u,selectedRates:p.current,selectShippingRate:d,shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:s}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(7),o=r(5);const a=()=>{const{customerData:e,isInitialized:t}=Object(n.useSelect)(e=>{const t=e(o.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}}),{setShippingAddress:r,setBillingData:a}=Object(n.useDispatch)(o.CART_STORE_KEY);return{isInitialized:t,billingData:e.billingData,shippingAddress:e.shippingAddress,setBillingData:a,setShippingAddress:r}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return O}));var n=r(0);const o={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},a={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},s={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:()=>null,shippingErrorTypes:o,shippingRates:[],isLoadingRates:!1,selectedRates:[],setSelectedRates:()=>null,shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},setShippingAddress:()=>null,onShippingRateSuccess:()=>null,onShippingRateFail:()=>null,onShippingRateSelectSuccess:()=>null,onShippingRateSelectFail:()=>null,needsShipping:!1},i=(e,t)=>{let{type:r}=t;return Object.values(o).includes(r)?r:e};var c=r(91),l=r(197);const u=e=>({onSuccess:Object(l.a)("shipping_rates_success",e),onFail:Object(l.a)("shipping_rates_fail",e),onSelectSuccess:Object(l.a)("shipping_rate_select_success",e),onSelectFail:Object(l.a)("shipping_rate_select_fail",e)});var d=r(199),p=r(34),f=r(31),m=r(67),h=r(64);const{NONE:b,INVALID_ADDRESS:g,UNKNOWN:E}=o,y=Object(n.createContext)(s),v=()=>Object(n.useContext)(y),O=e=>{let{children:t}=e;const{dispatchActions:r}=Object(p.b)(),{shippingRates:s,isLoadingRates:l,cartErrors:v}=Object(f.a)(),{isSelectingRate:O}=Object(m.a)(),{selectedRates:S}=Object(h.a)(),[_,k]=Object(n.useReducer)(i,b),[w,j]=Object(n.useReducer)(c.b,{}),R=Object(n.useRef)(w),C=Object(n.useMemo)(()=>({onShippingRateSuccess:u(j).onSuccess,onShippingRateFail:u(j).onFail,onShippingRateSelectSuccess:u(j).onSelectSuccess,onShippingRateSelectFail:u(j).onSelectFail}),[j]);Object(n.useEffect)(()=>{R.current=w},[w]),Object(n.useEffect)(()=>{l?r.incrementCalculating():r.decrementCalculating()},[l,r]),Object(n.useEffect)(()=>{O?r.incrementCalculating():r.decrementCalculating()},[O,r]),Object(n.useEffect)(()=>{v.length>0&&v.some(e=>!(!e.code||!Object.values(a).includes(e.code)))?k({type:g}):k({type:b})},[v]);const T=Object(n.useMemo)(()=>({isPristine:_===b,isValid:_===b,hasInvalidAddress:_===g,hasError:_===E||_===g}),[_]);Object(n.useEffect)(()=>{l||0!==s.length&&!T.hasError||Object(d.a)(R.current,"shipping_rates_fail",{hasInvalidAddress:T.hasInvalidAddress,hasError:T.hasError})},[s,l,T.hasError,T.hasInvalidAddress]),Object(n.useEffect)(()=>{!l&&s.length>0&&!T.hasError&&Object(d.a)(R.current,"shipping_rates_success",s)},[s,l,T.hasError]),Object(n.useEffect)(()=>{O||(T.hasError?Object(d.a)(R.current,"shipping_rate_select_fail",{hasError:T.hasError,hasInvalidAddress:T.hasInvalidAddress}):Object(d.a)(R.current,"shipping_rate_select_success",S.current))},[S,O,T.hasError,T.hasInvalidAddress]);const A={shippingErrorStatus:T,dispatchErrorStatus:k,shippingErrorTypes:o,...C};return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(y.Provider,{value:A},t))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(7),o=r(0),a=r(5),s=r(72),i=r(40);const c=()=>{const e=Object(s.a)(),{dispatchCheckoutEvent:t}=Object(i.a)(),{selectShippingRate:r}=Object(n.useDispatch)(a.CART_STORE_KEY);return{selectShippingRate:Object(o.useCallback)((n,o)=>{r(n,o).then(()=>{t("set-selected-shipping-rate",{shippingRateId:n})}).catch(t=>{e(t)})},[r,t,e]),isSelectingRate:Object(n.useSelect)(e=>e(a.CART_STORE_KEY).isShippingRateBeingSelected(),[])}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return c}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:a,detail:s={}}=t;if(!n)return;a||(a=document.body);const i=new n(e,{bubbles:r,cancelable:o,detail:s});a.dispatchEvent(i)};let a;const s=()=>{a&&clearTimeout(a),a=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},i=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},c=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 a=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,a),()=>jQuery(document).off(e,a)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"number"==typeof e},,,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(11),o=r.n(n),a=r(0);r(107);const s=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(a.useRef)(null);return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(a.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];s(e),null==e||e.focus()}else s(e)})(e,r):s(e))})(r.current,e)}})))}},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return a}));var n=r(7);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;const r=Object(n.select)("core/notices").getNotices(e);return r.some(e=>e.type===t)},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=Object(n.select)("core/notices").getNotices(),{removeNotice:o}=Object(n.dispatch)("core/notices"),a=r.filter(t=>t.status===e);a.forEach(e=>o(e.id,t))}},function(e,t){},function(e,t,r){var n=r(3),o=r(54),a=r(55),s=a.setStyleProp;function i(e){return a.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&a.isCustomComponent(e.name,e.attribs)}e.exports=function e(t,r){for(var a,c,l,u,d=(r=r||{}).library||n,p=d.cloneElement,f=d.createElement,m=d.isValidElement,h=[],b="function"==typeof r.replace,g=r.trim,E=0,y=t.length;E<y;E++)if(a=t[E],b&&m(c=r.replace(a)))y>1&&(c=p(c,{key:c.key||E})),h.push(c);else if("text"!==a.type){switch(l=a.attribs,i(a)?s(l.style,l):l&&(l=o(l)),u=null,a.type){case"script":case"style":a.children[0]&&(l.dangerouslySetInnerHTML={__html:a.children[0].data});break;case"tag":"textarea"===a.name&&a.children[0]?l.defaultValue=a.children[0].data:a.children&&a.children.length&&(u=e(a.children,r));break;default:continue}y>1&&(l.key=E),h.push(f(a.name,l,u))}else g?a.data.trim()&&h.push(a.data):h.push(a.data);return 1===h.length?h[0]:h}},function(e,t,r){var n=r(81),o=r(82),a=r(83),s=a.MUST_USE_PROPERTY,i=a.HAS_BOOLEAN_VALUE,c=a.HAS_NUMERIC_VALUE,l=a.HAS_POSITIVE_NUMERIC_VALUE,u=a.HAS_OVERLOADED_BOOLEAN_VALUE;function d(e,t){return(e&t)===t}function p(e,t,r){var n,o,a,p=e.Properties,f=e.DOMAttributeNames;for(o in p)n=f[o]||(r?o:o.toLowerCase()),a=p[o],t[n]={attributeName:n,propertyName:o,mustUseProperty:d(a,s),hasBooleanValue:d(a,i),hasNumericValue:d(a,c),hasPositiveNumericValue:d(a,l),hasOverloadedBooleanValue:d(a,u)}}var f={};p(n,f);var m={};p(o,m,!0);var h={};p(n,h),p(o,h,!0),e.exports={html:f,svg:m,properties:h,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))}},function(e,t){e.exports={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}}},function(e,t){e.exports={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}}},function(e,t){e.exports={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=n(r(85)),a=r(87);t.default=function(e,t){var r={};return e&&"string"==typeof e?(o.default(e,(function(e,n){e&&n&&(r[a.camelCase(e,t)]=n)})),r):r}},function(e,t,r){var n=r(86);e.exports=function(e,t){var r,o=null;if(!e||"string"!=typeof e)return o;for(var a,s,i=n(e),c="function"==typeof t,l=0,u=i.length;l<u;l++)a=(r=i[l]).property,s=r.value,c?t(a,s,r):s&&(o||(o={}),o[a]=s);return o}},function(e,t){var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e){return e?e.replace(l,""):""}e.exports=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var l=1,d=1;function p(e){var t=e.match(n);t&&(l+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function f(){var e={line:l,column:d};return function(t){return t.position=new m(e),E(),t}}function m(e){this.start=e,this.end={line:l,column:d},this.source=t.source}m.prototype.content=e;var h=[];function b(r){var n=new Error(t.source+":"+l+":"+d+": "+r);if(n.reason=r,n.filename=t.source,n.line=l,n.column=d,n.source=e,!t.silent)throw n;h.push(n)}function g(t){var r=t.exec(e);if(r){var n=r[0];return p(n),e=e.slice(n.length),r}}function E(){g(o)}function y(e){var t;for(e=e||[];t=v();)!1!==t&&e.push(t);return e}function v(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return b("End of comment missing");var n=e.slice(2,r-2);return d+=2,p(n),e=e.slice(r),d+=2,t({type:"comment",comment:n})}}function O(){var e=f(),t=g(a);if(t){if(v(),!g(s))return b("property missing ':'");var n=g(i),o=e({type:"declaration",property:u(t[0].replace(r,"")),value:n?u(n[0].replace(r,"")):""});return g(c),o}}return E(),function(){var e,t=[];for(y(t);e=O();)!1!==e&&(t.push(e),y(t));return t}()}},function(e,t,r){"use strict";t.__esModule=!0,t.camelCase=void 0;var n=/^--[a-zA-Z0-9-]+$/,o=/-([a-z])/g,a=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,i=function(e,t){return t.toUpperCase()},c=function(e,t){return t+"-"};t.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||a.test(e)||n.test(e)}(e)?e:(e=e.toLowerCase(),t.reactCompat||(e=e.replace(s,c)),e.replace(o,i))}},function(e,t,r){var n=r(89),o=r(56),a=o.formatDOM,s=o.isIE(9),i=/<(![a-zA-Z\s]+)>/;e.exports=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(i);return r&&r[1]&&(t=r[1],s&&(e=e.replace(r[0],""))),a(n(e),null,t)}},function(e,t,r){var n=r(56),o=/<([a-zA-Z]+[0-9]?)/,a=/<head.*>/i,s=/<body.*>/i,i=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,c=n.isIE(9),l=c||n.isIE(),u=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},d=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var p=new window.DOMParser,f=c?"text/xml":"text/html";u=d=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),c&&(e=e.replace(i,"<$1$2$3/>")),p.parseFromString(e,f)}}if(document.implementation){var m=document.implementation.createHTMLDocument(l?"html-dom-parser":void 0);u=function(e,t){if(t)return m.documentElement.getElementsByTagName(t)[0].innerHTML=e,m;try{return m.documentElement.innerHTML=e,m}catch(t){if(d)return d(e)}}}var h,b=document.createElement("template");b.content&&(h=function(e){return b.innerHTML=e,b.content.childNodes}),e.exports=function(e){var t,r,n,i,c=e.match(o);switch(c&&c[1]&&(t=c[1].toLowerCase()),t){case"html":return r=d(e),a.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),s.test(e)||(n=r.getElementsByTagName("body")[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");case"head":case"body":return i=u(e).getElementsByTagName(t),s.test(e)&&a.test(e)?i[0].parentNode.childNodes:i;default:return h?h(e):u(e,"body").getElementsByTagName("body")[0].childNodes}}},function(e,t){e.exports={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return i}));var n=r(6);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const a={addEventCallback:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(n.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},s={},i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s,{type:t,eventType:r,id:n,callback:a,priority:i}=arguments.length>1?arguments[1]:void 0;const c=e.hasOwnProperty(r)?new Map(e[r]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return c.set(n,{priority:i,callback:a}),{...e,[r]:c};case o.REMOVE_EVENT_CALLBACK:return c.delete(n),{...e,[r]:c}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s}));var n=r(1),o=r(18);const a=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"}},s=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&&e.message?Object(o.decodeEntities)(e.message):Object(n.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t,r){"use strict";var n=r(0),o=r(15);const a=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=a},function(e,t,r){"use strict";var n=r(0),o=r(6),a=r(4),s=r.n(a),i=r(1),c=r(20),l=r(93),u=r(50);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:a=r,onRemove:p=o.noop,isDismissible:f=!0,actions:m=[],politeness:h=d(t),__unstableHTML:b,onDismiss:g=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(c.speak)(r,t)},[r,t])}(a,h);const E=s()(e,"components-notice","is-"+t,{"is-dismissible":f});return b&&(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:a=!1,onClick:i,url:c},l)=>{let d=o;return"primary"===o||a||(d=c?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:c,variant:d,onClick:c?void 0:i,className:s()("components-notice__action",e)},t)}))),f&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(i.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(11)),a=n(r(128)),s=r(3),i=n(s),c=n(r(129)),l=n(r(131)),u={arr:Array.isArray,obj:function(e){return"[object Object]"===Object.prototype.toString.call(e)},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},und:function(e){return void 0===e},nul:function(e){return null===e},set:function(e){return e instanceof Set},map:function(e){return e instanceof Map},equ:function(e,t){if(typeof e!=typeof t)return!1;if(u.str(e)||u.num(e))return e===t;if(u.obj(e)&&u.obj(t)&&Object.keys(e).length+Object.keys(t).length===0)return!0;var r;for(r in e)if(!(r in t))return!1;for(r in t)if(e[r]!==t[r])return!1;return!u.und(r)||e===t}};function d(){var e=s.useState(!1)[1];return s.useCallback((function(){return e((function(e){return!e}))}),[])}function p(e,t){return u.und(e)||u.nul(e)?t:e}function f(e){return u.und(e)?[]:u.arr(e)?e:[e]}function m(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return u.fun(e)?e.apply(void 0,r):e}function h(e){var t=function(e){return e.to,e.from,e.config,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.delay,e.attach,e.destroyed,e.interpolateTo,e.ref,e.lazy,a(e,["to","from","config","onStart","onRest","onFrame","children","reset","reverse","force","immediate","delay","attach","destroyed","interpolateTo","ref","lazy"])}(e);if(u.und(t))return o({to:t},e);var r=Object.keys(e).reduce((function(r,n){var a;return u.und(t[n])?o({},r,((a={})[n]=e[n],a)):r}),{});return o({to:t},r)}var b,g,E=function(){function e(){this.payload=void 0,this.children=[]}var t=e.prototype;return t.getAnimatedValue=function(){return this.getValue()},t.getPayload=function(){return this.payload||this},t.attach=function(){},t.detach=function(){},t.getChildren=function(){return this.children},t.addChild=function(e){0===this.children.length&&this.attach(),this.children.push(e)},t.removeChild=function(e){var t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()},e}(),y=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).payload=[],t.attach=function(){return t.payload.forEach((function(e){return e instanceof E&&e.addChild(l(t))}))},t.detach=function(){return t.payload.forEach((function(e){return e instanceof E&&e.removeChild(l(t))}))},t}return c(t,e),t}(E),v=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).payload={},t.attach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof E&&e.addChild(l(t))}))},t.detach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof E&&e.removeChild(l(t))}))},t}c(t,e);var r=t.prototype;return r.getValue=function(e){void 0===e&&(e=!1);var t={};for(var r in this.payload){var n=this.payload[r];(!e||n instanceof E)&&(t[r]=n instanceof E?n[e?"getAnimatedValue":"getValue"]():n)}return t},r.getAnimatedValue=function(){return this.getValue(!0)},t}(E);function O(e,t){b={fn:e,transform:t}}function S(e){g=e}var _,k=function(e){return"undefined"!=typeof window?window.requestAnimationFrame(e):-1},w=function(e){"undefined"!=typeof window&&window.cancelAnimationFrame(e)};function j(e){_=e}var R,C=function(){return Date.now()};function T(e){R=e}var A,x,P=function(e){return e.current};function M(e){A=e}var N=Object.freeze({get applyAnimatedValues(){return b},injectApplyAnimatedValues:O,get colorNames(){return g},injectColorNames:S,get requestFrame(){return k},get cancelFrame(){return w},injectFrame:function(e,t){k=e,w=t},get interpolation(){return _},injectStringInterpolator:j,get now(){return C},injectNow:function(e){C=e},get defaultElement(){return R},injectDefaultElement:T,get animatedApi(){return P},injectAnimatedApi:function(e){P=e},get createAnimatedStyle(){return A},injectCreateAnimatedStyle:M,get manualFrameloop(){return x},injectManualFrameloop:function(e){x=e}}),I=function(e){function t(t,r){var n;return(n=e.call(this)||this).update=void 0,n.payload=t.style?o({},t,{style:A(t.style)}):t,n.update=r,n.attach(),n}return c(t,e),t}(v),D=!1,L=new Set,F=function e(){if(!D)return!1;var t=C(),r=L,n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var a;if(n){if(o>=r.length)break;a=r[o++]}else{if((o=r.next()).done)break;a=o.value}for(var s=a,i=!1,c=0;c<s.configs.length;c++){for(var l=s.configs[c],u=void 0,d=void 0,p=0;p<l.animatedValues.length;p++){var f=l.animatedValues[p];if(!f.done){var m=l.fromValues[p],h=l.toValues[p],b=f.lastPosition,g=h instanceof E,y=Array.isArray(l.initialVelocity)?l.initialVelocity[p]:l.initialVelocity;if(g&&(h=h.getValue()),l.immediate)f.setValue(h),f.done=!0;else if("string"!=typeof m&&"string"!=typeof h){if(void 0!==l.duration)b=m+l.easing((t-f.startTime)/l.duration)*(h-m),u=t>=f.startTime+l.duration;else if(l.decay)b=m+y/(1-.998)*(1-Math.exp(-(1-.998)*(t-f.startTime))),(u=Math.abs(f.lastPosition-b)<.1)&&(h=b);else{d=void 0!==f.lastTime?f.lastTime:t,y=void 0!==f.lastVelocity?f.lastVelocity:l.initialVelocity,t>d+64&&(d=t);for(var v=Math.floor(t-d),O=0;O<v;++O)b+=1*(y+=(-l.tension*(b-h)+-l.friction*y)/l.mass*1/1e3)/1e3;var S=!(!l.clamp||0===l.tension)&&(m<h?b>h:b<h),_=Math.abs(y)<=l.precision,w=0===l.tension||Math.abs(h-b)<=l.precision;u=S||_&&w,f.lastVelocity=y,f.lastTime=t}g&&!l.toValues[p].done&&(u=!1),u?(f.value!==h&&(b=h),f.done=!0):i=!0,f.setValue(b),f.lastPosition=b}else f.setValue(h),f.done=!0}}s.props.onFrame&&(s.values[l.name]=l.interpolation.getValue())}s.props.onFrame&&s.props.onFrame(s.values),i||(L.delete(s),s.stop(!0))}return L.size?x?x():k(e):D=!1,D};function V(e,t,r){if("function"==typeof e)return e;if(Array.isArray(e))return V({range:e,output:t,extrapolate:r});if(_&&"string"==typeof e.output[0])return _(e);var n=e,o=n.output,a=n.range||[0,1],s=n.extrapolateLeft||n.extrapolate||"extend",i=n.extrapolateRight||n.extrapolate||"extend",c=n.easing||function(e){return e};return function(e){var t=function(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}(e,a);return function(e,t,r,n,o,a,s,i,c){var l=c?c(e):e;if(l<t){if("identity"===s)return l;"clamp"===s&&(l=t)}if(l>r){if("identity"===i)return l;"clamp"===i&&(l=r)}return n===o?n:t===r?e<=t?n:o:(t===-1/0?l=-l:r===1/0?l-=t:l=(l-t)/(r-t),l=a(l),n===-1/0?l=-l:o===1/0?l+=n:l=l*(o-n)+n,l)}(e,a[t],a[t+1],o[t],o[t+1],c,s,i,n.map)}}var B=function(e){function t(r,n,o,a){var s;return(s=e.call(this)||this).calc=void 0,s.payload=r instanceof y&&!(r instanceof t)?r.getPayload():Array.isArray(r)?r:[r],s.calc=V(n,o,a),s}c(t,e);var r=t.prototype;return r.getValue=function(){return this.calc.apply(this,this.payload.map((function(e){return e.getValue()})))},r.updateConfig=function(e,t,r){this.calc=V(e,t,r)},r.interpolate=function(e,r,n){return new t(this,e,r,n)},t}(y),U=function(e){function t(t){var r;return(r=e.call(this)||this).animatedStyles=new Set,r.value=void 0,r.startPosition=void 0,r.lastPosition=void 0,r.lastVelocity=void 0,r.startTime=void 0,r.lastTime=void 0,r.done=!1,r.setValue=function(e,t){void 0===t&&(t=!0),r.value=e,t&&r.flush()},r.value=t,r.startPosition=t,r.lastPosition=t,r}c(t,e);var r=t.prototype;return r.flush=function(){0===this.animatedStyles.size&&function e(t,r){"update"in t?r.add(t):t.getChildren().forEach((function(t){return e(t,r)}))}(this,this.animatedStyles),this.animatedStyles.forEach((function(e){return e.update()}))},r.clearStyles=function(){this.animatedStyles.clear()},r.getValue=function(){return this.value},r.interpolate=function(e,t,r){return new B(this,e,t,r)},t}(E),H=function(e){function t(t){var r;return(r=e.call(this)||this).payload=t.map((function(e){return new U(e)})),r}c(t,e);var r=t.prototype;return r.setValue=function(e,t){var r=this;void 0===t&&(t=!0),Array.isArray(e)?e.length===this.payload.length&&e.forEach((function(e,n){return r.payload[n].setValue(e,t)})):this.payload.forEach((function(r){return r.setValue(e,t)}))},r.getValue=function(){return this.payload.map((function(e){return e.getValue()}))},r.interpolate=function(e,t){return new B(this,e,t)},t}(y),G=0,Y=function(){function e(){var e=this;this.id=void 0,this.idle=!0,this.hasChanged=!1,this.guid=0,this.local=0,this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.listeners=[],this.queue=[],this.localQueue=void 0,this.getValues=function(){return e.interpolations},this.id=G++}var t=e.prototype;return t.update=function(e){if(!e)return this;var t=h(e),r=t.delay,n=void 0===r?0:r,s=t.to,i=a(t,["delay","to"]);if(u.arr(s)||u.fun(s))this.queue.push(o({},i,{delay:n,to:s}));else if(s){var c={};Object.entries(s).forEach((function(e){var t,r=e[0],a=e[1],s=o({to:(t={},t[r]=a,t),delay:m(n,r)},i),l=c[s.delay]&&c[s.delay].to;c[s.delay]=o({},c[s.delay],s,{to:o({},l,s.to)})})),this.queue=Object.values(c)}return this.queue=this.queue.sort((function(e,t){return e.delay-t.delay})),this.diff(i),this},t.start=function(e){var t=this;if(this.queue.length){this.idle=!1,this.localQueue&&this.localQueue.forEach((function(e){var r=e.from,n=void 0===r?{}:r,a=e.to,s=void 0===a?{}:a;u.obj(n)&&(t.merged=o({},n,t.merged)),u.obj(s)&&(t.merged=o({},t.merged,s))}));var r=this.local=++this.guid,n=this.localQueue=this.queue;this.queue=[],n.forEach((function(o,s){var i=o.delay,c=a(o,["delay"]),l=function(o){s===n.length-1&&r===t.guid&&o&&(t.idle=!0,t.props.onRest&&t.props.onRest(t.merged)),e&&e()},d=u.arr(c.to)||u.fun(c.to);i?setTimeout((function(){r===t.guid&&(d?t.runAsync(c,l):t.diff(c).start(l))}),i):d?t.runAsync(c,l):t.diff(c).start(l)}))}else u.fun(e)&&this.listeners.push(e),this.props.onStart&&this.props.onStart(),this,L.has(this)||L.add(this),D||(D=!0,k(x||F));return this},t.stop=function(e){return this.listeners.forEach((function(t){return t(e)})),this.listeners=[],this},t.pause=function(e){return this.stop(!0),e&&(this,L.has(this)&&L.delete(this)),this},t.runAsync=function(e,t){var r=this,n=(e.delay,a(e,["delay"])),s=this.local,i=Promise.resolve(void 0);if(u.arr(n.to))for(var c=function(e){var t=e,a=o({},n,h(n.to[t]));u.arr(a.config)&&(a.config=a.config[t]),i=i.then((function(){if(s===r.guid)return new Promise((function(e){return r.diff(a).start(e)}))}))},l=0;l<n.to.length;l++)c(l);else if(u.fun(n.to)){var d,p=0;i=i.then((function(){return n.to((function(e){var t=o({},n,h(e));if(u.arr(t.config)&&(t.config=t.config[p]),p++,s===r.guid)return d=new Promise((function(e){return r.diff(t).start(e)}))}),(function(e){return void 0===e&&(e=!0),r.stop(e)})).then((function(){return d}))}))}i.then(t)},t.diff=function(e){var t=this;this.props=o({},this.props,e);var r=this.props,n=r.from,a=void 0===n?{}:n,s=r.to,i=void 0===s?{}:s,c=r.config,l=void 0===c?{}:c,d=r.reverse,h=r.attach,b=r.reset,E=r.immediate;if(d){var y=[i,a];a=y[0],i=y[1]}this.merged=o({},a,this.merged,i),this.hasChanged=!1;var v=h&&h(this);if(this.animations=Object.entries(this.merged).reduce((function(e,r){var n=r[0],s=r[1],i=e[n]||{},c=u.num(s),d=u.str(s)&&!s.startsWith("#")&&!/\d/.test(s)&&!g[s],h=u.arr(s),y=!c&&!h&&!d,O=u.und(a[n])?s:a[n],S=c||h||d?s:1,k=m(l,n);v&&(S=v.animations[n].parent);var w,j=i.parent,R=i.interpolation,T=f(v?S.getPayload():S),A=s;y&&(A=_({range:[0,1],output:[s,s]})(1));var x,P=R&&R.getValue(),M=!u.und(j)&&i.animatedValues.some((function(e){return!e.done})),N=!u.equ(A,P),I=!u.equ(A,i.previous),D=!u.equ(k,i.config);if(b||I&&N||D){var L;if(c||d)j=R=i.parent||new U(O);else if(h)j=R=i.parent||new H(O);else if(y){var F=i.interpolation&&i.interpolation.calc(i.parent.value);F=void 0===F||b?O:F,i.parent?(j=i.parent).setValue(0,!1):j=new U(0);var V={output:[F,s]};i.interpolation?(R=i.interpolation,i.interpolation.updateConfig(V)):R=j.interpolate(V)}return T=f(v?S.getPayload():S),w=f(j.getPayload()),b&&!y&&j.setValue(O,!1),t.hasChanged=!0,w.forEach((function(e){e.startPosition=e.value,e.lastPosition=e.value,e.lastVelocity=M?e.lastVelocity:void 0,e.lastTime=M?e.lastTime:void 0,e.startTime=C(),e.done=!1,e.animatedStyles.clear()})),m(E,n)&&j.setValue(y?S:s,!1),o({},e,((L={})[n]=o({},i,{name:n,parent:j,interpolation:R,animatedValues:w,toValues:T,previous:A,config:k,fromValues:f(j.getValue()),immediate:m(E,n),initialVelocity:p(k.velocity,0),clamp:p(k.clamp,!1),precision:p(k.precision,.01),tension:p(k.tension,170),friction:p(k.friction,26),mass:p(k.mass,1),duration:k.duration,easing:p(k.easing,(function(e){return e})),decay:k.decay}),L))}return N?e:(y&&(j.setValue(1,!1),R.updateConfig({output:[A,A]})),j.done=!0,t.hasChanged=!0,o({},e,((x={})[n]=o({},e[n],{previous:A}),x)))}),this.animations),this.hasChanged)for(var O in this.configs=Object.values(this.animations),this.values={},this.interpolations={},this.animations)this.interpolations[O]=this.animations[O].interpolation,this.values[O]=this.animations[O].interpolation.getValue();return this},t.destroy=function(){this.stop(),this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.local=0},e}(),z=function(e,t){var r=s.useRef(!1),n=s.useRef(),o=u.fun(t),a=s.useMemo((function(){var r;return n.current&&(n.current.map((function(e){return e.destroy()})),n.current=void 0),[new Array(e).fill().map((function(e,n){var a=new Y,s=o?m(t,n,a):t[n];return 0===n&&(r=s.ref),a.update(s),r||a.start(),a})),r]}),[e]),i=a[0],c=a[1];n.current=i,s.useImperativeHandle(c,(function(){return{start:function(){return Promise.all(n.current.map((function(e){return new Promise((function(t){return e.start(t)}))})))},stop:function(e){return n.current.forEach((function(t){return t.stop(e)}))},get controllers(){return n.current}}}));var l=s.useMemo((function(){return function(e){return n.current.map((function(t,r){t.update(o?m(e,r,t):e[r]),c||t.start()}))}}),[e]);s.useEffect((function(){r.current?o||l(t):c||n.current.forEach((function(e){return e.start()}))})),s.useEffect((function(){return r.current=!0,function(){return n.current.forEach((function(e){return e.destroy()}))}}),[]);var d=n.current.map((function(e){return e.getValues()}));return o?[d,l,function(e){return n.current.forEach((function(t){return t.pause(e)}))}]:d},q=0,W=function(e,t){return("function"==typeof t?e.map(t):f(t)).map(String)},X=function(e){var t=e.items,r=e.keys,n=void 0===r?function(e){return e}:r,s=a(e,["items","keys"]);return t=f(void 0!==t?t:null),o({items:t,keys:W(t,n)},s)};function K(e,t){var r=function(){if(o){if(a>=n.length)return"break";s=n[a++]}else{if((a=n.next()).done)return"break";s=a.value}var r=s.key,i=function(e){return e.key!==r};(u.und(t)||t===r)&&(e.current.instances.delete(r),e.current.transitions=e.current.transitions.filter(i),e.current.deleted=e.current.deleted.filter(i))},n=e.current.deleted,o=Array.isArray(n),a=0;for(n=o?n:n[Symbol.iterator]();;){var s;if("break"===r())break}e.current.forceUpdate()}var $=function(e){function t(t){var r;return void 0===t&&(t={}),r=e.call(this)||this,!t.transform||t.transform instanceof E||(t=b.transform(t)),r.payload=t,r}return c(t,e),t}(v),J={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Q="[-+]?\\d*\\.?\\d+";function Z(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var ee=new RegExp("rgb"+Z(Q,Q,Q)),te=new RegExp("rgba"+Z(Q,Q,Q,Q)),re=new RegExp("hsl"+Z(Q,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),ne=new RegExp("hsla"+Z(Q,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",Q)),oe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ae=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,se=/^#([0-9a-fA-F]{6})$/,ie=/^#([0-9a-fA-F]{8})$/;function ce(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function le(e,t,r){var n=r<.5?r*(1+t):r+t-r*t,o=2*r-n,a=ce(o,n,e+1/3),s=ce(o,n,e),i=ce(o,n,e-1/3);return Math.round(255*a)<<24|Math.round(255*s)<<16|Math.round(255*i)<<8}function ue(e){var t=parseInt(e,10);return t<0?0:t>255?255:t}function de(e){return(parseFloat(e)%360+360)%360/360}function pe(e){var t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function fe(e){var t=parseFloat(e);return t<0?0:t>100?1:t/100}function me(e){var t,r,n="number"==typeof(t=e)?t>>>0===t&&t>=0&&t<=4294967295?t:null:(r=se.exec(t))?parseInt(r[1]+"ff",16)>>>0:J.hasOwnProperty(t)?J[t]:(r=ee.exec(t))?(ue(r[1])<<24|ue(r[2])<<16|ue(r[3])<<8|255)>>>0:(r=te.exec(t))?(ue(r[1])<<24|ue(r[2])<<16|ue(r[3])<<8|pe(r[4]))>>>0:(r=oe.exec(t))?parseInt(r[1]+r[1]+r[2]+r[2]+r[3]+r[3]+"ff",16)>>>0:(r=ie.exec(t))?parseInt(r[1],16)>>>0:(r=ae.exec(t))?parseInt(r[1]+r[1]+r[2]+r[2]+r[3]+r[3]+r[4]+r[4],16)>>>0:(r=re.exec(t))?(255|le(de(r[1]),fe(r[2]),fe(r[3])))>>>0:(r=ne.exec(t))?(le(de(r[1]),fe(r[2]),fe(r[3]))|pe(r[4]))>>>0:null;return null===n?e:"rgba("+((4278190080&(n=n||0))>>>24)+", "+((16711680&n)>>>16)+", "+((65280&n)>>>8)+", "+(255&n)/255+")"}var he=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,be=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ge=new RegExp("("+Object.keys(J).join("|")+")","g"),Ee={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","Ms","Moz","O"];function ve(e,t,r){return null==t||"boolean"==typeof t||""===t?"":r||"number"!=typeof t||0===t||Ee.hasOwnProperty(e)&&Ee[e]?(""+t).trim():t+"px"}Ee=Object.keys(Ee).reduce((function(e,t){return ye.forEach((function(r){return e[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(r,t)]=e[t]})),e}),Ee);var Oe={};M((function(e){return new $(e)})),T("div"),j((function(e){var t=e.output.map((function(e){return e.replace(be,me)})).map((function(e){return e.replace(ge,me)})),r=t[0].match(he).map((function(){return[]}));t.forEach((function(e){e.match(he).forEach((function(e,t){return r[t].push(+e)}))}));var n=t[0].match(he).map((function(t,n){return V(o({},e,{output:r[n]}))}));return function(e){var r=0;return t[0].replace(he,(function(){return n[r++](e)})).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(function(e,t,r,n,o){return"rgba("+Math.round(t)+", "+Math.round(r)+", "+Math.round(n)+", "+o+")"}))}})),S(J),O((function(e,t){if(!e.nodeType||void 0===e.setAttribute)return!1;var r=t.style,n=t.children,o=t.scrollTop,s=t.scrollLeft,i=a(t,["style","children","scrollTop","scrollLeft"]),c="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName;for(var l in void 0!==o&&(e.scrollTop=o),void 0!==s&&(e.scrollLeft=s),void 0!==n&&(e.textContent=n),r)if(r.hasOwnProperty(l)){var u=0===l.indexOf("--"),d=ve(l,r[l],u);"float"===l&&(l="cssFloat"),u?e.style.setProperty(l,d):e.style[l]=d}for(var p in i){var f=c?p:Oe[p]||(Oe[p]=p.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})));void 0!==e.getAttribute(f)&&e.setAttribute(f,i[p])}}),(function(e){return e}));var Se,_e,ke=(Se=function(e){return s.forwardRef((function(t,r){var n=d(),c=s.useRef(!0),l=s.useRef(null),p=s.useRef(null),f=s.useCallback((function(e){var t=l.current;l.current=new I(e,(function(){var e=!1;p.current&&(e=b.fn(p.current,l.current.getAnimatedValue())),p.current&&!1!==e||n()})),t&&t.detach()}),[]);s.useEffect((function(){return function(){c.current=!1,l.current&&l.current.detach()}}),[]),s.useImperativeHandle(r,(function(){return P(p,c,n)})),f(t);var m,h=l.current.getValue(),g=(h.scrollTop,h.scrollLeft,a(h,["scrollTop","scrollLeft"])),E=(m=e,!u.fun(m)||m.prototype instanceof i.Component?function(e){return p.current=function(e,t){return t&&(u.fun(t)?t(e):u.obj(t)&&(t.current=e)),e}(e,r)}:void 0);return i.createElement(e,o({},g,{ref:E}))}))},void 0===(_e=!1)&&(_e=!0),function(e){return(u.arr(e)?e:Object.keys(e)).reduce((function(e,t){var r=_e?t[0].toLowerCase()+t.substring(1):t;return e[r]=Se(r),e}),Se)}),we=ke(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]);t.apply=ke,t.config={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},t.update=F,t.animated=we,t.a=we,t.interpolate=function(e,t,r){return e&&new B(e,t,r)},t.Globals=N,t.useSpring=function(e){var t=u.fun(e),r=z(1,t?e:[e]),n=r[0],o=r[1],a=r[2];return t?[n[0],o,a]:n},t.useTrail=function(e,t){var r=s.useRef(!1),n=u.fun(t),a=m(t),i=s.useRef(),c=z(e,(function(e,t){return 0===e&&(i.current=[]),i.current.push(t),o({},a,{config:m(a.config,e),attach:e>0&&function(){return i.current[e-1]}})})),l=c[0],d=c[1],p=c[2],f=s.useMemo((function(){return function(e){return d((function(t,r){e.reverse;var n=e.reverse?t+1:t-1,s=i.current[n];return o({},e,{config:m(e.config||a.config,t),attach:s&&function(){return s}})}))}}),[e,a.reverse]);return s.useEffect((function(){r.current&&!n&&f(t)})),s.useEffect((function(){r.current=!0}),[]),n?[l,f,p]:l},t.useTransition=function(e,t,r){var n=o({items:e,keys:t||function(e){return e}},r),i=X(n),c=i.lazy,l=void 0!==c&&c,u=(i.unique,i.reset),p=void 0!==u&&u,f=(i.enter,i.leave,i.update,i.onDestroyed),h=(i.keys,i.items,i.onFrame),b=i.onRest,g=i.onStart,E=i.ref,y=a(i,["lazy","unique","reset","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","ref"]),v=d(),O=s.useRef(!1),S=s.useRef({mounted:!1,first:!0,deleted:[],current:{},transitions:[],prevProps:{},paused:!!n.ref,instances:!O.current&&new Map,forceUpdate:v});return s.useImperativeHandle(n.ref,(function(){return{start:function(){return Promise.all(Array.from(S.current.instances).map((function(e){var t=e[1];return new Promise((function(e){return t.start(e)}))})))},stop:function(e){return Array.from(S.current.instances).forEach((function(t){return t[1].stop(e)}))},get controllers(){return Array.from(S.current.instances).map((function(e){return e[1]}))}}})),S.current=function(e,t){for(var r=e.first,n=e.prevProps,s=a(e,["first","prevProps"]),i=X(t),c=i.items,l=i.keys,u=i.initial,d=i.from,p=i.enter,f=i.leave,h=i.update,b=i.trail,g=void 0===b?0:b,E=i.unique,y=i.config,v=i.order,O=void 0===v?["enter","leave","update"]:v,S=X(n),_=S.keys,k=S.items,w=o({},s.current),j=[].concat(s.deleted),R=Object.keys(w),C=new Set(R),T=new Set(l),A=l.filter((function(e){return!C.has(e)})),x=s.transitions.filter((function(e){return!e.destroyed&&!T.has(e.originalKey)})).map((function(e){return e.originalKey})),P=l.filter((function(e){return C.has(e)})),M=-g;O.length;)switch(O.shift()){case"enter":A.forEach((function(e,t){E&&j.find((function(t){return t.originalKey===e}))&&(j=j.filter((function(t){return t.originalKey!==e})));var n=l.indexOf(e),o=c[n],a=r&&void 0!==u?"initial":"enter";w[e]={slot:a,originalKey:e,key:E?String(e):q++,item:o,trail:M+=g,config:m(y,o,a),from:m(r&&void 0!==u?u||{}:d,o),to:m(p,o)}}));break;case"leave":x.forEach((function(e){var t=_.indexOf(e),r=k[t];j.unshift(o({},w[e],{slot:"leave",destroyed:!0,left:_[Math.max(0,t-1)],right:_[Math.min(_.length,t+1)],trail:M+=g,config:m(y,r,"leave"),to:m(f,r)})),delete w[e]}));break;case"update":P.forEach((function(e){var t=l.indexOf(e),r=c[t];w[e]=o({},w[e],{item:r,slot:"update",trail:M+=g,config:m(y,r,"update"),to:m(h,r)})}))}var N=l.map((function(e){return w[e]}));return j.forEach((function(e){var t,r=e.left,n=(e.right,a(e,["left","right"]));-1!==(t=N.findIndex((function(e){return e.originalKey===r})))&&(t+=1),t=Math.max(0,t),N=[].concat(N.slice(0,t),[n],N.slice(t))})),o({},s,{changed:A.length||x.length||P.length,first:r&&0===A.length,transitions:N,current:w,deleted:j,prevProps:t})}(S.current,n),S.current.changed&&S.current.transitions.forEach((function(e){var t=e.slot,r=e.from,n=e.to,a=e.config,s=e.trail,i=e.key,c=e.item;S.current.instances.has(i)||S.current.instances.set(i,new Y);var u=S.current.instances.get(i),d=o({},y,{to:n,from:r,config:a,ref:E,onRest:function(r){S.current.mounted&&(e.destroyed&&(E||l||K(S,i),f&&f(c)),!Array.from(S.current.instances).some((function(e){return!e[1].idle}))&&(E||l)&&S.current.deleted.length>0&&K(S),b&&b(c,t,r))},onStart:g&&function(){return g(c,t)},onFrame:h&&function(e){return h(c,t,e)},delay:s,reset:p&&"enter"===t});u.update(d),S.current.paused||u.start()})),s.useEffect((function(){return S.current.mounted=O.current=!0,function(){S.current.mounted=O.current=!1,Array.from(S.current.instances).map((function(e){return e[1].destroy()})),S.current.instances.clear()}}),[]),S.current.transitions.map((function(e){var t=e.item,r=e.slot,n=e.key;return{item:t,key:n,state:r,props:S.current.instances.get(n).getValues()}}))},t.useChain=function(e,t,r){void 0===r&&(r=1e3);var n=s.useRef();s.useEffect((function(){u.equ(e,n.current)?e.forEach((function(e){var t=e.current;return t&&t.start()})):t?e.forEach((function(e,n){var a=e.current;if(a){var s=a.controllers;if(s.length){var i=r*t[n];s.forEach((function(e){e.queue=e.queue.map((function(e){return o({},e,{delay:e.delay+i})})),e.start()}))}}})):e.reduce((function(e,t,r){var n=t.current;return e.then((function(){return n.start()}))}),Promise.resolve()),n.current=e}))},t.useSprings=z},,,,,,,,,,,,function(e,t){},,,,,function(e,t,r){"use strict";(function(e){var n=r(0),o=r(6),a=r(4),s=r.n(a),i=r(20),c=r(1),l=(r(38),r(50));t.a=Object(n.forwardRef)((function({className:t,children:r,spokenMessage:a=r,politeness:u="polite",actions:d=[],onRemove:p=o.noop,icon:f=null,explicitDismiss:m=!1,onDismiss:h=o.noop},b){function g(e){e&&e.preventDefault&&e.preventDefault(),h(),p()}h=h||o.noop,function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(i.speak)(r,t)},[r,t])}(a,u),Object(n.useEffect)(()=>{const e=setTimeout(()=>{m||(h(),p())},1e4);return()=>clearTimeout(e)},[h,p]);const E=s()(t,"components-snackbar",{"components-snackbar-explicit-dismiss":!!m});d&&d.length>1&&(void 0!==e&&e.env,d=[d[0]]);const y=s()("components-snackbar__content",{"components-snackbar__content-with-icon":!!f});return Object(n.createElement)("div",{ref:b,className:E,onClick:m?o.noop:g,tabIndex:"0",role:m?"":"button",onKeyPress:m?o.noop:g,"aria-label":m?"":Object(c.__)("Dismiss this notice")},Object(n.createElement)("div",{className:y},f&&Object(n.createElement)("div",{className:"components-snackbar__icon"},f),r,d.map(({label:e,onClick:t,url:r},o)=>Object(n.createElement)(l.a,{key:o,href:r,variant:"tertiary",onClick:e=>function(e,t){e.stopPropagation(),p(),t&&t(e)}(e,t),className:"components-snackbar__action"},e)),m&&Object(n.createElement)("span",{role:"button","aria-label":"Dismiss this notice",tabIndex:"0",className:"components-snackbar__dismiss-button",onClick:g,onKeyPress:g},"✕")))}))}).call(this,r(63))},function(e,t){e.exports=window.wp.plugins},,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 a})),r.d(t,"a",(function(){return s}));var n=r(45),o=(r(14),r(2));const a=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),s=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),a=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(a[r]="")}),a}},,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(11),o=r.n(n),a=r(0),s=r(4),i=r.n(s),c=r(94),l=r(7),u=(r(78),r(57));const d=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""},p=e=>{let{className:t,context:r="default",additionalNotices:n=[]}=e;const{isSuppressed:s}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:f}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const h=i()(t,"wc-block-components-notices");return s?null:Object(a.createElement)("div",{className:h},m.map(e=>Object(a.createElement)(c.a,o()({key:"store-notice-"+e.id},e,{className:i()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&f(e.id,r)}}),e.content)))}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(0),o=r(48),a=r(2),s=r(59),i=r.n(s),c=r(10),l=r(16);const u=(e,t)=>e&&t[e]?t[e]:null,d=e=>{let{block:t,blockMap:r,blockWrapper:o,children:s,depth:p=1}=e;return s&&0!==s.length?Array.from(s).map((e,s)=>{const{blockName:f="",...m}={key:`${t}_${p}_${s}`,...e instanceof HTMLElement?e.dataset:{},className:e instanceof Element?null==e?void 0:e.className:""},h=u(f,r);if(!h){const a=i()(e instanceof Element&&(null==e?void 0:e.outerHTML)||(null==e?void 0:e.textContent)||"");if("string"==typeof a&&a)return a;if(!Object(n.isValidElement)(a))return null;const s=e.childNodes.length?d({block:t,blockMap:r,children:e.childNodes,depth:p+1,blockWrapper:o}):void 0;return s?Object(n.cloneElement)(a,m,s):Object(n.cloneElement)(a,m)}const b=o||n.Fragment;return Object(n.createElement)(n.Suspense,{key:`${t}_${p}_${s}_suspense`,fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(l.a,{text:"Unexpected error in: "+f,showErrorBlock:a.CURRENT_USER_IS_ADMIN},Object(n.createElement)(b,null,Object(n.createElement)(h,m,d({block:t,blockMap:r,children:e.childNodes,depth:p+1,blockWrapper:o}),((e,t,r,o)=>{if(!Object(c.hasInnerBlocks)(e))return null;const s=r?Array.from(r).map(e=>e instanceof HTMLElement&&(null==e?void 0:e.dataset.blockName)||null).filter(Boolean):[],i=Object(c.getRegisteredBlocks)(e).filter(e=>{let{blockName:t,force:r}=e;return!0===r&&!s.includes(t)}),d=o||n.Fragment;return Object(n.createElement)(n.Fragment,null,i.map((e,r)=>{let{blockName:o,component:s}=e;const i=s||u(o,t);return i?Object(n.createElement)(l.a,{text:"Unexpected error in: "+o,showErrorBlock:a.CURRENT_USER_IS_ADMIN},Object(n.createElement)(d,null,Object(n.createElement)(i,{key:`${o}_forced_${r}`}))):null}))})(f,r,e.childNodes,o)))))}):null},p=e=>{let{Block:t,selector:r,blockName:n,getProps:a=(()=>({})),blockMap:s,blockWrapper:i}=e;Object(o.a)({Block:t,selector:r,getProps:(e,t)=>{const r=d({block:n,blockMap:s,children:e.children||[],blockWrapper:i});return{...a(e,t),children:r}}})}},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(130);e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t,n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(0),o=r(113),a=r(2),s=r(16),i=r(201),c=r(66),l=r(46),u=r(34),d=r(1),p=r(25),f=r.n(p),m=r(118),h=r(92),b=r(7);const g=(e,t,r)=>{const n=Object.keys(e).map(t=>({key:t,value:e[t]}),[]),o=`wc-${r}-new-payment-method`;return n.push({key:o,value:t}),n},E=(e,t)=>{f.a.setNonce&&"function"==typeof f.a.setNonce&&f.a.setNonce(e),null!=e&&e.get("User-ID")&&t.setCustomerId(parseInt(e.get("User-ID")||"0",10))};var y=r(194),v=r(31),O=r(57),S=()=>{const{hasError:e,onCheckoutValidationBeforeProcessing:t,dispatchActions:r,redirectUrl:o,isProcessing:a,isBeforeProcessing:s,isComplete:p,orderNotes:S,shouldCreateAccount:_,extensionData:k}=Object(u.b)(),{hasValidationErrors:w}=Object(y.b)(),{shippingErrorStatus:j}=Object(c.b)(),{billingData:R,shippingAddress:C}=Object(l.b)(),{cartNeedsPayment:T,cartNeedsShipping:A,receiveCart:x}=Object(v.a)(),{activePaymentMethod:P,isExpressPaymentMethodActive:M,currentStatus:N,paymentMethodData:I,expressPaymentMethods:D,paymentMethods:L,shouldSavePayment:F}=Object(i.b)(),{setIsSuppressed:V}=Object(O.b)(),{createErrorNotice:B,removeNotice:U}=Object(b.useDispatch)("core/notices"),H=Object(n.useRef)(R),G=Object(n.useRef)(C),Y=Object(n.useRef)(o),[z,q]=Object(n.useState)(!1),W=Object(n.useMemo)(()=>{var e;const t={...D,...L};return null==t||null===(e=t[P])||void 0===e?void 0:e.paymentMethodId},[P,D,L]),X=w&&!M||N.hasError||j.hasError,K=!e&&!X&&(N.isSuccessful||!T)&&a;Object(n.useEffect)(()=>{V(M)},[M,V]),Object(n.useEffect)(()=>{X===e||!a&&!s||M||r.setHasError(X)},[X,e,a,s,M,r]),Object(n.useEffect)(()=>{H.current=R,G.current=C,Y.current=o},[R,C,o]);const $=Object(n.useCallback)(()=>!w&&(N.hasError?{errorMessage:Object(d.__)("There was a problem with your payment option.","woo-gutenberg-products-block")}:!j.hasError||{errorMessage:Object(d.__)("There was a problem with your shipping option.","woo-gutenberg-products-block")}),[w,N.hasError,j.hasError]);Object(n.useEffect)(()=>{let e;return M||(e=t($,0)),()=>{M||e()}},[t,$,M]),Object(n.useEffect)(()=>{Y.current&&(window.location.href=Y.current)},[p]);const J=Object(n.useCallback)(async()=>{if(z)return;q(!0),U("checkout");const e=T?{payment_method:W,payment_data:g(I,F,P)}:{},t={billing_address:Object(m.a)(H.current),customer_note:S,create_account:_,...e,extensions:{...k}};A&&(t.shipping_address=Object(m.a)(G.current)),f()({path:"/wc/store/v1/checkout",method:"POST",data:t,cache:"no-store",parse:!1}).then(e=>{if(E(e.headers,r),!e.ok)throw new Error(e);return e.json()}).then(e=>{r.setAfterProcessing(e),q(!1)}).catch(e=>{try{null!=e&&e.headers&&E(e.headers,r),e.json().then(e=>{var t,n,o;null!==(t=e.data)&&void 0!==t&&t.cart&&x(e.data.cart),B(Object(h.b)(e),{id:"checkout",context:"wc/checkout"}),null==e||null===(n=e.additional_errors)||void 0===n||null===(o=n.forEach)||void 0===o||o.call(n,e=>{B(e.message,{id:e.error_code,context:"wc/checkout"})}),r.setAfterProcessing(e)})}catch{var t;B(Object(d.sprintf)(// Translators: %s Error text.
|
4 |
-
Object(d.__)("%s Please try placing your order again.","woo-gutenberg-products-block"),null!==(t=null==e?void 0:e.message)&&void 0!==t?t:Object(d.__)("Something went wrong.","woo-gutenberg-products-block")),{id:"checkout",context:"wc/checkout"})}r.setHasError(!0),q(!1)})},[z,U,T,W,I,F,P,S,_,k,A,r,B,x]);return Object(n.useEffect)(()=>{K&&!z&&J()},[J,K,z]),null};const _=e=>{let{children:t,isCart:r=!1,redirectUrl:d}=e;return Object(n.createElement)(u.a,{redirectUrl:d,isCart:r},Object(n.createElement)(l.a,null,Object(n.createElement)(c.a,null,Object(n.createElement)(i.a,null,t,Object(n.createElement)(s.a,{renderError:a.CURRENT_USER_IS_ADMIN?null:()=>null},Object(n.createElement)(o.PluginArea,{scope:"woocommerce-checkout"})),Object(n.createElement)(S,null)))))}},,,function(e,t,r){"use strict";var n=r(0);r(191),t.a=()=>Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},,function(e,t,r){"use strict";var n=r(0),o=r(1),a=r(4),s=r.n(a),i=(r(193),r(135));t.a=e=>{let{children:t,className:r,screenReaderLabel:a,showSpinner:c=!1,isLoading:l=!0}=e;return Object(n.createElement)("div",{className:s()(r,{"wc-block-components-loading-mask":l})},l&&c&&Object(n.createElement)(i.a,null),Object(n.createElement)("div",{className:s()({"wc-block-components-loading-mask__children":l}),"aria-hidden":l},t),l&&Object(n.createElement)("span",{className:"screen-reader-text"},a||Object(o.__)("Loading…","woo-gutenberg-products-block")))}},,,,,function(e,t){e.exports=window.wp.keycodes},,function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=(e,t)=>{const r=[];return Object.keys(e).forEach(n=>{if(void 0!==t[n])switch(e[n].type){case"boolean":r[n]="false"!==t[n]&&!1!==t[n];break;case"number":r[n]=parseInt(t[n],10);break;case"array":case"object":r[n]=JSON.parse(t[n]);break;default:r[n]=t[n]}else r[n]=e[n].default}),r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return a}));var n=r(0);const o=Object(n.createContext)({hasDarkControls:!1}),a=()=>Object(n.useContext)(o)},,,function(e){e.exports=JSON.parse('{"name":"woocommerce/filled-cart-block","version":"1.0.0","title":"Filled Cart","description":"Contains blocks that are displayed when the cart contains products.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/empty-cart-block","version":"1.0.0","title":"Empty Cart","description":"Contains blocks that are displayed when the cart is empty.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-items-block","version":"1.0.0","title":"Cart Items block","description":"Column containing cart items.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-express-payment-block","version":"1.0.0","title":"Express Checkout","description":"Provide an express payment option for your customers.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-line-items-block","version":"1.0.0","title":"Cart Line Items","description":"Block containing current line items in Cart.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-items-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-totals-block","version":"1.0.0","title":"Cart Totals","description":"Column containing the cart totals.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"checkbox":{"type":"boolean","default":false},"text":{"type":"string","required":false},"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/proceed-to-checkout-block","version":"1.0.0","title":"Proceed to checkout","description":"Allow customers proceed to Checkout.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-accepted-payment-methods-block","version":"1.0.0","title":"Accepted Payment Methods","description":"Display accepted payment methods.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":true},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-block","version":"1.0.0","title":"Order Summary","description":"Show customers a summary of their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-subtotal-block","version":"1.0.0","title":"Subtotal","description":"Shows the cart subtotal row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-fee-block","version":"1.0.0","title":"Fees","description":"Shows the cart fee row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-discount-block","version":"1.0.0","title":"Discount","description":"Shows the cart discount row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-shipping-block","version":"1.0.0","title":"Shipping","description":"Shows the cart shipping row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-coupon-form-block","version":"1.0.0","title":"Coupon Form","description":"Shows the apply coupon form.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-taxes-block","version":"1.0.0","title":"Taxes","description":"Shows the cart taxes row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-heading-block","version":"1.0.0","title":"Heading","description":"Shows the heading row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"content":{"type":"string","default":"Cart totals"},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},,function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l}));var n=r(0),o=r(6),a=r(12),s=r.n(a);const i=Object(n.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),c=()=>Object(n.useContext)(i),l=e=>{let{children:t}=e;const[r,a]=Object(n.useState)({}),c=Object(n.useCallback)(e=>r[e],[r]),l=Object(n.useCallback)(e=>{const t=r[e];return!t||t.hidden?"":"validate-error-"+e},[r]),u=Object(n.useCallback)(e=>{a(t=>{if(!t[e])return t;const{[e]:r,...n}=t;return n})},[]),d=Object(n.useCallback)(()=>{a({})},[]),p=Object(n.useCallback)(e=>{e&&a(t=>(e=Object(o.pickBy)(e,(e,r)=>!("string"!=typeof e.message||t.hasOwnProperty(r)&&s()(t[r],e))),0===Object.values(e).length?t:{...t,...e}))},[]),f=Object(n.useCallback)((e,t)=>{a(r=>{if(!r.hasOwnProperty(e))return r;const n={...r[e],...t};return s()(r[e],n)?r:{...r,[e]:n}})},[]),m={getValidationError:c,setValidationErrors:p,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(n.useCallback)(e=>{f(e,{hidden:!0})},[f]),showValidationError:Object(n.useCallback)(e=>{f(e,{hidden:!1})},[f]),showAllValidationErrors:Object(n.useCallback)(()=>{a(e=>{const t={};return Object.keys(e).forEach(r=>{e[r].hidden&&(t[r]={...e[r],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(r).length>0,getValidationErrorId:l};return Object(n.createElement)(i.Provider,{value:m},t)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(91);const o=(e,t)=>function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const a=n.a.addEventCallback(e,r,o);return t(a),()=>{t(n.a.removeEventCallback(e,a.id))}}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s}));const n=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=r(29);const a=async(e,t,r)=>{const o=n(e,t),a=[];for(const e of o)try{const t=await Promise.resolve(e.callback(r));"object"==typeof t&&a.push(t)}catch(e){console.error(e)}return!a.length||a},s=async(e,t,r)=>{const a=[],s=n(e,t);for(const e of s)try{const t=await Promise.resolve(e.callback(r));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 a.push(t),a;a.push(t)}catch(e){return console.error(e),a.push({type:"error"}),a}return a}},,function(e,t,r){"use strict";r.d(t,"b",(function(){return L})),r.d(t,"a",(function(){return F}));var n=r(0),o=r(61),a=r(7);let s,i;!function(e){e.PRISTINE="pristine",e.STARTED="started",e.PROCESSING="processing",e.ERROR="has_error",e.FAILED="failed",e.SUCCESS="success",e.COMPLETE="complete"}(s||(s={})),function(e){e.SET_REGISTERED_PAYMENT_METHODS="set_registered_payment_methods",e.SET_REGISTERED_EXPRESS_PAYMENT_METHODS="set_registered_express_payment_methods",e.SET_SHOULD_SAVE_PAYMENT_METHOD="set_should_save_payment_method",e.SET_ACTIVE_PAYMENT_METHOD="set_active_payment_method"}(i||(i={}));const c={currentStatus:s.PRISTINE,shouldSavePaymentMethod:!1,activePaymentMethod:"",paymentMethodData:{payment_method:""},errorMessage:"",paymentMethods:{},expressPaymentMethods:{}},l={setPaymentStatus:()=>({pristine:()=>{},started:()=>{},processing:()=>{},completed:()=>{},error:e=>{},failed:(e,t)=>{},success:(e,t)=>{}}),currentStatus:{isPristine:!0,isStarted:!1,isProcessing:!1,isFinished:!1,hasError:!1,hasFailed:!1,isSuccessful:!1,isDoingExpressPayment:!1},paymentStatuses:s,paymentMethodData:{},errorMessage:"",activePaymentMethod:"",activeSavedToken:"",setActivePaymentMethod:()=>{},customerPaymentMethods:{},paymentMethods:{},expressPaymentMethods:{},paymentMethodsInitialized:!1,expressPaymentMethodsInitialized:!1,onPaymentProcessing:()=>()=>()=>{},setExpressPaymentError:()=>{},isExpressPaymentMethodActive:!1,setShouldSavePayment:()=>{},shouldSavePayment:!1};var u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,{type:t,paymentMethodData:r,shouldSavePaymentMethod:n=!1,errorMessage:o="",paymentMethods:a={},paymentMethod:l=""}=arguments.length>1?arguments[1]:void 0;switch(t){case s.PRISTINE:return{...c,...e,errorMessage:"",currentStatus:s.PRISTINE};case s.STARTED:return{...e,currentStatus:s.STARTED};case s.ERROR:return e.currentStatus!==s.ERROR?{...e,currentStatus:s.ERROR,errorMessage:o||e.errorMessage}:e;case s.FAILED:return e.currentStatus!==s.FAILED?{...e,currentStatus:s.FAILED,paymentMethodData:r||e.paymentMethodData,errorMessage:o||e.errorMessage}:e;case s.SUCCESS:return e.currentStatus!==s.SUCCESS?{...e,currentStatus:s.SUCCESS,paymentMethodData:r||e.paymentMethodData}:e;case s.PROCESSING:return e.currentStatus!==s.PROCESSING?{...e,currentStatus:s.PROCESSING,errorMessage:""}:e;case s.COMPLETE:return e.currentStatus!==s.COMPLETE?{...e,currentStatus:s.COMPLETE}:e;case i.SET_REGISTERED_PAYMENT_METHODS:return{...e,paymentMethods:a};case i.SET_REGISTERED_EXPRESS_PAYMENT_
|
1 |
+
!function(e){function t(t){for(var r,o,a=t[0],s=t[1],i=0,l=[];i<a.length;i++)o=a[i],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(c&&c(t);l.length;)l.shift()()}var r={},n={11:0,7:0,73: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 a=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=a);var s,i=document.createElement("script");i.charset="utf-8",i.timeout=120,o.nc&&i.setAttribute("nonce",o.nc),i.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",2:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b",3:"vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542",4:"cart-blocks/cart-line-items--mini-cart-contents-block/products-table",5:"cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping",12:"cart-blocks/cart-accepted-payment-methods",13:"cart-blocks/cart-express-payment",14:"cart-blocks/cart-items",15:"cart-blocks/cart-line-items",16:"cart-blocks/cart-order-summary",17:"cart-blocks/cart-totals",18:"cart-blocks/empty-cart",19:"cart-blocks/filled-cart",20:"cart-blocks/order-summary-coupon-form",21:"cart-blocks/order-summary-discount",22:"cart-blocks/order-summary-fee",23:"cart-blocks/order-summary-heading",24:"cart-blocks/order-summary-shipping",25:"cart-blocks/order-summary-subtotal",26:"cart-blocks/order-summary-taxes",27:"cart-blocks/proceed-to-checkout"}[e]||e)+"-frontend.js?ver="+{0:"4cd1d7b80996e87c4732",1:"435b3501d50007652e66",2:"bf894ce297cb28daa50d",3:"deab3ee0c5c13d3addc8",4:"be8d7ecf55c3042e876e",5:"2dddc7aca7753fe0882f",12:"5be5863d0add57329559",13:"d5c6db81220797f17d3f",14:"497cd8ab48255af9b50d",15:"e018f9e4f62fe3625a8e",16:"b9e14b4e57b5735562d9",17:"beabb36f9afc88b4feb3",18:"f6628e966e355c915de9",19:"b69c1cb2d5b09b6615bf",20:"09d17f0071005e6e226f",21:"c7695691a1fc2056b444",22:"7f685f8beac3d104e331",23:"14f6290bb0565b065a38",24:"3e736b89e04324e8d78a",25:"a348afa0fb9493cb1f39",26:"7034e6f77b9b5139aafa",27:"406e5289395af31c4329"}[e]}(e);var c=new Error;s=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+a+")",c.name="ChunkLoadError",c.type=o,c.request=a,r[1](c)}n[e]=void 0}};var l=setTimeout((function(){s({type:"timeout",target:i})}),12e4);i.onerror=i.onload=s,document.head.appendChild(i)}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 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 c=s;o(o.s=224)}([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 a=typeof n;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)){if(n.length){var s=o.apply(null,n);s&&e.push(s)}}else if("object"===a)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.data},function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},,function(e,t){e.exports=window.wc.blocksCheckout},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.url},function(e,t){e.exports=window.wp.primitives},function(e,t,r){"use strict";var n=r(19),o=r.n(n),a=r(0),s=r(3),i=r(1),c=r(43),l=e=>{let{imageUrl:t=c.l+"/block-error.svg",header:r=Object(i.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(i.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:s=Object(i.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(a.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(a.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(a.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(a.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(a.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(a.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",o),l&&Object(a.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(33);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(a.createElement)(a.Fragment,null,Object(a.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:i,button:c}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof i?i({errorMessage:u}):Object(a.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:s,button:c}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=window.wp.htmlEntities},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){e.exports=window.wp.a11y},,,,function(e,t,r){"use strict";(function(e){var n=r(0);r(38);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 a}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return d}));var n=r(61);let o,a;!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"}(a||(a={}));const s=(e,t)=>Object(n.a)(e)&&"type"in e&&e.type===t,i=e=>s(e,o.SUCCESS),c=e=>s(e,o.ERROR),l=e=>s(e,o.FAIL),u=e=>!Object(n.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:a,shouldRetry:u,isSuccessResponse:i,isErrorResponse:c,isFailResponse:l})},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(12),a=r.n(o);function s(e){const t=Object(n.useRef)(e);return a()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(6),o=r(0),a=r(5),s=r(7),i=r(18),c=r(118),l=r(27),u=r(68);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(s.dispatch)(a.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},f=()=>{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:""},h={...m,email:""},b={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:a.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),E={cartCoupons:a.EMPTY_CART_COUPONS,cartItems:a.EMPTY_CART_ITEMS,cartFees:a.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:a.EMPTY_CART_ITEM_ERRORS,cartTotals:b,cartIsLoading:!0,cartErrors:a.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,shippingRates:a.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:a.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:a.EMPTY_EXTENSIONS},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),i=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();f();const p=Object(s.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:a.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:a.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,extensions:a.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const o=e(a.CART_STORE_KEY),s=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),f=o.isCustomerDataUpdating(),{receiveCart:b}=n(a.CART_STORE_KEY),y=g(s.billingAddress),v=s.needsShipping?g(s.shippingAddress):y,O=s.fees.length>0?s.fees.map(e=>g(e)):a.EMPTY_CART_FEES;return{cartCoupons:s.coupons.length>0?s.coupons.map(e=>({...e,label:e.code})):a.EMPTY_CART_COUPONS,cartItems:s.items,cartFees:O,cartItemsCount:s.itemsCount,cartItemsWeight:s.itemsWeight,cartNeedsPayment:s.needsPayment,cartNeedsShipping:s.needsShipping,cartItemErrors:s.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingAddress:Object(c.a)(y),shippingAddress:Object(c.a)(v),extensions:s.extensions,shippingRates:s.shippingRates,isLoadingRates:f,cartHasCalculatedShipping:s.hasCalculatedShipping,paymentRequirements:s.paymentRequirements,receiveCart:b}},[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){},function(e,t,r){"use strict";r.d(t,"b",(function(){return P})),r.d(t,"a",(function(){return x}));var n=r(0),o=r(1),a=r(58),s=r(32),i=r.n(s),c=r(51),l=r(61),u=r(7);let d;!function(e){e.SET_IDLE="set_idle",e.SET_PRISTINE="set_pristine",e.SET_REDIRECT_URL="set_redirect_url",e.SET_COMPLETE="set_checkout_complete",e.SET_BEFORE_PROCESSING="set_before_processing",e.SET_AFTER_PROCESSING="set_after_processing",e.SET_PROCESSING_RESPONSE="set_processing_response",e.SET_PROCESSING="set_checkout_is_processing",e.SET_HAS_ERROR="set_checkout_has_error",e.SET_NO_ERROR="set_checkout_no_error",e.SET_CUSTOMER_ID="set_checkout_customer_id",e.SET_ORDER_ID="set_checkout_order_id",e.SET_ORDER_NOTES="set_checkout_order_notes",e.INCREMENT_CALCULATING="increment_calculating",e.DECREMENT_CALCULATING="decrement_calculating",e.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS="set_shipping_address_as_billing_address",e.SET_SHOULD_CREATE_ACCOUNT="set_should_create_account",e.SET_EXTENSION_DATA="set_extension_data"}(d||(d={}));const p=()=>({type:d.SET_IDLE}),f=e=>({type:d.SET_REDIRECT_URL,redirectUrl:e}),m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:d.SET_COMPLETE,data:e}},h=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:e?d.SET_HAS_ERROR:d.SET_NO_ERROR}};var b=r(2),g=r(118);let E;!function(e){e.PRISTINE="pristine",e.IDLE="idle",e.PROCESSING="processing",e.COMPLETE="complete",e.BEFORE_PROCESSING="before_processing",e.AFTER_PROCESSING="after_processing"}(E||(E={}));const y={order_id:0,customer_id:0,billing_address:{},shipping_address:{},...Object(b.getSetting)("checkoutData",{})||{}},v={redirectUrl:"",status:E.PRISTINE,hasError:!1,calculatingCount:0,orderId:y.order_id,orderNotes:"",customerId:y.customer_id,useShippingAsBilling:Object(g.b)(y.billing_address,y.shipping_address),shouldCreateAccount:!1,processingResponse:null,extensionData:{}},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,{redirectUrl:t,type:r,customerId:n,orderId:o,orderNotes:a,extensionData:s,useShippingAsBilling:i,shouldCreateAccount:c,data:l}=arguments.length>1?arguments[1]:void 0,u=e;switch(r){case d.SET_PRISTINE:u=v;break;case d.SET_IDLE:u=e.status!==E.IDLE?{...e,status:E.IDLE}:e;break;case d.SET_REDIRECT_URL:u=void 0!==t&&t!==e.redirectUrl?{...e,redirectUrl:t}:e;break;case d.SET_PROCESSING_RESPONSE:u={...e,processingResponse:l};break;case d.SET_COMPLETE:u=e.status!==E.COMPLETE?{...e,status:E.COMPLETE,redirectUrl:"string"==typeof(null==l?void 0:l.redirectUrl)?l.redirectUrl:e.redirectUrl}:e;break;case d.SET_PROCESSING:u=e.status!==E.PROCESSING?{...e,status:E.PROCESSING,hasError:!1}:e,u=!1===u.hasError?u:{...u,hasError:!1};break;case d.SET_BEFORE_PROCESSING:u=e.status!==E.BEFORE_PROCESSING?{...e,status:E.BEFORE_PROCESSING,hasError:!1}:e;break;case d.SET_AFTER_PROCESSING:u=e.status!==E.AFTER_PROCESSING?{...e,status:E.AFTER_PROCESSING}:e;break;case d.SET_HAS_ERROR:u=e.hasError?e:{...e,hasError:!0},u=e.status===E.PROCESSING||e.status===E.BEFORE_PROCESSING?{...u,status:E.IDLE}:u;break;case d.SET_NO_ERROR:u=e.hasError?{...e,hasError:!1}:e;break;case d.INCREMENT_CALCULATING:u={...e,calculatingCount:e.calculatingCount+1};break;case d.DECREMENT_CALCULATING:u={...e,calculatingCount:Math.max(0,e.calculatingCount-1)};break;case d.SET_CUSTOMER_ID:u=void 0!==n?{...e,customerId:n}:e;break;case d.SET_ORDER_ID:u=void 0!==o?{...e,orderId:o}:e;break;case d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS:void 0!==i&&i!==e.useShippingAsBilling&&(u={...e,useShippingAsBilling:i});break;case d.SET_SHOULD_CREATE_ACCOUNT:void 0!==c&&c!==e.shouldCreateAccount&&(u={...e,shouldCreateAccount:c});break;case d.SET_ORDER_NOTES:void 0!==a&&e.orderNotes!==a&&(u={...e,orderNotes:a});break;case d.SET_EXTENSION_DATA:void 0!==s&&e.extensionData!==s&&(u={...e,extensionData:s})}return u!==e&&r!==d.SET_PRISTINE&&u.status===E.PRISTINE&&(u.status=E.IDLE),u};var _=r(18),S=r(91),k=r(197);var w=r(199),j=r(194),R=r(56),C=r(29),T=r(77);const A=Object(n.createContext)({dispatchActions:{resetCheckout:()=>{},setRedirectUrl:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},incrementCalculating:()=>{},decrementCalculating:()=>{},setCustomerId:e=>{},setOrderId:e=>{},setOrderNotes:e=>{},setExtensionData:e=>{}},onSubmit:()=>{},isComplete:!1,isIdle:!1,isCalculating:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,redirectUrl:"",orderId:0,orderNotes:"",customerId:0,onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},hasOrder:!1,isCart:!1,useShippingAsBilling:!1,setUseShippingAsBilling:e=>{},shouldCreateAccount:!1,setShouldCreateAccount:e=>{},extensionData:{}}),P=()=>Object(n.useContext)(A),x=e=>{let{children:t,redirectUrl:r,isCart:s=!1}=e;v.redirectUrl=r;const[b,g]=Object(n.useReducer)(O,v),{setValidationErrors:y}=Object(j.b)(),{createErrorNotice:P}=Object(u.useDispatch)("core/notices"),{dispatchCheckoutEvent:x}=Object(R.a)(),M=b.calculatingCount>0,{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D,shouldRetry:L}=Object(C.d)(),{checkoutNotices:F,paymentNotices:V,expressPaymentNotices:B}=(()=>{const{noticeContexts:e}=Object(C.d)();return{checkoutNotices:Object(u.useSelect)(e=>e("core/notices").getNotices("wc/checkout"),[]),expressPaymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.EXPRESS_PAYMENTS),[e.EXPRESS_PAYMENTS]),paymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.PAYMENTS),[e.PAYMENTS])}})(),[U,H]=Object(n.useReducer)(S.b,{}),G=Object(n.useRef)(U),{onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,onCheckoutValidationBeforeProcessing:q}=(e=>Object(n.useMemo)(()=>({onCheckoutAfterProcessingWithSuccess:Object(k.a)("checkout_after_processing_with_success",e),onCheckoutAfterProcessingWithError:Object(k.a)("checkout_after_processing_with_error",e),onCheckoutValidationBeforeProcessing:Object(k.a)("checkout_validation_before_processing",e)}),[e]))(H);Object(n.useEffect)(()=>{G.current=U},[U]);const W=Object(n.useMemo)(()=>function(){return i()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidationBeforeProcessing",plugin:"WooCommerce Blocks"}),q(...arguments)},[q]),X=Object(n.useMemo)(()=>({resetCheckout:()=>{g({type:d.SET_PRISTINE})},setRedirectUrl:e=>{g(f(e))},setHasError:e=>{g(h(e))},incrementCalculating:()=>{g({type:d.INCREMENT_CALCULATING})},decrementCalculating:()=>{g({type:d.DECREMENT_CALCULATING})},setCustomerId:e=>{var t;g((t=e,{type:d.SET_CUSTOMER_ID,customerId:t}))},setOrderId:e=>{g((e=>({type:d.SET_ORDER_ID,orderId:e}))(e))},setOrderNotes:e=>{g((e=>({type:d.SET_ORDER_NOTES,orderNotes:e}))(e))},setExtensionData:e=>{g((e=>({type:d.SET_EXTENSION_DATA,extensionData:e}))(e))},setAfterProcessing:e=>{const t=(e=>{const t={message:"",paymentStatus:"",redirectUrl:"",paymentDetails:{}};return"payment_result"in e&&(t.paymentStatus=e.payment_result.payment_status,t.redirectUrl=e.payment_result.redirect_url,e.payment_result.hasOwnProperty("payment_details")&&Array.isArray(e.payment_result.payment_details)&&e.payment_result.payment_details.forEach(e=>{let{key:r,value:n}=e;t.paymentDetails[r]=Object(_.decodeEntities)(n)})),"message"in e&&(t.message=Object(_.decodeEntities)(e.message)),!t.message&&"data"in e&&"status"in e.data&&e.data.status>299&&(t.message=Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")),t})(e);var r;g(f((null==t?void 0:t.redirectUrl)||"")),g((r=t,{type:d.SET_PROCESSING_RESPONSE,data:r})),g({type:d.SET_AFTER_PROCESSING})}}),[]);Object(n.useEffect)(()=>{b.status===E.BEFORE_PROCESSING&&(Object(T.b)("error"),Object(w.a)(G.current,"checkout_validation_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;P(t,{context:"wc/checkout"}),y(r)}),g(p()),g(h())):g({type:d.SET_PROCESSING})}))},[b.status,y,P,g]);const K=Object(a.a)(b.status),$=Object(a.a)(b.hasError);Object(n.useEffect)(()=>{if((b.status!==K||b.hasError!==$)&&b.status===E.AFTER_PROCESSING){const e={redirectUrl:b.redirectUrl,orderId:b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,processingResponse:b.processingResponse};b.hasError?Object(w.b)(G.current,"checkout_after_processing_with_error",e).then(t=>{const r=(e=>{let t=null;return e.forEach(e=>{if((I(e)||D(e))&&e.message&&Object(c.a)(e.message)){const r=e.messageContext&&Object(c.a)(e.messageContent)?{context:e.messageContext}:void 0;t=e,P(e.message,r)}}),t})(t);if(null!==r)L(r)?g(p()):g(m(r));else{if(!(F.some(e=>"error"===e.status)||B.some(e=>"error"===e.status)||V.some(e=>"error"===e.status))){var n;const t=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");P(t,{id:"checkout",context:"wc/checkout"})}g(p())}}):Object(w.b)(G.current,"checkout_after_processing_with_success",e).then(e=>{let t=null,r=null;if(e.forEach(e=>{N(e)&&(t=e),(I(e)||D(e))&&(r=e)}),t&&!r)g(m(t));else if(Object(l.a)(r)){if(r.message&&Object(c.a)(r.message)){const e=r.messageContext&&Object(c.a)(r.messageContext)?{context:r.messageContext}:void 0;P(r.message,e)}L(r)?g(h(!0)):g(m(r))}else g(m())})}},[b.status,b.hasError,b.redirectUrl,b.orderId,b.customerId,b.orderNotes,b.processingResponse,K,$,X,P,I,D,N,L,F,B,V]);const J={onSubmit:Object(n.useCallback)(()=>{x("submit"),g({type:d.SET_BEFORE_PROCESSING})},[x]),isComplete:b.status===E.COMPLETE,isIdle:b.status===E.IDLE,isCalculating:M,isProcessing:b.status===E.PROCESSING,isBeforeProcessing:b.status===E.BEFORE_PROCESSING,isAfterProcessing:b.status===E.AFTER_PROCESSING,hasError:b.hasError,redirectUrl:b.redirectUrl,onCheckoutBeforeProcessing:W,onCheckoutValidationBeforeProcessing:q,onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,dispatchActions:X,isCart:s,orderId:b.orderId,hasOrder:!!b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,useShippingAsBilling:b.useShippingAsBilling,setUseShippingAsBilling:e=>{return g((t=e,{type:d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS,useShippingAsBilling:t}));var t},shouldCreateAccount:b.shouldCreateAccount,setShouldCreateAccount:e=>{return g((t=e,{type:d.SET_SHOULD_CREATE_ACCOUNT,shouldCreateAccount:t}));var t},extensionData:b.extensionData};return Object(n.createElement)(A.Provider,{value:J},t)}},,,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(8),o=r(0),a=r(15),s=function({icon:e,className:t,...r}){const a=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:a},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(s,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&s===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===a.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(a.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),a=r(0);t.a=Object(a.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(a.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},,function(e,t,r){"use strict";r.d(t,"n",(function(){return a})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return i})),r.d(t,"m",(function(){return c})),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 f})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return b})),r.d(t,"h",(function(){return g})),r.d(t,"b",(function(){return E}));var n,o=r(2);const a=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=a.pluginUrl+"images/",i=a.pluginUrl+"build/",c=a.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),f=(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"),h=Object(o.getSetting)("shippingCountries",{}),b=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),a=r(69),s=r(51);const i=Object(n.getSetting)("countryLocale",{}),c=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. */
|
|
|
|