@imtbl/sdk 1.64.0 → 1.65.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{blockchain_data-BJFFyOsZ.js → blockchain_data-DfCzmYtJ.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/{AddTokensWidget-_RYa4euh.js → AddTokensWidget-B4Ir7dvN.js} +71 -16
- package/dist/browser/checkout/{BridgeWidget-BCC7YXWj.js → BridgeWidget-H083MzVz.js} +9 -9
- package/dist/browser/checkout/{CommerceWidget-B4QxFLZq.js → CommerceWidget--lkMi5aZ.js} +119 -75
- package/dist/browser/checkout/{CryptoFiatProvider-b0KhVg3Y.js → CryptoFiatProvider-CiE5eWiz.js} +1 -1
- package/dist/browser/checkout/{EllipsizedText-CF9lzi6c.js → EllipsizedText-BYNkXO37.js} +1 -1
- package/dist/browser/checkout/{FeesBreakdown-BGnZxcX5.js → FeesBreakdown-Bh4uazkv.js} +1 -1
- package/dist/browser/checkout/{HandoverContent-CESizLWk.js → HandoverContent-D1zo76oD.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-BrGpM6Vn.js → OnRampWidget-NHF5WhcL.js} +3 -3
- package/dist/browser/checkout/{SaleWidget-iuigaIZp.js → SaleWidget-ByoqYtgj.js} +14 -14
- package/dist/browser/checkout/{SpendingCapHero-B3sb2Wt1.js → SpendingCapHero-D4WKiLRo.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-CdXf4YYP.js → SwapWidget-KGdvQrAY.js} +9 -9
- package/dist/browser/checkout/{TopUpView-Bg-huhcb.js → TopUpView-DzmCXwDT.js} +3 -3
- package/dist/browser/checkout/{WalletApproveHero-DW6Uw6rT.js → WalletApproveHero-DCUEVcQH.js} +3 -3
- package/dist/browser/checkout/{WalletWidget-ChYjXfAy.js → WalletWidget-BUz0zP4W.js} +4 -4
- package/dist/browser/checkout/{auto-track-CgS-wbin.js → auto-track-BTcqufEu.js} +1 -1
- package/dist/browser/checkout/{index-qYOj-RwR.js → index-B9xhbnXe.js} +1 -1
- package/dist/browser/checkout/{index-BjLYItcm.js → index-Be6kRjpo.js} +27 -26
- package/dist/browser/checkout/{index-DoYS_inI.js → index-BoADKkwG.js} +1 -1
- package/dist/browser/checkout/{index-CshBDuS0.js → index-CSsSQRP5.js} +1 -1
- package/dist/browser/checkout/{index-C4anNRY5.js → index-CY3lxpA0.js} +2 -2
- package/dist/browser/checkout/{index-bNCjF_qE.js → index-Du1pp5VY.js} +1 -1
- package/dist/browser/checkout/{index-BqJ9Usxu.js → index-Z-kqScRf.js} +1 -1
- package/dist/browser/checkout/{index-LCMExv1j.js → index-cQyEo58T.js} +1 -1
- package/dist/browser/checkout/{index-D6TVOnc2.js → index-eMbWP9ME.js} +1 -1
- package/dist/browser/checkout/{index.umd-CL6Tp5Ej.js → index.umd-BNmwg7T-.js} +1 -1
- package/dist/browser/checkout/{retry-GJcGp5Sw.js → retry-B3R-pN6g.js} +1 -1
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/browser/checkout/{useInterval-BfG2xnz-.js → useInterval-BHSScII2.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +175 -75
- package/dist/{checkout-Cs8dXzsO.js → checkout-CByLVa3T.js} +6 -5
- package/dist/checkout.d.ts +7 -4
- package/dist/checkout.js +5 -5
- package/dist/{config-COmcON31.js → config-D6m3gLa7.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-BDcnlE-I.js → index-CP5Jo8hc.js} +1 -1
- package/dist/{index-B1oIamSp.js → index-Cs29UnCY.js} +4 -4
- package/dist/{index-8JzLLOmv.js → index-CubSKjsq.js} +1 -1
- package/dist/{index-CinJtsQi.js → index-DoAt7WaE.js} +3 -3
- package/dist/{index-CPZC_4-h.js → index-Dxusousf.js} +1 -1
- package/dist/{index-27OfHl8u.js → index-H8jBbWYD.js} +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.d.ts +7 -4
- package/dist/index.js +14 -14
- package/dist/{minting_backend-CkmXVZ0p.js → minting_backend-B-sjNjb4.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-Bi2t8guV.js → orderbook-CZwKEtIk.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-B9TINukj.js → passport-B_Of8icJ.js} +3 -3
- package/dist/passport.js +4 -4
- package/dist/{webhook-D45ZPknC.js → webhook-BXlhJowI.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-C1LIWzQf.js → x-erMKrY3l.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as APIError, B as BlockchainData } from './index-
|
|
2
|
-
import { i as index } from './index-
|
|
1
|
+
import { A as APIError, B as BlockchainData } from './index-DoAt7WaE.js';
|
|
2
|
+
import { i as index } from './index-Dxusousf.js';
|
|
3
3
|
|
|
4
4
|
var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
5
5
|
__proto__: null,
|
package/dist/blockchain_data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { A as APIError, B as BlockchainData } from './index-
|
|
2
|
-
export { i as Types } from './index-
|
|
3
|
-
import './index-
|
|
1
|
+
export { A as APIError, B as BlockchainData } from './index-DoAt7WaE.js';
|
|
2
|
+
export { i as Types } from './index-Dxusousf.js';
|
|
3
|
+
import './index-CP5Jo8hc.js';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'lru-memorise';
|
|
6
6
|
import 'global-const';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties,
|
|
2
|
-
import { f as formatUnits, p as parseUnits } from './index-
|
|
3
|
-
import { E as EllipsizedText, C as Contract } from './EllipsizedText-
|
|
4
|
-
import { r as retry, T as TokenImage } from './retry-
|
|
5
|
-
import { H as HandoverContent } from './HandoverContent-
|
|
6
|
-
import { F as FeesBreakdown } from './FeesBreakdown-
|
|
1
|
+
import { _ as _objectWithoutProperties, w as useTheme, x as useForwardLocalDomRef, y as useGetSubcomponentChild, z as useSplitApartChildrenAndSubComponents, r as reactExports, D as merge$2, F as useResizeObserver, p as jsxs, o as jsx, G as SmartClone, H as Box, J as isChildSubcomponent, K as flattenChildren, M as Body, N as useTheme$1, Q as Icon, R as ButtCon, T as Button, U as _defineProperty, X as isDualVariantIcon, Y as _slicedToArray, Z as isNumberWithinTotal, $ as getStartingSize, a0 as BaseClickable, a1 as ClassNames, a2 as _toConsumableArray, a3 as isError, a4 as Badge, a5 as FramedIcon, a6 as FramedImage, a7 as FramedLogo, a8 as Stack, a9 as hFlex, aa as usePrevious, ab as useBrowserEffect, ac as getHeadingTextStyles, ad as vFlex, ae as centerFlexChildren, af as FormControlLabel, ag as FormControlValidation, ah as FormControlCaption, I as IMTBLWidgetEvents, A as AddTokensEventType, ai as getDefaultExportFromCjs, aj as commonjsGlobal, u as useTranslation, ak as MenuItem, al as tokenValueFormat, am as DEFAULT_TOKEN_FORMATTING_DECIMALS, an as BigNumber, ao as getRemoteVideo, ap as FramedVideo, aq as motion, ar as listItemVariants, as as Divider, at as Fragment, au as listVariants, av as useProvidersContext, aw as Drawer, ax as useAnalytics, ay as UserJourney, az as isPassportProvider, aA as Heading, aB as WalletDrawer, aC as UnableToConnectDrawer, aD as ChangedYourMindDrawer, aE as WalletProviderRdns, aF as getProviderSlugFromRdns, aG as Web3Provider, aH as connectEIP6963Provider, aI as identifyUser, aJ as ConnectEIP6963ProviderError, aK as ProvidersContextActions, aL as ViewContext, V as ViewActions, m as SharedViews, j as ChainId, aM as commonjsRequire, aN as getRemoteImage, aO as useHandover, aP as HandoverTarget, aQ as EventTargetContext, aR as getRemoteRive, aS as Trans, aT as Link, aU as useInjectedProviders, aV as getDefaultTokenImage, aW as OverflowDrawerMenu, aX as SimpleLayout, aY as TokenFilterTypes, h as getL2ChainId, aZ as isNativeToken, a_ as getTokenImageByAddress, a$ as orchestrationEvents, b0 as requireSecp256k1$1, b1 as requireLib_commonjs, b2 as require$$0$2, b3 as bech32$2, b4 as bnExports$1, b5 as require$$0$3, b6 as getAugmentedNamespace, b7 as require$$0$4, b8 as minimalisticAssert, b9 as require$$2, ba as hash$6, bb as MaxUint256, bc as merge$3, bd as SvgIcon, be as WalletWarningHero, bf as Environment, bg as t, bh as PriceDisplay, L as LoadingView, bi as viewReducer, bj as initialViewState, bk as isValidAddress, bl as amountInputValidation, bm as CloudImage, E as ErrorView, bn as ServiceUnavailableErrorView, bo as ServiceType } from './index-Be6kRjpo.js';
|
|
2
|
+
import { f as formatUnits, p as parseUnits } from './index-CSsSQRP5.js';
|
|
3
|
+
import { E as EllipsizedText, C as Contract } from './EllipsizedText-BYNkXO37.js';
|
|
4
|
+
import { r as retry, T as TokenImage } from './retry-B3R-pN6g.js';
|
|
5
|
+
import { H as HandoverContent } from './HandoverContent-D1zo76oD.js';
|
|
6
|
+
import { F as FeesBreakdown } from './FeesBreakdown-Bh4uazkv.js';
|
|
7
7
|
|
|
8
8
|
var bannerSx = {
|
|
9
9
|
d: "flex",
|
|
@@ -1074,6 +1074,35 @@ function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, pr
|
|
|
1074
1074
|
if (eventTarget !== undefined)
|
|
1075
1075
|
eventTarget.dispatchEvent(successEvent);
|
|
1076
1076
|
}
|
|
1077
|
+
const sendAddTokensSuccessEvent = (eventTarget, transactionHash) => {
|
|
1078
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
1079
|
+
detail: {
|
|
1080
|
+
type: AddTokensEventType.SUCCESS,
|
|
1081
|
+
data: {
|
|
1082
|
+
transactionHash,
|
|
1083
|
+
},
|
|
1084
|
+
},
|
|
1085
|
+
});
|
|
1086
|
+
// eslint-disable-next-line no-console
|
|
1087
|
+
console.log('add tokens success event:', eventTarget, successEvent);
|
|
1088
|
+
if (eventTarget !== undefined)
|
|
1089
|
+
eventTarget.dispatchEvent(successEvent);
|
|
1090
|
+
};
|
|
1091
|
+
const sendAddTokensFailedEvent = (eventTarget, reason) => {
|
|
1092
|
+
const failedEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
1093
|
+
detail: {
|
|
1094
|
+
type: AddTokensEventType.FAILURE,
|
|
1095
|
+
data: {
|
|
1096
|
+
reason,
|
|
1097
|
+
timestamp: new Date().getTime(),
|
|
1098
|
+
},
|
|
1099
|
+
},
|
|
1100
|
+
});
|
|
1101
|
+
// eslint-disable-next-line no-console
|
|
1102
|
+
console.log('add tokens failed event:', eventTarget, failedEvent);
|
|
1103
|
+
if (eventTarget !== undefined)
|
|
1104
|
+
eventTarget.dispatchEvent(failedEvent);
|
|
1105
|
+
};
|
|
1077
1106
|
|
|
1078
1107
|
const initialAddTokensState = {
|
|
1079
1108
|
allowedTokens: null,
|
|
@@ -2694,7 +2723,7 @@ function EOAWarningDrawer({ visible, onProceedClick, onCloseDrawer, }) {
|
|
|
2694
2723
|
}
|
|
2695
2724
|
|
|
2696
2725
|
function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, providerType, walletOptions, bottomSlot, menuItemSize = 'small', disabledOptions = [], getShouldRequestWalletPermissions, }) {
|
|
2697
|
-
const { providersState: { checkout }, providersDispatch, } = useProvidersContext();
|
|
2726
|
+
const { providersState: { checkout, fromProvider }, providersDispatch, } = useProvidersContext();
|
|
2698
2727
|
const { identify, track } = useAnalytics();
|
|
2699
2728
|
const prevWalletChangeEvent = reactExports.useRef();
|
|
2700
2729
|
const [showUnableToConnectDrawer, setShowUnableToConnectDrawer] = reactExports.useState(false);
|
|
@@ -2739,13 +2768,14 @@ function ConnectWalletDrawer({ heading, visible, onClose, onConnect, onError, pr
|
|
|
2739
2768
|
walletRdns: info.rdns,
|
|
2740
2769
|
},
|
|
2741
2770
|
});
|
|
2742
|
-
// Proceed to disconnect current provider if Passport
|
|
2743
2771
|
if (info.rdns === WalletProviderRdns.PASSPORT) {
|
|
2744
2772
|
const { isConnected } = await checkout.checkIsWalletConnected({
|
|
2745
2773
|
provider: new Web3Provider(providerDetail.provider),
|
|
2746
2774
|
});
|
|
2747
2775
|
if (isConnected) {
|
|
2748
|
-
|
|
2776
|
+
if (providerType === 'from' || (providerType === 'to' && !isPassportProvider(fromProvider))) {
|
|
2777
|
+
await checkout.passport?.logout();
|
|
2778
|
+
}
|
|
2749
2779
|
}
|
|
2750
2780
|
}
|
|
2751
2781
|
let address;
|
|
@@ -2831,7 +2861,7 @@ function DeliverToWalletDrawer({ visible, onClose, onConnect, walletOptions, })
|
|
|
2831
2861
|
});
|
|
2832
2862
|
}
|
|
2833
2863
|
};
|
|
2834
|
-
//
|
|
2864
|
+
// Because wallets extensions don't support multiple wallet connections
|
|
2835
2865
|
// UX decides to have the user use the same wallet type they selected to pay with
|
|
2836
2866
|
// ie: Metamask to Metamsk, will send to same wallet address
|
|
2837
2867
|
const selectedSameFromWalletType = (providerInfo) => (fromProviderInfo?.rdns !== providerInfo.rdns ? undefined : false);
|
|
@@ -5932,6 +5962,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
5932
5962
|
const { track, page } = useAnalytics();
|
|
5933
5963
|
const { t } = useTranslation();
|
|
5934
5964
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
5965
|
+
const [payWithCardClicked, setPayWithCardClicked] = reactExports.useState(false);
|
|
5935
5966
|
const [showOptionsDrawer, setShowOptionsDrawer] = reactExports.useState(false);
|
|
5936
5967
|
const [showPayWithDrawer, setShowPayWithDrawer] = reactExports.useState(false);
|
|
5937
5968
|
const [showDeliverToDrawer, setShowDeliverToDrawer] = reactExports.useState(false);
|
|
@@ -6007,7 +6038,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6007
6038
|
setInputValue(value);
|
|
6008
6039
|
setSelectedAmount(value);
|
|
6009
6040
|
};
|
|
6010
|
-
const { providersState: { fromProviderInfo, toProviderInfo, fromAddress, toAddress, lockedToProvider, }, } = useProvidersContext();
|
|
6041
|
+
const { providersState: { fromProviderInfo, toProviderInfo, toProvider, fromAddress, toAddress, lockedToProvider, }, } = useProvidersContext();
|
|
6011
6042
|
const { providers } = useInjectedProviders({ checkout });
|
|
6012
6043
|
const walletOptions = reactExports.useMemo(() => providers
|
|
6013
6044
|
// TODO: Check if must filter passport on L1
|
|
@@ -6133,7 +6164,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6133
6164
|
const handleTokenChange = reactExports.useCallback((token) => {
|
|
6134
6165
|
setSelectedToken(token);
|
|
6135
6166
|
}, []);
|
|
6136
|
-
const
|
|
6167
|
+
const sendRequestOnRampEvent = () => {
|
|
6137
6168
|
track({
|
|
6138
6169
|
userJourney: UserJourney.ADD_TOKENS,
|
|
6139
6170
|
screen: 'InputScreen',
|
|
@@ -6148,15 +6179,35 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6148
6179
|
tokenAddress: selectedToken?.address ?? '',
|
|
6149
6180
|
amount: selectedAmount ?? '',
|
|
6150
6181
|
showBackButton: true,
|
|
6182
|
+
provider: toProvider,
|
|
6151
6183
|
};
|
|
6152
6184
|
orchestrationEvents.sendRequestOnrampEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, data);
|
|
6153
6185
|
};
|
|
6186
|
+
const handleCardClick = () => {
|
|
6187
|
+
setPayWithCardClicked(true);
|
|
6188
|
+
if (!toProvider) {
|
|
6189
|
+
setShowDeliverToDrawer(true);
|
|
6190
|
+
return;
|
|
6191
|
+
}
|
|
6192
|
+
sendRequestOnRampEvent();
|
|
6193
|
+
};
|
|
6194
|
+
reactExports.useEffect(() => {
|
|
6195
|
+
if (toProvider && payWithCardClicked) {
|
|
6196
|
+
sendRequestOnRampEvent();
|
|
6197
|
+
}
|
|
6198
|
+
}, [toProvider]);
|
|
6154
6199
|
const handleRouteClick = (route) => {
|
|
6155
6200
|
setShowOptionsDrawer(false);
|
|
6156
6201
|
setShowPayWithDrawer(false);
|
|
6157
6202
|
setShowDeliverToDrawer(false);
|
|
6158
6203
|
setSelectedRouteData(route);
|
|
6159
6204
|
};
|
|
6205
|
+
const handleDeliverToClose = (connectedToAddress) => {
|
|
6206
|
+
if (!connectedToAddress) {
|
|
6207
|
+
setPayWithCardClicked(false);
|
|
6208
|
+
}
|
|
6209
|
+
setShowDeliverToDrawer(false);
|
|
6210
|
+
};
|
|
6160
6211
|
const handleReviewClick = () => {
|
|
6161
6212
|
if (!selectedRouteData || !selectedToken?.address)
|
|
6162
6213
|
return;
|
|
@@ -6267,7 +6318,7 @@ function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOptio
|
|
|
6267
6318
|
} }) }), jsx(SelectedWallet, { label: "Deliver to", providerInfo: {
|
|
6268
6319
|
...toProviderInfo,
|
|
6269
6320
|
address: toAddress,
|
|
6270
|
-
}, onClick: () => setShowDeliverToDrawer(true), disabled: lockedToProvider })] }), jsx(Button, { testId: "add-tokens-button", size: "large", variant: readyToReview ? 'primary' : 'secondary', disabled: !readyToReview, onClick: handleReviewClick, sx: { opacity: readyToReview ? 1 : 0.5 }, children: "Review" }), jsx(SquidFooter, {}), jsx(PayWithWalletDrawer, { visible: showPayWithDrawer, walletOptions: walletOptions, onClose: () => setShowPayWithDrawer(false), onPayWithCard: handleCardClick, onConnect: handleWalletConnected, insufficientBalance: insufficientBalance, showOnRampOption: shouldShowOnRampOption }), jsx(OptionsDrawer, { checkout: checkout, routes: routes, showOnrampOption: shouldShowOnRampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, visible: showOptionsDrawer, onClose: () => setShowOptionsDrawer(false), onCardClick: handleCardClick, onRouteClick: handleRouteClick, insufficientBalance: insufficientBalance }), jsx(DeliverToWalletDrawer, { visible: showDeliverToDrawer, walletOptions: walletOptions, onClose:
|
|
6321
|
+
}, onClick: () => setShowDeliverToDrawer(true), disabled: lockedToProvider })] }), jsx(Button, { testId: "add-tokens-button", size: "large", variant: readyToReview ? 'primary' : 'secondary', disabled: !readyToReview, onClick: handleReviewClick, sx: { opacity: readyToReview ? 1 : 0.5 }, children: "Review" }), jsx(SquidFooter, {}), jsx(PayWithWalletDrawer, { visible: showPayWithDrawer, walletOptions: walletOptions, onClose: () => setShowPayWithDrawer(false), onPayWithCard: handleCardClick, onConnect: handleWalletConnected, insufficientBalance: insufficientBalance, showOnRampOption: shouldShowOnRampOption }), jsx(OptionsDrawer, { checkout: checkout, routes: routes, showOnrampOption: shouldShowOnRampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, visible: showOptionsDrawer, onClose: () => setShowOptionsDrawer(false), onCardClick: handleCardClick, onRouteClick: handleRouteClick, insufficientBalance: insufficientBalance }), jsx(DeliverToWalletDrawer, { visible: showDeliverToDrawer, walletOptions: walletOptions, onClose: handleDeliverToClose }), jsx(OnboardingDrawer, { environment: checkout?.config.environment })] })] }) }));
|
|
6271
6322
|
}
|
|
6272
6323
|
|
|
6273
6324
|
var dist$2 = {};
|
|
@@ -173360,6 +173411,7 @@ const isSquidNativeToken = (token) => token.toLowerCase() === SQUID_NATIVE_TOKEN
|
|
|
173360
173411
|
|
|
173361
173412
|
const useExecute = (environment) => {
|
|
173362
173413
|
const { showErrorHandover } = useError(environment);
|
|
173414
|
+
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
173363
173415
|
const handleTransactionError = (err) => {
|
|
173364
173416
|
const reason = `${err?.reason || err?.message || ''}`.toLowerCase();
|
|
173365
173417
|
let errorType = AddTokensErrorTypes.WALLET_FAILED;
|
|
@@ -173376,6 +173428,7 @@ const useExecute = (environment) => {
|
|
|
173376
173428
|
if (reason.includes('status failed')
|
|
173377
173429
|
|| reason.includes('transaction failed')) {
|
|
173378
173430
|
errorType = AddTokensErrorTypes.TRANSACTION_FAILED;
|
|
173431
|
+
sendAddTokensFailedEvent(eventTarget, errorType);
|
|
173379
173432
|
}
|
|
173380
173433
|
if (reason.includes('unrecognized chain')
|
|
173381
173434
|
|| reason.includes('unrecognized chain')) {
|
|
@@ -173503,7 +173556,7 @@ function RouteFees({ visible, onClose, routeData, totalAmount, totalFiatAmount,
|
|
|
173503
173556
|
const feeCosts = reactExports.useMemo(() => routeData?.route.estimate.feeCosts.map((fee) => ({
|
|
173504
173557
|
label: fee.name,
|
|
173505
173558
|
amount: getFormattedNumber(fee.amount, fee.token.decimals),
|
|
173506
|
-
fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')}${getFormattedAmounts(fee.amountUsd)}`,
|
|
173559
|
+
fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} ${getFormattedAmounts(fee.amountUsd)}`,
|
|
173507
173560
|
token: {
|
|
173508
173561
|
name: fee.token.name,
|
|
173509
173562
|
symbol: fee.token.symbol,
|
|
@@ -173516,7 +173569,7 @@ function RouteFees({ visible, onClose, routeData, totalAmount, totalFiatAmount,
|
|
|
173516
173569
|
const gasCosts = reactExports.useMemo(() => routeData?.route.estimate.gasCosts.map((fee) => ({
|
|
173517
173570
|
label: 'Gas (transaction)',
|
|
173518
173571
|
amount: getFormattedNumber(fee.amount, fee.token.decimals),
|
|
173519
|
-
fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')}${getFormattedAmounts(fee.amountUsd)}`,
|
|
173572
|
+
fiatAmount: `${t('views.ADD_TOKENS.fees.fiatPricePrefix')} ${getFormattedAmounts(fee.amountUsd)}`,
|
|
173520
173573
|
token: {
|
|
173521
173574
|
name: fee.token.name,
|
|
173522
173575
|
symbol: fee.token.symbol,
|
|
@@ -173587,6 +173640,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
173587
173640
|
const { track, page } = useAnalytics();
|
|
173588
173641
|
const { addTokensState: { squid, chains, tokens }, } = reactExports.useContext(AddTokensContext);
|
|
173589
173642
|
const { providersState: { checkout, fromProvider, fromAddress, toAddress, }, } = useProvidersContext();
|
|
173643
|
+
const { eventTargetState: { eventTarget } } = reactExports.useContext(EventTargetContext);
|
|
173590
173644
|
const [route, setRoute] = reactExports.useState();
|
|
173591
173645
|
const [proceedDisabled, setProceedDisabled] = reactExports.useState(true);
|
|
173592
173646
|
const [showFeeBreakdown, setShowFeeBreakdown] = reactExports.useState(false);
|
|
@@ -173696,6 +173750,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
173696
173750
|
txHash: executeTxnReceipt.transactionHash,
|
|
173697
173751
|
},
|
|
173698
173752
|
});
|
|
173753
|
+
sendAddTokensSuccessEvent(eventTarget, executeTxnReceipt.transactionHash);
|
|
173699
173754
|
showHandover(EXECUTE_TXN_ANIMATION, RiveStateMachineInput.PROCESSING, 'Processing', '', FIXED_HANDOVER_DURATION);
|
|
173700
173755
|
showHandover(EXECUTE_TXN_ANIMATION, RiveStateMachineInput.COMPLETED, 'Funds added successfully', jsxs(Fragment, { children: ["Go to", ' ', jsx(Link, { size: "small", rc: (jsx("a", { target: "_blank", href: `https://axelarscan.io/gmp/${executeTxnReceipt?.transactionHash}`, rel: "noreferrer" })), children: "Axelarscan" }), ' ', "for transaction details"] }));
|
|
173701
173756
|
}
|
|
@@ -173752,7 +173807,7 @@ function Review({ data, showBackButton = false, onBackButtonClick, onCloseButton
|
|
|
173752
173807
|
top: '-26px',
|
|
173753
173808
|
h: 'base.spacing.x10',
|
|
173754
173809
|
},
|
|
173755
|
-
} }), jsxs(Stack, { direction: "row", sx: { py: 'base.spacing.x5', px: 'base.spacing.x7' }, gap: "base.spacing.x6", alignItems: "center", children: [jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(FramedImage, { use: (jsx("img", { src:
|
|
173810
|
+
} }), jsxs(Stack, { direction: "row", sx: { py: 'base.spacing.x5', px: 'base.spacing.x7' }, gap: "base.spacing.x6", alignItems: "center", children: [jsxs(Sticker, { position: { x: 'right', y: 'bottom' }, children: [jsx(FramedImage, { use: (jsx("img", { src: route.route.estimate.toToken.logoURI, alt: route.route.estimate.toToken.name })), circularFrame: true, size: "large" }), jsx(Sticker.FramedImage, { use: jsx("img", { src: toChain?.iconUrl, alt: toChain?.name }), emphasized: true, sx: {
|
|
173756
173811
|
bottom: 'base.spacing.x2',
|
|
173757
173812
|
right: 'base.spacing.x2',
|
|
173758
173813
|
} })] }), jsxs(Stack, { sx: { flex: 1 }, gap: "0px", children: [jsxs(Body, { weight: "bold", children: ["Receive", ' ', route?.route.estimate.toToken.name] }), jsxs(Body, { size: "small", sx: { c: 'base.color.text.body.secondary' }, children: [toChain?.name, jsx(EllipsizedText, { text: toAddress ?? '', sx: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-
|
|
3
|
-
import { T as TokenImage, r as retry } from './retry-
|
|
4
|
-
import { E as EllipsizedText, C as Contract } from './EllipsizedText-
|
|
5
|
-
import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-
|
|
6
|
-
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-
|
|
7
|
-
import { f as formatUnits, p as parseUnits } from './index-
|
|
8
|
-
import { u as useInterval } from './useInterval-
|
|
9
|
-
import './FeesBreakdown-
|
|
1
|
+
import { c0 as axios, c1 as CheckoutErrorType, c2 as IMMUTABLE_API_BASE_URL, r as reactExports, I as IMTBLWidgetEvents, B as BridgeEventType, p as jsxs, o as jsx, c3 as ShimmerBox, ak as MenuItem, a8 as Stack, u as useTranslation, M as Body, T as Button, H as Box, c4 as PASSPORT_URL, aT as Link, c5 as getChainIdBySlug, c6 as getChainImage, c7 as networkName, a6 as FramedImage, Q as Icon, ax as useAnalytics, ay as UserJourney, as as Divider, aL as ViewContext, at as Fragment, V as ViewActions, c8 as useWalletConnect, c9 as isWalletConnectProvider, ca as Logo, cb as RawImage, cc as AXELAR_SCAN_URL, aZ as isNativeToken, a_ as getTokenImageByAddress, cd as getNativeSymbolByChainSlug, by as calculateCryptoToFiat, aQ as EventTargetContext, az as isPassportProvider, i as getL1ChainId, aY as TokenFilterTypes, h as getL2ChainId, aE as WalletProviderRdns, aG as Web3Provider, aU as useInjectedProviders, bF as HeaderNavigation, bI as FooterLogo, aB as WalletDrawer, aX as SimpleLayout, ce as getChainSlugById, cf as JsonRpcProvider, cg as DEFAULT_TRANSACTIONS_RETRY_POLICY, L as LoadingView, j as ChainId, ch as getChainNameById, w as useTheme, aA as Heading, ci as getWalletProviderNameByProvider, cj as isAddressSanctioned, m as SharedViews, ck as isMetaMaskProvider, cl as WalletProviderName, aw as Drawer, R as ButtCon, cm as ButtonNavigationStyles, a$ as orchestrationEvents, al as tokenValueFormat, cn as formatZeroAmount, co as NATIVE, bl as amountInputValidation, aN as getRemoteImage, bm as CloudImage, cp as ETH_TOKEN_SYMBOL, an as BigNumber, bf as Environment, cq as GasEstimateType, cr as DEFAULT_TOKEN_DECIMALS, cs as DEFAULT_QUOTE_REFRESH_INTERVAL, ct as addChainChangedListener, cu as removeChainChangedListener, cv as IMX_TOKEN_SYMBOL, cw as dist, cx as CHECKOUT_CDN_BASE_URL, cy as heroBackGroundStyles, cz as heroImageStyles, a4 as Badge, cA as SimpleTextBody, cB as FooterButton, cC as getEthTokenImage, cD as WITHDRAWAL_CLAIM_GAS_LIMIT, aV as getDefaultTokenImage, bi as viewReducer, bj as initialViewState, cE as BridgeConfiguration, cF as ImmutableConfiguration, cG as TokenBridge, cH as StatusView, bJ as StatusType, E as ErrorView, bn as ServiceUnavailableErrorView, bo as ServiceType, cI as ETH_SEPOLIA_TO_ZKEVM_TESTNET, cJ as ETH_SEPOLIA_TO_ZKEVM_DEVNET, cK as ETH_MAINNET_TO_ZKEVM_MAINNET } from './index-Be6kRjpo.js';
|
|
2
|
+
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-CiE5eWiz.js';
|
|
3
|
+
import { T as TokenImage, r as retry } from './retry-B3R-pN6g.js';
|
|
4
|
+
import { E as EllipsizedText, C as Contract } from './EllipsizedText-BYNkXO37.js';
|
|
5
|
+
import { A as Accordion, S as SelectForm, T as TextInputForm, a as TransactionRejected, g as getAllowedBalances, F as Fees, N as NetworkSwitchDrawer, W as WalletApproveHero } from './WalletApproveHero-DCUEVcQH.js';
|
|
6
|
+
import { B as BridgeWidgetViews, T as TopUpView } from './TopUpView-DzmCXwDT.js';
|
|
7
|
+
import { f as formatUnits, p as parseUnits } from './index-CSsSQRP5.js';
|
|
8
|
+
import { u as useInterval } from './useInterval-BHSScII2.js';
|
|
9
|
+
import './FeesBreakdown-Bh4uazkv.js';
|
|
10
10
|
|
|
11
11
|
// This module is intended to unwrap Axios default export as named.
|
|
12
12
|
// Keep top-level export same with static properties
|
|
@@ -1,73 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import SwapWidget from './SwapWidget-
|
|
3
|
-
import BridgeWidget from './BridgeWidget-
|
|
4
|
-
import { O as OnRampWidget } from './OnRampWidget-
|
|
5
|
-
import WalletWidget from './WalletWidget-
|
|
6
|
-
import SaleWidget from './SaleWidget-
|
|
7
|
-
import AddTokensWidget from './AddTokensWidget-
|
|
8
|
-
import './WalletApproveHero-
|
|
9
|
-
import './retry-
|
|
10
|
-
import './FeesBreakdown-
|
|
11
|
-
import './CryptoFiatProvider-
|
|
12
|
-
import './useInterval-
|
|
13
|
-
import './index-
|
|
14
|
-
import './TopUpView-
|
|
15
|
-
import './SpendingCapHero-
|
|
16
|
-
import './EllipsizedText-
|
|
17
|
-
import './HandoverContent-
|
|
18
|
-
|
|
19
|
-
const initialCommerceState = {
|
|
20
|
-
checkout: undefined,
|
|
21
|
-
provider: undefined,
|
|
22
|
-
passport: undefined,
|
|
23
|
-
};
|
|
24
|
-
var CommerceActions;
|
|
25
|
-
(function (CommerceActions) {
|
|
26
|
-
CommerceActions["SET_CHECKOUT"] = "SET_CHECKOUT";
|
|
27
|
-
CommerceActions["SET_PROVIDER"] = "SET_PROVIDER";
|
|
28
|
-
CommerceActions["SET_PASSPORT"] = "SET_PASSPORT";
|
|
29
|
-
})(CommerceActions || (CommerceActions = {}));
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
|
-
const CommerceContext = reactExports.createContext({
|
|
32
|
-
commerceState: initialCommerceState,
|
|
33
|
-
commerceDispatch: () => { },
|
|
34
|
-
});
|
|
35
|
-
CommerceContext.displayName = 'CommerceContext'; // help with debugging Context in browser
|
|
36
|
-
const commerceReducer = (state, action) => {
|
|
37
|
-
switch (action.payload.type) {
|
|
38
|
-
case CommerceActions.SET_CHECKOUT:
|
|
39
|
-
return {
|
|
40
|
-
...state,
|
|
41
|
-
checkout: action.payload.checkout,
|
|
42
|
-
};
|
|
43
|
-
case CommerceActions.SET_PROVIDER:
|
|
44
|
-
return {
|
|
45
|
-
...state,
|
|
46
|
-
provider: action.payload.provider,
|
|
47
|
-
};
|
|
48
|
-
case CommerceActions.SET_PASSPORT:
|
|
49
|
-
return {
|
|
50
|
-
...state,
|
|
51
|
-
passport: action.payload.passport,
|
|
52
|
-
};
|
|
53
|
-
default:
|
|
54
|
-
return state;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const useCommerceWidgetState = () => {
|
|
59
|
-
const [viewState, viewDispatch] = reactExports.useReducer(commerceReducer, initialCommerceState);
|
|
60
|
-
return [viewState, viewDispatch];
|
|
61
|
-
};
|
|
62
|
-
function CommerceWidgetContextProvicer({ children, }) {
|
|
63
|
-
const [{ checkout, provider }] = useConnectLoaderState();
|
|
64
|
-
const [commerceState, commerceDispatch] = useCommerceWidgetState();
|
|
65
|
-
const values = reactExports.useMemo(() => ({
|
|
66
|
-
commerceState: { ...commerceState, checkout, provider },
|
|
67
|
-
commerceDispatch,
|
|
68
|
-
}), [commerceState, commerceDispatch, checkout, provider]);
|
|
69
|
-
return (jsx(CommerceContext.Provider, { value: values, children: children }));
|
|
70
|
-
}
|
|
1
|
+
import { I as IMTBLWidgetEvents, C as CommerceFlowType, P as ProviderEventType, a as CommerceEventType, b as ConnectEventType, c as CommerceFailureEventType, d as CommerceSuccessEventType, W as WalletEventType, e as CommerceUserActionEventType, S as SwapEventType, A as AddTokensEventType, B as BridgeEventType, O as OnRampEventType, f as SaleEventType, g as OrchestrationEventType, r as reactExports, V as ViewActions, h as getL2ChainId, i as getL1ChainId, j as ChainId, u as useTranslation, k as useViewState, l as useEventTargetState, m as SharedViews, n as commerceFlows, o as jsx, p as jsxs, L as LoadingView, E as ErrorView, q as ConnectWidget, s as ProvidersContextProvider, t as ConnectLoader, v as ViewContextProvider } from './index-Be6kRjpo.js';
|
|
2
|
+
import SwapWidget from './SwapWidget-KGdvQrAY.js';
|
|
3
|
+
import BridgeWidget from './BridgeWidget-H083MzVz.js';
|
|
4
|
+
import { O as OnRampWidget } from './OnRampWidget-NHF5WhcL.js';
|
|
5
|
+
import WalletWidget from './WalletWidget-BUz0zP4W.js';
|
|
6
|
+
import SaleWidget from './SaleWidget-ByoqYtgj.js';
|
|
7
|
+
import AddTokensWidget from './AddTokensWidget-B4Ir7dvN.js';
|
|
8
|
+
import './WalletApproveHero-DCUEVcQH.js';
|
|
9
|
+
import './retry-B3R-pN6g.js';
|
|
10
|
+
import './FeesBreakdown-Bh4uazkv.js';
|
|
11
|
+
import './CryptoFiatProvider-CiE5eWiz.js';
|
|
12
|
+
import './useInterval-BHSScII2.js';
|
|
13
|
+
import './index-CSsSQRP5.js';
|
|
14
|
+
import './TopUpView-DzmCXwDT.js';
|
|
15
|
+
import './SpendingCapHero-D4WKiLRo.js';
|
|
16
|
+
import './EllipsizedText-BYNkXO37.js';
|
|
17
|
+
import './HandoverContent-D1zo76oD.js';
|
|
71
18
|
|
|
72
19
|
const sendCheckoutEvent = (eventTarget, detail) => {
|
|
73
20
|
const event = new CustomEvent(IMTBLWidgetEvents.IMTBL_COMMERCE_WIDGET_EVENT, { detail });
|
|
@@ -209,6 +156,35 @@ function mapSwapWidgetEvent(event) {
|
|
|
209
156
|
function mapAddTokensWidgetEvent(event) {
|
|
210
157
|
const { type } = event.detail;
|
|
211
158
|
switch (type) {
|
|
159
|
+
case AddTokensEventType.SUCCESS:
|
|
160
|
+
return {
|
|
161
|
+
type: CommerceEventType.SUCCESS,
|
|
162
|
+
data: {
|
|
163
|
+
type: CommerceSuccessEventType.ADD_TOKENS_SUCCESS,
|
|
164
|
+
data: event.detail.data,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
case AddTokensEventType.CONNECT_SUCCESS:
|
|
168
|
+
return {
|
|
169
|
+
type: CommerceEventType.SUCCESS,
|
|
170
|
+
data: {
|
|
171
|
+
type: CommerceSuccessEventType.ADD_TOKENS_CONNECT_SUCCESS,
|
|
172
|
+
data: event.detail.data,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
case AddTokensEventType.FAILURE:
|
|
176
|
+
return {
|
|
177
|
+
type: CommerceEventType.FAILURE,
|
|
178
|
+
data: {
|
|
179
|
+
type: CommerceFailureEventType.ADD_TOKENS_FAILED,
|
|
180
|
+
data: event.detail.data,
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
case AddTokensEventType.CLOSE_WIDGET:
|
|
184
|
+
return {
|
|
185
|
+
type: CommerceEventType.CLOSE,
|
|
186
|
+
data: {},
|
|
187
|
+
};
|
|
212
188
|
default:
|
|
213
189
|
throw new Error(`Unknown add tokens event type "${event.detail.type}"`);
|
|
214
190
|
}
|
|
@@ -425,7 +401,7 @@ const widgetEvents = [
|
|
|
425
401
|
/**
|
|
426
402
|
* Subscribe and Handle widget events
|
|
427
403
|
*/
|
|
428
|
-
function useWidgetEvents(eventTarget, viewState) {
|
|
404
|
+
function useWidgetEvents(eventTarget, viewState, handleProviderUpdated) {
|
|
429
405
|
const [{ history }, viewDispatch] = viewState;
|
|
430
406
|
/**
|
|
431
407
|
* Change view as per orchestration event requests
|
|
@@ -441,6 +417,12 @@ function useWidgetEvents(eventTarget, viewState) {
|
|
|
441
417
|
});
|
|
442
418
|
return;
|
|
443
419
|
}
|
|
420
|
+
if (type === OrchestrationEventType.REQUEST_ONRAMP) {
|
|
421
|
+
const onRampEvent = data;
|
|
422
|
+
if (onRampEvent.provider) {
|
|
423
|
+
handleProviderUpdated(onRampEvent.provider);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
444
426
|
const flow = getViewFromOrchestrationEventType(type);
|
|
445
427
|
if (!flow)
|
|
446
428
|
return;
|
|
@@ -527,13 +509,56 @@ function getConnectLoaderParams(view, checkout, web3Provider) {
|
|
|
527
509
|
}
|
|
528
510
|
}
|
|
529
511
|
|
|
512
|
+
const initialCommerceState = {
|
|
513
|
+
checkout: undefined,
|
|
514
|
+
provider: undefined,
|
|
515
|
+
passport: undefined,
|
|
516
|
+
};
|
|
517
|
+
var CommerceActions;
|
|
518
|
+
(function (CommerceActions) {
|
|
519
|
+
CommerceActions["SET_CHECKOUT"] = "SET_CHECKOUT";
|
|
520
|
+
CommerceActions["SET_PROVIDER"] = "SET_PROVIDER";
|
|
521
|
+
CommerceActions["SET_PASSPORT"] = "SET_PASSPORT";
|
|
522
|
+
})(CommerceActions || (CommerceActions = {}));
|
|
523
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
524
|
+
const CommerceContext = reactExports.createContext({
|
|
525
|
+
commerceState: initialCommerceState,
|
|
526
|
+
commerceDispatch: () => { },
|
|
527
|
+
});
|
|
528
|
+
CommerceContext.displayName = 'CommerceContext'; // help with debugging Context in browser
|
|
529
|
+
const commerceReducer = (state, action) => {
|
|
530
|
+
switch (action.payload.type) {
|
|
531
|
+
case CommerceActions.SET_CHECKOUT:
|
|
532
|
+
return {
|
|
533
|
+
...state,
|
|
534
|
+
checkout: action.payload.checkout,
|
|
535
|
+
};
|
|
536
|
+
case CommerceActions.SET_PROVIDER:
|
|
537
|
+
return {
|
|
538
|
+
...state,
|
|
539
|
+
provider: action.payload.provider,
|
|
540
|
+
};
|
|
541
|
+
case CommerceActions.SET_PASSPORT:
|
|
542
|
+
return {
|
|
543
|
+
...state,
|
|
544
|
+
passport: action.payload.passport,
|
|
545
|
+
};
|
|
546
|
+
default:
|
|
547
|
+
return state;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
530
551
|
function CommerceWidget(props) {
|
|
531
552
|
const { flowParams, flowConfig, widgetsConfig, checkout, web3Provider, } = props;
|
|
532
553
|
const { t } = useTranslation();
|
|
533
554
|
const viewState = useViewState();
|
|
534
555
|
const [{ view, history }, viewDispatch] = viewState;
|
|
535
556
|
const [{ eventTarget }] = useEventTargetState();
|
|
536
|
-
const
|
|
557
|
+
const [commerceState, commerceDispatch] = reactExports.useReducer(commerceReducer, initialCommerceState);
|
|
558
|
+
const commerceReducerValues = reactExports.useMemo(() => ({ commerceState, commerceDispatch }), [commerceState, commerceDispatch]);
|
|
559
|
+
const { provider } = commerceState;
|
|
560
|
+
const connectLoaderParams = reactExports.useMemo(() => getConnectLoaderParams(view, checkout, provider || web3Provider), [view, checkout, provider, web3Provider]);
|
|
561
|
+
const connectLoaderSuccessEvent = flowParams.flow === CommerceFlowType.ADD_TOKENS ? () => { } : undefined;
|
|
537
562
|
const goToPreviousView = reactExports.useCallback(() => {
|
|
538
563
|
const sharedViews = [
|
|
539
564
|
SharedViews.LOADING_VIEW,
|
|
@@ -555,10 +580,29 @@ function CommerceWidget(props) {
|
|
|
555
580
|
});
|
|
556
581
|
}
|
|
557
582
|
}, [history]);
|
|
583
|
+
const handleProviderUpdated = reactExports.useMemo(() => (updatedProvider) => {
|
|
584
|
+
commerceDispatch({
|
|
585
|
+
payload: {
|
|
586
|
+
type: CommerceActions.SET_PROVIDER,
|
|
587
|
+
provider: updatedProvider,
|
|
588
|
+
},
|
|
589
|
+
});
|
|
590
|
+
}, [commerceDispatch]);
|
|
558
591
|
/**
|
|
559
592
|
* Subscribe and Handle widget events
|
|
560
593
|
*/
|
|
561
|
-
useWidgetEvents(eventTarget, viewState);
|
|
594
|
+
useWidgetEvents(eventTarget, viewState, handleProviderUpdated);
|
|
595
|
+
reactExports.useEffect(() => {
|
|
596
|
+
if (!web3Provider) {
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
commerceDispatch({
|
|
600
|
+
payload: {
|
|
601
|
+
type: CommerceActions.SET_PROVIDER,
|
|
602
|
+
provider: web3Provider,
|
|
603
|
+
},
|
|
604
|
+
});
|
|
605
|
+
}, [commerceDispatch, web3Provider]);
|
|
562
606
|
/**
|
|
563
607
|
* Mount the view according to set flow in params
|
|
564
608
|
*/
|
|
@@ -610,7 +654,7 @@ function CommerceWidget(props) {
|
|
|
610
654
|
* Show back button
|
|
611
655
|
*/
|
|
612
656
|
const showBackButton = !!view.data?.showBackButton;
|
|
613
|
-
return (jsx(ViewContextProvider, { children: jsxs(
|
|
657
|
+
return (jsx(ViewContextProvider, { children: jsxs(CommerceContext.Provider, { value: commerceReducerValues, children: [view.type === SharedViews.LOADING_VIEW && (jsx(LoadingView, { loadingText: t('views.LOADING_VIEW.text') })), view.type === SharedViews.ERROR_VIEW && (jsx(ErrorView, { onCloseClick: () => {
|
|
614
658
|
sendCheckoutEvent(eventTarget, {
|
|
615
659
|
type: CommerceEventType.CLOSE,
|
|
616
660
|
data: {},
|
|
@@ -622,7 +666,7 @@ function CommerceWidget(props) {
|
|
|
622
666
|
type: CommerceEventType.CLOSE,
|
|
623
667
|
data: {},
|
|
624
668
|
});
|
|
625
|
-
}, ...(view.data.params || {}) })), view.type === CommerceFlowType.BRIDGE && (jsx(BridgeWidget, { config: widgetsConfig, checkout: checkout, web3Provider: web3Provider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && (jsx(ProvidersContextProvider, { initialState: { checkout }, children: view.type === CommerceFlowType.ADD_TOKENS && (jsx(AddTokensWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })) })), shouldWrapWithConnectLoader && (jsx(ConnectLoader, { widgetConfig: widgetsConfig, params: connectLoaderParams, closeEvent: () => {
|
|
669
|
+
}, ...(view.data.params || {}) })), view.type === CommerceFlowType.BRIDGE && (jsx(BridgeWidget, { config: widgetsConfig, checkout: checkout, web3Provider: web3Provider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && (jsx(ProvidersContextProvider, { initialState: { checkout }, children: view.type === CommerceFlowType.ADD_TOKENS && (jsx(AddTokensWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })) })), shouldWrapWithConnectLoader && (jsx(ConnectLoader, { widgetConfig: widgetsConfig, params: connectLoaderParams, successEvent: connectLoaderSuccessEvent, closeEvent: () => {
|
|
626
670
|
sendCheckoutEvent(eventTarget, {
|
|
627
671
|
type: CommerceEventType.CLOSE,
|
|
628
672
|
data: {},
|
package/dist/browser/checkout/{CryptoFiatProvider-b0KhVg3Y.js → CryptoFiatProvider-CiE5eWiz.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bf as Environment, c0 as axios, r as reactExports, o as jsx } from './index-Be6kRjpo.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Class representing the configuration for the CryptoFiatModule.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cL as defineReadOnly, cM as getStatic, cN as Signer, cO as Provider, cP as getAddress, cQ as Logger, cR as getContractAddress, cS as Interface, cT as shallowCopy, cU as VoidSigner, cV as Indexed, cW as deepCopy, cX as isHexString, cY as checkResultErrors, cZ as resolveProperties, an as BigNumber, c_ as accessListify, c$ as arrayify, o as jsx, _ as _objectWithoutProperties, bv as cloneElementWithCssProp, M as Body, U as _defineProperty } from './index-Be6kRjpo.js';
|
|
2
2
|
|
|
3
3
|
const version = "contracts/5.7.0";
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as jsxs, o as jsx, M as Body, bh as PriceDisplay, H as Box, u as useTranslation, aw as Drawer, ak as MenuItem, at as Fragment, as as Divider, al as tokenValueFormat, cn as formatZeroAmount, bI as FooterLogo } from './index-Be6kRjpo.js';
|
|
2
2
|
|
|
3
3
|
const feesBreakdownContentStyles = {
|
|
4
4
|
display: 'flex',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { p as jsxs, H as Box, o as jsx, aA as Heading, M as Body, T as Button } from './index-Be6kRjpo.js';
|
|
2
2
|
|
|
3
3
|
function HandoverContent({ headingText, subheadingText, primaryButtonText, onPrimaryButtonClick, secondaryButtonText, onSecondaryButtonClick, }) {
|
|
4
4
|
return (jsxs(Box, { sx: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-
|
|
3
|
-
import { S as SpendingCapHero } from './SpendingCapHero-
|
|
1
|
+
import { d0 as global, ax as useAnalytics, r as reactExports, bU as ConnectLoaderContext, aQ as EventTargetContext, u as useTranslation, aL as ViewContext, m as SharedViews, d1 as ExchangeType, o as jsx, aX as SimpleLayout, bF as HeaderNavigation, d2 as sendOnRampWidgetCloseEvent, a$ as orchestrationEvents, I as IMTBLWidgetEvents, H as Box, ay as UserJourney, V as ViewActions, bI as FooterLogo, p as jsxs, cA as SimpleTextBody, bi as viewReducer, bj as initialViewState, co as NATIVE, L as LoadingView, d3 as sendOnRampSuccessEvent, bJ as StatusType, cH as StatusView, d4 as sendOnRampFailedEvent } from './index-Be6kRjpo.js';
|
|
2
|
+
import { O as OnRampWidgetViews, T as TopUpView } from './TopUpView-DzmCXwDT.js';
|
|
3
|
+
import { S as SpendingCapHero } from './SpendingCapHero-D4WKiLRo.js';
|
|
4
4
|
|
|
5
5
|
function isNull(arg) {
|
|
6
6
|
return arg === null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { _ as _objectWithoutProperties,
|
|
2
|
-
import { C as Contract } from './EllipsizedText-
|
|
3
|
-
import { u as useTransakEvents, O as OnRampWidget } from './OnRampWidget-
|
|
4
|
-
import { H as HandoverContent } from './HandoverContent-
|
|
5
|
-
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-
|
|
6
|
-
import { u as useMount, T as TopUpView } from './TopUpView-
|
|
7
|
-
import { T as TokenImage } from './retry-
|
|
8
|
-
import { f as formatUnits } from './index-
|
|
9
|
-
import { F as Fees } from './WalletApproveHero-
|
|
10
|
-
import BridgeWidget from './BridgeWidget-
|
|
11
|
-
import SwapWidget from './SwapWidget-
|
|
12
|
-
import './SpendingCapHero-
|
|
13
|
-
import './FeesBreakdown-
|
|
14
|
-
import './useInterval-
|
|
1
|
+
import { _ as _objectWithoutProperties, o as jsx, bp as MultiTextShimmer, U as _defineProperty, w as useTheme, r as reactExports, D as merge, bq as getCaptionTextStyles, br as DEFAULT_BODY_PROPS, bs as baseTextComponentSx, bt as useConvertSxToEmotionStyles, bu as useGetCurrentSizeClass, bv as cloneElementWithCssProp, bf as Environment, an as BigNumber, bw as compareStr, aL as ViewContext, V as ViewActions, bx as SalePaymentTypes, ay as UserJourney, u as useTranslation, by as calculateCryptoToFiat, ax as useAnalytics, aQ as EventTargetContext, bz as sendSaleWidgetCloseEvent, bA as sendSaleSuccessEvent, bB as sendSaleFailedEvent, bC as sendSaleTransactionSuccessEvent, bD as sendSalePaymentMethodEvent, bE as sendSalePaymentTokenEvent, bF as HeaderNavigation, p as jsxs, bG as LoadingOverlay, H as Box, at as Fragment, aX as SimpleLayout, aO as useHandover, aP as HandoverTarget, aR as getRemoteRive, aA as Heading, bH as HandoverDuration, az as isPassportProvider, ak as MenuItem, aq as motion, au as listVariants, ar as listItemVariants, m as SharedViews, bI as FooterLogo, bJ as StatusType, bK as prettyFormatNumber, al as tokenValueFormat, bL as ShimmerCircle, T as Button, a8 as Stack, bM as FundingStepType, bN as abbreviateWalletAddress, aw as Drawer, as as Divider, bO as tokenSymbolNameOverrides, bP as ItemType, bQ as TransactionOrGasType, bR as GasTokenType, bS as RoutingOutcomeType, aZ as isNativeToken, a_ as getTokenImageByAddress, bT as isGasFree, bU as ConnectLoaderContext, bV as eventTargetReducer, bW as initialEventTargetState, i as getL1ChainId, h as getL2ChainId, I as IMTBLWidgetEvents, bX as EventTargetActions, L as LoadingView, j as ChainId, bY as ConnectWidgetViews, q as ConnectWidget, S as SwapEventType, O as OnRampEventType, B as BridgeEventType, b as ConnectEventType, bZ as ConnectLoaderActions, R as ButtCon, M as Body, b_ as widgetTheme, bi as viewReducer, bj as initialViewState, b$ as BlockExplorerService } from './index-Be6kRjpo.js';
|
|
2
|
+
import { C as Contract } from './EllipsizedText-BYNkXO37.js';
|
|
3
|
+
import { u as useTransakEvents, O as OnRampWidget } from './OnRampWidget-NHF5WhcL.js';
|
|
4
|
+
import { H as HandoverContent } from './HandoverContent-D1zo76oD.js';
|
|
5
|
+
import { C as CryptoFiatContext, a as CryptoFiatActions, b as CryptoFiatProvider } from './CryptoFiatProvider-CiE5eWiz.js';
|
|
6
|
+
import { u as useMount, T as TopUpView } from './TopUpView-DzmCXwDT.js';
|
|
7
|
+
import { T as TokenImage } from './retry-B3R-pN6g.js';
|
|
8
|
+
import { f as formatUnits } from './index-CSsSQRP5.js';
|
|
9
|
+
import { F as Fees } from './WalletApproveHero-DCUEVcQH.js';
|
|
10
|
+
import BridgeWidget from './BridgeWidget-H083MzVz.js';
|
|
11
|
+
import SwapWidget from './SwapWidget-KGdvQrAY.js';
|
|
12
|
+
import './SpendingCapHero-D4WKiLRo.js';
|
|
13
|
+
import './FeesBreakdown-Bh4uazkv.js';
|
|
14
|
+
import './useInterval-BHSScII2.js';
|
|
15
15
|
|
|
16
16
|
var _excluded = ["size", "rc", "weight", "sx", "testId", "children", "domRef", "className"],
|
|
17
17
|
_excluded2 = ["size", "rc", "weight", "shimmer", "shimmerSx", "sx", "children", "domRef", "testId", "className"];
|