@imtbl/sdk 1.62.0 → 1.63.0-alpha.2
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-sxvR7yJA.js → blockchain_data-CHib54kz.js} +2 -2
- package/dist/blockchain_data.js +3 -3
- package/dist/browser/checkout/{AddFundsWidget-ZVSgslAw.js → AddTokensWidget-_Xn5oqy1.js} +167 -167
- package/dist/browser/checkout/{BridgeWidget-Cdho2hYD.js → BridgeWidget-BPIfYbvA.js} +8 -8
- package/dist/browser/checkout/{CommerceWidget-BzipzAPM.js → CommerceWidget-BA8RmVn9.js} +28 -28
- package/dist/browser/checkout/{EllipsizedText-CvkYzx6o.js → EllipsizedText-ClgMkj4v.js} +1 -1
- package/dist/browser/checkout/{FeesBreakdown-2gL4cI-R.js → FeesBreakdown-DR6v2-H-.js} +1 -1
- package/dist/browser/checkout/{HandoverContent-Bl4qmdQg.js → HandoverContent-QiXwWQ57.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-QJuXcGjQ.js → OnRampWidget-BgIua-mm.js} +3 -3
- package/dist/browser/checkout/{SaleWidget-edWOlmfl.js → SaleWidget-6eV8QF7G.js} +17 -17
- package/dist/browser/checkout/{SpendingCapHero-CqFT2_-Q.js → SpendingCapHero-BqPQ6a0R.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-gFL-1ypc.js → SwapWidget-DoPU0Yzi.js} +8 -8
- package/dist/browser/checkout/{TopUpView-BQBIv4KK.js → TopUpView-DNQT2rsA.js} +10 -10
- package/dist/browser/checkout/{WalletApproveHero-CLTmvRwO.js → WalletApproveHero-CmiF_ZJW.js} +3 -3
- package/dist/browser/checkout/{WalletWidget-DqzlgTAL.js → WalletWidget-rl3B0Qxr.js} +22 -22
- package/dist/browser/checkout/{auto-track-B_DVujaR.js → auto-track-B3-upPnC.js} +1 -1
- package/dist/browser/checkout/{index-BGasM3FI.js → index-46Ow2IS7.js} +1 -1
- package/dist/browser/checkout/{index-BVEcFW11.js → index-B7msauEg.js} +1 -1
- package/dist/browser/checkout/{index-yoSSDRdd.js → index-BmTv11nk.js} +1 -1
- package/dist/browser/checkout/{index-CgtLpuEZ.js → index-CG2H6hgX.js} +1 -1
- package/dist/browser/checkout/{index-DitiTTnr.js → index-CjNJ4JEB.js} +1 -1
- package/dist/browser/checkout/{index-DYTK3G7G.js → index-Cpj4gmmX.js} +2 -2
- package/dist/browser/checkout/{index-CRuWUFZW.js → index-DVvY446o.js} +1 -1
- package/dist/browser/checkout/{index-B_wChk6v.js → index-sjoe4g_0.js} +1 -1
- package/dist/browser/checkout/{index-DvBzy5DX.js → index-veWeUrkn.js} +67 -67
- package/dist/browser/checkout/{index.umd-5W8TJb-e.js → index.umd-BLRhOrrH.js} +1 -1
- package/dist/browser/checkout/{retry-Bd7qMg0v.js → retry-D2Hhra6P.js} +1 -1
- package/dist/browser/checkout/sdk.js +15 -15
- package/dist/browser/checkout/{useInterval-DI0ddcnq.js → useInterval-BliISh4h.js} +1 -1
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +252 -252
- package/dist/{checkout-C12Br7lr.js → checkout-DMMI_B4s.js} +22 -22
- package/dist/checkout.d.ts +50 -50
- package/dist/checkout.js +5 -5
- package/dist/{config-BR83WwI2.js → config-BWP6AMeq.js} +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-oQTMj48l.js → index-B9QgjXS3.js} +1 -1
- package/dist/{index-DeyLbhnj.js → index-BG-coMRS.js} +1 -1
- package/dist/{index-B3-R16ZI.js → index-CJ8CKZvf.js} +4 -4
- package/dist/{index-CA86ogWz.js → index-CWRp9quw.js} +3 -3
- package/dist/{index-o82oWSK6.js → index-DFG6xxKC.js} +1 -1
- package/dist/{index-B12uBW7v.js → index-kJT4-1dz.js} +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.d.ts +63 -63
- package/dist/index.js +14 -14
- package/dist/{minting_backend-BZNiHRmU.js → minting_backend-CRuUAqY_.js} +3 -3
- package/dist/minting_backend.js +5 -5
- package/dist/{orderbook-B1Tjr_q4.js → orderbook-CHg5VmWU.js} +1 -1
- package/dist/orderbook.js +2 -2
- package/dist/{passport-BSNhvk09.js → passport-Chi9Fpm8.js} +3 -3
- package/dist/passport.js +4 -4
- package/dist/{webhook-2lD6l4rk.js → webhook-U74UduTw.js} +1 -1
- package/dist/webhook.js +2 -2
- package/dist/{x-BuvtdpOp.js → x-bg80uxUK.js} +3 -3
- package/dist/x.js +4 -4
- package/package.json +1 -1
|
@@ -129104,7 +129104,7 @@
|
|
|
129104
129104
|
IMTBLWidgetEvents["IMTBL_ONRAMP_WIDGET_EVENT"] = "imtbl-onramp-widget";
|
|
129105
129105
|
IMTBLWidgetEvents["IMTBL_SALE_WIDGET_EVENT"] = "imtbl-sale-widget";
|
|
129106
129106
|
IMTBLWidgetEvents["IMTBL_COMMERCE_WIDGET_EVENT"] = "imtbl-commerce-widget";
|
|
129107
|
-
IMTBLWidgetEvents["
|
|
129107
|
+
IMTBLWidgetEvents["IMTBL_ADD_TOKENS_WIDGET_EVENT"] = "imtbl-add-tokens-widget";
|
|
129108
129108
|
})(IMTBLWidgetEvents || (IMTBLWidgetEvents = {}));
|
|
129109
129109
|
/**
|
|
129110
129110
|
* Enum for events raised for about provider objects
|
|
@@ -129199,7 +129199,7 @@
|
|
|
129199
129199
|
OrchestrationEventType["REQUEST_SWAP"] = "request-swap";
|
|
129200
129200
|
OrchestrationEventType["REQUEST_BRIDGE"] = "request-bridge";
|
|
129201
129201
|
OrchestrationEventType["REQUEST_ONRAMP"] = "request-onramp";
|
|
129202
|
-
OrchestrationEventType["
|
|
129202
|
+
OrchestrationEventType["REQUEST_ADD_TOKENS"] = "request-add-tokens";
|
|
129203
129203
|
OrchestrationEventType["REQUEST_GO_BACK"] = "request-go-back";
|
|
129204
129204
|
})(OrchestrationEventType || (OrchestrationEventType = {}));
|
|
129205
129205
|
|
|
@@ -129233,7 +129233,7 @@
|
|
|
129233
129233
|
CommerceSuccessEventType["SALE_TRANSACTION_SUCCESS"] = "SALE_TRANSACTION_SUCCESS";
|
|
129234
129234
|
CommerceSuccessEventType["BRIDGE_SUCCESS"] = "BRIDGE_SUCCESS";
|
|
129235
129235
|
CommerceSuccessEventType["BRIDGE_CLAIM_WITHDRAWAL_SUCCESS"] = "BRIDGE_CLAIM_WITHDRAWAL_SUCCESS";
|
|
129236
|
-
CommerceSuccessEventType["
|
|
129236
|
+
CommerceSuccessEventType["ADD_TOKENS_SUCCESS"] = "ADD_TOKENS_SUCCESS";
|
|
129237
129237
|
})(CommerceSuccessEventType || (CommerceSuccessEventType = {}));
|
|
129238
129238
|
var CommerceFailureEventType;
|
|
129239
129239
|
(function (CommerceFailureEventType) {
|
|
@@ -129244,7 +129244,7 @@
|
|
|
129244
129244
|
CommerceFailureEventType["CONNECT_FAILED"] = "CONNECT_FAILED";
|
|
129245
129245
|
CommerceFailureEventType["SALE_FAILED"] = "SALE_FAILED";
|
|
129246
129246
|
CommerceFailureEventType["ONRAMP_FAILED"] = "ONRAMP_FAILED";
|
|
129247
|
-
CommerceFailureEventType["
|
|
129247
|
+
CommerceFailureEventType["ADD_TOKENS_FAILED"] = "ADD_TOKENS_FAILED";
|
|
129248
129248
|
})(CommerceFailureEventType || (CommerceFailureEventType = {}));
|
|
129249
129249
|
var CommerceUserActionEventType;
|
|
129250
129250
|
(function (CommerceUserActionEventType) {
|
|
@@ -129254,16 +129254,16 @@
|
|
|
129254
129254
|
})(CommerceUserActionEventType || (CommerceUserActionEventType = {}));
|
|
129255
129255
|
|
|
129256
129256
|
/**
|
|
129257
|
-
* Enum of possible Add
|
|
129257
|
+
* Enum of possible Add Tokens Widget event types.
|
|
129258
129258
|
*/
|
|
129259
|
-
var
|
|
129260
|
-
(function (
|
|
129261
|
-
|
|
129262
|
-
|
|
129263
|
-
|
|
129264
|
-
|
|
129265
|
-
|
|
129266
|
-
})(
|
|
129259
|
+
var AddTokensEventType;
|
|
129260
|
+
(function (AddTokensEventType) {
|
|
129261
|
+
AddTokensEventType["CLOSE_WIDGET"] = "close-widget";
|
|
129262
|
+
AddTokensEventType["LANGUAGE_CHANGED"] = "language-changed";
|
|
129263
|
+
AddTokensEventType["CONNECT_SUCCESS"] = "connect-success";
|
|
129264
|
+
AddTokensEventType["SUCCESS"] = "success";
|
|
129265
|
+
AddTokensEventType["FAILURE"] = "failure";
|
|
129266
|
+
})(AddTokensEventType || (AddTokensEventType = {}));
|
|
129267
129267
|
|
|
129268
129268
|
/**
|
|
129269
129269
|
* Enum representing the list of widget types.
|
|
@@ -129277,7 +129277,7 @@
|
|
|
129277
129277
|
WidgetType["ONRAMP"] = "onramp";
|
|
129278
129278
|
WidgetType["SALE"] = "sale";
|
|
129279
129279
|
WidgetType["IMMUTABLE_COMMERCE"] = "immutableCommerce";
|
|
129280
|
-
WidgetType["
|
|
129280
|
+
WidgetType["ADD_TOKENS"] = "addTokens";
|
|
129281
129281
|
})(WidgetType || (WidgetType = {}));
|
|
129282
129282
|
|
|
129283
129283
|
var ConnectTargetLayer;
|
|
@@ -129300,7 +129300,7 @@
|
|
|
129300
129300
|
CommerceFlowType["SWAP"] = "SWAP";
|
|
129301
129301
|
CommerceFlowType["BRIDGE"] = "BRIDGE";
|
|
129302
129302
|
CommerceFlowType["ONRAMP"] = "ONRAMP";
|
|
129303
|
-
CommerceFlowType["
|
|
129303
|
+
CommerceFlowType["ADD_TOKENS"] = "ADD_TOKENS";
|
|
129304
129304
|
})(CommerceFlowType || (CommerceFlowType = {}));
|
|
129305
129305
|
|
|
129306
129306
|
/**
|
|
@@ -133256,12 +133256,12 @@
|
|
|
133256
133256
|
heading: {
|
|
133257
133257
|
swap: "Swapping is not available in your region",
|
|
133258
133258
|
generic: "This service is not available in your region",
|
|
133259
|
-
|
|
133259
|
+
addTokens: "This is not available in your region"
|
|
133260
133260
|
},
|
|
133261
133261
|
body: {
|
|
133262
133262
|
swap: "Please refer to <quickswapLink>Quickswap’s</quickswapLink> website for further information.",
|
|
133263
133263
|
generic: "For further assistance visit the <immutableSupport>Immutable</immutableSupport> support page.",
|
|
133264
|
-
|
|
133264
|
+
addTokens: "Please add tokens another way"
|
|
133265
133265
|
}
|
|
133266
133266
|
},
|
|
133267
133267
|
LOADING_VIEW: {
|
|
@@ -133826,7 +133826,7 @@
|
|
|
133826
133826
|
}
|
|
133827
133827
|
}
|
|
133828
133828
|
},
|
|
133829
|
-
|
|
133829
|
+
ADD_TOKENS: {
|
|
133830
133830
|
drawer: {
|
|
133831
133831
|
options: {
|
|
133832
133832
|
swap: {
|
|
@@ -134110,12 +134110,12 @@
|
|
|
134110
134110
|
heading: {
|
|
134111
134111
|
swap: "お住まいの地域では交換が利用できません",
|
|
134112
134112
|
generic: "このサービスはお住まいの地域では利用できません",
|
|
134113
|
-
|
|
134113
|
+
addTokens: "このサービスはお住まいの地域では利用できません"
|
|
134114
134114
|
},
|
|
134115
134115
|
body: {
|
|
134116
134116
|
swap: "<quickswapLink>Quickswap</quickswapLink>のウェブサイトで詳細情報をご覧ください。",
|
|
134117
134117
|
generic: "詳しいサポートについては、<immutableSupport>Immutable</immutableSupport>サポートページをご覧ください.",
|
|
134118
|
-
|
|
134118
|
+
addTokens: "別の方法でトークンを追加してください。"
|
|
134119
134119
|
}
|
|
134120
134120
|
},
|
|
134121
134121
|
LOADING_VIEW: {
|
|
@@ -134663,7 +134663,7 @@
|
|
|
134663
134663
|
}
|
|
134664
134664
|
}
|
|
134665
134665
|
},
|
|
134666
|
-
|
|
134666
|
+
ADD_TOKENS: {
|
|
134667
134667
|
drawer: {
|
|
134668
134668
|
options: {
|
|
134669
134669
|
swap: {
|
|
@@ -134947,12 +134947,12 @@
|
|
|
134947
134947
|
heading: {
|
|
134948
134948
|
swap: "해당 지역에서는 스왑을 이용할 수 없습니다",
|
|
134949
134949
|
generic: "이 서비스는 귀하의 지역에서 사용할 수 없습니다",
|
|
134950
|
-
|
|
134950
|
+
addTokens: "이 서비스는 귀하의 지역에서 사용할 수 없습니다"
|
|
134951
134951
|
},
|
|
134952
134952
|
body: {
|
|
134953
134953
|
swap: "<quickswapLink>Quickswap</quickswapLink> 웹사이트에서 자세한 내용을 확인하세요.",
|
|
134954
134954
|
generic: "자세한 내용은 <immutableSupport>Immutable</immutableSupport> 지원 페이지를 참조하세요.",
|
|
134955
|
-
|
|
134955
|
+
addTokens: "다른 방법으로 토큰을 추가해 주세요."
|
|
134956
134956
|
}
|
|
134957
134957
|
},
|
|
134958
134958
|
LOADING_VIEW: {
|
|
@@ -135497,7 +135497,7 @@
|
|
|
135497
135497
|
}
|
|
135498
135498
|
}
|
|
135499
135499
|
},
|
|
135500
|
-
|
|
135500
|
+
ADD_TOKENS: {
|
|
135501
135501
|
drawer: {
|
|
135502
135502
|
options: {
|
|
135503
135503
|
swap: {
|
|
@@ -135781,12 +135781,12 @@
|
|
|
135781
135781
|
heading: {
|
|
135782
135782
|
swap: "您的地区无法使用兑换功能",
|
|
135783
135783
|
generic: "该服务在您的地区不可用",
|
|
135784
|
-
|
|
135784
|
+
addTokens: "该服务在您的地区不可用"
|
|
135785
135785
|
},
|
|
135786
135786
|
body: {
|
|
135787
135787
|
swap: "请访问<quickswapLink>Quickswap</quickswapLink>网站了解更多信息。",
|
|
135788
135788
|
generic: "更多帮助,请访问<immutableSupport>Immutable</immutableSupport>支持页面。",
|
|
135789
|
-
|
|
135789
|
+
addTokens: "请通过其他方式添加代币。"
|
|
135790
135790
|
}
|
|
135791
135791
|
},
|
|
135792
135792
|
LOADING_VIEW: {
|
|
@@ -136331,7 +136331,7 @@
|
|
|
136331
136331
|
}
|
|
136332
136332
|
}
|
|
136333
136333
|
},
|
|
136334
|
-
|
|
136334
|
+
ADD_TOKENS: {
|
|
136335
136335
|
drawer: {
|
|
136336
136336
|
options: {
|
|
136337
136337
|
swap: {
|
|
@@ -136628,9 +136628,9 @@
|
|
|
136628
136628
|
*/
|
|
136629
136629
|
const DEFAULT_BRIDGE_ENABLED = true;
|
|
136630
136630
|
/**
|
|
136631
|
-
* Commerce Widget default add
|
|
136631
|
+
* Commerce Widget default add tokens enabled flag
|
|
136632
136632
|
*/
|
|
136633
|
-
const
|
|
136633
|
+
const DEFAULT_ADD_TOKENS_ENABLED = true;
|
|
136634
136634
|
/**
|
|
136635
136635
|
* Commerce Widget default refresh quote interval
|
|
136636
136636
|
*/
|
|
@@ -150417,7 +150417,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
150417
150417
|
isOnRampEnabled: getValidBoolean(DEFAULT_ON_RAMP_ENABLED, configs?.isOnRampEnabled?.toString()),
|
|
150418
150418
|
isSwapEnabled: getValidBoolean(DEFAULT_SWAP_ENABLED, configs?.isSwapEnabled?.toString()),
|
|
150419
150419
|
isBridgeEnabled: getValidBoolean(DEFAULT_BRIDGE_ENABLED, configs?.isBridgeEnabled?.toString()),
|
|
150420
|
-
|
|
150420
|
+
isAddTokensEnabled: getValidBoolean(DEFAULT_ADD_TOKENS_ENABLED, configs?.isAddTokensEnabled?.toString()),
|
|
150421
150421
|
});
|
|
150422
150422
|
|
|
150423
150423
|
/* eslint-disable class-methods-use-this */
|
|
@@ -156984,7 +156984,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
156984
156984
|
UserJourney["SWAP"] = "Swap";
|
|
156985
156985
|
UserJourney["BRIDGE"] = "Bridge";
|
|
156986
156986
|
UserJourney["SALE"] = "PrimarySale";
|
|
156987
|
-
UserJourney["
|
|
156987
|
+
UserJourney["ADD_TOKENS"] = "AddTokens";
|
|
156988
156988
|
})(UserJourney || (UserJourney = {}));
|
|
156989
156989
|
const productName = 'checkout';
|
|
156990
156990
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -225684,9 +225684,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
225684
225684
|
return context;
|
|
225685
225685
|
};
|
|
225686
225686
|
|
|
225687
|
-
const
|
|
225688
|
-
let
|
|
225689
|
-
eventTopic = IMTBLWidgetEvents.
|
|
225687
|
+
const AddTokensWidget$2 = React.lazy(() => Promise.resolve().then(function () { return AddTokensWidget$1; }));
|
|
225688
|
+
let AddTokens$1 = class AddTokens extends Base$3 {
|
|
225689
|
+
eventTopic = IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT;
|
|
225690
225690
|
getValidatedProperties({ config, }) {
|
|
225691
225691
|
let validatedConfig;
|
|
225692
225692
|
if (config) {
|
|
@@ -225721,10 +225721,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
225721
225721
|
if (!this.reactRoot)
|
|
225722
225722
|
return;
|
|
225723
225723
|
const { t } = instance;
|
|
225724
|
-
this.reactRoot.render(jsx$1(React.StrictMode, { children: jsx$1(CustomAnalyticsProvider, { checkout: this.checkout, children: jsx$1(ThemeProvider, { id: "add-
|
|
225724
|
+
this.reactRoot.render(jsx$1(React.StrictMode, { children: jsx$1(CustomAnalyticsProvider, { checkout: this.checkout, children: jsx$1(ThemeProvider, { id: "add-tokens-container", config: this.strongConfig(), children: jsx$1(HandoverProvider, { children: jsx$1(ProvidersContextProvider, { initialState: {
|
|
225725
225725
|
checkout: this.checkout,
|
|
225726
225726
|
toProvider: this.parameters.toProvider,
|
|
225727
|
-
}, children: jsx$1(reactExports.Suspense, { fallback: jsx$1(LoadingView, { loadingText: t('views.LOADING_VIEW.text') }), children: jsx$1(
|
|
225727
|
+
}, children: jsx$1(reactExports.Suspense, { fallback: jsx$1(LoadingView, { loadingText: t('views.LOADING_VIEW.text') }), children: jsx$1(AddTokensWidget$2, { config: this.strongConfig(), toTokenAddress: this.parameters.toTokenAddress, toAmount: this.parameters.toAmount, showBridgeOption: this.parameters.showBridgeOption, showSwapOption: this.parameters.showSwapOption, showOnrampOption: this.parameters.showOnrampOption, showBackButton: this.parameters.showBackButton }) }) }) }) }) }) }));
|
|
225728
225728
|
}
|
|
225729
225729
|
};
|
|
225730
225730
|
|
|
@@ -225793,7 +225793,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
225793
225793
|
CommerceFlowType.SWAP,
|
|
225794
225794
|
CommerceFlowType.BRIDGE,
|
|
225795
225795
|
CommerceFlowType.ONRAMP,
|
|
225796
|
-
CommerceFlowType.
|
|
225796
|
+
CommerceFlowType.ADD_TOKENS,
|
|
225797
225797
|
];
|
|
225798
225798
|
|
|
225799
225799
|
const CommerceWidget$2 = React.lazy(() => Promise.resolve().then(function () { return CommerceWidget$1; }));
|
|
@@ -225859,7 +225859,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
225859
225859
|
items: deduplicateSaleItemsArray(params.items),
|
|
225860
225860
|
};
|
|
225861
225861
|
}
|
|
225862
|
-
|
|
225862
|
+
getValidAddTokensFlowParams(params) {
|
|
225863
225863
|
const validatedParams = { ...params };
|
|
225864
225864
|
if (validatedParams.showBridgeOption) {
|
|
225865
225865
|
validatedParams.showBridgeOption = true;
|
|
@@ -225952,8 +225952,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
225952
225952
|
return this.getValidBridgeFlowParams(params);
|
|
225953
225953
|
case CommerceFlowType.ONRAMP:
|
|
225954
225954
|
return this.getValidOnRampFlowParams(params);
|
|
225955
|
-
case CommerceFlowType.
|
|
225956
|
-
return this.
|
|
225955
|
+
case CommerceFlowType.ADD_TOKENS:
|
|
225956
|
+
return this.getValidAddTokensFlowParams(params);
|
|
225957
225957
|
default:
|
|
225958
225958
|
// eslint-disable-next-line no-console
|
|
225959
225959
|
console.warn(`[IMTBL]: invalid "flow: ${flowType}" widget input, must be one of the following: ${supportedFlows}`);
|
|
@@ -226680,7 +226680,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
226680
226680
|
(function (ServiceType) {
|
|
226681
226681
|
ServiceType["SWAP"] = "swap";
|
|
226682
226682
|
ServiceType["GENERIC"] = "generic";
|
|
226683
|
-
ServiceType["
|
|
226683
|
+
ServiceType["ADD_TOKENS"] = "addTokens";
|
|
226684
226684
|
})(ServiceType || (ServiceType = {}));
|
|
226685
226685
|
|
|
226686
226686
|
function NoServiceHero() {
|
|
@@ -228118,26 +228118,26 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
228118
228118
|
if (eventTarget !== undefined)
|
|
228119
228119
|
eventTarget.dispatchEvent(requestGoBackEvent);
|
|
228120
228120
|
}
|
|
228121
|
-
function
|
|
228121
|
+
function sendRequestAddTokensEvent(eventTarget, imtblWidgetEvent, eventData) {
|
|
228122
228122
|
// eslint-disable-next-line max-len
|
|
228123
|
-
const
|
|
228123
|
+
const requestAddTokensEvent = new CustomEvent(imtblWidgetEvent, {
|
|
228124
228124
|
detail: {
|
|
228125
|
-
type: OrchestrationEventType.
|
|
228125
|
+
type: OrchestrationEventType.REQUEST_ADD_TOKENS,
|
|
228126
228126
|
data: eventData,
|
|
228127
228127
|
},
|
|
228128
228128
|
});
|
|
228129
228129
|
// TODO: please remove or if necessary keep the eslint ignore
|
|
228130
228130
|
// eslint-disable-next-line no-console
|
|
228131
|
-
console.log('add
|
|
228131
|
+
console.log('add tokens event:', eventTarget, requestAddTokensEvent);
|
|
228132
228132
|
if (eventTarget !== undefined)
|
|
228133
|
-
eventTarget.dispatchEvent(
|
|
228133
|
+
eventTarget.dispatchEvent(requestAddTokensEvent);
|
|
228134
228134
|
}
|
|
228135
228135
|
const orchestrationEvents$1 = {
|
|
228136
228136
|
sendRequestBridgeEvent,
|
|
228137
228137
|
sendRequestSwapEvent,
|
|
228138
228138
|
sendRequestOnrampEvent,
|
|
228139
228139
|
sendRequestGoBackEvent,
|
|
228140
|
-
|
|
228140
|
+
sendRequestAddTokensEvent,
|
|
228141
228141
|
};
|
|
228142
228142
|
|
|
228143
228143
|
const OnRampWidget$2 = React.lazy(() => Promise.resolve().then(function () { return OnRampWidget$1; }));
|
|
@@ -228732,8 +228732,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
228732
228732
|
provider,
|
|
228733
228733
|
});
|
|
228734
228734
|
}
|
|
228735
|
-
case WidgetType.
|
|
228736
|
-
return new
|
|
228735
|
+
case WidgetType.ADD_TOKENS: {
|
|
228736
|
+
return new AddTokens$1(this.sdk, {
|
|
228737
228737
|
config: { ...this.widgetConfig, ...(config) },
|
|
228738
228738
|
provider,
|
|
228739
228739
|
});
|
|
@@ -239085,10 +239085,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239085
239085
|
});
|
|
239086
239086
|
|
|
239087
239087
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
239088
|
-
function
|
|
239089
|
-
const closeWidgetEvent = new CustomEvent(IMTBLWidgetEvents.
|
|
239088
|
+
function sendAddTokensCloseEvent(eventTarget) {
|
|
239089
|
+
const closeWidgetEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
239090
239090
|
detail: {
|
|
239091
|
-
type:
|
|
239091
|
+
type: AddTokensEventType.CLOSE_WIDGET,
|
|
239092
239092
|
data: {},
|
|
239093
239093
|
},
|
|
239094
239094
|
});
|
|
@@ -239099,9 +239099,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239099
239099
|
eventTarget.dispatchEvent(closeWidgetEvent);
|
|
239100
239100
|
}
|
|
239101
239101
|
function sendConnectProviderSuccessEvent(eventTarget, providerType, provider, providerInfo) {
|
|
239102
|
-
const successEvent = new CustomEvent(IMTBLWidgetEvents.
|
|
239102
|
+
const successEvent = new CustomEvent(IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {
|
|
239103
239103
|
detail: {
|
|
239104
|
-
type:
|
|
239104
|
+
type: AddTokensEventType.CONNECT_SUCCESS,
|
|
239105
239105
|
data: {
|
|
239106
239106
|
provider,
|
|
239107
239107
|
providerType,
|
|
@@ -239115,7 +239115,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239115
239115
|
eventTarget.dispatchEvent(successEvent);
|
|
239116
239116
|
}
|
|
239117
239117
|
|
|
239118
|
-
const
|
|
239118
|
+
const initialAddTokensState = {
|
|
239119
239119
|
allowedTokens: null,
|
|
239120
239120
|
squid: null,
|
|
239121
239121
|
chains: null,
|
|
@@ -239127,73 +239127,73 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239127
239127
|
selectedAmount: '',
|
|
239128
239128
|
isSwapAvailable: false,
|
|
239129
239129
|
};
|
|
239130
|
-
var
|
|
239131
|
-
(function (
|
|
239132
|
-
|
|
239133
|
-
|
|
239134
|
-
|
|
239135
|
-
|
|
239136
|
-
|
|
239137
|
-
|
|
239138
|
-
|
|
239139
|
-
|
|
239140
|
-
|
|
239141
|
-
|
|
239142
|
-
})(
|
|
239130
|
+
var AddTokensActions;
|
|
239131
|
+
(function (AddTokensActions) {
|
|
239132
|
+
AddTokensActions["SET_ALLOWED_TOKENS"] = "SET_ALLOWED_TOKENS";
|
|
239133
|
+
AddTokensActions["SET_SQUID"] = "SET_SQUID";
|
|
239134
|
+
AddTokensActions["SET_CHAINS"] = "SET_CHAINS";
|
|
239135
|
+
AddTokensActions["SET_BALANCES"] = "SET_BALANCES";
|
|
239136
|
+
AddTokensActions["SET_TOKENS"] = "SET_TOKENS";
|
|
239137
|
+
AddTokensActions["SET_ROUTES"] = "SET_ROUTES";
|
|
239138
|
+
AddTokensActions["SET_SELECTED_ROUTE_DATA"] = "SET_SELECTED_ROUTE_DATA";
|
|
239139
|
+
AddTokensActions["SET_SELECTED_TOKEN"] = "SET_SELECTED_TOKEN";
|
|
239140
|
+
AddTokensActions["SET_SELECTED_AMOUNT"] = "SET_SELECTED_AMOUNT";
|
|
239141
|
+
AddTokensActions["SET_IS_SWAP_AVAILABLE"] = "SET_IS_SWAP_AVAILABLE";
|
|
239142
|
+
})(AddTokensActions || (AddTokensActions = {}));
|
|
239143
239143
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
239144
|
-
const
|
|
239145
|
-
|
|
239146
|
-
|
|
239144
|
+
const AddTokensContext = reactExports.createContext({
|
|
239145
|
+
addTokensState: initialAddTokensState,
|
|
239146
|
+
addTokensDispatch: () => { },
|
|
239147
239147
|
});
|
|
239148
|
-
|
|
239149
|
-
const
|
|
239148
|
+
AddTokensContext.displayName = 'AddTokensContext';
|
|
239149
|
+
const addTokensReducer = (state, action) => {
|
|
239150
239150
|
switch (action.payload.type) {
|
|
239151
|
-
case
|
|
239151
|
+
case AddTokensActions.SET_ALLOWED_TOKENS:
|
|
239152
239152
|
return {
|
|
239153
239153
|
...state,
|
|
239154
239154
|
allowedTokens: action.payload.allowedTokens,
|
|
239155
239155
|
};
|
|
239156
|
-
case
|
|
239156
|
+
case AddTokensActions.SET_SQUID:
|
|
239157
239157
|
return {
|
|
239158
239158
|
...state,
|
|
239159
239159
|
squid: action.payload.squid,
|
|
239160
239160
|
};
|
|
239161
|
-
case
|
|
239161
|
+
case AddTokensActions.SET_CHAINS:
|
|
239162
239162
|
return {
|
|
239163
239163
|
...state,
|
|
239164
239164
|
chains: action.payload.chains,
|
|
239165
239165
|
};
|
|
239166
|
-
case
|
|
239166
|
+
case AddTokensActions.SET_BALANCES:
|
|
239167
239167
|
return {
|
|
239168
239168
|
...state,
|
|
239169
239169
|
balances: action.payload.balances,
|
|
239170
239170
|
};
|
|
239171
|
-
case
|
|
239171
|
+
case AddTokensActions.SET_TOKENS:
|
|
239172
239172
|
return {
|
|
239173
239173
|
...state,
|
|
239174
239174
|
tokens: action.payload.tokens,
|
|
239175
239175
|
};
|
|
239176
|
-
case
|
|
239176
|
+
case AddTokensActions.SET_ROUTES:
|
|
239177
239177
|
return {
|
|
239178
239178
|
...state,
|
|
239179
239179
|
routes: action.payload.routes,
|
|
239180
239180
|
};
|
|
239181
|
-
case
|
|
239181
|
+
case AddTokensActions.SET_SELECTED_ROUTE_DATA:
|
|
239182
239182
|
return {
|
|
239183
239183
|
...state,
|
|
239184
239184
|
selectedRouteData: action.payload.selectedRouteData,
|
|
239185
239185
|
};
|
|
239186
|
-
case
|
|
239186
|
+
case AddTokensActions.SET_SELECTED_TOKEN:
|
|
239187
239187
|
return {
|
|
239188
239188
|
...state,
|
|
239189
239189
|
selectedToken: action.payload.selectedToken,
|
|
239190
239190
|
};
|
|
239191
|
-
case
|
|
239191
|
+
case AddTokensActions.SET_SELECTED_AMOUNT:
|
|
239192
239192
|
return {
|
|
239193
239193
|
...state,
|
|
239194
239194
|
selectedAmount: action.payload.selectedAmount,
|
|
239195
239195
|
};
|
|
239196
|
-
case
|
|
239196
|
+
case AddTokensActions.SET_IS_SWAP_AVAILABLE:
|
|
239197
239197
|
return {
|
|
239198
239198
|
...state,
|
|
239199
239199
|
isSwapAvailable: action.payload.isSwapAvailable,
|
|
@@ -239203,12 +239203,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239203
239203
|
}
|
|
239204
239204
|
};
|
|
239205
239205
|
|
|
239206
|
-
var
|
|
239207
|
-
(function (
|
|
239208
|
-
|
|
239209
|
-
|
|
239210
|
-
|
|
239211
|
-
})(
|
|
239206
|
+
var AddTokensWidgetViews;
|
|
239207
|
+
(function (AddTokensWidgetViews) {
|
|
239208
|
+
AddTokensWidgetViews["ADD_TOKENS"] = "ADD_TOKENS";
|
|
239209
|
+
AddTokensWidgetViews["REVIEW"] = "REVIEW";
|
|
239210
|
+
AddTokensWidgetViews["GEO_BLOCK_ERROR"] = "GEO_BLOCK_ERROR";
|
|
239211
|
+
})(AddTokensWidgetViews || (AddTokensWidgetViews = {}));
|
|
239212
239212
|
|
|
239213
239213
|
/**
|
|
239214
239214
|
* lodash (Custom Build) <https://lodash.com/>
|
|
@@ -239603,20 +239603,20 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239603
239603
|
RiveStateMachineInput[RiveStateMachineInput["COMPLETED"] = 3] = "COMPLETED";
|
|
239604
239604
|
RiveStateMachineInput[RiveStateMachineInput["ERROR"] = 4] = "ERROR";
|
|
239605
239605
|
})(RiveStateMachineInput || (RiveStateMachineInput = {}));
|
|
239606
|
-
var
|
|
239607
|
-
(function (
|
|
239608
|
-
|
|
239609
|
-
|
|
239610
|
-
|
|
239611
|
-
|
|
239612
|
-
|
|
239613
|
-
|
|
239614
|
-
|
|
239615
|
-
|
|
239616
|
-
|
|
239617
|
-
|
|
239618
|
-
|
|
239619
|
-
})(
|
|
239606
|
+
var AddTokensErrorTypes;
|
|
239607
|
+
(function (AddTokensErrorTypes) {
|
|
239608
|
+
AddTokensErrorTypes["DEFAULT"] = "DEFAULT_ERROR";
|
|
239609
|
+
AddTokensErrorTypes["INVALID_PARAMETERS"] = "INVALID_PARAMETERS";
|
|
239610
|
+
AddTokensErrorTypes["SERVICE_BREAKDOWN"] = "SERVICE_BREAKDOWN";
|
|
239611
|
+
AddTokensErrorTypes["TRANSACTION_FAILED"] = "TRANSACTION_FAILED";
|
|
239612
|
+
AddTokensErrorTypes["UNRECOGNISED_CHAIN"] = "UNRECOGNISED_CHAIN";
|
|
239613
|
+
AddTokensErrorTypes["PROVIDER_ERROR"] = "PROVIDER_ERROR";
|
|
239614
|
+
AddTokensErrorTypes["WALLET_FAILED"] = "WALLET_FAILED";
|
|
239615
|
+
AddTokensErrorTypes["WALLET_REJECTED"] = "WALLET_REJECTED";
|
|
239616
|
+
AddTokensErrorTypes["WALLET_REJECTED_NO_FUNDS"] = "WALLET_REJECTED_NO_FUNDS";
|
|
239617
|
+
AddTokensErrorTypes["WALLET_POPUP_BLOCKED"] = "WALLET_POPUP_BLOCKED";
|
|
239618
|
+
AddTokensErrorTypes["ENVIRONMENT_ERROR"] = "ENVIRONMENT_ERROR";
|
|
239619
|
+
})(AddTokensErrorTypes || (AddTokensErrorTypes = {}));
|
|
239620
239620
|
|
|
239621
239621
|
function FiatOption({ type, onClick, disabled = false, size = 'small', rc = jsx$1("span", {}), }) {
|
|
239622
239622
|
const { t } = useTranslation();
|
|
@@ -239634,7 +239634,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239634
239634
|
size,
|
|
239635
239635
|
rc,
|
|
239636
239636
|
};
|
|
239637
|
-
return (jsxs(MenuItem, { ...menuItemProps, children: [jsx$1(MenuItem.FramedIcon, { icon: icon[type], variant: "bold", emphasized: false }), jsx$1(MenuItem.Label, { children: t(`views.
|
|
239637
|
+
return (jsxs(MenuItem, { ...menuItemProps, children: [jsx$1(MenuItem.FramedIcon, { icon: icon[type], variant: "bold", emphasized: false }), jsx$1(MenuItem.Label, { children: t(`views.ADD_TOKENS.drawer.options.${type}.heading`) }), jsx$1(MenuItem.Caption, { children: t(`views.ADD_TOKENS.drawer.options.${type}.${disabled ? 'disabledCaption' : 'caption'}`) }), !disabled && jsx$1(MenuItem.IntentIcon, {})] }));
|
|
239638
239638
|
}
|
|
239639
239639
|
|
|
239640
239640
|
function getDurationFormatted(estimatedRouteDuration) {
|
|
@@ -239794,7 +239794,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
239794
239794
|
showSwapOption,
|
|
239795
239795
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
239796
239796
|
showBridgeOption, insufficientBalance, }) {
|
|
239797
|
-
const {
|
|
239797
|
+
const { addTokensState: { chains }, } = reactExports.useContext(AddTokensContext);
|
|
239798
239798
|
const { providersState: { fromProviderInfo, fromAddress }, } = useProvidersContext();
|
|
239799
239799
|
const selectedRouteIndex = reactExports.useRef(0);
|
|
239800
239800
|
const handleOnRouteClick = (route, index) => {
|
|
@@ -240506,12 +240506,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
240506
240506
|
const BASE_SLIPPAGE = 0.02;
|
|
240507
240507
|
const useRoutes = () => {
|
|
240508
240508
|
const latestRequestIdRef = reactExports.useRef(0);
|
|
240509
|
-
const {
|
|
240509
|
+
const { addTokensDispatch } = reactExports.useContext(AddTokensContext);
|
|
240510
240510
|
const { track } = useAnalytics();
|
|
240511
240511
|
const setRoutes = (routes) => {
|
|
240512
|
-
|
|
240512
|
+
addTokensDispatch({
|
|
240513
240513
|
payload: {
|
|
240514
|
-
type:
|
|
240514
|
+
type: AddTokensActions.SET_ROUTES,
|
|
240515
240515
|
routes,
|
|
240516
240516
|
},
|
|
240517
240517
|
});
|
|
@@ -240608,7 +240608,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
240608
240608
|
return { route: newRoute };
|
|
240609
240609
|
}
|
|
240610
240610
|
track({
|
|
240611
|
-
userJourney: UserJourney.
|
|
240611
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
240612
240612
|
screen: 'Routes',
|
|
240613
240613
|
action: 'Failed',
|
|
240614
240614
|
extras: {
|
|
@@ -243804,30 +243804,30 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243804
243804
|
var localforageExports = localforage.exports;
|
|
243805
243805
|
var localForage = /*@__PURE__*/getDefaultExportFromCjs$3(localforageExports);
|
|
243806
243806
|
|
|
243807
|
-
const
|
|
243808
|
-
name: '
|
|
243807
|
+
const addTokensOnboardingCache = localForage.createInstance({
|
|
243808
|
+
name: 'AddTokens Onboarding State',
|
|
243809
243809
|
version: 1.0,
|
|
243810
243810
|
storeName: 'Internal state',
|
|
243811
|
-
description: 'A small IndexDB for storage of state relating to the
|
|
243811
|
+
description: 'A small IndexDB for storage of state relating to the AddTokens Onboarding Drawer',
|
|
243812
243812
|
});
|
|
243813
243813
|
const SEEN_ONBOARDING_KEY = 'seen-onboarding';
|
|
243814
243814
|
async function getCacheItem(key) {
|
|
243815
|
-
const data = await
|
|
243815
|
+
const data = await addTokensOnboardingCache.getItem(key);
|
|
243816
243816
|
if (!data)
|
|
243817
243817
|
return null;
|
|
243818
243818
|
const { value } = data;
|
|
243819
243819
|
return value;
|
|
243820
243820
|
}
|
|
243821
243821
|
async function setCacheItem(key, value) {
|
|
243822
|
-
return
|
|
243822
|
+
return addTokensOnboardingCache.setItem(key, {
|
|
243823
243823
|
value,
|
|
243824
243824
|
});
|
|
243825
243825
|
}
|
|
243826
243826
|
|
|
243827
243827
|
const HERO_IMAGES = [
|
|
243828
|
-
'/add-
|
|
243829
|
-
'/add-
|
|
243830
|
-
'/add-
|
|
243828
|
+
'/add-tokens-onboarding-1.svg',
|
|
243829
|
+
'/add-tokens-onboarding-2.svg',
|
|
243830
|
+
'/add-tokens-onboarding-3.svg',
|
|
243831
243831
|
];
|
|
243832
243832
|
function OnboardingDrawer({ environment }) {
|
|
243833
243833
|
const { t } = useTranslation();
|
|
@@ -243862,11 +243862,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243862
243862
|
alignItems: 'center',
|
|
243863
243863
|
textAlign: 'center',
|
|
243864
243864
|
px: 'base.spacing.x6',
|
|
243865
|
-
}, children: [jsx$1(Box, { rc: jsx$1("img", { src: src, alt: HERO_IMAGES[screenIndex - 1] }), sx: { userSelect: 'none' } }), jsx$1(Divider, { size: "xSmall", textAlign: "center", sx: { mt: 'base.spacing.x6', mb: 'base.spacing.x4' }, children: t(`views.
|
|
243865
|
+
}, children: [jsx$1(Box, { rc: jsx$1("img", { src: src, alt: HERO_IMAGES[screenIndex - 1] }), sx: { userSelect: 'none' } }), jsx$1(Divider, { size: "xSmall", textAlign: "center", sx: { mt: 'base.spacing.x6', mb: 'base.spacing.x4' }, children: t(`views.ADD_TOKENS.onboarding.screen${screenIndex}.caption`) }), jsx$1(Heading, { size: "small", sx: {
|
|
243866
243866
|
// @NOTE: this preserves newlines inside any strings, which
|
|
243867
243867
|
// come out of the translation layer
|
|
243868
243868
|
whiteSpace: 'pre-line',
|
|
243869
|
-
}, children: t(`views.
|
|
243869
|
+
}, children: t(`views.ADD_TOKENS.onboarding.screen${screenIndex}.title`) }), jsx$1(OnboardingPagination, { disabled: true, size: "small", currentPage: screenIndex, totalPages: 3, sx: { mt: 'base.spacing.x11', mb: 'base.spacing.x8' } }), jsx$1(Button, { variant: screenIndex === 3 ? 'primary' : 'tertiary', onClick: handleCtaOnClick, size: "large", sx: { alignSelf: 'stretch' }, children: t(`views.ADD_TOKENS.onboarding.screen${screenIndex}.buttonText`) })] }) }));
|
|
243870
243870
|
}
|
|
243871
243871
|
|
|
243872
243872
|
function HandoverContent({ headingText, subheadingText, primaryButtonText, onPrimaryButtonClick, secondaryButtonText, onSecondaryButtonClick, }) {
|
|
@@ -243897,94 +243897,94 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243897
243897
|
});
|
|
243898
243898
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
243899
243899
|
const closeWidget = () => {
|
|
243900
|
-
|
|
243900
|
+
sendAddTokensCloseEvent(eventTarget);
|
|
243901
243901
|
};
|
|
243902
|
-
const
|
|
243902
|
+
const goBackToAddTokensView = () => {
|
|
243903
243903
|
closeHandover();
|
|
243904
243904
|
viewDispatch({
|
|
243905
243905
|
payload: {
|
|
243906
243906
|
type: ViewActions.UPDATE_VIEW,
|
|
243907
243907
|
view: {
|
|
243908
|
-
type:
|
|
243908
|
+
type: AddTokensWidgetViews.ADD_TOKENS,
|
|
243909
243909
|
},
|
|
243910
243910
|
},
|
|
243911
243911
|
});
|
|
243912
243912
|
};
|
|
243913
243913
|
const errorConfig = {
|
|
243914
|
-
[
|
|
243914
|
+
[AddTokensErrorTypes.DEFAULT]: {
|
|
243915
243915
|
headingText: 'Sorry, something went wrong. Please try again later.',
|
|
243916
243916
|
secondaryButtonText: 'Close',
|
|
243917
243917
|
onSecondaryButtonClick: closeWidget,
|
|
243918
243918
|
},
|
|
243919
|
-
[
|
|
243919
|
+
[AddTokensErrorTypes.INVALID_PARAMETERS]: {
|
|
243920
243920
|
headingText: 'Invalid parameters',
|
|
243921
243921
|
subHeadingText: 'The widget parameters provided are invalid. Please check again.',
|
|
243922
243922
|
secondaryButtonText: 'Close',
|
|
243923
243923
|
onSecondaryButtonClick: closeWidget,
|
|
243924
243924
|
},
|
|
243925
|
-
[
|
|
243925
|
+
[AddTokensErrorTypes.SERVICE_BREAKDOWN]: {
|
|
243926
243926
|
headingText: 'Our system is currently down',
|
|
243927
243927
|
subHeadingText: 'We are currently experiencing technical difficulties. Please try again later.',
|
|
243928
243928
|
secondaryButtonText: 'Close',
|
|
243929
243929
|
onSecondaryButtonClick: closeWidget,
|
|
243930
243930
|
},
|
|
243931
|
-
[
|
|
243931
|
+
[AddTokensErrorTypes.TRANSACTION_FAILED]: {
|
|
243932
243932
|
headingText: 'Transaction failed',
|
|
243933
243933
|
subHeadingText: 'The transaction failed. Please try again.',
|
|
243934
243934
|
primaryButtonText: 'Retry',
|
|
243935
|
-
onPrimaryButtonClick:
|
|
243935
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243936
243936
|
secondaryButtonText: 'Close',
|
|
243937
243937
|
onSecondaryButtonClick: closeWidget,
|
|
243938
243938
|
},
|
|
243939
|
-
[
|
|
243939
|
+
[AddTokensErrorTypes.UNRECOGNISED_CHAIN]: {
|
|
243940
243940
|
headingText: 'Unrecognised chain',
|
|
243941
243941
|
subHeadingText: 'Please add the chain to your account and try again.',
|
|
243942
243942
|
primaryButtonText: 'Retry',
|
|
243943
|
-
onPrimaryButtonClick:
|
|
243943
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243944
243944
|
secondaryButtonText: 'Close',
|
|
243945
243945
|
onSecondaryButtonClick: closeWidget,
|
|
243946
243946
|
},
|
|
243947
|
-
[
|
|
243947
|
+
[AddTokensErrorTypes.PROVIDER_ERROR]: {
|
|
243948
243948
|
headingText: 'Wallet cannot be found',
|
|
243949
243949
|
subHeadingText: 'Please try to connect your wallet and try again.',
|
|
243950
243950
|
primaryButtonText: 'Retry',
|
|
243951
|
-
onPrimaryButtonClick:
|
|
243951
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243952
243952
|
secondaryButtonText: 'Close',
|
|
243953
243953
|
onSecondaryButtonClick: closeWidget,
|
|
243954
243954
|
},
|
|
243955
|
-
[
|
|
243955
|
+
[AddTokensErrorTypes.WALLET_FAILED]: {
|
|
243956
243956
|
headingText: 'Transaction failed',
|
|
243957
243957
|
subHeadingText: 'The transaction failed. Please try again.',
|
|
243958
243958
|
primaryButtonText: 'Retry',
|
|
243959
|
-
onPrimaryButtonClick:
|
|
243959
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243960
243960
|
secondaryButtonText: 'Close',
|
|
243961
|
-
onSecondaryButtonClick:
|
|
243961
|
+
onSecondaryButtonClick: goBackToAddTokensView,
|
|
243962
243962
|
},
|
|
243963
|
-
[
|
|
243963
|
+
[AddTokensErrorTypes.WALLET_REJECTED]: {
|
|
243964
243964
|
headingText: 'Transaction rejected',
|
|
243965
243965
|
subHeadingText: "You'll need to approve the transaction in your wallet to proceed.",
|
|
243966
243966
|
primaryButtonText: 'Retry',
|
|
243967
|
-
onPrimaryButtonClick:
|
|
243967
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243968
243968
|
secondaryButtonText: 'Close',
|
|
243969
243969
|
onSecondaryButtonClick: closeWidget,
|
|
243970
243970
|
},
|
|
243971
|
-
[
|
|
243971
|
+
[AddTokensErrorTypes.WALLET_REJECTED_NO_FUNDS]: {
|
|
243972
243972
|
headingText: 'Insufficient funds',
|
|
243973
243973
|
subHeadingText: 'You do not have enough funds to complete the transaction.',
|
|
243974
243974
|
primaryButtonText: 'Retry',
|
|
243975
|
-
onPrimaryButtonClick:
|
|
243975
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243976
243976
|
secondaryButtonText: 'Close',
|
|
243977
243977
|
onSecondaryButtonClick: closeWidget,
|
|
243978
243978
|
},
|
|
243979
|
-
[
|
|
243979
|
+
[AddTokensErrorTypes.WALLET_POPUP_BLOCKED]: {
|
|
243980
243980
|
headingText: "Browser's popup blocked",
|
|
243981
243981
|
subHeadingText: 'Please allow pop-ups in your browser to proceed.',
|
|
243982
243982
|
primaryButtonText: 'Retry',
|
|
243983
|
-
onPrimaryButtonClick:
|
|
243983
|
+
onPrimaryButtonClick: goBackToAddTokensView,
|
|
243984
243984
|
secondaryButtonText: 'Close',
|
|
243985
|
-
onSecondaryButtonClick:
|
|
243985
|
+
onSecondaryButtonClick: goBackToAddTokensView,
|
|
243986
243986
|
},
|
|
243987
|
-
[
|
|
243987
|
+
[AddTokensErrorTypes.ENVIRONMENT_ERROR]: {
|
|
243988
243988
|
headingText: 'Unsupported environment',
|
|
243989
243989
|
subHeadingText: 'This is only supported in production environment.',
|
|
243990
243990
|
secondaryButtonText: 'Close',
|
|
@@ -243994,7 +243994,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
243994
243994
|
const getErrorConfig = (errorType) => errorConfig[errorType];
|
|
243995
243995
|
const showErrorHandover = (errorType, data) => {
|
|
243996
243996
|
page({
|
|
243997
|
-
userJourney: UserJourney.
|
|
243997
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
243998
243998
|
screen: 'Error',
|
|
243999
243999
|
extras: {
|
|
244000
244000
|
errorType,
|
|
@@ -244017,15 +244017,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244017
244017
|
return (jsx$1(Body, { size: "xSmall", sx: {
|
|
244018
244018
|
textAlign: 'center',
|
|
244019
244019
|
color: 'base.color.text.body.secondary',
|
|
244020
|
-
}, children: jsx$1(Trans, { i18nKey: t('views.
|
|
244020
|
+
}, children: jsx$1(Trans, { i18nKey: t('views.ADD_TOKENS.footer.body'), components: {
|
|
244021
244021
|
squidLink: jsx$1(Link, { size: "xSmall", rc: jsx$1("a", { target: "_blank", href: " https://app.squidrouter.com", rel: "noreferrer" }) }),
|
|
244022
244022
|
} }) }));
|
|
244023
244023
|
}
|
|
244024
244024
|
|
|
244025
|
-
function
|
|
244025
|
+
function AddTokens({ checkout, toAmount, config, toTokenAddress, showOnrampOption = true, showSwapOption = true, showBridgeOption = true, onCloseButtonClick, showBackButton, onBackButtonClick, }) {
|
|
244026
244026
|
const { fetchRoutesWithRateLimit, resetRoutes } = useRoutes();
|
|
244027
244027
|
const { showErrorHandover } = useError(config.environment);
|
|
244028
|
-
const {
|
|
244028
|
+
const { addTokensState: { squid, chains, balances, tokens, selectedAmount, routes, selectedRouteData, selectedToken, isSwapAvailable, }, addTokensDispatch, } = reactExports.useContext(AddTokensContext);
|
|
244029
244029
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
244030
244030
|
const { track, page } = useAnalytics();
|
|
244031
244031
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
@@ -244040,7 +244040,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244040
244040
|
const selectedAmountUsd = reactExports.useMemo(() => convertToUsd(tokens, inputValue, selectedToken), [tokens, inputValue, selectedToken]);
|
|
244041
244041
|
const setSelectedAmount = reactExports.useMemo(() => debounce$2((value) => {
|
|
244042
244042
|
track({
|
|
244043
|
-
userJourney: UserJourney.
|
|
244043
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244044
244044
|
screen: 'InputScreen',
|
|
244045
244045
|
control: 'AmountInput',
|
|
244046
244046
|
controlType: 'TextInput',
|
|
@@ -244048,16 +244048,16 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244048
244048
|
toAmount: value,
|
|
244049
244049
|
},
|
|
244050
244050
|
});
|
|
244051
|
-
|
|
244051
|
+
addTokensDispatch({
|
|
244052
244052
|
payload: {
|
|
244053
|
-
type:
|
|
244053
|
+
type: AddTokensActions.SET_SELECTED_AMOUNT,
|
|
244054
244054
|
selectedAmount: value,
|
|
244055
244055
|
},
|
|
244056
244056
|
});
|
|
244057
244057
|
}, 2500), []);
|
|
244058
244058
|
const setSelectedToken = (token) => {
|
|
244059
244059
|
track({
|
|
244060
|
-
userJourney: UserJourney.
|
|
244060
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244061
244061
|
screen: 'InputScreen',
|
|
244062
244062
|
control: 'TokensMenu',
|
|
244063
244063
|
controlType: 'MenuItem',
|
|
@@ -244065,9 +244065,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244065
244065
|
tokenAddress: token?.address,
|
|
244066
244066
|
},
|
|
244067
244067
|
});
|
|
244068
|
-
|
|
244068
|
+
addTokensDispatch({
|
|
244069
244069
|
payload: {
|
|
244070
|
-
type:
|
|
244070
|
+
type: AddTokensActions.SET_SELECTED_TOKEN,
|
|
244071
244071
|
selectedToken: token,
|
|
244072
244072
|
},
|
|
244073
244073
|
});
|
|
@@ -244075,7 +244075,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244075
244075
|
const setSelectedRouteData = (route) => {
|
|
244076
244076
|
if (route) {
|
|
244077
244077
|
track({
|
|
244078
|
-
userJourney: UserJourney.
|
|
244078
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244079
244079
|
screen: 'InputScreen',
|
|
244080
244080
|
control: 'RoutesMenu',
|
|
244081
244081
|
controlType: 'MenuItem',
|
|
@@ -244089,9 +244089,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244089
244089
|
},
|
|
244090
244090
|
});
|
|
244091
244091
|
}
|
|
244092
|
-
|
|
244092
|
+
addTokensDispatch({
|
|
244093
244093
|
payload: {
|
|
244094
|
-
type:
|
|
244094
|
+
type: AddTokensActions.SET_SELECTED_ROUTE_DATA,
|
|
244095
244095
|
selectedRouteData: route,
|
|
244096
244096
|
},
|
|
244097
244097
|
});
|
|
@@ -244122,7 +244122,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244122
244122
|
}), [providers]);
|
|
244123
244123
|
reactExports.useEffect(() => {
|
|
244124
244124
|
page({
|
|
244125
|
-
userJourney: UserJourney.
|
|
244125
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244126
244126
|
screen: 'InputScreen',
|
|
244127
244127
|
extras: {
|
|
244128
244128
|
toAmount,
|
|
@@ -244188,21 +244188,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244188
244188
|
});
|
|
244189
244189
|
setAllowedTokens(updatedTokens);
|
|
244190
244190
|
if (toTokenAddress) {
|
|
244191
|
-
const token =
|
|
244191
|
+
const token = updatedTokens.find((t) => t.address?.toLowerCase() === toTokenAddress.toLowerCase());
|
|
244192
244192
|
if (token) {
|
|
244193
244193
|
setSelectedToken(token);
|
|
244194
244194
|
}
|
|
244195
244195
|
}
|
|
244196
|
-
|
|
244196
|
+
addTokensDispatch({
|
|
244197
244197
|
payload: {
|
|
244198
|
-
type:
|
|
244198
|
+
type: AddTokensActions.SET_ALLOWED_TOKENS,
|
|
244199
244199
|
allowedTokens: tokenResponse.tokens,
|
|
244200
244200
|
},
|
|
244201
244201
|
});
|
|
244202
244202
|
}
|
|
244203
244203
|
}
|
|
244204
244204
|
catch (error) {
|
|
244205
|
-
showErrorHandover(
|
|
244205
|
+
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { error });
|
|
244206
244206
|
}
|
|
244207
244207
|
};
|
|
244208
244208
|
fetchTokens();
|
|
@@ -244221,7 +244221,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244221
244221
|
}
|
|
244222
244222
|
}
|
|
244223
244223
|
catch (error) {
|
|
244224
|
-
showErrorHandover(
|
|
244224
|
+
showErrorHandover(AddTokensErrorTypes.SERVICE_BREAKDOWN, { error });
|
|
244225
244225
|
}
|
|
244226
244226
|
};
|
|
244227
244227
|
fetchOnRampTokens();
|
|
@@ -244232,7 +244232,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244232
244232
|
}, []);
|
|
244233
244233
|
const handleCardClick = () => {
|
|
244234
244234
|
track({
|
|
244235
|
-
userJourney: UserJourney.
|
|
244235
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244236
244236
|
screen: 'InputScreen',
|
|
244237
244237
|
control: 'PayWithCardMenu',
|
|
244238
244238
|
controlType: 'MenuItem',
|
|
@@ -244246,7 +244246,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244246
244246
|
amount: selectedAmount ?? '',
|
|
244247
244247
|
showBackButton: true,
|
|
244248
244248
|
};
|
|
244249
|
-
orchestrationEvents$1.sendRequestOnrampEvent(eventTarget, IMTBLWidgetEvents.
|
|
244249
|
+
orchestrationEvents$1.sendRequestOnrampEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, data);
|
|
244250
244250
|
};
|
|
244251
244251
|
const handleRouteClick = (route) => {
|
|
244252
244252
|
setShowOptionsDrawer(false);
|
|
@@ -244258,7 +244258,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244258
244258
|
if (!selectedRouteData || !selectedToken?.address)
|
|
244259
244259
|
return;
|
|
244260
244260
|
track({
|
|
244261
|
-
userJourney: UserJourney.
|
|
244261
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244262
244262
|
screen: 'InputScreen',
|
|
244263
244263
|
control: 'RoutesMenu',
|
|
244264
244264
|
controlType: 'MenuItem',
|
|
@@ -244275,7 +244275,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244275
244275
|
payload: {
|
|
244276
244276
|
type: ViewActions.UPDATE_VIEW,
|
|
244277
244277
|
view: {
|
|
244278
|
-
type:
|
|
244278
|
+
type: AddTokensWidgetViews.REVIEW,
|
|
244279
244279
|
data: {
|
|
244280
244280
|
balance: selectedRouteData.amountData.balance,
|
|
244281
244281
|
toChainId: ChainId.IMTBL_ZKEVM_MAINNET.toString(),
|
|
@@ -244307,7 +244307,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244307
244307
|
const readyToReview = routeInputsReady && !!toAddress && !!selectedRouteData && !loading;
|
|
244308
244308
|
const handleWalletConnected = (providerType, provider, providerInfo) => {
|
|
244309
244309
|
track({
|
|
244310
|
-
userJourney: UserJourney.
|
|
244310
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
244311
244311
|
screen: 'InputScreen',
|
|
244312
244312
|
control: 'WalletsMenu',
|
|
244313
244313
|
controlType: 'MenuItem',
|
|
@@ -244342,7 +244342,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244342
244342
|
boxShadow: ({ base }) => `0 0 0 ${base.border.size[200]} ${base.color.text.body.primary}`,
|
|
244343
244343
|
},
|
|
244344
244344
|
} })),
|
|
244345
|
-
}), children: tokenChoiceOptions }), showInitialEmptyState ? (jsx$1(Body, { children: "Add Token" })) : (jsxs(HeroFormControl, { validationStatus: inputValue === '0' ? 'error' : 'success', children: [jsxs(HeroFormControl.Label, { children: ["Add", ' ', selectedToken.symbol] }), jsx$1(HeroTextInput, { testId: "add-
|
|
244345
|
+
}), children: tokenChoiceOptions }), showInitialEmptyState ? (jsx$1(Body, { children: "Add Token" })) : (jsxs(HeroFormControl, { validationStatus: inputValue === '0' ? 'error' : 'success', children: [jsxs(HeroFormControl.Label, { children: ["Add", ' ', selectedToken.symbol] }), jsx$1(HeroTextInput, { testId: "add-tokens-amount-input", type: "number", value: inputValue, onChange: (value) => handleOnAmountInputChange(value), placeholder: "0", maxTextSize: "xLarge" }), jsxs(HeroFormControl.Caption, { children: ["USD $", getFormattedNumberWithDecimalPlaces(selectedAmountUsd)] })] }))] }), jsxs(Stack, { testId: "bottomSection", sx: {
|
|
244346
244346
|
alignSelf: 'stretch',
|
|
244347
244347
|
p: 'base.spacing.x3',
|
|
244348
244348
|
pb: 'base.spacing.x5',
|
|
@@ -244363,7 +244363,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
244363
244363
|
} }) }), jsx$1(SelectedWallet, { label: "Deliver to", providerInfo: {
|
|
244364
244364
|
...toProviderInfo,
|
|
244365
244365
|
address: toAddress,
|
|
244366
|
-
}, onClick: () => setShowDeliverToDrawer(true), disabled: lockedToProvider })] }), jsx$1(Button, { testId: "add-
|
|
244366
|
+
}, onClick: () => setShowDeliverToDrawer(true), disabled: lockedToProvider })] }), jsx$1(Button, { testId: "add-tokens-button", size: "large", variant: readyToReview ? 'primary' : 'secondary', disabled: !readyToReview, onClick: handleReviewClick, sx: { opacity: readyToReview ? 1 : 0.5 }, children: "Review" }), jsx$1(SquidFooter, {}), jsx$1(PayWithWalletDrawer, { visible: showPayWithDrawer, walletOptions: walletOptions, onClose: () => setShowPayWithDrawer(false), onPayWithCard: handleCardClick, onConnect: handleWalletConnected, insufficientBalance: insufficientBalance, showOnRampOption: shouldShowOnRampOption }), jsx$1(OptionsDrawer, { checkout: checkout, routes: routes, showOnrampOption: shouldShowOnRampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, visible: showOptionsDrawer, onClose: () => setShowOptionsDrawer(false), onCardClick: handleCardClick, onRouteClick: handleRouteClick, insufficientBalance: insufficientBalance }), jsx$1(DeliverToWalletDrawer, { visible: showDeliverToDrawer, walletOptions: walletOptions, onClose: () => setShowDeliverToDrawer(false) }), jsx$1(OnboardingDrawer, { environment: checkout?.config.environment })] })] }) }));
|
|
244367
244367
|
}
|
|
244368
244368
|
|
|
244369
244369
|
var dist$2 = {};
|
|
@@ -411458,24 +411458,24 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411458
411458
|
const { showErrorHandover } = useError(environment);
|
|
411459
411459
|
const handleTransactionError = (err) => {
|
|
411460
411460
|
const reason = `${err?.reason || err?.message || ''}`.toLowerCase();
|
|
411461
|
-
let errorType =
|
|
411461
|
+
let errorType = AddTokensErrorTypes.WALLET_FAILED;
|
|
411462
411462
|
if (reason.includes('failed') && reason.includes('open confirmation')) {
|
|
411463
|
-
errorType =
|
|
411463
|
+
errorType = AddTokensErrorTypes.WALLET_POPUP_BLOCKED;
|
|
411464
411464
|
}
|
|
411465
411465
|
if (reason.includes('rejected') && reason.includes('user')) {
|
|
411466
|
-
errorType =
|
|
411466
|
+
errorType = AddTokensErrorTypes.WALLET_REJECTED;
|
|
411467
411467
|
}
|
|
411468
411468
|
if (reason.includes('failed to submit')
|
|
411469
411469
|
&& reason.includes('highest gas limit')) {
|
|
411470
|
-
errorType =
|
|
411470
|
+
errorType = AddTokensErrorTypes.WALLET_REJECTED_NO_FUNDS;
|
|
411471
411471
|
}
|
|
411472
411472
|
if (reason.includes('status failed')
|
|
411473
411473
|
|| reason.includes('transaction failed')) {
|
|
411474
|
-
errorType =
|
|
411474
|
+
errorType = AddTokensErrorTypes.TRANSACTION_FAILED;
|
|
411475
411475
|
}
|
|
411476
411476
|
if (reason.includes('unrecognized chain')
|
|
411477
411477
|
|| reason.includes('unrecognized chain')) {
|
|
411478
|
-
errorType =
|
|
411478
|
+
errorType = AddTokensErrorTypes.UNRECOGNISED_CHAIN;
|
|
411479
411479
|
}
|
|
411480
411480
|
const error = {
|
|
411481
411481
|
type: errorType,
|
|
@@ -411531,7 +411531,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411531
411531
|
return MaxUint256$5; // no approval is needed for native tokens
|
|
411532
411532
|
}
|
|
411533
411533
|
catch (error) {
|
|
411534
|
-
showErrorHandover(
|
|
411534
|
+
showErrorHandover(AddTokensErrorTypes.DEFAULT, { error });
|
|
411535
411535
|
return undefined;
|
|
411536
411536
|
}
|
|
411537
411537
|
};
|
|
@@ -411718,7 +411718,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411718
411718
|
function Review({ data, showBackButton = false, onBackButtonClick, onCloseButtonClick, }) {
|
|
411719
411719
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
411720
411720
|
const { track, page } = useAnalytics();
|
|
411721
|
-
const {
|
|
411721
|
+
const { addTokensState: { squid, chains, tokens }, } = reactExports.useContext(AddTokensContext);
|
|
411722
411722
|
const { providersState: { checkout, fromProvider, fromAddress, toAddress, }, } = useProvidersContext();
|
|
411723
411723
|
const [route, setRoute] = reactExports.useState();
|
|
411724
411724
|
const [proceedDisabled, setProceedDisabled] = reactExports.useState(true);
|
|
@@ -411732,7 +411732,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411732
411732
|
const { checkProviderChain, getAllowance, approve, execute, } = useExecute(checkout?.config.environment || Environment$1.SANDBOX);
|
|
411733
411733
|
reactExports.useEffect(() => {
|
|
411734
411734
|
page({
|
|
411735
|
-
userJourney: UserJourney.
|
|
411735
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
411736
411736
|
screen: 'Review',
|
|
411737
411737
|
extras: {
|
|
411738
411738
|
toAmount: data.toAmount,
|
|
@@ -411793,7 +411793,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411793
411793
|
currentFromAddress = await fromProvider.getSigner().getAddress();
|
|
411794
411794
|
}
|
|
411795
411795
|
catch (error) {
|
|
411796
|
-
showErrorHandover(
|
|
411796
|
+
showErrorHandover(AddTokensErrorTypes.PROVIDER_ERROR, { error });
|
|
411797
411797
|
return;
|
|
411798
411798
|
}
|
|
411799
411799
|
if (currentFromAddress !== fromAddress) {
|
|
@@ -411822,7 +411822,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411822
411822
|
const executeTxnReceipt = await execute(squid, changeableProvider, route);
|
|
411823
411823
|
if (executeTxnReceipt) {
|
|
411824
411824
|
track({
|
|
411825
|
-
userJourney: UserJourney.
|
|
411825
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
411826
411826
|
screen: 'FundsAdded',
|
|
411827
411827
|
action: 'Succeeded',
|
|
411828
411828
|
extras: {
|
|
@@ -411909,7 +411909,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411909
411909
|
payload: {
|
|
411910
411910
|
type: ViewActions.UPDATE_VIEW,
|
|
411911
411911
|
view: {
|
|
411912
|
-
type:
|
|
411912
|
+
type: AddTokensWidgetViews.ADD_TOKENS,
|
|
411913
411913
|
},
|
|
411914
411914
|
},
|
|
411915
411915
|
});
|
|
@@ -411993,13 +411993,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
411993
411993
|
return tokens;
|
|
411994
411994
|
};
|
|
411995
411995
|
|
|
411996
|
-
function
|
|
411996
|
+
function AddTokensWidget({ showOnrampOption = true, showSwapOption = true, showBridgeOption = true, toTokenAddress, toAmount, showBackButton, config, }) {
|
|
411997
411997
|
const fetchingBalances = reactExports.useRef(false);
|
|
411998
411998
|
const { base: { colorMode } } = useTheme();
|
|
411999
411999
|
const [viewState, viewDispatch] = reactExports.useReducer(viewReducer, {
|
|
412000
412000
|
...initialViewState,
|
|
412001
|
-
view: { type:
|
|
412002
|
-
history: [{ type:
|
|
412001
|
+
view: { type: AddTokensWidgetViews.ADD_TOKENS },
|
|
412002
|
+
history: [{ type: AddTokensWidgetViews.ADD_TOKENS }],
|
|
412003
412003
|
});
|
|
412004
412004
|
const { t } = useTranslation();
|
|
412005
412005
|
const { page } = useAnalytics();
|
|
@@ -412007,28 +412007,28 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412007
412007
|
viewState,
|
|
412008
412008
|
viewDispatch,
|
|
412009
412009
|
}), [viewState, viewReducer]);
|
|
412010
|
-
const [
|
|
412010
|
+
const [addTokensState, addTokensDispatch] = reactExports.useReducer(addTokensReducer, initialAddTokensState);
|
|
412011
412011
|
const { providersState: { checkout, fromProvider }, } = useProvidersContext();
|
|
412012
|
-
const { squid, chains } =
|
|
412013
|
-
const
|
|
412014
|
-
|
|
412015
|
-
|
|
412016
|
-
}), [
|
|
412012
|
+
const { squid, chains } = addTokensState;
|
|
412013
|
+
const addTokensReducerValues = reactExports.useMemo(() => ({
|
|
412014
|
+
addTokensState,
|
|
412015
|
+
addTokensDispatch,
|
|
412016
|
+
}), [addTokensState, addTokensDispatch]);
|
|
412017
412017
|
const squidSdk = useSquid(checkout);
|
|
412018
412018
|
const tokensResponse = useTokens(checkout);
|
|
412019
412019
|
const { showErrorHandover } = useError(checkout.config.environment);
|
|
412020
412020
|
reactExports.useEffect(() => {
|
|
412021
412021
|
if (config.environment !== Environment$1.PRODUCTION) {
|
|
412022
|
-
showErrorHandover(
|
|
412022
|
+
showErrorHandover(AddTokensErrorTypes.ENVIRONMENT_ERROR);
|
|
412023
412023
|
}
|
|
412024
412024
|
}, [config]);
|
|
412025
412025
|
reactExports.useEffect(() => {
|
|
412026
412026
|
if (!checkout)
|
|
412027
412027
|
return;
|
|
412028
412028
|
(async () => {
|
|
412029
|
-
|
|
412029
|
+
addTokensDispatch({
|
|
412030
412030
|
payload: {
|
|
412031
|
-
type:
|
|
412031
|
+
type: AddTokensActions.SET_IS_SWAP_AVAILABLE,
|
|
412032
412032
|
isSwapAvailable: await checkout.isSwapAvailable(),
|
|
412033
412033
|
},
|
|
412034
412034
|
});
|
|
@@ -412038,15 +412038,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412038
412038
|
const isInvalidToTokenAddress = toTokenAddress && !isValidAddress(toTokenAddress);
|
|
412039
412039
|
const isInvalidToAmount = toAmount && !amountInputValidation(toAmount);
|
|
412040
412040
|
if (isInvalidToTokenAddress || isInvalidToAmount) {
|
|
412041
|
-
showErrorHandover(
|
|
412041
|
+
showErrorHandover(AddTokensErrorTypes.INVALID_PARAMETERS);
|
|
412042
412042
|
}
|
|
412043
412043
|
}, [toTokenAddress, toAmount]);
|
|
412044
412044
|
reactExports.useEffect(() => {
|
|
412045
412045
|
(async () => {
|
|
412046
412046
|
const chainsResponse = await fetchChains();
|
|
412047
|
-
|
|
412047
|
+
addTokensDispatch({
|
|
412048
412048
|
payload: {
|
|
412049
|
-
type:
|
|
412049
|
+
type: AddTokensActions.SET_CHAINS,
|
|
412050
412050
|
chains: chainsResponse,
|
|
412051
412051
|
},
|
|
412052
412052
|
});
|
|
@@ -412060,9 +412060,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412060
412060
|
fetchingBalances.current = true;
|
|
412061
412061
|
const evmChains = chains.filter((chain) => chain.type === 'evm');
|
|
412062
412062
|
const balances = await fetchBalances(squid, evmChains, fromProvider);
|
|
412063
|
-
|
|
412063
|
+
addTokensDispatch({
|
|
412064
412064
|
payload: {
|
|
412065
|
-
type:
|
|
412065
|
+
type: AddTokensActions.SET_BALANCES,
|
|
412066
412066
|
balances,
|
|
412067
412067
|
},
|
|
412068
412068
|
});
|
|
@@ -412075,9 +412075,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412075
412075
|
reactExports.useEffect(() => {
|
|
412076
412076
|
if (!squidSdk)
|
|
412077
412077
|
return;
|
|
412078
|
-
|
|
412078
|
+
addTokensDispatch({
|
|
412079
412079
|
payload: {
|
|
412080
|
-
type:
|
|
412080
|
+
type: AddTokensActions.SET_SQUID,
|
|
412081
412081
|
squid: squidSdk,
|
|
412082
412082
|
},
|
|
412083
412083
|
});
|
|
@@ -412085,9 +412085,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412085
412085
|
reactExports.useEffect(() => {
|
|
412086
412086
|
if (!tokensResponse)
|
|
412087
412087
|
return;
|
|
412088
|
-
|
|
412088
|
+
addTokensDispatch({
|
|
412089
412089
|
payload: {
|
|
412090
|
-
type:
|
|
412090
|
+
type: AddTokensActions.SET_TOKENS,
|
|
412091
412091
|
tokens: tokensResponse,
|
|
412092
412092
|
},
|
|
412093
412093
|
});
|
|
@@ -412097,36 +412097,36 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
412097
412097
|
viewDispatch({
|
|
412098
412098
|
payload: {
|
|
412099
412099
|
type: ViewActions.UPDATE_VIEW,
|
|
412100
|
-
view: { type:
|
|
412100
|
+
view: { type: AddTokensWidgetViews.ADD_TOKENS },
|
|
412101
412101
|
},
|
|
412102
412102
|
});
|
|
412103
412103
|
};
|
|
412104
|
-
return (jsx$1(ViewContext.Provider, { value: viewReducerValues, children: jsx$1(
|
|
412104
|
+
return (jsx$1(ViewContext.Provider, { value: viewReducerValues, children: jsx$1(AddTokensContext.Provider, { value: addTokensReducerValues, children: jsxs(Stack, { sx: { pos: 'relative' }, children: [jsx$1(CloudImage, { use: (jsx$1("img", { src: getRemoteImage(config.environment, `/add-tokens-bg-texture-${colorMode}.webp`), alt: "blurry bg texture" })), sx: {
|
|
412105
412105
|
pos: 'absolute',
|
|
412106
412106
|
h: '100%',
|
|
412107
412107
|
w: '100%',
|
|
412108
412108
|
objectFit: 'cover',
|
|
412109
412109
|
objectPosition: 'center',
|
|
412110
|
-
} }), viewState.view.type ===
|
|
412111
|
-
orchestrationEvents$1.sendRequestGoBackEvent(eventTarget, IMTBLWidgetEvents.
|
|
412112
|
-
} })), viewState.view.type ===
|
|
412110
|
+
} }), viewState.view.type === AddTokensWidgetViews.ADD_TOKENS && (jsx$1(AddTokens, { config: config, checkout: checkout, toTokenAddress: toTokenAddress, toAmount: toAmount, showBackButton: showBackButton, showOnrampOption: showOnrampOption, showSwapOption: showSwapOption, showBridgeOption: showBridgeOption, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
412111
|
+
orchestrationEvents$1.sendRequestGoBackEvent(eventTarget, IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT, {});
|
|
412112
|
+
} })), viewState.view.type === AddTokensWidgetViews.REVIEW && (jsx$1(Review, { data: viewState.view.data, onCloseButtonClick: () => sendAddTokensCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
412113
412113
|
viewDispatch({
|
|
412114
412114
|
payload: {
|
|
412115
412115
|
type: ViewActions.GO_BACK,
|
|
412116
412116
|
},
|
|
412117
412117
|
});
|
|
412118
|
-
}, showBackButton: true })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx$1(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: errorAction, onCloseClick: () =>
|
|
412118
|
+
}, showBackButton: true })), viewState.view.type === SharedViews.ERROR_VIEW && (jsx$1(ErrorView, { actionText: t('views.ERROR_VIEW.actionText'), onActionClick: errorAction, onCloseClick: () => sendAddTokensCloseEvent(eventTarget), errorEventAction: () => {
|
|
412119
412119
|
page({
|
|
412120
|
-
userJourney: UserJourney.
|
|
412120
|
+
userJourney: UserJourney.ADD_TOKENS,
|
|
412121
412121
|
screen: 'Error',
|
|
412122
412122
|
});
|
|
412123
412123
|
} })), viewState.view.type
|
|
412124
|
-
=== SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx$1(ServiceUnavailableErrorView, { service: ServiceType.GENERIC, onCloseClick: () =>
|
|
412124
|
+
=== SharedViews.SERVICE_UNAVAILABLE_ERROR_VIEW && (jsx$1(ServiceUnavailableErrorView, { service: ServiceType.GENERIC, onCloseClick: () => sendAddTokensCloseEvent(eventTarget) }))] }) }) }));
|
|
412125
412125
|
}
|
|
412126
412126
|
|
|
412127
|
-
var
|
|
412127
|
+
var AddTokensWidget$1 = /*#__PURE__*/Object.freeze({
|
|
412128
412128
|
__proto__: null,
|
|
412129
|
-
default:
|
|
412129
|
+
default: AddTokensWidget
|
|
412130
412130
|
});
|
|
412131
412131
|
|
|
412132
412132
|
/**
|
|
@@ -413360,7 +413360,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
413360
413360
|
function TopUpView({ widgetEvent, checkout,
|
|
413361
413361
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
413362
413362
|
provider, // Keep this for future use
|
|
413363
|
-
showOnrampOption, showSwapOption, showBridgeOption,
|
|
413363
|
+
showOnrampOption, showSwapOption, showBridgeOption, showAddTokensOption, tokenAddress, amount, analytics, onCloseButtonClick, onBackButtonClick, heading, subheading, }) {
|
|
413364
413364
|
const { t } = useTranslation();
|
|
413365
413365
|
const { userJourney } = analytics;
|
|
413366
413366
|
const { viewDispatch } = reactExports.useContext(ViewContext);
|
|
@@ -413387,15 +413387,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
413387
413387
|
useMount(() => {
|
|
413388
413388
|
page({ userJourney, screen: 'TopUp' });
|
|
413389
413389
|
});
|
|
413390
|
-
// Go to add
|
|
413390
|
+
// Go to add tokens widget if available
|
|
413391
413391
|
useMount(() => {
|
|
413392
|
-
if (
|
|
413393
|
-
orchestrationEvents$1.
|
|
413392
|
+
if (showAddTokensOption) {
|
|
413393
|
+
orchestrationEvents$1.sendRequestAddTokensEvent(eventTarget, widgetEvent, {
|
|
413394
413394
|
toTokenAddress: tokenAddress ?? '',
|
|
413395
413395
|
toAmount: amount ?? '',
|
|
413396
413396
|
});
|
|
413397
413397
|
}
|
|
413398
|
-
}, () =>
|
|
413398
|
+
}, () => showAddTokensOption !== undefined, [showAddTokensOption]);
|
|
413399
413399
|
reactExports.useEffect(() => {
|
|
413400
413400
|
if (!cryptoFiatDispatch)
|
|
413401
413401
|
return;
|
|
@@ -413576,10 +413576,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
413576
413576
|
isAvailable: true,
|
|
413577
413577
|
isEnabled: showBridgeOption,
|
|
413578
413578
|
},
|
|
413579
|
-
], [
|
|
413579
|
+
], [showAddTokensOption, showBridgeOption, showOnrampOption, showSwapOption]);
|
|
413580
413580
|
// if swap is available, don't show top up view
|
|
413581
|
-
// await for redirect to add
|
|
413582
|
-
if (
|
|
413581
|
+
// await for redirect to add tokens widget
|
|
413582
|
+
if (showAddTokensOption)
|
|
413583
413583
|
return null;
|
|
413584
413584
|
return (jsx$1(SimpleLayout, { header: (jsx$1(HeaderNavigation, { onBackButtonClick: onBackButtonClick, onCloseButtonClick: onCloseButtonClick, showBack: true })), children: jsxs(Box, { sx: { paddingX: 'base.spacing.x4', paddingY: 'base.spacing.x4' }, children: [jsx$1(Heading, { size: "small", children: title }), description && (jsx$1(Body, { size: "small", sx: { color: 'base.color.text.body.secondary' }, children: description })), jsx$1(Box, { sx: { paddingY: 'base.spacing.x4' }, children: topUpFeatures
|
|
413585
413585
|
.sort((a, b) => Number(b.isAvailable) - Number(a.isAvailable))
|
|
@@ -419448,9 +419448,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419448
419448
|
isSwapEnabled: action.payload.supportedTopUps.isSwapEnabled ?? true,
|
|
419449
419449
|
isOnRampEnabled: action.payload.supportedTopUps.isOnRampEnabled ?? true,
|
|
419450
419450
|
isBridgeEnabled: action.payload.supportedTopUps.isBridgeEnabled ?? true,
|
|
419451
|
-
|
|
419451
|
+
isAddTokensEnabled: action.payload.supportedTopUps.isAddTokensEnabled ?? true,
|
|
419452
419452
|
isSwapAvailable: action.payload.supportedTopUps.isSwapAvailable ?? true,
|
|
419453
|
-
|
|
419453
|
+
isAddTokensAvailable: action.payload.supportedTopUps.isAddTokensAvailable ?? true,
|
|
419454
419454
|
},
|
|
419455
419455
|
};
|
|
419456
419456
|
default:
|
|
@@ -419526,7 +419526,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419526
419526
|
const [isOnRampEnabled, setIsOnRampEnabled] = reactExports.useState();
|
|
419527
419527
|
const [isBridgeEnabled, setIsBridgeEnabled] = reactExports.useState();
|
|
419528
419528
|
const [isSwapEnabled, setIsSwapEnabled] = reactExports.useState();
|
|
419529
|
-
const [
|
|
419529
|
+
const [isAddTokensEnabled, setIsAddTokensEnabled] = reactExports.useState();
|
|
419530
419530
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
419531
419531
|
const [onRampAllowedTokens, setOnRampAllowedTokens] = reactExports.useState([]);
|
|
419532
419532
|
const [swapAllowedTokens, setSwapAllowedTokens] = reactExports.useState([]);
|
|
@@ -419551,9 +419551,9 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419551
419551
|
reactExports.useEffect(() => {
|
|
419552
419552
|
if (!network || !supportedTopUps || !checkout)
|
|
419553
419553
|
return;
|
|
419554
|
-
const enableAddCoin = (supportedTopUps?.
|
|
419554
|
+
const enableAddCoin = (supportedTopUps?.isAddTokensEnabled ?? true)
|
|
419555
419555
|
&& (supportedTopUps?.isSwapAvailable ?? true);
|
|
419556
|
-
|
|
419556
|
+
setIsAddTokensEnabled(enableAddCoin);
|
|
419557
419557
|
const enableBuyCoin = !enableAddCoin
|
|
419558
419558
|
&& network.chainId === getL2ChainId(checkout.config)
|
|
419559
419559
|
&& (supportedTopUps?.isOnRampEnabled ?? true);
|
|
@@ -419573,14 +419573,14 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419573
419573
|
const canBuy = Boolean(isOnRampEnabled
|
|
419574
419574
|
&& onRampAllowedTokens.length > 0
|
|
419575
419575
|
&& onRampAllowedTokens.find((token) => token.address?.toLowerCase() === balanceInfo.address?.toLowerCase()));
|
|
419576
|
-
const canAdd = Boolean(
|
|
419576
|
+
const canAdd = Boolean(isAddTokensEnabled
|
|
419577
419577
|
&& swapAllowedTokens.length > 0
|
|
419578
419578
|
&& swapAllowedTokens.find((token) => token.address?.toLowerCase() === balanceInfo.address?.toLowerCase()));
|
|
419579
419579
|
return canBuy || canAdd;
|
|
419580
419580
|
}, [
|
|
419581
419581
|
isOnRampEnabled,
|
|
419582
419582
|
onRampAllowedTokens,
|
|
419583
|
-
|
|
419583
|
+
isAddTokensEnabled,
|
|
419584
419584
|
swapAllowedTokens,
|
|
419585
419585
|
]);
|
|
419586
419586
|
const handleAddTokenClick = () => {
|
|
@@ -419594,8 +419594,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419594
419594
|
tokenAddress: balanceInfo.address,
|
|
419595
419595
|
},
|
|
419596
419596
|
});
|
|
419597
|
-
if (
|
|
419598
|
-
orchestrationEvents$1.
|
|
419597
|
+
if (isAddTokensEnabled) {
|
|
419598
|
+
orchestrationEvents$1.sendRequestAddTokensEvent(eventTarget, IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT, {
|
|
419599
419599
|
toAmount: '',
|
|
419600
419600
|
toTokenAddress: balanceInfo.address ?? '',
|
|
419601
419601
|
});
|
|
@@ -419606,7 +419606,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
419606
419606
|
amount: '',
|
|
419607
419607
|
});
|
|
419608
419608
|
};
|
|
419609
|
-
return (jsxs(MenuItem, { testId: `balance-item-${balanceInfo.symbol}`, emphasized: true, children: [jsx$1(MenuItem.FramedImage, { use: (jsx$1(TokenImage, { theme: theme, src: balanceInfo.icon, name: balanceInfo.symbol, environment: checkout?.config.environment ?? Environment$1.PRODUCTION })), circularFrame: true }), jsx$1(MenuItem.Label, { children: balanceInfo.symbol }), jsx$1(MenuItem.Caption, { children: balanceInfo.description }), jsx$1(MenuItem.PriceDisplay, { testId: `balance-item-${balanceInfo.symbol}`, price: tokenValueFormat(balanceInfo.balance), fiatAmount: fiatAmount }), (isOnRampEnabled || isSwapEnabled || isBridgeEnabled ||
|
|
419609
|
+
return (jsxs(MenuItem, { testId: `balance-item-${balanceInfo.symbol}`, emphasized: true, children: [jsx$1(MenuItem.FramedImage, { use: (jsx$1(TokenImage, { theme: theme, src: balanceInfo.icon, name: balanceInfo.symbol, environment: checkout?.config.environment ?? Environment$1.PRODUCTION })), circularFrame: true }), jsx$1(MenuItem.Label, { children: balanceInfo.symbol }), jsx$1(MenuItem.Caption, { children: balanceInfo.description }), jsx$1(MenuItem.PriceDisplay, { testId: `balance-item-${balanceInfo.symbol}`, price: tokenValueFormat(balanceInfo.balance), fiatAmount: fiatAmount }), (isOnRampEnabled || isSwapEnabled || isBridgeEnabled || isAddTokensEnabled) && (jsxs(MenuItem.OverflowPopoverMenu, { size: "small", testId: "token-menu", onClick: () => {
|
|
419610
419610
|
track({
|
|
419611
419611
|
userJourney: UserJourney.WALLET,
|
|
419612
419612
|
screen: 'WalletBalances',
|
|
@@ -420146,7 +420146,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
420146
420146
|
const errorActionText = t('views.ERROR_VIEW.actionText');
|
|
420147
420147
|
const loadingText = t('views.LOADING_VIEW.text');
|
|
420148
420148
|
const { eventTargetState: { eventTarget }, } = reactExports.useContext(EventTargetContext);
|
|
420149
|
-
const { config: { environment, isOnRampEnabled, isSwapEnabled, isBridgeEnabled,
|
|
420149
|
+
const { config: { environment, isOnRampEnabled, isSwapEnabled, isBridgeEnabled, isAddTokensEnabled, theme, }, walletConfig: { showDisconnectButton, showNetworkMenu, }, } = props;
|
|
420150
420150
|
const { connectLoaderState: { checkout, provider }, } = reactExports.useContext(ConnectLoaderContext);
|
|
420151
420151
|
const [viewState, viewDispatch] = reactExports.useReducer(viewReducer, {
|
|
420152
420152
|
...initialViewState,
|
|
@@ -420191,10 +420191,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
420191
420191
|
checkSwapAvailable = await checkout.isSwapAvailable();
|
|
420192
420192
|
}
|
|
420193
420193
|
catch { /* */ }
|
|
420194
|
-
let
|
|
420194
|
+
let checkAddTokensEnabled = isAddTokensEnabled;
|
|
420195
420195
|
try {
|
|
420196
|
-
const
|
|
420197
|
-
|
|
420196
|
+
const addTokensConfig = await checkout.config.remote.getConfig('addTokens');
|
|
420197
|
+
checkAddTokensEnabled = addTokensConfig.enabled && isAddTokensEnabled;
|
|
420198
420198
|
}
|
|
420199
420199
|
catch { /* */ }
|
|
420200
420200
|
walletDispatch({
|
|
@@ -420205,8 +420205,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
420205
420205
|
isSwapEnabled,
|
|
420206
420206
|
isOnRampEnabled,
|
|
420207
420207
|
isSwapAvailable: checkSwapAvailable,
|
|
420208
|
-
|
|
420209
|
-
|
|
420208
|
+
isAddTokensEnabled: checkAddTokensEnabled,
|
|
420209
|
+
isAddTokensAvailable: checkSwapAvailable && checkAddTokensEnabled,
|
|
420210
420210
|
},
|
|
420211
420211
|
},
|
|
420212
420212
|
});
|
|
@@ -420268,7 +420268,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
420268
420268
|
await initialiseWallet();
|
|
420269
420269
|
};
|
|
420270
420270
|
return (jsx$1(ViewContext.Provider, { value: viewReducerValues, children: jsx$1(CryptoFiatProvider, { environment: environment, children: jsxs(WalletContext.Provider, { value: walletReducerValues, children: [viewState.view.type === SharedViews.LOADING_VIEW && (jsx$1(LoadingView, { loadingText: loadingText })), viewState.view.type === WalletWidgetViews.WALLET_BALANCES && (jsx$1(WalletBalances, { balancesLoading: balancesLoading, theme: theme, showNetworkMenu: showNetworkMenu })), viewState.view.type === WalletWidgetViews.SETTINGS
|
|
420271
|
-
&& (jsx$1(Settings, { showDisconnectButton: showDisconnectButton })), viewState.view.type === WalletWidgetViews.COIN_INFO && (jsx$1(CoinInfo, {})), viewState.view.type === SharedViews.ERROR_VIEW && (jsx$1(ErrorView, { actionText: errorActionText, onActionClick: errorAction, onCloseClick: () => sendWalletWidgetCloseEvent(eventTarget) })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx$1(TopUpView, { analytics: { userJourney: UserJourney.WALLET }, widgetEvent: IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT, checkout: checkout, showOnrampOption: isOnRampEnabled, showSwapOption: isSwapEnabled, showBridgeOption: isBridgeEnabled,
|
|
420271
|
+
&& (jsx$1(Settings, { showDisconnectButton: showDisconnectButton })), viewState.view.type === WalletWidgetViews.COIN_INFO && (jsx$1(CoinInfo, {})), viewState.view.type === SharedViews.ERROR_VIEW && (jsx$1(ErrorView, { actionText: errorActionText, onActionClick: errorAction, onCloseClick: () => sendWalletWidgetCloseEvent(eventTarget) })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx$1(TopUpView, { analytics: { userJourney: UserJourney.WALLET }, widgetEvent: IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT, checkout: checkout, showOnrampOption: isOnRampEnabled, showSwapOption: isSwapEnabled, showBridgeOption: isBridgeEnabled, showAddTokensOption: supportedTopUps?.isAddTokensAvailable, onCloseButtonClick: () => sendWalletWidgetCloseEvent(eventTarget) }))] }) }) }));
|
|
420272
420272
|
}
|
|
420273
420273
|
|
|
420274
420274
|
var WalletWidget$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -422963,13 +422963,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
422963
422963
|
const [viewState, viewDispatch] = reactExports.useReducer(viewReducer, initialViewState);
|
|
422964
422964
|
const viewReducerValues = reactExports.useMemo(() => ({ viewState, viewDispatch }), [viewState, viewDispatch]);
|
|
422965
422965
|
const loadingText = viewState.view.data?.loadingText || t('views.LOADING_VIEW.text');
|
|
422966
|
-
const
|
|
422966
|
+
const isAddTokensAvailable = useAsyncMemo(async () => {
|
|
422967
422967
|
if (!checkout)
|
|
422968
422968
|
return false;
|
|
422969
422969
|
try {
|
|
422970
422970
|
const isSwapAvailable = await checkout.isSwapAvailable();
|
|
422971
|
-
const
|
|
422972
|
-
return
|
|
422971
|
+
const addTokensConfig = (await checkout.config.remote.getConfig('addTokens'));
|
|
422972
|
+
return addTokensConfig.enabled && isSwapAvailable;
|
|
422973
422973
|
}
|
|
422974
422974
|
catch (error) {
|
|
422975
422975
|
return false;
|
|
@@ -423017,7 +423017,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423017
423017
|
customOrderData,
|
|
423018
423018
|
waitFulfillmentSettlements,
|
|
423019
423019
|
hideExcludedPaymentTypes,
|
|
423020
|
-
}, children: jsxs(CryptoFiatProvider, { environment: config.environment, children: [viewState.view.type === SharedViews.LOADING_VIEW && (jsx$1(LoadingView, { loadingText: loadingText })), viewState.view.type === SaleWidgetViews.PAYMENT_METHODS && (jsx$1(PaymentMethods, {})), viewState.view.type === SaleWidgetViews.PAY_WITH_CARD && (jsx$1(PayWithCard, {})), viewState.view.type === SaleWidgetViews.PAY_WITH_COINS && (jsx$1(PayWithCoins, {})), viewState.view.type === SaleWidgetViews.SALE_FAIL && (jsx$1(SaleErrorView, { biomeTheme: biomeTheme, errorType: viewState.view.data?.errorType, transactionHash: viewState.view.data?.transactionHash, blockExplorerLink: BlockExplorerService.getTransactionLink(chainId.current, viewState.view.data?.transactionHash) })), viewState.view.type === SaleWidgetViews.ORDER_SUMMARY && (jsx$1(OrderSummary, { subView: viewState.view.subView })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx$1(TopUpView, { analytics: { userJourney: UserJourney.SALE }, widgetEvent: IMTBLWidgetEvents.IMTBL_SALE_WIDGET_EVENT, checkout: checkout, provider: provider, showOnrampOption: config.isOnRampEnabled, showSwapOption: false, showBridgeOption: config.isBridgeEnabled,
|
|
423020
|
+
}, children: jsxs(CryptoFiatProvider, { environment: config.environment, children: [viewState.view.type === SharedViews.LOADING_VIEW && (jsx$1(LoadingView, { loadingText: loadingText })), viewState.view.type === SaleWidgetViews.PAYMENT_METHODS && (jsx$1(PaymentMethods, {})), viewState.view.type === SaleWidgetViews.PAY_WITH_CARD && (jsx$1(PayWithCard, {})), viewState.view.type === SaleWidgetViews.PAY_WITH_COINS && (jsx$1(PayWithCoins, {})), viewState.view.type === SaleWidgetViews.SALE_FAIL && (jsx$1(SaleErrorView, { biomeTheme: biomeTheme, errorType: viewState.view.data?.errorType, transactionHash: viewState.view.data?.transactionHash, blockExplorerLink: BlockExplorerService.getTransactionLink(chainId.current, viewState.view.data?.transactionHash) })), viewState.view.type === SaleWidgetViews.ORDER_SUMMARY && (jsx$1(OrderSummary, { subView: viewState.view.subView })), viewState.view.type === SharedViews.TOP_UP_VIEW && (jsx$1(TopUpView, { analytics: { userJourney: UserJourney.SALE }, widgetEvent: IMTBLWidgetEvents.IMTBL_SALE_WIDGET_EVENT, checkout: checkout, provider: provider, showOnrampOption: config.isOnRampEnabled, showSwapOption: false, showBridgeOption: config.isBridgeEnabled, showAddTokensOption: isAddTokensAvailable, onCloseButtonClick: () => sendSaleWidgetCloseEvent(eventTarget), onBackButtonClick: () => {
|
|
423021
423021
|
viewDispatch({
|
|
423022
423022
|
payload: {
|
|
423023
423023
|
type: ViewActions.UPDATE_VIEW,
|
|
@@ -423045,7 +423045,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423045
423045
|
* List of views that require a providers context wrapper
|
|
423046
423046
|
*/
|
|
423047
423047
|
const providersContextFlows = [
|
|
423048
|
-
CommerceFlowType.
|
|
423048
|
+
CommerceFlowType.ADD_TOKENS,
|
|
423049
423049
|
];
|
|
423050
423050
|
/**
|
|
423051
423051
|
* Check if the given view requires a connected wallet
|
|
@@ -423159,13 +423159,13 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423159
423159
|
}
|
|
423160
423160
|
}
|
|
423161
423161
|
/**
|
|
423162
|
-
* Map Add
|
|
423162
|
+
* Map Add Tokens Widget Events
|
|
423163
423163
|
*/
|
|
423164
|
-
function
|
|
423164
|
+
function mapAddTokensWidgetEvent(event) {
|
|
423165
423165
|
const { type } = event.detail;
|
|
423166
423166
|
switch (type) {
|
|
423167
423167
|
default:
|
|
423168
|
-
throw new Error(`Unknown add
|
|
423168
|
+
throw new Error(`Unknown add tokens event type "${event.detail.type}"`);
|
|
423169
423169
|
}
|
|
423170
423170
|
}
|
|
423171
423171
|
/**
|
|
@@ -423315,8 +423315,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423315
423315
|
return mapWalletWidgetEvent(event);
|
|
423316
423316
|
case IMTBLWidgetEvents.IMTBL_SWAP_WIDGET_EVENT:
|
|
423317
423317
|
return mapSwapWidgetEvent(event);
|
|
423318
|
-
case IMTBLWidgetEvents.
|
|
423319
|
-
return
|
|
423318
|
+
case IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT:
|
|
423319
|
+
return mapAddTokensWidgetEvent(event);
|
|
423320
423320
|
case IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT:
|
|
423321
423321
|
return mapBridgeWidgetEvent(event);
|
|
423322
423322
|
case IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT:
|
|
@@ -423343,8 +423343,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423343
423343
|
return CommerceFlowType.BRIDGE;
|
|
423344
423344
|
case OrchestrationEventType.REQUEST_ONRAMP:
|
|
423345
423345
|
return CommerceFlowType.ONRAMP;
|
|
423346
|
-
case OrchestrationEventType.
|
|
423347
|
-
return CommerceFlowType.
|
|
423346
|
+
case OrchestrationEventType.REQUEST_ADD_TOKENS:
|
|
423347
|
+
return CommerceFlowType.ADD_TOKENS;
|
|
423348
423348
|
default:
|
|
423349
423349
|
return null;
|
|
423350
423350
|
}
|
|
@@ -423357,7 +423357,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423357
423357
|
OrchestrationEventType.REQUEST_SWAP,
|
|
423358
423358
|
OrchestrationEventType.REQUEST_BRIDGE,
|
|
423359
423359
|
OrchestrationEventType.REQUEST_ONRAMP,
|
|
423360
|
-
OrchestrationEventType.
|
|
423360
|
+
OrchestrationEventType.REQUEST_ADD_TOKENS,
|
|
423361
423361
|
OrchestrationEventType.REQUEST_GO_BACK,
|
|
423362
423362
|
];
|
|
423363
423363
|
/**
|
|
@@ -423375,7 +423375,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423375
423375
|
IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT,
|
|
423376
423376
|
IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT,
|
|
423377
423377
|
IMTBLWidgetEvents.IMTBL_SALE_WIDGET_EVENT,
|
|
423378
|
-
IMTBLWidgetEvents.
|
|
423378
|
+
IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT,
|
|
423379
423379
|
];
|
|
423380
423380
|
/**
|
|
423381
423381
|
* Subscribe and Handle widget events
|
|
@@ -423459,7 +423459,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423459
423459
|
],
|
|
423460
423460
|
};
|
|
423461
423461
|
case CommerceFlowType.ONRAMP:
|
|
423462
|
-
case CommerceFlowType.
|
|
423462
|
+
case CommerceFlowType.ADD_TOKENS:
|
|
423463
423463
|
return {
|
|
423464
423464
|
checkout,
|
|
423465
423465
|
web3Provider,
|
|
@@ -423577,7 +423577,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
423577
423577
|
type: CommerceEventType.CLOSE,
|
|
423578
423578
|
data: {},
|
|
423579
423579
|
});
|
|
423580
|
-
}, ...(view.data.params || {}) })), view.type === CommerceFlowType.BRIDGE && (jsx$1(BridgeWidget, { config: widgetsConfig, checkout: checkout, web3Provider: web3Provider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && (jsx$1(ProvidersContextProvider, { initialState: { checkout }, children: view.type === CommerceFlowType.
|
|
423580
|
+
}, ...(view.data.params || {}) })), view.type === CommerceFlowType.BRIDGE && (jsx$1(BridgeWidget, { config: widgetsConfig, checkout: checkout, web3Provider: web3Provider, showBackButton: showBackButton, ...(view.data.params || {}) })), shouldWrapWithProvidersContext && (jsx$1(ProvidersContextProvider, { initialState: { checkout }, children: view.type === CommerceFlowType.ADD_TOKENS && (jsx$1(AddTokensWidget, { config: widgetsConfig, ...(view.data.params || {}), ...(view.data.config || {}), showBackButton: showBackButton })) })), shouldWrapWithConnectLoader && (jsx$1(ConnectLoader, { widgetConfig: widgetsConfig, params: connectLoaderParams, closeEvent: () => {
|
|
423581
423581
|
sendCheckoutEvent(eventTarget, {
|
|
423582
423582
|
type: CommerceEventType.CLOSE,
|
|
423583
423583
|
data: {},
|