From 169296f625d5bfc1d9f71593a58ab21c54fd3868 Mon Sep 17 00:00:00 2001 From: Luigi Date: Tue, 2 Aug 2022 10:17:34 +0200 Subject: [PATCH] just a POC --- .../product-elements/image/attributes.js | 4 + .../blocks/product-elements/image/block.js | 1 + .../blocks/product-elements/image/edit.js | 21 +- .../blocks/product-elements/image/index.js | 1 + .../blocks/product-elements/image/save.tsx | 3 +- .../atomic-product/blocks/image-2/block.json | 19 - .../atomic-product/blocks/image-2/edit.tsx | 16 - .../atomic-product/blocks/image-2/index.tsx | 30 - .../js/blocks/atomic-product/withProduct.tsx | 6 - assets/js/blocks/product-query/index.tsx | 149 +- .../shared/hocs/with-product-data-context.js | 9 +- package-lock.json | 1329 +---------------- package.json | 1 - src/BlockTypes/AbstractBlock.php | 16 +- src/BlockTypes/AbstractProductGrid.php | 2 +- src/BlockTypes/Cart.php | 2 +- src/BlockTypes/Checkout.php | 2 +- src/BlockTypes/ClassicTemplate.php | 2 +- src/BlockTypes/FeaturedItem.php | 2 +- src/BlockTypes/MiniCart.php | 2 +- src/BlockTypes/MiniCartContents.php | 2 +- src/BlockTypes/ProductCategories.php | 2 +- src/BlockTypes/ProductImage.php | 13 + src/BlockTypes/ProductQuery.php | 143 +- src/BlockTypes/ProductSearch.php | 2 +- src/BlockTypesController.php | 1 - 26 files changed, 184 insertions(+), 1596 deletions(-) delete mode 100644 assets/js/blocks/atomic-product/blocks/image-2/block.json delete mode 100644 assets/js/blocks/atomic-product/blocks/image-2/edit.tsx delete mode 100644 assets/js/blocks/atomic-product/blocks/image-2/index.tsx delete mode 100644 assets/js/blocks/atomic-product/withProduct.tsx diff --git a/assets/js/atomic/blocks/product-elements/image/attributes.js b/assets/js/atomic/blocks/product-elements/image/attributes.js index 1a2f60f9d6f..2612faad920 100644 --- a/assets/js/atomic/blocks/product-elements/image/attributes.js +++ b/assets/js/atomic/blocks/product-elements/image/attributes.js @@ -19,6 +19,10 @@ export const blockAttributes = { type: 'number', default: 0, }, + postId: { + type: 'number', + default: 0, + }, }; export default blockAttributes; diff --git a/assets/js/atomic/blocks/product-elements/image/block.js b/assets/js/atomic/blocks/product-elements/image/block.js index d5c296036b9..d432e5cd0dd 100644 --- a/assets/js/atomic/blocks/product-elements/image/block.js +++ b/assets/js/atomic/blocks/product-elements/image/block.js @@ -46,6 +46,7 @@ export const Block = ( props ) => { const { parentClassName } = useInnerBlockLayoutContext(); const { product } = useProductDataContext(); + const [ imageLoaded, setImageLoaded ] = useState( false ); const { dispatchStoreEvent } = useStoreEvents(); diff --git a/assets/js/atomic/blocks/product-elements/image/edit.js b/assets/js/atomic/blocks/product-elements/image/edit.js index f0deda5fc50..7dd15e26f71 100644 --- a/assets/js/atomic/blocks/product-elements/image/edit.js +++ b/assets/js/atomic/blocks/product-elements/image/edit.js @@ -21,13 +21,21 @@ import { import Block from './block'; import withProductSelector from '../shared/with-product-selector'; import { BLOCK_TITLE, BLOCK_ICON } from './constants'; +import { useEffect } from 'react'; -const Edit = ( { attributes, setAttributes } ) => { +const Edit = ( { attributes, setAttributes, context } ) => { const { showProductLink, imageSizing, showSaleBadge, saleBadgeAlign } = attributes; const blockProps = useBlockProps(); + const newProps = { ...attributes, ...context }; + + useEffect( () => { + console.log( context.postId ); + setAttributes( { postId: context.postId } ); + }, [ context, context.postId, setAttributes ] ); + return (
@@ -146,17 +154,10 @@ const Edit = ( { attributes, setAttributes } ) => { - +
); }; -export default withProductSelector( { - icon: BLOCK_ICON, - label: BLOCK_TITLE, - description: __( - 'Choose a product to display its image.', - 'woo-gutenberg-products-block' - ), -} )( Edit ); +export default Edit; diff --git a/assets/js/atomic/blocks/product-elements/image/index.js b/assets/js/atomic/blocks/product-elements/image/index.js index d132b276e19..abc22a26be7 100644 --- a/assets/js/atomic/blocks/product-elements/image/index.js +++ b/assets/js/atomic/blocks/product-elements/image/index.js @@ -26,6 +26,7 @@ const blockConfig = { edit, supports, save: Save, + usesContext: [ 'query', 'queryId', 'postId' ], }; registerBlockType( 'woocommerce/product-image', { diff --git a/assets/js/atomic/blocks/product-elements/image/save.tsx b/assets/js/atomic/blocks/product-elements/image/save.tsx index 03a720e27df..566227cf13b 100644 --- a/assets/js/atomic/blocks/product-elements/image/save.tsx +++ b/assets/js/atomic/blocks/product-elements/image/save.tsx @@ -10,11 +10,12 @@ type Props = { }; }; -export const Save = ( { attributes }: Props ): JSX.Element => { +export const Save = ( { attributes }: any ): JSX.Element => { return (
); diff --git a/assets/js/blocks/atomic-product/blocks/image-2/block.json b/assets/js/blocks/atomic-product/blocks/image-2/block.json deleted file mode 100644 index 8af21064509..00000000000 --- a/assets/js/blocks/atomic-product/blocks/image-2/block.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "woocommerce/product-image-2", - "version": "1.0.0", - "title": "Product Image", - "description": "Allow customers to filter the products by choosing a lower or upper price limit. Works in combination with the All Products block.", - "category": "woocommerce", - "keywords": [ "WooCommerce" ], - "textdomain": "woo-gutenberg-products-block", - "usesContext": [ - "queryId", - "query", - "postId", - "queryContext", - "displayLayout", - "templateSlug" - ], - "apiVersion": 2, - "$schema": "https://schemas.wp.org/trunk/block.json" -} diff --git a/assets/js/blocks/atomic-product/blocks/image-2/edit.tsx b/assets/js/blocks/atomic-product/blocks/image-2/edit.tsx deleted file mode 100644 index 24a2886ff4d..00000000000 --- a/assets/js/blocks/atomic-product/blocks/image-2/edit.tsx +++ /dev/null @@ -1,16 +0,0 @@ -/* eslint-disable @woocommerce/dependency-group */ -import { PRODUCTS_STORE_NAME, ProductQuery } from '@woocommerce/data'; -import { useSelect } from '@wordpress/data'; - -export const Edit = ( props: unknown ) => { - const { context } = props; - console.log( props.context ); - - const product = useSelect( ( select ) => { - return select( PRODUCTS_STORE_NAME ).getProducts( { - include: context.postId, - } ); - } ); - - return
{ product[ 0 ].name }
; -}; diff --git a/assets/js/blocks/atomic-product/blocks/image-2/index.tsx b/assets/js/blocks/atomic-product/blocks/image-2/index.tsx deleted file mode 100644 index 8d4c67f6542..00000000000 --- a/assets/js/blocks/atomic-product/blocks/image-2/index.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { Icon, currencyDollar } from '@wordpress/icons'; -import { registerBlockType } from '@wordpress/blocks'; -import metadata from './block.json'; -import { __ } from '@wordpress/i18n'; -import { Edit } from './edit'; - -registerBlockType( metadata, { - title: __( 'New Product Image', 'woo-gutenberg-products-block' ), - description: __( - 'Allow customers to filter the products by choosing a lower or upper price limit. Works in combination with the All Products block.', - 'woo-gutenberg-products-block' - ), - icon: { - src: ( - - ), - }, - edit: Edit, - usesContext: [ - 'queryId', - 'query', - 'postId', - 'queryContext', - 'displayLayout', - 'templateSlug', - ], -} ); diff --git a/assets/js/blocks/atomic-product/withProduct.tsx b/assets/js/blocks/atomic-product/withProduct.tsx deleted file mode 100644 index 7e691ca46e9..00000000000 --- a/assets/js/blocks/atomic-product/withProduct.tsx +++ /dev/null @@ -1,6 +0,0 @@ -// import { ReactComponentElement } from 'react'; - -// export const withProduct = -// ( originalComponent: ReactComponentElement ) => ( props: unknown ) => { - -// }; diff --git a/assets/js/blocks/product-query/index.tsx b/assets/js/blocks/product-query/index.tsx index 5e94e1b6c5e..72f54f0d20a 100644 --- a/assets/js/blocks/product-query/index.tsx +++ b/assets/js/blocks/product-query/index.tsx @@ -26,43 +26,24 @@ const QUERY_DEFAULT_ATTRIBUTES = { search: '', exclude: [], sticky: '', - inherit: true, + inherit: false, hidePostTypeSettings: true, }, }; -registerBlockVariation( 'core/query', { - name: 'product-query', - title: __( 'Product Query', 'woo-gutenberg-products-block' ), - isActive: () => true, - icon: { - src: ( - - ), - }, - attributes: { ...QUERY_DEFAULT_ATTRIBUTES, namespace: 'product-query' }, - innerBlocks: [ - [ - 'core/post-template', - {}, - [ - [ 'woocommerce/product-image-2' ], - [ 'woocommerce/product-title' ], - ], - ], - [ 'core/query-pagination' ], - [ 'core/query-no-results' ], - ], - scope: [ 'block', 'inserter' ], -} ); - export const withInspectorControl = createHigherOrderComponent( ( BlockEdit ) => { return ( props ) => { - return props.attributes.namespace !== 'product-query' ? ( + if ( props.name === 'core/query' ) { + console.log( props, 'attribute' ); + console.log( + props.attributes?.productQuery?.namespace, + 'cosa sei?' + ); + } + return props.name !== 'core/query' || + props.attributes?.productQuery?.namespace !== + 'product-query' ? ( ) : ( <> @@ -70,10 +51,15 @@ export const withInspectorControl = createHigherOrderComponent( { props.setAttributes( { - onSale: nextValue, + productQuery: { + ...props.attributes.productQuery, + onSale: nextValue, + }, } ); } } /> @@ -90,11 +76,8 @@ export function addAttribute( settings, name ) { // Gracefully handle if settings.attributes is undefined. settings.attributes = { ...settings.attributes, - namespace: { - type: 'string', - }, - onSale: { - type: 'boolean', + productQuery: { + type: 'object', }, }; } @@ -109,31 +92,67 @@ addFilter( addFilter( 'editor.BlockEdit', 'core/query', withInspectorControl ); -// registerBlockVariation( 'core/query', { -// name: 'Products on Sale', -// title: __( 'Product on Sale', 'woo-gutenberg-products-block' ), -// isActive: ( blockAttributes ) => blockAttributes.onSale, -// icon: { -// src: ( -// -// ), -// }, -// attributes: { -// ...QUERY_DEFAULT_ATTRIBUTES, -// namespace: 'product-on-sale', -// onSale: true, -// }, -// innerBlocks: [ -// [ -// 'core/post-template', -// {}, -// [ [ 'woocommerce/product-image-2' ], [ 'core/post-title' ] ], -// ], -// [ 'core/query-pagination' ], -// [ 'core/query-no-results' ], -// ], -// scope: [ 'block', 'inserter' ], -// } ); +registerBlockVariation( 'core/query', { + name: 'product-query', + title: __( 'Product Query', 'woo-gutenberg-products-block' ), + isActive: ( attributes ) => { + return attributes?.productQuery?.namespace === 'product-query'; + }, + icon: { + src: ( + + ), + }, + attributes: { + ...QUERY_DEFAULT_ATTRIBUTES, + productQuery: { + namespace: 'product-query', + }, + }, + innerBlocks: [ + [ + 'core/post-template', + {}, + [ [ 'core/post-title' ], [ 'woocommerce/product-image' ] ], + ], + [ 'core/query-pagination' ], + [ 'core/query-no-results' ], + ], + scope: [ 'block', 'inserter' ], +} ); + +registerBlockVariation( 'core/query', { + name: 'Products on Sale', + title: __( 'Product on Sale', 'woo-gutenberg-products-block' ), + isActive: ( blockAttributes ) => + blockAttributes.productQuery.namespace === 'product-query-on-sale' || + blockAttributes.productQuery.onSale === true, + icon: { + src: ( + + ), + }, + attributes: { + ...QUERY_DEFAULT_ATTRIBUTES, + productQuery: { + namespace: 'product-query-on-sale', + onSale: true, + }, + }, + innerBlocks: [ + [ + 'core/post-template', + {}, + [ [ 'core/post-title' ], [ 'woocommerce/product-image' ] ], + ], + [ 'core/query-pagination' ], + [ 'core/query-no-results' ], + ], + scope: [ 'block', 'inserter' ], +} ); diff --git a/assets/js/shared/hocs/with-product-data-context.js b/assets/js/shared/hocs/with-product-data-context.js index 9de448bfe56..813298f3d51 100644 --- a/assets/js/shared/hocs/with-product-data-context.js +++ b/assets/js/shared/hocs/with-product-data-context.js @@ -14,7 +14,7 @@ import { useState, useEffect } from '@wordpress/element'; * @param {Object} props Component props. */ const OriginalComponentWithContext = ( props ) => { - const { productId, OriginalComponent } = props; + const { productId, OriginalComponent, postId } = props; const [ product, setProduct ] = useState( null ); const [ isLoading, setIsLoading ] = useState( true ); @@ -26,10 +26,11 @@ const OriginalComponentWithContext = ( props ) => { }, [ props.product ] ); useEffect( () => { - if ( productId > 0 ) { + const id = productId > 0 ? productId : postId; + if ( id > 0 ) { setIsLoading( true ); apiFetch( { - path: `/wc/store/v1/products/${ productId }`, + path: `/wc/store/v1/products/${ id }`, } ) .then( ( receivedProduct ) => { setProduct( receivedProduct ); @@ -41,7 +42,7 @@ const OriginalComponentWithContext = ( props ) => { setIsLoading( false ); } ); } - }, [ productId ] ); + }, [ productId, postId ] ); if ( ! isLoading && ! product ) { return null; diff --git a/package-lock.json b/package-lock.json index e12f3c7a846..c7d43e75b87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "license": "GPL-3.0+", "dependencies": { - "@woocommerce/data": "^4.1.0", "@wordpress/autop": "3.12.0", "@wordpress/compose": "5.5.0", "@wordpress/deprecated": "3.12.0", @@ -9633,11 +9632,6 @@ "@types/node": "*" } }, - "node_modules/@types/d3-time-format": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-2.3.1.tgz", - "integrity": "sha512-fck0Z9RGfIQn3GJIEKVrp15h9m6Vlg0d5XXeiE/6+CQiBmMDZxfR21XtjEPuDeg7gC3bBM0SdieA5XF3GW1wKA==" - }, "node_modules/@types/dinero.js": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@types/dinero.js/-/dinero.js-1.9.0.tgz", @@ -11083,147 +11077,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "node_modules/@woocommerce/data": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@woocommerce/data/-/data-4.1.0.tgz", - "integrity": "sha512-K8MuPH1oYLeeKOS8hjjd0Iblrsvq09c9SMpcSjcE2Etnx8OFom1MPOOjeUQTGTg/tgDelOPqw30sGsGzDPi4Lg==", - "dependencies": { - "@woocommerce/date": "4.2.0", - "@woocommerce/navigation": "8.1.0", - "@wordpress/api-fetch": "^6.0.1", - "@wordpress/compose": "^5.1.2", - "@wordpress/core-data": "^4.1.2", - "@wordpress/data": "^6.3.0", - "@wordpress/data-controls": "^2.3.2", - "@wordpress/deprecated": "^3.3.1", - "@wordpress/element": "^4.1.1", - "@wordpress/hooks": "^3.5.0", - "@wordpress/i18n": "^4.3.1", - "@wordpress/url": "^3.4.1", - "dompurify": "^2.3.6", - "md5": "^2.3.0", - "qs": "^6.10.3", - "rememo": "^4.0.0" - }, - "peerDependencies": { - "@wordpress/core-data": "^4.1.0", - "moment": "^2.18.1", - "react": "^17.0.0", - "react-dom": "^17.0.0" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/api-fetch": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.10.0.tgz", - "integrity": "sha512-E1zaU0OrOcp+VnESRQyGDuZEnq84MfhQ/v/eci+tniMiU9yZpyuNjsC+tDrBDXx9WG6vfhuQmWJwafrnWjVuYA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/url": "^3.14.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/data-controls": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/data-controls/-/data-controls-2.13.0.tgz", - "integrity": "sha512-Y+ZHI/XAiH2ILzDC358YV6Ee4dydHcY/r3gNSzzysgL5Eq6Tk6JH6/5bJIr9ACMSu82mS5itcmes5v/tXwzXxA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/api-fetch": "^6.10.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^17.0.0" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - }, - "bin": { - "pot-to-php": "tools/pot-to-php.js" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/data/node_modules/@wordpress/url": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.14.0.tgz", - "integrity": "sha512-cTqew8zSvAgkV7PylV0SkAUfOnvnrqgW0ZDy0EhamyFv4yzVq+efeUVct1bGs5QN7jfaPcvGEGxUG8kz8EJSLg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "remove-accents": "^0.4.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/data/node_modules/rememo": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/rememo/-/rememo-4.0.1.tgz", - "integrity": "sha512-x/T5q/pCDh8k4OlvJGqkI3eO+O8hmJv9HhJHo4avwlluwUpDbteDvyqw1PTarEITkeH9bfW6GSKeRke+XKgykw==" - }, - "node_modules/@woocommerce/date": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@woocommerce/date/-/date-4.2.0.tgz", - "integrity": "sha512-6Aop2IkYLMmJ34BHqT55P6/T4FaoDGAbAL+z0TnPqQNnKn4RJ55rmhSGI34VQwa4541bAeD0pWQeMaP1Fpg6Ow==", - "dependencies": { - "@types/d3-time-format": "^2.3.0", - "@wordpress/date": "^4.3.1", - "@wordpress/i18n": "^4.3.1", - "moment": "^2.29.1", - "moment-timezone": "^0.5.34", - "qs": "^6.10.3" - }, - "peerDependencies": { - "lodash": "^4.17.0" - } - }, "node_modules/@woocommerce/e2e-utils": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@woocommerce/e2e-utils/-/e2e-utils-0.2.0.tgz", @@ -11335,365 +11188,6 @@ "requireindex": "^1.2.0" } }, - "node_modules/@woocommerce/navigation": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@woocommerce/navigation/-/navigation-8.1.0.tgz", - "integrity": "sha512-Ifl8IYRLYlbxk6RNuuVorMaCoOs8aFWEo8oSU++SqFfyjPi893Nuk6NJYVvAVhxFdwPfw9RptvQ/q8sIusPihA==", - "dependencies": { - "@wordpress/api-fetch": "^6.0.1", - "@wordpress/components": "^19.5.0", - "@wordpress/compose": "^5.1.2", - "@wordpress/element": "^4.1.1", - "@wordpress/hooks": "^3.5.0", - "@wordpress/notices": "^3.3.2", - "@wordpress/url": "^3.4.1", - "history": "^5.3.0", - "qs": "^6.10.3" - }, - "peerDependencies": { - "lodash": "^4.17.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/components": { - "version": "19.15.0", - "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-19.15.0.tgz", - "integrity": "sha512-8sO+ULUQ+/e5SgGHK9vieEZ80QlJ2fhZL6WNO7buxkgKjcx1CumnygzHHiJ7GGHTefTsyuDk0xpwv4em8njC6w==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@emotion/cache": "^11.7.1", - "@emotion/css": "^11.7.1", - "@emotion/react": "^11.7.1", - "@emotion/serialize": "^1.0.2", - "@emotion/styled": "^11.6.0", - "@emotion/utils": "1.0.0", - "@floating-ui/react-dom": "0.6.3", - "@use-gesture/react": "^10.2.6", - "@wordpress/a11y": "^3.13.0", - "@wordpress/compose": "^5.11.0", - "@wordpress/date": "^4.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/escape-html": "^2.13.0", - "@wordpress/hooks": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/icons": "^9.4.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/keycodes": "^3.13.0", - "@wordpress/primitives": "^3.11.0", - "@wordpress/rich-text": "^5.11.0", - "@wordpress/warning": "^2.13.0", - "classnames": "^2.3.1", - "colord": "^2.7.0", - "dom-scroll-into-view": "^1.2.1", - "downshift": "^6.0.15", - "framer-motion": "^6.2.8", - "gradient-parser": "^0.1.5", - "highlight-words-core": "^1.2.2", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "moment": "^2.26.0", - "re-resizable": "^6.4.0", - "react-colorful": "^5.3.1", - "react-dates": "^21.8.0", - "reakit": "^1.3.8", - "remove-accents": "^0.4.2", - "uuid": "^8.3.0" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^17.0.0", - "react-dom": "^17.0.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/compose": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-5.11.0.tgz", - "integrity": "sha512-S6KABT9jB6ynvTIEHFnPjeT++xsmX3410ctTNNOiVY3HdcnVjzXcu6czqj/y3OWXupNn7WqRA9p9pWaSvSKMXQ==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@types/lodash": "^4.14.172", - "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/keycodes": "^3.13.0", - "@wordpress/priority-queue": "^2.13.0", - "clipboard": "^2.0.8", - "lodash": "^4.17.21", - "mousetrap": "^1.6.5", - "use-memo-one": "^1.1.1" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^17.0.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/dom": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.13.0.tgz", - "integrity": "sha512-8fDWKGgAUrrJFeYm+ahlPRYzs5k2NmWNlw45SvH60nlkZjdjN5UuM8gEgVZadxNq+vCazuvSMGLesZXGuY4FRQ==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.8.0", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - }, - "bin": { - "pot-to-php": "tools/pot-to-php.js" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/icons": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.4.0.tgz", - "integrity": "sha512-ZDBUV0SmcKYLGohIOnit2pEL6IedKBOhlb0nloyU5q7UB0DvkxY0gUShZSP1ikixLDbAJPvqW1ZiUh7iC2pnUA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.11.0", - "@wordpress/primitives": "^3.11.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/is-shallow-equal": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.13.0.tgz", - "integrity": "sha512-oUoMbEZwnbd4nfEo6uxkvrNCc/LnqC9MIY6kK3iWtMhcykQNpbK3XY/i/NvJb+QpRf7U6XhXyw4//HcQv39iOA==", - "dependencies": { - "@babel/runtime": "^7.16.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/@wordpress/primitives": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.11.0.tgz", - "integrity": "sha512-vxwRa5Ex6bXJ0x/lZ/SxpWFzDLGO3eKC0C6+0iJSpG26OYrigBd8wxo1bebmXZnaR7Aqlt5+uDylplQR4z79Uw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.11.0", - "classnames": "^2.3.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@woocommerce/navigation/node_modules/deepmerge": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/framer-motion": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-6.5.1.tgz", - "integrity": "sha512-o1BGqqposwi7cgDrtg0dNONhkmPsUFDaLcKXigzuTFC5x58mE8iyTazxSudFzmT6MEyJKfjjU8ItoMe3W+3fiw==", - "dependencies": { - "@motionone/dom": "10.12.0", - "framesync": "6.0.1", - "hey-listen": "^1.0.8", - "popmotion": "11.0.3", - "style-value-types": "5.0.0", - "tslib": "^2.1.0" - }, - "optionalDependencies": { - "@emotion/is-prop-valid": "^0.8.2" - }, - "peerDependencies": { - "react": ">=16.8 || ^17.0.0 || ^18.0.0", - "react-dom": ">=16.8 || ^17.0.0 || ^18.0.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/framesync": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/framesync/-/framesync-6.0.1.tgz", - "integrity": "sha512-fUY88kXvGiIItgNC7wcTOl0SNRCVXMKSWW2Yzfmn7EKNc+MpCzcz9DhdHcdjbrtN3c6R4H5dTY2jiCpPdysEjA==", - "dependencies": { - "tslib": "^2.1.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/popmotion": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/popmotion/-/popmotion-11.0.3.tgz", - "integrity": "sha512-Y55FLdj3UxkR7Vl3s7Qr4e9m0onSnP8W7d/xQLsoJM40vs6UKHFdygs6SWryasTZYqugMjm3BepCF4CWXDiHgA==", - "dependencies": { - "framesync": "6.0.1", - "hey-listen": "^1.0.8", - "style-value-types": "5.0.0", - "tslib": "^2.1.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-dates": { - "version": "21.8.0", - "resolved": "https://registry.npmjs.org/react-dates/-/react-dates-21.8.0.tgz", - "integrity": "sha512-PPriGqi30CtzZmoHiGdhlA++YPYPYGCZrhydYmXXQ6RAvAsaONcPtYgXRTLozIOrsQ5mSo40+DiA5eOFHnZ6xw==", - "dependencies": { - "airbnb-prop-types": "^2.15.0", - "consolidated-events": "^1.1.1 || ^2.0.0", - "enzyme-shallow-equal": "^1.0.0", - "is-touch-device": "^1.0.1", - "lodash": "^4.1.1", - "object.assign": "^4.1.0", - "object.values": "^1.1.0", - "prop-types": "^15.7.2", - "raf": "^3.4.1", - "react-moment-proptypes": "^1.6.0", - "react-outside-click-handler": "^1.2.4", - "react-portal": "^4.2.0", - "react-with-direction": "^1.3.1", - "react-with-styles": "^4.1.0", - "react-with-styles-interface-css": "^6.0.0" - }, - "peerDependencies": { - "@babel/runtime": "^7.0.0", - "moment": "^2.18.1", - "react": "^0.14 || ^15.5.4 || ^16.1.1", - "react-dom": "^0.14 || ^15.5.4 || ^16.1.1", - "react-with-direction": "^1.3.1" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-dates/node_modules/airbnb-prop-types": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz", - "integrity": "sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg==", - "dependencies": { - "array.prototype.find": "^2.1.1", - "function.prototype.name": "^1.1.2", - "is-regex": "^1.1.0", - "object-is": "^1.1.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.2", - "prop-types": "^15.7.2", - "prop-types-exact": "^1.2.0", - "react-is": "^16.13.1" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - }, - "peerDependencies": { - "react": "^0.14 || ^15.0.0 || ^16.0.0-alpha" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-dates/node_modules/react-with-direction": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", - "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "dependencies": { - "airbnb-prop-types": "^2.16.0", - "brcast": "^2.0.2", - "deepmerge": "^1.5.2", - "direction": "^1.0.4", - "hoist-non-react-statics": "^3.3.2", - "object.assign": "^4.1.2", - "object.values": "^1.1.5", - "prop-types": "^15.7.2" - }, - "peerDependencies": { - "react": "^0.14 || ^15 || ^16", - "react-dom": "^0.14 || ^15 || ^16" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-dates/node_modules/react-with-styles": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/react-with-styles/-/react-with-styles-4.2.0.tgz", - "integrity": "sha512-tZCTY27KriRNhwHIbg1NkSdTTOSfXDg6Z7s+Q37mtz0Ym7Sc7IOr3PzVt4qJhJMW6Nkvfi3g34FuhtiGAJCBQA==", - "dependencies": { - "airbnb-prop-types": "^2.14.0", - "hoist-non-react-statics": "^3.2.1", - "object.assign": "^4.1.0", - "prop-types": "^15.7.2", - "react-with-direction": "^1.3.1" - }, - "peerDependencies": { - "@babel/runtime": "^7.0.0", - "react": ">=0.14", - "react-with-direction": "^1.3.1" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-dates/node_modules/react-with-styles-interface-css": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/react-with-styles-interface-css/-/react-with-styles-interface-css-6.0.0.tgz", - "integrity": "sha512-6khSG1Trf4L/uXOge/ZAlBnq2O2PEXlQEqAhCRbvzaQU4sksIkdwpCPEl6d+DtP3+IdhyffTWuHDO9lhe1iYvA==", - "dependencies": { - "array.prototype.flat": "^1.2.1", - "global-cache": "^1.2.1" - }, - "peerDependencies": { - "@babel/runtime": "^7.0.0", - "react-with-styles": "^3.0.0 || ^4.0.0" - } - }, - "node_modules/@woocommerce/navigation/node_modules/react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "node_modules/@woocommerce/navigation/node_modules/style-value-types": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/style-value-types/-/style-value-types-5.0.0.tgz", - "integrity": "sha512-08yq36Ikn4kx4YU6RD7jWEv27v4V+PUsOGa4n/as8Et3CuODMJQ00ENeAVXAeydX4Z2j1XHZF1K2sX4mGl18fA==", - "dependencies": { - "hey-listen": "^1.0.8", - "tslib": "^2.1.0" - } - }, "node_modules/@woocommerce/woocommerce-rest-api": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@woocommerce/woocommerce-rest-api/-/woocommerce-rest-api-1.0.1.tgz", @@ -12299,193 +11793,6 @@ "node": ">=12" } }, - "node_modules/@wordpress/core-data": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/core-data/-/core-data-4.11.0.tgz", - "integrity": "sha512-K8ZmjBjEgb9NbAA6CNMk+s01qPbrxmroGn2EV+tSZcKmDRjExYSEKGIqd7IwsogfQ/xPLsiblWAfJqlG46O+Fg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/api-fetch": "^6.10.0", - "@wordpress/blocks": "^11.12.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/html-entities": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/url": "^3.14.0", - "equivalent-key-map": "^0.2.2", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "rememo": "^4.0.0", - "uuid": "^8.3.0" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^17.0.0" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/api-fetch": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.10.0.tgz", - "integrity": "sha512-E1zaU0OrOcp+VnESRQyGDuZEnq84MfhQ/v/eci+tniMiU9yZpyuNjsC+tDrBDXx9WG6vfhuQmWJwafrnWjVuYA==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/url": "^3.14.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/autop": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/autop/-/autop-3.13.0.tgz", - "integrity": "sha512-EAVrb7KuSfCBDFnGJJxD/9TVkDZEi/A1F2YSOb0X8RPS6RQNtXU76aiNyrm/G8ovJ/ElRGfSiy/+hwqZlnQo+A==", - "dependencies": { - "@babel/runtime": "^7.16.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/blocks": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/blocks/-/blocks-11.12.0.tgz", - "integrity": "sha512-+krs+etDAuOW52eDk2gI2gzrnV3vWOFUgPM2sDrZk2C4qV/Dcq0Sp5fFV/CoQQECXuK8TvYanxNmMSPgZG3pYQ==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/autop": "^3.13.0", - "@wordpress/blob": "^3.13.0", - "@wordpress/block-serialization-default-parser": "^4.13.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/hooks": "^3.13.0", - "@wordpress/html-entities": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/shortcode": "^3.13.0", - "colord": "^2.7.0", - "hpq": "^1.3.0", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "rememo": "^4.0.0", - "showdown": "^1.9.1", - "simple-html-tokenizer": "^0.5.7", - "uuid": "^8.3.0" - }, - "engines": { - "node": ">=12" - }, - "peerDependencies": { - "react": "^17.0.0" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/dom": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.13.0.tgz", - "integrity": "sha512-8fDWKGgAUrrJFeYm+ahlPRYzs5k2NmWNlw45SvH60nlkZjdjN5UuM8gEgVZadxNq+vCazuvSMGLesZXGuY4FRQ==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.8.0", - "lodash": "^4.17.21" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/html-entities": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.13.0.tgz", - "integrity": "sha512-LMwQgBj0rPDrVoVrlx5ppXP2kWmenvpl9hQzodjFvbq8lRGyeJSKaHEJk1bU++X1q88hcd2ADrHezWPuy8hfZw==", - "dependencies": { - "@babel/runtime": "^7.16.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - }, - "bin": { - "pot-to-php": "tools/pot-to-php.js" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/is-shallow-equal": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.13.0.tgz", - "integrity": "sha512-oUoMbEZwnbd4nfEo6uxkvrNCc/LnqC9MIY6kK3iWtMhcykQNpbK3XY/i/NvJb+QpRf7U6XhXyw4//HcQv39iOA==", - "dependencies": { - "@babel/runtime": "^7.16.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/@wordpress/url": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.14.0.tgz", - "integrity": "sha512-cTqew8zSvAgkV7PylV0SkAUfOnvnrqgW0ZDy0EhamyFv4yzVq+efeUVct1bGs5QN7jfaPcvGEGxUG8kz8EJSLg==", - "dependencies": { - "@babel/runtime": "^7.16.0", - "remove-accents": "^0.4.2" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@wordpress/core-data/node_modules/rememo": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/rememo/-/rememo-4.0.1.tgz", - "integrity": "sha512-x/T5q/pCDh8k4OlvJGqkI3eO+O8hmJv9HhJHo4avwlluwUpDbteDvyqw1PTarEITkeH9bfW6GSKeRke+XKgykw==" - }, "node_modules/@wordpress/data": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.13.0.tgz", @@ -20273,14 +19580,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "node_modules/charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==", - "engines": { - "node": "*" - } - }, "node_modules/check-node-version": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.2.1.tgz", @@ -22214,14 +21513,6 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "devOptional": true }, - "node_modules/crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==", - "engines": { - "node": "*" - } - }, "node_modules/crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -24410,11 +23701,6 @@ "url": "https://github.com/fb55/domhandler?sponsor=1" } }, - "node_modules/dompurify": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.3.10.tgz", - "integrity": "sha512-o7Fg/AgC7p/XpKjf/+RC3Ok6k4St5F7Q6q6+Nnm3p2zGWioAY6dh0CbbuwOhH2UcSzKsdniE/YnE2/92JcsA+g==" - }, "node_modules/domutils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", @@ -28825,14 +28111,6 @@ "node": "*" } }, - "node_modules/history": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", - "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", - "dependencies": { - "@babel/runtime": "^7.7.6" - } - }, "node_modules/hjson": { "version": "1.8.4", "resolved": "https://registry.npmjs.org/hjson/-/hjson-1.8.4.tgz", @@ -36718,16 +35996,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "dependencies": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -36739,11 +36007,6 @@ "safe-buffer": "^5.1.2" } }, - "node_modules/md5/node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "node_modules/mdast-squeeze-paragraphs": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/mdast-squeeze-paragraphs/-/mdast-squeeze-paragraphs-4.0.0.tgz", @@ -43002,6 +42265,7 @@ "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, "dependencies": { "side-channel": "^1.0.4" }, @@ -59516,11 +58780,6 @@ "@types/node": "*" } }, - "@types/d3-time-format": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-2.3.1.tgz", - "integrity": "sha512-fck0Z9RGfIQn3GJIEKVrp15h9m6Vlg0d5XXeiE/6+CQiBmMDZxfR21XtjEPuDeg7gC3bBM0SdieA5XF3GW1wKA==" - }, "@types/dinero.js": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/@types/dinero.js/-/dinero.js-1.9.0.tgz", @@ -60798,116 +60057,6 @@ } } }, - "@woocommerce/data": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@woocommerce/data/-/data-4.1.0.tgz", - "integrity": "sha512-K8MuPH1oYLeeKOS8hjjd0Iblrsvq09c9SMpcSjcE2Etnx8OFom1MPOOjeUQTGTg/tgDelOPqw30sGsGzDPi4Lg==", - "requires": { - "@woocommerce/date": "4.2.0", - "@woocommerce/navigation": "8.1.0", - "@wordpress/api-fetch": "^6.0.1", - "@wordpress/compose": "^5.1.2", - "@wordpress/core-data": "^4.1.2", - "@wordpress/data": "^6.3.0", - "@wordpress/data-controls": "^2.3.2", - "@wordpress/deprecated": "^3.3.1", - "@wordpress/element": "^4.1.1", - "@wordpress/hooks": "^3.5.0", - "@wordpress/i18n": "^4.3.1", - "@wordpress/url": "^3.4.1", - "dompurify": "^2.3.6", - "md5": "^2.3.0", - "qs": "^6.10.3", - "rememo": "^4.0.0" - }, - "dependencies": { - "@wordpress/api-fetch": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.10.0.tgz", - "integrity": "sha512-E1zaU0OrOcp+VnESRQyGDuZEnq84MfhQ/v/eci+tniMiU9yZpyuNjsC+tDrBDXx9WG6vfhuQmWJwafrnWjVuYA==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/url": "^3.14.0" - } - }, - "@wordpress/data-controls": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/data-controls/-/data-controls-2.13.0.tgz", - "integrity": "sha512-Y+ZHI/XAiH2ILzDC358YV6Ee4dydHcY/r3gNSzzysgL5Eq6Tk6JH6/5bJIr9ACMSu82mS5itcmes5v/tXwzXxA==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/api-fetch": "^6.10.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0" - } - }, - "@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - } - }, - "@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "requires": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - } - }, - "@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - } - }, - "@wordpress/url": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.14.0.tgz", - "integrity": "sha512-cTqew8zSvAgkV7PylV0SkAUfOnvnrqgW0ZDy0EhamyFv4yzVq+efeUVct1bGs5QN7jfaPcvGEGxUG8kz8EJSLg==", - "requires": { - "@babel/runtime": "^7.16.0", - "remove-accents": "^0.4.2" - } - }, - "rememo": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/rememo/-/rememo-4.0.1.tgz", - "integrity": "sha512-x/T5q/pCDh8k4OlvJGqkI3eO+O8hmJv9HhJHo4avwlluwUpDbteDvyqw1PTarEITkeH9bfW6GSKeRke+XKgykw==" - } - } - }, - "@woocommerce/date": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/@woocommerce/date/-/date-4.2.0.tgz", - "integrity": "sha512-6Aop2IkYLMmJ34BHqT55P6/T4FaoDGAbAL+z0TnPqQNnKn4RJ55rmhSGI34VQwa4541bAeD0pWQeMaP1Fpg6Ow==", - "requires": { - "@types/d3-time-format": "^2.3.0", - "@wordpress/date": "^4.3.1", - "@wordpress/i18n": "^4.3.1", - "moment": "^2.29.1", - "moment-timezone": "^0.5.34", - "qs": "^6.10.3" - } - }, "@woocommerce/e2e-utils": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@woocommerce/e2e-utils/-/e2e-utils-0.2.0.tgz", @@ -61005,294 +60154,6 @@ "requireindex": "^1.2.0" } }, - "@woocommerce/navigation": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@woocommerce/navigation/-/navigation-8.1.0.tgz", - "integrity": "sha512-Ifl8IYRLYlbxk6RNuuVorMaCoOs8aFWEo8oSU++SqFfyjPi893Nuk6NJYVvAVhxFdwPfw9RptvQ/q8sIusPihA==", - "requires": { - "@wordpress/api-fetch": "^6.0.1", - "@wordpress/components": "^19.5.0", - "@wordpress/compose": "^5.1.2", - "@wordpress/element": "^4.1.1", - "@wordpress/hooks": "^3.5.0", - "@wordpress/notices": "^3.3.2", - "@wordpress/url": "^3.4.1", - "history": "^5.3.0", - "qs": "^6.10.3" - }, - "dependencies": { - "@wordpress/components": { - "version": "19.15.0", - "resolved": "https://registry.npmjs.org/@wordpress/components/-/components-19.15.0.tgz", - "integrity": "sha512-8sO+ULUQ+/e5SgGHK9vieEZ80QlJ2fhZL6WNO7buxkgKjcx1CumnygzHHiJ7GGHTefTsyuDk0xpwv4em8njC6w==", - "requires": { - "@babel/runtime": "^7.16.0", - "@emotion/cache": "^11.7.1", - "@emotion/css": "^11.7.1", - "@emotion/react": "^11.7.1", - "@emotion/serialize": "^1.0.2", - "@emotion/styled": "^11.6.0", - "@emotion/utils": "1.0.0", - "@floating-ui/react-dom": "0.6.3", - "@use-gesture/react": "^10.2.6", - "@wordpress/a11y": "^3.13.0", - "@wordpress/compose": "^5.11.0", - "@wordpress/date": "^4.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/escape-html": "^2.13.0", - "@wordpress/hooks": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/icons": "^9.4.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/keycodes": "^3.13.0", - "@wordpress/primitives": "^3.11.0", - "@wordpress/rich-text": "^5.11.0", - "@wordpress/warning": "^2.13.0", - "classnames": "^2.3.1", - "colord": "^2.7.0", - "dom-scroll-into-view": "^1.2.1", - "downshift": "^6.0.15", - "framer-motion": "^6.2.8", - "gradient-parser": "^0.1.5", - "highlight-words-core": "^1.2.2", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "moment": "^2.26.0", - "re-resizable": "^6.4.0", - "react-colorful": "^5.3.1", - "react-dates": "^21.8.0", - "reakit": "^1.3.8", - "remove-accents": "^0.4.2", - "uuid": "^8.3.0" - } - }, - "@wordpress/compose": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/compose/-/compose-5.11.0.tgz", - "integrity": "sha512-S6KABT9jB6ynvTIEHFnPjeT++xsmX3410ctTNNOiVY3HdcnVjzXcu6czqj/y3OWXupNn7WqRA9p9pWaSvSKMXQ==", - "requires": { - "@babel/runtime": "^7.16.0", - "@types/lodash": "^4.14.172", - "@types/mousetrap": "^1.6.8", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/keycodes": "^3.13.0", - "@wordpress/priority-queue": "^2.13.0", - "clipboard": "^2.0.8", - "lodash": "^4.17.21", - "mousetrap": "^1.6.5", - "use-memo-one": "^1.1.1" - } - }, - "@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - } - }, - "@wordpress/dom": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.13.0.tgz", - "integrity": "sha512-8fDWKGgAUrrJFeYm+ahlPRYzs5k2NmWNlw45SvH60nlkZjdjN5UuM8gEgVZadxNq+vCazuvSMGLesZXGuY4FRQ==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.8.0", - "lodash": "^4.17.21" - } - }, - "@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "requires": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - } - }, - "@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - } - }, - "@wordpress/icons": { - "version": "9.4.0", - "resolved": "https://registry.npmjs.org/@wordpress/icons/-/icons-9.4.0.tgz", - "integrity": "sha512-ZDBUV0SmcKYLGohIOnit2pEL6IedKBOhlb0nloyU5q7UB0DvkxY0gUShZSP1ikixLDbAJPvqW1ZiUh7iC2pnUA==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.11.0", - "@wordpress/primitives": "^3.11.0" - } - }, - "@wordpress/is-shallow-equal": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.13.0.tgz", - "integrity": "sha512-oUoMbEZwnbd4nfEo6uxkvrNCc/LnqC9MIY6kK3iWtMhcykQNpbK3XY/i/NvJb+QpRf7U6XhXyw4//HcQv39iOA==", - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/primitives": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/primitives/-/primitives-3.11.0.tgz", - "integrity": "sha512-vxwRa5Ex6bXJ0x/lZ/SxpWFzDLGO3eKC0C6+0iJSpG26OYrigBd8wxo1bebmXZnaR7Aqlt5+uDylplQR4z79Uw==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/element": "^4.11.0", - "classnames": "^2.3.1" - } - }, - "deepmerge": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", - "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" - }, - "framer-motion": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-6.5.1.tgz", - "integrity": "sha512-o1BGqqposwi7cgDrtg0dNONhkmPsUFDaLcKXigzuTFC5x58mE8iyTazxSudFzmT6MEyJKfjjU8ItoMe3W+3fiw==", - "requires": { - "@emotion/is-prop-valid": "^0.8.2", - "@motionone/dom": "10.12.0", - "framesync": "6.0.1", - "hey-listen": "^1.0.8", - "popmotion": "11.0.3", - "style-value-types": "5.0.0", - "tslib": "^2.1.0" - } - }, - "framesync": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/framesync/-/framesync-6.0.1.tgz", - "integrity": "sha512-fUY88kXvGiIItgNC7wcTOl0SNRCVXMKSWW2Yzfmn7EKNc+MpCzcz9DhdHcdjbrtN3c6R4H5dTY2jiCpPdysEjA==", - "requires": { - "tslib": "^2.1.0" - } - }, - "popmotion": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/popmotion/-/popmotion-11.0.3.tgz", - "integrity": "sha512-Y55FLdj3UxkR7Vl3s7Qr4e9m0onSnP8W7d/xQLsoJM40vs6UKHFdygs6SWryasTZYqugMjm3BepCF4CWXDiHgA==", - "requires": { - "framesync": "6.0.1", - "hey-listen": "^1.0.8", - "style-value-types": "5.0.0", - "tslib": "^2.1.0" - } - }, - "react-dates": { - "version": "21.8.0", - "resolved": "https://registry.npmjs.org/react-dates/-/react-dates-21.8.0.tgz", - "integrity": "sha512-PPriGqi30CtzZmoHiGdhlA++YPYPYGCZrhydYmXXQ6RAvAsaONcPtYgXRTLozIOrsQ5mSo40+DiA5eOFHnZ6xw==", - "requires": { - "airbnb-prop-types": "^2.15.0", - "consolidated-events": "^1.1.1 || ^2.0.0", - "enzyme-shallow-equal": "^1.0.0", - "is-touch-device": "^1.0.1", - "lodash": "^4.1.1", - "object.assign": "^4.1.0", - "object.values": "^1.1.0", - "prop-types": "^15.7.2", - "raf": "^3.4.1", - "react-moment-proptypes": "^1.6.0", - "react-outside-click-handler": "^1.2.4", - "react-portal": "^4.2.0", - "react-with-direction": "^1.3.1", - "react-with-styles": "^4.1.0", - "react-with-styles-interface-css": "^6.0.0" - }, - "dependencies": { - "airbnb-prop-types": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz", - "integrity": "sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg==", - "requires": { - "array.prototype.find": "^2.1.1", - "function.prototype.name": "^1.1.2", - "is-regex": "^1.1.0", - "object-is": "^1.1.2", - "object.assign": "^4.1.0", - "object.entries": "^1.1.2", - "prop-types": "^15.7.2", - "prop-types-exact": "^1.2.0", - "react-is": "^16.13.1" - } - }, - "react-with-direction": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/react-with-direction/-/react-with-direction-1.4.0.tgz", - "integrity": "sha512-ybHNPiAmaJpoWwugwqry9Hd1Irl2hnNXlo/2SXQBwbLn/jGMauMS2y9jw+ydyX5V9ICryCqObNSthNt5R94xpg==", - "requires": { - "airbnb-prop-types": "^2.16.0", - "brcast": "^2.0.2", - "deepmerge": "^1.5.2", - "direction": "^1.0.4", - "hoist-non-react-statics": "^3.3.2", - "object.assign": "^4.1.2", - "object.values": "^1.1.5", - "prop-types": "^15.7.2" - } - }, - "react-with-styles": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/react-with-styles/-/react-with-styles-4.2.0.tgz", - "integrity": "sha512-tZCTY27KriRNhwHIbg1NkSdTTOSfXDg6Z7s+Q37mtz0Ym7Sc7IOr3PzVt4qJhJMW6Nkvfi3g34FuhtiGAJCBQA==", - "requires": { - "airbnb-prop-types": "^2.14.0", - "hoist-non-react-statics": "^3.2.1", - "object.assign": "^4.1.0", - "prop-types": "^15.7.2", - "react-with-direction": "^1.3.1" - } - }, - "react-with-styles-interface-css": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/react-with-styles-interface-css/-/react-with-styles-interface-css-6.0.0.tgz", - "integrity": "sha512-6khSG1Trf4L/uXOge/ZAlBnq2O2PEXlQEqAhCRbvzaQU4sksIkdwpCPEl6d+DtP3+IdhyffTWuHDO9lhe1iYvA==", - "requires": { - "array.prototype.flat": "^1.2.1", - "global-cache": "^1.2.1" - } - } - } - }, - "react-is": { - "version": "16.13.1", - "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", - "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" - }, - "style-value-types": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/style-value-types/-/style-value-types-5.0.0.tgz", - "integrity": "sha512-08yq36Ikn4kx4YU6RD7jWEv27v4V+PUsOGa4n/as8Et3CuODMJQ00ENeAVXAeydX4Z2j1XHZF1K2sX4mGl18fA==", - "requires": { - "hey-listen": "^1.0.8", - "tslib": "^2.1.0" - } - } - } - }, "@woocommerce/woocommerce-rest-api": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@woocommerce/woocommerce-rest-api/-/woocommerce-rest-api-1.0.1.tgz", @@ -61806,153 +60667,6 @@ } } }, - "@wordpress/core-data": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/core-data/-/core-data-4.11.0.tgz", - "integrity": "sha512-K8ZmjBjEgb9NbAA6CNMk+s01qPbrxmroGn2EV+tSZcKmDRjExYSEKGIqd7IwsogfQ/xPLsiblWAfJqlG46O+Fg==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/api-fetch": "^6.10.0", - "@wordpress/blocks": "^11.12.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/html-entities": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/url": "^3.14.0", - "equivalent-key-map": "^0.2.2", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "rememo": "^4.0.0", - "uuid": "^8.3.0" - }, - "dependencies": { - "@wordpress/api-fetch": { - "version": "6.10.0", - "resolved": "https://registry.npmjs.org/@wordpress/api-fetch/-/api-fetch-6.10.0.tgz", - "integrity": "sha512-E1zaU0OrOcp+VnESRQyGDuZEnq84MfhQ/v/eci+tniMiU9yZpyuNjsC+tDrBDXx9WG6vfhuQmWJwafrnWjVuYA==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/url": "^3.14.0" - } - }, - "@wordpress/autop": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/autop/-/autop-3.13.0.tgz", - "integrity": "sha512-EAVrb7KuSfCBDFnGJJxD/9TVkDZEi/A1F2YSOb0X8RPS6RQNtXU76aiNyrm/G8ovJ/ElRGfSiy/+hwqZlnQo+A==", - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/blocks": { - "version": "11.12.0", - "resolved": "https://registry.npmjs.org/@wordpress/blocks/-/blocks-11.12.0.tgz", - "integrity": "sha512-+krs+etDAuOW52eDk2gI2gzrnV3vWOFUgPM2sDrZk2C4qV/Dcq0Sp5fFV/CoQQECXuK8TvYanxNmMSPgZG3pYQ==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/autop": "^3.13.0", - "@wordpress/blob": "^3.13.0", - "@wordpress/block-serialization-default-parser": "^4.13.0", - "@wordpress/data": "^6.13.0", - "@wordpress/deprecated": "^3.13.0", - "@wordpress/dom": "^3.13.0", - "@wordpress/element": "^4.11.0", - "@wordpress/hooks": "^3.13.0", - "@wordpress/html-entities": "^3.13.0", - "@wordpress/i18n": "^4.13.0", - "@wordpress/is-shallow-equal": "^4.13.0", - "@wordpress/shortcode": "^3.13.0", - "colord": "^2.7.0", - "hpq": "^1.3.0", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "rememo": "^4.0.0", - "showdown": "^1.9.1", - "simple-html-tokenizer": "^0.5.7", - "uuid": "^8.3.0" - } - }, - "@wordpress/deprecated": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/deprecated/-/deprecated-3.13.0.tgz", - "integrity": "sha512-0k0/h5Y9a7bb5HEDK9yJI+NBVrO/YyGcnI87DIgMVXTysykRf78qQq4CUvFh8roo1aOAFIUQDYQrJttkbbWyhw==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0" - } - }, - "@wordpress/dom": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/dom/-/dom-3.13.0.tgz", - "integrity": "sha512-8fDWKGgAUrrJFeYm+ahlPRYzs5k2NmWNlw45SvH60nlkZjdjN5UuM8gEgVZadxNq+vCazuvSMGLesZXGuY4FRQ==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/deprecated": "^3.8.0", - "lodash": "^4.17.21" - } - }, - "@wordpress/element": { - "version": "4.11.0", - "resolved": "https://registry.npmjs.org/@wordpress/element/-/element-4.11.0.tgz", - "integrity": "sha512-3Ha/BChFgkzh8oKK/FxXLEYSobCAMfWKdK/anNTWqbGxZM0ue1kowu23D7gUCCugjKOZdkhAabgJIjPflrGQOg==", - "requires": { - "@babel/runtime": "^7.16.0", - "@types/react": "^17.0.37", - "@types/react-dom": "^17.0.11", - "@wordpress/escape-html": "^2.13.0", - "lodash": "^4.17.21", - "react": "^17.0.2", - "react-dom": "^17.0.2" - } - }, - "@wordpress/html-entities": { - "version": "3.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/html-entities/-/html-entities-3.13.0.tgz", - "integrity": "sha512-LMwQgBj0rPDrVoVrlx5ppXP2kWmenvpl9hQzodjFvbq8lRGyeJSKaHEJk1bU++X1q88hcd2ADrHezWPuy8hfZw==", - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/i18n": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/i18n/-/i18n-4.13.0.tgz", - "integrity": "sha512-25x0ylQzXxbaw3oM8afoahiPzzZfzikBNzkzlEJ4MuI9u61zmFedbkIrsmhXtYNlcZ/52RxeUcswHdVs4Hln9Q==", - "requires": { - "@babel/runtime": "^7.16.0", - "@wordpress/hooks": "^3.13.0", - "gettext-parser": "^1.3.1", - "lodash": "^4.17.21", - "memize": "^1.1.0", - "sprintf-js": "^1.1.1", - "tannin": "^1.2.0" - } - }, - "@wordpress/is-shallow-equal": { - "version": "4.13.0", - "resolved": "https://registry.npmjs.org/@wordpress/is-shallow-equal/-/is-shallow-equal-4.13.0.tgz", - "integrity": "sha512-oUoMbEZwnbd4nfEo6uxkvrNCc/LnqC9MIY6kK3iWtMhcykQNpbK3XY/i/NvJb+QpRf7U6XhXyw4//HcQv39iOA==", - "requires": { - "@babel/runtime": "^7.16.0" - } - }, - "@wordpress/url": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/@wordpress/url/-/url-3.14.0.tgz", - "integrity": "sha512-cTqew8zSvAgkV7PylV0SkAUfOnvnrqgW0ZDy0EhamyFv4yzVq+efeUVct1bGs5QN7jfaPcvGEGxUG8kz8EJSLg==", - "requires": { - "@babel/runtime": "^7.16.0", - "remove-accents": "^0.4.2" - } - }, - "rememo": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/rememo/-/rememo-4.0.1.tgz", - "integrity": "sha512-x/T5q/pCDh8k4OlvJGqkI3eO+O8hmJv9HhJHo4avwlluwUpDbteDvyqw1PTarEITkeH9bfW6GSKeRke+XKgykw==" - } - } - }, "@wordpress/data": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/@wordpress/data/-/data-6.13.0.tgz", @@ -67937,11 +66651,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" - }, "check-node-version": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.2.1.tgz", @@ -69490,11 +68199,6 @@ } } }, - "crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" - }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -71104,11 +69808,6 @@ "domelementtype": "^2.2.0" } }, - "dompurify": { - "version": "2.3.10", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.3.10.tgz", - "integrity": "sha512-o7Fg/AgC7p/XpKjf/+RC3Ok6k4St5F7Q6q6+Nnm3p2zGWioAY6dh0CbbuwOhH2UcSzKsdniE/YnE2/92JcsA+g==" - }, "domutils": { "version": "2.8.0", "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz", @@ -74529,14 +73228,6 @@ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", "dev": true }, - "history": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/history/-/history-5.3.0.tgz", - "integrity": "sha512-ZqaKwjjrAYUYfLG+htGaIIZ4nioX2L70ZUMIFysS3xvBsSG4x/n1V6TXV3N8ZYNuFGlDirFg32T7B6WOUPDYcQ==", - "requires": { - "@babel/runtime": "^7.7.6" - } - }, "hjson": { "version": "1.8.4", "resolved": "https://registry.npmjs.org/hjson/-/hjson-1.8.4.tgz", @@ -80710,23 +79401,6 @@ "integrity": "sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==", "dev": true }, - "md5": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "requires": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - } - } - }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -85672,6 +84346,7 @@ "version": "6.10.3", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz", "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==", + "dev": true, "requires": { "side-channel": "^1.0.4" } diff --git a/package.json b/package.json index a31758ceb3f..037bf43e107 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,6 @@ "npm": "^8.0.0" }, "dependencies": { - "@woocommerce/data": "^4.1.0", "@wordpress/autop": "3.12.0", "@wordpress/compose": "5.5.0", "@wordpress/deprecated": "3.12.0", diff --git a/src/BlockTypes/AbstractBlock.php b/src/BlockTypes/AbstractBlock.php index f774da9b13a..725870f7726 100644 --- a/src/BlockTypes/AbstractBlock.php +++ b/src/BlockTypes/AbstractBlock.php @@ -78,12 +78,12 @@ public function __construct( AssetApi $asset_api, AssetDataRegistry $asset_data_ * @param string $content Block content. Default empty string. * @return string Rendered block type output. */ - public function render_callback( $attributes = [], $content = '' ) { + public function render_callback( $attributes = [], $content = '', $block ) { $render_callback_attributes = $this->parse_render_callback_attributes( $attributes ); if ( ! is_admin() && ! WC()->is_rest_api_request() ) { $this->enqueue_assets( $render_callback_attributes ); } - return $this->render( $render_callback_attributes, $content ); + return $this->render( $render_callback_attributes, $content, $block ); } /** @@ -222,8 +222,9 @@ protected function register_block_type() { * These are left unset until now and only added here because if they were set when registering with metadata, * the attributes and supports from $block_settings would override the values from metadata. */ - $block_settings['attributes'] = $this->get_block_type_attributes(); - $block_settings['supports'] = $this->get_block_type_supports(); + $block_settings['attributes'] = $this->get_block_type_attributes(); + $block_settings['supports'] = $this->get_block_type_supports(); + $block_settings['uses_context'] = $this->get_block_type_uses_context(); register_block_type( $this->get_block_type(), @@ -240,6 +241,10 @@ protected function get_block_type() { return $this->namespace . '/' . $this->block_name; } + protected function get_block_type_uses_context() { + return []; + } + /** * Get the render callback for this block type. * @@ -338,9 +343,10 @@ protected function parse_render_callback_attributes( $attributes ) { * * @param array $attributes Block attributes. * @param string $content Block content. + * @param object $block Block. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { return $content; } diff --git a/src/BlockTypes/AbstractProductGrid.php b/src/BlockTypes/AbstractProductGrid.php index cab1aa3df31..c29946c7319 100644 --- a/src/BlockTypes/AbstractProductGrid.php +++ b/src/BlockTypes/AbstractProductGrid.php @@ -71,7 +71,7 @@ protected function get_block_type_attributes() { * @param string $content Block content. Default empty string. * @return string Rendered block type output. */ - protected function render( $attributes = array(), $content = '' ) { + protected function render( $attributes = array(), $content = '', $block ) { $this->attributes = $this->parse_attributes( $attributes ); $this->content = $content; $this->query_args = $this->parse_query_args(); diff --git a/src/BlockTypes/Cart.php b/src/BlockTypes/Cart.php index 15aad499b34..f9004dbe0fd 100644 --- a/src/BlockTypes/Cart.php +++ b/src/BlockTypes/Cart.php @@ -80,7 +80,7 @@ protected function enqueue_assets( array $attributes ) { * @param string $content Block content. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { // Deregister core cart scripts and styles. wp_dequeue_script( 'wc-cart' ); wp_dequeue_script( 'wc-password-strength-meter' ); diff --git a/src/BlockTypes/Checkout.php b/src/BlockTypes/Checkout.php index d8b94f31b05..89a535aaa9a 100644 --- a/src/BlockTypes/Checkout.php +++ b/src/BlockTypes/Checkout.php @@ -76,7 +76,7 @@ protected function enqueue_assets( array $attributes ) { * @param string $content Block content. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { if ( $this->is_checkout_endpoint() ) { // Note: Currently the block only takes care of the main checkout form -- if an endpoint is set, refer to the // legacy shortcode instead and do not render block. diff --git a/src/BlockTypes/ClassicTemplate.php b/src/BlockTypes/ClassicTemplate.php index 311fd1a2080..c5ec6d9c560 100644 --- a/src/BlockTypes/ClassicTemplate.php +++ b/src/BlockTypes/ClassicTemplate.php @@ -45,7 +45,7 @@ protected function initialize() { * * @return string | void Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { if ( ! isset( $attributes['template'] ) ) { return; } diff --git a/src/BlockTypes/FeaturedItem.php b/src/BlockTypes/FeaturedItem.php index ec2ea332645..f778c83709c 100644 --- a/src/BlockTypes/FeaturedItem.php +++ b/src/BlockTypes/FeaturedItem.php @@ -94,7 +94,7 @@ protected function get_block_type_supports() { * @param string $content Block content. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { $item = $this->get_item( $attributes ); if ( ! $item ) { return ''; diff --git a/src/BlockTypes/MiniCart.php b/src/BlockTypes/MiniCart.php index d6b05a1905c..549e5e67a5c 100644 --- a/src/BlockTypes/MiniCart.php +++ b/src/BlockTypes/MiniCart.php @@ -309,7 +309,7 @@ protected function get_include_tax_label_markup() { * * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { return $content . $this->get_markup( $attributes ); } diff --git a/src/BlockTypes/MiniCartContents.php b/src/BlockTypes/MiniCartContents.php index 99fa952fba1..dfd8f7b332a 100644 --- a/src/BlockTypes/MiniCartContents.php +++ b/src/BlockTypes/MiniCartContents.php @@ -57,7 +57,7 @@ protected function get_block_type_script( $key = null ) { * * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { if ( is_admin() || WC()->is_rest_api_request() ) { // In the editor we will display the placeholder, so no need to // print the markup. diff --git a/src/BlockTypes/ProductCategories.php b/src/BlockTypes/ProductCategories.php index 1cb07d2782e..49649066aa9 100644 --- a/src/BlockTypes/ProductCategories.php +++ b/src/BlockTypes/ProductCategories.php @@ -60,7 +60,7 @@ protected function get_block_type_attributes() { * @param string $content Block content. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { $uid = uniqid( 'product-categories-' ); $categories = $this->get_categories( $attributes ); diff --git a/src/BlockTypes/ProductImage.php b/src/BlockTypes/ProductImage.php index 8f95831acc9..2ec1d08470d 100644 --- a/src/BlockTypes/ProductImage.php +++ b/src/BlockTypes/ProductImage.php @@ -56,4 +56,17 @@ protected function register_block_type_assets() { parent::register_block_type_assets(); $this->register_chunk_translations( [ $this->block_name ] ); } + + protected function get_block_type_uses_context() { + return array( 'query', 'queryId', 'postId' ); + } + + protected function render( $attributes, $content, $block ) { + $post_id = $block->context['postId']; + + $product = wc_get_product( $post_id ); + $is_on_sale = $product->is_on_sale(); + + return '' . wc_bool_to_string( $is_on_sale ) . '' . wp_get_attachment_image( get_post_thumbnail_id( $post_id ) ); + } } diff --git a/src/BlockTypes/ProductQuery.php b/src/BlockTypes/ProductQuery.php index aa1d82ce08b..4efe464c736 100644 --- a/src/BlockTypes/ProductQuery.php +++ b/src/BlockTypes/ProductQuery.php @@ -20,107 +20,46 @@ class ProductQuery extends AbstractBlock { * not in the post content on editor load. */ - // protected function initialize() { - // parent::initialize(); - - // do_action( 'qm/debug', 'initialize' ); - - // add_filter( 'query_vars', array( $this, 'themeslug_query_vars' ) ); - - // add_filter( - // 'pre_render_block', - // array( $this, 'wporg_block_wrapper' ), - // 10, - // 2 - // ); - - // $wp_query = new \WP_Query( - // array( - // 'post_type' => 'product', - // 'posts_per_page' => 8, - // 'meta_query' => array( - // 'relation' => 'OR', - // array( // Simple products type - // 'key' => '_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // array( // Variable products type - // 'key' => '_min_variation_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // ), - // ) - // ); - - // add_filter( - // 'gigitux', - // function ( $array ) { - // do_action( 'qm/debug', "sto nell'init" ); - // do_action( 'qm/debug', $array ); - // return array( - // 'post_type' => 'product', - // 'posts_per_page' => 8, - // 'meta_query' => array( - // 'relation' => 'OR', - // array( // Simple products type - // 'key' => '_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // array( // Variable products type - // 'key' => '_min_variation_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // ), - // ); - // } - // ); - // } - - // public function wporg_block_wrapper( $block_content, $block ) { - - // if ( $block['blockName'] === 'core/query' && $block['attrs']['onSale'] === true ) { - - // global $wp_query; - - // $wp_query = new \WP_Query( - // array( - // 'post_type' => 'product', - // 'posts_per_page' => 2, - // 'meta_query' => array( - // 'relation' => 'OR', - // array( // Simple products type - // 'key' => '_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // array( // Variable products type - // 'key' => '_min_variation_sale_price', - // 'value' => 0, - // 'compare' => '>', - // 'type' => 'numeric', - // ), - // ), - // ) - // ); - - // do_action( 'qm/debug', 1 ); - - // } - // return $block_content; - // } - - // function themeslug_query_vars( $qvars ) { - // $qvars[] = 'filter-stock'; - // return $qvars; - // } + protected function initialize() { + parent::initialize(); + add_filter( + 'pre_render_block', + array( $this, 'wporg_block_wrapper' ), + 10, + 2 + ); + + } + + public function update_query( $query, $block, $page ) { + $wp_query = array( + 'post_type' => 'product', + 'posts_per_page' => $query['posts_per_page'], + 'meta_query' => array( + 'relation' => 'OR', + array( // Simple products type + 'key' => '_sale_price', + 'value' => 0, + 'compare' => '>', + 'type' => 'numeric', + ), + array( // Variable products type + 'key' => '_min_variation_sale_price', + 'value' => 0, + 'compare' => '>', + 'type' => 'numeric', + ), + ), + ); + + return $wp_query; + } + + + public function wporg_block_wrapper( $block_content, $block ) { + if ( $block['blockName'] === 'core/query' && $block['attrs']['productQuery']['onSale'] === true ) { + add_filter( 'gigitux', array( $this, 'update_query' ), 10, 3 ); + } + } } diff --git a/src/BlockTypes/ProductSearch.php b/src/BlockTypes/ProductSearch.php index 613aa67d77d..2a1ecf8b961 100644 --- a/src/BlockTypes/ProductSearch.php +++ b/src/BlockTypes/ProductSearch.php @@ -30,7 +30,7 @@ protected function get_block_type_script( $key = null ) { * @param string $content Block content. * @return string Rendered block type output. */ - protected function render( $attributes, $content ) { + protected function render( $attributes, $content, $block ) { static $instance_id = 0; $attributes = wp_parse_args( diff --git a/src/BlockTypesController.php b/src/BlockTypesController.php index e52f42b306c..b4bafb01f37 100644 --- a/src/BlockTypesController.php +++ b/src/BlockTypesController.php @@ -197,7 +197,6 @@ protected function get_block_types() { 'MiniCart', 'MiniCartContents', 'ProductQuery', - 'ProductImage2', ]; if ( Package::feature()->is_feature_plugin_build() ) {