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,
|
2023-05-11 12:52:03 +00:00
|
|
|
title: __( 'Mini-Cart', 'woo-gutenberg-products-block' ),
|
2021-08-25 15:42:55 +00:00
|
|
|
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: __(
|
2023-05-11 12:52:03 +00:00
|
|
|
'Display a button for shoppers to quickly view their cart.',
|
2021-08-25 15:42:55 +00:00
|
|
|
'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,
|
2022-05-30 08:45:15 +00:00
|
|
|
} ),
|
|
|
|
},
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
example: {
|
|
|
|
attributes: {
|
|
|
|
isPreview: true,
|
2023-02-28 17:40:06 +00:00
|
|
|
className: 'wc-block-mini-cart--preview',
|
2021-08-25 15:42:55 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
attributes: {
|
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: 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,
|
|
|
|
},
|
2023-03-14 14:59:46 +00:00
|
|
|
cartAndCheckoutRenderStyle: {
|
|
|
|
type: 'string',
|
|
|
|
default: 'hidden',
|
|
|
|
},
|
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 );
|