fetchedVia -> fetchOrigin
This commit is contained in:
@@ -117,7 +117,7 @@ export class ZeroExInstantProvider extends React.Component<ZeroExInstantProvider
|
|||||||
// tslint:disable-next-line:no-floating-promises
|
// tslint:disable-next-line:no-floating-promises
|
||||||
asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, {
|
asyncData.fetchCurrentBuyQuoteAndDispatchToStore(state, dispatch, {
|
||||||
updateSilently: false,
|
updateSilently: false,
|
||||||
fetchedVia: QuoteFetchOrigin.Manual,
|
fetchOrigin: QuoteFetchOrigin.Manual,
|
||||||
});
|
});
|
||||||
// warm up the gas price estimator cache just in case we can't
|
// warm up the gas price estimator cache just in case we can't
|
||||||
// grab the gas price estimate when submitting the transaction
|
// grab the gas price estimate when submitting the transaction
|
||||||
|
@@ -92,7 +92,7 @@ const mapDispatchToProps = (
|
|||||||
setPending: true,
|
setPending: true,
|
||||||
dispatchErrors: true,
|
dispatchErrors: true,
|
||||||
affiliateInfo,
|
affiliateInfo,
|
||||||
fetchedVia: QuoteFetchOrigin.Manual,
|
fetchOrigin: QuoteFetchOrigin.Manual,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -84,7 +84,7 @@ export const asyncData = {
|
|||||||
fetchCurrentBuyQuoteAndDispatchToStore: async (
|
fetchCurrentBuyQuoteAndDispatchToStore: async (
|
||||||
state: State,
|
state: State,
|
||||||
dispatch: Dispatch,
|
dispatch: Dispatch,
|
||||||
options: { updateSilently: boolean; fetchedVia: QuoteFetchOrigin },
|
options: { updateSilently: boolean; fetchOrigin: QuoteFetchOrigin },
|
||||||
) => {
|
) => {
|
||||||
const { buyOrderState, providerState, selectedAsset, selectedAssetUnitAmount, affiliateInfo } = state;
|
const { buyOrderState, providerState, selectedAsset, selectedAssetUnitAmount, affiliateInfo } = state;
|
||||||
const assetBuyer = providerState.assetBuyer;
|
const assetBuyer = providerState.assetBuyer;
|
||||||
@@ -102,7 +102,7 @@ export const asyncData = {
|
|||||||
{
|
{
|
||||||
setPending: !options.updateSilently,
|
setPending: !options.updateSilently,
|
||||||
dispatchErrors: !options.updateSilently,
|
dispatchErrors: !options.updateSilently,
|
||||||
fetchedVia: options.fetchedVia,
|
fetchOrigin: options.fetchOrigin,
|
||||||
affiliateInfo,
|
affiliateInfo,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@@ -180,16 +180,16 @@ export const analytics = {
|
|||||||
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CHOSE)(payload),
|
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_CHOSE)(payload),
|
||||||
trackTokenSelectorSearched: (searchText: string) =>
|
trackTokenSelectorSearched: (searchText: string) =>
|
||||||
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_SEARCHED)({ searchText }),
|
trackingEventFnWithPayload(EventNames.TOKEN_SELECTOR_SEARCHED)({ searchText }),
|
||||||
trackQuoteFetched: (buyQuote: BuyQuote, fetchedVia: QuoteFetchOrigin) =>
|
trackQuoteFetched: (buyQuote: BuyQuote, fetchOrigin: QuoteFetchOrigin) =>
|
||||||
trackingEventFnWithPayload(EventNames.QUOTE_FETCHED)({
|
trackingEventFnWithPayload(EventNames.QUOTE_FETCHED)({
|
||||||
...buyQuoteEventProperties(buyQuote),
|
...buyQuoteEventProperties(buyQuote),
|
||||||
fetchedVia,
|
fetchOrigin,
|
||||||
}),
|
}),
|
||||||
trackQuoteError: (errorMessage: string, assetAmount: BigNumber, fetchedVia: QuoteFetchOrigin) => {
|
trackQuoteError: (errorMessage: string, assetAmount: BigNumber, fetchOrigin: QuoteFetchOrigin) => {
|
||||||
trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({
|
trackingEventFnWithPayload(EventNames.QUOTE_ERROR)({
|
||||||
errorMessage,
|
errorMessage,
|
||||||
assetAmount: assetAmount.toString(),
|
assetAmount: assetAmount.toString(),
|
||||||
fetchedVia,
|
fetchOrigin,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@@ -20,7 +20,7 @@ export const buyQuoteUpdater = {
|
|||||||
options: {
|
options: {
|
||||||
setPending: boolean;
|
setPending: boolean;
|
||||||
dispatchErrors: boolean;
|
dispatchErrors: boolean;
|
||||||
fetchedVia: QuoteFetchOrigin;
|
fetchOrigin: QuoteFetchOrigin;
|
||||||
affiliateInfo?: AffiliateInfo;
|
affiliateInfo?: AffiliateInfo;
|
||||||
},
|
},
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
@@ -37,7 +37,11 @@ export const buyQuoteUpdater = {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (options.dispatchErrors) {
|
if (options.dispatchErrors) {
|
||||||
dispatch(actions.setQuoteRequestStateFailure());
|
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;
|
let errorMessage;
|
||||||
if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
|
if (error.message === AssetBuyerError.InsufficientAssetLiquidity) {
|
||||||
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
|
const assetName = assetUtils.bestNameForAsset(asset, 'of this asset');
|
||||||
@@ -65,6 +69,6 @@ export const buyQuoteUpdater = {
|
|||||||
errorFlasher.clearError(dispatch);
|
errorFlasher.clearError(dispatch);
|
||||||
// invalidate the last buy quote.
|
// invalidate the last buy quote.
|
||||||
dispatch(actions.updateLatestBuyQuote(newBuyQuote));
|
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 () => {
|
return new Heartbeater(async () => {
|
||||||
await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, {
|
await asyncData.fetchCurrentBuyQuoteAndDispatchToStore(store.getState(), store.dispatch, {
|
||||||
updateSilently: true,
|
updateSilently: true,
|
||||||
fetchedVia: QuoteFetchOrigin.Heartbeat,
|
fetchOrigin: QuoteFetchOrigin.Heartbeat,
|
||||||
});
|
});
|
||||||
}, shouldPerformImmediatelyOnStart);
|
}, shouldPerformImmediatelyOnStart);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user