@imtbl/checkout-widgets 2.24.8 → 2.24.9-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/dist/browser/{AddTokensWidget-BQfrLKCo.js → AddTokensWidget-CIR8BF_I.js} +24 -297
  2. package/dist/browser/{BridgeWidget-6KlgTXwZ.js → BridgeWidget-C5Uljhhx.js} +13 -294
  3. package/dist/browser/{CommerceWidget-CcCuv661.js → CommerceWidget-CeBBYCbK.js} +17 -47
  4. package/dist/browser/{FeesBreakdown-DvoQJlP-.js → FeesBreakdown-BU4haotD.js} +1 -1
  5. package/dist/browser/{OnRampWidget-DaL34PiA.js → OnRampWidget-Ccvb3QkT.js} +5 -80
  6. package/dist/browser/{SaleWidget-D-IBBRTL.js → SaleWidget-CPARFlzv.js} +61 -219
  7. package/dist/browser/{SpendingCapHero-Z5NIcrWw.js → SpendingCapHero-B-0YYZho.js} +1 -1
  8. package/dist/browser/{SwapWidget-C4B2Answ.js → SwapWidget-ujE6uX-N.js} +12 -206
  9. package/dist/browser/{TokenImage-DucOedrZ.js → TokenImage-BeUf_Ulv.js} +1 -1
  10. package/dist/browser/{TopUpView-BIvdNYib.js → TopUpView-GMv3360Q.js} +3 -54
  11. package/dist/browser/{WalletApproveHero-ge2JSOYk.js → WalletApproveHero-BJi7ufqM.js} +4 -12
  12. package/dist/browser/{WalletWidget-hiUotMuQ.js → WalletWidget-BABrqsfd.js} +4 -96
  13. package/dist/browser/{index-2esq4Cem.js → index-CcxHW36j.js} +1275 -9717
  14. package/dist/browser/{index-DWNAmu0n.js → index-Cp1w6map.js} +1 -1
  15. package/dist/browser/index.js +1 -1
  16. package/dist/browser/{useInterval-1gu4cbu3.js → useInterval-DbCsm_gG.js} +1 -1
  17. package/dist/types/components/FormComponents/SelectForm/SelectForm.d.ts +1 -5
  18. package/dist/types/components/FormComponents/SelectInput/SelectInput.d.ts +1 -5
  19. package/dist/types/components/Transak/TransakIframe.d.ts +0 -1
  20. package/dist/types/components/Transak/useTransakEvents.d.ts +0 -4
  21. package/dist/types/components/WalletDrawer/ConnectWalletDrawer.d.ts +1 -2
  22. package/dist/types/lib/squid/hooks/useExecute.d.ts +1 -2
  23. package/dist/types/views/top-up/TopUpView.d.ts +1 -5
  24. package/dist/types/widgets/add-tokens/hooks/useError.d.ts +1 -1
  25. package/dist/types/widgets/purchase/components/PurchaseConnectWalletDrawer.d.ts +1 -3
  26. package/dist/types/widgets/sale/hooks/useSaleEvents.d.ts +5 -31
  27. package/dist/types/widgets/swap/components/Fees.d.ts +1 -1
  28. package/package.json +7 -9
  29. package/src/components/ConnectLoader/ConnectLoader.tsx +0 -16
  30. package/src/components/FormComponents/SelectForm/SelectForm.tsx +2 -18
  31. package/src/components/FormComponents/SelectInput/SelectInput.tsx +1 -12
  32. package/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +2 -26
  33. package/src/components/Transactions/ChangeWallet.tsx +1 -12
  34. package/src/components/Transactions/ClaimWithdrawalInProgress.tsx +0 -11
  35. package/src/components/Transactions/NoTransactions.tsx +0 -10
  36. package/src/components/Transactions/TransactionItemWithdrawPending.tsx +1 -13
  37. package/src/components/Transactions/Transactions.tsx +2 -28
  38. package/src/components/Transak/TransakIframe.tsx +0 -6
  39. package/src/components/Transak/useTransakEvents.ts +1 -70
  40. package/src/components/WalletDrawer/ConnectWalletDrawer.tsx +2 -35
  41. package/src/components/WalletDrawer/PayWithWalletDrawer.tsx +0 -1
  42. package/src/context/view-context/test-components/ViewContextTestComponent.tsx +14 -15
  43. package/src/lib/squid/hooks/useExecute.ts +5 -18
  44. package/src/views/top-up/TopUpView.tsx +5 -56
  45. package/src/widgets/add-tokens/AddTokensRoot.tsx +28 -29
  46. package/src/widgets/add-tokens/AddTokensWidget.tsx +2 -17
  47. package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +2 -18
  48. package/src/widgets/add-tokens/hooks/useError.tsx +1 -18
  49. package/src/widgets/add-tokens/hooks/useErrorHandler.ts +2 -12
  50. package/src/widgets/add-tokens/views/AddTokens.tsx +8 -154
  51. package/src/widgets/add-tokens/views/Review.tsx +6 -94
  52. package/src/widgets/bridge/BridgeWidget.tsx +0 -35
  53. package/src/widgets/bridge/BridgeWidgetRoot.tsx +17 -18
  54. package/src/widgets/bridge/components/BridgeForm.tsx +0 -20
  55. package/src/widgets/bridge/components/BridgeReviewSummary.tsx +1 -49
  56. package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +3 -122
  57. package/src/widgets/bridge/views/ApproveTransaction.tsx +1 -15
  58. package/src/widgets/bridge/views/Bridge.tsx +1 -16
  59. package/src/widgets/bridge/views/BridgeReview.tsx +1 -12
  60. package/src/widgets/bridge/views/ClaimWithdrawal.tsx +0 -11
  61. package/src/widgets/bridge/views/MoveInProgress.tsx +0 -24
  62. package/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +1 -12
  63. package/src/widgets/connect/ConnectWidget.tsx +2 -18
  64. package/src/widgets/connect/ConnectWidgetRoot.tsx +15 -16
  65. package/src/widgets/connect/components/WalletList.tsx +6 -55
  66. package/src/widgets/connect/views/ConnectWallet.tsx +1 -12
  67. package/src/widgets/connect/views/ReadyToConnect.tsx +2 -29
  68. package/src/widgets/connect/views/SwitchNetworkEth.tsx +3 -22
  69. package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +0 -18
  70. package/src/widgets/immutable-commerce/CommerceWidgetRoot.tsx +17 -19
  71. package/src/widgets/on-ramp/OnRampWidget.tsx +0 -2
  72. package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +23 -24
  73. package/src/widgets/on-ramp/views/OnRampMain.tsx +1 -91
  74. package/src/widgets/purchase/PurchaseWidgetRoot.tsx +22 -23
  75. package/src/widgets/purchase/components/PurchaseConnectWalletDrawer.tsx +2 -34
  76. package/src/widgets/purchase/components/PurchaseDeliverToWalletDrawer.tsx +0 -1
  77. package/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +0 -2
  78. package/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +1 -30
  79. package/src/widgets/purchase/components/WithCard.tsx +0 -4
  80. package/src/widgets/purchase/views/Purchase.tsx +1 -2
  81. package/src/widgets/sale/SaleWidget.tsx +0 -2
  82. package/src/widgets/sale/SaleWidgetRoot.tsx +32 -33
  83. package/src/widgets/sale/components/OrderReview.tsx +2 -29
  84. package/src/widgets/sale/components/WithCard.tsx +0 -2
  85. package/src/widgets/sale/hooks/useSaleEvents.ts +3 -185
  86. package/src/widgets/sale/views/OrderSummary.tsx +2 -15
  87. package/src/widgets/sale/views/PayWithCard.tsx +4 -46
  88. package/src/widgets/sale/views/PayWithCoins.tsx +4 -9
  89. package/src/widgets/sale/views/PaymentMethods.tsx +3 -6
  90. package/src/widgets/sale/views/SaleErrorView.tsx +1 -1
  91. package/src/widgets/swap/SwapWidget.tsx +0 -24
  92. package/src/widgets/swap/SwapWidgetRoot.tsx +29 -30
  93. package/src/widgets/swap/components/Fees.tsx +1 -1
  94. package/src/widgets/swap/components/SwapForm.tsx +2 -140
  95. package/src/widgets/swap/views/ApproveERC20Onboarding.tsx +1 -36
  96. package/src/widgets/swap/views/SwapCoins.tsx +0 -17
  97. package/src/widgets/swap/views/SwapInProgress.tsx +0 -14
  98. package/src/widgets/transfer/TransferForm.tsx +3 -25
  99. package/src/widgets/transfer/TransferWidget.tsx +1 -23
  100. package/src/widgets/wallet/WalletWidgetRoot.tsx +24 -25
  101. package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +1 -50
  102. package/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +0 -13
  103. package/src/widgets/wallet/components/WalletAddress/WalletAddress.tsx +0 -13
  104. package/src/widgets/wallet/views/CoinInfo.tsx +1 -12
  105. package/src/widgets/wallet/views/Settings.tsx +1 -15
  106. package/src/widgets/wallet/views/WalletBalances.tsx +0 -24
  107. package/tsconfig.json +0 -1
  108. package/dist/browser/auto-track-C-H4NHVE.js +0 -105
  109. package/dist/browser/index-CcQ-5rAF.js +0 -446
  110. package/dist/browser/index-CvpdSuud.js +0 -5634
  111. package/dist/browser/index-D3m5uC9C.js +0 -60
  112. package/dist/browser/index-DJEaNohG.js +0 -65
  113. package/dist/browser/index-DPz4F2rf.js +0 -27
  114. package/dist/browser/index-DQZhPkHy.js +0 -65
  115. package/dist/browser/index.umd-brf0Qwxh.js +0 -32
  116. package/dist/browser/is-plan-event-enabled-mXX0dwl-.js +0 -17
  117. package/dist/types/context/analytics-provider/CustomAnalyticsProvider.d.ts +0 -7
  118. package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +0 -42
  119. package/dist/types/context/analytics-provider/SetupAnalytics.d.ts +0 -7
  120. package/dist/types/lib/analytics/identifyUser.d.ts +0 -8
  121. package/dist/types/lib/analytics/identifyUser.test.d.ts +0 -1
  122. package/src/context/analytics-provider/CustomAnalyticsProvider.tsx +0 -22
  123. package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +0 -41
  124. package/src/context/analytics-provider/SetupAnalytics.tsx +0 -35
  125. package/src/lib/analytics/identifyUser.test.ts +0 -44
  126. package/src/lib/analytics/identifyUser.ts +0 -26
@@ -7,7 +7,6 @@ import {
7
7
  TransakWidgetType,
8
8
  TransakNFTCheckoutParams,
9
9
  } from './useTransakIframe';
10
- import { UserJourney } from '../../context/analytics-provider/SegmentAnalyticsProvider';
11
10
 
12
11
  export type TransakIframeProps = {
13
12
  id: string;
@@ -16,7 +15,6 @@ export type TransakIframeProps = {
16
15
  contractId: string;
17
16
  environment: Environment;
18
17
  walletAddress: string;
19
- isPassportWallet: boolean;
20
18
  } & TransakEventHandlers &
21
19
  TransakNFTCheckoutParams;
22
20
 
@@ -26,7 +24,6 @@ export function TransakIframe(props: TransakIframeProps) {
26
24
  type,
27
25
  email,
28
26
  walletAddress,
29
- isPassportWallet,
30
27
  nftData,
31
28
  calldata,
32
29
  cryptoCurrencyCode,
@@ -48,10 +45,7 @@ export function TransakIframe(props: TransakIframeProps) {
48
45
  const iframeRef = useRef<HTMLIFrameElement>(null);
49
46
 
50
47
  const { onLoad, initialised } = useTransakEvents({
51
- userJourney: UserJourney.SALE,
52
48
  ref: iframeRef,
53
- walletAddress,
54
- isPassportWallet,
55
49
  onOpen,
56
50
  onOrderCreated,
57
51
  onOrderProcessing,
@@ -1,15 +1,8 @@
1
1
  import {
2
2
  RefObject, useCallback, useEffect, useRef, useState,
3
3
  } from 'react';
4
- import { StandardAnalyticsActions } from '@imtbl/react-analytics';
5
-
6
4
  import * as url from 'url';
7
5
  import { TransakEvent, TransakEvents, TransakStatuses } from './TransakEvents';
8
- import {
9
- AnalyticsControlTypes,
10
- UserJourney,
11
- useAnalytics,
12
- } from '../../context/analytics-provider/SegmentAnalyticsProvider';
13
6
 
14
7
  export const TRANSAK_ORIGIN = ['global.transak.com', 'global-stg.transak.com'];
15
8
  const FAILED_TO_LOAD_TIMEOUT_IN_MS = 10000;
@@ -25,54 +18,13 @@ export type TransakEventHandlers = {
25
18
  failedToLoadTimeoutInMs?: number;
26
19
  };
27
20
 
28
- type AnalyticEvent = {
29
- screen: string;
30
- userJourney?: UserJourney;
31
- control: string;
32
- controlType: AnalyticsControlTypes;
33
- action?: StandardAnalyticsActions;
34
- [key: string]: unknown;
35
- };
36
-
37
- const ANALYTICS_EVENTS: Record<string, AnalyticEvent> = {
38
- [TransakEvents.TRANSAK_WIDGET_OPEN]: {
39
- screen: 'InputScreen',
40
- control: 'TransakWidgetOpen',
41
- controlType: 'IframeEvent',
42
- },
43
- [TransakEvents.TRANSAK_ORDER_CREATED]: {
44
- screen: 'InputScreen',
45
- control: 'OrderCreated',
46
- controlType: 'IframeEvent',
47
- },
48
- [`${TransakEvents.TRANSAK_ORDER_SUCCESSFUL}${TransakStatuses.PROCESSING}`]: {
49
- screen: 'OrderInProgress',
50
- control: 'PaymentProcessing',
51
- controlType: 'IframeEvent',
52
- },
53
- [`${TransakEvents.TRANSAK_ORDER_SUCCESSFUL}${TransakStatuses.COMPLETED}`]: {
54
- screen: 'Success',
55
- control: 'PaymentCompleted',
56
- controlType: 'IframeEvent',
57
- },
58
- [TransakEvents.TRANSAK_ORDER_FAILED]: {
59
- screen: 'Failure',
60
- control: 'PaymentFailed',
61
- controlType: 'IframeEvent',
62
- },
63
- };
64
-
65
21
  type UseTransakEventsProps = {
66
- userJourney: UserJourney;
67
22
  ref: RefObject<HTMLIFrameElement> | undefined;
68
- walletAddress: string;
69
- isPassportWallet: boolean;
70
23
  } & TransakEventHandlers;
71
24
 
72
25
  export const useTransakEvents = (props: UseTransakEventsProps) => {
73
- const { track } = useAnalytics();
74
26
  const {
75
- userJourney, ref, walletAddress, isPassportWallet, failedToLoadTimeoutInMs, onFailedToLoad,
27
+ ref, failedToLoadTimeoutInMs, onFailedToLoad,
76
28
  } = props;
77
29
  const [initialised, setInitialsed] = useState<boolean>(false);
78
30
  const failedToLoadTimeout = failedToLoadTimeoutInMs || FAILED_TO_LOAD_TIMEOUT_IN_MS;
@@ -96,26 +48,6 @@ export const useTransakEvents = (props: UseTransakEventsProps) => {
96
48
  }
97
49
  };
98
50
 
99
- const handleAnalyticsEvent = useCallback((event: TransakEvent) => {
100
- const type = event.event_id as TransakEvents;
101
- const key = [TransakEvents.TRANSAK_ORDER_SUCCESSFUL].includes(type)
102
- ? `${type}${event.data.status}`
103
- : type;
104
-
105
- const eventData = ANALYTICS_EVENTS?.[key] || {};
106
-
107
- if (Object.keys(eventData).length >= 0) {
108
- track({
109
- ...eventData,
110
- userJourney,
111
- extras: {
112
- walletAddress,
113
- isPassportWallet,
114
- },
115
- });
116
- }
117
- }, []);
118
-
119
51
  const handleEvents = useCallback((event: TransakEvent) => {
120
52
  switch (event.event_id) {
121
53
  case TransakEvents.TRANSAK_WIDGET_INITIALISED:
@@ -151,7 +83,6 @@ export const useTransakEvents = (props: UseTransakEventsProps) => {
151
83
 
152
84
  if (!isTransakEvent) return;
153
85
 
154
- handleAnalyticsEvent(event.data);
155
86
  handleEvents(event.data);
156
87
 
157
88
  console.log('@@@ Transak event', event); // eslint-disable-line no-console
@@ -9,12 +9,7 @@ import {
9
9
  import { MenuItemProps } from '@biom3/react';
10
10
  import { WalletDrawer } from './WalletDrawer';
11
11
  import { WalletChangeEvent } from './WalletDrawerEvents';
12
- import { identifyUser } from '../../lib/analytics/identifyUser';
13
- import { getProviderSlugFromRdns, isPassportProvider } from '../../lib/provider';
14
- import {
15
- useAnalytics,
16
- UserJourney,
17
- } from '../../context/analytics-provider/SegmentAnalyticsProvider';
12
+ import { isPassportProvider } from '../../lib/provider';
18
13
  import {
19
14
  ProvidersContextActions,
20
15
  useProvidersContext,
@@ -25,7 +20,7 @@ import {
25
20
  ConnectEIP6963ProviderError,
26
21
  } from '../../lib/connectEIP6963Provider';
27
22
  import { EOAWarningDrawer } from '../EOAWarningDrawer/EOAWarningDrawer';
28
- import { removeSpace } from '../../lib/utils';
23
+ import { } from '../../lib/utils';
29
24
 
30
25
  type ConnectWalletDrawerProps = {
31
26
  heading: string;
@@ -45,7 +40,6 @@ type ConnectWalletDrawerProps = {
45
40
  rdns: string;
46
41
  }[];
47
42
  getShouldRequestWalletPermissions?: (providerInfo: EIP6963ProviderInfo) => boolean | undefined;
48
- shouldIdentifyUser?: boolean;
49
43
  drawerBackground: string | undefined;
50
44
  };
51
45
 
@@ -61,16 +55,12 @@ export function ConnectWalletDrawer({
61
55
  menuItemSize = 'small',
62
56
  disabledOptions = [],
63
57
  getShouldRequestWalletPermissions,
64
- shouldIdentifyUser = true,
65
58
  drawerBackground,
66
59
  }: ConnectWalletDrawerProps) {
67
60
  const {
68
61
  providersState: { checkout, fromProvider, lockedToProvider },
69
62
  providersDispatch,
70
63
  } = useProvidersContext();
71
-
72
- const { identify, track, user } = useAnalytics();
73
-
74
64
  const prevWalletChangeEvent = useRef<WalletChangeEvent | undefined>();
75
65
 
76
66
  const [showUnableToConnectDrawer, setShowUnableToConnectDrawer] = useState(false);
@@ -110,20 +100,6 @@ export function ConnectWalletDrawer({
110
100
  const handleWalletConnection = async (event: WalletChangeEvent) => {
111
101
  const { providerDetail } = event;
112
102
  const { info } = providerDetail;
113
-
114
- // Trigger analytics connect wallet, menu item, with wallet details
115
- track({
116
- userJourney: UserJourney.CONNECT,
117
- screen: 'ConnectWallet',
118
- control: removeSpace(info.name),
119
- controlType: 'MenuItem',
120
- extras: {
121
- providerType,
122
- wallet: getProviderSlugFromRdns(info.rdns),
123
- walletRdns: info.rdns,
124
- },
125
- });
126
-
127
103
  if (info.rdns === WalletProviderRdns.PASSPORT) {
128
104
  const { isConnected } = await checkout.checkIsWalletConnected({
129
105
  provider: new WrappedBrowserProvider(providerDetail.provider!),
@@ -148,15 +124,6 @@ export function ConnectWalletDrawer({
148
124
  checkout,
149
125
  shouldRequestWalletPermissions,
150
126
  );
151
-
152
- // Identify connected wallet, retaining current anonymousId
153
- if (shouldIdentifyUser) {
154
- const userData = user ? await user() : undefined;
155
- const anonymousId = userData?.anonymousId();
156
-
157
- await identifyUser(identify, provider, { anonymousId });
158
- }
159
-
160
127
  // Store selected provider as fromProvider in context
161
128
  address = await setProviderInContext(provider, providerDetail.info);
162
129
 
@@ -80,7 +80,6 @@ export function PayWithWalletDrawer({
80
80
  disabledOptions={disabledOptions}
81
81
  bottomSlot={payWithCardItem}
82
82
  onConnect={handleOnConnect}
83
- shouldIdentifyUser={false}
84
83
  drawerBackground={drawerBackground}
85
84
  />
86
85
  );
@@ -1,10 +1,9 @@
1
1
  import React from 'react';
2
- import { Checkout, WidgetTheme } from '@imtbl/checkout-sdk';
2
+ import { WidgetTheme } from '@imtbl/checkout-sdk';
3
3
  import { I18nextProvider } from 'react-i18next';
4
4
  import { Environment } from '@imtbl/config';
5
5
  import { ThemeProvider } from '../../../components/ThemeProvider/ThemeProvider';
6
6
  import { withDefaultWidgetConfigs } from '../../../lib/withDefaultWidgetConfig';
7
- import { CustomAnalyticsProvider } from '../../analytics-provider/CustomAnalyticsProvider';
8
7
  import i18n from '../../../i18n';
9
8
 
10
9
  export interface TestProps {
@@ -24,19 +23,19 @@ export function ViewContextTestComponent({ children, theme }: TestProps) {
24
23
  });
25
24
  return (
26
25
  <I18nextProvider i18n={i18n}>
27
- <CustomAnalyticsProvider checkout={{} as Checkout}>
28
- <ThemeProvider
29
- id="test"
30
- config={config}
31
- globalSx={{
32
- body: {
33
- bg: 'base.color.neutral.800',
34
- },
35
- }}
36
- >
37
- {children}
38
- </ThemeProvider>
39
- </CustomAnalyticsProvider>
26
+
27
+ <ThemeProvider
28
+ id="test"
29
+ config={config}
30
+ globalSx={{
31
+ body: {
32
+ bg: 'base.color.neutral.800',
33
+ },
34
+ }}
35
+ >
36
+ {children}
37
+ </ThemeProvider>
38
+
40
39
  </I18nextProvider>
41
40
  );
42
41
  }
@@ -9,18 +9,15 @@ import { EIP6963ProviderInfo, WrappedBrowserProvider } from '@imtbl/checkout-sdk
9
9
  import { isSquidNativeToken } from '../functions/isSquidNativeToken';
10
10
  import { retry } from '../../retry';
11
11
  import { withMetricsAsync } from '../../metrics';
12
- import { useAnalytics, UserJourney } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
13
12
  import { isRejectedError } from '../../../functions/errorType';
14
13
  import { callApprove, callExecute } from '../functions/execute';
15
14
 
16
15
  const TRANSACTION_NOT_COMPLETED = 'transaction not completed';
17
16
 
18
17
  export const useExecute = (
19
- userJourney: UserJourney,
18
+ flowPrefix: 'AddTokens' | 'Purchase',
20
19
  onTransactionError?: (err: unknown) => void,
21
20
  ) => {
22
- const { user } = useAnalytics();
23
-
24
21
  const getAllowance = async (
25
22
  provider: WrappedBrowserProvider,
26
23
  routeResponse: RouteResponse,
@@ -53,16 +50,6 @@ export const useExecute = (
53
50
  return undefined;
54
51
  }
55
52
  };
56
-
57
- const getAnonymousId = async () => {
58
- try {
59
- const userData = await user();
60
- return userData?.anonymousId() ?? undefined;
61
- } catch (error) {
62
- return undefined;
63
- }
64
- };
65
-
66
53
  const approve = async (
67
54
  fromProviderInfo: EIP6963ProviderInfo,
68
55
  provider: WrappedBrowserProvider,
@@ -72,8 +59,8 @@ export const useExecute = (
72
59
  if (!isSquidNativeToken(routeResponse?.route?.params.fromToken)) {
73
60
  return await withMetricsAsync(
74
61
  (flow) => callApprove(flow, fromProviderInfo, provider, routeResponse),
75
- `${userJourney}_Approve`,
76
- await getAnonymousId(),
62
+ `${flowPrefix}_Approve`,
63
+ undefined,
77
64
  (error) => (isRejectedError(error) ? 'rejected' : ''),
78
65
  );
79
66
  }
@@ -96,8 +83,8 @@ export const useExecute = (
96
83
  try {
97
84
  return await withMetricsAsync(
98
85
  (flow) => callExecute(flow, squid, fromProviderInfo, provider, routeResponse),
99
- `${userJourney}_Execute`,
100
- await getAnonymousId(),
86
+ `${flowPrefix}_Execute`,
87
+ undefined,
101
88
  (error) => (isRejectedError(error) ? 'rejected' : ''),
102
89
  );
103
90
  } catch (error) {
@@ -2,7 +2,6 @@ import { Body, Box, Heading } from '@biom3/react';
2
2
  import {
3
3
  ReactNode, useContext, useEffect, useMemo, useState,
4
4
  } from 'react';
5
- import { StandardAnalyticsControlTypes } from '@imtbl/react-analytics';
6
5
  import {
7
6
  Checkout,
8
7
  GasEstimateBridgeToL2Result,
@@ -12,13 +11,9 @@ import {
12
11
  } from '@imtbl/checkout-sdk';
13
12
  import { Environment } from '@imtbl/config';
14
13
  import { useTranslation } from 'react-i18next';
15
- import {
16
- UserJourney,
17
- useAnalytics,
18
- } from '../../context/analytics-provider/SegmentAnalyticsProvider';
19
14
  import { DEFAULT_TOKEN_SYMBOLS } from '../../context/crypto-fiat-context/CryptoFiatProvider';
20
15
  import { BridgeWidgetViews } from '../../context/view-context/BridgeViewContextTypes';
21
- import { useMount } from '../../hooks/useMount';
16
+ import { } from '../../hooks/useMount';
22
17
  import { HeaderNavigation } from '../../components/Header/HeaderNavigation';
23
18
  import { SimpleLayout } from '../../components/SimpleLayout/SimpleLayout';
24
19
  import {
@@ -50,11 +45,7 @@ interface TopUpViewProps {
50
45
  showSwapOption: boolean;
51
46
  showBridgeOption: boolean;
52
47
  tokenAddress?: string;
53
- amount?: string;
54
- analytics: {
55
- userJourney: UserJourney;
56
- };
57
- onCloseButtonClick: () => void;
48
+ amount?: string; onCloseButtonClick: () => void;
58
49
  onBackButtonClick?: () => void;
59
50
  heading?: [key: string, options?: $Dictionary];
60
51
  subheading?: [key: string, options?: $Dictionary];
@@ -84,15 +75,12 @@ export function TopUpView({
84
75
  showBridgeOption,
85
76
  tokenAddress,
86
77
  amount,
87
- analytics,
88
78
  onCloseButtonClick,
89
79
  onBackButtonClick,
90
80
  heading,
91
81
  subheading,
92
82
  }: TopUpViewProps) {
93
83
  const { t } = useTranslation();
94
- const { userJourney } = analytics;
95
-
96
84
  const { viewDispatch } = useContext(ViewContext);
97
85
 
98
86
  const { cryptoFiatState, cryptoFiatDispatch } = useContext(CryptoFiatContext);
@@ -110,9 +98,6 @@ export function TopUpView({
110
98
 
111
99
  const title = heading ? t(...heading) : t('views.TOP_UP_VIEW.header.title');
112
100
  const description = subheading ? t(...subheading) : null;
113
-
114
- const { page, track } = useAnalytics();
115
-
116
101
  const isSwapAvailable = useAsyncMemo<boolean | undefined>(async () => {
117
102
  if (!checkout) return undefined;
118
103
  try {
@@ -121,11 +106,6 @@ export function TopUpView({
121
106
  return false;
122
107
  }
123
108
  }, [checkout]);
124
-
125
- useMount(() => {
126
- page({ userJourney, screen: 'TopUp' });
127
- });
128
-
129
109
  useEffect(() => {
130
110
  if (!cryptoFiatDispatch) return;
131
111
  cryptoFiatDispatch({
@@ -161,21 +141,6 @@ export function TopUpView({
161
141
  setOnRampFeesPercentage(onRampFees);
162
142
  })();
163
143
  }, [checkout !== undefined]);
164
-
165
- const localTrack = (
166
- control: string,
167
- extras: any,
168
- controlType: StandardAnalyticsControlTypes = 'Button',
169
- ) => {
170
- track({
171
- userJourney,
172
- screen: 'TopUp',
173
- control,
174
- controlType,
175
- extras,
176
- });
177
- };
178
-
179
144
  const onClickSwap = () => {
180
145
  if (widgetEvent === IMTBLWidgetEvents.IMTBL_SWAP_WIDGET_EVENT) {
181
146
  const data = {
@@ -192,9 +157,7 @@ export function TopUpView({
192
157
  data,
193
158
  },
194
159
  },
195
- });
196
- localTrack('Swap', { ...data, widgetEvent });
197
- return;
160
+ }); return;
198
161
  }
199
162
 
200
163
  const data = {
@@ -203,7 +166,6 @@ export function TopUpView({
203
166
  amount: '',
204
167
  };
205
168
  orchestrationEvents.sendRequestSwapEvent(eventTarget, widgetEvent, data);
206
- localTrack('Swap', { ...data, widgetEvent });
207
169
  };
208
170
 
209
171
  const onClickBridge = () => {
@@ -221,9 +183,7 @@ export function TopUpView({
221
183
  data,
222
184
  },
223
185
  },
224
- });
225
- localTrack('Bridge', { ...data, widgetEvent });
226
- return;
186
+ }); return;
227
187
  }
228
188
 
229
189
  const data = {
@@ -231,7 +191,6 @@ export function TopUpView({
231
191
  amount: '',
232
192
  };
233
193
  orchestrationEvents.sendRequestBridgeEvent(eventTarget, widgetEvent, data);
234
- localTrack('Bridge', { ...data, widgetEvent });
235
194
  };
236
195
 
237
196
  const onClickOnRamp = () => {
@@ -249,9 +208,7 @@ export function TopUpView({
249
208
  data,
250
209
  },
251
210
  },
252
- });
253
- localTrack('OnRamp', { ...data, widgetEvent });
254
- return;
211
+ }); return;
255
212
  }
256
213
 
257
214
  const data = {
@@ -259,18 +216,10 @@ export function TopUpView({
259
216
  amount: amount ?? '',
260
217
  };
261
218
  orchestrationEvents.sendRequestOnrampEvent(eventTarget, widgetEvent, data);
262
- localTrack('OnRamp', { ...data, widgetEvent });
263
219
  };
264
220
 
265
221
  const onClickAdvancedOptions = () => {
266
222
  const toolkitBaseUrl = TOOLKIT_BASE_URL[environment];
267
- const data = {
268
- tokenAddress: tokenAddress ?? '',
269
- amount: amount ?? '',
270
- };
271
-
272
- localTrack('AdvancedOptions', { ...data, widgetEvent });
273
-
274
223
  window.open(`${toolkitBaseUrl}/squid-bridge/`, '_blank');
275
224
  };
276
225
 
@@ -8,7 +8,6 @@ import {
8
8
  } from '@imtbl/checkout-sdk';
9
9
  import React, { Suspense } from 'react';
10
10
  import { Base } from '../BaseWidgetRoot';
11
- import { CustomAnalyticsProvider } from '../../context/analytics-provider/CustomAnalyticsProvider';
12
11
  import { HandoverProvider } from '../../context/handover-context/HandoverProvider';
13
12
  import i18n from '../../i18n';
14
13
  import { LoadingView } from '../../views/loading/LoadingView';
@@ -71,35 +70,35 @@ export class AddTokens extends Base<WidgetType.ADD_TOKENS> {
71
70
 
72
71
  this.reactRoot.render(
73
72
  <React.StrictMode>
74
- <CustomAnalyticsProvider checkout={this.checkout}>
75
- <ThemeProvider id="add-tokens-container" config={this.strongConfig()}>
76
- <HandoverProvider>
77
- <ProvidersContextProvider
78
- initialState={{
79
- checkout: this.checkout,
80
- toProvider: this.parameters.toProvider,
81
- }}
82
- >
83
- <Suspense
84
- fallback={
85
- <LoadingView loadingText={t('views.LOADING_VIEW.text')} />
73
+
74
+ <ThemeProvider id="add-tokens-container" config={this.strongConfig()}>
75
+ <HandoverProvider>
76
+ <ProvidersContextProvider
77
+ initialState={{
78
+ checkout: this.checkout,
79
+ toProvider: this.parameters.toProvider,
80
+ }}
81
+ >
82
+ <Suspense
83
+ fallback={
84
+ <LoadingView loadingText={t('views.LOADING_VIEW.text')} />
86
85
  }
87
- >
88
- <AddTokensWidget
89
- config={this.strongConfig()}
90
- toTokenAddress={this.parameters.toTokenAddress}
91
- toAmount={this.parameters.toAmount}
92
- showBridgeOption={this.parameters.showBridgeOption}
93
- showSwapOption={this.parameters.showSwapOption}
94
- showOnrampOption={this.parameters.showOnrampOption}
95
- showBackButton={this.parameters.showBackButton}
96
- experiments={this.parameters.experiments}
97
- />
98
- </Suspense>
99
- </ProvidersContextProvider>
100
- </HandoverProvider>
101
- </ThemeProvider>
102
- </CustomAnalyticsProvider>
86
+ >
87
+ <AddTokensWidget
88
+ config={this.strongConfig()}
89
+ toTokenAddress={this.parameters.toTokenAddress}
90
+ toAmount={this.parameters.toAmount}
91
+ showBridgeOption={this.parameters.showBridgeOption}
92
+ showSwapOption={this.parameters.showSwapOption}
93
+ showOnrampOption={this.parameters.showOnrampOption}
94
+ showBackButton={this.parameters.showBackButton}
95
+ experiments={this.parameters.experiments}
96
+ />
97
+ </Suspense>
98
+ </ProvidersContextProvider>
99
+ </HandoverProvider>
100
+ </ThemeProvider>
101
+
103
102
  </React.StrictMode>,
104
103
  );
105
104
  }
@@ -25,10 +25,6 @@ import {
25
25
  import { AddTokens } from './views/AddTokens';
26
26
  import { ErrorView } from '../../views/error/ErrorView';
27
27
  import { useSquid } from '../../lib/squid/hooks/useSquid';
28
- import {
29
- useAnalytics,
30
- UserJourney,
31
- } from '../../context/analytics-provider/SegmentAnalyticsProvider';
32
28
  import { fetchChains } from '../../lib/squid/functions/fetchChains';
33
29
  import { StrongCheckoutWidgetsConfig } from '../../lib/withDefaultWidgetConfig';
34
30
  import { Review } from './views/Review';
@@ -65,8 +61,6 @@ export default function AddTokensWidget({
65
61
  history: [{ type: AddTokensWidgetViews.ADD_TOKENS }],
66
62
  });
67
63
  const { t } = useTranslation();
68
- const { page } = useAnalytics();
69
-
70
64
  const viewReducerValues = useMemo(
71
65
  () => ({
72
66
  viewState,
@@ -130,7 +124,7 @@ export default function AddTokensWidget({
130
124
 
131
125
  useEffect(() => {
132
126
  if (config.environment !== Environment.PRODUCTION) {
133
- showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR, { contextId: id });
127
+ showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR);
134
128
  }
135
129
  }, [config, id]);
136
130
 
@@ -151,7 +145,7 @@ export default function AddTokensWidget({
151
145
  const isInvalidToAmount = toAmount && !amountInputValidation(toAmount);
152
146
 
153
147
  if (isInvalidToTokenAddress || isInvalidToAmount) {
154
- showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS, { contextId: id });
148
+ showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS);
155
149
  }
156
150
  }, [toTokenAddress, toAmount, id]);
157
151
 
@@ -281,15 +275,6 @@ export default function AddTokensWidget({
281
275
  actionText={t('views.ERROR_VIEW.actionText')}
282
276
  onActionClick={errorAction}
283
277
  onCloseClick={() => sendAddTokensCloseEvent(eventTarget)}
284
- errorEventAction={() => {
285
- page({
286
- userJourney: UserJourney.ADD_TOKENS,
287
- screen: 'Error',
288
- extras: {
289
- contextId: id,
290
- },
291
- });
292
- }}
293
278
  />
294
279
  )}
295
280
  {viewState.view.type
@@ -32,10 +32,6 @@ import {
32
32
  getTokenImageByAddress,
33
33
  isNativeToken,
34
34
  } from '../../../lib/utils';
35
- import {
36
- useAnalytics,
37
- UserJourney,
38
- } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
39
35
  import { AddTokensErrorTypes } from '../types';
40
36
  import { TokenImage } from '../../../components/TokenImage/TokenImage';
41
37
  import { PULSE_SHADOW } from '../utils/animation';
@@ -62,9 +58,7 @@ export function TokenDrawerMenu({
62
58
  const defaultTokenImage = getDefaultTokenImage(
63
59
  checkout?.config.environment,
64
60
  config.theme,
65
- );
66
- const { track } = useAnalytics();
67
- const { t } = useTranslation();
61
+ ); const { t } = useTranslation();
68
62
 
69
63
  const setSelectedToken = (token: TokenInfo | undefined) => {
70
64
  addTokensDispatch({
@@ -77,16 +71,6 @@ export function TokenDrawerMenu({
77
71
 
78
72
  const handleTokenChange = useCallback(
79
73
  (token: TokenInfo) => {
80
- track({
81
- userJourney: UserJourney.ADD_TOKENS,
82
- screen: 'InputScreen',
83
- control: 'TokensMenu',
84
- controlType: 'MenuItem',
85
- extras: {
86
- contextId: addTokensState.id,
87
- tokenAddress: token?.address,
88
- },
89
- });
90
74
  setSelectedToken(token);
91
75
  setVisible(false);
92
76
  setSearchValue('');
@@ -188,7 +172,7 @@ export function TokenDrawerMenu({
188
172
  });
189
173
  }
190
174
  } catch (error) {
191
- showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { contextId: addTokensState.id, error });
175
+ showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN);
192
176
  }
193
177
  })();
194
178
  }, [addTokensState.tokens, checkout, toTokenAddress]);