@imtbl/checkout-widgets 2.24.5 → 2.24.6

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.
Files changed (35) hide show
  1. package/dist/browser/{AddTokensWidget-Clbg163Q.js → AddTokensWidget-DtKOUsGu.js} +3 -3
  2. package/dist/browser/{BridgeWidget-KZ93rgVX.js → BridgeWidget-BEyIilgs.js} +7 -7
  3. package/dist/browser/{CommerceWidget-BGFEo2Mz.js → CommerceWidget-lHiaZb79.js} +13 -13
  4. package/dist/browser/{FeesBreakdown-MXttgF9g.js → FeesBreakdown-CGoQZNw_.js} +1 -1
  5. package/dist/browser/{OnRampWidget-Csk6zFNi.js → OnRampWidget-XiCeV2Y1.js} +3 -3
  6. package/dist/browser/{SaleWidget-DhFTG5jh.js → SaleWidget-wg7122ny.js} +10 -10
  7. package/dist/browser/{SpendingCapHero-DMhoCXNk.js → SpendingCapHero-50L-8e0O.js} +1 -1
  8. package/dist/browser/{SwapWidget-5cYssslL.js → SwapWidget-DyRGb56t.js} +7 -8
  9. package/dist/browser/{TokenImage-C_HL3hUH.js → TokenImage-BSEcsGPt.js} +1 -1
  10. package/dist/browser/{TopUpView-BRAksgxo.js → TopUpView-BruGxwia.js} +1 -1
  11. package/dist/browser/{WalletApproveHero-BkMI_HkP.js → WalletApproveHero-BNeRqb6c.js} +46 -20
  12. package/dist/browser/{WalletWidget-DnwrQj2F.js → WalletWidget-Qucp_iny.js} +3 -3
  13. package/dist/browser/{auto-track-lr-0xC0L.js → auto-track-YBHEPAZ3.js} +1 -1
  14. package/dist/browser/{index-D8bpXcfM.js → index-B_AfOz3m.js} +1 -1
  15. package/dist/browser/{index-DI1RAoPP.js → index-BuHtApNC.js} +1 -1
  16. package/dist/browser/{index-DJNRxwo3.js → index-C1C2zjQB.js} +1 -1
  17. package/dist/browser/{index-vx-Xcy1M.js → index-CZghGU-d.js} +54 -27
  18. package/dist/browser/{index-B64hLdVN.js → index-DRpwE8WW.js} +1 -1
  19. package/dist/browser/{index-CuQxoUxX.js → index-Do4ES1-4.js} +2 -2
  20. package/dist/browser/{index-C4oAI8Yr.js → index-DqtCQcyE.js} +1 -1
  21. package/dist/browser/{index-g3O4Hd06.js → index-DtCucxzi.js} +1 -1
  22. package/dist/browser/index.js +1 -1
  23. package/dist/browser/{index.umd-eUSqWuBe.js → index.umd-CjyGntCd.js} +1 -1
  24. package/dist/browser/{useInterval-DvnezEs1.js → useInterval-C-BIKYov.js} +1 -1
  25. package/dist/types/lib/chains.d.ts +15 -0
  26. package/package.json +7 -7
  27. package/src/components/NetworkSwitchDrawer/NetworkSwitchDrawer.tsx +50 -30
  28. package/src/lib/chains.test.ts +42 -1
  29. package/src/lib/chains.ts +21 -0
  30. package/src/locales/en.json +8 -1
  31. package/src/widgets/bridge/components/BridgeReviewSummary.tsx +2 -1
  32. package/src/widgets/connect/components/WalletList.tsx +3 -3
  33. package/src/widgets/connect/views/ReadyToConnect.tsx +3 -3
  34. package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +3 -3
  35. package/src/widgets/swap/components/SwapForm.tsx +2 -2
@@ -1,4 +1,4 @@
1
- import { e4 as getAugmentedNamespace, az as commonjsGlobal } from './index-vx-Xcy1M.js';
1
+ import { e5 as getAugmentedNamespace, az as commonjsGlobal } from './index-CZghGU-d.js';
2
2
 
3
3
  var dist$1 = {};
4
4
 
@@ -375,7 +375,7 @@ const clearGlobalNamespace = (namespace) => {
375
375
  };
376
376
  lib$4.clearGlobalNamespace = clearGlobalNamespace;
377
377
 
378
- const i$6=()=>typeof window>`u`,a$5=()=>!i$6();const s$4=()=>a$5()&&window.localStorage,c$6=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},l$4=e=>typeof e==`string`?e:JSON.stringify(e),u$2=e=>`__IMX-${e}`;function d$5(e){if(s$4())return c$6(window.localStorage.getItem(u$2(e)))}const f$7=(e,t)=>s$4()?(window.localStorage.setItem(u$2(e),l$4(t)),!0):!1;let m$3=0;const h$4=e=>{let t=parseInt(e,10)*1e3,n=new Date(t),r=new Date;return m$3=n.getTime()-r.getTime(),m$3},g$6=()=>{let e=new Date().getTime()+m$3;return new Date(e).toISOString()};(function(e){return e.RUNTIME_ID=`rid`,e.PASSPORT_CLIENT_ID=`passportClientId`,e.ENVIRONMENT=`env`,e.PUBLISHABLE_API_KEY=`pak`,e.IDENTITY=`uid`,e.DOMAIN=`domain`,e.SDK_VERSION=`sdkVersion`,e})({});const v$4=e=>{if(typeof Buffer<`u`)return Buffer.from(e,`utf-8`).toString(`base64`);if(typeof btoa==`function`)return btoa(unescape(encodeURIComponent(e)));throw Error(`Base64 encoding not supported in this environment`)};async function y$8(e,t){let n=JSON.stringify(t),r={payload:v$4(n)},i=await fetch(`https://api.immutable.com${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`Request failed (${i.status}): ${e||i.statusText}`)}return i.json()}let b$5,x$3;b$5=d$5(`metrics-events`)||[],x$3=d$5(`metrics-runtime`)||{};const S$5=(e,t)=>{x$3={...x$3,[e]:t},f$7(`metrics-runtime`,x$3);},C$5=e=>{if(x$3[e]!==void 0)return x$3[e]},w$5=()=>x$3,T$4=()=>b$5,E$7=e=>{b$5.push(e),f$7(`metrics-events`,b$5);},D$4=e=>{b$5=b$5.slice(e),f$7(`metrics-events`,b$5);},O$5=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{(typeof e==`string`||typeof n==`string`||typeof n==`number`||typeof n==`boolean`)&&t.push([e,n.toString()]);}),t},k$3=`2.24.5`,A$1=()=>i$6()?``:window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:``,j$6=()=>{if(i$6())return ``;let e;try{window.self!==window.top&&(e=A$1());}catch{}return e||=window.location.hostname,e},M$4=()=>{if(S$5(`sdkVersion`,k$3),i$6())return {browser:`nodejs`,sdkVersion:k$3};let e=j$6();return e&&S$5(`domain`,e),{sdkVersion:k$3,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}};let N$3=!1;const P$1=()=>N$3,F$1=async()=>{N$3=!0;try{let{runtimeId:e,sTime:t}=await y$8(`/v1/sdk/initialise`,{version:1,data:{runtimeDetails:O$5(M$4()),runtimeId:C$5(`rid`),uId:C$5(`uid`)}});S$5(`rid`,e),h$4(t);}catch{N$3=!1;}};function I$3(e,t){return (...n)=>{try{let r=e(...n);return r instanceof Promise?r.catch(()=>t):r}catch{return t}}}function L$6(){return a$5()||typeof process>`u`?!1:process.env.JEST_WORKER_ID!==void 0}const R$1=I$3(L$6,!1),z$6=`imtbl__metrics`,B$3=(e,n)=>getGlobalisedValue_1(z$6,e,n),V$3=I$3(((n,r)=>{let i=memorise(r,{lruOptions:{ttl:5e3,max:1e3}});return getGlobalisedValue_1(z$6,n,i)})(`track`,(e,t,n)=>{E$7({event:`${e}.${t}`,time:g$6(),...n&&{properties:O$5(n)}});})),H$1=I$3(async()=>{if(P$1()===!1){await F$1();return}let e=T$4();if(e.length===0)return;let t=e.length;await y$8(`/v1/sdk/metrics`,{version:1,data:{events:e,details:w$5()}})instanceof Error||D$4(t);}),U$1=async()=>{await H$1(),setTimeout(U$1,5e3);};let W$1=!1;R$1()||I$3(B$3(`startFlushing`,()=>{W$1||(W$1=!0,U$1());}))();const G$3=(e,t,n,r)=>V$3(e,t,{...r||{},duration:Math.round(n)}),K$5=()=>{let e=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`},q$3=(...e)=>{if(!e.some(e=>!!e))return {};let t={};return e.forEach(e=>{e&&(t={...t,...e});}),t},J$2=e=>e.replace(/[^a-zA-Z0-9\s\-_]/g,``),Y$1=(e,t)=>`${e}_${J$2(t)}`,X$2=I$3((e,t,n=!0,r)=>{let i=K$5(),a=Date.now(),o=0,s=0,c={},l=(...e)=>q$3(c,...e,{flowId:i,flowName:t});c=l(r);let u=e=>{e&&(c=l(e));},d=(n,r)=>{let i=Y$1(t,n),a=0,c=performance.now();o>0&&(a=c-s);let u=l(r,{flowEventName:n,flowStep:o});G$3(e,i,a,u),o++,s=c;};return n&&d(`Start`),{details:{moduleName:e,flowName:t,flowId:i,flowStartTime:a},addEvent:I$3(d),addFlowProperties:I$3(u)}}),Z$2=I$3((e,t,n,r)=>{let{message:i}=n,a=n.stack||``,{cause:o}=n;o instanceof Error&&(a=`${a} \nCause: ${o.message}\n ${o.stack}`),V$3(e,`trackError_${t}`,{...r||{},errorMessage:i,errorStack:a,isTrackError:!0});}),ee$1=I$3(B$3(`setEnvironment`,e=>{S$5(`env`,e);}));I$3(B$3(`setPassportClientId`,e=>{S$5(`passportClientId`,e);}));I$3(B$3(`setPublishableApiKey`,e=>{S$5(`pak`,e);}));I$3(B$3(`getDetail`,C$5));
378
+ const i$6=()=>typeof window>`u`,a$5=()=>!i$6();const s$4=()=>a$5()&&window.localStorage,c$6=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},l$4=e=>typeof e==`string`?e:JSON.stringify(e),u$2=e=>`__IMX-${e}`;function d$5(e){if(s$4())return c$6(window.localStorage.getItem(u$2(e)))}const f$7=(e,t)=>s$4()?(window.localStorage.setItem(u$2(e),l$4(t)),!0):!1;let m$3=0;const h$4=e=>{let t=parseInt(e,10)*1e3,n=new Date(t),r=new Date;return m$3=n.getTime()-r.getTime(),m$3},g$6=()=>{let e=new Date().getTime()+m$3;return new Date(e).toISOString()};(function(e){return e.RUNTIME_ID=`rid`,e.PASSPORT_CLIENT_ID=`passportClientId`,e.ENVIRONMENT=`env`,e.PUBLISHABLE_API_KEY=`pak`,e.IDENTITY=`uid`,e.DOMAIN=`domain`,e.SDK_VERSION=`sdkVersion`,e})({});const v$4=e=>{if(typeof Buffer<`u`)return Buffer.from(e,`utf-8`).toString(`base64`);if(typeof btoa==`function`)return btoa(unescape(encodeURIComponent(e)));throw Error(`Base64 encoding not supported in this environment`)};async function y$8(e,t){let n=JSON.stringify(t),r={payload:v$4(n)},i=await fetch(`https://api.immutable.com${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`Request failed (${i.status}): ${e||i.statusText}`)}return i.json()}let b$5,x$3;b$5=d$5(`metrics-events`)||[],x$3=d$5(`metrics-runtime`)||{};const S$5=(e,t)=>{x$3={...x$3,[e]:t},f$7(`metrics-runtime`,x$3);},C$5=e=>{if(x$3[e]!==void 0)return x$3[e]},w$5=()=>x$3,T$4=()=>b$5,E$7=e=>{b$5.push(e),f$7(`metrics-events`,b$5);},D$4=e=>{b$5=b$5.slice(e),f$7(`metrics-events`,b$5);},O$5=e=>{let t=[];return Object.entries(e).forEach(([e,n])=>{(typeof e==`string`||typeof n==`string`||typeof n==`number`||typeof n==`boolean`)&&t.push([e,n.toString()]);}),t},k$3=`2.24.6`,A$1=()=>i$6()?``:window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:``,j$6=()=>{if(i$6())return ``;let e;try{window.self!==window.top&&(e=A$1());}catch{}return e||=window.location.hostname,e},M$4=()=>{if(S$5(`sdkVersion`,k$3),i$6())return {browser:`nodejs`,sdkVersion:k$3};let e=j$6();return e&&S$5(`domain`,e),{sdkVersion:k$3,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}};let N$3=!1;const P$1=()=>N$3,F$1=async()=>{N$3=!0;try{let{runtimeId:e,sTime:t}=await y$8(`/v1/sdk/initialise`,{version:1,data:{runtimeDetails:O$5(M$4()),runtimeId:C$5(`rid`),uId:C$5(`uid`)}});S$5(`rid`,e),h$4(t);}catch{N$3=!1;}};function I$3(e,t){return (...n)=>{try{let r=e(...n);return r instanceof Promise?r.catch(()=>t):r}catch{return t}}}function L$6(){return a$5()||typeof process>`u`?!1:process.env.JEST_WORKER_ID!==void 0}const R$1=I$3(L$6,!1),z$6=`imtbl__metrics`,B$3=(e,n)=>getGlobalisedValue_1(z$6,e,n),V$3=I$3(((n,r)=>{let i=memorise(r,{lruOptions:{ttl:5e3,max:1e3}});return getGlobalisedValue_1(z$6,n,i)})(`track`,(e,t,n)=>{E$7({event:`${e}.${t}`,time:g$6(),...n&&{properties:O$5(n)}});})),H$1=I$3(async()=>{if(P$1()===!1){await F$1();return}let e=T$4();if(e.length===0)return;let t=e.length;await y$8(`/v1/sdk/metrics`,{version:1,data:{events:e,details:w$5()}})instanceof Error||D$4(t);}),U$1=async()=>{await H$1(),setTimeout(U$1,5e3);};let W$1=!1;R$1()||I$3(B$3(`startFlushing`,()=>{W$1||(W$1=!0,U$1());}))();const G$3=(e,t,n,r)=>V$3(e,t,{...r||{},duration:Math.round(n)}),K$5=()=>{let e=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return `${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`},q$3=(...e)=>{if(!e.some(e=>!!e))return {};let t={};return e.forEach(e=>{e&&(t={...t,...e});}),t},J$2=e=>e.replace(/[^a-zA-Z0-9\s\-_]/g,``),Y$1=(e,t)=>`${e}_${J$2(t)}`,X$2=I$3((e,t,n=!0,r)=>{let i=K$5(),a=Date.now(),o=0,s=0,c={},l=(...e)=>q$3(c,...e,{flowId:i,flowName:t});c=l(r);let u=e=>{e&&(c=l(e));},d=(n,r)=>{let i=Y$1(t,n),a=0,c=performance.now();o>0&&(a=c-s);let u=l(r,{flowEventName:n,flowStep:o});G$3(e,i,a,u),o++,s=c;};return n&&d(`Start`),{details:{moduleName:e,flowName:t,flowId:i,flowStartTime:a},addEvent:I$3(d),addFlowProperties:I$3(u)}}),Z$2=I$3((e,t,n,r)=>{let{message:i}=n,a=n.stack||``,{cause:o}=n;o instanceof Error&&(a=`${a} \nCause: ${o.message}\n ${o.stack}`),V$3(e,`trackError_${t}`,{...r||{},errorMessage:i,errorStack:a,isTrackError:!0});}),ee$1=I$3(B$3(`setEnvironment`,e=>{S$5(`env`,e);}));I$3(B$3(`setPassportClientId`,e=>{S$5(`passportClientId`,e);}));I$3(B$3(`setPublishableApiKey`,e=>{S$5(`pak`,e);}));I$3(B$3(`getDetail`,C$5));
379
379
 
380
380
  let r$7=function(e){return e.PRODUCTION=`production`,e.SANDBOX=`sandbox`,e}({});(function(e){return e.API_KEY=`x-immutable-api-key`,e.PUBLISHABLE_KEY=`x-immutable-publishable-key`,e.RATE_LIMITING_KEY=`x-api-key`,e})({});var a$4=class a{environment;rateLimitingKey;apiKey;publishableKey;constructor(t){this.environment=t.environment,this.publishableKey=t.publishableKey,this.apiKey=t.apiKey,this.rateLimitingKey=t.rateLimitingKey,ee$1(t.environment),V$3(`config`,`created_imtbl_config`);}};
381
381
 
@@ -69413,7 +69413,14 @@ var drawers$3 = {
69413
69413
  controlledSwitch: {
69414
69414
  body: "You'll need to switch to the {{chain}} network to proceed"
69415
69415
  },
69416
- switchButton: "Switch to {{chain}}"
69416
+ unsupportedSwitch: {
69417
+ body: "Your {{wallet}} can't switch networks. Go back and choose a different wallet to use the {{chain}} network."
69418
+ },
69419
+ switchFailed: {
69420
+ body: "We couldn't switch to the {{chain}} network. Check your {{wallet}} and try again."
69421
+ },
69422
+ switchButton: "Switch to {{chain}}",
69423
+ retryButton: "Try again"
69417
69424
  },
69418
69425
  walletConnectionError: {
69419
69426
  unableToConnect: {
@@ -73681,7 +73688,7 @@ function snapshot(proxyObject, handlePromise) {
73681
73688
 
73682
73689
  const o$2=proxy({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),T$3={state:o$2,subscribe(e){return subscribe(o$2,()=>e(o$2))},push(e,t){e!==o$2.view&&(o$2.view=e,t&&(o$2.data=t),o$2.history.push(e));},reset(e){o$2.view=e,o$2.history=[e];},replace(e){o$2.history.length>1&&(o$2.history[o$2.history.length-1]=e,o$2.view=e);},goBack(){if(o$2.history.length>1){o$2.history.pop();const[e]=o$2.history.slice(-1);o$2.view=e;}},setData(e){o$2.data=e;}},a$2={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return a$2.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return a$2.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(a$2.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const i=encodeURIComponent(t);return `${n}wc?uri=${i}`},formatUniversalUrl(e,t,s){if(!a$2.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const i=encodeURIComponent(t);return `${n}wc?uri=${i}`},async wait(e){return new Promise(t=>{setTimeout(t,e);})},openHref(e,t){window.open(e,t,"noreferrer noopener");},setWalletConnectDeepLink(e,t){try{localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}));}catch{console.info("Unable to set WalletConnect deep link");}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}));}catch{console.info("Unable to set WalletConnect android deep link");}},removeWalletConnectDeepLink(){try{localStorage.removeItem(a$2.WALLETCONNECT_DEEPLINK_CHOICE);}catch{console.info("Unable to remove WalletConnect deep link");}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(a$2.WCM_VERSION,"2.6.2");}catch{console.info("Unable to set Web3Modal version in storage");}},getWalletRouterData(){var e;const t=(e=T$3.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},_$2=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),r$4=proxy({enabled:_$2,userSessionId:"",events:[],connectedWalletId:void 0}),R={state:r$4,subscribe(e){return subscribe(r$4.events,()=>e(snapshot(r$4.events[r$4.events.length-1])))},initialize(){r$4.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(r$4.userSessionId=crypto.randomUUID());},setConnectedWalletId(e){r$4.connectedWalletId=e;},click(e){if(r$4.enabled){const t={type:"CLICK",name:e.name,userSessionId:r$4.userSessionId,timestamp:Date.now(),data:e};r$4.events.push(t);}},track(e){if(r$4.enabled){const t={type:"TRACK",name:e.name,userSessionId:r$4.userSessionId,timestamp:Date.now(),data:e};r$4.events.push(t);}},view(e){if(r$4.enabled){const t={type:"VIEW",name:e.name,userSessionId:r$4.userSessionId,timestamp:Date.now(),data:e};r$4.events.push(t);}}},c$3=proxy({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),p$5={state:c$3,subscribe(e){return subscribe(c$3,()=>e(c$3))},setChains(e){c$3.chains=e;},setWalletConnectUri(e){c$3.walletConnectUri=e;},setIsCustomDesktop(e){c$3.isCustomDesktop=e;},setIsCustomMobile(e){c$3.isCustomMobile=e;},setIsDataLoaded(e){c$3.isDataLoaded=e;},setIsUiLoaded(e){c$3.isUiLoaded=e;},setIsAuth(e){c$3.isAuth=e;}},W=proxy({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),y$6={state:W,subscribe(e){return subscribe(W,()=>e(W))},setConfig(e){var t,s;R.initialize(),p$5.setChains(e.chains),p$5.setIsAuth(Boolean(e.enableAuthMode)),p$5.setIsCustomMobile(Boolean((t=e.mobileWallets)==null?void 0:t.length)),p$5.setIsCustomDesktop(Boolean((s=e.desktopWallets)==null?void 0:s.length)),a$2.setModalVersionInStorage(),Object.assign(W,e);}};var V$2=Object.defineProperty,D$3=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,B$2=Object.prototype.propertyIsEnumerable,M$3=(e,t,s)=>t in e?V$2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,K$3=(e,t)=>{for(var s in t||(t={}))H.call(t,s)&&M$3(e,s,t[s]);if(D$3)for(var s of D$3(t))B$2.call(t,s)&&M$3(e,s,t[s]);return e};const L$5="https://explorer-api.walletconnect.com",E$6="wcm",O$4="js-2.6.2";async function w$4(e,t){const s=K$3({sdkType:E$6,sdkVersion:O$4},t),n=new URL(e,L$5);return n.searchParams.append("projectId",y$6.state.projectId),Object.entries(s).forEach(([i,l])=>{l&&n.searchParams.append(i,String(l));}),(await fetch(n)).json()}const m$2={async getDesktopListings(e){return w$4("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return w$4("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return w$4("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return w$4("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return `${L$5}/w3m/v1/getWalletImage/${e}?projectId=${y$6.state.projectId}&sdkType=${E$6}&sdkVersion=${O$4}`},getAssetImageUrl(e){return `${L$5}/w3m/v1/getAssetImage/${e}?projectId=${y$6.state.projectId}&sdkType=${E$6}&sdkVersion=${O$4}`}};var z$5=Object.defineProperty,j$5=Object.getOwnPropertySymbols,J$1=Object.prototype.hasOwnProperty,q$2=Object.prototype.propertyIsEnumerable,k$2=(e,t,s)=>t in e?z$5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,F=(e,t)=>{for(var s in t||(t={}))J$1.call(t,s)&&k$2(e,s,t[s]);if(j$5)for(var s of j$5(t))q$2.call(t,s)&&k$2(e,s,t[s]);return e};const N$2=a$2.isMobile(),d$4=proxy({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),te$1={state:d$4,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=y$6.state;if(e==="NONE"||t==="ALL"&&!e)return d$4.recomendedWallets;if(a$2.isArray(e)){const s={recommendedIds:e.join(",")},{listings:n}=await m$2.getAllListings(s),i=Object.values(n);i.sort((l,v)=>{const b=e.indexOf(l.id),f=e.indexOf(v.id);return b-f}),d$4.recomendedWallets=i;}else {const{chains:s,isAuth:n}=p$5.state,i=s?.join(","),l=a$2.isArray(t),v={page:1,sdks:n?"auth_v1":void 0,entries:a$2.RECOMMENDED_WALLET_AMOUNT,chains:i,version:2,excludedIds:l?t.join(","):void 0},{listings:b}=N$2?await m$2.getMobileListings(v):await m$2.getDesktopListings(v);d$4.recomendedWallets=Object.values(b);}return d$4.recomendedWallets},async getWallets(e){const t=F({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=y$6.state,{recomendedWallets:i}=d$4;if(n==="ALL")return d$4.wallets;i.length?t.excludedIds=i.map(x=>x.id).join(","):a$2.isArray(s)&&(t.excludedIds=s.join(",")),a$2.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),p$5.state.isAuth&&(t.sdks="auth_v1");const{page:l,search:v}=e,{listings:b,total:f}=N$2?await m$2.getMobileListings(t):await m$2.getDesktopListings(t),A=Object.values(b),U=v?"search":"wallets";return d$4[U]={listings:[...d$4[U].listings,...A],total:f,page:l??1},{listings:A,total:f}},getWalletImageUrl(e){return m$2.getWalletImageUrl(e)},getAssetImageUrl(e){return m$2.getAssetImageUrl(e)},resetSearch(){d$4.search={listings:[],total:0,page:1};}},I$2=proxy({open:!1}),se$1={state:I$2,subscribe(e){return subscribe(I$2,()=>e(I$2))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=p$5.state;if(a$2.removeWalletConnectDeepLink(),p$5.setWalletConnectUri(e?.uri),p$5.setChains(e?.chains),T$3.reset("ConnectWallet"),s&&n)I$2.open=!0,t();else {const i=setInterval(()=>{const l=p$5.state;l.isUiLoaded&&l.isDataLoaded&&(clearInterval(i),I$2.open=!0,t());},200);}})},close(){I$2.open=!1;}};var G$1=Object.defineProperty,$$1=Object.getOwnPropertySymbols,Q$3=Object.prototype.hasOwnProperty,X$1=Object.prototype.propertyIsEnumerable,S$4=(e,t,s)=>t in e?G$1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Y=(e,t)=>{for(var s in t||(t={}))Q$3.call(t,s)&&S$4(e,s,t[s]);if($$1)for(var s of $$1(t))X$1.call(t,s)&&S$4(e,s,t[s]);return e};function Z$1(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const C$4=proxy({themeMode:Z$1()?"dark":"light"}),ne$2={state:C$4,subscribe(e){return subscribe(C$4,()=>e(C$4))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(C$4.themeMode=t),s&&(C$4.themeVariables=Y({},s));}},g$5=proxy({open:!1,message:"",variant:"success"}),oe$2={state:g$5,subscribe(e){return subscribe(g$5,()=>e(g$5))},openToast(e,t){g$5.open=!0,g$5.message=e,g$5.variant=t;},closeToast(){g$5.open=!1;}};
73683
73690
 
73684
- let d$3 = class d{constructor(e){this.openModal=se$1.open,this.closeModal=se$1.close,this.subscribeModal=se$1.subscribe,this.setTheme=ne$2.setThemeConfig,ne$2.setThemeConfig(e),y$6.setConfig(e),this.initUi();}async initUi(){if(typeof window<"u"){await import('./index-DI1RAoPP.js');const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),p$5.setIsUiLoaded(!0);}}};
73691
+ let d$3 = class d{constructor(e){this.openModal=se$1.open,this.closeModal=se$1.close,this.subscribeModal=se$1.subscribe,this.setTheme=ne$2.setThemeConfig,ne$2.setThemeConfig(e),y$6.setConfig(e),this.initUi();}async initUi(){if(typeof window<"u"){await import('./index-BuHtApNC.js');const e=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",e),p$5.setIsUiLoaded(!0);}}};
73685
73692
 
73686
73693
  var index$2 = /*#__PURE__*/Object.freeze({
73687
73694
  __proto__: null,
@@ -106328,7 +106335,7 @@ var Analytics = /** @class */ (function (_super) {
106328
106335
  return __generator(this, function (_b) {
106329
106336
  switch (_b.label) {
106330
106337
  case 0: return [4 /*yield*/, import(
106331
- /* webpackChunkName: "auto-track" */ './auto-track-lr-0xC0L.js')];
106338
+ /* webpackChunkName: "auto-track" */ './auto-track-YBHEPAZ3.js')];
106332
106339
  case 1:
106333
106340
  autotrack = _b.sent();
106334
106341
  return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray$1([this], args, false))];
@@ -106347,7 +106354,7 @@ var Analytics = /** @class */ (function (_super) {
106347
106354
  return __generator(this, function (_b) {
106348
106355
  switch (_b.label) {
106349
106356
  case 0: return [4 /*yield*/, import(
106350
- /* webpackChunkName: "auto-track" */ './auto-track-lr-0xC0L.js')];
106357
+ /* webpackChunkName: "auto-track" */ './auto-track-YBHEPAZ3.js')];
106351
106358
  case 1:
106352
106359
  autotrack = _b.sent();
106353
106360
  return [2 /*return*/, (_a = autotrack.link).call.apply(_a, __spreadArray$1([this], args, false))];
@@ -106366,7 +106373,7 @@ var Analytics = /** @class */ (function (_super) {
106366
106373
  return __generator(this, function (_b) {
106367
106374
  switch (_b.label) {
106368
106375
  case 0: return [4 /*yield*/, import(
106369
- /* webpackChunkName: "auto-track" */ './auto-track-lr-0xC0L.js')];
106376
+ /* webpackChunkName: "auto-track" */ './auto-track-YBHEPAZ3.js')];
106370
106377
  case 1:
106371
106378
  autotrack = _b.sent();
106372
106379
  return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray$1([this], args, false))];
@@ -106385,7 +106392,7 @@ var Analytics = /** @class */ (function (_super) {
106385
106392
  return __generator(this, function (_b) {
106386
106393
  switch (_b.label) {
106387
106394
  case 0: return [4 /*yield*/, import(
106388
- /* webpackChunkName: "auto-track" */ './auto-track-lr-0xC0L.js')];
106395
+ /* webpackChunkName: "auto-track" */ './auto-track-YBHEPAZ3.js')];
106389
106396
  case 1:
106390
106397
  autotrack = _b.sent();
106391
106398
  return [2 /*return*/, (_a = autotrack.form).call.apply(_a, __spreadArray$1([this], args, false))];
@@ -106535,7 +106542,7 @@ var Analytics = /** @class */ (function (_super) {
106535
106542
  return [2 /*return*/, []];
106536
106543
  }
106537
106544
  return [4 /*yield*/, import(
106538
- /* webpackChunkName: "queryString" */ './index-D8bpXcfM.js')];
106545
+ /* webpackChunkName: "queryString" */ './index-B_AfOz3m.js')];
106539
106546
  case 1:
106540
106547
  queryString = (_a.sent()).queryString;
106541
106548
  return [2 /*return*/, queryString(this, query)];
@@ -109239,7 +109246,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
109239
109246
  case 0:
109240
109247
  if (!hasTsubMiddleware(legacySettings)) return [3 /*break*/, 2];
109241
109248
  return [4 /*yield*/, import(
109242
- /* webpackChunkName: "tsub-middleware" */ './index-DJNRxwo3.js').then(function (mod) {
109249
+ /* webpackChunkName: "tsub-middleware" */ './index-C1C2zjQB.js').then(function (mod) {
109243
109250
  return mod.tsubMiddleware(legacySettings.middlewareSettings.routingRules);
109244
109251
  })];
109245
109252
  case 1:
@@ -109252,7 +109259,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
109252
109259
  tsubMiddleware = _d;
109253
109260
  if (!(hasLegacyDestinations(legacySettings) || legacyIntegrationSources.length > 0)) return [3 /*break*/, 5];
109254
109261
  return [4 /*yield*/, import(
109255
- /* webpackChunkName: "ajs-destination" */ './index-B64hLdVN.js').then(function (mod) {
109262
+ /* webpackChunkName: "ajs-destination" */ './index-DRpwE8WW.js').then(function (mod) {
109256
109263
  return mod.ajsDestinations(writeKey, legacySettings, analytics.integrations, opts, tsubMiddleware, legacyIntegrationSources);
109257
109264
  })];
109258
109265
  case 4:
@@ -109265,7 +109272,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
109265
109272
  legacyDestinations = _e;
109266
109273
  if (!legacySettings.legacyVideoPluginsEnabled) return [3 /*break*/, 8];
109267
109274
  return [4 /*yield*/, import(
109268
- /* webpackChunkName: "legacyVideos" */ './index-CuQxoUxX.js').then(function (mod) {
109275
+ /* webpackChunkName: "legacyVideos" */ './index-Do4ES1-4.js').then(function (mod) {
109269
109276
  return mod.loadLegacyVideoPlugins(analytics);
109270
109277
  })];
109271
109278
  case 7:
@@ -109274,7 +109281,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
109274
109281
  case 8:
109275
109282
  if (!((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track)) return [3 /*break*/, 10];
109276
109283
  return [4 /*yield*/, import(
109277
- /* webpackChunkName: "schemaFilter" */ './index-g3O4Hd06.js').then(function (mod) {
109284
+ /* webpackChunkName: "schemaFilter" */ './index-DtCucxzi.js').then(function (mod) {
109278
109285
  var _a;
109279
109286
  return mod.schemaFilter((_a = opts.plan) === null || _a === void 0 ? void 0 : _a.track, legacySettings);
109280
109287
  })];
@@ -109313,7 +109320,7 @@ function registerPlugins(writeKey, legacySettings, analytics, opts, options, plu
109313
109320
  return enabled;
109314
109321
  })) return [3 /*break*/, 17];
109315
109322
  return [4 /*yield*/, import(
109316
- /* webpackChunkName: "remoteMiddleware" */ './index-C4oAI8Yr.js').then(function (_a) {
109323
+ /* webpackChunkName: "remoteMiddleware" */ './index-DqtCQcyE.js').then(function (_a) {
109317
109324
  var remoteMiddlewares = _a.remoteMiddlewares;
109318
109325
  return __awaiter$5(_this, void 0, void 0, function () {
109319
109326
  var middleware, promises;
@@ -193055,7 +193062,7 @@ const useProvidersContext = () => {
193055
193062
  return context;
193056
193063
  };
193057
193064
 
193058
- const AddTokensWidget = React$2.lazy(() => import('./AddTokensWidget-Clbg163Q.js'));
193065
+ const AddTokensWidget = React$2.lazy(() => import('./AddTokensWidget-DtKOUsGu.js'));
193059
193066
  class AddTokens extends Base$3 {
193060
193067
  eventTopic = IMTBLWidgetEvents.IMTBL_ADD_TOKENS_WIDGET_EVENT;
193061
193068
  getValidatedProperties({ config, }) {
@@ -193099,7 +193106,7 @@ class AddTokens extends Base$3 {
193099
193106
  }
193100
193107
  }
193101
193108
 
193102
- const BridgeWidget = React$2.lazy(() => import('./BridgeWidget-KZ93rgVX.js').then(function (n) { return n.a; }));
193109
+ const BridgeWidget = React$2.lazy(() => import('./BridgeWidget-BEyIilgs.js').then(function (n) { return n.a; }));
193103
193110
  class Bridge extends Base$3 {
193104
193111
  eventTopic = IMTBLWidgetEvents.IMTBL_BRIDGE_WIDGET_EVENT;
193105
193112
  getValidatedProperties({ config }) {
@@ -193142,6 +193149,28 @@ class Bridge extends Base$3 {
193142
193149
  }
193143
193150
  }
193144
193151
 
193152
+ /**
193153
+ * Parse a chain id as returned by an EIP-1193 provider (e.g. `eth_chainId`).
193154
+ *
193155
+ * EIP-695 specifies a hex-encoded quantity such as `0x343b`, but providers are
193156
+ * inconsistent and may return a decimal string or a number instead. `Number()`
193157
+ * handles all three.
193158
+ *
193159
+ * Do NOT reach for `parseInt(value, 10)` here: it silently returns 0 for hex
193160
+ * input, which reads as "wrong network" for every chain. Use this helper so the
193161
+ * radix decision lives in one tested place rather than at each call site.
193162
+ *
193163
+ * Returns `null` when the value cannot be parsed, so callers can tell an
193164
+ * unknown chain apart from a legitimately parsed id.
193165
+ */
193166
+ function parseChainId(chainId) {
193167
+ if (chainId === null || chainId === undefined || chainId === '')
193168
+ return null;
193169
+ const parsed = Number(chainId);
193170
+ if (!Number.isInteger(parsed) || parsed <= 0)
193171
+ return null;
193172
+ return parsed;
193173
+ }
193145
193174
  function getChainNameById(chainId) {
193146
193175
  switch (chainId) {
193147
193176
  case ChainId.ETHEREUM: return ChainName$1.ETHEREUM;
@@ -193242,7 +193271,7 @@ const commerceFlows = [
193242
193271
  CommerceFlowType.TRANSFER,
193243
193272
  ];
193244
193273
 
193245
- const CommerceWidget = React$2.lazy(() => import('./CommerceWidget-BGFEo2Mz.js'));
193274
+ const CommerceWidget = React$2.lazy(() => import('./CommerceWidget-lHiaZb79.js'));
193246
193275
  class CommerceWidgetRoot extends Base$3 {
193247
193276
  eventTopic = IMTBLWidgetEvents.IMTBL_COMMERCE_WIDGET_EVENT;
193248
193277
  getValidatedProperties({ config, }) {
@@ -194660,10 +194689,9 @@ function WalletList(props) {
194660
194689
  const handleConnectViewUpdate = async (provider) => {
194661
194690
  const isPassport = isPassportProvider(provider);
194662
194691
  const chainId = await provider.send('eth_chainId', []);
194663
- // eslint-disable-next-line radix
194664
- const parsedChainId = parseInt(chainId.toString());
194692
+ const parsedChainId = parseChainId(chainId);
194665
194693
  if (parsedChainId !== targetChainId
194666
- && !allowedChains?.includes(parsedChainId)) {
194694
+ && !(parsedChainId && allowedChains?.includes(parsedChainId))) {
194667
194695
  // TODO: What do we do with Passport here as it can't connect to L1
194668
194696
  if (isPassport) {
194669
194697
  viewDispatch({
@@ -194961,8 +194989,7 @@ function SwitchNetworkZkEVM() {
194961
194989
  return;
194962
194990
  const checkCorrectNetwork = async () => {
194963
194991
  const currentChainId = await provider.send('eth_chainId', []);
194964
- // eslint-disable-next-line radix
194965
- const parsedChainId = Number(currentChainId.toString());
194992
+ const parsedChainId = parseChainId(currentChainId);
194966
194993
  if (parsedChainId === checkout.config.l2ChainId) {
194967
194994
  connectDispatch({
194968
194995
  payload: {
@@ -194998,7 +195025,7 @@ function SwitchNetworkZkEVM() {
194998
195025
  if (!provider.send)
194999
195026
  return;
195000
195027
  const currentChainId = await provider.send('eth_chainId', []);
195001
- const parsedChainId = Number(currentChainId);
195028
+ const parsedChainId = parseChainId(currentChainId);
195002
195029
  if (parsedChainId === checkout.config.l2ChainId) {
195003
195030
  connectDispatch({
195004
195031
  payload: {
@@ -195497,7 +195524,7 @@ const orchestrationEvents = {
195497
195524
  sendRequestAddTokensEvent,
195498
195525
  };
195499
195526
 
195500
- const OnRampWidget = React$2.lazy(() => import('./OnRampWidget-Csk6zFNi.js'));
195527
+ const OnRampWidget = React$2.lazy(() => import('./OnRampWidget-XiCeV2Y1.js'));
195501
195528
  class OnRamp extends Base$3 {
195502
195529
  eventTopic = IMTBLWidgetEvents.IMTBL_ONRAMP_WIDGET_EVENT;
195503
195530
  getValidatedProperties({ config }) {
@@ -195636,7 +195663,7 @@ const sendSalePaymentTokenEvent = (eventTarget, details) => {
195636
195663
  eventTarget.dispatchEvent(event);
195637
195664
  };
195638
195665
 
195639
- const SaleWidget = React$2.lazy(() => import('./SaleWidget-DhFTG5jh.js'));
195666
+ const SaleWidget = React$2.lazy(() => import('./SaleWidget-wg7122ny.js'));
195640
195667
  class Sale extends Base$3 {
195641
195668
  eventTopic = IMTBLWidgetEvents.IMTBL_SALE_WIDGET_EVENT;
195642
195669
  // TODO: add specific validation logic for the sale items
@@ -195787,7 +195814,7 @@ const sendSwapRejectedEvent = (eventTarget, reason) => {
195787
195814
  eventTarget.dispatchEvent(rejectedEvent);
195788
195815
  };
195789
195816
 
195790
- const SwapWidget = React$2.lazy(() => import('./SwapWidget-5cYssslL.js').then(function (n) { return n.b; }));
195817
+ const SwapWidget = React$2.lazy(() => import('./SwapWidget-DyRGb56t.js').then(function (n) { return n.b; }));
195791
195818
  class Swap extends Base$3 {
195792
195819
  eventTopic = IMTBLWidgetEvents.IMTBL_SWAP_WIDGET_EVENT;
195793
195820
  getValidatedProperties({ config }) {
@@ -195894,7 +195921,7 @@ function sendDisconnectWalletEvent(eventTarget) {
195894
195921
  eventTarget.dispatchEvent(disconnectWalletEvent);
195895
195922
  }
195896
195923
 
195897
- const WalletWidget = React$2.lazy(() => import('./WalletWidget-DnwrQj2F.js'));
195924
+ const WalletWidget = React$2.lazy(() => import('./WalletWidget-Qucp_iny.js'));
195898
195925
  class Wallet extends Base$3 {
195899
195926
  eventTopic = IMTBLWidgetEvents.IMTBL_WALLET_WIDGET_EVENT;
195900
195927
  getValidatedProperties({ config }) {
@@ -338492,4 +338519,4 @@ class WidgetsFactory {
338492
338519
  };
338493
338520
  }
338494
338521
 
338495
- export { isError$1 as $, AddTokensEventType as A, BridgeEventType as B, CommerceFlowType as C, CryptoFiatContext as D, EventTargetContext as E, tokenValueFormat as F, getDefaultTokenImage as G, Heading as H, IMTBLWidgetEvents as I, HeaderNavigation as J, sendCloseWidgetEvent as K, Link as L, orchestrationEvents as M, amountInputValidation as N, OnRampEventType as O, ProviderEventType as P, useTheme as Q, CloudImage as R, SwapEventType as S, TransferEventType as T, UserJourney as U, ViewActions as V, WalletEventType as W, getRemoteImage as X, CryptoFiatProvider as Y, ConnectLoaderContext as Z, isAddress as _, CommerceEventType as a, isNativeToken as a$, LoadingView as a0, CryptoFiatActions as a1, useViewState as a2, useEventTargetState as a3, commerceFlows as a4, SharedViews as a5, ErrorView as a6, ConnectWidget as a7, ProvidersContextProvider as a8, PurchaseWidget as a9, Drawer as aA, Divider as aB, useProvidersContext as aC, WalletDrawer as aD, UnableToConnectDrawer as aE, Fragment$1 as aF, WalletProviderRdns as aG, removeSpace as aH, getProviderSlugFromRdns as aI, WrappedBrowserProvider as aJ, isPassportProvider as aK, connectEIP6963Provider as aL, identifyUser as aM, ConnectEIP6963ProviderError as aN, ProvidersContextActions as aO, MenuItem as aP, ChainId as aQ, SQUID_NATIVE_TOKEN as aR, commonjsRequire$1 as aS, OnboardingPagination as aT, ViewContext as aU, useHandover as aV, HandoverTarget as aW, APPROVE_TXN_ANIMATION as aX, RiveStateMachineInput as aY, HandoverContent as aZ, keyframes$2 as a_, ConnectLoader as aa, ViewContextProvider as ab, hFlex as ac, _defineProperty$1 as ad, _objectWithoutProperties as ae, useForwardLocalDomRef as af, _slicedToArray as ag, useResizeObserver as ah, usePrevious as ai, useGetMotionProfile as aj, useBrowserEffect as ak, merge$2 as al, getHeadingTextStyles as am, getMotionProfileSx as an, useConvertSxToEmotionStyles as ao, DUMMY_WIDTH_PUSHER_TEXT as ap, useGetSubcomponentChild as aq, flattenChildren as ar, vFlex as as, centerFlexChildren as at, SmartClone as au, FormControlLabel as av, FormControlValidation as aw, FormControlCaption as ax, getDefaultExportFromCjs$2 as ay, commonjsGlobal$1 as az, ConnectEventType as b, sendSaleFailedEvent as b$, getTokenImageByAddress as b0, FramedImage as b1, FramedIcon as b2, ButtCon as b3, TextInput as b4, VerticalMenu as b5, TOKEN_PRIORITY_ORDER as b6, EllipsizedText as b7, Tooltip as b8, Sticker as b9, useExecute as bA, getRouteChains as bB, t$3 as bC, convertToNetworkChangeableProvider as bD, verifyAndSwitchChain as bE, PriceDisplay as bF, getFromAmountData as bG, viewReducer as bH, initialViewState as bI, useSquid as bJ, useTokens as bK, v4 as bL, r$7 as bM, isValidAddress as bN, fetchChains as bO, fetchBalances as bP, ServiceUnavailableErrorView as bQ, errorToString as bR, hexToText as bS, compareStr as bT, Z$2 as bU, SalePaymentTypes as bV, TransakIframe as bW, toPascalCase as bX, sendSaleWidgetCloseEvent as bY, toStringifyTransactions as bZ, sendSaleSuccessEvent as b_, getDurationFormatted as ba, getTotalRouteFees as bb, getRouteAndTokenBalances as bc, Icon as bd, Badge as be, getFormattedAmounts as bf, getRemoteVideo as bg, FramedVideo as bh, listVariants as bi, motion$1 as bj, listItemVariants as bk, Banner as bl, useRoutes as bm, useInjectedProviders as bn, X$2 as bo, RouteError as bp, dist$2 as bq, SquidFooter as br, TOOLKIT_SQUID_URL as bs, merge$1 as bt, SvgIcon as bu, WalletWarningHero as bv, getFormattedNumber as bw, FIXED_HANDOVER_DURATION as bx, EXECUTE_TXN_ANIMATION as by, Trans as bz, CommerceFailureEventType as c, heroBackGroundStyles as c$, sendSaleTransactionSuccessEvent as c0, sendSalePaymentMethodEvent as c1, sendSalePaymentTokenEvent as c2, LoadingOverlay as c3, HandoverDuration as c4, FooterLogo as c5, StatusType as c6, prettyFormatNumber as c7, ShimmerCircle as c8, FundingStepType as c9, PASSPORT_URL as cA, getChainImage as cB, getChainIdBySlug as cC, useWalletConnect as cD, Logo as cE, RawImage as cF, isWalletConnectProvider as cG, getNativeSymbolByChainSlug as cH, JsonRpcProvider as cI, retry as cJ, getChainSlugById as cK, DEFAULT_TRANSACTIONS_RETRY_POLICY as cL, getChainNameById as cM, getWalletProviderNameByProvider as cN, isMetaMaskProvider as cO, WalletProviderName as cP, ButtonNavigationStyles as cQ, NATIVE as cR, ETH_TOKEN_SYMBOL as cS, GasEstimateType as cT, DEFAULT_QUOTE_REFRESH_INTERVAL as cU, addChainChangedListener as cV, removeChainChangedListener as cW, isAddressSanctioned as cX, IMX_TOKEN_SYMBOL as cY, DEFAULT_TOKEN_DECIMALS as cZ, CHECKOUT_CDN_BASE_URL as c_, abbreviateWalletAddress as ca, formatUnits as cb, Caption as cc, tokenSymbolNameOverrides as cd, TransactionOrGasType as ce, GasTokenType as cf, ItemType as cg, RoutingOutcomeType as ch, isGasFree as ci, eventTargetReducer as cj, initialEventTargetState as ck, EventTargetActions as cl, ConnectWidgetViews as cm, ConnectLoaderActions as cn, widgetTheme as co, toQuantity as cp, toBeHex as cq, getAddress as cr, keccak256$1 as cs, concat$5 as ct, AbiCoder as cu, axios$1 as cv, ZeroAddress as cw, ChainName$1 as cx, CheckoutErrorType as cy, ShimmerBox as cz, CommerceSuccessEventType as d, a$2 as d$, heroImageStyles as d0, SimpleTextBody as d1, FooterButton as d2, getEthTokenImage as d3, WITHDRAWAL_CLAIM_GAS_LIMIT as d4, getGasPriceInWei as d5, a$4 as d6, StatusView as d7, sendOnRampWidgetCloseEvent as d8, url as d9, getTertiaryButtonStyles as dA, isChildSubcomponent as dB, FormControlWrapper as dC, Select as dD, DuoCon as dE, heroImageBottomAlign as dF, IMMUTABLE_API_BASE_URL$1 as dG, isDualVariantIcon as dH, DEFAULT_TOKEN_SYMBOLS as dI, getStartingSize as dJ, DEFAULT_BUTTON_SIZE as dK, getResponsiveSx as dL, BUTTON_SIZES as dM, setDefaultSxBackgroundColor as dN, ZERO_BALANCE_STRING as dO, sendNetworkSwitchEvent as dP, NetworkFilterTypes as dQ, sortNetworksCompareFn as dR, sortTokensByAmount as dS, sendWalletWidgetCloseEvent as dT, sendDisconnectWalletEvent as dU, FAQS_LINK as dV, useBrowserLayoutEffect as dW, se$1 as dX, T$3 as dY, oe$2 as dZ, R as d_, TRANSAK_ORIGIN as da, ExchangeType as db, sendOnRampSuccessEvent as dc, sendOnRampFailedEvent as dd, quickswapFooterStyles as de, quickswapFooterLogoStyles as df, quickswapFooterDisclaimerTextStyles as dg, WidgetTheme as dh, getImxTokenImage as di, getCryptoToUSDConversion as dj, calculateFeesFiat as dk, parseEther as dl, ESTIMATE_DEBOUNCE as dm, DEFAULT_TOKEN_VALIDATION_DECIMALS as dn, sendSwapWidgetCloseEvent as dp, CheckoutError as dq, DEFAULT_BALANCE_RETRY_POLICY as dr, SwapDirection as ds, sendSwapSuccessEvent as dt, sendSwapFailedEvent as du, sendSwapRejectedEvent as dv, motion$3 as dw, BaseClickable as dx, AnimatePresence$1 as dy, ClassNames as dz, CommerceUserActionEventType as e, te$1 as e0, p$5 as e1, ne$2 as e2, y$6 as e3, getAugmentedNamespace as e4, __awaiter$5 as e5, __generator as e6, loadScript as e7, getNextIntegrationsURL as e8, unloadScript as e9, __spreadArray$1 as ea, isOffline as eb, __assign as ec, ContextCancelation as ed, applyDestinationMiddleware as ee, dist$4 as ef, isServer as eg, mergedOptions as eh, isPlainObject$1 as ei, pWhile as ej, PriorityQueue as ek, PersistedPriorityQueue as el, attempt as em, isOnline as en, Context as eo, pTimeout as ep, gracefulDecodeURIComponent as eq, WidgetsFactory as er, SaleEventType as f, PurchaseEventType as g, OrchestrationEventType as h, formatZeroAmount as i, calculateCryptoToFiat as j, Contract as k, TokenFilterTypes as l, dist$3 as m, getRemoteRive as n, BlockExplorerService as o, parseUnits$1 as p, jsx$1 as q, reactExports as r, jsxs as s, Box as t, useTranslation as u, Button as v, Stack as w, SimpleLayout as x, Body as y, useAnalytics as z };
338522
+ export { isError$1 as $, AddTokensEventType as A, BridgeEventType as B, CommerceFlowType as C, CryptoFiatContext as D, EventTargetContext as E, tokenValueFormat as F, getDefaultTokenImage as G, Heading as H, IMTBLWidgetEvents as I, HeaderNavigation as J, sendCloseWidgetEvent as K, Link as L, orchestrationEvents as M, amountInputValidation as N, OnRampEventType as O, ProviderEventType as P, useTheme as Q, CloudImage as R, SwapEventType as S, TransferEventType as T, UserJourney as U, ViewActions as V, WalletEventType as W, getRemoteImage as X, CryptoFiatProvider as Y, ConnectLoaderContext as Z, isAddress as _, CommerceEventType as a, isNativeToken as a$, LoadingView as a0, CryptoFiatActions as a1, useViewState as a2, useEventTargetState as a3, commerceFlows as a4, SharedViews as a5, ErrorView as a6, ConnectWidget as a7, ProvidersContextProvider as a8, PurchaseWidget as a9, Drawer as aA, Divider as aB, useProvidersContext as aC, WalletDrawer as aD, UnableToConnectDrawer as aE, Fragment$1 as aF, WalletProviderRdns as aG, removeSpace as aH, getProviderSlugFromRdns as aI, WrappedBrowserProvider as aJ, isPassportProvider as aK, connectEIP6963Provider as aL, identifyUser as aM, ConnectEIP6963ProviderError as aN, ProvidersContextActions as aO, MenuItem as aP, ChainId as aQ, SQUID_NATIVE_TOKEN as aR, commonjsRequire$1 as aS, OnboardingPagination as aT, ViewContext as aU, useHandover as aV, HandoverTarget as aW, APPROVE_TXN_ANIMATION as aX, RiveStateMachineInput as aY, HandoverContent as aZ, keyframes$2 as a_, ConnectLoader as aa, ViewContextProvider as ab, hFlex as ac, _defineProperty$1 as ad, _objectWithoutProperties as ae, useForwardLocalDomRef as af, _slicedToArray as ag, useResizeObserver as ah, usePrevious as ai, useGetMotionProfile as aj, useBrowserEffect as ak, merge$2 as al, getHeadingTextStyles as am, getMotionProfileSx as an, useConvertSxToEmotionStyles as ao, DUMMY_WIDTH_PUSHER_TEXT as ap, useGetSubcomponentChild as aq, flattenChildren as ar, vFlex as as, centerFlexChildren as at, SmartClone as au, FormControlLabel as av, FormControlValidation as aw, FormControlCaption as ax, getDefaultExportFromCjs$2 as ay, commonjsGlobal$1 as az, ConnectEventType as b, sendSaleFailedEvent as b$, getTokenImageByAddress as b0, FramedImage as b1, FramedIcon as b2, ButtCon as b3, TextInput as b4, VerticalMenu as b5, TOKEN_PRIORITY_ORDER as b6, EllipsizedText as b7, Tooltip as b8, Sticker as b9, useExecute as bA, getRouteChains as bB, t$3 as bC, convertToNetworkChangeableProvider as bD, verifyAndSwitchChain as bE, PriceDisplay as bF, getFromAmountData as bG, viewReducer as bH, initialViewState as bI, useSquid as bJ, useTokens as bK, v4 as bL, r$7 as bM, isValidAddress as bN, fetchChains as bO, fetchBalances as bP, ServiceUnavailableErrorView as bQ, errorToString as bR, hexToText as bS, compareStr as bT, Z$2 as bU, SalePaymentTypes as bV, TransakIframe as bW, toPascalCase as bX, sendSaleWidgetCloseEvent as bY, toStringifyTransactions as bZ, sendSaleSuccessEvent as b_, getDurationFormatted as ba, getTotalRouteFees as bb, getRouteAndTokenBalances as bc, Icon as bd, Badge as be, getFormattedAmounts as bf, getRemoteVideo as bg, FramedVideo as bh, listVariants as bi, motion$1 as bj, listItemVariants as bk, Banner as bl, useRoutes as bm, useInjectedProviders as bn, X$2 as bo, RouteError as bp, dist$2 as bq, SquidFooter as br, TOOLKIT_SQUID_URL as bs, merge$1 as bt, SvgIcon as bu, WalletWarningHero as bv, getFormattedNumber as bw, FIXED_HANDOVER_DURATION as bx, EXECUTE_TXN_ANIMATION as by, Trans as bz, CommerceFailureEventType as c, CHECKOUT_CDN_BASE_URL as c$, sendSaleTransactionSuccessEvent as c0, sendSalePaymentMethodEvent as c1, sendSalePaymentTokenEvent as c2, LoadingOverlay as c3, HandoverDuration as c4, FooterLogo as c5, StatusType as c6, prettyFormatNumber as c7, ShimmerCircle as c8, FundingStepType as c9, PASSPORT_URL as cA, getChainImage as cB, getChainIdBySlug as cC, useWalletConnect as cD, Logo as cE, RawImage as cF, isWalletConnectProvider as cG, getNativeSymbolByChainSlug as cH, JsonRpcProvider as cI, retry as cJ, getChainSlugById as cK, DEFAULT_TRANSACTIONS_RETRY_POLICY as cL, getChainNameById as cM, getWalletProviderNameByProvider as cN, isMetaMaskProvider as cO, WalletProviderName as cP, ButtonNavigationStyles as cQ, NATIVE as cR, ETH_TOKEN_SYMBOL as cS, GasEstimateType as cT, DEFAULT_QUOTE_REFRESH_INTERVAL as cU, addChainChangedListener as cV, removeChainChangedListener as cW, isAddressSanctioned as cX, IMX_TOKEN_SYMBOL as cY, DEFAULT_TOKEN_DECIMALS as cZ, parseChainId as c_, abbreviateWalletAddress as ca, formatUnits as cb, Caption as cc, tokenSymbolNameOverrides as cd, TransactionOrGasType as ce, GasTokenType as cf, ItemType as cg, RoutingOutcomeType as ch, isGasFree as ci, eventTargetReducer as cj, initialEventTargetState as ck, EventTargetActions as cl, ConnectWidgetViews as cm, ConnectLoaderActions as cn, widgetTheme as co, toQuantity as cp, toBeHex as cq, getAddress as cr, keccak256$1 as cs, concat$5 as ct, AbiCoder as cu, axios$1 as cv, ZeroAddress as cw, ChainName$1 as cx, CheckoutErrorType as cy, ShimmerBox as cz, CommerceSuccessEventType as d, R as d$, heroBackGroundStyles as d0, heroImageStyles as d1, SimpleTextBody as d2, FooterButton as d3, getEthTokenImage as d4, WITHDRAWAL_CLAIM_GAS_LIMIT as d5, getGasPriceInWei as d6, a$4 as d7, StatusView as d8, sendOnRampWidgetCloseEvent as d9, ClassNames as dA, getTertiaryButtonStyles as dB, isChildSubcomponent as dC, FormControlWrapper as dD, Select as dE, DuoCon as dF, heroImageBottomAlign as dG, IMMUTABLE_API_BASE_URL$1 as dH, isDualVariantIcon as dI, DEFAULT_TOKEN_SYMBOLS as dJ, getStartingSize as dK, DEFAULT_BUTTON_SIZE as dL, getResponsiveSx as dM, BUTTON_SIZES as dN, setDefaultSxBackgroundColor as dO, ZERO_BALANCE_STRING as dP, sendNetworkSwitchEvent as dQ, NetworkFilterTypes as dR, sortNetworksCompareFn as dS, sortTokensByAmount as dT, sendWalletWidgetCloseEvent as dU, sendDisconnectWalletEvent as dV, FAQS_LINK as dW, useBrowserLayoutEffect as dX, se$1 as dY, T$3 as dZ, oe$2 as d_, url as da, TRANSAK_ORIGIN as db, ExchangeType as dc, sendOnRampSuccessEvent as dd, sendOnRampFailedEvent as de, quickswapFooterStyles as df, quickswapFooterLogoStyles as dg, quickswapFooterDisclaimerTextStyles as dh, WidgetTheme as di, getImxTokenImage as dj, getCryptoToUSDConversion as dk, calculateFeesFiat as dl, parseEther as dm, ESTIMATE_DEBOUNCE as dn, DEFAULT_TOKEN_VALIDATION_DECIMALS as dp, sendSwapWidgetCloseEvent as dq, CheckoutError as dr, DEFAULT_BALANCE_RETRY_POLICY as ds, SwapDirection as dt, sendSwapSuccessEvent as du, sendSwapFailedEvent as dv, sendSwapRejectedEvent as dw, motion$3 as dx, BaseClickable as dy, AnimatePresence$1 as dz, CommerceUserActionEventType as e, a$2 as e0, te$1 as e1, p$5 as e2, ne$2 as e3, y$6 as e4, getAugmentedNamespace as e5, __awaiter$5 as e6, __generator as e7, loadScript as e8, getNextIntegrationsURL as e9, unloadScript as ea, __spreadArray$1 as eb, isOffline as ec, __assign as ed, ContextCancelation as ee, applyDestinationMiddleware as ef, dist$4 as eg, isServer as eh, mergedOptions as ei, isPlainObject$1 as ej, pWhile as ek, PriorityQueue as el, PersistedPriorityQueue as em, attempt as en, isOnline as eo, Context as ep, pTimeout as eq, gracefulDecodeURIComponent as er, WidgetsFactory as es, SaleEventType as f, PurchaseEventType as g, OrchestrationEventType as h, formatZeroAmount as i, calculateCryptoToFiat as j, Contract as k, TokenFilterTypes as l, dist$3 as m, getRemoteRive as n, BlockExplorerService as o, parseUnits$1 as p, jsx$1 as q, reactExports as r, jsxs as s, Box as t, useTranslation as u, Button as v, Stack as w, SimpleLayout as x, Body as y, useAnalytics as z };
@@ -1,4 +1,4 @@
1
- import { e5 as __awaiter, e6 as __generator, e7 as loadScript, e8 as getNextIntegrationsURL, e9 as unloadScript, ea as __spreadArray, eb as isOffline, ec as __assign, ed as ContextCancelation, ee as applyDestinationMiddleware, ef as dist, eg as isServer, eh as mergedOptions, ei as isPlainObject, ej as pWhile, ek as PriorityQueue, el as PersistedPriorityQueue, em as attempt, en as isOnline, eo as Context } from './index-vx-Xcy1M.js';
1
+ import { e6 as __awaiter, e7 as __generator, e8 as loadScript, e9 as getNextIntegrationsURL, ea as unloadScript, eb as __spreadArray, ec as isOffline, ed as __assign, ee as ContextCancelation, ef as applyDestinationMiddleware, eg as dist, eh as isServer, ei as mergedOptions, ej as isPlainObject, ek as pWhile, el as PriorityQueue, em as PersistedPriorityQueue, en as attempt, eo as isOnline, ep as Context } from './index-CZghGU-d.js';
2
2
  import { i as isPlanEventEnabled } from './is-plan-event-enabled-mXX0dwl-.js';
3
3
 
4
4
  function normalizeName(name) {
@@ -1,4 +1,4 @@
1
- import { e5 as __awaiter, e6 as __generator } from './index-vx-Xcy1M.js';
1
+ import { e6 as __awaiter, e7 as __generator } from './index-CZghGU-d.js';
2
2
 
3
3
  function loadLegacyVideoPlugins(analytics) {
4
4
  return __awaiter(this, void 0, void 0, function () {
@@ -7,7 +7,7 @@ function loadLegacyVideoPlugins(analytics) {
7
7
  switch (_a.label) {
8
8
  case 0: return [4 /*yield*/, import(
9
9
  // @ts-expect-error
10
- './index.umd-eUSqWuBe.js').then(function (n) { return n.i; })
10
+ './index.umd-CjyGntCd.js').then(function (n) { return n.i; })
11
11
  // This is super gross, but we need to support the `window.analytics.plugins` namespace
12
12
  // that is linked in the segment docs in order to be backwards compatible with ajs-classic
13
13
  // @ts-expect-error
@@ -1,4 +1,4 @@
1
- import { e5 as __awaiter, e6 as __generator, eg as isServer, e8 as getNextIntegrationsURL, e7 as loadScript } from './index-vx-Xcy1M.js';
1
+ import { e6 as __awaiter, e7 as __generator, eh as isServer, e9 as getNextIntegrationsURL, e8 as loadScript } from './index-CZghGU-d.js';
2
2
 
3
3
  function remoteMiddlewares(ctx, settings, obfuscate) {
4
4
  var _a;
@@ -1,4 +1,4 @@
1
- import { ec as __assign } from './index-vx-Xcy1M.js';
1
+ import { ed as __assign } from './index-CZghGU-d.js';
2
2
  import { i as isPlanEventEnabled } from './is-plan-event-enabled-mXX0dwl-.js';
3
3
 
4
4
  function disabledActionDestinations(plan, settings) {
@@ -1 +1 @@
1
- export { er as WidgetsFactory } from './index-vx-Xcy1M.js';
1
+ export { es as WidgetsFactory } from './index-CZghGU-d.js';
@@ -1,4 +1,4 @@
1
- import { ay as getDefaultExportFromCjs } from './index-vx-Xcy1M.js';
1
+ import { ay as getDefaultExportFromCjs } from './index-CZghGU-d.js';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -1,4 +1,4 @@
1
- import { r as reactExports, dW as useBrowserLayoutEffect } from './index-vx-Xcy1M.js';
1
+ import { r as reactExports, dX as useBrowserLayoutEffect } from './index-CZghGU-d.js';
2
2
 
3
3
  // Inspired by https://usehooks-ts.com/react-hook/use-interval
4
4
  function useInterval(callback, delay) {
@@ -1,4 +1,19 @@
1
1
  import { ChainId, ChainName, ChainSlug } from '@imtbl/checkout-sdk';
2
+ /**
3
+ * Parse a chain id as returned by an EIP-1193 provider (e.g. `eth_chainId`).
4
+ *
5
+ * EIP-695 specifies a hex-encoded quantity such as `0x343b`, but providers are
6
+ * inconsistent and may return a decimal string or a number instead. `Number()`
7
+ * handles all three.
8
+ *
9
+ * Do NOT reach for `parseInt(value, 10)` here: it silently returns 0 for hex
10
+ * input, which reads as "wrong network" for every chain. Use this helper so the
11
+ * radix decision lives in one tested place rather than at each call site.
12
+ *
13
+ * Returns `null` when the value cannot be parsed, so callers can tell an
14
+ * unknown chain apart from a legitimately parsed id.
15
+ */
16
+ export declare function parseChainId(chainId: unknown): ChainId | null;
2
17
  export declare function getChainNameById(chainId: ChainId): ChainName;
3
18
  export declare function getChainSlugById(chainId: ChainId): ChainSlug;
4
19
  export declare function getChainIdBySlug(chainSlug: ChainSlug): ChainId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imtbl/checkout-widgets",
3
- "version": "2.24.5",
3
+ "version": "2.24.6",
4
4
  "browserslist": {
5
5
  "production": [
6
6
  ">0.2%",
@@ -36,12 +36,12 @@
36
36
  "react-i18next": "^13.5.0",
37
37
  "ts-deepmerge": "^7.0.2",
38
38
  "uuid": "^9.0.1",
39
- "@imtbl/bridge-sdk": "2.24.5",
40
- "@imtbl/config": "2.24.5",
41
- "@imtbl/checkout-sdk": "2.24.5",
42
- "@imtbl/passport": "2.24.5",
43
- "@imtbl/cryptofiat": "2.24.5",
44
- "@imtbl/dex-sdk": "2.24.5"
39
+ "@imtbl/bridge-sdk": "2.24.6",
40
+ "@imtbl/checkout-sdk": "2.24.6",
41
+ "@imtbl/config": "2.24.6",
42
+ "@imtbl/cryptofiat": "2.24.6",
43
+ "@imtbl/dex-sdk": "2.24.6",
44
+ "@imtbl/passport": "2.24.6"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@0xsquid/squid-types": "^0.1.108",
@@ -8,7 +8,7 @@ import {
8
8
  Heading,
9
9
  } from '@biom3/react';
10
10
  import {
11
- useCallback, useMemo, useEffect,
11
+ useCallback, useMemo, useEffect, useState,
12
12
  } from 'react';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { ChainId, Checkout, WrappedBrowserProvider } from '@imtbl/checkout-sdk';
@@ -17,6 +17,7 @@ import { FooterLogo } from '../Footer/FooterLogo';
17
17
  import { getChainNameById } from '../../lib/chains';
18
18
  import {
19
19
  isMetaMaskProvider,
20
+ isPassportProvider,
20
21
  isWalletConnectProvider,
21
22
  } from '../../lib/provider';
22
23
  import { getRemoteImage } from '../../lib/utils';
@@ -38,6 +39,7 @@ export function NetworkSwitchDrawer({
38
39
  onNetworkSwitch,
39
40
  }: NetworkSwitchDrawerProps) {
40
41
  const { t } = useTranslation();
42
+ const [switchFailed, setSwitchFailed] = useState(false);
41
43
 
42
44
  const ethImageUrl = getRemoteImage(
43
45
  checkout.config.environment ?? Environment.PRODUCTION,
@@ -54,12 +56,21 @@ export function NetworkSwitchDrawer({
54
56
 
55
57
  const handleSwitchNetwork = useCallback(async () => {
56
58
  if (!checkout) return;
57
- const switchNetworkResult = await checkout.switchNetwork({
58
- provider,
59
- chainId: targetChainId,
60
- });
61
- if (onNetworkSwitch) {
62
- onNetworkSwitch(switchNetworkResult.provider);
59
+ try {
60
+ const switchNetworkResult = await checkout.switchNetwork({
61
+ provider,
62
+ chainId: targetChainId,
63
+ });
64
+ if (onNetworkSwitch) {
65
+ onNetworkSwitch(switchNetworkResult.provider);
66
+ }
67
+ } catch (err) {
68
+ // Without this catch the rejection is unhandled: the click handler returns
69
+ // a floating promise, so a failed switch surfaces only as a console error
70
+ // and floods error reporting instead of telling the user anything.
71
+ // eslint-disable-next-line no-console
72
+ console.error(err);
73
+ setSwitchFailed(true);
63
74
  }
64
75
  }, [checkout, provider, onNetworkSwitch, targetChainId]);
65
76
 
@@ -76,13 +87,31 @@ export function NetworkSwitchDrawer({
76
87
  );
77
88
 
78
89
  const walletDisplayName = useMemo(() => {
90
+ if (isPassportProvider(provider)) return 'Passport wallet';
79
91
  if (isMetaMaskProvider(provider)) return 'MetaMask wallet';
80
92
  if (isWalletConnect && walletConnectPeerName) return walletConnectPeerName;
81
93
  return 'wallet';
82
94
  }, [provider, isWalletConnect, walletConnectPeerName]);
83
95
 
96
+ // Passport rejects wallet_switchEthereumChain by design (see `switchWalletNetwork`
97
+ // in checkout-sdk), so offering a switch button leads the user to a dead end.
98
+ const cannotSwitch = isPassportProvider(provider);
99
+
84
100
  const requireManualSwitch = isWalletConnect && isMetaMaskMobileWalletPeer;
85
101
 
102
+ const bodyTextKey = useMemo(() => {
103
+ if (cannotSwitch) return 'drawers.networkSwitch.unsupportedSwitch.body';
104
+ if (switchFailed) return 'drawers.networkSwitch.switchFailed.body';
105
+ if (requireManualSwitch) return 'drawers.networkSwitch.manualSwitch.body';
106
+ return 'drawers.networkSwitch.controlledSwitch.body';
107
+ }, [cannotSwitch, switchFailed, requireManualSwitch]);
108
+
109
+ // Clear a previous failure when the drawer is reopened or the target changes,
110
+ // so a stale error message doesn't carry into a fresh attempt.
111
+ useEffect(() => {
112
+ if (visible) setSwitchFailed(false);
113
+ }, [visible, provider, targetChainId]);
114
+
86
115
  // Image preloading - load images into browser when component mounts
87
116
  // show cached images when drawer is made visible
88
117
  useEffect(() => {
@@ -140,8 +169,11 @@ export function NetworkSwitchDrawer({
140
169
  wallet: walletDisplayName,
141
170
  })}
142
171
  </Heading>
143
- {/** MetaMask mobile requires manual switch */}
144
- {requireManualSwitch && (
172
+ {/**
173
+ * Copy depends on whether the wallet can switch at all (Passport cannot),
174
+ * whether a previous attempt failed, and whether the wallet requires a
175
+ * manual switch (MetaMask mobile over WalletConnect).
176
+ */}
145
177
  <Body
146
178
  size="medium"
147
179
  weight="regular"
@@ -151,26 +183,11 @@ export function NetworkSwitchDrawer({
151
183
  paddingX: 'base.spacing.x6',
152
184
  }}
153
185
  >
154
- {t('drawers.networkSwitch.manualSwitch.body', {
155
- chain: targetChainName,
156
- })}
157
- </Body>
158
- )}
159
- {!requireManualSwitch && (
160
- <Body
161
- size="medium"
162
- weight="regular"
163
- sx={{
164
- color: 'base.color.text.body.secondary',
165
- textAlign: 'center',
166
- paddingX: 'base.spacing.x6',
167
- }}
168
- >
169
- {t('drawers.networkSwitch.controlledSwitch.body', {
186
+ {t(bodyTextKey, {
170
187
  chain: targetChainName,
188
+ wallet: walletDisplayName,
171
189
  })}
172
190
  </Body>
173
- )}
174
191
  </Box>
175
192
 
176
193
  <Box sx={{
@@ -180,16 +197,19 @@ export function NetworkSwitchDrawer({
180
197
  width: '100%',
181
198
  }}
182
199
  >
183
- {!requireManualSwitch && (
200
+ {!requireManualSwitch && !cannotSwitch && (
184
201
  <Button
185
202
  size="large"
186
203
  variant="primary"
187
204
  sx={{ width: '100%', marginBottom: 'base.spacing.x2' }}
188
205
  onClick={handleSwitchNetwork}
189
206
  >
190
- {t('drawers.networkSwitch.switchButton', {
191
- chain: targetChainName,
192
- })}
207
+ {t(
208
+ switchFailed
209
+ ? 'drawers.networkSwitch.retryButton'
210
+ : 'drawers.networkSwitch.switchButton',
211
+ { chain: targetChainName },
212
+ )}
193
213
  </Button>
194
214
  )}
195
215
  <FooterLogo />