From d5f6d2ab3279b3ef9a4b49263d5b6e06cc9be5ae Mon Sep 17 00:00:00 2001 From: Ji Young Lee <641712+jiyounglee@users.noreply.github.com> Date: Tue, 3 Dec 2024 09:52:58 +1100 Subject: [PATCH] [NO CHANGELOG] [Add Tokens Widget] Add trackFlow with messageId (#2441) --- .../widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx | 6 +++--- .../widgets-lib/src/widgets/add-tokens/views/Review.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx index 7d3d296ebc..3c0ef35d9c 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/AddTokens.tsx @@ -29,7 +29,7 @@ import { import { Web3Provider } from '@ethersproject/providers'; import { useTranslation } from 'react-i18next'; import { ActionType } from '@0xsquid/squid-types'; -import { trackError } from '@imtbl/metrics'; +import { trackFlow } from '@imtbl/metrics'; import { SimpleLayout } from '../../../components/SimpleLayout/SimpleLayout'; import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext'; import { @@ -270,8 +270,8 @@ export function AddTokens({ toTokenAddress, geoBlocked: !isSwapAvailable, }, - }).catch((err) => { - trackError('commerce', 'addTokensLoaded', err); + }).then((ctx) => { + trackFlow('commerce', `addTokensLoaded_${ctx.event.messageId}`); }); }, [id, isSwapAvailable]); diff --git a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx index 88bbd8db68..437b26aa60 100644 --- a/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx +++ b/packages/checkout/widgets-lib/src/widgets/add-tokens/views/Review.tsx @@ -27,7 +27,7 @@ import { t } from 'i18next'; import { Trans } from 'react-i18next'; import { Environment } from '@imtbl/config'; import { ChainId } from '@imtbl/checkout-sdk'; -import { trackError } from '@imtbl/metrics'; +import { trackFlow } from '@imtbl/metrics'; import { SimpleLayout } from '../../../components/SimpleLayout/SimpleLayout'; import { AddTokensContext } from '../context/AddTokensContext'; import { useRoutes } from '../hooks/useRoutes'; @@ -400,8 +400,8 @@ export function Review({ fromTokenSymbol: amountData?.fromToken.symbol, toTokenSymbol: amountData?.toToken.symbol, }, - }).catch((err) => { - trackError('commerce', 'addTokensFundsAdded', err); + }).then((ctx) => { + trackFlow('commerce', `addTokensFundsAdded_${ctx.event.messageId}`); }); sendAddTokensSuccessEvent(eventTarget, executeTxnReceipt.transactionHash);