diff options
author | Steve Klebanoff <steve@0xproject.com> | 2018-12-04 08:52:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-04 08:52:06 +0800 |
commit | 703cea6173f72ceb6969bc17bda0735b86477522 (patch) | |
tree | f73fb94c3de9e2718bcec5f5d0e0c736c1d11b28 /packages/instant/src | |
parent | 2601d16efbb1e85eadca459e5dc64e78099e738a (diff) | |
parent | 1107b84949ea74467393edc1496c153f5ce7f64d (diff) | |
download | dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar.gz dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar.bz2 dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar.lz dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar.xz dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.tar.zst dexon-sol-tools-703cea6173f72ceb6969bc17bda0735b86477522.zip |
Merge pull request #1370 from 0xProject/feature/instant/explicitly-enable-heap-dev
[instant] Must explicitly specify when want to send to heap when developing
Diffstat (limited to 'packages/instant/src')
-rw-r--r-- | packages/instant/src/constants.ts | 1 | ||||
-rw-r--r-- | packages/instant/src/util/analytics.ts | 12 |
2 files changed, 8 insertions, 5 deletions
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts index 1194cf881..2439c7349 100644 --- a/packages/instant/src/constants.ts +++ b/packages/instant/src/constants.ts @@ -19,6 +19,7 @@ export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6); export const DEFAULT_ESTIMATED_TRANSACTION_TIME_MS = ONE_MINUTE_MS * 2; export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info'; export const HEAP_ANALYTICS_ID = process.env.HEAP_ANALYTICS_ID; +export const HEAP_ENABLED = process.env.HEAP_ENABLED; export const COINBASE_API_BASE_URL = 'https://api.coinbase.com/v2'; export const PROGRESS_STALL_AT_WIDTH = '95%'; export const PROGRESS_FINISH_ANIMATION_TIME_MS = 200; diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts index e625824ef..760ec8b5c 100644 --- a/packages/instant/src/util/analytics.ts +++ b/packages/instant/src/util/analytics.ts @@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer'; import { BigNumber } from '@0x/utils'; import * as _ from 'lodash'; -import { INSTANT_DISCHARGE_TARGET } from '../constants'; +import { HEAP_ENABLED, INSTANT_DISCHARGE_TARGET } from '../constants'; import { AffiliateInfo, Asset, @@ -16,15 +16,17 @@ import { import { EventProperties, heapUtil } from './heap'; -let isDisabled = false; +let isDisabledViaConfig = false; export const disableAnalytics = (shouldDisableAnalytics: boolean) => { - isDisabled = shouldDisableAnalytics; + isDisabledViaConfig = shouldDisableAnalytics; }; export const evaluateIfEnabled = (fnCall: () => void) => { - if (isDisabled) { + if (isDisabledViaConfig) { return; } - fnCall(); + if (HEAP_ENABLED) { + fnCall(); + } }; enum EventNames { |