@imtbl/sdk 1.30.5-alpha → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-547ebd7f.js → BridgeWidget-377683ea.js} +1 -1
- package/dist/browser/checkout/{HorizontalMenu-7b0c87f0.js → HorizontalMenu-aa779396.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-a134bb5a.js → OnRampWidget-4e8905a3.js} +2 -2
- package/dist/browser/checkout/SaleWidget-3bf40e0b.js +1 -0
- package/dist/browser/checkout/{SpendingCapHero-ae6ec432.js → SpendingCapHero-8c25b84a.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-b45fbcf6.js → SwapWidget-f9379c1a.js} +1 -1
- package/dist/browser/checkout/{TopUpView-5e33fc57.js → TopUpView-00d1f7a6.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-d5f68b69.js → WalletWidget-61bd9efc.js} +1 -1
- package/dist/browser/checkout/{auto-track-c4b0d51c.js → auto-track-37c549ea.js} +1 -1
- package/dist/browser/checkout/{balance-f8adfbad.js → balance-a23933fd.js} +1 -1
- package/dist/browser/checkout/{index-e89e8900.js → index-043fc43e.js} +2 -2
- package/dist/browser/checkout/{index-f834a944.js → index-31a1c06d.js} +1 -1
- package/dist/browser/checkout/{index-4d6421f6.js → index-4a9647eb.js} +1 -1
- package/dist/browser/checkout/{index-ee4f35a6.js → index-65e2d3dc.js} +1 -1
- package/dist/browser/checkout/{index-53026566.js → index-95416067.js} +1 -1
- package/dist/browser/checkout/{index-f0773942.js → index-a03f2a49.js} +1 -1
- package/dist/browser/checkout/index-ab23c781.js +1 -0
- package/dist/browser/checkout/{index-9634649e.js → index-c3ad2d33.js} +1 -1
- package/dist/browser/checkout/{index.umd-592ef339.js → index.umd-80b06160.js} +1 -1
- package/dist/browser/checkout/{retry-25ccc1ac.js → retry-7a4aae5a.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +3 -3
- package/dist/checkout.js +4 -4
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +7 -7
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +4 -4
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/SaleWidget-a24bcdb3.js +0 -1
- package/dist/browser/checkout/index-21c15f4b.js +0 -1
package/dist/index.cjs
CHANGED
|
@@ -183,7 +183,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
183
183
|
};
|
|
184
184
|
|
|
185
185
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
186
|
-
const SDK_VERSION$1 = '1.
|
|
186
|
+
const SDK_VERSION$1 = '1.31.0';
|
|
187
187
|
const getFrameParentDomain$1 = () => {
|
|
188
188
|
if (isNode$1()) {
|
|
189
189
|
return '';
|
|
@@ -14194,7 +14194,7 @@ class MultiRollupApiClients {
|
|
|
14194
14194
|
}
|
|
14195
14195
|
|
|
14196
14196
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14197
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14197
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
14198
14198
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
14199
14199
|
if (!basePath.trim()) {
|
|
14200
14200
|
throw Error('basePath can not be empty');
|
|
@@ -14266,7 +14266,7 @@ class APIError extends Error {
|
|
|
14266
14266
|
|
|
14267
14267
|
/* eslint-disable implicit-arrow-linebreak */
|
|
14268
14268
|
const defaultHeaders$1 = {
|
|
14269
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.
|
|
14269
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.31.0',
|
|
14270
14270
|
};
|
|
14271
14271
|
/**
|
|
14272
14272
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14740,7 +14740,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14740
14740
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14741
14741
|
class ApiConfiguration extends index$2.Configuration {
|
|
14742
14742
|
}
|
|
14743
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14743
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
14744
14744
|
/**
|
|
14745
14745
|
* @dev use createImmutableXConfiguration instead
|
|
14746
14746
|
*/
|
|
@@ -14779,7 +14779,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14779
14779
|
chainID,
|
|
14780
14780
|
coreContractAddress,
|
|
14781
14781
|
registrationContractAddress,
|
|
14782
|
-
sdkVersion: 'ts-immutable-sdk-1.
|
|
14782
|
+
sdkVersion: 'ts-immutable-sdk-1.31.0',
|
|
14783
14783
|
baseConfig,
|
|
14784
14784
|
});
|
|
14785
14785
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -57599,7 +57599,7 @@ const flattenProperties = (properties) => {
|
|
|
57599
57599
|
};
|
|
57600
57600
|
|
|
57601
57601
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
57602
|
-
const SDK_VERSION = '1.
|
|
57602
|
+
const SDK_VERSION = '1.31.0';
|
|
57603
57603
|
const getFrameParentDomain = () => {
|
|
57604
57604
|
if (isNode()) {
|
|
57605
57605
|
return '';
|
|
@@ -62821,7 +62821,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
62821
62821
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
62822
62822
|
};
|
|
62823
62823
|
|
|
62824
|
-
const SDK_VERSION_MARKER = '1.
|
|
62824
|
+
const SDK_VERSION_MARKER = '1.31.0';
|
|
62825
62825
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
62826
62826
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
62827
62827
|
|
package/dist/index.js
CHANGED
|
@@ -160,7 +160,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
160
160
|
};
|
|
161
161
|
|
|
162
162
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
163
|
-
const SDK_VERSION$1 = '1.
|
|
163
|
+
const SDK_VERSION$1 = '1.31.0';
|
|
164
164
|
const getFrameParentDomain$1 = () => {
|
|
165
165
|
if (isNode$1()) {
|
|
166
166
|
return '';
|
|
@@ -14171,7 +14171,7 @@ class MultiRollupApiClients {
|
|
|
14171
14171
|
}
|
|
14172
14172
|
|
|
14173
14173
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
14174
|
-
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14174
|
+
const defaultHeaders$2 = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
14175
14175
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
14176
14176
|
if (!basePath.trim()) {
|
|
14177
14177
|
throw Error('basePath can not be empty');
|
|
@@ -14243,7 +14243,7 @@ class APIError extends Error {
|
|
|
14243
14243
|
|
|
14244
14244
|
/* eslint-disable implicit-arrow-linebreak */
|
|
14245
14245
|
const defaultHeaders$1 = {
|
|
14246
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.
|
|
14246
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.31.0',
|
|
14247
14247
|
};
|
|
14248
14248
|
/**
|
|
14249
14249
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -14717,7 +14717,7 @@ var blockchain_data = /*#__PURE__*/Object.freeze({
|
|
|
14717
14717
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
14718
14718
|
class ApiConfiguration extends index$2.Configuration {
|
|
14719
14719
|
}
|
|
14720
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
14720
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
14721
14721
|
/**
|
|
14722
14722
|
* @dev use createImmutableXConfiguration instead
|
|
14723
14723
|
*/
|
|
@@ -14756,7 +14756,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
14756
14756
|
chainID,
|
|
14757
14757
|
coreContractAddress,
|
|
14758
14758
|
registrationContractAddress,
|
|
14759
|
-
sdkVersion: 'ts-immutable-sdk-1.
|
|
14759
|
+
sdkVersion: 'ts-immutable-sdk-1.31.0',
|
|
14760
14760
|
baseConfig,
|
|
14761
14761
|
});
|
|
14762
14762
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
|
@@ -57576,7 +57576,7 @@ const flattenProperties = (properties) => {
|
|
|
57576
57576
|
};
|
|
57577
57577
|
|
|
57578
57578
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
57579
|
-
const SDK_VERSION = '1.
|
|
57579
|
+
const SDK_VERSION = '1.31.0';
|
|
57580
57580
|
const getFrameParentDomain = () => {
|
|
57581
57581
|
if (isNode()) {
|
|
57582
57582
|
return '';
|
|
@@ -62798,7 +62798,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
62798
62798
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
62799
62799
|
};
|
|
62800
62800
|
|
|
62801
|
-
const SDK_VERSION_MARKER = '1.
|
|
62801
|
+
const SDK_VERSION_MARKER = '1.31.0';
|
|
62802
62802
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
62803
62803
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
62804
62804
|
|
package/dist/orderbook.js
CHANGED
|
@@ -132,7 +132,7 @@ const flattenProperties = (properties) => {
|
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
135
|
-
const SDK_VERSION = '1.
|
|
135
|
+
const SDK_VERSION = '1.31.0';
|
|
136
136
|
const getFrameParentDomain = () => {
|
|
137
137
|
if (isNode()) {
|
|
138
138
|
return '';
|
package/dist/passport.js
CHANGED
|
@@ -11444,7 +11444,7 @@ class MultiRollupApiClients {
|
|
|
11444
11444
|
}
|
|
11445
11445
|
|
|
11446
11446
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11447
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
11447
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
11448
11448
|
const createConfig$1 = ({ basePath, headers, }) => {
|
|
11449
11449
|
if (!basePath.trim()) {
|
|
11450
11450
|
throw Error('basePath can not be empty');
|
|
@@ -11623,7 +11623,7 @@ const flattenProperties = (properties) => {
|
|
|
11623
11623
|
};
|
|
11624
11624
|
|
|
11625
11625
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
11626
|
-
const SDK_VERSION = '1.
|
|
11626
|
+
const SDK_VERSION = '1.31.0';
|
|
11627
11627
|
const getFrameParentDomain = () => {
|
|
11628
11628
|
if (isNode()) {
|
|
11629
11629
|
return '';
|
|
@@ -12013,7 +12013,7 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
12013
12013
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
12014
12014
|
class ApiConfiguration extends index$2.Configuration {
|
|
12015
12015
|
}
|
|
12016
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
12016
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
12017
12017
|
/**
|
|
12018
12018
|
* @dev use createImmutableXConfiguration instead
|
|
12019
12019
|
*/
|
|
@@ -12052,7 +12052,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
12052
12052
|
chainID,
|
|
12053
12053
|
coreContractAddress,
|
|
12054
12054
|
registrationContractAddress,
|
|
12055
|
-
sdkVersion: 'ts-immutable-sdk-1.
|
|
12055
|
+
sdkVersion: 'ts-immutable-sdk-1.31.0',
|
|
12056
12056
|
baseConfig,
|
|
12057
12057
|
});
|
|
12058
12058
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
package/dist/x.js
CHANGED
|
@@ -9003,7 +9003,7 @@ const flattenProperties = (properties) => {
|
|
|
9003
9003
|
};
|
|
9004
9004
|
|
|
9005
9005
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
9006
|
-
const SDK_VERSION = '1.
|
|
9006
|
+
const SDK_VERSION = '1.31.0';
|
|
9007
9007
|
const getFrameParentDomain = () => {
|
|
9008
9008
|
if (isNode()) {
|
|
9009
9009
|
return '';
|
|
@@ -9269,7 +9269,7 @@ const addKeysToHeadersOverride = (baseConfig, overrides) => {
|
|
|
9269
9269
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
9270
9270
|
class ApiConfiguration extends index$2.Configuration {
|
|
9271
9271
|
}
|
|
9272
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.
|
|
9272
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.31.0' };
|
|
9273
9273
|
/**
|
|
9274
9274
|
* @dev use createImmutableXConfiguration instead
|
|
9275
9275
|
*/
|
|
@@ -9308,7 +9308,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
9308
9308
|
chainID,
|
|
9309
9309
|
coreContractAddress,
|
|
9310
9310
|
registrationContractAddress,
|
|
9311
|
-
sdkVersion: 'ts-immutable-sdk-1.
|
|
9311
|
+
sdkVersion: 'ts-immutable-sdk-1.31.0',
|
|
9312
9312
|
baseConfig,
|
|
9313
9313
|
});
|
|
9314
9314
|
const production = ({ baseConfig }) => createImmutableXConfiguration({
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,a2 as t,a3 as n,r as a,a4 as r,a5 as o,a6 as s,a7 as i,a8 as c,a9 as d,aa as u,ab as l,B as m,ac as p,ad as E,ae as f,af as T,ag as y,ah as C,ai as g,aj as I,ak as A,y as R,al as h,V as _,d as S,am as v,S as O,u as D,C as b,an as w,ao as k,h as N,g as M,I as U,ap as P,j as L,a0 as F,aq as x,ar as W,as as B,E as H,at as V,au as Y,av as K,aw as G,ax as j,M as q,H as z,t as X,p as $,ay as Z,az as J,aA as Q,z as ee,G as te,b as ne,J as ae,e as re,U as oe,aB as se,aC as ie,aD as ce,aE as de,aF as ue,aG as le,aH as me,aI as pe,aJ as Ee,aK as fe,aL as Te,aM as ye,k as Ce,aN as ge,aO as Ie,aP as Ae,l as Re,x as he,c as _e,aQ as Se,_ as ve,$ as Oe,aR as De}from"./index-e89e8900.js";import be from"./BridgeWidget-547ebd7f.js";import{O as we,u as ke}from"./OnRampWidget-a134bb5a.js";import Ne from"./SwapWidget-b45fbcf6.js";import{C as Me,a as Ue,f as Pe,T as Le,b as Fe}from"./TopUpView-5e33fc57.js";import{H as xe}from"./HorizontalMenu-7b0c87f0.js";import"./retry-25ccc1ac.js";import"./balance-f8adfbad.js";import"./SpendingCapHero-ae6ec432.js";var We=["size","weight","rc","sx","testId","children","domRef","className"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function He(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Ve="base.color.text.caption.primary",Ye="medium";function Ke(u){var l=u.size,m=void 0===l?Ye:l,p=u.weight,E=void 0===p?"regular":p,f=u.rc,T=void 0===f?e("span",{}):f,y=u.sx,C=void 0===y?{}:y,g=u.testId,I=u.children,A=u.domRef,R=u.className,h=t(u,We),_=n(),S=a.useMemo((function(){var e,t;return r(s(C,Ve),o({themeProps:_,size:m,weight:E}),null!==(e=null===(t=_.components)||void 0===t||null===(t=t.Caption)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},C)}),[C,_,m,E]),v=i(S),O=c(m,Ye,Object.keys(_.base.text.caption));return d(T,He(He(He(He({},h),g?{"data-testid":g}:{}),A?{ref:A}:{}),{},{css:v,children:I,className:"".concat(null!=R?R:""," Caption Caption--").concat(O)}))}Ke.displayName="Caption";var Ge,je,qe,ze,Xe,$e,Ze,Je=["sx","radius"];function Qe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function et(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qe(Object(n),!0).forEach((function(t){u(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function tt(n){var a=n.sx,o=void 0===a?{}:a,s=n.radius,i=void 0===s?"50px":s,c=t(n,Je);return e(m,et(et({},c),{},{sx:r(l,{brad:"50%",w:i,h:i},o)}))}!function(e){e.PAYMENT_METHODS="PAYMENT_METHODS",e.PAY_WITH_COINS="PAY_WITH_COINS",e.PAY_WITH_CARD="PAY_WITH_CARD",e.FUND_WITH_SMART_CHECKOUT="FUND_WITH_SMART_CHECKOUT",e.ORDER_SUMMARY="ORDER_SUMMARY",e.SALE_SUCCESS="SALE_SUCCESS",e.SALE_FAIL="SALE_FAIL"}(Ge||(Ge={})),function(e){e.INIT="INIT",e.LOADING="LOADING",e.FUNDING_ROUTE_SELECT="FUNDING_ROUTE_SELECT",e.FUNDING_ROUTE_EXECUTE="FUNDING_ROUTE_EXECUTE"}(je||(je={})),function(e){e.INIT="INIT",e.REVIEW_ORDER="REVIEW_ORDER",e.EXECUTE_FUNDING_ROUTE="EXECUTE_FUNDING_ROUTE"}(qe||(qe={})),function(e){e.DEFAULT="DEFAULT_ERROR",e.INVALID_PARAMETERS="INVALID_PARAMETERS",e.TRANSACTION_FAILED="TRANSACTION_FAILED",e.SERVICE_BREAKDOWN="SERVICE_BREAKDOWN",e.PRODUCT_NOT_FOUND="PRODUCT_NOT_FOUND",e.INSUFFICIENT_STOCK="INSUFFICIENT_STOCK",e.TRANSAK_FAILED="TRANSAK_FAILED",e.WALLET_FAILED="WALLET_FAILED",e.WALLET_REJECTED="WALLET_REJECTED",e.WALLET_REJECTED_NO_FUNDS="WALLET_REJECTED_NO_FUNDS",e.WALLET_POPUP_BLOCKED="WALLET_POPUP_BLOCKED",e.SMART_CHECKOUT_ERROR="SMART_CHECKOUT_ERROR",e.SMART_CHECKOUT_EXECUTE_ERROR="SMART_CHECKOUT_EXECUTE_ERROR"}(ze||(ze={})),function(e){e.FRACTIONAL_BALANCE_BLOCKED="FRACTIONAL_BALANCE_BLOCKED"}(Xe||(Xe={})),function(e){e.CRYPTO="crypto",e.FIAT="fiat"}($e||($e={})),function(e){e.SUFFICIENT="SUFFICIENT"}(Ze||(Ze={}));const nt={[p.SANDBOX]:"https://api.sandbox.immutable.com/v1/primary-sales",[p.PRODUCTION]:"https://api.immutable.com/v1/primary-sales"},at=e=>e.map((({method:e,hash:t})=>`${e}: ${t}`)).join(" | "),rt=e=>e.split(/[_\s-]+/).map((e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase())).join(""),ot=e=>e.replace(/[^\u0000-\u00FF]/g,""),st=e=>{if(!e)return"";let t=e.trim().toLowerCase();if(t.startsWith("0x")&&(t=t.slice(2)),!/^[0-9a-f]+$/i.test(t))throw new Error("Invalid hexadecimal input");let n="";for(let e=0;e<t.length;e+=2){const a=parseInt(t.substr(e,2),16);n+=String.fromCharCode(a)}return n},it=e=>{const t=new E(101,100);return f.from(t.multiply(e.toString()).quotient.toString())};var ct;!function(e){e.CONTRACT_ADDRESS="contract_address",e.CURRENCY_SYMBOL="currency_symbol"}(ct||(ct={}));const dt=e=>{const{provider:t,items:n,environment:r,environmentId:o}=e,[s,i]=a.useState(void 0),[c,d]=a.useState(void 0),[u,l]=a.useState({done:!1,transactions:[]}),[m,p]=a.useState([]),E=()=>l((e=>({...e,done:!0}))),y=()=>l({done:!1,transactions:[]}),C=a.useCallback((async(e,n,a,r,o)=>{let s;try{const i=t?.getSigner(),d=await(t?.getGasPrice()),u=await(i?.sendTransaction({to:e,data:n,gasPrice:d,gasLimit:a}));return c={method:r,hash:u?.hash},l((e=>({...e,transactions:[...e.transactions,c]}))),o&&await(u?.wait()),s=u?.hash||"",[s,void 0]}catch(e){const t=`${e?.reason||e?.message||""}`.toLowerCase();s=e?.transactionHash;let n=ze.WALLET_FAILED;return t.includes("failed")&&t.includes("open confirmation")&&(n=ze.WALLET_POPUP_BLOCKED),t.includes("rejected")&&t.includes("user")&&(n=ze.WALLET_REJECTED),t.includes("failed to submit")&&t.includes("highest gas limit")&&(n=ze.WALLET_REJECTED_NO_FUNDS),(t.includes("status failed")||t.includes("transaction failed"))&&(n=ze.TRANSACTION_FAILED),i({type:n,data:{error:e}}),[void 0,e]}var c}),[t]);return{sign:a.useCallback((async(e,a)=>{try{const s=t?.getSigner(),c={recipient_address:await(s?.getAddress())||"",payment_type:e,currency_filter:ct.CONTRACT_ADDRESS,currency_value:a,products:n.map((e=>({product_id:e.productId,quantity:e.qty})))},u=`${nt[r]}/${o}/order/sign`,l=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),{ok:m,status:E}=l;if(!m){const{code:e}=await l.json();let t;switch(E){case 400:t=ze.SERVICE_BREAKDOWN;break;case 404:t="insufficient_stock"===e?ze.INSUFFICIENT_STOCK:ze.PRODUCT_NOT_FOUND;break;case 429:case 500:t=ze.DEFAULT;break;default:throw new Error("Unknown error")}return void i({type:t})}const f=await l.json(),T=f.order.products.map((e=>e.detail.map((({token_id:e})=>e)))).flat(),y=((e,t)=>{const{order:n,transactions:a}=e;return{order:{currency:{name:n.currency.name,erc20Address:n.currency.erc20_address},products:n.products.map((e=>((e,t,n)=>({productId:e.product_id,image:n?.image||"",qty:n?.qty||1,name:n?.name||"",description:n?.description||"",currency:t,contractType:e.contract_type,collectionAddress:e.collection_address,amount:e.detail.map((({amount:e})=>e)),tokenId:e.detail.map((({token_id:e})=>e))}))(e,n.currency.name,t.find((t=>t.productId===e.product_id))))).reduce(((e,t)=>{const n=e.findIndex((e=>e.name===t.name));return-1===n&&e.push({...t}),n>-1&&(e[n].amount=[...e[n].amount,...t.amount],e[n].tokenId=[...e[n].tokenId,...t.tokenId]),e}),[]),totalAmount:Number(n.total_amount)},transactions:a.map((e=>({tokenAddress:e.contract_address,gasEstimate:e.gas_estimate,methodCall:e.method_call,params:{reference:e.params.reference||"",amount:e.params.amount||0,spender:e.params.spender||""},rawData:e.raw_data}))),transactionId:st(a.find((e=>e.method_call.startsWith("execute")))?.params.reference||"")}})(f,n);return p(T),d(y),y}catch(e){i({type:ze.DEFAULT,data:{error:e}})}}),[n,o,r,t]),signResponse:c,signError:s,execute:async(e,n,a,r)=>{if(!e||!t)return i({type:ze.DEFAULT,data:{reason:"No sign data"}}),[];let o=!0;const s=[],c=await(async(e,t)=>{try{const n=t.getSigner(),a=await n.getAddress(),r=e.find((e=>e.methodCall.startsWith("approve")));if(!r||!n||!a)return e;const o=new T(r.tokenAddress,["function allowance(address,address) view returns (uint256)"],n),s=await(n?.call({to:r.tokenAddress,data:o.interface.encodeFunctionData("allowance",[a,r.params.spender])})),i=f.from(s),c=r.params.amount?f.from(r.params.amount):f.from(0);if(i.gte(f.from("0"))&&i.gte(c))return e.filter((e=>e.methodCall!==r.methodCall))}catch{}return e})(e.transactions,t);for(const e of c){const{tokenAddress:t,rawData:i,methodCall:c,gasEstimate:d}=e,[u,l]=await C(t,i,d,c,n);if(l||!u){o=!1,r(l,s);break}s.push({method:c,hash:u}),a({method:c,hash:u})}return(o?E:y)(),s},executeResponse:u,tokenIds:m}},ut=(e,t)=>{const n=[];for(const t of e.steps)switch(t.type){case A.BRIDGE:n.push(t.fees.approvalGasFee),n.push(...t.fees.bridgeFees),n.push(t.fees.bridgeGasFee);break;case A.SWAP:n.push(t.fees.approvalGasFee),n.push(...t.fees.swapFees),n.push(t.fees.swapGasFee)}let a=0;for(const e of n)if(e.token){const n=R(e.formattedAmount,e.token.symbol,t);a+=parseFloat(n)}return h(a)},lt=e=>{if(e.sufficient||e.router?.routingOutcome.type!==y.ROUTES_FOUND)return[];const t=[];for(const n of e.transactionRequirements){const{token:e}=n.current;t.includes(e.symbol)||t.push(e.symbol)}for(const n of e.router.routingOutcome.fundingRoutes)for(const e of n.steps)t.includes(e.fundingItem.token.symbol)||t.push(e.fundingItem.token.symbol);return t},mt=(e,t,n)=>{const a=e?.data?.transactionRequirements||[],r=a.find((({type:e})=>e===C.NATIVE)),o=a.find((({type:e})=>e===C.ERC20)),s={erc20:{value:o?.delta.formattedBalance,symbol:n},native:{value:r?.delta.formattedBalance,symbol:"IMX"}};let i=["views.PAYMENT_METHODS.topUp.subheading.both",s];r?.sufficient&&!o?.sufficient&&(i=["views.PAYMENT_METHODS.topUp.subheading.erc20",s]),!r?.sufficient&&o?.sufficient&&(i=["views.PAYMENT_METHODS.topUp.subheading.native",s]);return{amount:o?.delta.formattedBalance||"0",heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:i,tokenAddress:t}},pt=({checkout:e,provider:t,items:n,amount:r,tokenAddress:o})=>{const[s,i]=a.useState(void 0),[c,d]=a.useState(void 0),u=a.useCallback((async()=>{let n;try{const a=t?.getSigner(),s=await(a?.getAddress())||"",c=((e,t,n)=>[{type:C.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(r,s,o),d={type:g.GAS,gasToken:{type:I.NATIVE,limit:f.from("30000000")}},u=await(e?.smartCheckout({provider:t,itemRequirements:c,transactionOrGasAmount:d}));if(!u)throw new Error;if(n=((e,t)=>{const n={...e};if(!!t?.provider?.isPassport&&(n.transactionRequirements=e.transactionRequirements.map((e=>e.type===C.NATIVE?{...e,sufficient:!0}:e)),n.sufficient=n.transactionRequirements.every((e=>e.sufficient))),n.sufficient||n.router?.routingOutcome.type!==y.ROUTES_FOUND)return n;const a=[],r=n.router?.routingOutcome.fundingRoutes.filter((e=>!e.steps.some((e=>a.includes(e.type)))));let o;return o=0===r?.length?{type:y.NO_ROUTES_FOUND,message:"Smart Checkout did not find any routes to fulfill the transaction"}:{type:y.ROUTES_FOUND,fundingRoutes:r},{...n,router:{...n.router,routingOutcome:o}}})({...u},t),!n.sufficient)throw new Error(Xe.FRACTIONAL_BALANCE_BLOCKED);return i(n),u}catch(e){d({type:ze.SMART_CHECKOUT_ERROR,data:{error:e,transactionRequirements:n?.transactionRequirements}})}}),[e,t,n,r,o]);return{smartCheckout:u,smartCheckoutResult:s,smartCheckoutError:c}},Et={contractId:"",currencies:[],currencyConversion:{}},ft=({amount:e,environment:t,environmentId:n})=>{const[r,o]=a.useState(),s=a.useRef(!1),[i,c]=a.useState(Et),[d,u]=a.useState(void 0);return a.useEffect((()=>{t&&n&&e&&(async()=>{if(!s.current)try{s.current=!0;const a=`${nt[t]}/${n}/client-config?amount=${e}`,r=await fetch(a,{method:"GET",headers:{"Content-Type":"application/json"}});if(!r.ok)throw new Error(`${r.status} - ${r.statusText}`);const o=(e=>({contractId:e.contract_id,currencies:e.currencies.map((({erc20_address:e,exchange_id:t,...n})=>({...n,address:e,exchangeId:t}))),currencyConversion:Object.entries(e.currency_conversion).reduce(((e,[t,{amount:n,name:a,type:r}])=>(e[t]={amount:n,name:a,type:r},e)),{})}))(await r.json());c(o)}catch(e){u({type:ze.DEFAULT,data:{reason:"Error fetching settlement currencies"}})}finally{s.current=!1}})()}),[t,n,e]),a.useEffect((()=>{if(0===i.currencies.length)return;const e=i.currencies.find((e=>e.base))||i.currencies?.[0];o(e)}),[i]),{clientConfig:i,selectedCurrency:r,clientConfigError:d}},Tt=a.createContext({items:[],amount:"",collectionName:"",provider:void 0,checkout:void 0,environmentId:"",environment:p.SANDBOX,recipientAddress:"",recipientEmail:"",sign:()=>Promise.resolve(void 0),execute:()=>Promise.resolve([]),signResponse:void 0,signError:void 0,executeResponse:void 0,passport:void 0,isPassportWallet:!1,showCreditCardWarning:!1,setShowCreditCardWarning:()=>{},paymentMethod:void 0,setPaymentMethod:()=>{},goBackToPaymentMethods:()=>{},goToErrorView:()=>{},goToSuccessView:()=>{},config:{},querySmartCheckout:()=>Promise.resolve(void 0),smartCheckoutResult:void 0,smartCheckoutError:void 0,fundingRoutes:[],disabledPaymentTypes:[],invalidParameters:!1,fromTokenAddress:"",clientConfig:Et,signTokenIds:[],excludePaymentTypes:[],multicurrency:!1,selectedCurrency:void 0});Tt.displayName="SaleSaleContext";const yt=1;function Ct(t){const{children:n,value:{config:r,environment:o,environmentId:s,items:i,amount:c,provider:d,checkout:u,passport:l,collectionName:m,excludePaymentTypes:p,multicurrency:E}}=t,f=a.useRef(0),{viewDispatch:T}=a.useContext(_),[{recipientEmail:y,recipientAddress:C},g]=a.useState({recipientEmail:"",recipientAddress:""}),[I,A]=a.useState(!1),[R,h]=a.useState(void 0),D=e=>{e!==v.CREDIT||I?(h(e),A(!1)):A(!0)},[b]=a.useState([]),[w,k]=a.useState([]),[N,M]=a.useState(!1),{selectedCurrency:U,clientConfig:P,clientConfigError:L}=ft({amount:c,environmentId:s,environment:r.environment}),F=U?.address||"",x=a.useCallback(((e,t)=>{D(e),T({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAYMENT_METHODS,data:t}}})}),[]);a.useEffect((()=>{(async()=>{const e=d?.getSigner(),t=await(e?.getAddress())||"",n=(await(l?.getUserInfo()))?.email||"";g({recipientEmail:n,recipientAddress:t})})()}),[d]);const{sign:W,execute:B,signResponse:H,signError:V,executeResponse:Y,tokenIds:K}=dt({items:i,provider:d,fromTokenAddress:F,recipientAddress:C,environmentId:s,environment:o}),G=a.useCallback((async(e,t,n)=>{const a=t||F;if(!a||!a.startsWith("0x"))return void M(!0);const r=await W(e,a);return r?(n?.(r),r):void 0}),[W,F]),j=a.useCallback(((e,t={})=>{f.current+=1,f.current>yt&&(f.current=0,D(void 0)),T({payload:{type:S.UPDATE_VIEW,view:{type:Ge.SALE_FAIL,data:{...t,errorType:e,paymentMethod:R,transactions:Y.transactions}}}})}),[R,D,Y]),q=a.useCallback((e=>{T({payload:{type:S.UPDATE_VIEW,view:{type:Ge.SALE_SUCCESS,data:{paymentMethod:R,transactions:Y.transactions,tokenIds:K,...e}}}})}),[[R,Y,K]]);a.useEffect((()=>{V&&j(V.type,V.data)}),[V]),a.useEffect((()=>{L&&j(L.type,L.data)}),[L]);const{smartCheckout:z,smartCheckoutResult:X,smartCheckoutError:$}=pt({provider:d,checkout:u,items:i,amount:c,tokenAddress:F});a.useEffect((()=>{var e;if($)return $.data?.error?.message===Xe.FRACTIONAL_BALANCE_BLOCKED?(e=[v.CRYPTO],k((t=>Array.from(new Set([...t||[],...e])))),D(void 0),void T({payload:{type:S.UPDATE_VIEW,view:{type:O.TOP_UP_VIEW,data:mt($,F,U?.name)}}})):void j($.type,$.data)}),[$]);const Z=a.useCallback((async e=>{const t=await z();return e?.(t),t}),[z]);a.useEffect((()=>{!(!i||0===i.length)&&!(!c||"0"===c)&&m&&s||M(!0)}),[i,c,m,s]),a.useEffect((()=>{p?.length<=0||k(p)}),[p]);const J=a.useMemo((()=>({config:r,items:i,amount:c,fromTokenAddress:F,sign:G,signResponse:H,signError:V,execute:B,executeResponse:Y,environmentId:s,collectionName:m,environment:o,provider:d,checkout:u,recipientAddress:C,recipientEmail:y,showCreditCardWarning:I,setShowCreditCardWarning:A,paymentMethod:R,setPaymentMethod:D,goBackToPaymentMethods:x,goToErrorView:j,goToSuccessView:q,isPassportWallet:!!d?.provider?.isPassport,querySmartCheckout:Z,smartCheckoutResult:X,smartCheckoutError:$,fundingRoutes:b,disabledPaymentTypes:w,invalidParameters:N,clientConfig:P,signTokenIds:K,excludePaymentTypes:p,multicurrency:E,selectedCurrency:U})),[r,o,s,i,c,F,m,d,u,C,y,H,V,Y,I,A,R,x,j,q,G,Z,X,$,b,w,N,P,K,p,E,U]);return e(Tt.Provider,{value:J,children:n})}function gt(){return a.useContext(Tt)}var It;function At({fundingRouteStep:t,onFundingRouteExecuted:n}){const{t:r}=D(),{config:o,provider:s,checkout:i,fromTokenAddress:c}=gt(),{viewDispatch:d}=a.useContext(_),{connectLoaderDispatch:u}=a.useContext(b),[l,m]=a.useState(void 0),[p,E]=a.useState(void 0),[f,T]=a.useState(void 0),[y,C]=a.useState(It.LOADING),g=a.useRef(!1),I=a.useRef(void 0),R=a.useRef(void 0),[h,v]=a.useReducer(w,k),O=a.useMemo((()=>({eventTargetState:h,eventTargetDispatch:v})),[h,v]),q=new EventTarget,z=e=>{d({payload:{type:S.UPDATE_VIEW,view:{type:Ge.SALE_FAIL,data:{errorType:ze.SMART_CHECKOUT_EXECUTE_ERROR,errorData:e}}}})},X=a.useCallback((async e=>{if(!i||!s)throw new Error("checkout or provider not available.");const t=await i.getNetworkInfo({provider:s});if(e.type===A.BRIDGE){if(E({tokenAddress:e.fundingItem.token.address,amount:e.fundingItem.fundsRequired.formattedAmount}),t.chainId===N(i.config))return void C(It.EXECUTE_BRIDGE);g.current=It.EXECUTE_BRIDGE,C(It.SWITCH_NETWORK_ETH)}if(e.type===A.SWAP){if(m({amount:e.fundingItem.fundsRequired.formattedAmount,fromTokenAddress:e.fundingItem.token.address,toTokenAddress:c}),t.chainId===M(i.config))return void C(It.EXECUTE_SWAP);g.current=It.EXECUTE_SWAP,C(It.SWITCH_NETWORK_ZKEVM)}e.type===A.ONRAMP&&(T({amount:e.fundingItem.fundsRequired.formattedAmount,tokenAddress:e.fundingItem.token.address}),C(It.EXECUTE_ON_RAMP))}),[s,i]);a.useEffect((()=>{if(t)try{X(t)}catch(e){z(e)}}),[t]);const $=()=>{I.current?(I.current=void 0,R.current=void 0,n()):z(R.current)},Z=e=>{switch(e.detail.type){case V.SUCCESS:{const t=e.detail.data;I.current=t,$();break}case K.TRANSACTION_SENT:case Y.SUCCESS:{const t=e.detail.data;I.current=t;break}case K.FAILURE:case V.FAILURE:case Y.FAILURE:{const t=e.detail.data;R.current=t;break}case K.CLOSE_WIDGET:case V.CLOSE_WIDGET:case Y.CLOSE_WIDGET:$();case V.REJECTED:}},J=e=>{switch(e.detail.type){case G.SUCCESS:{const t=e.detail.data;u({payload:{type:j.SET_PROVIDER,provider:t.provider}}),!1!==g.current&&(C(g.current),g.current=!1);break}case G.FAILURE:case G.CLOSE_WIDGET:default:$()}};return a.useEffect((()=>(q.addEventListener(U.IMTBL_CONNECT_WIDGET_EVENT,J),q.addEventListener(U.IMTBL_BRIDGE_WIDGET_EVENT,Z),q.addEventListener(U.IMTBL_SWAP_WIDGET_EVENT,Z),()=>{q.removeEventListener(U.IMTBL_CONNECT_WIDGET_EVENT,J),q.removeEventListener(U.IMTBL_BRIDGE_WIDGET_EVENT,Z),q.removeEventListener(U.IMTBL_SWAP_WIDGET_EVENT,Z)})),[]),a.useEffect((()=>{v({payload:{type:P.SET_EVENT_TARGET,eventTarget:q}})}),[i]),L(H.Provider,{value:O,children:[y===It.LOADING&&e(F,{loadingText:r("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),y===It.EXECUTE_BRIDGE&&e(be,{...p,config:o,checkout:i}),y===It.EXECUTE_SWAP&&e(Ne,{...l,config:o}),y===It.EXECUTE_ON_RAMP&&e(we,{config:o,...f}),y===It.SWITCH_NETWORK_ETH&&e(B,{config:o,targetChainId:i.config.isProduction?x.ETHEREUM:x.SEPOLIA,web3Provider:s,checkout:i,deepLink:W.SWITCH_NETWORK}),y===It.SWITCH_NETWORK_ZKEVM&&e(B,{config:o,targetChainId:i.config.isProduction?x.IMTBL_ZKEVM_MAINNET:x.IMTBL_ZKEVM_TESTNET,web3Provider:s,checkout:i,deepLink:W.SWITCH_NETWORK})]})}!function(e){e.LOADING="LOADING",e.EXECUTE_SWAP="EXECUTE_SWAP",e.EXECUTE_BRIDGE="EXECUTE_BRIDGE",e.EXECUTE_ON_RAMP="EXECUTE_ON_RAMP",e.SWITCH_NETWORK_ETH="SWITCH_NETWORK_ETH",e.SWITCH_NETWORK_ZKEVM="SWITCH_NETWORK_ZKEVM"}(It||(It={}));const Rt={[x.IMTBL_ZKEVM_DEVNET]:"Immutable",[x.IMTBL_ZKEVM_MAINNET]:"Immutable",[x.IMTBL_ZKEVM_TESTNET]:"Immutable",[x.ETHEREUM]:"EthToken",[x.SEPOLIA]:"EthToken"},ht={[x.IMTBL_ZKEVM_DEVNET]:"base.color.text.link.primary",[x.IMTBL_ZKEVM_TESTNET]:"base.color.text.link.primary",[x.IMTBL_ZKEVM_MAINNET]:"base.color.text.link.primary",[x.ETHEREUM]:"base.color.accent.5",[x.SEPOLIA]:"base.color.accent.5"};function _t({onClick:t,fundingRoute:n,toggleVisible:r,selected:o,size:s="small"}){const{t:i}=D(),c=n.steps[0],{cryptoFiatState:d}=a.useContext(Me),{isPassportWallet:u}=gt(),[l,m]=a.useState(void 0),[p,E]=a.useState(void 0);a.useEffect((()=>{if(d.conversions)try{m(ut(n,d.conversions)),E(R(c.fundingItem.userBalance.formattedBalance,c.fundingItem.token.symbol,d.conversions))}catch{m(void 0),E(void 0)}}),[d,n]);return L(q,{emphasized:!0,testId:"funding-route-menu-item",onClick:t,selected:o,size:s,children:[r&&e(q.IntentIcon,{icon:"ChevronExpand"}),e(q.FramedIcon,{icon:"Coins",circularFrame:!0}),e(q.PriceDisplay,{use:e(z,{size:"xSmall"}),fiatAmount:`${i("views.FUND_WITH_SMART_CHECKOUT.currency.usdEstimate")}${p}`,price:X(c.fundingItem.userBalance.formattedBalance)}),L(q.Label,{sx:{display:"flex",wordBreak:"default"},children:[c.fundingItem.token.symbol,u?null:L(xe.Button,{rc:e("a",{}),sx:{pointerEvents:"none",cursor:"default",height:"100%",marginLeft:"base.spacing.x2",fontSize:"base.text.body.xxSmall.regular.fontSize",fontWeight:"base.text.body.xxSmall.regular.fontWeight",color:"base.color.brand.4",paddingLeft:"base.spacing.x2",paddingRight:"base.spacing.x2"},size:"small",children:[e($.Icon,{icon:Rt[c.chainId],sx:{width:"14px",fill:ht[c.chainId]}}),Z(c.chainId)]})]}),L(q.Caption,{children:["Fees ≈ USD $",l]})]})}function St({visible:t,onCloseDrawer:n,fundingRoutes:a,activeFundingRouteIndex:r}){const{t:o}=D();return e(J,{size:"full",onCloseDrawer:()=>n(r),visible:t,showHeaderBar:!0,headerBarTitle:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteDrawer.header"),children:e(J.Content,{children:a.map(((t,a)=>e(_t,{onClick:()=>{n(a)},fundingRoute:t,selected:r===a,size:"medium"},t.steps[0].fundingItem.type+t.steps[0].fundingItem.token)))})})}function vt({fundingRoute:t,collectionName:n}){const{t:r}=D(),{items:o}=gt(),s=o[0],i=t.steps[0],{cryptoFiatState:c}=a.useContext(Me),[d,u]=a.useState(void 0);return a.useEffect((()=>{if(c.conversions)try{u(R(i.fundingItem.fundsRequired.formattedAmount,i.fundingItem.token.symbol,c.conversions))}catch{u(void 0)}}),[c,t]),L(q,{emphasized:!0,testId:"funding-route-purchase-item",size:"medium",children:[e(q.FramedImage,{imageUrl:s?.image}),e(q.PriceDisplay,{use:e(z,{size:"xSmall"}),price:`${i?.fundingItem.token.symbol} \n ${X(i.fundingItem.fundsRequired.formattedAmount)}`,fiatAmount:`${r("views.FUND_WITH_SMART_CHECKOUT.currency.usdEstimate")}${d}`}),L(q.Label,{children:[s?.name,s?.qty>1?` x${s.qty}`:null]}),e(q.Caption,{children:n})]},s?.name)}function Ot({fundingRoutes:t,collectionName:n,onFundingRouteSelected:r}){const{t:o}=D(),[s,i]=a.useState(!1),[c,d]=a.useState(0),{viewDispatch:u}=a.useContext(_),{eventTargetState:{eventTarget:l}}=a.useContext(H),{goBackToPaymentMethods:p}=gt();return L(ae,{testId:"funding-route-select",header:e(ee,{onCloseButtonClick:()=>Q(l)}),footer:e(te,{}),children:[L(m,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4",height:"100%"},children:[e(z,{size:"small",children:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.heading")}),0===t.length?[e(ne,{size:"small",children:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.noRoutesAvailable")},"noRoutesAvailableText"),e($,{variant:"tertiary",children:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.payWithCard")},"payWithCardButton")]:[e(_t,{"data-testid":"funding-route-select-selected-route",onClick:t.length>1?()=>{i(!0)}:()=>{},fundingRoute:t[c],selected:!0,toggleVisible:t.length>1},"selectedFundingRouteMenuItem"),e(vt,{fundingRoute:t[c],collectionName:n},"purchaseMenuItem"),e($,{sx:{mt:"auto"},variant:"primary",onClick:()=>{r(t[c]),u({payload:{type:S.UPDATE_VIEW,view:{type:Ge.FUND_WITH_SMART_CHECKOUT,subView:je.FUNDING_ROUTE_EXECUTE}}})},children:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.continue")},"continueButton"),e($,{variant:"tertiary",onClick:()=>p(),children:o("views.FUND_WITH_SMART_CHECKOUT.fundingRouteSelect.payWithCardInstead")},"payWithCardButton")]]}),e(St,{visible:s,onCloseDrawer:e=>{d(e),i(!1)},fundingRoutes:t,activeFundingRouteIndex:c})]})}const Dt=(e,t)=>({type:e.type,token:e.token,amount:e.fundsRequired.formattedAmount,balance:e.userBalance.formattedBalance,fiat:{symbol:"USD",balance:R(e.userBalance.formattedBalance,e.token.symbol,t),amount:R(e.fundsRequired.formattedAmount,e.token.symbol,t)}}),bt=()=>{const{track:e,page:t}=re(),{recipientAddress:n,signResponse:r,paymentMethod:o}=gt(),{eventTargetState:{eventTarget:s}}=a.useContext(H),i=Ge.PAYMENT_METHODS,c={location:"web",userJourney:oe.SALE},d={userId:n,paymentMethod:o},u={amount:r?.order.totalAmount,currency:r?.order.currency.name};return{track:e,page:t,sendPageView:(e,n)=>{t({...c,screen:rt(e),action:"Viewed",extras:{...n}})},sendCloseEvent:(t=i,n="Button",a="Pressed")=>{e({...c,screen:rt(t),control:"Close",controlType:n,action:a,extras:{...d}}),Q(s)},sendSuccessEvent:(t=i,n=[],a=[],r={})=>{e({...c,screen:rt(t),control:"Success",controlType:"Event",action:"Succeeded",extras:{...r,...d,transactions:at(n),...u,paymentMethod:o,tokenIds:a}}),se(s,o,n,a,r.transactionId)},sendFailedEvent:(t,n,a=[],r=i,l={})=>{e({...c,screen:rt(r||i),control:"Fail",controlType:"Event",action:"Failed",extras:{...l,transactions:at(a),...n,...u,...d,paymentMethod:o,reason:t}}),ie(s,t,n,o,a,l.transactionId)},sendTransactionSuccessEvent:e=>{ce(s,o,[e])},sendOrderCreated:(t,n)=>{e({...c,screen:rt(t),control:"OrderCreated",controlType:"Event",extras:{...n}})},sendSelectedPaymentMethod:(t,n)=>{e({...c,screen:rt(n),control:"Select",controlType:"MenuItem",extras:{paymentMethod:t}}),de(s,t)},sendSelectedPaymentToken:(t,n,a)=>{const r=Dt(n,a);e({...c,screen:rt(t),control:"Select",controlType:"MenuItem",extras:{...r}}),ue(s,r)},sendProceedToPay:(t,n,a,r="Button",o="Pressed")=>{e({...c,screen:rt(t),control:"ProceedToPay",controlType:r,action:o,extras:{...d,...Dt(n,a)}})}}};function wt({subView:t}){const{t:n}=D(),{sendPageView:r}=bt(),{viewDispatch:o}=a.useContext(_),[s,i]=a.useState(void 0),[c,d]=a.useState(0),{querySmartCheckout:u,fundingRoutes:l,smartCheckoutResult:p,collectionName:E,fromTokenAddress:f,sign:T}=gt(),{cryptoFiatDispatch:y}=a.useContext(Me);a.useEffect((()=>{t===je.INIT&&f&&u()}),[t,f]),a.useEffect((()=>{p&&p.sufficient&&(T($e.CRYPTO),o({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAY_WITH_COINS}}}))}),[p]),a.useEffect((()=>{if(!y||!p)return;const e=lt(p);y({payload:{type:Ue.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[y,p]);const C=a.useMemo((()=>{if(s)return s.steps[c]}),[s,c]);return a.useEffect((()=>r(Ge.FUND_WITH_SMART_CHECKOUT,{subView:t,...!!C&&{fundingStep:C.type}})),[]),L(m,{children:[t===je.INIT&&e(F,{loadingText:n("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),t===je.FUNDING_ROUTE_SELECT&&e(Ot,{fundingRoutes:l,collectionName:E,onFundingRouteSelected:e=>{i(e)}}),t===je.FUNDING_ROUTE_EXECUTE&&e(At,{onFundingRouteExecuted:()=>{s&&(c===s.steps.length-1?(d(0),i(void 0),o({payload:{type:S.UPDATE_VIEW,view:{type:Ge.FUND_WITH_SMART_CHECKOUT,subView:je.INIT}}})):d(c+1))},fundingRouteStep:C})]})}const kt={[p.SANDBOX]:"https://global-stg.transak.com",[p.PRODUCTION]:"https://global.transak.com/"},Nt={[p.SANDBOX]:"https://api-stg.transak.com",[p.PRODUCTION]:"https://api.transak.com"},Mt={[p.SANDBOX]:"STAGING",[p.PRODUCTION]:"PRODUCTION"},Ut={[p.SANDBOX]:"d14b44fb-0f84-4db5-affb-e044040d724b",[p.PRODUCTION]:"ad1bca70-d917-4628-bb0f-5609537498bc"},Pt=e=>{const{contractId:t,environment:n,transakParams:r,onError:o}=e,[s,i]=a.useState(""),c=a.useCallback((async()=>{try{const{calldata:e,nftData:a,estimatedGasLimit:o,cryptoCurrencyCode:s,...i}=r,c=a?.slice(0,1).map((e=>({...e,imageURL:ot(e.imageURL),nftName:ot(e.nftName)}))),d={contractId:t,cryptoCurrencyCode:s,calldata:e,nftData:c,estimatedGasLimit:(o>0?o:"30000000").toString()},u=`${Nt[n]}/cryptocoverage/api/v1/public/one-click-protocol/nft-transaction-id`,l=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!l.ok)throw new Error("Failed to get NFT transaction ID");const{id:m}=await l.json(),p=`${kt[n]}?`;return`${p}${new URLSearchParams({apiKey:Ut[n],environment:Mt[n],isNFT:"true",nftTransactionId:m,themeColor:"0D0D0D",...i}).toString()}`}catch{o?.()}return""}),[t,n,r,o]);return a.useEffect((()=>{(async()=>{const e=await c();i(e)})()}),[]),{iframeSrc:s}};function Lt(t){const{id:n,type:r,email:o,walletAddress:s,isPassportWallet:i,nftData:c,calldata:d,cryptoCurrencyCode:u,estimatedGasLimit:l,exchangeScreenTitle:m,partnerOrderId:p,onOpen:E,onInit:f,onOrderCreated:T,onOrderProcessing:y,onOrderCompleted:C,onOrderFailed:g,onFailedToLoad:I,failedToLoadTimeoutInMs:A,environment:R,contractId:h}=t,_=a.useRef(null),{onLoad:S,initialised:v}=ke({userJourney:oe.SALE,ref:_,walletAddress:s,isPassportWallet:i,onOpen:E,onOrderCreated:T,onOrderProcessing:y,onOrderCompleted:C,onOrderFailed:g,onInit:f,failedToLoadTimeoutInMs:A,onFailedToLoad:I}),{iframeSrc:O}=Pt({type:r,contractId:h,environment:R,transakParams:{nftData:c,calldata:d,cryptoCurrencyCode:u,estimatedGasLimit:l,exchangeScreenTitle:m,email:o,walletAddress:s,partnerOrderId:p},onError:I});return e("iframe",{id:n,ref:_,src:O,title:"Transak-Iframe",allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute",top:0,left:0,opacity:v?1:0,transition:"opacity 0.5s ease-out"},onLoad:S,onError:()=>I?.()})}function Ft(t){const{t:n}=D(),{onInit:r,onOpen:o,onOrderCreated:s,onOrderProcessing:i,onOrderCompleted:c,onOrderFailed:d}=t,{recipientEmail:u,recipientAddress:l,isPassportWallet:m,signResponse:p,goToErrorView:E,environment:f,clientConfig:T}=gt(),y=p?.transactions.find((e=>e.methodCall.startsWith("execute")));if(!p||!y)return null;const C=a.useMemo((()=>p.order.products.map((e=>({collectionAddress:e.collectionAddress,imageURL:e.image,nftName:e.name,price:e.amount,quantity:e.qty,tokenID:e.tokenId,nftType:e.contractType||"ERC721"})))),[p]);return e(Lt,{id:"transak-iframe",type:"nft-checkout",email:u,walletAddress:l,isPassportWallet:m,exchangeScreenTitle:n("views.PAY_WITH_CARD.screenTitle"),nftData:C,calldata:y.rawData,cryptoCurrencyCode:p.order.currency.name,estimatedGasLimit:y.gasEstimate,partnerOrderId:y.params.reference,onInit:r,onOpen:o,onOrderCreated:s,onOrderProcessing:i,onOrderCompleted:c,onOrderFailed:d,onFailedToLoad:()=>{E(ze.TRANSAK_FAILED)},environment:f,contractId:T.contractId})}function xt(){const{sendPageView:t}=bt(),[n,r]=a.useState(!1),{goBackToPaymentMethods:o,goToErrorView:s,signResponse:i,signTokenIds:c}=gt(),{sendOrderCreated:d,sendCloseEvent:u,sendSuccessEvent:l}=bt(),{t:p}=D(),E=(e={})=>{const{id:t,status:n,cryptoAmount:a,cryptoCurrency:r,fiatAmount:o,fiatAmountInUsd:s,amountPaid:d,totalFeeInFiat:m,paymentOptionId:p,userId:E,userKycType:f,walletAddress:T,nftAssetInfo:y}=e,{nftDataBase64:C,quantity:g}=y||{},I={orderId:t,orderStatus:n,cryptoAmount:a,cryptoCurrency:r,fiatAmount:o,fiatAmountInUsd:s,amountPaid:d,totalFeeInFiat:m,paymentOption:p,userId:E,userKycType:f,walletAddress:T,nftDataBase64:C,quantity:g,signData:i,transactionId:i?.transactionId};l(Ge.SALE_SUCCESS,[],c,I),u(Ge.SALE_SUCCESS)};return a.useEffect((()=>t(Ge.PAY_WITH_CARD)),[]),e(ae,{header:n&&e(ee,{onCloseButtonClick:()=>o()}),children:L(me,{children:[e(le,{visible:!n,children:e(le.Content,{children:e(le.Content.LoopingText,{text:[p("views.PAY_WITH_CARD.loading")]})})}),e(m,{style:{display:"block",position:"relative",maxWidth:"420px",height:"565px",borderRadius:"1%",overflow:"hidden",margin:"0 auto",width:"100%"},children:e(Ft,{onInit:()=>r(!0),onOrderFailed:()=>{s(ze.TRANSAK_FAILED)},onOrderCompleted:E,onOrderCreated:(e={})=>{const{id:t,status:n,cryptoAmount:a,cryptoCurrency:r,fiatAmount:o,fiatAmountInUsd:s,amountPaid:c,totalFeeInFiat:u,paymentOptionId:l,userId:m,userKycType:p,walletAddress:E,nftAssetInfo:f}=e,{nftDataBase64:T,quantity:y}=f||{};d(Ge.PAY_WITH_CARD,{orderId:t,orderStatus:n,cryptoAmount:a,cryptoCurrency:r,fiatAmount:o,fiatAmountInUsd:s,amountPaid:c,totalFeeInFiat:u,paymentOption:l,userId:m,userKycType:p,walletAddress:E,nftDataBase64:T,quantity:y,signData:i,transactionId:i?.transactionId})},onOrderProcessing:E})})]})})}function Wt(){const{t:t}=D(),n=a.useRef(!1),{sendPageView:r,sendTransactionSuccessEvent:o,sendFailedEvent:s,sendCloseEvent:i,sendSuccessEvent:c}=bt(),{execute:d,signResponse:u,executeResponse:l,signTokenIds:m,provider:p}=gt(),E=l?.transactions.length||0;let f=[t("views.PAYMENT_METHODS.loading.ready1"),t("views.PAYMENT_METHODS.loading.ready2"),t("views.PAYMENT_METHODS.loading.ready3")];E>=1&&(f=[t("views.PAYMENT_METHODS.loading.processing1"),t("views.PAYMENT_METHODS.loading.processing2"),t("views.PAYMENT_METHODS.loading.processing3")]);return a.useEffect((()=>{void 0!==u&&!1===n.current&&(n.current=!0,(async()=>{const e=!("isMetaMask"in p?.provider&&p?.provider.isMetaMask);d(u,e,(e=>{o(e)}),((e,t)=>{const n={transactionId:u?.transactionId};s(e.toString(),e,t,void 0,n)}))})())}),[u]),a.useEffect((()=>{if(!0===l?.done){const e={transactionId:u?.transactionId};c(Ge.SALE_SUCCESS,l?.transactions,m,e),i(Ge.SALE_SUCCESS)}}),[l]),a.useEffect((()=>r(Ge.PAY_WITH_COINS)),[]),e(F,{loadingText:f})}function Bt({type:t,onClick:n,disabled:a=!1,caption:r,rc:o=e("span",{})}){const{t:s}=D(),i={[v.CRYPTO]:"Coins",[v.DEBIT]:"BankCard",[v.CREDIT]:"BankCard"};return L(q,{rc:o,size:"medium",sx:{marginBottom:"base.spacing.x1",userSelect:"none",...a&&{filter:"opacity(0.5)",cursor:"not-allowed !important"}},...{disabled:a,emphasized:!0,onClick:a?void 0:()=>n(t)},children:[e(q.FramedIcon,{icon:i[t]}),e(q.Label,{size:"medium",children:s(`views.PAYMENT_METHODS.options.${t}.heading`)}),!a&&e(q.IntentIcon,{}),e(q.Caption,{children:r||s(`views.PAYMENT_METHODS.options.${t}.${a?"disabledCaption":"caption"}`)})]})}const Ht=[v.CRYPTO,v.DEBIT,v.CREDIT];function Vt(t){const{disabledOptions:n=[],paymentOptions:a,onClick:r,captions:o}=t,s=a||Ht;return e(m,{testId:"payment-options-list",sx:{width:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start"},rc:e(pe.div,{variants:Ee,initial:"hidden",animate:"show"}),children:s.map(((t,a)=>e(Bt,{type:t,onClick:r,disabled:n.includes(t),caption:o?.[t],rc:e(pe.div,{custom:a,variants:fe})},`payment-type-${t}`)))})}function Yt(){const{t:t}=D(),{viewDispatch:n}=a.useContext(_),{sign:r,goToErrorView:o,paymentMethod:s,setPaymentMethod:i,disabledPaymentTypes:c,invalidParameters:d,multicurrency:u}=gt(),{sendPageView:l,sendCloseEvent:p,sendSelectedPaymentMethod:E}=bt();return a.useEffect((()=>{if(s&&E(s,Ge.PAYMENT_METHODS),s&&[v.DEBIT,v.CREDIT].includes(s)&&(r($e.FIAT,void 0,(()=>{n({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAY_WITH_CARD}}})})),n({payload:{type:S.UPDATE_VIEW,view:{type:O.LOADING_VIEW,data:{loadingText:t("views.PAYMENT_METHODS.loading.ready1")}}}})),s&&s===v.CRYPTO){if(u)return void n({payload:{type:S.UPDATE_VIEW,view:{type:Ge.ORDER_SUMMARY,subView:qe.INIT}}});n({payload:{type:S.UPDATE_VIEW,view:{type:Ge.FUND_WITH_SMART_CHECKOUT,subView:je.INIT}}})}}),[s]),a.useEffect((()=>l(Ge.PAYMENT_METHODS)),[]),a.useEffect((()=>{d&&o(ze.INVALID_PARAMETERS)}),[d]),e(ae,{testId:"payment-methods",header:e(ee,{onCloseButtonClick:()=>p(Ge.PAYMENT_METHODS)}),footer:e(te,{}),children:L(m,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[e(z,{size:"small",sx:{paddingX:"base.spacing.x4"},children:t("views.PAYMENT_METHODS.header.heading")}),e(m,{sx:{paddingX:"base.spacing.x2"},children:e(Vt,{disabledOptions:c,onClick:e=>{i(e)}})})]})})}function Kt({biomeTheme:t,transactionHash:n,blockExplorerLink:r,errorType:o=ze.DEFAULT}){const{t:s}=D(),{goBackToPaymentMethods:i}=gt(),{eventTargetState:{eventTarget:c}}=a.useContext(H),d=()=>{Q(c)},u={[ze.TRANSACTION_FAILED]:{onActionClick:i,onSecondaryActionClick:n?()=>{window.open(r)}:d,statusType:Te.FAILURE,statusIconStyles:{fill:t.color.status.destructive.dim}},[ze.SERVICE_BREAKDOWN]:{onSecondaryActionClick:d,statusType:Te.INFORMATION,statusIconStyles:{fill:t.color.status.fatal.dim}},[ze.PRODUCT_NOT_FOUND]:{onSecondaryActionClick:d,statusType:Te.INFORMATION,statusIconStyles:{fill:t.color.status.fatal.dim}},[ze.INSUFFICIENT_STOCK]:{onSecondaryActionClick:d,statusType:Te.INFORMATION,statusIconStyles:{fill:t.color.status.fatal.dim}},[ze.TRANSAK_FAILED]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.WALLET_FAILED]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION,statusIconStyles:{fill:t.color.status.fatal.dim}},[ze.WALLET_REJECTED_NO_FUNDS]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.WALLET_REJECTED]:{onActionClick:()=>{i(v.CRYPTO)},onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.WALLET_POPUP_BLOCKED]:{onActionClick:()=>{i(v.CRYPTO)},onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.SMART_CHECKOUT_ERROR]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.SMART_CHECKOUT_EXECUTE_ERROR]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION},[ze.INVALID_PARAMETERS]:{onSecondaryActionClick:d,statusType:Te.ALERT,statusIconStyles:{fill:t.color.status.attention.dim,transform:"none"}},[ze.DEFAULT]:{onActionClick:i,onSecondaryActionClick:d,statusType:Te.INFORMATION}};return e(ye,{...(()=>{const e=u[o]||{},a=o===ze.TRANSACTION_FAILED&&n?s(`views.SALE_FAIL.errors.${o}.secondaryAction`):s(`views.SALE_FAIL.errors.${ze.DEFAULT}.secondaryAction`);return{testId:"fail-view",statusText:s(`views.SALE_FAIL.errors.${o}.description`),actionText:s(`views.SALE_FAIL.errors.${o}.primaryAction`),onActionClick:e?.onActionClick,secondaryActionText:a,onSecondaryActionClick:e?.onSecondaryActionClick,onCloseClick:d,statusType:e.statusType,statusIconStyles:{transform:"rotate(180deg)",fill:t.color.status.guidance.dim,...e.statusIconStyles}}})()})}function Gt({balance:t,conversions:n,canOpen:a,onClick:r,onProceed:o,loading:s,priceDisplay:i}){const{t:c}=D(),{environment:d,config:{theme:u}}=gt(),{token:l,userBalance:m,fundsRequired:p}=t.fundingItem,E=R(p.formattedAmount,l.symbol,n,""),f=R(m.formattedBalance,l.symbol,n,"");return L(Ie,{sx:{w:"100%",bradtl:"base.borderRadius.x6",bradtr:"base.borderRadius.x6",px:"base.spacing.x4",pb:"base.spacing.x6",bg:"base.color.neutral.800",border:"0px solid transparent",borderTopWidth:"base.border.size.100",borderTopColor:"base.color.translucent.emphasis.400"},children:[L(q,{size:"medium",children:[e(q.FramedImage,{alt:l.name,circularFrame:!0,imageUrl:l.icon,defaultImageUrl:Ce(d,u)}),e(q.Label,{children:c("views.ORDER_SUMMARY.orderReview.payWith",{symbol:l.symbol})}),e(q.Caption,{rc:e(z,{size:"xSmall"}),children:`${c("views.ORDER_SUMMARY.orderReview.balance",{amount:ge(X(m.formattedBalance))})} ${f?c("views.ORDER_SUMMARY.currency.fiat",{amount:ge(X(f))}):""}`}),i&&e(q.PriceDisplay,{use:e(z,{size:"xSmall"}),fiatAmount:E?c("views.ORDER_SUMMARY.currency.fiat",{amount:E}):void 0,price:c("views.ORDER_SUMMARY.currency.price",{symbol:l.symbol,amount:X(p.formattedAmount)})}),a&&e(q.StatefulButtCon,{icon:"ChevronExpand",onClick:r}),!a&&s&&e(tt,{radius:"base.icon.size.400"})]}),e($,{size:"large",onClick:()=>o(t),children:c("views.ORDER_SUMMARY.orderReview.continue")})]})}const jt=e=>{let t=[];e.type===A.SWAP&&(t=[e.fees.approvalGasFee,e.fees.swapGasFee,...e.fees.swapFees]);return t.filter((e=>e.amount.gt(0)&&e.token)).reduce(((e,{amount:t,token:n})=>{if(!n)return e;if(e[n.symbol]){const a=e[n.symbol].amount.add(t);return{...e,[n.symbol]:{...e[n.symbol],amount:a,formattedAmount:Pe(a,n.decimals)}}}return n.symbol?{...e,[n.symbol]:{amount:t,symbol:n.symbol,formattedAmount:Pe(t,n.decimals)}}:e}),{})};function qt({rc:t=e("span",{}),balance:n,conversions:a,selected:r,transactionRequirement:o,onClick:s}){const{t:i}=D(),{environment:c,config:{theme:d}}=gt(),{token:u,userBalance:l,fundsRequired:m}=n.fundingItem,p=R(l.formattedBalance,u.symbol,a,""),E=Object.entries(jt(n));return L(q,{rc:t,sx:{mb:"base.spacing.x1"},size:"medium",emphasized:!0,...{onClick:s,selected:r},children:[e(q.FramedImage,{circularFrame:!0,alt:u.name,imageUrl:u.icon,defaultImageUrl:Ce(c,d)}),e(q.PriceDisplay,{use:e(z,{size:"xSmall"}),fiatAmount:p?i("views.ORDER_SUMMARY.currency.fiat",{amount:p}):void 0,price:X(l.formattedBalance)}),e(q.Label,{sx:{display:"flex",wordBreak:"default"},children:u.symbol}),L(q.Caption,{children:[i(`views.ORDER_SUMMARY.coinsDrawer.stepType${o?.sufficient?".":".delta."}${n.type}`,{required:{symbol:o?.current.type!==C.ERC721&&o?.current.token.symbol,amount:ge(X(o?.current.formattedBalance||0))},symbol:n.fundingItem.token.symbol,amount:ge(X(m.formattedAmount))}),E.length>0&&" | ",E.length>0&&E.map((([e,{formattedAmount:t}])=>L("span",{children:[i("views.ORDER_SUMMARY.coinsDrawer.fee",{symbol:e,amount:ge(X(t))})," "]},e)))]})]})}function zt({conversions:t,balances:n,selectedIndex:a,visible:r,loading:o,transactionRequirement:s,onClose:i,onSelect:c,onPayWithCard:d,disabledPaymentTypes:u}){const{t:l}=D();return e(J,{size:"full",visible:r,showHeaderBar:!0,onCloseDrawer:i,headerBarTitle:l("views.ORDER_SUMMARY.coinsDrawer.header"),children:e(J.Content,{rc:e(pe.div,{variants:Ee,initial:"hidden",animate:"show"}),children:L(m,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between",px:"base.spacing.x4"},children:[L(m,{children:[L(m,{sx:{display:"flex",justifyContent:"space-between",mb:"base.spacing.x2"},children:[e(Ke,{size:"small",children:l("views.ORDER_SUMMARY.coinsDrawer.caption1")}),e(Ke,{size:"small",children:l("views.ORDER_SUMMARY.coinsDrawer.caption2")})]}),n?.map(((n,r)=>{return e(qt,{onClick:(o=r,()=>{c(o),i()}),balance:n,selected:a===r,conversions:t,transactionRequirement:s,rc:e(pe.div,{variants:fe,custom:r})},`${n.fundingItem.token.symbol}-${n.type}`);var o})),o&&e(pe.div,{variants:fe,custom:n.length,children:e(q,{shimmer:!0,emphasized:!0,testId:"funding-balance-item-shimmer"})},"funding-balance-item-shimmer")]}),d&&L(m,{sx:{pb:"base.spacing.x4"},rc:e(pe.div,{variants:fe,custom:n.length+(o?1:0)}),children:[e(Ae,{size:"small",rc:e(Ke,{}),sx:{my:"base.spacing.x4"},children:l("views.ORDER_SUMMARY.coinsDrawer.divider")}),e(Vt,{onClick:d,paymentOptions:[v.DEBIT,v.CREDIT].filter((e=>!u?.includes(e))),captions:{[v.DEBIT]:l("views.ORDER_SUMMARY.coinsDrawer.payWithCard.caption"),[v.CREDIT]:l("views.ORDER_SUMMARY.coinsDrawer.payWithCard.caption")}})]})]})})})}function Xt({item:t,balance:n,conversions:a,rc:r=e("span",{})}){const{t:o}=D(),{token:s,fundsRequired:i}=n.fundingItem,c=i.formattedAmount,d=R(c,s.symbol,a);return L(q,{rc:r,emphasized:!0,size:"medium",sx:{pointerEvents:"none",mb:"base.spacing.x1"},children:[e(q.FramedImage,{imageUrl:t.image}),e(q.Label,{children:t.name}),e(q.Caption,{children:t.qty>1?o("views.ORDER_SUMMARY.orderItem.quantity",{qty:t.qty}):null}),e(q.PriceDisplay,{use:e(z,{size:"xSmall"}),price:o("views.ORDER_SUMMARY.currency.price",{symbol:s.symbol,amount:X(c)}),fiatAmount:o("views.ORDER_SUMMARY.currency.fiat",{amount:d})})]},t.name)}function $t({items:t,balance:n,conversions:a}){return e(m,{rc:e(pe.div,{variants:Ee,initial:"hidden",animate:"show"}),children:t.map(((t,r)=>e(Xt,{item:t,balance:n,conversions:a,rc:e(pe.div,{variants:fe,custom:r})},t.name)))})}function Zt({items:t,fundingBalances:n,conversions:r,collectionName:o,loadingBalances:s,transactionRequirement:i,onBackButtonClick:c,onPayWithCard:d,onProceedToBuy:u,disabledPaymentTypes:l}){const{eventTargetState:{eventTarget:p}}=a.useContext(H),{t:E}=D(),{sendSelectedPaymentToken:f}=bt(),[T,y]=a.useState(!1),[C,g]=a.useState(0);return L(ae,{testId:"order-review",header:e(ee,{showBack:!0,onCloseButtonClick:()=>Q(p),onBackButtonClick:c,title:o}),bodyStyleOverrides:{display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[L(m,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x2",paddingY:"base.spacing.x8",rowGap:"base.spacing.x4"},children:[e(z,{size:"small",sx:{paddingX:"base.spacing.x4"},children:E("views.ORDER_SUMMARY.orderReview.heading")}),e(m,{sx:{paddingX:"base.spacing.x2"},children:e($t,{items:t,balance:n[C],conversions:r})})]}),e(Gt,{onClick:()=>{y(!0)},onProceed:u,balance:n[C],conversions:r,canOpen:n.length>1,loading:s}),e(zt,{conversions:r,balances:n,onSelect:e=>{g(e);const{fundingItem:t}=n[C];f(qe.REVIEW_ORDER,t,r)},onClose:()=>{y(!1)},selectedIndex:C,visible:T,loading:s,onPayWithCard:d,transactionRequirement:i,disabledPaymentTypes:l})]})}const Jt=(e,t)=>{const n=Re(e.address)?e.symbol:e.address??"";return{...e,icon:he(t,n)}},Qt=(e,t)=>{return{type:Ze.SUFFICIENT,fundingItem:{type:C.ERC20,token:Jt((n=e,n.current.type!==C.ERC721&&n.current.token),t),fundsRequired:{amount:e.required.balance,formattedAmount:e.required.formattedBalance},userBalance:{balance:e.current.balance,formattedBalance:e.current.formattedBalance}}};var n},en=(e,t)=>{if(0===e.length)return[];const n=e.filter((e=>1===e.steps.length)),a=[C.ERC20,C.NATIVE];return n.flatMap((e=>e.steps.filter((e=>a.includes(e.fundingItem.type))))).map((e=>({...e,fundingItem:{...e.fundingItem,token:Jt(e.fundingItem.token,t)}})))},tn=e=>{let t=[];const n=(a=e.name,(e,t)=>{const n=e.fundingItem&&e.fundingItem.token&&e.fundingItem.token.symbol===a?-1:0,r=t.fundingItem&&t.fundingItem.token&&t.fundingItem.token.symbol===a?-1:0;return n!==r?n-r:e.type===Ze.SUFFICIENT&&t.type===Ze.SUFFICIENT?0:e.type===Ze.SUFFICIENT?-1:t.type===Ze.SUFFICIENT?1:0});var a;return e=>(0===e.length||(t=Array.from(new Set([...t,...e])).sort(n)),t)},nn=async e=>{const{provider:t,checkout:n,currencies:a,baseCurrency:r,onFundingBalance:o,getAmountByCurrency:s,getIsGasless:i,onComplete:c,onFundingRequirement:d}=e,u=t?.getSigner(),l=await(u?.getAddress())||"",m=n.config.environment,p=tn(r),E=e=>{Array.isArray(e)&&e.length>0&&o(p(e))},T=a.map((async e=>{const a=s(e);if(!a)return null;const r=((e,t,n)=>[{type:C.ERC20,tokenAddress:n,spenderAddress:t,amount:e}])(a,l,e.address),o=i()?void 0:{type:g.GAS,gasToken:{type:I.NATIVE,limit:f.from("30000000")}};return{currency:e,smartCheckoutResult:await n.smartCheckout({provider:t,itemRequirements:r,transactionOrGasAmount:o,routingOptions:{bridge:!1,onRamp:!1,swap:!0},fundingRouteFullAmount:!0,onComplete:()=>{c?.(p([]))},onFundingRoute:e=>{E(en([e],m))}})}})).filter(Boolean),A=await(async(e,t)=>{const n=e.map((async e=>{const n=await e;return t(n),n}));return await Promise.all(n)})(T,(({currency:e,smartCheckoutResult:t})=>{if(E(((e,t)=>{if(!0===e.sufficient){const n=e.transactionRequirements.find((e=>e.type===C.ERC20));if(n&&n.type===C.ERC20)return[Qt(n,t)]}return!1===e.sufficient&&e?.router?.routingOutcome.type===y.ROUTES_FOUND?en(e.router.routingOutcome.fundingRoutes,t):null})(t,m)),e.base){const e=t.transactionRequirements[0];d(e)}}));return A},an=()=>{const e=a.useRef(!1),{fromTokenAddress:t,clientConfig:n,provider:r,checkout:o,selectedCurrency:s}=gt(),[i,c]=a.useState(),[d,u]=a.useState([]),[l,m]=a.useState([]),[p,E]=a.useState(!1);return{fundingBalances:d,loadingBalances:p,fundingBalancesResult:l,transactionRequirement:i,queryFundingBalances:()=>{t&&r&&o&&n&&s&&(e.current||(async()=>{e.current=!0,E(!0);try{const e=await nn({provider:r,checkout:o,currencies:n.currencies,routingOptions:{bridge:!1,onRamp:!1,swap:!0},baseCurrency:s,getAmountByCurrency:e=>n.currencyConversion?.[e.name.toUpperCase()]?.amount?.toString(),getIsGasless:()=>r.provider?.isPassport||!1,onFundingBalance:e=>{u([...e])},onComplete:()=>{E(!1)},onFundingRequirement:e=>{c(e)}});m(e)}catch{E(!1)}finally{e.current=!1}})())}}},rn=e=>{if(e&&e.current.type!==C.ERC721)return e.current.token},on=e=>{const t=e.find((({type:e})=>e===C.NATIVE)),n=e.find((({type:e})=>e===C.ERC20)),a=it(f.from(n?.delta?.balance||f.from(0))),r=Pe(a,rn(n)?.decimals),o=it(f.from(t?.delta?.balance||f.from(0))),s=Pe(o,rn(t)?.decimals),i={erc20:{value:r,symbol:rn(n)?.symbol},native:{value:s,symbol:rn(t)?.symbol}};let c=["views.PAYMENT_METHODS.topUp.subheading.erc20",i],d=r,u=rn(n)?.address;return t&&n&&!t.sufficient&&!n.sufficient&&(c=["views.PAYMENT_METHODS.topUp.subheading.both",i]),t&&n&&!t.sufficient&&n.sufficient&&(d=s,u=rn(t)?.address,c=["views.PAYMENT_METHODS.topUp.subheading.native",i]),{heading:["views.PAYMENT_METHODS.topUp.heading"],subheading:c,amount:d,tokenAddress:u}};function sn({subView:t}){const{t:n}=D(),{sendPageView:r,sendProceedToPay:o}=bt(),{items:s,fromTokenAddress:i,collectionName:c,disabledPaymentTypes:d,goToErrorView:u,goBackToPaymentMethods:l,sign:p,selectedCurrency:E}=gt(),{viewDispatch:f,viewState:T}=a.useContext(_),{cryptoFiatDispatch:y,cryptoFiatState:C}=a.useContext(Me),g=e=>{p($e.CRYPTO,e),f({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAY_WITH_COINS}}})},I=()=>{g(E?.address)},{fundingBalances:A,loadingBalances:R,fundingBalancesResult:h,transactionRequirement:v,queryFundingBalances:b}=an();return a.useEffect((()=>{t===qe.INIT&&i&&b()}),[t,i]),a.useEffect((()=>{0!==A.length&&f({payload:{type:S.UPDATE_VIEW,view:{type:Ge.ORDER_SUMMARY,subView:qe.REVIEW_ORDER}}})}),[A]),a.useEffect((()=>{if(!R&&h.length&&!(A.length>0))try{const e=h.find((e=>e.currency.base))?.smartCheckoutResult,t=on(e.transactionRequirements);f({payload:{type:S.UPDATE_VIEW,view:{type:O.TOP_UP_VIEW,data:t}}})}catch(e){u(ze.SMART_CHECKOUT_EXECUTE_ERROR,e)}}),[A,R,h]),a.useEffect((()=>{if(!y||0===A.length||R)return;const e=A.map((({fundingItem:e})=>e.token.symbol));y({payload:{type:Ue.SET_TOKEN_SYMBOLS,tokenSymbols:e}})}),[y,A,R]),a.useEffect((()=>{if(R||!s.length||!C.conversions)return;const e=A.map((({fundingItem:e})=>Dt(e,C.conversions)));r(Ge.ORDER_SUMMARY,{subView:qe.REVIEW_ORDER,tokens:e,items:s,collectionName:c})}),[s,c,A,R,C]),L(m,{children:[t===qe.INIT&&e(F,{loadingText:n("views.FUND_WITH_SMART_CHECKOUT.loading.checkingBalances")}),t===qe.REVIEW_ORDER&&e(Zt,{items:s,fundingBalances:A,conversions:C.conversions,collectionName:c,loadingBalances:R,onBackButtonClick:l,onProceedToBuy:e=>{const{type:t,fundingItem:n}=e;o(Ge.ORDER_SUMMARY,n,C.conversions),t!==Ze.SUFFICIENT?f({payload:{type:S.UPDATE_VIEW,view:{type:Ge.ORDER_SUMMARY,subView:qe.EXECUTE_FUNDING_ROUTE,data:{fundingBalance:e,onFundingRouteExecuted:I}}}}):g(n.token.address)},transactionRequirement:v,onPayWithCard:e=>l(e),disabledPaymentTypes:d}),t===qe.EXECUTE_FUNDING_ROUTE&&e(At,{fundingRouteStep:T.view.data.fundingBalance,onFundingRouteExecuted:I})]})}function cn(){return e(m,{testId:"credit-card-warning-hero",children:e(m,{children:L("svg",{width:"430",height:"161",viewBox:"0 0 430 161",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("path",{d:"M172.973 133.128C171.472 132.262 170.399 130.653 170.399 128.67V91.134C170.399 87.4566 171.381 83.9165 173.158 80.8356C174.934 77.7546 177.509 75.137 180.697 73.2962L199.556 62.4057L231.623 44.1673C233.339 43.1761 235.27 43.3005 236.772 44.1673L229.34 39.8763C227.838 39.0095 225.907 38.8851 224.191 39.8763L192.124 58.1147L173.265 69.0052C170.077 70.8461 166.889 72.6253 165.112 75.7062C163.336 78.7872 162.967 83.1656 162.967 86.843V124.379C162.967 126.361 164.04 127.971 165.541 128.837L172.973 133.128Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M239.133 48.6725V85.9384C239.133 96.0882 236.344 99.3065 228.835 103.776L178.124 133.123C174.691 135.105 170.4 132.629 170.4 128.665V91.3985C170.4 82.7861 172.193 78.066 180.698 73.5609L231.409 44.2142C234.842 42.2317 239.133 44.7076 239.133 48.6725Z",fill:"#F3F3F3",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M172.973 133.127C171.472 132.26 170.399 130.651 170.399 128.668V91.3681C170.399 87.6907 170.631 83.7216 172.407 80.6406L164.975 76.3496C163.198 79.4306 162.967 83.3997 162.967 87.0771L162.967 124.377C162.967 126.36 164.04 127.969 165.541 128.836L172.973 133.127Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.64647",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M170.261 125.267V114.74L239.346 75.0625V85.3194L170.261 125.267Z",fill:"#0D0D0D",stroke:"black",strokeWidth:"0.823233"}),L("g",{clipPath:"url(#clip0_1548_70742)",children:[e("path",{d:"M228.362 71.9146C219.392 76.9925 219.392 93.5869 228.362 108.975C237.331 124.363 251.872 132.721 260.842 127.643L249.638 134.081C240.669 139.159 226.128 130.802 217.158 115.414C208.189 100.026 208.189 83.4311 217.158 78.3532L228.362 71.9146Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M228.361 71.9146C219.392 76.9925 219.392 93.5869 228.361 108.975C237.331 124.363 251.872 132.721 260.841 127.643C269.811 122.565 269.811 105.97 260.841 90.5822C251.872 75.194 237.331 66.8367 228.361 71.9146ZM234.856 83.0619C239.099 80.6582 245.416 83.268 250.539 89.0026L232.165 99.4117C229.72 92.1618 230.612 85.4657 234.856 83.0619ZM254.343 116.5C250.1 118.904 243.782 116.294 238.659 110.559L257.034 100.15C259.479 107.4 258.586 114.096 254.343 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M234.856 83.0618C239.099 80.658 245.417 83.2678 250.54 89.0024L232.165 99.4115C229.72 92.1617 230.613 85.4655 234.856 83.0618Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M254.347 116.5C250.104 118.903 243.787 116.294 238.664 110.559L257.038 100.15C259.483 107.4 258.591 114.096 254.347 116.5Z",fill:"#FAFD7E",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M232.165 99.4115C230.94 95.7844 230.552 92.299 231.001 89.4188C231.449 86.5386 232.734 84.2636 234.856 83.0618C236.977 81.8599 239.617 81.9114 242.368 82.9802L232.165 99.4115Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),e("path",{d:"M246.835 116.581C244.084 115.513 241.225 113.426 238.664 110.559L247.853 105.357L257.042 100.154L246.84 116.586L246.835 116.581Z",fill:"black",stroke:"black",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),e("defs",{children:e("clipPath",{id:"clip0_1548_70742",children:e("rect",{width:"58",height:"66",fill:"white",transform:"translate(210 70)"})})})]})})})}function dn(){const{t:t}=D(),{showCreditCardWarning:n,setShowCreditCardWarning:a,setPaymentMethod:r}=gt();return e(J,{size:"threeQuarter",visible:n,showHeaderBar:!1,children:L(J.Content,{children:[e(_e,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>a(!1)}),e(cn,{}),L(m,{sx:{px:"base.spacing.x12"},children:[e(z,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:t("views.PAYMENT_METHODS.creditCardWarningDrawer.heading")}),e(ne,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:t("views.PAYMENT_METHODS.creditCardWarningDrawer.body")}),e($,{sx:{width:"100%"},testId:"credit-card-button",variant:"primary",size:"large",onClick:()=>{r(v.CREDIT)},children:t("views.PAYMENT_METHODS.creditCardWarningDrawer.ctaButton")})]})]})})}function un(t){const{t:n}=D(),{config:r,amount:o,items:s,environmentId:i,collectionName:c,excludePaymentTypes:d,multicurrency:u=!1}=t,{connectLoaderState:l}=a.useContext(b),{checkout:m,provider:p}=l,E=a.useRef(),{eventTargetState:{eventTarget:f}}=a.useContext(H),{theme:T}=r,y=a.useMemo((()=>Se(T)),[T]),[C,g]=a.useReducer(ve,Oe),I=a.useMemo((()=>({viewState:C,viewDispatch:g})),[C,g]),A=C.view.data?.loadingText||n("views.LOADING_VIEW.text");a.useEffect((()=>{m&&p&&(async()=>{const e=await m.getNetworkInfo({provider:p});E.current=e.chainId})()}),[m,p]);const R=a.useRef(!1),h=a.useCallback((()=>{m&&p&&(R.current||(R.current=!0,g({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAYMENT_METHODS}}})))}),[m,p]);return a.useEffect((()=>{m&&p&&h()}),[m,p]),e(_.Provider,{value:I,children:e(Ct,{value:{config:r,items:s,amount:o,environment:r.environment,environmentId:i,provider:p,checkout:m,passport:m?.passport,collectionName:c,excludePaymentTypes:d,multicurrency:u},children:L(Fe,{environment:r.environment,children:[C.view.type===O.LOADING_VIEW&&e(F,{loadingText:A}),C.view.type===Ge.PAYMENT_METHODS&&e(Yt,{}),C.view.type===Ge.PAY_WITH_CARD&&e(xt,{}),C.view.type===Ge.PAY_WITH_COINS&&e(Wt,{}),C.view.type===Ge.SALE_FAIL&&e(Kt,{biomeTheme:y,errorType:C.view.data?.errorType,transactionHash:C.view.data?.transactionHash,blockExplorerLink:De.getTransactionLink(E.current,C.view.data?.transactionHash)}),C.view.type===Ge.FUND_WITH_SMART_CHECKOUT&&e(wt,{subView:C.view.subView}),C.view.type===Ge.ORDER_SUMMARY&&e(sn,{subView:C.view.subView}),C.view.type===O.TOP_UP_VIEW&&e(Le,{analytics:{userJourney:oe.SALE},widgetEvent:U.IMTBL_SALE_WIDGET_EVENT,checkout:m,provider:p,showOnrampOption:r.isOnRampEnabled,showSwapOption:r.isSwapEnabled,showBridgeOption:r.isBridgeEnabled,onCloseButtonClick:()=>Q(f),onBackButtonClick:()=>{g({payload:{type:S.UPDATE_VIEW,view:{type:Ge.PAYMENT_METHODS}}})},amount:C.view.data?.amount,tokenAddress:C.view.data?.tokenAddress,heading:C.view.data?.heading,subheading:C.view.data?.subheading}),e(dn,{})]})})})}export{un as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dm as n,dn as t}from"./index-e89e8900.js";function i(i){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:return[4,import("./index.umd-592ef339.js").then((function(n){return n.i}))];case 1:return n=t.sent(),i._plugins=n,[2]}}))}))}export{i as loadLegacyVideoPlugins};
|