Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix missing translations in inspector — Cross-Sells Block #7616

Merged
merged 5 commits into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
},
"parent": [ "woocommerce/cart-items-block" ],
"textdomain": "woo-gutenberg-products-block",
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { registerBlockType } from '@wordpress/blocks';
* Internal dependencies
*/
import { Edit, Save } from './edit';
import metadata from './block.json';

registerBlockType( metadata, {
registerBlockType( 'woocommerce/cart-cross-sells-block', {
icon: {
src: (
<Icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@
},
"parent": [ "woocommerce/cart-cross-sells-block" ],
"textdomain": "woo-gutenberg-products-block",
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { registerBlockType } from '@wordpress/blocks';
* Internal dependencies
*/
import { Edit, Save } from './edit';
import metadata from './block.json';

registerBlockType( metadata, {
registerBlockType( 'woocommerce/cart-cross-sells-products-block', {
icon: {
src: (
<Icon
Expand Down
21 changes: 10 additions & 11 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2198,26 +2198,25 @@
Type &apos;{ icon: { src: Element; }; edit: ({ attributes, }: { attributes: { className: string; }; }) =&gt; Element; save: () =&gt; Element; }&apos; is missing the following properties from type &apos;Pick&lt;Block&lt;{ className: string; }&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;: title, category, attributes" source="TS2769" />
</file>
<file name="assets/js/blocks/cart/inner-blocks/cart-cross-sells-block/index.tsx">
<error line="13" column="20" severity="error" message="No overload matches this call.
<error line="12" column="1" severity="error" message="No overload matches this call.
Overload 1 of 2, &apos;(metadata: BlockConfiguration&lt;{}&gt;, settings?: Partial&lt;BlockConfiguration&lt;{}&gt;&gt; | undefined): Block&lt;{}&gt; | undefined&apos;, gave the following error.
Argument of type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{}&gt;&apos;.
Property &apos;attributes&apos; is missing in type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; but required in type &apos;Pick&lt;Block&lt;{}&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;.
Argument of type &apos;string&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{}&gt;&apos;.
Type &apos;string&apos; is not assignable to type &apos;Pick&lt;Block&lt;{}&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;.
Overload 2 of 2, &apos;(name: string, settings: BlockConfiguration&lt;{}&gt;): Block&lt;{}&gt; | undefined&apos;, gave the following error.
Argument of type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; is not assignable to parameter of type &apos;string&apos;." source="TS2769" />
Argument of type &apos;{ icon: { src: JSX.Element; }; edit: () =&gt; JSX.Element; save: () =&gt; JSX.Element; }&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{}&gt;&apos;.
Type &apos;{ icon: { src: Element; }; edit: () =&gt; Element; save: () =&gt; Element; }&apos; is missing the following properties from type &apos;Pick&lt;Block&lt;{}&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;: title, category, attributes" source="TS2769" />
</file>
<file name="assets/js/blocks/cart/cart-cross-sells-product-list/cart-cross-sells-product.tsx">
<error line="51" column="8" severity="error" message="Type &apos;{}&apos; is missing the following properties from type &apos;BlockAttributes&apos;: productId, align" source="TS2739" />
</file>
<file name="assets/js/blocks/cart/inner-blocks/cart-cross-sells-products/index.tsx">
<error line="13" column="20" severity="error" message="No overload matches this call.
<error line="12" column="1" severity="error" message="No overload matches this call.
Overload 1 of 2, &apos;(metadata: BlockConfiguration&lt;{ className?: string; columns: number; }&gt;, settings?: Partial&lt;BlockConfiguration&lt;{ className?: string; columns: number; }&gt;&gt; | undefined): Block&lt;...&gt; | undefined&apos;, gave the following error.
Argument of type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; lock: boolean; }; attributes: { ...; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{ className?: string; columns: number; }&gt;&apos;.
Type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; lock: boolean; }; attributes: { ...; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; is not assignable to type &apos;Partial&lt;Omit&lt;Block&lt;{ className?: string; columns: number; }&gt;, &quot;icon&quot;&gt;&gt;&apos;.
The types of &apos;attributes.columns&apos; are incompatible between these types.
Type &apos;{ type: string; default: number; }&apos; is not assignable to type &apos;BlockAttribute&lt;number&gt;&apos;.
Type &apos;{ type: string; default: number; }&apos; is missing the following properties from type &apos;Query&lt;number&gt;&apos;: source, selector, query
Argument of type &apos;string&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{ className?: string; columns: number; }&gt;&apos;.
Type &apos;string&apos; is not assignable to type &apos;Pick&lt;Block&lt;{ className?: string; columns: number; }&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;.
Overload 2 of 2, &apos;(name: string, settings: BlockConfiguration&lt;{ className?: string; columns: number; }&gt;): Block&lt;{ className?: string; columns: number; }&gt; | undefined&apos;, gave the following error.
Argument of type &apos;{ name: string; version: string; title: string; description: string; category: string; supports: { align: boolean; html: boolean; multiple: boolean; reusable: boolean; inserter: boolean; lock: boolean; }; attributes: { ...; }; parent: string[]; textdomain: string; apiVersion: number; }&apos; is not assignable to parameter of type &apos;string&apos;." source="TS2769" />
Argument of type &apos;{ icon: { src: JSX.Element; }; edit: ({ attributes, setAttributes }: Props) =&gt; JSX.Element; save: () =&gt; JSX.Element; }&apos; is not assignable to parameter of type &apos;BlockConfiguration&lt;{ className?: string; columns: number; }&gt;&apos;.
Type &apos;{ icon: { src: Element; }; edit: ({ attributes, setAttributes }: Props) =&gt; Element; save: () =&gt; Element; }&apos; is missing the following properties from type &apos;Pick&lt;Block&lt;{ className?: string; columns: number; }&gt;, &quot;title&quot; | &quot;category&quot; | &quot;attributes&quot;&gt;&apos;: title, category, attributes" source="TS2769" />
</file>
<file name="assets/js/blocks/cart/inner-blocks/cart-totals-block/index.tsx">
<error line="12" column="1" severity="error" message="No overload matches this call.
Expand Down
2 changes: 2 additions & 0 deletions src/BlockTypes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ public static function get_cart_block_types() {
'CartOrderSummaryFeeBlock',
'CartOrderSummaryHeadingBlock',
'CartOrderSummaryShippingBlock',
'CartCrossSellsBlock',
'CartCrossSellsProductsBlock',
];
}
}
14 changes: 14 additions & 0 deletions src/BlockTypes/CartCrossSellsBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Automattic\WooCommerce\Blocks\BlockTypes;

/**
* CartCrossSellsBlock class.
*/
class CartCrossSellsBlock extends AbstractInnerBlock {
/**
* Block name.
*
* @var string
*/
protected $block_name = 'cart-cross-sells-block';
}
14 changes: 14 additions & 0 deletions src/BlockTypes/CartCrossSellsProductsBlock.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Automattic\WooCommerce\Blocks\BlockTypes;

/**
* CartCrossSellsProductsBlock class.
*/
class CartCrossSellsProductsBlock extends AbstractInnerBlock {
/**
* Block name.
*
* @var string
*/
protected $block_name = 'cart-cross-sells-products-block';
}