Revert "Record a tracks event when merchant toggles cart shipping calculator: (https://github.com/woocommerce/woocommerce-blocks/pull/1975)" (https://github.com/woocommerce/woocommerce-blocks/pull/2136)
This reverts commit 7921c3e5ba
.
This commit is contained in:
parent
dc8cc7681f
commit
3f0dcf00bc
|
@ -1,4 +1,3 @@
|
|||
export * from './errors';
|
||||
export * from './price';
|
||||
export * from './address';
|
||||
export * from './tracks';
|
||||
|
|
|
@ -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,
|
||||
} );
|
||||
};
|
|
@ -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={ __(
|
||||
|
|
Loading…
Reference in New Issue