This reverts commit 7921c3e5ba.
This commit is contained in:
Rua Haszard 2020-04-07 22:11:14 +12:00 committed by GitHub
parent dc8cc7681f
commit 3f0dcf00bc
3 changed files with 3 additions and 34 deletions

View File

@ -1,4 +1,3 @@
export * from './errors';
export * from './price';
export * from './address';
export * from './tracks';

View File

@ -1,23 +0,0 @@
/**
* External dependencies
*/
import { select } from '@wordpress/data';
// Stand-in wcTracks.recordEvent in case tracks is not available (for any reason).
window.wcTracks = window.wcTracks || {};
window.wcTracks.recordEvent = window.wcTracks.recordEvent || function() {};
export const recordEditorEvent = function( event, props ) {
// Force prefix - our editor events will be 'wcadmin_blocks_*'.
const blocksPrefix = 'blocks_';
const postData = select( 'core/editor' );
// If tracks is not available (e.g. opt-out), recordEvent is a no-op.
window.wcTracks.recordEvent( blocksPrefix + event, {
// Automatically include post id and post type props.
post_id: postData.getCurrentPostId(),
post_type: postData.getCurrentPostType(),
...props,
} );
};

View File

@ -23,7 +23,6 @@ import {
import { useSelect } from '@wordpress/data';
import { __experimentalCreateInterpolateElement } from 'wordpress-element';
import { getAdminLink } from '@woocommerce/settings';
import { recordEditorEvent } from '@woocommerce/base-utils';
/**
* Internal dependencies
@ -90,17 +89,11 @@ const BlockSettings = ( { attributes, setAttributes } ) => {
'woo-gutenberg-products-block'
) }
checked={ isShippingCalculatorEnabled }
onChange={ () => {
recordEditorEvent(
'cart_settings_shipping_calculator_toggle',
{
enabled: ! isShippingCalculatorEnabled,
}
);
onChange={ () =>
setAttributes( {
isShippingCalculatorEnabled: ! isShippingCalculatorEnabled,
} );
} }
} )
}
/>
<ToggleControl
label={ __(