Server IP : 104.21.14.103 / Your IP : 18.118.141.201 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart/ |
Upload File : |
/** * External dependencies */ import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; import { InnerBlocks } from '@wordpress/block-editor'; import { cart } from '@woocommerce/icons'; import { Icon } from '@wordpress/icons'; import { registerBlockType, createBlock } from '@wordpress/blocks'; /** * Internal dependencies */ import { Edit, Save } from './edit'; import './style.scss'; import { blockName, blockAttributes } from './attributes'; import './inner-blocks'; /** * Register and run the Cart block. */ const settings = { title: __( 'Cart', 'woocommerce' ), icon: { src: ( <Icon icon={ cart } className="wc-block-editor-components-block-icon" /> ), }, category: 'woocommerce', keywords: [ __( 'WooCommerce', 'woocommerce' ) ], description: __( 'Shopping cart.', 'woocommerce' ), supports: { align: [ 'wide' ], html: false, multiple: false, }, example: { attributes: { isPreview: true, }, viewportWidth: 800, }, attributes: blockAttributes, edit: Edit, save: Save, // Migrates v1 to v2 checkout. deprecated: [ { attributes: blockAttributes, save: ( { attributes } ) => { return ( <div className={ classnames( 'is-loading', attributes.className ) } > <InnerBlocks.Content /> </div> ); }, migrate: ( attributes, innerBlocks ) => { const { checkoutPageId, align } = attributes; return [ attributes, [ createBlock( 'woocommerce/filled-cart-block', { align }, [ createBlock( 'woocommerce/cart-items-block' ), createBlock( 'woocommerce/cart-totals-block', {}, [ createBlock( 'woocommerce/cart-order-summary-block', {} ), createBlock( 'woocommerce/cart-express-payment-block' ), createBlock( 'woocommerce/proceed-to-checkout-block', { checkoutPageId } ), createBlock( 'woocommerce/cart-accepted-payment-methods-block' ), ] ), ] ), createBlock( 'woocommerce/empty-cart-block', { align }, innerBlocks ), ], ]; }, isEligible: ( _, innerBlocks ) => { return ! innerBlocks.find( ( block ) => block.name === 'woocommerce/filled-cart-block' ); }, }, ], }; registerBlockType( blockName, settings );