diff --git a/assets/js/atomic/components/product/button/index.js b/assets/js/atomic/components/product/button/index.js index 01c458db991..2ab3d668264 100644 --- a/assets/js/atomic/components/product/button/index.js +++ b/assets/js/atomic/components/product/button/index.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; import { _n, sprintf } from '@wordpress/i18n'; import { useEffect, useRef } from '@wordpress/element'; import { useStoreAddToCart } from '@woocommerce/base-hooks'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import { decodeEntities } from '@wordpress/html-entities'; import { triggerFragmentRefresh } from '@woocommerce/base-utils'; @@ -25,7 +25,7 @@ const ProductButton = ( { product, className } ) => { cartIsLoading, addToCart, } = useStoreAddToCart( id ); - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const addedToCart = Number.isFinite( cartQuantity ) && cartQuantity > 0; const getButtonText = () => { if ( addedToCart ) { diff --git a/assets/js/atomic/components/product/image/index.js b/assets/js/atomic/components/product/image/index.js index 81e11effdcf..68dfa08e17b 100644 --- a/assets/js/atomic/components/product/image/index.js +++ b/assets/js/atomic/components/product/image/index.js @@ -5,7 +5,7 @@ import PropTypes from 'prop-types'; import { Fragment, useState } from '@wordpress/element'; import classnames from 'classnames'; import { PLACEHOLDER_IMG_SRC } from '@woocommerce/block-settings'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; /** * Internal dependencies @@ -56,7 +56,7 @@ const ProductImage = ( { saleBadgeAlign = 'right', } ) => { const [ imageLoaded, setImageLoaded ] = useState( false ); - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const image = product.images && product.images.length ? product.images[ 0 ] : null; diff --git a/assets/js/atomic/components/product/price/index.js b/assets/js/atomic/components/product/price/index.js index f406b4d841b..be5c7b0f099 100644 --- a/assets/js/atomic/components/product/price/index.js +++ b/assets/js/atomic/components/product/price/index.js @@ -2,12 +2,12 @@ * External dependencies */ import classnames from 'classnames'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; import { getCurrencyFromPriceResponse } from '@woocommerce/base-utils'; const ProductPrice = ( { className, product } ) => { - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const prices = product.prices || {}; const currency = getCurrencyFromPriceResponse( prices ); diff --git a/assets/js/atomic/components/product/rating/index.js b/assets/js/atomic/components/product/rating/index.js index b87c3c20e15..449a3f10c13 100644 --- a/assets/js/atomic/components/product/rating/index.js +++ b/assets/js/atomic/components/product/rating/index.js @@ -4,11 +4,11 @@ import PropTypes from 'prop-types'; import { __, sprintf } from '@wordpress/i18n'; import classnames from 'classnames'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; const ProductRating = ( { className, product } ) => { const rating = parseFloat( product.average_rating ); - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); if ( ! Number.isFinite( rating ) || rating === 0 ) { return null; diff --git a/assets/js/atomic/components/product/sale-badge/index.js b/assets/js/atomic/components/product/sale-badge/index.js index 2a35c2a5c44..f5d5b8a7dca 100644 --- a/assets/js/atomic/components/product/sale-badge/index.js +++ b/assets/js/atomic/components/product/sale-badge/index.js @@ -3,11 +3,11 @@ */ import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import Label from '@woocommerce/base-components/label'; const ProductSaleBadge = ( { className, product, align } ) => { - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const alignClass = typeof align === 'string' ? `${ layoutStyleClassPrefix }__product-onsale--align${ align }` diff --git a/assets/js/atomic/components/product/summary/index.js b/assets/js/atomic/components/product/summary/index.js index b883c7ef069..4b62a2a7901 100644 --- a/assets/js/atomic/components/product/summary/index.js +++ b/assets/js/atomic/components/product/summary/index.js @@ -3,12 +3,12 @@ */ import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import Summary from '@woocommerce/base-components/summary'; import { getSetting } from '@woocommerce/settings'; const ProductSummary = ( { className, product } ) => { - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const source = product.short_description ? product.short_description : product.description; diff --git a/assets/js/atomic/components/product/title/index.js b/assets/js/atomic/components/product/title/index.js index 2e5b27795a9..26ed9f10aac 100644 --- a/assets/js/atomic/components/product/title/index.js +++ b/assets/js/atomic/components/product/title/index.js @@ -3,7 +3,7 @@ */ import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import { decodeEntities } from '@wordpress/html-entities'; const ProductTitle = ( { @@ -12,7 +12,7 @@ const ProductTitle = ( { headingLevel = 2, productLink = true, } ) => { - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); if ( ! product.name ) { return null; } diff --git a/assets/js/base/components/product-list-item/index.js b/assets/js/base/components/product-list-item/index.js index fc91d3a77bc..88e40d23c2c 100644 --- a/assets/js/base/components/product-list-item/index.js +++ b/assets/js/base/components/product-list-item/index.js @@ -3,10 +3,7 @@ */ import PropTypes from 'prop-types'; import classnames from 'classnames'; -import { - useInnerBlockConfigurationContext, - useProductLayoutContext, -} from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import { withInstanceId } from '@woocommerce/base-hocs/with-instance-id'; /** @@ -16,8 +13,10 @@ import { renderProductLayout } from './utils'; const ProductListItem = ( { product, attributes, instanceId } ) => { const { layoutConfig } = attributes; - const { parentName } = useInnerBlockConfigurationContext(); - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { + layoutStyleClassPrefix, + parentName, + } = useInnerBlockConfigurationContext(); const isLoading = Object.keys( product ).length === 0; const classes = classnames( `${ layoutStyleClassPrefix }__product`, { 'is-loading': isLoading, diff --git a/assets/js/base/components/product-list/index.js b/assets/js/base/components/product-list/index.js index d866bd05a7b..e9444e835d7 100644 --- a/assets/js/base/components/product-list/index.js +++ b/assets/js/base/components/product-list/index.js @@ -16,7 +16,7 @@ import { useQueryStateByKey, } from '@woocommerce/base-hooks'; import withScrollToTop from '@woocommerce/base-hocs/with-scroll-to-top'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import { speak } from '@wordpress/a11y'; /** @@ -114,7 +114,7 @@ const ProductList = ( { const { products, totalProducts, productsLoading } = useStoreProducts( queryState ); - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); const totalQuery = extractPaginationAndSortAttributes( queryState ); // These are possible filters. diff --git a/assets/js/base/components/product-list/no-matching-products.js b/assets/js/base/components/product-list/no-matching-products.js index 9170ec4d5e2..982e93a12a2 100644 --- a/assets/js/base/components/product-list/no-matching-products.js +++ b/assets/js/base/components/product-list/no-matching-products.js @@ -2,11 +2,11 @@ * External dependencies */ import { __ } from '@wordpress/i18n'; -import { useProductLayoutContext } from '@woocommerce/base-context'; +import { useInnerBlockConfigurationContext } from '@woocommerce/shared-context'; import { Icon, search } from '@woocommerce/icons'; const NoMatchingProducts = ( { resetCallback = () => {} } ) => { - const { layoutStyleClassPrefix } = useProductLayoutContext(); + const { layoutStyleClassPrefix } = useInnerBlockConfigurationContext(); return (