@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.
- package/dist/browser/{AddTokensWidget-BQfrLKCo.js → AddTokensWidget-CIR8BF_I.js} +24 -297
- package/dist/browser/{BridgeWidget-6KlgTXwZ.js → BridgeWidget-C5Uljhhx.js} +13 -294
- package/dist/browser/{CommerceWidget-CcCuv661.js → CommerceWidget-CeBBYCbK.js} +17 -47
- package/dist/browser/{FeesBreakdown-DvoQJlP-.js → FeesBreakdown-BU4haotD.js} +1 -1
- package/dist/browser/{OnRampWidget-DaL34PiA.js → OnRampWidget-Ccvb3QkT.js} +5 -80
- package/dist/browser/{SaleWidget-D-IBBRTL.js → SaleWidget-CPARFlzv.js} +61 -219
- package/dist/browser/{SpendingCapHero-Z5NIcrWw.js → SpendingCapHero-B-0YYZho.js} +1 -1
- package/dist/browser/{SwapWidget-C4B2Answ.js → SwapWidget-ujE6uX-N.js} +12 -206
- package/dist/browser/{TokenImage-DucOedrZ.js → TokenImage-BeUf_Ulv.js} +1 -1
- package/dist/browser/{TopUpView-BIvdNYib.js → TopUpView-GMv3360Q.js} +3 -54
- package/dist/browser/{WalletApproveHero-ge2JSOYk.js → WalletApproveHero-BJi7ufqM.js} +4 -12
- package/dist/browser/{WalletWidget-hiUotMuQ.js → WalletWidget-BABrqsfd.js} +4 -96
- package/dist/browser/{index-2esq4Cem.js → index-CcxHW36j.js} +1275 -9717
- package/dist/browser/{index-DWNAmu0n.js → index-Cp1w6map.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{useInterval-1gu4cbu3.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-C-H4NHVE.js +0 -105
- package/dist/browser/index-CcQ-5rAF.js +0 -446
- package/dist/browser/index-CvpdSuud.js +0 -5634
- package/dist/browser/index-D3m5uC9C.js +0 -60
- package/dist/browser/index-DJEaNohG.js +0 -65
- package/dist/browser/index-DPz4F2rf.js +0 -27
- package/dist/browser/index-DQZhPkHy.js +0 -65
- package/dist/browser/index.umd-brf0Qwxh.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
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
import { useTranslation } from 'react-i18next';
|
|
15
15
|
import { Environment } from '@imtbl/config';
|
|
16
16
|
import { trackError } from '@imtbl/metrics';
|
|
17
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
18
17
|
import { amountInputValidation } from '../../../lib/validations/amountInputValidations';
|
|
19
18
|
import { BridgeActions, BridgeContext } from '../context/BridgeContext';
|
|
20
19
|
import {
|
|
@@ -81,9 +80,6 @@ export function BridgeForm(props: BridgeFormProps) {
|
|
|
81
80
|
theme,
|
|
82
81
|
themeOverrides,
|
|
83
82
|
} = props;
|
|
84
|
-
|
|
85
|
-
const { track } = useAnalytics();
|
|
86
|
-
|
|
87
83
|
// Form state
|
|
88
84
|
const [formAmount, setFormAmount] = useState<string>(defaultAmount || '');
|
|
89
85
|
const [amountError, setAmountError] = useState<string>('');
|
|
@@ -314,18 +310,6 @@ export function BridgeForm(props: BridgeFormProps) {
|
|
|
314
310
|
},
|
|
315
311
|
});
|
|
316
312
|
}
|
|
317
|
-
|
|
318
|
-
track({
|
|
319
|
-
userJourney: UserJourney.BRIDGE,
|
|
320
|
-
screen: 'TokenAmount',
|
|
321
|
-
control: 'Review',
|
|
322
|
-
controlType: 'Button',
|
|
323
|
-
extras: {
|
|
324
|
-
tokenAddress: formToken.token.address,
|
|
325
|
-
amount: formAmount,
|
|
326
|
-
},
|
|
327
|
-
});
|
|
328
|
-
|
|
329
313
|
bridgeDispatch({
|
|
330
314
|
payload: {
|
|
331
315
|
type: BridgeActions.SET_TOKEN_AND_AMOUNT,
|
|
@@ -350,7 +334,6 @@ export function BridgeForm(props: BridgeFormProps) {
|
|
|
350
334
|
formToken,
|
|
351
335
|
from,
|
|
352
336
|
getRiskAssessment,
|
|
353
|
-
track,
|
|
354
337
|
viewDispatch,
|
|
355
338
|
]);
|
|
356
339
|
|
|
@@ -376,9 +359,6 @@ export function BridgeForm(props: BridgeFormProps) {
|
|
|
376
359
|
{(!defaultTokenAddress || !isTokenBalancesLoading) && (
|
|
377
360
|
<Box sx={formInputsContainerStyles}>
|
|
378
361
|
<SelectForm
|
|
379
|
-
userJourney={UserJourney.BRIDGE}
|
|
380
|
-
screen="TokenAmount"
|
|
381
|
-
control="FromToken"
|
|
382
362
|
testId="bridge-token"
|
|
383
363
|
options={tokensOptions}
|
|
384
364
|
optionsLoading={isTokenBalancesLoading}
|
|
@@ -17,8 +17,7 @@ import { BridgeWidgetViews } from '../../../context/view-context/BridgeViewConte
|
|
|
17
17
|
import { abbreviateAddress } from '../../../lib/addressUtils';
|
|
18
18
|
import { CryptoFiatContext } from '../../../context/crypto-fiat-context/CryptoFiatContext';
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
isPassportProvider,
|
|
20
|
+
|
|
22
21
|
isWalletConnectProvider,
|
|
23
22
|
} from '../../../lib/provider';
|
|
24
23
|
import { calculateCryptoToFiat, getChainImage, isNativeToken } from '../../../lib/utils';
|
|
@@ -34,10 +33,6 @@ import {
|
|
|
34
33
|
removeChainChangedListener,
|
|
35
34
|
} from '../../../lib';
|
|
36
35
|
import { useInterval } from '../../../lib/hooks/useInterval';
|
|
37
|
-
import {
|
|
38
|
-
UserJourney,
|
|
39
|
-
useAnalytics,
|
|
40
|
-
} from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
41
36
|
import { NetworkSwitchDrawer } from '../../../components/NetworkSwitchDrawer/NetworkSwitchDrawer';
|
|
42
37
|
import { useWalletConnect } from '../../../lib/hooks/useWalletConnect';
|
|
43
38
|
import { NotEnoughGas } from '../../../components/NotEnoughGas/NotEnoughGas';
|
|
@@ -81,9 +76,6 @@ export function BridgeReviewSummary() {
|
|
|
81
76
|
bridgeDispatch,
|
|
82
77
|
} = useContext(BridgeContext);
|
|
83
78
|
const { environment } = checkout.config;
|
|
84
|
-
|
|
85
|
-
const { track } = useAnalytics();
|
|
86
|
-
|
|
87
79
|
const { cryptoFiatState } = useContext(CryptoFiatContext);
|
|
88
80
|
const [loading, setLoading] = useState(false);
|
|
89
81
|
const [estimates, setEstimates] = useState<GasEstimateBridgeToL2Result | undefined>(undefined);
|
|
@@ -401,38 +393,6 @@ export function BridgeReviewSummary() {
|
|
|
401
393
|
// eslint-disable-next-line no-console
|
|
402
394
|
console.error('Current network check failed', err);
|
|
403
395
|
}
|
|
404
|
-
|
|
405
|
-
track({
|
|
406
|
-
userJourney: UserJourney.BRIDGE,
|
|
407
|
-
screen: 'Summary',
|
|
408
|
-
control: 'Submit',
|
|
409
|
-
controlType: 'Button',
|
|
410
|
-
extras: {
|
|
411
|
-
fromWalletAddress: fromAddress,
|
|
412
|
-
fromNetwork,
|
|
413
|
-
fromWallet: {
|
|
414
|
-
address: fromAddress,
|
|
415
|
-
rdns: from?.walletProviderInfo?.rdns,
|
|
416
|
-
uuid: from?.walletProviderInfo?.uuid,
|
|
417
|
-
isPassportWallet: isPassportProvider(from?.browserProvider),
|
|
418
|
-
isMetaMask: isMetaMaskProvider(from?.browserProvider),
|
|
419
|
-
},
|
|
420
|
-
toWalletAddress: toAddress,
|
|
421
|
-
toNetwork,
|
|
422
|
-
toWallet: {
|
|
423
|
-
address: toAddress,
|
|
424
|
-
rdns: to?.walletProviderInfo?.rdns,
|
|
425
|
-
uuid: to?.walletProviderInfo?.uuid,
|
|
426
|
-
isPassportWallet: isPassportProvider(to?.browserProvider),
|
|
427
|
-
isMetaMask: isMetaMaskProvider(to?.browserProvider),
|
|
428
|
-
},
|
|
429
|
-
amount,
|
|
430
|
-
fiatAmount: fromFiatAmount,
|
|
431
|
-
tokenAddress: token?.address,
|
|
432
|
-
moveType: isTransfer ? 'transfer' : 'bridge',
|
|
433
|
-
},
|
|
434
|
-
});
|
|
435
|
-
|
|
436
396
|
viewDispatch({
|
|
437
397
|
payload: {
|
|
438
398
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -590,14 +550,6 @@ export function BridgeReviewSummary() {
|
|
|
590
550
|
gasFeeFiatValue={gasFeeFiatValue}
|
|
591
551
|
gasFeeToken={estimates?.token}
|
|
592
552
|
fees={formatFeeBreakdown()}
|
|
593
|
-
onFeesClick={() => {
|
|
594
|
-
track({
|
|
595
|
-
userJourney: UserJourney.BRIDGE,
|
|
596
|
-
screen: 'MoveCoins',
|
|
597
|
-
control: 'ViewFees',
|
|
598
|
-
controlType: 'Button',
|
|
599
|
-
});
|
|
600
|
-
}}
|
|
601
553
|
sx={{ borderTopRightRadius: '0', borderTopLeftRadius: '0' }}
|
|
602
554
|
loading={loading}
|
|
603
555
|
/>
|
|
@@ -18,17 +18,13 @@ import { useTranslation } from 'react-i18next';
|
|
|
18
18
|
import { BridgeWidgetViews } from '../../../context/view-context/BridgeViewContextTypes';
|
|
19
19
|
import {
|
|
20
20
|
connectToProvider, getWalletProviderNameByProvider,
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
isPassportProvider,
|
|
23
23
|
isWalletConnectProvider,
|
|
24
24
|
} from '../../../lib/provider';
|
|
25
25
|
import { getChainNameById } from '../../../lib/chains';
|
|
26
26
|
import { ViewActions, ViewContext } from '../../../context/view-context/ViewContext';
|
|
27
27
|
import { abbreviateAddress } from '../../../lib/addressUtils';
|
|
28
|
-
import {
|
|
29
|
-
useAnalytics,
|
|
30
|
-
UserJourney,
|
|
31
|
-
} from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
32
28
|
import {
|
|
33
29
|
bridgeHeadingStyles,
|
|
34
30
|
brigdeWalletWrapperStyles,
|
|
@@ -52,9 +48,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
52
48
|
const { viewDispatch } = useContext(ViewContext);
|
|
53
49
|
const { providers } = useInjectedProviders({ checkout });
|
|
54
50
|
const { environment } = checkout.config;
|
|
55
|
-
|
|
56
|
-
const { track } = useAnalytics();
|
|
57
|
-
|
|
58
51
|
// add default state from context values
|
|
59
52
|
// if user has clicked back button
|
|
60
53
|
const defaultFromBrowserProvider = from?.browserProvider ?? null;
|
|
@@ -158,32 +151,10 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
158
151
|
setFromWalletBrowserProvider(provider);
|
|
159
152
|
const address = await (await provider!.getSigner()).getAddress();
|
|
160
153
|
setFromWalletAddress(address.toLowerCase());
|
|
161
|
-
|
|
162
|
-
track({
|
|
163
|
-
userJourney: UserJourney.BRIDGE,
|
|
164
|
-
screen: 'WalletAndNetwork',
|
|
165
|
-
control: 'FromWallet',
|
|
166
|
-
controlType: 'Select',
|
|
167
|
-
extras: {
|
|
168
|
-
walletAddress: address.toLowerCase(),
|
|
169
|
-
},
|
|
170
|
-
});
|
|
171
|
-
|
|
172
154
|
/** if Passport skip from network selector and default to zkEVM */
|
|
173
155
|
if (isPassportProvider(provider)) {
|
|
174
156
|
setFromNetwork(imtblZkEvmNetworkChainId);
|
|
175
|
-
setFromWalletDrawerOpen(false);
|
|
176
|
-
|
|
177
|
-
track({
|
|
178
|
-
userJourney: UserJourney.BRIDGE,
|
|
179
|
-
screen: 'WalletAndNetwork',
|
|
180
|
-
control: 'FromNetwork',
|
|
181
|
-
controlType: 'Select',
|
|
182
|
-
extras: {
|
|
183
|
-
chainId: imtblZkEvmNetworkChainId,
|
|
184
|
-
},
|
|
185
|
-
});
|
|
186
|
-
return;
|
|
157
|
+
setFromWalletDrawerOpen(false); return;
|
|
187
158
|
}
|
|
188
159
|
|
|
189
160
|
/**
|
|
@@ -224,16 +195,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
224
195
|
clearToWalletSelections();
|
|
225
196
|
setFromNetworkDrawerOpen(false);
|
|
226
197
|
setFromNetwork(chainId);
|
|
227
|
-
|
|
228
|
-
track({
|
|
229
|
-
userJourney: UserJourney.BRIDGE,
|
|
230
|
-
screen: 'WalletAndNetwork',
|
|
231
|
-
control: 'FromNetwork',
|
|
232
|
-
controlType: 'Select',
|
|
233
|
-
extras: {
|
|
234
|
-
chainId,
|
|
235
|
-
},
|
|
236
|
-
});
|
|
237
198
|
},
|
|
238
199
|
[checkout, fromWalletBrowserProvider],
|
|
239
200
|
);
|
|
@@ -243,16 +204,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
243
204
|
if (!toWalletBrowserProvider) return;
|
|
244
205
|
setToNetworkDrawerOpen(false);
|
|
245
206
|
setToNetwork(chainId);
|
|
246
|
-
|
|
247
|
-
track({
|
|
248
|
-
userJourney: UserJourney.BRIDGE,
|
|
249
|
-
screen: 'WalletAndNetwork',
|
|
250
|
-
control: 'ToNetwork',
|
|
251
|
-
controlType: 'Select',
|
|
252
|
-
extras: {
|
|
253
|
-
chainId,
|
|
254
|
-
},
|
|
255
|
-
});
|
|
256
207
|
},
|
|
257
208
|
[checkout, toWalletBrowserProvider],
|
|
258
209
|
);
|
|
@@ -265,16 +216,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
265
216
|
: imtblZkEvmNetworkChainId;
|
|
266
217
|
setToNetwork(theToNetwork);
|
|
267
218
|
setToWalletDrawerOpen(false);
|
|
268
|
-
|
|
269
|
-
track({
|
|
270
|
-
userJourney: UserJourney.BRIDGE,
|
|
271
|
-
screen: 'WalletAndNetwork',
|
|
272
|
-
control: 'ToNetwork',
|
|
273
|
-
controlType: 'Select',
|
|
274
|
-
extras: {
|
|
275
|
-
chainId: theToNetwork,
|
|
276
|
-
},
|
|
277
|
-
});
|
|
278
219
|
}, [fromWalletAddress, fromNetwork]);
|
|
279
220
|
|
|
280
221
|
const handleWalletConnectToWalletConnection = useCallback(
|
|
@@ -286,16 +227,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
286
227
|
.then((address) => {
|
|
287
228
|
setToWalletAddress(address.toLowerCase());
|
|
288
229
|
handleSettingToNetwork(address.toLowerCase());
|
|
289
|
-
|
|
290
|
-
track({
|
|
291
|
-
userJourney: UserJourney.BRIDGE,
|
|
292
|
-
screen: 'WalletAndNetwork',
|
|
293
|
-
control: 'ToWallet',
|
|
294
|
-
controlType: 'Select',
|
|
295
|
-
extras: {
|
|
296
|
-
walletAddress: address.toLowerCase(),
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
230
|
});
|
|
300
231
|
},
|
|
301
232
|
[handleSettingToNetwork],
|
|
@@ -309,18 +240,7 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
309
240
|
setToWallet(event);
|
|
310
241
|
const address = await (await fromWalletBrowserProvider!.getSigner()).getAddress();
|
|
311
242
|
setToWalletAddress(address.toLowerCase());
|
|
312
|
-
handleSettingToNetwork(address.toLowerCase());
|
|
313
|
-
|
|
314
|
-
track({
|
|
315
|
-
userJourney: UserJourney.BRIDGE,
|
|
316
|
-
screen: 'WalletAndNetwork',
|
|
317
|
-
control: 'ToWallet',
|
|
318
|
-
controlType: 'Select',
|
|
319
|
-
extras: {
|
|
320
|
-
walletAddress: address.toLowerCase(),
|
|
321
|
-
},
|
|
322
|
-
});
|
|
323
|
-
return;
|
|
243
|
+
handleSettingToNetwork(address.toLowerCase()); return;
|
|
324
244
|
}
|
|
325
245
|
|
|
326
246
|
try {
|
|
@@ -336,16 +256,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
336
256
|
setToWalletBrowserProvider(connectedProvider);
|
|
337
257
|
setToWalletAddress(address.toLowerCase());
|
|
338
258
|
handleSettingToNetwork(address.toLowerCase());
|
|
339
|
-
|
|
340
|
-
track({
|
|
341
|
-
userJourney: UserJourney.BRIDGE,
|
|
342
|
-
screen: 'WalletAndNetwork',
|
|
343
|
-
control: 'ToWallet',
|
|
344
|
-
controlType: 'Select',
|
|
345
|
-
extras: {
|
|
346
|
-
walletAddress: address.toLowerCase(),
|
|
347
|
-
},
|
|
348
|
-
});
|
|
349
259
|
}
|
|
350
260
|
} catch (error) {
|
|
351
261
|
// eslint-disable-next-line no-console
|
|
@@ -399,35 +309,6 @@ export function WalletAndNetworkSelector({ themeOverrides }: { themeOverrides: T
|
|
|
399
309
|
},
|
|
400
310
|
},
|
|
401
311
|
});
|
|
402
|
-
|
|
403
|
-
track({
|
|
404
|
-
userJourney: UserJourney.BRIDGE,
|
|
405
|
-
screen: 'WalletAndNetwork',
|
|
406
|
-
control: 'Next',
|
|
407
|
-
controlType: 'Button',
|
|
408
|
-
extras: {
|
|
409
|
-
fromWalletAddress,
|
|
410
|
-
fromNetwork,
|
|
411
|
-
fromWallet: {
|
|
412
|
-
address: fromWalletAddress,
|
|
413
|
-
rdns: fromWallet?.providerDetail.info.rdns,
|
|
414
|
-
uuid: fromWallet?.providerDetail.info.uuid,
|
|
415
|
-
isPassportWallet: isPassportProvider(fromWalletBrowserProvider),
|
|
416
|
-
isMetaMask: isMetaMaskProvider(fromWalletBrowserProvider),
|
|
417
|
-
},
|
|
418
|
-
toWalletAddress,
|
|
419
|
-
toNetwork,
|
|
420
|
-
toWallet: {
|
|
421
|
-
address: toWalletAddress,
|
|
422
|
-
rdns: toWallet?.providerDetail.info.rdns,
|
|
423
|
-
uuid: toWallet?.providerDetail.info.uuid,
|
|
424
|
-
isPassportWallet: isPassportProvider(toWalletBrowserProvider),
|
|
425
|
-
isMetaMask: isMetaMaskProvider(toWalletBrowserProvider),
|
|
426
|
-
},
|
|
427
|
-
moveType: fromNetwork && fromNetwork === toNetwork ? 'transfer' : 'bridge',
|
|
428
|
-
},
|
|
429
|
-
});
|
|
430
|
-
|
|
431
312
|
viewDispatch({
|
|
432
313
|
payload: {
|
|
433
314
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -2,14 +2,13 @@ import { Box } from '@biom3/react';
|
|
|
2
2
|
import {
|
|
3
3
|
useCallback,
|
|
4
4
|
useContext,
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
useState,
|
|
7
7
|
} from 'react';
|
|
8
8
|
import { CheckoutErrorType } from '@imtbl/checkout-sdk';
|
|
9
9
|
import { ApproveBridgeResponse, BridgeTxResponse } from '@imtbl/bridge-sdk';
|
|
10
10
|
import { useTranslation } from 'react-i18next';
|
|
11
11
|
import { parseUnits } from 'ethers';
|
|
12
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
13
12
|
import { SimpleLayout } from '../../../components/SimpleLayout/SimpleLayout';
|
|
14
13
|
import { HeaderNavigation } from '../../../components/Header/HeaderNavigation';
|
|
15
14
|
import { sendBridgeWidgetCloseEvent } from '../BridgeWidgetEvents';
|
|
@@ -49,19 +48,6 @@ export function ApproveTransaction({ bridgeTransaction }: ApproveTransactionProp
|
|
|
49
48
|
} = bridgeState;
|
|
50
49
|
const { viewDispatch } = useContext(ViewContext);
|
|
51
50
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
52
|
-
|
|
53
|
-
const { page } = useAnalytics();
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
page({
|
|
57
|
-
userJourney: UserJourney.BRIDGE,
|
|
58
|
-
screen: 'ApproveTransaction',
|
|
59
|
-
extras: {
|
|
60
|
-
moveType: bridgeTransaction ? 'bridge' : 'transfer',
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
}, []);
|
|
64
|
-
|
|
65
51
|
// Local state
|
|
66
52
|
const [actionDisabled, setActionDisabled] = useState(false);
|
|
67
53
|
const [txProcessing, setTxProcessing] = useState(false);
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
} from 'react';
|
|
7
7
|
import { ThemeOverrides, TokenFilterTypes, WidgetTheme } from '@imtbl/checkout-sdk';
|
|
8
8
|
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
10
9
|
import { sendBridgeWidgetCloseEvent } from '../BridgeWidgetEvents';
|
|
11
10
|
import { SimpleLayout } from '../../../components/SimpleLayout/SimpleLayout';
|
|
12
11
|
import { HeaderNavigation } from '../../../components/Header/HeaderNavigation';
|
|
@@ -40,21 +39,7 @@ export function Bridge({
|
|
|
40
39
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
41
40
|
const [isTokenBalancesLoading, setIsTokenBalancesLoading] = useState(false);
|
|
42
41
|
const showBackButton = true;
|
|
43
|
-
|
|
44
|
-
const { page } = useAnalytics();
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (amount || tokenAddress) {
|
|
48
|
-
page({
|
|
49
|
-
userJourney: UserJourney.BRIDGE,
|
|
50
|
-
screen: 'TokenAmount',
|
|
51
|
-
extras: {
|
|
52
|
-
amount,
|
|
53
|
-
tokenAddress,
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}, []);
|
|
42
|
+
useEffect(() => { }, []);
|
|
58
43
|
|
|
59
44
|
// This is used to refresh the balances after the Bridge widget
|
|
60
45
|
// has been loaded so that processing transfers will be eventually
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import { useContext
|
|
1
|
+
import { useContext } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { HeaderNavigation } from '../../../components/Header/HeaderNavigation';
|
|
4
4
|
import { SimpleLayout } from '../../../components/SimpleLayout/SimpleLayout';
|
|
5
5
|
import { FooterLogo } from '../../../components/Footer/FooterLogo';
|
|
6
6
|
import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
|
|
7
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
8
7
|
import { sendBridgeWidgetCloseEvent } from '../BridgeWidgetEvents';
|
|
9
8
|
import { BridgeReviewSummary } from '../components/BridgeReviewSummary';
|
|
10
9
|
|
|
11
10
|
export function BridgeReview() {
|
|
12
11
|
const { t } = useTranslation();
|
|
13
12
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
14
|
-
|
|
15
|
-
const { page } = useAnalytics();
|
|
16
|
-
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
page({
|
|
19
|
-
userJourney: UserJourney.BRIDGE,
|
|
20
|
-
screen: 'Review',
|
|
21
|
-
});
|
|
22
|
-
}, []);
|
|
23
|
-
|
|
24
13
|
return (
|
|
25
14
|
<SimpleLayout
|
|
26
15
|
testId="bridge-review"
|
|
@@ -9,7 +9,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
9
9
|
import { getGasPriceInWei, WalletProviderName } from '@imtbl/checkout-sdk';
|
|
10
10
|
import { FlowRateWithdrawResponse } from '@imtbl/bridge-sdk';
|
|
11
11
|
import { FeeData } from 'ethers';
|
|
12
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
13
12
|
import { Transaction } from '../../../lib/clients';
|
|
14
13
|
import { getChainNameById } from '../../../lib/chains';
|
|
15
14
|
import { WITHDRAWAL_CLAIM_GAS_LIMIT } from '../../../lib';
|
|
@@ -35,16 +34,6 @@ export function ClaimWithdrawal({ transaction }: ClaimWithdrawalProps) {
|
|
|
35
34
|
const { bridgeState: { checkout, tokenBridge, from } } = useContext(BridgeContext);
|
|
36
35
|
const { viewDispatch } = useContext(ViewContext);
|
|
37
36
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
38
|
-
|
|
39
|
-
const { page } = useAnalytics();
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
page({
|
|
43
|
-
userJourney: UserJourney.BRIDGE,
|
|
44
|
-
screen: 'ClaimWithdrawal',
|
|
45
|
-
});
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
37
|
const [txProcessing, setTxProcessing] = useState(false);
|
|
49
38
|
const [loading, setLoading] = useState(false);
|
|
50
39
|
const [hasWithdrawError, setHasWithdrawError] = useState(false);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useContext, useEffect } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
3
|
import { Badge, ButtCon } from '@biom3/react';
|
|
4
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
5
4
|
import { ButtonNavigationStyles } from '../../../components/Header/HeaderStyles';
|
|
6
5
|
import { BridgeWidgetViews } from '../../../context/view-context/BridgeViewContextTypes';
|
|
7
6
|
import { ViewActions, ViewContext } from '../../../context/view-context/ViewContext';
|
|
@@ -13,8 +12,6 @@ import { sendBridgeTransactionSentEvent, sendBridgeWidgetCloseEvent } from '../B
|
|
|
13
12
|
import { FooterLogo } from '../../../components/Footer/FooterLogo';
|
|
14
13
|
import { EventTargetContext } from '../../../context/event-target-context/EventTargetContext';
|
|
15
14
|
import { BridgeContext } from '../context/BridgeContext';
|
|
16
|
-
import { calculateCryptoToFiat } from '../../../lib/utils';
|
|
17
|
-
import { CryptoFiatContext } from '../../../context/crypto-fiat-context/CryptoFiatContext';
|
|
18
15
|
|
|
19
16
|
export interface MoveInProgressProps {
|
|
20
17
|
transactionHash: string;
|
|
@@ -24,17 +21,10 @@ export interface MoveInProgressProps {
|
|
|
24
21
|
export function MoveInProgress({ transactionHash, isTransfer }: MoveInProgressProps) {
|
|
25
22
|
const { t } = useTranslation();
|
|
26
23
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
27
|
-
const { page } = useAnalytics();
|
|
28
|
-
|
|
29
|
-
const { cryptoFiatState } = useContext(CryptoFiatContext);
|
|
30
24
|
const { viewDispatch } = useContext(ViewContext);
|
|
31
25
|
const {
|
|
32
26
|
bridgeState: {
|
|
33
27
|
checkout,
|
|
34
|
-
from,
|
|
35
|
-
to,
|
|
36
|
-
token,
|
|
37
|
-
amount,
|
|
38
28
|
},
|
|
39
29
|
} = useContext(BridgeContext);
|
|
40
30
|
|
|
@@ -43,20 +33,6 @@ export function MoveInProgress({ transactionHash, isTransfer }: MoveInProgressPr
|
|
|
43
33
|
eventTarget,
|
|
44
34
|
transactionHash,
|
|
45
35
|
);
|
|
46
|
-
|
|
47
|
-
const fiatAmount = calculateCryptoToFiat(amount, token?.symbol ?? '', cryptoFiatState.conversions);
|
|
48
|
-
page({
|
|
49
|
-
userJourney: UserJourney.BRIDGE,
|
|
50
|
-
screen: 'InProgress',
|
|
51
|
-
extras: {
|
|
52
|
-
fromWalletAddress: from?.walletAddress,
|
|
53
|
-
toWalletAddress: to?.walletAddress,
|
|
54
|
-
amount,
|
|
55
|
-
fiatAmount,
|
|
56
|
-
tokenAddress: token?.address,
|
|
57
|
-
moveType: isTransfer ? 'transfer' : 'bridge',
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
36
|
}, []);
|
|
61
37
|
|
|
62
38
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext
|
|
1
|
+
import { useContext } from 'react';
|
|
2
2
|
import { ButtCon } from '@biom3/react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { IMTBLWidgetEvents, ThemeOverrides } from '@imtbl/checkout-sdk';
|
|
@@ -9,7 +9,6 @@ import { EventTargetContext } from '../../../context/event-target-context/EventT
|
|
|
9
9
|
import { BridgeWidgetViews } from '../../../context/view-context/BridgeViewContextTypes';
|
|
10
10
|
import { ButtonNavigationStyles } from '../../../components/Header/HeaderStyles';
|
|
11
11
|
import { ViewActions, ViewContext } from '../../../context/view-context/ViewContext';
|
|
12
|
-
import { UserJourney, useAnalytics } from '../../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
13
12
|
import { sendBridgeWidgetCloseEvent } from '../BridgeWidgetEvents';
|
|
14
13
|
import { WalletAndNetworkSelector } from '../components/WalletAndNetworkSelector';
|
|
15
14
|
import { orchestrationEvents } from '../../../lib/orchestrationEvents';
|
|
@@ -26,16 +25,6 @@ export function WalletNetworkSelectionView({
|
|
|
26
25
|
const { viewDispatch } = useContext(ViewContext);
|
|
27
26
|
|
|
28
27
|
const { eventTargetState: { eventTarget } } = useContext(EventTargetContext);
|
|
29
|
-
|
|
30
|
-
const { page } = useAnalytics();
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
page({
|
|
34
|
-
userJourney: UserJourney.BRIDGE,
|
|
35
|
-
screen: 'WalletNetworkSelection',
|
|
36
|
-
});
|
|
37
|
-
}, []);
|
|
38
|
-
|
|
39
28
|
return (
|
|
40
29
|
<SimpleLayout
|
|
41
30
|
testId="bridge-view"
|
|
@@ -20,7 +20,6 @@ import { useTranslation } from 'react-i18next';
|
|
|
20
20
|
import { ConnectLoaderSuccess } from '../../components/ConnectLoader/ConnectLoaderSuccess';
|
|
21
21
|
import { StatusType } from '../../components/Status/StatusType';
|
|
22
22
|
import { StatusView } from '../../components/Status/StatusView';
|
|
23
|
-
import { useAnalytics, UserJourney } from '../../context/analytics-provider/SegmentAnalyticsProvider';
|
|
24
23
|
import { EventTargetContext } from '../../context/event-target-context/EventTargetContext';
|
|
25
24
|
import { ConnectWidgetView, ConnectWidgetViews } from '../../context/view-context/ConnectViewContextTypes';
|
|
26
25
|
import {
|
|
@@ -31,7 +30,6 @@ import {
|
|
|
31
30
|
viewReducer,
|
|
32
31
|
} from '../../context/view-context/ViewContext';
|
|
33
32
|
import { addProviderListenersForWidgetRoot, sendProviderUpdatedEvent } from '../../lib';
|
|
34
|
-
import { identifyUser } from '../../lib/analytics/identifyUser';
|
|
35
33
|
import { useWalletConnect } from '../../lib/hooks/useWalletConnect';
|
|
36
34
|
import {
|
|
37
35
|
isMetaMaskProvider, isPassportProvider, isWalletConnectProvider,
|
|
@@ -112,9 +110,6 @@ export default function ConnectWidget({
|
|
|
112
110
|
() => ({ viewState, viewDispatch }),
|
|
113
111
|
[viewState, viewDispatch],
|
|
114
112
|
);
|
|
115
|
-
|
|
116
|
-
const { identify, page, user } = useAnalytics();
|
|
117
|
-
|
|
118
113
|
const targetChain = targetChainId ?? checkout.config.l2ChainId;
|
|
119
114
|
|
|
120
115
|
useEffect(() => {
|
|
@@ -176,19 +171,8 @@ export default function ConnectWidget({
|
|
|
176
171
|
}, [isWalletConnectEnabled, ethereumProvider]);
|
|
177
172
|
|
|
178
173
|
const handleConnectSuccess = useCallback(async () => {
|
|
179
|
-
if (!provider) return;
|
|
180
|
-
// WT-1698 Analytics - Identify user here
|
|
181
|
-
page({
|
|
182
|
-
userJourney: UserJourney.CONNECT,
|
|
183
|
-
screen: 'ConnectSuccess',
|
|
184
|
-
});
|
|
185
|
-
// Set up EIP-1193 provider event listeners for widget root instances
|
|
174
|
+
if (!provider) return; // Set up EIP-1193 provider event listeners for widget root instances
|
|
186
175
|
addProviderListenersForWidgetRoot(provider);
|
|
187
|
-
|
|
188
|
-
const userData = user ? await user() : undefined;
|
|
189
|
-
const anonymousId = userData?.anonymousId();
|
|
190
|
-
|
|
191
|
-
await identifyUser(identify, provider, { anonymousId });
|
|
192
176
|
sendProviderUpdatedEvent({ provider });
|
|
193
177
|
|
|
194
178
|
// Find the wallet provider info via injected with Passport and MetaMask fallbacks
|
|
@@ -206,7 +190,7 @@ export default function ConnectWidget({
|
|
|
206
190
|
return;
|
|
207
191
|
}
|
|
208
192
|
sendConnectSuccessEvent(eventTarget, provider, walletProviderName ?? undefined, walletProviderInfo);
|
|
209
|
-
}, [provider
|
|
193
|
+
}, [provider]);
|
|
210
194
|
|
|
211
195
|
return (
|
|
212
196
|
<ViewContext.Provider value={viewReducerValues}>
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
ConnectWidgetParams, IMTBLWidgetEvents, WidgetProperties, WidgetType,
|
|
4
4
|
} from '@imtbl/checkout-sdk';
|
|
5
5
|
import { ThemeProvider } from '../../components/ThemeProvider/ThemeProvider';
|
|
6
|
-
import { CustomAnalyticsProvider } from '../../context/analytics-provider/CustomAnalyticsProvider';
|
|
7
6
|
import { LoadingView } from '../../views/loading/LoadingView';
|
|
8
7
|
import { getChainNameById } from '../../lib/chains';
|
|
9
8
|
import { HandoverProvider } from '../../context/handover-context/HandoverProvider';
|
|
@@ -46,21 +45,21 @@ export class Connect extends Base<WidgetType.CONNECT> {
|
|
|
46
45
|
|
|
47
46
|
this.reactRoot.render(
|
|
48
47
|
<React.StrictMode>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
|
|
49
|
+
<ThemeProvider id="connect-container" config={this.strongConfig()}>
|
|
50
|
+
<HandoverProvider>
|
|
51
|
+
<Suspense fallback={<LoadingView loadingText={t('views.LOADING_VIEW.text')} />}>
|
|
52
|
+
<ConnectWidget
|
|
53
|
+
config={this.strongConfig()}
|
|
54
|
+
checkout={this.checkout}
|
|
55
|
+
targetWalletRdns={this.parameters.targetWalletRdns}
|
|
56
|
+
targetChainId={this.parameters.targetChainId}
|
|
57
|
+
blocklistWalletRdns={this.parameters.blocklistWalletRdns}
|
|
58
|
+
/>
|
|
59
|
+
</Suspense>
|
|
60
|
+
</HandoverProvider>
|
|
61
|
+
</ThemeProvider>
|
|
62
|
+
|
|
64
63
|
</React.StrictMode>,
|
|
65
64
|
);
|
|
66
65
|
}
|