Version Description
- Feature: A new block named 'All Reviews' was added in order to display a list of reviews from all products and categories of your store. #902
- Feature: Added Reviews by Product block.
- Feature: Added Reviews by Category block.
- Feature: Added a new product search block to insert a product search field on a page.
- Enhancement: Add error handling for API requests to the featured product block.
- Enhancement: Allow hidden products in handpicked products block.
- Fix: Prevented block settings being output on every route. Now they are only needed when the route has blocks requiring them.
- Dev: Introduced higher order components, global data handlers, and refactored some blocks.
- Dev: Created new HOCs for retrieving data:
withProduct
,withComponentId
,withCategory
. - Dev: Export block settings to an external global
wc.blockSettings
that can be reliably used by extensions by enqueuing their script with thewc-block-settings
as the handle. #903 - Dev: Added new generic base components:
<OrderSelect />
and<Label />
so they can be shared between different blocks. #905
Download this release
Release Info
Developer | mikejolley |
Plugin | WooCommerce Gutenberg Products Block |
Version | 2.4.0 |
Comparing to | |
See all releases |
Code changes from version 2.3.1 to 2.4.0
- assets/css/abstracts/_mixins.scss +16 -0
- assets/css/editor.scss +14 -0
- assets/js/base/components/label/index.js +63 -0
- assets/js/base/components/label/test/__snapshots__/index.js.snap +62 -0
- assets/js/base/components/label/test/index.js +85 -0
- assets/js/base/components/load-more-button/index.js +39 -0
- assets/js/base/components/load-more-button/style.scss +4 -0
- assets/js/base/components/order-select/index.js +65 -0
- assets/js/base/components/order-select/style.scss +9 -0
- assets/js/base/components/read-more/index.js +163 -0
- assets/js/base/components/read-more/test/index.js +30 -0
- assets/js/base/components/read-more/utils.js +76 -0
- assets/js/base/components/review-list-item/index.js +131 -0
- assets/js/base/components/review-list-item/style.scss +197 -0
- assets/js/base/components/review-list/index.js +42 -0
- assets/js/base/components/review-list/style.scss +4 -0
- assets/js/base/components/review-order-select/index.js +39 -0
- assets/js/base/components/review-order-select/style.scss +3 -0
- assets/js/base/hocs/test/with-reviews.js +129 -0
- assets/js/{utils → base/hocs}/with-component-id.js +0 -0
- assets/js/base/hocs/with-reviews.js +178 -0
- assets/js/blocks/featured-category/block.js +152 -211
- assets/js/blocks/featured-category/index.js +2 -1
- assets/js/blocks/featured-category/utils.js +57 -0
- assets/js/blocks/featured-product/block.js +212 -237
- assets/js/blocks/featured-product/editor.scss +3 -0
- assets/js/blocks/featured-product/index.js +2 -1
- assets/js/blocks/featured-product/utils.js +42 -0
- assets/js/blocks/handpicked-products/block.js +3 -2
- assets/js/blocks/handpicked-products/index.js +3 -2
- assets/js/blocks/product-categories/block.js +3 -2
- assets/js/blocks/product-categories/get-categories.js +6 -1
- assets/js/blocks/product-categories/style.scss +0 -1
- assets/js/blocks/product-category/block.js +25 -32
- assets/js/blocks/product-search/block.js +137 -0
- assets/js/blocks/product-search/editor.scss +10 -0
- assets/js/blocks/product-search/index.js +113 -0
- assets/js/blocks/product-search/style.scss +59 -0
- assets/js/blocks/product-tag/block.js +2 -2
- assets/js/blocks/product-tag/index.js +3 -2
- assets/js/blocks/products-by-attribute/index.js +5 -4
- assets/js/blocks/reviews/all-reviews/edit.js +71 -0
- assets/js/blocks/reviews/all-reviews/index.js +53 -0
- assets/js/blocks/reviews/all-reviews/no-reviews-placeholder.js +24 -0
- assets/js/blocks/reviews/attributes.js +97 -0
- assets/js/blocks/reviews/edit-utils.js +150 -0
- assets/js/blocks/reviews/editor-block.js +72 -0
- assets/js/blocks/reviews/editor-container-block.js +68 -0
- assets/js/blocks/reviews/editor.scss +13 -0
- assets/js/blocks/reviews/frontend-block.js +61 -0
- assets/js/blocks/reviews/frontend-container-block.js +103 -0
- assets/js/blocks/reviews/frontend.js +32 -0
- assets/js/blocks/reviews/reviews-by-category/edit.js +172 -0
- assets/js/blocks/reviews/reviews-by-category/index.js +59 -0
- assets/js/blocks/reviews/reviews-by-category/no-reviews-placeholder.js +24 -0
- assets/js/blocks/reviews/reviews-by-product/edit.js +166 -0
- assets/js/blocks/reviews/reviews-by-product/index.js +51 -0
- assets/js/blocks/reviews/reviews-by-product/no-reviews-placeholder.js +60 -0
- assets/js/blocks/reviews/save.js +33 -0
- assets/js/blocks/reviews/utils.js +57 -0
- assets/js/components/api-error-placeholder/index.js +86 -0
- assets/js/components/grid-layout-control/index.js +9 -8
- assets/js/components/icons/all-reviews.js +22 -0
- assets/js/components/icons/index.js +3 -0
- assets/js/components/icons/reviews-by-category.js +19 -0
- assets/js/components/icons/reviews-by-product.js +18 -0
- assets/js/components/product-attribute-control/index.js +7 -2
- assets/js/components/product-category-control/index.js +2 -1
- assets/js/components/product-control/index.js +26 -12
- assets/js/components/product-preview/index.js +4 -7
- assets/js/components/product-preview/test/index.js +8 -3
- assets/js/components/product-tag-control/index.js +3 -2
- assets/js/components/products-control/index.js +69 -90
- assets/js/components/utils/index.js +49 -24
- assets/js/hocs/index.js +3 -0
- assets/js/hocs/test/with-product.js +103 -0
- assets/js/hocs/test/with-searched-products.js +90 -0
- assets/js/hocs/with-category.js +76 -0
- assets/js/hocs/with-product.js +76 -0
- assets/js/hocs/with-searched-products.js +87 -0
- assets/js/settings/blocks/endpoints.js +6 -0
- assets/js/settings/blocks/index.js +25 -0
- assets/js/settings/shared/currency.js +16 -0
- assets/js/settings/shared/index.js +2 -0
- assets/js/utils/get-query.js +3 -2
- assets/js/utils/get-shortcode.js +7 -2
- assets/js/utils/products.js +14 -10
- assets/js/utils/shared-attributes.js +6 -2
- assets/js/utils/test/products.js +84 -0
- build/all-reviews.deps.json +1 -0
- build/all-reviews.js +1 -0
- build/blocks.js +1 -1
- build/editor.css +11 -14
- build/featured-category.deps.json +1 -1
- build/featured-category.js +1 -1
- build/featured-product.deps.json +1 -1
- build/featured-product.js +1 -1
- build/frontend.deps.json +0 -1
- build/frontend.js +0 -12
- build/handpicked-products.deps.json +1 -1
- build/handpicked-products.js +1 -1
- build/product-best-sellers.deps.json +1 -1
- build/product-best-sellers.js +1 -1
- build/product-categories-frontend.deps.json +1 -0
- build/product-categories-frontend.js +6 -0
- build/product-categories.deps.json +1 -1
- build/product-categories.js +1 -1
- build/product-category.deps.json +1 -1
- build/product-category.js +1 -1
- build/product-new.deps.json +1 -1
- build/product-new.js +1 -1
- build/product-on-sale.deps.json +1 -1
- build/product-on-sale.js +1 -1
- build/product-search.deps.json +1 -0
- build/product-search.js +1 -0
- build/product-tag.deps.json +1 -1
- build/product-tag.js +1 -1
- build/product-top-rated.deps.json +1 -1
- build/product-top-rated.js +1 -1
- build/products-by-attribute.deps.json +1 -1
- build/products-by-attribute.js +1 -1
- build/reviews-by-category.deps.json +1 -0
- build/reviews-by-category.js +1 -0
- build/reviews-by-product.deps.json +1 -0
- build/reviews-by-product.js +1 -0
- build/reviews-frontend.deps.json +1 -0
- build/reviews-frontend.js +6 -0
- build/style.css +7 -4
assets/css/abstracts/_mixins.scss
CHANGED
@@ -15,6 +15,18 @@
|
|
15 |
}
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
// Adds animation to placeholder section
|
19 |
@mixin placeholder( $lighten-percentage: 30% ) {
|
20 |
animation: loading-fade 1.6s ease-in-out infinite;
|
@@ -24,6 +36,10 @@
|
|
24 |
&::after {
|
25 |
content: "\00a0";
|
26 |
}
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
|
29 |
// Adds animation to transforms
|
15 |
}
|
16 |
}
|
17 |
|
18 |
+
@keyframes loading-fade {
|
19 |
+
0% {
|
20 |
+
opacity: 0.7;
|
21 |
+
}
|
22 |
+
50% {
|
23 |
+
opacity: 1;
|
24 |
+
}
|
25 |
+
100% {
|
26 |
+
opacity: 0.7;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
|
30 |
// Adds animation to placeholder section
|
31 |
@mixin placeholder( $lighten-percentage: 30% ) {
|
32 |
animation: loading-fade 1.6s ease-in-out infinite;
|
36 |
&::after {
|
37 |
content: "\00a0";
|
38 |
}
|
39 |
+
|
40 |
+
@media screen and (prefers-reduced-motion: reduce) {
|
41 |
+
animation: none;
|
42 |
+
}
|
43 |
}
|
44 |
|
45 |
// Adds animation to transforms
|
assets/css/editor.scss
CHANGED
@@ -35,3 +35,17 @@
|
|
35 |
}
|
36 |
}
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
}
|
37 |
}
|
38 |
+
|
39 |
+
.wc-block-api-error {
|
40 |
+
.components-placeholder__fieldset {
|
41 |
+
display: block;
|
42 |
+
margin: 0;
|
43 |
+
padding: 0;
|
44 |
+
}
|
45 |
+
.wc-block-error__message {
|
46 |
+
margin-bottom: 16px;
|
47 |
+
}
|
48 |
+
.components-spinner {
|
49 |
+
float: none;
|
50 |
+
}
|
51 |
+
}
|
assets/js/base/components/label/index.js
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import PropTypes from 'prop-types';
|
5 |
+
import { Fragment } from 'react';
|
6 |
+
import classNames from 'classnames';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Component used to render an accessible text given a label and/or a
|
10 |
+
* screenReaderLabel. The wrapper element and wrapper props can also be
|
11 |
+
* specified via props.
|
12 |
+
*/
|
13 |
+
const Label = ( { label, screenReaderLabel, wrapperElement, wrapperProps } ) => {
|
14 |
+
let Wrapper;
|
15 |
+
|
16 |
+
if ( ! label && screenReaderLabel ) {
|
17 |
+
Wrapper = wrapperElement || 'span';
|
18 |
+
wrapperProps = {
|
19 |
+
...wrapperProps,
|
20 |
+
className: classNames( wrapperProps.className, 'screen-reader-text' ),
|
21 |
+
};
|
22 |
+
|
23 |
+
return (
|
24 |
+
<Wrapper { ...wrapperProps }>
|
25 |
+
{ screenReaderLabel }
|
26 |
+
</Wrapper>
|
27 |
+
);
|
28 |
+
}
|
29 |
+
|
30 |
+
Wrapper = wrapperElement || Fragment;
|
31 |
+
|
32 |
+
if ( label && screenReaderLabel && label !== screenReaderLabel ) {
|
33 |
+
return (
|
34 |
+
<Wrapper { ...wrapperProps }>
|
35 |
+
<span aria-hidden>
|
36 |
+
{ label }
|
37 |
+
</span>
|
38 |
+
<span className="screen-reader-text">
|
39 |
+
{ screenReaderLabel }
|
40 |
+
</span>
|
41 |
+
</Wrapper>
|
42 |
+
);
|
43 |
+
}
|
44 |
+
|
45 |
+
return (
|
46 |
+
<Wrapper { ...wrapperProps }>
|
47 |
+
{ label }
|
48 |
+
</Wrapper>
|
49 |
+
);
|
50 |
+
};
|
51 |
+
|
52 |
+
Label.propTypes = {
|
53 |
+
label: PropTypes.string,
|
54 |
+
screenReaderLabel: PropTypes.string,
|
55 |
+
wrapperElement: PropTypes.elementType,
|
56 |
+
wrapperProps: PropTypes.object,
|
57 |
+
};
|
58 |
+
|
59 |
+
Label.defaultProps = {
|
60 |
+
wrapperProps: {},
|
61 |
+
};
|
62 |
+
|
63 |
+
export default Label;
|
assets/js/base/components/label/test/__snapshots__/index.js.snap
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2 |
+
|
3 |
+
exports[`Label with wrapperElement should render both label and screen reader label 1`] = `
|
4 |
+
<label
|
5 |
+
className="foo-bar"
|
6 |
+
data-foo="bar"
|
7 |
+
>
|
8 |
+
<span
|
9 |
+
aria-hidden={true}
|
10 |
+
>
|
11 |
+
Lorem
|
12 |
+
</span>
|
13 |
+
<span
|
14 |
+
className="screen-reader-text"
|
15 |
+
>
|
16 |
+
Ipsum
|
17 |
+
</span>
|
18 |
+
</label>
|
19 |
+
`;
|
20 |
+
|
21 |
+
exports[`Label with wrapperElement should render only the label 1`] = `
|
22 |
+
<label
|
23 |
+
className="foo-bar"
|
24 |
+
data-foo="bar"
|
25 |
+
>
|
26 |
+
Lorem
|
27 |
+
</label>
|
28 |
+
`;
|
29 |
+
|
30 |
+
exports[`Label with wrapperElement should render only the screen reader label 1`] = `
|
31 |
+
<label
|
32 |
+
className="foo-bar screen-reader-text"
|
33 |
+
data-foo="bar"
|
34 |
+
>
|
35 |
+
Ipsum
|
36 |
+
</label>
|
37 |
+
`;
|
38 |
+
|
39 |
+
exports[`Label without wrapperElement should render both label and screen reader label 1`] = `
|
40 |
+
Array [
|
41 |
+
<span
|
42 |
+
aria-hidden={true}
|
43 |
+
>
|
44 |
+
Lorem
|
45 |
+
</span>,
|
46 |
+
<span
|
47 |
+
className="screen-reader-text"
|
48 |
+
>
|
49 |
+
Ipsum
|
50 |
+
</span>,
|
51 |
+
]
|
52 |
+
`;
|
53 |
+
|
54 |
+
exports[`Label without wrapperElement should render only the label 1`] = `"Lorem"`;
|
55 |
+
|
56 |
+
exports[`Label without wrapperElement should render only the screen reader label 1`] = `
|
57 |
+
<span
|
58 |
+
className="screen-reader-text"
|
59 |
+
>
|
60 |
+
Ipsum
|
61 |
+
</span>
|
62 |
+
`;
|
assets/js/base/components/label/test/index.js
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import Label from '../';
|
10 |
+
|
11 |
+
describe( 'Label', () => {
|
12 |
+
describe( 'without wrapperElement', () => {
|
13 |
+
test( 'should render both label and screen reader label', () => {
|
14 |
+
const component = TestRenderer.create(
|
15 |
+
<Label label="Lorem" screenReaderLabel="Ipsum" />
|
16 |
+
);
|
17 |
+
|
18 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
19 |
+
} );
|
20 |
+
|
21 |
+
test( 'should render only the label', () => {
|
22 |
+
const component = TestRenderer.create(
|
23 |
+
<Label label="Lorem" />
|
24 |
+
);
|
25 |
+
|
26 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
27 |
+
} );
|
28 |
+
|
29 |
+
test( 'should render only the screen reader label', () => {
|
30 |
+
const component = TestRenderer.create(
|
31 |
+
<Label screenReaderLabel="Ipsum" />
|
32 |
+
);
|
33 |
+
|
34 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
35 |
+
} );
|
36 |
+
} );
|
37 |
+
|
38 |
+
describe( 'with wrapperElement', () => {
|
39 |
+
test( 'should render both label and screen reader label', () => {
|
40 |
+
const component = TestRenderer.create(
|
41 |
+
<Label
|
42 |
+
label="Lorem"
|
43 |
+
screenReaderLabel="Ipsum"
|
44 |
+
wrapperElement="label"
|
45 |
+
wrapperProps={ {
|
46 |
+
className: 'foo-bar',
|
47 |
+
'data-foo': 'bar',
|
48 |
+
} }
|
49 |
+
/>
|
50 |
+
);
|
51 |
+
|
52 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
53 |
+
} );
|
54 |
+
|
55 |
+
test( 'should render only the label', () => {
|
56 |
+
const component = TestRenderer.create(
|
57 |
+
<Label
|
58 |
+
label="Lorem"
|
59 |
+
wrapperElement="label"
|
60 |
+
wrapperProps={ {
|
61 |
+
className: 'foo-bar',
|
62 |
+
'data-foo': 'bar',
|
63 |
+
} }
|
64 |
+
/>
|
65 |
+
);
|
66 |
+
|
67 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
68 |
+
} );
|
69 |
+
|
70 |
+
test( 'should render only the screen reader label', () => {
|
71 |
+
const component = TestRenderer.create(
|
72 |
+
<Label
|
73 |
+
screenReaderLabel="Ipsum"
|
74 |
+
wrapperElement="label"
|
75 |
+
wrapperProps={ {
|
76 |
+
className: 'foo-bar',
|
77 |
+
'data-foo': 'bar',
|
78 |
+
} }
|
79 |
+
/>
|
80 |
+
);
|
81 |
+
|
82 |
+
expect( component.toJSON() ).toMatchSnapshot();
|
83 |
+
} );
|
84 |
+
} );
|
85 |
+
} );
|
assets/js/base/components/load-more-button/index.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import PropTypes from 'prop-types';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import Label from '../label';
|
11 |
+
import './style.scss';
|
12 |
+
|
13 |
+
export const LoadMoreButton = ( { onClick, label, screenReaderLabel } ) => {
|
14 |
+
return (
|
15 |
+
<div className="wp-block-button wc-block-load-more">
|
16 |
+
<button
|
17 |
+
className="wp-block-button__link"
|
18 |
+
onClick={ onClick }
|
19 |
+
>
|
20 |
+
<Label
|
21 |
+
label={ label }
|
22 |
+
screenReaderLabel={ screenReaderLabel }
|
23 |
+
/>
|
24 |
+
</button>
|
25 |
+
</div>
|
26 |
+
);
|
27 |
+
};
|
28 |
+
|
29 |
+
LoadMoreButton.propTypes = {
|
30 |
+
label: PropTypes.string,
|
31 |
+
onClick: PropTypes.func,
|
32 |
+
screenReaderLabel: PropTypes.string,
|
33 |
+
};
|
34 |
+
|
35 |
+
LoadMoreButton.defaultProps = {
|
36 |
+
label: __( 'Load more', 'woo-gutenberg-products-block' ),
|
37 |
+
};
|
38 |
+
|
39 |
+
export default LoadMoreButton;
|
assets/js/base/components/load-more-button/style.scss
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-load-more {
|
2 |
+
text-align: center;
|
3 |
+
width: 100%;
|
4 |
+
}
|
assets/js/base/components/order-select/index.js
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import PropTypes from 'prop-types';
|
5 |
+
import classNames from 'classnames';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import Label from '../label';
|
11 |
+
import withComponentId from '../../hocs/with-component-id';
|
12 |
+
import './style.scss';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Component used for 'Order by' selectors, which renders a label
|
16 |
+
* and a <select> with the options provided in the props.
|
17 |
+
*/
|
18 |
+
const OrderSelect = ( { className, componentId, defaultValue, label, onChange, options, screenReaderLabel, readOnly, value } ) => {
|
19 |
+
const selectId = `wc-block-order-select__select-${ componentId }`;
|
20 |
+
|
21 |
+
return (
|
22 |
+
<p className={ classNames( 'wc-block-order-select', className ) }>
|
23 |
+
<Label
|
24 |
+
label={ label }
|
25 |
+
screenReaderLabel={ screenReaderLabel }
|
26 |
+
wrapperElement="label"
|
27 |
+
wrapperProps={ {
|
28 |
+
className: 'wc-block-order-select__label',
|
29 |
+
htmlFor: selectId,
|
30 |
+
} }
|
31 |
+
/>
|
32 |
+
<select // eslint-disable-line jsx-a11y/no-onchange
|
33 |
+
id={ selectId }
|
34 |
+
className="wc-block-order-select__select"
|
35 |
+
defaultValue={ defaultValue }
|
36 |
+
onChange={ onChange }
|
37 |
+
readOnly={ readOnly }
|
38 |
+
value={ value }
|
39 |
+
>
|
40 |
+
{ options.map( ( option ) => (
|
41 |
+
<option key={ option.key } value={ option.key }>
|
42 |
+
{ option.label }
|
43 |
+
</option>
|
44 |
+
) ) }
|
45 |
+
</select>
|
46 |
+
</p>
|
47 |
+
);
|
48 |
+
};
|
49 |
+
|
50 |
+
OrderSelect.propTypes = {
|
51 |
+
defaultValue: PropTypes.string,
|
52 |
+
label: PropTypes.string,
|
53 |
+
onChange: PropTypes.func,
|
54 |
+
options: PropTypes.arrayOf( PropTypes.shape( {
|
55 |
+
key: PropTypes.string.isRequired,
|
56 |
+
label: PropTypes.string.isRequired,
|
57 |
+
} ) ),
|
58 |
+
readOnly: PropTypes.bool,
|
59 |
+
screenReaderLabel: PropTypes.string,
|
60 |
+
value: PropTypes.string,
|
61 |
+
// from withComponentId
|
62 |
+
componentId: PropTypes.number.isRequired,
|
63 |
+
};
|
64 |
+
|
65 |
+
export default withComponentId( OrderSelect );
|
assets/js/base/components/order-select/style.scss
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-order-select {
|
2 |
+
margin-bottom: $gap-small;
|
3 |
+
}
|
4 |
+
|
5 |
+
.wc-block-order-select__label {
|
6 |
+
margin-right: $gap-small;
|
7 |
+
display: inline-block;
|
8 |
+
font-weight: normal;
|
9 |
+
}
|
assets/js/base/components/read-more/index.js
ADDED
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Show text based content, limited to a number of lines, with a read more link.
|
3 |
+
*
|
4 |
+
* Based on https://github.com/zoltantothcom/react-clamp-lines.
|
5 |
+
*/
|
6 |
+
import React, { createRef, Component } from 'react';
|
7 |
+
import PropTypes from 'prop-types';
|
8 |
+
import { __ } from '@wordpress/i18n';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import { clampLines } from './utils';
|
14 |
+
|
15 |
+
class ReadMore extends Component {
|
16 |
+
constructor( props ) {
|
17 |
+
super( ...arguments );
|
18 |
+
|
19 |
+
this.state = {
|
20 |
+
/**
|
21 |
+
* This is true when read more has been pressed and the full review is shown.
|
22 |
+
*/
|
23 |
+
isExpanded: false,
|
24 |
+
/**
|
25 |
+
* True if we are clamping content. False if the review is short. Null during init.
|
26 |
+
*/
|
27 |
+
clampEnabled: null,
|
28 |
+
/**
|
29 |
+
* Content is passed in via children.
|
30 |
+
*/
|
31 |
+
content: props.children,
|
32 |
+
/**
|
33 |
+
* Summary content generated from content HTML.
|
34 |
+
*/
|
35 |
+
summary: '.',
|
36 |
+
};
|
37 |
+
|
38 |
+
this.reviewSummary = createRef();
|
39 |
+
this.reviewContent = createRef();
|
40 |
+
this.getButton = this.getButton.bind( this );
|
41 |
+
this.onClick = this.onClick.bind( this );
|
42 |
+
}
|
43 |
+
|
44 |
+
componentDidMount() {
|
45 |
+
if ( this.props.children ) {
|
46 |
+
const { maxLines, ellipsis } = this.props;
|
47 |
+
|
48 |
+
const lineHeight = this.reviewSummary.current.clientHeight + 1;
|
49 |
+
const reviewHeight = this.reviewContent.current.clientHeight + 1;
|
50 |
+
const maxHeight = ( lineHeight * maxLines ) + 1;
|
51 |
+
const clampEnabled = reviewHeight > maxHeight;
|
52 |
+
|
53 |
+
this.setState( {
|
54 |
+
clampEnabled,
|
55 |
+
} );
|
56 |
+
|
57 |
+
if ( clampEnabled ) {
|
58 |
+
this.setState( {
|
59 |
+
summary: clampLines( this.reviewContent.current.innerHTML, this.reviewSummary.current, maxHeight, ellipsis ),
|
60 |
+
} );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
getButton() {
|
66 |
+
const { isExpanded } = this.state;
|
67 |
+
const { className, lessText, moreText } = this.props;
|
68 |
+
|
69 |
+
const buttonText = isExpanded ? lessText : moreText;
|
70 |
+
|
71 |
+
if ( ! buttonText ) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
|
75 |
+
return (
|
76 |
+
<a
|
77 |
+
href="#more"
|
78 |
+
className={ className + '__read_more' }
|
79 |
+
onClick={ this.onClick }
|
80 |
+
aria-expanded={ ! isExpanded }
|
81 |
+
role="button"
|
82 |
+
>
|
83 |
+
{ buttonText }
|
84 |
+
</a>
|
85 |
+
);
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Handles the click event for the read more/less button.
|
90 |
+
*
|
91 |
+
* @param {obj} e event
|
92 |
+
*/
|
93 |
+
onClick( e ) {
|
94 |
+
e.preventDefault();
|
95 |
+
|
96 |
+
const { isExpanded } = this.state;
|
97 |
+
|
98 |
+
this.setState( {
|
99 |
+
isExpanded: ! isExpanded,
|
100 |
+
} );
|
101 |
+
}
|
102 |
+
|
103 |
+
render() {
|
104 |
+
const { className } = this.props;
|
105 |
+
const { content, summary, clampEnabled, isExpanded } = this.state;
|
106 |
+
|
107 |
+
if ( ! content ) {
|
108 |
+
return null;
|
109 |
+
}
|
110 |
+
|
111 |
+
if ( false === clampEnabled ) {
|
112 |
+
return (
|
113 |
+
<div className={ className }>
|
114 |
+
<div ref={ this.reviewContent }>
|
115 |
+
{ content }
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
);
|
119 |
+
}
|
120 |
+
|
121 |
+
return (
|
122 |
+
<div className={ className }>
|
123 |
+
{ ( ! isExpanded || null === clampEnabled ) && (
|
124 |
+
<div
|
125 |
+
ref={ this.reviewSummary }
|
126 |
+
aria-hidden={ isExpanded }
|
127 |
+
dangerouslySetInnerHTML={ {
|
128 |
+
__html: summary,
|
129 |
+
} }
|
130 |
+
/>
|
131 |
+
) }
|
132 |
+
{ ( isExpanded || null === clampEnabled ) && (
|
133 |
+
<div
|
134 |
+
ref={ this.reviewContent }
|
135 |
+
aria-hidden={ ! isExpanded }
|
136 |
+
>
|
137 |
+
{ content }
|
138 |
+
</div>
|
139 |
+
) }
|
140 |
+
{ this.getButton() }
|
141 |
+
</div>
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
ReadMore.propTypes = {
|
147 |
+
children: PropTypes.node.isRequired,
|
148 |
+
maxLines: PropTypes.number,
|
149 |
+
ellipsis: PropTypes.string,
|
150 |
+
moreText: PropTypes.string,
|
151 |
+
lessText: PropTypes.string,
|
152 |
+
className: PropTypes.string,
|
153 |
+
};
|
154 |
+
|
155 |
+
ReadMore.defaultProps = {
|
156 |
+
maxLines: 3,
|
157 |
+
ellipsis: '…',
|
158 |
+
moreText: __( 'Read more', 'woo-gutenberg-products-block' ),
|
159 |
+
lessText: __( 'Read less', 'woo-gutenberg-products-block' ),
|
160 |
+
className: 'read-more-content',
|
161 |
+
};
|
162 |
+
|
163 |
+
export default ReadMore;
|
assets/js/base/components/read-more/test/index.js
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { truncateHtml } from '../utils';
|
5 |
+
const shortContent =
|
6 |
+
'<p>Lorem ipsum dolor sit amet, <strong>consectetur.</strong>.</p>';
|
7 |
+
|
8 |
+
const longContent =
|
9 |
+
'<p>Lorem ipsum dolor sit amet, <strong>consectetur adipiscing elit. Nullam a condimentum diam.</strong> Donec finibus enim eros, et lobortis magna varius quis. Nulla lacinia tellus ac neque aliquet, in porttitor metus interdum. Maecenas vestibulum nisi et auctor vestibulum. Maecenas vehicula, lacus et pellentesque tempor, orci nulla mattis purus, id porttitor augue magna et metus. Aenean hendrerit aliquet massa ac convallis. Mauris vestibulum neque in condimentum porttitor. Donec viverra, orci a accumsan vehicula, dui massa lobortis lorem, et cursus est purus pulvinar elit. Vestibulum vitae tincidunt ex, ut vulputate nisi.</p>' +
|
10 |
+
'<p>Morbi tristique iaculis felis, sed porta urna tincidunt vitae. Etiam nisl sem, eleifend non varius quis, placerat a arcu. Donec consectetur nunc at orci fringilla pulvinar. Nam hendrerit tellus in est aliquet varius id in diam. Donec eu ullamcorper ante. Ut ultricies, felis vel sodales aliquet, nibh massa vestibulum ipsum, sed dignissim mi nunc eget lacus. Curabitur mattis placerat magna a aliquam. Nullam diam elit, cursus nec erat ullamcorper, tempor eleifend mauris. Nunc placerat nunc ut enim ornare tempus. Fusce porta molestie ante eget faucibus. Fusce eu lectus sit amet diam auctor lacinia et in diam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris eu lacus lobortis, faucibus est vel, pulvinar odio. Duis feugiat tortor quis dui euismod varius.</p>';
|
11 |
+
|
12 |
+
describe( 'ReadMore Component', () => {
|
13 |
+
describe( 'Test the truncateHtml function', () => {
|
14 |
+
it( 'Truncate long HTML content to length of 10', async () => {
|
15 |
+
const truncatedContent = truncateHtml( longContent, 10 );
|
16 |
+
|
17 |
+
expect( truncatedContent ).toEqual( '<p>Lorem ipsum...</p>' );
|
18 |
+
} );
|
19 |
+
it( 'Truncate long HTML content, but avoid cutting off HTML tags.', async () => {
|
20 |
+
const truncatedContent = truncateHtml( longContent, 40 );
|
21 |
+
|
22 |
+
expect( truncatedContent ).toEqual( '<p>Lorem ipsum dolor sit amet, <strong>consectetur...</strong></p>' );
|
23 |
+
} );
|
24 |
+
it( 'No need to truncate short HTML content.', async () => {
|
25 |
+
const truncatedContent = truncateHtml( shortContent, 100 );
|
26 |
+
|
27 |
+
expect( truncatedContent ).toEqual( '<p>Lorem ipsum dolor sit amet, <strong>consectetur.</strong>.</p>' );
|
28 |
+
} );
|
29 |
+
} );
|
30 |
+
} );
|
assets/js/base/components/read-more/utils.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import trimHtml from 'trim-html';
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Truncate some HTML content to a given length.
|
5 |
+
*
|
6 |
+
* @param {string} html HTML that will be truncated.
|
7 |
+
* @param {int} length Legth to truncate the string to.
|
8 |
+
* @param {string} ellipsis Character to append to truncated content.
|
9 |
+
*/
|
10 |
+
export const truncateHtml = ( html, length, ellipsis = '...' ) => {
|
11 |
+
const trimmed = trimHtml( html, {
|
12 |
+
suffix: ellipsis,
|
13 |
+
limit: length,
|
14 |
+
} );
|
15 |
+
|
16 |
+
return trimmed.html;
|
17 |
+
};
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Clamp lines calculates the height of a line of text and then limits it to the
|
21 |
+
* value of the lines prop. Content is updated once limited.
|
22 |
+
*
|
23 |
+
* @param {string} originalContent Content to be clamped.
|
24 |
+
* @param {object} targetElement Element which will contain the clamped content.
|
25 |
+
* @param {integer} maxHeight Max height of the clamped content.
|
26 |
+
* @param {string} ellipsis Character to append to clamped content.
|
27 |
+
* @return {string} clamped content
|
28 |
+
*/
|
29 |
+
export const clampLines = ( originalContent, targetElement, maxHeight, ellipsis ) => {
|
30 |
+
const length = calculateLength( originalContent, targetElement, maxHeight );
|
31 |
+
|
32 |
+
return truncateHtml( originalContent, length - ellipsis.length, ellipsis );
|
33 |
+
};
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Calculate how long the content can be based on the maximum number of lines allowed, and client height.
|
37 |
+
*
|
38 |
+
* @param {string} originalContent Content to be clamped.
|
39 |
+
* @param {object} targetElement Element which will contain the clamped content.
|
40 |
+
* @param {integer} maxHeight Max height of the clamped content.
|
41 |
+
*/
|
42 |
+
const calculateLength = ( originalContent, targetElement, maxHeight ) => {
|
43 |
+
let markers = {
|
44 |
+
start: 0,
|
45 |
+
middle: 0,
|
46 |
+
end: originalContent.length,
|
47 |
+
};
|
48 |
+
|
49 |
+
while ( markers.start <= markers.end ) {
|
50 |
+
markers.middle = Math.floor( ( markers.start + markers.end ) / 2 );
|
51 |
+
|
52 |
+
// We set the innerHTML directly in the DOM here so we can reliably check the clientHeight later in moveMarkers.
|
53 |
+
targetElement.innerHTML = truncateHtml( originalContent, markers.middle );
|
54 |
+
|
55 |
+
markers = moveMarkers( markers, targetElement.clientHeight, maxHeight );
|
56 |
+
}
|
57 |
+
|
58 |
+
return markers.middle;
|
59 |
+
};
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Move string markers. Used by calculateLength.
|
63 |
+
*
|
64 |
+
* @param {object} markers Markers for clamped content.
|
65 |
+
* @param {integer} currentHeight Current height of clamped content.
|
66 |
+
* @param {integer} maxHeight Max height of the clamped content.
|
67 |
+
*/
|
68 |
+
const moveMarkers = ( markers, currentHeight, maxHeight ) => {
|
69 |
+
if ( currentHeight <= maxHeight ) {
|
70 |
+
markers.start = markers.middle + 1;
|
71 |
+
} else {
|
72 |
+
markers.end = markers.middle - 1;
|
73 |
+
}
|
74 |
+
|
75 |
+
return markers;
|
76 |
+
};
|
assets/js/base/components/review-list-item/index.js
ADDED
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, sprintf } from '@wordpress/i18n';
|
5 |
+
import PropTypes from 'prop-types';
|
6 |
+
import classNames from 'classnames';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Internal dependencies
|
10 |
+
*/
|
11 |
+
import ReadMore from '../read-more';
|
12 |
+
import './style.scss';
|
13 |
+
|
14 |
+
function getReviewImage( review, imageType, isLoading ) {
|
15 |
+
if ( isLoading || ! review ) {
|
16 |
+
return (
|
17 |
+
<div className="wc-block-review-list-item__image" width="48" height="48" />
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
return (
|
22 |
+
<div className="wc-block-review-list-item__image">
|
23 |
+
{ imageType === 'product' ? (
|
24 |
+
<img aria-hidden="true" alt="" src={ review.product_picture || '' } className="wc-block-review-list-item__image" width="48" height="48" />
|
25 |
+
) : (
|
26 |
+
<img aria-hidden="true" alt="" src={ review.reviewer_avatar_urls[ '48' ] || '' } srcSet={ review.reviewer_avatar_urls[ '96' ] + ' 2x' } className="wc-block-review-list-item__image" width="48" height="48" />
|
27 |
+
) }
|
28 |
+
{ review.verified && (
|
29 |
+
<div className="wc-block-review-list-item__verified" title={ __( 'Verified buyer', 'woo-gutenberg-products-block' ) }>{ __( 'Verified buyer', 'woo-gutenberg-products-block' ) }</div>
|
30 |
+
) }
|
31 |
+
</div>
|
32 |
+
);
|
33 |
+
}
|
34 |
+
|
35 |
+
function getReviewContent( review ) {
|
36 |
+
return (
|
37 |
+
<ReadMore
|
38 |
+
maxLines={ 10 }
|
39 |
+
moreText={ __( 'Read full review', 'woo-gutenberg-products-block' ) }
|
40 |
+
lessText={ __( 'Hide full review', 'woo-gutenberg-products-block' ) }
|
41 |
+
className="wc-block-review-list-item__text"
|
42 |
+
>
|
43 |
+
<div
|
44 |
+
dangerouslySetInnerHTML={ {
|
45 |
+
// `content` is the `review` parameter returned by the `reviews` endpoint.
|
46 |
+
// It's filtered with `wp_filter_post_kses()`, which removes dangerous HTML tags,
|
47 |
+
// so using it inside `dangerouslySetInnerHTML` is safe.
|
48 |
+
__html: review.review || '',
|
49 |
+
} }
|
50 |
+
/>
|
51 |
+
</ReadMore>
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
function getReviewProductName( review ) {
|
56 |
+
return (
|
57 |
+
<div className="wc-block-review-list-item__product">
|
58 |
+
<a href={ review.product_permalink }>
|
59 |
+
{ review.product_name }
|
60 |
+
</a>
|
61 |
+
</div>
|
62 |
+
);
|
63 |
+
}
|
64 |
+
|
65 |
+
function getReviewerName( review ) {
|
66 |
+
const { reviewer = '' } = review;
|
67 |
+
return (
|
68 |
+
<div className="wc-block-review-list-item__author">
|
69 |
+
{ reviewer }
|
70 |
+
</div>
|
71 |
+
);
|
72 |
+
}
|
73 |
+
|
74 |
+
function getReviewDate( review ) {
|
75 |
+
const { date_created: dateCreated, formatted_date_created: formattedDateCreated } = review;
|
76 |
+
return (
|
77 |
+
<time className="wc-block-review-list-item__published-date" dateTime={ dateCreated }>
|
78 |
+
{ formattedDateCreated }
|
79 |
+
</time>
|
80 |
+
);
|
81 |
+
}
|
82 |
+
|
83 |
+
function getReviewRating( review ) {
|
84 |
+
const { rating } = review;
|
85 |
+
const starStyle = {
|
86 |
+
width: ( rating / 5 * 100 ) + '%', /* stylelint-disable-line */
|
87 |
+
};
|
88 |
+
return (
|
89 |
+
<div className="wc-block-review-list-item__rating">
|
90 |
+
<div className="wc-block-review-list-item__rating__stars" role="img">
|
91 |
+
<span style={ starStyle }>{ sprintf( __( 'Rated %d out of 5', 'woo-gutenberg-products-block' ), rating ) }</span>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
);
|
95 |
+
}
|
96 |
+
|
97 |
+
const ReviewListItem = ( { attributes, review = {} } ) => {
|
98 |
+
const { imageType, showReviewDate, showReviewerName, showReviewImage, showReviewRating: showReviewRatingAttr, showReviewContent, showProductName } = attributes;
|
99 |
+
const { rating } = review;
|
100 |
+
const isLoading = ! Object.keys( review ).length > 0;
|
101 |
+
const showReviewRating = Number.isFinite( rating ) && showReviewRatingAttr;
|
102 |
+
|
103 |
+
return (
|
104 |
+
<li
|
105 |
+
className={ classNames( 'wc-block-review-list-item__item', { 'is-loading': isLoading } ) }
|
106 |
+
aria-hidden={ isLoading }
|
107 |
+
>
|
108 |
+
{ ( showProductName || showReviewDate || showReviewerName || showReviewImage || showReviewRating ) && (
|
109 |
+
<div className="wc-block-review-list-item__info">
|
110 |
+
{ showReviewImage && getReviewImage( review, imageType, isLoading ) }
|
111 |
+
{ ( showProductName || showReviewerName || showReviewRating || showReviewDate ) && (
|
112 |
+
<div className="wc-block-review-list-item__meta">
|
113 |
+
{ showReviewRating && getReviewRating( review ) }
|
114 |
+
{ showProductName && getReviewProductName( review ) }
|
115 |
+
{ showReviewerName && getReviewerName( review ) }
|
116 |
+
{ showReviewDate && getReviewDate( review ) }
|
117 |
+
</div>
|
118 |
+
) }
|
119 |
+
</div>
|
120 |
+
) }
|
121 |
+
{ showReviewContent && getReviewContent( review ) }
|
122 |
+
</li>
|
123 |
+
);
|
124 |
+
};
|
125 |
+
|
126 |
+
ReviewListItem.propTypes = {
|
127 |
+
attributes: PropTypes.object.isRequired,
|
128 |
+
review: PropTypes.object,
|
129 |
+
};
|
130 |
+
|
131 |
+
export default ReviewListItem;
|
assets/js/base/components/review-list-item/style.scss
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.is-loading {
|
2 |
+
.wc-block-review-list-item__text {
|
3 |
+
@include placeholder();
|
4 |
+
display: block;
|
5 |
+
width: 60%;
|
6 |
+
}
|
7 |
+
|
8 |
+
.wc-block-review-list-item__info {
|
9 |
+
.wc-block-review-list-item__image {
|
10 |
+
@include placeholder();
|
11 |
+
}
|
12 |
+
|
13 |
+
.wc-block-review-list-item__meta {
|
14 |
+
.wc-block-review-list-item__author {
|
15 |
+
@include placeholder();
|
16 |
+
font-size: 1em;
|
17 |
+
width: 80px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.wc-block-review-list-item__product {
|
21 |
+
display: none;
|
22 |
+
}
|
23 |
+
|
24 |
+
.wc-block-review-list-item__rating {
|
25 |
+
.wc-block-review-list-item__rating__stars > span {
|
26 |
+
display: none;
|
27 |
+
}
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
.wc-block-review-list-item__published-date {
|
32 |
+
@include placeholder();
|
33 |
+
height: 1em;
|
34 |
+
width: 120px;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
.editor-styles-wrapper .wc-block-review-list-item__item,
|
40 |
+
.wc-block-review-list-item__item {
|
41 |
+
margin: 0 0 $gap-large * 2;
|
42 |
+
list-style: none;
|
43 |
+
}
|
44 |
+
|
45 |
+
.wc-block-review-list-item__info {
|
46 |
+
display: grid;
|
47 |
+
grid-template-columns: 1fr;
|
48 |
+
margin-bottom: $gap-large;
|
49 |
+
}
|
50 |
+
|
51 |
+
.wc-block-review-list-item__meta {
|
52 |
+
grid-column: 1;
|
53 |
+
grid-row: 1;
|
54 |
+
}
|
55 |
+
|
56 |
+
.has-image {
|
57 |
+
.wc-block-review-list-item__info {
|
58 |
+
grid-template-columns: #{48px + $gap} 1fr;
|
59 |
+
}
|
60 |
+
.wc-block-review-list-item__meta {
|
61 |
+
grid-column: 2;
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
.wc-block-review-list-item__image {
|
66 |
+
height: 48px;
|
67 |
+
grid-column: 1;
|
68 |
+
grid-row: 1 / 3;
|
69 |
+
width: 48px;
|
70 |
+
position: relative;
|
71 |
+
|
72 |
+
img {
|
73 |
+
width: 100%;
|
74 |
+
height: 100%;
|
75 |
+
display: block;
|
76 |
+
}
|
77 |
+
}
|
78 |
+
|
79 |
+
.wc-block-review-list-item__verified {
|
80 |
+
width: 21px;
|
81 |
+
height: 21px;
|
82 |
+
text-indent: 21px;
|
83 |
+
margin: 0;
|
84 |
+
line-height: 21px;
|
85 |
+
overflow: hidden;
|
86 |
+
position: absolute;
|
87 |
+
right: -7px;
|
88 |
+
bottom: -7px;
|
89 |
+
|
90 |
+
&::before {
|
91 |
+
width: 21px;
|
92 |
+
height: 21px;
|
93 |
+
background: transparent url('data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="21" height="21" fill="none"%3E%3Ccircle cx="10.5" cy="10.5" r="10.5" fill="%23fff"/%3E%3Cpath fill="%23008A21" fill-rule="evenodd" d="M2.1667 10.5003c0-4.6 3.7333-8.3333 8.3333-8.3333s8.3334 3.7333 8.3334 8.3333S15.1 18.8337 10.5 18.8337s-8.3333-3.7334-8.3333-8.3334zm2.5 0l4.1666 4.1667 7.5001-7.5-1.175-1.1833-6.325 6.325-2.9917-2.9834-1.175 1.175z" clip-rule="evenodd"/%3E%3Cmask id="a" width="17" height="17" x="2" y="2" maskUnits="userSpaceOnUse"%3E%3Cpath fill="%23fff" fill-rule="evenodd" d="M2.1667 10.5003c0-4.6 3.7333-8.3333 8.3333-8.3333s8.3334 3.7333 8.3334 8.3333S15.1 18.8337 10.5 18.8337s-8.3333-3.7334-8.3333-8.3334zm2.5 0l4.1666 4.1667 7.5001-7.5-1.175-1.1833-6.325 6.325-2.9917-2.9834-1.175 1.175z" clip-rule="evenodd"/%3E%3C/mask%3E%3Cg mask="url(%23a)"%3E%3Cpath fill="%23008A21" d="M.5.5h20v20H.5z"/%3E%3C/g%3E%3C/svg%3E') center center no-repeat; /* stylelint-disable-line */
|
94 |
+
display: block;
|
95 |
+
content: "";
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
.wc-block-review-list-item__meta {
|
100 |
+
display: flex;
|
101 |
+
align-items: center;
|
102 |
+
flex-flow: row wrap;
|
103 |
+
|
104 |
+
&::after {
|
105 |
+
// Force wrap after star rating.
|
106 |
+
order: 3;
|
107 |
+
content: "";
|
108 |
+
flex-basis: 100%;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
.wc-block-review-list-item__product {
|
113 |
+
display: block;
|
114 |
+
font-weight: bold;
|
115 |
+
order: 1;
|
116 |
+
margin-right: $gap/2;
|
117 |
+
}
|
118 |
+
|
119 |
+
.wc-block-review-list-item__author {
|
120 |
+
display: block;
|
121 |
+
font-weight: bold;
|
122 |
+
order: 1;
|
123 |
+
margin-right: $gap/2;
|
124 |
+
}
|
125 |
+
|
126 |
+
.wc-block-review-list-item__product + .wc-block-review-list-item__author {
|
127 |
+
font-weight: normal;
|
128 |
+
color: #808080;
|
129 |
+
order: 4;
|
130 |
+
}
|
131 |
+
|
132 |
+
.wc-block-review-list-item__published-date {
|
133 |
+
color: #808080;
|
134 |
+
order: 5;
|
135 |
+
}
|
136 |
+
|
137 |
+
.wc-block-review-list-item__author + .wc-block-review-list-item__published-date {
|
138 |
+
&::before {
|
139 |
+
content: "";
|
140 |
+
display: inline-block;
|
141 |
+
margin-right: $gap/2;
|
142 |
+
border-right: 1px solid #ddd;
|
143 |
+
height: 1em;
|
144 |
+
vertical-align: middle;
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
.wc-block-review-list-item__author:first-child + .wc-block-review-list-item__published-date,
|
149 |
+
.wc-block-review-list-item__rating + .wc-block-review-list-item__author + .wc-block-review-list-item__published-date {
|
150 |
+
&::before {
|
151 |
+
display: none;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
.wc-block-review-list-item__rating {
|
156 |
+
order: 2;
|
157 |
+
|
158 |
+
> .wc-block-review-list-item__rating__stars {
|
159 |
+
display: inline-block;
|
160 |
+
top: 0;
|
161 |
+
overflow: hidden;
|
162 |
+
position: relative;
|
163 |
+
height: 1.618em;
|
164 |
+
line-height: 1.618;
|
165 |
+
font-size: 1em;
|
166 |
+
width: 5.3em;
|
167 |
+
font-family: star; /* stylelint-disable-line */
|
168 |
+
font-weight: 400;
|
169 |
+
vertical-align: top;
|
170 |
+
}
|
171 |
+
|
172 |
+
> .wc-block-review-list-item__rating__stars::before {
|
173 |
+
content: "\53\53\53\53\53";
|
174 |
+
opacity: 0.25;
|
175 |
+
float: left;
|
176 |
+
top: 0;
|
177 |
+
left: 0;
|
178 |
+
position: absolute;
|
179 |
+
}
|
180 |
+
|
181 |
+
> .wc-block-review-list-item__rating__stars span {
|
182 |
+
overflow: hidden;
|
183 |
+
float: left;
|
184 |
+
top: 0;
|
185 |
+
left: 0;
|
186 |
+
position: absolute;
|
187 |
+
padding-top: 1.5em;
|
188 |
+
}
|
189 |
+
|
190 |
+
> .wc-block-review-list-item__rating__stars span::before {
|
191 |
+
content: "\53\53\53\53\53";
|
192 |
+
top: 0;
|
193 |
+
position: absolute;
|
194 |
+
left: 0;
|
195 |
+
color: #e6a237;
|
196 |
+
}
|
197 |
+
}
|
assets/js/base/components/review-list/index.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import PropTypes from 'prop-types';
|
5 |
+
import { ENABLE_REVIEW_RATING, SHOW_AVATARS } from '@woocommerce/block-settings';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import ReviewListItem from '../review-list-item';
|
11 |
+
import './style.scss';
|
12 |
+
|
13 |
+
const ReviewList = ( { attributes, reviews } ) => {
|
14 |
+
const showReviewImage = ( SHOW_AVATARS || attributes.imageType === 'product' ) && attributes.showReviewImage;
|
15 |
+
const showReviewRating = ENABLE_REVIEW_RATING && attributes.showReviewRating;
|
16 |
+
const attrs = {
|
17 |
+
...attributes,
|
18 |
+
showReviewImage,
|
19 |
+
showReviewRating,
|
20 |
+
};
|
21 |
+
|
22 |
+
return (
|
23 |
+
<ul className="wc-block-review-list">
|
24 |
+
{ reviews.length === 0 ?
|
25 |
+
(
|
26 |
+
<ReviewListItem attributes={ attrs } />
|
27 |
+
) : (
|
28 |
+
reviews.map( ( review, i ) => (
|
29 |
+
<ReviewListItem key={ review.id || i } attributes={ attrs } review={ review } />
|
30 |
+
) )
|
31 |
+
)
|
32 |
+
}
|
33 |
+
</ul>
|
34 |
+
);
|
35 |
+
};
|
36 |
+
|
37 |
+
ReviewList.propTypes = {
|
38 |
+
attributes: PropTypes.object.isRequired,
|
39 |
+
reviews: PropTypes.array.isRequired,
|
40 |
+
};
|
41 |
+
|
42 |
+
export default ReviewList;
|
assets/js/base/components/review-list/style.scss
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-review-list,
|
2 |
+
.editor-styles .wc-block-review-list {
|
3 |
+
margin: 0;
|
4 |
+
}
|
assets/js/base/components/review-order-select/index.js
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import PropTypes from 'prop-types';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import OrderSelect from '../order-select';
|
11 |
+
import './style.scss';
|
12 |
+
|
13 |
+
const ReviewOrderSelect = ( { defaultValue, onChange, readOnly, value } ) => {
|
14 |
+
return (
|
15 |
+
<OrderSelect
|
16 |
+
className="wc-block-review-order-select"
|
17 |
+
defaultValue={ defaultValue }
|
18 |
+
label={ __( 'Order by', 'woo-gutenberg-products-block' ) }
|
19 |
+
onChange={ onChange }
|
20 |
+
options={ [
|
21 |
+
{ key: 'most-recent', label: __( 'Most recent', 'woo-gutenberg-products-block' ) },
|
22 |
+
{ key: 'highest-rating', label: __( 'Highest rating', 'woo-gutenberg-products-block' ) },
|
23 |
+
{ key: 'lowest-rating', label: __( 'Lowest rating', 'woo-gutenberg-products-block' ) },
|
24 |
+
] }
|
25 |
+
readOnly={ readOnly }
|
26 |
+
screenReaderLabel={ __( 'Order reviews by', 'woo-gutenberg-products-block' ) }
|
27 |
+
value={ value }
|
28 |
+
/>
|
29 |
+
);
|
30 |
+
};
|
31 |
+
|
32 |
+
ReviewOrderSelect.propTypes = {
|
33 |
+
defaultValue: PropTypes.oneOf( [ 'most-recent', 'highest-rating', 'lowest-rating' ] ),
|
34 |
+
onChange: PropTypes.func,
|
35 |
+
readOnly: PropTypes.bool,
|
36 |
+
value: PropTypes.oneOf( [ 'most-recent', 'highest-rating', 'lowest-rating' ] ),
|
37 |
+
};
|
38 |
+
|
39 |
+
export default ReviewOrderSelect;
|
assets/js/base/components/review-order-select/style.scss
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
.wc-block-review-order-select {
|
2 |
+
text-align: right;
|
3 |
+
}
|
assets/js/base/hocs/test/with-reviews.js
ADDED
@@ -0,0 +1,129 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import withReviews from '../with-reviews';
|
10 |
+
import * as mockUtils from '../../../blocks/reviews/utils';
|
11 |
+
|
12 |
+
jest.mock( '../../../blocks/reviews/utils', () => ( {
|
13 |
+
getOrderArgs: () => ( {
|
14 |
+
order: 'desc',
|
15 |
+
orderby: 'date_gmt',
|
16 |
+
} ),
|
17 |
+
getReviews: jest.fn(),
|
18 |
+
} ) );
|
19 |
+
|
20 |
+
const mockReviews = [
|
21 |
+
{ reviewer: 'Alice', review: 'Lorem ipsum', rating: 2 },
|
22 |
+
{ reviewer: 'Bob', review: 'Dolor sit amet', rating: 3 },
|
23 |
+
{ reviewer: 'Carol', review: 'Consectetur adipiscing elit', rating: 5 },
|
24 |
+
];
|
25 |
+
const defaultArgs = {
|
26 |
+
offset: 0,
|
27 |
+
order: 'desc',
|
28 |
+
orderby: 'date_gmt',
|
29 |
+
per_page: 2,
|
30 |
+
product_id: 1,
|
31 |
+
};
|
32 |
+
const TestComponent = withReviews( ( props ) => {
|
33 |
+
return <div
|
34 |
+
error={ props.error }
|
35 |
+
getReviews={ props.getReviews }
|
36 |
+
appendReviews={ props.appendReviews }
|
37 |
+
onChangeArgs={ props.onChangeArgs }
|
38 |
+
isLoading={ props.isLoading }
|
39 |
+
reviews={ props.reviews }
|
40 |
+
totalReviews={ props.totalReviews }
|
41 |
+
/>;
|
42 |
+
} );
|
43 |
+
const render = () => {
|
44 |
+
return TestRenderer.create(
|
45 |
+
<TestComponent
|
46 |
+
order="desc"
|
47 |
+
orderby="date_gmt"
|
48 |
+
productId={ 1 }
|
49 |
+
reviewsToDisplay={ 2 }
|
50 |
+
/>
|
51 |
+
);
|
52 |
+
};
|
53 |
+
|
54 |
+
describe( 'withReviews Component', () => {
|
55 |
+
let renderer;
|
56 |
+
afterEach( () => {
|
57 |
+
mockUtils.getReviews.mockReset();
|
58 |
+
} );
|
59 |
+
|
60 |
+
describe( 'lifecycle events', () => {
|
61 |
+
beforeEach( () => {
|
62 |
+
mockUtils.getReviews.mockImplementationOnce(
|
63 |
+
() => Promise.resolve( { reviews: mockReviews.slice( 0, 2 ), totalReviews: mockReviews.length } )
|
64 |
+
).mockImplementationOnce(
|
65 |
+
() => Promise.resolve( { reviews: mockReviews.slice( 2, 3 ), totalReviews: mockReviews.length } )
|
66 |
+
);
|
67 |
+
renderer = render();
|
68 |
+
} );
|
69 |
+
|
70 |
+
it( 'getReviews is called on mount with default args', () => {
|
71 |
+
const { getReviews } = mockUtils;
|
72 |
+
|
73 |
+
expect( getReviews ).toHaveBeenCalledWith( defaultArgs );
|
74 |
+
expect( getReviews ).toHaveBeenCalledTimes( 1 );
|
75 |
+
} );
|
76 |
+
|
77 |
+
it( 'getReviews is called on component update', () => {
|
78 |
+
const { getReviews } = mockUtils;
|
79 |
+
renderer.update(
|
80 |
+
<TestComponent
|
81 |
+
order="desc"
|
82 |
+
orderby="date_gmt"
|
83 |
+
productId={ 1 }
|
84 |
+
reviewsToDisplay={ 3 }
|
85 |
+
/>
|
86 |
+
);
|
87 |
+
|
88 |
+
expect( getReviews ).toHaveBeenNthCalledWith( 2, { ...defaultArgs, offset: 2, per_page: 1 } );
|
89 |
+
expect( getReviews ).toHaveBeenCalledTimes( 2 );
|
90 |
+
} );
|
91 |
+
} );
|
92 |
+
|
93 |
+
describe( 'when the API returns product data', () => {
|
94 |
+
beforeEach( () => {
|
95 |
+
mockUtils.getReviews.mockImplementation(
|
96 |
+
() => Promise.resolve( { reviews: mockReviews.slice( 0, 2 ), totalReviews: mockReviews.length } )
|
97 |
+
);
|
98 |
+
renderer = render();
|
99 |
+
} );
|
100 |
+
|
101 |
+
it( 'sets reviews based on API response', () => {
|
102 |
+
const props = renderer.root.findByType( 'div' ).props;
|
103 |
+
|
104 |
+
expect( props.error ).toBeNull();
|
105 |
+
expect( props.isLoading ).toBe( false );
|
106 |
+
expect( props.reviews ).toEqual( mockReviews.slice( 0, 2 ) );
|
107 |
+
expect( props.totalReviews ).toEqual( mockReviews.length );
|
108 |
+
} );
|
109 |
+
} );
|
110 |
+
|
111 |
+
describe( 'when the API returns an error', () => {
|
112 |
+
beforeEach( () => {
|
113 |
+
mockUtils.getReviews.mockImplementation(
|
114 |
+
() => Promise.reject( {
|
115 |
+
json: () => Promise.resolve( { message: 'There was an error.' } ),
|
116 |
+
} )
|
117 |
+
);
|
118 |
+
renderer = render();
|
119 |
+
} );
|
120 |
+
|
121 |
+
it( 'sets the error prop', () => {
|
122 |
+
const props = renderer.root.findByType( 'div' ).props;
|
123 |
+
|
124 |
+
expect( props.error ).toEqual( { apiMessage: 'There was an error.' } );
|
125 |
+
expect( props.isLoading ).toBe( false );
|
126 |
+
expect( props.reviews ).toEqual( [] );
|
127 |
+
} );
|
128 |
+
} );
|
129 |
+
} );
|
assets/js/{utils → base/hocs}/with-component-id.js
RENAMED
File without changes
|
assets/js/base/hocs/with-reviews.js
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Component } from 'react';
|
5 |
+
import PropTypes from 'prop-types';
|
6 |
+
import isShallowEqual from '@wordpress/is-shallow-equal';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Internal dependencies
|
10 |
+
*/
|
11 |
+
import { getReviews } from '../../blocks/reviews/utils';
|
12 |
+
|
13 |
+
const withReviews = ( OriginalComponent ) => {
|
14 |
+
class WrappedComponent extends Component {
|
15 |
+
constructor() {
|
16 |
+
super( ...arguments );
|
17 |
+
|
18 |
+
this.state = {
|
19 |
+
error: null,
|
20 |
+
loading: true,
|
21 |
+
reviews: [],
|
22 |
+
totalReviews: 0,
|
23 |
+
};
|
24 |
+
|
25 |
+
this.setError = this.setError.bind( this );
|
26 |
+
this.delayedAppendReviews = this.props.delayFunction( this.appendReviews );
|
27 |
+
}
|
28 |
+
|
29 |
+
componentDidMount() {
|
30 |
+
this.replaceReviews();
|
31 |
+
}
|
32 |
+
|
33 |
+
componentDidUpdate( prevProps ) {
|
34 |
+
if ( prevProps.reviewsToDisplay < this.props.reviewsToDisplay ) {
|
35 |
+
// Since this attribute might be controlled via something with
|
36 |
+
// short intervals between value changes, this allows for optionally
|
37 |
+
// delaying review fetches via the provided delay function.
|
38 |
+
this.delayedAppendReviews();
|
39 |
+
} else if (
|
40 |
+
this.shouldReplaceReviews( prevProps, this.props )
|
41 |
+
) {
|
42 |
+
this.replaceReviews();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
shouldReplaceReviews( prevProps, nextProps ) {
|
47 |
+
return (
|
48 |
+
prevProps.orderby !== nextProps.orderby ||
|
49 |
+
prevProps.order !== nextProps.order ||
|
50 |
+
prevProps.productId !== nextProps.productId ||
|
51 |
+
! isShallowEqual( prevProps.categoryIds, nextProps.categoryIds )
|
52 |
+
);
|
53 |
+
}
|
54 |
+
|
55 |
+
componentWillUnMount() {
|
56 |
+
if ( this.delayedAppendReviews.cancel ) {
|
57 |
+
this.delayedAppendReviews.cancel();
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
getArgs( reviewsToSkip ) {
|
62 |
+
const { categoryIds, order, orderby, productId, reviewsToDisplay } = this.props;
|
63 |
+
const args = {
|
64 |
+
order,
|
65 |
+
orderby,
|
66 |
+
per_page: reviewsToDisplay - reviewsToSkip,
|
67 |
+
offset: reviewsToSkip,
|
68 |
+
};
|
69 |
+
|
70 |
+
if ( categoryIds && categoryIds.length ) {
|
71 |
+
args.category_id = Array.isArray( categoryIds ) ? categoryIds.join( ',' ) : categoryIds;
|
72 |
+
}
|
73 |
+
|
74 |
+
if ( productId ) {
|
75 |
+
args.product_id = productId;
|
76 |
+
}
|
77 |
+
|
78 |
+
return args;
|
79 |
+
}
|
80 |
+
|
81 |
+
replaceReviews() {
|
82 |
+
const { onReviewsReplaced } = this.props;
|
83 |
+
|
84 |
+
this.updateListOfReviews().then( onReviewsReplaced );
|
85 |
+
}
|
86 |
+
|
87 |
+
appendReviews() {
|
88 |
+
const { onReviewsAppended, reviewsToDisplay } = this.props;
|
89 |
+
const { reviews } = this.state;
|
90 |
+
|
91 |
+
// Given that this function is delayed, props might have been updated since
|
92 |
+
// it was called so we need to check again if fetching new reviews is necessary.
|
93 |
+
if ( reviewsToDisplay <= reviews.length ) {
|
94 |
+
return;
|
95 |
+
}
|
96 |
+
|
97 |
+
this.updateListOfReviews( reviews ).then( onReviewsAppended );
|
98 |
+
}
|
99 |
+
|
100 |
+
updateListOfReviews( oldReviews = [] ) {
|
101 |
+
const { reviewsToDisplay } = this.props;
|
102 |
+
const { totalReviews } = this.state;
|
103 |
+
const reviewsToLoad = Math.min( totalReviews, reviewsToDisplay ) - oldReviews.length;
|
104 |
+
|
105 |
+
this.setState( {
|
106 |
+
loading: true,
|
107 |
+
reviews: oldReviews.concat( Array( reviewsToLoad ).fill( {} ) ),
|
108 |
+
} );
|
109 |
+
|
110 |
+
return getReviews( this.getArgs( oldReviews.length ) )
|
111 |
+
.then( ( { reviews: newReviews, totalReviews: newTotalReviews } ) => {
|
112 |
+
this.setState( {
|
113 |
+
reviews: oldReviews.filter( ( review ) => Object.keys( review ).length ).concat( newReviews ),
|
114 |
+
totalReviews: newTotalReviews,
|
115 |
+
loading: false,
|
116 |
+
error: null,
|
117 |
+
} );
|
118 |
+
|
119 |
+
return { newReviews };
|
120 |
+
} )
|
121 |
+
.catch( this.setError );
|
122 |
+
}
|
123 |
+
|
124 |
+
setError( errorResponse ) {
|
125 |
+
errorResponse.json().then( ( apiError ) => {
|
126 |
+
const { onReviewsLoadError } = this.props;
|
127 |
+
const error = typeof apiError === 'object' && apiError.hasOwnProperty( 'message' ) ? {
|
128 |
+
apiMessage: apiError.message,
|
129 |
+
} : {
|
130 |
+
apiMessage: null,
|
131 |
+
};
|
132 |
+
|
133 |
+
this.setState( { reviews: [], loading: false, error } );
|
134 |
+
|
135 |
+
onReviewsLoadError();
|
136 |
+
} );
|
137 |
+
}
|
138 |
+
|
139 |
+
render() {
|
140 |
+
const { reviewsToDisplay } = this.props;
|
141 |
+
const { error, loading, reviews, totalReviews } = this.state;
|
142 |
+
|
143 |
+
return <OriginalComponent
|
144 |
+
{ ...this.props }
|
145 |
+
error={ error }
|
146 |
+
isLoading={ loading }
|
147 |
+
reviews={ reviews.slice( 0, reviewsToDisplay ) }
|
148 |
+
totalReviews={ totalReviews }
|
149 |
+
/>;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
|
153 |
+
WrappedComponent.propTypes = {
|
154 |
+
order: PropTypes.oneOf( [ 'asc', 'desc' ] ).isRequired,
|
155 |
+
orderby: PropTypes.string.isRequired,
|
156 |
+
reviewsToDisplay: PropTypes.number.isRequired,
|
157 |
+
categoryIds: PropTypes.oneOfType( [ PropTypes.string, PropTypes.array ] ),
|
158 |
+
delayFunction: PropTypes.func,
|
159 |
+
onReviewsAppended: PropTypes.func,
|
160 |
+
onReviewsLoadError: PropTypes.func,
|
161 |
+
onReviewsReplaced: PropTypes.func,
|
162 |
+
productId: PropTypes.oneOfType( [ PropTypes.string, PropTypes.number ] ),
|
163 |
+
};
|
164 |
+
|
165 |
+
WrappedComponent.defaultProps = {
|
166 |
+
delayFunction: ( f ) => f,
|
167 |
+
onReviewsAppended: () => {},
|
168 |
+
onReviewsLoadError: () => {},
|
169 |
+
onReviewsReplaced: () => {},
|
170 |
+
};
|
171 |
+
|
172 |
+
const { displayName = OriginalComponent.name || 'Component' } = OriginalComponent;
|
173 |
+
WrappedComponent.displayName = `WithReviews( ${ displayName } )`;
|
174 |
+
|
175 |
+
return WrappedComponent;
|
176 |
+
};
|
177 |
+
|
178 |
+
export default withReviews;
|
assets/js/blocks/featured-category/block.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
-
import apiFetch from '@wordpress/api-fetch';
|
6 |
import {
|
7 |
AlignmentToolbar,
|
8 |
BlockControls,
|
@@ -27,125 +26,77 @@ import {
|
|
27 |
withSpokenMessages,
|
28 |
} from '@wordpress/components';
|
29 |
import classnames from 'classnames';
|
30 |
-
import {
|
31 |
import { compose } from '@wordpress/compose';
|
32 |
-
import { debounce, isObject } from 'lodash';
|
33 |
import PropTypes from 'prop-types';
|
34 |
-
import {
|
35 |
|
36 |
/**
|
37 |
* Internal dependencies
|
38 |
*/
|
|
|
39 |
import ProductCategoryControl from '../../components/product-category-control';
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
*
|
49 |
-
* @param {object|null} category A product category object from the API.
|
50 |
-
* @return {string}
|
51 |
-
*/
|
52 |
-
function getCategoryImageSrc( category ) {
|
53 |
-
if ( isObject( category.image ) ) {
|
54 |
-
return category.image.src;
|
55 |
-
}
|
56 |
-
return '';
|
57 |
-
}
|
58 |
-
|
59 |
-
/**
|
60 |
-
* Get the attachment ID from a category object, unless null (no image).
|
61 |
-
*
|
62 |
-
* @param {object|null} category A product category object from the API.
|
63 |
-
* @return {int}
|
64 |
-
*/
|
65 |
-
function getCategoryImageID( category ) {
|
66 |
-
if ( isObject( category.image ) ) {
|
67 |
-
return category.image.id;
|
68 |
-
}
|
69 |
-
return 0;
|
70 |
-
}
|
71 |
-
|
72 |
-
/**
|
73 |
-
* Generate a style object given either a product category image from the API or URL to an image.
|
74 |
-
*
|
75 |
-
* @param {string} url An image URL.
|
76 |
-
* @return {object} A style object with a backgroundImage set (if a valid image is provided).
|
77 |
-
*/
|
78 |
-
function backgroundImageStyles( url ) {
|
79 |
-
if ( url ) {
|
80 |
-
return { backgroundImage: `url(${ url })` };
|
81 |
-
}
|
82 |
-
return {};
|
83 |
-
}
|
84 |
-
|
85 |
-
/**
|
86 |
-
* Convert the selected ratio to the correct background class.
|
87 |
-
*
|
88 |
-
* @param {number} ratio Selected opacity from 0 to 100.
|
89 |
-
* @return {string} The class name, if applicable (not used for ratio 0 or 50).
|
90 |
-
*/
|
91 |
-
function dimRatioToClass( ratio ) {
|
92 |
-
return ratio === 0 || ratio === 50 ?
|
93 |
-
null :
|
94 |
-
`has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
95 |
-
}
|
96 |
|
97 |
/**
|
98 |
* Component to handle edit mode of "Featured Category".
|
99 |
*/
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
|
|
|
|
107 |
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
componentDidMount() {
|
112 |
-
this.getCategory();
|
113 |
-
}
|
114 |
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
|
|
147 |
const url =
|
148 |
-
attributes.mediaSrc || getCategoryImageSrc(
|
149 |
const { focalPoint = { x: 0.5, y: 0.5 } } = attributes;
|
150 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
151 |
// so we need to check if it exists before using it.
|
@@ -193,10 +144,9 @@ class FeaturedCategory extends Component {
|
|
193 |
</PanelColorSettings>
|
194 |
</InspectorControls>
|
195 |
);
|
196 |
-
}
|
197 |
|
198 |
-
renderEditMode() {
|
199 |
-
const { attributes, debouncedSpeak, setAttributes } = this.props;
|
200 |
const onDone = () => {
|
201 |
setAttributes( { editMode: false } );
|
202 |
debouncedSpeak(
|
@@ -232,36 +182,32 @@ class FeaturedCategory extends Component {
|
|
232 |
</div>
|
233 |
</Placeholder>
|
234 |
);
|
235 |
-
}
|
236 |
|
237 |
-
|
238 |
-
const { attributes, isSelected, overlayColor, setAttributes } = this.props;
|
239 |
const {
|
240 |
className,
|
241 |
contentAlign,
|
242 |
dimRatio,
|
243 |
-
editMode,
|
244 |
focalPoint,
|
245 |
height,
|
246 |
showDesc,
|
247 |
} = attributes;
|
248 |
-
const { loaded, category } = this.state;
|
249 |
const classes = classnames(
|
250 |
'wc-block-featured-category',
|
251 |
{
|
252 |
'is-selected': isSelected,
|
253 |
-
'is-loading': ! category &&
|
254 |
-
'is-not-found': ! category &&
|
255 |
'has-background-dim': dimRatio !== 0,
|
256 |
},
|
257 |
dimRatioToClass( dimRatio ),
|
258 |
contentAlign !== 'center' && `has-${ contentAlign }-content`,
|
259 |
className,
|
260 |
);
|
261 |
-
const
|
262 |
-
const mediaSrc = attributes.mediaSrc || getCategoryImageSrc( this.state.category );
|
263 |
const style = !! category ?
|
264 |
-
|
265 |
{};
|
266 |
if ( overlayColor.color ) {
|
267 |
style.backgroundColor = overlayColor.color;
|
@@ -276,103 +222,88 @@ class FeaturedCategory extends Component {
|
|
276 |
};
|
277 |
|
278 |
return (
|
279 |
-
<
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
} }
|
286 |
/>
|
287 |
-
|
288 |
-
<
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
className={ classes }
|
316 |
-
size={ { height } }
|
317 |
-
minHeight={ MIN_HEIGHT }
|
318 |
-
enable={ { bottom: true } }
|
319 |
-
onResizeStop={ onResizeStop }
|
320 |
-
style={ style }
|
321 |
-
>
|
322 |
-
<div className="wc-block-featured-category__wrapper">
|
323 |
-
<h2
|
324 |
-
className="wc-block-featured-category__title"
|
325 |
-
dangerouslySetInnerHTML={ {
|
326 |
-
__html: category.name,
|
327 |
-
} }
|
328 |
-
/>
|
329 |
-
{ showDesc && (
|
330 |
-
<div
|
331 |
-
className="wc-block-featured-category__description"
|
332 |
-
dangerouslySetInnerHTML={ {
|
333 |
-
__html: category.description,
|
334 |
-
} }
|
335 |
-
/>
|
336 |
-
) }
|
337 |
-
<div className="wc-block-featured-category__link">
|
338 |
-
<InnerBlocks
|
339 |
-
template={ [
|
340 |
-
[
|
341 |
-
'core/button',
|
342 |
-
{
|
343 |
-
text: __(
|
344 |
-
'Shop now',
|
345 |
-
'woo-gutenberg-products-block'
|
346 |
-
),
|
347 |
-
url: category.permalink,
|
348 |
-
align: 'center',
|
349 |
-
},
|
350 |
-
],
|
351 |
-
] }
|
352 |
-
templateLock="all"
|
353 |
-
/>
|
354 |
-
</div>
|
355 |
-
</div>
|
356 |
-
</ResizableBox>
|
357 |
-
) : (
|
358 |
-
<Placeholder
|
359 |
-
className="wc-block-featured-category"
|
360 |
-
icon={ <IconFolderStar /> }
|
361 |
-
label={ __( 'Featured Category', 'woo-gutenberg-products-block' ) }
|
362 |
-
>
|
363 |
-
{ ! loaded ? (
|
364 |
-
<Spinner />
|
365 |
-
) : (
|
366 |
-
__( 'No product category is selected.', 'woo-gutenberg-products-block' )
|
367 |
-
) }
|
368 |
-
</Placeholder>
|
369 |
-
) }
|
370 |
-
</Fragment>
|
371 |
-
) }
|
372 |
-
</Fragment>
|
373 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
|
377 |
FeaturedCategory.propTypes = {
|
378 |
/**
|
@@ -391,6 +322,15 @@ FeaturedCategory.propTypes = {
|
|
391 |
* A callback to update attributes.
|
392 |
*/
|
393 |
setAttributes: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
// from withColors
|
395 |
overlayColor: PropTypes.object,
|
396 |
setOverlayColor: PropTypes.func.isRequired,
|
@@ -399,6 +339,7 @@ FeaturedCategory.propTypes = {
|
|
399 |
};
|
400 |
|
401 |
export default compose( [
|
|
|
402 |
withColors( { overlayColor: 'background-color' } ),
|
403 |
withSpokenMessages,
|
404 |
] )( FeaturedCategory );
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
|
|
5 |
import {
|
6 |
AlignmentToolbar,
|
7 |
BlockControls,
|
26 |
withSpokenMessages,
|
27 |
} from '@wordpress/components';
|
28 |
import classnames from 'classnames';
|
29 |
+
import { Fragment } from '@wordpress/element';
|
30 |
import { compose } from '@wordpress/compose';
|
|
|
31 |
import PropTypes from 'prop-types';
|
32 |
+
import { MIN_HEIGHT } from '@woocommerce/block-settings';
|
33 |
|
34 |
/**
|
35 |
* Internal dependencies
|
36 |
*/
|
37 |
+
import { IconFolderStar } from '../../components/icons';
|
38 |
import ProductCategoryControl from '../../components/product-category-control';
|
39 |
+
import ApiErrorPlaceholder from '../../components/api-error-placeholder';
|
40 |
+
import {
|
41 |
+
dimRatioToClass,
|
42 |
+
getBackgroundImageStyles,
|
43 |
+
getCategoryImageId,
|
44 |
+
getCategoryImageSrc,
|
45 |
+
} from './utils';
|
46 |
+
import { withCategory } from '../../hocs';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
/**
|
49 |
* Component to handle edit mode of "Featured Category".
|
50 |
*/
|
51 |
+
const FeaturedCategory = ( { attributes, isSelected, setAttributes, error, getCategory, isLoading, category, overlayColor, setOverlayColor, debouncedSpeak } ) => {
|
52 |
+
const renderApiError = () => (
|
53 |
+
<ApiErrorPlaceholder
|
54 |
+
className="wc-block-featured-category-error"
|
55 |
+
error={ error }
|
56 |
+
isLoading={ isLoading }
|
57 |
+
onRetry={ getCategory }
|
58 |
+
/>
|
59 |
+
);
|
60 |
|
61 |
+
const getBlockControls = () => {
|
62 |
+
const { contentAlign } = attributes;
|
63 |
+
const mediaId = attributes.mediaId || getCategoryImageId( category );
|
|
|
|
|
|
|
64 |
|
65 |
+
return (
|
66 |
+
<BlockControls>
|
67 |
+
<AlignmentToolbar
|
68 |
+
value={ contentAlign }
|
69 |
+
onChange={ ( nextAlign ) => {
|
70 |
+
setAttributes( { contentAlign: nextAlign } );
|
71 |
+
} }
|
72 |
+
/>
|
73 |
+
<MediaUploadCheck>
|
74 |
+
<Toolbar>
|
75 |
+
<MediaUpload
|
76 |
+
onSelect={ ( media ) => {
|
77 |
+
setAttributes( { mediaId: media.id, mediaSrc: media.url } );
|
78 |
+
} }
|
79 |
+
allowedTypes={ [ 'image' ] }
|
80 |
+
value={ mediaId }
|
81 |
+
render={ ( { open } ) => (
|
82 |
+
<IconButton
|
83 |
+
className="components-toolbar__control"
|
84 |
+
label={ __( 'Edit media' ) }
|
85 |
+
icon="format-image"
|
86 |
+
onClick={ open }
|
87 |
+
disabled={ ! category }
|
88 |
+
/>
|
89 |
+
) }
|
90 |
+
/>
|
91 |
+
</Toolbar>
|
92 |
+
</MediaUploadCheck>
|
93 |
+
</BlockControls>
|
94 |
+
);
|
95 |
+
};
|
96 |
|
97 |
+
const getInspectorControls = () => {
|
98 |
const url =
|
99 |
+
attributes.mediaSrc || getCategoryImageSrc( category );
|
100 |
const { focalPoint = { x: 0.5, y: 0.5 } } = attributes;
|
101 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
102 |
// so we need to check if it exists before using it.
|
144 |
</PanelColorSettings>
|
145 |
</InspectorControls>
|
146 |
);
|
147 |
+
};
|
148 |
|
149 |
+
const renderEditMode = () => {
|
|
|
150 |
const onDone = () => {
|
151 |
setAttributes( { editMode: false } );
|
152 |
debouncedSpeak(
|
182 |
</div>
|
183 |
</Placeholder>
|
184 |
);
|
185 |
+
};
|
186 |
|
187 |
+
const renderCategory = () => {
|
|
|
188 |
const {
|
189 |
className,
|
190 |
contentAlign,
|
191 |
dimRatio,
|
|
|
192 |
focalPoint,
|
193 |
height,
|
194 |
showDesc,
|
195 |
} = attributes;
|
|
|
196 |
const classes = classnames(
|
197 |
'wc-block-featured-category',
|
198 |
{
|
199 |
'is-selected': isSelected,
|
200 |
+
'is-loading': ! category && isLoading,
|
201 |
+
'is-not-found': ! category && ! isLoading,
|
202 |
'has-background-dim': dimRatio !== 0,
|
203 |
},
|
204 |
dimRatioToClass( dimRatio ),
|
205 |
contentAlign !== 'center' && `has-${ contentAlign }-content`,
|
206 |
className,
|
207 |
);
|
208 |
+
const mediaSrc = attributes.mediaSrc || getCategoryImageSrc( category );
|
|
|
209 |
const style = !! category ?
|
210 |
+
getBackgroundImageStyles( mediaSrc ) :
|
211 |
{};
|
212 |
if ( overlayColor.color ) {
|
213 |
style.backgroundColor = overlayColor.color;
|
222 |
};
|
223 |
|
224 |
return (
|
225 |
+
<ResizableBox
|
226 |
+
className={ classes }
|
227 |
+
size={ { height } }
|
228 |
+
minHeight={ MIN_HEIGHT }
|
229 |
+
enable={ { bottom: true } }
|
230 |
+
onResizeStop={ onResizeStop }
|
231 |
+
style={ style }
|
232 |
+
>
|
233 |
+
<div className="wc-block-featured-category__wrapper">
|
234 |
+
<h2
|
235 |
+
className="wc-block-featured-category__title"
|
236 |
+
dangerouslySetInnerHTML={ {
|
237 |
+
__html: category.name,
|
238 |
} }
|
239 |
/>
|
240 |
+
{ showDesc && (
|
241 |
+
<div
|
242 |
+
className="wc-block-featured-category__description"
|
243 |
+
dangerouslySetInnerHTML={ {
|
244 |
+
__html: category.description,
|
245 |
+
} }
|
246 |
+
/>
|
247 |
+
) }
|
248 |
+
<div className="wc-block-featured-category__link">
|
249 |
+
<InnerBlocks
|
250 |
+
template={ [
|
251 |
+
[
|
252 |
+
'core/button',
|
253 |
+
{
|
254 |
+
text: __(
|
255 |
+
'Shop now',
|
256 |
+
'woo-gutenberg-products-block'
|
257 |
+
),
|
258 |
+
url: category.permalink,
|
259 |
+
align: 'center',
|
260 |
+
},
|
261 |
+
],
|
262 |
+
] }
|
263 |
+
templateLock="all"
|
264 |
+
/>
|
265 |
+
</div>
|
266 |
+
</div>
|
267 |
+
</ResizableBox>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
);
|
269 |
+
};
|
270 |
+
|
271 |
+
const renderNoCategory = () => (
|
272 |
+
<Placeholder
|
273 |
+
className="wc-block-featured-category"
|
274 |
+
icon={ <IconFolderStar /> }
|
275 |
+
label={ __( 'Featured Category', 'woo-gutenberg-products-block' ) }
|
276 |
+
>
|
277 |
+
{ isLoading ? (
|
278 |
+
<Spinner />
|
279 |
+
) : (
|
280 |
+
__( 'No product category is selected.', 'woo-gutenberg-products-block' )
|
281 |
+
) }
|
282 |
+
</Placeholder>
|
283 |
+
);
|
284 |
+
|
285 |
+
const { editMode } = attributes;
|
286 |
+
|
287 |
+
if ( error ) {
|
288 |
+
return renderApiError();
|
289 |
+
}
|
290 |
+
|
291 |
+
if ( editMode ) {
|
292 |
+
return renderEditMode();
|
293 |
}
|
294 |
+
|
295 |
+
return (
|
296 |
+
<Fragment>
|
297 |
+
{ getBlockControls() }
|
298 |
+
{ getInspectorControls() }
|
299 |
+
{ category ? (
|
300 |
+
renderCategory()
|
301 |
+
) : (
|
302 |
+
renderNoCategory()
|
303 |
+
) }
|
304 |
+
</Fragment>
|
305 |
+
);
|
306 |
+
};
|
307 |
|
308 |
FeaturedCategory.propTypes = {
|
309 |
/**
|
322 |
* A callback to update attributes.
|
323 |
*/
|
324 |
setAttributes: PropTypes.func.isRequired,
|
325 |
+
// from withCategory
|
326 |
+
error: PropTypes.object,
|
327 |
+
getCategory: PropTypes.func,
|
328 |
+
isLoading: PropTypes.bool,
|
329 |
+
category: PropTypes.shape( {
|
330 |
+
name: PropTypes.node,
|
331 |
+
description: PropTypes.node,
|
332 |
+
permalink: PropTypes.string,
|
333 |
+
} ),
|
334 |
// from withColors
|
335 |
overlayColor: PropTypes.object,
|
336 |
setOverlayColor: PropTypes.func.isRequired,
|
339 |
};
|
340 |
|
341 |
export default compose( [
|
342 |
+
withCategory,
|
343 |
withColors( { overlayColor: 'background-color' } ),
|
344 |
withSpokenMessages,
|
345 |
] )( FeaturedCategory );
|
assets/js/blocks/featured-category/index.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { InnerBlocks } from '@wordpress/editor';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
|
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
@@ -69,7 +70,7 @@ registerBlockType( 'woocommerce/featured-category', {
|
|
69 |
*/
|
70 |
height: {
|
71 |
type: 'number',
|
72 |
-
default:
|
73 |
},
|
74 |
|
75 |
/**
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { InnerBlocks } from '@wordpress/editor';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
7 |
+
import { DEFAULT_HEIGHT } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
70 |
*/
|
71 |
height: {
|
72 |
type: 'number',
|
73 |
+
default: DEFAULT_HEIGHT,
|
74 |
},
|
75 |
|
76 |
/**
|
assets/js/blocks/featured-category/utils.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
/**
|
33 |
+
* Generate a style object given either a product category image from the API or URL to an image.
|
34 |
+
*
|
35 |
+
* @param {string} url An image URL.
|
36 |
+
* @return {Object} A style object with a backgroundImage set (if a valid image is provided).
|
37 |
+
*/
|
38 |
+
function getBackgroundImageStyles( url ) {
|
39 |
+
if ( url ) {
|
40 |
+
return { backgroundImage: `url(${ url })` };
|
41 |
+
}
|
42 |
+
return {};
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Convert the selected ratio to the correct background class.
|
47 |
+
*
|
48 |
+
* @param {number} ratio Selected opacity from 0 to 100.
|
49 |
+
* @return {string} The class name, if applicable (not used for ratio 0 or 50).
|
50 |
+
*/
|
51 |
+
function dimRatioToClass( ratio ) {
|
52 |
+
return ratio === 0 || ratio === 50 ?
|
53 |
+
null :
|
54 |
+
`has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
55 |
+
}
|
56 |
+
|
57 |
+
export { getCategoryImageSrc, getCategoryImageId, getBackgroundImageStyles, dimRatioToClass };
|
assets/js/blocks/featured-product/block.js
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
-
import apiFetch from '@wordpress/api-fetch';
|
6 |
import {
|
7 |
AlignmentToolbar,
|
8 |
BlockControls,
|
@@ -27,106 +26,128 @@ import {
|
|
27 |
withSpokenMessages,
|
28 |
} from '@wordpress/components';
|
29 |
import classnames from 'classnames';
|
30 |
-
import {
|
31 |
import { compose } from '@wordpress/compose';
|
32 |
-
import {
|
33 |
import PropTypes from 'prop-types';
|
|
|
34 |
|
35 |
/**
|
36 |
* Internal dependencies
|
37 |
*/
|
38 |
import ProductControl from '../../components/product-control';
|
|
|
|
|
|
|
|
|
|
|
39 |
import {
|
40 |
getImageSrcFromProduct,
|
41 |
getImageIdFromProduct,
|
42 |
} from '../../utils/products';
|
43 |
-
|
44 |
-
/**
|
45 |
-
* The min-height for the block content.
|
46 |
-
*/
|
47 |
-
const MIN_HEIGHT = wc_product_block_data.min_height;
|
48 |
-
|
49 |
-
/**
|
50 |
-
* Generate a style object given either a product object or URL to an image.
|
51 |
-
*
|
52 |
-
* @param {object|string} url A product object as returned from the API, or an image URL.
|
53 |
-
* @return {object} A style object with a backgroundImage set (if a valid image is provided).
|
54 |
-
*/
|
55 |
-
function backgroundImageStyles( url ) {
|
56 |
-
// If `url` is an object, it's actually a product.
|
57 |
-
if ( isObject( url ) ) {
|
58 |
-
url = getImageSrcFromProduct( url );
|
59 |
-
}
|
60 |
-
if ( url ) {
|
61 |
-
return { backgroundImage: `url(${ url })` };
|
62 |
-
}
|
63 |
-
return {};
|
64 |
-
}
|
65 |
-
|
66 |
-
/**
|
67 |
-
* Convert the selected ratio to the correct background class.
|
68 |
-
*
|
69 |
-
* @param {number} ratio Selected opacity from 0 to 100.
|
70 |
-
* @return {string} The class name, if applicable (not used for ratio 0 or 50).
|
71 |
-
*/
|
72 |
-
function dimRatioToClass( ratio ) {
|
73 |
-
return ratio === 0 || ratio === 50 ?
|
74 |
-
null :
|
75 |
-
`has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
76 |
-
}
|
77 |
|
78 |
/**
|
79 |
* Component to handle edit mode of "Featured Product".
|
80 |
*/
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
}
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
-
|
103 |
-
const {
|
104 |
-
|
105 |
-
// We've removed the selected product, or no product is selected yet.
|
106 |
-
this.setState( { product: false, loaded: true } );
|
107 |
-
return;
|
108 |
-
}
|
109 |
-
apiFetch( {
|
110 |
-
path: `/wc/blocks/products/${ productId }`,
|
111 |
-
} )
|
112 |
-
.then( ( product ) => {
|
113 |
-
this.setState( { product, loaded: true } );
|
114 |
-
} )
|
115 |
-
.catch( () => {
|
116 |
-
this.setState( { product: false, loaded: true } );
|
117 |
-
} );
|
118 |
-
}
|
119 |
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
|
129 |
-
|
130 |
const { focalPoint = { x: 0.5, y: 0.5 } } = attributes;
|
131 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
132 |
// so we need to check if it exists before using it.
|
@@ -179,76 +200,33 @@ class FeaturedProduct extends Component {
|
|
179 |
</PanelColorSettings>
|
180 |
</InspectorControls>
|
181 |
);
|
182 |
-
}
|
183 |
-
|
184 |
-
renderEditMode() {
|
185 |
-
const { attributes, debouncedSpeak, setAttributes } = this.props;
|
186 |
-
const onDone = () => {
|
187 |
-
setAttributes( { editMode: false } );
|
188 |
-
debouncedSpeak(
|
189 |
-
__(
|
190 |
-
'Showing Featured Product block preview.',
|
191 |
-
'woo-gutenberg-products-block'
|
192 |
-
)
|
193 |
-
);
|
194 |
-
};
|
195 |
-
|
196 |
-
return (
|
197 |
-
<Placeholder
|
198 |
-
icon="star-filled"
|
199 |
-
label={ __( 'Featured Product', 'woo-gutenberg-products-block' ) }
|
200 |
-
className="wc-block-featured-product"
|
201 |
-
>
|
202 |
-
{ __(
|
203 |
-
'Visually highlight a product or variation and encourage prompt action',
|
204 |
-
'woo-gutenberg-products-block'
|
205 |
-
) }
|
206 |
-
<div className="wc-block-featured-product__selection">
|
207 |
-
<ProductControl
|
208 |
-
selected={ attributes.productId || 0 }
|
209 |
-
onChange={ ( value = [] ) => {
|
210 |
-
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
211 |
-
setAttributes( { productId: id, mediaId: 0, mediaSrc: '' } );
|
212 |
-
} }
|
213 |
-
/>
|
214 |
-
<Button isDefault onClick={ onDone }>
|
215 |
-
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
216 |
-
</Button>
|
217 |
-
</div>
|
218 |
-
</Placeholder>
|
219 |
-
);
|
220 |
-
}
|
221 |
|
222 |
-
|
223 |
-
const { attributes, isSelected, overlayColor, setAttributes } = this.props;
|
224 |
const {
|
225 |
className,
|
226 |
contentAlign,
|
227 |
dimRatio,
|
228 |
-
editMode,
|
229 |
focalPoint,
|
230 |
height,
|
231 |
showDesc,
|
232 |
showPrice,
|
233 |
} = attributes;
|
234 |
-
const { loaded, product } = this.state;
|
235 |
const classes = classnames(
|
236 |
'wc-block-featured-product',
|
237 |
{
|
238 |
'is-selected': isSelected,
|
239 |
-
'is-loading': ! product &&
|
240 |
-
'is-not-found': ! product &&
|
241 |
'has-background-dim': dimRatio !== 0,
|
242 |
},
|
243 |
dimRatioToClass( dimRatio ),
|
244 |
contentAlign !== 'center' && `has-${ contentAlign }-content`,
|
245 |
className,
|
246 |
);
|
247 |
-
const mediaId = attributes.mediaId || getImageIdFromProduct( product );
|
248 |
|
249 |
-
const style =
|
250 |
-
|
251 |
-
{};
|
252 |
if ( overlayColor.color ) {
|
253 |
style.backgroundColor = overlayColor.color;
|
254 |
}
|
@@ -262,117 +240,102 @@ class FeaturedProduct extends Component {
|
|
262 |
};
|
263 |
|
264 |
return (
|
265 |
-
<
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
271 |
} }
|
272 |
/>
|
273 |
-
|
274 |
-
<
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
{ ! isEmpty( product.variation ) && (
|
316 |
-
<h3
|
317 |
-
className="wc-block-featured-product__variation"
|
318 |
-
dangerouslySetInnerHTML={ {
|
319 |
-
__html: product.variation,
|
320 |
-
} }
|
321 |
-
/>
|
322 |
-
) }
|
323 |
-
{ showDesc && (
|
324 |
-
<div
|
325 |
-
className="wc-block-featured-product__description"
|
326 |
-
dangerouslySetInnerHTML={ {
|
327 |
-
__html: product.description,
|
328 |
-
} }
|
329 |
-
/>
|
330 |
-
) }
|
331 |
-
{ showPrice && (
|
332 |
-
<div
|
333 |
-
className="wc-block-featured-product__price"
|
334 |
-
dangerouslySetInnerHTML={ { __html: product.price_html } }
|
335 |
-
/>
|
336 |
-
) }
|
337 |
-
<div className="wc-block-featured-product__link">
|
338 |
-
<InnerBlocks
|
339 |
-
template={ [
|
340 |
-
[
|
341 |
-
'core/button',
|
342 |
-
{
|
343 |
-
text: __(
|
344 |
-
'Shop now',
|
345 |
-
'woo-gutenberg-products-block'
|
346 |
-
),
|
347 |
-
url: product.permalink,
|
348 |
-
align: 'center',
|
349 |
-
},
|
350 |
-
],
|
351 |
-
] }
|
352 |
-
templateLock="all"
|
353 |
-
/>
|
354 |
-
</div>
|
355 |
-
</div>
|
356 |
-
</ResizableBox>
|
357 |
-
) : (
|
358 |
-
<Placeholder
|
359 |
-
className="wc-block-featured-product"
|
360 |
-
icon="star-filled"
|
361 |
-
label={ __( 'Featured Product', 'woo-gutenberg-products-block' ) }
|
362 |
-
>
|
363 |
-
{ ! loaded ? (
|
364 |
-
<Spinner />
|
365 |
-
) : (
|
366 |
-
__( 'No product is selected.', 'woo-gutenberg-products-block' )
|
367 |
-
) }
|
368 |
-
</Placeholder>
|
369 |
-
) }
|
370 |
-
</Fragment>
|
371 |
-
) }
|
372 |
-
</Fragment>
|
373 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
}
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
|
377 |
FeaturedProduct.propTypes = {
|
378 |
/**
|
@@ -391,6 +354,17 @@ FeaturedProduct.propTypes = {
|
|
391 |
* A callback to update attributes.
|
392 |
*/
|
393 |
setAttributes: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
394 |
// from withColors
|
395 |
overlayColor: PropTypes.object,
|
396 |
setOverlayColor: PropTypes.func.isRequired,
|
@@ -399,6 +373,7 @@ FeaturedProduct.propTypes = {
|
|
399 |
};
|
400 |
|
401 |
export default compose( [
|
|
|
402 |
withColors( { overlayColor: 'background-color' } ),
|
403 |
withSpokenMessages,
|
404 |
] )( FeaturedProduct );
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
|
|
5 |
import {
|
6 |
AlignmentToolbar,
|
7 |
BlockControls,
|
26 |
withSpokenMessages,
|
27 |
} from '@wordpress/components';
|
28 |
import classnames from 'classnames';
|
29 |
+
import { Fragment } from '@wordpress/element';
|
30 |
import { compose } from '@wordpress/compose';
|
31 |
+
import { isEmpty } from 'lodash';
|
32 |
import PropTypes from 'prop-types';
|
33 |
+
import { MIN_HEIGHT } from '@woocommerce/block-settings';
|
34 |
|
35 |
/**
|
36 |
* Internal dependencies
|
37 |
*/
|
38 |
import ProductControl from '../../components/product-control';
|
39 |
+
import ApiErrorPlaceholder from '../../components/api-error-placeholder';
|
40 |
+
import {
|
41 |
+
dimRatioToClass,
|
42 |
+
getBackgroundImageStyles,
|
43 |
+
} from './utils';
|
44 |
import {
|
45 |
getImageSrcFromProduct,
|
46 |
getImageIdFromProduct,
|
47 |
} from '../../utils/products';
|
48 |
+
import { withProduct } from '../../hocs';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
/**
|
51 |
* Component to handle edit mode of "Featured Product".
|
52 |
*/
|
53 |
+
const FeaturedProduct = ( { attributes, debouncedSpeak, error, getProduct, isLoading, isSelected, overlayColor, product, setAttributes, setOverlayColor } ) => {
|
54 |
+
const renderApiError = () => (
|
55 |
+
<ApiErrorPlaceholder
|
56 |
+
className="wc-block-featured-product-error"
|
57 |
+
error={ error }
|
58 |
+
isLoading={ isLoading }
|
59 |
+
onRetry={ getProduct }
|
60 |
+
/>
|
61 |
+
);
|
|
|
62 |
|
63 |
+
const renderEditMode = () => {
|
64 |
+
const onDone = () => {
|
65 |
+
setAttributes( { editMode: false } );
|
66 |
+
debouncedSpeak(
|
67 |
+
__(
|
68 |
+
'Showing Featured Product block preview.',
|
69 |
+
'woo-gutenberg-products-block'
|
70 |
+
)
|
71 |
+
);
|
72 |
+
};
|
73 |
|
74 |
+
return (
|
75 |
+
<Fragment>
|
76 |
+
{ getBlockControls() }
|
77 |
+
<Placeholder
|
78 |
+
icon="star-filled"
|
79 |
+
label={ __( 'Featured Product', 'woo-gutenberg-products-block' ) }
|
80 |
+
className="wc-block-featured-product"
|
81 |
+
>
|
82 |
+
{ __(
|
83 |
+
'Visually highlight a product or variation and encourage prompt action',
|
84 |
+
'woo-gutenberg-products-block'
|
85 |
+
) }
|
86 |
+
<div className="wc-block-featured-product__selection">
|
87 |
+
<ProductControl
|
88 |
+
selected={ attributes.productId || 0 }
|
89 |
+
onChange={ ( value = [] ) => {
|
90 |
+
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
91 |
+
setAttributes( { productId: id, mediaId: 0, mediaSrc: '' } );
|
92 |
+
} }
|
93 |
+
/>
|
94 |
+
<Button isDefault onClick={ onDone }>
|
95 |
+
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
96 |
+
</Button>
|
97 |
+
</div>
|
98 |
+
</Placeholder>
|
99 |
+
</Fragment>
|
100 |
+
);
|
101 |
+
};
|
102 |
|
103 |
+
const getBlockControls = () => {
|
104 |
+
const { contentAlign, editMode } = attributes;
|
105 |
+
const mediaId = attributes.mediaId || getImageIdFromProduct( product );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
return (
|
108 |
+
<BlockControls>
|
109 |
+
<AlignmentToolbar
|
110 |
+
value={ contentAlign }
|
111 |
+
onChange={ ( nextAlign ) => {
|
112 |
+
setAttributes( { contentAlign: nextAlign } );
|
113 |
+
} }
|
114 |
+
/>
|
115 |
+
<MediaUploadCheck>
|
116 |
+
<Toolbar>
|
117 |
+
<MediaUpload
|
118 |
+
onSelect={ ( media ) => {
|
119 |
+
setAttributes( { mediaId: media.id, mediaSrc: media.url } );
|
120 |
+
} }
|
121 |
+
allowedTypes={ [ 'image' ] }
|
122 |
+
value={ mediaId }
|
123 |
+
render={ ( { open } ) => (
|
124 |
+
<IconButton
|
125 |
+
className="components-toolbar__control"
|
126 |
+
label={ __( 'Edit media' ) }
|
127 |
+
icon="format-image"
|
128 |
+
onClick={ open }
|
129 |
+
disabled={ ! product }
|
130 |
+
/>
|
131 |
+
) }
|
132 |
+
/>
|
133 |
+
</Toolbar>
|
134 |
+
</MediaUploadCheck>
|
135 |
+
<Toolbar
|
136 |
+
controls={ [
|
137 |
+
{
|
138 |
+
icon: 'edit',
|
139 |
+
title: __( 'Edit' ),
|
140 |
+
onClick: () => setAttributes( { editMode: ! editMode } ),
|
141 |
+
isActive: editMode,
|
142 |
+
},
|
143 |
+
] }
|
144 |
+
/>
|
145 |
+
</BlockControls>
|
146 |
+
);
|
147 |
+
};
|
148 |
|
149 |
+
const getInspectorControls = () => {
|
150 |
+
const url = attributes.mediaSrc || getImageSrcFromProduct( product );
|
151 |
const { focalPoint = { x: 0.5, y: 0.5 } } = attributes;
|
152 |
// FocalPointPicker was introduced in Gutenberg 5.0 (WordPress 5.2),
|
153 |
// so we need to check if it exists before using it.
|
200 |
</PanelColorSettings>
|
201 |
</InspectorControls>
|
202 |
);
|
203 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
+
const renderProduct = () => {
|
|
|
206 |
const {
|
207 |
className,
|
208 |
contentAlign,
|
209 |
dimRatio,
|
|
|
210 |
focalPoint,
|
211 |
height,
|
212 |
showDesc,
|
213 |
showPrice,
|
214 |
} = attributes;
|
|
|
215 |
const classes = classnames(
|
216 |
'wc-block-featured-product',
|
217 |
{
|
218 |
'is-selected': isSelected,
|
219 |
+
'is-loading': ! product && isLoading,
|
220 |
+
'is-not-found': ! product && ! isLoading,
|
221 |
'has-background-dim': dimRatio !== 0,
|
222 |
},
|
223 |
dimRatioToClass( dimRatio ),
|
224 |
contentAlign !== 'center' && `has-${ contentAlign }-content`,
|
225 |
className,
|
226 |
);
|
|
|
227 |
|
228 |
+
const style = getBackgroundImageStyles( attributes.mediaSrc || product );
|
229 |
+
|
|
|
230 |
if ( overlayColor.color ) {
|
231 |
style.backgroundColor = overlayColor.color;
|
232 |
}
|
240 |
};
|
241 |
|
242 |
return (
|
243 |
+
<ResizableBox
|
244 |
+
className={ classes }
|
245 |
+
size={ { height } }
|
246 |
+
minHeight={ MIN_HEIGHT }
|
247 |
+
enable={ { bottom: true } }
|
248 |
+
onResizeStop={ onResizeStop }
|
249 |
+
style={ style }
|
250 |
+
>
|
251 |
+
<div className="wc-block-featured-product__wrapper">
|
252 |
+
<h2
|
253 |
+
className="wc-block-featured-product__title"
|
254 |
+
dangerouslySetInnerHTML={ {
|
255 |
+
__html: product.name,
|
256 |
} }
|
257 |
/>
|
258 |
+
{ ! isEmpty( product.variation ) && (
|
259 |
+
<h3
|
260 |
+
className="wc-block-featured-product__variation"
|
261 |
+
dangerouslySetInnerHTML={ {
|
262 |
+
__html: product.variation,
|
263 |
+
} }
|
264 |
+
/>
|
265 |
+
) }
|
266 |
+
{ showDesc && (
|
267 |
+
<div
|
268 |
+
className="wc-block-featured-product__description"
|
269 |
+
dangerouslySetInnerHTML={ {
|
270 |
+
__html: product.description,
|
271 |
+
} }
|
272 |
+
/>
|
273 |
+
) }
|
274 |
+
{ showPrice && (
|
275 |
+
<div
|
276 |
+
className="wc-block-featured-product__price"
|
277 |
+
dangerouslySetInnerHTML={ { __html: product.price_html } }
|
278 |
+
/>
|
279 |
+
) }
|
280 |
+
<div className="wc-block-featured-product__link">
|
281 |
+
<InnerBlocks
|
282 |
+
template={ [
|
283 |
+
[
|
284 |
+
'core/button',
|
285 |
+
{
|
286 |
+
text: __(
|
287 |
+
'Shop now',
|
288 |
+
'woo-gutenberg-products-block'
|
289 |
+
),
|
290 |
+
url: product.permalink,
|
291 |
+
align: 'center',
|
292 |
+
},
|
293 |
+
],
|
294 |
+
] }
|
295 |
+
templateLock="all"
|
296 |
+
/>
|
297 |
+
</div>
|
298 |
+
</div>
|
299 |
+
</ResizableBox>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
300 |
);
|
301 |
+
};
|
302 |
+
|
303 |
+
const renderNoProduct = () => (
|
304 |
+
<Placeholder
|
305 |
+
className="wc-block-featured-product"
|
306 |
+
icon="star-filled"
|
307 |
+
label={ __( 'Featured Product', 'woo-gutenberg-products-block' ) }
|
308 |
+
>
|
309 |
+
{ isLoading ? (
|
310 |
+
<Spinner />
|
311 |
+
) : (
|
312 |
+
__( 'No product is selected.', 'woo-gutenberg-products-block' )
|
313 |
+
) }
|
314 |
+
</Placeholder>
|
315 |
+
);
|
316 |
+
|
317 |
+
const { editMode } = attributes;
|
318 |
+
|
319 |
+
if ( error ) {
|
320 |
+
return renderApiError();
|
321 |
+
}
|
322 |
+
|
323 |
+
if ( editMode ) {
|
324 |
+
return renderEditMode();
|
325 |
}
|
326 |
+
|
327 |
+
return (
|
328 |
+
<Fragment>
|
329 |
+
{ getBlockControls() }
|
330 |
+
{ getInspectorControls() }
|
331 |
+
{ product ? (
|
332 |
+
renderProduct()
|
333 |
+
) : (
|
334 |
+
renderNoProduct()
|
335 |
+
) }
|
336 |
+
</Fragment>
|
337 |
+
);
|
338 |
+
};
|
339 |
|
340 |
FeaturedProduct.propTypes = {
|
341 |
/**
|
354 |
* A callback to update attributes.
|
355 |
*/
|
356 |
setAttributes: PropTypes.func.isRequired,
|
357 |
+
// from withProduct
|
358 |
+
error: PropTypes.object,
|
359 |
+
getProduct: PropTypes.func,
|
360 |
+
isLoading: PropTypes.bool,
|
361 |
+
product: PropTypes.shape( {
|
362 |
+
name: PropTypes.node,
|
363 |
+
variation: PropTypes.node,
|
364 |
+
description: PropTypes.node,
|
365 |
+
price_html: PropTypes.node,
|
366 |
+
permalink: PropTypes.string,
|
367 |
+
} ),
|
368 |
// from withColors
|
369 |
overlayColor: PropTypes.object,
|
370 |
setOverlayColor: PropTypes.func.isRequired,
|
373 |
};
|
374 |
|
375 |
export default compose( [
|
376 |
+
withProduct,
|
377 |
withColors( { overlayColor: 'background-color' } ),
|
378 |
withSpokenMessages,
|
379 |
] )( FeaturedProduct );
|
assets/js/blocks/featured-product/editor.scss
CHANGED
@@ -8,6 +8,9 @@
|
|
8 |
z-index: 10;
|
9 |
}
|
10 |
}
|
|
|
|
|
|
|
11 |
|
12 |
.wc-block-featured-product__selection {
|
13 |
width: 100%;
|
8 |
z-index: 10;
|
9 |
}
|
10 |
}
|
11 |
+
.wc-block-featured-product__message {
|
12 |
+
margin-bottom: 16px;
|
13 |
+
}
|
14 |
|
15 |
.wc-block-featured-product__selection {
|
16 |
width: 100%;
|
assets/js/blocks/featured-product/index.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { InnerBlocks } from '@wordpress/editor';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
|
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
@@ -68,7 +69,7 @@ registerBlockType( 'woocommerce/featured-product', {
|
|
68 |
*/
|
69 |
height: {
|
70 |
type: 'number',
|
71 |
-
default:
|
72 |
},
|
73 |
|
74 |
/**
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { InnerBlocks } from '@wordpress/editor';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
7 |
+
import { DEFAULT_HEIGHT } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
69 |
*/
|
70 |
height: {
|
71 |
type: 'number',
|
72 |
+
default: DEFAULT_HEIGHT,
|
73 |
},
|
74 |
|
75 |
/**
|
assets/js/blocks/featured-product/utils.js
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { isObject } from 'lodash';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import {
|
10 |
+
getImageSrcFromProduct,
|
11 |
+
} from '../../utils/products';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Generate a style object given either a product object or URL to an image.
|
15 |
+
*
|
16 |
+
* @param {object|string} url A product object as returned from the API, or an image URL.
|
17 |
+
* @return {Object} A style object with a backgroundImage set (if a valid image is provided).
|
18 |
+
*/
|
19 |
+
function getBackgroundImageStyles( url ) {
|
20 |
+
// If `url` is an object, it's actually a product.
|
21 |
+
if ( isObject( url ) ) {
|
22 |
+
url = getImageSrcFromProduct( url );
|
23 |
+
}
|
24 |
+
if ( url ) {
|
25 |
+
return { backgroundImage: `url(${ url })` };
|
26 |
+
}
|
27 |
+
return {};
|
28 |
+
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Convert the selected ratio to the correct background class.
|
32 |
+
*
|
33 |
+
* @param {number} ratio Selected opacity from 0 to 100.
|
34 |
+
* @return {string} The class name, if applicable (not used for ratio 0 or 50).
|
35 |
+
*/
|
36 |
+
function dimRatioToClass( ratio ) {
|
37 |
+
return ratio === 0 || ratio === 50 ?
|
38 |
+
null :
|
39 |
+
`has-background-dim-${ 10 * Math.round( ratio / 10 ) }`;
|
40 |
+
}
|
41 |
+
|
42 |
+
export { getBackgroundImageStyles, dimRatioToClass };
|
assets/js/blocks/handpicked-products/block.js
CHANGED
@@ -19,6 +19,7 @@ import {
|
|
19 |
} from '@wordpress/components';
|
20 |
import { Component, Fragment } from '@wordpress/element';
|
21 |
import PropTypes from 'prop-types';
|
|
|
22 |
|
23 |
/**
|
24 |
* Internal dependencies
|
@@ -46,8 +47,8 @@ class ProductsBlock extends Component {
|
|
46 |
label={ __( 'Columns', 'woo-gutenberg-products-block' ) }
|
47 |
value={ columns }
|
48 |
onChange={ ( value ) => setAttributes( { columns: value } ) }
|
49 |
-
min={
|
50 |
-
max={
|
51 |
/>
|
52 |
<ToggleControl
|
53 |
label={ __( 'Align Add to Cart buttons', 'woo-gutenberg-products-block' ) }
|
19 |
} from '@wordpress/components';
|
20 |
import { Component, Fragment } from '@wordpress/element';
|
21 |
import PropTypes from 'prop-types';
|
22 |
+
import { MAX_COLUMNS, MIN_COLUMNS } from '@woocommerce/block-settings';
|
23 |
|
24 |
/**
|
25 |
* Internal dependencies
|
47 |
label={ __( 'Columns', 'woo-gutenberg-products-block' ) }
|
48 |
value={ columns }
|
49 |
onChange={ ( value ) => setAttributes( { columns: value } ) }
|
50 |
+
min={ MIN_COLUMNS }
|
51 |
+
max={ MAX_COLUMNS }
|
52 |
/>
|
53 |
<ToggleControl
|
54 |
label={ __( 'Align Add to Cart buttons', 'woo-gutenberg-products-block' ) }
|
assets/js/blocks/handpicked-products/index.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
@@ -41,7 +42,7 @@ registerBlockType( 'woocommerce/handpicked-products', {
|
|
41 |
*/
|
42 |
columns: {
|
43 |
type: 'number',
|
44 |
-
default:
|
45 |
},
|
46 |
|
47 |
/**
|
@@ -99,7 +100,7 @@ registerBlockType( 'woocommerce/handpicked-products', {
|
|
99 |
},
|
100 |
columns: {
|
101 |
type: 'number',
|
102 |
-
default:
|
103 |
},
|
104 |
editMode: {
|
105 |
type: 'boolean',
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
import { DEFAULT_COLUMNS } from '@woocommerce/block-settings';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
42 |
*/
|
43 |
columns: {
|
44 |
type: 'number',
|
45 |
+
default: DEFAULT_COLUMNS,
|
46 |
},
|
47 |
|
48 |
/**
|
100 |
},
|
101 |
columns: {
|
102 |
type: 'number',
|
103 |
+
default: DEFAULT_COLUMNS,
|
104 |
},
|
105 |
editMode: {
|
106 |
type: 'boolean',
|
assets/js/blocks/product-categories/block.js
CHANGED
@@ -4,11 +4,12 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Component, createRef, Fragment } from 'react';
|
6 |
import classnames from 'classnames';
|
|
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
10 |
*/
|
11 |
-
import withComponentId from '../../
|
12 |
|
13 |
/**
|
14 |
* Component displaying the categories as dropdown or list.
|
@@ -28,7 +29,7 @@ class ProductCategoriesBlock extends Component {
|
|
28 |
if ( 'false' === url ) {
|
29 |
return;
|
30 |
}
|
31 |
-
const home =
|
32 |
|
33 |
if ( ! isPreview && 0 === url.indexOf( home ) ) {
|
34 |
document.location.href = url;
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { Component, createRef, Fragment } from 'react';
|
6 |
import classnames from 'classnames';
|
7 |
+
import { HOME_URL } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
11 |
*/
|
12 |
+
import withComponentId from '../../base/hocs/with-component-id';
|
13 |
|
14 |
/**
|
15 |
* Component displaying the categories as dropdown or list.
|
29 |
if ( 'false' === url ) {
|
30 |
return;
|
31 |
}
|
32 |
+
const home = HOME_URL;
|
33 |
|
34 |
if ( ! isPreview && 0 === url.indexOf( home ) ) {
|
35 |
document.location.href = url;
|
assets/js/blocks/product-categories/get-categories.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* Internal dependencies
|
3 |
*/
|
@@ -7,7 +12,7 @@ import { buildTermsTree } from './hierarchy';
|
|
7 |
* Returns categories in tree form.
|
8 |
*/
|
9 |
export default function( { hasEmpty, isHierarchical } ) {
|
10 |
-
const categories =
|
11 |
( cat ) => hasEmpty || !! cat.count
|
12 |
);
|
13 |
return isHierarchical ?
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { PRODUCT_CATEGORIES } from '@woocommerce/block-settings';
|
5 |
+
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
12 |
* Returns categories in tree form.
|
13 |
*/
|
14 |
export default function( { hasEmpty, isHierarchical } ) {
|
15 |
+
const categories = PRODUCT_CATEGORIES.filter(
|
16 |
( cat ) => hasEmpty || !! cat.count
|
17 |
);
|
18 |
return isHierarchical ?
|
assets/js/blocks/product-categories/style.scss
CHANGED
@@ -27,7 +27,6 @@
|
|
27 |
margin: 0;
|
28 |
border: none;
|
29 |
cursor: pointer;
|
30 |
-
-webkit-appearance: none;
|
31 |
background: none;
|
32 |
padding: 8px;
|
33 |
color: #555d66;
|
27 |
margin: 0;
|
28 |
border: none;
|
29 |
cursor: pointer;
|
|
|
30 |
background: none;
|
31 |
padding: 8px;
|
32 |
color: #555d66;
|
assets/js/blocks/product-category/block.js
CHANGED
@@ -30,16 +30,27 @@ import ProductOrderbyControl from '../../components/product-orderby-control';
|
|
30 |
* Component to handle edit mode of "Products by Category".
|
31 |
*/
|
32 |
class ProductByCategoryBlock extends Component {
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
}
|
44 |
|
45 |
componentDidMount() {
|
@@ -51,27 +62,27 @@ class ProductByCategoryBlock extends Component {
|
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
startEditing() {
|
55 |
this.setState( {
|
56 |
isEditing: true,
|
57 |
changedAttributes: {},
|
58 |
} );
|
59 |
}
|
60 |
|
61 |
-
stopEditing() {
|
62 |
this.setState( {
|
63 |
isEditing: false,
|
64 |
changedAttributes: {},
|
65 |
} );
|
66 |
}
|
67 |
|
68 |
-
setChangedAttributes( attributes ) {
|
69 |
this.setState( ( prevState ) => {
|
70 |
return { changedAttributes: { ...prevState.changedAttributes, ...attributes } };
|
71 |
} );
|
72 |
}
|
73 |
|
74 |
-
save() {
|
75 |
const { changedAttributes } = this.state;
|
76 |
const { setAttributes } = this.props;
|
77 |
|
@@ -254,22 +265,4 @@ class ProductByCategoryBlock extends Component {
|
|
254 |
}
|
255 |
}
|
256 |
|
257 |
-
ProductByCategoryBlock.propTypes = {
|
258 |
-
/**
|
259 |
-
* The attributes for this block
|
260 |
-
*/
|
261 |
-
attributes: PropTypes.object.isRequired,
|
262 |
-
/**
|
263 |
-
* The register block name.
|
264 |
-
*/
|
265 |
-
name: PropTypes.string.isRequired,
|
266 |
-
/**
|
267 |
-
* A callback to update attributes
|
268 |
-
*/
|
269 |
-
setAttributes: PropTypes.func.isRequired,
|
270 |
-
|
271 |
-
// from withSpokenMessages
|
272 |
-
debouncedSpeak: PropTypes.func.isRequired,
|
273 |
-
};
|
274 |
-
|
275 |
export default withSpokenMessages( ProductByCategoryBlock );
|
30 |
* Component to handle edit mode of "Products by Category".
|
31 |
*/
|
32 |
class ProductByCategoryBlock extends Component {
|
33 |
+
static propTypes = {
|
34 |
+
/**
|
35 |
+
* The attributes for this block
|
36 |
+
*/
|
37 |
+
attributes: PropTypes.object.isRequired,
|
38 |
+
/**
|
39 |
+
* The register block name.
|
40 |
+
*/
|
41 |
+
name: PropTypes.string.isRequired,
|
42 |
+
/**
|
43 |
+
* A callback to update attributes
|
44 |
+
*/
|
45 |
+
setAttributes: PropTypes.func.isRequired,
|
46 |
+
|
47 |
+
// from withSpokenMessages
|
48 |
+
debouncedSpeak: PropTypes.func.isRequired,
|
49 |
+
}
|
50 |
+
|
51 |
+
state = {
|
52 |
+
changedAttributes: {},
|
53 |
+
isEditing: false,
|
54 |
}
|
55 |
|
56 |
componentDidMount() {
|
62 |
}
|
63 |
}
|
64 |
|
65 |
+
startEditing = () => {
|
66 |
this.setState( {
|
67 |
isEditing: true,
|
68 |
changedAttributes: {},
|
69 |
} );
|
70 |
}
|
71 |
|
72 |
+
stopEditing = () => {
|
73 |
this.setState( {
|
74 |
isEditing: false,
|
75 |
changedAttributes: {},
|
76 |
} );
|
77 |
}
|
78 |
|
79 |
+
setChangedAttributes = ( attributes ) => {
|
80 |
this.setState( ( prevState ) => {
|
81 |
return { changedAttributes: { ...prevState.changedAttributes, ...attributes } };
|
82 |
} );
|
83 |
}
|
84 |
|
85 |
+
save = () => {
|
86 |
const { changedAttributes } = this.state;
|
87 |
const { setAttributes } = this.props;
|
88 |
|
265 |
}
|
266 |
}
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
export default withSpokenMessages( ProductByCategoryBlock );
|
assets/js/blocks/product-search/block.js
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import classnames from 'classnames';
|
6 |
+
import { Component } from '@wordpress/element';
|
7 |
+
import PropTypes from 'prop-types';
|
8 |
+
import { withInstanceId, compose } from '@wordpress/compose';
|
9 |
+
import { PlainText } from '@wordpress/editor';
|
10 |
+
import { HOME_URL } from '@woocommerce/block-settings';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Internal dependencies
|
14 |
+
*/
|
15 |
+
import './editor.scss';
|
16 |
+
import './style.scss';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Component displaying a product search form.
|
20 |
+
*/
|
21 |
+
class ProductSearchBlock extends Component {
|
22 |
+
renderView() {
|
23 |
+
const { attributes: { label, placeholder, formId, className, hasLabel, align } } = this.props;
|
24 |
+
const classes = classnames(
|
25 |
+
'wc-block-product-search',
|
26 |
+
align ? 'align' + align : '',
|
27 |
+
className,
|
28 |
+
);
|
29 |
+
|
30 |
+
return (
|
31 |
+
<div className={ classes }>
|
32 |
+
<form role="search" method="get" action={ HOME_URL }>
|
33 |
+
<label
|
34 |
+
htmlFor={ formId }
|
35 |
+
className={ hasLabel ? 'wc-block-product-search__label' : 'wc-block-product-search__label screen-reader-text' }
|
36 |
+
>
|
37 |
+
{ label }
|
38 |
+
</label>
|
39 |
+
<div className="wc-block-product-search__fields">
|
40 |
+
<input
|
41 |
+
type="search"
|
42 |
+
id={ formId }
|
43 |
+
className="wc-block-product-search__field"
|
44 |
+
placeholder={ placeholder }
|
45 |
+
name="s"
|
46 |
+
/>
|
47 |
+
<input type="hidden" name="post_type" value="product" />
|
48 |
+
<button
|
49 |
+
type="submit"
|
50 |
+
className="wc-block-product-search__button"
|
51 |
+
label={ __( 'Search', 'woo-gutenberg-products-block' ) }
|
52 |
+
>
|
53 |
+
<svg aria-hidden="true" role="img" focusable="false" className="dashicon dashicons-arrow-right-alt2" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
54 |
+
<path d="M6 15l5-5-5-5 1-2 7 7-7 7z"></path>
|
55 |
+
</svg>
|
56 |
+
</button>
|
57 |
+
</div>
|
58 |
+
</form>
|
59 |
+
</div>
|
60 |
+
);
|
61 |
+
}
|
62 |
+
|
63 |
+
renderEdit() {
|
64 |
+
const { attributes, setAttributes, instanceId } = this.props;
|
65 |
+
const { label, placeholder, formId, className, hasLabel, align } = attributes;
|
66 |
+
const classes = classnames(
|
67 |
+
'wc-block-product-search',
|
68 |
+
align ? 'align' + align : '',
|
69 |
+
className,
|
70 |
+
);
|
71 |
+
|
72 |
+
if ( ! formId ) {
|
73 |
+
setAttributes( { formId: `wc-block-product-search-${ instanceId }` } );
|
74 |
+
}
|
75 |
+
|
76 |
+
return (
|
77 |
+
<div className={ classes }>
|
78 |
+
{ !! hasLabel && (
|
79 |
+
<PlainText
|
80 |
+
className="wc-block-product-search__label"
|
81 |
+
value={ label }
|
82 |
+
onChange={ ( value ) => setAttributes( { label: value } ) }
|
83 |
+
/>
|
84 |
+
) }
|
85 |
+
<div className="wc-block-product-search__fields">
|
86 |
+
<PlainText
|
87 |
+
className="wc-block-product-search__field input-control"
|
88 |
+
value={ placeholder }
|
89 |
+
onChange={ ( value ) => setAttributes( { placeholder: value } ) }
|
90 |
+
/>
|
91 |
+
<button
|
92 |
+
type="submit"
|
93 |
+
className="wc-block-product-search__button"
|
94 |
+
label={ __( 'Search', 'woo-gutenberg-products-block' ) }
|
95 |
+
onClick={ ( e ) => e.preventDefault() }
|
96 |
+
tabIndex="-1"
|
97 |
+
>
|
98 |
+
<svg aria-hidden="true" role="img" focusable="false" className="dashicon dashicons-arrow-right-alt2" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
99 |
+
<path d="M6 15l5-5-5-5 1-2 7 7-7 7z"></path>
|
100 |
+
</svg>
|
101 |
+
</button>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
);
|
105 |
+
}
|
106 |
+
|
107 |
+
render() {
|
108 |
+
if ( this.props.isPreview ) {
|
109 |
+
return this.renderEdit();
|
110 |
+
}
|
111 |
+
|
112 |
+
return this.renderView();
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
ProductSearchBlock.propTypes = {
|
117 |
+
/**
|
118 |
+
* The attributes for this block.
|
119 |
+
*/
|
120 |
+
attributes: PropTypes.object.isRequired,
|
121 |
+
/**
|
122 |
+
* A unique ID for identifying the label for the select dropdown.
|
123 |
+
*/
|
124 |
+
instanceId: PropTypes.number,
|
125 |
+
/**
|
126 |
+
* Whether this is the block preview or frontend display.
|
127 |
+
*/
|
128 |
+
isPreview: PropTypes.bool,
|
129 |
+
/**
|
130 |
+
* A callback to update attributes.
|
131 |
+
*/
|
132 |
+
setAttributes: PropTypes.func,
|
133 |
+
};
|
134 |
+
|
135 |
+
export default compose( [
|
136 |
+
withInstanceId,
|
137 |
+
] )( ProductSearchBlock );
|
assets/js/blocks/product-search/editor.scss
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-product-search__field.input-control {
|
2 |
+
color: #828b96 !important;
|
3 |
+
}
|
4 |
+
.wc-block-product-search {
|
5 |
+
.wc-block-product-search__fields {
|
6 |
+
.block-editor-rich-text {
|
7 |
+
flex-grow: 1;
|
8 |
+
}
|
9 |
+
}
|
10 |
+
}
|
assets/js/blocks/product-search/index.js
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
import { InspectorControls } from '@wordpress/editor';
|
7 |
+
import { PanelBody, ToggleControl } from '@wordpress/components';
|
8 |
+
import { Fragment } from '@wordpress/element';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import './style.scss';
|
14 |
+
import './editor.scss';
|
15 |
+
import Block from './block.js';
|
16 |
+
|
17 |
+
registerBlockType( 'woocommerce/product-search', {
|
18 |
+
title: __( 'Product Search', 'woo-gutenberg-products-block' ),
|
19 |
+
icon: {
|
20 |
+
src: 'search',
|
21 |
+
foreground: '#96588a',
|
22 |
+
},
|
23 |
+
category: 'woocommerce',
|
24 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
25 |
+
description: __(
|
26 |
+
'Help visitors find your products.',
|
27 |
+
'woo-gutenberg-products-block'
|
28 |
+
),
|
29 |
+
supports: {
|
30 |
+
align: [ 'wide', 'full' ],
|
31 |
+
},
|
32 |
+
|
33 |
+
attributes: {
|
34 |
+
/**
|
35 |
+
* Whether to show the field label.
|
36 |
+
*/
|
37 |
+
hasLabel: {
|
38 |
+
type: 'boolean',
|
39 |
+
default: true,
|
40 |
+
},
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Search field label.
|
44 |
+
*/
|
45 |
+
label: {
|
46 |
+
type: 'string',
|
47 |
+
default: __( 'Search', 'woo-gutenberg-products-block' ),
|
48 |
+
source: 'text',
|
49 |
+
selector: 'label',
|
50 |
+
},
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Search field placeholder.
|
54 |
+
*/
|
55 |
+
placeholder: {
|
56 |
+
type: 'string',
|
57 |
+
default: __( 'Search products...', 'woo-gutenberg-products-block' ),
|
58 |
+
source: 'attribute',
|
59 |
+
selector: 'input.wc-block-product-search__field',
|
60 |
+
attribute: 'placeholder',
|
61 |
+
},
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Store the instance ID.
|
65 |
+
*/
|
66 |
+
formId: {
|
67 |
+
type: 'string',
|
68 |
+
default: '',
|
69 |
+
},
|
70 |
+
},
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Renders and manages the block.
|
74 |
+
*/
|
75 |
+
edit( props ) {
|
76 |
+
const { attributes, setAttributes } = props;
|
77 |
+
const { hasLabel } = attributes;
|
78 |
+
return (
|
79 |
+
<Fragment>
|
80 |
+
<InspectorControls key="inspector">
|
81 |
+
<PanelBody
|
82 |
+
title={ __( 'Content', 'woo-gutenberg-products-block' ) }
|
83 |
+
initialOpen
|
84 |
+
>
|
85 |
+
|
86 |
+
<ToggleControl
|
87 |
+
label={ __( 'Show search field label', 'woo-gutenberg-products-block' ) }
|
88 |
+
help={
|
89 |
+
hasLabel ?
|
90 |
+
__( 'Label is visible.', 'woo-gutenberg-products-block' ) :
|
91 |
+
__( 'Label is hidden.', 'woo-gutenberg-products-block' )
|
92 |
+
}
|
93 |
+
checked={ hasLabel }
|
94 |
+
onChange={ () => setAttributes( { hasLabel: ! hasLabel } ) }
|
95 |
+
/>
|
96 |
+
</PanelBody>
|
97 |
+
</InspectorControls>
|
98 |
+
<Block { ...props } isPreview />
|
99 |
+
</Fragment>
|
100 |
+
);
|
101 |
+
},
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Save the props to post content.
|
105 |
+
*/
|
106 |
+
save( attributes ) {
|
107 |
+
return (
|
108 |
+
<div>
|
109 |
+
<Block { ...attributes } />
|
110 |
+
</div>
|
111 |
+
);
|
112 |
+
},
|
113 |
+
} );
|
assets/js/blocks/product-search/style.scss
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-product-search {
|
2 |
+
.wc-block-product-search__fields {
|
3 |
+
display: flex;
|
4 |
+
}
|
5 |
+
.wc-block-product-search__field {
|
6 |
+
padding: 6px 8px;
|
7 |
+
line-height: 1.8;
|
8 |
+
flex-grow: 1;
|
9 |
+
}
|
10 |
+
.wc-block-product-search__button {
|
11 |
+
display: flex;
|
12 |
+
align-items: center;
|
13 |
+
text-decoration: none;
|
14 |
+
font-size: 13px;
|
15 |
+
margin: 0 0 0 6px;
|
16 |
+
border: none;
|
17 |
+
cursor: pointer;
|
18 |
+
background: none;
|
19 |
+
padding: 8px;
|
20 |
+
color: #555d66;
|
21 |
+
position: relative;
|
22 |
+
overflow: hidden;
|
23 |
+
border-radius: 4px;
|
24 |
+
svg {
|
25 |
+
fill: currentColor;
|
26 |
+
outline: none;
|
27 |
+
}
|
28 |
+
&:active {
|
29 |
+
color: currentColor;
|
30 |
+
}
|
31 |
+
&:disabled,
|
32 |
+
&[aria-disabled="true"] {
|
33 |
+
cursor: default;
|
34 |
+
opacity: 0.3;
|
35 |
+
}
|
36 |
+
&:focus:enabled {
|
37 |
+
background-color: #fff;
|
38 |
+
color: #191e23;
|
39 |
+
box-shadow: inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff;
|
40 |
+
outline: 2px solid transparent;
|
41 |
+
outline-offset: -2px;
|
42 |
+
}
|
43 |
+
&:not(:disabled):not([aria-disabled="true"]):hover {
|
44 |
+
background-color: #fff;
|
45 |
+
color: #191e23;
|
46 |
+
box-shadow: inset 0 0 0 1px #e2e4e7, inset 0 0 0 2px #fff, 0 1px 1px rgba(25, 30, 35, 0.2);
|
47 |
+
}
|
48 |
+
&:not(:disabled):not([aria-disabled="true"]):active {
|
49 |
+
outline: none;
|
50 |
+
background-color: #fff;
|
51 |
+
color: #191e23;
|
52 |
+
box-shadow: inset 0 0 0 1px #ccd0d4, inset 0 0 0 2px #fff;
|
53 |
+
}
|
54 |
+
&[aria-disabled="true"]:focus,
|
55 |
+
&:disabled:focus {
|
56 |
+
box-shadow: none;
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
assets/js/blocks/product-tag/block.js
CHANGED
@@ -17,6 +17,7 @@ import {
|
|
17 |
} from '@wordpress/components';
|
18 |
import { Component, Fragment } from '@wordpress/element';
|
19 |
import PropTypes from 'prop-types';
|
|
|
20 |
|
21 |
/**
|
22 |
* Internal dependencies
|
@@ -25,7 +26,6 @@ import GridContentControl from '../../components/grid-content-control';
|
|
25 |
import GridLayoutControl from '../../components/grid-layout-control';
|
26 |
import ProductTagControl from '../../components/product-tag-control';
|
27 |
import ProductOrderbyControl from '../../components/product-orderby-control';
|
28 |
-
import { hasTags } from '../../components/utils';
|
29 |
|
30 |
/**
|
31 |
* Component to handle edit mode of "Products by Tag".
|
@@ -231,7 +231,7 @@ class ProductsByTagBlock extends Component {
|
|
231 |
|
232 |
return (
|
233 |
<Fragment>
|
234 |
-
{
|
235 |
<Fragment>
|
236 |
<BlockControls>
|
237 |
<Toolbar
|
17 |
} from '@wordpress/components';
|
18 |
import { Component, Fragment } from '@wordpress/element';
|
19 |
import PropTypes from 'prop-types';
|
20 |
+
import { HAS_TAGS } from '@woocommerce/block-settings';
|
21 |
|
22 |
/**
|
23 |
* Internal dependencies
|
26 |
import GridLayoutControl from '../../components/grid-layout-control';
|
27 |
import ProductTagControl from '../../components/product-tag-control';
|
28 |
import ProductOrderbyControl from '../../components/product-orderby-control';
|
|
|
29 |
|
30 |
/**
|
31 |
* Component to handle edit mode of "Products by Tag".
|
231 |
|
232 |
return (
|
233 |
<Fragment>
|
234 |
+
{ HAS_TAGS ? (
|
235 |
<Fragment>
|
236 |
<BlockControls>
|
237 |
<Toolbar
|
assets/js/blocks/product-tag/index.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
@@ -35,7 +36,7 @@ registerBlockType( 'woocommerce/product-tag', {
|
|
35 |
*/
|
36 |
columns: {
|
37 |
type: 'number',
|
38 |
-
default:
|
39 |
},
|
40 |
|
41 |
/**
|
@@ -43,7 +44,7 @@ registerBlockType( 'woocommerce/product-tag', {
|
|
43 |
*/
|
44 |
rows: {
|
45 |
type: 'number',
|
46 |
-
default:
|
47 |
},
|
48 |
|
49 |
/**
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
import { DEFAULT_COLUMNS, DEFAULT_ROWS } from '@woocommerce/block-settings';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
36 |
*/
|
37 |
columns: {
|
38 |
type: 'number',
|
39 |
+
default: DEFAULT_COLUMNS,
|
40 |
},
|
41 |
|
42 |
/**
|
44 |
*/
|
45 |
rows: {
|
46 |
type: 'number',
|
47 |
+
default: DEFAULT_ROWS,
|
48 |
},
|
49 |
|
50 |
/**
|
assets/js/blocks/products-by-attribute/index.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import Gridicon from 'gridicons';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
|
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
@@ -52,7 +53,7 @@ registerBlockType( blockTypeName, {
|
|
52 |
*/
|
53 |
columns: {
|
54 |
type: 'number',
|
55 |
-
default:
|
56 |
},
|
57 |
|
58 |
/**
|
@@ -89,7 +90,7 @@ registerBlockType( blockTypeName, {
|
|
89 |
*/
|
90 |
rows: {
|
91 |
type: 'number',
|
92 |
-
default:
|
93 |
},
|
94 |
|
95 |
/**
|
@@ -115,7 +116,7 @@ registerBlockType( blockTypeName, {
|
|
115 |
},
|
116 |
columns: {
|
117 |
type: 'number',
|
118 |
-
default:
|
119 |
},
|
120 |
editMode: {
|
121 |
type: 'boolean',
|
@@ -136,7 +137,7 @@ registerBlockType( blockTypeName, {
|
|
136 |
},
|
137 |
rows: {
|
138 |
type: 'number',
|
139 |
-
default:
|
140 |
},
|
141 |
},
|
142 |
save: deprecatedConvertToShortcode( blockTypeName ),
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import Gridicon from 'gridicons';
|
6 |
import { registerBlockType } from '@wordpress/blocks';
|
7 |
+
import { DEFAULT_COLUMNS, DEFAULT_ROWS } from '@woocommerce/block-settings';
|
8 |
|
9 |
/**
|
10 |
* Internal dependencies
|
53 |
*/
|
54 |
columns: {
|
55 |
type: 'number',
|
56 |
+
default: DEFAULT_COLUMNS,
|
57 |
},
|
58 |
|
59 |
/**
|
90 |
*/
|
91 |
rows: {
|
92 |
type: 'number',
|
93 |
+
default: DEFAULT_ROWS,
|
94 |
},
|
95 |
|
96 |
/**
|
116 |
},
|
117 |
columns: {
|
118 |
type: 'number',
|
119 |
+
default: DEFAULT_COLUMNS,
|
120 |
},
|
121 |
editMode: {
|
122 |
type: 'boolean',
|
137 |
},
|
138 |
rows: {
|
139 |
type: 'number',
|
140 |
+
default: DEFAULT_ROWS,
|
141 |
},
|
142 |
},
|
143 |
save: deprecatedConvertToShortcode( blockTypeName ),
|
assets/js/blocks/reviews/all-reviews/edit.js
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import {
|
6 |
+
InspectorControls,
|
7 |
+
} from '@wordpress/editor';
|
8 |
+
import { PanelBody, ToggleControl } from '@wordpress/components';
|
9 |
+
import { Fragment } from '@wordpress/element';
|
10 |
+
import PropTypes from 'prop-types';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Internal dependencies
|
14 |
+
*/
|
15 |
+
import { IconAllReviews } from '../../../components/icons';
|
16 |
+
import EditorContainerBlock from '../editor-container-block.js';
|
17 |
+
import NoReviewsPlaceholder from './no-reviews-placeholder.js';
|
18 |
+
import { getSharedReviewContentControls, getSharedReviewListControls } from '../edit-utils.js';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Component to handle edit mode of "All Reviews".
|
22 |
+
*/
|
23 |
+
const AllReviewsEditor = ( { attributes, setAttributes } ) => {
|
24 |
+
const getInspectorControls = () => {
|
25 |
+
return (
|
26 |
+
<InspectorControls key="inspector">
|
27 |
+
<PanelBody title={ __( 'Content', 'woo-gutenberg-products-block' ) }>
|
28 |
+
<ToggleControl
|
29 |
+
label={ __( 'Product name', 'woo-gutenberg-products-block' ) }
|
30 |
+
checked={ attributes.showProductName }
|
31 |
+
onChange={ () => setAttributes( { showProductName: ! attributes.showProductName } ) }
|
32 |
+
/>
|
33 |
+
{ getSharedReviewContentControls( attributes, setAttributes ) }
|
34 |
+
</PanelBody>
|
35 |
+
<PanelBody title={ __( 'List Settings', 'woo-gutenberg-products-block' ) }>
|
36 |
+
{ getSharedReviewListControls( attributes, setAttributes ) }
|
37 |
+
</PanelBody>
|
38 |
+
</InspectorControls>
|
39 |
+
);
|
40 |
+
};
|
41 |
+
|
42 |
+
return (
|
43 |
+
<Fragment>
|
44 |
+
{ getInspectorControls() }
|
45 |
+
<EditorContainerBlock
|
46 |
+
attributes={ attributes }
|
47 |
+
className="wc-block-all-reviews"
|
48 |
+
icon={ <IconAllReviews className="block-editor-block-icon" /> }
|
49 |
+
name={ __( 'All Reviews', 'woo-gutenberg-products-block' ) }
|
50 |
+
noReviewsPlaceholder={ NoReviewsPlaceholder }
|
51 |
+
/>
|
52 |
+
</Fragment>
|
53 |
+
);
|
54 |
+
};
|
55 |
+
|
56 |
+
AllReviewsEditor.propTypes = {
|
57 |
+
/**
|
58 |
+
* The attributes for this block.
|
59 |
+
*/
|
60 |
+
attributes: PropTypes.object.isRequired,
|
61 |
+
/**
|
62 |
+
* The register block name.
|
63 |
+
*/
|
64 |
+
name: PropTypes.string.isRequired,
|
65 |
+
/**
|
66 |
+
* A callback to update attributes.
|
67 |
+
*/
|
68 |
+
setAttributes: PropTypes.func.isRequired,
|
69 |
+
};
|
70 |
+
|
71 |
+
export default AllReviewsEditor;
|
assets/js/blocks/reviews/all-reviews/index.js
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import '../editor.scss';
|
11 |
+
import Editor from './edit';
|
12 |
+
import { IconAllReviews } from '../../../components/icons';
|
13 |
+
import sharedAttributes from '../attributes';
|
14 |
+
import save from '../save.js';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Register and run the "All Reviews" block.
|
18 |
+
*/
|
19 |
+
registerBlockType( 'woocommerce/all-reviews', {
|
20 |
+
title: __( 'All Reviews', 'woo-gutenberg-products-block' ),
|
21 |
+
icon: {
|
22 |
+
src: <IconAllReviews fillColor="#96588a" />,
|
23 |
+
foreground: '#96588a',
|
24 |
+
},
|
25 |
+
category: 'woocommerce',
|
26 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
27 |
+
description: __(
|
28 |
+
'Shows a list of all product reviews.',
|
29 |
+
'woo-gutenberg-products-block'
|
30 |
+
),
|
31 |
+
attributes: {
|
32 |
+
...sharedAttributes,
|
33 |
+
/**
|
34 |
+
* Show the product name.
|
35 |
+
*/
|
36 |
+
showProductName: {
|
37 |
+
type: 'boolean',
|
38 |
+
default: true,
|
39 |
+
},
|
40 |
+
},
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Renders and manages the block.
|
44 |
+
*/
|
45 |
+
edit( props ) {
|
46 |
+
return <Editor { ...props } />;
|
47 |
+
},
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Save the props to post content.
|
51 |
+
*/
|
52 |
+
save,
|
53 |
+
} );
|
assets/js/blocks/reviews/all-reviews/no-reviews-placeholder.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Placeholder } from '@wordpress/components';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import { IconAllReviews } from '../../../components/icons';
|
11 |
+
|
12 |
+
const NoCategoryReviewsPlaceholder = () => {
|
13 |
+
return (
|
14 |
+
<Placeholder
|
15 |
+
className="wc-block-all-reviews"
|
16 |
+
icon={ <IconAllReviews className="block-editor-block-icon" /> }
|
17 |
+
label={ __( 'All Reviews', 'woo-gutenberg-products-block' ) }
|
18 |
+
>
|
19 |
+
{ __( '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' ) }
|
20 |
+
</Placeholder>
|
21 |
+
);
|
22 |
+
};
|
23 |
+
|
24 |
+
export default NoCategoryReviewsPlaceholder;
|
assets/js/blocks/reviews/attributes.js
ADDED
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
export default {
|
2 |
+
/**
|
3 |
+
* Toggle for edit mode in the block preview.
|
4 |
+
*/
|
5 |
+
editMode: {
|
6 |
+
type: 'boolean',
|
7 |
+
default: true,
|
8 |
+
},
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Whether to display the reviewer or product image.
|
12 |
+
*/
|
13 |
+
imageType: {
|
14 |
+
type: 'string',
|
15 |
+
default: 'reviewer',
|
16 |
+
},
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Order to use for the reviews listing.
|
20 |
+
*/
|
21 |
+
orderby: {
|
22 |
+
type: 'string',
|
23 |
+
default: 'most-recent',
|
24 |
+
},
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Number of reviews to add when clicking on load more.
|
28 |
+
*/
|
29 |
+
reviewsOnLoadMore: {
|
30 |
+
type: 'number',
|
31 |
+
default: 10,
|
32 |
+
},
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Number of reviews to display on page load.
|
36 |
+
*/
|
37 |
+
reviewsOnPageLoad: {
|
38 |
+
type: 'number',
|
39 |
+
default: 10,
|
40 |
+
},
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Show the load more button.
|
44 |
+
*/
|
45 |
+
showLoadMore: {
|
46 |
+
type: 'boolean',
|
47 |
+
default: true,
|
48 |
+
},
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Show the order by selector.
|
52 |
+
*/
|
53 |
+
showOrderby: {
|
54 |
+
type: 'boolean',
|
55 |
+
default: true,
|
56 |
+
},
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Show the review date.
|
60 |
+
*/
|
61 |
+
showReviewDate: {
|
62 |
+
type: 'boolean',
|
63 |
+
default: true,
|
64 |
+
},
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Show the reviewer name.
|
68 |
+
*/
|
69 |
+
showReviewerName: {
|
70 |
+
type: 'boolean',
|
71 |
+
default: true,
|
72 |
+
},
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Show the review image..
|
76 |
+
*/
|
77 |
+
showReviewImage: {
|
78 |
+
type: 'boolean',
|
79 |
+
default: true,
|
80 |
+
},
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Show the product rating.
|
84 |
+
*/
|
85 |
+
showReviewRating: {
|
86 |
+
type: 'boolean',
|
87 |
+
default: true,
|
88 |
+
},
|
89 |
+
|
90 |
+
/**
|
91 |
+
* Show the product content.
|
92 |
+
*/
|
93 |
+
showReviewContent: {
|
94 |
+
type: 'boolean',
|
95 |
+
default: true,
|
96 |
+
},
|
97 |
+
};
|
assets/js/blocks/reviews/edit-utils.js
ADDED
@@ -0,0 +1,150 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { __, sprintf } from '@wordpress/i18n';
|
2 |
+
import { Fragment, RawHTML } from '@wordpress/element';
|
3 |
+
import { escapeHTML } from '@wordpress/escape-html';
|
4 |
+
import {
|
5 |
+
Notice,
|
6 |
+
ToggleControl,
|
7 |
+
Toolbar,
|
8 |
+
RangeControl,
|
9 |
+
SelectControl,
|
10 |
+
} from '@wordpress/components';
|
11 |
+
import { BlockControls } from '@wordpress/editor';
|
12 |
+
import { getAdminLink } from '@woocommerce/navigation';
|
13 |
+
import { ENABLE_REVIEW_RATING, SHOW_AVATARS } from '@woocommerce/block-settings';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Internal dependencies
|
17 |
+
*/
|
18 |
+
import ToggleButtonControl from '../../components/toggle-button-control';
|
19 |
+
|
20 |
+
export const getBlockControls = ( editMode, setAttributes ) => (
|
21 |
+
<BlockControls>
|
22 |
+
<Toolbar
|
23 |
+
controls={ [
|
24 |
+
{
|
25 |
+
icon: 'edit',
|
26 |
+
title: __( 'Edit', 'woo-gutenberg-products-block' ),
|
27 |
+
onClick: () => setAttributes( { editMode: ! editMode } ),
|
28 |
+
isActive: editMode,
|
29 |
+
},
|
30 |
+
] }
|
31 |
+
/>
|
32 |
+
</BlockControls>
|
33 |
+
);
|
34 |
+
|
35 |
+
export const getSharedReviewContentControls = ( attributes, setAttributes ) => {
|
36 |
+
return (
|
37 |
+
<Fragment>
|
38 |
+
<ToggleControl
|
39 |
+
label={ __( 'Product rating', 'woo-gutenberg-products-block' ) }
|
40 |
+
checked={ attributes.showReviewRating }
|
41 |
+
onChange={ () => setAttributes( { showReviewRating: ! attributes.showReviewRating } ) }
|
42 |
+
/>
|
43 |
+
{ ( attributes.showReviewRating && ! ENABLE_REVIEW_RATING ) && (
|
44 |
+
<Notice className="wc-block-reviews__notice" isDismissible={ false }>
|
45 |
+
<RawHTML>
|
46 |
+
{ sprintf(
|
47 |
+
escapeHTML(
|
48 |
+
/* translators: A notice that links to WooCommerce settings. */
|
49 |
+
__( 'Product rating is disabled in your %sstore settings%s.', 'woo-gutenberg-products-block' )
|
50 |
+
),
|
51 |
+
`<a href="${ getAdminLink( 'admin.php?page=wc-settings&tab=products' ) }" target="_blank">`, '</a>'
|
52 |
+
) }
|
53 |
+
</RawHTML>
|
54 |
+
</Notice>
|
55 |
+
) }
|
56 |
+
<ToggleControl
|
57 |
+
label={ __( 'Reviewer name', 'woo-gutenberg-products-block' ) }
|
58 |
+
checked={ attributes.showReviewerName }
|
59 |
+
onChange={ () => setAttributes( { showReviewerName: ! attributes.showReviewerName } ) }
|
60 |
+
/>
|
61 |
+
<ToggleControl
|
62 |
+
label={ __( 'Image', 'woo-gutenberg-products-block' ) }
|
63 |
+
checked={ attributes.showReviewImage }
|
64 |
+
onChange={ () => setAttributes( { showReviewImage: ! attributes.showReviewImage } ) }
|
65 |
+
/>
|
66 |
+
<ToggleControl
|
67 |
+
label={ __( 'Review date', 'woo-gutenberg-products-block' ) }
|
68 |
+
checked={ attributes.showReviewDate }
|
69 |
+
onChange={ () => setAttributes( { showReviewDate: ! attributes.showReviewDate } ) }
|
70 |
+
/>
|
71 |
+
<ToggleControl
|
72 |
+
label={ __( 'Review content', 'woo-gutenberg-products-block' ) }
|
73 |
+
checked={ attributes.showReviewContent }
|
74 |
+
onChange={ () => setAttributes( { showReviewContent: ! attributes.showReviewContent } ) }
|
75 |
+
/>
|
76 |
+
{ attributes.showReviewImage && (
|
77 |
+
<Fragment>
|
78 |
+
<ToggleButtonControl
|
79 |
+
label={ __( 'Review image', 'woo-gutenberg-products-block' ) }
|
80 |
+
value={ attributes.imageType }
|
81 |
+
options={ [
|
82 |
+
{ label: __( 'Reviewer photo', 'woo-gutenberg-products-block' ), value: 'reviewer' },
|
83 |
+
{ label: __( 'Product', 'woo-gutenberg-products-block' ), value: 'product' },
|
84 |
+
] }
|
85 |
+
onChange={ ( value ) => setAttributes( { imageType: value } ) }
|
86 |
+
/>
|
87 |
+
{ ( attributes.imageType === 'reviewer' && ! SHOW_AVATARS ) && (
|
88 |
+
<Notice className="wc-block-reviews__notice" isDismissible={ false }>
|
89 |
+
<RawHTML>
|
90 |
+
{ sprintf(
|
91 |
+
escapeHTML(
|
92 |
+
/* translators: A notice that links to WordPress settings. */
|
93 |
+
__( 'Reviewer photo is disabled in your %ssite settings%s.', 'woo-gutenberg-products-block' )
|
94 |
+
),
|
95 |
+
`<a href="${ getAdminLink( 'options-discussion.php' ) }" target="_blank">`, '</a>'
|
96 |
+
) }
|
97 |
+
</RawHTML>
|
98 |
+
</Notice>
|
99 |
+
) }
|
100 |
+
</Fragment>
|
101 |
+
) }
|
102 |
+
</Fragment>
|
103 |
+
);
|
104 |
+
};
|
105 |
+
|
106 |
+
export const getSharedReviewListControls = ( attributes, setAttributes ) => {
|
107 |
+
const minPerPage = 1;
|
108 |
+
const maxPerPage = 20;
|
109 |
+
|
110 |
+
return (
|
111 |
+
<Fragment>
|
112 |
+
<ToggleControl
|
113 |
+
label={ __( 'Order by', 'woo-gutenberg-products-block' ) }
|
114 |
+
checked={ attributes.showOrderby }
|
115 |
+
onChange={ () => setAttributes( { showOrderby: ! attributes.showOrderby } ) }
|
116 |
+
/>
|
117 |
+
<SelectControl
|
118 |
+
label={ __( 'Order Product Reviews by', 'woo-gutenberg-products-block' ) }
|
119 |
+
value={ attributes.orderby }
|
120 |
+
options={ [
|
121 |
+
{ label: 'Most recent', value: 'most-recent' },
|
122 |
+
{ label: 'Highest Rating', value: 'highest-rating' },
|
123 |
+
{ label: 'Lowest Rating', value: 'lowest-rating' },
|
124 |
+
] }
|
125 |
+
onChange={ ( orderby ) => setAttributes( { orderby } ) }
|
126 |
+
/>
|
127 |
+
<RangeControl
|
128 |
+
label={ __( 'Starting Number of Reviews', 'woo-gutenberg-products-block' ) }
|
129 |
+
value={ attributes.reviewsOnPageLoad }
|
130 |
+
onChange={ ( reviewsOnPageLoad ) => setAttributes( { reviewsOnPageLoad } ) }
|
131 |
+
max={ maxPerPage }
|
132 |
+
min={ minPerPage }
|
133 |
+
/>
|
134 |
+
<ToggleControl
|
135 |
+
label={ __( 'Load more', 'woo-gutenberg-products-block' ) }
|
136 |
+
checked={ attributes.showLoadMore }
|
137 |
+
onChange={ () => setAttributes( { showLoadMore: ! attributes.showLoadMore } ) }
|
138 |
+
/>
|
139 |
+
{ attributes.showLoadMore && (
|
140 |
+
<RangeControl
|
141 |
+
label={ __( 'Load More Reviews', 'woo-gutenberg-products-block' ) }
|
142 |
+
value={ attributes.reviewsOnLoadMore }
|
143 |
+
onChange={ ( reviewsOnLoadMore ) => setAttributes( { reviewsOnLoadMore } ) }
|
144 |
+
max={ maxPerPage }
|
145 |
+
min={ minPerPage }
|
146 |
+
/>
|
147 |
+
) }
|
148 |
+
</Fragment>
|
149 |
+
);
|
150 |
+
};
|
assets/js/blocks/reviews/editor-block.js
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Component } from 'react';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
+
import { Disabled } from '@wordpress/components';
|
8 |
+
import { ENABLE_REVIEW_RATING } from '@woocommerce/block-settings';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import ApiErrorPlaceholder from '../../components/api-error-placeholder';
|
14 |
+
import LoadMoreButton from '../../base/components/load-more-button';
|
15 |
+
import ReviewList from '../../base/components/review-list';
|
16 |
+
import ReviewOrderSelect from '../../base/components/review-order-select';
|
17 |
+
import withReviews from '../../base/hocs/with-reviews';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Block rendered in the editor.
|
21 |
+
*/
|
22 |
+
class EditorBlock extends Component {
|
23 |
+
static propTypes = {
|
24 |
+
/**
|
25 |
+
* The attributes for this block.
|
26 |
+
*/
|
27 |
+
attributes: PropTypes.object.isRequired,
|
28 |
+
// from withReviews
|
29 |
+
reviews: PropTypes.array,
|
30 |
+
totalReviews: PropTypes.number,
|
31 |
+
}
|
32 |
+
|
33 |
+
render() {
|
34 |
+
const { attributes, error, isLoading, noReviewsPlaceholder: NoReviewsPlaceholder, reviews, totalReviews } = this.props;
|
35 |
+
|
36 |
+
if ( error ) {
|
37 |
+
return (
|
38 |
+
<ApiErrorPlaceholder
|
39 |
+
className="wc-block-featured-product-error"
|
40 |
+
error={ error }
|
41 |
+
isLoading={ isLoading }
|
42 |
+
/>
|
43 |
+
);
|
44 |
+
}
|
45 |
+
|
46 |
+
if ( 0 === reviews.length && ! isLoading ) {
|
47 |
+
return <NoReviewsPlaceholder attributes={ attributes } />;
|
48 |
+
}
|
49 |
+
|
50 |
+
return (
|
51 |
+
<Disabled>
|
52 |
+
{ ( attributes.showOrderby && ENABLE_REVIEW_RATING ) && (
|
53 |
+
<ReviewOrderSelect
|
54 |
+
readOnly
|
55 |
+
value={ attributes.orderby }
|
56 |
+
/>
|
57 |
+
) }
|
58 |
+
<ReviewList
|
59 |
+
attributes={ attributes }
|
60 |
+
reviews={ reviews }
|
61 |
+
/>
|
62 |
+
{ ( attributes.showLoadMore && totalReviews > reviews.length ) && (
|
63 |
+
<LoadMoreButton
|
64 |
+
screenReaderLabel={ __( 'Load more reviews', 'woo-gutenberg-products-block' ) }
|
65 |
+
/>
|
66 |
+
) }
|
67 |
+
</Disabled>
|
68 |
+
);
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
export default withReviews( EditorBlock );
|
assets/js/blocks/reviews/editor-container-block.js
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Component } from 'react';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
+
import { debounce } from 'lodash';
|
8 |
+
import { Placeholder } from '@wordpress/components';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import EditorBlock from './editor-block.js';
|
14 |
+
import { getBlockClassName, getOrderArgs } from './utils.js';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Container of the block rendered in the editor.
|
18 |
+
*/
|
19 |
+
class EditorContainerBlock extends Component {
|
20 |
+
renderHiddenContentPlaceholder() {
|
21 |
+
const { icon, name } = this.props;
|
22 |
+
|
23 |
+
return (
|
24 |
+
<Placeholder
|
25 |
+
icon={ icon }
|
26 |
+
label={ name }
|
27 |
+
>
|
28 |
+
{ __( 'The content for this block is hidden due to block settings.', 'woo-gutenberg-products-block' ) }
|
29 |
+
</Placeholder>
|
30 |
+
);
|
31 |
+
}
|
32 |
+
|
33 |
+
render() {
|
34 |
+
const { attributes, className, noReviewsPlaceholder } = this.props;
|
35 |
+
const { categoryIds, productId, reviewsOnPageLoad, showProductName, showReviewDate, showReviewerName, showReviewContent, showReviewImage, showReviewRating } = attributes;
|
36 |
+
const { order, orderby } = getOrderArgs( attributes.orderby );
|
37 |
+
const isAllContentHidden = ! showReviewContent && ! showReviewRating && ! showReviewDate && ! showReviewerName && ! showReviewImage && ! showProductName;
|
38 |
+
|
39 |
+
if ( isAllContentHidden ) {
|
40 |
+
return this.renderHiddenContentPlaceholder();
|
41 |
+
}
|
42 |
+
|
43 |
+
return (
|
44 |
+
<div className={ getBlockClassName( className, attributes ) }>
|
45 |
+
<EditorBlock
|
46 |
+
attributes={ attributes }
|
47 |
+
categoryIds={ categoryIds }
|
48 |
+
delayFunction={ ( callback ) => debounce( callback, 400 ) }
|
49 |
+
noReviewsPlaceholder={ noReviewsPlaceholder }
|
50 |
+
orderby={ orderby }
|
51 |
+
order={ order }
|
52 |
+
productId={ productId }
|
53 |
+
reviewsToDisplay={ reviewsOnPageLoad }
|
54 |
+
/>
|
55 |
+
</div>
|
56 |
+
);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
+
EditorContainerBlock.propTypes = {
|
61 |
+
attributes: PropTypes.object.isRequired,
|
62 |
+
icon: PropTypes.node.isRequired,
|
63 |
+
name: PropTypes.string.isRequired,
|
64 |
+
noReviewsPlaceholder: PropTypes.func.isRequired,
|
65 |
+
className: PropTypes.string,
|
66 |
+
};
|
67 |
+
|
68 |
+
export default EditorContainerBlock;
|
assets/js/blocks/reviews/editor.scss
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.wc-block-reviews__selection {
|
2 |
+
width: 100%;
|
3 |
+
}
|
4 |
+
|
5 |
+
.components-base-control {
|
6 |
+
+ .wc-block-reviews__notice {
|
7 |
+
margin: -$gap 0 $gap;
|
8 |
+
}
|
9 |
+
|
10 |
+
&:nth-last-child(2) + .wc-block-reviews__notice {
|
11 |
+
margin: -$gap 0 $gap-small;
|
12 |
+
}
|
13 |
+
}
|
assets/js/blocks/reviews/frontend-block.js
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Fragment } from 'react';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
+
import { ENABLE_REVIEW_RATING } from '@woocommerce/block-settings';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Internal dependencies
|
11 |
+
*/
|
12 |
+
import LoadMoreButton from '../../base/components/load-more-button';
|
13 |
+
import ReviewOrderSelect from '../../base/components/review-order-select';
|
14 |
+
import ReviewList from '../../base/components/review-list';
|
15 |
+
import withReviews from '../../base/hocs/with-reviews';
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Block rendered in the frontend.
|
19 |
+
*/
|
20 |
+
const FrontendBlock = ( { attributes, onAppendReviews, onChangeOrderby, reviews, totalReviews } ) => {
|
21 |
+
const { orderby } = attributes;
|
22 |
+
|
23 |
+
if ( 0 === reviews.length ) {
|
24 |
+
return null;
|
25 |
+
}
|
26 |
+
|
27 |
+
return (
|
28 |
+
<Fragment>
|
29 |
+
{ ( attributes.showOrderby !== 'false' && ENABLE_REVIEW_RATING ) && (
|
30 |
+
<ReviewOrderSelect
|
31 |
+
defaultValue={ orderby }
|
32 |
+
onChange={ onChangeOrderby }
|
33 |
+
/>
|
34 |
+
) }
|
35 |
+
<ReviewList
|
36 |
+
attributes={ attributes }
|
37 |
+
reviews={ reviews }
|
38 |
+
/>
|
39 |
+
{ ( attributes.showLoadMore !== 'false' && totalReviews > reviews.length ) && (
|
40 |
+
<LoadMoreButton
|
41 |
+
onClick={ onAppendReviews }
|
42 |
+
screenReaderLabel={ __( 'Load more reviews', 'woo-gutenberg-products-block' ) }
|
43 |
+
/>
|
44 |
+
) }
|
45 |
+
</Fragment>
|
46 |
+
);
|
47 |
+
};
|
48 |
+
|
49 |
+
FrontendBlock.propTypes = {
|
50 |
+
/**
|
51 |
+
* The attributes for this block.
|
52 |
+
*/
|
53 |
+
attributes: PropTypes.object.isRequired,
|
54 |
+
onAppendReviews: PropTypes.func,
|
55 |
+
onChangeArgs: PropTypes.func,
|
56 |
+
// from withReviewsattributes
|
57 |
+
reviews: PropTypes.array,
|
58 |
+
totalReviews: PropTypes.number,
|
59 |
+
};
|
60 |
+
|
61 |
+
export default withReviews( FrontendBlock );
|
assets/js/blocks/reviews/frontend-container-block.js
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
+
import { speak } from '@wordpress/a11y';
|
6 |
+
import { Component } from 'react';
|
7 |
+
import PropTypes from 'prop-types';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Internal dependencies
|
11 |
+
*/
|
12 |
+
import { getOrderArgs } from './utils';
|
13 |
+
import FrontendBlock from './frontend-block';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Container of the block rendered in the frontend.
|
17 |
+
*/
|
18 |
+
class FrontendContainerBlock extends Component {
|
19 |
+
constructor() {
|
20 |
+
super( ...arguments );
|
21 |
+
const { attributes } = this.props;
|
22 |
+
|
23 |
+
this.state = {
|
24 |
+
orderby: attributes.orderby,
|
25 |
+
reviewsToDisplay: parseInt( attributes.reviewsOnPageLoad, 10 ),
|
26 |
+
};
|
27 |
+
|
28 |
+
this.onAppendReviews = this.onAppendReviews.bind( this );
|
29 |
+
this.onChangeOrderby = this.onChangeOrderby.bind( this );
|
30 |
+
}
|
31 |
+
|
32 |
+
onAppendReviews() {
|
33 |
+
const { attributes } = this.props;
|
34 |
+
const { reviewsToDisplay } = this.state;
|
35 |
+
|
36 |
+
this.setState( {
|
37 |
+
reviewsToDisplay: reviewsToDisplay + parseInt( attributes.reviewsOnLoadMore, 10 ),
|
38 |
+
} );
|
39 |
+
}
|
40 |
+
|
41 |
+
onChangeOrderby( event ) {
|
42 |
+
const { attributes } = this.props;
|
43 |
+
|
44 |
+
this.setState( {
|
45 |
+
orderby: event.target.value,
|
46 |
+
reviewsToDisplay: parseInt( attributes.reviewsOnPageLoad, 10 ),
|
47 |
+
} );
|
48 |
+
}
|
49 |
+
|
50 |
+
onReviewsAppended( { newReviews } ) {
|
51 |
+
speak(
|
52 |
+
sprintf(
|
53 |
+
_n(
|
54 |
+
'%d review loaded.',
|
55 |
+
'%d reviews loaded.',
|
56 |
+
newReviews.length,
|
57 |
+
'woo-gutenberg-products-block'
|
58 |
+
),
|
59 |
+
newReviews.length,
|
60 |
+
)
|
61 |
+
);
|
62 |
+
}
|
63 |
+
|
64 |
+
onReviewsReplaced() {
|
65 |
+
speak( __( 'Reviews list updated.', 'woo-gutenberg-products-block' ) );
|
66 |
+
}
|
67 |
+
|
68 |
+
onReviewsLoadError() {
|
69 |
+
speak( __( 'There was an error loading the reviews.', 'woo-gutenberg-products-block' ) );
|
70 |
+
}
|
71 |
+
|
72 |
+
render() {
|
73 |
+
const { attributes } = this.props;
|
74 |
+
const { categoryIds, productId } = attributes;
|
75 |
+
const { reviewsToDisplay } = this.state;
|
76 |
+
const { order, orderby } = getOrderArgs( this.state.orderby );
|
77 |
+
|
78 |
+
return (
|
79 |
+
<FrontendBlock
|
80 |
+
attributes={ attributes }
|
81 |
+
categoryIds={ categoryIds }
|
82 |
+
onAppendReviews={ this.onAppendReviews }
|
83 |
+
onChangeOrderby={ this.onChangeOrderby }
|
84 |
+
onReviewsAppended={ this.onReviewsAppended }
|
85 |
+
onReviewsLoadError={ this.onReviewsLoadError }
|
86 |
+
onReviewsReplaced={ this.onReviewsReplaced }
|
87 |
+
order={ order }
|
88 |
+
orderby={ orderby }
|
89 |
+
productId={ productId }
|
90 |
+
reviewsToDisplay={ reviewsToDisplay }
|
91 |
+
/>
|
92 |
+
);
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
FrontendContainerBlock.propTypes = {
|
97 |
+
/**
|
98 |
+
* The attributes for this block.
|
99 |
+
*/
|
100 |
+
attributes: PropTypes.object.isRequired,
|
101 |
+
};
|
102 |
+
|
103 |
+
export default FrontendContainerBlock;
|
assets/js/blocks/reviews/frontend.js
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { render } from 'react-dom';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import FrontendContainerBlock from './frontend-container-block.js';
|
10 |
+
|
11 |
+
const containers = document.querySelectorAll( `
|
12 |
+
.wp-block-woocommerce-all-reviews,
|
13 |
+
.wp-block-woocommerce-reviews-by-product,
|
14 |
+
.wp-block-woocommerce-reviews-by-category
|
15 |
+
` );
|
16 |
+
|
17 |
+
if ( containers.length ) {
|
18 |
+
// Use Array.forEach for IE11 compatibility
|
19 |
+
Array.prototype.forEach.call( containers, ( el ) => {
|
20 |
+
const attributes = {
|
21 |
+
...el.dataset,
|
22 |
+
showReviewDate: el.classList.contains( 'has-date' ),
|
23 |
+
showReviewerName: el.classList.contains( 'has-name' ),
|
24 |
+
showReviewImage: el.classList.contains( 'has-image' ),
|
25 |
+
showReviewRating: el.classList.contains( 'has-rating' ),
|
26 |
+
showReviewContent: el.classList.contains( 'has-content' ),
|
27 |
+
showProductName: el.classList.contains( 'has-product-name' ),
|
28 |
+
};
|
29 |
+
|
30 |
+
render( <FrontendContainerBlock attributes={ attributes } />, el );
|
31 |
+
} );
|
32 |
+
}
|
assets/js/blocks/reviews/reviews-by-category/edit.js
ADDED
@@ -0,0 +1,172 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
+
import {
|
6 |
+
InspectorControls,
|
7 |
+
} from '@wordpress/editor';
|
8 |
+
import {
|
9 |
+
Button,
|
10 |
+
PanelBody,
|
11 |
+
Placeholder,
|
12 |
+
ToggleControl,
|
13 |
+
withSpokenMessages,
|
14 |
+
} from '@wordpress/components';
|
15 |
+
import { SearchListItem } from '@woocommerce/components';
|
16 |
+
import { Fragment } from '@wordpress/element';
|
17 |
+
import PropTypes from 'prop-types';
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Internal dependencies
|
21 |
+
*/
|
22 |
+
import ProductCategoryControl from '../../../components/product-category-control';
|
23 |
+
import { IconReviewsByCategory } from '../../../components/icons';
|
24 |
+
import EditorContainerBlock from '../editor-container-block.js';
|
25 |
+
import NoReviewsPlaceholder from './no-reviews-placeholder.js';
|
26 |
+
import { getBlockControls, getSharedReviewContentControls, getSharedReviewListControls } from '../edit-utils.js';
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Component to handle edit mode of "Reviews by Category".
|
30 |
+
*/
|
31 |
+
const ReviewsByCategoryEditor = ( { attributes, debouncedSpeak, setAttributes } ) => {
|
32 |
+
const { editMode, categoryIds } = attributes;
|
33 |
+
|
34 |
+
const renderCategoryControlItem = ( args ) => {
|
35 |
+
const { item, search, depth = 0 } = args;
|
36 |
+
const classes = [
|
37 |
+
'woocommerce-product-categories__item',
|
38 |
+
];
|
39 |
+
if ( search.length ) {
|
40 |
+
classes.push( 'is-searching' );
|
41 |
+
}
|
42 |
+
if ( depth === 0 && item.parent !== 0 ) {
|
43 |
+
classes.push( 'is-skip-level' );
|
44 |
+
}
|
45 |
+
|
46 |
+
const accessibleName = ! item.breadcrumbs.length ?
|
47 |
+
item.name :
|
48 |
+
`${ item.breadcrumbs.join( ', ' ) }, ${ item.name }`;
|
49 |
+
|
50 |
+
return (
|
51 |
+
<SearchListItem
|
52 |
+
className={ classes.join( ' ' ) }
|
53 |
+
{ ...args }
|
54 |
+
showCount
|
55 |
+
aria-label={ sprintf(
|
56 |
+
_n(
|
57 |
+
'%s, has %d product',
|
58 |
+
'%s, has %d products',
|
59 |
+
item.count,
|
60 |
+
'woo-gutenberg-products-block'
|
61 |
+
),
|
62 |
+
accessibleName,
|
63 |
+
item.count
|
64 |
+
) }
|
65 |
+
/>
|
66 |
+
);
|
67 |
+
};
|
68 |
+
|
69 |
+
const getInspectorControls = () => {
|
70 |
+
return (
|
71 |
+
<InspectorControls key="inspector">
|
72 |
+
<PanelBody
|
73 |
+
title={ __( 'Category', 'woo-gutenberg-products-block' ) }
|
74 |
+
initialOpen={ false }
|
75 |
+
>
|
76 |
+
<ProductCategoryControl
|
77 |
+
selected={ attributes.categoryIds }
|
78 |
+
onChange={ ( value = [] ) => {
|
79 |
+
const ids = value.map( ( { id } ) => id );
|
80 |
+
setAttributes( { categoryIds: ids } );
|
81 |
+
} }
|
82 |
+
renderItem={ renderCategoryControlItem }
|
83 |
+
/>
|
84 |
+
</PanelBody>
|
85 |
+
<PanelBody title={ __( 'Content', 'woo-gutenberg-products-block' ) }>
|
86 |
+
<ToggleControl
|
87 |
+
label={ __( 'Product name', 'woo-gutenberg-products-block' ) }
|
88 |
+
checked={ attributes.showProductName }
|
89 |
+
onChange={ () => setAttributes( { showProductName: ! attributes.showProductName } ) }
|
90 |
+
/>
|
91 |
+
{ getSharedReviewContentControls( attributes, setAttributes ) }
|
92 |
+
</PanelBody>
|
93 |
+
<PanelBody title={ __( 'List Settings', 'woo-gutenberg-products-block' ) }>
|
94 |
+
{ getSharedReviewListControls( attributes, setAttributes ) }
|
95 |
+
</PanelBody>
|
96 |
+
</InspectorControls>
|
97 |
+
);
|
98 |
+
};
|
99 |
+
|
100 |
+
const renderEditMode = () => {
|
101 |
+
const onDone = () => {
|
102 |
+
setAttributes( { editMode: false } );
|
103 |
+
debouncedSpeak(
|
104 |
+
__(
|
105 |
+
'Showing Reviews by Category block preview.',
|
106 |
+
'woo-gutenberg-products-block'
|
107 |
+
)
|
108 |
+
);
|
109 |
+
};
|
110 |
+
|
111 |
+
return (
|
112 |
+
<Placeholder
|
113 |
+
icon={ <IconReviewsByCategory className="block-editor-block-icon" /> }
|
114 |
+
label={ __( 'Reviews by Category', 'woo-gutenberg-products-block' ) }
|
115 |
+
>
|
116 |
+
{ __(
|
117 |
+
'Show product reviews from specific categories.',
|
118 |
+
'woo-gutenberg-products-block'
|
119 |
+
) }
|
120 |
+
<div className="wc-block-reviews__selection">
|
121 |
+
<ProductCategoryControl
|
122 |
+
selected={ attributes.categoryIds }
|
123 |
+
onChange={ ( value = [] ) => {
|
124 |
+
const ids = value.map( ( { id } ) => id );
|
125 |
+
setAttributes( { categoryIds: ids } );
|
126 |
+
} }
|
127 |
+
/>
|
128 |
+
<Button isDefault onClick={ onDone }>
|
129 |
+
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
130 |
+
</Button>
|
131 |
+
</div>
|
132 |
+
</Placeholder>
|
133 |
+
);
|
134 |
+
};
|
135 |
+
|
136 |
+
if ( ! categoryIds || editMode ) {
|
137 |
+
return renderEditMode();
|
138 |
+
}
|
139 |
+
|
140 |
+
return (
|
141 |
+
<Fragment>
|
142 |
+
{ getBlockControls( editMode, setAttributes ) }
|
143 |
+
{ getInspectorControls() }
|
144 |
+
<EditorContainerBlock
|
145 |
+
attributes={ attributes }
|
146 |
+
className="wc-block-reviews-by-category"
|
147 |
+
icon={ <IconReviewsByCategory className="block-editor-block-icon" /> }
|
148 |
+
name={ __( 'Reviews by Category', 'woo-gutenberg-products-block' ) }
|
149 |
+
noReviewsPlaceholder={ NoReviewsPlaceholder }
|
150 |
+
/>
|
151 |
+
</Fragment>
|
152 |
+
);
|
153 |
+
};
|
154 |
+
|
155 |
+
ReviewsByCategoryEditor.propTypes = {
|
156 |
+
/**
|
157 |
+
* The attributes for this block.
|
158 |
+
*/
|
159 |
+
attributes: PropTypes.object.isRequired,
|
160 |
+
/**
|
161 |
+
* The register block name.
|
162 |
+
*/
|
163 |
+
name: PropTypes.string.isRequired,
|
164 |
+
/**
|
165 |
+
* A callback to update attributes.
|
166 |
+
*/
|
167 |
+
setAttributes: PropTypes.func.isRequired,
|
168 |
+
// from withSpokenMessages
|
169 |
+
debouncedSpeak: PropTypes.func.isRequired,
|
170 |
+
};
|
171 |
+
|
172 |
+
export default withSpokenMessages( ReviewsByCategoryEditor );
|
assets/js/blocks/reviews/reviews-by-category/index.js
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import '../editor.scss';
|
11 |
+
import Editor from './edit';
|
12 |
+
import { IconReviewsByCategory } from '../../../components/icons';
|
13 |
+
import sharedAttributes from '../attributes';
|
14 |
+
import save from '../save.js';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Register and run the "Reviews by category" block.
|
18 |
+
*/
|
19 |
+
registerBlockType( 'woocommerce/reviews-by-category', {
|
20 |
+
title: __( 'Reviews by Category', 'woo-gutenberg-products-block' ),
|
21 |
+
icon: (
|
22 |
+
<IconReviewsByCategory fillColor="#96588a" />
|
23 |
+
),
|
24 |
+
category: 'woocommerce',
|
25 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
26 |
+
description: __(
|
27 |
+
'Show product reviews from specific categories.',
|
28 |
+
'woo-gutenberg-products-block'
|
29 |
+
),
|
30 |
+
attributes: {
|
31 |
+
...sharedAttributes,
|
32 |
+
/**
|
33 |
+
* The ids of the categories to load reviews for.
|
34 |
+
*/
|
35 |
+
categoryIds: {
|
36 |
+
type: 'array',
|
37 |
+
default: [],
|
38 |
+
},
|
39 |
+
/**
|
40 |
+
* Show the product name.
|
41 |
+
*/
|
42 |
+
showProductName: {
|
43 |
+
type: 'boolean',
|
44 |
+
default: true,
|
45 |
+
},
|
46 |
+
},
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Renders and manages the block.
|
50 |
+
*/
|
51 |
+
edit( props ) {
|
52 |
+
return <Editor { ...props } />;
|
53 |
+
},
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Save the props to post content.
|
57 |
+
*/
|
58 |
+
save,
|
59 |
+
} );
|
assets/js/blocks/reviews/reviews-by-category/no-reviews-placeholder.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Placeholder } from '@wordpress/components';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import { IconReviewsByCategory } from '../../../components/icons';
|
11 |
+
|
12 |
+
const NoReviewsPlaceholder = () => {
|
13 |
+
return (
|
14 |
+
<Placeholder
|
15 |
+
className="wc-block-reviews-by-category"
|
16 |
+
icon={ <IconReviewsByCategory className="block-editor-block-icon" /> }
|
17 |
+
label={ __( 'Reviews by Category', 'woo-gutenberg-products-block' ) }
|
18 |
+
>
|
19 |
+
{ __( 'This block lists reviews for products from selected categories. The selected categories do not have any reviews yet, but they will show up here when they do.', 'woo-gutenberg-products-block' ) }
|
20 |
+
</Placeholder>
|
21 |
+
);
|
22 |
+
};
|
23 |
+
|
24 |
+
export default NoReviewsPlaceholder;
|
assets/js/blocks/reviews/reviews-by-product/edit.js
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
+
import {
|
6 |
+
InspectorControls,
|
7 |
+
} from '@wordpress/editor';
|
8 |
+
import {
|
9 |
+
Button,
|
10 |
+
PanelBody,
|
11 |
+
Placeholder,
|
12 |
+
withSpokenMessages,
|
13 |
+
} from '@wordpress/components';
|
14 |
+
import { SearchListItem } from '@woocommerce/components';
|
15 |
+
import { Fragment } from '@wordpress/element';
|
16 |
+
import PropTypes from 'prop-types';
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Internal dependencies
|
20 |
+
*/
|
21 |
+
import ProductControl from '../../../components/product-control';
|
22 |
+
import { IconReviewsByProduct } from '../../../components/icons';
|
23 |
+
import EditorContainerBlock from '../editor-container-block.js';
|
24 |
+
import NoReviewsPlaceholder from './no-reviews-placeholder.js';
|
25 |
+
import { getBlockControls, getSharedReviewContentControls, getSharedReviewListControls } from '../edit-utils.js';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Component to handle edit mode of "Reviews by Product".
|
29 |
+
*/
|
30 |
+
const ReviewsByProductEditor = ( { attributes, debouncedSpeak, setAttributes } ) => {
|
31 |
+
const { editMode, productId } = attributes;
|
32 |
+
|
33 |
+
const renderProductControlItem = ( args ) => {
|
34 |
+
const { item = 0 } = args;
|
35 |
+
|
36 |
+
return (
|
37 |
+
<SearchListItem
|
38 |
+
{ ...args }
|
39 |
+
countLabel={ sprintf(
|
40 |
+
_n(
|
41 |
+
'%d Review',
|
42 |
+
'%d Reviews',
|
43 |
+
item.review_count,
|
44 |
+
'woo-gutenberg-products-block'
|
45 |
+
),
|
46 |
+
item.review_count
|
47 |
+
) }
|
48 |
+
showCount
|
49 |
+
aria-label={ sprintf(
|
50 |
+
_n(
|
51 |
+
'%s, has %d review',
|
52 |
+
'%s, has %d reviews',
|
53 |
+
item.review_count,
|
54 |
+
'woo-gutenberg-products-block'
|
55 |
+
),
|
56 |
+
item.name,
|
57 |
+
item.review_count
|
58 |
+
) }
|
59 |
+
/>
|
60 |
+
);
|
61 |
+
};
|
62 |
+
|
63 |
+
const getInspectorControls = () => {
|
64 |
+
return (
|
65 |
+
<InspectorControls key="inspector">
|
66 |
+
<PanelBody
|
67 |
+
title={ __( 'Product', 'woo-gutenberg-products-block' ) }
|
68 |
+
initialOpen={ false }
|
69 |
+
>
|
70 |
+
<ProductControl
|
71 |
+
selected={ attributes.productId || 0 }
|
72 |
+
onChange={ ( value = [] ) => {
|
73 |
+
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
74 |
+
setAttributes( { productId: id } );
|
75 |
+
} }
|
76 |
+
renderItem={ renderProductControlItem }
|
77 |
+
/>
|
78 |
+
</PanelBody>
|
79 |
+
<PanelBody title={ __( 'Content', 'woo-gutenberg-products-block' ) }>
|
80 |
+
{ getSharedReviewContentControls( attributes, setAttributes ) }
|
81 |
+
</PanelBody>
|
82 |
+
<PanelBody title={ __( 'List Settings', 'woo-gutenberg-products-block' ) }>
|
83 |
+
{ getSharedReviewListControls( attributes, setAttributes ) }
|
84 |
+
</PanelBody>
|
85 |
+
</InspectorControls>
|
86 |
+
);
|
87 |
+
};
|
88 |
+
|
89 |
+
const renderEditMode = () => {
|
90 |
+
const onDone = () => {
|
91 |
+
setAttributes( { editMode: false } );
|
92 |
+
debouncedSpeak(
|
93 |
+
__(
|
94 |
+
'Showing Reviews by Product block preview.',
|
95 |
+
'woo-gutenberg-products-block'
|
96 |
+
)
|
97 |
+
);
|
98 |
+
};
|
99 |
+
|
100 |
+
return (
|
101 |
+
<Placeholder
|
102 |
+
icon={ <IconReviewsByProduct className="block-editor-block-icon" /> }
|
103 |
+
label={ __( 'Reviews by Product', 'woo-gutenberg-products-block' ) }
|
104 |
+
>
|
105 |
+
{ __(
|
106 |
+
'Show reviews of your product to build trust',
|
107 |
+
'woo-gutenberg-products-block'
|
108 |
+
) }
|
109 |
+
<div className="wc-block-reviews__selection">
|
110 |
+
<ProductControl
|
111 |
+
selected={ attributes.productId || 0 }
|
112 |
+
onChange={ ( value = [] ) => {
|
113 |
+
const id = value[ 0 ] ? value[ 0 ].id : 0;
|
114 |
+
setAttributes( { productId: id } );
|
115 |
+
} }
|
116 |
+
queryArgs={ {
|
117 |
+
orderby: 'comment_count',
|
118 |
+
order: 'desc',
|
119 |
+
} }
|
120 |
+
renderItem={ renderProductControlItem }
|
121 |
+
/>
|
122 |
+
<Button isDefault onClick={ onDone }>
|
123 |
+
{ __( 'Done', 'woo-gutenberg-products-block' ) }
|
124 |
+
</Button>
|
125 |
+
</div>
|
126 |
+
</Placeholder>
|
127 |
+
);
|
128 |
+
};
|
129 |
+
|
130 |
+
if ( ! productId || editMode ) {
|
131 |
+
return renderEditMode();
|
132 |
+
}
|
133 |
+
|
134 |
+
return (
|
135 |
+
<Fragment>
|
136 |
+
{ getBlockControls( editMode, setAttributes ) }
|
137 |
+
{ getInspectorControls() }
|
138 |
+
<EditorContainerBlock
|
139 |
+
attributes={ attributes }
|
140 |
+
className="wc-block-all-reviews"
|
141 |
+
icon={ <IconReviewsByProduct className="block-editor-block-icon" /> }
|
142 |
+
name={ __( 'Reviews by Product', 'woo-gutenberg-products-block' ) }
|
143 |
+
noReviewsPlaceholder={ NoReviewsPlaceholder }
|
144 |
+
/>
|
145 |
+
</Fragment>
|
146 |
+
);
|
147 |
+
};
|
148 |
+
|
149 |
+
ReviewsByProductEditor.propTypes = {
|
150 |
+
/**
|
151 |
+
* The attributes for this block.
|
152 |
+
*/
|
153 |
+
attributes: PropTypes.object.isRequired,
|
154 |
+
/**
|
155 |
+
* The register block name.
|
156 |
+
*/
|
157 |
+
name: PropTypes.string.isRequired,
|
158 |
+
/**
|
159 |
+
* A callback to update attributes.
|
160 |
+
*/
|
161 |
+
setAttributes: PropTypes.func.isRequired,
|
162 |
+
// from withSpokenMessages
|
163 |
+
debouncedSpeak: PropTypes.func.isRequired,
|
164 |
+
};
|
165 |
+
|
166 |
+
export default withSpokenMessages( ReviewsByProductEditor );
|
assets/js/blocks/reviews/reviews-by-product/index.js
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { registerBlockType } from '@wordpress/blocks';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import '../editor.scss';
|
11 |
+
import Editor from './edit';
|
12 |
+
import { IconReviewsByProduct } from '../../../components/icons';
|
13 |
+
import sharedAttributes from '../attributes';
|
14 |
+
import save from '../save.js';
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Register and run the "Reviews by Product" block.
|
18 |
+
*/
|
19 |
+
registerBlockType( 'woocommerce/reviews-by-product', {
|
20 |
+
title: __( 'Reviews by Product', 'woo-gutenberg-products-block' ),
|
21 |
+
icon: (
|
22 |
+
<IconReviewsByProduct fillColor="#96588a" />
|
23 |
+
),
|
24 |
+
category: 'woocommerce',
|
25 |
+
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
26 |
+
description: __(
|
27 |
+
'Show reviews of your product to build trust.',
|
28 |
+
'woo-gutenberg-products-block'
|
29 |
+
),
|
30 |
+
attributes: {
|
31 |
+
...sharedAttributes,
|
32 |
+
/**
|
33 |
+
* The id of the product to load reviews for.
|
34 |
+
*/
|
35 |
+
productId: {
|
36 |
+
type: 'number',
|
37 |
+
},
|
38 |
+
},
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Renders and manages the block.
|
42 |
+
*/
|
43 |
+
edit( props ) {
|
44 |
+
return <Editor { ...props } />;
|
45 |
+
},
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Save the props to post content.
|
49 |
+
*/
|
50 |
+
save,
|
51 |
+
} );
|
assets/js/blocks/reviews/reviews-by-product/no-reviews-placeholder.js
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __, sprintf } from '@wordpress/i18n';
|
5 |
+
import { Placeholder, Spinner } from '@wordpress/components';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Internal dependencies
|
10 |
+
*/
|
11 |
+
import ApiErrorPlaceholder from '../../../components/api-error-placeholder';
|
12 |
+
import { IconReviewsByProduct } from '../../../components/icons';
|
13 |
+
import { withProduct } from '../../../hocs';
|
14 |
+
|
15 |
+
const NoReviewsPlaceholder = ( { error, getProduct, isLoading, product } ) => {
|
16 |
+
const renderApiError = () => (
|
17 |
+
<ApiErrorPlaceholder
|
18 |
+
className="wc-block-featured-product-error"
|
19 |
+
error={ error }
|
20 |
+
isLoading={ isLoading }
|
21 |
+
onRetry={ getProduct }
|
22 |
+
/>
|
23 |
+
);
|
24 |
+
|
25 |
+
if ( error ) {
|
26 |
+
return renderApiError();
|
27 |
+
}
|
28 |
+
|
29 |
+
const content = ( ! product || isLoading ) ?
|
30 |
+
<Spinner /> :
|
31 |
+
sprintf(
|
32 |
+
__(
|
33 |
+
"This block lists reviews for a selected product. %s doesn't have any reviews yet, but they will show up here when it does.",
|
34 |
+
'woo-gutenberg-products-block'
|
35 |
+
),
|
36 |
+
product.name
|
37 |
+
);
|
38 |
+
|
39 |
+
return (
|
40 |
+
<Placeholder
|
41 |
+
className="wc-block-reviews-by-product"
|
42 |
+
icon={ <IconReviewsByProduct className="block-editor-block-icon" /> }
|
43 |
+
label={ __( 'Reviews by Product', 'woo-gutenberg-products-block' ) }
|
44 |
+
>
|
45 |
+
{ content }
|
46 |
+
</Placeholder>
|
47 |
+
);
|
48 |
+
};
|
49 |
+
|
50 |
+
NoReviewsPlaceholder.propTypes = {
|
51 |
+
// from withProduct
|
52 |
+
error: PropTypes.object,
|
53 |
+
isLoading: PropTypes.bool,
|
54 |
+
product: PropTypes.shape( {
|
55 |
+
name: PropTypes.node,
|
56 |
+
review_count: PropTypes.number,
|
57 |
+
} ),
|
58 |
+
};
|
59 |
+
|
60 |
+
export default withProduct( NoReviewsPlaceholder );
|
assets/js/blocks/reviews/save.js
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import './editor.scss';
|
5 |
+
import { getBlockClassName } from './utils.js';
|
6 |
+
|
7 |
+
export default ( { attributes } ) => {
|
8 |
+
const { categoryIds, imageType, orderby, productId, reviewsOnPageLoad, reviewsOnLoadMore, showLoadMore, showOrderby } = attributes;
|
9 |
+
|
10 |
+
const data = {
|
11 |
+
'data-image-type': imageType,
|
12 |
+
'data-orderby': orderby,
|
13 |
+
'data-reviews-on-page-load': reviewsOnPageLoad,
|
14 |
+
'data-reviews-on-load-more': reviewsOnLoadMore,
|
15 |
+
'data-show-load-more': showLoadMore,
|
16 |
+
'data-show-orderby': showOrderby,
|
17 |
+
};
|
18 |
+
let className = 'wc-block-all-reviews';
|
19 |
+
|
20 |
+
if ( productId ) {
|
21 |
+
data[ 'data-product-id' ] = productId;
|
22 |
+
className = 'wc-block-reviews-by-product';
|
23 |
+
}
|
24 |
+
|
25 |
+
if ( Array.isArray( categoryIds ) ) {
|
26 |
+
data[ 'data-category-ids' ] = categoryIds.join( ',' );
|
27 |
+
className = 'wc-block-reviews-by-category';
|
28 |
+
}
|
29 |
+
|
30 |
+
return (
|
31 |
+
<div className={ getBlockClassName( className, attributes ) } { ...data } />
|
32 |
+
);
|
33 |
+
};
|
assets/js/blocks/reviews/utils.js
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import apiFetch from '@wordpress/api-fetch';
|
5 |
+
import classNames from 'classnames';
|
6 |
+
import { ENABLE_REVIEW_RATING } from '@woocommerce/block-settings';
|
7 |
+
|
8 |
+
export const getOrderArgs = ( orderValue ) => {
|
9 |
+
if ( ENABLE_REVIEW_RATING ) {
|
10 |
+
if ( orderValue === 'lowest-rating' ) {
|
11 |
+
return {
|
12 |
+
order: 'asc',
|
13 |
+
orderby: 'rating',
|
14 |
+
};
|
15 |
+
}
|
16 |
+
if ( orderValue === 'highest-rating' ) {
|
17 |
+
return {
|
18 |
+
order: 'desc',
|
19 |
+
orderby: 'rating',
|
20 |
+
};
|
21 |
+
}
|
22 |
+
}
|
23 |
+
|
24 |
+
return {
|
25 |
+
order: 'desc',
|
26 |
+
orderby: 'date_gmt',
|
27 |
+
};
|
28 |
+
};
|
29 |
+
|
30 |
+
export const getReviews = ( args ) => {
|
31 |
+
return apiFetch( {
|
32 |
+
path: '/wc/blocks/products/reviews?' + Object.entries( args ).map( ( arg ) => arg.join( '=' ) ).join( '&' ),
|
33 |
+
parse: false,
|
34 |
+
} ).then( ( response ) => {
|
35 |
+
return response.json().then( ( reviews ) => {
|
36 |
+
const totalReviews = parseInt( response.headers.get( 'x-wp-total' ), 10 );
|
37 |
+
return { reviews, totalReviews };
|
38 |
+
} );
|
39 |
+
} );
|
40 |
+
};
|
41 |
+
|
42 |
+
export const getBlockClassName = ( blockClassName, attributes ) => {
|
43 |
+
const { className, showReviewDate, showReviewerName, showReviewContent, showProductName, showReviewImage, showReviewRating } = attributes;
|
44 |
+
|
45 |
+
return classNames(
|
46 |
+
blockClassName,
|
47 |
+
className,
|
48 |
+
{
|
49 |
+
'has-image': showReviewImage,
|
50 |
+
'has-name': showReviewerName,
|
51 |
+
'has-date': showReviewDate,
|
52 |
+
'has-rating': showReviewRating,
|
53 |
+
'has-content': showReviewContent,
|
54 |
+
'has-product-name': showProductName,
|
55 |
+
}
|
56 |
+
);
|
57 |
+
};
|
assets/js/components/api-error-placeholder/index.js
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { __ } from '@wordpress/i18n';
|
5 |
+
import { Fragment } from '@wordpress/element';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
+
import Gridicon from 'gridicons';
|
8 |
+
import classNames from 'classnames';
|
9 |
+
import { escapeHTML } from '@wordpress/escape-html';
|
10 |
+
import {
|
11 |
+
Button,
|
12 |
+
Placeholder,
|
13 |
+
Spinner,
|
14 |
+
} from '@wordpress/components';
|
15 |
+
|
16 |
+
const getErrorMessage = ( { apiMessage, message } ) => {
|
17 |
+
if ( message ) {
|
18 |
+
return message;
|
19 |
+
}
|
20 |
+
|
21 |
+
if ( apiMessage ) {
|
22 |
+
return (
|
23 |
+
<span>
|
24 |
+
{ __( 'The following error was returned from the API', 'woo-gutenberg-products-block' ) }
|
25 |
+
<br />
|
26 |
+
<code>{ escapeHTML( apiMessage ) }</code>
|
27 |
+
</span>
|
28 |
+
);
|
29 |
+
}
|
30 |
+
|
31 |
+
return __( 'An unknown error occurred which prevented the block from being updated.', 'woo-gutenberg-products-block' );
|
32 |
+
};
|
33 |
+
|
34 |
+
const ApiErrorPlaceholder = ( { className, error, isLoading, onRetry } ) => (
|
35 |
+
<Placeholder
|
36 |
+
icon={ <Gridicon icon="notice" /> }
|
37 |
+
label={ __( 'Sorry, an error occurred', 'woo-gutenberg-products-block' ) }
|
38 |
+
className={ classNames( 'wc-block-api-error', className ) }
|
39 |
+
>
|
40 |
+
<div className="wc-block-error__message">
|
41 |
+
{ getErrorMessage( error ) }
|
42 |
+
</div>
|
43 |
+
{ onRetry && (
|
44 |
+
<Fragment>
|
45 |
+
{ isLoading ? (
|
46 |
+
<Spinner />
|
47 |
+
) : (
|
48 |
+
<Button isDefault onClick={ onRetry }>
|
49 |
+
{ __( 'Retry', 'woo-gutenberg-products-block' ) }
|
50 |
+
</Button>
|
51 |
+
) }
|
52 |
+
</Fragment>
|
53 |
+
) }
|
54 |
+
</Placeholder>
|
55 |
+
);
|
56 |
+
|
57 |
+
ApiErrorPlaceholder.propTypes = {
|
58 |
+
/**
|
59 |
+
* Classname to add to placeholder in addition to the defaults.
|
60 |
+
*/
|
61 |
+
className: PropTypes.string,
|
62 |
+
/**
|
63 |
+
* The error object.
|
64 |
+
*/
|
65 |
+
error: PropTypes.shape( {
|
66 |
+
/**
|
67 |
+
* API error message to display in case of a missing `message`.
|
68 |
+
*/
|
69 |
+
apiMessage: PropTypes.node,
|
70 |
+
/**
|
71 |
+
* Human-readable error message to display.
|
72 |
+
*/
|
73 |
+
message: PropTypes.string,
|
74 |
+
} ),
|
75 |
+
/**
|
76 |
+
* Whether there is a request running, so the 'Retry' button is hidden and
|
77 |
+
* a spinner is shown instead.
|
78 |
+
*/
|
79 |
+
isLoading: PropTypes.bool,
|
80 |
+
/**
|
81 |
+
* Callback to retry an action.
|
82 |
+
*/
|
83 |
+
onRetry: PropTypes.func,
|
84 |
+
};
|
85 |
+
|
86 |
+
export default ApiErrorPlaceholder;
|
assets/js/components/grid-layout-control/index.js
CHANGED
@@ -6,6 +6,7 @@ import { clamp, isNaN } from 'lodash';
|
|
6 |
import { Fragment } from '@wordpress/element';
|
7 |
import PropTypes from 'prop-types';
|
8 |
import { RangeControl, ToggleControl } from '@wordpress/components';
|
|
|
9 |
|
10 |
/**
|
11 |
* A combination of range controls for product grid layout settings.
|
@@ -19,13 +20,13 @@ const GridLayoutControl = ( { columns, rows, setAttributes, alignButtons } ) =>
|
|
19 |
onChange={ ( value ) => {
|
20 |
const newValue = clamp(
|
21 |
value,
|
22 |
-
|
23 |
-
|
24 |
);
|
25 |
setAttributes( { columns: isNaN( newValue ) ? '' : newValue } );
|
26 |
} }
|
27 |
-
min={
|
28 |
-
max={
|
29 |
/>
|
30 |
<RangeControl
|
31 |
label={ __( 'Rows', 'woo-gutenberg-products-block' ) }
|
@@ -33,13 +34,13 @@ const GridLayoutControl = ( { columns, rows, setAttributes, alignButtons } ) =>
|
|
33 |
onChange={ ( value ) => {
|
34 |
const newValue = clamp(
|
35 |
value,
|
36 |
-
|
37 |
-
|
38 |
);
|
39 |
setAttributes( { rows: isNaN( newValue ) ? '' : newValue } );
|
40 |
} }
|
41 |
-
min={
|
42 |
-
max={
|
43 |
/>
|
44 |
<ToggleControl
|
45 |
label={ __( 'Align Add to Cart buttons', 'woo-gutenberg-products-block' ) }
|
6 |
import { Fragment } from '@wordpress/element';
|
7 |
import PropTypes from 'prop-types';
|
8 |
import { RangeControl, ToggleControl } from '@wordpress/components';
|
9 |
+
import { MAX_COLUMNS, MIN_COLUMNS, MAX_ROWS, MIN_ROWS } from '@woocommerce/block-settings';
|
10 |
|
11 |
/**
|
12 |
* A combination of range controls for product grid layout settings.
|
20 |
onChange={ ( value ) => {
|
21 |
const newValue = clamp(
|
22 |
value,
|
23 |
+
MIN_COLUMNS,
|
24 |
+
MAX_COLUMNS
|
25 |
);
|
26 |
setAttributes( { columns: isNaN( newValue ) ? '' : newValue } );
|
27 |
} }
|
28 |
+
min={ MIN_COLUMNS }
|
29 |
+
max={ MAX_COLUMNS }
|
30 |
/>
|
31 |
<RangeControl
|
32 |
label={ __( 'Rows', 'woo-gutenberg-products-block' ) }
|
34 |
onChange={ ( value ) => {
|
35 |
const newValue = clamp(
|
36 |
value,
|
37 |
+
MIN_ROWS,
|
38 |
+
MAX_ROWS
|
39 |
);
|
40 |
setAttributes( { rows: isNaN( newValue ) ? '' : newValue } );
|
41 |
} }
|
42 |
+
min={ MIN_ROWS }
|
43 |
+
max={ MAX_ROWS }
|
44 |
/>
|
45 |
<ToggleControl
|
46 |
label={ __( 'Align Add to Cart buttons', 'woo-gutenberg-products-block' ) }
|
assets/js/components/icons/all-reviews.js
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Icon } from '@wordpress/components';
|
5 |
+
|
6 |
+
export default ( { className, fillColor } ) => (
|
7 |
+
<Icon
|
8 |
+
className={ className }
|
9 |
+
icon={
|
10 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 22.41">
|
11 |
+
<g>
|
12 |
+
<g>
|
13 |
+
<path fill={ fillColor } d="M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z" />
|
14 |
+
<path fill={ fillColor } d="M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z" />
|
15 |
+
<path fill={ fillColor } d="M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z" />
|
16 |
+
<path fill="#ffffff" d="M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z" />
|
17 |
+
</g>
|
18 |
+
</g>
|
19 |
+
</svg>
|
20 |
+
}
|
21 |
+
/>
|
22 |
+
);
|
assets/js/components/icons/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
// Export each icon as a named component.
|
|
|
2 |
export { default as IconCheckChecked } from './checkbox-checked';
|
3 |
export { default as IconCheckUnchecked } from './checkbox-unchecked';
|
4 |
export { default as IconFolder } from './folder';
|
@@ -6,5 +7,7 @@ export { default as IconFolderStar } from './folder-star';
|
|
6 |
export { default as IconNewReleases } from './new-releases';
|
7 |
export { default as IconRadioSelected } from './radio-selected';
|
8 |
export { default as IconRadioUnselected } from './radio-unselected';
|
|
|
|
|
9 |
export { default as IconWidgets } from './widgets';
|
10 |
export { default as IconWoo } from './woo';
|
1 |
// Export each icon as a named component.
|
2 |
+
export { default as IconAllReviews } from './all-reviews';
|
3 |
export { default as IconCheckChecked } from './checkbox-checked';
|
4 |
export { default as IconCheckUnchecked } from './checkbox-unchecked';
|
5 |
export { default as IconFolder } from './folder';
|
7 |
export { default as IconNewReleases } from './new-releases';
|
8 |
export { default as IconRadioSelected } from './radio-selected';
|
9 |
export { default as IconRadioUnselected } from './radio-unselected';
|
10 |
+
export { default as IconReviewsByProduct } from './reviews-by-product';
|
11 |
+
export { default as IconReviewsByCategory } from './reviews-by-category';
|
12 |
export { default as IconWidgets } from './widgets';
|
13 |
export { default as IconWoo } from './woo';
|
assets/js/components/icons/reviews-by-category.js
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Icon } from '@wordpress/components';
|
5 |
+
|
6 |
+
export default ( { className, fillColor } ) => (
|
7 |
+
<Icon
|
8 |
+
className={ className }
|
9 |
+
icon={
|
10 |
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 23">
|
11 |
+
<path fill={ fillColor } d="M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z" />
|
12 |
+
<path fill={ fillColor } d="M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z" />
|
13 |
+
<path fill="white" d="M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z" />
|
14 |
+
<path fill="white" d="M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z" />
|
15 |
+
<path fill="white" d="M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z" />
|
16 |
+
</svg>
|
17 |
+
}
|
18 |
+
/>
|
19 |
+
);
|
assets/js/components/icons/reviews-by-product.js
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Icon } from '@wordpress/components';
|
5 |
+
|
6 |
+
export default ( { className, fillColor } ) => (
|
7 |
+
<Icon
|
8 |
+
className={ className }
|
9 |
+
icon={
|
10 |
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
11 |
+
<path fill={ fillColor } d="M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z" />
|
12 |
+
<polygon fill="#ffffff" points="8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5" />
|
13 |
+
<path fill="#ffffff" d="M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z" />
|
14 |
+
<path fill="#ffffff" d="M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z" />
|
15 |
+
</svg>
|
16 |
+
}
|
17 |
+
/>
|
18 |
+
);
|
assets/js/components/product-attribute-control/index.js
CHANGED
@@ -9,6 +9,7 @@ import { debounce, find } from 'lodash';
|
|
9 |
import PropTypes from 'prop-types';
|
10 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
11 |
import { SelectControl, Spinner } from '@wordpress/components';
|
|
|
12 |
|
13 |
/**
|
14 |
* Internal dependencies
|
@@ -34,7 +35,7 @@ class ProductAttributeControl extends Component {
|
|
34 |
componentDidMount() {
|
35 |
const { selected } = this.props;
|
36 |
apiFetch( {
|
37 |
-
path: addQueryArgs(
|
38 |
} )
|
39 |
.then( ( list ) => {
|
40 |
list = list.map( ( item ) => ( { ...item, parent: 0 } ) );
|
@@ -51,6 +52,10 @@ class ProductAttributeControl extends Component {
|
|
51 |
} );
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
54 |
componentDidUpdate( prevProps, prevState ) {
|
55 |
if ( prevState.attribute !== this.state.attribute ) {
|
56 |
this.debouncedGetTerms();
|
@@ -67,7 +72,7 @@ class ProductAttributeControl extends Component {
|
|
67 |
}
|
68 |
|
69 |
apiFetch( {
|
70 |
-
path: addQueryArgs(
|
71 |
per_page: -1,
|
72 |
} ),
|
73 |
} )
|
9 |
import PropTypes from 'prop-types';
|
10 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
11 |
import { SelectControl, Spinner } from '@wordpress/components';
|
12 |
+
import { ENDPOINTS } from '@woocommerce/block-settings';
|
13 |
|
14 |
/**
|
15 |
* Internal dependencies
|
35 |
componentDidMount() {
|
36 |
const { selected } = this.props;
|
37 |
apiFetch( {
|
38 |
+
path: addQueryArgs( `${ ENDPOINTS.products }/attributes`, { per_page: -1 } ),
|
39 |
} )
|
40 |
.then( ( list ) => {
|
41 |
list = list.map( ( item ) => ( { ...item, parent: 0 } ) );
|
52 |
} );
|
53 |
}
|
54 |
|
55 |
+
componentWillUnmount() {
|
56 |
+
this.debouncedGetTerms.cancel();
|
57 |
+
}
|
58 |
+
|
59 |
componentDidUpdate( prevProps, prevState ) {
|
60 |
if ( prevState.attribute !== this.state.attribute ) {
|
61 |
this.debouncedGetTerms();
|
72 |
}
|
73 |
|
74 |
apiFetch( {
|
75 |
+
path: addQueryArgs( `${ ENDPOINTS.products }/attributes/${ attribute }/terms`, {
|
76 |
per_page: -1,
|
77 |
} ),
|
78 |
} )
|
assets/js/components/product-category-control/index.js
CHANGED
@@ -9,6 +9,7 @@ import { find } from 'lodash';
|
|
9 |
import PropTypes from 'prop-types';
|
10 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
11 |
import { SelectControl } from '@wordpress/components';
|
|
|
12 |
|
13 |
/**
|
14 |
* Internal dependencies
|
@@ -27,7 +28,7 @@ class ProductCategoryControl extends Component {
|
|
27 |
|
28 |
componentDidMount() {
|
29 |
apiFetch( {
|
30 |
-
path: addQueryArgs(
|
31 |
} )
|
32 |
.then( ( list ) => {
|
33 |
this.setState( { list, loading: false } );
|
9 |
import PropTypes from 'prop-types';
|
10 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
11 |
import { SelectControl } from '@wordpress/components';
|
12 |
+
import { ENDPOINTS } from '@woocommerce/block-settings';
|
13 |
|
14 |
/**
|
15 |
* Internal dependencies
|
28 |
|
29 |
componentDidMount() {
|
30 |
apiFetch( {
|
31 |
+
path: addQueryArgs( `${ ENDPOINTS.products }/categories`, { per_page: -1 } ),
|
32 |
} )
|
33 |
.then( ( list ) => {
|
34 |
this.setState( { list, loading: false } );
|
assets/js/components/product-control/index.js
CHANGED
@@ -13,11 +13,12 @@ import {
|
|
13 |
} from '@woocommerce/components';
|
14 |
import { Spinner, MenuItem } from '@wordpress/components';
|
15 |
import classnames from 'classnames';
|
|
|
16 |
|
17 |
/**
|
18 |
* Internal dependencies
|
19 |
*/
|
20 |
-
import {
|
21 |
import {
|
22 |
IconRadioSelected,
|
23 |
IconRadioUnselected,
|
@@ -53,17 +54,22 @@ class ProductControl extends Component {
|
|
53 |
this.onProductSelect = this.onProductSelect.bind( this );
|
54 |
}
|
55 |
|
|
|
|
|
|
|
|
|
|
|
56 |
componentDidMount() {
|
57 |
-
const { selected } = this.props;
|
58 |
|
59 |
-
getProducts( { selected } )
|
60 |
.then( ( products ) => {
|
61 |
products = products.map( ( product ) => {
|
62 |
const count = product.variations ? product.variations.length : 0;
|
63 |
return {
|
64 |
...product,
|
65 |
parent: 0,
|
66 |
-
count
|
67 |
};
|
68 |
} );
|
69 |
this.setState( { products, loading: false } );
|
@@ -80,7 +86,7 @@ class ProductControl extends Component {
|
|
80 |
}
|
81 |
|
82 |
getVariations() {
|
83 |
-
const { product, variationsList } = this.state;
|
84 |
|
85 |
if ( ! product ) {
|
86 |
this.setState( {
|
@@ -90,7 +96,7 @@ class ProductControl extends Component {
|
|
90 |
return;
|
91 |
}
|
92 |
|
93 |
-
const productDetails =
|
94 |
|
95 |
if ( ! productDetails.variations || productDetails.variations.length === 0 ) {
|
96 |
return;
|
@@ -101,7 +107,7 @@ class ProductControl extends Component {
|
|
101 |
}
|
102 |
|
103 |
apiFetch( {
|
104 |
-
path: addQueryArgs(
|
105 |
per_page: -1,
|
106 |
} ),
|
107 |
} )
|
@@ -118,8 +124,8 @@ class ProductControl extends Component {
|
|
118 |
}
|
119 |
|
120 |
onSearch( search ) {
|
121 |
-
const { selected } = this.props;
|
122 |
-
getProducts( { selected, search } )
|
123 |
.then( ( products ) => {
|
124 |
this.setState( { products, loading: false } );
|
125 |
} )
|
@@ -237,7 +243,7 @@ class ProductControl extends Component {
|
|
237 |
|
238 |
render() {
|
239 |
const { products, loading, product, variationsList } = this.state;
|
240 |
-
const { onChange, selected } = this.props;
|
241 |
const currentVariations = variationsList[ product ] || [];
|
242 |
const currentList = [ ...products, ...currentVariations ];
|
243 |
const messages = {
|
@@ -266,9 +272,9 @@ class ProductControl extends Component {
|
|
266 |
isSingle
|
267 |
selected={ selectedListItems }
|
268 |
onChange={ onChange }
|
269 |
-
|
|
|
270 |
messages={ messages }
|
271 |
-
renderItem={ this.renderItem }
|
272 |
isHierarchical
|
273 |
/>
|
274 |
</Fragment>
|
@@ -281,10 +287,18 @@ ProductControl.propTypes = {
|
|
281 |
* Callback to update the selected products.
|
282 |
*/
|
283 |
onChange: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
|
284 |
/**
|
285 |
* The ID of the currently selected product.
|
286 |
*/
|
287 |
selected: PropTypes.number.isRequired,
|
|
|
|
|
|
|
|
|
288 |
};
|
289 |
|
290 |
export default ProductControl;
|
13 |
} from '@woocommerce/components';
|
14 |
import { Spinner, MenuItem } from '@wordpress/components';
|
15 |
import classnames from 'classnames';
|
16 |
+
import { ENDPOINTS, IS_LARGE_CATALOG } from '@woocommerce/block-settings';
|
17 |
|
18 |
/**
|
19 |
* Internal dependencies
|
20 |
*/
|
21 |
+
import { getProducts } from '../utils';
|
22 |
import {
|
23 |
IconRadioSelected,
|
24 |
IconRadioUnselected,
|
54 |
this.onProductSelect = this.onProductSelect.bind( this );
|
55 |
}
|
56 |
|
57 |
+
componentWillUnmount() {
|
58 |
+
this.debouncedOnSearch.cancel();
|
59 |
+
this.debouncedGetVariations.cancel();
|
60 |
+
}
|
61 |
+
|
62 |
componentDidMount() {
|
63 |
+
const { selected, queryArgs } = this.props;
|
64 |
|
65 |
+
getProducts( { selected, queryArgs } )
|
66 |
.then( ( products ) => {
|
67 |
products = products.map( ( product ) => {
|
68 |
const count = product.variations ? product.variations.length : 0;
|
69 |
return {
|
70 |
...product,
|
71 |
parent: 0,
|
72 |
+
count,
|
73 |
};
|
74 |
} );
|
75 |
this.setState( { products, loading: false } );
|
86 |
}
|
87 |
|
88 |
getVariations() {
|
89 |
+
const { product, products, variationsList } = this.state;
|
90 |
|
91 |
if ( ! product ) {
|
92 |
this.setState( {
|
96 |
return;
|
97 |
}
|
98 |
|
99 |
+
const productDetails = products.find( ( findProduct ) => findProduct.id === product );
|
100 |
|
101 |
if ( ! productDetails.variations || productDetails.variations.length === 0 ) {
|
102 |
return;
|
107 |
}
|
108 |
|
109 |
apiFetch( {
|
110 |
+
path: addQueryArgs( `${ ENDPOINTS.products }/${ product }/variations`, {
|
111 |
per_page: -1,
|
112 |
} ),
|
113 |
} )
|
124 |
}
|
125 |
|
126 |
onSearch( search ) {
|
127 |
+
const { selected, queryArgs } = this.props;
|
128 |
+
getProducts( { selected, search, queryArgs } )
|
129 |
.then( ( products ) => {
|
130 |
this.setState( { products, loading: false } );
|
131 |
} )
|
243 |
|
244 |
render() {
|
245 |
const { products, loading, product, variationsList } = this.state;
|
246 |
+
const { onChange, renderItem, selected } = this.props;
|
247 |
const currentVariations = variationsList[ product ] || [];
|
248 |
const currentList = [ ...products, ...currentVariations ];
|
249 |
const messages = {
|
272 |
isSingle
|
273 |
selected={ selectedListItems }
|
274 |
onChange={ onChange }
|
275 |
+
renderItem={ renderItem }
|
276 |
+
onSearch={ IS_LARGE_CATALOG ? this.debouncedOnSearch : null }
|
277 |
messages={ messages }
|
|
|
278 |
isHierarchical
|
279 |
/>
|
280 |
</Fragment>
|
287 |
* Callback to update the selected products.
|
288 |
*/
|
289 |
onChange: PropTypes.func.isRequired,
|
290 |
+
/**
|
291 |
+
* Callback to render each item in the selection list, allows any custom object-type rendering.
|
292 |
+
*/
|
293 |
+
renderItem: PropTypes.func.isRequired,
|
294 |
/**
|
295 |
* The ID of the currently selected product.
|
296 |
*/
|
297 |
selected: PropTypes.number.isRequired,
|
298 |
+
/**
|
299 |
+
* Query args to pass to getProducts.
|
300 |
+
*/
|
301 |
+
queryArgs: PropTypes.object,
|
302 |
};
|
303 |
|
304 |
export default ProductControl;
|
assets/js/components/product-preview/index.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import PropTypes from 'prop-types';
|
|
|
6 |
|
7 |
/**
|
8 |
* Internal dependencies
|
@@ -13,10 +14,6 @@ import './style.scss';
|
|
13 |
* Display a preview for a given product.
|
14 |
*/
|
15 |
const ProductPreview = ( { product } ) => {
|
16 |
-
const {
|
17 |
-
placeholderImgSrc,
|
18 |
-
} = wc_product_block_data; /* eslint-disable-line camelcase */
|
19 |
-
|
20 |
let image = null;
|
21 |
if ( product.images.length ) {
|
22 |
image = (
|
@@ -24,16 +21,16 @@ const ProductPreview = ( { product } ) => {
|
|
24 |
className="wc-product-preview__image"
|
25 |
src={ product.images[ 0 ].src }
|
26 |
alt=""
|
27 |
-
style={ { width: `${
|
28 |
/>
|
29 |
);
|
30 |
} else {
|
31 |
image = (
|
32 |
<img
|
33 |
className="wc-product-preview__image"
|
34 |
-
src={
|
35 |
alt=""
|
36 |
-
style={ { width: `${
|
37 |
/>
|
38 |
);
|
39 |
}
|
3 |
*/
|
4 |
import { __ } from '@wordpress/i18n';
|
5 |
import PropTypes from 'prop-types';
|
6 |
+
import { PLACEHOLDER_IMG_SRC, THUMBNAIL_SIZE } from '@woocommerce/block-settings';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
14 |
* Display a preview for a given product.
|
15 |
*/
|
16 |
const ProductPreview = ( { product } ) => {
|
|
|
|
|
|
|
|
|
17 |
let image = null;
|
18 |
if ( product.images.length ) {
|
19 |
image = (
|
21 |
className="wc-product-preview__image"
|
22 |
src={ product.images[ 0 ].src }
|
23 |
alt=""
|
24 |
+
style={ { width: `${ THUMBNAIL_SIZE }px` } }
|
25 |
/>
|
26 |
);
|
27 |
} else {
|
28 |
image = (
|
29 |
<img
|
30 |
className="wc-product-preview__image"
|
31 |
+
src={ PLACEHOLDER_IMG_SRC }
|
32 |
alt=""
|
33 |
+
style={ { width: `${ THUMBNAIL_SIZE }px` } }
|
34 |
/>
|
35 |
);
|
36 |
}
|
assets/js/components/product-preview/test/index.js
CHANGED
@@ -1,13 +1,18 @@
|
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
-
import
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
9 |
import ProductPreview from '../';
|
10 |
|
|
|
|
|
|
|
|
|
|
|
11 |
describe( 'ProductPreview', () => {
|
12 |
test( 'should render a single product preview with an image', () => {
|
13 |
const product = {
|
@@ -21,7 +26,7 @@ describe( 'ProductPreview', () => {
|
|
21 |
},
|
22 |
],
|
23 |
};
|
24 |
-
const component =
|
25 |
expect( component.toJSON() ).toMatchSnapshot();
|
26 |
} );
|
27 |
|
@@ -33,7 +38,7 @@ describe( 'ProductPreview', () => {
|
|
33 |
'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>65.00</span>',
|
34 |
images: [],
|
35 |
};
|
36 |
-
const component =
|
37 |
expect( component.toJSON() ).toMatchSnapshot();
|
38 |
} );
|
39 |
} );
|
1 |
/**
|
2 |
* External dependencies
|
3 |
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
|
6 |
/**
|
7 |
* Internal dependencies
|
8 |
*/
|
9 |
import ProductPreview from '../';
|
10 |
|
11 |
+
jest.mock( '@woocommerce/block-settings', () => ( {
|
12 |
+
PLACEHOLDER_IMG_SRC: 'placeholder.png',
|
13 |
+
THUMBNAIL_SIZE: 300,
|
14 |
+
} ) );
|
15 |
+
|
16 |
describe( 'ProductPreview', () => {
|
17 |
test( 'should render a single product preview with an image', () => {
|
18 |
const product = {
|
26 |
},
|
27 |
],
|
28 |
};
|
29 |
+
const component = TestRenderer.create( <ProductPreview product={ product } /> );
|
30 |
expect( component.toJSON() ).toMatchSnapshot();
|
31 |
} );
|
32 |
|
38 |
'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>65.00</span>',
|
39 |
images: [],
|
40 |
};
|
41 |
+
const component = TestRenderer.create( <ProductPreview product={ product } /> );
|
42 |
expect( component.toJSON() ).toMatchSnapshot();
|
43 |
} );
|
44 |
} );
|
assets/js/components/product-tag-control/index.js
CHANGED
@@ -7,12 +7,13 @@ import { debounce, find } from 'lodash';
|
|
7 |
import PropTypes from 'prop-types';
|
8 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
9 |
import { SelectControl } from '@wordpress/components';
|
|
|
10 |
|
11 |
/**
|
12 |
* Internal dependencies
|
13 |
*/
|
|
|
14 |
import './style.scss';
|
15 |
-
import { limitTags, getProductTags } from '../utils';
|
16 |
|
17 |
/**
|
18 |
* Component to handle searching and selecting product tags.
|
@@ -127,7 +128,7 @@ class ProductTagControl extends Component {
|
|
127 |
isLoading={ loading }
|
128 |
selected={ selected.map( ( id ) => find( list, { id } ) ).filter( Boolean ) }
|
129 |
onChange={ onChange }
|
130 |
-
onSearch={
|
131 |
renderItem={ this.renderItem }
|
132 |
messages={ messages }
|
133 |
isHierarchical
|
7 |
import PropTypes from 'prop-types';
|
8 |
import { SearchListControl, SearchListItem } from '@woocommerce/components';
|
9 |
import { SelectControl } from '@wordpress/components';
|
10 |
+
import { LIMIT_TAGS } from '@woocommerce/block-settings';
|
11 |
|
12 |
/**
|
13 |
* Internal dependencies
|
14 |
*/
|
15 |
+
import { getProductTags } from '../utils';
|
16 |
import './style.scss';
|
|
|
17 |
|
18 |
/**
|
19 |
* Component to handle searching and selecting product tags.
|
128 |
isLoading={ loading }
|
129 |
selected={ selected.map( ( id ) => find( list, { id } ) ).filter( Boolean ) }
|
130 |
onChange={ onChange }
|
131 |
+
onSearch={ LIMIT_TAGS ? this.debouncedOnSearch : null }
|
132 |
renderItem={ this.renderItem }
|
133 |
messages={ messages }
|
134 |
isHierarchical
|
assets/js/components/products-control/index.js
CHANGED
@@ -2,106 +2,85 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __, _n, sprintf } from '@wordpress/i18n';
|
5 |
-
import { Component, Fragment } from '@wordpress/element';
|
6 |
-
import { debounce, find } from 'lodash';
|
7 |
-
import PropTypes from 'prop-types';
|
8 |
import { SearchListControl } from '@woocommerce/components';
|
|
|
9 |
|
10 |
/**
|
11 |
* Internal dependencies
|
12 |
*/
|
13 |
-
import {
|
14 |
-
|
15 |
-
class ProductsControl extends Component {
|
16 |
-
constructor() {
|
17 |
-
super( ...arguments );
|
18 |
-
this.state = {
|
19 |
-
list: [],
|
20 |
-
loading: true,
|
21 |
-
};
|
22 |
-
|
23 |
-
this.debouncedOnSearch = debounce( this.onSearch.bind( this ), 400 );
|
24 |
-
}
|
25 |
-
|
26 |
-
componentDidMount() {
|
27 |
-
const { selected } = this.props;
|
28 |
-
|
29 |
-
getProducts( { selected } )
|
30 |
-
.then( ( list ) => {
|
31 |
-
this.setState( { list, loading: false } );
|
32 |
-
} )
|
33 |
-
.catch( () => {
|
34 |
-
this.setState( { list: [], loading: false } );
|
35 |
-
} );
|
36 |
-
}
|
37 |
-
|
38 |
-
onSearch( search ) {
|
39 |
-
const { selected } = this.props;
|
40 |
-
getProducts( { selected, search } )
|
41 |
-
.then( ( list ) => {
|
42 |
-
this.setState( { list, loading: false } );
|
43 |
-
} )
|
44 |
-
.catch( () => {
|
45 |
-
this.setState( { list: [], loading: false } );
|
46 |
-
} );
|
47 |
-
}
|
48 |
-
|
49 |
-
render() {
|
50 |
-
const { list, loading } = this.state;
|
51 |
-
const { onChange, selected } = this.props;
|
52 |
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
),
|
74 |
-
|
75 |
-
'Product search results updated.',
|
76 |
-
'woo-gutenberg-products-block'
|
77 |
),
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
}
|
95 |
|
96 |
ProductsControl.propTypes = {
|
97 |
-
/**
|
98 |
-
* Callback to update the selected products.
|
99 |
-
*/
|
100 |
onChange: PropTypes.func.isRequired,
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
};
|
106 |
|
107 |
-
export default ProductsControl;
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
|
|
|
|
|
5 |
import { SearchListControl } from '@woocommerce/components';
|
6 |
+
import PropTypes from 'prop-types';
|
7 |
|
8 |
/**
|
9 |
* Internal dependencies
|
10 |
*/
|
11 |
+
import { withSearchedProducts } from '../../hocs';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
/**
|
14 |
+
* The products control exposes a custom selector for searching and selecting
|
15 |
+
* products.
|
16 |
+
*
|
17 |
+
* @param {Object} props Component props.
|
18 |
+
* @param {Function} props.onChange Callback fired when the selected item changes
|
19 |
+
* @param {Function} props.onSearch Callback fired when a search is triggered
|
20 |
+
* @param {Array} props.selected An array of selected products.
|
21 |
+
* @param {Array} props.products An array of products to select from.
|
22 |
+
* @param {boolean} props.isLoading Whether or not the products are being loaded.
|
23 |
+
*
|
24 |
+
* @return {Function} A functional component.
|
25 |
+
*/
|
26 |
+
const ProductsControl = ( {
|
27 |
+
onChange,
|
28 |
+
onSearch,
|
29 |
+
selected,
|
30 |
+
products,
|
31 |
+
isLoading,
|
32 |
+
} ) => {
|
33 |
+
const messages = {
|
34 |
+
clear: __( 'Clear all products', 'woo-gutenberg-products-block' ),
|
35 |
+
list: __( 'Products', 'woo-gutenberg-products-block' ),
|
36 |
+
noItems: __(
|
37 |
+
"Your store doesn't have any products.",
|
38 |
+
'woo-gutenberg-products-block'
|
39 |
+
),
|
40 |
+
search: __(
|
41 |
+
'Search for products to display',
|
42 |
+
'woo-gutenberg-products-block'
|
43 |
+
),
|
44 |
+
selected: ( n ) =>
|
45 |
+
sprintf(
|
46 |
+
_n(
|
47 |
+
'%d product selected',
|
48 |
+
'%d products selected',
|
49 |
+
n,
|
50 |
+
'woo-gutenberg-products-block'
|
51 |
),
|
52 |
+
n
|
|
|
|
|
53 |
),
|
54 |
+
updated: __(
|
55 |
+
'Product search results updated.',
|
56 |
+
'woo-gutenberg-products-block'
|
57 |
+
),
|
58 |
+
};
|
59 |
+
return (
|
60 |
+
<SearchListControl
|
61 |
+
className="woocommerce-products"
|
62 |
+
list={ products }
|
63 |
+
isLoading={ isLoading }
|
64 |
+
selected={ selected }
|
65 |
+
onSearch={ onSearch }
|
66 |
+
onChange={ onChange }
|
67 |
+
messages={ messages }
|
68 |
+
/>
|
69 |
+
);
|
70 |
+
};
|
71 |
|
72 |
ProductsControl.propTypes = {
|
|
|
|
|
|
|
73 |
onChange: PropTypes.func.isRequired,
|
74 |
+
onSearch: PropTypes.func,
|
75 |
+
selected: PropTypes.array,
|
76 |
+
products: PropTypes.array,
|
77 |
+
isLoading: PropTypes.bool,
|
78 |
+
};
|
79 |
+
|
80 |
+
ProductsControl.defaultProps = {
|
81 |
+
selected: [],
|
82 |
+
products: [],
|
83 |
+
isLoading: true,
|
84 |
};
|
85 |
|
86 |
+
export default withSearchedProducts( ProductsControl );
|
assets/js/components/utils/index.js
CHANGED
@@ -4,26 +4,29 @@
|
|
4 |
import { addQueryArgs } from '@wordpress/url';
|
5 |
import apiFetch from '@wordpress/api-fetch';
|
6 |
import { flatten, uniqBy } from 'lodash';
|
|
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
const requests = [
|
14 |
-
addQueryArgs(
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
search,
|
19 |
-
} ),
|
20 |
];
|
21 |
|
22 |
// If we have a large catalog, we might not get all selected products in the first page.
|
23 |
-
if (
|
24 |
requests.push(
|
25 |
-
addQueryArgs(
|
26 |
-
catalog_visibility: '
|
27 |
status: 'publish',
|
28 |
include: selected,
|
29 |
} )
|
@@ -36,30 +39,41 @@ const getProductsRequests = ( { selected = [], search } ) => {
|
|
36 |
/**
|
37 |
* Get a promise that resolves to a list of products from the API.
|
38 |
*
|
39 |
-
* @param {
|
40 |
*/
|
41 |
-
export const getProducts = ( { selected = [], search } ) => {
|
42 |
-
const requests = getProductsRequests( { selected, search } );
|
43 |
|
44 |
return Promise.all( requests.map( ( path ) => apiFetch( { path } ) ) ).then( ( data ) => {
|
45 |
return uniqBy( flatten( data ), 'id' );
|
46 |
} );
|
47 |
};
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
const getProductTagsRequests = ( { selected = [], search } ) => {
|
50 |
const requests = [
|
51 |
-
addQueryArgs(
|
52 |
-
per_page:
|
53 |
-
orderby:
|
54 |
-
order:
|
55 |
search,
|
56 |
} ),
|
57 |
];
|
58 |
|
59 |
// If we have a large catalog, we might not get all selected products in the first page.
|
60 |
-
if (
|
61 |
requests.push(
|
62 |
-
addQueryArgs(
|
63 |
include: selected,
|
64 |
} )
|
65 |
);
|
@@ -71,7 +85,7 @@ const getProductTagsRequests = ( { selected = [], search } ) => {
|
|
71 |
/**
|
72 |
* Get a promise that resolves to a list of tags from the API.
|
73 |
*
|
74 |
-
* @param {
|
75 |
*/
|
76 |
export const getProductTags = ( { selected = [], search } ) => {
|
77 |
const requests = getProductTagsRequests( { selected, search } );
|
@@ -80,3 +94,14 @@ export const getProductTags = ( { selected = [], search } ) => {
|
|
80 |
return uniqBy( flatten( data ), 'id' );
|
81 |
} );
|
82 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
import { addQueryArgs } from '@wordpress/url';
|
5 |
import apiFetch from '@wordpress/api-fetch';
|
6 |
import { flatten, uniqBy } from 'lodash';
|
7 |
+
import { ENDPOINTS, IS_LARGE_CATALOG, LIMIT_TAGS } from '@woocommerce/block-settings';
|
8 |
|
9 |
+
const getProductsRequests = ( { selected = [], search = '', queryArgs = [] } ) => {
|
10 |
+
const defaultArgs = {
|
11 |
+
per_page: IS_LARGE_CATALOG ? 100 : -1,
|
12 |
+
catalog_visibility: 'any',
|
13 |
+
status: 'publish',
|
14 |
+
search,
|
15 |
+
orderby: 'title',
|
16 |
+
order: 'asc',
|
17 |
+
};
|
18 |
const requests = [
|
19 |
+
addQueryArgs(
|
20 |
+
ENDPOINTS.products,
|
21 |
+
{ ...defaultArgs, ...queryArgs }
|
22 |
+
),
|
|
|
|
|
23 |
];
|
24 |
|
25 |
// If we have a large catalog, we might not get all selected products in the first page.
|
26 |
+
if ( IS_LARGE_CATALOG && selected.length ) {
|
27 |
requests.push(
|
28 |
+
addQueryArgs( ENDPOINTS.products, {
|
29 |
+
catalog_visibility: 'any',
|
30 |
status: 'publish',
|
31 |
include: selected,
|
32 |
} )
|
39 |
/**
|
40 |
* Get a promise that resolves to a list of products from the API.
|
41 |
*
|
42 |
+
* @param {Object} - A query object with the list of selected products and search term.
|
43 |
*/
|
44 |
+
export const getProducts = ( { selected = [], search = '', queryArgs = [] } ) => {
|
45 |
+
const requests = getProductsRequests( { selected, search, queryArgs } );
|
46 |
|
47 |
return Promise.all( requests.map( ( path ) => apiFetch( { path } ) ) ).then( ( data ) => {
|
48 |
return uniqBy( flatten( data ), 'id' );
|
49 |
} );
|
50 |
};
|
51 |
|
52 |
+
/**
|
53 |
+
* Get a promise that resolves to a product object from the API.
|
54 |
+
*
|
55 |
+
* @param {number} productId Id of the product to retrieve.
|
56 |
+
*/
|
57 |
+
export const getProduct = ( productId ) => {
|
58 |
+
return apiFetch( {
|
59 |
+
path: `${ ENDPOINTS.products }/${ productId }`,
|
60 |
+
} );
|
61 |
+
};
|
62 |
+
|
63 |
const getProductTagsRequests = ( { selected = [], search } ) => {
|
64 |
const requests = [
|
65 |
+
addQueryArgs( `${ ENDPOINTS.products }/tags`, {
|
66 |
+
per_page: LIMIT_TAGS ? 100 : -1,
|
67 |
+
orderby: LIMIT_TAGS ? 'count' : 'name',
|
68 |
+
order: LIMIT_TAGS ? 'desc' : 'asc',
|
69 |
search,
|
70 |
} ),
|
71 |
];
|
72 |
|
73 |
// If we have a large catalog, we might not get all selected products in the first page.
|
74 |
+
if ( LIMIT_TAGS && selected.length ) {
|
75 |
requests.push(
|
76 |
+
addQueryArgs( `${ ENDPOINTS.products }/tags`, {
|
77 |
include: selected,
|
78 |
} )
|
79 |
);
|
85 |
/**
|
86 |
* Get a promise that resolves to a list of tags from the API.
|
87 |
*
|
88 |
+
* @param {Object} - A query object with the list of selected products and search term.
|
89 |
*/
|
90 |
export const getProductTags = ( { selected = [], search } ) => {
|
91 |
const requests = getProductTagsRequests( { selected, search } );
|
94 |
return uniqBy( flatten( data ), 'id' );
|
95 |
} );
|
96 |
};
|
97 |
+
|
98 |
+
/**
|
99 |
+
* Get a promise that resolves to a category object from the API.
|
100 |
+
*
|
101 |
+
* @param {number} categoryId Id of the product to retrieve.
|
102 |
+
*/
|
103 |
+
export const getCategory = ( categoryId ) => {
|
104 |
+
return apiFetch( {
|
105 |
+
path: `${ ENDPOINTS.categories }/${ categoryId }`,
|
106 |
+
} );
|
107 |
+
};
|
assets/js/hocs/index.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
export { default as withProduct } from './with-product';
|
2 |
+
export { default as withCategory } from './with-category';
|
3 |
+
export { default as withSearchedProducts } from './with-searched-products';
|
assets/js/hocs/test/with-product.js
ADDED
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Internal dependencies
|
8 |
+
*/
|
9 |
+
import withProduct from '../with-product';
|
10 |
+
import * as mockUtils from '../../components/utils';
|
11 |
+
|
12 |
+
// Mock the getProduct functions for tests.
|
13 |
+
jest.mock( '../../components/utils', () => ( {
|
14 |
+
getProduct: jest.fn(),
|
15 |
+
} ) );
|
16 |
+
|
17 |
+
const mockProduct = { name: 'T-Shirt' };
|
18 |
+
const attributes = { productId: 1 };
|
19 |
+
const TestComponent = withProduct( ( props ) => {
|
20 |
+
return <div
|
21 |
+
error={ props.error }
|
22 |
+
getProduct={ props.getProduct }
|
23 |
+
isLoading={ props.isLoading }
|
24 |
+
product={ props.product }
|
25 |
+
/>;
|
26 |
+
} );
|
27 |
+
const render = () => {
|
28 |
+
return TestRenderer.create(
|
29 |
+
<TestComponent
|
30 |
+
attributes={ attributes }
|
31 |
+
/>
|
32 |
+
);
|
33 |
+
};
|
34 |
+
|
35 |
+
describe( 'withProduct Component', () => {
|
36 |
+
let renderer;
|
37 |
+
afterEach( () => {
|
38 |
+
mockUtils.getProduct.mockReset();
|
39 |
+
} );
|
40 |
+
|
41 |
+
describe( 'lifecycle events', () => {
|
42 |
+
beforeEach( () => {
|
43 |
+
mockUtils.getProduct.mockImplementation( () => Promise.resolve() );
|
44 |
+
renderer = render();
|
45 |
+
} );
|
46 |
+
|
47 |
+
describe( 'test', () => {
|
48 |
+
it( 'getProduct is called on mount with passed in product id', () => {
|
49 |
+
const { getProduct } = mockUtils;
|
50 |
+
|
51 |
+
expect( getProduct ).toHaveBeenCalledWith( attributes.productId );
|
52 |
+
expect( getProduct ).toHaveBeenCalledTimes( 1 );
|
53 |
+
} );
|
54 |
+
} );
|
55 |
+
|
56 |
+
describe( 'test', () => {
|
57 |
+
it( 'getProduct is hooked to the prop', () => {
|
58 |
+
const { getProduct } = mockUtils;
|
59 |
+
const props = renderer.root.findByType( 'div' ).props;
|
60 |
+
|
61 |
+
props.getProduct();
|
62 |
+
|
63 |
+
expect( getProduct ).toHaveBeenCalledTimes( 2 );
|
64 |
+
} );
|
65 |
+
} );
|
66 |
+
} );
|
67 |
+
|
68 |
+
describe( 'when the API returns product data', () => {
|
69 |
+
beforeEach( () => {
|
70 |
+
mockUtils.getProduct.mockImplementation(
|
71 |
+
( productId ) => Promise.resolve( { ...mockProduct, id: productId } )
|
72 |
+
);
|
73 |
+
renderer = render();
|
74 |
+
} );
|
75 |
+
|
76 |
+
it( 'sets the product props', () => {
|
77 |
+
const props = renderer.root.findByType( 'div' ).props;
|
78 |
+
|
79 |
+
expect( props.error ).toBeNull();
|
80 |
+
expect( typeof props.getProduct ).toBe( 'function' );
|
81 |
+
expect( props.isLoading ).toBe( false );
|
82 |
+
expect( props.product ).toEqual( { ...mockProduct, id: attributes.productId } );
|
83 |
+
} );
|
84 |
+
} );
|
85 |
+
|
86 |
+
describe( 'when the API returns an error', () => {
|
87 |
+
beforeEach( () => {
|
88 |
+
mockUtils.getProduct.mockImplementation(
|
89 |
+
() => Promise.reject( { message: 'There was an error.' } )
|
90 |
+
);
|
91 |
+
renderer = render();
|
92 |
+
} );
|
93 |
+
|
94 |
+
it( 'sets the error prop', () => {
|
95 |
+
const props = renderer.root.findByType( 'div' ).props;
|
96 |
+
|
97 |
+
expect( props.error ).toEqual( { apiMessage: 'There was an error.' } );
|
98 |
+
expect( typeof props.getProduct ).toBe( 'function' );
|
99 |
+
expect( props.isLoading ).toBe( false );
|
100 |
+
expect( props.product ).toBeNull();
|
101 |
+
} );
|
102 |
+
} );
|
103 |
+
} );
|
assets/js/hocs/test/with-searched-products.js
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import TestRenderer from 'react-test-renderer';
|
5 |
+
import _ from 'lodash';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import withSearchedProducts from '../with-searched-products';
|
11 |
+
import * as mockedUtils from '../../components/utils';
|
12 |
+
|
13 |
+
jest.mock( '@woocommerce/block-settings', () => ( {
|
14 |
+
IS_LARGE_CATALOG: true,
|
15 |
+
} ) );
|
16 |
+
|
17 |
+
// Mock the getProducts and isLargeCatalog values for tests.
|
18 |
+
mockedUtils.getProducts = jest.fn().mockImplementation(
|
19 |
+
() => Promise.resolve(
|
20 |
+
[ { id: 10, name: 'foo' }, { id: 20, name: 'bar' } ]
|
21 |
+
)
|
22 |
+
);
|
23 |
+
|
24 |
+
// Add a mock implementation of debounce for testing so we can spy on
|
25 |
+
// the onSearch call.
|
26 |
+
const debouncedCancel = jest.fn();
|
27 |
+
const debouncedAction = jest.fn();
|
28 |
+
_.debounce = ( onSearch ) => {
|
29 |
+
const debounced = debouncedAction.mockImplementation(
|
30 |
+
() => {
|
31 |
+
onSearch();
|
32 |
+
}
|
33 |
+
);
|
34 |
+
debounced.cancel = debouncedCancel;
|
35 |
+
return debounced;
|
36 |
+
};
|
37 |
+
|
38 |
+
describe( 'withSearchedProducts Component', () => {
|
39 |
+
const { getProducts } = mockedUtils;
|
40 |
+
afterEach( () => {
|
41 |
+
debouncedCancel.mockClear();
|
42 |
+
debouncedAction.mockClear();
|
43 |
+
mockedUtils.getProducts.mockClear();
|
44 |
+
} );
|
45 |
+
const TestComponent = withSearchedProducts( ( {
|
46 |
+
selected,
|
47 |
+
products,
|
48 |
+
isLoading,
|
49 |
+
onSearch,
|
50 |
+
} ) => {
|
51 |
+
return <div
|
52 |
+
products={ products }
|
53 |
+
selected={ selected }
|
54 |
+
isLoading={ isLoading }
|
55 |
+
onSearch={ onSearch }
|
56 |
+
/>;
|
57 |
+
} );
|
58 |
+
describe( 'lifecycle tests', () => {
|
59 |
+
const selected = [ 10 ];
|
60 |
+
const renderer = TestRenderer.create(
|
61 |
+
<TestComponent
|
62 |
+
selected={ selected }
|
63 |
+
/>
|
64 |
+
);
|
65 |
+
let props;
|
66 |
+
it( 'getProducts is called on mount with passed in selected ' +
|
67 |
+
'values', () => {
|
68 |
+
expect( getProducts ).toHaveBeenCalledWith( { selected } );
|
69 |
+
expect( getProducts ).toHaveBeenCalledTimes( 1 );
|
70 |
+
} );
|
71 |
+
it( 'has expected values for props', () => {
|
72 |
+
props = renderer.root.findByType( 'div' ).props;
|
73 |
+
expect( props.selected ).toEqual( [ { id: 10, name: 'foo' } ] );
|
74 |
+
expect( props.products ).toEqual(
|
75 |
+
[ { id: 10, name: 'foo' }, { id: 20, name: 'bar' } ]
|
76 |
+
);
|
77 |
+
} );
|
78 |
+
it( 'debounce and getProducts is called on search event', () => {
|
79 |
+
props = renderer.root.findByType( 'div' ).props;
|
80 |
+
props.onSearch();
|
81 |
+
expect( debouncedAction ).toHaveBeenCalled();
|
82 |
+
expect( getProducts ).toHaveBeenCalledTimes( 1 );
|
83 |
+
} );
|
84 |
+
it( 'debounce is cancelled on unmount', () => {
|
85 |
+
renderer.unmount();
|
86 |
+
expect( debouncedCancel ).toHaveBeenCalled();
|
87 |
+
expect( getProducts ).toHaveBeenCalledTimes( 0 );
|
88 |
+
} );
|
89 |
+
} );
|
90 |
+
} );
|
assets/js/hocs/with-category.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Component } from '@wordpress/element';
|
5 |
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import { getCategory } from '../components/utils';
|
11 |
+
|
12 |
+
const withCategory = createHigherOrderComponent(
|
13 |
+
( OriginalComponent ) => {
|
14 |
+
return class WrappedComponent extends Component {
|
15 |
+
constructor() {
|
16 |
+
super( ...arguments );
|
17 |
+
this.state = {
|
18 |
+
error: null,
|
19 |
+
loading: false,
|
20 |
+
category: null,
|
21 |
+
};
|
22 |
+
this.loadCategory = this.loadCategory.bind( this );
|
23 |
+
}
|
24 |
+
|
25 |
+
componentDidMount() {
|
26 |
+
this.loadCategory();
|
27 |
+
}
|
28 |
+
|
29 |
+
componentDidUpdate( prevProps ) {
|
30 |
+
if ( prevProps.attributes.categoryId !== this.props.attributes.categoryId ) {
|
31 |
+
this.loadCategory();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
loadCategory() {
|
36 |
+
const { categoryId } = this.props.attributes;
|
37 |
+
|
38 |
+
if ( ! categoryId ) {
|
39 |
+
this.setState( { category: null, loading: false, error: null } );
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
this.setState( { loading: true } );
|
44 |
+
|
45 |
+
getCategory( categoryId ).then( ( category ) => {
|
46 |
+
this.setState( { category, loading: false, error: null } );
|
47 |
+
} ).catch( ( apiError ) => {
|
48 |
+
const error = typeof apiError === 'object' && apiError.hasOwnProperty( 'message' ) ? {
|
49 |
+
apiMessage: apiError.message,
|
50 |
+
} : {
|
51 |
+
// If we can't get any message from the API, set it to null and
|
52 |
+
// let <ApiErrorPlaceholder /> handle the message to display.
|
53 |
+
apiMessage: null,
|
54 |
+
};
|
55 |
+
|
56 |
+
this.setState( { category: null, loading: false, error } );
|
57 |
+
} );
|
58 |
+
}
|
59 |
+
|
60 |
+
render() {
|
61 |
+
const { error, loading, category } = this.state;
|
62 |
+
|
63 |
+
return <OriginalComponent
|
64 |
+
{ ...this.props }
|
65 |
+
error={ error }
|
66 |
+
getCategory={ this.loadCategory }
|
67 |
+
isLoading={ loading }
|
68 |
+
category={ category }
|
69 |
+
/>;
|
70 |
+
}
|
71 |
+
};
|
72 |
+
},
|
73 |
+
'withCategory'
|
74 |
+
);
|
75 |
+
|
76 |
+
export default withCategory;
|
assets/js/hocs/with-product.js
ADDED
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Component } from '@wordpress/element';
|
5 |
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Internal dependencies
|
9 |
+
*/
|
10 |
+
import { getProduct } from '../components/utils';
|
11 |
+
|
12 |
+
const withProduct = createHigherOrderComponent(
|
13 |
+
( OriginalComponent ) => {
|
14 |
+
return class WrappedComponent extends Component {
|
15 |
+
constructor() {
|
16 |
+
super( ...arguments );
|
17 |
+
this.state = {
|
18 |
+
error: null,
|
19 |
+
loading: false,
|
20 |
+
product: null,
|
21 |
+
};
|
22 |
+
this.loadProduct = this.loadProduct.bind( this );
|
23 |
+
}
|
24 |
+
|
25 |
+
componentDidMount() {
|
26 |
+
this.loadProduct();
|
27 |
+
}
|
28 |
+
|
29 |
+
componentDidUpdate( prevProps ) {
|
30 |
+
if ( prevProps.attributes.productId !== this.props.attributes.productId ) {
|
31 |
+
this.loadProduct();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
|
35 |
+
loadProduct() {
|
36 |
+
const { productId } = this.props.attributes;
|
37 |
+
|
38 |
+
if ( ! productId ) {
|
39 |
+
this.setState( { product: null, loading: false, error: null } );
|
40 |
+
return;
|
41 |
+
}
|
42 |
+
|
43 |
+
this.setState( { loading: true } );
|
44 |
+
|
45 |
+
getProduct( productId ).then( ( product ) => {
|
46 |
+
this.setState( { product, loading: false, error: null } );
|
47 |
+
} ).catch( ( apiError ) => {
|
48 |
+
const error = typeof apiError === 'object' && apiError.hasOwnProperty( 'message' ) ? {
|
49 |
+
apiMessage: apiError.message,
|
50 |
+
} : {
|
51 |
+
// If we can't get any message from the API, set it to null and
|
52 |
+
// let <ApiErrorPlaceholder /> handle the message to display.
|
53 |
+
apiMessage: null,
|
54 |
+
};
|
55 |
+
|
56 |
+
this.setState( { product: null, loading: false, error } );
|
57 |
+
} );
|
58 |
+
}
|
59 |
+
|
60 |
+
render() {
|
61 |
+
const { error, loading, product } = this.state;
|
62 |
+
|
63 |
+
return <OriginalComponent
|
64 |
+
{ ...this.props }
|
65 |
+
error={ error }
|
66 |
+
getProduct={ this.loadProduct }
|
67 |
+
isLoading={ loading }
|
68 |
+
product={ product }
|
69 |
+
/>;
|
70 |
+
}
|
71 |
+
};
|
72 |
+
},
|
73 |
+
'withProduct'
|
74 |
+
);
|
75 |
+
|
76 |
+
export default withProduct;
|
assets/js/hocs/with-searched-products.js
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { Component } from '@wordpress/element';
|
5 |
+
import { debounce } from 'lodash';
|
6 |
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
7 |
+
import PropTypes from 'prop-types';
|
8 |
+
import { IS_LARGE_CATALOG } from '@woocommerce/block-settings';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Internal dependencies
|
12 |
+
*/
|
13 |
+
import { getProducts } from '../components/utils';
|
14 |
+
|
15 |
+
/**
|
16 |
+
* A higher order component that enhances the provided component with products
|
17 |
+
* from a search query.
|
18 |
+
*/
|
19 |
+
const withSearchedProducts = createHigherOrderComponent( ( OriginalComponent ) => {
|
20 |
+
/**
|
21 |
+
* A Component wrapping the passed in component.
|
22 |
+
*
|
23 |
+
* @class WrappedComponent
|
24 |
+
* @extends {Component}
|
25 |
+
*/
|
26 |
+
class WrappedComponent extends Component {
|
27 |
+
constructor() {
|
28 |
+
super( ...arguments );
|
29 |
+
this.state = {
|
30 |
+
list: [],
|
31 |
+
loading: true,
|
32 |
+
};
|
33 |
+
this.debouncedOnSearch = debounce( this.onSearch.bind( this ), 400 );
|
34 |
+
}
|
35 |
+
|
36 |
+
componentDidMount() {
|
37 |
+
const { selected } = this.props;
|
38 |
+
getProducts( { selected } )
|
39 |
+
.then( ( list ) => {
|
40 |
+
this.setState( { list, loading: false } );
|
41 |
+
} )
|
42 |
+
.catch( () => {
|
43 |
+
this.setState( { list: [], loading: false } );
|
44 |
+
} );
|
45 |
+
}
|
46 |
+
|
47 |
+
componentWillUnmount() {
|
48 |
+
this.debouncedOnSearch.cancel();
|
49 |
+
}
|
50 |
+
|
51 |
+
onSearch( search ) {
|
52 |
+
const { selected } = this.props;
|
53 |
+
getProducts( { selected, search } )
|
54 |
+
.then( ( list ) => {
|
55 |
+
this.setState( { list, loading: false } );
|
56 |
+
} )
|
57 |
+
.catch( () => {
|
58 |
+
this.setState( { list: [], loading: false } );
|
59 |
+
} );
|
60 |
+
}
|
61 |
+
|
62 |
+
render() {
|
63 |
+
const { list, loading } = this.state;
|
64 |
+
const { selected } = this.props;
|
65 |
+
return (
|
66 |
+
<OriginalComponent
|
67 |
+
{ ...this.props }
|
68 |
+
products={ list }
|
69 |
+
isLoading={ loading }
|
70 |
+
selected={ list.filter(
|
71 |
+
( { id } ) => selected.includes( id )
|
72 |
+
) }
|
73 |
+
onSearch={ IS_LARGE_CATALOG ? this.debouncedOnSearch : null }
|
74 |
+
/>
|
75 |
+
);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
WrappedComponent.propTypes = {
|
79 |
+
selected: PropTypes.array,
|
80 |
+
};
|
81 |
+
WrappedComponent.defaultProps = {
|
82 |
+
selected: [],
|
83 |
+
};
|
84 |
+
return WrappedComponent;
|
85 |
+
}, 'withSearchedProducts' );
|
86 |
+
|
87 |
+
export default withSearchedProducts;
|
assets/js/settings/blocks/endpoints.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const NAMESPACE = '/wc/blocks';
|
2 |
+
export const ENDPOINTS = {
|
3 |
+
root: NAMESPACE,
|
4 |
+
products: `${ NAMESPACE }/products`,
|
5 |
+
categories: `${ NAMESPACE }/products/categories`,
|
6 |
+
};
|
assets/js/settings/blocks/index.js
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
const getConstantFromData = ( property, fallback = false ) => {
|
2 |
+
if ( typeof wc_product_block_data === 'object' && wc_product_block_data.hasOwnProperty( property ) ) {
|
3 |
+
return wc_product_block_data[ property ];
|
4 |
+
}
|
5 |
+
return fallback;
|
6 |
+
};
|
7 |
+
|
8 |
+
export const ENABLE_REVIEW_RATING = getConstantFromData( 'enableReviewRating', true );
|
9 |
+
export const SHOW_AVATARS = getConstantFromData( 'showAvatars', true );
|
10 |
+
export const MAX_COLUMNS = getConstantFromData( 'max_columns', 6 );
|
11 |
+
export const MIN_COLUMNS = getConstantFromData( 'min_columns', 1 );
|
12 |
+
export const DEFAULT_COLUMNS = getConstantFromData( 'default_columns', 3 );
|
13 |
+
export const MAX_ROWS = getConstantFromData( 'max_rows', 6 );
|
14 |
+
export const MIN_ROWS = getConstantFromData( 'min_rows', 1 );
|
15 |
+
export const DEFAULT_ROWS = getConstantFromData( 'default_rows', 1 );
|
16 |
+
export const MIN_HEIGHT = getConstantFromData( 'min_height', 500 );
|
17 |
+
export const DEFAULT_HEIGHT = getConstantFromData( 'default_height', 500 );
|
18 |
+
export const PLACEHOLDER_IMG_SRC = getConstantFromData( 'placeholderImgSrc ', '' );
|
19 |
+
export const THUMBNAIL_SIZE = getConstantFromData( 'thumbnail_size', 300 );
|
20 |
+
export const IS_LARGE_CATALOG = getConstantFromData( 'isLargeCatalog' );
|
21 |
+
export const LIMIT_TAGS = getConstantFromData( 'limitTags' );
|
22 |
+
export const HAS_TAGS = getConstantFromData( 'hasTags', true );
|
23 |
+
export const HOME_URL = getConstantFromData( 'homeUrl ', '' );
|
24 |
+
export const PRODUCT_CATEGORIES = getConstantFromData( 'productCategories', [] );
|
25 |
+
export { ENDPOINTS } from './endpoints';
|
assets/js/settings/shared/currency.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Wrapper for the wcSettings global, which sets defaults if data is missing.
|
3 |
+
*
|
4 |
+
* Only settings used by blocks are defined here. Component settings are left out.
|
5 |
+
*/
|
6 |
+
const currency = wcSettings.currency || {
|
7 |
+
code: 'USD',
|
8 |
+
precision: 2,
|
9 |
+
symbol: '$',
|
10 |
+
position: 'left',
|
11 |
+
decimal_separator: '.',
|
12 |
+
thousand_separator: ',',
|
13 |
+
price_format: '%1$s%2$s',
|
14 |
+
};
|
15 |
+
|
16 |
+
export default currency;
|
assets/js/settings/shared/index.js
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
// Exports shared settings from wcSettings global.
|
2 |
+
export { default as currency } from './currency';
|
assets/js/utils/get-query.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { min } from 'lodash';
|
|
|
5 |
|
6 |
export default function getQuery( blockAttributes, name ) {
|
7 |
const {
|
@@ -14,8 +15,8 @@ export default function getQuery( blockAttributes, name ) {
|
|
14 |
orderby,
|
15 |
products,
|
16 |
} = blockAttributes;
|
17 |
-
const columns = blockAttributes.columns ||
|
18 |
-
const rows = blockAttributes.rows ||
|
19 |
const apiMax = Math.floor( 100 / columns ) * columns; // Prevent uneven final row.
|
20 |
|
21 |
const query = {
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { min } from 'lodash';
|
5 |
+
import { DEFAULT_COLUMNS, DEFAULT_ROWS } from '@woocommerce/block-settings';
|
6 |
|
7 |
export default function getQuery( blockAttributes, name ) {
|
8 |
const {
|
15 |
orderby,
|
16 |
products,
|
17 |
} = blockAttributes;
|
18 |
+
const columns = blockAttributes.columns || DEFAULT_COLUMNS;
|
19 |
+
const rows = blockAttributes.rows || DEFAULT_ROWS;
|
20 |
const apiMax = Math.floor( 100 / columns ) * columns; // Prevent uneven final row.
|
21 |
|
22 |
const query = {
|
assets/js/utils/get-shortcode.js
CHANGED
@@ -1,3 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
export default function getShortcode( props, name ) {
|
2 |
const blockAttributes = props.attributes;
|
3 |
const {
|
@@ -8,8 +13,8 @@ export default function getShortcode( props, name ) {
|
|
8 |
orderby,
|
9 |
products,
|
10 |
} = blockAttributes;
|
11 |
-
const columns = blockAttributes.columns ||
|
12 |
-
const rows = blockAttributes.rows ||
|
13 |
|
14 |
const shortcodeAtts = new Map();
|
15 |
shortcodeAtts.set( 'limit', rows * columns );
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { DEFAULT_COLUMNS, DEFAULT_ROWS } from '@woocommerce/block-settings';
|
5 |
+
|
6 |
export default function getShortcode( props, name ) {
|
7 |
const blockAttributes = props.attributes;
|
8 |
const {
|
13 |
orderby,
|
14 |
products,
|
15 |
} = blockAttributes;
|
16 |
+
const columns = blockAttributes.columns || DEFAULT_COLUMNS;
|
17 |
+
const rows = blockAttributes.rows || DEFAULT_ROWS;
|
18 |
|
19 |
const shortcodeAtts = new Map();
|
20 |
shortcodeAtts.set( 'limit', rows * columns );
|
assets/js/utils/products.js
CHANGED
@@ -1,25 +1,29 @@
|
|
1 |
/**
|
2 |
* Get the src of the first image attached to a product (the featured image).
|
3 |
*
|
4 |
-
* @param {
|
|
|
5 |
* @return {string} The full URL to the image.
|
6 |
*/
|
7 |
-
export function getImageSrcFromProduct(
|
8 |
-
if ( images.length ) {
|
9 |
-
return
|
10 |
}
|
11 |
-
|
|
|
12 |
}
|
13 |
|
14 |
/**
|
15 |
* Get the ID of the first image attached to a product (the featured image).
|
16 |
*
|
17 |
-
* @param {
|
|
|
18 |
* @return {number} The ID of the image.
|
19 |
*/
|
20 |
-
export function getImageIdFromProduct(
|
21 |
-
if ( images.length ) {
|
22 |
-
return
|
23 |
}
|
24 |
-
|
|
|
25 |
}
|
1 |
/**
|
2 |
* Get the src of the first image attached to a product (the featured image).
|
3 |
*
|
4 |
+
* @param {Object} product The product object to get the images from.
|
5 |
+
* @param {Array} product.images The array of images, destructured from the product object.
|
6 |
* @return {string} The full URL to the image.
|
7 |
*/
|
8 |
+
export function getImageSrcFromProduct( product ) {
|
9 |
+
if ( ! product || ! product.images || ! product.images.length ) {
|
10 |
+
return '';
|
11 |
}
|
12 |
+
|
13 |
+
return product.images[ 0 ].src || '';
|
14 |
}
|
15 |
|
16 |
/**
|
17 |
* Get the ID of the first image attached to a product (the featured image).
|
18 |
*
|
19 |
+
* @param {Object} product The product object to get the images from.
|
20 |
+
* @param {Array} product.images The array of images, destructured from the product object.
|
21 |
* @return {number} The ID of the image.
|
22 |
*/
|
23 |
+
export function getImageIdFromProduct( product ) {
|
24 |
+
if ( ! product || ! product.images || ! product.images.length ) {
|
25 |
+
return 0;
|
26 |
}
|
27 |
+
|
28 |
+
return product.images[ 0 ].id || 0;
|
29 |
}
|
assets/js/utils/shared-attributes.js
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
export const sharedAttributeBlockTypes = [
|
3 |
'woocommerce/product-best-sellers',
|
@@ -13,7 +17,7 @@ export default {
|
|
13 |
*/
|
14 |
columns: {
|
15 |
type: 'number',
|
16 |
-
default:
|
17 |
},
|
18 |
|
19 |
/**
|
@@ -21,7 +25,7 @@ export default {
|
|
21 |
*/
|
22 |
rows: {
|
23 |
type: 'number',
|
24 |
-
default:
|
25 |
},
|
26 |
|
27 |
/**
|
1 |
+
/**
|
2 |
+
* External dependencies
|
3 |
+
*/
|
4 |
+
import { DEFAULT_COLUMNS, DEFAULT_ROWS } from '@woocommerce/block-settings';
|
5 |
|
6 |
export const sharedAttributeBlockTypes = [
|
7 |
'woocommerce/product-best-sellers',
|
17 |
*/
|
18 |
columns: {
|
19 |
type: 'number',
|
20 |
+
default: DEFAULT_COLUMNS,
|
21 |
},
|
22 |
|
23 |
/**
|
25 |
*/
|
26 |
rows: {
|
27 |
type: 'number',
|
28 |
+
default: DEFAULT_ROWS,
|
29 |
},
|
30 |
|
31 |
/**
|
assets/js/utils/test/products.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Internal dependencies
|
3 |
+
*/
|
4 |
+
import { getImageSrcFromProduct, getImageIdFromProduct } from '../products';
|
5 |
+
|
6 |
+
describe( 'getImageSrcFromProduct', () => {
|
7 |
+
test( 'returns first image src', () => {
|
8 |
+
const imageSrc = getImageSrcFromProduct( {
|
9 |
+
images: [ { src: 'foo.jpg' } ],
|
10 |
+
} );
|
11 |
+
|
12 |
+
expect( imageSrc ).toBe( 'foo.jpg' );
|
13 |
+
} );
|
14 |
+
|
15 |
+
test( 'returns empty string if no product was provided', () => {
|
16 |
+
const imageSrc = getImageSrcFromProduct();
|
17 |
+
|
18 |
+
expect( imageSrc ).toBe( '' );
|
19 |
+
} );
|
20 |
+
|
21 |
+
test( 'returns empty string if product is empty', () => {
|
22 |
+
const imageSrc = getImageSrcFromProduct( {} );
|
23 |
+
|
24 |
+
expect( imageSrc ).toBe( '' );
|
25 |
+
} );
|
26 |
+
|
27 |
+
test( 'returns empty string if product has no images', () => {
|
28 |
+
const imageSrc = getImageSrcFromProduct( { images: null } );
|
29 |
+
|
30 |
+
expect( imageSrc ).toBe( '' );
|
31 |
+
} );
|
32 |
+
|
33 |
+
test( 'returns empty string if product has 0 images', () => {
|
34 |
+
const imageSrc = getImageSrcFromProduct( { images: [] } );
|
35 |
+
|
36 |
+
expect( imageSrc ).toBe( '' );
|
37 |
+
} );
|
38 |
+
|
39 |
+
test( 'returns empty string if product image has no src attribute', () => {
|
40 |
+
const imageSrc = getImageSrcFromProduct( { images: [ {} ] } );
|
41 |
+
|
42 |
+
expect( imageSrc ).toBe( '' );
|
43 |
+
} );
|
44 |
+
} );
|
45 |
+
|
46 |
+
describe( 'getImageIdFromProduct', () => {
|
47 |
+
test( 'returns first image id', () => {
|
48 |
+
const imageUrl = getImageIdFromProduct( {
|
49 |
+
images: [ { id: 123 } ],
|
50 |
+
} );
|
51 |
+
|
52 |
+
expect( imageUrl ).toBe( 123 );
|
53 |
+
} );
|
54 |
+
|
55 |
+
test( 'returns 0 if no product was provided', () => {
|
56 |
+
const imageUrl = getImageIdFromProduct();
|
57 |
+
|
58 |
+
expect( imageUrl ).toBe( 0 );
|
59 |
+
} );
|
60 |
+
|
61 |
+
test( 'returns 0 if product is empty', () => {
|
62 |
+
const imageUrl = getImageIdFromProduct( {} );
|
63 |
+
|
64 |
+
expect( imageUrl ).toBe( 0 );
|
65 |
+
} );
|
66 |
+
|
67 |
+
test( 'returns 0 if product has no images', () => {
|
68 |
+
const imageUrl = getImageIdFromProduct( { images: null } );
|
69 |
+
|
70 |
+
expect( imageUrl ).toBe( 0 );
|
71 |
+
} );
|
72 |
+
|
73 |
+
test( 'returns 0 if product has 0 images', () => {
|
74 |
+
const imageUrl = getImageIdFromProduct( { images: [] } );
|
75 |
+
|
76 |
+
expect( imageUrl ).toBe( 0 );
|
77 |
+
} );
|
78 |
+
|
79 |
+
test( 'returns 0 if product image has no src attribute', () => {
|
80 |
+
const imageUrl = getImageIdFromProduct( { images: [ {} ] } );
|
81 |
+
|
82 |
+
expect( imageUrl ).toBe( 0 );
|
83 |
+
} );
|
84 |
+
} );
|
build/all-reviews.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["lodash","react","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-editor","wp-element","wp-escape-html","wp-i18n","wp-is-shallow-equal","wp-polyfill","wp-url"]
|
build/all-reviews.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var n,a,i=t[0],l=t[1],s=t[2],b=0,d=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,i=1;i<r.length;i++){var l=r[i];0!==o[l]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={3:0},c=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return c.push([551,2,1,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},114:function(e,t,r){},13:function(e,t){!function(){e.exports=this.React}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,r){"use strict";var n=r(0),o=r(2),c=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(n.createElement)("g",null,Object(n.createElement)("g",null,Object(n.createElement)("path",{fill:r,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(n.createElement)("path",{fill:r,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(n.createElement)("path",{fill:r,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},b=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)("path",{fill:r,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(n.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},d=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(n.createElement)("path",{fill:r,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(n.createElement)("path",{fill:r,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(n.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},w=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},p=r(6),m=r.n(p),h=(r(7),function(e){var t=e.size,r=void 0===t?20:t,c=e.className;return Object(n.createElement)(o.Icon,{className:m()("woo-icon",c),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:r,width:Math.floor(1.67*r),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});r.d(t,"a",function(){return c}),r.d(t,"b",function(){return a}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return l}),r.d(t,"e",function(){return s}),r.d(t,"f",function(){return u}),r.d(t,"h",function(){return b}),r.d(t,"g",function(){return d}),r.d(t,"i",function(){return w}),r.d(t,"j",function(){return h})},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},40:function(e,t,r){"use strict";r.d(t,"b",function(){return l}),r.d(t,"c",function(){return s}),r.d(t,"a",function(){return u});var n=r(17),o=r.n(n),c=r(6),a=r.n(c),i=r(5),l=function(e){if(i.ENABLE_REVIEW_RATING){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},s=function(e){return o()({path:"/wc/blocks/products/reviews?"+Object.entries(e).map(function(e){return e.join("=")}).join("&"),parse:!1}).then(function(e){return e.json().then(function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}})})},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,i=t.showProductName,l=t.showReviewImage,s=t.showReviewRating;return a()(e,r,{"has-image":l,"has-name":o,"has-date":n,"has-rating":s,"has-content":c,"has-product-name":i})}},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(7),r(29)),a=r.n(c),i=r(6),l=r.n(i),s=r(39),u=r(2);t.a=function(e){var t,r,c=e.className,i=e.error,b=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(a.a,{icon:"notice"}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:l()("wc-block-api-error",c)},Object(n.createElement)("div",{className:"wc-block-error__message"},(r=(t=i).apiMessage,t.message||(r?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(s.escapeHTML)(r))):Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))),d&&Object(n.createElement)(n.Fragment,null,b?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:d},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},551:function(e,t,r){"use strict";r.r(t);var n=r(20),o=r.n(n),c=r(0),a=r(1),i=r(23),l=(r(77),r(18)),s=r(2),u=(r(7),r(24)),b=r(81),d=function(){return Object(c.createElement)(s.Placeholder,{className:"wc-block-all-reviews",icon:Object(c.createElement)(u.a,{className:"block-editor-block-icon"}),label:Object(a.__)("All Reviews","woo-gutenberg-products-block")},Object(a.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block"))},w=r(63),p=function(e){var t=e.attributes,r=e.setAttributes;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(l.InspectorControls,{key:"inspector"},Object(c.createElement)(s.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(s.ToggleControl,{label:Object(a.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return r({showProductName:!t.showProductName})}}),Object(w.b)(t,r)),Object(c.createElement)(s.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block")},Object(w.c)(t,r))),Object(c.createElement)(b.a,{attributes:t,className:"wc-block-all-reviews",icon:Object(c.createElement)(u.a,{className:"block-editor-block-icon"}),name:Object(a.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:d}))},m=r(79),h=r(80);function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}Object(i.registerBlockType)("woocommerce/all-reviews",{title:Object(a.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(u.a,{fillColor:"#96588a"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Shows a list of all product reviews.","woo-gutenberg-products-block"),attributes:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},m.a,{showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(p,e)},save:h.a})},63:function(e,t,r){"use strict";r.d(t,"a",function(){return b}),r.d(t,"b",function(){return d}),r.d(t,"c",function(){return w});var n=r(0),o=r(1),c=r(39),a=r(2),i=r(18),l=r(74),s=r(5),u=r(70),b=function(e,t){return Object(n.createElement)(i.BlockControls,null,Object(n.createElement)(a.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!s.ENABLE_REVIEW_RATING&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Product rating is disabled in your %sstore settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(l.a)("admin.php?page=wc-settings&tab=products"),'" target="_blank">'),"</a>"))),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!s.SHOW_AVATARS&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Reviewer photo is disabled in your %ssite settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(l.a)("options-discussion.php"),'" target="_blank">'),"</a>")))))},w=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(a.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},69:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),w=r(12),p=r.n(w),m=r(0),h=r(13),v=[];t.a=function(e){return function(t){function r(){return a()(this,r),u()(this,d()(r).apply(this,arguments))}return p()(r,t),l()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return v[e]||(v[e]=0),v[e]++,v[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(m.createElement)(e,o()({},this.props,{componentId:t}))}}]),r}(h.Component)}},70:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),w=r(15),p=r.n(w),m=r(12),h=r.n(m),v=r(0),g=r(4),f=r(6),O=r.n(f),j=r(2),y=r(21),E=(r(132),function(e){function t(){var e;return a()(this,t),(e=u()(this,d()(t).apply(this,arguments))).onClick=e.onClick.bind(p()(e)),e}return h()(t,e),l()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,a=r.instanceId,i=r.className,l=r.help,s=r.options,u=r.value,b="inspector-toggle-button-control-".concat(a);return l&&(e=Object(g.isFunction)(l)?l(c):l),Object(v.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",i)},Object(v.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(v.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},s.map(function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(v.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)})))}}]),t}(v.Component));t.a=Object(y.withInstanceId)(E)},77:function(e,t,r){var n=r(114);"string"==typeof n&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(35)(n,o);n.locals&&(e.exports=n.locals)},78:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},79: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}}},80:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(0),a=(r(77),r(40));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,i=t.orderby,l=t.productId,s={"data-image-type":n,"data-orderby":i,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return l&&(s["data-product-id"]=l,u="wc-block-reviews-by-product"),Array.isArray(r)&&(s["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(a.a)(u,t)},s))}},81:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(9),a=r.n(c),i=r(10),l=r.n(i),s=r(11),u=r.n(s),b=r(12),d=r.n(b),w=r(0),p=r(1),m=r(13),h=(r(7),r(4)),v=r(2),g=r(5),f=r(52),O=r(20),j=r.n(O),y=r(6),E=r.n(y);function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var k=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,c=e.wrapperProps;return!r&&n?(t=o||"span",c=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},c,{className:E()(c.className,"screen-reader-text")}),Object(w.createElement)(t,c,n)):(t=o||m.Fragment,r&&n&&r!==n?Object(w.createElement)(t,c,Object(w.createElement)("span",{"aria-hidden":!0},r),Object(w.createElement)("span",{className:"screen-reader-text"},n)):Object(w.createElement)(t,c,r))};k.defaultProps={wrapperProps:{}};var R=k,C=(r(170),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(w.createElement)("div",{className:"wp-block-button wc-block-load-more"},Object(w.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(w.createElement)(R,{label:r,screenReaderLabel:n})))});C.defaultProps={label:Object(p.__)("Load more","woo-gutenberg-products-block")};var N=C,L=r(15),P=r.n(L),M=r(100),x=r.n(M),I=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=x()(e,{suffix:r,limit:t});return n.html},T=function(e,t,r,n){var o=H(e,t,r);return I(e,o-n.length,n)},H=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=I(e,n.middle),n=A(n,t.clientHeight,r);return n.middle},A=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e},S=function(e){function t(e){var r;return o()(this,t),(r=l()(this,u()(t).apply(this,arguments))).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},r.reviewSummary=Object(m.createRef)(),r.reviewContent=Object(m.createRef)(),r.getButton=r.getButton.bind(P()(r)),r.onClick=r.onClick.bind(P()(r)),r}return d()(t,e),a()(t,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:T(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(w.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(w.createElement)("div",{className:e},Object(w.createElement)("div",{ref:this.reviewContent},r)):Object(w.createElement)("div",{className:e},(!c||null===o)&&Object(w.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(w.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),t}(m.Component);S.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(p.__)("Read more","woo-gutenberg-products-block"),lessText:Object(p.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var z=S;r(171);var D=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,a=t.showReviewerName,i=t.showReviewImage,l=t.showReviewRating,s=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,m=Number.isFinite(b)&&l;return Object(w.createElement)("li",{className:E()("wc-block-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||a||i||m)&&Object(w.createElement)("div",{className:"wc-block-review-list-item__info"},i&&function(e,t,r){return r||!e?Object(w.createElement)("div",{className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(w.createElement)("div",{className:"wc-block-review-list-item__image"},"product"===t?Object(w.createElement)("img",{"aria-hidden":"true",alt:"",src:e.product_picture||"",className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(w.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x",className:"wc-block-review-list-item__image",width:"48",height:"48"}),e.verified&&Object(w.createElement)("div",{className:"wc-block-review-list-item__verified",title:Object(p.__)("Verified buyer","woo-gutenberg-products-block")},Object(p.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||a||m||c)&&Object(w.createElement)("div",{className:"wc-block-review-list-item__meta"},m&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(w.createElement)("div",{className:"wc-block-review-list-item__rating"},Object(w.createElement)("div",{className:"wc-block-review-list-item__rating__stars",role:"img"},Object(w.createElement)("span",{style:r},Object(p.sprintf)(Object(p.__)("Rated %d out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(w.createElement)("div",{className:"wc-block-review-list-item__product"},Object(w.createElement)("a",{href:e.product_permalink},e.product_name))}(n),a&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(w.createElement)("div",{className:"wc-block-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(w.createElement)("time",{className:"wc-block-review-list-item__published-date",dateTime:t},r)}(n))),s&&function(e){return Object(w.createElement)(z,{maxLines:10,moreText:Object(p.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(p.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text"},Object(w.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(172);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var V=function(e){var t=e.attributes,r=e.reviews,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{showReviewImage:(g.SHOW_AVATARS||"product"===t.imageType)&&t.showReviewImage,showReviewRating:g.ENABLE_REVIEW_RATING&&t.showReviewRating});return Object(w.createElement)("ul",{className:"wc-block-review-list"},0===r.length?Object(w.createElement)(D,{attributes:n}):r.map(function(e,t){return Object(w.createElement)(D,{key:e.id||t,attributes:n,review:e})}))},F=r(69),W=(r(173),Object(F.a)(function(e){var t=e.className,r=e.componentId,n=e.defaultValue,o=e.label,c=e.onChange,a=e.options,i=e.screenReaderLabel,l=e.readOnly,s=e.value,u="wc-block-order-select__select-".concat(r);return Object(w.createElement)("p",{className:E()("wc-block-order-select",t)},Object(w.createElement)(R,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-order-select__label",htmlFor:u}}),Object(w.createElement)("select",{id:u,className:"wc-block-order-select__select",defaultValue:n,onChange:c,readOnly:l,value:s},a.map(function(e){return Object(w.createElement)("option",{key:e.key,value:e.key},e.label)})))})),G=(r(174),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(w.createElement)(W,{className:"wc-block-review-order-select",defaultValue:t,label:Object(p.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(p.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(p.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(p.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(p.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),Z=r(16),U=r.n(Z),q=r(38),J=r.n(q),Y=r(78),K=r.n(Y),Q=r(40),X=function(e){var t=function(t){function r(){var e;return o()(this,r),(e=l()(this,u()(r).apply(this,arguments))).state={error:null,loading:!0,reviews:[],totalReviews:0},e.setError=e.setError.bind(P()(e)),e.delayedAppendReviews=e.props.delayFunction(e.appendReviews),e}return d()(r,t),a()(r,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!K()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{key:"replaceReviews",value:function(){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}},{key:"appendReviews",value:function(){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(Q.c)(this.getArgs(t.length)).then(function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter(function(e){return Object.keys(e).length}).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}}).catch(this.setError)}},{key:"setError",value:function(e){var t=this;e.json().then(function(e){var r=t.props.onReviewsLoadError,n="object"===J()(e)&&e.hasOwnProperty("message")?{apiMessage:e.message}:{apiMessage:null};t.setState({reviews:[],loading:!1,error:n}),r()})}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,a=r.totalReviews;return Object(w.createElement)(e,U()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),r}(m.Component);t.defaultProps={delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}};var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;return r?Object(w.createElement)(f.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(w.createElement)(v.Disabled,null,t.showOrderby&&g.ENABLE_REVIEW_RATING&&Object(w.createElement)(G,{readOnly:!0,value:t.orderby}),Object(w.createElement)(V,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(w.createElement)(N,{screenReaderLabel:Object(p.__)("Load more reviews","woo-gutenberg-products-block")})):Object(w.createElement)(o,{attributes:t})}}]),t}(m.Component)),$=function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(w.createElement)(v.Placeholder,{icon:t,label:r},Object(p.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,a=t.reviewsOnPageLoad,i=t.showProductName,l=t.showReviewDate,s=t.showReviewerName,u=t.showReviewContent,b=t.showReviewImage,d=t.showReviewRating,p=Object(Q.b)(t.orderby),m=p.order,v=p.orderby;return!(u||d||l||s||b||i)?this.renderHiddenContentPlaceholder():Object(w.createElement)("div",{className:Object(Q.a)(r,t)},Object(w.createElement)(X,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(h.debounce)(e,400)},noReviewsPlaceholder:n,orderby:v,order:m,productId:c,reviewsToDisplay:a}))}}]),t}(m.Component);t.a=$}});
|
build/blocks.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks.blocks=function(e){function t(t){for(var c,i,l=t[0],a=t[1],s=t[2],h=0,f=[];h<l.length;h++)i=l[h],r[i]&&f.push(r[i][0]),r[i]=0;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&(e[c]=a[c]);for(u&&u(t);f.length;)f.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,l=1;l<n.length;l++){var a=n[l];0!==r[a]&&(c=!1)}c&&(o.splice(t--,1),e=i(i.s=n[0]))}return e}var c={},r={3:0},o=[];function i(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=c,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(n,c,function(t){return e[t]}.bind(null,c));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=a;return o.push([259,0,2,1]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},259:function(e,t,n){"use strict";n.r(t);var c=n(60),r=n.n(c),o=n(0),i=n(18),l=n(1),a=(n(263),n(266),n(28));Object(i.setCategories)([].concat(r()(Object(i.getCategories)().filter(function(e){return"woocommerce"!==e.slug})),[{slug:"woocommerce",title:Object(l.__)("WooCommerce","woo-gutenberg-products-block"),icon:Object(o.createElement)(a.g,null)}]))},263:function(e,t,n){var c=n(264);"string"==typeof c&&(c=[[e.i,c,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(38)(c,r);c.locals&&(e.exports=c.locals)},264:function(e,t,n){},28:function(e,t,n){"use strict";var c=n(0),r=n(3),o=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},a=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},h=n(6),f=n.n(h),m=n(4),p=n.n(m),v=function(e){var t=e.size,n=void 0===t?20:t,o=e.className;return Object(c.createElement)(r.Icon,{className:f()("woo-icon",o),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};v.propTypes={size:p.a.number,className:p.a.string};var w=v;n.d(t,"a",function(){return o}),n.d(t,"b",function(){return i}),n.d(t,"c",function(){return l}),n.d(t,"d",function(){return a}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return w})},3:function(e,t){!function(){e.exports=this.wp.components}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks.blocks=function(e){function t(t){for(var n,o,a=t[0],i=t[1],f=t[2],h=0,u=[];h<a.length;h++)o=a[h],Object.prototype.hasOwnProperty.call(r,o)&&r[o]&&u.push(r[o][0]),r[o]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(s&&s(t);u.length;)u.shift()();return l.push.apply(l,f||[]),c()}function c(){for(var e,t=0;t<l.length;t++){for(var c=l[t],n=!0,a=1;a<c.length;a++){var i=c[a];0!==r[i]&&(n=!1)}n&&(l.splice(t--,1),e=o(o.s=c[0]))}return e}var n={},r={4:0},l=[];function o(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,o),c.l=!0,c.exports}o.m=e,o.c=n,o.d=function(e,t,c){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(o.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(c,n,function(t){return e[t]}.bind(null,n));return c},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=a.push.bind(a);a.push=t,a=a.slice();for(var f=0;f<a.length;f++)t(a[f]);var s=i;return l.push([290,2,1,0]),c()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},2:function(e,t){!function(){e.exports=this.wp.components}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,c){"use strict";var n=c(0),r=c(2),l=function(e){var t=e.className,c=e.fillColor;return Object(n.createElement)(r.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(n.createElement)("g",null,Object(n.createElement)("g",null,Object(n.createElement)("path",{fill:c,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(n.createElement)("path",{fill:c,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(n.createElement)("path",{fill:c,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},o=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(n.createElement)(r.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},f=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},h=function(e){var t=e.className,c=e.fillColor;return Object(n.createElement)(r.Icon,{className:t,icon:Object(n.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)("path",{fill:c,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(n.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},u=function(e){var t=e.className,c=e.fillColor;return Object(n.createElement)(r.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(n.createElement)("path",{fill:c,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(n.createElement)("path",{fill:c,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(n.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},m=function(){return Object(n.createElement)(r.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},w=c(6),p=c.n(w),v=(c(7),function(e){var t=e.size,c=void 0===t?20:t,l=e.className;return Object(n.createElement)(r.Icon,{className:p()("woo-icon",l),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:c,width:Math.floor(1.67*c),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});c.d(t,"a",function(){return l}),c.d(t,"b",function(){return o}),c.d(t,"c",function(){return a}),c.d(t,"d",function(){return i}),c.d(t,"e",function(){return f}),c.d(t,"f",function(){return s}),c.d(t,"h",function(){return h}),c.d(t,"g",function(){return u}),c.d(t,"i",function(){return m}),c.d(t,"j",function(){return v})},290:function(e,t,c){"use strict";c.r(t);var n=c(62),r=c.n(n),l=c(0),o=c(23),a=c(1),i=(c(294),c(296),c(24));Object(o.setCategories)([].concat(r()(Object(o.getCategories)().filter(function(e){return"woocommerce"!==e.slug})),[{slug:"woocommerce",title:Object(a.__)("WooCommerce","woo-gutenberg-products-block"),icon:Object(l.createElement)(i.j,null)}]))},294:function(e,t,c){var n=c(295);"string"==typeof n&&(n=[[e.i,n,""]]);var r={insert:"head",singleton:!1};c(35)(n,r);n.locals&&(e.exports=n.locals)},295:function(e,t,c){}});
|
build/editor.css
CHANGED
@@ -1,14 +1,11 @@
|
|
1 |
-
@charset "UTF-8";@-webkit-keyframes slide-in-left{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes slide-in-left{0%{transform:translateX(100%)}to{transform:translateX(0)}}@-webkit-keyframes slide-out-left{0%{transform:translateX(-100%)}to{transform:translateX(-200%)}}@keyframes slide-out-left{0%{transform:translateX(-100%)}to{transform:translateX(-200%)}}@-webkit-keyframes slide-in-right{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-in-right{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@-webkit-keyframes slide-out-right{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes slide-out-right{0%{transform:translateX(-100%)}to{transform:translateX(0)}}.woocommerce-slide-animation>div{width:100%;white-space:nowrap;overflow:hidden;display:flex}.woocommerce-slide-animation.animate-left .slide-enter-active{-webkit-animation:slide-in-left;animation:slide-in-left;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-left .slide-exit-active{-webkit-animation:slide-out-left;animation:slide-out-left;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-right .slide-enter-active{-webkit-animation:slide-in-right;animation:slide-in-right;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-right .slide-exit-active{-webkit-animation:slide-out-right;animation:slide-out-right;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (prefers-reduced-motion:reduce){.woocommerce-slide-animation .slide-enter-active,.woocommerce-slide-animation .slide-exit-active{-webkit-animation:none!important;animation:none!important}}.woocommerce-calendar{width:100%;background-color:#f8f9f9;border-top:1px solid #ccd0d4;height:396px}.woocommerce-calendar.is-mobile{height:100%}.woocommerce-calendar__react-dates{width:100%;overflow-x:hidden}.woocommerce-calendar__react-dates .DayPicker{margin:0 auto}.woocommerce-calendar__react-dates .CalendarMonth_table{margin-top:10px}.woocommerce-calendar__react-dates .CalendarDay__selected_span{background:#95588a;border:1px solid #ccd0d4}.woocommerce-calendar__react-dates .CalendarDay__selected{background:#622557;border:1px solid #ccd0d4}.woocommerce-calendar__react-dates .CalendarDay__hovered_span{background:#95588a;border:1px solid #e2e4e7;color:#fff}.woocommerce-calendar__react-dates .CalendarDay__blocked_out_of_range{color:#a2aab2}.woocommerce-calendar__react-dates .CalendarMonth,.woocommerce-calendar__react-dates .CalendarMonthGrid,.woocommerce-calendar__react-dates .DayPicker,.woocommerce-calendar__react-dates .DayPicker_transitionContainer{background-color:#f8f9f9}.woocommerce-calendar__react-dates .DayPicker_weekHeader_li{color:#606a73}.woocommerce-calendar__react-dates .DayPickerNavigation_button:focus{outline:2px solid #bfe7f3}.woocommerce-calendar__react-dates.is-core-datepicker .components-datetime__date{padding-left:0}.woocommerce-calendar__react-dates.is-core-datepicker .CalendarDay__default{background-color:transparent}.woocommerce-calendar__react-dates.is-core-datepicker .CalendarDay__selected{background:#622557;border:none}.woocommerce-calendar__inputs{padding:1em;width:100%;max-width:500px;display:-ms-grid;display:grid;-ms-grid-columns:43% 14% 43%;grid-template-columns:43% 14% 43%;margin:0 auto}.woocommerce-calendar__inputs .components-base-control{margin:0}.woocommerce-calendar__inputs-to{display:flex;align-items:center;justify-content:center;-ms-grid-column:2;grid-column-start:2}.woocommerce-calendar__input{position:relative}.woocommerce-calendar__input .dashicons-calendar{position:absolute;top:50%;transform:translateY(-50%);left:10px}.woocommerce-calendar__input .dashicons-calendar path{fill:#6c7781}.woocommerce-calendar__input:first-child{-ms-grid-column:1;grid-column-start:1}.woocommerce-calendar__input:last-child{-ms-grid-column:3;grid-column-start:3}.woocommerce-calendar__input.is-empty .dashicons-calendar path{fill:#6c7781}.woocommerce-calendar__input.is-error .dashicons-calendar path{fill:#d94f4f}.woocommerce-calendar__input.is-error .woocommerce-calendar__input-text{border:1px solid #d94f4f;box-shadow:inset 0 0 8px #d94f4f}.woocommerce-calendar__input.is-error .woocommerce-calendar__input-text:focus{box-shadow:inset 0 0 8px #d94f4f,0 0 6px rgba(30,140,190,.8)}.woocommerce-calendar__input .woocommerce-calendar__input-text{color:#555d66;border-radius:3px;padding:10px 10px 10px 30px;width:100%;font-size:13px;font-size:.8125rem}.woocommerce-calendar__input .woocommerce-calendar__input-text:-ms-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-ms-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-webkit-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-moz-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::placeholder{color:#6c7781}.woocommerce-filters-date__content.is-mobile .woocommerce-calendar__input-error .components-popover__content{height:auto}.woocommerce-calendar__input-error{display:none}.is-error .woocommerce-calendar__input-text:focus+span .woocommerce-calendar__input-error{display:block;left:50%!important;position:absolute;top:auto!important}.woocommerce-calendar__input-error .components-popover__content{background-color:#606a73;color:#fff;padding:.5em;border:none}.woocommerce-calendar__input-error.components-popover .components-popover__content{min-width:100px;width:100px;text-align:center}.woocommerce-calendar__input-error.components-popover:not(.no-arrow):not(.is-mobile).is-bottom:before{border-bottom-color:#606a73;z-index:1;top:-6px}.woocommerce-calendar__input-error.components-popover:not(.no-arrow):not(.is-mobile).is-top:after{border-top-color:#606a73;z-index:1;top:0}.woocommerce-calendar__date-picker-title{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#6c7781;width:100%;margin:0;padding:1em;background-color:#fff}.woocommerce-card{margin-bottom:24px;background:#fff;border-radius:3px;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);transition:box-shadow .2s cubic-bezier(.4,1,.4,1)}@media (max-width:782px){.woocommerce-card{margin-bottom:12px;width:auto}}.woocommerce-card.is-inactive{background-color:#f6f6f6;box-shadow:none}.woocommerce-card__header{padding:16px;display:-ms-grid;display:grid;align-items:center;border-top-left-radius:3px;border-top-left-radius:4px}.has-action .woocommerce-card__header{-ms-grid-columns:auto 1fr;grid-template-columns:auto 1fr}.has-menu .woocommerce-card__header{-ms-grid-columns:auto 24px;grid-template-columns:auto 24px}.has-menu.has-action .woocommerce-card__header{grid-gap:12px;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px}.woocommerce-card__header-item{-ms-grid-row-align:center}.woocommerce-card__header-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__header-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__header-item:nth-child(3){-ms-grid-column:3;grid-column-start:3;-ms-grid-column-span:1;grid-column-end:4;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__action,.woocommerce-card__menu{text-align:right}.woocommerce-card__body{padding:16px}.woocommerce-card__title{margin:0;font-size:24px;font-size:1.5rem;line-height:1.2;font-weight:400}.woocommerce-card__description{font-size:16px;font-size:1rem;line-height:1.5;color:#636d75;margin-top:12px;margin-bottom:0;font-weight:400}.woocommerce-chart{margin-top:-16px;margin-bottom:24px;background:#fff;border:1px solid #ccd0d4;border-top:0}@media (max-width:782px){.woocommerce-chart{margin-left:-16px;margin-right:-16px;margin-bottom:12px;border-left:none;border-right:none;width:auto}}.woocommerce-chart .woocommerce-chart__header{min-height:50px;border-bottom:1px solid #ccd0d4;display:flex;flex-flow:row wrap;justify-content:space-between;align-items:center;width:100%}.woocommerce-chart .woocommerce-chart__header .woocommerce-chart__title{height:18px;color:#24292d;font-size:15px;font-weight:600;line-height:18px;margin-left:16px;margin-right:16px}.woocommerce-chart .woocommerce-chart__body{display:flex;flex-direction:row;justify-content:flex-start;align-items:flex-start;width:100%}.woocommerce-chart .woocommerce-chart__body.woocommerce-chart__body-column{flex-direction:column}.woocommerce-chart .woocommerce-chart__footer{width:100%}.woocommerce-chart-placeholder{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;padding:0;width:100%;display:flex;align-items:center;justify-content:center}.woocommerce-chart-placeholder:after{content:"\00a0"}.woocommerce-chart-placeholder .components-spinner{margin:0}.woocommerce-chart__interval-select{align-items:start;border-right:1px solid #ccd0d4;display:flex;flex-direction:column;justify-content:center;margin:0 0 0 auto;min-height:50px;padding:8px 16px 0}@media (max-width:960px){.woocommerce-chart__interval-select{width:100%;order:1;margin-top:-8px;margin-left:0;padding-left:8px;border-right:0;min-height:0}}#wpbody .woocommerce-chart__interval-select .components-select-control__input{font-size:13px;font-size:.8125rem;border:0;box-shadow:none}#wpbody .woocommerce-chart__interval-select .components-select-control__input:not(:disabled):not([aria-disabled=true]):focus{background-color:#fff;color:#191e23;box-shadow:inset 0 0 0 1px #6c7781,inset 0 0 0 2px #fff;outline:2px solid transparent;outline-offset:-2px}.woocommerce-chart__types{padding:0 8px;white-space:nowrap}.woocommerce-chart__type-button{background:transparent!important}.woocommerce-chart__type-button.components-icon-button{color:#ccd0d4}.woocommerce-chart__type-button.components-icon-button.woocommerce-chart__type-button-selected{color:#555d66}.woocommerce-chart__type-button.components-icon-button:hover{box-shadow:none!important}@media (max-width:960px){.woocommerce-summary+.woocommerce-chart .woocommerce-chart__title{display:none}.woocommerce-summary+.woocommerce-chart .woocommerce-chart__interval-select{width:auto;order:0;margin-top:0}}.woocommerce-legend.has-total{padding-bottom:50px;position:relative}.woocommerce-legend.woocommerce-legend__direction-column{border-right:1px solid #ccd0d4;min-width:320px}.woocommerce-chart__footer .woocommerce-legend.woocommerce-legend__direction-column{border-right:none}.woocommerce-legend__list{color:#24292d;display:flex;height:100%;margin:0}.woocommerce-legend__direction-column .woocommerce-legend__list{flex-direction:column;height:300px;overflow:auto}.woocommerce-chart__footer .woocommerce-legend__direction-column .woocommerce-legend__list{border-top:1px solid #ccd0d4;height:100%;max-height:none;min-height:none}.has-total.woocommerce-legend__direction-column .woocommerce-legend__list{height:250px}.woocommerce-chart__footer .has-total.woocommerce-legend__direction-column .woocommerce-legend__list{height:auto;max-height:220px;min-height:none}.woocommerce-legend__direction-row .woocommerce-legend__list{flex-direction:row}.woocommerce-legend__item>button{display:flex;justify-content:center;align-items:center;background-color:#fff;color:#555d66;cursor:pointer;display:inline-flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;width:100%;border:none;padding:0}.woocommerce-legend__item>button .woocommerce-legend__item-container{display:flex;flex-direction:row;flex-wrap:nowrap;position:relative;padding:3px 0 3px 24px;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.woocommerce-legend__item>button .woocommerce-legend__item-container:hover input~.woocommerce-legend__item-checkmark{background-color:#f3f4f5}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{border:1px solid #a2aab2;position:absolute;top:4px;left:0;height:16px;width:16px;background-color:#fff}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark:after{content:"";position:absolute;display:none}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark.woocommerce-legend__item-checkmark-checked{background-color:currentColor;border-color:currentColor}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark.woocommerce-legend__item-checkmark-checked:after{display:block;left:5px;top:2px;width:3px;height:6px;border:solid #fff;border-width:0 2px 2px 0;transform:rotate(45deg)}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-total{margin-left:auto;font-weight:700}.woocommerce-legend__item>button:focus{outline:none}.woocommerce-legend__item>button:focus .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{outline:2px solid #a2aab2}.woocommerce-legend__item>button:hover{background-color:#f8f9f9}.woocommerce-legend__direction-column .woocommerce-legend__item{margin:0;padding:0}.woocommerce-legend__direction-column .woocommerce-legend__item>button{min-height:36px;padding:0 17px;text-align:left}.woocommerce-legend__direction-column .woocommerce-legend__item:first-child{margin-top:12px}.woocommerce-legend__direction-column .woocommerce-legend__item:last-child:after{content:"";display:block;height:12px;width:100%}.woocommerce-legend__direction-row .woocommerce-legend__item{padding:0;margin:0}.woocommerce-legend__direction-row .woocommerce-legend__item>button{padding:0 17px}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container{height:50px;align-items:center}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{top:17px}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-title{margin-right:17px}.woocommerce-legend__total{align-items:center;background:#fff;border-top:1px solid #ccd0d4;bottom:0;color:#555d66;display:flex;height:50px;justify-content:center;left:0;position:absolute;right:0;text-transform:uppercase}.woocommerce-legend__total:before{background:linear-gradient(180deg,transparent,rgba(0,0,0,.2));bottom:100%;content:"";height:20px;left:0;opacity:0;pointer-events:none;position:absolute;right:0;transition:opacity .3s}.is-scrollable .woocommerce-legend__total:before{opacity:1}.woocommerce-chart__body-row .d3-chart__container{width:calc(100% - 320px)}.d3-chart__container{position:relative;width:100%}.d3-chart__container svg{overflow:visible}.d3-chart__container .d3-chart__empty-message{align-items:center;bottom:0;color:#6c7781;display:flex;font-size:18px;font-size:1.125rem;font-weight:700;justify-content:center;left:0;line-height:1.5;margin:0 auto;max-width:50%;padding-bottom:48px;pointer-events:none;position:absolute;right:0;top:0;text-align:center;z-index:1}@media (max-width:782px){.d3-chart__container .d3-chart__empty-message{font-size:13px;font-size:.8125rem}}.d3-chart__container .d3-chart__tooltip{border:1px solid #ccd0d4;position:absolute;display:flex;min-width:324px;height:auto;background-color:#fff;text-align:left;padding:17px;box-shadow:0 3px 20px 0 rgba(18,24,30,.1),0 1px 3px 0 rgba(18,24,30,.1);flex-direction:column;flex-wrap:nowrap;justify-content:flex-start;pointer-events:none;visibility:hidden;z-index:1}@media (max-width:600px){.d3-chart__container .d3-chart__tooltip{min-width:auto;width:calc(100% - 48px)}}.d3-chart__container .d3-chart__tooltip h4{text-align:left;line-height:18px;width:100%;text-transform:uppercase;font-size:11px;color:#6c7781;margin-top:0}.d3-chart__container .d3-chart__tooltip ul{list-style:none;margin-bottom:2px;margin-top:2px;font-size:14px}.d3-chart__container .d3-chart__tooltip ul li{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center}.d3-chart__container .d3-chart__tooltip ul li.key-row{display:flex;flex-direction:row;justify-content:space-between;width:100%}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container{width:100%;min-width:100px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container .key-color{display:inline-block;width:16px;height:16px;margin-right:8px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container .key-key{margin-right:6px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-value{font-weight:600}.d3-chart__container .bargrouprect{shape-rendering:crispEdges}.d3-chart__container .grid .tick line{stroke:#e2e4e7;stroke-width:1;shape-rendering:crispEdges}.d3-chart__container .grid .tick:first-child line{stroke:#555d66}.d3-chart__container .grid.with-positive-ticks .tick:last-child line{opacity:0}.d3-chart__container .tick{padding-top:10px;stroke-width:1}.d3-chart__container .y-axis{text-anchor:start}.d3-chart__container .y-axis.ticktext{fill:#555d66}.d3-chart__container .axis-month .tick text,.d3-chart__container .y-axis .tick text{font-size:10px}.d3-chart__container .focus-grid line{stroke:rgba(0,0,0,.1);stroke-width:1px}.d3-chart__container .barfocus{fill:rgba(0,0,0,.1)}.d3-base{background:transparent;overflow-x:auto;overflow-y:hidden;position:relative;width:100%;height:100%}.woocommerce-count{border:1px solid;border-radius:10px;padding:0 8px;font-weight:700}.woocommerce-page .woocommerce-dropdown-button{background-color:#fff;position:relative;border:1px solid #e2e4e7;color:#555d66;border-radius:4px;padding:0 40px 0 0;width:100%}.woocommerce-page .woocommerce-dropdown-button:after{content:"";position:absolute;right:14px;top:50%;transform:translateY(-50%);width:0;height:0;border-color:#555d66 transparent transparent;border-style:solid;border-width:6px 6px 0;transition:transform .2s ease}@media screen and (prefers-reduced-motion:reduce){.woocommerce-page .woocommerce-dropdown-button:after{transition:none}}.woocommerce-page .woocommerce-dropdown-button.is-open:after{transform:translateY(-50%) rotate(180deg)}.woocommerce-page .woocommerce-dropdown-button.is-open,.woocommerce-page .woocommerce-dropdown-button:active,.woocommerce-page .woocommerce-dropdown-button:hover{background-color:#f8f9f9}.woocommerce-page .woocommerce-dropdown-button.is-multi-line .woocommerce-dropdown-button__labels{flex-direction:column}.woocommerce-dropdown-button__labels{text-align:left;padding:8px 12px;min-height:48px;display:flex;align-items:center;width:100%;justify-content:space-around}@media (max-width:400px){.woocommerce-dropdown-button__labels{min-height:46px}}.woocommerce-dropdown-button__labels span{width:100%;text-align:left}.woocommerce-dropdown-button__labels span:last-child{font-size:12px;font-size:.75rem;margin:0}.woocommerce-dropdown-button__labels span:first-child{font-size:13px;font-size:.8125rem;font-weight:600}@media (max-width:400px){.woocommerce-dropdown-button__labels span:last-child{font-size:10px;font-size:.625rem}.woocommerce-dropdown-button__labels span:first-child{font-size:12px;font-size:.75rem}}.woocommerce-ellipsis-menu{text-align:center}.woocommerce-ellipsis-menu__toggle{height:24px;justify-content:center;vertical-align:middle;width:24px}.woocommerce-ellipsis-menu__toggle .dashicon{transform:rotate(90deg)}.woocommerce-ellipsis-menu__popover{text-align:left}.woocommerce-ellipsis-menu__popover:not(.is-mobile):after,.woocommerce-ellipsis-menu__popover:not(.is-mobile):before{margin-left:-16px}.woocommerce-ellipsis-menu__popover .components-popover__content{width:182px;padding:2px}.woocommerce-ellipsis-menu__popover .components-form-toggle.is-checked .components-form-toggle__track{background-color:#95588a}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__content{width:100%}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item,.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__title{padding:4px 12px}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item{cursor:pointer;color:#6c7781}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item:focus{box-shadow:inset 0 0 0 1px #6c7781,inset 0 0 0 2px #fff;outline:2px solid transparent;outline-offset:-2px}.woocommerce-ellipsis-menu__popover .components-base-control__label,.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__title{color:#23282d;padding-top:8px;padding-bottom:8px;font-size:15px;font-size:.9375rem;margin-bottom:4px}.woocommerce-ellipsis-menu__popover .components-toggle-control .components-base-control__field{margin:4px 0}.woocommerce-ellipsis-menu__popover .components-base-control{margin:0}.woocommerce-empty-content{margin-bottom:16px;text-align:center}.woocommerce-empty-content .woocommerce-empty-content__illustration{max-width:100%}.woocommerce-empty-content .woocommerce-empty-content__actions .components-button+.components-button{margin-left:16px}.woocommerce-filters-advanced{margin:24px 0}.woocommerce-filters-advanced .woocommerce-card__header{padding:8px 16px}.woocommerce-filters-advanced .woocommerce-card__body{padding:0}.woocommerce-filters-advanced .components-select-control__input{height:38px;padding:0;margin:0}.woocommerce-filters-advanced .components-base-control__field{margin-bottom:0}@media (max-width:782px){.woocommerce-filters-advanced{margin:16px 0;border:1px solid #ccd0d4}}@media (max-width:400px){.woocommerce-filters-advanced{margin:12px 0}}.woocommerce-filters-advanced__title-select{width:70px;display:inline-block;margin:0 8px}.woocommerce-filters-advanced__list{margin:0}.woocommerce-filters-advanced__list-item{padding:0 16px 0 0;margin:0;display:-ms-grid;display:grid;-ms-grid-columns:1fr 40px;grid-template-columns:1fr 40px;background-color:#f8f9f9;border-bottom:1px solid #ccd0d4}.woocommerce-filters-advanced__list-item:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__line-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__line-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__list-item fieldset{padding:8px 8px 8px 16px}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__remove{width:40px;height:38px;-ms-grid-row-align:center;align-self:center}@media (max-width:400px){.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__remove{position:absolute;top:0;right:4px}}.woocommerce-filters-advanced__list-item .components-form-token-field{border-radius:4px}@media (max-width:400px){.woocommerce-filters-advanced__list-item{display:block;position:relative;padding:8px 8px 0 0}}.woocommerce-filters-advanced__add-filter{padding:12px;margin:0;color:#95588a;display:block;background-color:#f8f9f9;border-bottom:1px solid #ccd0d4}.woocommerce-filters-advanced__add-filter:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__add-filter div div{display:inline-block}.woocommerce-filters-advanced__add-filter .components-popover:not(.is-mobile) .components-popover__content{min-width:180px}.woocommerce-filters-advanced__fieldset{display:flex;align-items:center}.woocommerce-filters-advanced__fieldset>div{padding:0 4px}@media (max-width:782px){.woocommerce-filters-advanced__fieldset>div{width:100%;padding:4px 0}}@media (max-width:782px){.woocommerce-filters-advanced__fieldset{display:block}}.woocommerce-filters-advanced__fieldset.is-english{display:-ms-grid;display:grid;-ms-grid-columns:100px 150px 1fr;grid-template-columns:100px 150px 1fr}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:nth-child(3){-ms-grid-column:3;grid-column-start:3;-ms-grid-column-span:1;grid-column-end:4;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:first-child{display:flex;align-items:center}@media (max-width:782px){.woocommerce-filters-advanced__fieldset.is-english{display:block}}.woocommerce-filters-advanced__rule{width:150px}.woocommerce-filters-advanced__input{width:100%}.woocommerce-filters-advanced__add-filter-dropdown{display:inline-block}.woocommerce-filters-advanced__add-button{color:inherit;padding:8px}.woocommerce-filters-advanced__add-button svg{fill:currentColor;margin:0 6px 0 0}.woocommerce-filters-advanced__add-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{color:#c88bbd}.woocommerce-filters-advanced__add-button:not(:disabled):not([aria-disabled=true]):focus{color:#95588a;background-color:transparent}.woocommerce-filters-advanced__controls{padding:8px 16px;display:flex;align-items:center}.woocommerce-filters-advanced__controls .components-button{margin-right:16px}.woocommerce-filters-advanced__add-dropdown{padding:8px 0}.woocommerce-filters-advanced__add-dropdown li{margin:0}.woocommerce-filters-advanced__add-dropdown .components-button{width:100%;padding:8px}.woocommerce-filters-advanced__add-dropdown .components-button:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__add-dropdown .components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#edeff0;box-shadow:none}.woocommerce-filters-advanced__input-range{align-items:center;display:-ms-grid;display:grid;-ms-grid-columns:1fr;grid-template-columns:1fr}.woocommerce-filters-advanced__input-range.is-between{-ms-grid-columns:1fr 36px 1fr;grid-template-columns:1fr 36px 1fr}.woocommerce-filters-advanced__input-range input{height:38px;margin:0}.woocommerce-filters-advanced__input-range .separator{text-align:center}.woocommerce-filters-date__content.is-mobile .components-popover__header{border:none;height:0}.woocommerce-filters-date__content.is-mobile .components-popover__close{transform:translateY(22px)}.woocommerce-filters-date__content.is-mobile .components-tab-panel__tab-content{height:calc(100% - 46px);overflow:auto}.woocommerce-filters-date__tabs{height:calc(100% - 42px)}.woocommerce-filters-date__tabs .components-tab-panel__tabs{display:-ms-grid;display:grid;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;border-radius:5px;margin:0 1em 1em}.woocommerce-filters-date__tabs .components-tab-panel__tab-content{display:flex;flex-direction:column;align-items:center}.woocommerce-filters-date__tab:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-date__tab:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}button.woocommerce-filters-date__tab{outline:none;border:1px solid #95588a;padding:8px;margin:0;border-radius:4px 0 0 4px;color:#95588a;background-color:transparent;justify-content:center}button.woocommerce-filters-date__tab:hover{background-color:#f8f4f7;cursor:pointer}button.woocommerce-filters-date__tab:last-child{border-radius:0 4px 4px 0}button.woocommerce-filters-date__tab.is-active,button.woocommerce-filters-date__tab.is-active:focus{background-color:#95588a;color:#fff}button.woocommerce-filters-date__tab:focus{box-shadow:inset 0 -1px 0 #00435d,0 0 0 2px #bfe7f3}.woocommerce-filters-date__text{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#6c7781;width:100%;margin:0;padding:1em;background-color:#fff}.woocommerce-filters-date__content-controls{display:flex;flex-direction:column;width:100%;align-items:center;padding-bottom:1em;background-color:#fff}.woocommerce-filters-date__content-controls.is-custom{border-top:1px solid #ccd0d4}.woocommerce-filters-date__button-group{padding-top:1em;display:flex;justify-content:center;width:100%}.woocommerce-filters-date__button-group .woocommerce-filters-date__button.is-button{justify-content:center;width:40%;height:34px;margin:0 12px}.woocommerce-filters-filter__content.is-mobile .components-popover__header-title{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#555d66}.woocommerce-filters-filter__content.is-mobile .woocommerce-filters-filter__content-list-item:last-child{border-bottom:1px solid #ccd0d4}.woocommerce-filters-filter__content-list{margin:0;width:100%;min-width:100%}.woocommerce-filters-filter__content-list-item{border-bottom:1px solid #ccd0d4;margin:0}.woocommerce-filters-filter__content-list-item:last-child{border-bottom:none}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button{background-color:#fff}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button.components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#fff}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button:before{content:"";width:8px;height:8px;background-color:#95588a;position:absolute;top:50%;left:1em;transform:translate(50%,-50%)}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button{position:relative;display:block;width:100%;padding:1em 1em 1em 3em;background-color:#f8f9f9;text-align:left}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button.components-button{color:#555d66}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button:hover{background-color:#f3f4f5;color:#555d66}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button.components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#f8f9f9}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button .dashicon{position:absolute;left:1em;top:50%;transform:translateY(-50%)}.woocommerce-filters .components-base-control__field{margin-bottom:0}@media (max-width:400px){.woocommerce-filters{margin-left:-8px;margin-right:-8px}}.woocommerce-filters__basic-filters{display:flex;margin-bottom:24px}@media (max-width:1280px){.woocommerce-filters__basic-filters{flex-direction:column}}@media (max-width:782px){.woocommerce-filters__basic-filters{margin-bottom:16px}}.woocommerce-filters-filter{width:25%;padding:0 12px;min-height:82px;display:flex;flex-direction:column;justify-content:flex-end}.woocommerce-filters-filter:first-child{padding-left:0}.woocommerce-filters-filter:last-child{padding-right:0}@media (max-width:1440px){.woocommerce-filters-filter{width:33.3%}}@media (max-width:1280px){.woocommerce-filters-filter{width:50%;padding:0;min-height:78px}}@media (max-width:782px){.woocommerce-filters-filter{width:100%}}.woocommerce-filters-label{margin:7px 0;display:block}@media (max-width:1280px){.woocommerce-filters-label{margin:5px 0}}.woocommerce-filters-date__content .components-popover__content,.woocommerce-filters-filter__content .components-popover__content{width:320px;border:1px solid #ccd0d4;background-color:#fff}.woocommerce-filters-date__content .woocommerce-calendar__input-error .components-popover__content,.woocommerce-filters-filter__content .woocommerce-calendar__input-error .components-popover__content{background-color:#606a73}.woocommerce-filters-date__content.is-mobile .components-popover__content,.woocommerce-filters-filter__content.is-mobile .components-popover__content{width:100%;height:100%;border:none}.woocommerce-filters__compare .woocommerce-card__body{padding:0}.woocommerce-filters__compare-body{padding:16px;background-color:#f8f9f9;border-bottom:1px solid #e2e4e7}.woocommerce-filters__compare-footer{padding:16px;display:flex;align-items:center}.woocommerce-filters__compare-footer .components-button{margin-right:16px}.woocommerce-filters-filter__search .woocommerce-search__autocomplete-results{position:static}.woocommerce-filters-filter__search .woocommerce-search__inline-container{overflow:hidden}.woocommerce-filters-filter__search .woocommerce-search__inline-container:not(.is-active){border:none}.woocommerce-filters-advanced__list-item .components-base-control+.components-base-control{margin-bottom:0}.woocommerce-flag span{vertical-align:middle}.woocommerce-flag .woocommerce-flag__fallback{background:#e2e4e7;color:transparent;width:24px;height:18px;display:block;overflow:hidden}.woocommerce-gravatar{border-radius:50%}.woocommerce-order-status{display:flex;align-items:center}.woocommerce-order-status__indicator{min-width:16px;width:16px;height:16px;display:block;background:#ccd0d4;margin-right:8px;border-radius:50%;border:3px solid #e2e4e7}.woocommerce-order-status__indicator.is-processing{background:#4ab866;border-color:#93d5a4}.woocommerce-order-status__indicator.is-on-hold{background:#ffb900;border-color:#ffd566}.woocommerce-pagination{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:center;align-items:center}@media (max-width:782px){.woocommerce-pagination{flex-direction:column}}.woocommerce-pagination input{border-radius:4px}.woocommerce-pagination__page-arrows{display:flex;flex-direction:row}.woocommerce-pagination__page-arrows-buttons{display:inline-flex;align-items:baseline;border:solid #b5bfc9;border-width:1px 1px 2px;border-radius:4px;background:#f0f2f4}.woocommerce-pagination__page-arrows-buttons .components-button:not(:disabled):not([aria-disabled=true]){color:#24292d;height:30px;width:32px;justify-content:center}.woocommerce-pagination__page-arrows-buttons .components-icon-button:not(:disabled):not([aria-disabled=true]):hover{color:#6c7781}.woocommerce-pagination__page-arrows-buttons button:first-child{border-right:2px solid #d3d9de}.woocommerce-pagination__page-arrows-buttons .woocommerce-pagination__link{padding:4px}.woocommerce-pagination__page-arrows-label{margin-top:8px;margin-right:8px}.woocommerce-pagination__page-picker{margin-left:16px}@media (max-width:782px){.woocommerce-pagination__page-picker{margin-top:16px;margin-left:0}}.woocommerce-pagination__page-picker .woocommerce-pagination__page-picker-input{margin-left:8px;width:60px;height:34px;box-shadow:none}.woocommerce-pagination__per-page-picker{margin-left:16px}@media (max-width:782px){.woocommerce-pagination__per-page-picker{margin-top:16px;margin-left:0}}.woocommerce-pagination__per-page-picker .components-base-control{margin-bottom:0}.woocommerce-pagination__per-page-picker .components-base-control__field{display:flex;flex-direction:row;align-items:baseline;margin-bottom:0}.woocommerce-pagination__per-page-picker .components-select-control__input{width:60px;height:34px;box-shadow:none}.woocommerce-pagination__per-page-picker .components-base-control__label{margin-right:8px}.woocommerce-pagination__page-picker-input.has-error,.woocommerce-pagination__page-picker-input.has-error:focus{border-color:#d94f4f;box-shadow:0 0 2px #d94f4f}.woocommerce-product-image{border-radius:50%}.woocommerce-rating{position:relative;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap}.woocommerce-rating .gridicon{fill:#d7dade}.woocommerce-rating .woocommerce-rating__star-outline{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden}.woocommerce-rating .woocommerce-rating__star-outline .gridicon{fill:#555d66}.woocommerce-search{position:relative;min-width:0}.woocommerce-search>div{min-width:0}.woocommerce-search .woocommerce-search__icon{position:absolute;top:10px;left:10px;fill:#a2aab2}.woocommerce-search .woocommerce-tag{max-width:100%}.woocommerce-search .woocommerce-tag .woocommerce-tag__text{max-width:calc(100% - 24px)}.woocommerce-search:not(.has-inline-tags) .woocommerce-tag{margin:8px 6px 0 0}.woocommerce-search.has-inline-tags .woocommerce-search__icon{top:50%;transform:translateY(-50%)}.woocommerce-search .woocommerce-search__inline-container{width:100%;padding:4px 2px 4px 36px;border:1px solid #ccd0d4;background-color:#fff;display:flex;align-items:center;position:relative}.woocommerce-search .woocommerce-search__inline-container.is-active{border-color:#00a0d2;box-shadow:inset 0 0 0 #00435d,0 0 1px 2px #bfe7f3}.woocommerce-search .woocommerce-search__inline-container.has-tags{padding-right:36px}.woocommerce-search .woocommerce-search__inline-container .woocommerce-search__token-list{max-width:100%;display:inline-block;padding:1px 0}.woocommerce-search .woocommerce-search__inline-input,.woocommerce-search .woocommerce-search__inline-input:focus{border:none;outline:none;box-shadow:none;padding:2px 0;line-height:20px;max-width:100%;min-width:70px;font-size:inherit;vertical-align:middle}.woocommerce-search .woocommerce-search__inline-input:focus[type=number]::-webkit-inner-spin-button,.woocommerce-search .woocommerce-search__inline-input:focus[type=number]::-webkit-outer-spin-button,.woocommerce-search .woocommerce-search__inline-input[type=number]::-webkit-inner-spin-button,.woocommerce-search .woocommerce-search__inline-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.woocommerce-search .woocommerce-search__input{width:100%;padding:8px 12px 8px 36px;border:1px solid #ccd0d4}.woocommerce-search .woocommerce-search__autocomplete-results{display:flex;flex-direction:column;align-items:stretch;border:1px solid #ccd0d4;position:absolute;left:0;right:0;z-index:10}.woocommerce-search .woocommerce-search__autocomplete-results:empty{display:none}.woocommerce-search .woocommerce-search__autocomplete-results.is-static-results{position:static}.woocommerce-search .woocommerce-search__autocomplete-result{margin-bottom:0;display:flex;flex-direction:row;flex-grow:1;flex-shrink:0;align-items:center;padding:12px;color:#95588a;text-align:left;background:#f8f9f9;border-bottom:1px solid #e2e4e7}.woocommerce-search .woocommerce-search__autocomplete-result:last-of-type{border-bottom:none}.woocommerce-search .woocommerce-search__autocomplete-result:hover{box-shadow:none;color:#95588a;background:#f3f4f5}.woocommerce-search .woocommerce-search__autocomplete-result.is-selected,.woocommerce-search .woocommerce-search__autocomplete-result:active,.woocommerce-search .woocommerce-search__autocomplete-result:focus{color:#95588a;background:#fff;box-shadow:inset 0 0 0 1px #f3f4f5,inset 0 0 0 2px #24292d}.woocommerce-search .woocommerce-search__autocomplete-result .woocommerce-search__result-thumbnail{margin-right:12px}.woocommerce-search__result-name{text-decoration:underline}.woocommerce-search__clear{position:absolute;right:10px;top:calc(50% - 10px)}.woocommerce-search__clear>.dashicon{color:#c9c9c9}.woocommerce-search-list{width:100%;padding:0 0 16px;text-align:left}.woocommerce-search-list__selected{margin:16px 0;padding:16px 0 0;min-height:76px;border-top:1px solid #e2e4e7}.woocommerce-search-list__selected .woocommerce-search-list__selected-header{margin-bottom:8px}.woocommerce-search-list__selected .woocommerce-search-list__selected-header button{margin-left:12px}.woocommerce-search-list__selected .woocommerce-tag__text{max-width:13em}.woocommerce-search-list__search{margin:16px 0;padding:16px 0 0;border-top:1px solid #e2e4e7}.woocommerce-search-list__search .components-base-control__field{margin-bottom:16px}.woocommerce-search-list__list{padding:0;max-height:17em;overflow-x:hidden;overflow-y:auto;border-top:1px solid #e2e4e7;border-bottom:1px solid #e2e4e7}.woocommerce-search-list__list.is-loading,.woocommerce-search-list__list.is-not-found{padding:12px 0;text-align:center;border:none}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon,.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-text{display:inline-block}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon{margin-right:16px}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon .gridicon{vertical-align:top;margin-top:-1px}.woocommerce-search-list__list .components-spinner{float:none;margin:0 auto}.woocommerce-search-list__list .components-menu-group__label{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;word-wrap:normal!important}.woocommerce-search-list__list>[role=menu]{border:1px solid #e2e4e7;border-bottom:none}.woocommerce-search-list__list .woocommerce-search-list__item{display:flex;align-items:center;margin-bottom:0;padding:12px 16px;background:#fff;border-bottom:1px solid #e2e4e7!important;color:#555d66}.woocommerce-search-list__list .woocommerce-search-list__item:active,.woocommerce-search-list__list .woocommerce-search-list__item:focus,.woocommerce-search-list__list .woocommerce-search-list__item:hover{background:#f8f9f9}.woocommerce-search-list__list .woocommerce-search-list__item:last-child{border-bottom:none!important}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-state{flex:0 0 16px;margin-right:8px;height:24px}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-label{display:flex;flex:1}.woocommerce-search-list__list .woocommerce-search-list__item.depth-0+.depth-1{margin-top:-1px}.woocommerce-search-list__list .woocommerce-search-list__item:not(.depth-0){border-bottom:0!important}.woocommerce-search-list__list .woocommerce-search-list__item:not(.depth-0)+.depth-0{border-top:1px solid #e2e4e7}.woocommerce-search-list__list .woocommerce-search-list__item[class*=depth-] .woocommerce-search-list__item-label:before{margin-right:4px;content:"— — — — — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-0 .woocommerce-search-list__item-label:before{margin-right:0;content:""}.woocommerce-search-list__list .woocommerce-search-list__item.depth-1 .woocommerce-search-list__item-label:before{content:"— "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-2 .woocommerce-search-list__item-label:before{content:"— — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-3 .woocommerce-search-list__item-label:before{content:"— — — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-4 .woocommerce-search-list__item-label:before{content:"— — — — "}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-name{display:inline-block}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-prefix{display:none;color:#6c7781}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-label,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-label{display:inline-block}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-prefix,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-prefix{display:inline}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-prefix:after,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-prefix:after{margin-right:4px;content:" ›"}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-name{color:#191e23}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-count{flex:0;padding:2px 8px;border:1px solid #e2e4e7;border-radius:12px;font-size:.8em;line-height:1.4;color:#6c7781;background:#fff;white-space:nowrap}.components-panel .woocommerce-search-list{padding:0}.components-panel .woocommerce-search-list__selected{margin:0 0 16px;padding:0;border-top:none;min-height:54px}.components-panel .woocommerce-search-list__search{margin:0 0 16px;padding:0;border-top:none}.woocommerce-section-header{padding:13px;border-bottom:none;display:flex;justify-content:space-between}@media (max-width:782px){.woocommerce-section-header{margin-left:-16px;margin-right:-16px;margin-bottom:12px;border-left:none;border-right:none;width:auto}}.woocommerce-section-header hr{-ms-grid-row-align:center;align-self:center;flex-grow:1;height:1px;margin:0 10px}@media (max-width:782px){.woocommerce-section-header.has-interval-select{position:relative;padding-bottom:30px}.woocommerce-section-header.has-interval-select .woocommerce-chart__interval-select{position:absolute;left:0;bottom:0;padding-left:6px}}.woocommerce-section-header__actions,.woocommerce-section-header__menu{text-align:right}.woocommerce-section-header__actions{display:flex;flex-grow:1;justify-content:flex-end;align-items:center}.woocommerce-section-header__actions .components-base-control{padding-top:0;min-height:34px}.woocommerce-section-header__actions .components-base-control__field{margin-bottom:0}.woocommerce-section-header__actions .components-base-control__field select{background:transparent}.woocommerce-ellipsis-menu__toggle{padding:0}.woocommerce-section-header__menu{display:flex;flex-direction:column;justify-content:center}.woocommerce-section-header__title{margin:0 16px 0 0;padding:3px 0;font-size:18px;font-size:1.125rem;line-height:2.2;font-weight:600}.woocommerce-segmented-selection{width:100%;color:#555d66}.woocommerce-segmented-selection__container{width:100%;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;display:-ms-grid;display:grid;border-top:1px solid #ccd0d4;border-bottom:1px solid #ccd0d4;background-color:#ccd0d4}.woocommerce-segmented-selection__item:nth-child(2n){border-left:1px solid #ccd0d4;border-top:1px solid #ccd0d4}.woocommerce-segmented-selection__item:nth-child(odd){border-top:1px solid #ccd0d4}.woocommerce-segmented-selection__item:nth-child(-n+2){border-top:0}.woocommerce-segmented-selection__label{background-color:#f8f9f9;padding:12px 12px 12px 36px;position:relative;display:block;height:100%}.woocommerce-segmented-selection__label:active{background-color:#f3f4f5}.woocommerce-segmented-selection__label:hover{background-color:#f3f4f5}.woocommerce-segmented-selection__input{opacity:0;position:absolute;left:-9999px}.woocommerce-segmented-selection__input:active+label .woocommerce-segmented-selection__label{background-color:#f3f4f5}.woocommerce-segmented-selection__input:checked+label .woocommerce-segmented-selection__label{background-color:#fff;font-weight:600}.woocommerce-segmented-selection__input:checked+label .woocommerce-segmented-selection__label:before{content:"";width:8px;height:8px;background-color:#95588a;position:absolute;top:50%;transform:translate(-20px,-50%)}.woocommerce-segmented-selection__input:focus+label .woocommerce-segmented-selection__label{box-shadow:inset 0 0 0 1px #24292d}.woocommerce-split-button{display:flex;align-items:center;padding:4px 0}.woocommerce-split-button .woocommerce-split-button__menu{padding:0}.woocommerce-split-button .woocommerce-split-button__main-action,.woocommerce-split-button .woocommerce-split-button__menu-toggle{line-height:26px;height:42px;border-radius:3px;white-space:nowrap;color:#555d66;border:1px solid #b5bcc2;background:#f3f4f5;box-shadow:inset 0 -1px 0 #b5bcc2;vertical-align:top}.woocommerce-split-button .woocommerce-split-button__main-action{padding:0 12px;border-top-right-radius:0;border-bottom-right-radius:0;border-right:0;height:32px}.woocommerce-split-button .woocommerce-split-button__menu-toggle{border-top-left-radius:0;border-bottom-left-radius:0;padding:4px;height:32px;width:32px}.woocommerce-split-button .woocommerce-split-button__menu-popover.is-mobile{top:46px}.woocommerce-split-button .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.woocommerce-split-button .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{background-color:#fafafa;border-color:#78848f;box-shadow:inset 0 -1px 0 #b5bcc2}.woocommerce-split-button .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus,.woocommerce-split-button .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus{background-color:#fafafa;border:1px solid #555d66;box-shadow:inset 0 -1px 0 #6c7781,0 0 0 2px #bfe7f3}.woocommerce-split-button .woocommerce-split-button__main-action.components-button .dashicon,.woocommerce-split-button .woocommerce-split-button__main-action.components-button .gridicon{width:18px;height:18px}.woocommerce-split-button.has-label .woocommerce-split-button__main-action.components-button .dashicon,.woocommerce-split-button.has-label .woocommerce-split-button__main-action.components-button .gridicon{margin-right:8px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper{width:100%;padding:4px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-button,.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-icon-button{color:#555d66;margin-top:4px;margin-bottom:4px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{background-color:#fff;color:#24292d;box-shadow:inset 0 0 0 1px #e2e4e7,inset 0 0 0 2px #fff,0 1px 1px rgba(25,30,35,.2)}.woocommerce-split-button .woocommerce-split-button__menu-item{width:100%;padding:4px;border-radius:0;outline:none;cursor:pointer}.woocommerce-split-button .woocommerce-split-button__menu-item .dashicon{margin-right:8px}.woocommerce-split-button .dashicons-arrow-down{fill:#555d66;height:20px;width:20px}.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover>svg,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active>svg{background:initial}.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover{border-color:#b5bcc2}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle{background:#95588a;color:#fff;border-color:#7c3f71;box-shadow:inset 0 -1px 0 #7c3f71}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{color:#fff;background-color:#7c3f71;border-color:#622557;box-shadow:inset 0 -1px 0 #622557}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus{color:#fff;background-color:#7c3f71;box-shadow:inset 0 -1px 0 #622557,0 0 0 2px #ffd7ff;border:1px solid #622557}.woocommerce-split-button.is-primary .dashicons-arrow-down{fill:#fff}.woocommerce-stepper{background:#fff;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);display:flex;justify-content:space-around;align-items:center;margin-bottom:24px;padding-left:16px;padding-right:16px;font-size:16px}.woocommerce-stepper .woocommerce-stepper__step{display:inline-flex;align-items:center;padding:12px;font-weight:400;color:#1a1a1a;height:48px}.woocommerce-stepper .woocommerce-stepper__step svg{display:none}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-spinner{display:block;margin-left:-8px;margin-right:4px}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-spinner__circle{stroke:#005fb7}.woocommerce-stepper .woocommerce-stepper__step.is-active .woocommerce-stepper__step-icon,.woocommerce-stepper .woocommerce-stepper__step.is-complete .woocommerce-stepper__step-icon{background:#005fb7;color:#fff}.woocommerce-stepper .woocommerce-stepper__step.is-active{font-weight:600}.woocommerce-stepper .woocommerce-stepper__step.is-active .woocommerce-stepper__step-label{margin:0}.woocommerce-stepper .woocommerce-stepper__step.is-complete .woocommerce-stepper__step-number{display:none}.woocommerce-stepper .woocommerce-stepper__step.is-complete svg{display:inline}.woocommerce-stepper .woocommerce-stepper__step-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;min-width:24px;margin-right:12px;background:#e1e2e2;color:#50575d;border-radius:50%}.woocommerce-stepper .woocommerce-stepper__step-divider{flex-grow:1;border-bottom:1px solid #e1e2e2}.woocommerce-stepper .woocommerce-stepper__step-divider:last-child{display:none}@media (max-width:782px){.woocommerce-stepper .woocommerce-stepper__step-label{display:none;padding-top:24px}.woocommerce-stepper .woocommerce-stepper__step-icon{margin-right:0}}.woocommerce-stepper.is-vertical{align-items:normal;flex-direction:column}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-divider{border-bottom:0;border-left:1px solid #e1e2e2;height:50px;margin-left:24px}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-label{display:initial}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-icon{margin-right:12px}@-webkit-keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(270deg)}}@keyframes rotate{0%{transform:rotate(0deg)}to{transform:rotate(270deg)}}@-webkit-keyframes growAndShrink{0%,to{stroke-dashoffset:200}50%{stroke-dashoffset:50;transform:rotate(135deg)}to{transform:rotate(450deg)}}@keyframes growAndShrink{0%,to{stroke-dashoffset:200}50%{stroke-dashoffset:50;transform:rotate(135deg)}to{transform:rotate(450deg)}}.woocommerce-spinner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:40px;min-width:40px;height:40px;max-height:40px}.woocommerce-spinner__circle{stroke-dasharray:200;stroke-dashoffset:0;transform-origin:center;-webkit-animation:growAndShrink 2s ease-in-out infinite;animation:growAndShrink 2s ease-in-out infinite;stroke:#1a1a1a}.woocommerce-summary{margin:16px 0;display:-ms-grid;display:grid;border-color:#ccd0d4;border-style:solid;border-width:1px 0 0 1px;background-color:#edeff0;box-shadow:inset -1px -1px 0 #ccd0d4}@media (max-width:782px){.woocommerce-summary{border-width:0}.woocommerce-summary.is-placeholder{border-top:0}.woocommerce-summary .woocommerce-summary__item-container.is-placeholder{border-top:1px solid #ccd0d4}}.woocommerce-summary .components-popover.components-popover{position:static!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;margin-top:0!important;margin-left:0}.woocommerce-summary .components-popover.components-popover .components-popover__header{display:none}.woocommerce-summary .components-popover.components-popover .components-popover__content{position:static;left:auto;right:auto;margin:0;width:100%;max-width:100%!important;max-height:100%!important;box-shadow:none;border:none;transform:none}.woocommerce-summary .components-popover.components-popover .components-popover__content .woocommerce-summary__item.is-selected{display:none}.components-popover__content .woocommerce-summary{max-height:100%;margin-top:0;margin-bottom:0;overflow-y:auto;border:none}.woocommerce-summary .woocommerce-summary__item-data{display:flex;flex-wrap:wrap}.woocommerce-summary .woocommerce-summary__item-delta,.woocommerce-summary .woocommerce-summary__item-value{flex:1 0 auto}.woocommerce-summary .woocommerce-summary__item-delta{flex:0 1 auto;display:flex;flex-wrap:none}.woocommerce-summary,.woocommerce-summary.has-1-items,.woocommerce-summary.has-one-item{-ms-grid-columns:1fr;grid-template-columns:1fr}.woocommerce-summary.has-2-items{-ms-grid-columns:(1fr)[2];grid-template-columns:repeat(2,1fr)}.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(2n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(odd):nth-last-of-type(-n+2) .woocommerce-summary__item,.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(odd):nth-last-of-type(-n+2)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-3-items{-ms-grid-columns:(1fr)[3];grid-template-columns:repeat(3,1fr)}.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-4-items,.woocommerce-summary.has-7-items,.woocommerce-summary.has-8-items{-ms-grid-columns:(1fr)[4];grid-template-columns:repeat(4,1fr)}.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-5-items{-ms-grid-columns:(1fr)[5];grid-template-columns:repeat(5,1fr)}.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-5-items .woocommerce-summary__item-delta,.woocommerce-summary.has-5-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-5-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-5-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-5-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}@media (min-width:1441px){.woocommerce-summary.has-6-items{-ms-grid-columns:(1fr)[6];grid-template-columns:repeat(6,1fr)}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n+1):nth-last-of-type(-n+6) .woocommerce-summary__item,.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n+1):nth-last-of-type(-n+6)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-delta,.woocommerce-summary.has-6-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-6-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-6-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-6-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-9-items,.woocommerce-summary.has-10-items{-ms-grid-columns:(1fr)[5];grid-template-columns:repeat(5,1fr)}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-9-items .woocommerce-summary__item-delta,.woocommerce-summary.has-9-items .woocommerce-summary__item-value,.woocommerce-summary.has-10-items .woocommerce-summary__item-delta,.woocommerce-summary.has-10-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-9-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-9-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-9-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}}@media (max-width:1440px){.woocommerce-summary.has-4-items .woocommerce-summary__item-delta,.woocommerce-summary.has-4-items .woocommerce-summary__item-value,.woocommerce-summary.has-7-items .woocommerce-summary__item-delta,.woocommerce-summary.has-7-items .woocommerce-summary__item-value,.woocommerce-summary.has-8-items .woocommerce-summary__item-delta,.woocommerce-summary.has-8-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-4-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-4-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-7-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-7-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-8-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-8-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-4-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-7-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-8-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-6-items,.woocommerce-summary.has-9-items{-ms-grid-columns:(1fr)[3];grid-template-columns:repeat(3,1fr)}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-10-items{-ms-grid-columns:(1fr)[4];grid-template-columns:repeat(4,1fr)}.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-10-items .woocommerce-summary__item-delta,.woocommerce-summary.has-10-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-10-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#e2e4e7}}@media (max-width:960px){.woocommerce-summary .woocommerce-summary__item{border-right-color:#ccd0d4}}@media (max-width:782px){.woocommerce-summary .woocommerce-summary__item-container{margin-left:-16px;margin-right:-16px;width:auto}.woocommerce-summary .woocommerce-summary__item-container .woocommerce-summary__item{border-right:none}.woocommerce-summary .components-popover.components-popover{margin-left:-16px;margin-right:-16px}.woocommerce-summary .components-popover.components-popover .woocommerce-summary__item-container{margin-left:0;margin-right:0}}.woocommerce-summary__item-container{margin-bottom:0}.woocommerce-summary__item-container:last-of-type .woocommerce-summary__item{border-bottom-color:#ccd0d4!important}.woocommerce-summary__item-container.is-dropdown-button{padding:0;list-style:none;border-right:1px solid #ccd0d4}.woocommerce-summary__item-container.is-dropdown-button .components-button{border-bottom:1px solid #ccd0d4;text-align:left;display:block}@media (max-width:782px){.woocommerce-summary__item-container.is-dropdown-button{border-right:none}}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-label{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;margin-top:2.2px;max-width:110px;width:70%}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-label:after{content:"\00a0"}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-data{justify-content:space-between}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;min-width:auto}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value:after{content:"\00a0"}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value{margin-top:2.2px;max-width:60px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value{margin-top:2.2px;width:50px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label{width:80px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value{width:40px}.woocommerce-summary__item{display:flex;flex-direction:column;height:100%;padding:16px;background-color:#f8f9f9;border-bottom:1px solid #e2e4e7;border-right:1px solid #e2e4e7;line-height:1.4em;text-decoration:none}.woocommerce-summary__item:hover{background-color:#f3f4f5}.woocommerce-summary__item:active{background-color:#edeff0}.woocommerce-summary__item:focus{box-shadow:inset -1px -1px 0 #6c7781,inset 1px 1px 0 #6c7781!important}.woocommerce-summary__item.is-selected:focus{box-shadow:inset -1px -1px 0 #6c7781,inset 1px 0 0 #6c7781,inset 0 4px 0 #95588a!important}.is-dropdown-button .woocommerce-summary__item{position:relative;width:100%;padding-right:56px}@media (max-width:782px){.is-dropdown-button .woocommerce-summary__item{border-right:none}}.woocommerce-summary__item .woocommerce-summary__item-data{margin-top:auto}.woocommerce-summary__item .woocommerce-summary__item-label{display:block;margin-bottom:16px;font-size:11px;font-size:.6875rem;text-transform:uppercase;color:#6c7781}.woocommerce-summary__item .woocommerce-summary__item-value{margin-bottom:4px;font-size:18px;font-size:1.125rem;font-weight:500;color:#191e23}.woocommerce-summary__item .woocommerce-summary__item-delta{margin-bottom:12px;font-size:18px;font-size:1.125rem;font-weight:300;color:#555d66}.woocommerce-summary__item.is-selected{background:#fff;box-shadow:inset 0 4px 0 #95588a}.woocommerce-summary__item.is-selected .woocommerce-summary__item-value{font-weight:600}.woocommerce-summary__item.is-selected .woocommerce-summary__item-delta{font-weight:400}.woocommerce-summary__item.is-good-trend .woocommerce-summary__item-delta{color:#4ab866}.woocommerce-summary__item.is-bad-trend .woocommerce-summary__item-delta{color:#d94f4f}.woocommerce-summary__item .woocommerce-summary__item-delta-icon{vertical-align:middle;margin-right:3px;fill:currentColor}.woocommerce-summary__item .woocommerce-summary__item-delta-icon.gridicons-arrow-up{transform:rotate(45deg)}.woocommerce-summary__item .woocommerce-summary__item-delta-icon.gridicons-arrow-down{transform:rotate(-45deg)}.woocommerce-summary__item .woocommerce-summary__item-prev-label,.woocommerce-summary__item .woocommerce-summary__item-prev-value{font-size:13px;font-size:.8125rem;color:#555d66;display:inline-block}.woocommerce-summary__item .woocommerce-summary__toggle{position:absolute;top:44px;right:16px;transition:transform .2s ease}@media screen and (prefers-reduced-motion:reduce){.woocommerce-summary__item .woocommerce-summary__toggle{transition:none}}.is-dropdown-expanded .woocommerce-summary__item .woocommerce-summary__toggle{transform:rotate(-180deg)}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-label{margin-bottom:0}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-delta,.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-value{font-size:13px;font-size:.8125rem;margin-bottom:0}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-prev-label,.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-prev-value{font-size:11px;font-size:.6875rem}.woocommerce-table .woocommerce-card__body{padding:0;position:relative}.woocommerce-table .woocommerce-search{flex-grow:1}.woocommerce-table .woocommerce-card__action{justify-self:flex-end;margin:-13px 0}.woocommerce-table .woocommerce-card__menu{justify-self:flex-end}.woocommerce-table.has-compare .woocommerce-card__action,.woocommerce-table.has-search .woocommerce-card__action{align-items:center;text-align:left;display:-ms-grid;display:grid;width:100%;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}@media (max-width:960px){.woocommerce-table.has-compare .woocommerce-card__action,.woocommerce-table.has-search .woocommerce-card__action{-ms-grid-row:1;-ms-grid-row-span:2;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:1/1/3/4;grid-gap:12px;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px;margin:0}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-table__compare,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-table__compare{display:flex;-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:1;-ms-grid-column-span:1;grid-area:2/1/3/2}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-search{-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:2/2/3/4;margin-right:0}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row:1;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:1;grid-area:1/2/2/3;-ms-grid-column-align:end;justify-self:end;margin:-6px 0}}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action{-ms-grid-columns:1fr auto;grid-template-columns:1fr auto}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search{-ms-grid-row-align:center;align-self:center;-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row-align:center;align-self:center;-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3}@media (max-width:960px){.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action{-ms-grid-row:1;-ms-grid-row-span:2;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:1/1/3/4;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search{-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:2/1/3/4;margin-left:0}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row:1;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:1;grid-area:1/2/2/3}}.woocommerce-table.has-compare .woocommerce-search,.woocommerce-table.has-search .woocommerce-search{margin:0 16px}.woocommerce-table.has-compare .woocommerce-compare-button,.woocommerce-table.has-search .woocommerce-compare-button{padding:3px 12px;height:auto}.woocommerce-table.is-empty{align-items:center;background:#f8f9f9;color:#555d66;display:flex;height:calc(17px + 1.1375rem + 165px + 5.6875rem);height:calc(17px + 1.1375rem + (33px + 1.1375rem)*var(--number-of-rows));justify-content:center;padding:16px;text-align:center}.woocommerce-table button.woocommerce-table__download-button.is-link{padding:6px 12px;color:#000;text-decoration:none}.woocommerce-table button.woocommerce-table__download-button.is-link svg{margin-right:8px;height:24px;width:24px}@media (max-width:782px){.woocommerce-table button.woocommerce-table__download-button.is-link svg{margin-right:0}.woocommerce-table button.woocommerce-table__download-button.is-link .woocommerce-table__download-button__label{display:none}}.woocommerce-table .woocommerce-pagination{padding-top:16px;padding-bottom:16px;z-index:1;background:#fff;position:relative}.woocommerce-table__caption{font-size:24px;font-size:1.5rem;text-align:left}.woocommerce-table__table{overflow-x:auto}.woocommerce-table__table:after{content:"";position:absolute;right:0;top:0;width:41px;height:100%;background:linear-gradient(90deg,transparent,rgba(0,0,0,.2));opacity:0;pointer-events:none;transition:opacity .3s}.woocommerce-table__table.is-scrollable:after{opacity:1}.woocommerce-table__table table{border-collapse:collapse;width:100%}.woocommerce-table__table tr:focus-within,.woocommerce-table__table tr:hover{background-color:#f3f4f5}.woocommerce-table__table tr:focus-within td,.woocommerce-table__table tr:focus-within th,.woocommerce-table__table tr:hover td,.woocommerce-table__table tr:hover th{background:transparent}.woocommerce-table__header,.woocommerce-table__item{font-size:13px;font-size:.8125rem;padding:16px 24px;border-bottom:1px solid #e2e4e7;text-align:left}.woocommerce-table__header>a:only-child,.woocommerce-table__item>a:only-child{display:block}.woocommerce-table__header a:focus,.woocommerce-table__header a:hover,.woocommerce-table__item a:focus,.woocommerce-table__item a:hover{color:#622557}.woocommerce-table__header .is-placeholder,.woocommerce-table__item .is-placeholder{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;max-width:120px;width:80%}.woocommerce-table__header .is-placeholder:after,.woocommerce-table__item .is-placeholder:after{content:"\00a0"}.woocommerce-table__header:not(.is-left-aligned),.woocommerce-table__item:not(.is-left-aligned){text-align:right}.woocommerce-table__header:not(.is-left-aligned) button,.woocommerce-table__item:not(.is-left-aligned) button{justify-content:flex-end}.woocommerce-table__header.is-numeric .is-placeholder,.woocommerce-table__item.is-numeric .is-placeholder{max-width:40px}.woocommerce-table__header .is-negative,.woocommerce-table__item .is-negative{color:#d94f4f;font-weight:700}.woocommerce-table__header.is-sorted,.woocommerce-table__item.is-sorted{background-color:#f8f9f9}.woocommerce-table__header.is-checkbox-column,.woocommerce-table__item.is-checkbox-column{width:33px;max-width:33px;padding-right:0;padding-left:16px}.woocommerce-table__header.is-checkbox-column+th,.woocommerce-table__item.is-checkbox-column+th{border-left:0}th.woocommerce-table__item{font-weight:400}.woocommerce-table__header{padding:8px 24px;background-color:#f8f9fa;border-bottom:1px solid #ccd0d4;font-weight:700;white-space:nowrap}.woocommerce-table__header+.woocommerce-table__header{border-left:1px solid #ccd0d4}.woocommerce-table__header.is-left-aligned.is-sortable{padding-left:16px}.woocommerce-table__header.is-left-aligned.is-sortable svg{display:inline-flex;order:1;margin-left:0}.woocommerce-table__header .components-button.is-button{height:auto;width:100%;padding:8px 24px 8px 0;vertical-align:middle;line-height:1;border:none;background:transparent;box-shadow:none!important}.woocommerce-table__header .components-button.is-button:hover{box-shadow:none!important}.woocommerce-table__header .components-button.is-button:active{box-shadow:none!important}.woocommerce-table__header.is-sortable{padding:0}.woocommerce-table__header.is-sortable .gridicon{visibility:hidden;margin-left:4px}.woocommerce-table__header.is-sortable .components-button:focus .gridicon,.woocommerce-table__header.is-sortable .components-button:hover .gridicon,.woocommerce-table__header.is-sortable.is-sorted .components-button .gridicon{visibility:visible}.woocommerce-table__summary{margin:0;padding:16px 0;text-align:center;z-index:1;background:#fff;position:relative}.woocommerce-table__summary-item{display:inline-block;margin-bottom:0;margin-left:8px;margin-right:8px}.woocommerce-table__summary-item .woocommerce-table__summary-label,.woocommerce-table__summary-item .woocommerce-table__summary-value{display:inline-block}.woocommerce-table__summary-item .woocommerce-table__summary-label{margin-left:4px}.woocommerce-table__summary-item .woocommerce-table__summary-value{font-weight:600}.woocommerce-tag{display:inline-flex;margin:1px 4px 1px 0;overflow:hidden;vertical-align:middle}.woocommerce-tag .woocommerce-tag__remove.components-icon-button,.woocommerce-tag .woocommerce-tag__text{display:inline-block;line-height:24px;background:#e2e4e7;transition:all .2s cubic-bezier(.4,1,.4,1)}.woocommerce-tag .woocommerce-tag__text{-ms-grid-row-align:center;align-self:center;padding:0 8px;border-radius:12px;color:#555d66;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.woocommerce-tag.has-remove .woocommerce-tag__text{padding:0 4px 0 8px;border-radius:12px 0 0 12px}.woocommerce-tag .woocommerce-tag__remove.components-icon-button{cursor:pointer;padding:0 2px;border-radius:0 12px 12px 0;color:#555d66;line-height:10px;text-indent:0}.woocommerce-tag .woocommerce-tag__remove.components-icon-button:hover{color:#32373c}.text-control-with-affixes{display:inline-flex;flex-direction:row;width:100%}.text-control-with-affixes input[type=email],.text-control-with-affixes input[type=number],.text-control-with-affixes input[type=password],.text-control-with-affixes input[type=text],.text-control-with-affixes input[type=url]{flex-grow:1;margin:0}.text-control-with-affixes input[type=email]:disabled,.text-control-with-affixes input[type=number]:disabled,.text-control-with-affixes input[type=password]:disabled,.text-control-with-affixes input[type=text]:disabled,.text-control-with-affixes input[type=url]:disabled{border-right-width:0}.text-control-with-affixes input[type=email]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=number]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=password]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=text]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=url]:disabled+.text-control-with-affixes__suffix{border-left:1px solid #e2e4e7}.text-control-with-affixes__prefix,.text-control-with-affixes__suffix{position:relative;background:#fff;border:1px solid #e2e4e7;color:#555d66;padding:7px 14px;white-space:nowrap;flex:1 0 auto;font-size:14px;line-height:1.5}.text-control-with-affixes__prefix{border-right:none}.text-control-with-affixes__prefix+input[type=email]:disabled,.text-control-with-affixes__prefix+input[type=number]:disabled,.text-control-with-affixes__prefix+input[type=password]:disabled,.text-control-with-affixes__prefix+input[type=text]:disabled,.text-control-with-affixes__prefix+input[type=url]:disabled{border-left-color:#e2e4e7;border-right-width:1px}.text-control-with-affixes__suffix{border-left:none}.woocommerce-view-more-list{padding-left:4px;margin:0 0 0 4px;vertical-align:middle}.woocommerce-view-more-list__popover{margin:0;padding:16px;text-align:left}.woocommerce-view-more-list__popover__item{display:block;margin:16px 0}.woocommerce-view-more-list__popover__item:first-child{margin-top:0}.woocommerce-view-more-list__popover__item:last-child{margin-bottom:0}
|
2 |
-
.editor-block-preview__content{overflow:hidden}.components-placeholder__label .gridicon,.components-placeholder__label .material-icon{margin-right:1ch;fill:currentColor}.editor-styles-wrapper .wc-block-grid .wc-block-grid__products{list-style:none;margin:0}.editor-styles-wrapper .wc-block-grid .wc-block-grid__products .wp-block-button__link{color:inherit}.editor-styles-wrapper .wc-block-grid.components-placeholder{padding:2em 1em}.editor-styles-wrapper .wc-block-grid.is-loading,.editor-styles-wrapper .wc-block-grid.is-not-found{display:block}
|
3 |
-
.wc-block-handpicked-products__selection{width:100%}
|
4 |
-
.wc-block-products-category__selection{width:100%}.wc-block-products-category__cancel-button.is-tertiary{margin:1em auto 0;display:block;text-align:center;font-size:1em}
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
.wc-block-
|
10 |
-
|
11 |
-
.wc-block-featured-
|
12 |
-
.woocommerce-search-product__item .woocommerce-search-list__item-name .description{display:block}.woocommerce-search-product__item.is-searching .woocommerce-search-list__item-prefix:after,.woocommerce-search-product__item.is-skip-level .woocommerce-search-list__item-prefix:after{content:":"}.woocommerce-search-product__item.is-not-active:active,.woocommerce-search-product__item.is-not-active:focus,.woocommerce-search-product__item.is-not-active:hover{background:#fff}.woocommerce-search-product__item.is-loading{justify-content:center}.woocommerce-search-product__item.is-loading .components-spinner{margin-bottom:12px}.woocommerce-search-product__item.depth-0.is-variable:after{margin-left:8px;content:"";height:24px;width:24px;background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" fill="{$core-grey-dark-300}" /></svg>');background-repeat:no-repeat;background-position:100%;background-size:contain}.woocommerce-search-product__item.depth-0.is-variable[aria-expanded=true]:after{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" fill="{$core-grey-dark-300}" /></svg>')}
|
13 |
-
.wc-block-product-tag__selection{width:100%}.wc-block-product-tag__cancel-button.is-tertiary{margin:1em auto 0;display:block;text-align:center;font-size:1em}
|
14 |
-
.woocommerce-product-tags__operator .components-base-control__help{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;word-wrap:normal!important}.components-panel .woocommerce-product-tags__operator.components-base-control{margin-top:16px}.components-panel .woocommerce-product-tags__operator.components-base-control .components-select-control__input{margin-left:0;min-width:100%}
|
1 |
+
@charset "UTF-8";@-webkit-keyframes slide-in-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-left{0%{-webkit-transform:translateX(100%);transform:translateX(100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slide-out-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(-200%);transform:translateX(-200%)}}@keyframes slide-out-left{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(-200%);transform:translateX(-200%)}}@-webkit-keyframes slide-in-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-in-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@-webkit-keyframes slide-out-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}@keyframes slide-out-right{0%{-webkit-transform:translateX(-100%);transform:translateX(-100%)}to{-webkit-transform:translateX(0);transform:translateX(0)}}.woocommerce-slide-animation>div{width:100%;white-space:nowrap;overflow:hidden;display:-webkit-box;display:flex}.woocommerce-slide-animation.animate-left .slide-enter-active{-webkit-animation:slide-in-left;animation:slide-in-left;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-left .slide-exit-active{-webkit-animation:slide-out-left;animation:slide-out-left;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-right .slide-enter-active{-webkit-animation:slide-in-right;animation:slide-in-right;-webkit-animation-duration:.2s;animation-duration:.2s}.woocommerce-slide-animation.animate-right .slide-exit-active{-webkit-animation:slide-out-right;animation:slide-out-right;-webkit-animation-duration:.2s;animation-duration:.2s}@media screen and (prefers-reduced-motion:reduce){.woocommerce-slide-animation .slide-enter-active,.woocommerce-slide-animation .slide-exit-active{-webkit-animation:none!important;animation:none!important}}.woocommerce-calendar{width:100%;background-color:#f8f9f9;border-top:1px solid #ccd0d4;height:396px}.woocommerce-calendar.is-mobile{height:100%}.woocommerce-calendar__react-dates{width:100%;overflow-x:hidden}.woocommerce-calendar__react-dates .DayPicker{margin:0 auto}.woocommerce-calendar__react-dates .CalendarMonth_table{margin-top:10px}.woocommerce-calendar__react-dates .CalendarDay__selected_span{background:#95588a;border:1px solid #ccd0d4}.woocommerce-calendar__react-dates .CalendarDay__selected{background:#622557;border:1px solid #ccd0d4}.woocommerce-calendar__react-dates .CalendarDay__hovered_span{background:#95588a;border:1px solid #e2e4e7;color:#fff}.woocommerce-calendar__react-dates .CalendarDay__blocked_out_of_range{color:#a2aab2}.woocommerce-calendar__react-dates .CalendarMonth,.woocommerce-calendar__react-dates .CalendarMonthGrid,.woocommerce-calendar__react-dates .DayPicker,.woocommerce-calendar__react-dates .DayPicker_transitionContainer{background-color:#f8f9f9}.woocommerce-calendar__react-dates .DayPicker_weekHeader_li{color:#606a73}.woocommerce-calendar__react-dates .DayPickerNavigation_button:focus{outline:2px solid #bfe7f3}.woocommerce-calendar__react-dates.is-core-datepicker .components-datetime__date{padding-left:0}.woocommerce-calendar__react-dates.is-core-datepicker .CalendarDay__default{background-color:transparent}.woocommerce-calendar__react-dates.is-core-datepicker .CalendarDay__selected{background:#622557;border:none}.woocommerce-calendar__inputs{padding:1em;width:100%;max-width:500px;display:-ms-grid;display:grid;-ms-grid-columns:43% 14% 43%;grid-template-columns:43% 14% 43%;margin:0 auto}.woocommerce-calendar__inputs .components-base-control{margin:0}.woocommerce-calendar__inputs-to{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;-ms-grid-column:2;grid-column-start:2}.woocommerce-calendar__input{position:relative}.woocommerce-calendar__input .dashicons-calendar{position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);left:10px}.woocommerce-calendar__input .dashicons-calendar path{fill:#6c7781}.woocommerce-calendar__input:first-child{-ms-grid-column:1;grid-column-start:1}.woocommerce-calendar__input:last-child{-ms-grid-column:3;grid-column-start:3}.woocommerce-calendar__input.is-empty .dashicons-calendar path{fill:#6c7781}.woocommerce-calendar__input.is-error .dashicons-calendar path{fill:#d94f4f}.woocommerce-calendar__input.is-error .woocommerce-calendar__input-text{border:1px solid #d94f4f;box-shadow:inset 0 0 8px #d94f4f}.woocommerce-calendar__input.is-error .woocommerce-calendar__input-text:focus{box-shadow:inset 0 0 8px #d94f4f,0 0 6px rgba(30,140,190,.8)}.woocommerce-calendar__input .woocommerce-calendar__input-text{color:#555d66;border-radius:3px;padding:10px 10px 10px 30px;width:100%;font-size:13px;font-size:.8125rem}.woocommerce-calendar__input .woocommerce-calendar__input-text:-ms-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-ms-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-webkit-input-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::-moz-placeholder{color:#6c7781}.woocommerce-calendar__input .woocommerce-calendar__input-text::placeholder{color:#6c7781}.woocommerce-filters-date__content.is-mobile .woocommerce-calendar__input-error .components-popover__content{height:auto}.woocommerce-calendar__input-error{display:none}.is-error .woocommerce-calendar__input-text:focus+span .woocommerce-calendar__input-error{display:block;left:50%!important;position:absolute;top:auto!important}.woocommerce-calendar__input-error .components-popover__content{background-color:#606a73;color:#fff;padding:.5em;border:none}.woocommerce-calendar__input-error.components-popover .components-popover__content{min-width:100px;width:100px;text-align:center}.woocommerce-calendar__input-error.components-popover:not(.no-arrow):not(.is-mobile).is-bottom:before{border-bottom-color:#606a73;z-index:1;top:-6px}.woocommerce-calendar__input-error.components-popover:not(.no-arrow):not(.is-mobile).is-top:after{border-top-color:#606a73;z-index:1;top:0}.woocommerce-calendar__date-picker-title{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#6c7781;width:100%;margin:0;padding:1em;background-color:#fff}.woocommerce-card{margin-bottom:24px;background:#fff;border-radius:3px;box-shadow:0 2px 1px -1px rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 1px 3px 0 rgba(0,0,0,.12);-webkit-transition:box-shadow .2s cubic-bezier(.4,1,.4,1);transition:box-shadow .2s cubic-bezier(.4,1,.4,1)}@media (max-width:782px){.woocommerce-card{margin-bottom:12px;width:auto}}.woocommerce-card.is-inactive{background-color:#f6f6f6;box-shadow:none}.woocommerce-card__header{padding:16px;display:-ms-grid;display:grid;-webkit-box-align:center;align-items:center;border-top-left-radius:3px;border-top-left-radius:4px}.has-action .woocommerce-card__header{-ms-grid-columns:auto 1fr;grid-template-columns:auto 1fr}.has-menu .woocommerce-card__header{-ms-grid-columns:auto 24px;grid-template-columns:auto 24px}.has-menu.has-action .woocommerce-card__header{grid-gap:12px;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px}.woocommerce-card__header-item{-ms-grid-row-align:center}.woocommerce-card__header-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__header-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__header-item:nth-child(3){-ms-grid-column:3;grid-column-start:3;-ms-grid-column-span:1;grid-column-end:4;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-card__action,.woocommerce-card__menu{text-align:right}.woocommerce-card__body{padding:16px}.woocommerce-card__title{margin:0;font-size:24px;font-size:1.5rem;line-height:1.2;font-weight:400}.woocommerce-card__description{font-size:16px;font-size:1rem;line-height:1.5;color:#636d75;margin-top:12px;margin-bottom:0;font-weight:400}.woocommerce-chart{margin-top:-16px;margin-bottom:24px;background:#fff;border:1px solid #ccd0d4;border-top:0}@media (max-width:782px){.woocommerce-chart{margin-left:-16px;margin-right:-16px;margin-bottom:12px;border-left:none;border-right:none;width:auto}}.woocommerce-chart .woocommerce-chart__header{min-height:50px;border-bottom:1px solid #ccd0d4;display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-flow:row wrap;-webkit-box-pack:justify;justify-content:space-between;-webkit-box-align:center;align-items:center;width:100%}.woocommerce-chart .woocommerce-chart__header .woocommerce-chart__title{height:18px;color:#24292d;font-size:15px;font-weight:600;line-height:18px;margin-left:16px;margin-right:16px}.woocommerce-chart .woocommerce-chart__body{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-pack:start;justify-content:flex-start;-webkit-box-align:start;align-items:flex-start;width:100%}.woocommerce-chart .woocommerce-chart__body.woocommerce-chart__body-column{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.woocommerce-chart .woocommerce-chart__footer{width:100%}.woocommerce-chart-placeholder{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;padding:0;width:100%;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center}.woocommerce-chart-placeholder:after{content:"\00a0"}@media screen and (prefers-reduced-motion:reduce){.woocommerce-chart-placeholder{-webkit-animation:none;animation:none}}.woocommerce-chart-placeholder .components-spinner{margin:0}.woocommerce-chart__interval-select{-webkit-box-align:start;align-items:start;border-right:1px solid #ccd0d4;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center;margin:0 0 0 auto;min-height:50px;padding:8px 16px 0}@media (max-width:960px){.woocommerce-chart__interval-select{width:100%;-webkit-box-ordinal-group:2;order:1;margin-top:-8px;margin-left:0;padding-left:8px;border-right:0;min-height:0}}#wpbody .woocommerce-chart__interval-select .components-select-control__input{font-size:13px;font-size:.8125rem;border:0;box-shadow:none}#wpbody .woocommerce-chart__interval-select .components-select-control__input:not(:disabled):not([aria-disabled=true]):focus{background-color:#fff;color:#191e23;box-shadow:inset 0 0 0 1px #6c7781,inset 0 0 0 2px #fff;outline:2px solid transparent;outline-offset:-2px}.woocommerce-chart__types{padding:0 8px;white-space:nowrap}.woocommerce-chart__type-button{background:transparent!important}.woocommerce-chart__type-button.components-icon-button{color:#ccd0d4}.woocommerce-chart__type-button.components-icon-button.woocommerce-chart__type-button-selected{color:#555d66}.woocommerce-chart__type-button.components-icon-button:hover{box-shadow:none!important}@media (max-width:960px){.woocommerce-summary+.woocommerce-chart .woocommerce-chart__title{display:none}.woocommerce-summary+.woocommerce-chart .woocommerce-chart__interval-select{width:auto;-webkit-box-ordinal-group:1;order:0;margin-top:0}}.woocommerce-legend.has-total{padding-bottom:50px;position:relative}.woocommerce-legend.woocommerce-legend__direction-column{border-right:1px solid #ccd0d4;min-width:320px}.woocommerce-chart__footer .woocommerce-legend.woocommerce-legend__direction-column{border-right:none}.woocommerce-legend__list{color:#24292d;display:-webkit-box;display:flex;height:100%;margin:0}.woocommerce-legend__direction-column .woocommerce-legend__list{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;height:300px;overflow:auto}.woocommerce-chart__footer .woocommerce-legend__direction-column .woocommerce-legend__list{border-top:1px solid #ccd0d4;height:100%;max-height:none;min-height:none}.has-total.woocommerce-legend__direction-column .woocommerce-legend__list{height:250px}.woocommerce-chart__footer .has-total.woocommerce-legend__direction-column .woocommerce-legend__list{height:auto;max-height:220px;min-height:none}.woocommerce-legend__direction-row .woocommerce-legend__list{-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}.woocommerce-legend__item>button{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;background-color:#fff;color:#555d66;cursor:pointer;display:-webkit-inline-box;display:inline-flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;flex-wrap:nowrap;-webkit-box-pack:justify;justify-content:space-between;width:100%;border:none;padding:0}.woocommerce-legend__item>button .woocommerce-legend__item-container{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;flex-wrap:nowrap;position:relative;padding:3px 0 3px 24px;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.woocommerce-legend__item>button .woocommerce-legend__item-container:hover input~.woocommerce-legend__item-checkmark{background-color:#f3f4f5}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{border:1px solid #a2aab2;position:absolute;top:4px;left:0;height:16px;width:16px;background-color:#fff}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark:after{content:"";position:absolute;display:none}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark.woocommerce-legend__item-checkmark-checked{background-color:currentColor;border-color:currentColor}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark.woocommerce-legend__item-checkmark-checked:after{display:block;left:5px;top:2px;width:3px;height:6px;border:solid #fff;border-width:0 2px 2px 0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-total{margin-left:auto;font-weight:700}.woocommerce-legend__item>button:focus{outline:none}.woocommerce-legend__item>button:focus .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{outline:2px solid #a2aab2}.woocommerce-legend__item>button:hover{background-color:#f8f9f9}.woocommerce-legend__direction-column .woocommerce-legend__item{margin:0;padding:0}.woocommerce-legend__direction-column .woocommerce-legend__item>button{min-height:36px;padding:0 17px;text-align:left}.woocommerce-legend__direction-column .woocommerce-legend__item:first-child{margin-top:12px}.woocommerce-legend__direction-column .woocommerce-legend__item:last-child:after{content:"";display:block;height:12px;width:100%}.woocommerce-legend__direction-row .woocommerce-legend__item{padding:0;margin:0}.woocommerce-legend__direction-row .woocommerce-legend__item>button{padding:0 17px}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container{height:50px;-webkit-box-align:center;align-items:center}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-checkmark{top:17px}.woocommerce-legend__direction-row .woocommerce-legend__item>button .woocommerce-legend__item-container .woocommerce-legend__item-title{margin-right:17px}.woocommerce-legend__total{-webkit-box-align:center;align-items:center;background:#fff;border-top:1px solid #ccd0d4;bottom:0;color:#555d66;display:-webkit-box;display:flex;height:50px;-webkit-box-pack:center;justify-content:center;left:0;position:absolute;right:0;text-transform:uppercase}.woocommerce-legend__total:before{background:-webkit-gradient(linear,left top,left bottom,from(transparent),to(rgba(0,0,0,.2)));background:linear-gradient(180deg,transparent,rgba(0,0,0,.2));bottom:100%;content:"";height:20px;left:0;opacity:0;pointer-events:none;position:absolute;right:0;-webkit-transition:opacity .3s;transition:opacity .3s}.is-scrollable .woocommerce-legend__total:before{opacity:1}.woocommerce-chart__body-row .d3-chart__container{width:calc(100% - 320px)}.d3-chart__container{position:relative;width:100%}.d3-chart__container svg{overflow:visible}.d3-chart__container .d3-chart__empty-message{-webkit-box-align:center;align-items:center;bottom:0;color:#6c7781;display:-webkit-box;display:flex;font-size:18px;font-size:1.125rem;font-weight:700;-webkit-box-pack:center;justify-content:center;left:0;line-height:1.5;margin:0 auto;max-width:50%;padding-bottom:48px;pointer-events:none;position:absolute;right:0;top:0;text-align:center}@media (max-width:782px){.d3-chart__container .d3-chart__empty-message{font-size:13px;font-size:.8125rem}}.d3-chart__container .d3-chart__tooltip{border:1px solid #ccd0d4;position:absolute;display:-webkit-box;display:flex;min-width:324px;height:auto;background-color:#fff;text-align:left;padding:17px;box-shadow:0 3px 20px 0 rgba(18,24,30,.1),0 1px 3px 0 rgba(18,24,30,.1);-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;flex-wrap:nowrap;-webkit-box-pack:start;justify-content:flex-start;pointer-events:none;visibility:hidden;z-index:1}@media (max-width:600px){.d3-chart__container .d3-chart__tooltip{min-width:auto;width:calc(100% - 48px)}}.d3-chart__container .d3-chart__tooltip h4{text-align:left;line-height:18px;width:100%;text-transform:uppercase;font-size:11px;color:#6c7781;margin-top:0}.d3-chart__container .d3-chart__tooltip ul{list-style:none;margin-bottom:2px;margin-top:2px;font-size:14px}.d3-chart__container .d3-chart__tooltip ul li{flex-wrap:nowrap;-webkit-box-pack:start;justify-content:flex-start;-webkit-box-align:center;align-items:center}.d3-chart__container .d3-chart__tooltip ul li,.d3-chart__container .d3-chart__tooltip ul li.key-row{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}.d3-chart__container .d3-chart__tooltip ul li.key-row{-webkit-box-pack:justify;justify-content:space-between;width:100%}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container{width:100%;min-width:100px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container .key-color{display:inline-block;width:16px;height:16px;margin-right:8px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-container .key-key{margin-right:6px}.d3-chart__container .d3-chart__tooltip ul li.key-row .key-value{font-weight:600}.d3-chart__container .bargrouprect{shape-rendering:crispEdges}.d3-chart__container .grid .tick line{stroke:#e2e4e7;stroke-width:1;shape-rendering:crispEdges}.d3-chart__container .grid .tick:first-child line{stroke:#555d66}.d3-chart__container .grid.with-positive-ticks .tick:last-child line{opacity:0}.d3-chart__container .tick{padding-top:10px;stroke-width:1}.d3-chart__container .y-axis{text-anchor:start}.d3-chart__container .y-axis.ticktext{fill:#555d66}.d3-chart__container .axis-month .tick text,.d3-chart__container .y-axis .tick text{font-size:10px}.d3-chart__container .focus-grid line{stroke:rgba(0,0,0,.1);stroke-width:1px}.d3-chart__container .barfocus{fill:rgba(0,0,0,.1)}.d3-base{background:transparent;overflow-x:auto;overflow-y:hidden;position:relative;width:100%;height:100%}.woocommerce-count{border:1px solid;border-radius:10px;padding:0 8px;font-weight:700}.woocommerce-page .woocommerce-dropdown-button{background-color:#fff;position:relative;border:1px solid #e2e4e7;color:#555d66;border-radius:4px;padding:0 40px 0 0;width:100%}.woocommerce-page .woocommerce-dropdown-button:after{content:"";position:absolute;right:14px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:0;height:0;border-color:#555d66 transparent transparent;border-style:solid;border-width:6px 6px 0;-webkit-transition:-webkit-transform .2s ease;transition:-webkit-transform .2s ease;transition:transform .2s ease;transition:transform .2s ease,-webkit-transform .2s ease}@media screen and (prefers-reduced-motion:reduce){.woocommerce-page .woocommerce-dropdown-button:after{-webkit-transition:none;transition:none}}.woocommerce-page .woocommerce-dropdown-button.is-open:after{-webkit-transform:translateY(-50%) rotate(180deg);transform:translateY(-50%) rotate(180deg)}.woocommerce-page .woocommerce-dropdown-button.is-open,.woocommerce-page .woocommerce-dropdown-button:active,.woocommerce-page .woocommerce-dropdown-button:hover{background-color:#f8f9f9}.woocommerce-page .woocommerce-dropdown-button.is-multi-line .woocommerce-dropdown-button__labels{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.woocommerce-dropdown-button__labels{text-align:left;padding:8px 12px;min-height:48px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;width:100%;justify-content:space-around}@media (max-width:400px){.woocommerce-dropdown-button__labels{min-height:46px}}.woocommerce-dropdown-button__labels span{width:100%;text-align:left}.woocommerce-dropdown-button__labels span:last-child{font-size:12px;font-size:.75rem;margin:0}.woocommerce-dropdown-button__labels span:first-child{font-size:13px;font-size:.8125rem;font-weight:600}@media (max-width:400px){.woocommerce-dropdown-button__labels span:last-child{font-size:10px;font-size:.625rem}.woocommerce-dropdown-button__labels span:first-child{font-size:12px;font-size:.75rem}}.woocommerce-ellipsis-menu{text-align:center}.woocommerce-ellipsis-menu__toggle{height:24px;-webkit-box-pack:center;justify-content:center;vertical-align:middle;width:24px}.woocommerce-ellipsis-menu__toggle .dashicon{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.woocommerce-ellipsis-menu__popover{text-align:left}.woocommerce-ellipsis-menu__popover:not(.is-mobile):after,.woocommerce-ellipsis-menu__popover:not(.is-mobile):before{margin-left:-16px}.woocommerce-ellipsis-menu__popover .components-popover__content{width:182px;padding:2px}.woocommerce-ellipsis-menu__popover .components-form-toggle.is-checked .components-form-toggle__track{background-color:#95588a}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__content{width:100%}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item,.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__title{padding:4px 12px}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item{cursor:pointer;color:#6c7781}.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__item:focus{box-shadow:inset 0 0 0 1px #6c7781,inset 0 0 0 2px #fff;outline:2px solid transparent;outline-offset:-2px}.woocommerce-ellipsis-menu__popover .components-base-control__label,.woocommerce-ellipsis-menu__popover .woocommerce-ellipsis-menu__title{color:#23282d;padding-top:8px;padding-bottom:8px;font-size:15px;font-size:.9375rem;margin-bottom:4px}.woocommerce-ellipsis-menu__popover .components-toggle-control .components-base-control__field{margin:4px 0}.woocommerce-ellipsis-menu__popover .components-base-control{margin:0}.woocommerce-empty-content{margin-bottom:16px;text-align:center}.woocommerce-empty-content .woocommerce-empty-content__illustration{max-width:100%}.woocommerce-empty-content .woocommerce-empty-content__actions .components-button+.components-button{margin-left:16px}.woocommerce-filters-advanced{margin:24px 0}.woocommerce-filters-advanced .woocommerce-card__header{padding:8px 16px}.woocommerce-filters-advanced .woocommerce-card__body{padding:0}.woocommerce-filters-advanced .components-select-control__input{height:38px;padding:0;margin:0}.woocommerce-filters-advanced .components-base-control__field{margin-bottom:0}@media (max-width:782px){.woocommerce-filters-advanced{margin:16px 0;border:1px solid #ccd0d4}}@media (max-width:400px){.woocommerce-filters-advanced{margin:12px 0}}.woocommerce-filters-advanced__title-select{width:70px;display:inline-block;margin:0 8px}.woocommerce-filters-advanced__list{margin:0}.woocommerce-filters-advanced__list-item{padding:0 16px 0 0;margin:0;display:-ms-grid;display:grid;-ms-grid-columns:1fr 40px;grid-template-columns:1fr 40px;background-color:#f8f9f9;border-bottom:1px solid #ccd0d4}.woocommerce-filters-advanced__list-item:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__line-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__line-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__list-item fieldset{padding:8px 8px 8px 16px}.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__remove{width:40px;height:38px;-ms-grid-row-align:center;align-self:center}@media (max-width:400px){.woocommerce-filters-advanced__list-item .woocommerce-filters-advanced__remove{position:absolute;top:0;right:4px}}.woocommerce-filters-advanced__list-item .components-form-token-field{border-radius:4px}@media (max-width:400px){.woocommerce-filters-advanced__list-item{display:block;position:relative;padding:8px 8px 0 0}}.woocommerce-filters-advanced__add-filter{padding:12px;margin:0;color:#95588a;display:block;background-color:#f8f9f9;border-bottom:1px solid #ccd0d4}.woocommerce-filters-advanced__add-filter:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__add-filter div div{display:inline-block}.woocommerce-filters-advanced__add-filter .components-popover:not(.is-mobile) .components-popover__content{min-width:180px}.woocommerce-filters-advanced__fieldset{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.woocommerce-filters-advanced__fieldset>div{padding:0 4px}@media (max-width:782px){.woocommerce-filters-advanced__fieldset>div{width:100%;padding:4px 0}}@media (max-width:782px){.woocommerce-filters-advanced__fieldset{display:block}}.woocommerce-filters-advanced__fieldset.is-english{display:-ms-grid;display:grid;-ms-grid-columns:100px 150px 1fr;grid-template-columns:100px 150px 1fr}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:nth-child(3){-ms-grid-column:3;grid-column-start:3;-ms-grid-column-span:1;grid-column-end:4;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-advanced__fieldset.is-english .woocommerce-filters-advanced__fieldset-item:first-child{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}@media (max-width:782px){.woocommerce-filters-advanced__fieldset.is-english{display:block}}.woocommerce-filters-advanced__rule{width:150px}.woocommerce-filters-advanced__input{width:100%}.woocommerce-filters-advanced__add-filter-dropdown{display:inline-block}.woocommerce-filters-advanced__add-button{color:inherit;padding:8px}.woocommerce-filters-advanced__add-button svg{fill:currentColor;margin:0 6px 0 0}.woocommerce-filters-advanced__add-button.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{color:#c88bbd}.woocommerce-filters-advanced__add-button:not(:disabled):not([aria-disabled=true]):focus{color:#95588a;background-color:transparent}.woocommerce-filters-advanced__controls{padding:8px 16px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.woocommerce-filters-advanced__controls .components-button{margin-right:16px}.woocommerce-filters-advanced__add-dropdown{padding:8px 0}.woocommerce-filters-advanced__add-dropdown li{margin:0}.woocommerce-filters-advanced__add-dropdown .components-button{width:100%;padding:8px}.woocommerce-filters-advanced__add-dropdown .components-button:hover{background-color:#f3f4f5}.woocommerce-filters-advanced__add-dropdown .components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#edeff0;box-shadow:none}.woocommerce-filters-advanced__input-range{-webkit-box-align:center;align-items:center;display:-ms-grid;display:grid;-ms-grid-columns:1fr;grid-template-columns:1fr}.woocommerce-filters-advanced__input-range.is-between{-ms-grid-columns:1fr 36px 1fr;grid-template-columns:1fr 36px 1fr}.woocommerce-filters-advanced__input-range input{height:38px;margin:0}.woocommerce-filters-advanced__input-range .separator{text-align:center}.woocommerce-filters-date__content.is-mobile .components-popover__header{border:none;height:0}.woocommerce-filters-date__content.is-mobile .components-popover__close{-webkit-transform:translateY(22px);transform:translateY(22px)}.woocommerce-filters-date__content.is-mobile .components-tab-panel__tab-content{height:calc(100% - 46px);overflow:auto}.woocommerce-filters-date__tabs{height:calc(100% - 42px)}.woocommerce-filters-date__tabs .components-tab-panel__tabs{display:-ms-grid;display:grid;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;border-radius:5px;margin:0 1em 1em}.woocommerce-filters-date__tabs .components-tab-panel__tab-content{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:center;align-items:center}.woocommerce-filters-date__tab:first-child{-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}.woocommerce-filters-date__tab:nth-child(2){-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3;-ms-grid-row:1;grid-row-start:1;-ms-grid-row-span:1;grid-row-end:2}button.woocommerce-filters-date__tab{outline:none;border:1px solid #95588a;padding:8px;margin:0;border-radius:4px 0 0 4px;color:#95588a;background-color:transparent;-webkit-box-pack:center;justify-content:center}button.woocommerce-filters-date__tab:hover{background-color:#f8f4f7;cursor:pointer}button.woocommerce-filters-date__tab:last-child{border-radius:0 4px 4px 0}button.woocommerce-filters-date__tab.is-active,button.woocommerce-filters-date__tab.is-active:focus{background-color:#95588a;color:#fff}button.woocommerce-filters-date__tab:focus{box-shadow:inset 0 -1px 0 #00435d,0 0 0 2px #bfe7f3}.woocommerce-filters-date__text{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#6c7781;width:100%;margin:0;padding:1em;background-color:#fff}.woocommerce-filters-date__content-controls{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;width:100%;-webkit-box-align:center;align-items:center;padding-bottom:1em;background-color:#fff}.woocommerce-filters-date__content-controls.is-custom{border-top:1px solid #ccd0d4}.woocommerce-filters-date__button-group{padding-top:1em;display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;width:100%}.woocommerce-filters-date__button-group .woocommerce-filters-date__button.is-button{-webkit-box-pack:center;justify-content:center;width:40%;height:34px;margin:0 12px}.woocommerce-filters-filter__content.is-mobile .components-popover__header-title{font-size:12px;font-size:.75rem;font-weight:100;text-transform:uppercase;text-align:center;color:#555d66}.woocommerce-filters-filter__content.is-mobile .woocommerce-filters-filter__content-list-item:last-child{border-bottom:1px solid #ccd0d4}.woocommerce-filters-filter__content-list{margin:0;width:100%;min-width:100%}.woocommerce-filters-filter__content-list-item{border-bottom:1px solid #ccd0d4;margin:0}.woocommerce-filters-filter__content-list-item:last-child{border-bottom:none}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button{background-color:#fff}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button.components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#fff}.woocommerce-filters-filter__content-list-item.is-selected .woocommerce-filters-filter__button:before{content:"";width:8px;height:8px;background-color:#95588a;position:absolute;top:50%;left:1em;-webkit-transform:translate(50%,-50%);transform:translate(50%,-50%)}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button{position:relative;display:block;width:100%;padding:1em 1em 1em 3em;background-color:#f8f9f9;text-align:left}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button.components-button{color:#555d66}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button:hover{background-color:#f3f4f5;color:#555d66}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button.components-button:not(:disabled):not([aria-disabled=true]):focus{background-color:#f8f9f9}.woocommerce-filters-filter__content-list-item .woocommerce-filters-filter__button .dashicon{position:absolute;left:1em;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.woocommerce-filters .components-base-control__field{margin-bottom:0}@media (max-width:400px){.woocommerce-filters{margin-left:-8px;margin-right:-8px}}.woocommerce-filters__basic-filters{display:-webkit-box;display:flex;margin-bottom:24px}@media (max-width:1280px){.woocommerce-filters__basic-filters{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}@media (max-width:782px){.woocommerce-filters__basic-filters{margin-bottom:16px}}.woocommerce-filters-filter{width:25%;padding:0 12px;min-height:82px;display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:end;justify-content:flex-end}.woocommerce-filters-filter:first-child{padding-left:0}.woocommerce-filters-filter:last-child{padding-right:0}@media (max-width:1440px){.woocommerce-filters-filter{width:33.3%}}@media (max-width:1280px){.woocommerce-filters-filter{width:50%;padding:0;min-height:78px}}@media (max-width:782px){.woocommerce-filters-filter{width:100%}}.woocommerce-filters-label{margin:7px 0;display:block}@media (max-width:1280px){.woocommerce-filters-label{margin:5px 0}}.woocommerce-filters-date__content .components-popover__content,.woocommerce-filters-filter__content .components-popover__content{width:320px;border:1px solid #ccd0d4;background-color:#fff}.woocommerce-filters-date__content .woocommerce-calendar__input-error .components-popover__content,.woocommerce-filters-filter__content .woocommerce-calendar__input-error .components-popover__content{background-color:#606a73}.woocommerce-filters-date__content.is-mobile .components-popover__content,.woocommerce-filters-filter__content.is-mobile .components-popover__content{width:100%;height:100%;border:none}.woocommerce-filters__compare .woocommerce-card__body{padding:0}.woocommerce-filters__compare-body{padding:16px;background-color:#f8f9f9;border-bottom:1px solid #e2e4e7}.woocommerce-filters__compare-footer{padding:16px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.woocommerce-filters__compare-footer .components-button{margin-right:16px}.woocommerce-filters-filter__search .woocommerce-search__autocomplete-results{position:static}.woocommerce-filters-filter__search .woocommerce-search__inline-container{overflow:hidden}.woocommerce-filters-filter__search .woocommerce-search__inline-container:not(.is-active){border:none}.woocommerce-filters-advanced__list-item .components-base-control+.components-base-control{margin-bottom:0}.woocommerce-flag span{vertical-align:middle}.woocommerce-flag .woocommerce-flag__fallback{background:#e2e4e7;color:transparent;width:24px;height:18px;display:block;overflow:hidden}.woocommerce-gravatar{border-radius:50%}.woocommerce-list__item{padding:16px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;margin-bottom:0}.woocommerce-list__item.has-action{cursor:pointer}.woocommerce-list__item .woocommerce-list__item-title{display:block;font-size:16px;line-height:22px;color:#1a1a1a}.woocommerce-list__item .woocommerce-list__item-description{margin-top:4px;display:block;font-size:14px;line-height:20px;color:#50575d}.woocommerce-list__item .woocommerce-list__item-before{margin-right:20px;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.woocommerce-list__item .woocommerce-list__item-after{margin-left:auto}.woocommerce-list__item .woocommerce-list__item-after,.woocommerce-order-status{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center}.woocommerce-order-status__indicator{min-width:16px;width:16px;height:16px;display:block;background:#ccd0d4;margin-right:8px;border-radius:50%;border:3px solid #e2e4e7}.woocommerce-order-status__indicator.is-processing{background:#4ab866;border-color:#93d5a4}.woocommerce-order-status__indicator.is-on-hold{background:#ffb900;border-color:#ffd566}.woocommerce-pagination{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;flex-wrap:nowrap;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center}@media (max-width:782px){.woocommerce-pagination{-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}}.woocommerce-pagination input{border-radius:4px}.woocommerce-pagination__page-arrows{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row}.woocommerce-pagination__page-arrows-buttons{display:-webkit-inline-box;display:inline-flex;-webkit-box-align:baseline;align-items:baseline;border:solid #b5bfc9;border-width:1px 1px 2px;border-radius:4px;background:#f0f2f4}.woocommerce-pagination__page-arrows-buttons .components-button:not(:disabled):not([aria-disabled=true]){color:#24292d;height:30px;width:32px;-webkit-box-pack:center;justify-content:center}.woocommerce-pagination__page-arrows-buttons .components-icon-button:not(:disabled):not([aria-disabled=true]):hover{color:#6c7781}.woocommerce-pagination__page-arrows-buttons button:first-child{border-right:2px solid #d3d9de}.woocommerce-pagination__page-arrows-buttons .woocommerce-pagination__link{padding:4px}.woocommerce-pagination__page-arrows-label{margin-top:8px;margin-right:8px}.woocommerce-pagination__page-picker{margin-left:16px}@media (max-width:782px){.woocommerce-pagination__page-picker{margin-top:16px;margin-left:0}}.woocommerce-pagination__page-picker .woocommerce-pagination__page-picker-input{margin-left:8px;width:60px;height:34px;box-shadow:none}.woocommerce-pagination__per-page-picker{margin-left:16px}@media (max-width:782px){.woocommerce-pagination__per-page-picker{margin-top:16px;margin-left:0}}.woocommerce-pagination__per-page-picker .components-base-control{margin-bottom:0}.woocommerce-pagination__per-page-picker .components-base-control__field{display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-align:baseline;align-items:baseline;margin-bottom:0}.woocommerce-pagination__per-page-picker .components-select-control__input{width:60px;height:34px;box-shadow:none}.woocommerce-pagination__per-page-picker .components-base-control__label{margin-right:8px}.woocommerce-pagination__page-picker-input.has-error,.woocommerce-pagination__page-picker-input.has-error:focus{border-color:#d94f4f;box-shadow:0 0 2px #d94f4f}.woocommerce-product-image{border-radius:50%}.woocommerce-rating{position:relative;vertical-align:middle;display:inline-block;overflow:hidden;white-space:nowrap}.woocommerce-rating .gridicon{fill:#d7dade}.woocommerce-rating .woocommerce-rating__star-outline{position:absolute;left:0;top:0;white-space:nowrap;overflow:hidden}.woocommerce-rating .woocommerce-rating__star-outline .gridicon{fill:#555d66}.woocommerce-search{position:relative;min-width:0}.woocommerce-search>div{min-width:0}.woocommerce-search .woocommerce-search__icon{position:absolute;top:10px;left:10px;fill:#a2aab2}.woocommerce-search .woocommerce-tag{max-width:100%}.woocommerce-search .woocommerce-tag .woocommerce-tag__text{max-width:calc(100% - 24px)}.woocommerce-search:not(.has-inline-tags) .woocommerce-tag{margin:8px 6px 0 0}.woocommerce-search.has-inline-tags .woocommerce-search__icon{top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.woocommerce-search .woocommerce-search__inline-container{width:100%;padding:4px 2px 4px 36px;border:1px solid #ccd0d4;background-color:#fff;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;position:relative}.woocommerce-search .woocommerce-search__inline-container.is-active{border-color:#00a0d2;box-shadow:inset 0 0 0 #00435d,0 0 1px 2px #bfe7f3}.woocommerce-search .woocommerce-search__inline-container.has-tags{padding-right:36px}.woocommerce-search .woocommerce-search__inline-container .woocommerce-search__token-list{max-width:100%;display:inline-block;padding:1px 0}.woocommerce-search .woocommerce-search__inline-input,.woocommerce-search .woocommerce-search__inline-input:focus{border:none;outline:none;box-shadow:none;padding:2px 0;line-height:20px;max-width:100%;min-width:70px;font-size:inherit;vertical-align:middle}.woocommerce-search .woocommerce-search__inline-input:focus[type=number]::-webkit-inner-spin-button,.woocommerce-search .woocommerce-search__inline-input:focus[type=number]::-webkit-outer-spin-button,.woocommerce-search .woocommerce-search__inline-input[type=number]::-webkit-inner-spin-button,.woocommerce-search .woocommerce-search__inline-input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.woocommerce-search .woocommerce-search__input{width:100%;padding:8px 12px 8px 36px;border:1px solid #ccd0d4}.woocommerce-search .woocommerce-search__autocomplete-results{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-align:stretch;align-items:stretch;border:1px solid #ccd0d4;position:absolute;left:0;right:0;z-index:10}.woocommerce-search .woocommerce-search__autocomplete-results:empty{display:none}.woocommerce-search .woocommerce-search__autocomplete-results.is-static-results{position:static}.woocommerce-search .woocommerce-search__autocomplete-result{margin-bottom:0;display:-webkit-box;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;-webkit-box-flex:1;flex-grow:1;flex-shrink:0;-webkit-box-align:center;align-items:center;padding:12px;color:#95588a;text-align:left;background:#f8f9f9;border-bottom:1px solid #e2e4e7}.woocommerce-search .woocommerce-search__autocomplete-result:last-of-type{border-bottom:none}.woocommerce-search .woocommerce-search__autocomplete-result:hover{box-shadow:none;color:#95588a;background:#f3f4f5}.woocommerce-search .woocommerce-search__autocomplete-result.is-selected,.woocommerce-search .woocommerce-search__autocomplete-result:active,.woocommerce-search .woocommerce-search__autocomplete-result:focus{color:#95588a;background:#fff;box-shadow:inset 0 0 0 1px #f3f4f5,inset 0 0 0 2px #24292d}.woocommerce-search .woocommerce-search__autocomplete-result .woocommerce-search__result-thumbnail{margin-right:12px}.woocommerce-search__result-name{text-decoration:underline}.woocommerce-search__clear{position:absolute;right:10px;top:calc(50% - 10px)}.woocommerce-search__clear>.dashicon{color:#c9c9c9}.woocommerce-search-list{width:100%;padding:0 0 16px;text-align:left}.woocommerce-search-list__selected{margin:16px 0;padding:16px 0 0;min-height:76px;border-top:1px solid #e2e4e7}.woocommerce-search-list__selected .woocommerce-search-list__selected-header{margin-bottom:8px}.woocommerce-search-list__selected .woocommerce-search-list__selected-header button{margin-left:12px}.woocommerce-search-list__selected .woocommerce-tag__text{max-width:13em}.woocommerce-search-list__search{margin:16px 0;padding:16px 0 0;border-top:1px solid #e2e4e7}.woocommerce-search-list__search .components-base-control__field{margin-bottom:16px}.woocommerce-search-list__list{padding:0;max-height:17em;overflow-x:hidden;overflow-y:auto;border-top:1px solid #e2e4e7;border-bottom:1px solid #e2e4e7}.woocommerce-search-list__list.is-loading,.woocommerce-search-list__list.is-not-found{padding:12px 0;text-align:center;border:none}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon,.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-text{display:inline-block}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon{margin-right:16px}.woocommerce-search-list__list.is-not-found .woocommerce-search-list__not-found-icon .gridicon{vertical-align:top;margin-top:-1px}.woocommerce-search-list__list .components-spinner{float:none;margin:0 auto}.woocommerce-search-list__list .components-menu-group__label{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;word-wrap:normal!important}.woocommerce-search-list__list>[role=menu]{border:1px solid #e2e4e7;border-bottom:none}.woocommerce-search-list__list .woocommerce-search-list__item{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;margin-bottom:0;padding:12px 16px;background:#fff;border-bottom:1px solid #e2e4e7!important;color:#555d66}.woocommerce-search-list__list .woocommerce-search-list__item:active,.woocommerce-search-list__list .woocommerce-search-list__item:focus,.woocommerce-search-list__list .woocommerce-search-list__item:hover{background:#f8f9f9}.woocommerce-search-list__list .woocommerce-search-list__item:last-child{border-bottom:none!important}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-state{-webkit-box-flex:0;flex:0 0 16px;margin-right:8px;height:24px}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-label{display:-webkit-box;display:flex;-webkit-box-flex:1;flex:1}.woocommerce-search-list__list .woocommerce-search-list__item.depth-0+.depth-1{margin-top:-1px}.woocommerce-search-list__list .woocommerce-search-list__item:not(.depth-0){border-bottom:0!important}.woocommerce-search-list__list .woocommerce-search-list__item:not(.depth-0)+.depth-0{border-top:1px solid #e2e4e7}.woocommerce-search-list__list .woocommerce-search-list__item[class*=depth-] .woocommerce-search-list__item-label:before{margin-right:4px;content:"— — — — — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-0 .woocommerce-search-list__item-label:before{margin-right:0;content:""}.woocommerce-search-list__list .woocommerce-search-list__item.depth-1 .woocommerce-search-list__item-label:before{content:"— "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-2 .woocommerce-search-list__item-label:before{content:"— — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-3 .woocommerce-search-list__item-label:before{content:"— — — "}.woocommerce-search-list__list .woocommerce-search-list__item.depth-4 .woocommerce-search-list__item-label:before{content:"— — — — "}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-name{display:inline-block}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-prefix{display:none;color:#6c7781}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-label,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-label{display:inline-block}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-prefix,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-prefix{display:inline}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-prefix:after,.woocommerce-search-list__list .woocommerce-search-list__item.is-skip-level .woocommerce-search-list__item-prefix:after{margin-right:4px;content:" ›"}.woocommerce-search-list__list .woocommerce-search-list__item.is-searching .woocommerce-search-list__item-name{color:#191e23}.woocommerce-search-list__list .woocommerce-search-list__item .woocommerce-search-list__item-count{-webkit-box-flex:0;flex:0 1 auto;padding:2px 8px;border:1px solid #e2e4e7;border-radius:12px;font-size:.8em;line-height:1.4;color:#6c7781;background:#fff;white-space:nowrap}.components-panel .woocommerce-search-list{padding:0}.components-panel .woocommerce-search-list__selected{margin:0 0 16px;padding:0;border-top:none;min-height:54px}.components-panel .woocommerce-search-list__search{margin:0 0 16px;padding:0;border-top:none}.woocommerce-section-header{padding:13px;border-bottom:none;display:-webkit-box;display:flex;-webkit-box-pack:justify;justify-content:space-between}@media (max-width:782px){.woocommerce-section-header{margin-left:-16px;margin-right:-16px;margin-bottom:12px;border-left:none;border-right:none;width:auto}}.woocommerce-section-header hr{-ms-grid-row-align:center;align-self:center;-webkit-box-flex:1;flex-grow:1;height:1px;margin:0 10px}@media (max-width:782px){.woocommerce-section-header.has-interval-select{position:relative;padding-bottom:30px}.woocommerce-section-header.has-interval-select .woocommerce-chart__interval-select{position:absolute;left:0;bottom:0;padding-left:6px}}.woocommerce-section-header__actions,.woocommerce-section-header__menu{text-align:right}.woocommerce-section-header__actions{display:-webkit-box;display:flex;-webkit-box-flex:1;flex-grow:1;-webkit-box-pack:end;justify-content:flex-end;-webkit-box-align:center;align-items:center}.woocommerce-section-header__actions .components-base-control{padding-top:0;min-height:34px}.woocommerce-section-header__actions .components-base-control__field{margin-bottom:0}.woocommerce-section-header__actions .components-base-control__field select{background:transparent}.woocommerce-ellipsis-menu__toggle{padding:0}.woocommerce-section-header__menu{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-pack:center;justify-content:center}.woocommerce-section-header__title{margin:0 16px 0 0;padding:3px 0;font-size:18px;font-size:1.125rem;line-height:2.2;font-weight:600}.woocommerce-segmented-selection{width:100%;color:#555d66}.woocommerce-segmented-selection__container{width:100%;-ms-grid-columns:1fr 1fr;grid-template-columns:1fr 1fr;display:-ms-grid;display:grid;border-top:1px solid #ccd0d4;border-bottom:1px solid #ccd0d4;background-color:#ccd0d4}.woocommerce-segmented-selection__item:nth-child(2n){border-left:1px solid #ccd0d4;border-top:1px solid #ccd0d4}.woocommerce-segmented-selection__item:nth-child(odd){border-top:1px solid #ccd0d4}.woocommerce-segmented-selection__item:nth-child(-n+2){border-top:0}.woocommerce-segmented-selection__label{background-color:#f8f9f9;padding:12px 12px 12px 36px;position:relative;display:block;height:100%}.woocommerce-segmented-selection__label:active{background-color:#f3f4f5}.woocommerce-segmented-selection__label:hover{background-color:#f3f4f5}.woocommerce-segmented-selection__input{opacity:0;position:absolute;left:-9999px}.woocommerce-segmented-selection__input:active+label .woocommerce-segmented-selection__label{background-color:#f3f4f5}.woocommerce-segmented-selection__input:checked+label .woocommerce-segmented-selection__label{background-color:#fff;font-weight:600}.woocommerce-segmented-selection__input:checked+label .woocommerce-segmented-selection__label:before{content:"";width:8px;height:8px;background-color:#95588a;position:absolute;top:50%;-webkit-transform:translate(-20px,-50%);transform:translate(-20px,-50%)}.woocommerce-segmented-selection__input:focus+label .woocommerce-segmented-selection__label{box-shadow:inset 0 0 0 1px #24292d}.woocommerce-simple-select-control__dropdown{position:relative;width:100%;height:56px;border:1px solid #b0b5b8;box-shadow:none;box-sizing:border-box;border-radius:3px;background:#fff;font-size:16px;line-height:54px;font-weight:400;margin-top:16px;margin-bottom:16px}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__selector.components-button{border:0;background:transparent;box-shadow:none;-webkit-box-pack:unset;justify-content:unset;margin-left:0;position:absolute;top:0;height:100%;width:100%;left:0;padding-left:16px;padding-right:40px}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__selector.components-button:focus:not(:disabled){box-shadow:none;outline:none;background-color:transparent;outline-offset:0}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__selector.components-button:after{display:block;pointer-events:none;position:absolute;float:right;line-height:56px;font-family:dashicons,sans-serif;font-size:20px;content:"\f140";z-index:101;height:24px;width:24px;margin-top:0;top:0;right:16px;bottom:16px;color:#000}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__dropdown-content.components-popover.is-bottom{margin-top:-80px;z-index:999}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__dropdown-content.components-popover.is-bottom:after,.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__dropdown-content.components-popover.is-bottom:before{display:none}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__dropdown-content .components-button{display:block;position:relative;padding:10px 20px 10px 40px;width:100%;text-align:left}.woocommerce-simple-select-control__dropdown .woocommerce-simple-select-control__dropdown-content .components-button.is-selected{background:#ccced0}.woocommerce-simple-select-control__dropdown.is-empty .woocommerce-simple-select-control__selector.components-button{font-size:16px;line-height:54px;height:54px;z-index:100;color:#636d75}.woocommerce-simple-select-control__dropdown.is-active{box-shadow:0 0 0 2px #673d99;border-color:transparent}.woocommerce-simple-select-control__dropdown.has-value .woocommerce-simple-select-control__selector{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.woocommerce-simple-select-control__dropdown.has-value .woocommerce-simple-select-control__selector.components-button:after{bottom:23px}.woocommerce-simple-select-control__dropdown.has-value .woocommerce-simple-select-control__label{font-size:12px;line-height:16px;margin-top:8px;color:#636d75}.woocommerce-simple-select-control__dropdown.has-value .woocommerce-simple-select-control__value{color:#2b2d2f;font-size:16px;white-space:nowrap}.woocommerce-split-button{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;padding:4px 0}.woocommerce-split-button .woocommerce-split-button__menu{padding:0}.woocommerce-split-button .woocommerce-split-button__main-action,.woocommerce-split-button .woocommerce-split-button__menu-toggle{line-height:26px;height:42px;border-radius:3px;white-space:nowrap;color:#555d66;border:1px solid #b5bcc2;background:#f3f4f5;box-shadow:inset 0 -1px 0 #b5bcc2;vertical-align:top}.woocommerce-split-button .woocommerce-split-button__main-action{padding:0 12px;border-top-right-radius:0;border-bottom-right-radius:0;border-right:0;height:32px}.woocommerce-split-button .woocommerce-split-button__menu-toggle{border-top-left-radius:0;border-bottom-left-radius:0;padding:4px;height:32px;width:32px}.woocommerce-split-button .woocommerce-split-button__menu-popover.is-mobile{top:46px}.woocommerce-split-button .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.woocommerce-split-button .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{background-color:#fafafa;border-color:#78848f;box-shadow:inset 0 -1px 0 #b5bcc2}.woocommerce-split-button .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus,.woocommerce-split-button .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus{background-color:#fafafa;border:1px solid #555d66;box-shadow:inset 0 -1px 0 #6c7781,0 0 0 2px #bfe7f3}.woocommerce-split-button .woocommerce-split-button__main-action.components-button .dashicon,.woocommerce-split-button .woocommerce-split-button__main-action.components-button .gridicon{width:18px;height:18px}.woocommerce-split-button.has-label .woocommerce-split-button__main-action.components-button .dashicon,.woocommerce-split-button.has-label .woocommerce-split-button__main-action.components-button .gridicon{margin-right:8px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper{width:100%;padding:4px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-button,.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-icon-button{color:#555d66;margin-top:4px;margin-bottom:4px}.woocommerce-split-button .woocommerce-split-button__menu-wrapper .components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{background-color:#fff;color:#24292d;box-shadow:inset 0 0 0 1px #e2e4e7,inset 0 0 0 2px #fff,0 1px 1px rgba(25,30,35,.2)}.woocommerce-split-button .woocommerce-split-button__menu-item{width:100%;padding:4px;border-radius:0;outline:none;cursor:pointer}.woocommerce-split-button .woocommerce-split-button__menu-item .dashicon{margin-right:8px}.woocommerce-split-button .dashicons-arrow-down{fill:#555d66;height:20px;width:20px}.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover>svg,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active>svg{background:initial}.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active,.woocommerce-split-button .woocommerce-split-button__menu-toggle.is-active:hover{border-color:#b5bcc2}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle{background:#95588a;color:#fff;border-color:#7c3f71;box-shadow:inset 0 -1px 0 #7c3f71}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):hover{color:#fff;background-color:#7c3f71;border-color:#622557;box-shadow:inset 0 -1px 0 #622557}.woocommerce-split-button.is-primary .woocommerce-split-button__main-action.components-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus,.woocommerce-split-button.is-primary .woocommerce-split-button__menu-toggle.components-icon-button:not(:disabled):not([aria-disabled=true]):not(.is-default):focus{color:#fff;background-color:#7c3f71;box-shadow:inset 0 -1px 0 #622557,0 0 0 2px #ffd7ff;border:1px solid #622557}.woocommerce-split-button.is-primary .dashicons-arrow-down{fill:#fff}.woocommerce-stepper .woocommerce-stepper__steps{display:-webkit-box;display:flex;justify-content:space-around;margin-bottom:24px}.woocommerce-stepper .woocommerce-stepper__step{display:-webkit-inline-box;display:inline-flex;padding:8px;font-weight:400;position:relative}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-stepper__step-label{color:#1a1a1a;line-height:24px;font-size:16px}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-stepper__step-description{display:none;font-size:14px;color:#636d75;font-weight:400;margin-top:2px}.woocommerce-stepper .woocommerce-stepper__step svg{display:none}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-spinner{display:block;margin-right:12px;max-height:24px;min-width:auto;width:24px;border-radius:50%;background:#005fb7}.woocommerce-stepper .woocommerce-stepper__step .woocommerce-spinner__circle{stroke:#fff}.woocommerce-stepper .woocommerce-stepper__step.is-active .woocommerce-stepper__step-icon,.woocommerce-stepper .woocommerce-stepper__step.is-complete .woocommerce-stepper__step-icon{background:#005fb7;color:#fff}.woocommerce-stepper .woocommerce-stepper__step.is-active .woocommerce-stepper__step-icon{font-weight:600}.woocommerce-stepper .woocommerce-stepper__step.is-active .woocommerce-stepper__step-label{font-weight:600;margin:0}.woocommerce-stepper .woocommerce-stepper__step.is-complete .woocommerce-stepper__step-number{display:none}.woocommerce-stepper .woocommerce-stepper__step.is-complete svg{display:inline}.woocommerce-stepper .woocommerce-stepper__step-icon{font-size:16px;display:-webkit-inline-box;display:inline-flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;width:24px;height:24px;min-width:24px;margin-right:12px;background:#e1e2e2;color:#50575d;border-radius:50%}.woocommerce-stepper .woocommerce-stepper__step-divider{align-self:flex-start;-webkit-box-flex:1;flex-grow:1;border-bottom:1px solid #e1e2e2;margin-top:20px}.woocommerce-stepper .woocommerce-stepper__step-divider:last-child{display:none}@media (max-width:782px){.woocommerce-stepper .woocommerce-stepper__step-label{display:none;padding-top:24px}.woocommerce-stepper .woocommerce-stepper__step-icon{margin-right:0}}.woocommerce-stepper.is-vertical .woocommerce-stepper__steps{-webkit-box-align:initial;align-items:normal;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.woocommerce-stepper.is-vertical .woocommerce-stepper__step{min-height:90px}.woocommerce-stepper.is-vertical .woocommerce-stepper__step:after{content:"";position:absolute;left:20px;top:40px;height:calc(100% - 40px);border-left:1px solid #e1e2e2}.woocommerce-stepper.is-vertical .woocommerce-stepper__step:last-child{min-height:auto}.woocommerce-stepper.is-vertical .woocommerce-stepper__step:last-child:after{display:none}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-label{display:initial}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-icon{margin-right:12px}.woocommerce-stepper.is-vertical .woocommerce-stepper__step-description{display:block}.woocommerce-stepper.is-vertical .woocommerce-stepper_content{margin-top:8px}@-webkit-keyframes rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(270deg);transform:rotate(270deg)}}@keyframes rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(270deg);transform:rotate(270deg)}}@-webkit-keyframes growAndShrink{0%,to{stroke-dashoffset:200}50%{stroke-dashoffset:50;-webkit-transform:rotate(135deg);transform:rotate(135deg)}to{-webkit-transform:rotate(450deg);transform:rotate(450deg)}}@keyframes growAndShrink{0%,to{stroke-dashoffset:200}50%{stroke-dashoffset:50;-webkit-transform:rotate(135deg);transform:rotate(135deg)}to{-webkit-transform:rotate(450deg);transform:rotate(450deg)}}.woocommerce-spinner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:40px;min-width:40px;height:40px;max-height:40px}.woocommerce-spinner__circle{stroke-dasharray:200;stroke-dashoffset:0;-webkit-transform-origin:center;transform-origin:center;-webkit-animation:growAndShrink 2s ease-in-out infinite;animation:growAndShrink 2s ease-in-out infinite;stroke:#1a1a1a}.woocommerce-summary{margin:16px 0;display:-ms-grid;display:grid;border-color:#ccd0d4;border-style:solid;border-width:1px 0 0 1px;background-color:#edeff0;box-shadow:inset -1px -1px 0 #ccd0d4}@media (max-width:782px){.woocommerce-summary{border-width:0}.woocommerce-summary.is-placeholder{border-top:0}.woocommerce-summary .woocommerce-summary__item-container.is-placeholder{border-top:1px solid #ccd0d4}}.woocommerce-summary .components-popover.components-popover{position:static!important;top:auto!important;left:auto!important;right:auto!important;bottom:auto!important;margin-top:0!important;margin-left:0}.woocommerce-summary .components-popover.components-popover .components-popover__header{display:none}.woocommerce-summary .components-popover.components-popover .components-popover__content{position:static;left:auto;right:auto;margin:0;width:100%;max-width:100%!important;max-height:100%!important;box-shadow:none;border:none;-webkit-transform:none;transform:none}.woocommerce-summary .components-popover.components-popover .components-popover__content .woocommerce-summary__item.is-selected{display:none}.components-popover__content .woocommerce-summary{max-height:100%;margin-top:0;margin-bottom:0;overflow-y:auto;border:none}.woocommerce-summary .woocommerce-summary__item-data{display:-webkit-box;display:flex;flex-wrap:wrap}.woocommerce-summary .woocommerce-summary__item-delta,.woocommerce-summary .woocommerce-summary__item-value{-webkit-box-flex:1;flex:1 0 auto}.woocommerce-summary .woocommerce-summary__item-delta{-webkit-box-flex:0;flex:0 1 auto;display:-webkit-box;display:flex;flex-wrap:none}.woocommerce-summary,.woocommerce-summary.has-1-items,.woocommerce-summary.has-one-item{-ms-grid-columns:1fr;grid-template-columns:1fr}.woocommerce-summary.has-2-items{-ms-grid-columns:(1fr)[2];grid-template-columns:repeat(2,1fr)}.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(2n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(odd):nth-last-of-type(-n+2) .woocommerce-summary__item,.woocommerce-summary.has-2-items .woocommerce-summary__item-container:nth-of-type(odd):nth-last-of-type(-n+2)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-3-items{-ms-grid-columns:(1fr)[3];grid-template-columns:repeat(3,1fr)}.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-3-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-4-items,.woocommerce-summary.has-7-items,.woocommerce-summary.has-8-items{-ms-grid-columns:(1fr)[4];grid-template-columns:repeat(4,1fr)}.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-4-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-7-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-8-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-5-items{-ms-grid-columns:(1fr)[5];grid-template-columns:repeat(5,1fr)}.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-5-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-5-items .woocommerce-summary__item-delta,.woocommerce-summary.has-5-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-5-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-5-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-5-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}@media (min-width:1441px){.woocommerce-summary.has-6-items{-ms-grid-columns:(1fr)[6];grid-template-columns:repeat(6,1fr)}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n+1):nth-last-of-type(-n+6) .woocommerce-summary__item,.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(6n+1):nth-last-of-type(-n+6)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-delta,.woocommerce-summary.has-6-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-6-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-6-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-6-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-9-items,.woocommerce-summary.has-10-items{-ms-grid-columns:(1fr)[5];grid-template-columns:repeat(5,1fr)}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n+1):nth-last-of-type(-n+5)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-9-items .woocommerce-summary__item-delta,.woocommerce-summary.has-9-items .woocommerce-summary__item-value,.woocommerce-summary.has-10-items .woocommerce-summary__item-delta,.woocommerce-summary.has-10-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-9-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-9-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-9-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}}@media (max-width:1440px){.woocommerce-summary.has-4-items .woocommerce-summary__item-delta,.woocommerce-summary.has-4-items .woocommerce-summary__item-value,.woocommerce-summary.has-7-items .woocommerce-summary__item-delta,.woocommerce-summary.has-7-items .woocommerce-summary__item-value,.woocommerce-summary.has-8-items .woocommerce-summary__item-delta,.woocommerce-summary.has-8-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-4-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-4-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-7-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-7-items .woocommerce-summary__item-prev-value,.woocommerce-summary.has-8-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-8-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-4-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-7-items.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary.has-8-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-6-items,.woocommerce-summary.has-9-items{-ms-grid-columns:(1fr)[3];grid-template-columns:repeat(3,1fr)}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-6-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3) .woocommerce-summary__item,.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(3n+1):nth-last-of-type(-n+3)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-10-items{-ms-grid-columns:(1fr)[4];grid-template-columns:repeat(4,1fr)}.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n) .woocommerce-summary__item{border-right-color:#ccd0d4}.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(4n+1):nth-last-of-type(-n+4)~.woocommerce-summary__item-container .woocommerce-summary__item{border-bottom-color:#ccd0d4}.woocommerce-summary.has-10-items .woocommerce-summary__item-delta,.woocommerce-summary.has-10-items .woocommerce-summary__item-value{min-width:100%}.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-label,.woocommerce-summary.has-10-items .woocommerce-summary__item-prev-value{display:block}.woocommerce-summary.has-10-items.is-placeholder .woocommerce-summary__item-prev-label{margin-right:calc(100% - 80px)}.woocommerce-summary.has-9-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item,.woocommerce-summary.has-10-items .woocommerce-summary__item-container:nth-of-type(5n) .woocommerce-summary__item{border-right-color:#e2e4e7}}@media (max-width:960px){.woocommerce-summary .woocommerce-summary__item{border-right-color:#ccd0d4}}@media (max-width:782px){.woocommerce-summary .woocommerce-summary__item-container{margin-left:-16px;margin-right:-16px;width:auto}.woocommerce-summary .woocommerce-summary__item-container .woocommerce-summary__item{border-right:none}.woocommerce-summary .components-popover.components-popover{margin-left:-16px;margin-right:-16px}.woocommerce-summary .components-popover.components-popover .woocommerce-summary__item-container{margin-left:0;margin-right:0}}.woocommerce-summary__item-container{margin-bottom:0}.woocommerce-summary__item-container:last-of-type .woocommerce-summary__item{border-bottom-color:#ccd0d4!important}.woocommerce-summary__item-container.is-dropdown-button{padding:0;list-style:none;border-right:1px solid #ccd0d4}.woocommerce-summary__item-container.is-dropdown-button .components-button{border-bottom:1px solid #ccd0d4;text-align:left;display:block}@media (max-width:782px){.woocommerce-summary__item-container.is-dropdown-button{border-right:none}}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-label{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;margin-top:2.2px;max-width:110px;width:70%}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-label:after{content:"\00a0"}@media screen and (prefers-reduced-motion:reduce){.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-label{-webkit-animation:none;animation:none}}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-data{-webkit-box-pack:justify;justify-content:space-between}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;min-width:auto}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value:after,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value:after{content:"\00a0"}@media screen and (prefers-reduced-motion:reduce){.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value,.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value{-webkit-animation:none;animation:none}}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-value{margin-top:2.2px;max-width:60px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-delta-value{margin-top:2.2px;width:50px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-label{width:80px}.woocommerce-summary__item-container.is-placeholder .woocommerce-summary__item-prev-value{width:40px}.woocommerce-summary__item{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;height:100%;padding:16px;background-color:#f8f9f9;border-bottom:1px solid #e2e4e7;border-right:1px solid #e2e4e7;line-height:1.4em;text-decoration:none}.woocommerce-summary__item:hover{background-color:#f3f4f5}.woocommerce-summary__item:active{background-color:#edeff0}.woocommerce-summary__item:focus{box-shadow:inset -1px -1px 0 #6c7781,inset 1px 1px 0 #6c7781!important}.woocommerce-summary__item.is-selected:focus{box-shadow:inset -1px -1px 0 #6c7781,inset 1px 0 0 #6c7781,inset 0 4px 0 #95588a!important}.is-dropdown-button .woocommerce-summary__item{position:relative;width:100%;padding-right:56px}@media (max-width:782px){.is-dropdown-button .woocommerce-summary__item{border-right:none}}.woocommerce-summary__item .woocommerce-summary__item-data{margin-top:auto}.woocommerce-summary__item .woocommerce-summary__item-label{display:block;margin-bottom:16px;font-size:11px;font-size:.6875rem;text-transform:uppercase;color:#6c7781}.woocommerce-summary__item .woocommerce-summary__item-value{margin-bottom:4px;font-size:18px;font-size:1.125rem;font-weight:500;color:#191e23}.woocommerce-summary__item .woocommerce-summary__item-delta{margin-bottom:12px;font-size:18px;font-size:1.125rem;font-weight:300;color:#555d66}.woocommerce-summary__item.is-selected{background:#fff;box-shadow:inset 0 4px 0 #95588a}.woocommerce-summary__item.is-selected .woocommerce-summary__item-value{font-weight:600}.woocommerce-summary__item.is-selected .woocommerce-summary__item-delta{font-weight:400}.woocommerce-summary__item.is-good-trend .woocommerce-summary__item-delta{color:#4ab866}.woocommerce-summary__item.is-bad-trend .woocommerce-summary__item-delta{color:#d94f4f}.woocommerce-summary__item .woocommerce-summary__item-delta-icon{vertical-align:middle;margin-right:3px;fill:currentColor}.woocommerce-summary__item .woocommerce-summary__item-delta-icon.gridicons-arrow-up{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.woocommerce-summary__item .woocommerce-summary__item-delta-icon.gridicons-arrow-down{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.woocommerce-summary__item .woocommerce-summary__item-prev-label,.woocommerce-summary__item .woocommerce-summary__item-prev-value{font-size:13px;font-size:.8125rem;color:#555d66;display:inline-block}.woocommerce-summary__item .woocommerce-summary__toggle{position:absolute;top:44px;right:16px;-webkit-transition:-webkit-transform .2s ease;transition:-webkit-transform .2s ease;transition:transform .2s ease;transition:transform .2s ease,-webkit-transform .2s ease}@media screen and (prefers-reduced-motion:reduce){.woocommerce-summary__item .woocommerce-summary__toggle{-webkit-transition:none;transition:none}}.is-dropdown-expanded .woocommerce-summary__item .woocommerce-summary__toggle{-webkit-transform:rotate(-180deg);transform:rotate(-180deg)}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-label{margin-bottom:0}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-delta,.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-value{font-size:13px;font-size:.8125rem;margin-bottom:0}.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-prev-label,.components-popover__content .woocommerce-summary__item .woocommerce-summary__item-prev-value{font-size:11px;font-size:.6875rem}.woocommerce-table .woocommerce-card__body{padding:0;position:relative}.woocommerce-table .woocommerce-search{-webkit-box-flex:1;flex-grow:1}.woocommerce-table .woocommerce-card__action{justify-self:flex-end;margin:-13px 0}.woocommerce-table .woocommerce-card__menu{justify-self:flex-end}.woocommerce-table.has-compare .woocommerce-card__action,.woocommerce-table.has-search .woocommerce-card__action{-webkit-box-align:center;align-items:center;text-align:left;display:-ms-grid;display:grid;width:100%;-ms-grid-columns:auto 1fr auto;grid-template-columns:auto 1fr auto}@media (max-width:960px){.woocommerce-table.has-compare .woocommerce-card__action,.woocommerce-table.has-search .woocommerce-card__action{-ms-grid-row:1;-ms-grid-row-span:2;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:1/1/3/4;grid-gap:12px;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px;margin:0}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-table__compare,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-table__compare{display:-webkit-box;display:flex;-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:1;-ms-grid-column-span:1;grid-area:2/1/3/2}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-search{-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:2;grid-area:2/2/3/4;margin-right:0}.woocommerce-table.has-compare .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row:1;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:1;grid-area:1/2/2/3;-ms-grid-column-align:end;justify-self:end;margin:-6px 0}}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action{-ms-grid-columns:1fr auto;grid-template-columns:1fr auto}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search{-ms-grid-row-align:center;align-self:center;-ms-grid-column:1;grid-column-start:1;-ms-grid-column-span:1;grid-column-end:2}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row-align:center;align-self:center;-ms-grid-column:2;grid-column-start:2;-ms-grid-column-span:1;grid-column-end:3}@media (max-width:960px){.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action{-ms-grid-row:1;-ms-grid-row-span:2;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:1/1/3/4;-ms-grid-columns:auto 1fr 24px;grid-template-columns:auto 1fr 24px}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-search{-ms-grid-row:2;-ms-grid-row-span:1;-ms-grid-column:1;-ms-grid-column-span:3;grid-area:2/1/3/4;margin-left:0}.woocommerce-table.has-compare.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button,.woocommerce-table.has-search.has-search:not(.has-compare) .woocommerce-card__action .woocommerce-table__download-button{-ms-grid-row:1;-ms-grid-row-span:1;-ms-grid-column:2;-ms-grid-column-span:1;grid-area:1/2/2/3}}.woocommerce-table.has-compare .woocommerce-search,.woocommerce-table.has-search .woocommerce-search{margin:0 16px}.woocommerce-table.has-compare .woocommerce-compare-button,.woocommerce-table.has-search .woocommerce-compare-button{padding:3px 12px;height:auto}.woocommerce-table.is-empty{-webkit-box-align:center;align-items:center;background:#f8f9f9;color:#555d66;display:-webkit-box;display:flex;height:calc(17px + 1.1375rem + 165px + 5.6875rem);height:calc(17px + 1.1375rem + (33px + 1.1375rem)*var(--number-of-rows));-webkit-box-pack:center;justify-content:center;padding:16px;text-align:center}.woocommerce-table button.woocommerce-table__download-button.is-link{padding:6px 12px;color:#000;text-decoration:none}.woocommerce-table button.woocommerce-table__download-button.is-link svg{margin-right:8px;height:24px;width:24px}@media (max-width:782px){.woocommerce-table button.woocommerce-table__download-button.is-link svg{margin-right:0}.woocommerce-table button.woocommerce-table__download-button.is-link .woocommerce-table__download-button__label{display:none}}.woocommerce-table .woocommerce-pagination{padding-top:16px;padding-bottom:16px;z-index:1;background:#fff;position:relative}.woocommerce-table__caption{font-size:24px;font-size:1.5rem;text-align:left}.woocommerce-table__table{overflow-x:auto}.woocommerce-table__table:after{content:"";position:absolute;right:0;top:0;width:41px;height:100%;background:-webkit-gradient(linear,left top,right top,from(transparent),to(rgba(0,0,0,.2)));background:linear-gradient(90deg,transparent,rgba(0,0,0,.2));opacity:0;pointer-events:none;-webkit-transition:opacity .3s;transition:opacity .3s}.woocommerce-table__table.is-scrollable:after{opacity:1}.woocommerce-table__table table{border-collapse:collapse;width:100%}.woocommerce-table__table tr:focus-within,.woocommerce-table__table tr:hover{background-color:#f3f4f5}.woocommerce-table__table tr:focus-within td,.woocommerce-table__table tr:focus-within th,.woocommerce-table__table tr:hover td,.woocommerce-table__table tr:hover th{background:transparent}.woocommerce-table__header,.woocommerce-table__item{font-size:13px;font-size:.8125rem;padding:16px 24px;border-bottom:1px solid #e2e4e7;text-align:left}.woocommerce-table__header>a:only-child,.woocommerce-table__item>a:only-child{display:block}.woocommerce-table__header a:focus,.woocommerce-table__header a:hover,.woocommerce-table__item a:focus,.woocommerce-table__item a:hover{color:#622557}.woocommerce-table__header .is-placeholder,.woocommerce-table__item .is-placeholder{-webkit-animation:loading-fade 1.6s ease-in-out infinite;animation:loading-fade 1.6s ease-in-out infinite;background-color:#e2e4e7;color:transparent;display:inline-block;height:16px;max-width:120px;width:80%}.woocommerce-table__header .is-placeholder:after,.woocommerce-table__item .is-placeholder:after{content:"\00a0"}@media screen and (prefers-reduced-motion:reduce){.woocommerce-table__header .is-placeholder,.woocommerce-table__item .is-placeholder{-webkit-animation:none;animation:none}}.woocommerce-table__header:not(.is-left-aligned),.woocommerce-table__item:not(.is-left-aligned){text-align:right}.woocommerce-table__header:not(.is-left-aligned) button,.woocommerce-table__item:not(.is-left-aligned) button{-webkit-box-pack:end;justify-content:flex-end}.woocommerce-table__header.is-numeric .is-placeholder,.woocommerce-table__item.is-numeric .is-placeholder{max-width:40px}.woocommerce-table__header .is-negative,.woocommerce-table__item .is-negative{color:#d94f4f;font-weight:700}.woocommerce-table__header.is-sorted,.woocommerce-table__item.is-sorted{background-color:#f8f9f9}.woocommerce-table__header.is-checkbox-column,.woocommerce-table__item.is-checkbox-column{width:33px;max-width:33px;padding-right:0;padding-left:16px}.woocommerce-table__header.is-checkbox-column+th,.woocommerce-table__item.is-checkbox-column+th{border-left:0}th.woocommerce-table__item{font-weight:400}.woocommerce-table__header{padding:8px 24px;background-color:#f8f9fa;border-bottom:1px solid #ccd0d4;font-weight:700;white-space:nowrap}.woocommerce-table__header+.woocommerce-table__header{border-left:1px solid #ccd0d4}.woocommerce-table__header.is-left-aligned.is-sortable{padding-left:16px}.woocommerce-table__header.is-left-aligned.is-sortable svg{display:-webkit-inline-box;display:inline-flex;-webkit-box-ordinal-group:2;order:1;margin-left:0}.woocommerce-table__header .components-button.is-button{height:auto;width:100%;padding:8px 24px 8px 0;vertical-align:middle;line-height:1;border:none;background:transparent;box-shadow:none!important}.woocommerce-table__header .components-button.is-button:hover{box-shadow:none!important}.woocommerce-table__header .components-button.is-button:active{box-shadow:none!important}.woocommerce-table__header.is-sortable{padding:0}.woocommerce-table__header.is-sortable .gridicon{visibility:hidden;margin-left:4px}.woocommerce-table__header.is-sortable .components-button:focus .gridicon,.woocommerce-table__header.is-sortable .components-button:hover .gridicon,.woocommerce-table__header.is-sortable.is-sorted .components-button .gridicon{visibility:visible}.woocommerce-table__summary{margin:0;padding:16px 0;text-align:center;z-index:1;background:#fff;position:relative}.woocommerce-table__summary-item{display:inline-block;margin-bottom:0;margin-left:8px;margin-right:8px}.woocommerce-table__summary-item .woocommerce-table__summary-label,.woocommerce-table__summary-item .woocommerce-table__summary-value{display:inline-block}.woocommerce-table__summary-item .woocommerce-table__summary-label{margin-left:4px}.woocommerce-table__summary-item .woocommerce-table__summary-value{font-weight:600}.woocommerce-tag{display:-webkit-inline-box;display:inline-flex;margin:1px 4px 1px 0;overflow:hidden;vertical-align:middle}.woocommerce-tag .woocommerce-tag__remove.components-icon-button,.woocommerce-tag .woocommerce-tag__text{display:inline-block;line-height:24px;background:#e2e4e7;-webkit-transition:all .2s cubic-bezier(.4,1,.4,1);transition:all .2s cubic-bezier(.4,1,.4,1)}.woocommerce-tag .woocommerce-tag__text{-ms-grid-row-align:center;align-self:center;padding:0 8px;border-radius:12px;color:#555d66;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.woocommerce-tag.has-remove .woocommerce-tag__text{padding:0 4px 0 8px;border-radius:12px 0 0 12px}.woocommerce-tag .woocommerce-tag__remove.components-icon-button{cursor:pointer;padding:0 2px;border-radius:0 12px 12px 0;color:#555d66;line-height:10px;text-indent:0}.woocommerce-tag .woocommerce-tag__remove.components-icon-button:hover{color:#32373c}.text-control-with-affixes{display:-webkit-inline-box;display:inline-flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;flex-direction:row;width:100%}.text-control-with-affixes input[type=email],.text-control-with-affixes input[type=number],.text-control-with-affixes input[type=password],.text-control-with-affixes input[type=text],.text-control-with-affixes input[type=url]{-webkit-box-flex:1;flex-grow:1;margin:0}.text-control-with-affixes input[type=email]:disabled,.text-control-with-affixes input[type=number]:disabled,.text-control-with-affixes input[type=password]:disabled,.text-control-with-affixes input[type=text]:disabled,.text-control-with-affixes input[type=url]:disabled{border-right-width:0}.text-control-with-affixes input[type=email]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=number]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=password]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=text]:disabled+.text-control-with-affixes__suffix,.text-control-with-affixes input[type=url]:disabled+.text-control-with-affixes__suffix{border-left:1px solid #e2e4e7}.text-control-with-affixes__prefix,.text-control-with-affixes__suffix{position:relative;background:#fff;border:1px solid #e2e4e7;color:#555d66;padding:7px 14px;white-space:nowrap;-webkit-box-flex:1;flex:1 0 auto;font-size:14px;line-height:1.5}.text-control-with-affixes__prefix{border-right:none}.text-control-with-affixes__prefix+input[type=email]:disabled,.text-control-with-affixes__prefix+input[type=number]:disabled,.text-control-with-affixes__prefix+input[type=password]:disabled,.text-control-with-affixes__prefix+input[type=text]:disabled,.text-control-with-affixes__prefix+input[type=url]:disabled{border-left-color:#e2e4e7;border-right-width:1px}.text-control-with-affixes__suffix{border-left:none}.woocommerce-view-more-list{padding-left:4px;margin:0 0 0 4px;vertical-align:middle}.woocommerce-view-more-list__popover{margin:0;padding:16px;text-align:left}.woocommerce-view-more-list__popover__item{display:block;margin:16px 0}.woocommerce-view-more-list__popover__item:first-child{margin-top:0}.woocommerce-view-more-list__popover__item:last-child{margin-bottom:0}.woocommerce-web-preview{width:100%;display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;-webkit-box-pack:center;justify-content:center;background:#f6f6f6}.woocommerce-web-preview.is-loading .woocommerce-web-preview__iframe-wrapper{display:none}.woocommerce-web-preview .woocommerce-web-preview__iframe-wrapper{width:100%}.woocommerce-web-preview iframe{width:100%;height:100%;min-height:400px}
|
2 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.editor-block-preview__content{overflow:hidden}.components-placeholder__label .gridicon,.components-placeholder__label .material-icon{margin-right:1ch;fill:currentColor}.editor-styles-wrapper .wc-block-grid .wc-block-grid__products{list-style:none;margin:0}.editor-styles-wrapper .wc-block-grid .wc-block-grid__products .wp-block-button__link{color:inherit}.editor-styles-wrapper .wc-block-grid.components-placeholder{padding:2em 1em}.editor-styles-wrapper .wc-block-grid.is-loading,.editor-styles-wrapper .wc-block-grid.is-not-found{display:block}.wc-block-api-error .components-placeholder__fieldset{display:block;margin:0;padding:0}.wc-block-api-error .wc-block-error__message{margin-bottom:16px}.wc-block-api-error .components-spinner{float:none}
|
3 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-handpicked-products__selection{width:100%}
|
4 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-products-category__selection{width:100%}.wc-block-products-category__cancel-button.is-tertiary{margin:1em auto 0;display:block;text-align:center;font-size:1em}
|
5 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-product-categories.wc-block-product-categories ul{margin-left:20px}.wc-block-product-categories .components-placeholder__label svg{margin-right:1ch;fill:currentColor}
|
6 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-products-by-attribute__selection{width:100%}
|
7 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-featured-product.components-placeholder{background-color:rgba(139,139,150,.1)}.wc-block-featured-product .components-resizable-box__handle{z-index:10}.wc-block-featured-product__message{margin-bottom:16px}.wc-block-featured-product__selection{width:100%}
|
8 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-reviews__selection{width:100%}.components-base-control+.wc-block-reviews__notice{margin:-16px 0 16px}.components-base-control:nth-last-child(2)+.wc-block-reviews__notice{margin:-16px 0 12px}
|
9 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-product-search__field.input-control{color:#828b96!important}.wc-block-product-search .wc-block-product-search__fields .block-editor-rich-text{-webkit-box-flex:1;flex-grow:1}
|
10 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-product-tag__selection{width:100%}.wc-block-product-tag__cancel-button.is-tertiary{margin:1em auto 0;display:block;text-align:center;font-size:1em}
|
11 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-featured-category.components-placeholder{background-color:rgba(139,139,150,.1)}.wc-block-featured-category .components-resizable-box__handle{z-index:10}.wc-block-featured-category .components-placeholder__label svg{fill:currentColor;margin-right:1ch}.wc-block-featured-category__selection{width:100%}
|
|
|
|
|
|
build/featured-category.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-escape-html","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/featured-category.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-category"]=function(e){function t(t){for(var n,a,i=t[0],l=t[1],s=t[2],d=0,b=[];d<i.length;d++)a=i[d],c[a]&&b.push(c[a][0]),c[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(u&&u(t);b.length;)b.shift()();return r.push.apply(r,s||[]),o()}function o(){for(var e,t=0;t<r.length;t++){for(var o=r[t],n=!0,i=1;i<o.length;i++){var l=o[i];0!==c[l]&&(n=!1)}n&&(r.splice(t--,1),e=a(a.s=o[0]))}return e}var n={},c={4:0},r=[];function a(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=n,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return r.push([520,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},28:function(e,t,o){"use strict";var n=o(0),c=o(3),r=function(){return Object(n.createElement)(c.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(n.createElement)(c.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(n.createElement)(c.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},l=function(){return Object(n.createElement)(c.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(n.createElement)(c.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(c.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},d=o(6),b=o.n(d),g=o(4),p=o.n(g),h=function(e){var t=e.size,o=void 0===t?20:t,r=e.className;return Object(n.createElement)(c.Icon,{className:b()("woo-icon",r),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:o,width:Math.floor(1.67*o),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};h.propTypes={size:p.a.number,className:p.a.string};var m=h;o.d(t,"a",function(){return r}),o.d(t,"b",function(){return a}),o.d(t,"c",function(){return i}),o.d(t,"d",function(){return l}),o.d(t,"e",function(){return s}),o.d(t,"f",function(){return u}),o.d(t,"g",function(){return m})},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var n=o(27),c=o.n(n),r=o(13),a=o.n(r),i=o(14),l=o.n(i),s=o(15),u=o.n(s),d=o(16),b=o.n(d),g=o(12),p=o.n(g),h=o(17),m=o.n(h),f=o(0),w=o(1),O=o(19),v=o(10),j=o.n(v),y=o(5),_=o(4),k=o.n(_),E=o(24),C=o(3),x=(o(79),function(e){function t(){var e;return a()(this,t),(e=u()(this,b()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(p()(e)),e}return m()(t,e),l()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(O.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,n=e.depth,r=void 0===n?0:n,a=["woocommerce-product-categories__item"];o.length&&a.push("is-searching"),0===r&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(f.createElement)(E.b,c()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(w.sprintf)(Object(w._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,n=this.props,c=n.onChange,r=n.onOperatorChange,a=n.operator,i=n.selected,l=n.isSingle,s={clear:Object(w.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(w.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(w.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(w.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(w.sprintf)(Object(w._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(w.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(E.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:i.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:c,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:l}),!!r&&Object(f.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(f.createElement)(C.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(w.__)("Display products matching","woo-gutenberg-products-block"),help:Object(w.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:r,options:[{label:Object(w.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(w.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(f.Component));x.propTypes={onChange:k.a.func.isRequired,onOperatorChange:k.a.func,operator:k.a.oneOf(["all","any"]),selected:k.a.array.isRequired,isSingle:k.a.bool},x.defaultProps={operator:"any",isSingle:!1},t.a=x},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},510:function(e,t,o){var n=o(511);"string"==typeof n&&(n=[[e.i,n,""]]);var c={hmr:!0,transform:void 0,insertInto:void 0};o(38)(n,c);n.locals&&(e.exports=n.locals)},511:function(e,t,o){},52:function(e,t){!function(){e.exports=this.wp.date}()},520:function(e,t,o){"use strict";o.r(t);var n=o(0),c=o(1),r=o(9),a=o(18),i=(o(508),o(510),o(13)),l=o.n(i),s=o(14),u=o.n(s),d=o(15),b=o.n(d),g=o(16),p=o.n(g),h=o(12),m=o.n(h),f=o(17),w=o.n(f),O=o(10),v=o.n(O),j=o(3),y=o(6),_=o.n(y),k=o(22),E=o(5),C=o(4),x=o.n(C),S=o(28),M=o(37),I=wc_product_block_data.min_height;function z(e){return Object(E.isObject)(e.image)?e.image.src:""}var P=function(e){function t(){var e;return l()(this,t),(e=b()(this,p()(t).apply(this,arguments))).state={category:!1,loaded:!1},e.debouncedGetCategory=Object(E.debounce)(e.getCategory.bind(m()(e)),200),e}return w()(t,e),u()(t,[{key:"componentDidMount",value:function(){this.getCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.debouncedGetCategory()}},{key:"getCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?v()({path:"/wc/blocks/products/categories/".concat(t)}).then(function(t){e.setState({category:t,loaded:!0})}).catch(function(){e.setState({category:!1,loaded:!0})}):this.setState({category:!1,loaded:!0})}},{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,a=e.overlayColor,i=e.setOverlayColor,l=t.mediaSrc||z(this.state.category),s=t.focalPoint,u=void 0===s?{x:.5,y:.5}:s,d="function"==typeof j.FocalPointPicker;return Object(n.createElement)(r.InspectorControls,{key:"inspector"},Object(n.createElement)(j.PanelBody,{title:Object(c.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(j.ToggleControl,{label:Object(c.__)("Show description","woo-gutenberg-products-block"),checked:t.showDesc,onChange:function(){return o({showDesc:!t.showDesc})}})),Object(n.createElement)(r.PanelColorSettings,{title:Object(c.__)("Overlay","woo-gutenberg-products-block"),colorSettings:[{value:a.color,onChange:i,label:Object(c.__)("Overlay Color","woo-gutenberg-products-block")}]},!!l&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(j.RangeControl,{label:Object(c.__)("Background Opacity","woo-gutenberg-products-block"),value:t.dimRatio,onChange:function(e){return o({dimRatio:e})},min:0,max:100,step:10}),d&&Object(n.createElement)(j.FocalPointPicker,{label:Object(c.__)("Focal Point Picker"),url:l,value:u,onChange:function(e){return o({focalPoint:e})}}))))}},{key:"renderEditMode",value:function(){var e=this.props,t=e.attributes,o=e.debouncedSpeak,r=e.setAttributes;return Object(n.createElement)(j.Placeholder,{icon:Object(n.createElement)(S.b,null),label:Object(c.__)("Featured Category","woo-gutenberg-products-block"),className:"wc-block-featured-category"},Object(c.__)("Visually highlight a product category and encourage prompt action.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-featured-category__selection"},Object(n.createElement)(M.a,{selected:[t.categoryId],onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;r({categoryId:t,mediaId:0,mediaSrc:""})},isSingle:!0}),Object(n.createElement)(j.Button,{isDefault:!0,onClick:function(){r({editMode:!1}),o(Object(c.__)("Showing Featured Product block preview.","woo-gutenberg-products-block"))}},Object(c.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var e,t,o=this,a=this.props,i=a.attributes,l=a.isSelected,s=a.overlayColor,u=a.setAttributes,d=i.className,b=i.contentAlign,g=i.dimRatio,p=i.editMode,h=i.focalPoint,m=i.height,f=i.showDesc,w=this.state,O=w.loaded,v=w.category,y=_()("wc-block-featured-category",{"is-selected":l,"is-loading":!v&&!O,"is-not-found":!v&&O,"has-background-dim":0!==g},0===(e=g)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==b&&"has-".concat(b,"-content"),d),k=i.mediaId||function(e){return Object(E.isObject)(e.image)?e.image.id:0}(v),C=i.mediaSrc||z(this.state.category),x=v?(t=C)?{backgroundImage:"url(".concat(t,")")}:{}:{};s.color&&(x.backgroundColor=s.color),h&&(x.backgroundPosition="".concat(100*h.x,"% ").concat(100*h.y,"%"));return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(r.BlockControls,null,Object(n.createElement)(r.AlignmentToolbar,{value:b,onChange:function(e){u({contentAlign:e})}}),Object(n.createElement)(r.MediaUploadCheck,null,Object(n.createElement)(j.Toolbar,null,Object(n.createElement)(r.MediaUpload,{onSelect:function(e){u({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"],value:k,render:function(e){var t=e.open;return Object(n.createElement)(j.IconButton,{className:"components-toolbar__control",label:Object(c.__)("Edit media"),icon:"format-image",onClick:t,disabled:!o.state.category})}})))),!i.editMode&&this.getInspectorControls(),p?this.renderEditMode():Object(n.createElement)(n.Fragment,null,v?Object(n.createElement)(j.ResizableBox,{className:y,size:{height:m},minHeight:I,enable:{bottom:!0},onResizeStop:function(e,t,o){u({height:parseInt(o.style.height)})},style:x},Object(n.createElement)("div",{className:"wc-block-featured-category__wrapper"},Object(n.createElement)("h2",{className:"wc-block-featured-category__title",dangerouslySetInnerHTML:{__html:v.name}}),f&&Object(n.createElement)("div",{className:"wc-block-featured-category__description",dangerouslySetInnerHTML:{__html:v.description}}),Object(n.createElement)("div",{className:"wc-block-featured-category__link"},Object(n.createElement)(r.InnerBlocks,{template:[["core/button",{text:Object(c.__)("Shop now","woo-gutenberg-products-block"),url:v.permalink,align:"center"}]],templateLock:"all"})))):Object(n.createElement)(j.Placeholder,{className:"wc-block-featured-category",icon:Object(n.createElement)(S.b,null),label:Object(c.__)("Featured Category","woo-gutenberg-products-block")},O?Object(c.__)("No product category is selected.","woo-gutenberg-products-block"):Object(n.createElement)(j.Spinner,null))))}}]),t}(n.Component);P.propTypes={attributes:x.a.object.isRequired,isSelected:x.a.bool.isRequired,name:x.a.string.isRequired,setAttributes:x.a.func.isRequired,overlayColor:x.a.object,setOverlayColor:x.a.func.isRequired,debouncedSpeak:x.a.func.isRequired};var B=Object(k.compose)([Object(r.withColors)({overlayColor:"background-color"}),j.withSpokenMessages])(P);Object(a.registerBlockType)("woocommerce/featured-category",{title:Object(c.__)("Featured Category","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(S.b,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(c.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(c.__)("Visually highlight a product category and encourage prompt action.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:wc_product_block_data.default_height},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(c.__)("Shop now","woo-gutenberg-products-block")},categoryId:{type:"number"},showDesc:{type:"boolean",default:!0}},edit:function(e){return Object(n.createElement)(B,e)},save:function(){return Object(n.createElement)(r.InnerBlocks.Content,null)}})},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-category"]=function(e){function t(t){for(var c,a,l=t[0],i=t[1],s=t[2],d=0,b=[];d<l.length;d++)a=l[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c]);for(u&&u(t);b.length;)b.shift()();return r.push.apply(r,s||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],c=!0,l=1;l<n.length;l++){var i=n[l];0!==o[i]&&(c=!1)}c&&(r.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},o={5:0},r=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=i;return r.push([549,2,1,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,n){"use strict";var c=n(0),o=n(2),r=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(o.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(c.createElement)("g",null,Object(c.createElement)("g",null,Object(c.createElement)("path",{fill:n,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(c.createElement)("path",{fill:n,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(c.createElement)("path",{fill:n,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},l=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(c.createElement)(o.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},d=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(o.Icon,{className:t,icon:Object(c.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)("path",{fill:n,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(c.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},b=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(o.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(c.createElement)("path",{fill:n,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(c.createElement)("path",{fill:n,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(c.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},p=function(){return Object(c.createElement)(o.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},g=n(6),h=n.n(g),f=(n(7),function(e){var t=e.size,n=void 0===t?20:t,r=e.className;return Object(c.createElement)(o.Icon,{className:h()("woo-icon",r),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return l}),n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"h",function(){return d}),n.d(t,"g",function(){return b}),n.d(t,"i",function(){return p}),n.d(t,"j",function(){return f})},25:function(e,t,n){"use strict";n.d(t,"d",function(){return b}),n.d(t,"b",function(){return p}),n.d(t,"c",function(){return g}),n.d(t,"a",function(){return h});var c=n(20),o=n.n(c),r=n(19),a=n(17),l=n.n(a),i=n(4),s=n(5);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,c)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(n,!0).forEach(function(t){o()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var b=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,o=void 0===c?"":c,a=e.queryArgs,u=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,o=void 0===c?"":c,a=e.queryArgs,l=void 0===a?[]:a,i={per_page:s.IS_LARGE_CATALOG?100:-1,catalog_visibility:"any",status:"publish",search:o,orderby:"title",order:"asc"},u=[Object(r.addQueryArgs)(s.ENDPOINTS.products,d({},i,{},l))];return s.IS_LARGE_CATALOG&&n.length&&u.push(Object(r.addQueryArgs)(s.ENDPOINTS.products,{catalog_visibility:"any",status:"publish",include:n})),u}({selected:n,search:o,queryArgs:void 0===a?[]:a});return Promise.all(u.map(function(e){return l()({path:e})})).then(function(e){return Object(i.uniqBy)(Object(i.flatten)(e),"id")})},p=function(e){return l()({path:"".concat(s.ENDPOINTS.products,"/").concat(e)})},g=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,o=[Object(r.addQueryArgs)("".concat(s.ENDPOINTS.products,"/tags"),{per_page:s.LIMIT_TAGS?100:-1,orderby:s.LIMIT_TAGS?"count":"name",order:s.LIMIT_TAGS?"desc":"asc",search:c})];return s.LIMIT_TAGS&&n.length&&o.push(Object(r.addQueryArgs)("".concat(s.ENDPOINTS.products,"/tags"),{include:n})),o}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return l()({path:e})})).then(function(e){return Object(i.uniqBy)(Object(i.flatten)(e),"id")})},h=function(e){return l()({path:"".concat(s.ENDPOINTS.categories,"/").concat(e)})}},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,n){"use strict";var c=n(16),o=n.n(c),r=n(8),a=n.n(r),l=n(9),i=n.n(l),s=n(10),u=n.n(s),d=n(11),b=n.n(d),p=n(15),g=n.n(p),h=n(12),f=n.n(h),m=n(0),O=n(1),j=n(19),w=n(17),v=n.n(w),y=n(4),E=(n(7),n(26)),_=n(2),k=n(5),C=(n(86),function(e){function t(){var e;return a()(this,t),(e=u()(this,b()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return f()(t,e),i()(t,[{key:"componentDidMount",value:function(){var e=this;v()({path:Object(j.addQueryArgs)("".concat(k.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,n=e.search,c=e.depth,r=void 0===c?0:c,a=["woocommerce-product-categories__item"];n.length&&a.push("is-searching"),0===r&&0!==t.parent&&a.push("is-skip-level");var l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(m.createElement)(E.b,o()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(O.sprintf)(Object(O._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),l,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,n=e.loading,c=this.props,o=c.onChange,r=c.onOperatorChange,a=c.operator,l=c.selected,i=c.isSingle,s={clear:Object(O.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(O.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(O.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(O.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(O.sprintf)(Object(O._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(O.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(E.a,{className:"woocommerce-product-categories",list:t,isLoading:n,selected:l.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:o,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:i}),!!r&&Object(m.createElement)("div",{className:l.length<2?"screen-reader-text":""},Object(m.createElement)(_.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(O.__)("Display products matching","woo-gutenberg-products-block"),help:Object(O.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:r,options:[{label:Object(O.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(O.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(m.Component));C.defaultProps={operator:"any",isSingle:!1},t.a=C},44:function(e,t){!function(){e.exports=this.ReactDOM}()},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},52:function(e,t,n){"use strict";var c=n(0),o=n(1),r=(n(7),n(29)),a=n.n(r),l=n(6),i=n.n(l),s=n(39),u=n(2);t.a=function(e){var t,n,r=e.className,l=e.error,d=e.isLoading,b=e.onRetry;return Object(c.createElement)(u.Placeholder,{icon:Object(c.createElement)(a.a,{icon:"notice"}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:i()("wc-block-api-error",r)},Object(c.createElement)("div",{className:"wc-block-error__message"},(n=(t=l).apiMessage,t.message||(n?Object(c.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(c.createElement)("br",null),Object(c.createElement)("code",null,Object(s.escapeHTML)(n))):Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))),b&&Object(c.createElement)(c.Fragment,null,d?Object(c.createElement)(u.Spinner,null):Object(c.createElement)(u.Button,{isDefault:!0,onClick:b},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},543:function(e,t,n){var c=n(544);"string"==typeof c&&(c=[[e.i,c,""]]);var o={insert:"head",singleton:!1};n(35)(c,o);c.locals&&(e.exports=c.locals)},544:function(e,t,n){},549:function(e,t,n){"use strict";n.r(t);var c=n(0),o=n(1),r=n(18),a=n(23),l=n(5),i=(n(541),n(543),n(2)),s=n(6),u=n.n(s),d=n(21),b=(n(7),n(24)),p=n(41),g=n(52),h=n(4);function f(e){return e&&Object(h.isObject)(e.image)?e.image.src:""}var m=n(71),O=Object(d.compose)([m.a,Object(r.withColors)({overlayColor:"background-color"}),i.withSpokenMessages])(function(e){var t,n,a,s,d,m,O=e.attributes,j=e.isSelected,w=e.setAttributes,v=e.error,y=e.getCategory,E=e.isLoading,_=e.category,k=e.overlayColor,C=e.setOverlayColor,S=e.debouncedSpeak,M=O.editMode;return v?Object(c.createElement)(g.a,{className:"wc-block-featured-category-error",error:v,isLoading:E,onRetry:y}):M?Object(c.createElement)(i.Placeholder,{icon:Object(c.createElement)(b.c,null),label:Object(o.__)("Featured Category","woo-gutenberg-products-block"),className:"wc-block-featured-category"},Object(o.__)("Visually highlight a product category and encourage prompt action.","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-featured-category__selection"},Object(c.createElement)(p.a,{selected:[O.categoryId],onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;w({categoryId:t,mediaId:0,mediaSrc:""})},isSingle:!0}),Object(c.createElement)(i.Button,{isDefault:!0,onClick:function(){w({editMode:!1}),S(Object(o.__)("Showing Featured Product block preview.","woo-gutenberg-products-block"))}},Object(o.__)("Done","woo-gutenberg-products-block")))):Object(c.createElement)(c.Fragment,null,(d=O.contentAlign,m=O.mediaId||function(e){return e&&Object(h.isObject)(e.image)?e.image.id:0}(_),Object(c.createElement)(r.BlockControls,null,Object(c.createElement)(r.AlignmentToolbar,{value:d,onChange:function(e){w({contentAlign:e})}}),Object(c.createElement)(r.MediaUploadCheck,null,Object(c.createElement)(i.Toolbar,null,Object(c.createElement)(r.MediaUpload,{onSelect:function(e){w({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"],value:m,render:function(e){var t=e.open;return Object(c.createElement)(i.IconButton,{className:"components-toolbar__control",label:Object(o.__)("Edit media"),icon:"format-image",onClick:t,disabled:!_})}}))))),(t=O.mediaSrc||f(_),n=O.focalPoint,a=void 0===n?{x:.5,y:.5}:n,s="function"==typeof i.FocalPointPicker,Object(c.createElement)(r.InspectorControls,{key:"inspector"},Object(c.createElement)(i.PanelBody,{title:Object(o.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(i.ToggleControl,{label:Object(o.__)("Show description","woo-gutenberg-products-block"),checked:O.showDesc,onChange:function(){return w({showDesc:!O.showDesc})}})),Object(c.createElement)(r.PanelColorSettings,{title:Object(o.__)("Overlay","woo-gutenberg-products-block"),colorSettings:[{value:k.color,onChange:C,label:Object(o.__)("Overlay Color","woo-gutenberg-products-block")}]},!!t&&Object(c.createElement)(c.Fragment,null,Object(c.createElement)(i.RangeControl,{label:Object(o.__)("Background Opacity","woo-gutenberg-products-block"),value:O.dimRatio,onChange:function(e){return w({dimRatio:e})},min:0,max:100,step:10}),s&&Object(c.createElement)(i.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:t,value:a,onChange:function(e){return w({focalPoint:e})}}))))),_?function(){var e,t,n=O.className,a=O.contentAlign,s=O.dimRatio,d=O.focalPoint,b=O.height,p=O.showDesc,g=u()("wc-block-featured-category",{"is-selected":j,"is-loading":!_&&E,"is-not-found":!_&&!E,"has-background-dim":0!==s},0===(e=s)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==a&&"has-".concat(a,"-content"),n),h=O.mediaSrc||f(_),m=_?(t=h)?{backgroundImage:"url(".concat(t,")")}:{}:{};k.color&&(m.backgroundColor=k.color),d&&(m.backgroundPosition="".concat(100*d.x,"% ").concat(100*d.y,"%"));return Object(c.createElement)(i.ResizableBox,{className:g,size:{height:b},minHeight:l.MIN_HEIGHT,enable:{bottom:!0},onResizeStop:function(e,t,n){w({height:parseInt(n.style.height)})},style:m},Object(c.createElement)("div",{className:"wc-block-featured-category__wrapper"},Object(c.createElement)("h2",{className:"wc-block-featured-category__title",dangerouslySetInnerHTML:{__html:_.name}}),p&&Object(c.createElement)("div",{className:"wc-block-featured-category__description",dangerouslySetInnerHTML:{__html:_.description}}),Object(c.createElement)("div",{className:"wc-block-featured-category__link"},Object(c.createElement)(r.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now","woo-gutenberg-products-block"),url:_.permalink,align:"center"}]],templateLock:"all"}))))}():Object(c.createElement)(i.Placeholder,{className:"wc-block-featured-category",icon:Object(c.createElement)(b.c,null),label:Object(o.__)("Featured Category","woo-gutenberg-products-block")},E?Object(c.createElement)(i.Spinner,null):Object(o.__)("No product category is selected.","woo-gutenberg-products-block")))});Object(a.registerBlockType)("woocommerce/featured-category",{title:Object(o.__)("Featured Category","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(b.c,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Visually highlight a product category and encourage prompt action.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:l.DEFAULT_HEIGHT},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(o.__)("Shop now","woo-gutenberg-products-block")},categoryId:{type:"number"},showDesc:{type:"boolean",default:!0}},edit:function(e){return Object(c.createElement)(O,e)},save:function(){return Object(c.createElement)(r.InnerBlocks.Content,null)}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},71:function(e,t,n){"use strict";var c=n(16),o=n.n(c),r=n(38),a=n.n(r),l=n(8),i=n.n(l),s=n(9),u=n.n(s),d=n(10),b=n.n(d),p=n(11),g=n.n(p),h=n(15),f=n.n(h),m=n(12),O=n.n(m),j=n(0),w=n(21),v=n(25),y=Object(w.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,product:null},e.loadProduct=e.loadProduct.bind(f()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"loadProduct",value:function(){var e=this,t=this.props.attributes.productId;t?(this.setState({loading:!0}),Object(v.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({product:null,loading:!1,error:n})})):this.setState({product:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,r=t.product;return Object(j.createElement)(e,o()({},this.props,{error:n,getProduct:this.loadProduct,isLoading:c,product:r}))}}]),n}(j.Component)},"withProduct"),E=Object(w.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,category:null},e.loadCategory=e.loadCategory.bind(f()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?(this.setState({loading:!0}),Object(v.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({category:null,loading:!1,error:n})})):this.setState({category:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,r=t.category;return Object(j.createElement)(e,o()({},this.props,{error:n,getCategory:this.loadCategory,isLoading:c,category:r}))}}]),n}(j.Component)},"withCategory"),_=n(4),k=(n(7),n(5)),C=Object(w.createHigherOrderComponent)(function(e){var t=function(t){function n(){var e;return i()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(_.debounce)(e.onSearch.bind(f()(e)),400),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(v.d)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(v.d)({selected:n,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var t=this.state,n=t.list,c=t.loading,r=this.props.selected;return Object(j.createElement)(e,o()({},this.props,{products:n,isLoading:c,selected:n.filter(function(e){var t=e.id;return r.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),n}(j.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");n.d(t,"b",function(){return y}),n.d(t,"a",function(){return E}),n.d(t,"c",function(){return C})}});
|
build/featured-product.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-escape-html","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/featured-product.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(e){function t(t){for(var c,a,i=t[0],s=t[1],l=t[2],d=0,p=[];d<i.length;d++)a=i[d],o[a]&&p.push(o[a][0]),o[a]=0;for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&(e[c]=s[c]);for(u&&u(t);p.length;)p.shift()();return r.push.apply(r,l||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],c=!0,i=1;i<n.length;i++){var s=n[i];0!==o[s]&&(c=!1)}c&&(r.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},o={5:0},r=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;return r.push([513,0,2,1]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},28:function(e,t,n){"use strict";var c=n(0),o=n(3),r=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(c.createElement)(o.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},l=function(){return Object(c.createElement)(o.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(o.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},d=n(6),p=n.n(d),b=n(4),h=n.n(b),m=function(e){var t=e.size,n=void 0===t?20:t,r=e.className;return Object(c.createElement)(o.Icon,{className:p()("woo-icon",r),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};m.propTypes={size:h.a.number,className:h.a.string};var f=m;n.d(t,"a",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return s}),n.d(t,"e",function(){return l}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return f})},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},36:function(e,t){!function(){e.exports=this.ReactDOM}()},39:function(e,t){!function(){e.exports=this.wp.viewport}()},43:function(e,t,n){"use strict";n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"c",function(){return l}),n.d(t,"b",function(){return u}),n.d(t,"a",function(){return d});var c=n(19),o=n(10),r=n.n(o),a=n(5),i=wc_product_block_data.isLargeCatalog||!1,s=wc_product_block_data.limitTags||!1,l=wc_product_block_data.hasTags||!1,u=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,o=e.search,r=[Object(c.addQueryArgs)("/wc/blocks/products",{per_page:i?100:-1,catalog_visibility:"visible",status:"publish",search:o})];return i&&n.length&&r.push(Object(c.addQueryArgs)("/wc/blocks/products",{catalog_visibility:"visible",status:"publish",include:n})),r}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return r()({path:e})})).then(function(e){return Object(a.uniqBy)(Object(a.flatten)(e),"id")})},d=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,o=e.search,r=[Object(c.addQueryArgs)("/wc/blocks/products/tags",{per_page:s?100:-1,orderby:s?"count":"name",order:s?"desc":"asc",search:o})];return s&&n.length&&r.push(Object(c.addQueryArgs)("/wc/blocks/products/tags",{include:n})),r}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return r()({path:e})})).then(function(e){return Object(a.uniqBy)(Object(a.flatten)(e),"id")})}},46:function(e,t){!function(){e.exports=this.wp.hooks}()},5:function(e,t){!function(){e.exports=this.lodash}()},500:function(e,t,n){var c=n(501);"string"==typeof c&&(c=[[e.i,c,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(38)(c,o);c.locals&&(e.exports=c.locals)},501:function(e,t,n){},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},513:function(e,t,n){"use strict";n.r(t);var c=n(0),o=n(1),r=n(9),a=n(18),i=(n(498),n(500),n(13)),s=n.n(i),l=n(14),u=n.n(l),d=n(15),p=n.n(d),b=n(16),h=n.n(b),m=n(12),f=n.n(m),g=n(17),v=n.n(g),w=n(10),O=n.n(w),j=n(3),_=n(6),k=n.n(_),y=n(22),E=n(5),S=n(4),x=n.n(S),C=n(60),P=n.n(C),M=n(27),I=n.n(M),z=n(92),L=n.n(z),N=n(8),B=n.n(N),R=n(19),T=n(24),H=n(43),A=n(28);n(502);function F(e,t){if(!t)return e;var n=new RegExp(Object(E.escapeRegExp)(t),"ig");return e.replace(n,"<strong>$&</strong>")}var D=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(c.createElement)(A.d,null):Object(c.createElement)(A.e,null)},q=function(e){function t(){var e;return s()(this,t),(e=p()(this,h()(t).apply(this,arguments))).state={products:[],product:0,variationsList:{},variationsLoading:!1,loading:!0},e.debouncedOnSearch=Object(E.debounce)(e.onSearch.bind(f()(e)),400),e.debouncedGetVariations=Object(E.debounce)(e.getVariations.bind(f()(e)),200),e.renderItem=e.renderItem.bind(f()(e)),e.onProductSelect=e.onProductSelect.bind(f()(e)),e}return v()(t,e),u()(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(H.b)({selected:t}).then(function(t){t=t.map(function(e){var t=e.variations?e.variations.length:0;return B()({},e,{parent:0,count:t})}),e.setState({products:t,loading:!1})}).catch(function(){e.setState({products:[],loading:!1})})}},{key:"componentDidUpdate",value:function(e,t){t.product!==this.state.product&&this.debouncedGetVariations()}},{key:"getVariations",value:function(){var e=this,t=this.state,n=t.product,c=t.variationsList;if(n){var o=this.state.products.find(function(e){return e.id===n});o.variations&&0!==o.variations.length&&(c[n]||this.setState({variationsLoading:!0}),O()({path:Object(R.addQueryArgs)("/wc/blocks/products/".concat(n,"/variations"),{per_page:-1})}).then(function(t){t=t.map(function(e){return B()({},e,{parent:n})}),e.setState(function(e){return{variationsList:B()({},e.variationsList,L()({},n,t)),variationsLoading:!1}})}).catch(function(){e.setState({termsLoading:!1})}))}else this.setState({variationsList:{},variationsLoading:!1})}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(H.b)({selected:n,search:e}).then(function(e){t.setState({products:e,loading:!1})}).catch(function(){t.setState({products:[],loading:!1})})}},{key:"onProductSelect",value:function(e,t){var n=this;return function(){n.setState({product:t?0:e.id})}}},{key:"renderItem",value:function(e){var t=this,n=e.item,r=e.search,a=e.depth,i=void 0===a?0:a,s=e.isSelected,l=e.onSelect,u=this.state,d=u.product,p=u.variationsLoading,b=k()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(i),{"is-searching":r.length>0,"is-skip-level":0===i&&0!==n.parent,"is-variable":n.count>0}),h=Object.assign({},e);delete h.isSingle;var m={role:"menuitemradio"};return n.breadcrumbs.length&&(m["aria-label"]="".concat(n.breadcrumbs[0],": ").concat(n.name)),n.count&&(m["aria-expanded"]=n.id===d),n.breadcrumbs.length?(Object(E.isEmpty)(n.variation)||(n.name=n.variation),Object(c.createElement)(T.b,I()({className:b},e,m))):[Object(c.createElement)(j.MenuItem,I()({key:"product-".concat(n.id),isSelected:s},h,m,{className:b,onClick:function(){l(n)(),t.onProductSelect(n,s)()}}),Object(c.createElement)("span",{className:"woocommerce-search-list__item-state"},D(s)),Object(c.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(c.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:F(n.name,r)}})),n.count?Object(c.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(o.sprintf)(Object(o._n)("%d variation","%d variations",n.count,"woo-gutenberg-products-block"),n.count)):null),d===n.id&&n.count>0&&p&&Object(c.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(c.createElement)(j.Spinner,null))]}},{key:"render",value:function(){var e=this.state,t=e.products,n=e.loading,r=e.product,a=e.variationsList,i=this.props,s=i.onChange,l=i.selected,u=a[r]||[],d=[].concat(P()(t),P()(u)),p={list:Object(o.__)("Products","woo-gutenberg-products-block"),noItems:Object(o.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(o.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(o.__)("Product search results updated.","woo-gutenberg-products-block")},b=l?[Object(E.find)(d,{id:l})]:[];return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(T.a,{className:"woocommerce-products",list:d,isLoading:n,isSingle:!0,selected:b,onChange:s,onSearch:H.d?this.debouncedOnSearch:null,messages:p,renderItem:this.renderItem,isHierarchical:!0}))}}]),t}(c.Component);q.propTypes={onChange:x.a.func.isRequired,selected:x.a.number.isRequired};var V=q;function Q(e){var t=e.images,n=void 0===t?[]:t;return n.length&&n[0].src||""}var G=wc_product_block_data.min_height;var U=function(e){function t(){var e;return s()(this,t),(e=p()(this,h()(t).apply(this,arguments))).state={product:!1,loaded:!1},e.debouncedGetProduct=Object(E.debounce)(e.getProduct.bind(f()(e)),200),e}return v()(t,e),u()(t,[{key:"componentDidMount",value:function(){this.getProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.debouncedGetProduct()}},{key:"getProduct",value:function(){var e=this,t=this.props.attributes.productId;t?O()({path:"/wc/blocks/products/".concat(t)}).then(function(t){e.setState({product:t,loaded:!0})}).catch(function(){e.setState({product:!1,loaded:!0})}):this.setState({product:!1,loaded:!0})}},{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,a=e.overlayColor,i=e.setOverlayColor,s=t.mediaSrc||Q(this.state.product),l=t.focalPoint,u=void 0===l?{x:.5,y:.5}:l,d="function"==typeof j.FocalPointPicker;return Object(c.createElement)(r.InspectorControls,{key:"inspector"},Object(c.createElement)(j.PanelBody,{title:Object(o.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(j.ToggleControl,{label:Object(o.__)("Show description","woo-gutenberg-products-block"),checked:t.showDesc,onChange:function(){return n({showDesc:!t.showDesc})}}),Object(c.createElement)(j.ToggleControl,{label:Object(o.__)("Show price","woo-gutenberg-products-block"),checked:t.showPrice,onChange:function(){return n({showPrice:!t.showPrice})}})),Object(c.createElement)(r.PanelColorSettings,{title:Object(o.__)("Overlay","woo-gutenberg-products-block"),colorSettings:[{value:a.color,onChange:i,label:Object(o.__)("Overlay Color","woo-gutenberg-products-block")}]},!!s&&Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j.RangeControl,{label:Object(o.__)("Background Opacity","woo-gutenberg-products-block"),value:t.dimRatio,onChange:function(e){return n({dimRatio:e})},min:0,max:100,step:10}),d&&Object(c.createElement)(j.FocalPointPicker,{label:Object(o.__)("Focal Point Picker"),url:s,value:u,onChange:function(e){return n({focalPoint:e})}}))))}},{key:"renderEditMode",value:function(){var e=this.props,t=e.attributes,n=e.debouncedSpeak,r=e.setAttributes;return Object(c.createElement)(j.Placeholder,{icon:"star-filled",label:Object(o.__)("Featured Product","woo-gutenberg-products-block"),className:"wc-block-featured-product"},Object(o.__)("Visually highlight a product or variation and encourage prompt action","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-featured-product__selection"},Object(c.createElement)(V,{selected:t.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;r({productId:t,mediaId:0,mediaSrc:""})}}),Object(c.createElement)(j.Button,{isDefault:!0,onClick:function(){r({editMode:!1}),n(Object(o.__)("Showing Featured Product block preview.","woo-gutenberg-products-block"))}},Object(o.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var e,t,n,a,i=this,s=this.props,l=s.attributes,u=s.isSelected,d=s.overlayColor,p=s.setAttributes,b=l.className,h=l.contentAlign,m=l.dimRatio,f=l.editMode,g=l.focalPoint,v=l.height,w=l.showDesc,O=l.showPrice,_=this.state,y=_.loaded,S=_.product,x=k()("wc-block-featured-product",{"is-selected":u,"is-loading":!S&&!y,"is-not-found":!S&&y,"has-background-dim":0!==m},0===(e=m)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==h&&"has-".concat(h,"-content"),b),C=l.mediaId||(t=S.images,(n=void 0===t?[]:t).length&&n[0].id||0),P=S?(a=l.mediaSrc||S,Object(E.isObject)(a)&&(a=Q(a)),a?{backgroundImage:"url(".concat(a,")")}:{}):{};d.color&&(P.backgroundColor=d.color),g&&(P.backgroundPosition="".concat(100*g.x,"% ").concat(100*g.y,"%"));return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(r.BlockControls,null,Object(c.createElement)(r.AlignmentToolbar,{value:h,onChange:function(e){p({contentAlign:e})}}),Object(c.createElement)(r.MediaUploadCheck,null,Object(c.createElement)(j.Toolbar,null,Object(c.createElement)(r.MediaUpload,{onSelect:function(e){p({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"],value:C,render:function(e){var t=e.open;return Object(c.createElement)(j.IconButton,{className:"components-toolbar__control",label:Object(o.__)("Edit media"),icon:"format-image",onClick:t,disabled:!i.state.product})}})))),!l.editMode&&this.getInspectorControls(),f?this.renderEditMode():Object(c.createElement)(c.Fragment,null,S?Object(c.createElement)(j.ResizableBox,{className:x,size:{height:v},minHeight:G,enable:{bottom:!0},onResizeStop:function(e,t,n){p({height:parseInt(n.style.height)})},style:P},Object(c.createElement)("div",{className:"wc-block-featured-product__wrapper"},Object(c.createElement)("h2",{className:"wc-block-featured-product__title",dangerouslySetInnerHTML:{__html:S.name}}),!Object(E.isEmpty)(S.variation)&&Object(c.createElement)("h3",{className:"wc-block-featured-product__variation",dangerouslySetInnerHTML:{__html:S.variation}}),w&&Object(c.createElement)("div",{className:"wc-block-featured-product__description",dangerouslySetInnerHTML:{__html:S.description}}),O&&Object(c.createElement)("div",{className:"wc-block-featured-product__price",dangerouslySetInnerHTML:{__html:S.price_html}}),Object(c.createElement)("div",{className:"wc-block-featured-product__link"},Object(c.createElement)(r.InnerBlocks,{template:[["core/button",{text:Object(o.__)("Shop now","woo-gutenberg-products-block"),url:S.permalink,align:"center"}]],templateLock:"all"})))):Object(c.createElement)(j.Placeholder,{className:"wc-block-featured-product",icon:"star-filled",label:Object(o.__)("Featured Product","woo-gutenberg-products-block")},y?Object(o.__)("No product is selected.","woo-gutenberg-products-block"):Object(c.createElement)(j.Spinner,null))))}}]),t}(c.Component);U.propTypes={attributes:x.a.object.isRequired,isSelected:x.a.bool.isRequired,name:x.a.string.isRequired,setAttributes:x.a.func.isRequired,overlayColor:x.a.object,setOverlayColor:x.a.func.isRequired,debouncedSpeak:x.a.func.isRequired};var W=Object(y.compose)([Object(r.withColors)({overlayColor:"background-color"}),j.withSpokenMessages])(U);Object(a.registerBlockType)("woocommerce/featured-product",{title:Object(o.__)("Featured Product","woo-gutenberg-products-block"),icon:{src:"star-filled",foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Visually highlight a product or variation and encourage prompt action.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:wc_product_block_data.default_height},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(o.__)("Shop now","woo-gutenberg-products-block")},productId:{type:"number"},showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0}},edit:function(e){return Object(c.createElement)(W,e)},save:function(){return Object(c.createElement)(r.InnerBlocks.Content,null)}})},52:function(e,t){!function(){e.exports=this.wp.date}()},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["featured-product"]=function(e){function t(t){for(var c,a,i=t[0],l=t[1],s=t[2],d=0,p=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&p.push(r[a][0]),r[a]=0;for(c in l)Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,i=1;i<n.length;i++){var l=n[i];0!==r[l]&&(c=!1)}c&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},r={6:0},o=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return o.push([546,2,1,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,n){"use strict";var c=n(0),r=n(2),o=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(c.createElement)("g",null,Object(c.createElement)("g",null,Object(c.createElement)("path",{fill:n,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(c.createElement)("path",{fill:n,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(c.createElement)("path",{fill:n,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},d=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)("path",{fill:n,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(c.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},p=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(c.createElement)("path",{fill:n,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(c.createElement)("path",{fill:n,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(c.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},b=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},h=n(6),f=n.n(h),m=(n(7),function(e){var t=e.size,n=void 0===t?20:t,o=e.className;return Object(c.createElement)(r.Icon,{className:f()("woo-icon",o),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});n.d(t,"a",function(){return o}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return i}),n.d(t,"d",function(){return l}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"h",function(){return d}),n.d(t,"g",function(){return p}),n.d(t,"i",function(){return b}),n.d(t,"j",function(){return m})},25:function(e,t,n){"use strict";n.d(t,"d",function(){return p}),n.d(t,"b",function(){return b}),n.d(t,"c",function(){return h}),n.d(t,"a",function(){return f});var c=n(20),r=n.n(c),o=n(19),a=n(17),i=n.n(a),l=n(4),s=n(5);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,c)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(n,!0).forEach(function(t){r()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var p=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,r=void 0===c?"":c,a=e.queryArgs,u=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,r=void 0===c?"":c,a=e.queryArgs,i=void 0===a?[]:a,l={per_page:s.IS_LARGE_CATALOG?100:-1,catalog_visibility:"any",status:"publish",search:r,orderby:"title",order:"asc"},u=[Object(o.addQueryArgs)(s.ENDPOINTS.products,d({},l,{},i))];return s.IS_LARGE_CATALOG&&n.length&&u.push(Object(o.addQueryArgs)(s.ENDPOINTS.products,{catalog_visibility:"any",status:"publish",include:n})),u}({selected:n,search:r,queryArgs:void 0===a?[]:a});return Promise.all(u.map(function(e){return i()({path:e})})).then(function(e){return Object(l.uniqBy)(Object(l.flatten)(e),"id")})},b=function(e){return i()({path:"".concat(s.ENDPOINTS.products,"/").concat(e)})},h=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,r=[Object(o.addQueryArgs)("".concat(s.ENDPOINTS.products,"/tags"),{per_page:s.LIMIT_TAGS?100:-1,orderby:s.LIMIT_TAGS?"count":"name",order:s.LIMIT_TAGS?"desc":"asc",search:c})];return s.LIMIT_TAGS&&n.length&&r.push(Object(o.addQueryArgs)("".concat(s.ENDPOINTS.products,"/tags"),{include:n})),r}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return i()({path:e})})).then(function(e){return Object(l.uniqBy)(Object(l.flatten)(e),"id")})},f=function(e){return i()({path:"".concat(s.ENDPOINTS.categories,"/").concat(e)})}},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},44:function(e,t){!function(){e.exports=this.ReactDOM}()},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},52:function(e,t,n){"use strict";var c=n(0),r=n(1),o=(n(7),n(29)),a=n.n(o),i=n(6),l=n.n(i),s=n(39),u=n(2);t.a=function(e){var t,n,o=e.className,i=e.error,d=e.isLoading,p=e.onRetry;return Object(c.createElement)(u.Placeholder,{icon:Object(c.createElement)(a.a,{icon:"notice"}),label:Object(r.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:l()("wc-block-api-error",o)},Object(c.createElement)("div",{className:"wc-block-error__message"},(n=(t=i).apiMessage,t.message||(n?Object(c.createElement)("span",null,Object(r.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(c.createElement)("br",null),Object(c.createElement)("code",null,Object(s.escapeHTML)(n))):Object(r.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))),p&&Object(c.createElement)(c.Fragment,null,d?Object(c.createElement)(u.Spinner,null):Object(c.createElement)(u.Button,{isDefault:!0,onClick:p},Object(r.__)("Retry","woo-gutenberg-products-block"))))}},525:function(e,t,n){var c=n(526);"string"==typeof c&&(c=[[e.i,c,""]]);var r={insert:"head",singleton:!1};n(35)(c,r);c.locals&&(e.exports=c.locals)},526:function(e,t,n){},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},546:function(e,t,n){"use strict";n.r(t);var c=n(0),r=n(1),o=n(18),a=n(23),i=n(5),l=(n(523),n(525),n(2)),s=n(6),u=n.n(s),d=n(21),p=n(4),b=(n(7),n(99)),h=n(52);function f(e){return e&&e.images&&e.images.length&&e.images[0].src||""}var m=n(71),g=Object(d.compose)([m.b,Object(o.withColors)({overlayColor:"background-color"}),l.withSpokenMessages])(function(e){var t,n,a,s,d=e.attributes,m=e.debouncedSpeak,g=e.error,O=e.getProduct,v=e.isLoading,j=e.isSelected,w=e.overlayColor,y=e.product,E=e.setAttributes,_=e.setOverlayColor,k=function(){var e=d.contentAlign,t=d.editMode,n=d.mediaId||function(e){return e&&e.images&&e.images.length&&e.images[0].id||0}(y);return Object(c.createElement)(o.BlockControls,null,Object(c.createElement)(o.AlignmentToolbar,{value:e,onChange:function(e){E({contentAlign:e})}}),Object(c.createElement)(o.MediaUploadCheck,null,Object(c.createElement)(l.Toolbar,null,Object(c.createElement)(o.MediaUpload,{onSelect:function(e){E({mediaId:e.id,mediaSrc:e.url})},allowedTypes:["image"],value:n,render:function(e){var t=e.open;return Object(c.createElement)(l.IconButton,{className:"components-toolbar__control",label:Object(r.__)("Edit media"),icon:"format-image",onClick:t,disabled:!y})}}))),Object(c.createElement)(l.Toolbar,{controls:[{icon:"edit",title:Object(r.__)("Edit"),onClick:function(){return E({editMode:!t})},isActive:t}]}))},S=d.editMode;return g?Object(c.createElement)(h.a,{className:"wc-block-featured-product-error",error:g,isLoading:v,onRetry:O}):S?Object(c.createElement)(c.Fragment,null,k(),Object(c.createElement)(l.Placeholder,{icon:"star-filled",label:Object(r.__)("Featured Product","woo-gutenberg-products-block"),className:"wc-block-featured-product"},Object(r.__)("Visually highlight a product or variation and encourage prompt action","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-featured-product__selection"},Object(c.createElement)(b.a,{selected:d.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;E({productId:t,mediaId:0,mediaSrc:""})}}),Object(c.createElement)(l.Button,{isDefault:!0,onClick:function(){E({editMode:!1}),m(Object(r.__)("Showing Featured Product block preview.","woo-gutenberg-products-block"))}},Object(r.__)("Done","woo-gutenberg-products-block"))))):Object(c.createElement)(c.Fragment,null,k(),(t=d.mediaSrc||f(y),n=d.focalPoint,a=void 0===n?{x:.5,y:.5}:n,s="function"==typeof l.FocalPointPicker,Object(c.createElement)(o.InspectorControls,{key:"inspector"},Object(c.createElement)(l.PanelBody,{title:Object(r.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(l.ToggleControl,{label:Object(r.__)("Show description","woo-gutenberg-products-block"),checked:d.showDesc,onChange:function(){return E({showDesc:!d.showDesc})}}),Object(c.createElement)(l.ToggleControl,{label:Object(r.__)("Show price","woo-gutenberg-products-block"),checked:d.showPrice,onChange:function(){return E({showPrice:!d.showPrice})}})),Object(c.createElement)(o.PanelColorSettings,{title:Object(r.__)("Overlay","woo-gutenberg-products-block"),colorSettings:[{value:w.color,onChange:_,label:Object(r.__)("Overlay Color","woo-gutenberg-products-block")}]},!!t&&Object(c.createElement)(c.Fragment,null,Object(c.createElement)(l.RangeControl,{label:Object(r.__)("Background Opacity","woo-gutenberg-products-block"),value:d.dimRatio,onChange:function(e){return E({dimRatio:e})},min:0,max:100,step:10}),s&&Object(c.createElement)(l.FocalPointPicker,{label:Object(r.__)("Focal Point Picker"),url:t,value:a,onChange:function(e){return E({focalPoint:e})}}))))),y?function(){var e,t,n=d.className,a=d.contentAlign,s=d.dimRatio,b=d.focalPoint,h=d.height,m=d.showDesc,g=d.showPrice,O=u()("wc-block-featured-product",{"is-selected":j,"is-loading":!y&&v,"is-not-found":!y&&!v,"has-background-dim":0!==s},0===(e=s)||50===e?null:"has-background-dim-".concat(10*Math.round(e/10)),"center"!==a&&"has-".concat(a,"-content"),n),_=(t=d.mediaSrc||y,Object(p.isObject)(t)&&(t=f(t)),t?{backgroundImage:"url(".concat(t,")")}:{});w.color&&(_.backgroundColor=w.color),b&&(_.backgroundPosition="".concat(100*b.x,"% ").concat(100*b.y,"%"));return Object(c.createElement)(l.ResizableBox,{className:O,size:{height:h},minHeight:i.MIN_HEIGHT,enable:{bottom:!0},onResizeStop:function(e,t,n){E({height:parseInt(n.style.height)})},style:_},Object(c.createElement)("div",{className:"wc-block-featured-product__wrapper"},Object(c.createElement)("h2",{className:"wc-block-featured-product__title",dangerouslySetInnerHTML:{__html:y.name}}),!Object(p.isEmpty)(y.variation)&&Object(c.createElement)("h3",{className:"wc-block-featured-product__variation",dangerouslySetInnerHTML:{__html:y.variation}}),m&&Object(c.createElement)("div",{className:"wc-block-featured-product__description",dangerouslySetInnerHTML:{__html:y.description}}),g&&Object(c.createElement)("div",{className:"wc-block-featured-product__price",dangerouslySetInnerHTML:{__html:y.price_html}}),Object(c.createElement)("div",{className:"wc-block-featured-product__link"},Object(c.createElement)(o.InnerBlocks,{template:[["core/button",{text:Object(r.__)("Shop now","woo-gutenberg-products-block"),url:y.permalink,align:"center"}]],templateLock:"all"}))))}():Object(c.createElement)(l.Placeholder,{className:"wc-block-featured-product",icon:"star-filled",label:Object(r.__)("Featured Product","woo-gutenberg-products-block")},v?Object(c.createElement)(l.Spinner,null):Object(r.__)("No product is selected.","woo-gutenberg-products-block")))});Object(a.registerBlockType)("woocommerce/featured-product",{title:Object(r.__)("Featured Product","woo-gutenberg-products-block"),icon:{src:"star-filled",foreground:"#96588a"},category:"woocommerce",keywords:[Object(r.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(r.__)("Visually highlight a product or variation and encourage prompt action.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{contentAlign:{type:"string",default:"center"},dimRatio:{type:"number",default:50},editMode:{type:"boolean",default:!0},focalPoint:{type:"object"},height:{type:"number",default:i.DEFAULT_HEIGHT},mediaId:{type:"number",default:0},mediaSrc:{type:"string",default:""},overlayColor:{type:"string"},customOverlayColor:{type:"string"},linkText:{type:"string",default:Object(r.__)("Shop now","woo-gutenberg-products-block")},productId:{type:"number"},showDesc:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0}},edit:function(e){return Object(c.createElement)(g,e)},save:function(){return Object(c.createElement)(o.InnerBlocks.Content,null)}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},71:function(e,t,n){"use strict";var c=n(16),r=n.n(c),o=n(38),a=n.n(o),i=n(8),l=n.n(i),s=n(9),u=n.n(s),d=n(10),p=n.n(d),b=n(11),h=n.n(b),f=n(15),m=n.n(f),g=n(12),O=n.n(g),v=n(0),j=n(21),w=n(25),y=Object(j.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(this,n),(e=p()(this,h()(n).apply(this,arguments))).state={error:null,loading:!1,product:null},e.loadProduct=e.loadProduct.bind(m()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"loadProduct",value:function(){var e=this,t=this.props.attributes.productId;t?(this.setState({loading:!0}),Object(w.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({product:null,loading:!1,error:n})})):this.setState({product:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,o=t.product;return Object(v.createElement)(e,r()({},this.props,{error:n,getProduct:this.loadProduct,isLoading:c,product:o}))}}]),n}(v.Component)},"withProduct"),E=Object(j.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(this,n),(e=p()(this,h()(n).apply(this,arguments))).state={error:null,loading:!1,category:null},e.loadCategory=e.loadCategory.bind(m()(e)),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?(this.setState({loading:!0}),Object(w.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var n="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({category:null,loading:!1,error:n})})):this.setState({category:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,c=t.loading,o=t.category;return Object(v.createElement)(e,r()({},this.props,{error:n,getCategory:this.loadCategory,isLoading:c,category:o}))}}]),n}(v.Component)},"withCategory"),_=n(4),k=(n(7),n(5)),S=Object(j.createHigherOrderComponent)(function(e){var t=function(t){function n(){var e;return l()(this,n),(e=p()(this,h()(n).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(_.debounce)(e.onSearch.bind(m()(e)),400),e}return O()(n,t),u()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(w.d)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(w.d)({selected:n,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var t=this.state,n=t.list,c=t.loading,o=this.props.selected;return Object(v.createElement)(e,r()({},this.props,{products:n,isLoading:c,selected:n.filter(function(e){var t=e.id;return o.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),n}(v.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");n.d(t,"b",function(){return y}),n.d(t,"a",function(){return E}),n.d(t,"c",function(){return S})},99:function(e,t,n){"use strict";var c=n(62),r=n.n(c),o=n(16),a=n.n(o),i=n(20),l=n.n(i),s=n(8),u=n.n(s),d=n(9),p=n.n(d),b=n(10),h=n.n(b),f=n(11),m=n.n(f),g=n(15),O=n.n(g),v=n(12),j=n.n(v),w=n(0),y=n(1),E=n(19),_=n(17),k=n.n(_),S=n(4),C=(n(7),n(26)),P=n(2),M=n(6),I=n.n(M),L=n(5),x=n(25),N=n(24);n(280);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,c)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(n,!0).forEach(function(t){l()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z(e,t){if(!t)return e;var n=new RegExp(Object(S.escapeRegExp)(t),"ig");return e.replace(n,"<strong>$&</strong>")}var T=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(w.createElement)(N.e,null):Object(w.createElement)(N.f,null)},D=function(e){function t(){var e;return u()(this,t),(e=h()(this,m()(t).apply(this,arguments))).state={products:[],product:0,variationsList:{},variationsLoading:!1,loading:!0},e.debouncedOnSearch=Object(S.debounce)(e.onSearch.bind(O()(e)),400),e.debouncedGetVariations=Object(S.debounce)(e.getVariations.bind(O()(e)),200),e.renderItem=e.renderItem.bind(O()(e)),e.onProductSelect=e.onProductSelect.bind(O()(e)),e}return j()(t,e),p()(t,[{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel(),this.debouncedGetVariations.cancel()}},{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.selected,c=t.queryArgs;Object(x.d)({selected:n,queryArgs:c}).then(function(t){t=t.map(function(e){return H({},e,{parent:0,count:e.variations?e.variations.length:0})}),e.setState({products:t,loading:!1})}).catch(function(){e.setState({products:[],loading:!1})})}},{key:"componentDidUpdate",value:function(e,t){t.product!==this.state.product&&this.debouncedGetVariations()}},{key:"getVariations",value:function(){var e=this,t=this.state,n=t.product,c=t.products,r=t.variationsList;if(n){var o=c.find(function(e){return e.id===n});o.variations&&0!==o.variations.length&&(r[n]||this.setState({variationsLoading:!0}),k()({path:Object(E.addQueryArgs)("".concat(L.ENDPOINTS.products,"/").concat(n,"/variations"),{per_page:-1})}).then(function(t){t=t.map(function(e){return H({},e,{parent:n})}),e.setState(function(e){return{variationsList:H({},e.variationsList,l()({},n,t)),variationsLoading:!1}})}).catch(function(){e.setState({termsLoading:!1})}))}else this.setState({variationsList:{},variationsLoading:!1})}},{key:"onSearch",value:function(e){var t=this,n=this.props,c=n.selected,r=n.queryArgs;Object(x.d)({selected:c,search:e,queryArgs:r}).then(function(e){t.setState({products:e,loading:!1})}).catch(function(){t.setState({products:[],loading:!1})})}},{key:"onProductSelect",value:function(e,t){var n=this;return function(){n.setState({product:t?0:e.id})}}},{key:"renderItem",value:function(e){var t=this,n=e.item,c=e.search,r=e.depth,o=void 0===r?0:r,i=e.isSelected,l=e.onSelect,s=this.state,u=s.product,d=s.variationsLoading,p=I()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(o),{"is-searching":c.length>0,"is-skip-level":0===o&&0!==n.parent,"is-variable":n.count>0}),b=Object.assign({},e);delete b.isSingle;var h={role:"menuitemradio"};return n.breadcrumbs.length&&(h["aria-label"]="".concat(n.breadcrumbs[0],": ").concat(n.name)),n.count&&(h["aria-expanded"]=n.id===u),n.breadcrumbs.length?(Object(S.isEmpty)(n.variation)||(n.name=n.variation),Object(w.createElement)(C.b,a()({className:p},e,h))):[Object(w.createElement)(P.MenuItem,a()({key:"product-".concat(n.id),isSelected:i},b,h,{className:p,onClick:function(){l(n)(),t.onProductSelect(n,i)()}}),Object(w.createElement)("span",{className:"woocommerce-search-list__item-state"},T(i)),Object(w.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(w.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:z(n.name,c)}})),n.count?Object(w.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(y.sprintf)(Object(y._n)("%d variation","%d variations",n.count,"woo-gutenberg-products-block"),n.count)):null),u===n.id&&n.count>0&&d&&Object(w.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(w.createElement)(P.Spinner,null))]}},{key:"render",value:function(){var e=this.state,t=e.products,n=e.loading,c=e.product,o=e.variationsList,a=this.props,i=a.onChange,l=a.renderItem,s=a.selected,u=o[c]||[],d=[].concat(r()(t),r()(u)),p={list:Object(y.__)("Products","woo-gutenberg-products-block"),noItems:Object(y.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(y.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(y.__)("Product search results updated.","woo-gutenberg-products-block")},b=s?[Object(S.find)(d,{id:s})]:[];return Object(w.createElement)(w.Fragment,null,Object(w.createElement)(C.a,{className:"woocommerce-products",list:d,isLoading:n,isSingle:!0,selected:b,onChange:i,renderItem:l,onSearch:L.IS_LARGE_CATALOG?this.debouncedOnSearch:null,messages:p,isHierarchical:!0}))}}]),t}(w.Component);t.a=D}});
|
build/frontend.deps.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
["react","react-dom","wp-i18n","wp-polyfill"]
|
|
build/frontend.js
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=19)}([function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){var n=r(13),o=r(1);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){var n=r(14);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,r){var n;
|
2 |
-
/*!
|
3 |
-
Copyright (c) 2017 Jed Watson.
|
4 |
-
Licensed under the MIT License (MIT), see
|
5 |
-
http://jedwatson.github.io/classnames
|
6 |
-
*/
|
7 |
-
/*!
|
8 |
-
Copyright (c) 2017 Jed Watson.
|
9 |
-
Licensed under the MIT License (MIT), see
|
10 |
-
http://jedwatson.github.io/classnames
|
11 |
-
*/
|
12 |
-
!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var c=o.apply(null,n);c&&e.push(c)}else if("object"===i)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t,r){var n=r(15),o=r(16),i=r(17);e.exports=function(e){return n(e)||o(e)||i()}},function(e,t,r){var n=r(18);e.exports=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},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}},function(e,t,r){"use strict";r.r(t);var n=r(8),o=r(2),i=r.n(o),c=r(3),a=r.n(c),u=r(4),l=r.n(u),s=r(5),f=r.n(s),p=r(1),d=r.n(p),y=r(6),b=r.n(y),h=r(7),m=r(0),v=r(9),g=r.n(v),O=r(10),w=r.n(O),x=[],_=function(e){return function(t){function r(){return i()(this,r),l()(this,f()(r).apply(this,arguments))}return b()(r,t),a()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return x[e]||(x[e]=0),x[e]++,x[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return React.createElement(e,w()({},this.props,{componentId:t}))}}]),r}(m.Component)}(function(e){function t(){var e;return i()(this,t),(e=l()(this,f()(t).apply(this,arguments))).select=Object(m.createRef)(),e.onNavigate=e.onNavigate.bind(d()(e)),e.renderList=e.renderList.bind(d()(e)),e.renderOptions=e.renderOptions.bind(d()(e)),e}return b()(t,e),a()(t,[{key:"onNavigate",value:function(){var e=this.props.isPreview,t=void 0!==e&&e,r=this.select.current.value;if("false"!==r){var n=wc_product_block_data.homeUrl;t||0!==r.indexOf(n)||(document.location.href=r)}}},{key:"renderList",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.isPreview,o=void 0!==n&&n,i=this.props.attributes.hasCount,c="parent-"+e[0].term_id;return React.createElement("ul",{key:c},e.map(function(e){var n=i?React.createElement("span",null,"(",e.count,")"):null;return[React.createElement("li",{key:e.term_id},React.createElement("a",{href:o?null:e.link},e.name)," ",n," "),!!e.children&&!!e.children.length&&t.renderList(e.children,r+1)]}))}},{key:"renderOptions",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.attributes.hasCount;return e.map(function(e){var o=n?"(".concat(e.count,")"):null;return[React.createElement("option",{key:e.term_id,value:e.link},"–".repeat(r)," ",e.name," ",o),!!e.children&&!!e.children.length&&t.renderOptions(e.children,r+1)]})}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.categories,n=e.componentId,o=t.className,i=t.isDropdown,c=g()("wc-block-product-categories",o,{"is-dropdown":i,"is-list":!i}),a="prod-categories-".concat(n);return React.createElement(m.Fragment,null,r.length>0&&React.createElement("div",{className:c},i?React.createElement(m.Fragment,null,React.createElement("div",{className:"wc-block-product-categories__dropdown"},React.createElement("label",{className:"screen-reader-text",htmlFor:a},Object(h.__)("Select a category","woo-gutenberg-products-block")),React.createElement("select",{id:a,ref:this.select},React.createElement("option",{value:"false",hidden:!0},Object(h.__)("Select a category","woo-gutenberg-products-block")),this.renderOptions(r))),React.createElement("button",{type:"button",className:"wc-block-product-categories__button","aria-label":Object(h.__)("Go to category","woo-gutenberg-products-block"),icon:"arrow-right-alt2",onClick:this.onNavigate},React.createElement("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},React.createElement("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))):this.renderList(r)))}}]),t}(m.Component)),j=r(11),E=r.n(j),S=r(12),k=r.n(S);var R=function(e){var t=e.hasEmpty,r=e.isHierarchical,n=wc_product_block_data.productCategories.filter(function(e){return t||!!e.count});return r?function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.parent;return(e[o]||(e[o]=[])).push(t),e},{}),t=function t(r){return r.map(function(r){var n=e[r.term_id];return delete e[r.term_id],k()({},r,{children:n&&n.length?t(n):[]})})},r=t(e[0]||[]);return delete e[0],Object.keys(e).forEach(function(e){r.push.apply(r,E()(t(e||[])))}),r}(n):n},P=document.querySelectorAll(".wp-block-woocommerce-product-categories");P.length&&Array.prototype.forEach.call(P,function(e){var t=JSON.parse(JSON.stringify(e.dataset)),r={hasCount:"true"===t.hasCount,hasEmpty:"true"===t.hasEmpty,isDropdown:"true"===t.isDropdown,isHierarchical:"true"===t.isHierarchical},o=R(r);e.classList.remove("is-loading"),Object(n.render)(React.createElement(_,{attributes:r,categories:o}),e)})}]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/handpicked-products.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/handpicked-products.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["handpicked-products"]=function(e){function t(t){for(var o,i,u=t[0],a=t[1],s=t[2],d=0,b=[];d<u.length;d++)i=u[d],c[i]&&b.push(c[i][0]),c[i]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(e[o]=a[o]);for(l&&l(t);b.length;)b.shift()();return r.push.apply(r,s||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],o=!0,u=1;u<n.length;u++){var a=n[u];0!==c[a]&&(o=!1)}o&&(r.splice(t--,1),e=i(i.s=n[0]))}return e}var o={},c={6:0},r=[];function i(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=o,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)i.d(n,o,function(t){return e[t]}.bind(null,o));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var u=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=u.push.bind(u);u.push=t,u=u.slice();for(var s=0;s<u.length;s++)t(u[s]);var l=a;return r.push([515,0,1]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},270:function(e,t,n){var o=n(271);"string"==typeof o&&(o=[[e.i,o,""]]);var c={hmr:!0,transform:void 0,insertInto:void 0};n(38)(o,c);o.locals&&(e.exports=o.locals)},271:function(e,t,n){},28:function(e,t,n){"use strict";var o=n(0),c=n(3),r=function(){return Object(o.createElement)(c.Icon,{icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(o.createElement)(c.Icon,{icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(o.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},u=function(){return Object(o.createElement)(c.Icon,{className:"material-icon",icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(o.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},a=function(){return Object(o.createElement)(c.Icon,{icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(o.createElement)(c.Icon,{icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},l=function(){return Object(o.createElement)(c.Icon,{className:"material-icon",icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(o.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(o.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},d=n(6),b=n.n(d),p=n(4),g=n.n(p),h=function(e){var t=e.size,n=void 0===t?20:t,r=e.className;return Object(o.createElement)(c.Icon,{className:b()("woo-icon",r),icon:Object(o.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(o.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(o.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};h.propTypes={size:g.a.number,className:g.a.string};var f=h;n.d(t,"a",function(){return r}),n.d(t,"b",function(){return i}),n.d(t,"c",function(){return u}),n.d(t,"d",function(){return a}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return l}),n.d(t,"g",function(){return f})},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},31:function(e,t,n){"use strict";var o=n(8),c=n.n(o),r=n(0),i=n(1),u=n(4),a=n.n(u),s=n(3),l=function(e){var t=e.onChange,n=e.settings,o=n.button,u=n.price,a=n.rating,l=n.title;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(c()({},n,{title:!l}))}}),Object(r.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:u?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return t(c()({},n,{price:!u}))}}),Object(r.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:a?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return t(c()({},n,{rating:!a}))}}),Object(r.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:o?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:o,onChange:function(){return t(c()({},n,{button:!o}))}}))};l.propTypes={settings:a.a.shape({button:a.a.bool.isRequired,price:a.a.bool.isRequired,rating:a.a.bool.isRequired,title:a.a.bool.isRequired}).isRequired,onChange:a.a.func.isRequired},t.a=l},35:function(e,t,n){"use strict";var o=n(0),c=n(6),r=n.n(c),i=n(48),u=n.n(i);n.d(t,"a",function(){return a});var a=function(e){return function(t){var n=t.attributes,c=n.align,i=n.contentVisibility,a=r()(c?"align".concat(c):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(o.createElement)(o.RawHTML,{className:a},function(e,t){var n=e.attributes,o=n.attributes,c=n.attrOperator,r=n.categories,i=n.catOperator,a=n.orderby,s=n.products,l=n.columns||wc_product_block_data.default_columns,d=n.rows||wc_product_block_data.default_rows,b=new Map;switch(b.set("limit",d*l),b.set("columns",l),r&&r.length&&(b.set("category",r.join(",")),i&&"all"===i&&b.set("cat_operator","AND")),o&&o.length&&(b.set("terms",o.map(function(e){return e.id}).join(",")),b.set("attribute",o[0].attr_slug),c&&"all"===c&&b.set("terms_operator","AND")),a&&("price_desc"===a?(b.set("orderby","price"),b.set("order","DESC")):"price_asc"===a?(b.set("orderby","price"),b.set("order","ASC")):"date"===a?(b.set("orderby","date"),b.set("order","DESC")):b.set("orderby",a)),t){case"woocommerce/product-best-sellers":b.set("best_selling","1");break;case"woocommerce/product-top-rated":b.set("orderby","rating");break;case"woocommerce/product-on-sale":b.set("on_sale","1");break;case"woocommerce/product-new":b.set("orderby","date"),b.set("order","DESC");break;case"woocommerce/handpicked-products":if(!s.length)return"";b.set("ids",s.join(",")),b.set("limit",s.length);break;case"woocommerce/product-category":if(!r||!r.length)return"";break;case"woocommerce/products-by-attribute":if(!o||!o.length)return""}var p="[products",g=!0,h=!1,f=void 0;try{for(var m,w=b[Symbol.iterator]();!(g=(m=w.next()).done);g=!0){var _=u()(m.value,2);p+=" "+_[0]+'="'+_[1]+'"'}}catch(e){h=!0,f=e}finally{try{g||null==w.return||w.return()}finally{if(h)throw f}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},39:function(e,t){!function(){e.exports=this.wp.viewport}()},43:function(e,t,n){"use strict";n.d(t,"d",function(){return u}),n.d(t,"e",function(){return a}),n.d(t,"c",function(){return s}),n.d(t,"b",function(){return l}),n.d(t,"a",function(){return d});var o=n(19),c=n(10),r=n.n(c),i=n(5),u=wc_product_block_data.isLargeCatalog||!1,a=wc_product_block_data.limitTags||!1,s=wc_product_block_data.hasTags||!1,l=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,r=[Object(o.addQueryArgs)("/wc/blocks/products",{per_page:u?100:-1,catalog_visibility:"visible",status:"publish",search:c})];return u&&n.length&&r.push(Object(o.addQueryArgs)("/wc/blocks/products",{catalog_visibility:"visible",status:"publish",include:n})),r}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return r()({path:e})})).then(function(e){return Object(i.uniqBy)(Object(i.flatten)(e),"id")})},d=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,c=e.search,r=[Object(o.addQueryArgs)("/wc/blocks/products/tags",{per_page:a?100:-1,orderby:a?"count":"name",order:a?"desc":"asc",search:c})];return a&&n.length&&r.push(Object(o.addQueryArgs)("/wc/blocks/products/tags",{include:n})),r}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return r()({path:e})})).then(function(e){return Object(i.uniqBy)(Object(i.flatten)(e),"id")})}},46:function(e,t){!function(){e.exports=this.wp.hooks}()},47:function(e,t,n){"use strict";var o=n(0),c=n(1),r=n(3),i=n(4),u=n.n(i),a=function(e){var t=e.value,n=e.setAttributes;return Object(o.createElement)(r.SelectControl,{label:Object(c.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(c.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(c.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(c.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(c.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(c.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(c.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(c.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return n({orderby:e})}})};a.propTypes={setAttributes:u.a.func.isRequired,value:u.a.string.isRequired},t.a=a},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},515:function(e,t,n){"use strict";n.r(t);var o=n(0),c=n(1),r=n(18),i=(n(270),n(13)),u=n.n(i),a=n(14),s=n.n(a),l=n(15),d=n.n(l),b=n(16),p=n.n(b),g=n(17),h=n.n(g),f=n(9),m=n(3),w=n(4),_=n.n(w),O=n(31),v=n(28),j=n(12),k=n.n(j),y=n(5),E=n(24),C=n(43),x=function(e){function t(){var e;return u()(this,t),(e=d()(this,p()(t).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(y.debounce)(e.onSearch.bind(k()(e)),400),e}return h()(t,e),s()(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(C.b)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(C.b)({selected:n,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var e=this.state,t=e.list,n=e.loading,r=this.props,i=r.onChange,u=r.selected,a={clear:Object(c.__)("Clear all products","woo-gutenberg-products-block"),list:Object(c.__)("Products","woo-gutenberg-products-block"),noItems:Object(c.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(c.__)("Search for products to display","woo-gutenberg-products-block"),selected:function(e){return Object(c.sprintf)(Object(c._n)("%d product selected","%d products selected",e,"woo-gutenberg-products-block"),e)},updated:Object(c.__)("Product search results updated.","woo-gutenberg-products-block")};return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E.a,{className:"woocommerce-products",list:t,isLoading:n,selected:u.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onSearch:C.d?this.debouncedOnSearch:null,onChange:i,messages:a}))}}]),t}(o.Component);x.propTypes={onChange:_.a.func.isRequired,selected:_.a.array.isRequired};var M=x,z=n(47),P=function(e){function t(){return u()(this,t),d()(this,p()(t).apply(this,arguments))}return h()(t,e),s()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,r=t.columns,i=t.contentVisibility,u=t.orderby,a=t.alignButtons;return Object(o.createElement)(f.InspectorControls,{key:"inspector"},Object(o.createElement)(m.PanelBody,{title:Object(c.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(m.RangeControl,{label:Object(c.__)("Columns","woo-gutenberg-products-block"),value:r,onChange:function(e){return n({columns:e})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(o.createElement)(m.ToggleControl,{label:Object(c.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(c.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(c.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return n({alignButtons:!a})}})),Object(o.createElement)(m.PanelBody,{title:Object(c.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(O.a,{settings:i,onChange:function(e){return n({contentVisibility:e})}})),Object(o.createElement)(m.PanelBody,{title:Object(c.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(o.createElement)(z.a,{setAttributes:n,value:u})),Object(o.createElement)(m.PanelBody,{title:Object(c.__)("Products","woo-gutenberg-products-block"),initialOpen:!1},Object(o.createElement)(M,{selected:t.products,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({products:t})}})))}},{key:"renderEditMode",value:function(){var e=this.props,t=e.attributes,n=e.debouncedSpeak,r=e.setAttributes;return Object(o.createElement)(m.Placeholder,{icon:Object(o.createElement)(v.f,null),label:Object(c.__)("Hand-picked Products","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-handpicked-products"},Object(c.__)("Display a selection of hand-picked products in a grid.","woo-gutenberg-products-block"),Object(o.createElement)("div",{className:"wc-block-handpicked-products__selection"},Object(o.createElement)(M,{selected:t.products,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});r({products:t})}}),Object(o.createElement)(m.Button,{isDefault:!0,onClick:function(){r({editMode:!1}),n(Object(c.__)("Showing Hand-picked Products block preview.","woo-gutenberg-products-block"))}},Object(c.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.name,r=e.setAttributes,i=t.editMode;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(f.BlockControls,null,Object(o.createElement)(m.Toolbar,{controls:[{icon:"edit",title:Object(c.__)("Edit"),onClick:function(){return r({editMode:!i})},isActive:i}]})),this.getInspectorControls(),i?this.renderEditMode():Object(o.createElement)(m.Disabled,null,Object(o.createElement)(f.ServerSideRender,{block:n,attributes:t})))}}]),t}(o.Component);P.propTypes={attributes:_.a.object.isRequired,name:_.a.string.isRequired,setAttributes:_.a.func.isRequired,debouncedSpeak:_.a.func.isRequired};var S=Object(m.withSpokenMessages)(P),B=n(35);Object(r.registerBlockType)("woocommerce/handpicked-products",{title:Object(c.__)("Hand-picked Products","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(v.f,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(c.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(c.__)("Display a selection of hand-picked products in a grid.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{align:{type:"string"},columns:{type:"number",default:wc_product_block_data.default_columns},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]},alignButtons:{type:"boolean",default:!1}},deprecated:[{attributes:{align:{type:"string"},columns:{type:"number",default:wc_product_block_data.default_columns},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]}},save:Object(B.a)("woocommerce/handpicked-products")}],edit:function(e){return Object(o.createElement)(S,e)},save:function(){return null}})},52:function(e,t){!function(){e.exports=this.wp.date}()},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["handpicked-products"]=function(e){function t(t){for(var r,i,a=t[0],l=t[1],u=t[2],d=0,b=[];d<a.length;d++)i=a[d],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&b.push(o[i][0]),o[i]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(s&&s(t);b.length;)b.shift()();return c.push.apply(c,u||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,a=1;a<n.length;a++){var l=n[a];0!==o[l]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=n[0]))}return e}var r={},o={7:0},c=[];function i(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,i),n.l=!0,n.exports}i.m=e,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var s=l;return c.push([548,2,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,n){"use strict";var r=n(0),o=n(2),c=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(r.createElement)("g",null,Object(r.createElement)("g",null,Object(r.createElement)("path",{fill:n,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(r.createElement)("path",{fill:n,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(r.createElement)("path",{fill:n,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},i=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(r.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(r.createElement)(o.Icon,{className:"material-icon",icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(r.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},u=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},d=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)("path",{fill:n,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(r.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},b=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(r.createElement)("path",{fill:n,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(r.createElement)("path",{fill:n,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(r.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(r.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(r.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},p=function(){return Object(r.createElement)(o.Icon,{className:"material-icon",icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(r.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},g=n(6),h=n.n(g),f=(n(7),function(e){var t=e.size,n=void 0===t?20:t,c=e.className;return Object(r.createElement)(o.Icon,{className:h()("woo-icon",c),icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(r.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(r.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});n.d(t,"a",function(){return c}),n.d(t,"b",function(){return i}),n.d(t,"c",function(){return a}),n.d(t,"d",function(){return l}),n.d(t,"e",function(){return u}),n.d(t,"f",function(){return s}),n.d(t,"h",function(){return d}),n.d(t,"g",function(){return b}),n.d(t,"i",function(){return p}),n.d(t,"j",function(){return f})},25:function(e,t,n){"use strict";n.d(t,"d",function(){return b}),n.d(t,"b",function(){return p}),n.d(t,"c",function(){return g}),n.d(t,"a",function(){return h});var r=n(20),o=n.n(r),c=n(19),i=n(17),a=n.n(i),l=n(4),u=n(5);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(n,!0).forEach(function(t){o()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var b=function(e){var t=e.selected,n=void 0===t?[]:t,r=e.search,o=void 0===r?"":r,i=e.queryArgs,s=function(e){var t=e.selected,n=void 0===t?[]:t,r=e.search,o=void 0===r?"":r,i=e.queryArgs,a=void 0===i?[]:i,l={per_page:u.IS_LARGE_CATALOG?100:-1,catalog_visibility:"any",status:"publish",search:o,orderby:"title",order:"asc"},s=[Object(c.addQueryArgs)(u.ENDPOINTS.products,d({},l,{},a))];return u.IS_LARGE_CATALOG&&n.length&&s.push(Object(c.addQueryArgs)(u.ENDPOINTS.products,{catalog_visibility:"any",status:"publish",include:n})),s}({selected:n,search:o,queryArgs:void 0===i?[]:i});return Promise.all(s.map(function(e){return a()({path:e})})).then(function(e){return Object(l.uniqBy)(Object(l.flatten)(e),"id")})},p=function(e){return a()({path:"".concat(u.ENDPOINTS.products,"/").concat(e)})},g=function(e){var t=e.selected,n=function(e){var t=e.selected,n=void 0===t?[]:t,r=e.search,o=[Object(c.addQueryArgs)("".concat(u.ENDPOINTS.products,"/tags"),{per_page:u.LIMIT_TAGS?100:-1,orderby:u.LIMIT_TAGS?"count":"name",order:u.LIMIT_TAGS?"desc":"asc",search:r})];return u.LIMIT_TAGS&&n.length&&o.push(Object(c.addQueryArgs)("".concat(u.ENDPOINTS.products,"/tags"),{include:n})),o}({selected:void 0===t?[]:t,search:e.search});return Promise.all(n.map(function(e){return a()({path:e})})).then(function(e){return Object(l.uniqBy)(Object(l.flatten)(e),"id")})},h=function(e){return a()({path:"".concat(u.ENDPOINTS.categories,"/").concat(e)})}},300:function(e,t,n){var r=n(301);"string"==typeof r&&(r=[[e.i,r,""]]);var o={insert:"head",singleton:!1};n(35)(r,o);r.locals&&(e.exports=r.locals)},301:function(e,t,n){},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},37:function(e,t,n){"use strict";var r=n(20),o=n.n(r),c=n(0),i=n(1),a=(n(7),n(2));function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){o()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}t.a=function(e){var t=e.onChange,n=e.settings,r=n.button,o=n.price,l=n.rating,s=n.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:s?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return t(u({},n,{title:!s}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:o?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:o,onChange:function(){return t(u({},n,{price:!o}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:l?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(u({},n,{rating:!l}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(u({},n,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},44:function(e,t){!function(){e.exports=this.ReactDOM}()},46:function(e,t,n){"use strict";var r=n(0),o=n(6),c=n.n(o),i=n(58),a=n.n(i),l=n(5);n.d(t,"a",function(){return u});var u=function(e){return function(t){var n=t.attributes,o=n.align,i=n.contentVisibility,u=c()(o?"align".concat(o):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:u},function(e,t){var n=e.attributes,r=n.attributes,o=n.attrOperator,c=n.categories,i=n.catOperator,u=n.orderby,s=n.products,d=n.columns||l.DEFAULT_COLUMNS,b=n.rows||l.DEFAULT_ROWS,p=new Map;switch(p.set("limit",b*d),p.set("columns",d),c&&c.length&&(p.set("category",c.join(",")),i&&"all"===i&&p.set("cat_operator","AND")),r&&r.length&&(p.set("terms",r.map(function(e){return e.id}).join(",")),p.set("attribute",r[0].attr_slug),o&&"all"===o&&p.set("terms_operator","AND")),u&&("price_desc"===u?(p.set("orderby","price"),p.set("order","DESC")):"price_asc"===u?(p.set("orderby","price"),p.set("order","ASC")):"date"===u?(p.set("orderby","date"),p.set("order","DESC")):p.set("orderby",u)),t){case"woocommerce/product-best-sellers":p.set("best_selling","1");break;case"woocommerce/product-top-rated":p.set("orderby","rating");break;case"woocommerce/product-on-sale":p.set("on_sale","1");break;case"woocommerce/product-new":p.set("orderby","date"),p.set("order","DESC");break;case"woocommerce/handpicked-products":if(!s.length)return"";p.set("ids",s.join(",")),p.set("limit",s.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",h=!0,f=!1,O=void 0;try{for(var m,w=p[Symbol.iterator]();!(h=(m=w.next()).done);h=!0){var v=a()(m.value,2);g+=" "+v[0]+'="'+v[1]+'"'}}catch(e){f=!0,O=e}finally{try{h||null==w.return||w.return()}finally{if(f)throw O}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},548:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n(1),c=n(23),i=n(5),a=(n(300),n(8)),l=n.n(a),u=n(9),s=n.n(u),d=n(10),b=n.n(d),p=n(11),g=n.n(p),h=n(12),f=n.n(h),O=n(18),m=n(2),w=(n(7),n(37)),v=n(24),j=n(26),y=n(71),_=function(e){var t=e.onChange,n=e.onSearch,c=e.selected,i=e.products,a=e.isLoading,l={clear:Object(o.__)("Clear all products","woo-gutenberg-products-block"),list:Object(o.__)("Products","woo-gutenberg-products-block"),noItems:Object(o.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(o.__)("Search for products to display","woo-gutenberg-products-block"),selected:function(e){return Object(o.sprintf)(Object(o._n)("%d product selected","%d products selected",e,"woo-gutenberg-products-block"),e)},updated:Object(o.__)("Product search results updated.","woo-gutenberg-products-block")};return Object(r.createElement)(j.a,{className:"woocommerce-products",list:i,isLoading:a,selected:c,onSearch:n,onChange:t,messages:l})};_.defaultProps={selected:[],products:[],isLoading:!0};var E=Object(y.c)(_),k=n(57),C=function(e){function t(){return l()(this,t),b()(this,g()(t).apply(this,arguments))}return f()(t,e),s()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,c=t.columns,a=t.contentVisibility,l=t.orderby,u=t.alignButtons;return Object(r.createElement)(O.InspectorControls,{key:"inspector"},Object(r.createElement)(m.PanelBody,{title:Object(o.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(m.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:c,onChange:function(e){return n({columns:e})},min:i.MIN_COLUMNS,max:i.MAX_COLUMNS}),Object(r.createElement)(m.ToggleControl,{label:Object(o.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:u?Object(o.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(o.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:u,onChange:function(){return n({alignButtons:!u})}})),Object(r.createElement)(m.PanelBody,{title:Object(o.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(w.a,{settings:a,onChange:function(e){return n({contentVisibility:e})}})),Object(r.createElement)(m.PanelBody,{title:Object(o.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(r.createElement)(k.a,{setAttributes:n,value:l})),Object(r.createElement)(m.PanelBody,{title:Object(o.__)("Products","woo-gutenberg-products-block"),initialOpen:!1},Object(r.createElement)(E,{selected:t.products,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({products:t})}})))}},{key:"renderEditMode",value:function(){var e=this.props,t=e.attributes,n=e.debouncedSpeak,c=e.setAttributes;return Object(r.createElement)(m.Placeholder,{icon:Object(r.createElement)(v.i,null),label:Object(o.__)("Hand-picked Products","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-handpicked-products"},Object(o.__)("Display a selection of hand-picked products in a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-handpicked-products__selection"},Object(r.createElement)(E,{selected:t.products,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});c({products:t})}}),Object(r.createElement)(m.Button,{isDefault:!0,onClick:function(){c({editMode:!1}),n(Object(o.__)("Showing Hand-picked Products block preview.","woo-gutenberg-products-block"))}},Object(o.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.name,c=e.setAttributes,i=t.editMode;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(O.BlockControls,null,Object(r.createElement)(m.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit"),onClick:function(){return c({editMode:!i})},isActive:i}]})),this.getInspectorControls(),i?this.renderEditMode():Object(r.createElement)(m.Disabled,null,Object(r.createElement)(O.ServerSideRender,{block:n,attributes:t})))}}]),t}(r.Component),S=Object(m.withSpokenMessages)(C),P=n(46);Object(c.registerBlockType)("woocommerce/handpicked-products",{title:Object(o.__)("Hand-picked Products","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(v.i,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(o.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(o.__)("Display a selection of hand-picked products in a grid.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{align:{type:"string"},columns:{type:"number",default:i.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]},alignButtons:{type:"boolean",default:!1}},deprecated:[{attributes:{align:{type:"string"},columns:{type:"number",default:i.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},products:{type:"array",default:[]}},save:Object(P.a)("woocommerce/handpicked-products")}],edit:function(e){return Object(r.createElement)(S,e)},save:function(){return null}})},57:function(e,t,n){"use strict";var r=n(0),o=n(1),c=n(2);n(7);t.a=function(e){var t=e.value,n=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(o.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(o.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(o.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(o.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(o.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(o.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(o.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(o.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return n({orderby:e})}})}},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},71:function(e,t,n){"use strict";var r=n(16),o=n.n(r),c=n(38),i=n.n(c),a=n(8),l=n.n(a),u=n(9),s=n.n(u),d=n(10),b=n.n(d),p=n(11),g=n.n(p),h=n(15),f=n.n(h),O=n(12),m=n.n(O),w=n(0),v=n(21),j=n(25),y=Object(v.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,product:null},e.loadProduct=e.loadProduct.bind(f()(e)),e}return m()(n,t),s()(n,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"loadProduct",value:function(){var e=this,t=this.props.attributes.productId;t?(this.setState({loading:!0}),Object(j.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var n="object"===i()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({product:null,loading:!1,error:n})})):this.setState({product:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,r=t.loading,c=t.product;return Object(w.createElement)(e,o()({},this.props,{error:n,getProduct:this.loadProduct,isLoading:r,product:c}))}}]),n}(w.Component)},"withProduct"),_=Object(v.createHigherOrderComponent)(function(e){return function(t){function n(){var e;return l()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={error:null,loading:!1,category:null},e.loadCategory=e.loadCategory.bind(f()(e)),e}return m()(n,t),s()(n,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?(this.setState({loading:!0}),Object(j.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var n="object"===i()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({category:null,loading:!1,error:n})})):this.setState({category:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,n=t.error,r=t.loading,c=t.category;return Object(w.createElement)(e,o()({},this.props,{error:n,getCategory:this.loadCategory,isLoading:r,category:c}))}}]),n}(w.Component)},"withCategory"),E=n(4),k=(n(7),n(5)),C=Object(v.createHigherOrderComponent)(function(e){var t=function(t){function n(){var e;return l()(this,n),(e=b()(this,g()(n).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(E.debounce)(e.onSearch.bind(f()(e)),400),e}return m()(n,t),s()(n,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(j.d)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,n=this.props.selected;Object(j.d)({selected:n,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var t=this.state,n=t.list,r=t.loading,c=this.props.selected;return Object(w.createElement)(e,o()({},this.props,{products:n,isLoading:r,selected:n.filter(function(e){var t=e.id;return c.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),n}(w.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");n.d(t,"b",function(){return y}),n.d(t,"a",function(){return _}),n.d(t,"c",function(){return C})}});
|
build/product-best-sellers.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-best-sellers.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-best-sellers"]=function(e){function t(t){for(var r,s,i=t[0],a=t[1],u=t[2],b=0,d=[];b<i.length;b++)s=i[b],n[s]&&d.push(n[s][0]),n[s]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,i=1;i<o.length;i++){var a=o[i];0!==n[a]&&(r=!1)}r&&(c.splice(t--,1),e=s(s.s=o[0]))}return e}var r={},n={7:0},c=[];function s(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,s),o.l=!0,o.exports}s.m=e,s.c=r,s.d=function(e,t,o){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(s.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)s.d(o,r,function(t){return e[t]}.bind(null,r));return o},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=i.push.bind(i);i.push=t,i=i.slice();for(var u=0;u<i.length;u++)t(i[u]);var l=a;return c.push([519,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,o){"use strict";o.d(t,"b",function(){return r});var r=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},31:function(e,t,o){"use strict";var r=o(8),n=o.n(r),c=o(0),s=o(1),i=o(4),a=o.n(i),u=o(3),l=function(e){var t=e.onChange,o=e.settings,r=o.button,i=o.price,a=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(s.__)("Product title","woo-gutenberg-products-block"),help:l?Object(s.__)("Product title is visible.","woo-gutenberg-products-block"):Object(s.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(n()({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(s.__)("Product price","woo-gutenberg-products-block"),help:i?Object(s.__)("Product price is visible.","woo-gutenberg-products-block"):Object(s.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:i,onChange:function(){return t(n()({},o,{price:!i}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(s.__)("Product rating","woo-gutenberg-products-block"),help:a?Object(s.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(s.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return t(n()({},o,{rating:!a}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(s.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(s.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(s.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(n()({},o,{button:!r}))}}))};l.propTypes={settings:a.a.shape({button:a.a.bool.isRequired,price:a.a.bool.isRequired,rating:a.a.bool.isRequired,title:a.a.bool.isRequired}).isRequired,onChange:a.a.func.isRequired},t.a=l},34:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(5),s=o(4),i=o.n(s),a=o(3),u=function(e){var t=e.columns,o=e.rows,s=e.setAttributes,i=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_columns,wc_product_block_data.max_columns);s({columns:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(r.createElement)(a.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_rows,wc_product_block_data.max_rows);s({rows:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(r.createElement)(a.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:i?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:i,onChange:function(){return s({alignButtons:!i})}}))};u.propTypes={columns:i.a.oneOfType([i.a.number,i.a.string]).isRequired,rows:i.a.oneOfType([i.a.number,i.a.string]).isRequired,alignButtons:i.a.bool.isRequired,setAttributes:i.a.func.isRequired},t.a=u},35:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),s=o(48),i=o.n(s);o.d(t,"a",function(){return a});var a=function(e){return function(t){var o=t.attributes,n=o.align,s=o.contentVisibility,a=c()(n?"align".concat(n):"",{"is-hidden-title":!s.title,"is-hidden-price":!s.price,"is-hidden-rating":!s.rating,"is-hidden-button":!s.button});return Object(r.createElement)(r.RawHTML,{className:a},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,s=o.catOperator,a=o.orderby,u=o.products,l=o.columns||wc_product_block_data.default_columns,b=o.rows||wc_product_block_data.default_rows,d=new Map;switch(d.set("limit",b*l),d.set("columns",l),c&&c.length&&(d.set("category",c.join(",")),s&&"all"===s&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),a&&("price_desc"===a?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===a?(d.set("orderby","price"),d.set("order","ASC")):"date"===a?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",a)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!u.length)return"";d.set("ids",u.join(",")),d.set("limit",u.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var p="[products",g=!0,m=!1,f=void 0;try{for(var _,h=d[Symbol.iterator]();!(g=(_=h.next()).done);g=!0){var w=i()(_.value,2);p+=" "+w[0]+'="'+w[1]+'"'}}catch(e){m=!0,f=e}finally{try{g||null==h.return||h.return()}finally{if(m)throw f}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var r=o(27),n=o.n(r),c=o(13),s=o.n(c),i=o(14),a=o.n(i),u=o(15),l=o.n(u),b=o(16),d=o.n(b),p=o(12),g=o.n(p),m=o(17),f=o.n(m),_=o(0),h=o(1),w=o(19),O=o(10),j=o.n(O),k=o(5),y=o(4),v=o.n(y),C=o(24),x=o(3),E=(o(79),function(e){function t(){var e;return s()(this,t),(e=l()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return f()(t,e),a()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(w.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,s=["woocommerce-product-categories__item"];o.length&&s.push("is-searching"),0===c&&0!==t.parent&&s.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(_.createElement)(C.b,n()({className:s.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,s=r.operator,i=r.selected,a=r.isSingle,u={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(C.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:i.map(function(e){return Object(k.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:u,isHierarchical:!0,isSingle:a}),!!c&&Object(_.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(_.createElement)(x.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:s,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(_.Component));E.propTypes={onChange:v.a.func.isRequired,onOperatorChange:v.a.func,operator:v.a.oneOf(["all","any"]),selected:v.a.array.isRequired,isSingle:v.a.bool},E.defaultProps={operator:"any",isSingle:!1},t.a=E},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},519:function(e,t,o){"use strict";o.r(t);var r=o(8),n=o.n(r),c=o(0),s=o(1),i=o(18),a=o(5),u=o(25),l=o.n(u),b=o(13),d=o.n(b),p=o(14),g=o.n(p),m=o(15),f=o.n(m),_=o(16),h=o.n(_),w=o(17),O=o.n(w),j=o(3),k=o(9),y=o(4),v=o.n(y),C=o(31),x=o(34),E=o(37),P=function(e){function t(){return d()(this,t),f()(this,h()(t).apply(this,arguments))}return O()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,i=t.columns,a=t.contentVisibility,u=t.rows,l=t.alignButtons;return Object(c.createElement)(k.InspectorControls,{key:"inspector"},Object(c.createElement)(j.PanelBody,{title:Object(s.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(x.a,{columns:i,rows:u,alignButtons:l,setAttributes:o})),Object(c.createElement)(j.PanelBody,{title:Object(s.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(C.a,{settings:a,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(j.PanelBody,{title:Object(s.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(E.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,o=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(j.Disabled,null,Object(c.createElement)(k.ServerSideRender,{block:o,attributes:t})))}}]),t}(c.Component);P.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired};var R=P,S=o(35),B=o(30);Object(i.registerBlockType)("woocommerce/product-best-sellers",{title:Object(s.__)("Best Selling Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(l.a,{icon:"stats-up-alt"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(s.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(s.__)("Display a grid of your all-time best selling products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:n()({},B.a),transforms:{from:[{type:"block",blocks:Object(a.without)(B.b,"woocommerce/product-best-sellers"),transform:function(e){return Object(i.createBlock)("woocommerce/product-best-sellers",e)}}]},deprecated:[{attributes:B.a,save:Object(S.a)("woocommerce/product-best-sellers")}],edit:function(e){return Object(c.createElement)(R,e)},save:function(){return null}})},52:function(e,t){!function(){e.exports=this.wp.date}()},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-best-sellers"]=function(e){function t(t){for(var r,i,s=t[0],u=t[1],a=t[2],b=0,p=[];b<s.length;b++)i=s[b],Object.prototype.hasOwnProperty.call(n,i)&&n[i]&&p.push(n[i][0]),n[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,a||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,s=1;s<o.length;s++){var u=o[s];0!==n[u]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=o[0]))}return e}var r={},n={8:0},c=[];function i(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=r,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=s.push.bind(s);s.push=t,s=s.slice();for(var a=0;a<s.length;a++)t(s[a]);var l=u;return c.push([559,1,0]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},36:function(e,t,o){"use strict";o.d(t,"b",function(){return n});var r=o(5),n=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:r.DEFAULT_COLUMNS},rows:{type:"number",default:r.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},37:function(e,t,o){"use strict";var r=o(20),n=o.n(r),c=o(0),i=o(1),s=(o(7),o(2));function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}t.a=function(e){var t=e.onChange,o=e.settings,r=o.button,n=o.price,u=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(a({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:n?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return t(a({},o,{price:!n}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:u?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return t(a({},o,{rating:!u}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(a({},o,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,o){"use strict";var r=o(16),n=o.n(r),c=o(8),i=o.n(c),s=o(9),u=o.n(s),a=o(10),l=o.n(a),b=o(11),p=o.n(b),d=o(15),g=o.n(d),f=o(12),m=o.n(f),O=o(0),h=o(1),w=o(19),j=o(17),y=o.n(j),_=o(4),v=(o(7),o(26)),k=o(2),C=o(5),P=(o(86),function(e){function t(){var e;return i()(this,t),(e=l()(this,p()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return m()(t,e),u()(t,[{key:"componentDidMount",value:function(){var e=this;y()({path:Object(w.addQueryArgs)("".concat(C.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];o.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var s=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(O.createElement)(v.b,n()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),s,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,i=r.operator,s=r.selected,u=r.isSingle,a={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(O.createElement)(O.Fragment,null,Object(O.createElement)(v.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:s.map(function(e){return Object(_.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:a,isHierarchical:!0,isSingle:u}),!!c&&Object(O.createElement)("div",{className:s.length<2?"screen-reader-text":""},Object(O.createElement)(k.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(O.Component));P.defaultProps={operator:"any",isSingle:!1},t.a=P},44:function(e,t){!function(){e.exports=this.ReactDOM}()},45:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(4),i=(o(7),o(2)),s=o(5);t.a=function(e){var t=e.columns,o=e.rows,u=e.setAttributes,a=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_COLUMNS,s.MAX_COLUMNS);u({columns:Object(c.isNaN)(t)?"":t})},min:s.MIN_COLUMNS,max:s.MAX_COLUMNS}),Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_ROWS,s.MAX_ROWS);u({rows:Object(c.isNaN)(t)?"":t})},min:s.MIN_ROWS,max:s.MAX_ROWS}),Object(r.createElement)(i.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return u({alignButtons:!a})}}))}},46:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(58),s=o.n(i),u=o(5);o.d(t,"a",function(){return a});var a=function(e){return function(t){var o=t.attributes,n=o.align,i=o.contentVisibility,a=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:a},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,a=o.orderby,l=o.products,b=o.columns||u.DEFAULT_COLUMNS,p=o.rows||u.DEFAULT_ROWS,d=new Map;switch(d.set("limit",p*b),d.set("columns",b),c&&c.length&&(d.set("category",c.join(",")),i&&"all"===i&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),a&&("price_desc"===a?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===a?(d.set("orderby","price"),d.set("order","ASC")):"date"===a?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",a)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!l.length)return"";d.set("ids",l.join(",")),d.set("limit",l.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",f=!0,m=!1,O=void 0;try{for(var h,w=d[Symbol.iterator]();!(f=(h=w.next()).done);f=!0){var j=s()(h.value,2);g+=" "+j[0]+'="'+j[1]+'"'}}catch(e){m=!0,O=e}finally{try{f||null==w.return||w.return()}finally{if(m)throw O}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},559:function(e,t,o){"use strict";o.r(t);var r=o(20),n=o.n(r),c=o(0),i=o(1),s=o(23),u=o(4),a=o(29),l=o.n(a),b=o(8),p=o.n(b),d=o(9),g=o.n(d),f=o(10),m=o.n(f),O=o(11),h=o.n(O),w=o(12),j=o.n(w),y=o(2),_=o(18),v=(o(7),o(37)),k=o(45),C=o(41),P=function(e){function t(){return p()(this,t),m()(this,h()(t).apply(this,arguments))}return j()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,s=t.columns,u=t.contentVisibility,a=t.rows,l=t.alignButtons;return Object(c.createElement)(_.InspectorControls,{key:"inspector"},Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(k.a,{columns:s,rows:a,alignButtons:l,setAttributes:o})),Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(v.a,{settings:u,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(C.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,o=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(y.Disabled,null,Object(c.createElement)(_.ServerSideRender,{block:o,attributes:t})))}}]),t}(c.Component),E=o(46),S=o(36);function x(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}Object(s.registerBlockType)("woocommerce/product-best-sellers",{title:Object(i.__)("Best Selling Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(l.a,{icon:"stats-up-alt"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of your all-time best selling products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?x(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):x(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}({},S.a),transforms:{from:[{type:"block",blocks:Object(u.without)(S.b,"woocommerce/product-best-sellers"),transform:function(e){return Object(s.createBlock)("woocommerce/product-best-sellers",e)}}]},deprecated:[{attributes:S.a,save:Object(E.a)("woocommerce/product-best-sellers")}],edit:function(e){return Object(c.createElement)(P,e)},save:function(){return null}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){}});
|
build/product-categories-frontend.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["react","react-dom","wc-block-settings","wp-i18n","wp-polyfill"]
|
build/product-categories-frontend.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=33)}([function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){var n=r(13),o=r(2);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){var n=r(17);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},function(e,t,r){var n;
|
2 |
+
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
+
Licensed under the MIT License (MIT), see
|
5 |
+
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var c=o.apply(null,n);c&&e.push(c)}else if("object"===i)for(var a in n)r.call(n,a)&&n[a]&&e.push(a)}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},,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}},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,r){"use strict";var n=r(12),o=r.n(n),i=r(3),c=r.n(i),a=r(4),u=r.n(a),s=r(5),l=r.n(s),p=r(6),f=r.n(p),y=r(7),b=r.n(y),d=r(1),h=[];t.a=function(e){return function(t){function r(){return c()(this,r),l()(this,f()(r).apply(this,arguments))}return b()(r,t),u()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return h[e]||(h[e]=0),h[e]++,h[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return React.createElement(e,o()({},this.props,{componentId:t}))}}]),r}(d.Component)}},,function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},function(e,t,r){var n=r(22),o=r(23),i=r(24);e.exports=function(e){return n(e)||o(e)||i()}},,,,function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(14),o=r(3),i=r.n(o),c=r(4),a=r.n(c),u=r(5),s=r.n(u),l=r(6),p=r.n(l),f=r(2),y=r.n(f),b=r(7),d=r.n(b),h=r(0),m=r(1),v=r(9),g=r.n(v),O=r(8),w=r(15),j=function(e){function t(){var e;return i()(this,t),(e=s()(this,p()(t).apply(this,arguments))).select=Object(m.createRef)(),e.onNavigate=e.onNavigate.bind(y()(e)),e.renderList=e.renderList.bind(y()(e)),e.renderOptions=e.renderOptions.bind(y()(e)),e}return d()(t,e),a()(t,[{key:"onNavigate",value:function(){var e=this.props.isPreview,t=void 0!==e&&e,r=this.select.current.value;if("false"!==r){var n=O.HOME_URL;t||0!==r.indexOf(n)||(document.location.href=r)}}},{key:"renderList",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.isPreview,o=void 0!==n&&n,i=this.props.attributes.hasCount,c="parent-"+e[0].term_id;return React.createElement("ul",{key:c},e.map(function(e){var n=i?React.createElement("span",null,"(",e.count,")"):null;return[React.createElement("li",{key:e.term_id},React.createElement("a",{href:o?null:e.link},e.name)," ",n," "),!!e.children&&!!e.children.length&&t.renderList(e.children,r+1)]}))}},{key:"renderOptions",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.props.attributes.hasCount;return e.map(function(e){var o=n?"(".concat(e.count,")"):null;return[React.createElement("option",{key:e.term_id,value:e.link},"–".repeat(r)," ",e.name," ",o),!!e.children&&!!e.children.length&&t.renderOptions(e.children,r+1)]})}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.categories,n=e.componentId,o=t.className,i=t.isDropdown,c=g()("wc-block-product-categories",o,{"is-dropdown":i,"is-list":!i}),a="prod-categories-".concat(n);return React.createElement(m.Fragment,null,r.length>0&&React.createElement("div",{className:c},i?React.createElement(m.Fragment,null,React.createElement("div",{className:"wc-block-product-categories__dropdown"},React.createElement("label",{className:"screen-reader-text",htmlFor:a},Object(h.__)("Select a category","woo-gutenberg-products-block")),React.createElement("select",{id:a,ref:this.select},React.createElement("option",{value:"false",hidden:!0},Object(h.__)("Select a category","woo-gutenberg-products-block")),this.renderOptions(r))),React.createElement("button",{type:"button",className:"wc-block-product-categories__button","aria-label":Object(h.__)("Go to category","woo-gutenberg-products-block"),icon:"arrow-right-alt2",onClick:this.onNavigate},React.createElement("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},React.createElement("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))):this.renderList(r)))}}]),t}(m.Component),x=Object(w.a)(j),E=r(18),_=r.n(E),S=r(11),P=r.n(S);function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function k(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.parent;return(e[o]||(e[o]=[])).push(t),e},{}),t=function t(r){return r.map(function(r){var n=e[r.term_id];return delete e[r.term_id],function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?R(r,!0).forEach(function(t){P()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},r,{children:n&&n.length?t(n):[]})})},r=t(e[0]||[]);return delete e[0],Object.keys(e).forEach(function(e){r.push.apply(r,_()(t(e||[])))}),r}var N=document.querySelectorAll(".wp-block-woocommerce-product-categories");N.length&&Array.prototype.forEach.call(N,function(e){var t=JSON.parse(JSON.stringify(e.dataset)),r={hasCount:"true"===t.hasCount,hasEmpty:"true"===t.hasEmpty,isDropdown:"true"===t.isDropdown,isHierarchical:"true"===t.isHierarchical},o=function(e){var t=e.hasEmpty,r=e.isHierarchical,n=O.PRODUCT_CATEGORIES.filter(function(e){return t||!!e.count});return r?k(n):n}(r);e.classList.remove("is-loading"),Object(n.render)(React.createElement(x,{attributes:r,categories:o}),e)})}]);
|
build/product-categories.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","react","wp-blocks","wp-components","wp-compose","wp-editor","wp-element","wp-i18n","wp-polyfill"]
|
1 |
+
["lodash","react","wc-block-settings","wp-blocks","wp-components","wp-compose","wp-editor","wp-element","wp-i18n","wp-polyfill"]
|
build/product-categories.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-categories"]=function(e){function t(t){for(var c,a,l=t[0],i=t[1],s=t[2],d=0,b=[];d<l.length;d++)a=l[d],r[a]&&b.push(r[a][0]),r[a]=0;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c]);for(u&&u(t);b.length;)b.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,l=1;l<n.length;l++){var i=n[l];0!==r[i]&&(c=!1)}c&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},r={8:0},o=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=i;return o.push([512,0,2,1]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},253:function(e,t,n){var c=n(489);"string"==typeof c&&(c=[[e.i,c,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};n(38)(c,r);c.locals&&(e.exports=c.locals)},28:function(e,t,n){"use strict";var c=n(0),r=n(3),o=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},i=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},s=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},d=n(6),b=n.n(d),p=n(4),h=n.n(p),g=function(e){var t=e.size,n=void 0===t?20:t,o=e.className;return Object(c.createElement)(r.Icon,{className:b()("woo-icon",o),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};g.propTypes={size:h.a.number,className:h.a.string};var m=g;n.d(t,"a",function(){return o}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return l}),n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"g",function(){return m})},3:function(e,t){!function(){e.exports=this.wp.components}()},489:function(e,t,n){},5:function(e,t){!function(){e.exports=this.lodash}()},512:function(e,t,n){"use strict";n.r(t);var c=n(27),r=n.n(c),o=n(0),a=n(1),l=n(18),i=(n(253),n(490),n(9)),s=n(3),u=n(13),d=n.n(u),b=n(14),p=n.n(b),h=n(15),g=n.n(h),m=n(16),f=n.n(m),v=n(12),w=n.n(v),O=n(17),j=n.n(O),_=n(11),E=n(6),k=n.n(E),y=[],C=function(e){return function(t){function n(){return d()(this,n),g()(this,f()(n).apply(this,arguments))}return j()(n,t),p()(n,[{key:"generateUniqueID",value:function(){var e=n.name;return y[e]||(y[e]=0),y[e]++,y[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(o.createElement)(e,r()({},this.props,{componentId:t}))}}]),n}(_.Component)}(function(e){function t(){var e;return d()(this,t),(e=g()(this,f()(t).apply(this,arguments))).select=Object(_.createRef)(),e.onNavigate=e.onNavigate.bind(w()(e)),e.renderList=e.renderList.bind(w()(e)),e.renderOptions=e.renderOptions.bind(w()(e)),e}return j()(t,e),p()(t,[{key:"onNavigate",value:function(){var e=this.props.isPreview,t=void 0!==e&&e,n=this.select.current.value;if("false"!==n){var c=wc_product_block_data.homeUrl;t||0!==n.indexOf(c)||(document.location.href=n)}}},{key:"renderList",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=this.props.isPreview,r=void 0!==c&&c,a=this.props.attributes.hasCount,l="parent-"+e[0].term_id;return Object(o.createElement)("ul",{key:l},e.map(function(e){var c=a?Object(o.createElement)("span",null,"(",e.count,")"):null;return[Object(o.createElement)("li",{key:e.term_id},Object(o.createElement)("a",{href:r?null:e.link},e.name)," ",c," "),!!e.children&&!!e.children.length&&t.renderList(e.children,n+1)]}))}},{key:"renderOptions",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=this.props.attributes.hasCount;return e.map(function(e){var r=c?"(".concat(e.count,")"):null;return[Object(o.createElement)("option",{key:e.term_id,value:e.link},"–".repeat(n)," ",e.name," ",r),!!e.children&&!!e.children.length&&t.renderOptions(e.children,n+1)]})}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.categories,c=e.componentId,r=t.className,l=t.isDropdown,i=k()("wc-block-product-categories",r,{"is-dropdown":l,"is-list":!l}),s="prod-categories-".concat(c);return Object(o.createElement)(_.Fragment,null,n.length>0&&Object(o.createElement)("div",{className:i},l?Object(o.createElement)(_.Fragment,null,Object(o.createElement)("div",{className:"wc-block-product-categories__dropdown"},Object(o.createElement)("label",{className:"screen-reader-text",htmlFor:s},Object(a.__)("Select a category","woo-gutenberg-products-block")),Object(o.createElement)("select",{id:s,ref:this.select},Object(o.createElement)("option",{value:"false",hidden:!0},Object(a.__)("Select a category","woo-gutenberg-products-block")),this.renderOptions(n))),Object(o.createElement)("button",{type:"button",className:"wc-block-product-categories__button","aria-label":Object(a.__)("Go to category","woo-gutenberg-products-block"),icon:"arrow-right-alt2",onClick:this.onNavigate},Object(o.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(o.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))):this.renderList(n)))}}]),t}(_.Component)),x=n(5),z=n(22),N=(n(492),function(e){function t(){var e;return d()(this,t),(e=g()(this,f()(t).apply(this,arguments))).onClick=e.onClick.bind(w()(e)),e}return j()(t,e),p()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,n=this.props,c=n.label,a=n.checked,l=n.instanceId,i=n.className,u=n.help,d=n.options,b=n.value,p="inspector-toggle-button-control-".concat(l);return u&&(e=Object(x.isFunction)(u)?u(a):u),Object(o.createElement)(s.BaseControl,{id:p,help:e,className:k()("components-toggle-button-control",i)},Object(o.createElement)("label",{id:p+"__label",htmlFor:p,className:"components-toggle-button-control__label"},c),Object(o.createElement)(s.ButtonGroup,{"aria-labelledby":p+"__label"},d.map(function(e,n){var a={};return b===e.value?(a.isPrimary=!0,a["aria-pressed"]=!0):(a.isDefault=!0,a["aria-pressed"]=!1),Object(o.createElement)(s.Button,r()({key:"".concat(e.label,"-").concat(e.value,"-").concat(n),value:e.value,onClick:t.onClick,"aria-label":c+": "+e.label},a),e.label)})))}}]),t}(o.Component)),M=Object(z.withInstanceId)(N),B=n(60),H=n.n(B),I=n(8),P=n.n(I);var L=function(e){var t=e.hasEmpty,n=e.isHierarchical,c=wc_product_block_data.productCategories.filter(function(e){return t||!!e.count});return n?function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t,n,c){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.parent;return(e[r]||(e[r]=[])).push(t),e},{}),t=function t(n){return n.map(function(n){var c=e[n.term_id];return delete e[n.term_id],P()({},n,{children:c&&c.length?t(c):[]})})},n=t(e[0]||[]);return delete e[0],Object.keys(e).forEach(function(e){n.push.apply(n,H()(t(e||[])))}),n}(c):c},S=n(28);Object(l.registerBlockType)("woocommerce/product-categories",{title:Object(a.__)("Product Categories List","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(S.a,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show your product categories as a list or dropdown.","woo-gutenberg-products-block"),supports:{align:["wide","full"]},attributes:{hasCount:{type:"boolean",default:!0,source:"attribute",selector:"div",attribute:"data-has-count"},hasEmpty:{type:"boolean",default:!1,source:"attribute",selector:"div",attribute:"data-has-empty"},isDropdown:{type:"boolean",default:!1,source:"attribute",selector:"div",attribute:"data-is-dropdown"},isHierarchical:{type:"boolean",default:!0,source:"attribute",selector:"div",attribute:"data-is-hierarchical"}},edit:function(e){var t=e.attributes,n=e.setAttributes,c=t.hasCount,r=t.hasEmpty,l=t.isDropdown,u=t.isHierarchical,d=L(t);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(s.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show product count","woo-gutenberg-products-block"),help:c?Object(a.__)("Product count is visible.","woo-gutenberg-products-block"):Object(a.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:c,onChange:function(){return n({hasCount:!c})}}),Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show hierarchy","woo-gutenberg-products-block"),help:u?Object(a.__)("Hierarchy is visible.","woo-gutenberg-products-block"):Object(a.__)("Hierarchy is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return n({isHierarchical:!u})}}),Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show empty categories","woo-gutenberg-products-block"),help:r?Object(a.__)("Empty categories are visible.","woo-gutenberg-products-block"):Object(a.__)("Empty categories are hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return n({hasEmpty:!r})}})),Object(o.createElement)(s.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(M,{label:Object(a.__)("Display style","woo-gutenberg-products-block"),value:l?"dropdown":"list",options:[{label:Object(a.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(a.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:function(e){return n({isDropdown:"dropdown"===e})}}))),d.length>0?Object(o.createElement)(C,{attributes:t,categories:d,isPreview:!0}):Object(o.createElement)(s.Placeholder,{className:"wc-block-product-categories",icon:Object(o.createElement)(S.a,null),label:Object(a.__)("Product Categories List","woo-gutenberg-products-block")},Object(a.__)("This block shows product categories for your store. In order to preview this you'll first need to create a product and assign it to a category.","woo-gutenberg-products-block")))},save:function(e){var t=e.attributes,n=t.hasCount,c=t.hasEmpty,a=t.isDropdown,l=t.isHierarchical,i={};return n&&(i["data-has-count"]=!0),c&&(i["data-has-empty"]=!0),a&&(i["data-is-dropdown"]=!0),l&&(i["data-is-hierarchical"]=!0),Object(o.createElement)("div",r()({className:"is-loading"},i),a?Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-categories__placeholder"}):Object(o.createElement)("ul",{"aria-hidden":!0},Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"})),Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"})),Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"}))))}})},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-categories"]=function(e){function t(t){for(var c,a,l=t[0],i=t[1],s=t[2],b=0,p=[];b<l.length;b++)a=l[b],Object.prototype.hasOwnProperty.call(r,a)&&r[a]&&p.push(r[a][0]),r[a]=0;for(c in i)Object.prototype.hasOwnProperty.call(i,c)&&(e[c]=i[c]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,l=1;l<n.length;l++){var i=n[l];0!==r[i]&&(c=!1)}c&&(o.splice(t--,1),e=a(a.s=n[0]))}return e}var c={},r={9:0},o=[];function a(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=c,a.d=function(e,t,n){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)a.d(n,c,function(t){return e[t]}.bind(null,c));return n},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var l=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=i;return o.push([545,2,1,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,n){"use strict";var c=n(0),r=n(2),o=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(c.createElement)("g",null,Object(c.createElement)("g",null,Object(c.createElement)("path",{fill:n,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(c.createElement)("path",{fill:n,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(c.createElement)("path",{fill:n,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},l=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(c.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(c.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(c.createElement)(r.Icon,{icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},b=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)("path",{fill:n,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(c.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(c.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},p=function(e){var t=e.className,n=e.fillColor;return Object(c.createElement)(r.Icon,{className:t,icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(c.createElement)("path",{fill:n,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(c.createElement)("path",{fill:n,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(c.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(c.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},h=function(){return Object(c.createElement)(r.Icon,{className:"material-icon",icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(c.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(c.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},d=n(6),f=n.n(d),m=(n(7),function(e){var t=e.size,n=void 0===t?20:t,o=e.className;return Object(c.createElement)(r.Icon,{className:f()("woo-icon",o),icon:Object(c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(c.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(c.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});n.d(t,"a",function(){return o}),n.d(t,"b",function(){return a}),n.d(t,"c",function(){return l}),n.d(t,"d",function(){return i}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"h",function(){return b}),n.d(t,"g",function(){return p}),n.d(t,"i",function(){return h}),n.d(t,"j",function(){return m})},279:function(e,t,n){var c=n(515);"string"==typeof c&&(c=[[e.i,c,""]]);var r={insert:"head",singleton:!1};n(35)(c,r);c.locals&&(e.exports=c.locals)},4:function(e,t){!function(){e.exports=this.lodash}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},515:function(e,t,n){},545:function(e,t,n){"use strict";n.r(t);var c=n(16),r=n.n(c),o=n(0),a=n(1),l=n(23),i=(n(279),n(516),n(18)),s=n(2),u=n(8),b=n.n(u),p=n(9),h=n.n(p),d=n(10),f=n.n(d),m=n(11),g=n.n(m),w=n(15),v=n.n(w),O=n(12),j=n.n(O),E=n(13),y=n(6),_=n.n(y),k=n(5),C=n(69),x=function(e){function t(){var e;return b()(this,t),(e=f()(this,g()(t).apply(this,arguments))).select=Object(E.createRef)(),e.onNavigate=e.onNavigate.bind(v()(e)),e.renderList=e.renderList.bind(v()(e)),e.renderOptions=e.renderOptions.bind(v()(e)),e}return j()(t,e),h()(t,[{key:"onNavigate",value:function(){var e=this.props.isPreview,t=void 0!==e&&e,n=this.select.current.value;if("false"!==n){var c=k.HOME_URL;t||0!==n.indexOf(c)||(document.location.href=n)}}},{key:"renderList",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=this.props.isPreview,r=void 0!==c&&c,a=this.props.attributes.hasCount,l="parent-"+e[0].term_id;return Object(o.createElement)("ul",{key:l},e.map(function(e){var c=a?Object(o.createElement)("span",null,"(",e.count,")"):null;return[Object(o.createElement)("li",{key:e.term_id},Object(o.createElement)("a",{href:r?null:e.link},e.name)," ",c," "),!!e.children&&!!e.children.length&&t.renderList(e.children,n+1)]}))}},{key:"renderOptions",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=this.props.attributes.hasCount;return e.map(function(e){var r=c?"(".concat(e.count,")"):null;return[Object(o.createElement)("option",{key:e.term_id,value:e.link},"–".repeat(n)," ",e.name," ",r),!!e.children&&!!e.children.length&&t.renderOptions(e.children,n+1)]})}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.categories,c=e.componentId,r=t.className,l=t.isDropdown,i=_()("wc-block-product-categories",r,{"is-dropdown":l,"is-list":!l}),s="prod-categories-".concat(c);return Object(o.createElement)(E.Fragment,null,n.length>0&&Object(o.createElement)("div",{className:i},l?Object(o.createElement)(E.Fragment,null,Object(o.createElement)("div",{className:"wc-block-product-categories__dropdown"},Object(o.createElement)("label",{className:"screen-reader-text",htmlFor:s},Object(a.__)("Select a category","woo-gutenberg-products-block")),Object(o.createElement)("select",{id:s,ref:this.select},Object(o.createElement)("option",{value:"false",hidden:!0},Object(a.__)("Select a category","woo-gutenberg-products-block")),this.renderOptions(n))),Object(o.createElement)("button",{type:"button",className:"wc-block-product-categories__button","aria-label":Object(a.__)("Go to category","woo-gutenberg-products-block"),icon:"arrow-right-alt2",onClick:this.onNavigate},Object(o.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(o.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))):this.renderList(n)))}}]),t}(E.Component),z=Object(C.a)(x),M=n(70),H=n(62),L=n.n(H),N=n(20),P=n.n(N);function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);t&&(c=c.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,c)}return n}function I(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce(function(e,t,n,c){var r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.parent;return(e[r]||(e[r]=[])).push(t),e},{}),t=function t(n){return n.map(function(n){var c=e[n.term_id];return delete e[n.term_id],function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(n,!0).forEach(function(t){P()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},n,{children:c&&c.length?t(c):[]})})},n=t(e[0]||[]);return delete e[0],Object.keys(e).forEach(function(e){n.push.apply(n,L()(t(e||[])))}),n}var S=n(24);Object(l.registerBlockType)("woocommerce/product-categories",{title:Object(a.__)("Product Categories List","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(S.b,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show your product categories as a list or dropdown.","woo-gutenberg-products-block"),supports:{align:["wide","full"]},attributes:{hasCount:{type:"boolean",default:!0,source:"attribute",selector:"div",attribute:"data-has-count"},hasEmpty:{type:"boolean",default:!1,source:"attribute",selector:"div",attribute:"data-has-empty"},isDropdown:{type:"boolean",default:!1,source:"attribute",selector:"div",attribute:"data-is-dropdown"},isHierarchical:{type:"boolean",default:!0,source:"attribute",selector:"div",attribute:"data-is-hierarchical"}},edit:function(e){var t=e.attributes,n=e.setAttributes,c=t.hasCount,r=t.hasEmpty,l=t.isDropdown,u=t.isHierarchical,b=function(e){var t=e.hasEmpty,n=e.isHierarchical,c=k.PRODUCT_CATEGORIES.filter(function(e){return t||!!e.count});return n?I(c):c}(t);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.InspectorControls,{key:"inspector"},Object(o.createElement)(s.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show product count","woo-gutenberg-products-block"),help:c?Object(a.__)("Product count is visible.","woo-gutenberg-products-block"):Object(a.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:c,onChange:function(){return n({hasCount:!c})}}),Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show hierarchy","woo-gutenberg-products-block"),help:u?Object(a.__)("Hierarchy is visible.","woo-gutenberg-products-block"):Object(a.__)("Hierarchy is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return n({isHierarchical:!u})}}),Object(o.createElement)(s.ToggleControl,{label:Object(a.__)("Show empty categories","woo-gutenberg-products-block"),help:r?Object(a.__)("Empty categories are visible.","woo-gutenberg-products-block"):Object(a.__)("Empty categories are hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return n({hasEmpty:!r})}})),Object(o.createElement)(s.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(M.a,{label:Object(a.__)("Display style","woo-gutenberg-products-block"),value:l?"dropdown":"list",options:[{label:Object(a.__)("List","woo-gutenberg-products-block"),value:"list"},{label:Object(a.__)("Dropdown","woo-gutenberg-products-block"),value:"dropdown"}],onChange:function(e){return n({isDropdown:"dropdown"===e})}}))),b.length>0?Object(o.createElement)(z,{attributes:t,categories:b,isPreview:!0}):Object(o.createElement)(s.Placeholder,{className:"wc-block-product-categories",icon:Object(o.createElement)(S.b,null),label:Object(a.__)("Product Categories List","woo-gutenberg-products-block")},Object(a.__)("This block shows product categories for your store. In order to preview this you'll first need to create a product and assign it to a category.","woo-gutenberg-products-block")))},save:function(e){var t=e.attributes,n=t.hasCount,c=t.hasEmpty,a=t.isDropdown,l=t.isHierarchical,i={};return n&&(i["data-has-count"]=!0),c&&(i["data-has-empty"]=!0),a&&(i["data-is-dropdown"]=!0),l&&(i["data-is-hierarchical"]=!0),Object(o.createElement)("div",r()({className:"is-loading"},i),a?Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-categories__placeholder"}):Object(o.createElement)("ul",{"aria-hidden":!0},Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"})),Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"})),Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-product-categories__placeholder"}))))}})},69:function(e,t,n){"use strict";var c=n(16),r=n.n(c),o=n(8),a=n.n(o),l=n(9),i=n.n(l),s=n(10),u=n.n(s),b=n(11),p=n.n(b),h=n(12),d=n.n(h),f=n(0),m=n(13),g=[];t.a=function(e){return function(t){function n(){return a()(this,n),u()(this,p()(n).apply(this,arguments))}return d()(n,t),i()(n,[{key:"generateUniqueID",value:function(){var e=n.name;return g[e]||(g[e]=0),g[e]++,g[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(f.createElement)(e,r()({},this.props,{componentId:t}))}}]),n}(m.Component)}},70:function(e,t,n){"use strict";var c=n(16),r=n.n(c),o=n(8),a=n.n(o),l=n(9),i=n.n(l),s=n(10),u=n.n(s),b=n(11),p=n.n(b),h=n(15),d=n.n(h),f=n(12),m=n.n(f),g=n(0),w=n(4),v=n(6),O=n.n(v),j=n(2),E=n(21),y=(n(132),function(e){function t(){var e;return a()(this,t),(e=u()(this,p()(t).apply(this,arguments))).onClick=e.onClick.bind(d()(e)),e}return m()(t,e),i()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,n=this.props,c=n.label,o=n.checked,a=n.instanceId,l=n.className,i=n.help,s=n.options,u=n.value,b="inspector-toggle-button-control-".concat(a);return i&&(e=Object(w.isFunction)(i)?i(o):i),Object(g.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",l)},Object(g.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},c),Object(g.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},s.map(function(e,n){var o={};return u===e.value?(o.isPrimary=!0,o["aria-pressed"]=!0):(o.isDefault=!0,o["aria-pressed"]=!1),Object(g.createElement)(j.Button,r()({key:"".concat(e.label,"-").concat(e.value,"-").concat(n),value:e.value,onClick:t.onClick,"aria-label":c+": "+e.label},o),e.label)})))}}]),t}(g.Component));t.a=Object(E.withInstanceId)(y)}});
|
build/product-category.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-category.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-category"]=function(e){function t(t){for(var r,i,a=t[0],s=t[1],u=t[2],d=0,b=[];d<a.length;d++)i=a[d],n[i]&&b.push(n[i][0]),n[i]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(l&&l(t);b.length;)b.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,a=1;a<o.length;a++){var s=o[a];0!==n[s]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=o[0]))}return e}var r={},n={9:0},c=[];function i(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=r,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var u=0;u<a.length;u++)t(a[u]);var l=s;return c.push([518,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,o){"use strict";o.d(t,"b",function(){return r});var r=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},31:function(e,t,o){"use strict";var r=o(8),n=o.n(r),c=o(0),i=o(1),a=o(4),s=o.n(a),u=o(3),l=function(e){var t=e.onChange,o=e.settings,r=o.button,a=o.price,s=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(n()({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:a?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return t(n()({},o,{price:!a}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:s?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return t(n()({},o,{rating:!s}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(n()({},o,{button:!r}))}}))};l.propTypes={settings:s.a.shape({button:s.a.bool.isRequired,price:s.a.bool.isRequired,rating:s.a.bool.isRequired,title:s.a.bool.isRequired}).isRequired,onChange:s.a.func.isRequired},t.a=l},34:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(5),i=o(4),a=o.n(i),s=o(3),u=function(e){var t=e.columns,o=e.rows,i=e.setAttributes,a=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(s.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_columns,wc_product_block_data.max_columns);i({columns:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(r.createElement)(s.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_rows,wc_product_block_data.max_rows);i({rows:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(r.createElement)(s.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return i({alignButtons:!a})}}))};u.propTypes={columns:a.a.oneOfType([a.a.number,a.a.string]).isRequired,rows:a.a.oneOfType([a.a.number,a.a.string]).isRequired,alignButtons:a.a.bool.isRequired,setAttributes:a.a.func.isRequired},t.a=u},35:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(48),a=o.n(i);o.d(t,"a",function(){return s});var s=function(e){return function(t){var o=t.attributes,n=o.align,i=o.contentVisibility,s=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:s},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,s=o.orderby,u=o.products,l=o.columns||wc_product_block_data.default_columns,d=o.rows||wc_product_block_data.default_rows,b=new Map;switch(b.set("limit",d*l),b.set("columns",l),c&&c.length&&(b.set("category",c.join(",")),i&&"all"===i&&b.set("cat_operator","AND")),r&&r.length&&(b.set("terms",r.map(function(e){return e.id}).join(",")),b.set("attribute",r[0].attr_slug),n&&"all"===n&&b.set("terms_operator","AND")),s&&("price_desc"===s?(b.set("orderby","price"),b.set("order","DESC")):"price_asc"===s?(b.set("orderby","price"),b.set("order","ASC")):"date"===s?(b.set("orderby","date"),b.set("order","DESC")):b.set("orderby",s)),t){case"woocommerce/product-best-sellers":b.set("best_selling","1");break;case"woocommerce/product-top-rated":b.set("orderby","rating");break;case"woocommerce/product-on-sale":b.set("on_sale","1");break;case"woocommerce/product-new":b.set("orderby","date"),b.set("order","DESC");break;case"woocommerce/handpicked-products":if(!u.length)return"";b.set("ids",u.join(",")),b.set("limit",u.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var p="[products",g=!0,f=!1,h=void 0;try{for(var m,_=b[Symbol.iterator]();!(g=(m=_.next()).done);g=!0){var w=a()(m.value,2);p+=" "+w[0]+'="'+w[1]+'"'}}catch(e){f=!0,h=e}finally{try{g||null==_.return||_.return()}finally{if(f)throw h}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var r=o(27),n=o.n(r),c=o(13),i=o.n(c),a=o(14),s=o.n(a),u=o(15),l=o.n(u),d=o(16),b=o.n(d),p=o(12),g=o.n(p),f=o(17),h=o.n(f),m=o(0),_=o(1),w=o(19),O=o(10),y=o.n(O),k=o(5),j=o(4),v=o.n(j),C=o(24),E=o(3),A=(o(79),function(e){function t(){var e;return i()(this,t),(e=l()(this,b()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return h()(t,e),s()(t,[{key:"componentDidMount",value:function(){var e=this;y()({path:Object(w.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];o.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var a=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(m.createElement)(C.b,n()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(_.sprintf)(Object(_._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),a,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,i=r.operator,a=r.selected,s=r.isSingle,u={clear:Object(_.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(_.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(_.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(_.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(_.sprintf)(Object(_._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(_.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(C.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:a.map(function(e){return Object(k.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:u,isHierarchical:!0,isSingle:s}),!!c&&Object(m.createElement)("div",{className:a.length<2?"screen-reader-text":""},Object(m.createElement)(E.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(_.__)("Display products matching","woo-gutenberg-products-block"),help:Object(_.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(_.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(_.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(m.Component));A.propTypes={onChange:v.a.func.isRequired,onOperatorChange:v.a.func,operator:v.a.oneOf(["all","any"]),selected:v.a.array.isRequired,isSingle:v.a.bool},A.defaultProps={operator:"any",isSingle:!1},t.a=A},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},47:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(3),i=o(4),a=o.n(i),s=function(e){var t=e.value,o=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return o({orderby:e})}})};s.propTypes={setAttributes:a.a.func.isRequired,value:a.a.string.isRequired},t.a=s},487:function(e,t,o){var r=o(488);"string"==typeof r&&(r=[[e.i,r,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};o(38)(r,n);r.locals&&(e.exports=r.locals)},488:function(e,t,o){},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},518:function(e,t,o){"use strict";o.r(t);var r=o(8),n=o.n(r),c=o(0),i=o(1),a=o(18),s=o(5),u=(o(487),o(13)),l=o.n(u),d=o(14),b=o.n(d),p=o(15),g=o.n(p),f=o(16),h=o.n(f),m=o(12),_=o.n(m),w=o(17),O=o.n(w),y=o(9),k=o(3),j=o(4),v=o.n(j),C=o(31),E=o(34),A=o(37),x=o(47),S=function(e){function t(){var e;return l()(this,t),(e=g()(this,h()(t).apply(this,arguments))).state={changedAttributes:{},isEditing:!1},e.startEditing=e.startEditing.bind(_()(e)),e.stopEditing=e.stopEditing.bind(_()(e)),e.setChangedAttributes=e.setChangedAttributes.bind(_()(e)),e.save=e.save.bind(_()(e)),e}return O()(t,e),b()(t,[{key:"componentDidMount",value:function(){this.props.attributes.categories.length||this.setState({isEditing:!0})}},{key:"startEditing",value:function(){this.setState({isEditing:!0,changedAttributes:{}})}},{key:"stopEditing",value:function(){this.setState({isEditing:!1,changedAttributes:{}})}},{key:"setChangedAttributes",value:function(e){this.setState(function(t){return{changedAttributes:n()({},t.changedAttributes,e)}})}},{key:"save",value:function(){var e=this.state.changedAttributes;(0,this.props.setAttributes)(e),this.stopEditing()}},{key:"getInspectorControls",value:function(){var e=this,t=this.props,o=t.attributes,r=t.setAttributes,n=this.state.isEditing,a=o.columns,s=o.catOperator,u=o.contentVisibility,l=o.orderby,d=o.rows,b=o.alignButtons;return Object(c.createElement)(y.InspectorControls,{key:"inspector"},Object(c.createElement)(k.PanelBody,{title:Object(i.__)("Product Category","woo-gutenberg-products-block"),initialOpen:!o.categories.length&&!n},Object(c.createElement)(A.a,{selected:o.categories,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=t.map(function(e){return e.id}),n={categories:o};r(n),e.setChangedAttributes(n)},operator:s,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any",o={catOperator:t};r(o),e.setChangedAttributes(o)}})),Object(c.createElement)(k.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(E.a,{columns:a,rows:d,alignButtons:b,setAttributes:r})),Object(c.createElement)(k.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(C.a,{settings:u,onChange:function(e){return r({contentVisibility:e})}})),Object(c.createElement)(k.PanelBody,{title:Object(i.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(x.a,{setAttributes:r,value:l})))}},{key:"renderEditMode",value:function(){var e=this,t=this.props,o=t.attributes,r=t.debouncedSpeak,a=this.state.changedAttributes,s=n()({},o,a);return Object(c.createElement)(k.Placeholder,{icon:"category",label:Object(i.__)("Products by Category","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-products-category"},Object(i.__)("Display a grid of products from your selected categories.","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-products-category__selection"},Object(c.createElement)(A.a,{selected:s.categories,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=t.map(function(e){return e.id});e.setChangedAttributes({categories:o})},operator:s.catOperator,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return e.setChangedAttributes({catOperator:t})}}),Object(c.createElement)(k.Button,{isDefault:!0,onClick:function(){e.save(),r(Object(i.__)("Showing Products by Category block preview.","woo-gutenberg-products-block"))}},Object(i.__)("Done","woo-gutenberg-products-block")),Object(c.createElement)(k.Button,{className:"wc-block-products-category__cancel-button",isTertiary:!0,onClick:function(){e.stopEditing(),r(Object(i.__)("Showing Products by Category block preview.","woo-gutenberg-products-block"))}},Object(i.__)("Cancel","woo-gutenberg-products-block"))))}},{key:"renderViewMode",value:function(){var e=this.props,t=e.attributes,o=e.name,r=t.categories.length;return Object(c.createElement)(k.Disabled,null,r?Object(c.createElement)(y.ServerSideRender,{block:o,attributes:t}):Object(i.__)("Select at least one category to display its products.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this,t=this.state.isEditing;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(y.BlockControls,null,Object(c.createElement)(k.Toolbar,{controls:[{icon:"edit",title:Object(i.__)("Edit"),onClick:function(){return t?e.stopEditing():e.startEditing()},isActive:t}]})),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())}}]),t}(c.Component);S.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired,debouncedSpeak:v.a.func.isRequired};var P=Object(k.withSpokenMessages)(S),R=o(35),B=o(30);Object(a.registerBlockType)("woocommerce/product-category",{title:Object(i.__)("Products by Category","woo-gutenberg-products-block"),icon:{src:"category",foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of products from your selected categories.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:n()({},B.a,{editMode:{type:"boolean",default:!0},orderby:{type:"string",default:"date"}}),transforms:{from:[{type:"block",blocks:Object(s.without)(B.b,"woocommerce/product-category"),transform:function(e){return Object(a.createBlock)("woocommerce/product-category",n()({},e,{editMode:!1}))}}]},deprecated:[{attributes:n()({},B.a,{editMode:{type:"boolean",default:!0},orderby:{type:"string",default:"date"}}),save:Object(R.a)("woocommerce/product-category")}],edit:function(e){return Object(c.createElement)(P,e)},save:function(){return null}})},52:function(e,t){!function(){e.exports=this.wp.date}()},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-category"]=function(e){function t(t){for(var r,i,s=t[0],a=t[1],u=t[2],b=0,d=[];b<s.length;b++)i=s[b],Object.prototype.hasOwnProperty.call(n,i)&&n[i]&&d.push(n[i][0]),n[i]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,s=1;s<o.length;s++){var a=o[s];0!==n[a]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=o[0]))}return e}var r={},n={10:0},c=[];function i(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=r,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=s.push.bind(s);s.push=t,s=s.slice();for(var u=0;u<s.length;u++)t(s[u]);var l=a;return c.push([555,2,1,0]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},36:function(e,t,o){"use strict";o.d(t,"b",function(){return n});var r=o(5),n=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:r.DEFAULT_COLUMNS},rows:{type:"number",default:r.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},37:function(e,t,o){"use strict";var r=o(20),n=o.n(r),c=o(0),i=o(1),s=(o(7),o(2));function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?a(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):a(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}t.a=function(e){var t=e.onChange,o=e.settings,r=o.button,n=o.price,a=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(u({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:n?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return t(u({},o,{price:!n}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:a?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return t(u({},o,{rating:!a}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(u({},o,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,o){"use strict";var r=o(16),n=o.n(r),c=o(8),i=o.n(c),s=o(9),a=o.n(s),u=o(10),l=o.n(u),b=o(11),d=o.n(b),p=o(15),g=o.n(p),f=o(12),O=o.n(f),h=o(0),m=o(1),w=o(19),y=o(17),j=o.n(y),_=o(4),v=(o(7),o(26)),k=o(2),C=o(5),E=(o(86),function(e){function t(){var e;return i()(this,t),(e=l()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return O()(t,e),a()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(w.addQueryArgs)("".concat(C.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];o.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var s=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(h.createElement)(v.b,n()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(m.sprintf)(Object(m._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),s,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,i=r.operator,s=r.selected,a=r.isSingle,u={clear:Object(m.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(m.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(m.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(m.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(m.sprintf)(Object(m._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(m.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(h.createElement)(h.Fragment,null,Object(h.createElement)(v.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:s.map(function(e){return Object(_.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:u,isHierarchical:!0,isSingle:a}),!!c&&Object(h.createElement)("div",{className:s.length<2?"screen-reader-text":""},Object(h.createElement)(k.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(m.__)("Display products matching","woo-gutenberg-products-block"),help:Object(m.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(m.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(m.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(h.Component));E.defaultProps={operator:"any",isSingle:!1},t.a=E},44:function(e,t){!function(){e.exports=this.ReactDOM}()},45:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(4),i=(o(7),o(2)),s=o(5);t.a=function(e){var t=e.columns,o=e.rows,a=e.setAttributes,u=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_COLUMNS,s.MAX_COLUMNS);a({columns:Object(c.isNaN)(t)?"":t})},min:s.MIN_COLUMNS,max:s.MAX_COLUMNS}),Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_ROWS,s.MAX_ROWS);a({rows:Object(c.isNaN)(t)?"":t})},min:s.MIN_ROWS,max:s.MAX_ROWS}),Object(r.createElement)(i.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:u?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:u,onChange:function(){return a({alignButtons:!u})}}))}},46:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(58),s=o.n(i),a=o(5);o.d(t,"a",function(){return u});var u=function(e){return function(t){var o=t.attributes,n=o.align,i=o.contentVisibility,u=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:u},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,u=o.orderby,l=o.products,b=o.columns||a.DEFAULT_COLUMNS,d=o.rows||a.DEFAULT_ROWS,p=new Map;switch(p.set("limit",d*b),p.set("columns",b),c&&c.length&&(p.set("category",c.join(",")),i&&"all"===i&&p.set("cat_operator","AND")),r&&r.length&&(p.set("terms",r.map(function(e){return e.id}).join(",")),p.set("attribute",r[0].attr_slug),n&&"all"===n&&p.set("terms_operator","AND")),u&&("price_desc"===u?(p.set("orderby","price"),p.set("order","DESC")):"price_asc"===u?(p.set("orderby","price"),p.set("order","ASC")):"date"===u?(p.set("orderby","date"),p.set("order","DESC")):p.set("orderby",u)),t){case"woocommerce/product-best-sellers":p.set("best_selling","1");break;case"woocommerce/product-top-rated":p.set("orderby","rating");break;case"woocommerce/product-on-sale":p.set("on_sale","1");break;case"woocommerce/product-new":p.set("orderby","date"),p.set("order","DESC");break;case"woocommerce/handpicked-products":if(!l.length)return"";p.set("ids",l.join(",")),p.set("limit",l.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",f=!0,O=!1,h=void 0;try{for(var m,w=p[Symbol.iterator]();!(f=(m=w.next()).done);f=!0){var y=s()(m.value,2);g+=" "+y[0]+'="'+y[1]+'"'}}catch(e){O=!0,h=e}finally{try{f||null==w.return||w.return()}finally{if(O)throw h}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},513:function(e,t,o){var r=o(514);"string"==typeof r&&(r=[[e.i,r,""]]);var n={insert:"head",singleton:!1};o(35)(r,n);r.locals&&(e.exports=r.locals)},514:function(e,t,o){},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},555:function(e,t,o){"use strict";o.r(t);var r=o(20),n=o.n(r),c=o(0),i=o(1),s=o(23),a=o(4),u=(o(513),o(8)),l=o.n(u),b=o(9),d=o.n(b),p=o(10),g=o.n(p),f=o(11),O=o.n(f),h=o(15),m=o.n(h),w=o(12),y=o.n(w),j=o(18),_=o(2),v=(o(7),o(37)),k=o(45),C=o(41),E=o(57);function P(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function S(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?P(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):P(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}var A=function(e){function t(){var e,o;l()(this,t);for(var r=arguments.length,c=new Array(r),i=0;i<r;i++)c[i]=arguments[i];return o=g()(this,(e=O()(t)).call.apply(e,[this].concat(c))),n()(m()(o),"state",{changedAttributes:{},isEditing:!1}),n()(m()(o),"startEditing",function(){o.setState({isEditing:!0,changedAttributes:{}})}),n()(m()(o),"stopEditing",function(){o.setState({isEditing:!1,changedAttributes:{}})}),n()(m()(o),"setChangedAttributes",function(e){o.setState(function(t){return{changedAttributes:S({},t.changedAttributes,{},e)}})}),n()(m()(o),"save",function(){var e=o.state.changedAttributes;(0,o.props.setAttributes)(e),o.stopEditing()}),o}return y()(t,e),d()(t,[{key:"componentDidMount",value:function(){this.props.attributes.categories.length||this.setState({isEditing:!0})}},{key:"getInspectorControls",value:function(){var e=this,t=this.props,o=t.attributes,r=t.setAttributes,n=this.state.isEditing,s=o.columns,a=o.catOperator,u=o.contentVisibility,l=o.orderby,b=o.rows,d=o.alignButtons;return Object(c.createElement)(j.InspectorControls,{key:"inspector"},Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Product Category","woo-gutenberg-products-block"),initialOpen:!o.categories.length&&!n},Object(c.createElement)(C.a,{selected:o.categories,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=t.map(function(e){return e.id}),n={categories:o};r(n),e.setChangedAttributes(n)},operator:a,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any",o={catOperator:t};r(o),e.setChangedAttributes(o)}})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(k.a,{columns:s,rows:b,alignButtons:d,setAttributes:r})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(v.a,{settings:u,onChange:function(e){return r({contentVisibility:e})}})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(E.a,{setAttributes:r,value:l})))}},{key:"renderEditMode",value:function(){var e=this,t=this.props,o=t.attributes,r=t.debouncedSpeak,n=S({},o,{},this.state.changedAttributes);return Object(c.createElement)(_.Placeholder,{icon:"category",label:Object(i.__)("Products by Category","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-products-category"},Object(i.__)("Display a grid of products from your selected categories.","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-products-category__selection"},Object(c.createElement)(C.a,{selected:n.categories,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=t.map(function(e){return e.id});e.setChangedAttributes({categories:o})},operator:n.catOperator,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return e.setChangedAttributes({catOperator:t})}}),Object(c.createElement)(_.Button,{isDefault:!0,onClick:function(){e.save(),r(Object(i.__)("Showing Products by Category block preview.","woo-gutenberg-products-block"))}},Object(i.__)("Done","woo-gutenberg-products-block")),Object(c.createElement)(_.Button,{className:"wc-block-products-category__cancel-button",isTertiary:!0,onClick:function(){e.stopEditing(),r(Object(i.__)("Showing Products by Category block preview.","woo-gutenberg-products-block"))}},Object(i.__)("Cancel","woo-gutenberg-products-block"))))}},{key:"renderViewMode",value:function(){var e=this.props,t=e.attributes,o=e.name,r=t.categories.length;return Object(c.createElement)(_.Disabled,null,r?Object(c.createElement)(j.ServerSideRender,{block:o,attributes:t}):Object(i.__)("Select at least one category to display its products.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this,t=this.state.isEditing;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(j.BlockControls,null,Object(c.createElement)(_.Toolbar,{controls:[{icon:"edit",title:Object(i.__)("Edit"),onClick:function(){return t?e.stopEditing():e.startEditing()},isActive:t}]})),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())}}]),t}(c.Component),M=Object(_.withSpokenMessages)(A),D=o(46),x=o(36);function N(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function B(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?N(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):N(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}Object(s.registerBlockType)("woocommerce/product-category",{title:Object(i.__)("Products by Category","woo-gutenberg-products-block"),icon:{src:"category",foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of products from your selected categories.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:B({},x.a,{editMode:{type:"boolean",default:!0},orderby:{type:"string",default:"date"}}),transforms:{from:[{type:"block",blocks:Object(a.without)(x.b,"woocommerce/product-category"),transform:function(e){return Object(s.createBlock)("woocommerce/product-category",B({},e,{editMode:!1}))}}]},deprecated:[{attributes:B({},x.a,{editMode:{type:"boolean",default:!0},orderby:{type:"string",default:"date"}}),save:Object(D.a)("woocommerce/product-category")}],edit:function(e){return Object(c.createElement)(M,e)},save:function(){return null}})},57:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(2);o(7);t.a=function(e){var t=e.value,o=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return o({orderby:e})}})}},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){}});
|
build/product-new.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-new.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-new"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],u=t[2],b=0,d=[];b<i.length;b++)a=i[b],r[a]&&d.push(r[a][0]),r[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],n=!0,i=1;i<o.length;i++){var s=o[i];0!==r[s]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=o[0]))}return e}var n={},r={10:0},c=[];function a(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=n,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},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 u=0;u<i.length;u++)t(i[u]);var l=s;return c.push([522,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},28:function(e,t,o){"use strict";var n=o(0),r=o(3),c=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},i=function(){return Object(n.createElement)(r.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(r.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},l=function(){return Object(n.createElement)(r.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},b=o(6),d=o.n(b),p=o(4),g=o.n(p),m=function(e){var t=e.size,o=void 0===t?20:t,c=e.className;return Object(n.createElement)(r.Icon,{className:d()("woo-icon",c),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:o,width:Math.floor(1.67*o),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})};m.propTypes={size:g.a.number,className:g.a.string};var h=m;o.d(t,"a",function(){return c}),o.d(t,"b",function(){return a}),o.d(t,"c",function(){return i}),o.d(t,"d",function(){return s}),o.d(t,"e",function(){return u}),o.d(t,"f",function(){return l}),o.d(t,"g",function(){return h})},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,o){"use strict";o.d(t,"b",function(){return n});var n=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},31:function(e,t,o){"use strict";var n=o(8),r=o.n(n),c=o(0),a=o(1),i=o(4),s=o.n(i),u=o(3),l=function(e){var t=e.onChange,o=e.settings,n=o.button,i=o.price,s=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product title","woo-gutenberg-products-block"),help:l?Object(a.__)("Product title is visible.","woo-gutenberg-products-block"):Object(a.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(r()({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product price","woo-gutenberg-products-block"),help:i?Object(a.__)("Product price is visible.","woo-gutenberg-products-block"):Object(a.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:i,onChange:function(){return t(r()({},o,{price:!i}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product rating","woo-gutenberg-products-block"),help:s?Object(a.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(a.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return t(r()({},o,{rating:!s}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Add to Cart button","woo-gutenberg-products-block"),help:n?Object(a.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(a.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return t(r()({},o,{button:!n}))}}))};l.propTypes={settings:s.a.shape({button:s.a.bool.isRequired,price:s.a.bool.isRequired,rating:s.a.bool.isRequired,title:s.a.bool.isRequired}).isRequired,onChange:s.a.func.isRequired},t.a=l},34:function(e,t,o){"use strict";var n=o(0),r=o(1),c=o(5),a=o(4),i=o.n(a),s=o(3),u=function(e){var t=e.columns,o=e.rows,a=e.setAttributes,i=e.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.RangeControl,{label:Object(r.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_columns,wc_product_block_data.max_columns);a({columns:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(n.createElement)(s.RangeControl,{label:Object(r.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_rows,wc_product_block_data.max_rows);a({rows:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(n.createElement)(s.ToggleControl,{label:Object(r.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:i?Object(r.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(r.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:i,onChange:function(){return a({alignButtons:!i})}}))};u.propTypes={columns:i.a.oneOfType([i.a.number,i.a.string]).isRequired,rows:i.a.oneOfType([i.a.number,i.a.string]).isRequired,alignButtons:i.a.bool.isRequired,setAttributes:i.a.func.isRequired},t.a=u},35:function(e,t,o){"use strict";var n=o(0),r=o(6),c=o.n(r),a=o(48),i=o.n(a);o.d(t,"a",function(){return s});var s=function(e){return function(t){var o=t.attributes,r=o.align,a=o.contentVisibility,s=c()(r?"align".concat(r):"",{"is-hidden-title":!a.title,"is-hidden-price":!a.price,"is-hidden-rating":!a.rating,"is-hidden-button":!a.button});return Object(n.createElement)(n.RawHTML,{className:s},function(e,t){var o=e.attributes,n=o.attributes,r=o.attrOperator,c=o.categories,a=o.catOperator,s=o.orderby,u=o.products,l=o.columns||wc_product_block_data.default_columns,b=o.rows||wc_product_block_data.default_rows,d=new Map;switch(d.set("limit",b*l),d.set("columns",l),c&&c.length&&(d.set("category",c.join(",")),a&&"all"===a&&d.set("cat_operator","AND")),n&&n.length&&(d.set("terms",n.map(function(e){return e.id}).join(",")),d.set("attribute",n[0].attr_slug),r&&"all"===r&&d.set("terms_operator","AND")),s&&("price_desc"===s?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===s?(d.set("orderby","price"),d.set("order","ASC")):"date"===s?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",s)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!u.length)return"";d.set("ids",u.join(",")),d.set("limit",u.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!n||!n.length)return""}var p="[products",g=!0,m=!1,h=void 0;try{for(var f,w=d[Symbol.iterator]();!(g=(f=w.next()).done);g=!0){var _=i()(f.value,2);p+=" "+_[0]+'="'+_[1]+'"'}}catch(e){m=!0,h=e}finally{try{g||null==w.return||w.return()}finally{if(m)throw h}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var n=o(27),r=o.n(n),c=o(13),a=o.n(c),i=o(14),s=o.n(i),u=o(15),l=o.n(u),b=o(16),d=o.n(b),p=o(12),g=o.n(p),m=o(17),h=o.n(m),f=o(0),w=o(1),_=o(19),O=o(10),j=o.n(O),v=o(5),k=o(4),y=o.n(k),E=o(24),C=o(3),x=(o(79),function(e){function t(){var e;return a()(this,t),(e=l()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return h()(t,e),s()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(_.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,n=e.depth,c=void 0===n?0:n,a=["woocommerce-product-categories__item"];o.length&&a.push("is-searching"),0===c&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(f.createElement)(E.b,r()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(w.sprintf)(Object(w._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,n=this.props,r=n.onChange,c=n.onOperatorChange,a=n.operator,i=n.selected,s=n.isSingle,u={clear:Object(w.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(w.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(w.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(w.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(w.sprintf)(Object(w._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(w.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(f.createElement)(f.Fragment,null,Object(f.createElement)(E.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:i.map(function(e){return Object(v.find)(t,{id:e})}).filter(Boolean),onChange:r,renderItem:this.renderItem,messages:u,isHierarchical:!0,isSingle:s}),!!c&&Object(f.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(f.createElement)(C.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(w.__)("Display products matching","woo-gutenberg-products-block"),help:Object(w.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:c,options:[{label:Object(w.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(w.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(f.Component));x.propTypes={onChange:y.a.func.isRequired,onOperatorChange:y.a.func,operator:y.a.oneOf(["all","any"]),selected:y.a.array.isRequired,isSingle:y.a.bool},x.defaultProps={operator:"any",isSingle:!1},t.a=x},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},52:function(e,t){!function(){e.exports=this.wp.date}()},522:function(e,t,o){"use strict";o.r(t);var n=o(8),r=o.n(n),c=o(0),a=o(1),i=o(18),s=o(5),u=o(13),l=o.n(u),b=o(14),d=o.n(b),p=o(15),g=o.n(p),m=o(16),h=o.n(m),f=o(17),w=o.n(f),_=o(3),O=o(9),j=o(4),v=o.n(j),k=o(31),y=o(34),E=o(37),C=function(e){function t(){return l()(this,t),g()(this,h()(t).apply(this,arguments))}return w()(t,e),d()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,n=t.categories,r=t.catOperator,i=t.columns,s=t.contentVisibility,u=t.rows,l=t.alignButtons;return Object(c.createElement)(O.InspectorControls,{key:"inspector"},Object(c.createElement)(_.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(y.a,{columns:i,rows:u,alignButtons:l,setAttributes:o})),Object(c.createElement)(_.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(k.a,{settings:s,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(_.PanelBody,{title:Object(a.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(E.a,{selected:n,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:r,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,o=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(_.Disabled,null,Object(c.createElement)(O.ServerSideRender,{block:o,attributes:t})))}}]),t}(c.Component);C.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired};var x=C,z=o(35),M=o(28),B=o(30);Object(i.registerBlockType)("woocommerce/product-new",{title:Object(a.__)("Newest Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(M.c,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display a grid of your newest products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:r()({},B.a),transforms:{from:[{type:"block",blocks:Object(s.without)(B.b,"woocommerce/product-new"),transform:function(e){return Object(i.createBlock)("woocommerce/product-new",e)}}]},deprecated:[{attributes:B.a,save:Object(z.a)("woocommerce/product-new")}],edit:function(e){return Object(c.createElement)(x,e)},save:function(){return null}})},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-new"]=function(e){function t(t){for(var r,i,a=t[0],l=t[1],s=t[2],b=0,p=[];b<a.length;b++)i=a[b],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);p.length;)p.shift()();return c.push.apply(c,s||[]),n()}function n(){for(var e,t=0;t<c.length;t++){for(var n=c[t],r=!0,a=1;a<n.length;a++){var l=n[a];0!==o[l]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=n[0]))}return e}var r={},o={11:0},c=[];function i(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,i),n.l=!0,n.exports}i.m=e,i.c=r,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var u=l;return c.push([556,1,0]),n()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,n){"use strict";var r=n(0),o=n(2),c=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(r.createElement)("g",null,Object(r.createElement)("g",null,Object(r.createElement)("path",{fill:n,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(r.createElement)("path",{fill:n,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(r.createElement)("path",{fill:n,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},i=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},a=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(r.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(r.createElement)(o.Icon,{className:"material-icon",icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(r.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(r.createElement)(o.Icon,{icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},b=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)("path",{fill:n,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(r.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(r.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},p=function(e){var t=e.className,n=e.fillColor;return Object(r.createElement)(o.Icon,{className:t,icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(r.createElement)("path",{fill:n,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(r.createElement)("path",{fill:n,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(r.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(r.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(r.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},d=function(){return Object(r.createElement)(o.Icon,{className:"material-icon",icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(r.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},g=n(6),f=n.n(g),h=(n(7),function(e){var t=e.size,n=void 0===t?20:t,c=e.className;return Object(r.createElement)(o.Icon,{className:f()("woo-icon",c),icon:Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:n,width:Math.floor(1.67*n),viewBox:"0 0 245 145"},Object(r.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(r.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});n.d(t,"a",function(){return c}),n.d(t,"b",function(){return i}),n.d(t,"c",function(){return a}),n.d(t,"d",function(){return l}),n.d(t,"e",function(){return s}),n.d(t,"f",function(){return u}),n.d(t,"h",function(){return b}),n.d(t,"g",function(){return p}),n.d(t,"i",function(){return d}),n.d(t,"j",function(){return h})},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},36:function(e,t,n){"use strict";n.d(t,"b",function(){return o});var r=n(5),o=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:r.DEFAULT_COLUMNS},rows:{type:"number",default:r.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},37:function(e,t,n){"use strict";var r=n(20),o=n.n(r),c=n(0),i=n(1),a=(n(7),n(2));function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(n,!0).forEach(function(t){o()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}t.a=function(e){var t=e.onChange,n=e.settings,r=n.button,o=n.price,l=n.rating,u=n.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:u?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return t(s({},n,{title:!u}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:o?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:o,onChange:function(){return t(s({},n,{price:!o}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:l?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(s({},n,{rating:!l}))}}),Object(c.createElement)(a.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(s({},n,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,n){"use strict";var r=n(16),o=n.n(r),c=n(8),i=n.n(c),a=n(9),l=n.n(a),s=n(10),u=n.n(s),b=n(11),p=n.n(b),d=n(15),g=n.n(d),f=n(12),h=n.n(f),m=n(0),w=n(1),O=n(19),j=n(17),v=n.n(j),y=n(4),_=(n(7),n(26)),E=n(2),C=n(5),k=(n(86),function(e){function t(){var e;return i()(this,t),(e=u()(this,p()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return h()(t,e),l()(t,[{key:"componentDidMount",value:function(){var e=this;v()({path:Object(O.addQueryArgs)("".concat(C.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,n=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];n.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var a=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(m.createElement)(_.b,o()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(w.sprintf)(Object(w._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),a,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,n=e.loading,r=this.props,o=r.onChange,c=r.onOperatorChange,i=r.operator,a=r.selected,l=r.isSingle,s={clear:Object(w.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(w.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(w.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(w.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(w.sprintf)(Object(w._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(w.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(_.a,{className:"woocommerce-product-categories",list:t,isLoading:n,selected:a.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:o,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:l}),!!c&&Object(m.createElement)("div",{className:a.length<2?"screen-reader-text":""},Object(m.createElement)(E.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(w.__)("Display products matching","woo-gutenberg-products-block"),help:Object(w.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(w.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(w.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(m.Component));k.defaultProps={operator:"any",isSingle:!1},t.a=k},44:function(e,t){!function(){e.exports=this.ReactDOM}()},45:function(e,t,n){"use strict";var r=n(0),o=n(1),c=n(4),i=(n(7),n(2)),a=n(5);t.a=function(e){var t=e.columns,n=e.rows,l=e.setAttributes,s=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(i.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,a.MIN_COLUMNS,a.MAX_COLUMNS);l({columns:Object(c.isNaN)(t)?"":t})},min:a.MIN_COLUMNS,max:a.MAX_COLUMNS}),Object(r.createElement)(i.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:n,onChange:function(e){var t=Object(c.clamp)(e,a.MIN_ROWS,a.MAX_ROWS);l({rows:Object(c.isNaN)(t)?"":t})},min:a.MIN_ROWS,max:a.MAX_ROWS}),Object(r.createElement)(i.ToggleControl,{label:Object(o.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:s?Object(o.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(o.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:s,onChange:function(){return l({alignButtons:!s})}}))}},46:function(e,t,n){"use strict";var r=n(0),o=n(6),c=n.n(o),i=n(58),a=n.n(i),l=n(5);n.d(t,"a",function(){return s});var s=function(e){return function(t){var n=t.attributes,o=n.align,i=n.contentVisibility,s=c()(o?"align".concat(o):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:s},function(e,t){var n=e.attributes,r=n.attributes,o=n.attrOperator,c=n.categories,i=n.catOperator,s=n.orderby,u=n.products,b=n.columns||l.DEFAULT_COLUMNS,p=n.rows||l.DEFAULT_ROWS,d=new Map;switch(d.set("limit",p*b),d.set("columns",b),c&&c.length&&(d.set("category",c.join(",")),i&&"all"===i&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),o&&"all"===o&&d.set("terms_operator","AND")),s&&("price_desc"===s?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===s?(d.set("orderby","price"),d.set("order","ASC")):"date"===s?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",s)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!u.length)return"";d.set("ids",u.join(",")),d.set("limit",u.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",f=!0,h=!1,m=void 0;try{for(var w,O=d[Symbol.iterator]();!(f=(w=O.next()).done);f=!0){var j=a()(w.value,2);g+=" "+j[0]+'="'+j[1]+'"'}}catch(e){h=!0,m=e}finally{try{f||null==O.return||O.return()}finally{if(h)throw m}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},556:function(e,t,n){"use strict";n.r(t);var r=n(20),o=n.n(r),c=n(0),i=n(1),a=n(23),l=n(4),s=n(8),u=n.n(s),b=n(9),p=n.n(b),d=n(10),g=n.n(d),f=n(11),h=n.n(f),m=n(12),w=n.n(m),O=n(2),j=n(18),v=(n(7),n(37)),y=n(45),_=n(41),E=function(e){function t(){return u()(this,t),g()(this,h()(t).apply(this,arguments))}return w()(t,e),p()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,n=e.setAttributes,r=t.categories,o=t.catOperator,a=t.columns,l=t.contentVisibility,s=t.rows,u=t.alignButtons;return Object(c.createElement)(j.InspectorControls,{key:"inspector"},Object(c.createElement)(O.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(y.a,{columns:a,rows:s,alignButtons:u,setAttributes:n})),Object(c.createElement)(O.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(v.a,{settings:l,onChange:function(e){return n({contentVisibility:e})}})),Object(c.createElement)(O.PanelBody,{title:Object(i.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(_.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({categories:t})},operator:o,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return n({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(O.Disabled,null,Object(c.createElement)(j.ServerSideRender,{block:n,attributes:t})))}}]),t}(c.Component),C=n(46),k=n(24),M=n(36);function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}Object(a.registerBlockType)("woocommerce/product-new",{title:Object(i.__)("Newest Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(k.d,null),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of your newest products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(n,!0).forEach(function(t){o()(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(n).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},M.a),transforms:{from:[{type:"block",blocks:Object(l.without)(M.b,"woocommerce/product-new"),transform:function(e){return Object(a.createBlock)("woocommerce/product-new",e)}}]},deprecated:[{attributes:M.a,save:Object(C.a)("woocommerce/product-new")}],edit:function(e){return Object(c.createElement)(E,e)},save:function(){return null}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){}});
|
build/product-on-sale.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-on-sale.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-on-sale"]=function(e){function t(t){for(var r,a,i=t[0],u=t[1],s=t[2],b=0,d=[];b<i.length;b++)a=i[b],n[a]&&d.push(n[a][0]),n[a]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);for(l&&l(t);d.length;)d.shift()();return c.push.apply(c,s||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,i=1;i<o.length;i++){var u=o[i];0!==n[u]&&(r=!1)}r&&(c.splice(t--,1),e=a(a.s=o[0]))}return e}var r={},n={11:0},c=[];function a(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=r,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(o,r,function(t){return e[t]}.bind(null,r));return o},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||[],u=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var l=u;return c.push([517,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,o){"use strict";o.d(t,"b",function(){return r});var r=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},31:function(e,t,o){"use strict";var r=o(8),n=o.n(r),c=o(0),a=o(1),i=o(4),u=o.n(i),s=o(3),l=function(e){var t=e.onChange,o=e.settings,r=o.button,i=o.price,u=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(a.__)("Product title","woo-gutenberg-products-block"),help:l?Object(a.__)("Product title is visible.","woo-gutenberg-products-block"):Object(a.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(n()({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(a.__)("Product price","woo-gutenberg-products-block"),help:i?Object(a.__)("Product price is visible.","woo-gutenberg-products-block"):Object(a.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:i,onChange:function(){return t(n()({},o,{price:!i}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(a.__)("Product rating","woo-gutenberg-products-block"),help:u?Object(a.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(a.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return t(n()({},o,{rating:!u}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(a.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(a.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(a.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(n()({},o,{button:!r}))}}))};l.propTypes={settings:u.a.shape({button:u.a.bool.isRequired,price:u.a.bool.isRequired,rating:u.a.bool.isRequired,title:u.a.bool.isRequired}).isRequired,onChange:u.a.func.isRequired},t.a=l},34:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(5),a=o(4),i=o.n(a),u=o(3),s=function(e){var t=e.columns,o=e.rows,a=e.setAttributes,i=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(u.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_columns,wc_product_block_data.max_columns);a({columns:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(r.createElement)(u.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_rows,wc_product_block_data.max_rows);a({rows:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(r.createElement)(u.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:i?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:i,onChange:function(){return a({alignButtons:!i})}}))};s.propTypes={columns:i.a.oneOfType([i.a.number,i.a.string]).isRequired,rows:i.a.oneOfType([i.a.number,i.a.string]).isRequired,alignButtons:i.a.bool.isRequired,setAttributes:i.a.func.isRequired},t.a=s},35:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),a=o(48),i=o.n(a);o.d(t,"a",function(){return u});var u=function(e){return function(t){var o=t.attributes,n=o.align,a=o.contentVisibility,u=c()(n?"align".concat(n):"",{"is-hidden-title":!a.title,"is-hidden-price":!a.price,"is-hidden-rating":!a.rating,"is-hidden-button":!a.button});return Object(r.createElement)(r.RawHTML,{className:u},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,a=o.catOperator,u=o.orderby,s=o.products,l=o.columns||wc_product_block_data.default_columns,b=o.rows||wc_product_block_data.default_rows,d=new Map;switch(d.set("limit",b*l),d.set("columns",l),c&&c.length&&(d.set("category",c.join(",")),a&&"all"===a&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),u&&("price_desc"===u?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===u?(d.set("orderby","price"),d.set("order","ASC")):"date"===u?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",u)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!s.length)return"";d.set("ids",s.join(",")),d.set("limit",s.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var p="[products",g=!0,f=!1,m=void 0;try{for(var _,h=d[Symbol.iterator]();!(g=(_=h.next()).done);g=!0){var w=i()(_.value,2);p+=" "+w[0]+'="'+w[1]+'"'}}catch(e){f=!0,m=e}finally{try{g||null==h.return||h.return()}finally{if(f)throw m}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var r=o(27),n=o.n(r),c=o(13),a=o.n(c),i=o(14),u=o.n(i),s=o(15),l=o.n(s),b=o(16),d=o.n(b),p=o(12),g=o.n(p),f=o(17),m=o.n(f),_=o(0),h=o(1),w=o(19),O=o(10),j=o.n(O),k=o(5),y=o(4),v=o.n(y),C=o(24),E=o(3),x=(o(79),function(e){function t(){var e;return a()(this,t),(e=l()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return m()(t,e),u()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(w.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,a=["woocommerce-product-categories__item"];o.length&&a.push("is-searching"),0===c&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(_.createElement)(C.b,n()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,a=r.operator,i=r.selected,u=r.isSingle,s={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(C.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:i.map(function(e){return Object(k.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:u}),!!c&&Object(_.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(_.createElement)(E.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(_.Component));x.propTypes={onChange:v.a.func.isRequired,onOperatorChange:v.a.func,operator:v.a.oneOf(["all","any"]),selected:v.a.array.isRequired,isSingle:v.a.bool},x.defaultProps={operator:"any",isSingle:!1},t.a=x},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},47:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(3),a=o(4),i=o.n(a),u=function(e){var t=e.value,o=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return o({orderby:e})}})};u.propTypes={setAttributes:i.a.func.isRequired,value:i.a.string.isRequired},t.a=u},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},517:function(e,t,o){"use strict";o.r(t);var r=o(8),n=o.n(r),c=o(0),a=o(1),i=o(18),u=o(5),s=o(25),l=o.n(s),b=o(13),d=o.n(b),p=o(14),g=o.n(p),f=o(15),m=o.n(f),_=o(16),h=o.n(_),w=o(17),O=o.n(w),j=o(3),k=o(9),y=o(4),v=o.n(y),C=o(31),E=o(34),x=o(37),P=o(47),R=function(e){function t(){return d()(this,t),m()(this,h()(t).apply(this,arguments))}return O()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,i=t.columns,u=t.contentVisibility,s=t.rows,l=t.orderby,b=t.alignButtons;return Object(c.createElement)(k.InspectorControls,{key:"inspector"},Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(E.a,{columns:i,rows:s,alignButtons:b,setAttributes:o})),Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(C.a,{settings:u,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(P.a,{setAttributes:o,value:l})),Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(x.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,o=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(j.Disabled,null,Object(c.createElement)(k.ServerSideRender,{block:o,attributes:t})))}}]),t}(c.Component);R.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired};var S=R,A=o(35),B=o(30);Object(i.registerBlockType)("woocommerce/product-on-sale",{title:Object(a.__)("On Sale Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(l.a,{icon:"tag"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display a grid of on sale products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:n()({},B.a,{orderby:{type:"string",default:"date"}}),transforms:{from:[{type:"block",blocks:Object(u.without)(B.b,"woocommerce/product-on-sale"),transform:function(e){return Object(i.createBlock)("woocommerce/product-on-sale",e)}}]},deprecated:[{attributes:n()({},B.a,{orderby:{type:"string",default:"date"}}),save:Object(A.a)("woocommerce/product-on-sale")}],edit:function(e){return Object(c.createElement)(S,e)},save:function(){return null}})},52:function(e,t){!function(){e.exports=this.wp.date}()},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-on-sale"]=function(e){function t(t){for(var r,i,u=t[0],s=t[1],a=t[2],b=0,p=[];b<u.length;b++)i=u[b],Object.prototype.hasOwnProperty.call(n,i)&&n[i]&&p.push(n[i][0]),n[i]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,a||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,u=1;u<o.length;u++){var s=o[u];0!==n[s]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=o[0]))}return e}var r={},n={12:0},c=[];function i(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=r,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var u=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=u.push.bind(u);u.push=t,u=u.slice();for(var a=0;a<u.length;a++)t(u[a]);var l=s;return c.push([557,1,0]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},36:function(e,t,o){"use strict";o.d(t,"b",function(){return n});var r=o(5),n=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:r.DEFAULT_COLUMNS},rows:{type:"number",default:r.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},37:function(e,t,o){"use strict";var r=o(20),n=o.n(r),c=o(0),i=o(1),u=(o(7),o(2));function s(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?s(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):s(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}t.a=function(e){var t=e.onChange,o=e.settings,r=o.button,n=o.price,s=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(a({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:n?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return t(a({},o,{price:!n}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:s?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return t(a({},o,{rating:!s}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(a({},o,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,o){"use strict";var r=o(16),n=o.n(r),c=o(8),i=o.n(c),u=o(9),s=o.n(u),a=o(10),l=o.n(a),b=o(11),p=o.n(b),d=o(15),g=o.n(d),f=o(12),O=o.n(f),m=o(0),h=o(1),w=o(19),j=o(17),_=o.n(j),y=o(4),v=(o(7),o(26)),k=o(2),C=o(5),P=(o(86),function(e){function t(){var e;return i()(this,t),(e=l()(this,p()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return O()(t,e),s()(t,[{key:"componentDidMount",value:function(){var e=this;_()({path:Object(w.addQueryArgs)("".concat(C.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];o.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var u=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(m.createElement)(v.b,n()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),u,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,i=r.operator,u=r.selected,s=r.isSingle,a={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(m.createElement)(m.Fragment,null,Object(m.createElement)(v.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:u.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:a,isHierarchical:!0,isSingle:s}),!!c&&Object(m.createElement)("div",{className:u.length<2?"screen-reader-text":""},Object(m.createElement)(k.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(m.Component));P.defaultProps={operator:"any",isSingle:!1},t.a=P},44:function(e,t){!function(){e.exports=this.ReactDOM}()},45:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(4),i=(o(7),o(2)),u=o(5);t.a=function(e){var t=e.columns,o=e.rows,s=e.setAttributes,a=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,u.MIN_COLUMNS,u.MAX_COLUMNS);s({columns:Object(c.isNaN)(t)?"":t})},min:u.MIN_COLUMNS,max:u.MAX_COLUMNS}),Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,u.MIN_ROWS,u.MAX_ROWS);s({rows:Object(c.isNaN)(t)?"":t})},min:u.MIN_ROWS,max:u.MAX_ROWS}),Object(r.createElement)(i.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return s({alignButtons:!a})}}))}},46:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(58),u=o.n(i),s=o(5);o.d(t,"a",function(){return a});var a=function(e){return function(t){var o=t.attributes,n=o.align,i=o.contentVisibility,a=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:a},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,a=o.orderby,l=o.products,b=o.columns||s.DEFAULT_COLUMNS,p=o.rows||s.DEFAULT_ROWS,d=new Map;switch(d.set("limit",p*b),d.set("columns",b),c&&c.length&&(d.set("category",c.join(",")),i&&"all"===i&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),a&&("price_desc"===a?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===a?(d.set("orderby","price"),d.set("order","ASC")):"date"===a?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",a)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!l.length)return"";d.set("ids",l.join(",")),d.set("limit",l.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",f=!0,O=!1,m=void 0;try{for(var h,w=d[Symbol.iterator]();!(f=(h=w.next()).done);f=!0){var j=u()(h.value,2);g+=" "+j[0]+'="'+j[1]+'"'}}catch(e){O=!0,m=e}finally{try{f||null==w.return||w.return()}finally{if(O)throw m}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},557:function(e,t,o){"use strict";o.r(t);var r=o(20),n=o.n(r),c=o(0),i=o(1),u=o(23),s=o(4),a=o(29),l=o.n(a),b=o(8),p=o.n(b),d=o(9),g=o.n(d),f=o(10),O=o.n(f),m=o(11),h=o.n(m),w=o(12),j=o.n(w),_=o(2),y=o(18),v=(o(7),o(37)),k=o(45),C=o(41),P=o(57),E=function(e){function t(){return p()(this,t),O()(this,h()(t).apply(this,arguments))}return j()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,u=t.columns,s=t.contentVisibility,a=t.rows,l=t.orderby,b=t.alignButtons;return Object(c.createElement)(y.InspectorControls,{key:"inspector"},Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(k.a,{columns:u,rows:a,alignButtons:b,setAttributes:o})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(v.a,{settings:s,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(P.a,{setAttributes:o,value:l})),Object(c.createElement)(_.PanelBody,{title:Object(i.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(C.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.attributes,o=e.name;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(_.Disabled,null,Object(c.createElement)(y.ServerSideRender,{block:o,attributes:t})))}}]),t}(c.Component),S=o(46),x=o(36);function A(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function N(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?A(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):A(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}Object(u.registerBlockType)("woocommerce/product-on-sale",{title:Object(i.__)("On Sale Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(l.a,{icon:"tag"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of on sale products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:N({},x.a,{orderby:{type:"string",default:"date"}}),transforms:{from:[{type:"block",blocks:Object(s.without)(x.b,"woocommerce/product-on-sale"),transform:function(e){return Object(u.createBlock)("woocommerce/product-on-sale",e)}}]},deprecated:[{attributes:N({},x.a,{orderby:{type:"string",default:"date"}}),save:Object(S.a)("woocommerce/product-on-sale")}],edit:function(e){return Object(c.createElement)(E,e)},save:function(){return null}})},57:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(2);o(7);t.a=function(e){var t=e.value,o=e.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:t,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(e){return o({orderby:e})}})}},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){}});
|
build/product-search.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["wc-block-settings","wp-blocks","wp-components","wp-compose","wp-editor","wp-element","wp-i18n","wp-polyfill"]
|
build/product-search.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-search"]=function(e){function t(t){for(var c,l,a=t[0],s=t[1],i=t[2],b=0,p=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&p.push(o[l][0]),o[l]=0;for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&(e[c]=s[c]);for(u&&u(t);p.length;)p.shift()();return n.push.apply(n,i||[]),r()}function r(){for(var e,t=0;t<n.length;t++){for(var r=n[t],c=!0,a=1;a<r.length;a++){var s=r[a];0!==o[s]&&(c=!1)}c&&(n.splice(t--,1),e=l(l.s=r[0]))}return e}var c={},o={13:0},n=[];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 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 n.push([554,2,1,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},284:function(e,t,r){var c=r(536);"string"==typeof c&&(c=[[e.i,c,""]]);var o={insert:"head",singleton:!1};r(35)(c,o);c.locals&&(e.exports=c.locals)},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},536:function(e,t,r){},554:function(e,t,r){"use strict";r.r(t);var c=r(16),o=r.n(c),n=r(0),l=r(1),a=r(23),s=r(18),i=r(2),u=(r(283),r(284),r(8)),b=r.n(u),p=r(9),d=r.n(p),h=r(10),f=r.n(h),m=r(11),w=r.n(m),g=r(12),_=r.n(g),O=r(6),j=r.n(O),v=(r(7),r(21)),k=r(5),y=function(e){function t(){return b()(this,t),f()(this,w()(t).apply(this,arguments))}return _()(t,e),d()(t,[{key:"renderView",value:function(){var e=this.props.attributes,t=e.label,r=e.placeholder,c=e.formId,o=e.className,a=e.hasLabel,s=e.align,i=j()("wc-block-product-search",s?"align"+s:"",o);return Object(n.createElement)("div",{className:i},Object(n.createElement)("form",{role:"search",method:"get",action:k.HOME_URL},Object(n.createElement)("label",{htmlFor:c,className:a?"wc-block-product-search__label":"wc-block-product-search__label screen-reader-text"},t),Object(n.createElement)("div",{className:"wc-block-product-search__fields"},Object(n.createElement)("input",{type:"search",id:c,className:"wc-block-product-search__field",placeholder:r,name:"s"}),Object(n.createElement)("input",{type:"hidden",name:"post_type",value:"product"}),Object(n.createElement)("button",{type:"submit",className:"wc-block-product-search__button",label:Object(l.__)("Search","woo-gutenberg-products-block")},Object(n.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(n.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"}))))))}},{key:"renderEdit",value:function(){var e=this.props,t=e.attributes,r=e.setAttributes,c=e.instanceId,o=t.label,a=t.placeholder,i=t.formId,u=t.className,b=t.hasLabel,p=t.align,d=j()("wc-block-product-search",p?"align"+p:"",u);return i||r({formId:"wc-block-product-search-".concat(c)}),Object(n.createElement)("div",{className:d},!!b&&Object(n.createElement)(s.PlainText,{className:"wc-block-product-search__label",value:o,onChange:function(e){return r({label:e})}}),Object(n.createElement)("div",{className:"wc-block-product-search__fields"},Object(n.createElement)(s.PlainText,{className:"wc-block-product-search__field input-control",value:a,onChange:function(e){return r({placeholder:e})}}),Object(n.createElement)("button",{type:"submit",className:"wc-block-product-search__button",label:Object(l.__)("Search","woo-gutenberg-products-block"),onClick:function(e){return e.preventDefault()},tabIndex:"-1"},Object(n.createElement)("svg",{"aria-hidden":"true",role:"img",focusable:"false",className:"dashicon dashicons-arrow-right-alt2",xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20"},Object(n.createElement)("path",{d:"M6 15l5-5-5-5 1-2 7 7-7 7z"})))))}},{key:"render",value:function(){return this.props.isPreview?this.renderEdit():this.renderView()}}]),t}(n.Component),E=Object(v.compose)([v.withInstanceId])(y);Object(a.registerBlockType)("woocommerce/product-search",{title:Object(l.__)("Product Search","woo-gutenberg-products-block"),icon:{src:"search",foreground:"#96588a"},category:"woocommerce",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(l.__)("Help visitors find your products.","woo-gutenberg-products-block"),supports:{align:["wide","full"]},attributes:{hasLabel:{type:"boolean",default:!0},label:{type:"string",default:Object(l.__)("Search","woo-gutenberg-products-block"),source:"text",selector:"label"},placeholder:{type:"string",default:Object(l.__)("Search products...","woo-gutenberg-products-block"),source:"attribute",selector:"input.wc-block-product-search__field",attribute:"placeholder"},formId:{type:"string",default:""}},edit:function(e){var t=e.attributes,r=e.setAttributes,c=t.hasLabel;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(i.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(i.ToggleControl,{label:Object(l.__)("Show search field label","woo-gutenberg-products-block"),help:c?Object(l.__)("Label is visible.","woo-gutenberg-products-block"):Object(l.__)("Label is hidden.","woo-gutenberg-products-block"),checked:c,onChange:function(){return r({hasLabel:!c})}}))),Object(n.createElement)(E,o()({},e,{isPreview:!0})))},save:function(e){return Object(n.createElement)("div",null,Object(n.createElement)(E,e))}})}});
|
build/product-tag.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-tag.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-tag"]=function(t){function e(e){for(var n,a,s=e[0],i=e[1],u=e[2],d=0,b=[];d<s.length;d++)a=s[d],r[a]&&b.push(r[a][0]),r[a]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n]);for(l&&l(e);b.length;)b.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var t,e=0;e<c.length;e++){for(var o=c[e],n=!0,s=1;s<o.length;s++){var i=o[s];0!==r[i]&&(n=!1)}n&&(c.splice(e--,1),t=a(a.s=o[0]))}return t}var n={},r={12:0},c=[];function a(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=t,a.c=n,a.d=function(t,e,o){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)a.d(o,n,function(e){return t[e]}.bind(null,n));return o},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var l=i;return c.push([516,0,2,1]),o()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},10:function(t,e){!function(){t.exports=this.wp.apiFetch}()},11:function(t,e){!function(){t.exports=this.React}()},18:function(t,e){!function(){t.exports=this.wp.blocks}()},19:function(t,e){!function(){t.exports=this.wp.url}()},22:function(t,e){!function(){t.exports=this.wp.compose}()},29:function(t,e){!function(){t.exports=this.wp.keycodes}()},3:function(t,e){!function(){t.exports=this.wp.components}()},31:function(t,e,o){"use strict";var n=o(8),r=o.n(n),c=o(0),a=o(1),s=o(4),i=o.n(s),u=o(3),l=function(t){var e=t.onChange,o=t.settings,n=o.button,s=o.price,i=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product title","woo-gutenberg-products-block"),help:l?Object(a.__)("Product title is visible.","woo-gutenberg-products-block"):Object(a.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return e(r()({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product price","woo-gutenberg-products-block"),help:s?Object(a.__)("Product price is visible.","woo-gutenberg-products-block"):Object(a.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return e(r()({},o,{price:!s}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product rating","woo-gutenberg-products-block"),help:i?Object(a.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(a.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:i,onChange:function(){return e(r()({},o,{rating:!i}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Add to Cart button","woo-gutenberg-products-block"),help:n?Object(a.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(a.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return e(r()({},o,{button:!n}))}}))};l.propTypes={settings:i.a.shape({button:i.a.bool.isRequired,price:i.a.bool.isRequired,rating:i.a.bool.isRequired,title:i.a.bool.isRequired}).isRequired,onChange:i.a.func.isRequired},e.a=l},34:function(t,e,o){"use strict";var n=o(0),r=o(1),c=o(5),a=o(4),s=o.n(a),i=o(3),u=function(t){var e=t.columns,o=t.rows,a=t.setAttributes,s=t.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.RangeControl,{label:Object(r.__)("Columns","woo-gutenberg-products-block"),value:e,onChange:function(t){var e=Object(c.clamp)(t,wc_product_block_data.min_columns,wc_product_block_data.max_columns);a({columns:Object(c.isNaN)(e)?"":e})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(n.createElement)(i.RangeControl,{label:Object(r.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(t){var e=Object(c.clamp)(t,wc_product_block_data.min_rows,wc_product_block_data.max_rows);a({rows:Object(c.isNaN)(e)?"":e})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(n.createElement)(i.ToggleControl,{label:Object(r.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:s?Object(r.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(r.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:s,onChange:function(){return a({alignButtons:!s})}}))};u.propTypes={columns:s.a.oneOfType([s.a.number,s.a.string]).isRequired,rows:s.a.oneOfType([s.a.number,s.a.string]).isRequired,alignButtons:s.a.bool.isRequired,setAttributes:s.a.func.isRequired},e.a=u},36:function(t,e){!function(){t.exports=this.ReactDOM}()},39:function(t,e){!function(){t.exports=this.wp.viewport}()},43:function(t,e,o){"use strict";o.d(e,"d",function(){return s}),o.d(e,"e",function(){return i}),o.d(e,"c",function(){return u}),o.d(e,"b",function(){return l}),o.d(e,"a",function(){return d});var n=o(19),r=o(10),c=o.n(r),a=o(5),s=wc_product_block_data.isLargeCatalog||!1,i=wc_product_block_data.limitTags||!1,u=wc_product_block_data.hasTags||!1,l=function(t){var e=t.selected,o=function(t){var e=t.selected,o=void 0===e?[]:e,r=t.search,c=[Object(n.addQueryArgs)("/wc/blocks/products",{per_page:s?100:-1,catalog_visibility:"visible",status:"publish",search:r})];return s&&o.length&&c.push(Object(n.addQueryArgs)("/wc/blocks/products",{catalog_visibility:"visible",status:"publish",include:o})),c}({selected:void 0===e?[]:e,search:t.search});return Promise.all(o.map(function(t){return c()({path:t})})).then(function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")})},d=function(t){var e=t.selected,o=function(t){var e=t.selected,o=void 0===e?[]:e,r=t.search,c=[Object(n.addQueryArgs)("/wc/blocks/products/tags",{per_page:i?100:-1,orderby:i?"count":"name",order:i?"desc":"asc",search:r})];return i&&o.length&&c.push(Object(n.addQueryArgs)("/wc/blocks/products/tags",{include:o})),c}({selected:void 0===e?[]:e,search:t.search});return Promise.all(o.map(function(t){return c()({path:t})})).then(function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")})}},46:function(t,e){!function(){t.exports=this.wp.hooks}()},47:function(t,e,o){"use strict";var n=o(0),r=o(1),c=o(3),a=o(4),s=o.n(a),i=function(t){var e=t.value,o=t.setAttributes;return Object(n.createElement)(c.SelectControl,{label:Object(r.__)("Order products by","woo-gutenberg-products-block"),value:e,options:[{label:Object(r.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(r.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(r.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(r.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(r.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(r.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(r.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(t){return o({orderby:t})}})};i.propTypes={setAttributes:s.a.func.isRequired,value:s.a.string.isRequired},e.a=i},5:function(t,e){!function(){t.exports=this.lodash}()},504:function(t,e,o){var n=o(505);"string"==typeof n&&(n=[[t.i,n,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};o(38)(n,r);n.locals&&(t.exports=n.locals)},505:function(t,e,o){},51:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},516:function(t,e,o){"use strict";o.r(e);var n=o(0),r=o(1),c=o(18),a=(o(504),o(8)),s=o.n(a),i=o(13),u=o.n(i),l=o(14),d=o.n(l),b=o(15),g=o.n(b),p=o(16),h=o.n(p),f=o(12),_=o.n(f),m=o(17),O=o.n(m),w=o(9),j=o(3),k=o(4),v=o.n(k),y=o(31),E=o(34),C=o(27),P=o.n(C),A=o(5),x=o(24),S=(o(506),o(43)),T=function(t){function e(){var t;return u()(this,e),(t=g()(this,h()(e).apply(this,arguments))).state={list:[],loading:!0},t.renderItem=t.renderItem.bind(_()(t)),t.debouncedOnSearch=Object(A.debounce)(t.onSearch.bind(_()(t)),400),t}return O()(e,t),d()(e,[{key:"componentDidMount",value:function(){var t=this,e=this.props.selected;Object(S.a)({selected:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"onSearch",value:function(t){var e=this,o=this.props.selected;this.setState({loading:!0}),Object(S.a)({selected:o,search:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(t){var e=t.item,o=t.search,c=t.depth,a=void 0===c?0:c,s=["woocommerce-product-tags__item"];o.length&&s.push("is-searching"),0===a&&0!==e.parent&&s.push("is-skip-level");var i=e.breadcrumbs.length?"".concat(e.breadcrumbs.join(", "),", ").concat(e.name):e.name;return Object(n.createElement)(x.b,P()({className:s.join(" ")},t,{showCount:!0,"aria-label":Object(r.sprintf)(Object(r._n)("%d product tagged as %s","%d products tagged as %s",e.count,"woo-gutenberg-products-block"),e.count,i)}))}},{key:"render",value:function(){var t=this.state,e=t.list,o=t.loading,c=this.props,a=c.onChange,s=c.onOperatorChange,i=c.operator,u=c.selected,l={clear:Object(r.__)("Clear all product tags","woo-gutenberg-products-block"),list:Object(r.__)("Product Tags","woo-gutenberg-products-block"),noItems:Object(r.__)("Your store doesn't have any product tags.","woo-gutenberg-products-block"),search:Object(r.__)("Search for product tags","woo-gutenberg-products-block"),selected:function(t){return Object(r.sprintf)(Object(r._n)("%d tag selected","%d tags selected",t,"woo-gutenberg-products-block"),t)},updated:Object(r.__)("Tag search results updated.","woo-gutenberg-products-block")};return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(x.a,{className:"woocommerce-product-tags",list:e,isLoading:o,selected:u.map(function(t){return Object(A.find)(e,{id:t})}).filter(Boolean),onChange:a,onSearch:S.e?this.debouncedOnSearch:null,renderItem:this.renderItem,messages:l,isHierarchical:!0}),!!s&&Object(n.createElement)("div",{className:u.length<2?"screen-reader-text":""},Object(n.createElement)(j.SelectControl,{className:"woocommerce-product-tags__operator",label:Object(r.__)("Display products matching","woo-gutenberg-products-block"),help:Object(r.__)("Pick at least two tags to use this setting.","woo-gutenberg-products-block"),value:i,onChange:s,options:[{label:Object(r.__)("Any selected tags","woo-gutenberg-products-block"),value:"any"},{label:Object(r.__)("All selected tags","woo-gutenberg-products-block"),value:"all"}]})))}}]),e}(n.Component);T.propTypes={onChange:v.a.func.isRequired,onOperatorChange:v.a.func,operator:v.a.oneOf(["all","any"]),selected:v.a.array.isRequired},T.defaultProps={operator:"any"};var R=T,B=o(47),q=function(t){function e(){var t;return u()(this,e),(t=g()(this,h()(e).apply(this,arguments))).state={changedAttributes:{},isEditing:!1},t.startEditing=t.startEditing.bind(_()(t)),t.stopEditing=t.stopEditing.bind(_()(t)),t.setChangedAttributes=t.setChangedAttributes.bind(_()(t)),t.save=t.save.bind(_()(t)),t}return O()(e,t),d()(e,[{key:"componentDidMount",value:function(){this.props.attributes.tags.length||this.setState({isEditing:!0})}},{key:"startEditing",value:function(){this.setState({isEditing:!0,changedAttributes:{}})}},{key:"stopEditing",value:function(){this.setState({isEditing:!1,changedAttributes:{}})}},{key:"setChangedAttributes",value:function(t){this.setState(function(e){return{changedAttributes:s()({},e.changedAttributes,t)}})}},{key:"save",value:function(){var t=this.state.changedAttributes;(0,this.props.setAttributes)(t),this.stopEditing()}},{key:"getInspectorControls",value:function(){var t=this.props,e=t.attributes,o=t.setAttributes,c=this.state.isEditing,a=e.columns,s=e.tagOperator,i=e.contentVisibility,u=e.orderby,l=e.rows,d=e.alignButtons;return Object(n.createElement)(w.InspectorControls,{key:"inspector"},Object(n.createElement)(j.PanelBody,{title:Object(r.__)("Product Tag","woo-gutenberg-products-block"),initialOpen:!e.tags.length&&!c},Object(n.createElement)(R,{selected:e.tags,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map(function(t){return t.id});o({tags:e})},operator:s,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({tagOperator:t})}})),Object(n.createElement)(j.PanelBody,{title:Object(r.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(E.a,{columns:a,rows:l,alignButtons:d,setAttributes:o})),Object(n.createElement)(j.PanelBody,{title:Object(r.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(y.a,{settings:i,onChange:function(t){return o({contentVisibility:t})}})),Object(n.createElement)(j.PanelBody,{title:Object(r.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(n.createElement)(B.a,{setAttributes:o,value:u})))}},{key:"renderEditMode",value:function(){var t=this,e=this.props,o=e.attributes,c=e.debouncedSpeak,a=this.state.changedAttributes,i=s()({},o,a);return Object(n.createElement)(j.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("Display a grid of products from your selected tags.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-product-tag__selection"},Object(n.createElement)(R,{selected:i.tags,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=e.map(function(t){return t.id});t.setChangedAttributes({tags:o})},operator:i.tagOperator,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t.setChangedAttributes({tagOperator:e})}}),Object(n.createElement)(j.Button,{isDefault:!0,onClick:function(){t.save(),c(Object(r.__)("Showing Products by Tag block preview.","woo-gutenberg-products-block"))}},Object(r.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(j.Button,{className:"wc-block-product-tag__cancel-button",isTertiary:!0,onClick:function(){t.stopEditing(),c(Object(r.__)("Showing Products by Tag block preview.","woo-gutenberg-products-block"))}},Object(r.__)("Cancel","woo-gutenberg-products-block"))))}},{key:"renderViewMode",value:function(){var t=this.props,e=t.attributes,o=t.name,c=e.tags.length;return Object(n.createElement)(j.Disabled,null,c?Object(n.createElement)(w.ServerSideRender,{block:o,attributes:e}):Object(n.createElement)(j.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("This block displays products from selected tags. Select at least one tag to display its products.","woo-gutenberg-products-block")))}},{key:"render",value:function(){var t=this,e=this.state.isEditing;return Object(n.createElement)(n.Fragment,null,S.c?Object(n.createElement)(n.Fragment,null,Object(n.createElement)(w.BlockControls,null,Object(n.createElement)(j.Toolbar,{controls:[{icon:"edit",title:Object(r.__)("Edit"),onClick:function(){return e?t.stopEditing():t.startEditing()},isActive:e}]})),this.getInspectorControls(),e?this.renderEditMode():this.renderViewMode()):Object(n.createElement)(j.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("This block displays products from selected tags. In order to preview this you'll first need to create a product and assign it some tags.","woo-gutenberg-products-block")))}}]),e}(n.Component);q.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired,debouncedSpeak:v.a.func.isRequired};var N=Object(j.withSpokenMessages)(q);Object(c.registerBlockType)("woocommerce/product-tag",{title:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),icon:{src:"tag",foreground:"#96588a"},category:"woocommerce",keywords:[Object(r.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(r.__)("Display a grid of products from your selected tags.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},tags:{type:"array",default:[]},tagOperator:{type:"string",default:"any"},orderby:{type:"string",default:"date"}},edit:function(t){return Object(n.createElement)(N,t)},save:function(){return null}})},52:function(t,e){!function(){t.exports=this.wp.date}()},54:function(t,e){!function(){t.exports=this.wp.dom}()},55:function(t,e){},56:function(t,e){},57:function(t,e){},58:function(t,e){},7:function(t,e){!function(){t.exports=this.moment}()},9:function(t,e){!function(){t.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-tag"]=function(t){function e(e){for(var n,i,s=e[0],a=e[1],u=e[2],b=0,d=[];b<s.length;b++)i=s[b],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&d.push(r[i][0]),r[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(l&&l(e);d.length;)d.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var t,e=0;e<c.length;e++){for(var o=c[e],n=!0,s=1;s<o.length;s++){var a=o[s];0!==r[a]&&(n=!1)}n&&(c.splice(e--,1),t=i(i.s=o[0]))}return t}var n={},r={14:0},c=[];function i(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=n,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(o,n,function(e){return t[e]}.bind(null,n));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=s.push.bind(s);s.push=e,s=s.slice();for(var u=0;u<s.length;u++)e(s[u]);var l=a;return c.push([553,2,1,0]),o()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},13:function(t,e){!function(){t.exports=this.React}()},14:function(t,e){!function(){t.exports=this.moment}()},17:function(t,e){!function(){t.exports=this.wp.apiFetch}()},18:function(t,e){!function(){t.exports=this.wp.editor}()},19:function(t,e){!function(){t.exports=this.wp.url}()},2:function(t,e){!function(){t.exports=this.wp.components}()},21:function(t,e){!function(){t.exports=this.wp.compose}()},23:function(t,e){!function(){t.exports=this.wp.blocks}()},25:function(t,e,o){"use strict";o.d(e,"d",function(){return d}),o.d(e,"b",function(){return g}),o.d(e,"c",function(){return p}),o.d(e,"a",function(){return f});var n=o(20),r=o.n(n),c=o(19),i=o(17),s=o.n(i),a=o(4),u=o(5);function l(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)}return o}function b(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?l(o,!0).forEach(function(e){r()(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):l(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}var d=function(t){var e=t.selected,o=void 0===e?[]:e,n=t.search,r=void 0===n?"":n,i=t.queryArgs,l=function(t){var e=t.selected,o=void 0===e?[]:e,n=t.search,r=void 0===n?"":n,i=t.queryArgs,s=void 0===i?[]:i,a={per_page:u.IS_LARGE_CATALOG?100:-1,catalog_visibility:"any",status:"publish",search:r,orderby:"title",order:"asc"},l=[Object(c.addQueryArgs)(u.ENDPOINTS.products,b({},a,{},s))];return u.IS_LARGE_CATALOG&&o.length&&l.push(Object(c.addQueryArgs)(u.ENDPOINTS.products,{catalog_visibility:"any",status:"publish",include:o})),l}({selected:o,search:r,queryArgs:void 0===i?[]:i});return Promise.all(l.map(function(t){return s()({path:t})})).then(function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")})},g=function(t){return s()({path:"".concat(u.ENDPOINTS.products,"/").concat(t)})},p=function(t){var e=t.selected,o=function(t){var e=t.selected,o=void 0===e?[]:e,n=t.search,r=[Object(c.addQueryArgs)("".concat(u.ENDPOINTS.products,"/tags"),{per_page:u.LIMIT_TAGS?100:-1,orderby:u.LIMIT_TAGS?"count":"name",order:u.LIMIT_TAGS?"desc":"asc",search:n})];return u.LIMIT_TAGS&&o.length&&r.push(Object(c.addQueryArgs)("".concat(u.ENDPOINTS.products,"/tags"),{include:o})),r}({selected:void 0===e?[]:e,search:t.search});return Promise.all(o.map(function(t){return s()({path:t})})).then(function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")})},f=function(t){return s()({path:"".concat(u.ENDPOINTS.categories,"/").concat(t)})}},33:function(t,e){!function(){t.exports=this.wp.keycodes}()},37:function(t,e,o){"use strict";var n=o(20),r=o.n(n),c=o(0),i=o(1),s=(o(7),o(2));function a(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)}return o}function u(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?a(o,!0).forEach(function(e){r()(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):a(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}e.a=function(t){var e=t.onChange,o=t.settings,n=o.button,r=o.price,a=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return e(u({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:r?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return e(u({},o,{price:!r}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:a?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return e(u({},o,{rating:!a}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:n?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return e(u({},o,{button:!n}))}}))}},4:function(t,e){!function(){t.exports=this.lodash}()},44:function(t,e){!function(){t.exports=this.ReactDOM}()},45:function(t,e,o){"use strict";var n=o(0),r=o(1),c=o(4),i=(o(7),o(2)),s=o(5);e.a=function(t){var e=t.columns,o=t.rows,a=t.setAttributes,u=t.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.RangeControl,{label:Object(r.__)("Columns","woo-gutenberg-products-block"),value:e,onChange:function(t){var e=Object(c.clamp)(t,s.MIN_COLUMNS,s.MAX_COLUMNS);a({columns:Object(c.isNaN)(e)?"":e})},min:s.MIN_COLUMNS,max:s.MAX_COLUMNS}),Object(n.createElement)(i.RangeControl,{label:Object(r.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(t){var e=Object(c.clamp)(t,s.MIN_ROWS,s.MAX_ROWS);a({rows:Object(c.isNaN)(e)?"":e})},min:s.MIN_ROWS,max:s.MAX_ROWS}),Object(n.createElement)(i.ToggleControl,{label:Object(r.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:u?Object(r.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(r.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:u,onChange:function(){return a({alignButtons:!u})}}))}},47:function(t,e){!function(){t.exports=this.wp.viewport}()},5:function(t,e){!function(){t.exports=this.wc["wc-block-settings"]}()},51:function(t,e){!function(){t.exports=this.wp.hooks}()},53:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},537:function(t,e,o){var n=o(538);"string"==typeof n&&(n=[[t.i,n,""]]);var r={insert:"head",singleton:!1};o(35)(n,r);n.locals&&(t.exports=n.locals)},538:function(t,e,o){},54:function(t,e){!function(){t.exports=this.wp.date}()},553:function(t,e,o){"use strict";o.r(e);var n=o(0),r=o(1),c=o(23),i=o(5),s=(o(537),o(20)),a=o.n(s),u=o(8),l=o.n(u),b=o(9),d=o.n(b),g=o(10),p=o.n(g),f=o(11),h=o.n(f),O=o(15),j=o.n(O),_=o(12),w=o.n(_),m=o(18),y=o(2),v=(o(7),o(37)),k=o(45),E=o(16),P=o.n(E),S=o(4),C=o(26),A=o(25),T=(o(539),function(t){function e(){var t;return l()(this,e),(t=p()(this,h()(e).apply(this,arguments))).state={list:[],loading:!0},t.renderItem=t.renderItem.bind(j()(t)),t.debouncedOnSearch=Object(S.debounce)(t.onSearch.bind(j()(t)),400),t}return w()(e,t),d()(e,[{key:"componentDidMount",value:function(){var t=this,e=this.props.selected;Object(A.c)({selected:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"onSearch",value:function(t){var e=this,o=this.props.selected;this.setState({loading:!0}),Object(A.c)({selected:o,search:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(t){var e=t.item,o=t.search,c=t.depth,i=void 0===c?0:c,s=["woocommerce-product-tags__item"];o.length&&s.push("is-searching"),0===i&&0!==e.parent&&s.push("is-skip-level");var a=e.breadcrumbs.length?"".concat(e.breadcrumbs.join(", "),", ").concat(e.name):e.name;return Object(n.createElement)(C.b,P()({className:s.join(" ")},t,{showCount:!0,"aria-label":Object(r.sprintf)(Object(r._n)("%d product tagged as %s","%d products tagged as %s",e.count,"woo-gutenberg-products-block"),e.count,a)}))}},{key:"render",value:function(){var t=this.state,e=t.list,o=t.loading,c=this.props,s=c.onChange,a=c.onOperatorChange,u=c.operator,l=c.selected,b={clear:Object(r.__)("Clear all product tags","woo-gutenberg-products-block"),list:Object(r.__)("Product Tags","woo-gutenberg-products-block"),noItems:Object(r.__)("Your store doesn't have any product tags.","woo-gutenberg-products-block"),search:Object(r.__)("Search for product tags","woo-gutenberg-products-block"),selected:function(t){return Object(r.sprintf)(Object(r._n)("%d tag selected","%d tags selected",t,"woo-gutenberg-products-block"),t)},updated:Object(r.__)("Tag search results updated.","woo-gutenberg-products-block")};return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(C.a,{className:"woocommerce-product-tags",list:e,isLoading:o,selected:l.map(function(t){return Object(S.find)(e,{id:t})}).filter(Boolean),onChange:s,onSearch:i.LIMIT_TAGS?this.debouncedOnSearch:null,renderItem:this.renderItem,messages:b,isHierarchical:!0}),!!a&&Object(n.createElement)("div",{className:l.length<2?"screen-reader-text":""},Object(n.createElement)(y.SelectControl,{className:"woocommerce-product-tags__operator",label:Object(r.__)("Display products matching","woo-gutenberg-products-block"),help:Object(r.__)("Pick at least two tags to use this setting.","woo-gutenberg-products-block"),value:u,onChange:a,options:[{label:Object(r.__)("Any selected tags","woo-gutenberg-products-block"),value:"any"},{label:Object(r.__)("All selected tags","woo-gutenberg-products-block"),value:"all"}]})))}}]),e}(n.Component));T.defaultProps={operator:"any"};var N=T,I=o(57);function M(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),o.push.apply(o,n)}return o}function D(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?M(o,!0).forEach(function(e){a()(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):M(o).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}var x=function(t){function e(){var t;return l()(this,e),(t=p()(this,h()(e).apply(this,arguments))).state={changedAttributes:{},isEditing:!1},t.startEditing=t.startEditing.bind(j()(t)),t.stopEditing=t.stopEditing.bind(j()(t)),t.setChangedAttributes=t.setChangedAttributes.bind(j()(t)),t.save=t.save.bind(j()(t)),t}return w()(e,t),d()(e,[{key:"componentDidMount",value:function(){this.props.attributes.tags.length||this.setState({isEditing:!0})}},{key:"startEditing",value:function(){this.setState({isEditing:!0,changedAttributes:{}})}},{key:"stopEditing",value:function(){this.setState({isEditing:!1,changedAttributes:{}})}},{key:"setChangedAttributes",value:function(t){this.setState(function(e){return{changedAttributes:D({},e.changedAttributes,{},t)}})}},{key:"save",value:function(){var t=this.state.changedAttributes;(0,this.props.setAttributes)(t),this.stopEditing()}},{key:"getInspectorControls",value:function(){var t=this.props,e=t.attributes,o=t.setAttributes,c=this.state.isEditing,i=e.columns,s=e.tagOperator,a=e.contentVisibility,u=e.orderby,l=e.rows,b=e.alignButtons;return Object(n.createElement)(m.InspectorControls,{key:"inspector"},Object(n.createElement)(y.PanelBody,{title:Object(r.__)("Product Tag","woo-gutenberg-products-block"),initialOpen:!e.tags.length&&!c},Object(n.createElement)(N,{selected:e.tags,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map(function(t){return t.id});o({tags:e})},operator:s,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({tagOperator:t})}})),Object(n.createElement)(y.PanelBody,{title:Object(r.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(k.a,{columns:i,rows:l,alignButtons:b,setAttributes:o})),Object(n.createElement)(y.PanelBody,{title:Object(r.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(v.a,{settings:a,onChange:function(t){return o({contentVisibility:t})}})),Object(n.createElement)(y.PanelBody,{title:Object(r.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(n.createElement)(I.a,{setAttributes:o,value:u})))}},{key:"renderEditMode",value:function(){var t=this,e=this.props,o=e.attributes,c=e.debouncedSpeak,i=D({},o,{},this.state.changedAttributes);return Object(n.createElement)(y.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("Display a grid of products from your selected tags.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-product-tag__selection"},Object(n.createElement)(N,{selected:i.tags,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=e.map(function(t){return t.id});t.setChangedAttributes({tags:o})},operator:i.tagOperator,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t.setChangedAttributes({tagOperator:e})}}),Object(n.createElement)(y.Button,{isDefault:!0,onClick:function(){t.save(),c(Object(r.__)("Showing Products by Tag block preview.","woo-gutenberg-products-block"))}},Object(r.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(y.Button,{className:"wc-block-product-tag__cancel-button",isTertiary:!0,onClick:function(){t.stopEditing(),c(Object(r.__)("Showing Products by Tag block preview.","woo-gutenberg-products-block"))}},Object(r.__)("Cancel","woo-gutenberg-products-block"))))}},{key:"renderViewMode",value:function(){var t=this.props,e=t.attributes,o=t.name,c=e.tags.length;return Object(n.createElement)(y.Disabled,null,c?Object(n.createElement)(m.ServerSideRender,{block:o,attributes:e}):Object(n.createElement)(y.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("This block displays products from selected tags. Select at least one tag to display its products.","woo-gutenberg-products-block")))}},{key:"render",value:function(){var t=this,e=this.state.isEditing;return Object(n.createElement)(n.Fragment,null,i.HAS_TAGS?Object(n.createElement)(n.Fragment,null,Object(n.createElement)(m.BlockControls,null,Object(n.createElement)(y.Toolbar,{controls:[{icon:"edit",title:Object(r.__)("Edit"),onClick:function(){return e?t.stopEditing():t.startEditing()},isActive:e}]})),this.getInspectorControls(),e?this.renderEditMode():this.renderViewMode()):Object(n.createElement)(y.Placeholder,{icon:"tag",label:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-product-tag"},Object(r.__)("This block displays products from selected tags. In order to preview this you'll first need to create a product and assign it some tags.","woo-gutenberg-products-block")))}}]),e}(n.Component),B=Object(y.withSpokenMessages)(x);Object(c.registerBlockType)("woocommerce/product-tag",{title:Object(r.__)("Products by Tag","woo-gutenberg-products-block"),icon:{src:"tag",foreground:"#96588a"},category:"woocommerce",keywords:[Object(r.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(r.__)("Display a grid of products from your selected tags.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{columns:{type:"number",default:i.DEFAULT_COLUMNS},rows:{type:"number",default:i.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},tags:{type:"array",default:[]},tagOperator:{type:"string",default:"any"},orderby:{type:"string",default:"date"}},edit:function(t){return Object(n.createElement)(B,t)},save:function(){return null}})},57:function(t,e,o){"use strict";var n=o(0),r=o(1),c=o(2);o(7);e.a=function(t){var e=t.value,o=t.setAttributes;return Object(n.createElement)(c.SelectControl,{label:Object(r.__)("Order products by","woo-gutenberg-products-block"),value:e,options:[{label:Object(r.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(r.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(r.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(r.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(r.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(r.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(r.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(t){return o({orderby:t})}})}},61:function(t,e){!function(){t.exports=this.wp.dom}()},64:function(t,e){},65:function(t,e){},67:function(t,e){},68:function(t,e){}});
|
build/product-top-rated.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/product-top-rated.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-top-rated"]=function(e){function t(t){for(var r,a,i=t[0],s=t[1],u=t[2],d=0,b=[];d<i.length;d++)a=i[d],n[a]&&b.push(n[a][0]),n[a]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(l&&l(t);b.length;)b.shift()();return c.push.apply(c,u||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,i=1;i<o.length;i++){var s=o[i];0!==n[s]&&(r=!1)}r&&(c.splice(t--,1),e=a(a.s=o[0]))}return e}var r={},n={13:0},c=[];function a(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,a),o.l=!0,o.exports}a.m=e,a.c=r,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(o,r,function(t){return e[t]}.bind(null,r));return o},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 u=0;u<i.length;u++)t(i[u]);var l=s;return c.push([521,0,2,1]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},10:function(e,t){!function(){e.exports=this.wp.apiFetch}()},11:function(e,t){!function(){e.exports=this.React}()},18:function(e,t){!function(){e.exports=this.wp.blocks}()},19:function(e,t){!function(){e.exports=this.wp.url}()},22:function(e,t){!function(){e.exports=this.wp.compose}()},29:function(e,t){!function(){e.exports=this.wp.keycodes}()},3:function(e,t){!function(){e.exports=this.wp.components}()},30:function(e,t,o){"use strict";o.d(t,"b",function(){return r});var r=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:wc_product_block_data.default_columns},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},31:function(e,t,o){"use strict";var r=o(8),n=o.n(r),c=o(0),a=o(1),i=o(4),s=o.n(i),u=o(3),l=function(e){var t=e.onChange,o=e.settings,r=o.button,i=o.price,s=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product title","woo-gutenberg-products-block"),help:l?Object(a.__)("Product title is visible.","woo-gutenberg-products-block"):Object(a.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(n()({},o,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product price","woo-gutenberg-products-block"),help:i?Object(a.__)("Product price is visible.","woo-gutenberg-products-block"):Object(a.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:i,onChange:function(){return t(n()({},o,{price:!i}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Product rating","woo-gutenberg-products-block"),help:s?Object(a.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(a.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:s,onChange:function(){return t(n()({},o,{rating:!s}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(a.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(a.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(a.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(n()({},o,{button:!r}))}}))};l.propTypes={settings:s.a.shape({button:s.a.bool.isRequired,price:s.a.bool.isRequired,rating:s.a.bool.isRequired,title:s.a.bool.isRequired}).isRequired,onChange:s.a.func.isRequired},t.a=l},34:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(5),a=o(4),i=o.n(a),s=o(3),u=function(e){var t=e.columns,o=e.rows,a=e.setAttributes,i=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(s.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_columns,wc_product_block_data.max_columns);a({columns:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(r.createElement)(s.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,wc_product_block_data.min_rows,wc_product_block_data.max_rows);a({rows:Object(c.isNaN)(t)?"":t})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(r.createElement)(s.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:i?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:i,onChange:function(){return a({alignButtons:!i})}}))};u.propTypes={columns:i.a.oneOfType([i.a.number,i.a.string]).isRequired,rows:i.a.oneOfType([i.a.number,i.a.string]).isRequired,alignButtons:i.a.bool.isRequired,setAttributes:i.a.func.isRequired},t.a=u},35:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),a=o(48),i=o.n(a);o.d(t,"a",function(){return s});var s=function(e){return function(t){var o=t.attributes,n=o.align,a=o.contentVisibility,s=c()(n?"align".concat(n):"",{"is-hidden-title":!a.title,"is-hidden-price":!a.price,"is-hidden-rating":!a.rating,"is-hidden-button":!a.button});return Object(r.createElement)(r.RawHTML,{className:s},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,a=o.catOperator,s=o.orderby,u=o.products,l=o.columns||wc_product_block_data.default_columns,d=o.rows||wc_product_block_data.default_rows,b=new Map;switch(b.set("limit",d*l),b.set("columns",l),c&&c.length&&(b.set("category",c.join(",")),a&&"all"===a&&b.set("cat_operator","AND")),r&&r.length&&(b.set("terms",r.map(function(e){return e.id}).join(",")),b.set("attribute",r[0].attr_slug),n&&"all"===n&&b.set("terms_operator","AND")),s&&("price_desc"===s?(b.set("orderby","price"),b.set("order","DESC")):"price_asc"===s?(b.set("orderby","price"),b.set("order","ASC")):"date"===s?(b.set("orderby","date"),b.set("order","DESC")):b.set("orderby",s)),t){case"woocommerce/product-best-sellers":b.set("best_selling","1");break;case"woocommerce/product-top-rated":b.set("orderby","rating");break;case"woocommerce/product-on-sale":b.set("on_sale","1");break;case"woocommerce/product-new":b.set("orderby","date"),b.set("order","DESC");break;case"woocommerce/handpicked-products":if(!u.length)return"";b.set("ids",u.join(",")),b.set("limit",u.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var p="[products",g=!0,f=!1,m=void 0;try{for(var _,h=b[Symbol.iterator]();!(g=(_=h.next()).done);g=!0){var w=i()(_.value,2);p+=" "+w[0]+'="'+w[1]+'"'}}catch(e){f=!0,m=e}finally{try{g||null==h.return||h.return()}finally{if(f)throw m}}return p+="]"}(t,e))}}},36:function(e,t){!function(){e.exports=this.ReactDOM}()},37:function(e,t,o){"use strict";var r=o(27),n=o.n(r),c=o(13),a=o.n(c),i=o(14),s=o.n(i),u=o(15),l=o.n(u),d=o(16),b=o.n(d),p=o(12),g=o.n(p),f=o(17),m=o.n(f),_=o(0),h=o(1),w=o(19),O=o(10),j=o.n(O),k=o(5),y=o(4),v=o.n(y),C=o(24),x=o(3),E=(o(79),function(e){function t(){var e;return a()(this,t),(e=l()(this,b()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return m()(t,e),s()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(w.addQueryArgs)("/wc/blocks/products/categories",{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,a=["woocommerce-product-categories__item"];o.length&&a.push("is-searching"),0===c&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(_.createElement)(C.b,n()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,a=r.operator,i=r.selected,s=r.isSingle,u={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(C.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:i.map(function(e){return Object(k.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:u,isHierarchical:!0,isSingle:s}),!!c&&Object(_.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(_.createElement)(x.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(_.Component));E.propTypes={onChange:v.a.func.isRequired,onOperatorChange:v.a.func,operator:v.a.oneOf(["all","any"]),selected:v.a.array.isRequired,isSingle:v.a.bool},E.defaultProps={operator:"any",isSingle:!1},t.a=E},39:function(e,t){!function(){e.exports=this.wp.viewport}()},46:function(e,t){!function(){e.exports=this.wp.hooks}()},5:function(e,t){!function(){e.exports=this.lodash}()},51:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},52:function(e,t){!function(){e.exports=this.wp.date}()},521:function(e,t,o){"use strict";o.r(t);var r=o(8),n=o.n(r),c=o(0),a=o(1),i=o(18),s=o(25),u=o.n(s),l=o(5),d=o(13),b=o.n(d),p=o(14),g=o.n(p),f=o(15),m=o.n(f),_=o(16),h=o.n(_),w=o(17),O=o.n(w),j=o(3),k=o(9),y=o(4),v=o.n(y),C=o(31),x=o(34),E=o(37),P=function(e){function t(){return b()(this,t),m()(this,h()(t).apply(this,arguments))}return O()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,i=t.columns,s=t.contentVisibility,u=t.rows,l=t.alignButtons;return Object(c.createElement)(k.InspectorControls,{key:"inspector"},Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(x.a,{columns:i,rows:u,alignButtons:l,setAttributes:o})),Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(C.a,{settings:s,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(j.PanelBody,{title:Object(a.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(E.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.name,o=e.attributes;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(j.Disabled,null,Object(c.createElement)(k.ServerSideRender,{block:t,attributes:o})))}}]),t}(c.Component);P.propTypes={attributes:v.a.object.isRequired,name:v.a.string.isRequired,setAttributes:v.a.func.isRequired};var R=P,S=o(35),A=o(30),B="woocommerce/product-top-rated";Object(i.registerBlockType)(B,{title:Object(a.__)("Top Rated Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(u.a,{icon:"trophy"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display a grid of your top rated products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:n()({},A.a),transforms:{from:[{type:"block",blocks:Object(l.without)(A.b,B),transform:function(e){return Object(i.createBlock)("woocommerce/product-top-rated",e)}}]},deprecated:[{attributes:A.a,save:Object(S.a)(B)}],edit:function(e){return Object(c.createElement)(R,e)},save:function(){return null}})},54:function(e,t){!function(){e.exports=this.wp.dom}()},55:function(e,t){},56:function(e,t){},57:function(e,t){},58:function(e,t){},7:function(e,t){!function(){e.exports=this.moment}()},9:function(e,t){!function(){e.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["product-top-rated"]=function(e){function t(t){for(var r,i,s=t[0],u=t[1],a=t[2],b=0,p=[];b<s.length;b++)i=s[b],Object.prototype.hasOwnProperty.call(n,i)&&n[i]&&p.push(n[i][0]),n[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(e[r]=u[r]);for(l&&l(t);p.length;)p.shift()();return c.push.apply(c,a||[]),o()}function o(){for(var e,t=0;t<c.length;t++){for(var o=c[t],r=!0,s=1;s<o.length;s++){var u=o[s];0!==n[u]&&(r=!1)}r&&(c.splice(t--,1),e=i(i.s=o[0]))}return e}var r={},n={15:0},c=[];function i(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=r,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(o,r,function(t){return e[t]}.bind(null,r));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=s.push.bind(s);s.push=t,s=s.slice();for(var a=0;a<s.length;a++)t(s[a]);var l=u;return c.push([558,1,0]),o()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},36:function(e,t,o){"use strict";o.d(t,"b",function(){return n});var r=o(5),n=["woocommerce/product-best-sellers","woocommerce/product-category","woocommerce/product-new","woocommerce/product-on-sale","woocommerce/product-top-rated"];t.a={columns:{type:"number",default:r.DEFAULT_COLUMNS},rows:{type:"number",default:r.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}}}},37:function(e,t,o){"use strict";var r=o(20),n=o.n(r),c=o(0),i=o(1),s=(o(7),o(2));function u(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?u(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):u(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}t.a=function(e){var t=e.onChange,o=e.settings,r=o.button,n=o.price,u=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return t(a({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:n?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return t(a({},o,{price:!n}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:u?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return t(a({},o,{rating:!u}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return t(a({},o,{button:!r}))}}))}},4:function(e,t){!function(){e.exports=this.lodash}()},41:function(e,t,o){"use strict";var r=o(16),n=o.n(r),c=o(8),i=o.n(c),s=o(9),u=o.n(s),a=o(10),l=o.n(a),b=o(11),p=o.n(b),d=o(15),g=o.n(d),f=o(12),m=o.n(f),O=o(0),h=o(1),w=o(19),j=o(17),y=o.n(j),_=o(4),v=(o(7),o(26)),k=o(2),C=o(5),P=(o(86),function(e){function t(){var e;return i()(this,t),(e=l()(this,p()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(g()(e)),e}return m()(t,e),u()(t,[{key:"componentDidMount",value:function(){var e=this;y()({path:Object(w.addQueryArgs)("".concat(C.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,o=e.search,r=e.depth,c=void 0===r?0:r,i=["woocommerce-product-categories__item"];o.length&&i.push("is-searching"),0===c&&0!==t.parent&&i.push("is-skip-level");var s=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(O.createElement)(v.b,n()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(h.sprintf)(Object(h._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),s,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,o=e.loading,r=this.props,n=r.onChange,c=r.onOperatorChange,i=r.operator,s=r.selected,u=r.isSingle,a={clear:Object(h.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(h.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(h.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(h.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(h.sprintf)(Object(h._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(h.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(O.createElement)(O.Fragment,null,Object(O.createElement)(v.a,{className:"woocommerce-product-categories",list:t,isLoading:o,selected:s.map(function(e){return Object(_.find)(t,{id:e})}).filter(Boolean),onChange:n,renderItem:this.renderItem,messages:a,isHierarchical:!0,isSingle:u}),!!c&&Object(O.createElement)("div",{className:s.length<2?"screen-reader-text":""},Object(O.createElement)(k.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(h.__)("Display products matching","woo-gutenberg-products-block"),help:Object(h.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:i,onChange:c,options:[{label:Object(h.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(h.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(O.Component));P.defaultProps={operator:"any",isSingle:!1},t.a=P},44:function(e,t){!function(){e.exports=this.ReactDOM}()},45:function(e,t,o){"use strict";var r=o(0),n=o(1),c=o(4),i=(o(7),o(2)),s=o(5);t.a=function(e){var t=e.columns,o=e.rows,u=e.setAttributes,a=e.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_COLUMNS,s.MAX_COLUMNS);u({columns:Object(c.isNaN)(t)?"":t})},min:s.MIN_COLUMNS,max:s.MAX_COLUMNS}),Object(r.createElement)(i.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(e){var t=Object(c.clamp)(e,s.MIN_ROWS,s.MAX_ROWS);u({rows:Object(c.isNaN)(t)?"":t})},min:s.MIN_ROWS,max:s.MAX_ROWS}),Object(r.createElement)(i.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return u({alignButtons:!a})}}))}},46:function(e,t,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(58),s=o.n(i),u=o(5);o.d(t,"a",function(){return a});var a=function(e){return function(t){var o=t.attributes,n=o.align,i=o.contentVisibility,a=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:a},function(e,t){var o=e.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,a=o.orderby,l=o.products,b=o.columns||u.DEFAULT_COLUMNS,p=o.rows||u.DEFAULT_ROWS,d=new Map;switch(d.set("limit",p*b),d.set("columns",b),c&&c.length&&(d.set("category",c.join(",")),i&&"all"===i&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(e){return e.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),a&&("price_desc"===a?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===a?(d.set("orderby","price"),d.set("order","ASC")):"date"===a?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",a)),t){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!l.length)return"";d.set("ids",l.join(",")),d.set("limit",l.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var g="[products",f=!0,m=!1,O=void 0;try{for(var h,w=d[Symbol.iterator]();!(f=(h=w.next()).done);f=!0){var j=s()(h.value,2);g+=" "+j[0]+'="'+j[1]+'"'}}catch(e){m=!0,O=e}finally{try{f||null==w.return||w.return()}finally{if(m)throw O}}return g+="]"}(t,e))}}},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},558:function(e,t,o){"use strict";o.r(t);var r=o(20),n=o.n(r),c=o(0),i=o(1),s=o(23),u=o(29),a=o.n(u),l=o(4),b=o(8),p=o.n(b),d=o(9),g=o.n(d),f=o(10),m=o.n(f),O=o(11),h=o.n(O),w=o(12),j=o.n(w),y=o(2),_=o(18),v=(o(7),o(37)),k=o(45),C=o(41),P=function(e){function t(){return p()(this,t),m()(this,h()(t).apply(this,arguments))}return j()(t,e),g()(t,[{key:"getInspectorControls",value:function(){var e=this.props,t=e.attributes,o=e.setAttributes,r=t.categories,n=t.catOperator,s=t.columns,u=t.contentVisibility,a=t.rows,l=t.alignButtons;return Object(c.createElement)(_.InspectorControls,{key:"inspector"},Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(k.a,{columns:s,rows:a,alignButtons:l,setAttributes:o})),Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(c.createElement)(v.a,{settings:u,onChange:function(e){return o({contentVisibility:e})}})),Object(c.createElement)(y.PanelBody,{title:Object(i.__)("Filter by Product Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(C.a,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});o({categories:t})},operator:n,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({catOperator:e})}})))}},{key:"render",value:function(){var e=this.props,t=e.name,o=e.attributes;return Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(y.Disabled,null,Object(c.createElement)(_.ServerSideRender,{block:t,attributes:o})))}}]),t}(c.Component),E=o(46),S=o(36);function x(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),o.push.apply(o,r)}return o}var D="woocommerce/product-top-rated";Object(s.registerBlockType)(D,{title:Object(i.__)("Top Rated Products","woo-gutenberg-products-block"),icon:{src:Object(c.createElement)(a.a,{icon:"trophy"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(i.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(i.__)("Display a grid of your top rated products.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:function(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?x(o,!0).forEach(function(t){n()(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):x(o).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))})}return e}({},S.a),transforms:{from:[{type:"block",blocks:Object(l.without)(S.b,D),transform:function(e){return Object(s.createBlock)("woocommerce/product-top-rated",e)}}]},deprecated:[{attributes:S.a,save:Object(E.a)(D)}],edit:function(e){return Object(c.createElement)(P,e)},save:function(){return null}})},61:function(e,t){!function(){e.exports=this.wp.dom}()},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){}});
|
build/products-by-attribute.deps.json
CHANGED
@@ -1 +1 @@
|
|
1 |
-
["lodash","moment","react","react-dom","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-hooks","wp-html-entities","wp-i18n","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/products-by-attribute.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["products-by-attribute"]=function(t){function e(e){for(var r,i,a=e[0],u=e[1],s=e[2],b=0,d=[];b<a.length;b++)i=a[b],n[i]&&d.push(n[i][0]),n[i]=0;for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(t[r]=u[r]);for(l&&l(e);d.length;)d.shift()();return c.push.apply(c,s||[]),o()}function o(){for(var t,e=0;e<c.length;e++){for(var o=c[e],r=!0,a=1;a<o.length;a++){var u=o[a];0!==n[u]&&(r=!1)}r&&(c.splice(e--,1),t=i(i.s=o[0]))}return t}var r={},n={14:0},c=[];function i(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=t,i.c=r,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(o,r,function(e){return t[e]}.bind(null,r));return o},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],u=a.push.bind(a);a.push=e,a=a.slice();for(var s=0;s<a.length;s++)e(a[s]);var l=u;return c.push([514,0,2,1]),o()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},10:function(t,e){!function(){t.exports=this.wp.apiFetch}()},11:function(t,e){!function(){t.exports=this.React}()},18:function(t,e){!function(){t.exports=this.wp.blocks}()},19:function(t,e){!function(){t.exports=this.wp.url}()},22:function(t,e){!function(){t.exports=this.wp.compose}()},29:function(t,e){!function(){t.exports=this.wp.keycodes}()},3:function(t,e){!function(){t.exports=this.wp.components}()},31:function(t,e,o){"use strict";var r=o(8),n=o.n(r),c=o(0),i=o(1),a=o(4),u=o.n(a),s=o(3),l=function(t){var e=t.onChange,o=t.settings,r=o.button,a=o.price,u=o.rating,l=o.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return e(n()({},o,{title:!l}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:a?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return e(n()({},o,{price:!a}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:u?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:u,onChange:function(){return e(n()({},o,{rating:!u}))}}),Object(c.createElement)(s.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:r?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:r,onChange:function(){return e(n()({},o,{button:!r}))}}))};l.propTypes={settings:u.a.shape({button:u.a.bool.isRequired,price:u.a.bool.isRequired,rating:u.a.bool.isRequired,title:u.a.bool.isRequired}).isRequired,onChange:u.a.func.isRequired},e.a=l},34:function(t,e,o){"use strict";var r=o(0),n=o(1),c=o(5),i=o(4),a=o.n(i),u=o(3),s=function(t){var e=t.columns,o=t.rows,i=t.setAttributes,a=t.alignButtons;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(u.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:e,onChange:function(t){var e=Object(c.clamp)(t,wc_product_block_data.min_columns,wc_product_block_data.max_columns);i({columns:Object(c.isNaN)(e)?"":e})},min:wc_product_block_data.min_columns,max:wc_product_block_data.max_columns}),Object(r.createElement)(u.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:o,onChange:function(t){var e=Object(c.clamp)(t,wc_product_block_data.min_rows,wc_product_block_data.max_rows);i({rows:Object(c.isNaN)(e)?"":e})},min:wc_product_block_data.min_rows,max:wc_product_block_data.max_rows}),Object(r.createElement)(u.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:a?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:a,onChange:function(){return i({alignButtons:!a})}}))};s.propTypes={columns:a.a.oneOfType([a.a.number,a.a.string]).isRequired,rows:a.a.oneOfType([a.a.number,a.a.string]).isRequired,alignButtons:a.a.bool.isRequired,setAttributes:a.a.func.isRequired},e.a=s},35:function(t,e,o){"use strict";var r=o(0),n=o(6),c=o.n(n),i=o(48),a=o.n(i);o.d(e,"a",function(){return u});var u=function(t){return function(e){var o=e.attributes,n=o.align,i=o.contentVisibility,u=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(r.createElement)(r.RawHTML,{className:u},function(t,e){var o=t.attributes,r=o.attributes,n=o.attrOperator,c=o.categories,i=o.catOperator,u=o.orderby,s=o.products,l=o.columns||wc_product_block_data.default_columns,b=o.rows||wc_product_block_data.default_rows,d=new Map;switch(d.set("limit",b*l),d.set("columns",l),c&&c.length&&(d.set("category",c.join(",")),i&&"all"===i&&d.set("cat_operator","AND")),r&&r.length&&(d.set("terms",r.map(function(t){return t.id}).join(",")),d.set("attribute",r[0].attr_slug),n&&"all"===n&&d.set("terms_operator","AND")),u&&("price_desc"===u?(d.set("orderby","price"),d.set("order","DESC")):"price_asc"===u?(d.set("orderby","price"),d.set("order","ASC")):"date"===u?(d.set("orderby","date"),d.set("order","DESC")):d.set("orderby",u)),e){case"woocommerce/product-best-sellers":d.set("best_selling","1");break;case"woocommerce/product-top-rated":d.set("orderby","rating");break;case"woocommerce/product-on-sale":d.set("on_sale","1");break;case"woocommerce/product-new":d.set("orderby","date"),d.set("order","DESC");break;case"woocommerce/handpicked-products":if(!s.length)return"";d.set("ids",s.join(",")),d.set("limit",s.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!r||!r.length)return""}var p="[products",g=!0,m=!1,f=void 0;try{for(var _,h=d[Symbol.iterator]();!(g=(_=h.next()).done);g=!0){var w=a()(_.value,2);p+=" "+w[0]+'="'+w[1]+'"'}}catch(t){m=!0,f=t}finally{try{g||null==h.return||h.return()}finally{if(m)throw f}}return p+="]"}(e,t))}}},36:function(t,e){!function(){t.exports=this.ReactDOM}()},39:function(t,e){!function(){t.exports=this.wp.viewport}()},46:function(t,e){!function(){t.exports=this.wp.hooks}()},47:function(t,e,o){"use strict";var r=o(0),n=o(1),c=o(3),i=o(4),a=o.n(i),u=function(t){var e=t.value,o=t.setAttributes;return Object(r.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:e,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(t){return o({orderby:t})}})};u.propTypes={setAttributes:a.a.func.isRequired,value:a.a.string.isRequired},e.a=u},494:function(t,e,o){var r=o(495);"string"==typeof r&&(r=[[t.i,r,""]]);var n={hmr:!0,transform:void 0,insertInto:void 0};o(38)(r,n);r.locals&&(t.exports=r.locals)},495:function(t,e,o){},5:function(t,e){!function(){t.exports=this.lodash}()},51:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},514:function(t,e,o){"use strict";o.r(e);var r=o(0),n=o(1),c=o(25),i=o.n(c),a=o(18),u=(o(494),o(13)),s=o.n(u),l=o(14),b=o.n(l),d=o(15),p=o.n(d),g=o(16),m=o.n(g),f=o(17),_=o.n(f),h=o(9),w=o(3),O=o(4),y=o.n(O),j=o(31),k=o(34),v=o(60),C=o.n(v),E=o(27),S=o.n(E),x=o(92),A=o.n(x),P=o(8),R=o.n(P),T=o(12),B=o.n(T),q=o(19),M=o(10),N=o.n(M),D=o(5),L=o(24),I=(o(496),function(t){function e(){var t;return s()(this,e),(t=p()(this,m()(e).apply(this,arguments))).state={list:[],loading:!0,attribute:0,termsList:{},termsLoading:!0},t.debouncedGetTerms=Object(D.debounce)(t.getTerms.bind(B()(t)),200),t.renderItem=t.renderItem.bind(B()(t)),t.onSelectAttribute=t.onSelectAttribute.bind(B()(t)),t}return _()(e,t),b()(e,[{key:"componentDidMount",value:function(){var t=this,e=this.props.selected;N()({path:Object(q.addQueryArgs)("/wc/blocks/products/attributes",{per_page:-1})}).then(function(o){o=o.map(function(t){return R()({},t,{parent:0})}),t.setState(function(t){var r=t.attribute;if(!r&&e.length>0){var n=Object(D.find)(o,{slug:e[0].attr_slug});r=n?n.id:0}return{list:o,attribute:r,loading:!1}})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"componentDidUpdate",value:function(t,e){e.attribute!==this.state.attribute&&this.debouncedGetTerms()}},{key:"getTerms",value:function(){var t=this,e=this.state,o=e.attribute,r=e.termsList;o&&(r[o]||this.setState({termsLoading:!0}),N()({path:Object(q.addQueryArgs)("/wc/blocks/products/attributes/".concat(o,"/terms"),{per_page:-1})}).then(function(e){e=e.map(function(t){return R()({},t,{parent:o,attr_slug:t.attribute.slug})}),t.setState(function(t){return{termsList:R()({},t.termsList,A()({},o,e)),termsLoading:!1}})}).catch(function(){t.setState({termsLoading:!1})}))}},{key:"onSelectAttribute",value:function(t){var e=this;return function(){e.props.onChange([]),e.setState({attribute:t.id===e.state.attribute?0:t.id})}}},{key:"renderItem",value:function(t){var e=t.item,o=t.search,c=t.depth,i=void 0===c?0:c,a=this.state,u=a.attribute,s=a.termsLoading,l=["woocommerce-product-attributes__item","woocommerce-search-list__item"];return o.length&&l.push("is-searching"),0===i&&0!==e.parent&&l.push("is-skip-level"),e.breadcrumbs.length?Object(r.createElement)(L.b,S()({className:l.join(" ")},t,{showCount:!0,"aria-label":"".concat(e.breadcrumbs[0],": ").concat(e.name)})):[Object(r.createElement)(L.b,S()({key:"attr-".concat(e.id)},t,{className:l.join(" "),isSelected:u===e.id,onSelect:this.onSelectAttribute,isSingle:!0,disabled:"0"===e.count,"aria-expanded":u===e.id,"aria-label":Object(n.sprintf)(Object(n._n)("%s, has %d term","%s, has %d terms",e.count,"woo-gutenberg-products-block"),e.name,e.count)})),u===e.id&&s&&Object(r.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-product-attributes__itemdepth-1 is-loading is-not-active"},Object(r.createElement)(w.Spinner,null))]}},{key:"render",value:function(){var t=this.state,e=t.attribute,o=t.list,c=t.loading,i=t.termsList,a=this.props,u=a.onChange,s=a.onOperatorChange,l=a.operator,b=a.selected,d=i[e]||[],p=[].concat(C()(o),C()(d)),g={clear:Object(n.__)("Clear all product attributes","woo-gutenberg-products-block"),list:Object(n.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(n.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(n.__)("Search for product attributes","woo-gutenberg-products-block"),selected:function(t){return Object(n.sprintf)(Object(n._n)("%d attribute selected","%d attributes selected",t,"woo-gutenberg-products-block"),t)},updated:Object(n.__)("Product attribute search results updated.","woo-gutenberg-products-block")};return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(L.a,{className:"woocommerce-product-attributes",list:p,isLoading:c,selected:b.map(function(t){var e=t.id;return Object(D.find)(p,{id:e})}).filter(Boolean),onChange:u,renderItem:this.renderItem,messages:g,isHierarchical:!0}),!!s&&Object(r.createElement)("div",{className:b.length<2?"screen-reader-text":""},Object(r.createElement)(w.SelectControl,{className:"woocommerce-product-attributes__operator",label:Object(n.__)("Display products matching","woo-gutenberg-products-block"),help:Object(n.__)("Pick at least two attributes to use this setting.","woo-gutenberg-products-block"),value:l,onChange:s,options:[{label:Object(n.__)("Any selected attributes","woo-gutenberg-products-block"),value:"any"},{label:Object(n.__)("All selected attributes","woo-gutenberg-products-block"),value:"all"}]})))}}]),e}(r.Component));I.propTypes={onChange:y.a.func.isRequired,onOperatorChange:y.a.func,operator:y.a.oneOf(["all","any"]),selected:y.a.array.isRequired},I.defaultProps={operator:"any"};var F=I,V=o(47),W=function(t){function e(){return s()(this,e),p()(this,m()(e).apply(this,arguments))}return _()(e,t),b()(e,[{key:"getInspectorControls",value:function(){var t=this.props.setAttributes,e=this.props.attributes,o=e.attributes,c=e.attrOperator,i=e.columns,a=e.contentVisibility,u=e.orderby,s=e.rows,l=e.alignButtons;return Object(r.createElement)(h.InspectorControls,{key:"inspector"},Object(r.createElement)(w.PanelBody,{title:Object(n.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(k.a,{columns:i,rows:s,alignButtons:l,setAttributes:t})),Object(r.createElement)(w.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(j.a,{settings:a,onChange:function(e){return t({contentVisibility:e})}})),Object(r.createElement)(w.PanelBody,{title:Object(n.__)("Filter by Product Attribute","woo-gutenberg-products-block"),initialOpen:!1},Object(r.createElement)(F,{selected:o,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],o=e.map(function(t){return{id:t.id,attr_slug:t.attr_slug}});t({attributes:o})},operator:c,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t({attrOperator:e})}})),Object(r.createElement)(w.PanelBody,{title:Object(n.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(r.createElement)(V.a,{setAttributes:t,value:u})))}},{key:"renderEditMode",value:function(){var t=this.props,e=t.debouncedSpeak,o=t.setAttributes,c=this.props.attributes;return Object(r.createElement)(w.Placeholder,{icon:Object(r.createElement)(i.a,{icon:"custom-post-type"}),label:Object(n.__)("Products by Attribute","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-products-by-attribute"},Object(n.__)("Display a grid of products from your selected attributes.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-products-by-attribute__selection"},Object(r.createElement)(F,{selected:c.attributes,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map(function(t){return{id:t.id,attr_slug:t.attr_slug}});o({attributes:e})},operator:c.attrOperator,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return o({attrOperator:t})}}),Object(r.createElement)(w.Button,{isDefault:!0,onClick:function(){o({editMode:!1}),e(Object(n.__)("Showing Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(n.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var t=this.props,e=t.attributes,o=t.name,c=t.setAttributes,i=e.editMode;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(h.BlockControls,null,Object(r.createElement)(w.Toolbar,{controls:[{icon:"edit",title:Object(n.__)("Edit"),onClick:function(){return c({editMode:!i})},isActive:i}]})),this.getInspectorControls(),i?this.renderEditMode():Object(r.createElement)(w.Disabled,null,Object(r.createElement)(h.ServerSideRender,{block:o,attributes:e})))}}]),e}(r.Component);W.propTypes={attributes:y.a.object.isRequired,name:y.a.string.isRequired,setAttributes:y.a.func.isRequired,debouncedSpeak:y.a.func.isRequired};var G=Object(w.withSpokenMessages)(W),H=o(35);Object(a.registerBlockType)("woocommerce/products-by-attribute",{title:Object(n.__)("Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(i.a,{icon:"custom-post-type"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Display a grid of products from your selected attributes.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{attributes:{type:"array",default:[]},attrOperator:{type:"string",default:"any"},columns:{type:"number",default:wc_product_block_data.default_columns},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},rows:{type:"number",default:wc_product_block_data.default_rows},alignButtons:{type:"boolean",default:!1}},deprecated:[{attributes:{attributes:{type:"array",default:[]},attrOperator:{type:"string",default:"any"},columns:{type:"number",default:wc_product_block_data.default_columns},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},rows:{type:"number",default:wc_product_block_data.default_rows}},save:Object(H.a)("woocommerce/products-by-attribute")}],edit:function(t){return Object(r.createElement)(G,t)},save:function(){return null}})},52:function(t,e){!function(){t.exports=this.wp.date}()},54:function(t,e){!function(){t.exports=this.wp.dom}()},55:function(t,e){},56:function(t,e){},57:function(t,e){},58:function(t,e){},7:function(t,e){!function(){t.exports=this.moment}()},9:function(t,e){!function(){t.exports=this.wp.editor}()}});
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["products-by-attribute"]=function(t){function e(e){for(var o,i,u=e[0],a=e[1],s=e[2],b=0,d=[];b<u.length;b++)i=u[b],Object.prototype.hasOwnProperty.call(n,i)&&n[i]&&d.push(n[i][0]),n[i]=0;for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&(t[o]=a[o]);for(l&&l(e);d.length;)d.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var t,e=0;e<c.length;e++){for(var r=c[e],o=!0,u=1;u<r.length;u++){var a=r[u];0!==n[a]&&(o=!1)}o&&(c.splice(e--,1),t=i(i.s=r[0]))}return t}var o={},n={16:0},c=[];function i(e){if(o[e])return o[e].exports;var r=o[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=o,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(r,o,function(e){return t[e]}.bind(null,o));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="";var u=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=u.push.bind(u);u.push=e,u=u.slice();for(var s=0;s<u.length;s++)e(u[s]);var l=a;return c.push([550,2,1,0]),r()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},13:function(t,e){!function(){t.exports=this.React}()},14:function(t,e){!function(){t.exports=this.moment}()},17:function(t,e){!function(){t.exports=this.wp.apiFetch}()},18:function(t,e){!function(){t.exports=this.wp.editor}()},19:function(t,e){!function(){t.exports=this.wp.url}()},2:function(t,e){!function(){t.exports=this.wp.components}()},21:function(t,e){!function(){t.exports=this.wp.compose}()},23:function(t,e){!function(){t.exports=this.wp.blocks}()},33:function(t,e){!function(){t.exports=this.wp.keycodes}()},37:function(t,e,r){"use strict";var o=r(20),n=r.n(o),c=r(0),i=r(1),u=(r(7),r(2));function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(r,!0).forEach(function(e){n()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}e.a=function(t){var e=t.onChange,r=t.settings,o=r.button,n=r.price,a=r.rating,l=r.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product title","woo-gutenberg-products-block"),help:l?Object(i.__)("Product title is visible.","woo-gutenberg-products-block"):Object(i.__)("Product title is hidden.","woo-gutenberg-products-block"),checked:l,onChange:function(){return e(s({},r,{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product price","woo-gutenberg-products-block"),help:n?Object(i.__)("Product price is visible.","woo-gutenberg-products-block"):Object(i.__)("Product price is hidden.","woo-gutenberg-products-block"),checked:n,onChange:function(){return e(s({},r,{price:!n}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product rating","woo-gutenberg-products-block"),help:a?Object(i.__)("Product rating is visible.","woo-gutenberg-products-block"):Object(i.__)("Product rating is hidden.","woo-gutenberg-products-block"),checked:a,onChange:function(){return e(s({},r,{rating:!a}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Add to Cart button","woo-gutenberg-products-block"),help:o?Object(i.__)("Add to Cart button is visible.","woo-gutenberg-products-block"):Object(i.__)("Add to Cart button is hidden.","woo-gutenberg-products-block"),checked:o,onChange:function(){return e(s({},r,{button:!o}))}}))}},4:function(t,e){!function(){t.exports=this.lodash}()},44:function(t,e){!function(){t.exports=this.ReactDOM}()},45:function(t,e,r){"use strict";var o=r(0),n=r(1),c=r(4),i=(r(7),r(2)),u=r(5);e.a=function(t){var e=t.columns,r=t.rows,a=t.setAttributes,s=t.alignButtons;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Columns","woo-gutenberg-products-block"),value:e,onChange:function(t){var e=Object(c.clamp)(t,u.MIN_COLUMNS,u.MAX_COLUMNS);a({columns:Object(c.isNaN)(e)?"":e})},min:u.MIN_COLUMNS,max:u.MAX_COLUMNS}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Rows","woo-gutenberg-products-block"),value:r,onChange:function(t){var e=Object(c.clamp)(t,u.MIN_ROWS,u.MAX_ROWS);a({rows:Object(c.isNaN)(e)?"":e})},min:u.MIN_ROWS,max:u.MAX_ROWS}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Align Add to Cart buttons","woo-gutenberg-products-block"),help:s?Object(n.__)("Buttons are aligned vertically.","woo-gutenberg-products-block"):Object(n.__)("Buttons follow content.","woo-gutenberg-products-block"),checked:s,onChange:function(){return a({alignButtons:!s})}}))}},46:function(t,e,r){"use strict";var o=r(0),n=r(6),c=r.n(n),i=r(58),u=r.n(i),a=r(5);r.d(e,"a",function(){return s});var s=function(t){return function(e){var r=e.attributes,n=r.align,i=r.contentVisibility,s=c()(n?"align".concat(n):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(o.createElement)(o.RawHTML,{className:s},function(t,e){var r=t.attributes,o=r.attributes,n=r.attrOperator,c=r.categories,i=r.catOperator,s=r.orderby,l=r.products,b=r.columns||a.DEFAULT_COLUMNS,d=r.rows||a.DEFAULT_ROWS,p=new Map;switch(p.set("limit",d*b),p.set("columns",b),c&&c.length&&(p.set("category",c.join(",")),i&&"all"===i&&p.set("cat_operator","AND")),o&&o.length&&(p.set("terms",o.map(function(t){return t.id}).join(",")),p.set("attribute",o[0].attr_slug),n&&"all"===n&&p.set("terms_operator","AND")),s&&("price_desc"===s?(p.set("orderby","price"),p.set("order","DESC")):"price_asc"===s?(p.set("orderby","price"),p.set("order","ASC")):"date"===s?(p.set("orderby","date"),p.set("order","DESC")):p.set("orderby",s)),e){case"woocommerce/product-best-sellers":p.set("best_selling","1");break;case"woocommerce/product-top-rated":p.set("orderby","rating");break;case"woocommerce/product-on-sale":p.set("on_sale","1");break;case"woocommerce/product-new":p.set("orderby","date"),p.set("order","DESC");break;case"woocommerce/handpicked-products":if(!l.length)return"";p.set("ids",l.join(",")),p.set("limit",l.length);break;case"woocommerce/product-category":if(!c||!c.length)return"";break;case"woocommerce/products-by-attribute":if(!o||!o.length)return""}var g="[products",f=!0,m=!1,O=void 0;try{for(var h,_=p[Symbol.iterator]();!(f=(h=_.next()).done);f=!0){var j=u()(h.value,2);g+=" "+j[0]+'="'+j[1]+'"'}}catch(t){m=!0,O=t}finally{try{f||null==_.return||_.return()}finally{if(m)throw O}}return g+="]"}(e,t))}}},47:function(t,e){!function(){t.exports=this.wp.viewport}()},5:function(t,e){!function(){t.exports=this.wc["wc-block-settings"]}()},51:function(t,e){!function(){t.exports=this.wp.hooks}()},519:function(t,e,r){var o=r(520);"string"==typeof o&&(o=[[t.i,o,""]]);var n={insert:"head",singleton:!1};r(35)(o,n);o.locals&&(t.exports=o.locals)},520:function(t,e,r){},53:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},54:function(t,e){!function(){t.exports=this.wp.date}()},550:function(t,e,r){"use strict";r.r(e);var o=r(0),n=r(1),c=r(29),i=r.n(c),u=r(23),a=r(5),s=(r(519),r(8)),l=r.n(s),b=r(9),d=r.n(b),p=r(10),g=r.n(p),f=r(11),m=r.n(f),O=r(12),h=r.n(O),_=r(18),j=r(2),y=(r(7),r(37)),w=r(45),v=r(62),k=r.n(v),E=r(16),C=r.n(E),S=r(20),P=r.n(S),A=r(15),M=r.n(A),N=r(19),x=r(17),D=r.n(x),L=r(4),T=r(26);r(521);function B(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,o)}return r}function I(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?B(r,!0).forEach(function(e){P()(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):B(r).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var R=function(t){function e(){var t;return l()(this,e),(t=g()(this,m()(e).apply(this,arguments))).state={list:[],loading:!0,attribute:0,termsList:{},termsLoading:!0},t.debouncedGetTerms=Object(L.debounce)(t.getTerms.bind(M()(t)),200),t.renderItem=t.renderItem.bind(M()(t)),t.onSelectAttribute=t.onSelectAttribute.bind(M()(t)),t}return h()(e,t),d()(e,[{key:"componentDidMount",value:function(){var t=this,e=this.props.selected;D()({path:Object(N.addQueryArgs)("".concat(a.ENDPOINTS.products,"/attributes"),{per_page:-1})}).then(function(r){r=r.map(function(t){return I({},t,{parent:0})}),t.setState(function(t){var o=t.attribute;if(!o&&e.length>0){var n=Object(L.find)(r,{slug:e[0].attr_slug});o=n?n.id:0}return{list:r,attribute:o,loading:!1}})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedGetTerms.cancel()}},{key:"componentDidUpdate",value:function(t,e){e.attribute!==this.state.attribute&&this.debouncedGetTerms()}},{key:"getTerms",value:function(){var t=this,e=this.state,r=e.attribute,o=e.termsList;r&&(o[r]||this.setState({termsLoading:!0}),D()({path:Object(N.addQueryArgs)("".concat(a.ENDPOINTS.products,"/attributes/").concat(r,"/terms"),{per_page:-1})}).then(function(e){e=e.map(function(t){return I({},t,{parent:r,attr_slug:t.attribute.slug})}),t.setState(function(t){return{termsList:I({},t.termsList,P()({},r,e)),termsLoading:!1}})}).catch(function(){t.setState({termsLoading:!1})}))}},{key:"onSelectAttribute",value:function(t){var e=this;return function(){e.props.onChange([]),e.setState({attribute:t.id===e.state.attribute?0:t.id})}}},{key:"renderItem",value:function(t){var e=t.item,r=t.search,c=t.depth,i=void 0===c?0:c,u=this.state,a=u.attribute,s=u.termsLoading,l=["woocommerce-product-attributes__item","woocommerce-search-list__item"];return r.length&&l.push("is-searching"),0===i&&0!==e.parent&&l.push("is-skip-level"),e.breadcrumbs.length?Object(o.createElement)(T.b,C()({className:l.join(" ")},t,{showCount:!0,"aria-label":"".concat(e.breadcrumbs[0],": ").concat(e.name)})):[Object(o.createElement)(T.b,C()({key:"attr-".concat(e.id)},t,{className:l.join(" "),isSelected:a===e.id,onSelect:this.onSelectAttribute,isSingle:!0,disabled:"0"===e.count,"aria-expanded":a===e.id,"aria-label":Object(n.sprintf)(Object(n._n)("%s, has %d term","%s, has %d terms",e.count,"woo-gutenberg-products-block"),e.name,e.count)})),a===e.id&&s&&Object(o.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-product-attributes__itemdepth-1 is-loading is-not-active"},Object(o.createElement)(j.Spinner,null))]}},{key:"render",value:function(){var t=this.state,e=t.attribute,r=t.list,c=t.loading,i=t.termsList,u=this.props,a=u.onChange,s=u.onOperatorChange,l=u.operator,b=u.selected,d=i[e]||[],p=[].concat(k()(r),k()(d)),g={clear:Object(n.__)("Clear all product attributes","woo-gutenberg-products-block"),list:Object(n.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(n.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(n.__)("Search for product attributes","woo-gutenberg-products-block"),selected:function(t){return Object(n.sprintf)(Object(n._n)("%d attribute selected","%d attributes selected",t,"woo-gutenberg-products-block"),t)},updated:Object(n.__)("Product attribute search results updated.","woo-gutenberg-products-block")};return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(T.a,{className:"woocommerce-product-attributes",list:p,isLoading:c,selected:b.map(function(t){var e=t.id;return Object(L.find)(p,{id:e})}).filter(Boolean),onChange:a,renderItem:this.renderItem,messages:g,isHierarchical:!0}),!!s&&Object(o.createElement)("div",{className:b.length<2?"screen-reader-text":""},Object(o.createElement)(j.SelectControl,{className:"woocommerce-product-attributes__operator",label:Object(n.__)("Display products matching","woo-gutenberg-products-block"),help:Object(n.__)("Pick at least two attributes to use this setting.","woo-gutenberg-products-block"),value:l,onChange:s,options:[{label:Object(n.__)("Any selected attributes","woo-gutenberg-products-block"),value:"any"},{label:Object(n.__)("All selected attributes","woo-gutenberg-products-block"),value:"all"}]})))}}]),e}(o.Component);R.defaultProps={operator:"any"};var U=R,F=r(57),W=function(t){function e(){return l()(this,e),g()(this,m()(e).apply(this,arguments))}return h()(e,t),d()(e,[{key:"getInspectorControls",value:function(){var t=this.props.setAttributes,e=this.props.attributes,r=e.attributes,c=e.attrOperator,i=e.columns,u=e.contentVisibility,a=e.orderby,s=e.rows,l=e.alignButtons;return Object(o.createElement)(_.InspectorControls,{key:"inspector"},Object(o.createElement)(j.PanelBody,{title:Object(n.__)("Layout","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(w.a,{columns:i,rows:s,alignButtons:l,setAttributes:t})),Object(o.createElement)(j.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block"),initialOpen:!0},Object(o.createElement)(y.a,{settings:u,onChange:function(e){return t({contentVisibility:e})}})),Object(o.createElement)(j.PanelBody,{title:Object(n.__)("Filter by Product Attribute","woo-gutenberg-products-block"),initialOpen:!1},Object(o.createElement)(U,{selected:r,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=e.map(function(t){return{id:t.id,attr_slug:t.attr_slug}});t({attributes:r})},operator:c,onOperatorChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return t({attrOperator:e})}})),Object(o.createElement)(j.PanelBody,{title:Object(n.__)("Order By","woo-gutenberg-products-block"),initialOpen:!1},Object(o.createElement)(F.a,{setAttributes:t,value:a})))}},{key:"renderEditMode",value:function(){var t=this.props,e=t.debouncedSpeak,r=t.setAttributes,c=this.props.attributes;return Object(o.createElement)(j.Placeholder,{icon:Object(o.createElement)(i.a,{icon:"custom-post-type"}),label:Object(n.__)("Products by Attribute","woo-gutenberg-products-block"),className:"wc-block-products-grid wc-block-products-by-attribute"},Object(n.__)("Display a grid of products from your selected attributes.","woo-gutenberg-products-block"),Object(o.createElement)("div",{className:"wc-block-products-by-attribute__selection"},Object(o.createElement)(U,{selected:c.attributes,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map(function(t){return{id:t.id,attr_slug:t.attr_slug}});r({attributes:e})},operator:c.attrOperator,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return r({attrOperator:t})}}),Object(o.createElement)(j.Button,{isDefault:!0,onClick:function(){r({editMode:!1}),e(Object(n.__)("Showing Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(n.__)("Done","woo-gutenberg-products-block"))))}},{key:"render",value:function(){var t=this.props,e=t.attributes,r=t.name,c=t.setAttributes,i=e.editMode;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(_.BlockControls,null,Object(o.createElement)(j.Toolbar,{controls:[{icon:"edit",title:Object(n.__)("Edit"),onClick:function(){return c({editMode:!i})},isActive:i}]})),this.getInspectorControls(),i?this.renderEditMode():Object(o.createElement)(j.Disabled,null,Object(o.createElement)(_.ServerSideRender,{block:r,attributes:e})))}}]),e}(o.Component),V=Object(j.withSpokenMessages)(W),X=r(46);Object(u.registerBlockType)("woocommerce/products-by-attribute",{title:Object(n.__)("Products by Attribute","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(i.a,{icon:"custom-post-type"}),foreground:"#96588a"},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Display a grid of products from your selected attributes.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1},attributes:{attributes:{type:"array",default:[]},attrOperator:{type:"string",default:"any"},columns:{type:"number",default:a.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},rows:{type:"number",default:a.DEFAULT_ROWS},alignButtons:{type:"boolean",default:!1}},deprecated:[{attributes:{attributes:{type:"array",default:[]},attrOperator:{type:"string",default:"any"},columns:{type:"number",default:a.DEFAULT_COLUMNS},editMode:{type:"boolean",default:!0},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},orderby:{type:"string",default:"date"},rows:{type:"number",default:a.DEFAULT_ROWS}},save:Object(X.a)("woocommerce/products-by-attribute")}],edit:function(t){return Object(o.createElement)(V,t)},save:function(){return null}})},57:function(t,e,r){"use strict";var o=r(0),n=r(1),c=r(2);r(7);e.a=function(t){var e=t.value,r=t.setAttributes;return Object(o.createElement)(c.SelectControl,{label:Object(n.__)("Order products by","woo-gutenberg-products-block"),value:e,options:[{label:Object(n.__)("Newness - newest first","woo-gutenberg-products-block"),value:"date"},{label:Object(n.__)("Price - low to high","woo-gutenberg-products-block"),value:"price_asc"},{label:Object(n.__)("Price - high to low","woo-gutenberg-products-block"),value:"price_desc"},{label:Object(n.__)("Rating - highest first","woo-gutenberg-products-block"),value:"rating"},{label:Object(n.__)("Sales - most first","woo-gutenberg-products-block"),value:"popularity"},{label:Object(n.__)("Title - alphabetical","woo-gutenberg-products-block"),value:"title"},{label:Object(n.__)("Menu Order","woo-gutenberg-products-block"),value:"menu_order"}],onChange:function(t){return r({orderby:t})}})}},61:function(t,e){!function(){t.exports=this.wp.dom}()},64:function(t,e){},65:function(t,e){},67:function(t,e){},68:function(t,e){}});
|
build/reviews-by-category.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-escape-html","wp-hooks","wp-html-entities","wp-i18n","wp-is-shallow-equal","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/reviews-by-category.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["reviews-by-category"]=function(e){function t(t){for(var n,a,i=t[0],l=t[1],s=t[2],b=0,d=[];b<i.length;b++)a=i[b],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&d.push(o[a][0]),o[a]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(u&&u(t);d.length;)d.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,i=1;i<r.length;i++){var l=r[i];0!==o[l]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={17:0},c=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=i.push.bind(i);i.push=t,i=i.slice();for(var s=0;s<i.length;s++)t(i[s]);var u=l;return c.push([552,2,1,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},114:function(e,t,r){},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,r){"use strict";var n=r(0),o=r(2),c=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(n.createElement)("g",null,Object(n.createElement)("g",null,Object(n.createElement)("path",{fill:r,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(n.createElement)("path",{fill:r,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(n.createElement)("path",{fill:r,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},l=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},s=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},b=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)("path",{fill:r,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(n.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},d=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(n.createElement)("path",{fill:r,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(n.createElement)("path",{fill:r,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(n.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},p=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},w=r(6),m=r.n(w),h=(r(7),function(e){var t=e.size,r=void 0===t?20:t,c=e.className;return Object(n.createElement)(o.Icon,{className:m()("woo-icon",c),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:r,width:Math.floor(1.67*r),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});r.d(t,"a",function(){return c}),r.d(t,"b",function(){return a}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return l}),r.d(t,"e",function(){return s}),r.d(t,"f",function(){return u}),r.d(t,"h",function(){return b}),r.d(t,"g",function(){return d}),r.d(t,"i",function(){return p}),r.d(t,"j",function(){return h})},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},40:function(e,t,r){"use strict";r.d(t,"b",function(){return l}),r.d(t,"c",function(){return s}),r.d(t,"a",function(){return u});var n=r(17),o=r.n(n),c=r(6),a=r.n(c),i=r(5),l=function(e){if(i.ENABLE_REVIEW_RATING){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},s=function(e){return o()({path:"/wc/blocks/products/reviews?"+Object.entries(e).map(function(e){return e.join("=")}).join("&"),parse:!1}).then(function(e){return e.json().then(function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}})})},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,i=t.showProductName,l=t.showReviewImage,s=t.showReviewRating;return a()(e,r,{"has-image":l,"has-name":o,"has-date":n,"has-rating":s,"has-content":c,"has-product-name":i})}},41:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(15),w=r.n(p),m=r(12),h=r.n(m),g=r(0),v=r(1),f=r(19),O=r(17),j=r.n(O),y=r(4),_=(r(7),r(26)),E=r(2),k=r(5),R=(r(86),function(e){function t(){var e;return a()(this,t),(e=u()(this,d()(t).apply(this,arguments))).state={list:[],loading:!0},e.renderItem=e.renderItem.bind(w()(e)),e}return h()(t,e),l()(t,[{key:"componentDidMount",value:function(){var e=this;j()({path:Object(f.addQueryArgs)("".concat(k.ENDPOINTS.products,"/categories"),{per_page:-1})}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"renderItem",value:function(e){var t=e.item,r=e.search,n=e.depth,c=void 0===n?0:n,a=["woocommerce-product-categories__item"];r.length&&a.push("is-searching"),0===c&&0!==t.parent&&a.push("is-skip-level");var i=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(g.createElement)(_.b,o()({className:a.join(" ")},e,{showCount:!0,"aria-label":Object(v.sprintf)(Object(v._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),i,t.count)}))}},{key:"render",value:function(){var e=this.state,t=e.list,r=e.loading,n=this.props,o=n.onChange,c=n.onOperatorChange,a=n.operator,i=n.selected,l=n.isSingle,s={clear:Object(v.__)("Clear all product categories","woo-gutenberg-products-block"),list:Object(v.__)("Product Categories","woo-gutenberg-products-block"),noItems:Object(v.__)("Your store doesn't have any product categories.","woo-gutenberg-products-block"),search:Object(v.__)("Search for product categories","woo-gutenberg-products-block"),selected:function(e){return Object(v.sprintf)(Object(v._n)("%d category selected","%d categories selected",e,"woo-gutenberg-products-block"),e)},updated:Object(v.__)("Category search results updated.","woo-gutenberg-products-block")};return Object(g.createElement)(g.Fragment,null,Object(g.createElement)(_.a,{className:"woocommerce-product-categories",list:t,isLoading:r,selected:i.map(function(e){return Object(y.find)(t,{id:e})}).filter(Boolean),onChange:o,renderItem:this.renderItem,messages:s,isHierarchical:!0,isSingle:l}),!!c&&Object(g.createElement)("div",{className:i.length<2?"screen-reader-text":""},Object(g.createElement)(E.SelectControl,{className:"woocommerce-product-categories__operator",label:Object(v.__)("Display products matching","woo-gutenberg-products-block"),help:Object(v.__)("Pick at least two categories to use this setting.","woo-gutenberg-products-block"),value:a,onChange:c,options:[{label:Object(v.__)("Any selected categories","woo-gutenberg-products-block"),value:"any"},{label:Object(v.__)("All selected categories","woo-gutenberg-products-block"),value:"all"}]})))}}]),t}(g.Component));R.defaultProps={operator:"any",isSingle:!1},t.a=R},44:function(e,t){!function(){e.exports=this.ReactDOM}()},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(7),r(29)),a=r.n(c),i=r(6),l=r.n(i),s=r(39),u=r(2);t.a=function(e){var t,r,c=e.className,i=e.error,b=e.isLoading,d=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(a.a,{icon:"notice"}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:l()("wc-block-api-error",c)},Object(n.createElement)("div",{className:"wc-block-error__message"},(r=(t=i).apiMessage,t.message||(r?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(s.escapeHTML)(r))):Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))),d&&Object(n.createElement)(n.Fragment,null,b?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:d},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},552:function(e,t,r){"use strict";r.r(t);var n=r(20),o=r.n(n),c=r(0),a=r(1),i=r(23),l=(r(77),r(16)),s=r.n(l),u=r(18),b=r(2),d=r(26),p=(r(7),r(41)),w=r(24),m=r(81),h=function(){return Object(c.createElement)(b.Placeholder,{className:"wc-block-reviews-by-category",icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Category","woo-gutenberg-products-block")},Object(a.__)("This block lists reviews for products from selected categories. The selected categories do not have any reviews yet, but they will show up here when they do.","woo-gutenberg-products-block"))},g=r(63),v=Object(b.withSpokenMessages)(function(e){var t=e.attributes,r=e.debouncedSpeak,n=e.setAttributes,o=t.editMode,i=t.categoryIds,l=function(e){var t=e.item,r=e.search,n=e.depth,o=void 0===n?0:n,i=["woocommerce-product-categories__item"];r.length&&i.push("is-searching"),0===o&&0!==t.parent&&i.push("is-skip-level");var l=t.breadcrumbs.length?"".concat(t.breadcrumbs.join(", "),", ").concat(t.name):t.name;return Object(c.createElement)(d.b,s()({className:i.join(" ")},e,{showCount:!0,"aria-label":Object(a.sprintf)(Object(a._n)("%s, has %d product","%s, has %d products",t.count,"woo-gutenberg-products-block"),l,t.count)}))};return!i||o?Object(c.createElement)(b.Placeholder,{icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Category","woo-gutenberg-products-block")},Object(a.__)("Show product reviews from specific categories.","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-reviews__selection"},Object(c.createElement)(p.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({categoryIds:t})}}),Object(c.createElement)(b.Button,{isDefault:!0,onClick:function(){n({editMode:!1}),r(Object(a.__)("Showing Reviews by Category block preview.","woo-gutenberg-products-block"))}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(c.createElement)(c.Fragment,null,Object(g.a)(o,n),Object(c.createElement)(u.InspectorControls,{key:"inspector"},Object(c.createElement)(b.PanelBody,{title:Object(a.__)("Category","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(p.a,{selected:t.categoryIds,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e.map(function(e){return e.id});n({categoryIds:t})},renderItem:l})),Object(c.createElement)(b.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(c.createElement)(b.ToggleControl,{label:Object(a.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:function(){return n({showProductName:!t.showProductName})}}),Object(g.b)(t,n)),Object(c.createElement)(b.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block")},Object(g.c)(t,n))),Object(c.createElement)(m.a,{attributes:t,className:"wc-block-reviews-by-category",icon:Object(c.createElement)(w.g,{className:"block-editor-block-icon"}),name:Object(a.__)("Reviews by Category","woo-gutenberg-products-block"),noReviewsPlaceholder:h}))}),f=r(79),O=r(80);function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}Object(i.registerBlockType)("woocommerce/reviews-by-category",{title:Object(a.__)("Reviews by Category","woo-gutenberg-products-block"),icon:Object(c.createElement)(w.g,{fillColor:"#96588a"}),category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show product reviews from specific categories.","woo-gutenberg-products-block"),attributes:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},f.a,{categoryIds:{type:"array",default:[]},showProductName:{type:"boolean",default:!0}}),edit:function(e){return Object(c.createElement)(v,e)},save:O.a})},61:function(e,t){!function(){e.exports=this.wp.dom}()},63:function(e,t,r){"use strict";r.d(t,"a",function(){return b}),r.d(t,"b",function(){return d}),r.d(t,"c",function(){return p});var n=r(0),o=r(1),c=r(39),a=r(2),i=r(18),l=r(74),s=r(5),u=r(70),b=function(e,t){return Object(n.createElement)(i.BlockControls,null,Object(n.createElement)(a.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},d=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!s.ENABLE_REVIEW_RATING&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Product rating is disabled in your %sstore settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(l.a)("admin.php?page=wc-settings&tab=products"),'" target="_blank">'),"</a>"))),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!s.SHOW_AVATARS&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Reviewer photo is disabled in your %ssite settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(l.a)("options-discussion.php"),'" target="_blank">'),"</a>")))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(a.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},69:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(12),w=r.n(p),m=r(0),h=r(13),g=[];t.a=function(e){return function(t){function r(){return a()(this,r),u()(this,d()(r).apply(this,arguments))}return w()(r,t),l()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return g[e]||(g[e]=0),g[e]++,g[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(m.createElement)(e,o()({},this.props,{componentId:t}))}}]),r}(h.Component)}},70:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),l=r.n(i),s=r(10),u=r.n(s),b=r(11),d=r.n(b),p=r(15),w=r.n(p),m=r(12),h=r.n(m),g=r(0),v=r(4),f=r(6),O=r.n(f),j=r(2),y=r(21),_=(r(132),function(e){function t(){var e;return a()(this,t),(e=u()(this,d()(t).apply(this,arguments))).onClick=e.onClick.bind(w()(e)),e}return h()(t,e),l()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,a=r.instanceId,i=r.className,l=r.help,s=r.options,u=r.value,b="inspector-toggle-button-control-".concat(a);return l&&(e=Object(v.isFunction)(l)?l(c):l),Object(g.createElement)(j.BaseControl,{id:b,help:e,className:O()("components-toggle-button-control",i)},Object(g.createElement)("label",{id:b+"__label",htmlFor:b,className:"components-toggle-button-control__label"},n),Object(g.createElement)(j.ButtonGroup,{"aria-labelledby":b+"__label"},s.map(function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(g.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)})))}}]),t}(g.Component));t.a=Object(y.withInstanceId)(_)},77:function(e,t,r){var n=r(114);"string"==typeof n&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(35)(n,o);n.locals&&(e.exports=n.locals)},78:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},79: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}}},80:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(0),a=(r(77),r(40));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,i=t.orderby,l=t.productId,s={"data-image-type":n,"data-orderby":i,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return l&&(s["data-product-id"]=l,u="wc-block-reviews-by-product"),Array.isArray(r)&&(s["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(a.a)(u,t)},s))}},81:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(9),a=r.n(c),i=r(10),l=r.n(i),s=r(11),u=r.n(s),b=r(12),d=r.n(b),p=r(0),w=r(1),m=r(13),h=(r(7),r(4)),g=r(2),v=r(5),f=r(52),O=r(20),j=r.n(O),y=r(6),_=r.n(y);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var k=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,c=e.wrapperProps;return!r&&n?(t=o||"span",c=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},c,{className:_()(c.className,"screen-reader-text")}),Object(p.createElement)(t,c,n)):(t=o||m.Fragment,r&&n&&r!==n?Object(p.createElement)(t,c,Object(p.createElement)("span",{"aria-hidden":!0},r),Object(p.createElement)("span",{className:"screen-reader-text"},n)):Object(p.createElement)(t,c,r))};k.defaultProps={wrapperProps:{}};var R=k,C=(r(170),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(R,{label:r,screenReaderLabel:n})))});C.defaultProps={label:Object(w.__)("Load more","woo-gutenberg-products-block")};var N=C,L=r(15),P=r.n(L),M=r(100),x=r.n(M),I=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=x()(e,{suffix:r,limit:t});return n.html},T=function(e,t,r,n){var o=S(e,t,r);return I(e,o-n.length,n)},S=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=I(e,n.middle),n=H(n,t.clientHeight,r);return n.middle},H=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e},D=function(e){function t(e){var r;return o()(this,t),(r=l()(this,u()(t).apply(this,arguments))).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},r.reviewSummary=Object(m.createRef)(),r.reviewContent=Object(m.createRef)(),r.getButton=r.getButton.bind(P()(r)),r.onClick=r.onClick.bind(P()(r)),r}return d()(t,e),a()(t,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:T(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),t}(m.Component);D.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(w.__)("Read more","woo-gutenberg-products-block"),lessText:Object(w.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var A=D;r(171);var z=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,a=t.showReviewerName,i=t.showReviewImage,l=t.showReviewRating,s=t.showReviewContent,u=t.showProductName,b=n.rating,d=!Object.keys(n).length>0,m=Number.isFinite(b)&&l;return Object(p.createElement)("li",{className:_()("wc-block-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||c||a||i||m)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info"},i&&function(e,t,r){return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.product_picture||"",className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x",className:"wc-block-review-list-item__image",width:"48",height:"48"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified",title:Object(w.__)("Verified buyer","woo-gutenberg-products-block")},Object(w.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||a||m||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta"},m&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(w.sprintf)(Object(w.__)("Rated %d out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink},e.product_name))}(n),a&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date",dateTime:t},r)}(n))),s&&function(e){return Object(p.createElement)(A,{maxLines:10,moreText:Object(w.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(w.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(172);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var V=function(e){var t=e.attributes,r=e.reviews,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{showReviewImage:(v.SHOW_AVATARS||"product"===t.imageType)&&t.showReviewImage,showReviewRating:v.ENABLE_REVIEW_RATING&&t.showReviewRating});return Object(p.createElement)("ul",{className:"wc-block-review-list"},0===r.length?Object(p.createElement)(z,{attributes:n}):r.map(function(e,t){return Object(p.createElement)(z,{key:e.id||t,attributes:n,review:e})}))},F=r(69),W=(r(173),Object(F.a)(function(e){var t=e.className,r=e.componentId,n=e.defaultValue,o=e.label,c=e.onChange,a=e.options,i=e.screenReaderLabel,l=e.readOnly,s=e.value,u="wc-block-order-select__select-".concat(r);return Object(p.createElement)("p",{className:_()("wc-block-order-select",t)},Object(p.createElement)(R,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-order-select__label",htmlFor:u}}),Object(p.createElement)("select",{id:u,className:"wc-block-order-select__select",defaultValue:n,onChange:c,readOnly:l,value:s},a.map(function(e){return Object(p.createElement)("option",{key:e.key,value:e.key},e.label)})))})),G=(r(174),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(W,{className:"wc-block-review-order-select",defaultValue:t,label:Object(w.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(w.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(w.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(w.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(w.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),Z=r(16),U=r.n(Z),q=r(38),J=r.n(q),Q=r(78),Y=r.n(Q),K=r(40),X=function(e){var t=function(t){function r(){var e;return o()(this,r),(e=l()(this,u()(r).apply(this,arguments))).state={error:null,loading:!0,reviews:[],totalReviews:0},e.setError=e.setError.bind(P()(e)),e.delayedAppendReviews=e.props.delayFunction(e.appendReviews),e}return d()(r,t),a()(r,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{key:"replaceReviews",value:function(){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}},{key:"appendReviews",value:function(){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object(K.c)(this.getArgs(t.length)).then(function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter(function(e){return Object.keys(e).length}).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}}).catch(this.setError)}},{key:"setError",value:function(e){var t=this;e.json().then(function(e){var r=t.props.onReviewsLoadError,n="object"===J()(e)&&e.hasOwnProperty("message")?{apiMessage:e.message}:{apiMessage:null};t.setState({reviews:[],loading:!1,error:n}),r()})}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,a=r.totalReviews;return Object(p.createElement)(e,U()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),r}(m.Component);t.defaultProps={delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}};var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;return r?Object(p.createElement)(f.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(g.Disabled,null,t.showOrderby&&v.ENABLE_REVIEW_RATING&&Object(p.createElement)(G,{readOnly:!0,value:t.orderby}),Object(p.createElement)(V,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(p.createElement)(N,{screenReaderLabel:Object(w.__)("Load more reviews","woo-gutenberg-products-block")})):Object(p.createElement)(o,{attributes:t})}}]),t}(m.Component)),$=function(e){function t(){return o()(this,t),l()(this,u()(t).apply(this,arguments))}return d()(t,e),a()(t,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(g.Placeholder,{icon:t,label:r},Object(w.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,a=t.reviewsOnPageLoad,i=t.showProductName,l=t.showReviewDate,s=t.showReviewerName,u=t.showReviewContent,b=t.showReviewImage,d=t.showReviewRating,w=Object(K.b)(t.orderby),m=w.order,g=w.orderby;return!(u||d||l||s||b||i)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object(K.a)(r,t)},Object(p.createElement)(X,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(h.debounce)(e,400)},noReviewsPlaceholder:n,orderby:g,order:m,productId:c,reviewsToDisplay:a}))}}]),t}(m.Component);t.a=$}});
|
build/reviews-by-product.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["lodash","moment","react","react-dom","wc-block-settings","wp-api-fetch","wp-blocks","wp-components","wp-compose","wp-date","wp-dom","wp-editor","wp-element","wp-escape-html","wp-hooks","wp-html-entities","wp-i18n","wp-is-shallow-equal","wp-keycodes","wp-polyfill","wp-url","wp-viewport"]
|
build/reviews-by-product.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["reviews-by-product"]=function(e){function t(t){for(var n,a,i=t[0],s=t[1],l=t[2],d=0,b=[];d<i.length;d++)a=i[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],n=!0,i=1;i<r.length;i++){var s=r[i];0!==o[s]&&(n=!1)}n&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var n={},o={18:0},c=[];function a(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=n,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(r,n,function(t){return e[t]}.bind(null,n));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var u=s;return c.push([547,2,1,0]),r()}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},114:function(e,t,r){},13:function(e,t){!function(){e.exports=this.React}()},14:function(e,t){!function(){e.exports=this.moment}()},17:function(e,t){!function(){e.exports=this.wp.apiFetch}()},18:function(e,t){!function(){e.exports=this.wp.editor}()},19:function(e,t){!function(){e.exports=this.wp.url}()},2:function(e,t){!function(){e.exports=this.wp.components}()},21:function(e,t){!function(){e.exports=this.wp.compose}()},23:function(e,t){!function(){e.exports=this.wp.blocks}()},24:function(e,t,r){"use strict";var n=r(0),o=r(2),c=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 22.41"},Object(n.createElement)("g",null,Object(n.createElement)("g",null,Object(n.createElement)("path",{fill:r,d:"M16.55 0H1.75C.56 0 0 .52 0 1.68v9.24c0 1.15.56 1.92 1.75 1.92H2V4.76a2.51 2.51 0 0 1 2.74-2.68H18v-.4A1.51 1.51 0 0 0 16.55 0z"}),Object(n.createElement)("path",{fill:r,d:"M19.54 3.11H4.74C3.55 3.11 3 3.64 3 4.79V14c0 1.19.55 2 1.74 2H5V7.88A2.51 2.51 0 0 1 7.73 5.2H21v-.41a1.51 1.51 0 0 0-1.46-1.68z"}),Object(n.createElement)("path",{fill:r,d:"M22.53 6.23H7.73C6.54 6.23 6 6.75 6 7.91v9.24c0 1.15.56 1.92 1.75 1.92h7a.59.59 0 0 1 .32.11l1.61 1.15 2.83 2a.31.31 0 0 0 .18.05.3.3 0 0 0 .31-.3v-2.73a.3.3 0 0 1 .28-.28h2.31A1.47 1.47 0 0 0 24 17.6V7.91a1.52 1.52 0 0 0-1.47-1.68z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M10.2 10.92l1.06-2.14 1.05 2.14 2.37.35-1.71 1.66.4 2.36-2.11-1.11-.17.09-.52.27-.51.26-.92.49.18-1.02.09-.57.1-.56.03-.21-1.71-1.66 2.37-.35zM21.46 14.25h-4.4a.69.69 0 0 1-.69-.69.68.68 0 0 1 .69-.68h4.4a.68.68 0 0 1 .69.68.69.69 0 0 1-.69.69zM21.46 11.19h-4.4a.69.69 0 1 1 0-1.37h4.4a.69.69 0 1 1 0 1.37z"}))))})},a=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fillRule:"nonzero",d:"M21.913 7.0946H2.0254c-1.1708 0-2.0984.9908-2.0205 2.16l.741 11.0724c.0714 1.0638.9552 1.8892 2.0206 1.8892h18.4054c1.0654 0 1.9492-.8254 2.0205-1.8892l.7411-11.0724c.0779-1.1692-.8497-2.16-2.0205-2.16zm-8.8006-4.6573h5.987c1.119 0 2.0255.9065 2.0255 2.0254v.934H2.8103V2.0255C2.8103.9064 3.7168 0 4.8357 0h6.2513c1.119 0 2.0254.9065 2.0254 2.0254v.4119zm-7.0589 11.619a.926.926 0 1 1 0-1.852h11.8297a.926.926 0 1 1 0 1.852H6.0535z"}))})},i=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M22 7.5H2c-1.2 0-2.1 1-2 2.2l.7 11.1c.1 1.1 1 1.9 2 1.9h18.5c1.1 0 2-.8 2-1.9L24 9.6c.1-1.1-.9-2.1-2-2.1zM13.1 2.8v-.4c0-1.1-.9-2-2-2H4.8c-1.1 0-2 .9-2 2v3.4h18.4v-1c0-1.1-.9-2-2-2h-6.1z"}),Object(n.createElement)("path",{fill:"#fff",d:"M14.4 18.7L12 17.4l-2.4 1.3.5-2.6-1.9-1.9 2.6-.4 1.2-2.4 1.2 2.4 2.6.4-1.9 1.9z"}))})},s=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}),Object(n.createElement)("path",{d:"M23 12l-2.44-2.78.34-3.68-3.61-.82-1.89-3.18L12 3 8.6 1.54 6.71 4.72l-3.61.81.34 3.68L1 12l2.44 2.78-.34 3.69 3.61.82 1.89 3.18L12 21l3.4 1.46 1.89-3.18 3.61-.82-.34-3.68L23 12zm-10 5h-2v-2h2v2zm0-4h-2V7h2v6z"}))})},l=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#1E8CBE",d:"M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},u=function(){return Object(n.createElement)(o.Icon,{icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{fill:"#6C7781",d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}))})},d=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)("path",{fill:r,d:"M2.3,17.3h9.3c0.1,0,0.3,0,0.4,0.1l5.9,4.2c0.3,0.2,0.7,0,0.7-0.3v-3.7c0-0.2,0.2-0.4,0.4-0.4H22 c1.1,0,2-0.9,2-2V2.5c0-1.2-0.7-2.2-2-2.2H2.3C0.7,0.2,0,0.9,0,2.5v12.3C0,16.3,0.7,17.3,2.3,17.3z"}),Object(n.createElement)("polygon",{fill:"#ffffff",points:"8.8,12.1 6.5,10.9 4.1,12.1 4.5,9.5 2.6,7.6 5.3,7.2 6.5,4.8 7.6,7.2 10.3,7.6 8.4,9.5"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,7.9h-7c-0.5,0-0.9-0.4-0.9-0.9S13.2,6,13.7,6h7c0.5,0,0.9,0.4,0.9,0.9S21.2,7.9,20.7,7.9z"}),Object(n.createElement)("path",{fill:"#ffffff",d:"M20.7,11.5h-7c-0.5,0-0.9-0.4-0.9-0.9s0.4-0.9,0.9-0.9h7c0.5,0,0.9,0.4,0.9,0.9S21.2,11.5,20.7,11.5z"}))})},b=function(e){var t=e.className,r=e.fillColor;return Object(n.createElement)(o.Icon,{className:t,icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 23"},Object(n.createElement)("path",{fill:r,d:"M21.9943 7.0957H2.00638C0.807102 7.0957 -0.0923543 8.0951 0.0075853 9.29437L0.707162 20.3877C0.807102 21.487 1.70656 22.2865 2.70595 22.2865H21.1948C22.2941 22.2865 23.1936 21.487 23.1936 20.3877L23.9931 9.29437C24.093 8.0951 23.0936 7.0957 21.9943 7.0957Z"}),Object(n.createElement)("path",{fill:r,d:"M13.0921 2.39855V1.99879C13.0921 0.899456 12.1926 0 11.0933 0H4.7971C3.69777 0 2.79831 0.899456 2.79831 1.99879V5.39674H21.1872V4.49728C21.1872 3.39795 20.2877 2.49849 19.1884 2.49849H13.0921V2.39855Z"}),Object(n.createElement)("path",{fill:"white",d:"M8.63115 17.126L6.5415 15.9449L4.361 17.126L4.72442 14.6729L2.99819 13.0376L5.45125 12.6742L6.5415 10.4937L7.5409 12.6742L9.99396 13.0376L8.26773 14.6729L8.63115 17.126Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 13.5918H12.9899C12.547 13.5918 12.1926 13.1921 12.1926 12.6924C12.1926 12.1927 12.547 11.7929 12.9899 11.7929H19.1907C19.6336 11.7929 19.9879 12.1927 19.9879 12.6924C19.9879 13.1921 19.6336 13.5918 19.1907 13.5918Z"}),Object(n.createElement)("path",{fill:"white",d:"M19.1907 17.1897H12.9899C12.547 17.1897 12.1926 16.7899 12.1926 16.2902C12.1926 15.7905 12.547 15.3907 12.9899 15.3907H19.1907C19.6336 15.3907 19.9879 15.7905 19.9879 16.2902C19.9879 16.7899 19.6336 17.1897 19.1907 17.1897Z"}))})},p=function(){return Object(n.createElement)(o.Icon,{className:"material-icon",icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M13 13v8h8v-8h-8zM3 21h8v-8H3v8zM3 3v8h8V3H3zm13.66-1.31L11 7.34 16.66 13l5.66-5.66-5.66-5.65z"}),Object(n.createElement)("path",{d:"M0 0h24v24H0z",fill:"none"}))})},h=r(6),m=r.n(h),v=(r(7),function(e){var t=e.size,r=void 0===t?20:t,c=e.className;return Object(n.createElement)(o.Icon,{className:m()("woo-icon",c),icon:Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",height:r,width:Math.floor(1.67*r),viewBox:"0 0 245 145"},Object(n.createElement)("path",{fill:"#96588A",d:"M22.76 0h199.1a22.77 22.77 0 0 1 22.8 22.76v75.92a22.77 22.77 0 0 1-22.78 22.78h-71.41l9.77 24-43.13-24H22.76C10.1946 121.449.011 111.2654 0 98.7V22.76C.011 10.1946 10.1946.011 22.76 0z"}),Object(n.createElement)("path",{fill:"#FFF",fillRule:"nonzero",d:"M12.32 20.63a8.16 8.16 0 0 1 6.25-3.09c5.0733-.36 7.9867 2.0333 8.74 7.18 3.14 20.86 6.4933 38.5633 10.06 53.11l21.92-41.69c2-3.76 4.49-5.76 7.52-6 4.3867-.3067 7.13 2.49 8.23 8.39a186 186 0 0 0 9.47 34.23c2.62-25.38 7.0133-43.7133 13.18-55a7.73 7.73 0 0 1 6.6-4.43 8.8 8.8 0 0 1 6.32 2 7.75 7.75 0 0 1 3.05 5.74 8.52 8.52 0 0 1-1 4.77c-3.9 7.24-7.12 19.28-9.66 36.12-2.48 16.2533-3.3967 28.9633-2.75 38.13a12.25 12.25 0 0 1-1.16 6.56 6.32 6.32 0 0 1-5.33 3.53c-2.6667.18-5.3033-1.0567-7.91-3.71-9.2933-9.54-16.6567-23.7267-22.09-42.56C57.3 76.7167 52.48 86.3333 49.3 92.76c-5.86 11.3333-10.89 17.13-15.09 17.39-2.7333.1933-5.0667-2.0933-7-6.86-5.1-13.0933-10.5833-38.4033-16.45-75.93a8.56 8.56 0 0 1 1.56-6.73zM227.23 36.34a23.17 23.17 0 0 0-16-11.59 26.25 26.25 0 0 0-5.42-.58c-9.5867 0-17.41 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6167 14.3333 4.85 19.8a23.15 23.15 0 0 0 16 11.59 26.28 26.28 0 0 0 5.42.59c9.68 0 17.5033-5 23.47-15A53.89 53.89 0 0 0 232.08 56c0-7.7333-1.6167-14.2867-4.85-19.66zm-12.61 27.72c-1.3733 6.56-3.9167 11.5-7.63 14.82-2.9267 2.6667-5.6133 3.7433-8.06 3.23-2.4467-.5133-4.4033-2.6667-5.87-6.46a25.68 25.68 0 0 1-1.76-9.09 35.9 35.9 0 0 1 .73-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.68 25.68 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03zM164.57 36.34a23.2 23.2 0 0 0-16-11.59 26.42 26.42 0 0 0-5.43-.58c-9.5933 0-17.4167 5-23.47 15a53 53 0 0 0-7.78 28.16c0 7.7333 1.6133 14.3333 4.84 19.8a23.19 23.19 0 0 0 16 11.59 26.44 26.44 0 0 0 5.43.59c9.68 0 17.5033-5 23.47-15A53.88 53.88 0 0 0 169.4 56c0-7.7333-1.6133-14.2867-4.84-19.66h.01zm-12.61 27.72c-1.3667 6.56-3.91 11.5-7.63 14.82-2.93 2.64-5.63 3.72-8.07 3.23-2.44-.49-4.4-2.64-5.86-6.46a25.7 25.7 0 0 1-1.77-9.09 35.9 35.9 0 0 1 .74-7.34 33 33 0 0 1 5.28-11.88c3.3333-4.8933 6.8067-6.9467 10.42-6.16 2.44.4867 4.3933 2.64 5.86 6.46a25.91 25.91 0 0 1 1.76 9.12 35.73 35.73 0 0 1-.73 7.33v-.03z"}))})});r.d(t,"a",function(){return c}),r.d(t,"b",function(){return a}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return s}),r.d(t,"e",function(){return l}),r.d(t,"f",function(){return u}),r.d(t,"h",function(){return d}),r.d(t,"g",function(){return b}),r.d(t,"i",function(){return p}),r.d(t,"j",function(){return v})},25:function(e,t,r){"use strict";r.d(t,"d",function(){return b}),r.d(t,"b",function(){return p}),r.d(t,"c",function(){return h}),r.d(t,"a",function(){return m});var n=r(20),o=r.n(n),c=r(19),a=r(17),i=r.n(a),s=r(4),l=r(5);function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var b=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,u=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=void 0===n?"":n,a=e.queryArgs,i=void 0===a?[]:a,s={per_page:l.IS_LARGE_CATALOG?100:-1,catalog_visibility:"any",status:"publish",search:o,orderby:"title",order:"asc"},u=[Object(c.addQueryArgs)(l.ENDPOINTS.products,d({},s,{},i))];return l.IS_LARGE_CATALOG&&r.length&&u.push(Object(c.addQueryArgs)(l.ENDPOINTS.products,{catalog_visibility:"any",status:"publish",include:r})),u}({selected:r,search:o,queryArgs:void 0===a?[]:a});return Promise.all(u.map(function(e){return i()({path:e})})).then(function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id")})},p=function(e){return i()({path:"".concat(l.ENDPOINTS.products,"/").concat(e)})},h=function(e){var t=e.selected,r=function(e){var t=e.selected,r=void 0===t?[]:t,n=e.search,o=[Object(c.addQueryArgs)("".concat(l.ENDPOINTS.products,"/tags"),{per_page:l.LIMIT_TAGS?100:-1,orderby:l.LIMIT_TAGS?"count":"name",order:l.LIMIT_TAGS?"desc":"asc",search:n})];return l.LIMIT_TAGS&&r.length&&o.push(Object(c.addQueryArgs)("".concat(l.ENDPOINTS.products,"/tags"),{include:r})),o}({selected:void 0===t?[]:t,search:e.search});return Promise.all(r.map(function(e){return i()({path:e})})).then(function(e){return Object(s.uniqBy)(Object(s.flatten)(e),"id")})},m=function(e){return i()({path:"".concat(l.ENDPOINTS.categories,"/").concat(e)})}},33:function(e,t){!function(){e.exports=this.wp.keycodes}()},39:function(e,t){!function(){e.exports=this.wp.escapeHtml}()},4:function(e,t){!function(){e.exports=this.lodash}()},40:function(e,t,r){"use strict";r.d(t,"b",function(){return s}),r.d(t,"c",function(){return l}),r.d(t,"a",function(){return u});var n=r(17),o=r.n(n),c=r(6),a=r.n(c),i=r(5),s=function(e){if(i.ENABLE_REVIEW_RATING){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=function(e){return o()({path:"/wc/blocks/products/reviews?"+Object.entries(e).map(function(e){return e.join("=")}).join("&"),parse:!1}).then(function(e){return e.json().then(function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}})})},u=function(e,t){var r=t.className,n=t.showReviewDate,o=t.showReviewerName,c=t.showReviewContent,i=t.showProductName,s=t.showReviewImage,l=t.showReviewRating;return a()(e,r,{"has-image":s,"has-name":o,"has-date":n,"has-rating":l,"has-content":c,"has-product-name":i})}},44:function(e,t){!function(){e.exports=this.ReactDOM}()},47:function(e,t){!function(){e.exports=this.wp.viewport}()},5:function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},51:function(e,t){!function(){e.exports=this.wp.hooks}()},52:function(e,t,r){"use strict";var n=r(0),o=r(1),c=(r(7),r(29)),a=r.n(c),i=r(6),s=r.n(i),l=r(39),u=r(2);t.a=function(e){var t,r,c=e.className,i=e.error,d=e.isLoading,b=e.onRetry;return Object(n.createElement)(u.Placeholder,{icon:Object(n.createElement)(a.a,{icon:"notice"}),label:Object(o.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",c)},Object(n.createElement)("div",{className:"wc-block-error__message"},(r=(t=i).apiMessage,t.message||(r?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(l.escapeHTML)(r))):Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")))),b&&Object(n.createElement)(n.Fragment,null,d?Object(n.createElement)(u.Spinner,null):Object(n.createElement)(u.Button,{isDefault:!0,onClick:b},Object(o.__)("Retry","woo-gutenberg-products-block"))))}},53:function(e,t){!function(){e.exports=this.wp.htmlEntities}()},54:function(e,t){!function(){e.exports=this.wp.date}()},547:function(e,t,r){"use strict";r.r(t);var n=r(20),o=r.n(n),c=r(0),a=r(1),i=r(23),s=(r(77),r(16)),l=r.n(s),u=r(18),d=r(2),b=r(26),p=(r(7),r(99)),h=r(24),m=r(81),v=r(52),g=r(71),w=Object(g.b)(function(e){var t=e.error,r=e.getProduct,n=e.isLoading,o=e.product;if(t)return Object(c.createElement)(v.a,{className:"wc-block-featured-product-error",error:t,isLoading:n,onRetry:r});var i=!o||n?Object(c.createElement)(d.Spinner,null):Object(a.sprintf)(Object(a.__)("This block lists reviews for a selected product. %s doesn't have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block"),o.name);return Object(c.createElement)(d.Placeholder,{className:"wc-block-reviews-by-product",icon:Object(c.createElement)(h.h,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Product","woo-gutenberg-products-block")},i)}),f=r(63),O=Object(d.withSpokenMessages)(function(e){var t=e.attributes,r=e.debouncedSpeak,n=e.setAttributes,o=t.editMode,i=t.productId,s=function(e){var t=e.item,r=void 0===t?0:t;return Object(c.createElement)(b.b,l()({},e,{countLabel:Object(a.sprintf)(Object(a._n)("%d Review","%d Reviews",r.review_count,"woo-gutenberg-products-block"),r.review_count),showCount:!0,"aria-label":Object(a.sprintf)(Object(a._n)("%s, has %d review","%s, has %d reviews",r.review_count,"woo-gutenberg-products-block"),r.name,r.review_count)}))};return!i||o?Object(c.createElement)(d.Placeholder,{icon:Object(c.createElement)(h.h,{className:"block-editor-block-icon"}),label:Object(a.__)("Reviews by Product","woo-gutenberg-products-block")},Object(a.__)("Show reviews of your product to build trust","woo-gutenberg-products-block"),Object(c.createElement)("div",{className:"wc-block-reviews__selection"},Object(c.createElement)(p.a,{selected:t.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;n({productId:t})},queryArgs:{orderby:"comment_count",order:"desc"},renderItem:s}),Object(c.createElement)(d.Button,{isDefault:!0,onClick:function(){n({editMode:!1}),r(Object(a.__)("Showing Reviews by Product block preview.","woo-gutenberg-products-block"))}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(c.createElement)(c.Fragment,null,Object(f.a)(o,n),Object(c.createElement)(u.InspectorControls,{key:"inspector"},Object(c.createElement)(d.PanelBody,{title:Object(a.__)("Product","woo-gutenberg-products-block"),initialOpen:!1},Object(c.createElement)(p.a,{selected:t.productId||0,onChange:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=e[0]?e[0].id:0;n({productId:t})},renderItem:s})),Object(c.createElement)(d.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(f.b)(t,n)),Object(c.createElement)(d.PanelBody,{title:Object(a.__)("List Settings","woo-gutenberg-products-block")},Object(f.c)(t,n))),Object(c.createElement)(m.a,{attributes:t,className:"wc-block-all-reviews",icon:Object(c.createElement)(h.h,{className:"block-editor-block-icon"}),name:Object(a.__)("Reviews by Product","woo-gutenberg-products-block"),noReviewsPlaceholder:w}))}),j=r(79),y=r(80);function _(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}Object(i.registerBlockType)("woocommerce/reviews-by-product",{title:Object(a.__)("Reviews by Product","woo-gutenberg-products-block"),icon:Object(c.createElement)(h.h,{fillColor:"#96588a"}),category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Show reviews of your product to build trust.","woo-gutenberg-products-block"),attributes:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},j.a,{productId:{type:"number"}}),edit:function(e){return Object(c.createElement)(O,e)},save:y.a})},61:function(e,t){!function(){e.exports=this.wp.dom}()},63:function(e,t,r){"use strict";r.d(t,"a",function(){return d}),r.d(t,"b",function(){return b}),r.d(t,"c",function(){return p});var n=r(0),o=r(1),c=r(39),a=r(2),i=r(18),s=r(74),l=r(5),u=r(70),d=function(e,t){return Object(n.createElement)(i.BlockControls,null,Object(n.createElement)(a.Toolbar,{controls:[{icon:"edit",title:Object(o.__)("Edit","woo-gutenberg-products-block"),onClick:function(){return t({editMode:!e})},isActive:e}]}))},b=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:function(){return t({showReviewRating:!e.showReviewRating})}}),e.showReviewRating&&!l.ENABLE_REVIEW_RATING&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Product rating is disabled in your %sstore settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(s.a)("admin.php?page=wc-settings&tab=products"),'" target="_blank">'),"</a>"))),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:function(){return t({showReviewerName:!e.showReviewerName})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:function(){return t({showReviewImage:!e.showReviewImage})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:function(){return t({showReviewDate:!e.showReviewDate})}}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:function(){return t({showReviewContent:!e.showReviewContent})}}),e.showReviewImage&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(u.a,{label:Object(o.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,options:[{label:Object(o.__)("Reviewer photo","woo-gutenberg-products-block"),value:"reviewer"},{label:Object(o.__)("Product","woo-gutenberg-products-block"),value:"product"}],onChange:function(e){return t({imageType:e})}}),"reviewer"===e.imageType&&!l.SHOW_AVATARS&&Object(n.createElement)(a.Notice,{className:"wc-block-reviews__notice",isDismissible:!1},Object(n.createElement)(n.RawHTML,null,Object(o.sprintf)(Object(c.escapeHTML)(Object(o.__)("Reviewer photo is disabled in your %ssite settings%s.","woo-gutenberg-products-block")),'<a href="'.concat(Object(s.a)("options-discussion.php"),'" target="_blank">'),"</a>")))))},p=function(e,t){return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:function(){return t({showOrderby:!e.showOrderby})}}),Object(n.createElement)(a.SelectControl,{label:Object(o.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:function(e){return t({orderby:e})}}),Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:function(e){return t({reviewsOnPageLoad:e})},max:20,min:1}),Object(n.createElement)(a.ToggleControl,{label:Object(o.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:function(){return t({showLoadMore:!e.showLoadMore})}}),e.showLoadMore&&Object(n.createElement)(a.RangeControl,{label:Object(o.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:function(e){return t({reviewsOnLoadMore:e})},max:20,min:1}))}},64:function(e,t){},65:function(e,t){},67:function(e,t){},68:function(e,t){},69:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),s=r.n(i),l=r(10),u=r.n(l),d=r(11),b=r.n(d),p=r(12),h=r.n(p),m=r(0),v=r(13),g=[];t.a=function(e){return function(t){function r(){return a()(this,r),u()(this,b()(r).apply(this,arguments))}return h()(r,t),s()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return g[e]||(g[e]=0),g[e]++,g[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return Object(m.createElement)(e,o()({},this.props,{componentId:t}))}}]),r}(v.Component)}},70:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(8),a=r.n(c),i=r(9),s=r.n(i),l=r(10),u=r.n(l),d=r(11),b=r.n(d),p=r(15),h=r.n(p),m=r(12),v=r.n(m),g=r(0),w=r(4),f=r(6),O=r.n(f),j=r(2),y=r(21),_=(r(132),function(e){function t(){var e;return a()(this,t),(e=u()(this,b()(t).apply(this,arguments))).onClick=e.onClick.bind(h()(e)),e}return v()(t,e),s()(t,[{key:"onClick",value:function(e){this.props.onChange&&this.props.onChange(e.target.value)}},{key:"render",value:function(){var e,t=this,r=this.props,n=r.label,c=r.checked,a=r.instanceId,i=r.className,s=r.help,l=r.options,u=r.value,d="inspector-toggle-button-control-".concat(a);return s&&(e=Object(w.isFunction)(s)?s(c):s),Object(g.createElement)(j.BaseControl,{id:d,help:e,className:O()("components-toggle-button-control",i)},Object(g.createElement)("label",{id:d+"__label",htmlFor:d,className:"components-toggle-button-control__label"},n),Object(g.createElement)(j.ButtonGroup,{"aria-labelledby":d+"__label"},l.map(function(e,r){var c={};return u===e.value?(c.isPrimary=!0,c["aria-pressed"]=!0):(c.isDefault=!0,c["aria-pressed"]=!1),Object(g.createElement)(j.Button,o()({key:"".concat(e.label,"-").concat(e.value,"-").concat(r),value:e.value,onClick:t.onClick,"aria-label":n+": "+e.label},c),e.label)})))}}]),t}(g.Component));t.a=Object(y.withInstanceId)(_)},71:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(38),a=r.n(c),i=r(8),s=r.n(i),l=r(9),u=r.n(l),d=r(10),b=r.n(d),p=r(11),h=r.n(p),m=r(15),v=r.n(m),g=r(12),w=r.n(g),f=r(0),O=r(21),j=r(25),y=Object(O.createHigherOrderComponent)(function(e){return function(t){function r(){var e;return s()(this,r),(e=b()(this,h()(r).apply(this,arguments))).state={error:null,loading:!1,product:null},e.loadProduct=e.loadProduct.bind(v()(e)),e}return w()(r,t),u()(r,[{key:"componentDidMount",value:function(){this.loadProduct()}},{key:"componentDidUpdate",value:function(e){e.attributes.productId!==this.props.attributes.productId&&this.loadProduct()}},{key:"loadProduct",value:function(){var e=this,t=this.props.attributes.productId;t?(this.setState({loading:!0}),Object(j.b)(t).then(function(t){e.setState({product:t,loading:!1,error:null})}).catch(function(t){var r="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({product:null,loading:!1,error:r})})):this.setState({product:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,c=t.product;return Object(f.createElement)(e,o()({},this.props,{error:r,getProduct:this.loadProduct,isLoading:n,product:c}))}}]),r}(f.Component)},"withProduct"),_=Object(O.createHigherOrderComponent)(function(e){return function(t){function r(){var e;return s()(this,r),(e=b()(this,h()(r).apply(this,arguments))).state={error:null,loading:!1,category:null},e.loadCategory=e.loadCategory.bind(v()(e)),e}return w()(r,t),u()(r,[{key:"componentDidMount",value:function(){this.loadCategory()}},{key:"componentDidUpdate",value:function(e){e.attributes.categoryId!==this.props.attributes.categoryId&&this.loadCategory()}},{key:"loadCategory",value:function(){var e=this,t=this.props.attributes.categoryId;t?(this.setState({loading:!0}),Object(j.a)(t).then(function(t){e.setState({category:t,loading:!1,error:null})}).catch(function(t){var r="object"===a()(t)&&t.hasOwnProperty("message")?{apiMessage:t.message}:{apiMessage:null};e.setState({category:null,loading:!1,error:r})})):this.setState({category:null,loading:!1,error:null})}},{key:"render",value:function(){var t=this.state,r=t.error,n=t.loading,c=t.category;return Object(f.createElement)(e,o()({},this.props,{error:r,getCategory:this.loadCategory,isLoading:n,category:c}))}}]),r}(f.Component)},"withCategory"),E=r(4),k=(r(7),r(5)),R=Object(O.createHigherOrderComponent)(function(e){var t=function(t){function r(){var e;return s()(this,r),(e=b()(this,h()(r).apply(this,arguments))).state={list:[],loading:!0},e.debouncedOnSearch=Object(E.debounce)(e.onSearch.bind(v()(e)),400),e}return w()(r,t),u()(r,[{key:"componentDidMount",value:function(){var e=this,t=this.props.selected;Object(j.d)({selected:t}).then(function(t){e.setState({list:t,loading:!1})}).catch(function(){e.setState({list:[],loading:!1})})}},{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel()}},{key:"onSearch",value:function(e){var t=this,r=this.props.selected;Object(j.d)({selected:r,search:e}).then(function(e){t.setState({list:e,loading:!1})}).catch(function(){t.setState({list:[],loading:!1})})}},{key:"render",value:function(){var t=this.state,r=t.list,n=t.loading,c=this.props.selected;return Object(f.createElement)(e,o()({},this.props,{products:r,isLoading:n,selected:r.filter(function(e){var t=e.id;return c.includes(t)}),onSearch:k.IS_LARGE_CATALOG?this.debouncedOnSearch:null}))}}]),r}(f.Component);return t.defaultProps={selected:[]},t},"withSearchedProducts");r.d(t,"b",function(){return y}),r.d(t,"a",function(){return _}),r.d(t,"c",function(){return R})},77:function(e,t,r){var n=r(114);"string"==typeof n&&(n=[[e.i,n,""]]);var o={insert:"head",singleton:!1};r(35)(n,o);n.locals&&(e.exports=n.locals)},78:function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},79: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}}},80:function(e,t,r){"use strict";var n=r(16),o=r.n(n),c=r(0),a=(r(77),r(40));t.a=function(e){var t=e.attributes,r=t.categoryIds,n=t.imageType,i=t.orderby,s=t.productId,l={"data-image-type":n,"data-orderby":i,"data-reviews-on-page-load":t.reviewsOnPageLoad,"data-reviews-on-load-more":t.reviewsOnLoadMore,"data-show-load-more":t.showLoadMore,"data-show-orderby":t.showOrderby},u="wc-block-all-reviews";return s&&(l["data-product-id"]=s,u="wc-block-reviews-by-product"),Array.isArray(r)&&(l["data-category-ids"]=r.join(","),u="wc-block-reviews-by-category"),Object(c.createElement)("div",o()({className:Object(a.a)(u,t)},l))}},81:function(e,t,r){"use strict";var n=r(8),o=r.n(n),c=r(9),a=r.n(c),i=r(10),s=r.n(i),l=r(11),u=r.n(l),d=r(12),b=r.n(d),p=r(0),h=r(1),m=r(13),v=(r(7),r(4)),g=r(2),w=r(5),f=r(52),O=r(20),j=r.n(O),y=r(6),_=r.n(y);function E(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var k=function(e){var t,r=e.label,n=e.screenReaderLabel,o=e.wrapperElement,c=e.wrapperProps;return!r&&n?(t=o||"span",c=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},c,{className:_()(c.className,"screen-reader-text")}),Object(p.createElement)(t,c,n)):(t=o||m.Fragment,r&&n&&r!==n?Object(p.createElement)(t,c,Object(p.createElement)("span",{"aria-hidden":!0},r),Object(p.createElement)("span",{className:"screen-reader-text"},n)):Object(p.createElement)(t,c,r))};k.defaultProps={wrapperProps:{}};var R=k,C=(r(170),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return Object(p.createElement)("div",{className:"wp-block-button wc-block-load-more"},Object(p.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(p.createElement)(R,{label:r,screenReaderLabel:n})))});C.defaultProps={label:Object(h.__)("Load more","woo-gutenberg-products-block")};var P=C,S=r(15),N=r.n(S),L=r(100),I=r.n(L),M=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=I()(e,{suffix:r,limit:t});return n.html},x=function(e,t,r,n){var o=T(e,t,r);return M(e,o-n.length,n)},T=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=M(e,n.middle),n=A(n,t.clientHeight,r);return n.middle},A=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e},D=function(e){function t(e){var r;return o()(this,t),(r=s()(this,u()(t).apply(this,arguments))).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},r.reviewSummary=Object(m.createRef)(),r.reviewContent=Object(m.createRef)(),r.getButton=r.getButton.bind(N()(r)),r.onClick=r.onClick.bind(N()(r)),r}return b()(t,e),a()(t,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:x(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,c=e?n:o;if(c)return Object(p.createElement)("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,c=t.isExpanded;return r?!1===o?Object(p.createElement)("div",{className:e},Object(p.createElement)("div",{ref:this.reviewContent},r)):Object(p.createElement)("div",{className:e},(!c||null===o)&&Object(p.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:n}}),(c||null===o)&&Object(p.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},r),this.getButton()):null}}]),t}(m.Component);D.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(h.__)("Read more","woo-gutenberg-products-block"),lessText:Object(h.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var H=D;r(171);var z=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,c=t.showReviewDate,a=t.showReviewerName,i=t.showReviewImage,s=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,d=n.rating,b=!Object.keys(n).length>0,m=Number.isFinite(d)&&s;return Object(p.createElement)("li",{className:_()("wc-block-review-list-item__item",{"is-loading":b}),"aria-hidden":b},(u||c||a||i||m)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__info"},i&&function(e,t,r){return r||!e?Object(p.createElement)("div",{className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("div",{className:"wc-block-review-list-item__image"},"product"===t?Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.product_picture||"",className:"wc-block-review-list-item__image",width:"48",height:"48"}):Object(p.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x",className:"wc-block-review-list-item__image",width:"48",height:"48"}),e.verified&&Object(p.createElement)("div",{className:"wc-block-review-list-item__verified",title:Object(h.__)("Verified buyer","woo-gutenberg-products-block")},Object(h.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,b),(u||a||m||c)&&Object(p.createElement)("div",{className:"wc-block-review-list-item__meta"},m&&function(e){var t=e.rating,r={width:t/5*100+"%"};return Object(p.createElement)("div",{className:"wc-block-review-list-item__rating"},Object(p.createElement)("div",{className:"wc-block-review-list-item__rating__stars",role:"img"},Object(p.createElement)("span",{style:r},Object(h.sprintf)(Object(h.__)("Rated %d out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return Object(p.createElement)("div",{className:"wc-block-review-list-item__product"},Object(p.createElement)("a",{href:e.product_permalink},e.product_name))}(n),a&&function(e){var t=e.reviewer,r=void 0===t?"":t;return Object(p.createElement)("div",{className:"wc-block-review-list-item__author"},r)}(n),c&&function(e){var t=e.date_created,r=e.formatted_date_created;return Object(p.createElement)("time",{className:"wc-block-review-list-item__published-date",dateTime:t},r)}(n))),l&&function(e){return Object(p.createElement)(H,{maxLines:10,moreText:Object(h.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(h.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text"},Object(p.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(172);function B(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var V=function(e){var t=e.attributes,r=e.reviews,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?B(r,!0).forEach(function(t){j()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{showReviewImage:(w.SHOW_AVATARS||"product"===t.imageType)&&t.showReviewImage,showReviewRating:w.ENABLE_REVIEW_RATING&&t.showReviewRating});return Object(p.createElement)("ul",{className:"wc-block-review-list"},0===r.length?Object(p.createElement)(z,{attributes:n}):r.map(function(e,t){return Object(p.createElement)(z,{key:e.id||t,attributes:n,review:e})}))},G=r(69),F=(r(173),Object(G.a)(function(e){var t=e.className,r=e.componentId,n=e.defaultValue,o=e.label,c=e.onChange,a=e.options,i=e.screenReaderLabel,s=e.readOnly,l=e.value,u="wc-block-order-select__select-".concat(r);return Object(p.createElement)("p",{className:_()("wc-block-order-select",t)},Object(p.createElement)(R,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-order-select__label",htmlFor:u}}),Object(p.createElement)("select",{id:u,className:"wc-block-order-select__select",defaultValue:n,onChange:c,readOnly:s,value:l},a.map(function(e){return Object(p.createElement)("option",{key:e.key,value:e.key},e.label)})))})),q=(r(174),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return Object(p.createElement)(F,{className:"wc-block-review-order-select",defaultValue:t,label:Object(h.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(h.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(h.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(h.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(h.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),W=r(16),U=r.n(W),Q=r(38),Z=r.n(Q),J=r(78),Y=r.n(J),$=r(40),K=function(e){var t=function(t){function r(){var e;return o()(this,r),(e=s()(this,u()(r).apply(this,arguments))).state={error:null,loading:!0,reviews:[],totalReviews:0},e.setError=e.setError.bind(N()(e)),e.delayedAppendReviews=e.props.delayFunction(e.appendReviews),e}return b()(r,t),a()(r,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Y()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,c=t.productId,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),c&&(a.product_id=c),a}},{key:"replaceReviews",value:function(){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}},{key:"appendReviews",value:function(){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),Object($.c)(this.getArgs(t.length)).then(function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter(function(e){return Object.keys(e).length}).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}}).catch(this.setError)}},{key:"setError",value:function(e){var t=this;e.json().then(function(e){var r=t.props.onReviewsLoadError,n="object"===Z()(e)&&e.hasOwnProperty("message")?{apiMessage:e.message}:{apiMessage:null};t.setState({reviews:[],loading:!1,error:n}),r()})}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,c=r.reviews,a=r.totalReviews;return Object(p.createElement)(e,U()({},this.props,{error:n,isLoading:o,reviews:c.slice(0,t),totalReviews:a}))}}]),r}(m.Component);t.defaultProps={delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}};var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){function t(){return o()(this,t),s()(this,u()(t).apply(this,arguments))}return b()(t,e),a()(t,[{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.error,n=e.isLoading,o=e.noReviewsPlaceholder,c=e.reviews,a=e.totalReviews;return r?Object(p.createElement)(f.a,{className:"wc-block-featured-product-error",error:r,isLoading:n}):0!==c.length||n?Object(p.createElement)(g.Disabled,null,t.showOrderby&&w.ENABLE_REVIEW_RATING&&Object(p.createElement)(q,{readOnly:!0,value:t.orderby}),Object(p.createElement)(V,{attributes:t,reviews:c}),t.showLoadMore&&a>c.length&&Object(p.createElement)(P,{screenReaderLabel:Object(h.__)("Load more reviews","woo-gutenberg-products-block")})):Object(p.createElement)(o,{attributes:t})}}]),t}(m.Component)),X=function(e){function t(){return o()(this,t),s()(this,u()(t).apply(this,arguments))}return b()(t,e),a()(t,[{key:"renderHiddenContentPlaceholder",value:function(){var e=this.props,t=e.icon,r=e.name;return Object(p.createElement)(g.Placeholder,{icon:t,label:r},Object(h.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props,t=e.attributes,r=e.className,n=e.noReviewsPlaceholder,o=t.categoryIds,c=t.productId,a=t.reviewsOnPageLoad,i=t.showProductName,s=t.showReviewDate,l=t.showReviewerName,u=t.showReviewContent,d=t.showReviewImage,b=t.showReviewRating,h=Object($.b)(t.orderby),m=h.order,g=h.orderby;return!(u||b||s||l||d||i)?this.renderHiddenContentPlaceholder():Object(p.createElement)("div",{className:Object($.a)(r,t)},Object(p.createElement)(K,{attributes:t,categoryIds:o,delayFunction:function(e){return Object(v.debounce)(e,400)},noReviewsPlaceholder:n,orderby:g,order:m,productId:c,reviewsToDisplay:a}))}}]),t}(m.Component);t.a=X},99:function(e,t,r){"use strict";var n=r(62),o=r.n(n),c=r(16),a=r.n(c),i=r(20),s=r.n(i),l=r(8),u=r.n(l),d=r(9),b=r.n(d),p=r(10),h=r.n(p),m=r(11),v=r.n(m),g=r(15),w=r.n(g),f=r(12),O=r.n(f),j=r(0),y=r(1),_=r(19),E=r(17),k=r.n(E),R=r(4),C=(r(7),r(26)),P=r(2),S=r(6),N=r.n(S),L=r(5),I=r(25),M=r(24);r(280);function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(r,!0).forEach(function(t){s()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function A(e,t){if(!t)return e;var r=new RegExp(Object(R.escapeRegExp)(t),"ig");return e.replace(r,"<strong>$&</strong>")}var D=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e?Object(j.createElement)(M.e,null):Object(j.createElement)(M.f,null)},H=function(e){function t(){var e;return u()(this,t),(e=h()(this,v()(t).apply(this,arguments))).state={products:[],product:0,variationsList:{},variationsLoading:!1,loading:!0},e.debouncedOnSearch=Object(R.debounce)(e.onSearch.bind(w()(e)),400),e.debouncedGetVariations=Object(R.debounce)(e.getVariations.bind(w()(e)),200),e.renderItem=e.renderItem.bind(w()(e)),e.onProductSelect=e.onProductSelect.bind(w()(e)),e}return O()(t,e),b()(t,[{key:"componentWillUnmount",value:function(){this.debouncedOnSearch.cancel(),this.debouncedGetVariations.cancel()}},{key:"componentDidMount",value:function(){var e=this,t=this.props,r=t.selected,n=t.queryArgs;Object(I.d)({selected:r,queryArgs:n}).then(function(t){t=t.map(function(e){return T({},e,{parent:0,count:e.variations?e.variations.length:0})}),e.setState({products:t,loading:!1})}).catch(function(){e.setState({products:[],loading:!1})})}},{key:"componentDidUpdate",value:function(e,t){t.product!==this.state.product&&this.debouncedGetVariations()}},{key:"getVariations",value:function(){var e=this,t=this.state,r=t.product,n=t.products,o=t.variationsList;if(r){var c=n.find(function(e){return e.id===r});c.variations&&0!==c.variations.length&&(o[r]||this.setState({variationsLoading:!0}),k()({path:Object(_.addQueryArgs)("".concat(L.ENDPOINTS.products,"/").concat(r,"/variations"),{per_page:-1})}).then(function(t){t=t.map(function(e){return T({},e,{parent:r})}),e.setState(function(e){return{variationsList:T({},e.variationsList,s()({},r,t)),variationsLoading:!1}})}).catch(function(){e.setState({termsLoading:!1})}))}else this.setState({variationsList:{},variationsLoading:!1})}},{key:"onSearch",value:function(e){var t=this,r=this.props,n=r.selected,o=r.queryArgs;Object(I.d)({selected:n,search:e,queryArgs:o}).then(function(e){t.setState({products:e,loading:!1})}).catch(function(){t.setState({products:[],loading:!1})})}},{key:"onProductSelect",value:function(e,t){var r=this;return function(){r.setState({product:t?0:e.id})}}},{key:"renderItem",value:function(e){var t=this,r=e.item,n=e.search,o=e.depth,c=void 0===o?0:o,i=e.isSelected,s=e.onSelect,l=this.state,u=l.product,d=l.variationsLoading,b=N()("woocommerce-search-product__item","woocommerce-search-list__item","depth-".concat(c),{"is-searching":n.length>0,"is-skip-level":0===c&&0!==r.parent,"is-variable":r.count>0}),p=Object.assign({},e);delete p.isSingle;var h={role:"menuitemradio"};return r.breadcrumbs.length&&(h["aria-label"]="".concat(r.breadcrumbs[0],": ").concat(r.name)),r.count&&(h["aria-expanded"]=r.id===u),r.breadcrumbs.length?(Object(R.isEmpty)(r.variation)||(r.name=r.variation),Object(j.createElement)(C.b,a()({className:b},e,h))):[Object(j.createElement)(P.MenuItem,a()({key:"product-".concat(r.id),isSelected:i},p,h,{className:b,onClick:function(){s(r)(),t.onProductSelect(r,i)()}}),Object(j.createElement)("span",{className:"woocommerce-search-list__item-state"},D(i)),Object(j.createElement)("span",{className:"woocommerce-search-list__item-label"},Object(j.createElement)("span",{className:"woocommerce-search-list__item-name",dangerouslySetInnerHTML:{__html:A(r.name,n)}})),r.count?Object(j.createElement)("span",{className:"woocommerce-search-list__item-variation-count"},Object(y.sprintf)(Object(y._n)("%d variation","%d variations",r.count,"woo-gutenberg-products-block"),r.count)):null),u===r.id&&r.count>0&&d&&Object(j.createElement)("div",{key:"loading",className:"woocommerce-search-list__item woocommerce-search-product__itemdepth-1 is-loading is-not-active"},Object(j.createElement)(P.Spinner,null))]}},{key:"render",value:function(){var e=this.state,t=e.products,r=e.loading,n=e.product,c=e.variationsList,a=this.props,i=a.onChange,s=a.renderItem,l=a.selected,u=c[n]||[],d=[].concat(o()(t),o()(u)),b={list:Object(y.__)("Products","woo-gutenberg-products-block"),noItems:Object(y.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(y.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(y.__)("Product search results updated.","woo-gutenberg-products-block")},p=l?[Object(R.find)(d,{id:l})]:[];return Object(j.createElement)(j.Fragment,null,Object(j.createElement)(C.a,{className:"woocommerce-products",list:d,isLoading:r,isSingle:!0,selected:p,onChange:i,renderItem:s,onSearch:L.IS_LARGE_CATALOG?this.debouncedOnSearch:null,messages:b,isHierarchical:!0}))}}]),t}(j.Component);t.a=H}});
|
build/reviews-frontend.deps.json
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
["react","react-dom","wc-block-settings","wp-a11y","wp-api-fetch","wp-i18n","wp-is-shallow-equal","wp-polyfill"]
|
build/reviews-frontend.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=32)}([function(e,t){!function(){e.exports=this.wp.i18n}()},function(e,t){!function(){e.exports=this.React}()},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function r(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}},function(e,t,r){var n=r(13),o=r(2);e.exports=function(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?o(e):t}},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){var n=r(17);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}},function(e,t){!function(){e.exports=this.wc["wc-block-settings"]}()},function(e,t,r){var n;
|
2 |
+
/*!
|
3 |
+
Copyright (c) 2017 Jed Watson.
|
4 |
+
Licensed under the MIT License (MIT), see
|
5 |
+
http://jedwatson.github.io/classnames
|
6 |
+
*/!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var i=typeof n;if("string"===i||"number"===i)e.push(n);else if(Array.isArray(n)&&n.length){var a=o.apply(null,n);a&&e.push(a)}else if("object"===i)for(var s in n)r.call(n,s)&&n[s]&&e.push(s)}}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,r){e.exports=r(25)()},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}},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},r.apply(this,arguments)}e.exports=r},function(e,t){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(t){return"function"==typeof Symbol&&"symbol"===r(Symbol.iterator)?e.exports=n=function(e){return r(e)}:e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":r(e)},n(t)}e.exports=n},function(e,t){!function(){e.exports=this.ReactDOM}()},function(e,t,r){"use strict";var n=r(12),o=r.n(n),i=r(3),a=r.n(i),s=r(4),c=r.n(s),l=r(5),u=r.n(l),p=r(6),d=r.n(p),f=r(7),v=r.n(f),b=r(1),w=[];t.a=function(e){return function(t){function r(){return a()(this,r),u()(this,d()(r).apply(this,arguments))}return v()(r,t),c()(r,[{key:"generateUniqueID",value:function(){var e=r.name;return w[e]||(w[e]=0),w[e]++,w[e]}},{key:"render",value:function(){var t=this.generateUniqueID();return React.createElement(e,o()({},this.props,{componentId:t}))}}]),r}(b.Component)}},function(e,t){!function(){e.exports=this.wp.a11y}()},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},r(t,n)}e.exports=r},,function(e,t){!function(){e.exports=this.wp.apiFetch}()},function(e,t,r){function n(e){for(var t,r,n=[],o=0;o<rowCut.length;o++)(t=rowCut.substring(o).match(/^&[a-z0-9#]+;/))?(r=t[0],n.push(r),o+=r.length-1):n.push(rowCut[o]);return n}e.exports&&(e.exports=function(e,t){for(var r,o,i,a,s,c=(t=t||{}).limit||100,l=void 0===t.preserveTags||t.preserveTags,u=void 0!==t.wordBreak&&t.wordBreak,p=t.suffix||"...",d=t.moreLink||"",f=t.moreText||"»",v=t.preserveWhiteSpace||!1,b=e.replace(/</g,"\n<").replace(/>/g,">\n").replace(/\n\n/g,"\n").replace(/^\n/g,"").replace(/\n$/g,"").split("\n"),w=0,m=[],h=!1,y=0;y<b.length;y++)if(r=b[y],rowCut=v?r:r.replace(/[ ]+/g," "),r.length){var g=n(rowCut);if("<"!==r[0])if(w>=c)r="";else if(w+g.length>=c){if(" "===g[(o=c-w)-1])for(;o&&" "===g[(o-=1)-1];);else i=g.slice(o).indexOf(" "),u||(-1!==i?o+=i:o=r.length);r=g.slice(0,o).join("")+p,d&&(r+='<a href="'+d+'" style="display:inline">'+f+"</a>"),w=c,h=!0}else w+=g.length;else if(l){if(w>=c)if(s=(a=r.match(/[a-zA-Z]+/))?a[0]:"")if("</"!==r.substring(0,2))m.push(s),r="";else{for(;m[m.length-1]!==s&&m.length;)m.pop();m.length&&(r=""),m.pop()}else r=""}else r="";b[y]=r}return{html:b.join("\n").replace(/\n/g,""),more:h}})},function(e,t){!function(){e.exports=this.wp.isShallowEqual}()},,,,function(e,t,r){"use strict";var n=r(26);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,r,o,i,a){if(a!==n){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return r.PropTypes=r,r}},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,r){"use strict";r.r(t);var n=r(11),o=r.n(n),i=r(14),a=r(3),s=r.n(a),c=r(4),l=r.n(c),u=r(5),p=r.n(u),d=r(6),f=r.n(d),v=r(2),b=r.n(v),w=r(7),m=r.n(w),h=r(0),y=r(16),g=r(1),R=r.n(g),O=(r(10),r(19)),_=r.n(O),k=r(9),E=r.n(k),j=r(8),x=function(e){return _()({path:"/wc/blocks/products/reviews?"+Object.entries(e).map(function(e){return e.join("=")}).join("&"),parse:!1}).then(function(e){return e.json().then(function(t){return{reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}})})};function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var T=function(e){var t,r=e.label,n=e.screenReaderLabel,i=e.wrapperElement,a=e.wrapperProps;return!r&&n?(t=i||"span",a=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},a,{className:E()(a.className,"screen-reader-text")}),React.createElement(t,a,n)):(t=i||g.Fragment,r&&n&&r!==n?React.createElement(t,a,React.createElement("span",{"aria-hidden":!0},r),React.createElement("span",{className:"screen-reader-text"},n)):React.createElement(t,a,r))};T.defaultProps={wrapperProps:{}};var S=T,N=(r(27),function(e){var t=e.onClick,r=e.label,n=e.screenReaderLabel;return React.createElement("div",{className:"wp-block-button wc-block-load-more"},React.createElement("button",{className:"wp-block-button__link",onClick:t},React.createElement(S,{label:r,screenReaderLabel:n})))});N.defaultProps={label:Object(h.__)("Load more","woo-gutenberg-products-block")};var L=N,C=r(15),A=(r(28),Object(C.a)(function(e){var t=e.className,r=e.componentId,n=e.defaultValue,o=e.label,i=e.onChange,a=e.options,s=e.screenReaderLabel,c=e.readOnly,l=e.value,u="wc-block-order-select__select-".concat(r);return React.createElement("p",{className:E()("wc-block-order-select",t)},React.createElement(S,{label:o,screenReaderLabel:s,wrapperElement:"label",wrapperProps:{className:"wc-block-order-select__label",htmlFor:u}}),React.createElement("select",{id:u,className:"wc-block-order-select__select",defaultValue:n,onChange:i,readOnly:c,value:l},a.map(function(e){return React.createElement("option",{key:e.key,value:e.key},e.label)})))})),D=(r(29),function(e){var t=e.defaultValue,r=e.onChange,n=e.readOnly,o=e.value;return React.createElement(A,{className:"wc-block-review-order-select",defaultValue:t,label:Object(h.__)("Order by","woo-gutenberg-products-block"),onChange:r,options:[{key:"most-recent",label:Object(h.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(h.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(h.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:n,screenReaderLabel:Object(h.__)("Order reviews by","woo-gutenberg-products-block"),value:o})}),I=r(20),M=r.n(I),V=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...",n=M()(e,{suffix:r,limit:t});return n.html},H=function(e,t,r,n){var o=B(e,t,r);return V(e,o-n.length,n)},B=function(e,t,r){for(var n={start:0,middle:0,end:e.length};n.start<=n.end;)n.middle=Math.floor((n.start+n.end)/2),t.innerHTML=V(e,n.middle),n=W(n,t.clientHeight,r);return n.middle},W=function(e,t,r){return t<=r?e.start=e.middle+1:e.end=e.middle-1,e},F=function(e){function t(e){var r;return s()(this,t),(r=p()(this,f()(t).apply(this,arguments))).state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},r.reviewSummary=Object(g.createRef)(),r.reviewContent=Object(g.createRef)(),r.getButton=r.getButton.bind(b()(r)),r.onClick=r.onClick.bind(b()(r)),r}return m()(t,e),l()(t,[{key:"componentDidMount",value:function(){if(this.props.children){var e=this.props,t=e.maxLines,r=e.ellipsis,n=(this.reviewSummary.current.clientHeight+1)*t+1,o=this.reviewContent.current.clientHeight+1>n;this.setState({clampEnabled:o}),o&&this.setState({summary:H(this.reviewContent.current.innerHTML,this.reviewSummary.current,n,r)})}}},{key:"getButton",value:function(){var e=this.state.isExpanded,t=this.props,r=t.className,n=t.lessText,o=t.moreText,i=e?n:o;if(i)return R.a.createElement("a",{href:"#more",className:r+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},i)}},{key:"onClick",value:function(e){e.preventDefault();var t=this.state.isExpanded;this.setState({isExpanded:!t})}},{key:"render",value:function(){var e=this.props.className,t=this.state,r=t.content,n=t.summary,o=t.clampEnabled,i=t.isExpanded;return r?!1===o?R.a.createElement("div",{className:e},R.a.createElement("div",{ref:this.reviewContent},r)):R.a.createElement("div",{className:e},(!i||null===o)&&R.a.createElement("div",{ref:this.reviewSummary,"aria-hidden":i,dangerouslySetInnerHTML:{__html:n}}),(i||null===o)&&R.a.createElement("div",{ref:this.reviewContent,"aria-hidden":!i},r),this.getButton()):null}}]),t}(g.Component);F.defaultProps={maxLines:3,ellipsis:"…",moreText:Object(h.__)("Read more","woo-gutenberg-products-block"),lessText:Object(h.__)("Read less","woo-gutenberg-products-block"),className:"read-more-content"};var U=F;r(30);var q=function(e){var t=e.attributes,r=e.review,n=void 0===r?{}:r,o=t.imageType,i=t.showReviewDate,a=t.showReviewerName,s=t.showReviewImage,c=t.showReviewRating,l=t.showReviewContent,u=t.showProductName,p=n.rating,d=!Object.keys(n).length>0,f=Number.isFinite(p)&&c;return React.createElement("li",{className:E()("wc-block-review-list-item__item",{"is-loading":d}),"aria-hidden":d},(u||i||a||s||f)&&React.createElement("div",{className:"wc-block-review-list-item__info"},s&&function(e,t,r){return r||!e?React.createElement("div",{className:"wc-block-review-list-item__image",width:"48",height:"48"}):React.createElement("div",{className:"wc-block-review-list-item__image"},"product"===t?React.createElement("img",{"aria-hidden":"true",alt:"",src:e.product_picture||"",className:"wc-block-review-list-item__image",width:"48",height:"48"}):React.createElement("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[48]||"",srcSet:e.reviewer_avatar_urls[96]+" 2x",className:"wc-block-review-list-item__image",width:"48",height:"48"}),e.verified&&React.createElement("div",{className:"wc-block-review-list-item__verified",title:Object(h.__)("Verified buyer","woo-gutenberg-products-block")},Object(h.__)("Verified buyer","woo-gutenberg-products-block")))}(n,o,d),(u||a||f||i)&&React.createElement("div",{className:"wc-block-review-list-item__meta"},f&&function(e){var t=e.rating,r={width:t/5*100+"%"};return React.createElement("div",{className:"wc-block-review-list-item__rating"},React.createElement("div",{className:"wc-block-review-list-item__rating__stars",role:"img"},React.createElement("span",{style:r},Object(h.sprintf)(Object(h.__)("Rated %d out of 5","woo-gutenberg-products-block"),t))))}(n),u&&function(e){return React.createElement("div",{className:"wc-block-review-list-item__product"},React.createElement("a",{href:e.product_permalink},e.product_name))}(n),a&&function(e){var t=e.reviewer,r=void 0===t?"":t;return React.createElement("div",{className:"wc-block-review-list-item__author"},r)}(n),i&&function(e){var t=e.date_created,r=e.formatted_date_created;return React.createElement("time",{className:"wc-block-review-list-item__published-date",dateTime:t},r)}(n))),l&&function(e){return React.createElement(U,{maxLines:10,moreText:Object(h.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(h.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text"},React.createElement("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(n))};r(31);function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var z=function(e){var t=e.attributes,r=e.reviews,n=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},t,{showReviewImage:(j.SHOW_AVATARS||"product"===t.imageType)&&t.showReviewImage,showReviewRating:j.ENABLE_REVIEW_RATING&&t.showReviewRating});return React.createElement("ul",{className:"wc-block-review-list"},0===r.length?React.createElement(q,{attributes:n}):r.map(function(e,t){return React.createElement(q,{key:e.id||t,attributes:n,review:e})}))},Y=r(12),Z=r.n(Y),$=r(13),J=r.n($),K=r(21),Q=r.n(K),X=function(e){var t=function(t){function r(){var e;return s()(this,r),(e=p()(this,f()(r).apply(this,arguments))).state={error:null,loading:!0,reviews:[],totalReviews:0},e.setError=e.setError.bind(b()(e)),e.delayedAppendReviews=e.props.delayFunction(e.appendReviews),e}return m()(r,t),l()(r,[{key:"componentDidMount",value:function(){this.replaceReviews()}},{key:"componentDidUpdate",value:function(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}},{key:"shouldReplaceReviews",value:function(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!Q()(e.categoryIds,t.categoryIds)}},{key:"componentWillUnMount",value:function(){this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}},{key:"getArgs",value:function(e){var t=this.props,r=t.categoryIds,n=t.order,o=t.orderby,i=t.productId,a={order:n,orderby:o,per_page:t.reviewsToDisplay-e,offset:e};return r&&r.length&&(a.category_id=Array.isArray(r)?r.join(","):r),i&&(a.product_id=i),a}},{key:"replaceReviews",value:function(){var e=this.props.onReviewsReplaced;this.updateListOfReviews().then(e)}},{key:"appendReviews",value:function(){var e=this.props,t=e.onReviewsAppended,r=e.reviewsToDisplay,n=this.state.reviews;r<=n.length||this.updateListOfReviews(n).then(t)}},{key:"updateListOfReviews",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=this.props.reviewsToDisplay,n=this.state.totalReviews,o=Math.min(n,r)-t.length;return this.setState({loading:!0,reviews:t.concat(Array(o).fill({}))}),x(this.getArgs(t.length)).then(function(r){var n=r.reviews,o=r.totalReviews;return e.setState({reviews:t.filter(function(e){return Object.keys(e).length}).concat(n),totalReviews:o,loading:!1,error:null}),{newReviews:n}}).catch(this.setError)}},{key:"setError",value:function(e){var t=this;e.json().then(function(e){var r=t.props.onReviewsLoadError,n="object"===J()(e)&&e.hasOwnProperty("message")?{apiMessage:e.message}:{apiMessage:null};t.setState({reviews:[],loading:!1,error:n}),r()})}},{key:"render",value:function(){var t=this.props.reviewsToDisplay,r=this.state,n=r.error,o=r.loading,i=r.reviews,a=r.totalReviews;return React.createElement(e,Z()({},this.props,{error:n,isLoading:o,reviews:i.slice(0,t),totalReviews:a}))}}]),r}(g.Component);t.defaultProps={delayFunction:function(e){return e},onReviewsAppended:function(){},onReviewsLoadError:function(){},onReviewsReplaced:function(){}};var r=e.displayName,n=void 0===r?e.name||"Component":r;return t.displayName="WithReviews( ".concat(n," )"),t}(function(e){var t=e.attributes,r=e.onAppendReviews,n=e.onChangeOrderby,o=e.reviews,i=e.totalReviews,a=t.orderby;return 0===o.length?null:React.createElement(g.Fragment,null,"false"!==t.showOrderby&&j.ENABLE_REVIEW_RATING&&React.createElement(D,{defaultValue:a,onChange:n}),React.createElement(z,{attributes:t,reviews:o}),"false"!==t.showLoadMore&&i>o.length&&React.createElement(L,{onClick:r,screenReaderLabel:Object(h.__)("Load more reviews","woo-gutenberg-products-block")}))}),ee=function(e){function t(){var e;s()(this,t);var r=(e=p()(this,f()(t).apply(this,arguments))).props.attributes;return e.state={orderby:r.orderby,reviewsToDisplay:parseInt(r.reviewsOnPageLoad,10)},e.onAppendReviews=e.onAppendReviews.bind(b()(e)),e.onChangeOrderby=e.onChangeOrderby.bind(b()(e)),e}return m()(t,e),l()(t,[{key:"onAppendReviews",value:function(){var e=this.props.attributes,t=this.state.reviewsToDisplay;this.setState({reviewsToDisplay:t+parseInt(e.reviewsOnLoadMore,10)})}},{key:"onChangeOrderby",value:function(e){var t=this.props.attributes;this.setState({orderby:e.target.value,reviewsToDisplay:parseInt(t.reviewsOnPageLoad,10)})}},{key:"onReviewsAppended",value:function(e){var t=e.newReviews;Object(y.speak)(Object(h.sprintf)(Object(h._n)("%d review loaded.","%d reviews loaded.",t.length,"woo-gutenberg-products-block"),t.length))}},{key:"onReviewsReplaced",value:function(){Object(y.speak)(Object(h.__)("Reviews list updated.","woo-gutenberg-products-block"))}},{key:"onReviewsLoadError",value:function(){Object(y.speak)(Object(h.__)("There was an error loading the reviews.","woo-gutenberg-products-block"))}},{key:"render",value:function(){var e=this.props.attributes,t=e.categoryIds,r=e.productId,n=this.state.reviewsToDisplay,o=function(e){if(j.ENABLE_REVIEW_RATING){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}}(this.state.orderby),i=o.order,a=o.orderby;return React.createElement(X,{attributes:e,categoryIds:t,onAppendReviews:this.onAppendReviews,onChangeOrderby:this.onChangeOrderby,onReviewsAppended:this.onReviewsAppended,onReviewsLoadError:this.onReviewsLoadError,onReviewsReplaced:this.onReviewsReplaced,order:i,orderby:a,productId:r,reviewsToDisplay:n})}}]),t}(g.Component);function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var re=document.querySelectorAll("\n\t.wp-block-woocommerce-all-reviews,\n\t.wp-block-woocommerce-reviews-by-product,\n\t.wp-block-woocommerce-reviews-by-category\n");re.length&&Array.prototype.forEach.call(re,function(e){var t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(r,!0).forEach(function(t){o()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},e.dataset,{showReviewDate:e.classList.contains("has-date"),showReviewerName:e.classList.contains("has-name"),showReviewImage:e.classList.contains("has-image"),showReviewRating:e.classList.contains("has-rating"),showReviewContent:e.classList.contains("has-content"),showProductName:e.classList.contains("has-product-name")});Object(i.render)(React.createElement(ee,{attributes:t}),e)})}]);
|
build/style.css
CHANGED
@@ -1,4 +1,15 @@
|
|
1 |
-
.wc-block-grid__products{display:flex;flex-wrap:wrap;list-style:none;padding:0;margin:0 0 24px}.wc-block-grid__product{padding:0 16px 0 0;margin:0 0 24px;float:none;width:auto;position:relative;text-align:center}.wc-block-grid__product-link{text-decoration:none;border:0}.wc-block-grid__product-image{text-decoration:none;margin-bottom:16px;display:block}.wc-block-grid__product-image img{vertical-align:middle;margin-left:auto;margin-right:auto}.wc-block-grid__product-title{line-height:1.2;font-weight:700}.wc-block-grid__product-price,.wc-block-grid__product-rating,.wc-block-grid__product-title{margin-bottom:12px;display:block}.wc-block-grid__product-add-to-cart,.wc-block-grid__product-add-to-cart a{margin:0;word-break:break-word;white-space:normal}.wc-block-grid__product-add-to-cart a.loading{opacity:.25;padding-right:2.618em}.wc-block-grid__product-add-to-cart a.loading:after{font-family:WooCommerce;content:"\e01c";vertical-align:top;font-weight:400;position:absolute;top:.618em;right:1em;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}.wc-block-grid__product-add-to-cart a.added:after{font-family:WooCommerce;content:"\e017";margin-left:.53em;vertical-align:bottom}.wc-block-grid__product-add-to-cart .added_to_cart{text-align:center}.wc-block-grid__product-onsale{font-weight:700;position:absolute;text-align:center;top:0;left:0;margin:0;background-color:#000;color:#fff;display:inline-block;font-size:.75em;padding:.5em;z-index:9;text-transform:uppercase}.wc-block-grid__product-rating .star-rating{overflow:hidden;position:relative;width:5.3em;height:1.618em;line-height:1.618;font-size:1em;font-family:star;font-weight:400;display:inline-block;margin:0 auto;text-align:left}.wc-block-grid__product-rating .star-rating:before{content:"\53\53\53\53\53";top:0;left:0;right:0;position:absolute;opacity:.5;color:#aaa}.wc-block-grid__product-rating .star-rating span{overflow:hidden;top:0;left:0;right:0;position:absolute;padding-top:1.5em}.wc-block-grid__product-rating .star-rating span:before{content:"\53\53\53\53\53";top:0;left:0;right:0;position:absolute;color:#000}.wc-block-grid.has-aligned-buttons .wc-block-grid__product{display:flex;flex-direction:column}.wc-block-grid.has-aligned-buttons .wc-block-grid__product-add-to-cart{margin-top:auto!important}.wc-block-grid.has-1-columns .wc-block-grid__products{display:block}.wc-block-grid.has-1-columns .wc-block-grid__product{margin-left:auto;margin-right:auto}.wc-block-grid.has-2-columns .wc-block-grid__product{flex:1 0 50%;max-width:50%}.wc-block-grid.has-3-columns .wc-block-grid__product{flex:1 0 33.33333%;max-width:33.33333%}.wc-block-grid.has-4-columns .wc-block-grid__product{flex:1 0 25%;max-width:25%}.wc-block-grid.has-5-columns .wc-block-grid__product{flex:1 0 20%;max-width:20%}.wc-block-grid.has-6-columns .wc-block-grid__product{flex:1 0 16.66667%;max-width:16.66667%}.wc-block-grid.has-7-columns .wc-block-grid__product{flex:1 0 14.28571%;max-width:14.28571%}.wc-block-grid.has-8-columns .wc-block-grid__product{flex:1 0 12.5%;max-width:12.5%}.wc-block-grid.has-4-columns:not(.alignwide):not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-5-columns:not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-6-columns:not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-7-columns .wc-block-grid__product,.wc-block-grid.has-8-columns .wc-block-grid__product{font-size:.8em}.theme-twentysixteen .wc-block-grid .price ins{color:#77a464}.theme-twentynineteen .wc-block-grid__product{font-size:.88889em}.theme-twentynineteen .wc-block-grid__product-onsale,.theme-twentynineteen .wc-block-grid__product-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.theme-twentynineteen .wc-block-grid__product-onsale{line-height:1}
|
2 |
-
.wc-block-featured-category{position:relative;background-color:#24292d;background-size:cover;background-position:50%;width:100%;margin:0 0 1.5em;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;align-content:center}.wc-block-featured-category .wc-block-featured-category__wrapper{overflow:hidden;height:100
|
3 |
-
|
4 |
-
|
|
|
|
|
|
1 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-grid__products{display:-webkit-box;display:flex;flex-wrap:wrap;list-style:none;padding:0;margin:0 0 24px}.wc-block-grid__product{padding:0 16px 0 0;margin:0 0 24px;float:none;width:auto;position:relative;text-align:center}.wc-block-grid__product-link{text-decoration:none;border:0}.wc-block-grid__product-image{text-decoration:none;margin-bottom:16px;display:block}.wc-block-grid__product-image img{vertical-align:middle;margin-left:auto;margin-right:auto}.wc-block-grid__product-title{line-height:1.2;font-weight:700}.wc-block-grid__product-price,.wc-block-grid__product-rating,.wc-block-grid__product-title{margin-bottom:12px;display:block}.wc-block-grid__product-add-to-cart,.wc-block-grid__product-add-to-cart a{margin:0;word-break:break-word;white-space:normal}.wc-block-grid__product-add-to-cart a.loading{opacity:.25;padding-right:2.618em}.wc-block-grid__product-add-to-cart a.loading:after{font-family:WooCommerce;content:"\e01c";vertical-align:top;font-weight:400;position:absolute;top:.618em;right:1em;-webkit-animation:spin 2s linear infinite;animation:spin 2s linear infinite}.wc-block-grid__product-add-to-cart a.added:after{font-family:WooCommerce;content:"\e017";margin-left:.53em;vertical-align:bottom}.wc-block-grid__product-add-to-cart .added_to_cart{text-align:center}.wc-block-grid__product-onsale{font-weight:700;position:absolute;text-align:center;top:0;left:0;margin:0;background-color:#000;color:#fff;display:inline-block;font-size:.75em;padding:.5em;z-index:9;text-transform:uppercase}.wc-block-grid__product-rating .star-rating{overflow:hidden;position:relative;width:5.3em;height:1.618em;line-height:1.618;font-size:1em;font-family:star;font-weight:400;display:inline-block;margin:0 auto;text-align:left}.wc-block-grid__product-rating .star-rating:before{content:"\53\53\53\53\53";top:0;left:0;right:0;position:absolute;opacity:.5;color:#aaa}.wc-block-grid__product-rating .star-rating span{overflow:hidden;top:0;left:0;right:0;position:absolute;padding-top:1.5em}.wc-block-grid__product-rating .star-rating span:before{content:"\53\53\53\53\53";top:0;left:0;right:0;position:absolute;color:#000}.wc-block-grid.has-aligned-buttons .wc-block-grid__product{display:-webkit-box;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column}.wc-block-grid.has-aligned-buttons .wc-block-grid__product-add-to-cart{margin-top:auto!important}.wc-block-grid.has-1-columns .wc-block-grid__products{display:block}.wc-block-grid.has-1-columns .wc-block-grid__product{margin-left:auto;margin-right:auto}.wc-block-grid.has-2-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 50%;max-width:50%}.wc-block-grid.has-3-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 33.33333%;max-width:33.33333%}.wc-block-grid.has-4-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 25%;max-width:25%}.wc-block-grid.has-5-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 20%;max-width:20%}.wc-block-grid.has-6-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 16.66667%;max-width:16.66667%}.wc-block-grid.has-7-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 14.28571%;max-width:14.28571%}.wc-block-grid.has-8-columns .wc-block-grid__product{-webkit-box-flex:1;flex:1 0 12.5%;max-width:12.5%}.wc-block-grid.has-4-columns:not(.alignwide):not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-5-columns:not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-6-columns:not(.alignfull) .wc-block-grid__product,.wc-block-grid.has-7-columns .wc-block-grid__product,.wc-block-grid.has-8-columns .wc-block-grid__product{font-size:.8em}.theme-twentysixteen .wc-block-grid .price ins{color:#77a464}.theme-twentynineteen .wc-block-grid__product{font-size:.88889em}.theme-twentynineteen .wc-block-grid__product-onsale,.theme-twentynineteen .wc-block-grid__product-title{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.theme-twentynineteen .wc-block-grid__product-onsale{line-height:1}
|
2 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-featured-category{position:relative;background-color:#24292d;background-size:cover;background-position:50%;width:100%;margin:0 0 1.5em}.wc-block-featured-category,.wc-block-featured-category .wc-block-featured-category__wrapper{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;flex-wrap:wrap;align-content:center}.wc-block-featured-category .wc-block-featured-category__wrapper{overflow:hidden;height:100%}.wc-block-featured-category.has-left-content{-webkit-box-pack:start;justify-content:flex-start}.wc-block-featured-category.has-left-content .wc-block-featured-category__description,.wc-block-featured-category.has-left-content .wc-block-featured-category__price,.wc-block-featured-category.has-left-content .wc-block-featured-category__title{margin-left:0;text-align:left}.wc-block-featured-category.has-right-content{-webkit-box-pack:end;justify-content:flex-end}.wc-block-featured-category.has-right-content .wc-block-featured-category__description,.wc-block-featured-category.has-right-content .wc-block-featured-category__price,.wc-block-featured-category.has-right-content .wc-block-featured-category__title{margin-right:0;text-align:right}.wc-block-featured-category .wc-block-featured-category__description,.wc-block-featured-category .wc-block-featured-category__price,.wc-block-featured-category .wc-block-featured-category__title{color:#fff;line-height:1.25;margin-bottom:0;text-align:center}.wc-block-featured-category .wc-block-featured-category__description a,.wc-block-featured-category .wc-block-featured-category__description a:active,.wc-block-featured-category .wc-block-featured-category__description a:focus,.wc-block-featured-category .wc-block-featured-category__description a:hover,.wc-block-featured-category .wc-block-featured-category__price a,.wc-block-featured-category .wc-block-featured-category__price a:active,.wc-block-featured-category .wc-block-featured-category__price a:focus,.wc-block-featured-category .wc-block-featured-category__price a:hover,.wc-block-featured-category .wc-block-featured-category__title a,.wc-block-featured-category .wc-block-featured-category__title a:active,.wc-block-featured-category .wc-block-featured-category__title a:focus,.wc-block-featured-category .wc-block-featured-category__title a:hover{color:#fff}.wc-block-featured-category .wc-block-featured-category__description,.wc-block-featured-category .wc-block-featured-category__link,.wc-block-featured-category .wc-block-featured-category__price,.wc-block-featured-category .wc-block-featured-category__title{width:100%;padding:0 48px 16px;z-index:1}.wc-block-featured-category .wc-block-featured-category__title{margin-top:0}.wc-block-featured-category .wc-block-featured-category__title:before{display:none}.wc-block-featured-category .wc-block-featured-category__description p{margin:0}.wc-block-featured-category.has-background-dim:before{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-color:inherit;opacity:.5;z-index:1}.wc-block-featured-category.has-background-dim.has-background-dim-10:before{opacity:.1}.wc-block-featured-category.has-background-dim.has-background-dim-20:before{opacity:.2}.wc-block-featured-category.has-background-dim.has-background-dim-30:before{opacity:.3}.wc-block-featured-category.has-background-dim.has-background-dim-40:before{opacity:.4}.wc-block-featured-category.has-background-dim.has-background-dim-50:before{opacity:.5}.wc-block-featured-category.has-background-dim.has-background-dim-60:before{opacity:.6}.wc-block-featured-category.has-background-dim.has-background-dim-70:before{opacity:.7}.wc-block-featured-category.has-background-dim.has-background-dim-80:before{opacity:.8}.wc-block-featured-category.has-background-dim.has-background-dim-90:before{opacity:.9}.wc-block-featured-category.has-background-dim.has-background-dim-100:before{opacity:1}.wc-block-featured-category.alignleft,.wc-block-featured-category.alignright{max-width:305px;width:100%}.wc-block-featured-category:after{display:block;content:"";font-size:0;min-height:inherit}@supports ((position:-webkit-sticky) or (position:sticky)){.wc-block-featured-category:after{content:none}}.wc-block-featured-category.aligncenter,.wc-block-featured-category.alignleft,.wc-block-featured-category.alignright{display:-webkit-box;display:flex}
|
3 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.woocommerce-product-categories__operator .components-base-control__help{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;word-wrap:normal!important}.components-panel .woocommerce-product-categories__operator.components-base-control{margin-top:16px}.components-panel .woocommerce-product-categories__operator.components-base-control .components-select-control__input{margin-left:0;min-width:100%}
|
4 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-product-categories{margin-bottom:1em}.wc-block-product-categories.is-dropdown{display:-webkit-box;display:flex}.wc-block-product-categories select{margin-right:.5em}.wp-block-woocommerce-product-categories.is-loading .wc-block-product-categories__placeholder{display:inline-block;height:1em;width:50%;min-width:200px;background:currentColor;opacity:.2}.wc-block-product-categories__button{display:-webkit-box;display:flex;-webkit-box-align:center;align-items:center;text-decoration:none;font-size:13px;margin:0;border:none;cursor:pointer;background:none;padding:8px;color:#555d66;position:relative;overflow:hidden;border-radius:4px}.wc-block-product-categories__button svg{fill:currentColor;outline:none}.wc-block-product-categories__button:active{color:currentColor}.wc-block-product-categories__button:disabled,.wc-block-product-categories__button[aria-disabled=true]{cursor:default;opacity:.3}.wc-block-product-categories__button:focus:enabled{background-color:#fff;color:#191e23;box-shadow:inset 0 0 0 1px #6c7781,inset 0 0 0 2px #fff;outline:2px solid transparent;outline-offset:-2px}.wc-block-product-categories__button:not(:disabled):not([aria-disabled=true]):hover{background-color:#fff;color:#191e23;box-shadow:inset 0 0 0 1px #e2e4e7,inset 0 0 0 2px #fff,0 1px 1px rgba(25,30,35,.2)}.wc-block-product-categories__button:not(:disabled):not([aria-disabled=true]):active{outline:none;background-color:#fff;color:#191e23;box-shadow:inset 0 0 0 1px #ccd0d4,inset 0 0 0 2px #fff}.wc-block-product-categories__button:disabled:focus,.wc-block-product-categories__button[aria-disabled=true]:focus{box-shadow:none}
|
5 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.woocommerce-product-attributes__operator .components-base-control__help{clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;width:1px;margin:-1px;overflow:hidden;overflow-wrap:normal!important;word-wrap:normal!important}.components-panel .woocommerce-product-attributes__operator.components-base-control{margin-top:16px}.components-panel .woocommerce-product-attributes__operator.components-base-control .components-select-control__input{margin-left:0;min-width:100%}.woocommerce-search-list__item.woocommerce-product-attributes__item.is-searching .woocommerce-search-list__item-prefix:after,.woocommerce-search-list__item.woocommerce-product-attributes__item.is-skip-level .woocommerce-search-list__item-prefix:after{content:":"}.woocommerce-search-list__item.woocommerce-product-attributes__item.is-not-active:active,.woocommerce-search-list__item.woocommerce-product-attributes__item.is-not-active:focus,.woocommerce-search-list__item.woocommerce-product-attributes__item.is-not-active:hover{background:#fff}.woocommerce-search-list__item.woocommerce-product-attributes__item.is-loading{-webkit-box-pack:center;justify-content:center}.woocommerce-search-list__item.woocommerce-product-attributes__item.is-loading .components-spinner{margin-bottom:12px}.woocommerce-search-list__item.woocommerce-product-attributes__item.depth-0:after{margin-left:8px;content:"";height:24px;width:24px;background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" fill="{$core-grey-dark-300}" /></svg>');background-repeat:no-repeat;background-position:100%;background-size:contain}.woocommerce-search-list__item.woocommerce-product-attributes__item.depth-0[aria-expanded=true]:after{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" fill="{$core-grey-dark-300}" /></svg>')}.woocommerce-search-list__item.woocommerce-product-attributes__item[disabled].depth-0:after{margin-left:0;width:auto;background:none}
|
6 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.wc-block-featured-product{position:relative;background-color:#24292d;background-size:cover;background-position:50%;width:100%;margin:0 0 1.5em}.wc-block-featured-product,.wc-block-featured-product .wc-block-featured-product__wrapper{display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;-webkit-box-align:center;align-items:center;flex-wrap:wrap;align-content:center}.wc-block-featured-product .wc-block-featured-product__wrapper{overflow:hidden;height:100%}.wc-block-featured-product.has-left-content{-webkit-box-pack:start;justify-content:flex-start}.wc-block-featured-product.has-left-content .wc-block-featured-product__description,.wc-block-featured-product.has-left-content .wc-block-featured-product__price,.wc-block-featured-product.has-left-content .wc-block-featured-product__title,.wc-block-featured-product.has-left-content .wc-block-featured-product__variation{margin-left:0;text-align:left}.wc-block-featured-product.has-right-content{-webkit-box-pack:end;justify-content:flex-end}.wc-block-featured-product.has-right-content .wc-block-featured-product__description,.wc-block-featured-product.has-right-content .wc-block-featured-product__price,.wc-block-featured-product.has-right-content .wc-block-featured-product__title,.wc-block-featured-product.has-right-content .wc-block-featured-product__variation{margin-right:0;text-align:right}.wc-block-featured-product .wc-block-featured-product__description,.wc-block-featured-product .wc-block-featured-product__price,.wc-block-featured-product .wc-block-featured-product__title,.wc-block-featured-product .wc-block-featured-product__variation{color:#fff;line-height:1.25;margin-bottom:0;text-align:center}.wc-block-featured-product .wc-block-featured-product__description a,.wc-block-featured-product .wc-block-featured-product__description a:active,.wc-block-featured-product .wc-block-featured-product__description a:focus,.wc-block-featured-product .wc-block-featured-product__description a:hover,.wc-block-featured-product .wc-block-featured-product__price a,.wc-block-featured-product .wc-block-featured-product__price a:active,.wc-block-featured-product .wc-block-featured-product__price a:focus,.wc-block-featured-product .wc-block-featured-product__price a:hover,.wc-block-featured-product .wc-block-featured-product__title a,.wc-block-featured-product .wc-block-featured-product__title a:active,.wc-block-featured-product .wc-block-featured-product__title a:focus,.wc-block-featured-product .wc-block-featured-product__title a:hover,.wc-block-featured-product .wc-block-featured-product__variation a,.wc-block-featured-product .wc-block-featured-product__variation a:active,.wc-block-featured-product .wc-block-featured-product__variation a:focus,.wc-block-featured-product .wc-block-featured-product__variation a:hover{color:#fff}.wc-block-featured-product .wc-block-featured-product__description,.wc-block-featured-product .wc-block-featured-product__link,.wc-block-featured-product .wc-block-featured-product__price,.wc-block-featured-product .wc-block-featured-product__title,.wc-block-featured-product .wc-block-featured-product__variation{width:100%;padding:16px 48px 0;z-index:1}.wc-block-featured-product .wc-block-featured-product__title,.wc-block-featured-product .wc-block-featured-product__variation{margin-top:0;border:0}.wc-block-featured-product .wc-block-featured-product__title:before,.wc-block-featured-product .wc-block-featured-product__variation:before{display:none}.wc-block-featured-product .wc-block-featured-product__variation{font-style:italic;padding-top:0}.wc-block-featured-product .wc-block-featured-product__description p{margin:0;line-height:1.5em}.wc-block-featured-product.has-background-dim:before{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-color:inherit;opacity:.5;z-index:1}.wc-block-featured-product.has-background-dim.has-background-dim-10:before{opacity:.1}.wc-block-featured-product.has-background-dim.has-background-dim-20:before{opacity:.2}.wc-block-featured-product.has-background-dim.has-background-dim-30:before{opacity:.3}.wc-block-featured-product.has-background-dim.has-background-dim-40:before{opacity:.4}.wc-block-featured-product.has-background-dim.has-background-dim-50:before{opacity:.5}.wc-block-featured-product.has-background-dim.has-background-dim-60:before{opacity:.6}.wc-block-featured-product.has-background-dim.has-background-dim-70:before{opacity:.7}.wc-block-featured-product.has-background-dim.has-background-dim-80:before{opacity:.8}.wc-block-featured-product.has-background-dim.has-background-dim-90:before{opacity:.9}.wc-block-featured-product.has-background-dim.has-background-dim-100:before{opacity:1}.wc-block-featured-product.alignleft,.wc-block-featured-product.alignright{max-width:305px;width:100%}.wc-block-featured-product:after{display:block;content:"";font-size:0;min-height:inherit}@supports ((position:-webkit-sticky) or (position:sticky)){.wc-block-featured-product:after{content:none}}.wc-block-featured-product.aligncenter,.wc-block-featured-product.alignleft,.wc-block-featured-product.alignright{display:-webkit-box;display:flex}
|
7 |
+
@-webkit-keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}@keyframes loading-fade{0%{opacity:.7}50%{opacity:1}to{opacity:.7}}.woocommerce-search-product__item .woocommerce-search-list__item-name .description{display:block}.woocommerce-search-product__item.is-searching .woocommerce-search-list__item-prefix:after,.woocommerce-search-product__item.is-skip-level .woocommerce-search-list__item-prefix:after{content:":"}.woocommerce-search-product__item.is-not-active:active,.woocommerce-search-product__item.is-not-active:focus,.woocommerce-search-product__item.is-not-active:hover{background:#fff}.woocommerce-search-product__item.is-loading{-webkit-box-pack:center;justify-content:center}.woocommerce-search-product__item.is-loading .components-spinner{margin-bottom:12px}.woocommerce-search-product__item.depth-0.is-variable:after{margin-left:8px;content:"";height:24px;width:24px;background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z" fill="{$core-grey-dark-300}" /></svg>');background-repeat:no-repeat;background-position:100%;background-size:contain}.woocommerce-search-product__item.depth-0.is-variable[aria-expanded=true]:after{background-image:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M7.41
|