@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
@@ -1,6 +1,6 @@
1
1
  import { Box } from '@biom3/react';
2
2
  import {
3
- useCallback, useContext, useEffect, useMemo, useState,
3
+ useCallback, useContext, useMemo, useState,
4
4
  } from 'react';
5
5
  import { CheckoutError, CheckoutErrorType, TokenInfo } from '@imtbl/checkout-sdk';
6
6
  import { useTranslation } from 'react-i18next';
@@ -22,16 +22,12 @@ import { ConnectLoaderContext } from '../../../context/connect-loader-context/Co
22
22
  import { SpendingCapHero } from '../../../components/Hero/SpendingCapHero';
23
23
  import { WalletApproveHero } from '../../../components/Hero/WalletApproveHero';
24
24
  import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
25
- import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
26
25
  import { isPassportProvider } from '../../../lib/provider';
27
26
 
28
27
  export interface ApproveERC20Props {
29
28
  data: ApproveERC20SwapData;
30
29
  }
31
30
 
32
- const APPROVE_SPENDING = 'ApproveSpending';
33
- const APPROVE_SWAP = 'ApproveSwap';
34
-
35
31
  export function ApproveERC20Onboarding({ data }: ApproveERC20Props) {
36
32
  const { t } = useTranslation();
37
33
  const { swapState: { allowedTokens } } = useContext(SwapContext);
@@ -51,19 +47,6 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) {
51
47
  // reject transaction flags
52
48
  const [rejectedSpending, setRejectedSpending] = useState(false);
53
49
  const [rejectedSwap, setRejectedSwap] = useState(false);
54
-
55
- const { page, track } = useAnalytics();
56
-
57
- useEffect(() => {
58
- page({
59
- userJourney: UserJourney.SWAP,
60
- screen: noApprovalTransaction ? APPROVE_SWAP : APPROVE_SPENDING,
61
- extras: {
62
- swapFormInfo: data.swapFormInfo,
63
- },
64
- });
65
- }, []);
66
-
67
50
  // Get symbol from swap info for approve amount text
68
51
  const fromToken = useMemo(
69
52
  () => allowedTokens.find(
@@ -152,15 +135,6 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) {
152
135
 
153
136
  const handleApproveSpendingClick = useCallback(async () => {
154
137
  if (loading) return;
155
- track({
156
- userJourney: UserJourney.SWAP,
157
- screen: APPROVE_SPENDING,
158
- control: APPROVE_SPENDING,
159
- controlType: 'Button',
160
- extras: {
161
- autoProceed: data.autoProceed,
162
- },
163
- });
164
138
  setLoading(true);
165
139
 
166
140
  if (!checkout || !provider) {
@@ -256,15 +230,6 @@ export function ApproveERC20Onboarding({ data }: ApproveERC20Props) {
256
230
 
257
231
  const handleApproveSwapClick = useCallback(async () => {
258
232
  if (loading) return;
259
- track({
260
- userJourney: UserJourney.SWAP,
261
- screen: APPROVE_SWAP,
262
- control: APPROVE_SWAP,
263
- controlType: 'Button',
264
- extras: {
265
- autoProceed: data.autoProceed,
266
- },
267
- });
268
233
  setLoading(true);
269
234
 
270
235
  if (!checkout || !provider) {
@@ -19,7 +19,6 @@ import { SwapContext } from '../context/SwapContext';
19
19
  import { NotEnoughImx } from '../../../components/NotEnoughImx/NotEnoughImx';
20
20
  import { IMX_TOKEN_SYMBOL } from '../../../lib';
21
21
  import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
22
- import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
23
22
  import { isPassportProvider } from '../../../lib/provider';
24
23
  import { LoadingView } from '../../../views/loading/LoadingView';
25
24
  import { orchestrationEvents } from '../../../lib/orchestrationEvents';
@@ -70,22 +69,6 @@ export function SwapCoins({
70
69
  } = useContext(ConnectLoaderContext);
71
70
 
72
71
  const [showNotEnoughImxDrawer, setShowNotEnoughImxDrawer] = useState(false);
73
-
74
- const { page } = useAnalytics();
75
-
76
- useEffect(() => {
77
- page({
78
- userJourney: UserJourney.SWAP,
79
- screen: 'SwapCoins',
80
- extras: {
81
- fromAmount,
82
- toAmount,
83
- fromTokenAddress,
84
- toTokenAddress,
85
- },
86
- });
87
- }, []);
88
-
89
72
  useEffect(() => {
90
73
  if (hasZeroBalance(tokenBalances, IMX_TOKEN_SYMBOL) && !isPassportProvider(provider)) {
91
74
  setShowNotEnoughImxDrawer(true);
@@ -10,7 +10,6 @@ import {
10
10
  SwapWidgetViews,
11
11
  } from '../../../context/view-context/SwapViewContextTypes';
12
12
  import { LoadingView } from '../../../views/loading/LoadingView';
13
- import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
14
13
 
15
14
  interface SwapInProgressProps {
16
15
  transactionResponse: TransactionResponse;
@@ -23,19 +22,6 @@ export function SwapInProgress({
23
22
  }: SwapInProgressProps) {
24
23
  const { t } = useTranslation();
25
24
  const { viewDispatch } = useContext(ViewContext);
26
-
27
- const { page } = useAnalytics();
28
-
29
- useEffect(() => {
30
- page({
31
- userJourney: UserJourney.SWAP,
32
- screen: 'SwapInProgress',
33
- extras: {
34
- swapFormInfo: swapForm,
35
- },
36
- });
37
- }, []);
38
-
39
25
  useEffect(() => {
40
26
  (async () => {
41
27
  try {
@@ -10,7 +10,6 @@ import { SelectInput } from '../../components/FormComponents/SelectInput/SelectI
10
10
  import { TextInputForm } from '../../components/FormComponents/TextInputForm/TextInputForm';
11
11
  import { HeaderNavigation } from '../../components/Header/HeaderNavigation';
12
12
  import { SimpleLayout } from '../../components/SimpleLayout/SimpleLayout';
13
- import { useAnalytics, UserJourney } from '../../context/analytics-provider/SegmentAnalyticsProvider';
14
13
  import { CryptoFiatContext } from '../../context/crypto-fiat-context/CryptoFiatContext';
15
14
  import { EventTargetContext } from '../../context/event-target-context/EventTargetContext';
16
15
  import { orchestrationEvents } from '../../lib/orchestrationEvents';
@@ -42,9 +41,7 @@ export function TransferForm({
42
41
  title: string;
43
42
  coinAmountTitle: string;
44
43
  }) {
45
- const { t } = useTranslation();
46
- const { track } = useAnalytics();
47
- const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
44
+ const { t } = useTranslation(); const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
48
45
  const { cryptoFiatState } = useContext(CryptoFiatContext);
49
46
 
50
47
  const tokenOptions = useMemo(
@@ -88,36 +85,20 @@ export function TransferForm({
88
85
 
89
86
  const handleTokenChange = useCallback(
90
87
  (optionKey: OptionKey) => {
91
- track({
92
- screen: 'TransferToken',
93
- userJourney: UserJourney.TRANSFER,
94
- control: 'SelectToken',
95
- controlType: 'Select',
96
- extras: { token: optionKey },
97
- });
98
88
  if (typeof optionKey !== 'string') throw new Error('Invalid token address');
99
89
  setViewState((s) => ({ ...s, tokenAddress: optionKey, amountError: '' }));
100
90
  },
101
- [setViewState, track],
91
+ [setViewState],
102
92
  );
103
93
 
104
94
  const handleMaxButtonClick = useCallback(() => {
105
95
  if (!token) throw new Error('Token not found');
106
96
  if (!token.balance) throw new Error('Token balance not found');
107
-
108
- track({
109
- screen: 'TransferToken',
110
- userJourney: UserJourney.TRANSFER,
111
- control: 'Max',
112
- controlType: 'Button',
113
- extras: { token: token.id, amount: token.balance.fullBalance },
114
- });
115
-
116
97
  setViewState((s) => {
117
98
  if (!token.balance) throw new Error('Token balance not found');
118
99
  return { ...s, amount: token.balance.fullBalance };
119
100
  });
120
- }, [token, setViewState, track]);
101
+ }, [token, setViewState]);
121
102
 
122
103
  const handleRecipientAddressChange = useCallback((value: string) => {
123
104
  setViewState((s) => ({ ...s, toAddress: value, toAddressError: '' }));
@@ -188,9 +169,6 @@ export function TransferForm({
188
169
  onSelectChange={handleTokenChange}
189
170
  selectedOption={token?.id}
190
171
  defaultTokenImage={defaultTokenImage}
191
- userJourney={UserJourney.TRANSFER}
192
- screen="TransferToken"
193
- control="Token"
194
172
  theme={config.theme}
195
173
  themeOverrides={config.themeOverrides}
196
174
  />
@@ -10,10 +10,6 @@ import { CloudImage, Stack, useTheme } from '@biom3/react';
10
10
  import { isAddress, isError, parseUnits } from 'ethers';
11
11
  import { StrongCheckoutWidgetsConfig } from '../../lib/withDefaultWidgetConfig';
12
12
  import { LoadingView } from '../../views/loading/LoadingView';
13
- import {
14
- useAnalytics,
15
- UserJourney,
16
- } from '../../context/analytics-provider/SegmentAnalyticsProvider';
17
13
  import { ConnectLoaderContext } from '../../context/connect-loader-context/ConnectLoaderContext';
18
14
  import { getRemoteImage } from '../../lib/utils';
19
15
  import {
@@ -41,8 +37,6 @@ function TransferWidgetInner(props: TransferWidgetInputs) {
41
37
  const { t } = useTranslation();
42
38
  const { cryptoFiatDispatch } = useContext(CryptoFiatContext);
43
39
  const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
44
- const { track } = useAnalytics();
45
-
46
40
  const {
47
41
  connectLoaderState: { checkout, provider },
48
42
  } = useContext(ConnectLoaderContext);
@@ -89,15 +83,6 @@ function TransferWidgetInner(props: TransferWidgetInputs) {
89
83
 
90
84
  const onSend = useCallback(async () => {
91
85
  if (viewState.type !== 'FORM') throw new Error('Unexpected state');
92
-
93
- track({
94
- screen: 'TransferToken',
95
- userJourney: UserJourney.TRANSFER,
96
- control: 'Send',
97
- controlType: 'Button',
98
- extras: { token: viewState.tokenAddress, amount: viewState.amount },
99
- });
100
-
101
86
  if (!isAddress(viewState.toAddress)) {
102
87
  setViewState((s) => ({ ...s, toAddressError: 'Invalid wallet address' }));
103
88
  return;
@@ -177,13 +162,6 @@ function TransferWidgetInner(props: TransferWidgetInputs) {
177
162
  && 'code' in e.error
178
163
  && e.error.code === TRANSACTION_CANCELLED_ERROR_CODE
179
164
  ) {
180
- track({
181
- screen: 'TransferToken',
182
- userJourney: UserJourney.TRANSFER,
183
- control: 'TranactionCancel',
184
- controlType: 'Event',
185
- extras: { token: viewState.tokenAddress, amount: viewState.amount },
186
- });
187
165
  sendRejectedEvent(eventTarget, 'Transaction cancelled');
188
166
  } else {
189
167
  // eslint-disable-next-line no-console
@@ -192,7 +170,7 @@ function TransferWidgetInner(props: TransferWidgetInputs) {
192
170
  setViewState({ ...viewState, type: 'FORM' }); // TODO: We should be showing a failed view here
193
171
  }
194
172
  }
195
- }, [viewState, eventTarget, track]);
173
+ }, [viewState, eventTarget]);
196
174
 
197
175
  switch (viewState.type) {
198
176
  case 'INITIALISING':
@@ -12,7 +12,6 @@ import { Base } from '../BaseWidgetRoot';
12
12
  import { ConnectLoader, ConnectLoaderParams } from '../../components/ConnectLoader/ConnectLoader';
13
13
  import { isValidWalletProvider } from '../../lib/validations/widgetValidators';
14
14
  import { ThemeProvider } from '../../components/ThemeProvider/ThemeProvider';
15
- import { CustomAnalyticsProvider } from '../../context/analytics-provider/CustomAnalyticsProvider';
16
15
  import { LoadingView } from '../../views/loading/LoadingView';
17
16
  import { HandoverProvider } from '../../context/handover-context/HandoverProvider';
18
17
  import { sendWalletWidgetCloseEvent } from './WalletWidgetEvents';
@@ -79,32 +78,32 @@ export class Wallet extends Base<WidgetType.WALLET> {
79
78
 
80
79
  this.reactRoot.render(
81
80
  <React.StrictMode>
82
- <CustomAnalyticsProvider checkout={this.checkout}>
83
- <ThemeProvider id="wallet-container" config={this.strongConfig()}>
84
- <HandoverProvider>
85
- <ConnectLoader
86
- widgetConfig={this.strongConfig()}
87
- params={connectLoaderParams}
88
- closeEvent={() => sendWalletWidgetCloseEvent(window)}
89
- >
90
- <Suspense
91
- fallback={
92
- <LoadingView loadingText={t('views.LOADING_VIEW.text')} />
81
+
82
+ <ThemeProvider id="wallet-container" config={this.strongConfig()}>
83
+ <HandoverProvider>
84
+ <ConnectLoader
85
+ widgetConfig={this.strongConfig()}
86
+ params={connectLoaderParams}
87
+ closeEvent={() => sendWalletWidgetCloseEvent(window)}
88
+ >
89
+ <Suspense
90
+ fallback={
91
+ <LoadingView loadingText={t('views.LOADING_VIEW.text')} />
93
92
  }
94
- >
95
- <WalletWidget
96
- config={this.strongConfig()}
97
- walletConfig={{
98
- showDisconnectButton:
93
+ >
94
+ <WalletWidget
95
+ config={this.strongConfig()}
96
+ walletConfig={{
97
+ showDisconnectButton:
99
98
  this.properties.config?.showDisconnectButton!,
100
- showNetworkMenu: this.properties.config?.showNetworkMenu!,
101
- }}
102
- />
103
- </Suspense>
104
- </ConnectLoader>
105
- </HandoverProvider>
106
- </ThemeProvider>
107
- </CustomAnalyticsProvider>
99
+ showNetworkMenu: this.properties.config?.showNetworkMenu!,
100
+ }}
101
+ />
102
+ </Suspense>
103
+ </ConnectLoader>
104
+ </HandoverProvider>
105
+ </ThemeProvider>
106
+
108
107
  </React.StrictMode>,
109
108
  );
110
109
  }
@@ -18,10 +18,6 @@ import { formatZeroAmount, tokenValueFormat } from '../../../../lib/utils';
18
18
  import { ConnectLoaderContext } from '../../../../context/connect-loader-context/ConnectLoaderContext';
19
19
  import { isPassportProvider } from '../../../../lib/provider';
20
20
  import { EventTargetContext } from '../../../../context/event-target-context/EventTargetContext';
21
- import {
22
- UserJourney,
23
- useAnalytics,
24
- } from '../../../../context/analytics-provider/SegmentAnalyticsProvider';
25
21
 
26
22
  export interface BalanceItemProps {
27
23
  balanceInfo: BalanceInfo;
@@ -34,9 +30,7 @@ export function BalanceItem({
34
30
  theme,
35
31
  bridgeToL2OnClick,
36
32
  }: BalanceItemProps) {
37
- const { connectLoaderState } = useContext(ConnectLoaderContext);
38
- const { track } = useAnalytics();
39
- const { checkout, provider } = connectLoaderState;
33
+ const { connectLoaderState } = useContext(ConnectLoaderContext); const { checkout, provider } = connectLoaderState;
40
34
  const fiatAmount = `≈ USD $${formatZeroAmount(balanceInfo.fiatAmount)}`;
41
35
  const { walletState } = useContext(WalletContext);
42
36
  const { supportedTopUps, network } = walletState;
@@ -126,17 +120,6 @@ export function BalanceItem({
126
120
  ]);
127
121
 
128
122
  const handleAddTokenClick = () => {
129
- track({
130
- userJourney: UserJourney.WALLET,
131
- screen: 'WalletBalances',
132
- control: 'AddTokens',
133
- controlType: 'Button',
134
- extras: {
135
- tokenSymbol: balanceInfo.symbol,
136
- tokenAddress: balanceInfo.address,
137
- },
138
- });
139
-
140
123
  if (isAddTokensEnabled) {
141
124
  orchestrationEvents.sendRequestAddTokensEvent(
142
125
  eventTarget,
@@ -184,18 +167,6 @@ export function BalanceItem({
184
167
  <MenuItem.OverflowPopoverMenu
185
168
  size="small"
186
169
  testId="token-menu"
187
- onClick={() => {
188
- track({
189
- userJourney: UserJourney.WALLET,
190
- screen: 'WalletBalances',
191
- control: 'BalanceItem',
192
- controlType: 'Button',
193
- extras: {
194
- tokenSymbol: balanceInfo.symbol,
195
- tokenAddress: balanceInfo.address,
196
- },
197
- });
198
- }}
199
170
  >
200
171
  <MenuItem
201
172
  testId="balance-item-add-option"
@@ -209,16 +180,6 @@ export function BalanceItem({
209
180
  testId="balance-item-swap-option"
210
181
  sx={ShowMenuItem(isSwapEnabled)}
211
182
  onClick={() => {
212
- track({
213
- userJourney: UserJourney.WALLET,
214
- screen: 'WalletBalances',
215
- control: 'SwapTokens',
216
- controlType: 'Button',
217
- extras: {
218
- tokenSymbol: balanceInfo.symbol,
219
- tokenAddress: balanceInfo.address,
220
- },
221
- });
222
183
  orchestrationEvents.sendRequestSwapEvent(
223
184
  eventTarget,
224
185
  IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT,
@@ -237,16 +198,6 @@ export function BalanceItem({
237
198
  testId="balance-item-move-option"
238
199
  sx={ShowMenuItem(isBridgeEnabled)}
239
200
  onClick={() => {
240
- track({
241
- userJourney: UserJourney.WALLET,
242
- screen: 'WalletBalances',
243
- control: 'MoveTokens',
244
- controlType: 'Button',
245
- extras: {
246
- tokenSymbol: balanceInfo.symbol,
247
- tokenAddress: balanceInfo.address,
248
- },
249
- });
250
201
  bridgeToL2OnClick(balanceInfo.address);
251
202
  }}
252
203
  >
@@ -33,7 +33,6 @@ import {
33
33
  ConnectLoaderContext,
34
34
  } from '../../../../context/connect-loader-context/ConnectLoaderContext';
35
35
  import { EventTargetContext } from '../../../../context/event-target-context/EventTargetContext';
36
- import { UserJourney, useAnalytics } from '../../../../context/analytics-provider/SegmentAnalyticsProvider';
37
36
 
38
37
  export function NetworkMenu() {
39
38
  const { t } = useTranslation();
@@ -46,21 +45,9 @@ export function NetworkMenu() {
46
45
  const [allowedNetworks, setNetworks] = useState<NetworkInfo[] | undefined>(
47
46
  [],
48
47
  );
49
- const { track } = useAnalytics();
50
-
51
48
  const switchNetwork = useCallback(
52
49
  async (chainId: ChainId) => {
53
50
  if (!checkout || !provider || !network || Number(network.chainId) === chainId) return;
54
- track({
55
- userJourney: UserJourney.WALLET,
56
- screen: 'WalletBalances',
57
- control: 'SwitchNetwork',
58
- controlType: 'Button',
59
- extras: {
60
- chainId,
61
- },
62
- });
63
-
64
51
  try {
65
52
  const switchNetworkResult = await checkout.switchNetwork({
66
53
  provider,
@@ -6,10 +6,6 @@ import {
6
6
  import { useEffect, useMemo, useState } from 'react';
7
7
  import { useTranslation } from 'react-i18next';
8
8
  import { WrappedBrowserProvider } from '@imtbl/checkout-sdk';
9
- import {
10
- UserJourney,
11
- useAnalytics,
12
- } from '../../../../context/analytics-provider/SegmentAnalyticsProvider';
13
9
  import { getWalletLogoByName } from '../../../../lib/logoUtils';
14
10
  import { getWalletProviderNameByProvider, isPassportProvider } from '../../../../lib/provider';
15
11
  import { abbreviateWalletAddress } from '../../../../lib/utils';
@@ -36,9 +32,6 @@ export function WalletAddress({
36
32
  const [isCopied, setIsCopied] = useState(false);
37
33
 
38
34
  const { t } = useTranslation();
39
-
40
- const { track } = useAnalytics();
41
-
42
35
  const ctaIcon = useMemo<AllIconKeys>(() => {
43
36
  if (isPassportProvider(provider) && !showL1Warning) {
44
37
  return 'ShowPassword';
@@ -57,12 +50,6 @@ export function WalletAddress({
57
50
 
58
51
  const handleIconClick = async () => {
59
52
  if (walletAddress && ctaIcon === 'CopyText') {
60
- track({
61
- userJourney: UserJourney.WALLET,
62
- screen: 'Settings',
63
- control: 'CopyWalletAddress',
64
- controlType: 'Button',
65
- });
66
53
  navigator.clipboard.writeText(walletAddress);
67
54
  setIsCopied(true);
68
55
  setTimeout(() => setIsCopied(false), 1000);
@@ -1,4 +1,4 @@
1
- import { useContext, useEffect } from 'react';
1
+ import { useContext } from 'react';
2
2
  import { Link } from '@biom3/react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { FooterLogo } from '../../../components/Footer/FooterLogo';
@@ -9,22 +9,11 @@ import { IMXCoinsHero } from '../../../components/Hero/IMXCoinsHero';
9
9
  import { ConnectLoaderContext } from '../../../context/connect-loader-context/ConnectLoaderContext';
10
10
  import { isPassportProvider } from '../../../lib/provider';
11
11
  import { FAQS_LINK } from '../../../lib';
12
- import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
13
12
 
14
13
  export function CoinInfo() {
15
14
  const { t } = useTranslation();
16
15
  const { connectLoaderState: { provider } } = useContext(ConnectLoaderContext);
17
16
  const isPassport = isPassportProvider(provider);
18
-
19
- const { page } = useAnalytics();
20
-
21
- useEffect(() => {
22
- page({
23
- userJourney: UserJourney.WALLET,
24
- screen: 'CoinInfo',
25
- });
26
- }, []);
27
-
28
17
  return (
29
18
  <SimpleLayout
30
19
  testId="coin-info"
@@ -1,5 +1,5 @@
1
1
  import { Box, Button } from '@biom3/react';
2
- import { useContext, useEffect, useState } from 'react';
2
+ import { useContext, useState } from 'react';
3
3
  import { useTranslation } from 'react-i18next';
4
4
  import { useWalletConnect } from '../../../lib/hooks/useWalletConnect';
5
5
  import { isWalletConnectProvider } from '../../../lib/provider';
@@ -17,10 +17,6 @@ import {
17
17
  } from './SettingsStyles';
18
18
  import { ConnectLoaderContext } from '../../../context/connect-loader-context/ConnectLoaderContext';
19
19
  import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
20
- import {
21
- UserJourney,
22
- useAnalytics,
23
- } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
24
20
  import { TransferAssetsL1Warning } from '../components/TransferAssetsL1Warning';
25
21
 
26
22
  export interface SettingsProps {
@@ -38,16 +34,6 @@ export function Settings({ showDisconnectButton }: SettingsProps) {
38
34
  } = useContext(EventTargetContext);
39
35
 
40
36
  const { ethereumProvider } = useWalletConnect();
41
-
42
- const { page } = useAnalytics();
43
-
44
- useEffect(() => {
45
- page({
46
- userJourney: UserJourney.WALLET,
47
- screen: 'Settings',
48
- });
49
- }, []);
50
-
51
37
  // disconnect all Wallet Connect pairings and disconnect the provider
52
38
  // so that restoreSession doesn't pick up the previous sessions
53
39
  const handleWCDisconnect = async () => {
@@ -29,7 +29,6 @@ import {
29
29
  import { orchestrationEvents } from '../../../lib/orchestrationEvents';
30
30
  import { ConnectLoaderContext } from '../../../context/connect-loader-context/ConnectLoaderContext';
31
31
  import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
32
- import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
33
32
  import { BalanceInfo, mapTokenBalancesWithConversions } from '../functions/tokenBalances';
34
33
  import { isPassportProvider } from '../../../lib/provider';
35
34
 
@@ -60,9 +59,6 @@ export function WalletBalances({
60
59
  const { conversions } = cryptoFiatState;
61
60
  const isPassport = isPassportProvider(provider);
62
61
  const enableNetworkMenu = !isPassport && showNetworkMenu;
63
-
64
- const { track, page } = useAnalytics();
65
-
66
62
  const balanceInfos: BalanceInfo[] = useMemo(
67
63
  () => {
68
64
  if (!network?.chainId) return [];
@@ -71,14 +67,6 @@ export function WalletBalances({
71
67
  },
72
68
  [tokenBalances, conversions, network?.chainId],
73
69
  );
74
-
75
- useEffect(() => {
76
- page({
77
- userJourney: UserJourney.WALLET,
78
- screen: 'WalletBalances',
79
- });
80
- }, []);
81
-
82
70
  useEffect(() => {
83
71
  (async () => {
84
72
  if (!checkout) return;
@@ -120,12 +108,6 @@ export function WalletBalances({
120
108
  }, [checkout, network, supportedTopUps]);
121
109
 
122
110
  const handleAddCoinsClick = () => {
123
- track({
124
- userJourney: UserJourney.WALLET,
125
- screen: 'WalletBalances',
126
- control: 'AddCoins',
127
- controlType: 'Button',
128
- });
129
111
  orchestrationEvents.sendRequestAddTokensEvent(eventTarget, IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT, {});
130
112
  };
131
113
 
@@ -148,12 +130,6 @@ export function WalletBalances({
148
130
  sx={ButtonNavigationStyles()}
149
131
  iconVariant="bold"
150
132
  onClick={() => {
151
- track({
152
- userJourney: UserJourney.WALLET,
153
- screen: 'WalletBalances',
154
- control: 'Settings',
155
- controlType: 'Button',
156
- });
157
133
  viewDispatch({
158
134
  payload: {
159
135
  type: ViewActions.UPDATE_VIEW,
package/tsconfig.json CHANGED
@@ -12,7 +12,6 @@
12
12
  "jsxImportSource": "@emotion/react",
13
13
  "experimentalDecorators": true,
14
14
  "types": [
15
- "@segment/analytics-next",
16
15
  "jest",
17
16
  "node"
18
17
  ],