2021-11-19 11:47:48 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
import { Icon, cart } from '@woocommerce/icons';
|
|
|
|
import { registerExperimentalBlockType } from '@woocommerce/block-settings';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-12-07 14:07:53 +00:00
|
|
|
import edit, { Save as save } from './edit';
|
2021-12-10 11:11:59 +00:00
|
|
|
import { blockName } from './attributes';
|
2021-12-07 14:07:53 +00:00
|
|
|
import './inner-blocks';
|
2021-11-19 11:47:48 +00:00
|
|
|
|
|
|
|
const settings = {
|
|
|
|
apiVersion: 2,
|
|
|
|
title: __( 'Mini Cart Contents', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: {
|
2021-12-10 14:32:44 +00:00
|
|
|
src: (
|
|
|
|
<Icon
|
|
|
|
srcElement={ cart }
|
|
|
|
className="wc-block-editor-components-block-icon"
|
|
|
|
/>
|
|
|
|
),
|
2021-11-19 11:47:48 +00:00
|
|
|
},
|
|
|
|
category: 'woocommerce',
|
|
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
|
|
description: __(
|
|
|
|
'Display a mini cart widget.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
supports: {
|
|
|
|
align: false,
|
|
|
|
html: false,
|
|
|
|
multiple: false,
|
|
|
|
reusable: false,
|
|
|
|
inserter: false,
|
2021-12-07 14:07:53 +00:00
|
|
|
__experimentalExposeControlsToChildren: true,
|
2021-11-19 11:47:48 +00:00
|
|
|
},
|
|
|
|
attributes: {
|
2021-12-10 11:11:59 +00:00
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
save: false,
|
|
|
|
},
|
2021-11-19 11:47:48 +00:00
|
|
|
lock: {
|
|
|
|
type: 'object',
|
|
|
|
default: {
|
|
|
|
remove: true,
|
|
|
|
move: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
edit,
|
2021-12-07 14:07:53 +00:00
|
|
|
save,
|
2021-11-19 11:47:48 +00:00
|
|
|
};
|
|
|
|
|
2021-12-10 11:11:59 +00:00
|
|
|
registerExperimentalBlockType( blockName, settings );
|