@imtbl/checkout-widgets 2.24.7 → 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.
- package/dist/browser/{AddTokensWidget-aAZMavtt.js → AddTokensWidget-CIR8BF_I.js} +24 -297
- package/dist/browser/{BridgeWidget-CWWCr015.js → BridgeWidget-C5Uljhhx.js} +13 -294
- package/dist/browser/{CommerceWidget-B36D9SAt.js → CommerceWidget-CeBBYCbK.js} +17 -47
- package/dist/browser/{FeesBreakdown-WeqZxAT6.js → FeesBreakdown-BU4haotD.js} +1 -1
- package/dist/browser/{OnRampWidget-DpxysET8.js → OnRampWidget-Ccvb3QkT.js} +5 -80
- package/dist/browser/{SaleWidget-CMkn5eAJ.js → SaleWidget-CPARFlzv.js} +61 -219
- package/dist/browser/{SpendingCapHero-BuWrv_Rb.js → SpendingCapHero-B-0YYZho.js} +1 -1
- package/dist/browser/{SwapWidget-CEnCMtGs.js → SwapWidget-ujE6uX-N.js} +12 -206
- package/dist/browser/{TokenImage-EqfdG328.js → TokenImage-BeUf_Ulv.js} +1 -1
- package/dist/browser/{TopUpView-D3BxE8R3.js → TopUpView-GMv3360Q.js} +3 -54
- package/dist/browser/{WalletApproveHero-C_8es7r9.js → WalletApproveHero-BJi7ufqM.js} +4 -12
- package/dist/browser/{WalletWidget-Czye7zS5.js → WalletWidget-BABrqsfd.js} +4 -96
- package/dist/browser/{index-WfurfROg.js → index-CcxHW36j.js} +1275 -9717
- package/dist/browser/{index-CcLq9am4.js → index-Cp1w6map.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{useInterval-CrmneADn.js → useInterval-DbCsm_gG.js} +1 -1
- package/dist/types/components/FormComponents/SelectForm/SelectForm.d.ts +1 -5
- package/dist/types/components/FormComponents/SelectInput/SelectInput.d.ts +1 -5
- package/dist/types/components/Transak/TransakIframe.d.ts +0 -1
- package/dist/types/components/Transak/useTransakEvents.d.ts +0 -4
- package/dist/types/components/WalletDrawer/ConnectWalletDrawer.d.ts +1 -2
- package/dist/types/lib/squid/hooks/useExecute.d.ts +1 -2
- package/dist/types/views/top-up/TopUpView.d.ts +1 -5
- package/dist/types/widgets/add-tokens/hooks/useError.d.ts +1 -1
- package/dist/types/widgets/purchase/components/PurchaseConnectWalletDrawer.d.ts +1 -3
- package/dist/types/widgets/sale/hooks/useSaleEvents.d.ts +5 -31
- package/dist/types/widgets/swap/components/Fees.d.ts +1 -1
- package/package.json +7 -9
- package/src/components/ConnectLoader/ConnectLoader.tsx +0 -16
- package/src/components/FormComponents/SelectForm/SelectForm.tsx +2 -18
- package/src/components/FormComponents/SelectInput/SelectInput.tsx +1 -12
- package/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +2 -26
- package/src/components/Transactions/ChangeWallet.tsx +1 -12
- package/src/components/Transactions/ClaimWithdrawalInProgress.tsx +0 -11
- package/src/components/Transactions/NoTransactions.tsx +0 -10
- package/src/components/Transactions/TransactionItemWithdrawPending.tsx +1 -13
- package/src/components/Transactions/Transactions.tsx +2 -28
- package/src/components/Transak/TransakIframe.tsx +0 -6
- package/src/components/Transak/useTransakEvents.ts +1 -70
- package/src/components/WalletDrawer/ConnectWalletDrawer.tsx +2 -35
- package/src/components/WalletDrawer/PayWithWalletDrawer.tsx +0 -1
- package/src/context/view-context/test-components/ViewContextTestComponent.tsx +14 -15
- package/src/lib/squid/hooks/useExecute.ts +5 -18
- package/src/views/top-up/TopUpView.tsx +5 -56
- package/src/widgets/add-tokens/AddTokensRoot.tsx +28 -29
- package/src/widgets/add-tokens/AddTokensWidget.tsx +2 -17
- package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +2 -18
- package/src/widgets/add-tokens/hooks/useError.tsx +1 -18
- package/src/widgets/add-tokens/hooks/useErrorHandler.ts +2 -12
- package/src/widgets/add-tokens/views/AddTokens.tsx +8 -154
- package/src/widgets/add-tokens/views/Review.tsx +6 -94
- package/src/widgets/bridge/BridgeWidget.tsx +0 -35
- package/src/widgets/bridge/BridgeWidgetRoot.tsx +17 -18
- package/src/widgets/bridge/components/BridgeForm.tsx +0 -20
- package/src/widgets/bridge/components/BridgeReviewSummary.tsx +1 -49
- package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +3 -122
- package/src/widgets/bridge/views/ApproveTransaction.tsx +1 -15
- package/src/widgets/bridge/views/Bridge.tsx +1 -16
- package/src/widgets/bridge/views/BridgeReview.tsx +1 -12
- package/src/widgets/bridge/views/ClaimWithdrawal.tsx +0 -11
- package/src/widgets/bridge/views/MoveInProgress.tsx +0 -24
- package/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +1 -12
- package/src/widgets/connect/ConnectWidget.tsx +2 -18
- package/src/widgets/connect/ConnectWidgetRoot.tsx +15 -16
- package/src/widgets/connect/components/WalletList.tsx +6 -55
- package/src/widgets/connect/views/ConnectWallet.tsx +1 -12
- package/src/widgets/connect/views/ReadyToConnect.tsx +2 -29
- package/src/widgets/connect/views/SwitchNetworkEth.tsx +3 -22
- package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +0 -18
- package/src/widgets/immutable-commerce/CommerceWidgetRoot.tsx +17 -19
- package/src/widgets/on-ramp/OnRampWidget.tsx +0 -2
- package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +23 -24
- package/src/widgets/on-ramp/views/OnRampMain.tsx +1 -91
- package/src/widgets/purchase/PurchaseWidgetRoot.tsx +22 -23
- package/src/widgets/purchase/components/PurchaseConnectWalletDrawer.tsx +2 -34
- package/src/widgets/purchase/components/PurchaseDeliverToWalletDrawer.tsx +0 -1
- package/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +0 -2
- package/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +1 -30
- package/src/widgets/purchase/components/WithCard.tsx +0 -4
- package/src/widgets/purchase/views/Purchase.tsx +1 -2
- package/src/widgets/sale/SaleWidget.tsx +0 -2
- package/src/widgets/sale/SaleWidgetRoot.tsx +32 -33
- package/src/widgets/sale/components/OrderReview.tsx +2 -29
- package/src/widgets/sale/components/WithCard.tsx +0 -2
- package/src/widgets/sale/hooks/useSaleEvents.ts +3 -185
- package/src/widgets/sale/views/OrderSummary.tsx +2 -15
- package/src/widgets/sale/views/PayWithCard.tsx +4 -46
- package/src/widgets/sale/views/PayWithCoins.tsx +4 -9
- package/src/widgets/sale/views/PaymentMethods.tsx +3 -6
- package/src/widgets/sale/views/SaleErrorView.tsx +1 -1
- package/src/widgets/swap/SwapWidget.tsx +0 -24
- package/src/widgets/swap/SwapWidgetRoot.tsx +29 -30
- package/src/widgets/swap/components/Fees.tsx +1 -1
- package/src/widgets/swap/components/SwapForm.tsx +2 -140
- package/src/widgets/swap/views/ApproveERC20Onboarding.tsx +1 -36
- package/src/widgets/swap/views/SwapCoins.tsx +0 -17
- package/src/widgets/swap/views/SwapInProgress.tsx +0 -14
- package/src/widgets/transfer/TransferForm.tsx +3 -25
- package/src/widgets/transfer/TransferWidget.tsx +1 -23
- package/src/widgets/wallet/WalletWidgetRoot.tsx +24 -25
- package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +1 -50
- package/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +0 -13
- package/src/widgets/wallet/components/WalletAddress/WalletAddress.tsx +0 -13
- package/src/widgets/wallet/views/CoinInfo.tsx +1 -12
- package/src/widgets/wallet/views/Settings.tsx +1 -15
- package/src/widgets/wallet/views/WalletBalances.tsx +0 -24
- package/tsconfig.json +0 -1
- package/dist/browser/auto-track-BcwQjFJ1.js +0 -105
- package/dist/browser/index-BSnE_6oQ.js +0 -27
- package/dist/browser/index-CKGatDzP.js +0 -60
- package/dist/browser/index-Cnt0i-EY.js +0 -65
- package/dist/browser/index-DLXeqRzN.js +0 -65
- package/dist/browser/index-MANbU_qG.js +0 -5634
- package/dist/browser/index-lHICKwNF.js +0 -446
- package/dist/browser/index.umd-Cn1Q502t.js +0 -32
- package/dist/browser/is-plan-event-enabled-mXX0dwl-.js +0 -17
- package/dist/types/context/analytics-provider/CustomAnalyticsProvider.d.ts +0 -7
- package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +0 -42
- package/dist/types/context/analytics-provider/SetupAnalytics.d.ts +0 -7
- package/dist/types/lib/analytics/identifyUser.d.ts +0 -8
- package/dist/types/lib/analytics/identifyUser.test.d.ts +0 -1
- package/src/context/analytics-provider/CustomAnalyticsProvider.tsx +0 -22
- package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +0 -41
- package/src/context/analytics-provider/SetupAnalytics.tsx +0 -35
- package/src/lib/analytics/identifyUser.test.ts +0 -44
- package/src/lib/analytics/identifyUser.ts +0 -26
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as reactExports,
|
|
2
|
-
import { T as TokenImage } from './TokenImage-
|
|
3
|
-
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-
|
|
1
|
+
import { r as reactExports, aa as hFlex, ab as _defineProperty, ac as _objectWithoutProperties, ad as useForwardLocalDomRef, ae as _slicedToArray, af as useResizeObserver, N as useTheme, ag as usePrevious, ah as useGetMotionProfile, ai as useBrowserEffect, aj as merge, ak as getHeadingTextStyles, al as getMotionProfileSx, am as useConvertSxToEmotionStyles, an as DUMMY_WIDTH_PUSHER_TEXT, s as jsxs, q as jsx, t as Box, ao as useGetSubcomponentChild, ap as flattenChildren, aq as vFlex, ar as centerFlexChildren, as as SmartClone, at as FormControlLabel, au as FormControlValidation, av as FormControlCaption, I as IMTBLWidgetEvents, A as AddTokensEventType, aw as getDefaultExportFromCjs, ax as commonjsGlobal, u as useTranslation, ay as Drawer, az as Divider, H as Heading, v as Button, aA as useProvidersContext, aB as WalletDrawer, aC as UnableToConnectDrawer, aD as Fragment, aE as WalletProviderRdns, aF as WrappedBrowserProvider, aG as isPassportProvider, aH as connectEIP6963Provider, aI as ConnectEIP6963ProviderError, aJ as ProvidersContextActions, aK as MenuItem, aL as ChainId, aM as SQUID_NATIVE_TOKEN, aN as commonjsRequire, R as getRemoteImage, aO as OnboardingPagination, aP as ViewContext, aQ as useHandover, E as EventTargetContext, aR as HandoverTarget, V as ViewActions, n as getRemoteRive, aS as APPROVE_TXN_ANIMATION, aT as RiveStateMachineInput, aU as HandoverContent, aV as keyframes, l as TokenFilterTypes, aW as isNativeToken, aX as getTokenImageByAddress, aY as FramedImage, aZ as FramedIcon, a_ as ButtCon, a$ as TextInput, b0 as VerticalMenu, F as getDefaultTokenImage, b1 as TOKEN_PRIORITY_ORDER, y as Body, b2 as EllipsizedText, b3 as Tooltip, b4 as Sticker, b5 as getDurationFormatted, b6 as getTotalRouteFees, b7 as getRouteAndTokenBalances, w as Stack, b8 as Icon, b9 as Badge, ba as getFormattedAmounts, bb as getRemoteVideo, bc as FramedVideo, bd as listVariants, be as motion, bf as listItemVariants, bg as Banner, bh as useRoutes, bi as useInjectedProviders, bj as getProviderSlugFromRdns, bk as X, bl as v4, x as SimpleLayout, K as orchestrationEvents, p as parseUnits, a3 as SharedViews, bm as SquidFooter, bn as TOOLKIT_SQUID_URL, bo as merge$1, bp as SvgIcon, bq as WalletWarningHero, br as getFormattedNumber, bs as FIXED_HANDOVER_DURATION, bt as EXECUTE_TXN_ANIMATION, L as Link, bu as Trans, bv as getRouteChains, bw as t, bx as convertToNetworkChangeableProvider, by as verifyAndSwitchChain, bz as PriceDisplay, _ as LoadingView, bA as useExecute, bB as getFromAmountData, bC as viewReducer, bD as initialViewState, bE as useSquid, bF as useTokens, bG as r, bH as isValidAddress, M as amountInputValidation, bI as fetchChains, bJ as fetchBalances, Q as CloudImage, a4 as ErrorView, bK as ServiceUnavailableErrorView } from './index-CcxHW36j.js';
|
|
2
|
+
import { T as TokenImage } from './TokenImage-BeUf_Ulv.js';
|
|
3
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-BU4haotD.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The function `useInterval` sets up an interval that repeatedly calls a given callback function with
|
|
@@ -884,9 +884,8 @@ function EOAWarningDrawer({ visible, onProceedClick, onCloseDrawer, }) {
|
|
|
884
884
|
}, children: [jsx(Button, { sx: { width: '100%', mb: 'base.spacing.x2' }, testId: "non-passport-cta-button", variant: "primary", size: "large", onClick: onCloseDrawer, children: t('drawers.eoaWarning.passportButtonText') }), jsx(Button, { sx: { width: '100%', marginBottom: 'base.spacing.x10' }, testId: "non-passport-cta-button", variant: "tertiary", size: "large", onClick: onProceedClick, children: t('drawers.eoaWarning.proceedButtonText') })] })] }) }) }));
|
|
885
885
|
}
|
|
886
886
|
|
|
887
|
-
function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, providerType, walletOptions, bottomSlot, menuItemSize = 'small', disabledOptions = [], getShouldRequestWalletPermissions,
|
|
887
|
+
function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, providerType, walletOptions, bottomSlot, menuItemSize = 'small', disabledOptions = [], getShouldRequestWalletPermissions, drawerBackground, }) {
|
|
888
888
|
const { providersState: { checkout, fromProvider, lockedToProvider }, providersDispatch, } = useProvidersContext();
|
|
889
|
-
const { identify, track, user } = useAnalytics();
|
|
890
889
|
const prevWalletChangeEvent = reactExports.useRef();
|
|
891
890
|
const [showUnableToConnectDrawer, setShowUnableToConnectDrawer] = reactExports.useState(false);
|
|
892
891
|
const [showEOAWarningDrawer, setShowEOAWarningDrawer] = reactExports.useState(false);
|
|
@@ -917,18 +916,6 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
917
916
|
const handleWalletConnection = async (event) => {
|
|
918
917
|
const { providerDetail } = event;
|
|
919
918
|
const { info } = providerDetail;
|
|
920
|
-
// Trigger analytics connect wallet, menu item, with wallet details
|
|
921
|
-
track({
|
|
922
|
-
userJourney: UserJourney.CONNECT,
|
|
923
|
-
screen: 'ConnectWallet',
|
|
924
|
-
control: removeSpace(info.name),
|
|
925
|
-
controlType: 'MenuItem',
|
|
926
|
-
extras: {
|
|
927
|
-
providerType,
|
|
928
|
-
wallet: getProviderSlugFromRdns(info.rdns),
|
|
929
|
-
walletRdns: info.rdns,
|
|
930
|
-
},
|
|
931
|
-
});
|
|
932
919
|
if (info.rdns === WalletProviderRdns.PASSPORT) {
|
|
933
920
|
const { isConnected } = await checkout.checkIsWalletConnected({
|
|
934
921
|
provider: new WrappedBrowserProvider(providerDetail.provider),
|
|
@@ -945,12 +932,6 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
945
932
|
const shouldRequestWalletPermissions = getShouldRequestWalletPermissions?.(info);
|
|
946
933
|
try {
|
|
947
934
|
const { provider } = await connectEIP6963Provider(providerDetail, checkout, shouldRequestWalletPermissions);
|
|
948
|
-
// Identify connected wallet, retaining current anonymousId
|
|
949
|
-
if (shouldIdentifyUser) {
|
|
950
|
-
const userData = user ? await user() : undefined;
|
|
951
|
-
const anonymousId = userData?.anonymousId();
|
|
952
|
-
await identifyUser(identify, provider, { anonymousId });
|
|
953
|
-
}
|
|
954
935
|
// Store selected provider as fromProvider in context
|
|
955
936
|
address = await setProviderInContext(provider, providerDetail.info);
|
|
956
937
|
// Notify successful connection
|
|
@@ -1037,7 +1018,7 @@ function PayWithWalletDrawer({ visible, onClose, onConnect, onPayWithCard, walle
|
|
|
1037
1018
|
}, [onClose, onPayWithCard]);
|
|
1038
1019
|
return (jsx(ConnectWalletDrawer, { heading: insufficientBalance
|
|
1039
1020
|
? t('drawers.wallet.payWithHeadingInsufficientBalance')
|
|
1040
|
-
: t('drawers.wallet.payWithHeading'), visible: visible, onClose: onClose, providerType: "from", walletOptions: walletOptions, disabledOptions: disabledOptions, bottomSlot: payWithCardItem, onConnect: handleOnConnect,
|
|
1021
|
+
: t('drawers.wallet.payWithHeading'), visible: visible, onClose: onClose, providerType: "from", walletOptions: walletOptions, disabledOptions: disabledOptions, bottomSlot: payWithCardItem, onConnect: handleOnConnect, drawerBackground: drawerBackground }));
|
|
1041
1022
|
}
|
|
1042
1023
|
|
|
1043
1024
|
function convertToUsd(tokens, amount, token) {
|
|
@@ -3958,7 +3939,6 @@ function OnboardingDrawer({ environment }) {
|
|
|
3958
3939
|
|
|
3959
3940
|
const useError = (environment) => {
|
|
3960
3941
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
3961
|
-
const { page } = useAnalytics();
|
|
3962
3942
|
const { t } = useTranslation();
|
|
3963
3943
|
const { addHandover, closeHandover } = useHandover({
|
|
3964
3944
|
id: HandoverTarget.GLOBAL,
|
|
@@ -4066,15 +4046,7 @@ const useError = (environment) => {
|
|
|
4066
4046
|
},
|
|
4067
4047
|
};
|
|
4068
4048
|
const getErrorConfig = (errorType) => errorConfig[errorType];
|
|
4069
|
-
const showErrorHandover = (errorType
|
|
4070
|
-
page({
|
|
4071
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4072
|
-
screen: 'Error',
|
|
4073
|
-
extras: {
|
|
4074
|
-
errorType,
|
|
4075
|
-
...data,
|
|
4076
|
-
},
|
|
4077
|
-
});
|
|
4049
|
+
const showErrorHandover = (errorType) => {
|
|
4078
4050
|
addHandover({
|
|
4079
4051
|
animationUrl: getRemoteRive(environment, APPROVE_TXN_ANIMATION),
|
|
4080
4052
|
inputValue: RiveStateMachineInput.ERROR,
|
|
@@ -4103,7 +4075,6 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
4103
4075
|
const [visible, setVisible] = reactExports.useState(false);
|
|
4104
4076
|
const [searchValue, setSearchValue] = reactExports.useState('');
|
|
4105
4077
|
const defaultTokenImage = getDefaultTokenImage(checkout?.config.environment, config.theme);
|
|
4106
|
-
const { track } = useAnalytics();
|
|
4107
4078
|
const { t } = useTranslation();
|
|
4108
4079
|
const setSelectedToken = (token) => {
|
|
4109
4080
|
addTokensDispatch({
|
|
@@ -4114,16 +4085,6 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
4114
4085
|
});
|
|
4115
4086
|
};
|
|
4116
4087
|
const handleTokenChange = reactExports.useCallback((token) => {
|
|
4117
|
-
track({
|
|
4118
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4119
|
-
screen: 'InputScreen',
|
|
4120
|
-
control: 'TokensMenu',
|
|
4121
|
-
controlType: 'MenuItem',
|
|
4122
|
-
extras: {
|
|
4123
|
-
contextId: addTokensState.id,
|
|
4124
|
-
tokenAddress: token?.address,
|
|
4125
|
-
},
|
|
4126
|
-
});
|
|
4127
4088
|
setSelectedToken(token);
|
|
4128
4089
|
setVisible(false);
|
|
4129
4090
|
setSearchValue('');
|
|
@@ -4199,7 +4160,7 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
4199
4160
|
}
|
|
4200
4161
|
}
|
|
4201
4162
|
catch (error) {
|
|
4202
|
-
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN
|
|
4163
|
+
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN);
|
|
4203
4164
|
}
|
|
4204
4165
|
})();
|
|
4205
4166
|
}, [addTokensState.tokens, checkout, toTokenAddress]);
|
|
@@ -4362,33 +4323,13 @@ showSwapOption,
|
|
|
4362
4323
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4363
4324
|
showBridgeOption, insufficientBalance, }) {
|
|
4364
4325
|
const { t } = useTranslation();
|
|
4365
|
-
const {
|
|
4366
|
-
const { addTokensState: { id, chains }, } = reactExports.useContext(AddTokensContext);
|
|
4326
|
+
const { addTokensState: { chains }, } = reactExports.useContext(AddTokensContext);
|
|
4367
4327
|
const { providersState: { fromProviderInfo, fromAddress }, } = useProvidersContext();
|
|
4368
4328
|
const selectedRouteIndex = reactExports.useRef(0);
|
|
4369
4329
|
const handleOnRouteClick = (route, index) => {
|
|
4370
4330
|
selectedRouteIndex.current = index;
|
|
4371
4331
|
onRouteClick(route);
|
|
4372
4332
|
};
|
|
4373
|
-
reactExports.useEffect(() => {
|
|
4374
|
-
if (!visible) {
|
|
4375
|
-
return;
|
|
4376
|
-
}
|
|
4377
|
-
track({
|
|
4378
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4379
|
-
screen: 'InputScreen',
|
|
4380
|
-
control: 'RoutesMenu',
|
|
4381
|
-
controlType: 'MenuItem',
|
|
4382
|
-
action: 'Opened',
|
|
4383
|
-
extras: {
|
|
4384
|
-
contextId: id,
|
|
4385
|
-
showOnrampOption: Boolean(showOnrampOption),
|
|
4386
|
-
showSwapOption: Boolean(showSwapOption),
|
|
4387
|
-
insufficientBalance: Boolean(insufficientBalance),
|
|
4388
|
-
routesAvailable: routes?.length ?? 0,
|
|
4389
|
-
},
|
|
4390
|
-
});
|
|
4391
|
-
}, [visible]);
|
|
4392
4333
|
return (jsx(Drawer, { size: "full", visible: visible, showHeaderBar: false, onCloseDrawer: onClose, children: jsxs(Drawer.Content, { rc: jsx(motion.div, { variants: listVariants, initial: "hidden", animate: "show" }), sx: {
|
|
4393
4334
|
pt: 'base.spacing.x3',
|
|
4394
4335
|
px: 'base.spacing.x3',
|
|
@@ -4454,8 +4395,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4454
4395
|
const { fetchRoutes } = useRoutes();
|
|
4455
4396
|
const { showErrorHandover } = useError(config.environment);
|
|
4456
4397
|
const { addTokensState, addTokensDispatch, } = reactExports.useContext(AddTokensContext);
|
|
4457
|
-
const { id, squid, chains, balances, tokens, selectedAmount, routes, selectedRouteData, selectedToken, isSwapAvailable,
|
|
4458
|
-
const { track, page, identify, user, } = useAnalytics();
|
|
4398
|
+
const { id, squid, chains, balances, tokens, selectedAmount, routes, selectedRouteData, selectedToken, isSwapAvailable, } = addTokensState;
|
|
4459
4399
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
4460
4400
|
const { t } = useTranslation();
|
|
4461
4401
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
@@ -4496,29 +4436,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4496
4436
|
}
|
|
4497
4437
|
}, [selectedAmount, inputValue]);
|
|
4498
4438
|
const setSelectedRouteData = (route) => {
|
|
4499
|
-
if (route) {
|
|
4500
|
-
track({
|
|
4501
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4502
|
-
screen: 'InputScreen',
|
|
4503
|
-
control: 'RoutesMenu',
|
|
4504
|
-
controlType: 'MenuItem',
|
|
4505
|
-
extras: {
|
|
4506
|
-
contextId: id,
|
|
4507
|
-
toTokenAddress: route.amountData.toToken.address,
|
|
4508
|
-
toTokenChainId: route.amountData.toToken.chainId,
|
|
4509
|
-
toTokenSymbol: route.amountData.toToken.symbol,
|
|
4510
|
-
fromTokenAddress: route.amountData.fromToken.address,
|
|
4511
|
-
fromTokenChainId: route.amountData.fromToken.chainId,
|
|
4512
|
-
fromTokenSymbol: route.amountData.fromToken.symbol,
|
|
4513
|
-
toAmount: route.amountData.toAmount,
|
|
4514
|
-
fromAmount: route.amountData.fromAmount,
|
|
4515
|
-
isBridge: route.amountData.toToken.chainId !== route.amountData.fromToken.chainId,
|
|
4516
|
-
isSwap: route.amountData.toToken.chainId === route.amountData.fromToken.chainId,
|
|
4517
|
-
hasEmbeddedSwap: !!route.route.route.estimate.actions.find((action) => action.type === dist.ActionType.SWAP),
|
|
4518
|
-
isInsufficientGas: route.isInsufficientGas,
|
|
4519
|
-
},
|
|
4520
|
-
});
|
|
4521
|
-
}
|
|
4522
4439
|
addTokensDispatch({
|
|
4523
4440
|
payload: {
|
|
4524
4441
|
type: AddTokensActions.SET_SELECTED_ROUTE_DATA,
|
|
@@ -4532,16 +4449,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4532
4449
|
setInputValue(value);
|
|
4533
4450
|
if (amount > 0) {
|
|
4534
4451
|
setSelectedAmount(value);
|
|
4535
|
-
track({
|
|
4536
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4537
|
-
screen: 'InputScreen',
|
|
4538
|
-
control: 'AmountInput',
|
|
4539
|
-
controlType: 'TextInput',
|
|
4540
|
-
extras: {
|
|
4541
|
-
contextId: id,
|
|
4542
|
-
toAmount: value,
|
|
4543
|
-
},
|
|
4544
|
-
});
|
|
4545
4452
|
}
|
|
4546
4453
|
else {
|
|
4547
4454
|
setSelectedAmount('');
|
|
@@ -4568,29 +4475,13 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4568
4475
|
if (!lockedToProvider) {
|
|
4569
4476
|
return;
|
|
4570
4477
|
}
|
|
4571
|
-
(async () => {
|
|
4572
|
-
const userData = user ? await user() : undefined;
|
|
4573
|
-
const anonymousId = userData?.anonymousId();
|
|
4574
|
-
await identifyUser(identify, toProvider, { anonymousId });
|
|
4575
|
-
})();
|
|
4478
|
+
(async () => { })();
|
|
4576
4479
|
}, [toProvider, lockedToProvider]);
|
|
4577
4480
|
const toChain = reactExports.useMemo(() => chains?.find((chain) => chain.id === ChainId.IMTBL_ZKEVM_MAINNET.toString()), [chains]);
|
|
4578
4481
|
reactExports.useEffect(() => {
|
|
4579
|
-
if (!id || isSwapAvailable === undefined)
|
|
4482
|
+
if (!id || isSwapAvailable === undefined)
|
|
4580
4483
|
return;
|
|
4581
|
-
}
|
|
4582
|
-
page({
|
|
4583
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4584
|
-
screen: 'InputScreen',
|
|
4585
|
-
extras: {
|
|
4586
|
-
contextId: id,
|
|
4587
|
-
toAmount,
|
|
4588
|
-
toTokenAddress,
|
|
4589
|
-
geoBlocked: !isSwapAvailable,
|
|
4590
|
-
},
|
|
4591
|
-
}).then((ctx) => {
|
|
4592
|
-
X('commerce', `addTokensLoaded_${ctx.event.messageId}`);
|
|
4593
|
-
});
|
|
4484
|
+
X('commerce', `addTokensLoaded_${v4()}`);
|
|
4594
4485
|
}, [id, isSwapAvailable]);
|
|
4595
4486
|
reactExports.useEffect(() => {
|
|
4596
4487
|
if (!toAmount)
|
|
@@ -4627,32 +4518,9 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4627
4518
|
if (availableRoutes.length === 0) {
|
|
4628
4519
|
setInsufficientBalance(true);
|
|
4629
4520
|
}
|
|
4630
|
-
track({
|
|
4631
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4632
|
-
screen: 'InputScreen',
|
|
4633
|
-
control: 'RoutesMenu',
|
|
4634
|
-
controlType: 'MenuItem',
|
|
4635
|
-
action: 'Request',
|
|
4636
|
-
extras: {
|
|
4637
|
-
contextId: id,
|
|
4638
|
-
routesAvailable: availableRoutes.length,
|
|
4639
|
-
geoBlocked: !isSwapAvailable,
|
|
4640
|
-
},
|
|
4641
|
-
});
|
|
4642
4521
|
}
|
|
4643
|
-
catch
|
|
4644
|
-
|
|
4645
|
-
track({
|
|
4646
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4647
|
-
screen: 'Routes',
|
|
4648
|
-
action: 'Failed',
|
|
4649
|
-
extras: {
|
|
4650
|
-
contextId: id,
|
|
4651
|
-
message: error.message,
|
|
4652
|
-
...error.data,
|
|
4653
|
-
},
|
|
4654
|
-
});
|
|
4655
|
-
}
|
|
4522
|
+
catch {
|
|
4523
|
+
// Route errors are reflected by the empty routes state.
|
|
4656
4524
|
}
|
|
4657
4525
|
setFetchingRoutes(false);
|
|
4658
4526
|
}
|
|
@@ -4677,23 +4545,12 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4677
4545
|
}
|
|
4678
4546
|
}
|
|
4679
4547
|
catch (error) {
|
|
4680
|
-
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN
|
|
4548
|
+
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN);
|
|
4681
4549
|
}
|
|
4682
4550
|
};
|
|
4683
4551
|
fetchOnRampTokens();
|
|
4684
4552
|
}, [checkout, id]);
|
|
4685
4553
|
const sendRequestOnRampEvent = async () => {
|
|
4686
|
-
track({
|
|
4687
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4688
|
-
screen: 'InputScreen',
|
|
4689
|
-
control: 'PayWithCardMenu',
|
|
4690
|
-
controlType: 'MenuItem',
|
|
4691
|
-
extras: {
|
|
4692
|
-
contextId: id,
|
|
4693
|
-
tokenAddress: selectedToken?.address ?? '',
|
|
4694
|
-
amount: selectedAmount ?? '',
|
|
4695
|
-
},
|
|
4696
|
-
});
|
|
4697
4554
|
const data = {
|
|
4698
4555
|
tokenAddress: selectedToken?.address ?? '',
|
|
4699
4556
|
amount: selectedAmount ?? '',
|
|
@@ -4744,21 +4601,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4744
4601
|
});
|
|
4745
4602
|
return;
|
|
4746
4603
|
}
|
|
4747
|
-
track({
|
|
4748
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4749
|
-
screen: 'InputScreen',
|
|
4750
|
-
control: 'Review',
|
|
4751
|
-
controlType: 'Button',
|
|
4752
|
-
extras: {
|
|
4753
|
-
contextId: id,
|
|
4754
|
-
toTokenAddress: selectedRouteData.amountData.toToken.address,
|
|
4755
|
-
toTokenChainId: selectedRouteData.amountData.toToken.chainId,
|
|
4756
|
-
fromTokenAddress: selectedRouteData.amountData.fromToken.address,
|
|
4757
|
-
fromTokenChainId: selectedRouteData.amountData.fromToken.chainId,
|
|
4758
|
-
toAmount: selectedRouteData.amountData.toAmount,
|
|
4759
|
-
fromAmount: selectedRouteData.amountData.fromAmount,
|
|
4760
|
-
},
|
|
4761
|
-
});
|
|
4762
4604
|
viewDispatch({
|
|
4763
4605
|
payload: {
|
|
4764
4606
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -4802,19 +4644,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4802
4644
|
&& !selectedRouteData.isInsufficientGas
|
|
4803
4645
|
&& !loading;
|
|
4804
4646
|
const handleWalletConnected = (providerType, provider, providerInfo) => {
|
|
4805
|
-
track({
|
|
4806
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4807
|
-
screen: 'InputScreen',
|
|
4808
|
-
control: 'WalletsMenu',
|
|
4809
|
-
controlType: 'MenuItem',
|
|
4810
|
-
extras: {
|
|
4811
|
-
contextId: id,
|
|
4812
|
-
providerType,
|
|
4813
|
-
providerName: providerInfo.name,
|
|
4814
|
-
providerRdns: providerInfo.rdns,
|
|
4815
|
-
providerUuid: providerInfo.uuid,
|
|
4816
|
-
},
|
|
4817
|
-
});
|
|
4818
4647
|
sendConnectProviderSuccessEvent(eventTarget, providerType, provider, providerInfo);
|
|
4819
4648
|
};
|
|
4820
4649
|
const getChainInfo = () => {
|
|
@@ -4826,19 +4655,6 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4826
4655
|
}
|
|
4827
4656
|
return undefined;
|
|
4828
4657
|
};
|
|
4829
|
-
reactExports.useEffect(() => {
|
|
4830
|
-
if (!id || !experiments)
|
|
4831
|
-
return;
|
|
4832
|
-
track({
|
|
4833
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
4834
|
-
screen: 'Experiments',
|
|
4835
|
-
action: 'Started',
|
|
4836
|
-
extras: {
|
|
4837
|
-
contextId: id,
|
|
4838
|
-
preselectedToken: experiments[AddTokensExperiments.PRESELECTED_TOKEN] || 'none',
|
|
4839
|
-
},
|
|
4840
|
-
});
|
|
4841
|
-
}, [id, experiments]);
|
|
4842
4658
|
reactExports.useEffect(() => {
|
|
4843
4659
|
if (selectedRouteData?.isInsufficientGas) {
|
|
4844
4660
|
setShowNotEnoughGasDrawer(true);
|
|
@@ -4961,7 +4777,6 @@ function RouteFees({ visible, onClose, routeData, totalAmount, totalFiatAmount,
|
|
|
4961
4777
|
}
|
|
4962
4778
|
|
|
4963
4779
|
const useErrorHandler = () => {
|
|
4964
|
-
const { addTokensState: { id: contextId }, } = reactExports.useContext(AddTokensContext);
|
|
4965
4780
|
const { providersState: { checkout, }, } = useProvidersContext();
|
|
4966
4781
|
const { showErrorHandover } = useError(checkout.config.environment);
|
|
4967
4782
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
@@ -4986,11 +4801,7 @@ const useErrorHandler = () => {
|
|
|
4986
4801
|
if (reason.includes('unrecognized chain')) {
|
|
4987
4802
|
errorType = AddTokensErrorTypes.UNRECOGNISED_CHAIN;
|
|
4988
4803
|
}
|
|
4989
|
-
|
|
4990
|
-
type: errorType,
|
|
4991
|
-
data: { error: err },
|
|
4992
|
-
};
|
|
4993
|
-
showErrorHandover(errorType, { contextId, error });
|
|
4804
|
+
showErrorHandover(errorType);
|
|
4994
4805
|
};
|
|
4995
4806
|
return { onTransactionError };
|
|
4996
4807
|
};
|
|
@@ -5140,13 +4951,11 @@ const dividerSx = {
|
|
|
5140
4951
|
};
|
|
5141
4952
|
function Review({ data, showBackButton = false, onBackButtonClick, onCloseButtonClick, }) {
|
|
5142
4953
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
5143
|
-
const {
|
|
5144
|
-
const { addTokensState: { id, squid, chains, tokens, }, } = reactExports.useContext(AddTokensContext);
|
|
4954
|
+
const { addTokensState: { squid, chains, tokens, }, } = reactExports.useContext(AddTokensContext);
|
|
5145
4955
|
const { providersState: { checkout, fromProvider, fromAddress, toAddress, fromProviderInfo, }, } = useProvidersContext();
|
|
5146
4956
|
const { showErrorHandover } = useError(checkout.config.environment);
|
|
5147
4957
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
5148
4958
|
const [route, setRoute] = reactExports.useState();
|
|
5149
|
-
const [amountData, setAmountData] = reactExports.useState();
|
|
5150
4959
|
const [proceedDisabled, setProceedDisabled] = reactExports.useState(true);
|
|
5151
4960
|
const [showFeeBreakdown, setShowFeeBreakdown] = reactExports.useState(false);
|
|
5152
4961
|
const [showSecuringQuote, setShowSecuringQuote] = reactExports.useState(false);
|
|
@@ -5154,19 +4963,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5154
4963
|
const { getRoute } = useRoutes();
|
|
5155
4964
|
const { showHandover } = useHandoverConfig(checkout.config.environment);
|
|
5156
4965
|
const { onTransactionError } = useErrorHandler();
|
|
5157
|
-
const { getAllowance, approve, execute, getStatus, } = useExecute(
|
|
5158
|
-
reactExports.useEffect(() => {
|
|
5159
|
-
page({
|
|
5160
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5161
|
-
screen: 'Review',
|
|
5162
|
-
extras: {
|
|
5163
|
-
contextId: id,
|
|
5164
|
-
toAmount: data.toAmount,
|
|
5165
|
-
toChainId: data.toChainId,
|
|
5166
|
-
toTokenAddress: data.toTokenAddress,
|
|
5167
|
-
},
|
|
5168
|
-
});
|
|
5169
|
-
}, [id]);
|
|
4966
|
+
const { getAllowance, approve, execute, getStatus, } = useExecute('AddTokens', onTransactionError);
|
|
5170
4967
|
const getFromAmountAndRoute = async () => {
|
|
5171
4968
|
if (!squid || !tokens)
|
|
5172
4969
|
return;
|
|
@@ -5180,14 +4977,10 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5180
4977
|
return;
|
|
5181
4978
|
const routeResponse = await getRoute(squid, updatedAmountData?.fromToken, updatedAmountData?.toToken, toAddress, updatedAmountData.fromAmount, updatedAmountData.toAmount, fromAddress, false);
|
|
5182
4979
|
setRoute(routeResponse.route);
|
|
5183
|
-
setAmountData(updatedAmountData);
|
|
5184
4980
|
setProceedDisabled(false);
|
|
5185
4981
|
setShowSecuringQuote(false);
|
|
5186
4982
|
if (routeResponse?.route === undefined) {
|
|
5187
|
-
showErrorHandover(AddTokensErrorTypes.ROUTE_ERROR
|
|
5188
|
-
contextId: id,
|
|
5189
|
-
error: 'Failed to obtain final route',
|
|
5190
|
-
});
|
|
4983
|
+
showErrorHandover(AddTokensErrorTypes.ROUTE_ERROR);
|
|
5191
4984
|
}
|
|
5192
4985
|
};
|
|
5193
4986
|
const { fromChain, toChain } = reactExports.useMemo(() => getRouteChains(chains, route), [chains, route]);
|
|
@@ -5197,19 +4990,6 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5197
4990
|
}, []);
|
|
5198
4991
|
const { totalFees, totalFeesUsd } = reactExports.useMemo(() => getTotalRouteFees(route), [route]);
|
|
5199
4992
|
const openFeeBreakdown = () => {
|
|
5200
|
-
const feesToken = route?.route.estimate.feeCosts?.[0]?.token;
|
|
5201
|
-
track({
|
|
5202
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5203
|
-
screen: 'Review',
|
|
5204
|
-
control: 'FeeBreakdown',
|
|
5205
|
-
controlType: 'Button',
|
|
5206
|
-
extras: {
|
|
5207
|
-
contextId: id,
|
|
5208
|
-
feesToken: feesToken?.symbol,
|
|
5209
|
-
totalAmount: feesToken ? getFormattedNumber(totalFees, feesToken.decimals) : null,
|
|
5210
|
-
totalFiatAmount: getFormattedAmounts(totalFeesUsd),
|
|
5211
|
-
},
|
|
5212
|
-
});
|
|
5213
4993
|
setShowFeeBreakdown(true);
|
|
5214
4994
|
};
|
|
5215
4995
|
const routeFees = reactExports.useMemo(() => {
|
|
@@ -5235,32 +5015,11 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5235
5015
|
return;
|
|
5236
5016
|
}
|
|
5237
5017
|
let currentFromAddress = '';
|
|
5238
|
-
track({
|
|
5239
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5240
|
-
screen: 'Review',
|
|
5241
|
-
control: 'Proceed',
|
|
5242
|
-
controlType: 'Button',
|
|
5243
|
-
extras: {
|
|
5244
|
-
contextId: id,
|
|
5245
|
-
toTokenAddress: route.route.params.toToken,
|
|
5246
|
-
toTokenChainId: route.route.params.toChain,
|
|
5247
|
-
fromTokenAddress: route.route.params.fromToken,
|
|
5248
|
-
fromTokenChainId: route.route.params.fromChain,
|
|
5249
|
-
fromAddress: route.route.params.fromAddress,
|
|
5250
|
-
toAddress: route.route.params.toAddress,
|
|
5251
|
-
estimatedRouteDuration: route.route.estimate.estimatedRouteDuration,
|
|
5252
|
-
fromAmount: amountData?.fromAmount,
|
|
5253
|
-
toAmount: amountData?.toAmount,
|
|
5254
|
-
},
|
|
5255
|
-
});
|
|
5256
5018
|
try {
|
|
5257
5019
|
currentFromAddress = await (await fromProvider.getSigner()).getAddress();
|
|
5258
5020
|
}
|
|
5259
5021
|
catch (error) {
|
|
5260
|
-
showErrorHandover(AddTokensErrorTypes.PROVIDER_ERROR
|
|
5261
|
-
contextId: id,
|
|
5262
|
-
error,
|
|
5263
|
-
});
|
|
5022
|
+
showErrorHandover(AddTokensErrorTypes.PROVIDER_ERROR);
|
|
5264
5023
|
return;
|
|
5265
5024
|
}
|
|
5266
5025
|
if (currentFromAddress !== fromAddress) {
|
|
@@ -5288,30 +5047,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5288
5047
|
showHandover(AddTokensHandoverStep.REQUEST_EXECUTION, {});
|
|
5289
5048
|
const executeTxnReceipt = await execute(squid, fromProviderInfo, changeableProvider, route);
|
|
5290
5049
|
if (executeTxnReceipt) {
|
|
5291
|
-
|
|
5292
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5293
|
-
screen: 'FundsAdded',
|
|
5294
|
-
action: 'Succeeded',
|
|
5295
|
-
extras: {
|
|
5296
|
-
contextId: id,
|
|
5297
|
-
...(route.route.params.fromChain !== ChainId.IMTBL_ZKEVM_MAINNET.toString()
|
|
5298
|
-
&& { txHash: executeTxnReceipt.hash }),
|
|
5299
|
-
...(route.route.params.fromChain === ChainId.IMTBL_ZKEVM_MAINNET.toString()
|
|
5300
|
-
&& { immutableZkEVMTxHash: executeTxnReceipt.hash }),
|
|
5301
|
-
toTokenAddress: route.route.params.toToken,
|
|
5302
|
-
toTokenChainId: route.route.params.toChain,
|
|
5303
|
-
fromTokenAddress: route.route.params.fromToken,
|
|
5304
|
-
fromTokenChainId: route.route.params.fromChain,
|
|
5305
|
-
fromAmount: amountData?.fromAmount,
|
|
5306
|
-
fromAddress: route.route.params.fromAddress,
|
|
5307
|
-
toAddress: route.route.params.toAddress,
|
|
5308
|
-
toAmount: amountData?.toAmount,
|
|
5309
|
-
fromTokenSymbol: amountData?.fromToken.symbol,
|
|
5310
|
-
toTokenSymbol: amountData?.toToken.symbol,
|
|
5311
|
-
},
|
|
5312
|
-
}).then((ctx) => {
|
|
5313
|
-
X('commerce', `addTokensFundsAdded_${ctx.event.messageId}`);
|
|
5314
|
-
});
|
|
5050
|
+
X('commerce', `addTokensFundsAdded_${v4()}`);
|
|
5315
5051
|
sendAddTokensSuccessEvent(eventTarget, executeTxnReceipt.hash);
|
|
5316
5052
|
if (toChain === fromChain) {
|
|
5317
5053
|
showHandover(AddTokensHandoverStep.SUCCESS_ZKEVM, { transactionHash: executeTxnReceipt.hash });
|
|
@@ -5420,7 +5156,6 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5420
5156
|
history: [{ type: AddTokensWidgetViews.ADD_TOKENS }],
|
|
5421
5157
|
});
|
|
5422
5158
|
const { t } = useTranslation();
|
|
5423
|
-
const { page } = useAnalytics();
|
|
5424
5159
|
const viewReducerValues = reactExports.useMemo(() => ({
|
|
5425
5160
|
viewState,
|
|
5426
5161
|
viewDispatch,
|
|
@@ -5462,7 +5197,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5462
5197
|
}, [experiments, toTokenAddressParameter]);
|
|
5463
5198
|
reactExports.useEffect(() => {
|
|
5464
5199
|
if (config.environment !== r.PRODUCTION) {
|
|
5465
|
-
showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR
|
|
5200
|
+
showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR);
|
|
5466
5201
|
}
|
|
5467
5202
|
}, [config, id]);
|
|
5468
5203
|
reactExports.useEffect(() => {
|
|
@@ -5481,7 +5216,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5481
5216
|
const isInvalidToTokenAddress = toTokenAddress && !isValidAddress(toTokenAddress);
|
|
5482
5217
|
const isInvalidToAmount = toAmount && !amountInputValidation(toAmount);
|
|
5483
5218
|
if (isInvalidToTokenAddress || isInvalidToAmount) {
|
|
5484
|
-
showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS
|
|
5219
|
+
showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS);
|
|
5485
5220
|
}
|
|
5486
5221
|
}, [toTokenAddress, toAmount, id]);
|
|
5487
5222
|
reactExports.useEffect(() => {
|
|
@@ -5556,15 +5291,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5556
5291
|
type: ViewActions.GO_BACK,
|
|
5557
5292
|
},
|
|
5558
5293
|
});
|
|
5559
|
-
}, showBackButton: true })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: errorAction, onCloseClick: () => sendAddTokensCloseEvent(eventTarget)
|
|
5560
|
-
page({
|
|
5561
|
-
userJourney: UserJourney.ADD_TOKENS,
|
|
5562
|
-
screen: 'Error',
|
|
5563
|
-
extras: {
|
|
5564
|
-
contextId: id,
|
|
5565
|
-
},
|
|
5566
|
-
});
|
|
5567
|
-
} })), viewState.view.type
|
|
5294
|
+
}, showBackButton: true })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: errorAction, onCloseClick: () => sendAddTokensCloseEvent(eventTarget) })), viewState.view.type
|
|
5568
5295
|
=== SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx(ServiceUnavailableErrorView, { onCloseClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5569
5296
|
viewDispatch({
|
|
5570
5297
|
payload: {
|