Server IP : 104.21.14.103 / Your IP : 3.145.155.91 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 { getValidBlockAttributes } from '@woocommerce/base-utils'; import { Children, cloneElement, isValidElement } from '@wordpress/element'; import { useStoreCart } from '@woocommerce/base-context'; import { getRegisteredBlockComponents } from '@woocommerce/blocks-registry'; import { renderParentBlock } from '@woocommerce/atomic-utils'; /** * Internal dependencies */ import './inner-blocks/register-components'; import Block from './block'; import { blockName, blockAttributes } from './attributes'; const getProps = ( el ) => { return { attributes: getValidBlockAttributes( blockAttributes, !! el ? el.dataset : {} ), }; }; const Wrapper = ( { children } ) => { // we need to pluck out receiveCart. // eslint-disable-next-line no-unused-vars const { extensions, receiveCart, ...cart } = useStoreCart(); return Children.map( children, ( child ) => { if ( isValidElement( child ) ) { const componentProps = { extensions, cart, }; return cloneElement( child, componentProps ); } return child; } ); }; renderParentBlock( { Block, blockName, selector: '.wp-block-woocommerce-cart', getProps, blockMap: getRegisteredBlockComponents( blockName ), blockWrapper: Wrapper, } );