Merge pull request woocommerce/woocommerce-admin#267 from woocommerce/fix/gutenberg-3-4-fatal
Fix for gutenberg 3.4
This commit is contained in:
commit
d7e9e30296
|
@ -3,9 +3,8 @@
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { __ } from '@wordpress/i18n';
|
import { __ } from '@wordpress/i18n';
|
||||||
import { ToggleControl, withAPIData } from '@wordpress/components';
|
import { ToggleControl } from '@wordpress/components';
|
||||||
import { Component } from '@wordpress/element';
|
import { Component } from '@wordpress/element';
|
||||||
import { compose } from '@wordpress/compose';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -63,9 +62,8 @@ class StorePerformance extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { orders, products } = this.props;
|
const totalOrders = 10;
|
||||||
const totalOrders = ( orders.data && orders.data.length ) || 0;
|
const totalProducts = 1000;
|
||||||
const totalProducts = ( products.data && products.data.length ) || 0;
|
|
||||||
const { showCustomers, showProducts, showOrders } = this.state;
|
const { showCustomers, showProducts, showOrders } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -108,9 +106,4 @@ class StorePerformance extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default compose( [
|
export default StorePerformance;
|
||||||
withAPIData( () => ( {
|
|
||||||
orders: '/wc/v3/orders?status=processing',
|
|
||||||
products: '/wc/v3/products',
|
|
||||||
} ) ),
|
|
||||||
] )( StorePerformance );
|
|
||||||
|
|
|
@ -3,8 +3,7 @@
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
import { __, _n, sprintf } from '@wordpress/i18n';
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
||||||
import { Button, withAPIData } from '@wordpress/components';
|
import { Button } from '@wordpress/components';
|
||||||
import { compose } from '@wordpress/compose';
|
|
||||||
import { Fragment } from '@wordpress/element';
|
import { Fragment } from '@wordpress/element';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { noop } from 'lodash';
|
import { noop } from 'lodash';
|
||||||
|
@ -112,8 +111,4 @@ OrdersPanel.propTypes = {
|
||||||
orders: PropTypes.object.isRequired,
|
orders: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default compose( [
|
export default OrdersPanel;
|
||||||
withAPIData( () => ( {
|
|
||||||
orders: '/wc/v3/orders',
|
|
||||||
} ) ),
|
|
||||||
] )( OrdersPanel );
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ class Header extends Component {
|
||||||
sprintf(
|
sprintf(
|
||||||
__( '%1$s ‹ %2$s — WooCommerce', 'wc-admin' ),
|
__( '%1$s ‹ %2$s — WooCommerce', 'wc-admin' ),
|
||||||
documentTitle,
|
documentTitle,
|
||||||
wpApiSettings.schema.name
|
wcSettings.siteTitle
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ function wc_admin_register_script() {
|
||||||
wp_add_inline_script( WC_ADMIN_APP, $content, 'before' );
|
wp_add_inline_script( WC_ADMIN_APP, $content, 'before' );
|
||||||
|
|
||||||
wp_enqueue_script( 'wp-api' );
|
wp_enqueue_script( 'wp-api' );
|
||||||
gutenberg_extend_wp_api_backbone_client();
|
|
||||||
|
|
||||||
// Settings and variables can be passed here for access in the app
|
// Settings and variables can be passed here for access in the app
|
||||||
$settings = array(
|
$settings = array(
|
||||||
|
@ -48,6 +47,7 @@ function wc_admin_register_script() {
|
||||||
'dow' => get_option( 'start_of_week', 0 ),
|
'dow' => get_option( 'start_of_week', 0 ),
|
||||||
),
|
),
|
||||||
'orderStatuses' => wc_get_order_statuses(),
|
'orderStatuses' => wc_get_order_statuses(),
|
||||||
|
'siteTitle' => get_bloginfo( 'name' ),
|
||||||
);
|
);
|
||||||
|
|
||||||
wp_add_inline_script(
|
wp_add_inline_script(
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue