diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/attributes.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/attributes.ts similarity index 55% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/attributes.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/attributes.ts index f9e1dc67749..c28a8218483 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/attributes.ts +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/attributes.ts @@ -5,40 +5,20 @@ import { getSetting } from '@woocommerce/settings'; export const blockName = 'woocommerce/checkout'; export const blockAttributes = { - isPreview: { - type: 'boolean', - default: false, - save: false, - }, hasDarkControls: { type: 'boolean', default: getSetting( 'hasDarkEditorStyleSupport', false ), }, - showCompanyField: { + showRateAfterTaxName: { type: 'boolean', - default: false, + default: getSetting( 'displayCartPricesIncludingTax', false ), }, - requireCompanyField: { - type: 'boolean', - default: false, - }, - allowCreateAccount: { - type: 'boolean', - default: false, - }, - showApartmentField: { - type: 'boolean', - default: true, - }, - showPhoneField: { - type: 'boolean', - default: true, - }, - requirePhoneField: { - type: 'boolean', - default: false, - }, - // Deprecated - here for v1 migration support +}; + +/** + * @deprecated here for v1 migration support + */ +export const deprecatedAttributes = { showOrderNotes: { type: 'boolean', default: true, @@ -55,8 +35,4 @@ export const blockAttributes = { type: 'number', default: 0, }, - showRateAfterTaxName: { - type: 'boolean', - default: getSetting( 'displayCartPricesIncludingTax', false ), - }, }; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.json new file mode 100644 index 00000000000..437677063f5 --- /dev/null +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.json @@ -0,0 +1,46 @@ +{ + "name": "woocommerce/checkout", + "version": "1.0.0", + "title": "Checkout", + "description": "Display a checkout form so your customers can submit orders.", + "category": "woocommerce", + "keywords": [ "WooCommerce" ], + "supports": { + "align": [ "wide" ], + "html": false, + "multiple": false + }, + "attributes": { + "isPreview": { + "type": "boolean", + "default": false, + "save": false + }, + "showCompanyField": { + "type": "boolean", + "default": false + }, + "requireCompanyField": { + "type": "boolean", + "default": false + }, + "allowCreateAccount": { + "type": "boolean", + "default": false + }, + "showApartmentField": { + "type": "boolean", + "default": true + }, + "showPhoneField": { + "type": "boolean", + "default": true + }, + "requirePhoneField": { + "type": "boolean", + "default": false + } + }, + "textdomain": "woo-gutenberg-products-block", + "apiVersion": 2 +} diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/constants.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/constants.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/constants.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/constants.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/checkout-order-error/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/checkout-order-error/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/context.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/context.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/context.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx similarity index 98% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx index b906718580c..f4b1cd1ca0a 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/edit.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/edit.tsx @@ -35,7 +35,10 @@ import type { TemplateArray } from '@wordpress/blocks'; * Internal dependencies */ 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/cart-checkout/checkout/empty-cart/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/empty-cart/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/empty-cart/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/empty-cart/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/empty-cart/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/empty-cart/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/empty-cart/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/empty-cart/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/additional-fields.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx similarity index 89% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/additional-fields.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/additional-fields.tsx index 968e30c537d..3c3cfb489b5 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/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/cart-checkout/checkout/form-step/attributes.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/attributes.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/attributes.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/attributes.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/form-step-block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/form-step-block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/form-step-heading.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-heading.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/form-step-heading.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/form-step-heading.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/form-step/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/form-step/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/index.tsx similarity index 82% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/index.tsx index b44d1b16231..15820a8581b 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/index.tsx +++ b/plugins/woocommerce-blocks/assets/js/blocks/checkout/index.tsx @@ -1,7 +1,6 @@ /** * External dependencies */ -import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; import { Icon, fields } from '@woocommerce/icons'; import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; @@ -11,11 +10,11 @@ import { BlockInstance, createBlock } from '@wordpress/blocks'; * Internal dependencies */ import { Edit, Save } from './edit'; -import { blockName, blockAttributes } from './attributes'; +import { blockAttributes, deprecatedAttributes } from './attributes'; import './inner-blocks'; +import metadata from './block.json'; const settings = { - title: __( 'Checkout', 'woo-gutenberg-products-block' ), icon: { src: ( ), }, - category: 'woocommerce', - keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ], - description: __( - 'Display a checkout form so your customers can submit orders.', - 'woo-gutenberg-products-block' - ), - supports: { - align: [ 'wide' ], - html: false, - multiple: false, + attributes: { + ...metadata.attributes, + ...blockAttributes, + ...deprecatedAttributes, }, - attributes: blockAttributes, - apiVersion: 2, edit: Edit, save: Save, // Migrates v1 to v2 checkout. deprecated: [ { - attributes: blockAttributes, + attributes: { + ...metadata.attributes, + ...blockAttributes, + ...deprecatedAttributes, + }, save( { attributes }: { attributes: { className: string } } ) { return (
{ const { cartNeedsPayment } = useStoreCart(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-express-payment-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/edit.tsx similarity index 95% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/edit.tsx rename to 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/cart-checkout/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/cart-checkout/checkout/inner-blocks/checkout-fields-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-fields-block/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-fields-block/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-note-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-note-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/attributes.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/attributes.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/attributes.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/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 similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-order-summary-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/attributes.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/attributes.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/attributes.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx similarity index 69% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.tsx index 191a060bca2..a8554d856df 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/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 '../../../payment-methods'; +import { PaymentMethods } from '../../../cart-checkout/payment-methods'; const Block = (): JSX.Element | null => { return ; diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-payment-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/attributes.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/attributes.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/attributes.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-address-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-address-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/attributes.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/attributes.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/attributes.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/attributes.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/block.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/no-shipping-placeholder/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-shipping-methods-block/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/constants.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/constants.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/constants.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/constants.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/edit.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/edit.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/test/edit.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/test/edit.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/test/frontend.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/frontend.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-terms-block/test/frontend.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/frontend.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/block.json b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/block.json similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/block.json rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/block.json diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/edit.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx similarity index 94% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/edit.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/edit.tsx index 95c35ba15d4..ad271e3f359 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/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'; import { useCheckoutBlockContext } from '../../context'; export const Edit = ( { diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/frontend.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/frontend.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/frontend.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/frontend.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/checkout-totals-block/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/checkout-totals-block/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/register-components.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/inner-blocks/register-components.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/inner-blocks/register-components.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/test/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/test/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/order-notes/test/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/order-notes/test/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/phone-number/index.tsx b/plugins/woocommerce-blocks/assets/js/blocks/checkout/phone-number/index.tsx similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/phone-number/index.tsx rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/phone-number/index.tsx diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/phone-number/test/index.js b/plugins/woocommerce-blocks/assets/js/blocks/checkout/phone-number/test/index.js similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/phone-number/test/index.js rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/phone-number/test/index.js diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/styles/editor.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/styles/editor.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/styles/editor.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/styles/editor.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/styles/style.scss b/plugins/woocommerce-blocks/assets/js/blocks/checkout/styles/style.scss similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/styles/style.scss rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/styles/style.scss diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/types.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/types.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/types.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/types.ts diff --git a/plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/utils.ts b/plugins/woocommerce-blocks/assets/js/blocks/checkout/utils.ts similarity index 100% rename from plugins/woocommerce-blocks/assets/js/blocks/cart-checkout/checkout/utils.ts rename to plugins/woocommerce-blocks/assets/js/blocks/checkout/utils.ts diff --git a/plugins/woocommerce-blocks/bin/webpack-entries.js b/plugins/woocommerce-blocks/bin/webpack-entries.js index 3c4d256809e..e6be19dcd5c 100644 --- a/plugins/woocommerce-blocks/bin/webpack-entries.js +++ b/plugins/woocommerce-blocks/bin/webpack-entries.js @@ -43,9 +43,7 @@ const blocks = { cart: { customDir: 'cart-checkout/cart', }, - checkout: { - customDir: 'cart-checkout/checkout', - }, + checkout: {}, 'mini-cart': { customDir: 'cart-checkout/mini-cart', isExperimental: true, diff --git a/plugins/woocommerce-blocks/src/Assets/Api.php b/plugins/woocommerce-blocks/src/Assets/Api.php index dd9612e272d..4aa20b89fba 100644 --- a/plugins/woocommerce-blocks/src/Assets/Api.php +++ b/plugins/woocommerce-blocks/src/Assets/Api.php @@ -60,6 +60,21 @@ class Api { return $this->package->get_url( $relative_path ); } + /** + * Get the path to a block's metadata + * + * @param string $block_name The block to get metadata for. + * + * @return string|boolean False if metadata file is not found for the block. + */ + public function get_block_metadata_path( $block_name ) { + $path_to_metadata_from_plugin_root = $this->package->get_path( 'assets/js/blocks/' . $block_name . '/block.json' ); + if ( ! file_exists( $path_to_metadata_from_plugin_root ) ) { + return false; + } + return $path_to_metadata_from_plugin_root; + } + /** * Get src, version and dependencies given a script relative src. * diff --git a/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php b/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php index 20841ffd398..280f04516fc 100644 --- a/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php +++ b/plugins/woocommerce-blocks/src/BlockTypes/AbstractBlock.php @@ -181,14 +181,30 @@ abstract class AbstractBlock { 'editor_script' => $this->get_block_type_editor_script( 'handle' ), 'editor_style' => $this->get_block_type_editor_style(), 'style' => $this->get_block_type_style(), - 'attributes' => $this->get_block_type_attributes(), - 'supports' => $this->get_block_type_supports(), ]; if ( isset( $this->api_version ) && '2' === $this->api_version ) { $block_settings['api_version'] = 2; } + $metadata_path = $this->asset_api->get_block_metadata_path( $this->block_name ); + // Prefer to register with metadata if the path is set in the block's class. + if ( ! empty( $metadata_path ) ) { + register_block_type( + $metadata_path, + $block_settings + ); + return; + } + + /* + * Insert attributes and supports if we're not registering the block using metadata. + * These are left unset until now and only added here because if they were set when registering with metadata, + * the attributes and supports from $block_settings would override the values from metadata. + */ + $block_settings['attributes'] = $this->get_block_type_attributes(); + $block_settings['supports'] = $this->get_block_type_supports(); + register_block_type( $this->get_block_type(), $block_settings diff --git a/plugins/woocommerce-blocks/tsconfig.json b/plugins/woocommerce-blocks/tsconfig.json index cef4cd07024..c3de0213c48 100644 --- a/plugins/woocommerce-blocks/tsconfig.json +++ b/plugins/woocommerce-blocks/tsconfig.json @@ -2,7 +2,7 @@ "extends": "./tsconfig.base.json", "include": [ "./assets/js/**/*", - "./assets/js/blocks/cart-checkout/checkout/inner-blocks/**/block.json", + "./assets/js/blocks/cart-checkout/checkout/**/block.json", "./assets/js/blocks/cart-checkout/mini-cart-contents/inner-blocks/**/block.json", "./storybook/**/*" ],