Fix missing translations in inspector (https://github.com/woocommerce/woocommerce-blocks/pull/6737)
* Try registering the "cart taxes" inner block Registering server side. This example isn't working, but I'm pushing to share it and see what's wrong with this implementation. * Fix registering the cart taxes inner block issue * Update translation script loading * Remove unnecessary JS translation The translation should work fine by getting the title & description from the `block.json` file * Put back the initial code in the 'Cart Taxes' inner block We didn't provide the correct `block.json` file path server side, that's why the `metadata` wasn't correctly registered * Generate `block.json`files for inner blocks This is the first step on fixing the missing translations of `metadata` in `block.json` files * Set the folder name exactly the same as the inner block name We are doing this first test for the `Cart taxes` inner block. The `Block` & its containing folder need to have the same name for: - Consistency - We use the `Block` name to get the file Path * Update imports after folder renaming * Get block name directly from the JSON metadata Getting the block name from the JSON metadata is less error prone than extracting it from the file path. And no need to rename all our `inner-blocks` to get the correct `block.json` path * Revert folder naming change of `Cart taxes` inner block Since we are getting the `block` name directly from the `block.json` metadata instead of extracting it from the file path, there is no need to keep their names in sync anymore * Fix missing translations for the `Cart Subtotal` Block * Register only the client-side settings on the client When the block is registered on the server, you only need to register the client-side settings on the client using the same block’s name. See [docs](https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md#javascript-client-side). * Add schema validation to `block.json` Development is improved by using a defined schema definition file. Supported editors can provide help like tooltips, autocomplete, and schema validation. * Use the same `editor_script` as the parent block This prevents WordPress from generating script tags to inexistant inner blocks JS files * Add C&C inner blocks in Cart.php & Checkout.php This is a refactoring to keep the block types controller file less overloaded * Fix all Cart inner blocks missing translations * Create the "AbstractInnerBlock" class The "Inner Blocks" will use their parent's script, so no need to create new scripts for each one of them And, our "Inner Blocks" should always be registered using the metadata file * Update the "Inner Blocks" PHP classes * Fix PHP lint erros & update function description * Fix missing translations bug for all Checkout Inner Blocks * Update src/BlockTypes/Checkout.php Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com> * skip lazy loaded scripts Co-authored-by: Seghir Nadir <nadir.seghir@gmail.com>
This commit is contained in:
parent
0ee5dbbc18
commit
dc97e5af1e
|
@ -13,5 +13,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-totals-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ payment }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-accepted-payment-methods-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ payment }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-totals-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/filled-cart-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-items-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-items-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-line-items-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-totals-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -25,5 +25,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-order-summary-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ tag }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-order-summary-coupon-form-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ tag }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-order-summary-discount-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
|
|
|
@ -29,5 +29,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-order-summary-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-order-summary-heading-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-order-summary-shipping-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/cart-order-summary-subtotal-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
|
|
|
@ -30,5 +30,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/filled-cart-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-totals-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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/empty-cart-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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/filled-cart-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/cart-totals-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -9,9 +9,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
|||
*/
|
||||
import attributes from './attributes';
|
||||
import { Edit, Save } from './edit';
|
||||
import metadata from './block.json';
|
||||
|
||||
registerFeaturePluginBlockType( metadata, {
|
||||
registerFeaturePluginBlockType( 'woocommerce/proceed-to-checkout-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -9,9 +9,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
|||
*/
|
||||
import attributes from './attributes';
|
||||
import { Edit, Save } from './edit';
|
||||
import metadata from './block.json';
|
||||
|
||||
registerFeaturePluginBlockType( metadata, {
|
||||
registerFeaturePluginBlockType( 'woocommerce/checkout-actions-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-billing-address-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -9,18 +9,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: (
|
||||
<Icon
|
||||
icon={ atSymbol }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-contact-information-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ atSymbol }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-fields-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -25,5 +25,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-order-note-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -21,5 +21,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-totals-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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/checkout-order-summary-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ cart }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-cart-items-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ cart }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ tag }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-coupon-form-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ tag }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-discount-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-fee-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-shipping-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-subtotal-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
} );
|
||||
registerFeaturePluginBlockType(
|
||||
'woocommerce/checkout-order-summary-taxes-block',
|
||||
{
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
icon={ totals }
|
||||
className="wc-block-editor-components-block-icon"
|
||||
/>
|
||||
),
|
||||
},
|
||||
attributes,
|
||||
edit: Edit,
|
||||
save: Save,
|
||||
}
|
||||
);
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-shipping-address-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-shipping-methods-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -26,5 +26,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout-fields-block" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -7,9 +7,8 @@ import { registerFeaturePluginBlockType } from '@woocommerce/block-settings';
|
|||
* Internal dependencies
|
||||
*/
|
||||
import { Edit, Save } from './edit';
|
||||
import metadata from './block.json';
|
||||
|
||||
registerFeaturePluginBlockType( metadata, {
|
||||
registerFeaturePluginBlockType( 'woocommerce/checkout-terms-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
},
|
||||
"parent": [ "woocommerce/checkout" ],
|
||||
"textdomain": "woo-gutenberg-products-block",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 2
|
||||
}
|
||||
|
|
|
@ -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-totals-block', {
|
||||
icon: {
|
||||
src: (
|
||||
<Icon
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
const path = require( 'path' );
|
||||
const fs = require( 'fs' );
|
||||
const { kebabCase } = require( 'lodash' );
|
||||
const RemoveFilesPlugin = require( './remove-files-webpack-plugin' );
|
||||
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
||||
|
@ -262,14 +263,19 @@ const getMainConfig = ( options = {} ) => {
|
|||
{
|
||||
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/**' ],
|
||||
},
|
||||
},
|
||||
],
|
||||
} ),
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* AbstractInnerBlock class.
|
||||
*/
|
||||
abstract class AbstractInnerBlock extends AbstractBlock {
|
||||
|
||||
/**
|
||||
* Is this inner block lazy loaded? this helps us know if we should load its frontend script ot not.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $is_lazy_loaded = true;
|
||||
|
||||
/**
|
||||
* Registers the block type with WordPress using the metadata file.
|
||||
*
|
||||
* The registration using metadata is now recommended. And it's required for "Inner Blocks" to
|
||||
* fix the issue of missing translations in the inspector (in the Editor mode)
|
||||
*/
|
||||
protected function register_block_type() {
|
||||
$block_settings = [
|
||||
'render_callback' => $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 );
|
||||
}
|
||||
|
||||
}
|
|
@ -246,4 +246,35 @@ class Cart extends AbstractBlock {
|
|||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartAcceptedPaymentMethodsBlock class.
|
||||
*/
|
||||
class CartAcceptedPaymentMethodsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-accepted-payment-methods-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartExpressPaymentBlock class.
|
||||
*/
|
||||
class CartExpressPaymentBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-express-payment-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartItemsBlock class.
|
||||
*/
|
||||
class CartItemsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-items-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartLineItemsBlock class.
|
||||
*/
|
||||
class CartLineItemsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-line-items-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryBlock class.
|
||||
*/
|
||||
class CartOrderSummaryBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryCouponFormBlock class.
|
||||
*/
|
||||
class CartOrderSummaryCouponFormBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-coupon-form-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryDiscountBlock class.
|
||||
*/
|
||||
class CartOrderSummaryDiscountBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-discount-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryFeeBlock class.
|
||||
*/
|
||||
class CartOrderSummaryFeeBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-fee-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryHeadingBlock class.
|
||||
*/
|
||||
class CartOrderSummaryHeadingBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-heading-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryShippingBlock class.
|
||||
*/
|
||||
class CartOrderSummaryShippingBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-shipping-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummarySubtotalBlock class.
|
||||
*/
|
||||
class CartOrderSummarySubtotalBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-subtotal-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartOrderSummaryTaxesBlock class.
|
||||
*/
|
||||
class CartOrderSummaryTaxesBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-order-summary-taxes-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CartTotalsBlock class.
|
||||
*/
|
||||
class CartTotalsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'cart-totals-block';
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
use Automattic\WooCommerce\Blocks\Package;
|
||||
|
||||
/**
|
||||
* Checkout class.
|
||||
*
|
||||
|
@ -411,4 +413,38 @@ class Checkout extends AbstractBlock {
|
|||
$shared_chunks = [ 'cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend' ];
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutActionsBlock class.
|
||||
*/
|
||||
class CheckoutActionsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-actions-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutBillingAddressBlock class.
|
||||
*/
|
||||
class CheckoutBillingAddressBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-billing-address-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutContactInformationBlock class.
|
||||
*/
|
||||
class CheckoutContactInformationBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-contact-information-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutExpressPaymentBlock class.
|
||||
*/
|
||||
class CheckoutExpressPaymentBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-express-payment-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutFieldsBlock class.
|
||||
*/
|
||||
class CheckoutFieldsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-fields-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderNoteBlock class.
|
||||
*/
|
||||
class CheckoutOrderNoteBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-note-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryCartItemsBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryCartItemsBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-cart-items-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryCouponFormBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryCouponFormBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-coupon-form-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryDiscountBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryDiscountBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-discount-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryFeeBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryFeeBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-fee-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummaryShippingBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummaryShippingBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-shipping-block';
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
namespace Automattic\WooCommerce\Blocks\BlockTypes;
|
||||
|
||||
/**
|
||||
* CheckoutOrderSummarySubtotalBlock class.
|
||||
*/
|
||||
class CheckoutOrderSummarySubtotalBlock extends AbstractInnerBlock {
|
||||
/**
|
||||
* Block name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $block_name = 'checkout-order-summary-subtotal-block';
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue