Change disabled analytics name, add assertion, and always set
This commit is contained in:
@@ -37,7 +37,7 @@ export interface ZeroExInstantProviderOptionalProps {
|
||||
additionalAssetMetaDataMap: ObjectMap<AssetMetaData>;
|
||||
networkId: Network;
|
||||
affiliateInfo: AffiliateInfo;
|
||||
disableAnalyticsTracking: boolean;
|
||||
shouldDisableAnalyticsTracking: boolean;
|
||||
}
|
||||
|
||||
export class ZeroExInstantProvider extends React.Component<ZeroExInstantProviderProps> {
|
||||
@@ -125,9 +125,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
|
||||
this._flashErrorIfWrongNetwork();
|
||||
|
||||
// Analytics
|
||||
if (this.props.disableAnalyticsTracking) {
|
||||
disableAnalytics();
|
||||
}
|
||||
disableAnalytics(this.props.shouldDisableAnalyticsTracking || false);
|
||||
analytics.addEventProperties({
|
||||
embeddedHost: window.location.host,
|
||||
embeddedUrl: window.location.href,
|
||||
|
||||
@@ -35,6 +35,9 @@ export const render = (props: ZeroExInstantOverlayProps, selector: string = DEFA
|
||||
if (!_.isUndefined(props.provider)) {
|
||||
assert.isWeb3Provider('props.provider', props.provider);
|
||||
}
|
||||
if (!_.isUndefined(props.shouldDisableAnalyticsTracking)) {
|
||||
assert.isBoolean('props.shouldDisableAnalyticsTracking', props.shouldDisableAnalyticsTracking);
|
||||
}
|
||||
assert.isString('selector', selector);
|
||||
const appendToIfExists = document.querySelector(selector);
|
||||
assert.assert(!_.isNull(appendToIfExists), `Could not find div with selector: ${selector}`);
|
||||
|
||||
@@ -2,12 +2,12 @@ import { ObjectMap } from '@0x/types';
|
||||
|
||||
import { heapUtil } from './heap';
|
||||
|
||||
let disabled = false;
|
||||
export const disableAnalytics = () => {
|
||||
disabled = true;
|
||||
let isDisabled = false;
|
||||
export const disableAnalytics = (shouldDisableAnalytics: boolean) => {
|
||||
isDisabled = shouldDisableAnalytics;
|
||||
};
|
||||
export const evaluateIfEnabled = (fnCall: () => void) => {
|
||||
if (disabled) {
|
||||
if (isDisabled) {
|
||||
return;
|
||||
}
|
||||
fnCall();
|
||||
|
||||
Reference in New Issue
Block a user