aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/instant/package.json7
-rw-r--r--packages/instant/public/external.css4
-rw-r--r--packages/instant/src/components/ui/input.tsx4
-rw-r--r--packages/instant/src/components/zero_ex_instant_provider.tsx3
-rw-r--r--packages/instant/src/constants.ts7
-rw-r--r--packages/instant/src/util/analytics.ts4
-rw-r--r--packages/instant/src/util/asset.ts4
-rw-r--r--packages/instant/src/util/error_reporter.ts23
8 files changed, 37 insertions, 19 deletions
diff --git a/packages/instant/package.json b/packages/instant/package.json
index 7d0bf6bec..9303276b4 100644
--- a/packages/instant/package.json
+++ b/packages/instant/package.json
@@ -10,7 +10,7 @@
"scripts": {
"build": "webpack --mode production",
"build:ci": "yarn build",
- "dev": "webpack-dev-server --mode development",
+ "dev": "dotenv webpack-dev-server -- --mode development",
"lint": "tslint --format stylish --project .",
"test": "jest",
"test:coverage": "jest --coverage",
@@ -24,10 +24,7 @@
},
"config": {
"postpublish": {
- "assets": [
- "packages/instant/umd/instant.js",
- "packages/instant/umd/instant.js.map"
- ]
+ "assets": ["packages/instant/umd/instant.js", "packages/instant/umd/instant.js.map"]
}
},
"repository": {
diff --git a/packages/instant/public/external.css b/packages/instant/public/external.css
index cab11112a..21278577e 100644
--- a/packages/instant/public/external.css
+++ b/packages/instant/public/external.css
@@ -15,6 +15,10 @@ input {
height: 100px;
}
+input::-webkit-input-placeholder {
+ color: #b4b4b4 !important;
+}
+
div {
padding: 3px;
}
diff --git a/packages/instant/src/components/ui/input.tsx b/packages/instant/src/components/ui/input.tsx
index 863c970ef..62c70f9e1 100644
--- a/packages/instant/src/components/ui/input.tsx
+++ b/packages/instant/src/components/ui/input.tsx
@@ -29,8 +29,8 @@ export const Input =
outline: none;
border: none;
&::placeholder {
- color: ${props => props.theme[props.fontColor || 'white']};
- opacity: 0.5;
+ color: ${props => props.theme[props.fontColor || 'white']} !important;
+ opacity: 0.5 !important;
}
}
`;
diff --git a/packages/instant/src/components/zero_ex_instant_provider.tsx b/packages/instant/src/components/zero_ex_instant_provider.tsx
index 6d7ed0b87..7ae27de23 100644
--- a/packages/instant/src/components/zero_ex_instant_provider.tsx
+++ b/packages/instant/src/components/zero_ex_instant_provider.tsx
@@ -41,7 +41,8 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
);
// merge the additional additionalAssetMetaDataMap with our default map
const completeAssetMetaDataMap = {
- ...props.additionalAssetMetaDataMap,
+ // Make sure the passed in assetDatas are lower case
+ ..._.mapKeys(props.additionalAssetMetaDataMap || {}, (value, key) => key.toLowerCase()),
...defaultState.assetMetaDataMap,
};
// construct the final state
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 506348092..f83eb4ac7 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -15,6 +15,7 @@ export const GWEI_IN_WEI = new BigNumber(1000000000);
export const ONE_SECOND_MS = 1000;
export const ONE_MINUTE_MS = ONE_SECOND_MS * 60;
export const GIT_SHA = process.env.GIT_SHA;
+export const NODE_ENV = process.env.NODE_ENV;
export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15;
@@ -28,14 +29,12 @@ 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;
-export const HOST_DOMAINS = [
+export const HOST_DOMAINS_EXTERNAL = [
'0x-instant-staging.s3-website-us-east-1.amazonaws.com',
'0x-instant-dogfood.s3-website-us-east-1.amazonaws.com',
- 'localhost',
- '127.0.0.1',
- '0.0.0.0',
'instant.0xproject.com',
];
+export const HOST_DOMAINS_LOCAL = ['localhost', '127.0.0.1', '0.0.0.0'];
export const ROLLBAR_CLIENT_TOKEN = process.env.ROLLBAR_CLIENT_TOKEN;
export const ROLLBAR_ENABLED = process.env.ROLLBAR_ENABLED;
export const INSTANT_DISCHARGE_TARGET = process.env.INSTANT_DISCHARGE_TARGET as
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 6da37bedb..6da52db16 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 { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NPM_PACKAGE_VERSION } from '../constants';
+import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NODE_ENV, NPM_PACKAGE_VERSION } from '../constants';
import {
AffiliateInfo,
Asset,
@@ -156,7 +156,7 @@ export const analytics = {
affiliateFeePercent,
selectedAssetName: selectedAsset ? selectedAsset.metaData.name : 'none',
selectedAssetData: selectedAsset ? selectedAsset.assetData : 'none',
- instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${process.env.NODE_ENV}`,
+ instantEnvironment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
};
return eventOptions;
},
diff --git a/packages/instant/src/util/asset.ts b/packages/instant/src/util/asset.ts
index 08f3642e3..13f84ef74 100644
--- a/packages/instant/src/util/asset.ts
+++ b/packages/instant/src/util/asset.ts
@@ -26,7 +26,7 @@ export const assetUtils = {
return;
}
return {
- assetData,
+ assetData: assetData.toLowerCase(),
metaData,
};
},
@@ -36,7 +36,7 @@ export const assetUtils = {
network: Network,
): Asset => {
return {
- assetData,
+ assetData: assetData.toLowerCase(),
metaData: assetUtils.getMetaDataOrThrow(assetData, assetMetaDataMap, network),
};
},
diff --git a/packages/instant/src/util/error_reporter.ts b/packages/instant/src/util/error_reporter.ts
index b1824eaf9..8d7481684 100644
--- a/packages/instant/src/util/error_reporter.ts
+++ b/packages/instant/src/util/error_reporter.ts
@@ -1,17 +1,34 @@
import { logUtils } from '@0x/utils';
import * as _ from 'lodash';
-import { GIT_SHA, HOST_DOMAINS, INSTANT_DISCHARGE_TARGET, ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENABLED } from '../constants';
+import {
+ GIT_SHA,
+ HOST_DOMAINS_EXTERNAL,
+ HOST_DOMAINS_LOCAL,
+ INSTANT_DISCHARGE_TARGET,
+ NODE_ENV,
+ ROLLBAR_CLIENT_TOKEN,
+ ROLLBAR_ENABLED,
+} from '../constants';
// Import version of Rollbar designed for embedded components
// See https://docs.rollbar.com/docs/using-rollbarjs-inside-an-embedded-component
// tslint:disable-next-line:no-var-requires
const Rollbar = require('rollbar/dist/rollbar.noconflict.umd');
+const getRollbarHostDomains = (): string[] => {
+ if (NODE_ENV === 'development') {
+ return HOST_DOMAINS_EXTERNAL.concat(HOST_DOMAINS_LOCAL);
+ } else {
+ return HOST_DOMAINS_EXTERNAL;
+ }
+};
+
let rollbar: any;
// Configures rollbar and sets up error catching
export const setupRollbar = (): any => {
if (_.isUndefined(rollbar) && ROLLBAR_CLIENT_TOKEN && ROLLBAR_ENABLED) {
+ const hostDomains = getRollbarHostDomains();
rollbar = new Rollbar({
accessToken: ROLLBAR_CLIENT_TOKEN,
captureUncaught: true,
@@ -20,7 +37,7 @@ export const setupRollbar = (): any => {
itemsPerMinute: 10,
maxItems: 500,
payload: {
- environment: INSTANT_DISCHARGE_TARGET || `Local ${process.env.NODE_ENV}`,
+ environment: INSTANT_DISCHARGE_TARGET || `Local ${NODE_ENV}`,
client: {
javascript: {
source_map_enabled: true,
@@ -29,7 +46,7 @@ export const setupRollbar = (): any => {
},
},
},
- hostWhiteList: HOST_DOMAINS,
+ hostWhiteList: hostDomains,
uncaughtErrorLevel: 'error',
ignoredMessages: [
// Errors from the third-party scripts