2020-03-27 20:42:58 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2024-08-09 15:57:24 +00:00
|
|
|
import { createRoot } from '@wordpress/element';
|
2020-04-16 23:58:36 +00:00
|
|
|
import { withPluginsHydration } from '@woocommerce/data';
|
|
|
|
|
2020-03-27 20:42:58 +00:00
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import ShippingBanner from './shipping-banner';
|
2022-01-06 12:53:30 +00:00
|
|
|
import { getAdminSetting } from '~/utils/admin-settings';
|
2020-03-27 20:42:58 +00:00
|
|
|
|
|
|
|
const metaBox = document.getElementById( 'wc-admin-shipping-banner-root' );
|
|
|
|
const args =
|
|
|
|
( metaBox.dataset.args && JSON.parse( metaBox.dataset.args ) ) || {};
|
|
|
|
|
|
|
|
// Render the header.
|
2020-07-28 02:32:58 +00:00
|
|
|
const HydratedShippingBanner = withPluginsHydration( {
|
2022-01-06 12:53:30 +00:00
|
|
|
...getAdminSetting( 'plugins' ),
|
|
|
|
jetpackStatus: getAdminSetting( 'dataEndpoints', {} ).jetpackStatus,
|
2020-07-28 02:32:58 +00:00
|
|
|
} )( ShippingBanner );
|
2024-08-09 15:57:24 +00:00
|
|
|
|
|
|
|
createRoot( metaBox ).render(
|
|
|
|
<HydratedShippingBanner itemsCount={ args.items } />
|
|
|
|
);
|