2021-08-25 15:42:55 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
2022-07-29 19:40:03 +00:00
|
|
|
import { miniCartAlt } 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';
|
2022-05-30 08:45:15 +00:00
|
|
|
import { isFeaturePluginBuild } from '@woocommerce/block-settings';
|
2021-08-25 15:42:55 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import edit from './edit';
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
const settings: BlockConfiguration = {
|
2021-08-25 15:42:55 +00:00
|
|
|
apiVersion: 2,
|
|
|
|
title: __( 'Mini Cart', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: {
|
2021-12-10 14:32:44 +00:00
|
|
|
src: (
|
|
|
|
<Icon
|
2022-07-29 19:40:03 +00:00
|
|
|
icon={ miniCartAlt }
|
2021-12-10 14:32:44 +00:00
|
|
|
className="wc-block-editor-components-block-icon"
|
|
|
|
/>
|
|
|
|
),
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
category: 'woocommerce',
|
|
|
|
keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
|
|
|
|
description: __(
|
|
|
|
'Display a mini cart widget.',
|
|
|
|
'woo-gutenberg-products-block'
|
|
|
|
),
|
|
|
|
supports: {
|
|
|
|
html: false,
|
|
|
|
multiple: false,
|
2022-03-09 09:13:52 +00:00
|
|
|
color: true,
|
2022-05-30 08:45:15 +00:00
|
|
|
typography: {
|
|
|
|
fontSize: true,
|
|
|
|
...( isFeaturePluginBuild() && {
|
|
|
|
__experimentalFontFamily: true,
|
2022-08-05 18:15:10 +00:00
|
|
|
__experimentalFontWeight: true,
|
|
|
|
__experimentalSkipSerialization: true,
|
2022-05-30 08:45:15 +00:00
|
|
|
} ),
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
attributes: {
|
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
save: false,
|
|
|
|
},
|
2022-03-26 00:32:23 +00:00
|
|
|
addToCartBehaviour: {
|
|
|
|
type: 'string',
|
|
|
|
default: 'none',
|
|
|
|
},
|
2022-08-02 14:28:52 +00:00
|
|
|
hasHiddenPrice: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
edit,
|
|
|
|
|
|
|
|
save() {
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-04-08 08:51:21 +00:00
|
|
|
registerBlockType( 'woocommerce/mini-cart', settings );
|