Fix Gutenberg 3.7 compatibility: Remove APIProvider (https://github.com/woocommerce/woocommerce-admin/pull/390)
* Remove APIProvider Unused in the project, and deprecated in gutenberg * Remove wp-api dependency
This commit is contained in:
parent
fbd91266f0
commit
ed1b847067
|
@ -2,8 +2,6 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { APIProvider } from '@wordpress/components';
|
||||
import { pick } from 'lodash';
|
||||
import { render } from '@wordpress/element';
|
||||
import { Provider as SlotFillProvider } from 'react-slot-fill';
|
||||
|
||||
|
@ -14,13 +12,8 @@ import './stylesheets/_embedded.scss';
|
|||
import { EmbedLayout } from './layout';
|
||||
|
||||
render(
|
||||
<APIProvider
|
||||
{ ...wpApiSettings }
|
||||
{ ...pick( wp.api, [ 'postTypeRestBaseMapping', 'taxonomyRestBaseMapping' ] ) }
|
||||
>
|
||||
<SlotFillProvider>
|
||||
<EmbedLayout />
|
||||
</SlotFillProvider>
|
||||
</APIProvider>,
|
||||
</SlotFillProvider>,
|
||||
document.getElementById( 'woocommerce-embedded-root' )
|
||||
);
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
/**
|
||||
* External dependencies
|
||||
*/
|
||||
import { APIProvider } from '@wordpress/components';
|
||||
import { pick } from 'lodash';
|
||||
import { render } from '@wordpress/element';
|
||||
import { Provider as SlotFillProvider } from 'react-slot-fill';
|
||||
|
||||
|
@ -15,13 +13,8 @@ import { PageLayout } from './layout';
|
|||
import 'store';
|
||||
|
||||
render(
|
||||
<APIProvider
|
||||
{ ...wpApiSettings }
|
||||
{ ...pick( wp.api, [ 'postTypeRestBaseMapping', 'taxonomyRestBaseMapping' ] ) }
|
||||
>
|
||||
<SlotFillProvider>
|
||||
<PageLayout />
|
||||
</SlotFillProvider>
|
||||
</APIProvider>,
|
||||
</SlotFillProvider>,
|
||||
document.getElementById( 'root' )
|
||||
);
|
||||
|
|
|
@ -55,13 +55,11 @@ function wc_admin_register_script() {
|
|||
$content = 'wp.i18n.setLocaleData( ' . json_encode( $locale_data ) . ', "wc-admin" );';
|
||||
wp_add_inline_script( 'wc-components', $content, 'before' );
|
||||
|
||||
wp_enqueue_script( 'wp-api' );
|
||||
|
||||
// Add Tracks script to the DOM if tracking is opted in
|
||||
// Add Tracks script to the DOM if tracking is opted in.
|
||||
$tracking_enabled = 'yes' === get_option( 'woocommerce_allow_tracking', 'no' );
|
||||
if( $tracking_enabled ) {
|
||||
if ( $tracking_enabled ) {
|
||||
$tracking_script = "var wc_tracking_script = document.createElement( 'script' );\n";
|
||||
$tracking_script .= "wc_tracking_script.src = '//stats.wp.com/w.js';\n"; //TODO Version/cache buster
|
||||
$tracking_script .= "wc_tracking_script.src = '//stats.wp.com/w.js';\n"; // TODO Version/cache buster.
|
||||
$tracking_script .= "wc_tracking_script.type = 'text/javascript';\n";
|
||||
$tracking_script .= "wc_tracking_script.async = true;\n";
|
||||
$tracking_script .= "wc_tracking_script.defer = true;\n";
|
||||
|
|
Loading…
Reference in New Issue