/* tslint:disable */ /** * External dependencies */ import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; import { useBlockProps, InnerBlocks, InspectorControls, } from '@wordpress/block-editor'; import BlockErrorBoundary from '@woocommerce/base-components/block-error-boundary'; import { EditorProvider, CartProvider } from '@woocommerce/base-context'; import { previewCart } from '@woocommerce/resource-previews'; import { SlotFillProvider } from '@woocommerce/blocks-checkout'; /** * Internal dependencies */ import './inner-blocks'; import './editor.scss'; import { addClassToBody, useBlockPropsWithLocking, useForcedLayout, BlockSettings, } from '../cart-checkout-shared'; import '../cart-checkout-shared/sidebar-notices'; import '../cart-checkout-shared/view-switcher'; import { CartBlockContext } from './context'; // This is adds a class to body to signal if the selected block is locked addClassToBody(); // Array of allowed block names. const ALLOWED_BLOCKS = [ 'woocommerce/filled-cart-block', 'woocommerce/empty-cart-block', ]; export const Edit = ( { className, attributes, setAttributes, clientId } ) => { const { hasDarkControls, currentView } = attributes; const defaultTemplate = [ [ 'woocommerce/filled-cart-block', {}, [] ], [ 'woocommerce/empty-cart-block', {}, [] ], ]; const blockProps = useBlockPropsWithLocking( { className: classnames( className, 'wp-block-woocommerce-cart', { 'is-editor-preview': attributes.isPreview, } ), } ); useForcedLayout( { clientId, registeredBlocks: ALLOWED_BLOCKS, defaultTemplate, } ); return (