Server IP : 172.67.158.161 / Your IP : 3.146.221.231 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/thread-self/root/home/giankuin/sieuthiweb.com.vn/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/blocks/cart-checkout/cart/ |
Upload File : |
/** * External dependencies */ import { withRestApiHydration, withStoreCartApiHydration, } from '@woocommerce/block-hocs'; import { __ } from '@wordpress/i18n'; import { StoreNoticesProvider } from '@woocommerce/base-context'; import { CURRENT_USER_IS_ADMIN } from '@woocommerce/block-settings'; import { __experimentalCreateInterpolateElement } from 'wordpress-element'; import { renderFrontend, getValidBlockAttributes, } from '@woocommerce/base-utils'; /** * Internal dependencies */ import Block from './block.js'; import blockAttributes from './attributes'; const reloadPage = () => void window.location.reload( true ); /** * Wrapper component to supply API data and show empty cart view as needed. * * @param {*} props */ const CartFrontend = ( props ) => { return ( <StoreNoticesProvider context="wc/cart"> <Block { ...props } /> </StoreNoticesProvider> ); }; const getProps = ( el ) => { return { emptyCart: el.innerHTML, attributes: getValidBlockAttributes( blockAttributes, el.dataset ), }; }; const getErrorBoundaryProps = () => { return { header: __( 'Something went wrong…', 'woocommerce' ), text: __experimentalCreateInterpolateElement( __( 'The cart has encountered an unexpected error. <button>Try reloading the page</button>. If the error persists, please get in touch with us so we can assist.', 'woocommerce' ), { button: ( <button className="wc-block-link-button" onClick={ reloadPage } /> ), } ), showErrorMessage: CURRENT_USER_IS_ADMIN, }; }; renderFrontend( { selector: '.wp-block-woocommerce-cart', Block: withStoreCartApiHydration( withRestApiHydration( CartFrontend ) ), getProps, getErrorBoundaryProps, } );