@imtbl/checkout-widgets 2.24.8 → 2.24.9-1

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-CAnsz6Ds.js} +24 -297
  2. package/dist/browser/{BridgeWidget-6KlgTXwZ.js → BridgeWidget-BPonD-21.js} +13 -294
  3. package/dist/browser/{CommerceWidget-CcCuv661.js → CommerceWidget-BPFWRX2R.js} +17 -47
  4. package/dist/browser/{FeesBreakdown-DvoQJlP-.js → FeesBreakdown-7fI38j9m.js} +1 -1
  5. package/dist/browser/{OnRampWidget-DaL34PiA.js → OnRampWidget-BahAHZlJ.js} +5 -80
  6. package/dist/browser/{SaleWidget-D-IBBRTL.js → SaleWidget-CaNtBz3t.js} +61 -219
  7. package/dist/browser/{SpendingCapHero-Z5NIcrWw.js → SpendingCapHero-SdeBfZ_3.js} +1 -1
  8. package/dist/browser/{SwapWidget-C4B2Answ.js → SwapWidget-r9E9O8w8.js} +12 -206
  9. package/dist/browser/{TokenImage-DucOedrZ.js → TokenImage-Cc4dAr3U.js} +1 -1
  10. package/dist/browser/{TopUpView-BIvdNYib.js → TopUpView-CKIcuXnF.js} +3 -54
  11. package/dist/browser/{WalletApproveHero-ge2JSOYk.js → WalletApproveHero-ZZhVhTT2.js} +4 -12
  12. package/dist/browser/{WalletWidget-hiUotMuQ.js → WalletWidget-Bf6bDJdr.js} +4 -96
  13. package/dist/browser/{index-2esq4Cem.js → index-Bs2uHEgi.js} +1275 -9717
  14. package/dist/browser/{index-DWNAmu0n.js → index-Bs7IKKJt.js} +1 -1
  15. package/dist/browser/index.js +1 -1
  16. package/dist/browser/{useInterval-1gu4cbu3.js → useInterval-C6NhVtCa.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,16 +1,16 @@
1
- import { I as IMTBLWidgetEvents, C as CommerceFlowType, P as ProviderEventType, a as CommerceEventType, b as ConnectEventType, c as CommerceFailureEventType, d as CommerceSuccessEventType, W as WalletEventType, e as CommerceUserActionEventType, S as SwapEventType, A as AddTokensEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as PurchaseEventType, T as TransferEventType, h as OrchestrationEventType, r as reactExports, V as ViewActions, p as parseUnits, i as formatZeroAmount, j as calculateCryptoToFiat, k as Contract, l as TokenFilterTypes, u as useTranslation, m as dist, n as getRemoteRive, o as BlockExplorerService, q as jsx, s as jsxs, t as Box, H as Heading, L as Link, v as Button, w as Stack, x as SimpleLayout, y as Body, z as useAnalytics, E as EventTargetContext, D as CryptoFiatContext, F as tokenValueFormat, G as getDefaultTokenImage, U as UserJourney, J as HeaderNavigation, K as sendCloseWidgetEvent, M as orchestrationEvents$1, N as amountInputValidation, Q as useTheme, R as CloudImage, X as getRemoteImage, Y as CryptoFiatProvider, Z as ConnectLoaderContext, _ as isAddress, $ as isError, a0 as LoadingView, a1 as CryptoFiatActions, a2 as useViewState, a3 as useEventTargetState, a4 as commerceFlows, a5 as SharedViews, a6 as ErrorView, a7 as ConnectWidget, a8 as ProvidersContextProvider, a9 as PurchaseWidget, aa as ConnectLoader, ab as ViewContextProvider } from './index-2esq4Cem.js';
2
- import { S as SelectInput, a as SwapWidget } from './SwapWidget-C4B2Answ.js';
3
- import { B as BridgeWidget } from './BridgeWidget-6KlgTXwZ.js';
4
- import OnRampWidget from './OnRampWidget-DaL34PiA.js';
5
- import WalletWidget from './WalletWidget-hiUotMuQ.js';
6
- import SaleWidget from './SaleWidget-D-IBBRTL.js';
7
- import AddTokensWidget from './AddTokensWidget-BQfrLKCo.js';
8
- import { g as getAllowedBalances, T as TextInputForm } from './WalletApproveHero-ge2JSOYk.js';
9
- import './useInterval-1gu4cbu3.js';
10
- import './TopUpView-BIvdNYib.js';
11
- import './FeesBreakdown-DvoQJlP-.js';
12
- import './SpendingCapHero-Z5NIcrWw.js';
13
- import './TokenImage-DucOedrZ.js';
1
+ import { I as IMTBLWidgetEvents, C as CommerceFlowType, P as ProviderEventType, a as CommerceEventType, b as ConnectEventType, c as CommerceFailureEventType, d as CommerceSuccessEventType, W as WalletEventType, e as CommerceUserActionEventType, S as SwapEventType, A as AddTokensEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as PurchaseEventType, T as TransferEventType, h as OrchestrationEventType, r as reactExports, V as ViewActions, p as parseUnits, i as formatZeroAmount, j as calculateCryptoToFiat, k as Contract, l as TokenFilterTypes, u as useTranslation, m as dist, n as getRemoteRive, o as BlockExplorerService, q as jsx, s as jsxs, t as Box, H as Heading, L as Link, v as Button, w as Stack, x as SimpleLayout, y as Body, E as EventTargetContext, z as CryptoFiatContext, D as tokenValueFormat, F as getDefaultTokenImage, G as HeaderNavigation, J as sendCloseWidgetEvent, K as orchestrationEvents$1, M as amountInputValidation, N as useTheme, Q as CloudImage, R as getRemoteImage, U as CryptoFiatProvider, X as ConnectLoaderContext, Y as isAddress, Z as isError, _ as LoadingView, $ as CryptoFiatActions, a0 as useViewState, a1 as useEventTargetState, a2 as commerceFlows, a3 as SharedViews, a4 as ErrorView, a5 as ConnectWidget, a6 as ProvidersContextProvider, a7 as PurchaseWidget, a8 as ConnectLoader, a9 as ViewContextProvider } from './index-Bs2uHEgi.js';
2
+ import { S as SelectInput, a as SwapWidget } from './SwapWidget-r9E9O8w8.js';
3
+ import { B as BridgeWidget } from './BridgeWidget-BPonD-21.js';
4
+ import OnRampWidget from './OnRampWidget-BahAHZlJ.js';
5
+ import WalletWidget from './WalletWidget-Bf6bDJdr.js';
6
+ import SaleWidget from './SaleWidget-CaNtBz3t.js';
7
+ import AddTokensWidget from './AddTokensWidget-CAnsz6Ds.js';
8
+ import { g as getAllowedBalances, T as TextInputForm } from './WalletApproveHero-ZZhVhTT2.js';
9
+ import './useInterval-C6NhVtCa.js';
10
+ import './TopUpView-CKIcuXnF.js';
11
+ import './FeesBreakdown-7fI38j9m.js';
12
+ import './SpendingCapHero-SdeBfZ_3.js';
13
+ import './TokenImage-Cc4dAr3U.js';
14
14
 
15
15
  const sendCheckoutEvent = (eventTarget, detail) => {
16
16
  const event = new CustomEvent(IMTBLWidgetEvents.IMTBL_COMMERCE_WIDGET_EVENT, { detail });
@@ -720,7 +720,6 @@ function AwaitingApproval({ config }) {
720
720
 
721
721
  function TransferForm({ config, viewState, setViewState, onSend, showBackButton, showHeader, title, coinAmountTitle, }) {
722
722
  const { t } = useTranslation();
723
- const { track } = useAnalytics();
724
723
  const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
725
724
  const { cryptoFiatState } = reactExports.useContext(CryptoFiatContext);
726
725
  const tokenOptions = reactExports.useMemo(() => viewState.allowedBalances.map((tokenBalance) => ({
@@ -738,35 +737,21 @@ function TransferForm({ config, viewState, setViewState, onSend, showBackButton,
738
737
  const defaultTokenImage = reactExports.useMemo(() => getDefaultTokenImage(viewState.checkout.config.environment, config.theme), [viewState.checkout.config.environment, config.theme]);
739
738
  const fromFiatValue = reactExports.useMemo(() => calculateCryptoToFiat(viewState.amount, token?.symbol || '', cryptoFiatState.conversions), [viewState.amount, token, cryptoFiatState.conversions]);
740
739
  const handleTokenChange = reactExports.useCallback((optionKey) => {
741
- track({
742
- screen: 'TransferToken',
743
- userJourney: UserJourney.TRANSFER,
744
- control: 'SelectToken',
745
- controlType: 'Select',
746
- extras: { token: optionKey },
747
- });
748
740
  if (typeof optionKey !== 'string')
749
741
  throw new Error('Invalid token address');
750
742
  setViewState((s) => ({ ...s, tokenAddress: optionKey, amountError: '' }));
751
- }, [setViewState, track]);
743
+ }, [setViewState]);
752
744
  const handleMaxButtonClick = reactExports.useCallback(() => {
753
745
  if (!token)
754
746
  throw new Error('Token not found');
755
747
  if (!token.balance)
756
748
  throw new Error('Token balance not found');
757
- track({
758
- screen: 'TransferToken',
759
- userJourney: UserJourney.TRANSFER,
760
- control: 'Max',
761
- controlType: 'Button',
762
- extras: { token: token.id, amount: token.balance.fullBalance },
763
- });
764
749
  setViewState((s) => {
765
750
  if (!token.balance)
766
751
  throw new Error('Token balance not found');
767
752
  return { ...s, amount: token.balance.fullBalance };
768
753
  });
769
- }, [token, setViewState, track]);
754
+ }, [token, setViewState]);
770
755
  const handleRecipientAddressChange = reactExports.useCallback((value) => {
771
756
  setViewState((s) => ({ ...s, toAddress: value, toAddressError: '' }));
772
757
  }, [setViewState]);
@@ -786,7 +771,7 @@ function TransferForm({ config, viewState, setViewState, onSend, showBackButton,
786
771
  mt: 'base.spacing.x6',
787
772
  mx: 'base.spacing.x4',
788
773
  mb: 'base.spacing.x10',
789
- }, children: [jsxs(Stack, { gap: "base.spacing.x9", children: [jsxs(Stack, { gap: "base.spacing.x1", children: [jsx(Heading, { size: "xSmall", children: coinAmountTitle }), jsx(SelectInput, { testId: "transfer-token-select", options: tokenOptions, textInputValue: viewState.amount, textInputPlaceholder: "0", textInputTextAlign: "right", coinSelectorHeading: t('views.TRANSFER.form.coinSelectorHeading'), textInputMaxButtonClick: token ? handleMaxButtonClick : undefined, textInputValidator: amountInputValidation, textInputErrorMessage: viewState.amountError, selectSubtext: selectSubtext, textInputSubtext: `${t('views.TRANSFER.content.fiatPricePrefix')} $${formatZeroAmount(fromFiatValue, true)}`, onTextInputChange: handleAmountChange, onSelectChange: handleTokenChange, selectedOption: token?.id, defaultTokenImage: defaultTokenImage, userJourney: UserJourney.TRANSFER, screen: "TransferToken", control: "Token", theme: config.theme, themeOverrides: config.themeOverrides })] }), jsxs(Stack, { gap: "base.spacing.x1", children: [jsx(Heading, { size: "xSmall", children: t('views.TRANSFER.form.toAddressHeading') }), jsx(TextInputForm, { testId: "transfer-to-address-input", value: viewState.toAddress, placeholder: "0x", validator: validatePartialAddress, onTextInputChange: handleRecipientAddressChange, errorMessage: viewState.toAddressError })] })] }), jsxs(Box, { children: [jsx(Body, { rc: jsx("div", {}), size: "xSmall", weight: "bold", sx: { color: 'base.color.text.status.fatal.primary' }, children: t('views.TRANSFER.content.notAllExchangesSupportImmutableZkEVM') }), jsx(Body, { rc: jsx("div", {}), size: "xxSmall", weight: "regular", sx: { mb: 'base.spacing.x4' }, children: t('views.TRANSFER.content.notAllExchangesSupportImmutableZkEVMDescription') }), jsx(Button, { sx: { width: '100%' }, variant: "primary", size: "large", disabled: isButtonDisabled, onClick: onSend, children: t('views.TRANSFER.form.buttonText') })] })] }) }));
774
+ }, children: [jsxs(Stack, { gap: "base.spacing.x9", children: [jsxs(Stack, { gap: "base.spacing.x1", children: [jsx(Heading, { size: "xSmall", children: coinAmountTitle }), jsx(SelectInput, { testId: "transfer-token-select", options: tokenOptions, textInputValue: viewState.amount, textInputPlaceholder: "0", textInputTextAlign: "right", coinSelectorHeading: t('views.TRANSFER.form.coinSelectorHeading'), textInputMaxButtonClick: token ? handleMaxButtonClick : undefined, textInputValidator: amountInputValidation, textInputErrorMessage: viewState.amountError, selectSubtext: selectSubtext, textInputSubtext: `${t('views.TRANSFER.content.fiatPricePrefix')} $${formatZeroAmount(fromFiatValue, true)}`, onTextInputChange: handleAmountChange, onSelectChange: handleTokenChange, selectedOption: token?.id, defaultTokenImage: defaultTokenImage, theme: config.theme, themeOverrides: config.themeOverrides })] }), jsxs(Stack, { gap: "base.spacing.x1", children: [jsx(Heading, { size: "xSmall", children: t('views.TRANSFER.form.toAddressHeading') }), jsx(TextInputForm, { testId: "transfer-to-address-input", value: viewState.toAddress, placeholder: "0x", validator: validatePartialAddress, onTextInputChange: handleRecipientAddressChange, errorMessage: viewState.toAddressError })] })] }), jsxs(Box, { children: [jsx(Body, { rc: jsx("div", {}), size: "xSmall", weight: "bold", sx: { color: 'base.color.text.status.fatal.primary' }, children: t('views.TRANSFER.content.notAllExchangesSupportImmutableZkEVM') }), jsx(Body, { rc: jsx("div", {}), size: "xxSmall", weight: "regular", sx: { mb: 'base.spacing.x4' }, children: t('views.TRANSFER.content.notAllExchangesSupportImmutableZkEVMDescription') }), jsx(Button, { sx: { width: '100%' }, variant: "primary", size: "large", disabled: isButtonDisabled, onClick: onSend, children: t('views.TRANSFER.form.buttonText') })] })] }) }));
790
775
  }
791
776
 
792
777
  const sendSuccessEvent = (eventTarget, transactionHash) => {
@@ -839,7 +824,6 @@ function TransferWidgetInner(props) {
839
824
  const { t } = useTranslation();
840
825
  const { cryptoFiatDispatch } = reactExports.useContext(CryptoFiatContext);
841
826
  const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
842
- const { track } = useAnalytics();
843
827
  const { connectLoaderState: { checkout, provider }, } = reactExports.useContext(ConnectLoaderContext);
844
828
  const [viewState, setViewState] = reactExports.useState({
845
829
  type: 'INITIALISING',
@@ -877,13 +861,6 @@ function TransferWidgetInner(props) {
877
861
  const onSend = reactExports.useCallback(async () => {
878
862
  if (viewState.type !== 'FORM')
879
863
  throw new Error('Unexpected state');
880
- track({
881
- screen: 'TransferToken',
882
- userJourney: UserJourney.TRANSFER,
883
- control: 'Send',
884
- controlType: 'Button',
885
- extras: { token: viewState.tokenAddress, amount: viewState.amount },
886
- });
887
864
  if (!isAddress(viewState.toAddress)) {
888
865
  setViewState((s) => ({ ...s, toAddressError: 'Invalid wallet address' }));
889
866
  return;
@@ -945,13 +922,6 @@ function TransferWidgetInner(props) {
945
922
  && e.error
946
923
  && 'code' in e.error
947
924
  && e.error.code === TRANSACTION_CANCELLED_ERROR_CODE) {
948
- track({
949
- screen: 'TransferToken',
950
- userJourney: UserJourney.TRANSFER,
951
- control: 'TranactionCancel',
952
- controlType: 'Event',
953
- extras: { token: viewState.tokenAddress, amount: viewState.amount },
954
- });
955
925
  sendRejectedEvent(eventTarget, 'Transaction cancelled');
956
926
  }
957
927
  else {
@@ -961,7 +931,7 @@ function TransferWidgetInner(props) {
961
931
  setViewState({ ...viewState, type: 'FORM' }); // TODO: We should be showing a failed view here
962
932
  }
963
933
  }
964
- }, [viewState, eventTarget, track]);
934
+ }, [viewState, eventTarget]);
965
935
  switch (viewState.type) {
966
936
  case 'INITIALISING':
967
937
  return jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') });
@@ -1,4 +1,4 @@
1
- import { cv as axios, dH as IMMUTABLE_API_BASE_URL, s as jsxs, q as jsx, y as Body, bF as PriceDisplay, t as Box, u as useTranslation, aA as Drawer, aP as MenuItem, aF as Fragment, aB as Divider, F as tokenValueFormat, i as formatZeroAmount, c5 as FooterLogo } from './index-2esq4Cem.js';
1
+ import { cn as axios, dz as IMMUTABLE_API_BASE_URL, s as jsxs, q as jsx, y as Body, bz as PriceDisplay, t as Box, u as useTranslation, ay as Drawer, aK as MenuItem, aD as Fragment, az as Divider, D as tokenValueFormat, i as formatZeroAmount, bZ as FooterLogo } from './index-Bs2uHEgi.js';
2
2
 
3
3
  const fetchRiskAssessmentV2 = async (assessmentData, config) => {
4
4
  const result = Object.fromEntries(assessmentData.map((data) => [data.address.toLowerCase(), { sanctioned: false }]));
@@ -1,6 +1,6 @@
1
- import { r as reactExports, Z as ConnectLoaderContext, E as EventTargetContext, u as useTranslation, aU as ViewContext, a5 as SharedViews, z as useAnalytics, U as UserJourney, V as ViewActions, q as jsx, x as SimpleLayout, J as HeaderNavigation, d9 as sendOnRampWidgetCloseEvent, M as orchestrationEvents, I as IMTBLWidgetEvents, t as Box, aK as isPassportProvider, da as url, db as TRANSAK_ORIGIN, dc as ExchangeType, c5 as FooterLogo, s as jsxs, d2 as SimpleTextBody, bH as viewReducer, bI as initialViewState, cR as NATIVE, a0 as LoadingView, dd as sendOnRampSuccessEvent, c6 as StatusType, d8 as StatusView, de as sendOnRampFailedEvent, bQ as ServiceUnavailableErrorView } from './index-2esq4Cem.js';
2
- import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-BIvdNYib.js';
3
- import { S as SpendingCapHero } from './SpendingCapHero-Z5NIcrWw.js';
1
+ import { r as reactExports, X as ConnectLoaderContext, E as EventTargetContext, u as useTranslation, aP as ViewContext, a3 as SharedViews, V as ViewActions, q as jsx, x as SimpleLayout, G as HeaderNavigation, d0 as sendOnRampWidgetCloseEvent, K as orchestrationEvents, I as IMTBLWidgetEvents, t as Box, d1 as url, d2 as TRANSAK_ORIGIN, d3 as ExchangeType, bZ as FooterLogo, s as jsxs, cV as SimpleTextBody, bC as viewReducer, bD as initialViewState, cI as NATIVE, _ as LoadingView, d4 as sendOnRampSuccessEvent, b_ as StatusType, c$ as StatusView, d5 as sendOnRampFailedEvent, bK as ServiceUnavailableErrorView } from './index-Bs2uHEgi.js';
2
+ import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-CKIcuXnF.js';
3
+ import { S as SpendingCapHero } from './SpendingCapHero-SdeBfZ_3.js';
4
4
 
5
5
  const containerStyle = (showIframe) => ({
6
6
  position: 'relative',
@@ -50,15 +50,6 @@ function useWidgetUrl(checkout, provider, tokenAddress, tokenAmount, passport, s
50
50
  }, [checkout, provider, tokenAddress, tokenAmount, passport, showMenu, customSubTitle]);
51
51
  return widgetUrl;
52
52
  }
53
- function useWalletAddress(provider) {
54
- const [userWalletAddress, setUserWalletAddress] = reactExports.useState(undefined);
55
- reactExports.useEffect(() => {
56
- if (!provider)
57
- return;
58
- provider.getSigner().then((signer) => signer.getAddress()).then(setUserWalletAddress);
59
- }, [provider]);
60
- return userWalletAddress;
61
- }
62
53
  function OnRampMain({ passport, showIframe, tokenAmount, tokenAddress, showBackButton, showMenu, customTitle, customSubTitle, showHeader = true, }) {
63
54
  const { connectLoaderState } = reactExports.useContext(ConnectLoaderContext);
64
55
  const { checkout, provider } = connectLoaderState;
@@ -66,76 +57,11 @@ function OnRampMain({ passport, showIframe, tokenAmount, tokenAddress, showBackB
66
57
  const { t } = useTranslation();
67
58
  const { viewState, viewDispatch } = reactExports.useContext(ViewContext);
68
59
  const widgetUrl = useWidgetUrl(checkout, provider, tokenAddress, tokenAmount, passport, showMenu, customSubTitle);
69
- const userWalletAddress = useWalletAddress(provider);
70
60
  const eventTimer = reactExports.useRef();
71
- const isPassport = !!passport && isPassportProvider(provider);
72
61
  const openedFromTopUpView = reactExports.useMemo(() => viewState.history.length > 2
73
62
  && viewState.history[viewState.history.length - 2].type
74
63
  === SharedViews.TOP_UP_VIEW, [viewState.history]);
75
64
  const showBack = showBackButton || openedFromTopUpView;
76
- const { track } = useAnalytics();
77
- const trackSegmentEvents = reactExports.useCallback(async (event, walletAddress) => {
78
- const miscProps = {
79
- userId: walletAddress.toLowerCase(),
80
- isPassportWallet: isPassport,
81
- };
82
- switch (event.event_id) {
83
- case TransakEvents.TRANSAK_WIDGET_OPEN:
84
- track({
85
- userJourney: UserJourney.ON_RAMP,
86
- screen: 'InputScreen',
87
- control: 'TransakWidgetOpen',
88
- controlType: 'IframeEvent',
89
- extras: { ...miscProps },
90
- }); // checkoutOnRampInputScreen_TransakWidgetOpenIframeEvent
91
- break;
92
- case TransakEvents.TRANSAK_ORDER_CREATED:
93
- track({
94
- userJourney: UserJourney.ON_RAMP,
95
- screen: 'InputScreen',
96
- control: 'OrderCreated',
97
- controlType: 'IframeEvent',
98
- extras: { ...miscProps },
99
- }); // checkoutOnRampInputScreen_OrderCreatedIframeEvent
100
- break;
101
- case TransakEvents.TRANSAK_ORDER_SUCCESSFUL:
102
- if (event.data.status === TransakStatuses.PROCESSING) {
103
- // user paid
104
- track({
105
- userJourney: UserJourney.ON_RAMP,
106
- screen: 'OrderInProgress',
107
- control: 'PaymentProcessing',
108
- controlType: 'IframeEvent',
109
- extras: {
110
- ...miscProps,
111
- transactionHash: event.data.transactionHash,
112
- },
113
- }); // checkoutOnRampOrderInProgress_PaymentProcessingIframeEvent
114
- }
115
- if (event.data.status === TransakStatuses.COMPLETED) {
116
- track({
117
- userJourney: UserJourney.ON_RAMP,
118
- screen: 'Success',
119
- control: 'PaymentCompleted',
120
- controlType: 'IframeEvent',
121
- extras: {
122
- ...miscProps,
123
- transactionHash: event.data.transactionHash,
124
- },
125
- }); // checkoutOnRampSuccess_PaymentCompletedIframeEvent
126
- }
127
- break;
128
- case TransakEvents.TRANSAK_ORDER_FAILED: // payment failed
129
- track({
130
- userJourney: UserJourney.ON_RAMP,
131
- screen: 'Failure',
132
- control: 'PaymentFailed',
133
- controlType: 'IframeEvent',
134
- extras: { ...miscProps },
135
- }); // checkoutOnRampFailure_PaymentFailedIframeEvent
136
- break;
137
- }
138
- }, [isPassport, track]);
139
65
  const transakEventHandler = reactExports.useCallback((event) => {
140
66
  if (eventTimer.current)
141
67
  clearTimeout(eventTimer.current);
@@ -219,7 +145,6 @@ function OnRampMain({ passport, showIframe, tokenAmount, tokenAddress, showBackB
219
145
  if (event.source === domIframe.contentWindow
220
146
  && host
221
147
  && TRANSAK_ORIGIN.includes(host)) {
222
- trackSegmentEvents(event.data, userWalletAddress ?? '');
223
148
  transakEventHandler(event.data);
224
149
  }
225
150
  };
@@ -228,7 +153,7 @@ function OnRampMain({ passport, showIframe, tokenAmount, tokenAddress, showBackB
228
153
  return () => {
229
154
  window.removeEventListener('message', handleTransakEvents);
230
155
  };
231
- }, [trackSegmentEvents, transakEventHandler, userWalletAddress]);
156
+ }, [transakEventHandler]);
232
157
  return (jsx(Box, { sx: boxMainStyle(showIframe), children: jsx(SimpleLayout, { header: showHeader ? (jsx(HeaderNavigation, { title: customTitle ?? t('views.ONRAMP.header.title'), onCloseButtonClick: () => sendOnRampWidgetCloseEvent(eventTarget), showBack: showBack, onBackButtonClick: () => {
233
158
  orchestrationEvents.sendRequestGoBackEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT, {});
234
159
  } })) : undefined, footerBackgroundColor: "base.color.translucent.emphasis.200", children: jsx(Box, { sx: containerStyle(showIframe), children: jsx("iframe", { title: "Transak", id: transakIframeId, src: widgetUrl, allow: "camera;microphone;fullscreen;payment", referrerPolicy: "strict-origin-when-cross-origin", style: {
@@ -288,7 +213,7 @@ function OnRampWidget({ amount, tokenAddress, config, showBackButton, onrampConf
288
213
  },
289
214
  });
290
215
  }, statusType: StatusType.FAILURE, onCloseClick: () => sendOnRampWidgetCloseEvent(eventTarget), testId: "fail-view" })), (viewState.view.type !== OnRampWidgetViews.SUCCESS
291
- && viewState.view.type !== OnRampWidgetViews.FAIL) && (jsx(OnRampMain, { passport: checkout?.passport, showIframe: showIframe, tokenAmount: amount ?? viewState.view.data?.amount, tokenAddress: tknAddr ?? viewState.view.data?.tokenAddress, showBackButton: showBackButton, showMenu: onrampConfig?.showMenu, customTitle: onrampConfig?.customTitle, customSubTitle: onrampConfig?.customSubTitle, showHeader: onrampConfig?.showHeader })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { analytics: { userJourney: UserJourney.ON_RAMP }, widgetEvent: IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT, checkout: checkout, provider: provider, showOnrampOption: isOnRampEnabled, showSwapOption: isSwapEnabled, showBridgeOption: isBridgeEnabled, onCloseButtonClick: () => sendOnRampWidgetCloseEvent(eventTarget) })), viewState.view.type
216
+ && viewState.view.type !== OnRampWidgetViews.FAIL) && (jsx(OnRampMain, { passport: checkout?.passport, showIframe: showIframe, tokenAmount: amount ?? viewState.view.data?.amount, tokenAddress: tknAddr ?? viewState.view.data?.tokenAddress, showBackButton: showBackButton, showMenu: onrampConfig?.showMenu, customTitle: onrampConfig?.customTitle, customSubTitle: onrampConfig?.customSubTitle, showHeader: onrampConfig?.showHeader })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx(TopUpView, { widgetEvent: IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT, checkout: checkout, provider: provider, showOnrampOption: isOnRampEnabled, showSwapOption: isSwapEnabled, showBridgeOption: isBridgeEnabled, onCloseButtonClick: () => sendOnRampWidgetCloseEvent(eventTarget) })), viewState.view.type
292
217
  === SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(ServiceUnavailableErrorView, { onCloseClick: () => sendOnRampWidgetCloseEvent(eventTarget) }))] }));
293
218
  }
294
219