2019-12-03 13:57:56 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { withRestApiHydration } from '@woocommerce/block-hocs';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2019-12-10 15:41:57 +00:00
|
|
|
import FullCart from './full-cart';
|
2019-12-03 13:57:56 +00:00
|
|
|
import renderFrontend from '../../../utils/render-frontend.js';
|
|
|
|
|
2019-12-10 15:41:57 +00:00
|
|
|
const isCartEmpty = false; // @todo check if the cart has some products
|
|
|
|
const selector = '.wp-block-woocommerce-cart';
|
|
|
|
|
|
|
|
if ( ! isCartEmpty ) {
|
|
|
|
const getProps = () => {
|
|
|
|
return {
|
|
|
|
attributes: {},
|
|
|
|
};
|
2019-12-03 13:57:56 +00:00
|
|
|
};
|
|
|
|
|
2019-12-10 15:41:57 +00:00
|
|
|
renderFrontend( selector, withRestApiHydration( FullCart ), getProps );
|
|
|
|
} else {
|
|
|
|
const containers = document.querySelectorAll( selector );
|
|
|
|
|
|
|
|
if ( containers.length ) {
|
|
|
|
// Use Array.forEach for IE11 compatibility.
|
|
|
|
Array.prototype.forEach.call( containers, ( el ) => {
|
|
|
|
el.classList.remove( 'is-loading' );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
}
|