@imtbl/checkout-widgets 2.24.2 → 2.24.3
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-DfuhVxM_.js → AddTokensWidget-CN40XAWs.js} +25 -25
- package/dist/browser/{BridgeWidget-DPGVaxwB.js → BridgeWidget-DX1647_H.js} +50 -50
- package/dist/browser/{CommerceWidget-q9rMetzw.js → CommerceWidget-BRQwRtxq.js} +183 -183
- package/dist/browser/{FeesBreakdown-BearnE-z.js → FeesBreakdown-Dj6pDMhI.js} +2 -2
- package/dist/browser/{OnRampWidget-uOeC1RaV.js → OnRampWidget-CY-MuVuH.js} +6 -6
- package/dist/browser/{SaleWidget-XJkxP0rC.js → SaleWidget-DaEJqhTD.js} +65 -65
- package/dist/browser/{SpendingCapHero-DYO48Xgn.js → SpendingCapHero-DgHqajeF.js} +1 -1
- package/dist/browser/{SwapWidget-Ds9Sc1MP.js → SwapWidget-zq-pWclo.js} +23 -23
- package/dist/browser/{TokenImage-Bv8Lexz9.js → TokenImage-xteftx70.js} +1 -1
- package/dist/browser/{TopUpView-ClhdDleL.js → TopUpView-7HXyhb0A.js} +5 -5
- package/dist/browser/{WalletApproveHero-dgeupmzI.js → WalletApproveHero-D9nikPK2.js} +2 -2
- package/dist/browser/{WalletWidget-BTpEzbG5.js → WalletWidget-CE0PxYvF.js} +15 -15
- package/dist/browser/{auto-track-DbX_C4-P.js → auto-track-DE8ELQUp.js} +1 -1
- package/dist/browser/{index-taK8KsgT.js → index-C57mAJnv.js} +911 -235
- package/dist/browser/{index-D96x2b7m.js → index-CKqYNquG.js} +2 -2
- package/dist/browser/{index-BxoGgGF_.js → index-Cdro0xC5.js} +1 -1
- package/dist/browser/{index-CJpZcr5g.js → index-CpfhdhMk.js} +1 -1
- package/dist/browser/{index-vCYAbOQs.js → index-Dl1jA9Oe.js} +1 -1
- package/dist/browser/{index-Dw-s1YMM.js → index-Fd3hryxQ.js} +1 -1
- package/dist/browser/{index-Bhf8WaI7.js → index-_EgRO9oh.js} +1 -1
- package/dist/browser/{index-CCeP9wBE.js → index-lhrBlEyX.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-cYI2vutp.js → index.umd-C8WfVuUJ.js} +1 -1
- package/dist/browser/{useInterval-BMjqUNtV.js → useInterval-ChO2M86D.js} +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as reactExports, ac as hFlex, ad as _defineProperty, ae as _objectWithoutProperties, af as useForwardLocalDomRef, ag as _slicedToArray, ah as useResizeObserver, Q as useTheme, ai as usePrevious, aj as useGetMotionProfile, ak as useBrowserEffect, al as merge, am as getHeadingTextStyles, an as getMotionProfileSx, ao as useConvertSxToEmotionStyles, ap as DUMMY_WIDTH_PUSHER_TEXT,
|
|
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, ac as hFlex, ad as _defineProperty, ae as _objectWithoutProperties, af as useForwardLocalDomRef, ag as _slicedToArray, ah as useResizeObserver, Q as useTheme, ai as usePrevious, aj as useGetMotionProfile, ak as useBrowserEffect, al as merge, am as getHeadingTextStyles, an as getMotionProfileSx, ao as useConvertSxToEmotionStyles, ap as DUMMY_WIDTH_PUSHER_TEXT, s as jsxs, q as jsx, t as Box, aq as useGetSubcomponentChild, ar as flattenChildren, as as vFlex, at as centerFlexChildren, au as SmartClone, av as FormControlLabel, aw as FormControlValidation, ax as FormControlCaption, I as IMTBLWidgetEvents, A as AddTokensEventType, ay as getDefaultExportFromCjs, az as commonjsGlobal, u as useTranslation, aA as Drawer, aB as Divider, H as Heading, v as Button, aC as useProvidersContext, z as useAnalytics, aD as WalletDrawer, aE as UnableToConnectDrawer, aF as Fragment, aG as WalletProviderRdns, U as UserJourney, aH as removeSpace, aI as getProviderSlugFromRdns, aJ as WrappedBrowserProvider, aK as isPassportProvider, aL as connectEIP6963Provider, aM as identifyUser, aN as ConnectEIP6963ProviderError, aO as ProvidersContextActions, aP as MenuItem, aQ as ChainId, aR as SQUID_NATIVE_TOKEN, aS as commonjsRequire, X as getRemoteImage, aT as OnboardingPagination, aU as ViewContext, aV as useHandover, E as EventTargetContext, aW as HandoverTarget, V as ViewActions, n as getRemoteRive, aX as APPROVE_TXN_ANIMATION, aY as RiveStateMachineInput, aZ as HandoverContent, a_ as keyframes, l as TokenFilterTypes, a$ as isNativeToken, b0 as getTokenImageByAddress, b1 as FramedImage, b2 as FramedIcon, b3 as ButtCon, b4 as TextInput, b5 as VerticalMenu, G as getDefaultTokenImage, b6 as TOKEN_PRIORITY_ORDER, y as Body, b7 as EllipsizedText, b8 as Tooltip, b9 as Sticker, ba as getDurationFormatted, bb as getTotalRouteFees, bc as getRouteAndTokenBalances, w as Stack, bd as Icon, be as Badge, bf as getFormattedAmounts, bg as getRemoteVideo, bh as FramedVideo, bi as listVariants, bj as motion, bk as listItemVariants, bl as Banner, bm as useRoutes, bn as useInjectedProviders, bo as X, bp as RouteError, x as SimpleLayout, bq as dist, M as orchestrationEvents, p as parseUnits, a5 as SharedViews, br as SquidFooter, bs as TOOLKIT_SQUID_URL, bt as merge$1, bu as SvgIcon, bv as WalletWarningHero, bw as getFormattedNumber, bx as FIXED_HANDOVER_DURATION, by as EXECUTE_TXN_ANIMATION, L as Link, bz as Trans, bA as useExecute, bB as getRouteChains, bC as t, bD as convertToNetworkChangeableProvider, bE as verifyAndSwitchChain, bF as PriceDisplay, a0 as LoadingView, bG as getFromAmountData, bH as viewReducer, bI as initialViewState, bJ as useSquid, bK as useTokens, bL as v4, bM as r, bN as isValidAddress, N as amountInputValidation, bO as fetchChains, bP as fetchBalances, R as CloudImage, a6 as ErrorView, bQ as ServiceUnavailableErrorView } from './index-C57mAJnv.js';
|
|
2
|
+
import { T as TokenImage } from './TokenImage-xteftx70.js';
|
|
3
|
+
import { f as fetchRiskAssessmentV2, r as resultHasSanctionedWallets, F as FeesBreakdown } from './FeesBreakdown-Dj6pDMhI.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The function `useInterval` sets up an interval that repeatedly calls a given callback function with
|
|
@@ -292,9 +292,9 @@ HeroFormControl.inputs = SUPPORTED_INPUT_COMPONENTS_MAP;
|
|
|
292
292
|
|
|
293
293
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
294
294
|
function sendAddTokensCloseEvent(eventTarget) {
|
|
295
|
-
const closeWidgetEvent = new CustomEvent(
|
|
295
|
+
const closeWidgetEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
296
296
|
detail: {
|
|
297
|
-
type:
|
|
297
|
+
type: AddTokensEventType.CLOSE_WIDGET,
|
|
298
298
|
data: {},
|
|
299
299
|
},
|
|
300
300
|
});
|
|
@@ -305,9 +305,9 @@ function sendAddTokensCloseEvent(eventTarget) {
|
|
|
305
305
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
306
306
|
}
|
|
307
307
|
function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, providerInfo) {
|
|
308
|
-
const successEvent = new CustomEvent(
|
|
308
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
309
309
|
detail: {
|
|
310
|
-
type:
|
|
310
|
+
type: AddTokensEventType.CONNECT_SUCCESS,
|
|
311
311
|
data: {
|
|
312
312
|
provider,
|
|
313
313
|
providerType,
|
|
@@ -321,9 +321,9 @@ function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, pr
|
|
|
321
321
|
eventTarget.dispatchEvent(successEvent);
|
|
322
322
|
}
|
|
323
323
|
const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
324
|
-
const successEvent = new CustomEvent(
|
|
324
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
325
325
|
detail: {
|
|
326
|
-
type:
|
|
326
|
+
type: AddTokensEventType.SUCCESS,
|
|
327
327
|
data: {
|
|
328
328
|
transactionHash,
|
|
329
329
|
},
|
|
@@ -335,9 +335,9 @@ const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
|
335
335
|
eventTarget.dispatchEvent(successEvent);
|
|
336
336
|
};
|
|
337
337
|
const sendAddTokensFailedEvent = (eventTarget, reason) => {
|
|
338
|
-
const failedEvent = new CustomEvent(
|
|
338
|
+
const failedEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
339
339
|
detail: {
|
|
340
|
-
type:
|
|
340
|
+
type: AddTokensEventType.FAILURE,
|
|
341
341
|
data: {
|
|
342
342
|
reason,
|
|
343
343
|
timestamp: new Date().getTime(),
|
|
@@ -929,9 +929,9 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
929
929
|
walletRdns: info.rdns,
|
|
930
930
|
},
|
|
931
931
|
});
|
|
932
|
-
if (info.rdns ===
|
|
932
|
+
if (info.rdns === WalletProviderRdns.PASSPORT) {
|
|
933
933
|
const { isConnected } = await checkout.checkIsWalletConnected({
|
|
934
|
-
provider: new
|
|
934
|
+
provider: new WrappedBrowserProvider(providerDetail.provider),
|
|
935
935
|
});
|
|
936
936
|
if (isConnected) {
|
|
937
937
|
if ((providerType === 'from' && !lockedToProvider)
|
|
@@ -975,7 +975,7 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
975
975
|
// Keep prev wallet change event
|
|
976
976
|
prevWalletChangeEvent.current = event;
|
|
977
977
|
const { info } = event.providerDetail;
|
|
978
|
-
if (providerType === 'to' && info.rdns !==
|
|
978
|
+
if (providerType === 'to' && info.rdns !== WalletProviderRdns.PASSPORT) {
|
|
979
979
|
setShowEOAWarningDrawer(true);
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
@@ -1046,7 +1046,7 @@ function convertToUsd(tokens, amount, token) {
|
|
|
1046
1046
|
}
|
|
1047
1047
|
const address = token.address === 'native' ? SQUID_NATIVE_TOKEN : token.address;
|
|
1048
1048
|
const toToken = tokens.find((value) => value.address.toLowerCase() === address.toLowerCase()
|
|
1049
|
-
&& value.chainId ===
|
|
1049
|
+
&& value.chainId === ChainId.IMTBL_ZKEVM_MAINNET.toString());
|
|
1050
1050
|
if (!toToken) {
|
|
1051
1051
|
return 0;
|
|
1052
1052
|
}
|
|
@@ -4154,7 +4154,7 @@ function TokenDrawerMenu({ checkout, config, toTokenAddress, addTokensState, add
|
|
|
4154
4154
|
(async () => {
|
|
4155
4155
|
try {
|
|
4156
4156
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
4157
|
-
type:
|
|
4157
|
+
type: TokenFilterTypes.SWAP,
|
|
4158
4158
|
chainId: checkout.config.l2ChainId,
|
|
4159
4159
|
});
|
|
4160
4160
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4553,7 +4553,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4553
4553
|
const walletOptions = reactExports.useMemo(() => providers
|
|
4554
4554
|
// TODO: Check if must filter passport on L1
|
|
4555
4555
|
.map((detail) => {
|
|
4556
|
-
if (detail.info.rdns ===
|
|
4556
|
+
if (detail.info.rdns === WalletProviderRdns.PASSPORT) {
|
|
4557
4557
|
return {
|
|
4558
4558
|
...detail,
|
|
4559
4559
|
info: {
|
|
@@ -4574,7 +4574,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4574
4574
|
await identifyUser(identify, toProvider, { anonymousId });
|
|
4575
4575
|
})();
|
|
4576
4576
|
}, [toProvider, lockedToProvider]);
|
|
4577
|
-
const toChain = reactExports.useMemo(() => chains?.find((chain) => chain.id ===
|
|
4577
|
+
const toChain = reactExports.useMemo(() => chains?.find((chain) => chain.id === ChainId.IMTBL_ZKEVM_MAINNET.toString()), [chains]);
|
|
4578
4578
|
reactExports.useEffect(() => {
|
|
4579
4579
|
if (!id || isSwapAvailable === undefined) {
|
|
4580
4580
|
return;
|
|
@@ -4615,7 +4615,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4615
4615
|
&& isValidAmount) {
|
|
4616
4616
|
setFetchingRoutes(true);
|
|
4617
4617
|
try {
|
|
4618
|
-
const availableRoutes = await fetchRoutes(squid, tokens, balances,
|
|
4618
|
+
const availableRoutes = await fetchRoutes(squid, tokens, balances, ChainId.IMTBL_ZKEVM_MAINNET.toString(), selectedToken.address === 'native'
|
|
4619
4619
|
? SQUID_NATIVE_TOKEN
|
|
4620
4620
|
: selectedToken.address, selectedAmount, 5, 1000, isSwapAvailable);
|
|
4621
4621
|
addTokensDispatch({
|
|
@@ -4669,7 +4669,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4669
4669
|
const fetchOnRampTokens = async () => {
|
|
4670
4670
|
try {
|
|
4671
4671
|
const tokenResponse = await checkout.getTokenAllowList({
|
|
4672
|
-
type:
|
|
4672
|
+
type: TokenFilterTypes.ONRAMP,
|
|
4673
4673
|
chainId: checkout.config.l2ChainId,
|
|
4674
4674
|
});
|
|
4675
4675
|
if (tokenResponse?.tokens.length > 0) {
|
|
@@ -4700,7 +4700,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4700
4700
|
showBackButton: true,
|
|
4701
4701
|
provider: toProvider,
|
|
4702
4702
|
};
|
|
4703
|
-
orchestrationEvents.sendRequestOnrampEvent(eventTarget,
|
|
4703
|
+
orchestrationEvents.sendRequestOnrampEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, data);
|
|
4704
4704
|
};
|
|
4705
4705
|
const handleCardClick = () => {
|
|
4706
4706
|
setPayWithCardClicked(true);
|
|
@@ -4766,7 +4766,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
4766
4766
|
type: AddTokensWidgetViews.REVIEW,
|
|
4767
4767
|
data: {
|
|
4768
4768
|
balance: selectedRouteData.amountData.balance,
|
|
4769
|
-
toChainId:
|
|
4769
|
+
toChainId: ChainId.IMTBL_ZKEVM_MAINNET.toString(),
|
|
4770
4770
|
toTokenAddress: selectedToken.address,
|
|
4771
4771
|
toAmount: selectedAmount,
|
|
4772
4772
|
additionalBuffer: selectedRouteData.amountData.additionalBuffer,
|
|
@@ -5294,9 +5294,9 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
5294
5294
|
action: 'Succeeded',
|
|
5295
5295
|
extras: {
|
|
5296
5296
|
contextId: id,
|
|
5297
|
-
...(route.route.params.fromChain !==
|
|
5297
|
+
...(route.route.params.fromChain !== ChainId.IMTBL_ZKEVM_MAINNET.toString()
|
|
5298
5298
|
&& { txHash: executeTxnReceipt.hash }),
|
|
5299
|
-
...(route.route.params.fromChain ===
|
|
5299
|
+
...(route.route.params.fromChain === ChainId.IMTBL_ZKEVM_MAINNET.toString()
|
|
5300
5300
|
&& { immutableZkEVMTxHash: executeTxnReceipt.hash }),
|
|
5301
5301
|
toTokenAddress: route.route.params.toToken,
|
|
5302
5302
|
toTokenChainId: route.route.params.toChain,
|
|
@@ -5549,7 +5549,7 @@ function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showB
|
|
|
5549
5549
|
objectFit: 'cover',
|
|
5550
5550
|
objectPosition: 'center',
|
|
5551
5551
|
} }), viewState.view.type === AddTokensWidgetViews.ADD_TOKENS && (jsx(AddTokens, { config: config, checkout: checkout, toTokenAddress: toTokenAddress, toAmount: toAmount, showBackButton: showBackButton, showOnrampOption: showOnrampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5552
|
-
orchestrationEvents.sendRequestGoBackEvent(eventTarget,
|
|
5552
|
+
orchestrationEvents.sendRequestGoBackEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {});
|
|
5553
5553
|
} })), viewState.view.type === AddTokensWidgetViews.REVIEW && (jsx(Review, { data: viewState.view.data, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
5554
5554
|
viewDispatch({
|
|
5555
5555
|
payload: {
|