- { ViewSwitcherComponent }
,
- },
- {
- view: 'woocommerce/empty-mini-cart-contents-block',
- label: __( 'Empty Mini Cart', 'woo-gutenberg-products-block' ),
- icon: ,
- },
-];
-
interface Props {
clientId: string;
}
-const Edit = ( { clientId }: Props ): ReactElement => {
+const Edit = ( { clientId, attributes }: Props ): ReactElement => {
const blockProps = useBlockProps( {
/**
* This is a workaround for the Site Editor to calculate the
@@ -63,10 +43,7 @@ const Edit = ( { clientId }: Props ): ReactElement => {
[ 'woocommerce/empty-mini-cart-contents-block', {}, [] ],
] as TemplateArray;
- const { currentView, component: ViewSwitcherComponent } = useViewSwitcher(
- clientId,
- views
- );
+ const { currentView } = attributes;
useForcedLayout( {
clientId,
@@ -130,7 +107,6 @@ const Edit = ( { clientId }: Props ): ReactElement => {
return (
- { ViewSwitcherComponent }
,
+ },
+ {
+ view: 'woocommerce/empty-mini-cart-contents-block',
+ label: __(
+ 'Empty Mini Cart',
+ 'woo-gutenberg-products-block'
+ ),
+ icon: ,
+ },
+ ],
+ },
},
example: {
attributes: {
diff --git a/plugins/woocommerce-blocks/assets/js/blocks/single-product/attributes.js b/plugins/woocommerce-blocks/assets/js/blocks/single-product/attributes.js
index 37f0395fa17..6a09d89aaee 100644
--- a/plugins/woocommerce-blocks/assets/js/blocks/single-product/attributes.js
+++ b/plugins/woocommerce-blocks/assets/js/blocks/single-product/attributes.js
@@ -5,7 +5,6 @@ export const blockAttributes = {
isPreview: {
type: 'boolean',
default: false,
- save: false,
},
/**
* The product ID to display.
diff --git a/plugins/woocommerce-blocks/assets/js/types/type-defs/contexts.js b/plugins/woocommerce-blocks/assets/js/types/type-defs/contexts.js
index 87efc3ab816..16f06d263db 100644
--- a/plugins/woocommerce-blocks/assets/js/types/type-defs/contexts.js
+++ b/plugins/woocommerce-blocks/assets/js/types/type-defs/contexts.js
@@ -140,15 +140,6 @@
* shouldCreateAccount property.
*/
-/**
- * @typedef {Object} EditorDataContext
- *
- * @property {boolean} isEditor Indicates whether in the editor context.
- * @property {number} currentPostId The post ID being edited.
- * @property {Object} previewData Object containing preview data for the editor.
- * @property {function(string):Object} getPreviewData Get data by name.
- */
-
/**
* @typedef {Object} AddToCartFormContext
*
diff --git a/plugins/woocommerce-blocks/package-lock.json b/plugins/woocommerce-blocks/package-lock.json
index 52922618ef4..b07d4e77708 100644
--- a/plugins/woocommerce-blocks/package-lock.json
+++ b/plugins/woocommerce-blocks/package-lock.json
@@ -71,7 +71,6 @@
"@types/react-dom": "18.0.9",
"@types/wordpress__block-editor": "6.0.6",
"@types/wordpress__blocks": "11.0.7",
- "@types/wordpress__compose": "4.0.1",
"@types/wordpress__core-data": "^2.4.5",
"@types/wordpress__data": "^6.0.1",
"@types/wordpress__data-controls": "2.2.0",
@@ -11338,51 +11337,6 @@
"re-resizable": "^6.4.0"
}
},
- "node_modules/@types/wordpress__compose": {
- "version": "4.0.1",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/lodash": "*",
- "@types/react": "*",
- "@wordpress/element": "^3.0.0"
- }
- },
- "node_modules/@types/wordpress__compose/node_modules/@types/react": {
- "version": "16.14.25",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/prop-types": "*",
- "@types/scheduler": "*",
- "csstype": "^3.0.2"
- }
- },
- "node_modules/@types/wordpress__compose/node_modules/@types/react-dom": {
- "version": "16.9.15",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/react": "^16"
- }
- },
- "node_modules/@types/wordpress__compose/node_modules/@wordpress/element": {
- "version": "3.2.0",
- "dev": true,
- "license": "GPL-2.0-or-later",
- "dependencies": {
- "@babel/runtime": "^7.13.10",
- "@types/react": "^16.9.0",
- "@types/react-dom": "^16.9.0",
- "@wordpress/escape-html": "^2.2.0",
- "lodash": "^4.17.21",
- "react": "^17.0.1",
- "react-dom": "^17.0.1"
- },
- "engines": {
- "node": ">=12"
- }
- },
"node_modules/@types/wordpress__core-data": {
"version": "2.4.5",
"dev": true,
@@ -57902,46 +57856,6 @@
"re-resizable": "^6.4.0"
}
},
- "@types/wordpress__compose": {
- "version": "4.0.1",
- "dev": true,
- "requires": {
- "@types/lodash": "*",
- "@types/react": "*",
- "@wordpress/element": "^3.0.0"
- },
- "dependencies": {
- "@types/react": {
- "version": "16.14.25",
- "dev": true,
- "requires": {
- "@types/prop-types": "*",
- "@types/scheduler": "*",
- "csstype": "^3.0.2"
- }
- },
- "@types/react-dom": {
- "version": "16.9.15",
- "dev": true,
- "requires": {
- "@types/react": "^16"
- }
- },
- "@wordpress/element": {
- "version": "3.2.0",
- "dev": true,
- "requires": {
- "@babel/runtime": "^7.13.10",
- "@types/react": "^16.9.0",
- "@types/react-dom": "^16.9.0",
- "@wordpress/escape-html": "^2.2.0",
- "lodash": "^4.17.21",
- "react": "^17.0.1",
- "react-dom": "^17.0.1"
- }
- }
- }
- },
"@types/wordpress__core-data": {
"version": "2.4.5",
"dev": true
diff --git a/plugins/woocommerce-blocks/package.json b/plugins/woocommerce-blocks/package.json
index 223dd247ae6..70270c93328 100644
--- a/plugins/woocommerce-blocks/package.json
+++ b/plugins/woocommerce-blocks/package.json
@@ -23,6 +23,7 @@
"./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/**/index.tsx",
"./assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/register-components.ts",
"./assets/js/blocks/cart-checkout-shared/sidebar-notices/index.tsx",
+ "./assets/js/blocks/cart-checkout-shared/view-switcher/index.tsx",
"./assets/js/blocks/filter-wrapper/register-components.ts",
"./assets/js/blocks/product-query/variations/**.tsx",
"./assets/js/blocks/product-query/index.tsx",
@@ -122,7 +123,6 @@
"@types/react-dom": "18.0.9",
"@types/wordpress__block-editor": "6.0.6",
"@types/wordpress__blocks": "11.0.7",
- "@types/wordpress__compose": "4.0.1",
"@types/wordpress__core-data": "^2.4.5",
"@types/wordpress__data": "^6.0.1",
"@types/wordpress__data-controls": "2.2.0",