2021-11-19 11:47:48 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2023-04-14 07:48:55 +00:00
|
|
|
import { cart } from '@woocommerce/icons';
|
2022-02-01 16:54:38 +00:00
|
|
|
import { Icon } from '@wordpress/icons';
|
2022-04-08 13:47:19 +00:00
|
|
|
import { registerBlockType } from '@wordpress/blocks';
|
|
|
|
import type { BlockConfiguration } from '@wordpress/blocks';
|
2023-03-10 08:25:24 +00:00
|
|
|
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
2021-11-19 11:47:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2021-12-07 14:07:53 +00:00
|
|
|
import edit, { Save as save } from './edit';
|
2023-04-14 07:48:55 +00:00
|
|
|
import { blockName, attributes } from './attributes';
|
2021-12-07 14:07:53 +00:00
|
|
|
import './inner-blocks';
|
2021-11-19 11:47:48 +00:00
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
const settings: BlockConfiguration = {
|
2021-11-19 11:47:48 +00:00
|
|
|
apiVersion: 2,
|
2023-12-12 22:12:36 +00:00
|
|
|
title: __( 'Mini-Cart Contents', 'woocommerce' ),
|
2021-11-19 11:47:48 +00:00
|
|
|
icon: {
|
2021-12-10 14:32:44 +00:00
|
|
|
src: (
|
|
|
|
<Icon
|
2022-02-01 16:54:38 +00:00
|
|
|
icon={ cart }
|
2021-12-10 14:32:44 +00:00
|
|
|
className="wc-block-editor-components-block-icon"
|
|
|
|
/>
|
|
|
|
),
|
2021-11-19 11:47:48 +00:00
|
|
|
},
|
|
|
|
category: 'woocommerce',
|
2023-12-12 22:12:36 +00:00
|
|
|
keywords: [ __( 'WooCommerce', 'woocommerce' ) ],
|
2023-12-12 23:05:20 +00:00
|
|
|
description: __( 'Display a Mini-Cart widget.', 'woocommerce' ),
|
2021-11-19 11:47:48 +00:00
|
|
|
supports: {
|
|
|
|
align: false,
|
|
|
|
html: false,
|
|
|
|
multiple: false,
|
|
|
|
reusable: false,
|
|
|
|
inserter: false,
|
2021-12-20 07:57:55 +00:00
|
|
|
color: {
|
2022-01-21 17:39:04 +00:00
|
|
|
link: true,
|
2021-12-20 07:57:55 +00:00
|
|
|
},
|
2022-05-05 10:31:57 +00:00
|
|
|
lock: false,
|
2023-03-10 08:25:24 +00:00
|
|
|
...( isFeaturePluginBuild() && {
|
|
|
|
__experimentalBorder: {
|
|
|
|
color: true,
|
|
|
|
width: true,
|
|
|
|
},
|
|
|
|
} ),
|
2021-11-19 11:47:48 +00:00
|
|
|
},
|
2023-04-14 07:48:55 +00:00
|
|
|
attributes,
|
2021-11-19 11:47:48 +00:00
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
edit,
|
2021-12-07 14:07:53 +00:00
|
|
|
save,
|
2021-11-19 11:47:48 +00:00
|
|
|
};
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
registerBlockType( blockName, settings );
|