fetchedVia -> fetchOrigin
This commit is contained in:
parent
f4cc14f438
commit
ec01893e9c
@ -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
|
||||
|
@ -92,7 +92,7 @@ const mapDispatchToProps = (
|
||||
setPending: true,
|
||||
dispatchErrors: true,
|
||||
affiliateInfo,
|
||||
fetchedVia: QuoteFetchOrigin.Manual,
|
||||
fetchOrigin: QuoteFetchOrigin.Manual,
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -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,
|
||||
},
|
||||
);
|
||||
|
@ -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,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -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);
|
||||
},
|
||||
};
|
||||
|
@ -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);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user