diff --git a/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/block.json b/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/block.json index 6549400fea7..39f3533446f 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/block.json @@ -13,5 +13,6 @@ }, "parent": [ "woocommerce/cart-totals-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/index.tsx index fb892298718..d69772b7ea9 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-accepted-payment-methods-block/index.tsx @@ -8,17 +8,19 @@ import { Icon, payment } from '@wordpress/icons'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-accepted-payment-methods-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.json b/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.json index cf536b5fd8d..f9bfc5cc7dc 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/block.json @@ -23,5 +23,6 @@ }, "parent": [ "woocommerce/cart-totals-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/index.tsx index e35ae7f5ff3..87bbc0bac7b 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-express-payment-block/index.tsx @@ -8,9 +8,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { +registerFeaturePluginBlockType( 'woocommerce/cart-express-payment-block', { icon: { src: ( - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-order-summary-coupon-form-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.json b/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.json index d407d1aa8f4..cfb3d6c6cb2 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/cart-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/index.tsx index ce580c46483..34bc4d8d00e 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-discount/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-order-summary-discount-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json b/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json index 42af475387f..27175d16395 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/cart-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/index.tsx index ce580c46483..a2c81308d84 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-fee/index.tsx @@ -9,9 +9,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { +registerFeaturePluginBlockType( 'woocommerce/cart-order-summary-fee-block', { icon: { src: ( - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-order-summary-heading-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.json b/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.json index 0cfb01ea522..e6a61cf07c1 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/block.json @@ -22,5 +22,6 @@ }, "parent": [ "woocommerce/cart-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/index.tsx index 72010b2cccc..a347933ee4e 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-shipping/index.tsx @@ -10,18 +10,20 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; */ import { Edit, Save } from './edit'; import attributes from './attributes'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - attributes, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-order-summary-shipping-block', + { + icon: { + src: ( + + ), + }, + attributes, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.json b/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.json index 264fadd033d..aee05b8d5b0 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/cart-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/index.tsx index ce580c46483..1f88b0c559e 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-subtotal/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/cart-order-summary-subtotal-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.json b/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.json index 4fa00fc7d32..289675f7405 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.json +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/cart-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/index.tsx b/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/index.tsx index 72010b2cccc..0ad9966f6dd 100644 --- a/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/index.tsx +++ b/assets/js/blocks/cart/inner-blocks/cart-order-summary-taxes/index.tsx @@ -10,9 +10,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; */ import { Edit, Save } from './edit'; import attributes from './attributes'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { +registerFeaturePluginBlockType( 'woocommerce/cart-order-summary-taxes-block', { icon: { src: ( - ), - }, - attributes, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-contact-information-block', + { + icon: { + src: ( + + ), + }, + attributes, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.json index 58b9807dd4d..6c14d00aefe 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/block.json @@ -27,5 +27,6 @@ }, "parent": [ "woocommerce/checkout-fields-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx index e35ae7f5ff3..8b9e69c4b9d 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/index.tsx @@ -8,9 +8,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { +registerFeaturePluginBlockType( 'woocommerce/checkout-express-payment-block', { icon: { src: ( - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-cart-items-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.json index e02fd415ed3..0aac398caf1 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/block.json @@ -25,5 +25,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/index.tsx index 5badfa89545..28441776d35 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-coupon-form/index.tsx @@ -8,17 +8,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-coupon-form-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.json index 6807f1ae351..25a304e8e04 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/index.tsx index ce580c46483..fb206bd1ee6 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-discount/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-discount-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.json index bca03d2d395..9201ac68b5c 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/index.tsx index ce580c46483..419b02a8e2c 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-fee/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-fee-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json index f7bfd5a4b97..b9350d81b50 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/block.json @@ -22,5 +22,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/index.tsx index ce580c46483..4303d250fbd 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-shipping/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-shipping-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/block.json index 395ded30be5..cc0eaab1ae8 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/index.tsx index ce580c46483..b20dfefaf4c 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-subtotal/index.tsx @@ -9,17 +9,19 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; * Internal dependencies */ import { Edit, Save } from './edit'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-subtotal-block', + { + icon: { + src: ( + + ), + }, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json index 69f733ceb9f..24658d4ba11 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/block.json @@ -26,5 +26,6 @@ }, "parent": [ "woocommerce/checkout-order-summary-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/index.tsx index 72010b2cccc..a0af3bcf598 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-order-summary-taxes/index.tsx @@ -10,18 +10,20 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; */ import { Edit, Save } from './edit'; import attributes from './attributes'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { - icon: { - src: ( - - ), - }, - attributes, - edit: Edit, - save: Save, -} ); +registerFeaturePluginBlockType( + 'woocommerce/checkout-order-summary-taxes-block', + { + icon: { + src: ( + + ), + }, + attributes, + edit: Edit, + save: Save, + } +); diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json b/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json index 4ed9a01d442..94169b163c8 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json +++ b/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/block.json @@ -23,5 +23,6 @@ }, "parent": [ "woocommerce/checkout-fields-block" ], "textdomain": "woo-gutenberg-products-block", + "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2 } diff --git a/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx b/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx index 2384e91a1f8..136c00f1b52 100644 --- a/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx +++ b/assets/js/blocks/checkout/inner-blocks/checkout-payment-block/index.tsx @@ -9,9 +9,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings'; */ import { Edit, Save } from './edit'; import attributes from './attributes'; -import metadata from './block.json'; -registerFeaturePluginBlockType( metadata, { +registerFeaturePluginBlockType( 'woocommerce/checkout-payment-block', { icon: { src: ( { { from: './assets/js/blocks/**/block.json', to( { absoluteFilename } ) { - const blockName = absoluteFilename + /** + * Getting the block name from the JSON metadata is less error prone + * than extracting it from the file path. + */ + const JSONFile = fs.readFileSync( + path.resolve( __dirname, absoluteFilename ) + ); + const metadata = JSON.parse( JSONFile.toString() ); + const blockName = metadata.name .split( '/' ) - .at( -2 ); + .at( 1 ); return `./${ blockName }/block.json`; }, - globOptions: { - ignore: [ '**/inner-blocks/**' ], - }, }, ], } ), diff --git a/src/BlockTypes/AbstractInnerBlock.php b/src/BlockTypes/AbstractInnerBlock.php new file mode 100644 index 00000000000..3b992d5f77b --- /dev/null +++ b/src/BlockTypes/AbstractInnerBlock.php @@ -0,0 +1,57 @@ + $this->get_block_type_render_callback(), + 'editor_style' => $this->get_block_type_editor_style(), + 'style' => $this->get_block_type_style(), + ]; + + 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. + register_block_type_from_metadata( + $metadata_path, + $block_settings + ); + } + + /** + * For lazy loaded inner blocks, we don't want to enqueue the script but rather leave it for webpack to do that. + * + * @see $this->register_block_type() + * @param string $key Data to get, or default to everything. + * @return array|string|null + */ + protected function get_block_type_script( $key = null ) { + + if ( $this->is_lazy_loaded ) { + return null; + } + + return parent::get_block_type_script( $key ); + } + +} diff --git a/src/BlockTypes/Cart.php b/src/BlockTypes/Cart.php index 15aad499b34..dc0c831b2ed 100644 --- a/src/BlockTypes/Cart.php +++ b/src/BlockTypes/Cart.php @@ -246,4 +246,35 @@ protected function register_block_type_assets() { $this->register_chunk_translations( array_merge( $chunks, $vendor_chunks ) ); } + + /** + * Get list of Cart block & its inner-block types. + * + * @return array; + */ + public static function get_cart_block_types() { + $block_types = []; + + if ( Package::feature()->is_feature_plugin_build() ) { + $block_types[] = 'Cart'; + $block_types[] = 'CartOrderSummaryTaxesBlock'; + $block_types[] = 'CartOrderSummarySubtotalBlock'; + $block_types[] = 'FilledCartBlock'; + $block_types[] = 'EmptyCartBlock'; + $block_types[] = 'CartTotalsBlock'; + $block_types[] = 'CartItemsBlock'; + $block_types[] = 'CartLineItemsBlock'; + $block_types[] = 'CartOrderSummaryBlock'; + $block_types[] = 'CartExpressPaymentBlock'; + $block_types[] = 'ProceedToCheckoutBlock'; + $block_types[] = 'CartAcceptedPaymentMethodsBlock'; + $block_types[] = 'CartOrderSummaryCouponFormBlock'; + $block_types[] = 'CartOrderSummaryDiscountBlock'; + $block_types[] = 'CartOrderSummaryFeeBlock'; + $block_types[] = 'CartOrderSummaryHeadingBlock'; + $block_types[] = 'CartOrderSummaryShippingBlock'; + } + + return $block_types; + } } diff --git a/src/BlockTypes/CartAcceptedPaymentMethodsBlock.php b/src/BlockTypes/CartAcceptedPaymentMethodsBlock.php new file mode 100644 index 00000000000..e92e38b678f --- /dev/null +++ b/src/BlockTypes/CartAcceptedPaymentMethodsBlock.php @@ -0,0 +1,14 @@ +register_chunk_translations( array_merge( $chunks, $vendor_chunks, $shared_chunks ) ); } + + /** + * Get list of Checkout block & its inner-block types. + * + * @return array; + */ + public static function get_checkout_block_types() { + $block_types = []; + + if ( Package::feature()->is_feature_plugin_build() ) { + $block_types[] = 'Checkout'; + $block_types[] = 'CheckoutActionsBlock'; + $block_types[] = 'CheckoutBillingAddressBlock'; + $block_types[] = 'CheckoutContactInformationBlock'; + $block_types[] = 'CheckoutExpressPaymentBlock'; + $block_types[] = 'CheckoutFieldsBlock'; + $block_types[] = 'CheckoutOrderNoteBlock'; + $block_types[] = 'CheckoutOrderSummaryBlock'; + $block_types[] = 'CheckoutOrderSummaryCartItemsBlock'; + $block_types[] = 'CheckoutOrderSummaryCouponFormBlock'; + $block_types[] = 'CheckoutOrderSummaryDiscountBlock'; + $block_types[] = 'CheckoutOrderSummaryFeeBlock'; + $block_types[] = 'CheckoutOrderSummaryShippingBlock'; + $block_types[] = 'CheckoutOrderSummarySubtotalBlock'; + $block_types[] = 'CheckoutOrderSummaryTaxesBlock'; + $block_types[] = 'CheckoutPaymentBlock'; + $block_types[] = 'CheckoutShippingAddressBlock'; + $block_types[] = 'CheckoutShippingMethodsBlock'; + $block_types[] = 'CheckoutTermsBlock'; + $block_types[] = 'CheckoutTotalsBlock'; + } + + return $block_types; + } } diff --git a/src/BlockTypes/CheckoutActionsBlock.php b/src/BlockTypes/CheckoutActionsBlock.php new file mode 100644 index 00000000000..67e132b8720 --- /dev/null +++ b/src/BlockTypes/CheckoutActionsBlock.php @@ -0,0 +1,14 @@ +is_feature_plugin_build() ) { - $block_types[] = 'Checkout'; - $block_types[] = 'Cart'; - } + $block_types = array_merge( $block_types, Cart::get_cart_block_types(), Checkout::get_checkout_block_types() ); if ( Package::feature()->is_experimental_build() ) { $block_types[] = 'SingleProduct';