From 28c2e94cf512aa2d616ac94c2c1b89f5a23a2709 Mon Sep 17 00:00:00 2001 From: Thomas Roberts Date: Thu, 12 Oct 2023 13:08:58 +0100 Subject: [PATCH 1/3] Move FormattedMonetaryAmount to the components package --- .../components/formatted-monetary-amount/index.tsx | 0 .../components/formatted-monetary-amount/style.scss | 0 packages/components/index.js | 1 + 3 files changed, 1 insertion(+) rename {assets/js/base => packages}/components/formatted-monetary-amount/index.tsx (100%) rename {assets/js/base => packages}/components/formatted-monetary-amount/style.scss (100%) diff --git a/assets/js/base/components/formatted-monetary-amount/index.tsx b/packages/components/formatted-monetary-amount/index.tsx similarity index 100% rename from assets/js/base/components/formatted-monetary-amount/index.tsx rename to packages/components/formatted-monetary-amount/index.tsx diff --git a/assets/js/base/components/formatted-monetary-amount/style.scss b/packages/components/formatted-monetary-amount/style.scss similarity index 100% rename from assets/js/base/components/formatted-monetary-amount/style.scss rename to packages/components/formatted-monetary-amount/style.scss diff --git a/packages/components/index.js b/packages/components/index.js index 599ab85acc2..f26fcde77ba 100644 --- a/packages/components/index.js +++ b/packages/components/index.js @@ -1,2 +1,3 @@ export { default as CheckboxList } from './checkbox-list'; +export { default as FormattedMonetaryAmount } from './formatted-monetary-amount'; export { Chip, RemovableChip } from './chip'; From c9bd1999fd77eac19bbb4cd7cc447f5976fcb14c Mon Sep 17 00:00:00 2001 From: Thomas Roberts Date: Thu, 12 Oct 2023 13:12:32 +0100 Subject: [PATCH 2/3] Update imports of FormattedMonetaryAmount --- .../base/components/cart-checkout/product-sale-badge/index.tsx | 2 +- .../render-package-rate-option.tsx | 2 +- .../base/components/cart-checkout/totals/footer-item/index.tsx | 2 +- assets/js/base/components/price-slider/index.tsx | 2 +- assets/js/base/components/product-price/index.tsx | 2 +- .../inner-blocks/checkout-pickup-options-block/block.tsx | 2 +- .../checkout-shipping-method-block/shared/rate-price.tsx | 2 +- .../inner-blocks/checkout-shipping-methods-block/block.tsx | 2 +- packages/checkout/components/totals/item/index.tsx | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx b/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx index 3d0066ba879..2edef13439d 100644 --- a/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx +++ b/assets/js/base/components/cart-checkout/product-sale-badge/index.tsx @@ -3,7 +3,7 @@ */ import { createInterpolateElement } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import type { Currency } from '@woocommerce/price-format'; /** diff --git a/assets/js/base/components/cart-checkout/shipping-rates-control-package/render-package-rate-option.tsx b/assets/js/base/components/cart-checkout/shipping-rates-control-package/render-package-rate-option.tsx index 7ff24881060..2e59a0542b2 100644 --- a/assets/js/base/components/cart-checkout/shipping-rates-control-package/render-package-rate-option.tsx +++ b/assets/js/base/components/cart-checkout/shipping-rates-control-package/render-package-rate-option.tsx @@ -3,7 +3,7 @@ */ import { decodeEntities } from '@wordpress/html-entities'; import { getCurrencyFromPriceResponse } from '@woocommerce/price-format'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import type { PackageRateOption } from '@woocommerce/types'; import { getSetting } from '@woocommerce/settings'; import { CartShippingPackageShippingRate } from '@woocommerce/types'; diff --git a/assets/js/base/components/cart-checkout/totals/footer-item/index.tsx b/assets/js/base/components/cart-checkout/totals/footer-item/index.tsx index 60a7a8f6fc8..76b76d0e5fa 100644 --- a/assets/js/base/components/cart-checkout/totals/footer-item/index.tsx +++ b/assets/js/base/components/cart-checkout/totals/footer-item/index.tsx @@ -4,7 +4,7 @@ import { __, sprintf } from '@wordpress/i18n'; import classNames from 'classnames'; import { createInterpolateElement } from '@wordpress/element'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import { applyCheckoutFilter, TotalsItem } from '@woocommerce/blocks-checkout'; import { useStoreCart } from '@woocommerce/base-context/hooks'; import { getSetting } from '@woocommerce/settings'; diff --git a/assets/js/base/components/price-slider/index.tsx b/assets/js/base/components/price-slider/index.tsx index 743fdaf2fb5..712df6e1527 100644 --- a/assets/js/base/components/price-slider/index.tsx +++ b/assets/js/base/components/price-slider/index.tsx @@ -11,7 +11,7 @@ import { useLayoutEffect, } from '@wordpress/element'; import classnames from 'classnames'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import { Currency, isObject } from '@woocommerce/types'; import { useDebouncedCallback } from 'use-debounce'; diff --git a/assets/js/base/components/product-price/index.tsx b/assets/js/base/components/product-price/index.tsx index 10fa139b3b7..3a2b3ea907e 100644 --- a/assets/js/base/components/product-price/index.tsx +++ b/assets/js/base/components/product-price/index.tsx @@ -2,7 +2,7 @@ * External dependencies */ import { __, sprintf } from '@wordpress/i18n'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import classNames from 'classnames'; import { formatPrice } from '@woocommerce/price-format'; import { createInterpolateElement } from '@wordpress/element'; diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx index 91771f5109e..bcaf239ee8b 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-pickup-options-block/block.tsx @@ -10,7 +10,7 @@ import { } from '@wordpress/element'; import { useShippingData, useStoreCart } from '@woocommerce/base-context/hooks'; import { getCurrencyFromPriceResponse } from '@woocommerce/price-format'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import { decodeEntities } from '@wordpress/html-entities'; import { getSetting } from '@woocommerce/settings'; import { Icon, mapMarker } from '@wordpress/icons'; diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/shared/rate-price.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/shared/rate-price.tsx index 30e2395154c..57e16611713 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/shared/rate-price.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-shipping-method-block/shared/rate-price.tsx @@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n'; import { getSetting } from '@woocommerce/settings'; import { createInterpolateElement } from '@wordpress/element'; import { getCurrencyFromPriceResponse } from '@woocommerce/price-format'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import type { CartShippingPackageShippingRate } from '@woocommerce/type-defs/cart'; export const RatePrice = ( { diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx index e0ad9bc0c72..34e52ba81de 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx @@ -13,7 +13,7 @@ import { isAddressComplete, } from '@woocommerce/base-utils'; import { getCurrencyFromPriceResponse } from '@woocommerce/price-format'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import { useEditorContext, noticeContexts } from '@woocommerce/base-context'; import { StoreNoticesContainer } from '@woocommerce/blocks-checkout'; import { decodeEntities } from '@wordpress/html-entities'; diff --git a/packages/checkout/components/totals/item/index.tsx b/packages/checkout/components/totals/item/index.tsx index ee045a5136e..f8eb797424a 100644 --- a/packages/checkout/components/totals/item/index.tsx +++ b/packages/checkout/components/totals/item/index.tsx @@ -3,7 +3,7 @@ */ import classnames from 'classnames'; import { isValidElement } from '@wordpress/element'; -import FormattedMonetaryAmount from '@woocommerce/base-components/formatted-monetary-amount'; +import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import type { ReactElement, ReactNode } from 'react'; import type { Currency } from '@woocommerce/price-format'; From 407f17508a1cff4f4560dcd385c9737e928f095a Mon Sep 17 00:00:00 2001 From: Thomas Roberts Date: Thu, 12 Oct 2023 15:27:26 +0100 Subject: [PATCH 3/3] Change import path in the checkout components package --- packages/checkout/components/totals/item/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/checkout/components/totals/item/index.tsx b/packages/checkout/components/totals/item/index.tsx index f8eb797424a..5e3c9120bbe 100644 --- a/packages/checkout/components/totals/item/index.tsx +++ b/packages/checkout/components/totals/item/index.tsx @@ -3,7 +3,6 @@ */ import classnames from 'classnames'; import { isValidElement } from '@wordpress/element'; -import { FormattedMonetaryAmount } from '@woocommerce/blocks-components'; import type { ReactElement, ReactNode } from 'react'; import type { Currency } from '@woocommerce/price-format'; @@ -11,6 +10,7 @@ import type { Currency } from '@woocommerce/price-format'; * Internal dependencies */ import './style.scss'; +import FormattedMonetaryAmount from '../../../../components/formatted-monetary-amount'; export interface TotalsItemProps { className?: string;