From bf674fff55e388476eefb6b9f0e428b02bfabb96 Mon Sep 17 00:00:00 2001 From: Seghir Nadir Date: Thu, 4 Nov 2021 12:03:33 +0100 Subject: [PATCH] expose with-filtered-attributes (#5058) --- .../atomic/blocks/product-elements/add-to-cart/frontend.js | 2 +- assets/js/atomic/blocks/product-elements/image/frontend.js | 2 +- assets/js/atomic/blocks/product-elements/title/frontend.ts | 2 +- .../cart/inner-blocks/cart-order-summary-block/frontend.tsx | 2 +- .../inner-blocks/proceed-to-checkout-block/frontend.tsx | 2 +- .../inner-blocks/checkout-actions-block/frontend.tsx | 2 +- .../checkout-billing-address-block/frontend.tsx | 2 +- .../checkout-contact-information-block/frontend.tsx | 2 +- .../inner-blocks/checkout-payment-block/frontend.tsx | 2 +- .../checkout-shipping-address-block/frontend.tsx | 2 +- .../checkout-shipping-methods-block/frontend.tsx | 2 +- assets/js/shared/hocs/index.js | 1 + assets/js/{base => shared}/hocs/with-filtered-attributes.js | 6 +++--- 13 files changed, 15 insertions(+), 14 deletions(-) rename assets/js/{base => shared}/hocs/with-filtered-attributes.js (80%) diff --git a/assets/js/atomic/blocks/product-elements/add-to-cart/frontend.js b/assets/js/atomic/blocks/product-elements/add-to-cart/frontend.js index 37602e61842..b6c773996b2 100644 --- a/assets/js/atomic/blocks/product-elements/add-to-cart/frontend.js +++ b/assets/js/atomic/blocks/product-elements/add-to-cart/frontend.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/atomic/blocks/product-elements/image/frontend.js b/assets/js/atomic/blocks/product-elements/image/frontend.js index 37602e61842..b6c773996b2 100644 --- a/assets/js/atomic/blocks/product-elements/image/frontend.js +++ b/assets/js/atomic/blocks/product-elements/image/frontend.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/atomic/blocks/product-elements/title/frontend.ts b/assets/js/atomic/blocks/product-elements/title/frontend.ts index 37602e61842..b6c773996b2 100644 --- a/assets/js/atomic/blocks/product-elements/title/frontend.ts +++ b/assets/js/atomic/blocks/product-elements/title/frontend.ts @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/cart/inner-blocks/cart-order-summary-block/frontend.tsx b/assets/js/blocks/cart-checkout/cart/inner-blocks/cart-order-summary-block/frontend.tsx index 37602e61842..b6c773996b2 100644 --- a/assets/js/blocks/cart-checkout/cart/inner-blocks/cart-order-summary-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/cart/inner-blocks/cart-order-summary-block/frontend.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/cart/inner-blocks/proceed-to-checkout-block/frontend.tsx b/assets/js/blocks/cart-checkout/cart/inner-blocks/proceed-to-checkout-block/frontend.tsx index 37602e61842..b6c773996b2 100644 --- a/assets/js/blocks/cart-checkout/cart/inner-blocks/proceed-to-checkout-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/cart/inner-blocks/proceed-to-checkout-block/frontend.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-actions-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-actions-block/frontend.tsx index 37602e61842..b6c773996b2 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-actions-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-actions-block/frontend.tsx @@ -1,7 +1,7 @@ /** * External dependencies */ -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; /** * Internal dependencies diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx index c419104432a..7675565e2eb 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-billing-address-block/frontend.tsx @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; import { FormStep } from '@woocommerce/base-components/cart-checkout'; import { useCheckoutContext } from '@woocommerce/base-context'; import { useCheckoutAddress } from '@woocommerce/base-context/hooks'; diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/frontend.tsx index c089509c1ad..3d772448fc6 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-contact-information-block/frontend.tsx @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; import { FormStep } from '@woocommerce/base-components/cart-checkout'; import { useCheckoutContext } from '@woocommerce/base-context'; diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx index d2584ab151c..abca086c41c 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx @@ -3,7 +3,7 @@ */ import classnames from 'classnames'; import { useStoreCart, useEmitResponse } from '@woocommerce/base-context/hooks'; -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; import { FormStep } from '@woocommerce/base-components/cart-checkout'; import { useCheckoutContext, diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx index d3ae6c1a924..9756834dd9a 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; import { FormStep } from '@woocommerce/base-components/cart-checkout'; import { useCheckoutContext } from '@woocommerce/base-context'; import { useCheckoutAddress } from '@woocommerce/base-context/hooks'; diff --git a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx index 9c42c4c9423..a9c8d90f7ac 100644 --- a/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx +++ b/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx @@ -2,7 +2,7 @@ * External dependencies */ import classnames from 'classnames'; -import withFilteredAttributes from '@woocommerce/base-hocs/with-filtered-attributes'; +import { withFilteredAttributes } from '@woocommerce/shared-hocs'; import { FormStep } from '@woocommerce/base-components/cart-checkout'; import { useCheckoutContext } from '@woocommerce/base-context'; import { useCheckoutAddress } from '@woocommerce/base-context/hooks'; diff --git a/assets/js/shared/hocs/index.js b/assets/js/shared/hocs/index.js index 39d783f86e9..9232666ace5 100644 --- a/assets/js/shared/hocs/index.js +++ b/assets/js/shared/hocs/index.js @@ -1 +1,2 @@ export * from './with-product-data-context'; +export * from './with-filtered-attributes'; diff --git a/assets/js/base/hocs/with-filtered-attributes.js b/assets/js/shared/hocs/with-filtered-attributes.js similarity index 80% rename from assets/js/base/hocs/with-filtered-attributes.js rename to assets/js/shared/hocs/with-filtered-attributes.js index bea2f0be473..e3e95488f2e 100644 --- a/assets/js/base/hocs/with-filtered-attributes.js +++ b/assets/js/shared/hocs/with-filtered-attributes.js @@ -8,7 +8,9 @@ import { getValidBlockAttributes } from '@woocommerce/base-utils'; * * @param {Object} blockAttributes Component being wrapped. */ -const withFilteredAttributes = ( blockAttributes ) => ( OriginalComponent ) => { +export const withFilteredAttributes = ( blockAttributes ) => ( + OriginalComponent +) => { return ( ownProps ) => { const validBlockAttributes = getValidBlockAttributes( blockAttributes, @@ -20,5 +22,3 @@ const withFilteredAttributes = ( blockAttributes ) => ( OriginalComponent ) => { ); }; }; - -export default withFilteredAttributes;