2020-03-13 13:41:59 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2022-12-22 14:35:24 +00:00
|
|
|
import { __ } from '@wordpress/i18n';
|
2021-04-22 11:37:27 +00:00
|
|
|
import { getSetting } from '@woocommerce/settings';
|
2022-12-22 14:35:24 +00:00
|
|
|
import { Icon } from '@wordpress/icons';
|
|
|
|
import { filledCart, removeCart } from '@woocommerce/icons';
|
2020-03-13 13:41:59 +00:00
|
|
|
|
2021-10-25 14:46:34 +00:00
|
|
|
export const blockName = 'woocommerce/cart';
|
|
|
|
export const blockAttributes = {
|
2020-04-08 15:03:39 +00:00
|
|
|
isPreview: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: false,
|
2022-12-22 14:35:24 +00:00
|
|
|
},
|
|
|
|
currentView: {
|
|
|
|
type: 'string',
|
|
|
|
default: 'woocommerce/filled-cart-block',
|
|
|
|
source: 'readonly', // custom source to prevent saving to post content
|
|
|
|
},
|
|
|
|
editorViews: {
|
|
|
|
type: 'object',
|
|
|
|
default: [
|
|
|
|
{
|
|
|
|
view: 'woocommerce/filled-cart-block',
|
|
|
|
label: __( 'Filled Cart', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: <Icon icon={ filledCart } />,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
view: 'woocommerce/empty-cart-block',
|
|
|
|
label: __( 'Empty Cart', 'woo-gutenberg-products-block' ),
|
|
|
|
icon: <Icon icon={ removeCart } />,
|
|
|
|
},
|
|
|
|
],
|
2020-04-08 15:03:39 +00:00
|
|
|
},
|
2021-10-25 14:46:34 +00:00
|
|
|
hasDarkControls: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: getSetting( 'hasDarkEditorStyleSupport', false ),
|
|
|
|
},
|
|
|
|
// Deprecated - here for v1 migration support
|
2020-03-13 13:41:59 +00:00
|
|
|
isShippingCalculatorEnabled: {
|
|
|
|
type: 'boolean',
|
2021-04-22 11:37:27 +00:00
|
|
|
default: getSetting( 'isShippingCalculatorEnabled', true ),
|
2020-03-13 13:41:59 +00:00
|
|
|
},
|
2020-03-17 10:30:52 +00:00
|
|
|
checkoutPageId: {
|
|
|
|
type: 'number',
|
|
|
|
default: 0,
|
|
|
|
},
|
2021-05-17 14:00:57 +00:00
|
|
|
showRateAfterTaxName: {
|
|
|
|
type: 'boolean',
|
|
|
|
default: true,
|
|
|
|
},
|
2021-10-25 16:42:31 +00:00
|
|
|
align: {
|
|
|
|
type: 'string',
|
|
|
|
},
|
2020-03-13 13:41:59 +00:00
|
|
|
};
|