fetchedVia -> fetchOrigin

This commit is contained in:
Steve Klebanoff 2018-11-28 14:11:53 -08:00
parent f4cc14f438
commit ec01893e9c
6 changed files with 16 additions and 12 deletions

View File

@ -117,7 +117,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
// tslint:disable-next-line:no-floating-promises
asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, {
updateSilently: false,
fetchedVia: QuoteFetchOrigin.Manual,
fetchOrigin: QuoteFetchOrigin.Manual,
});
// warm up the gas price estimator cache just in case we can't
// grab the gas price estimate when submitting the transaction

View File

@ -92,7 +92,7 @@ const mapDispatchToProps = (
setPending: true,
dispatchErrors: true,
affiliateInfo,
fetchedVia: QuoteFetchOrigin.Manual,
fetchOrigin: QuoteFetchOrigin.Manual,
});
}
},

View File

@ -84,7 +84,7 @@ export const asyncData = {
fetchCurrentBuyQuoteAndDispatchToStore: async (
state: State,
dispatch: Dispatch,
options: { updateSilently: boolean; fetchedVia: QuoteFetchOrigin },
options: { updateSilently: boolean; fetchOrigin: QuoteFetchOrigin },
) => {
const { buyOrderState, providerState, selectedAsset, selectedAssetUnitAmount, affiliateInfo } = state;
const assetBuyer = providerState.assetBuyer;
@ -102,7 +102,7 @@ export const asyncData = {
{
setPending: !options.updateSilently,
dispatchErrors: !options.updateSilently,
fetchedVia: options.fetchedVia,
fetchOrigin: options.fetchOrigin,
affiliateInfo,
},
);

View File

@ -180,16 +180,16 @@ export const analytics = {
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CHOSE)(payload),
trackTokenSelectorSearched: (searchText: string) =>
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_SEARCHED)({ searchText }),
trackQuoteFetched: (buyQuote: BuyQuote, fetchedVia: QuoteFetchOrigin) =>
trackQuoteFetched: (buyQuote: BuyQuote, fetchOrigin: QuoteFetchOrigin) =>
trackingEventFnWithPayload(EventNames.QUOTE_FETCHED)({
...buyQuoteEventProperties(buyQuote),
fetchedVia,
fetchOrigin,
}),
trackQuoteError: (errorMessage: string, assetAmount: BigNumber, fetchedVia: QuoteFetchOrigin) => {
trackQuoteError: (errorMessage: string, assetAmount: BigNumber, fetchOrigin: QuoteFetchOrigin) => {
trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({
errorMessage,
assetAmount: assetAmount.toString(),
fetchedVia,
fetchOrigin,
});
},
};

View File

@ -20,7 +20,7 @@ export const buyQuoteUpdater = {
options: {
setPending: boolean;
dispatchErrors: boolean;
fetchedVia: QuoteFetchOrigin;
fetchOrigin: QuoteFetchOrigin;
affiliateInfo?: AffiliateInfo;
},
): Promise<void> => {
@ -37,7 +37,11 @@ export const buyQuoteUpdater = {
} catch (error) {
if (options.dispatchErrors) {
dispatch(actions.setQuoteRequestStateFailure());
analytics.trackQuoteError(error.message ? error.message : 'other', assetUnitAmount, options.fetchedVia);
analytics.trackQuoteError(
error.message ? error.message : 'other',
assetUnitAmount,
options.fetchOrigin,
);
let errorMessage;
if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
@ -65,6 +69,6 @@ export const buyQuoteUpdater = {
errorFlasher.clearError(dispatch);
// invalidate the last buy quote.
dispatch(actions.updateLatestBuyQuote(newBuyQuote));
analytics.trackQuoteFetched(newBuyQuote, options.fetchedVia);
analytics.trackQuoteFetched(newBuyQuote, options.fetchOrigin);
},
};

View File

@ -20,7 +20,7 @@ export const generateBuyQuoteHeartbeater = (options: HeartbeatFactoryOptions): H
return new Heartbeater(async () => {
await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, {
updateSilently: true,
fetchedVia: QuoteFetchOrigin.Heartbeat,
fetchOrigin: QuoteFetchOrigin.Heartbeat,
});
}, shouldPerformImmediatelyOnStart);
};