From e15d5161632846bb225a85509ec11fc52f0803c5 Mon Sep 17 00:00:00 2001 From: Alex Florisca Date: Tue, 5 Apr 2022 11:14:32 +0100 Subject: [PATCH] Revert "Move cart and mini-cart blocks into their own folders (https://github.com/woocommerce/woocommerce-blocks/pull/6126)" (https://github.com/woocommerce/woocommerce-blocks/pull/6190) This reverts commit d005dbd2cfbbc1178a3624d6e7a9d58e9f36f690. --- .../test/payment-method-data-context.js | 2 +- .../mini-cart-contents/attributes.ts | 0 .../mini-cart-contents/block.tsx | 0 .../mini-cart-contents/edit.tsx | 2 +- .../mini-cart-contents/editor.scss | 0 .../mini-cart-contents/index.tsx | 0 .../mini-cart-contents/inner-blocks-style.tsx | 0 .../inner-blocks/allowed-blocks.ts | 0 .../empty-mini-cart-contents-block/block.json | 0 .../empty-mini-cart-contents-block/edit.tsx | 0 .../frontend.tsx | 0 .../empty-mini-cart-contents-block/index.tsx | 0 .../block.json | 0 .../filled-mini-cart-contents-block/block.tsx | 0 .../filled-mini-cart-contents-block/edit.tsx | 2 +- .../frontend.tsx | 0 .../filled-mini-cart-contents-block/index.tsx | 0 .../mini-cart-contents/inner-blocks/index.tsx | 0 .../mini-cart-footer-block/block.json | 0 .../mini-cart-footer-block/block.tsx | 0 .../mini-cart-footer-block/edit.tsx | 0 .../mini-cart-footer-block/index.tsx | 0 .../mini-cart-items-block/block.json | 0 .../mini-cart-items-block/edit.tsx | 0 .../mini-cart-items-block/frontend.tsx | 0 .../mini-cart-items-block/index.tsx | 0 .../mini-cart-products-table-block/block.json | 0 .../mini-cart-products-table-block/block.tsx | 0 .../mini-cart-products-table-block/edit.tsx | 0 .../mini-cart-products-table-block/index.tsx | 0 .../block.json | 0 .../mini-cart-shopping-button-block/block.tsx | 0 .../mini-cart-shopping-button-block/edit.tsx | 0 .../mini-cart-shopping-button-block/index.tsx | 0 .../mini-cart-title-block/block.json | 0 .../mini-cart-title-block/block.tsx | 0 .../mini-cart-title-block/edit.tsx | 0 .../mini-cart-title-block/index.tsx | 0 .../inner-blocks/register-components.ts | 0 .../{ => cart-checkout}/mini-cart/block.tsx | 4 +- .../mini-cart/component-frontend.tsx | 0 .../{ => cart-checkout}/mini-cart/edit.tsx | 0 .../{ => cart-checkout}/mini-cart/frontend.ts | 0 .../{ => cart-checkout}/mini-cart/index.tsx | 0 .../mini-cart/quantity-badge/index.tsx | 0 .../mini-cart/quantity-badge/style.scss | 0 .../{ => cart-checkout}/mini-cart/style.scss | 0 .../mini-cart/test/block.js | 2 +- .../express-payment-methods.js | 0 .../express-payment/cart-express-payment.js | 0 .../checkout-express-payment.js | 0 .../payment-methods/express-payment/index.js | 0 .../express-payment/style.scss | 0 .../payment-methods/index.js | 0 .../no-payment-methods/index.js | 0 .../no-payment-methods/style.scss | 0 .../payment-methods/payment-method-card.js | 0 .../payment-method-error-boundary.js | 0 .../payment-methods/payment-method-options.js | 0 .../payment-methods/payment-methods.js | 0 .../saved-payment-method-options.js | 0 .../payment-methods/style.scss | 0 .../payment-methods/test/payment-methods.js | 0 .../shared/editor-utils.ts | 0 .../{ => cart-checkout}/shared/hacks.ts | 0 .../{ => cart-checkout}/shared/index.js | 0 .../shared/use-forced-layout.ts | 0 .../shared/use-view-switcher.tsx | 0 .../cart/cart-line-items-table/index.tsx | 2 +- .../assets/js/blocks/cart/edit.js | 2 +- .../cart-express-payment-block/block.tsx | 2 +- .../inner-blocks/cart-items-block/edit.tsx | 5 +- .../cart-order-summary-block/attributes.tsx | 18 --- .../cart-order-summary-block/block.tsx | 125 ------------------ .../cart-order-summary-block/edit.tsx | 5 +- .../inner-blocks/cart-totals-block/edit.tsx | 5 +- .../inner-blocks/empty-cart-block/edit.tsx | 5 +- .../inner-blocks/filled-cart-block/edit.tsx | 5 +- .../cart/inner-blocks/register-components.ts | 123 ++++++++++++----- .../assets/js/blocks/checkout/edit.tsx | 5 +- .../checkout/form-step/additional-fields.tsx | 2 +- .../checkout-express-payment-block/block.tsx | 2 +- .../checkout-fields-block/edit.tsx | 5 +- .../checkout-order-summary-block/edit.tsx | 5 +- .../checkout-payment-block/block.tsx | 2 +- .../checkout-totals-block/edit.tsx | 5 +- .../woocommerce-blocks/bin/webpack-entries.js | 5 +- .../extensibility/checkout-flow-and-events.md | 37 +++--- .../docs/testing/releases/440.md | 2 +- plugins/woocommerce-blocks/package.json | 4 +- .../checkout/utils/extension-cart-update.ts | 3 +- plugins/woocommerce-blocks/tsconfig.json | 2 +- 92 files changed, 164 insertions(+), 224 deletions(-) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/attributes.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/edit.tsx (97%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/editor.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks-style.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/allowed-blocks.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx (95%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-items-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-products-table-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/mini-cart-title-block/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{mini-cart => cart-checkout}/mini-cart-contents/inner-blocks/register-components.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/block.tsx (97%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/component-frontend.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/edit.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/frontend.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/quantity-badge/index.tsx (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/quantity-badge/style.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/style.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/mini-cart/test/block.js (98%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/express-payment-methods.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/express-payment/cart-express-payment.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/express-payment/checkout-express-payment.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/express-payment/index.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/express-payment/style.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/index.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/no-payment-methods/index.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/no-payment-methods/style.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/payment-method-card.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/payment-method-error-boundary.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/payment-method-options.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/payment-methods.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/saved-payment-method-options.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/style.scss (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{shared => cart-checkout}/payment-methods/test/payment-methods.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/shared/editor-utils.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/shared/hacks.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/shared/index.js (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/shared/use-forced-layout.ts (100%) rename plugins/woocommerce-blocks/assets/js/blocks/{ => cart-checkout}/shared/use-view-switcher.tsx (100%) delete mode 100644 plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/attributes.tsx delete mode 100644 plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js b/plugins/woocommerce-blocks/assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js index 544692e6329..52bd6c2df3e 100644 --- a/plugins/woocommerce-blocks/assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js +++ b/plugins/woocommerce-blocks/assets/js/base/context/providers/cart-checkout/payment-methods/test/payment-method-data-context.js @@ -24,7 +24,7 @@ import { import { CheckoutExpressPayment, SavedPaymentMethodOptions, -} from '../../../../../../blocks/shared/payment-methods'; +} from '../../../../../../blocks/cart-checkout/payment-methods'; import { defaultCartState } from '../../../../../../data/default-states'; jest.mock( '@woocommerce/settings', () => { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/attributes.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/attributes.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/attributes.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/attributes.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/edit.tsx similarity index 97% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/edit.tsx index f75e2ed958c..386b8e315a7 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/edit.tsx @@ -17,7 +17,7 @@ import type { TemplateArray } from '@wordpress/blocks'; /** * Internal dependencies */ -import { useViewSwitcher, useForcedLayout } from '../../shared'; +import { useViewSwitcher, useForcedLayout } from '../shared'; import { MiniCartInnerBlocksStyle } from './inner-blocks-style'; import './editor.scss'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks-style.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks-style.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks-style.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks-style.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/allowed-blocks.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/allowed-blocks.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/allowed-blocks.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx similarity index 95% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx index 794e970172e..1938e9fa1cf 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/edit.tsx @@ -10,7 +10,7 @@ import { previewCart } from '@woocommerce/resource-previews'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../../shared'; +import { useForcedLayout, getAllowedBlocks } from '../../../shared'; export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => { const blockProps = useBlockProps(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-footer-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-items-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-items-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-products-table-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-products-table-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-title-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/mini-cart-title-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/register-components.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/register-components.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/block.tsx similarity index 97% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/block.tsx index bfc8f3aa408..364e377640d 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/block.tsx @@ -31,9 +31,9 @@ import classnames from 'classnames'; * Internal dependencies */ import QuantityBadge from './quantity-badge'; -import { MiniCartContentsBlock } from './mini-cart-contents/block'; +import { MiniCartContentsBlock } from '../mini-cart-contents/block'; import './style.scss'; -import { blockName } from './mini-cart-contents/attributes'; +import { blockName } from '../mini-cart-contents/attributes'; interface Props { isInitiallyOpen?: boolean; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/component-frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/component-frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/frontend.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/frontend.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/frontend.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/frontend.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/quantity-badge/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/quantity-badge/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/quantity-badge/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/quantity-badge/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/quantity-badge/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/quantity-badge/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/quantity-badge/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/quantity-badge/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/test/block.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/test/block.js similarity index 98% rename from plugins/woocommerce-blocks/assets/js/blocks/mini-cart/test/block.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/test/block.js index bd371e13791..0b34c23adad 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/mini-cart/test/block.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/mini-cart/test/block.js @@ -19,7 +19,7 @@ import userEvent from '@testing-library/user-event'; * Internal dependencies */ import Block from '../block'; -import { defaultCartState } from '../../../data/default-states'; +import { defaultCartState } from '../../../../data/default-states'; const MiniCartBlock = ( props ) => ( diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment-methods.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment-methods.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment-methods.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment-methods.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/cart-express-payment.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/cart-express-payment.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/cart-express-payment.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/cart-express-payment.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/checkout-express-payment.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/checkout-express-payment.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/checkout-express-payment.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/checkout-express-payment.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/index.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/express-payment/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/express-payment/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/index.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/no-payment-methods/index.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/no-payment-methods/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/no-payment-methods/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/no-payment-methods/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/no-payment-methods/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/no-payment-methods/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/no-payment-methods/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/no-payment-methods/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-card.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-card.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-card.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-error-boundary.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-error-boundary.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-error-boundary.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-error-boundary.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-options.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-options.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-method-options.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-method-options.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-methods.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-methods.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/payment-methods.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/payment-methods.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/saved-payment-method-options.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/saved-payment-method-options.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/saved-payment-method-options.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/saved-payment-method-options.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/test/payment-methods.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/payment-methods/test/payment-methods.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/payment-methods/test/payment-methods.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/editor-utils.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/editor-utils.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/editor-utils.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/editor-utils.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/hacks.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/hacks.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/hacks.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/hacks.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/index.js b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/use-forced-layout.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/use-forced-layout.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/use-forced-layout.ts rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/use-forced-layout.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/shared/use-view-switcher.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/use-view-switcher.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/shared/use-view-switcher.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/shared/use-view-switcher.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/index.tsx index c13e8a1f174..e9a22366255 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/cart-line-items-table/index.tsx @@ -3,7 +3,7 @@ */ import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; -import { CartResponseItem } from '@woocommerce/types'; +import { CartResponseItem } from '@woocommerce/type-defs/cart-response'; import { createRef, useEffect, useRef } from '@wordpress/element'; import type { RefObject } from 'react'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/edit.js b/plugins/woocommerce-blocks/assets/js/blocks/cart/edit.js index 256d15b58d2..0e74e7ef108 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/edit.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/edit.js @@ -36,7 +36,7 @@ import { useViewSwitcher, useBlockPropsWithLocking, useForcedLayout, -} from '../shared'; +} from '../cart-checkout/shared'; import { CartBlockContext } from './context'; // This is adds a class to body to signal if the selected block is locked diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.tsx index e7f4731cf9e..ccb0659b1a9 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.tsx @@ -7,7 +7,7 @@ import classnames from 'classnames'; /** * Internal dependencies */ -import { CartExpressPayment } from '../../../shared/payment-methods'; +import { CartExpressPayment } from '../../../cart-checkout/payment-methods'; const Block = ( { className }: { className: string } ): JSX.Element | null => { const { cartNeedsPayment } = useStoreCart(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/edit.tsx index fc4df087b9d..e823d38f0bd 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-items-block/edit.tsx @@ -8,7 +8,10 @@ import type { TemplateArray } from '@wordpress/blocks'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => { const blockProps = useBlockProps( { className: 'wc-block-cart__main' } ); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/attributes.tsx deleted file mode 100644 index e5378cb59e8..00000000000 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/attributes.tsx +++ /dev/null @@ -1,18 +0,0 @@ -/** - * External dependencies - */ -import { getSetting } from '@woocommerce/settings'; - -export default { - isShippingCalculatorEnabled: { - type: 'boolean', - default: getSetting( 'isShippingCalculatorEnabled', true ), - }, - lock: { - type: 'object', - default: { - move: false, - remove: true, - }, - }, -}; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/block.tsx deleted file mode 100644 index fa7bdfc6f77..00000000000 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/block.tsx +++ /dev/null @@ -1,125 +0,0 @@ -/** - * External dependencies - */ -import { __ } from '@wordpress/i18n'; -import { - TotalsCoupon, - TotalsDiscount, - TotalsFooterItem, - TotalsShipping, -} from '@woocommerce/base-components/cart-checkout'; -import { - Subtotal, - TotalsFees, - TotalsTaxes, - TotalsWrapper, - ExperimentalOrderMeta, - ExperimentalDiscountsMeta, -} from '@woocommerce/blocks-checkout'; -import { getCurrencyFromPriceResponse } from '@woocommerce/price-format'; -import { - useStoreCartCoupons, - useStoreCart, -} from '@woocommerce/base-context/hooks'; -import { getSetting } from '@woocommerce/settings'; -import Title from '@woocommerce/base-components/title'; - -/** - * Internal dependencies - */ - -const Block = ( { - className, - showRateAfterTaxName = false, - isShippingCalculatorEnabled = true, -}: { - className: string; - showRateAfterTaxName: boolean; - isShippingCalculatorEnabled: boolean; -} ): JSX.Element => { - const { cartFees, cartTotals, cartNeedsShipping } = useStoreCart(); - - const { - applyCoupon, - removeCoupon, - isApplyingCoupon, - isRemovingCoupon, - appliedCoupons, - } = useStoreCartCoupons(); - - const totalsCurrency = getCurrencyFromPriceResponse( cartTotals ); - - // Prepare props to pass to the ExperimentalOrderMeta slot fill. - // We need to pluck out receiveCart. - // eslint-disable-next-line no-unused-vars - const { extensions, receiveCart, ...cart } = useStoreCart(); - const slotFillProps = { - extensions, - cart, - context: 'woocommerce/cart', - }; - - const discountsSlotFillProps = { - extensions, - cart, - context: 'woocommerce/cart', - }; - - return ( -
- - { __( 'Cart totals', 'woo-gutenberg-products-block' ) } - - - - - - - { getSetting( 'couponsEnabled', true ) && ( - - - - ) } - - { cartNeedsShipping && ( - - - - ) } - { ! getSetting( 'displayCartPricesIncludingTax', false ) && - parseInt( cartTotals.total_tax, 10 ) > 0 && ( - - - - ) } - - - - - -
- ); -}; - -export default Block; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/edit.tsx index 97d14483b27..f9e9e41269c 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-order-summary-block/edit.tsx @@ -12,7 +12,10 @@ import { useStoreCart } from '@woocommerce/base-context/hooks'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; import { OrderMetaSlotFill } from './slotfills'; export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-totals-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-totals-block/edit.tsx index 615fc753539..178eb1077a8 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-totals-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/cart-totals-block/edit.tsx @@ -10,7 +10,10 @@ import type { TemplateArray } from '@wordpress/blocks'; * Internal dependencies */ import './style.scss'; -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => { const blockProps = useBlockProps( { className: 'wc-block-cart__sidebar' } ); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx index 78dc6abdb09..e63b5d8dd1b 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/empty-cart-block/edit.tsx @@ -11,7 +11,10 @@ import { SHOP_URL } from '@woocommerce/block-settings'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; import iconDataUri from './icon-data-uri.js'; import './style.scss'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx index 37b6aa952ce..06e7c325845 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/filled-cart-block/edit.tsx @@ -11,7 +11,10 @@ import { useEditorContext } from '@woocommerce/base-context'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; import './editor.scss'; import { useCartBlockContext } from '../../context'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts index 09de5c2e619..fb645f51d60 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts +++ b/plugins/woocommerce-blocks/assets/js/blocks/cart/inner-blocks/register-components.ts @@ -5,118 +5,171 @@ import { lazy } from '@wordpress/element'; import { WC_BLOCKS_BUILD_URL } from '@woocommerce/block-settings'; import { registerCheckoutBlock } from '@woocommerce/blocks-checkout'; +/** + * Internal dependencies + */ +import metadata from './component-metadata'; + // Modify webpack publicPath at runtime based on location of WordPress Plugin. // eslint-disable-next-line no-undef,camelcase __webpack_public_path__ = WC_BLOCKS_BUILD_URL; -/** - * Internal dependencies - */ -import filledCartMetadata from './filled-cart-block/block.json'; -import emptyCartMetadata from './empty-cart-block/block.json'; -import cartItemsMetadata from './cart-items-block/block.json'; -import cartExpressPaymentMetadata from './cart-express-payment-block/block.json'; -import cartLineItemsMetadata from './cart-line-items-block/block.json'; -import cartOrderSummaryMetadata from './cart-order-summary-block/block.json'; -import cartTotalsMetadata from './cart-totals-block/block.json'; -import cartProceedToCheckoutMetadata from './proceed-to-checkout-block/block.json'; -import cartAcceptedPaymentMethodsMetadata from './cart-accepted-payment-methods-block/block.json'; - registerCheckoutBlock( { - metadata: filledCartMetadata, + metadata: metadata.FILLED_CART, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/filled-cart" */ './filled-cart-block/frontend' + /* webpackChunkName: "cart-blocks/filled-cart" */ + './filled-cart-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: emptyCartMetadata, + metadata: metadata.EMPTY_CART, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/empty-cart" */ './empty-cart-block/frontend' + /* webpackChunkName: "cart-blocks/empty-cart" */ + './empty-cart-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: filledCartMetadata, + metadata: metadata.CART_ITEMS, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/filled-cart" */ './filled-cart-block/frontend' + /* webpackChunkName: "cart-blocks/cart-items" */ + './cart-items-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: emptyCartMetadata, + metadata: metadata.CART_LINE_ITEMS, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/empty-cart" */ './empty-cart-block/frontend' + /* webpackChunkName: "cart-blocks/cart-line-items" */ + './cart-line-items-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartItemsMetadata, + metadata: metadata.CART_TOTALS, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/items" */ './cart-items-block/frontend' + /* webpackChunkName: "cart-blocks/cart-totals" */ + './cart-totals-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartLineItemsMetadata, + metadata: metadata.CART_EXPRESS_PAYMENT, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/line-items" */ './cart-line-items-block/block' + /* webpackChunkName: "cart-blocks/cart-express-payment" */ + './cart-express-payment-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartTotalsMetadata, + metadata: metadata.PROCEED_TO_CHECKOUT, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/totals" */ './cart-totals-block/frontend' + /* webpackChunkName: "cart-blocks/proceed-to-checkout" */ + './proceed-to-checkout-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartOrderSummaryMetadata, + metadata: metadata.CART_ACCEPTED_PAYMENT_METHODS, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/order-summary" */ './cart-order-summary-block/frontend' + /* webpackChunkName: "cart-blocks/cart-accepted-payment-methods" */ + './cart-accepted-payment-methods-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartExpressPaymentMetadata, + metadata: metadata.CART_ORDER_SUMMARY, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/express-payment" */ './cart-express-payment-block/block' + /* webpackChunkName: "cart-blocks/cart-order-summary" */ + './cart-order-summary-block/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartProceedToCheckoutMetadata, + metadata: metadata.CART_ORDER_SUMMARY_SUBTOTAL, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/checkout-button" */ './proceed-to-checkout-block/frontend' + /* webpackChunkName: "cart-blocks/order-summary-subtotal" */ + './cart-order-summary-subtotal/frontend' ) ), } ); registerCheckoutBlock( { - metadata: cartAcceptedPaymentMethodsMetadata, + metadata: metadata.CART_ORDER_SUMMARY_FEE, component: lazy( () => import( - /* webpackChunkName: "cart-blocks/accepted-payment-methods" */ './cart-accepted-payment-methods-block/frontend' + /* webpackChunkName: "cart-blocks/order-summary-fee" */ + './cart-order-summary-fee/frontend' + ) + ), +} ); + +registerCheckoutBlock( { + metadata: metadata.CART_ORDER_SUMMARY_DISCOUNT, + component: lazy( () => + import( + /* webpackChunkName: "cart-blocks/order-summary-discount" */ + './cart-order-summary-discount/frontend' + ) + ), +} ); + +registerCheckoutBlock( { + metadata: metadata.CART_ORDER_SUMMARY_SHIPPING, + component: lazy( () => + import( + /* webpackChunkName: "cart-blocks/order-summary-shipping" */ + './cart-order-summary-shipping/frontend' + ) + ), +} ); + +registerCheckoutBlock( { + metadata: metadata.CART_ORDER_SUMMARY_COUPON_FORM, + component: lazy( () => + import( + /* webpackChunkName: "cart-blocks/order-summary-coupon-form" */ + './cart-order-summary-coupon-form/frontend' + ) + ), +} ); + +registerCheckoutBlock( { + metadata: metadata.CART_ORDER_SUMMARY_TAXES, + component: lazy( () => + import( + /* webpackChunkName: "cart-blocks/order-summary-taxes" */ + './cart-order-summary-taxes/frontend' + ) + ), +} ); + +registerCheckoutBlock( { + metadata: metadata.CART_ORDER_SUMMARY_HEADING, + component: lazy( () => + import( + /* webpackChunkName: "cart-blocks/order-summary-heading" */ + './cart-order-summary-heading/frontend' ) ), } ); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx index 22ac472d25a..0a6bd2dc7db 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx @@ -36,7 +36,10 @@ import type { TemplateArray } from '@wordpress/blocks'; */ import './inner-blocks'; import './styles/editor.scss'; -import { addClassToBody, useBlockPropsWithLocking } from '../shared'; +import { + addClassToBody, + useBlockPropsWithLocking, +} from '../cart-checkout/shared'; import { CheckoutBlockContext, CheckoutBlockControlsContext } from './context'; import type { Attributes } from './types'; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx index 968e30c537d..3c3cfb489b5 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx @@ -7,7 +7,7 @@ import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; * Internal dependencies */ import './editor.scss'; -import { useForcedLayout, getAllowedBlocks } from '../../shared'; +import { useForcedLayout, getAllowedBlocks } from '../../cart-checkout/shared'; export const AdditionalFields = ( { block, diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.tsx index 08233ffb9c9..fd3c14ee4b4 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.tsx @@ -6,7 +6,7 @@ import { useStoreCart } from '@woocommerce/base-context/hooks'; /** * Internal dependencies */ -import { CheckoutExpressPayment } from '../../../shared/payment-methods'; +import { CheckoutExpressPayment } from '../../../cart-checkout/payment-methods'; const Block = ( { className }: { className?: string } ): JSX.Element | null => { const { cartNeedsPayment } = useStoreCart(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx index 1ba7f7fb1ed..eb35dfef8df 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx @@ -11,7 +11,10 @@ import type { TemplateArray } from '@wordpress/blocks'; * Internal dependencies */ import { useCheckoutBlockControlsContext } from '../../context'; -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; import './style.scss'; export const Edit = ( { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx index f8f79eeafaa..c62979de8e7 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx @@ -11,7 +11,10 @@ import { useStoreCart } from '@woocommerce/base-context/hooks'; /** * Internal dependencies */ -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; import { OrderMetaSlotFill } from './slotfills'; export const Edit = ( { clientId }: { clientId: string } ): JSX.Element => { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx index 4e01615d390..a8554d856df 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx @@ -5,7 +5,7 @@ /** * Internal dependencies */ -import { PaymentMethods } from '../../../shared/payment-methods'; +import { PaymentMethods } from '../../../cart-checkout/payment-methods'; const Block = (): JSX.Element | null => { return ; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx index f7968f0d283..b8ce3c5f412 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx @@ -11,7 +11,10 @@ import type { TemplateArray } from '@wordpress/blocks'; * Internal dependencies */ import './style.scss'; -import { useForcedLayout, getAllowedBlocks } from '../../../shared'; +import { + useForcedLayout, + getAllowedBlocks, +} from '../../../cart-checkout/shared'; export const Edit = ( { clientId, diff --git a/plugins/woocommerce-blocks/bin/webpack-entries.js b/plugins/woocommerce-blocks/bin/webpack-entries.js index 8d933a8b1c2..6cd67227231 100644 --- a/plugins/woocommerce-blocks/bin/webpack-entries.js +++ b/plugins/woocommerce-blocks/bin/webpack-entries.js @@ -43,10 +43,11 @@ const blocks = { cart: {}, checkout: {}, 'mini-cart': { + customDir: 'cart-checkout/mini-cart', isExperimental: true, }, 'mini-cart-contents': { - customDir: 'mini-cart/mini-cart-contents', + customDir: 'cart-checkout/mini-cart-contents', isExperimental: true, }, 'single-product': { @@ -129,7 +130,7 @@ const entries = { reviews: './assets/js/blocks/reviews/frontend.js', ...getBlockEntries( 'frontend.{t,j}s{,x}' ), 'mini-cart-component': - './assets/js/blocks/mini-cart/component-frontend.tsx', + './assets/js/blocks/cart-checkout/mini-cart/component-frontend.tsx', }, payments: { 'wc-payment-method-cheque': diff --git a/plugins/woocommerce-blocks/docs/extensibility/checkout-flow-and-events.md b/plugins/woocommerce-blocks/docs/extensibility/checkout-flow-and-events.md index f5a4bc2db71..9197501365d 100644 --- a/plugins/woocommerce-blocks/docs/extensibility/checkout-flow-and-events.md +++ b/plugins/woocommerce-blocks/docs/extensibility/checkout-flow-and-events.md @@ -4,21 +4,21 @@ This document gives an overview of the flow for the checkout in the WooCommerce ## Table of Contents -- [General Concepts](#general-concepts) - - [Tracking flow through status](#tracking-flow-through-status) - - [`CheckoutProvider` Exposed Statuses](#checkoutprovider-exposed-statuses) - - [Special States:](#special-states) - - [`ShippingProvider` Exposed Statuses](#shippingprovider-exposed-statuses) - - [`PaymentMethodDataProvider` Exposed Statuses](#paymentmethoddataprovider-exposed-statuses) - - [Emitting Events](#emitting-events) - - [`onCheckoutValidationBeforeProcessing`](#oncheckoutvalidationbeforeprocessing) - - [`onPaymentProcessing`](#onpaymentprocessing) - - [`onCheckoutAfterProcessingWithSuccess`](#oncheckoutafterprocessingwithsuccess) - - [`onCheckoutAfterProcessingWithError`](#oncheckoutafterprocessingwitherror) - - [`onShippingRateSuccess`](#onshippingratesuccess) - - [`onShippingRateFail`](#onshippingratefail) - - [`onShippingRateSelectSuccess`](#onshippingrateselectsuccess) - - [`onShippingRateSelectFail`](#onshippingrateselectfail) +- [General Concepts](#general-concepts) + - [Tracking flow through status](#tracking-flow-through-status) + - [`CheckoutProvider` Exposed Statuses](#checkoutprovider-exposed-statuses) + - [Special States:](#special-states) + - [`ShippingProvider` Exposed Statuses](#shippingprovider-exposed-statuses) + - [`PaymentMethodDataProvider` Exposed Statuses](#paymentmethoddataprovider-exposed-statuses) + - [Emitting Events](#emitting-events) + - [`onCheckoutValidationBeforeProcessing`](#oncheckoutvalidationbeforeprocessing) + - [`onPaymentProcessing`](#onpaymentprocessing) + - [`onCheckoutAfterProcessingWithSuccess`](#oncheckoutafterprocessingwithsuccess) + - [`onCheckoutAfterProcessingWithError`](#oncheckoutafterprocessingwitherror) + - [`onShippingRateSuccess`](#onshippingratesuccess) + - [`onShippingRateFail`](#onshippingratefail) + - [`onShippingRateSelectSuccess`](#onshippingrateselectsuccess) + - [`onShippingRateSelectFail`](#onshippingrateselectfail) The architecture of the Checkout Block is derived from the following principles: @@ -182,7 +182,7 @@ const Component = () => { The properties of the object returned by this hook are: -- `isSuccessResponse`, `isErrorResponse` and `isFailResponse`: These are helper functions that receive a value and report via boolean whether the object is a type of response expected. For event emitters that receive responses from registered observers, a `type` property on the returned object from the observer indicates what type of response it is and event emitters will react according to that type. So for instance if an observer returned `{ type: 'success' }` the emitter could feed that to `isSuccessResponse` and it would return `true`. You can see an example of this being implemented for the payment processing emitted event [here](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/34e17c3622637dbe8b02fac47b5c9b9ebf9e3596/assets/js/base/context/shared/payment-methods/payment-method-data-context.js#L281-L307). +- `isSuccessResponse`, `isErrorResponse` and `isFailResponse`: These are helper functions that receive a value and report via boolean whether the object is a type of response expected. For event emitters that receive responses from registered observers, a `type` property on the returned object from the observer indicates what type of response it is and event emitters will react according to that type. So for instance if an observer returned `{ type: 'success' }` the emitter could feed that to `isSuccessResponse` and it would return `true`. You can see an example of this being implemented for the payment processing emitted event [here](https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/34e17c3622637dbe8b02fac47b5c9b9ebf9e3596/assets/js/base/context/cart-checkout/payment-methods/payment-method-data-context.js#L281-L307). - `noticeContexts`: This is an object containing properties referencing areas where notices can be targeted in the checkout. The object has the following properties: - `PAYMENTS`: This is a reference to the notice area in the payment methods step. - `EXPRESS_PAYMENTS`: This is a reference to the notice area in the express payment methods step. @@ -473,10 +473,11 @@ This event emitter is fired when a shipping rate selection is not being persiste This event emitter doesn't care about any registered observer response and will simply execute all registered observers passing them the current error status in the context. -## + +--- [We're hiring!](https://woocommerce.com/careers/) Come work with us! 🐞 Found a mistake, or have a suggestion? [Leave feedback about this document here.](https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/new?assignees=&labels=type%3A+documentation&template=--doc-feedback.md&title=Feedback%20on%20./docs/extensibility/checkout-flow-and-events.md) - + diff --git a/plugins/woocommerce-blocks/docs/testing/releases/440.md b/plugins/woocommerce-blocks/docs/testing/releases/440.md index 142e47dc4d2..f5a72e3611a 100644 --- a/plugins/woocommerce-blocks/docs/testing/releases/440.md +++ b/plugins/woocommerce-blocks/docs/testing/releases/440.md @@ -66,7 +66,7 @@ This test requires the browser dev tools to inspect rendered HTML. This test requires a code edit to force an error. 1. Chose Storefront and set the background to black and text to white. -2. Force an error to the Cart or Checkout block. Add on line 74 throw new Error( 'test' ); in `assets/js/blocks/cart/block.js` +2. Force an error to the Cart or Checkout block. Add on line 74 throw new Error( 'test' ); in `assets/js/blocks/cart-checkout/cart/block.js` 3. Notice the error text is now visible ## Feature plugin only diff --git a/plugins/woocommerce-blocks/package.json b/plugins/woocommerce-blocks/package.json index 10771d94dc3..9a73f84ef65 100644 --- a/plugins/woocommerce-blocks/package.json +++ b/plugins/woocommerce-blocks/package.json @@ -20,8 +20,8 @@ "./assets/js/blocks/checkout/inner-blocks/register-components.ts", "./assets/js/blocks/cart/inner-blocks/**/index.tsx", "./assets/js/blocks/cart/inner-blocks/register-components.ts", - "./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/**/index.tsx", - "./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts" + "./assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/**/index.tsx", + "./assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/register-components.ts" ], "repository": { "type": "git", diff --git a/plugins/woocommerce-blocks/packages/checkout/utils/extension-cart-update.ts b/plugins/woocommerce-blocks/packages/checkout/utils/extension-cart-update.ts index 70a00b2daab..c0af2a8b4b0 100644 --- a/plugins/woocommerce-blocks/packages/checkout/utils/extension-cart-update.ts +++ b/plugins/woocommerce-blocks/packages/checkout/utils/extension-cart-update.ts @@ -2,7 +2,8 @@ * External dependencies */ import { dispatch } from '@wordpress/data'; -import { ExtensionCartUpdateArgs, CartResponse } from '@woocommerce/types'; +import { CartResponse } from '@woocommerce/type-defs/cart-response'; +import { ExtensionCartUpdateArgs } from '@woocommerce/types'; /** * Internal dependencies diff --git a/plugins/woocommerce-blocks/tsconfig.json b/plugins/woocommerce-blocks/tsconfig.json index 1f6db79ecf9..4068973ad86 100644 --- a/plugins/woocommerce-blocks/tsconfig.json +++ b/plugins/woocommerce-blocks/tsconfig.json @@ -3,7 +3,7 @@ "include": [ "./assets/js/**/*", "./assets/js/blocks/**/block.json", - "./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/**/block.json", + "./assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/**/block.json", "./storybook/**/*" ], "exclude": [ "./assets/js/data" ],