2018-04-17 23:51:48 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
2019-07-23 03:26:46 +00:00
|
|
|
import '@wordpress/notices';
|
2018-05-18 17:31:08 +00:00
|
|
|
import { render } from '@wordpress/element';
|
2018-04-17 23:51:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
2018-08-06 15:30:43 +00:00
|
|
|
import './stylesheets/_index.scss';
|
2019-09-24 15:55:39 +00:00
|
|
|
import { PageLayout, EmbedLayout, PrimaryLayout as NoticeArea } from './layout';
|
2018-11-29 15:57:49 +00:00
|
|
|
import 'wc-api/wp-data-store';
|
2018-05-15 15:06:15 +00:00
|
|
|
|
2019-09-24 15:55:39 +00:00
|
|
|
const appRoot = document.getElementById( 'root' );
|
|
|
|
|
|
|
|
if ( appRoot ) {
|
|
|
|
render( <PageLayout />, appRoot );
|
|
|
|
} else {
|
|
|
|
const embeddedRoot = document.getElementById( 'woocommerce-embedded-root' );
|
|
|
|
|
|
|
|
// Render the header.
|
|
|
|
render( <EmbedLayout />, embeddedRoot );
|
|
|
|
|
|
|
|
embeddedRoot.classList.remove( 'is-embed-loading' );
|
|
|
|
|
|
|
|
// Render notices just above the WP content div.
|
|
|
|
const wpBody = document.getElementById( 'wpbody-content' );
|
|
|
|
const wrap = wpBody.querySelector( '.wrap' );
|
|
|
|
const noticeContainer = document.createElement( 'div' );
|
|
|
|
|
|
|
|
render(
|
|
|
|
<div className="woocommerce-layout">
|
|
|
|
<NoticeArea />
|
|
|
|
</div>,
|
|
|
|
wpBody.insertBefore( noticeContainer, wrap )
|
|
|
|
);
|
|
|
|
}
|