@imtbl/sdk 1.29.0 → 1.29.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-0c8ba5f4.js → BridgeWidget-6bf8661a.js} +1 -1
  3. package/dist/browser/checkout/{HorizontalMenu-actual-d9d5362e.js → HorizontalMenu-actual-72c414cb.js} +1 -1
  4. package/dist/browser/checkout/{OnRampWidget-7b9c46d9.js → OnRampWidget-1bb2826a.js} +2 -2
  5. package/dist/browser/checkout/{SaleWidget-5f976f57.js → SaleWidget-2d1f59d1.js} +2 -2
  6. package/dist/browser/checkout/{SpendingCapHero-78cf24cf.js → SpendingCapHero-6abc0869.js} +1 -1
  7. package/dist/browser/checkout/{SwapWidget-e3224198.js → SwapWidget-85254819.js} +1 -1
  8. package/dist/browser/checkout/{TopUpView-55a4ebd7.js → TopUpView-57b43da7.js} +1 -1
  9. package/dist/browser/checkout/{WalletWidget-080def57.js → WalletWidget-5a4b4650.js} +1 -1
  10. package/dist/browser/checkout/{auto-track-c9c76e80.js → auto-track-4e36e7b3.js} +1 -1
  11. package/dist/browser/checkout/{balance-cdb0a3fa.js → balance-4f016daf.js} +1 -1
  12. package/dist/browser/checkout/{index-b7f0cdc7.js → index-04a85afd.js} +1 -1
  13. package/dist/browser/checkout/{index-e27c3ed4.js → index-38e5d382.js} +2 -2
  14. package/dist/browser/checkout/{index-a48f6b1d.js → index-6ef61124.js} +1 -1
  15. package/dist/browser/checkout/{index-e8067c90.js → index-b794d729.js} +1 -1
  16. package/dist/browser/checkout/{index-8491ffb8.js → index-bbdc4af9.js} +1 -1
  17. package/dist/browser/checkout/{index-0f644711.js → index-d022ef82.js} +1 -1
  18. package/dist/browser/checkout/{index-0e023c6c.js → index-ddc7140f.js} +1 -1
  19. package/dist/browser/checkout/index-efd0d822.js +1 -0
  20. package/dist/browser/checkout/{index.umd-f196f3bb.js → index.umd-e3e63faf.js} +1 -1
  21. package/dist/browser/checkout/{retry-38e872b6.js → retry-d97eb99d.js} +1 -1
  22. package/dist/browser/checkout/sdk.js +4 -4
  23. package/dist/browser/checkout/widgets-esm.js +1 -1
  24. package/dist/browser/checkout/widgets.js +4 -4
  25. package/dist/checkout.js +4 -4
  26. package/dist/config.js +1 -1
  27. package/dist/index.browser.js +4 -4
  28. package/dist/index.browser.js.map +1 -1
  29. package/dist/index.cjs +19 -9
  30. package/dist/index.js +19 -9
  31. package/dist/orderbook.js +1 -1
  32. package/dist/passport.js +16 -6
  33. package/dist/x.js +3 -3
  34. package/package.json +1 -1
  35. package/dist/browser/checkout/index-a5564aad.js +0 -1
@@ -1 +1 @@
1
- import{c as e,a2 as s,a3 as a,be as r,bf as n,a4 as t,r as i,bg as o,a as c,aa as d,bh as u,bi as l,B as m,bj as b,bk as p,bl as v,bm as h,bn as f,bo as z,p as x,bp as y,bq as g}from"./index-e27c3ed4.js";var P={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function A(e){var s=e.size,a=e.themeProps,r=/large|medium/.test(s)?a.base.spacing.x2:a.base.spacing.x1;return{gap:r,padding:r,borderRadius:/large|medium/.test(s)?a.base.borderRadius.x8:a.base.borderRadius.x4}}function w(e){var s=e.size,a=e.themeProps;return{borderRadius:/large|medium/.test(s)?a.base.borderRadius.x4:a.base.spacing.x2}}var N={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&:hover:not([disabled])":{boxShadow:function(e){var s=e.base;return"inset 0 0 0 ".concat(s.border.size[100]," ").concat(s.color.translucent.standard[1e3])}},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var s=e.base;return"inset 0 0 0 ".concat(s.border.size[200]," ").concat(s.color.translucent.standard[1e3])}},"&:hover:not([disabled])::before":{content:"unset"},"& > span":{textAlign:"left",whiteSpace:"nowrap"}};function M(e){var s=e.size,a=e.themeProps,r=Array.isArray(s)?b(s):[s];return r.shift(),{styles:t.apply(void 0,b(r.map((function(e,s){if(null!=e&&!p(e)){var r,n="@media screen and (min-width: ".concat(null===(r=a.base.breakpointAsArray)||void 0===r?void 0:r[s],"px)");return v({},n,w({size:e,themeProps:a}))}return{}}))))}}var B=["sx","size","selected"];function H(o){var u=o.sx,l=void 0===u?{}:u,m=o.size,b=void 0===m?"medium":m,p=o.selected,v=s(o,B),x=a(),y=r(b,n,h),g=M({size:b,themeProps:x}).styles,P=i.useMemo((function(){return t(N,g,w({size:y,themeProps:x}),f(l,"base.color.translucent.emphasis.100"),l)}),[l,g,y,x]);return c(z,{children:function(s){var a=s.cx;return c(e,d(d({},v),{},{size:b,variant:"tertiary",sx:P,className:a({selected:p})}))}})}H.displayName="HorizontalMenuButtCon",H.SvgIcon=e.SvgIcon;var R=["children","sx","size","selected"];function S(e){var o=e.children,u=e.sx,l=void 0===u?{}:u,m=e.size,b=void 0===m?"medium":m,p=e.selected,v=s(e,R),y=a(),g=r(b,n,h),P=M({size:b,themeProps:y}).styles,A=i.useMemo((function(){return t(N,P,w({size:g,themeProps:y}),f(l,"base.color.translucent.emphasis.100"),l)}),[l,P,g,y]);return c(z,{children:function(e){var s=e.cx;return c(x,d(d({},v),{},{size:b,variant:"tertiary",className:s({selected:p}),sx:A,children:o}))}})}S.displayName="HorizontalMenuButton",S.Icon=y,S.Logo=g;var k=["children","sx","size","className"];function C(e){var f=e.children,z=e.sx,x=void 0===z?{}:z,y=e.size,g=void 0===y?"medium":y,w=e.className,N=s(e,k),M=a(),B=r(g,n,h),R=function(e){var s=e.size,a=e.themeProps,r=Array.isArray(s)?b(s):[s];return r.shift(),{styles:t.apply(void 0,b(r.map((function(e,s){if(null!=e&&!p(e)){var r,n="@media screen and (min-width: ".concat(null===(r=a.base.breakpointAsArray)||void 0===r?void 0:r[s],"px)");return v({},n,A({size:e,themeProps:a}))}return{}}))))}}({size:g,themeProps:M}),C=R.styles,j=t(P,A({size:B,themeProps:M}),C,x),I=i.useMemo((function(){return o(f)}),[f]);return c(m,d(d({},N),{},{sx:j,className:"".concat(null!=w?w:""," HorizontalMenu"),children:i.Children.map(I,(function(e){return u(e,H)||u(e,S)?c(l,{size:e.props.size?e.props.size:g,children:e}):e}))}))}C.displayName="HorizontalMenu",C.Button=S,C.ButtCon=H;export{C as H};
1
+ import{c as e,a2 as s,a3 as a,be as r,bf as n,a4 as t,r as i,bg as o,a as c,aa as d,bh as u,bi as l,B as m,bj as b,bk as p,bl as v,bm as h,bn as f,bo as z,p as x,bp as y,bq as g}from"./index-38e5d382.js";var P={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function A(e){var s=e.size,a=e.themeProps,r=/large|medium/.test(s)?a.base.spacing.x2:a.base.spacing.x1;return{gap:r,padding:r,borderRadius:/large|medium/.test(s)?a.base.borderRadius.x8:a.base.borderRadius.x4}}function w(e){var s=e.size,a=e.themeProps;return{borderRadius:/large|medium/.test(s)?a.base.borderRadius.x4:a.base.spacing.x2}}var N={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&:hover:not([disabled])":{boxShadow:function(e){var s=e.base;return"inset 0 0 0 ".concat(s.border.size[100]," ").concat(s.color.translucent.standard[1e3])}},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var s=e.base;return"inset 0 0 0 ".concat(s.border.size[200]," ").concat(s.color.translucent.standard[1e3])}},"&:hover:not([disabled])::before":{content:"unset"},"& > span":{textAlign:"left",whiteSpace:"nowrap"}};function M(e){var s=e.size,a=e.themeProps,r=Array.isArray(s)?b(s):[s];return r.shift(),{styles:t.apply(void 0,b(r.map((function(e,s){if(null!=e&&!p(e)){var r,n="@media screen and (min-width: ".concat(null===(r=a.base.breakpointAsArray)||void 0===r?void 0:r[s],"px)");return v({},n,w({size:e,themeProps:a}))}return{}}))))}}var B=["sx","size","selected"];function H(o){var u=o.sx,l=void 0===u?{}:u,m=o.size,b=void 0===m?"medium":m,p=o.selected,v=s(o,B),x=a(),y=r(b,n,h),g=M({size:b,themeProps:x}).styles,P=i.useMemo((function(){return t(N,g,w({size:y,themeProps:x}),f(l,"base.color.translucent.emphasis.100"),l)}),[l,g,y,x]);return c(z,{children:function(s){var a=s.cx;return c(e,d(d({},v),{},{size:b,variant:"tertiary",sx:P,className:a({selected:p})}))}})}H.displayName="HorizontalMenuButtCon",H.SvgIcon=e.SvgIcon;var R=["children","sx","size","selected"];function S(e){var o=e.children,u=e.sx,l=void 0===u?{}:u,m=e.size,b=void 0===m?"medium":m,p=e.selected,v=s(e,R),y=a(),g=r(b,n,h),P=M({size:b,themeProps:y}).styles,A=i.useMemo((function(){return t(N,P,w({size:g,themeProps:y}),f(l,"base.color.translucent.emphasis.100"),l)}),[l,P,g,y]);return c(z,{children:function(e){var s=e.cx;return c(x,d(d({},v),{},{size:b,variant:"tertiary",className:s({selected:p}),sx:A,children:o}))}})}S.displayName="HorizontalMenuButton",S.Icon=y,S.Logo=g;var k=["children","sx","size","className"];function C(e){var f=e.children,z=e.sx,x=void 0===z?{}:z,y=e.size,g=void 0===y?"medium":y,w=e.className,N=s(e,k),M=a(),B=r(g,n,h),R=function(e){var s=e.size,a=e.themeProps,r=Array.isArray(s)?b(s):[s];return r.shift(),{styles:t.apply(void 0,b(r.map((function(e,s){if(null!=e&&!p(e)){var r,n="@media screen and (min-width: ".concat(null===(r=a.base.breakpointAsArray)||void 0===r?void 0:r[s],"px)");return v({},n,A({size:e,themeProps:a}))}return{}}))))}}({size:g,themeProps:M}),C=R.styles,j=t(P,A({size:B,themeProps:M}),C,x),I=i.useMemo((function(){return o(f)}),[f]);return c(m,d(d({},N),{},{sx:j,className:"".concat(null!=w?w:""," HorizontalMenu"),children:i.Children.map(I,(function(e){return u(e,H)||u(e,S)?c(l,{size:e.props.size?e.props.size:g,children:e}):e}))}))}C.displayName="HorizontalMenu",C.Button=S,C.ButtCon=H;export{C as H};
@@ -1,2 +1,2 @@
1
- import{b5 as e,b6 as t,b7 as a,b8 as r,b9 as n,e as o,r as s,C as i,E as h,u as c,V as u,S as l,ba as p,a as f,J as d,z as m,bb as R,B as E,U as v,d as A,G as S,j as O,W as T,_ as y,$ as _,aT as I,a0 as C,bc as g,aF as w,aG as N,bd as P,I as b}from"./index-e27c3ed4.js";import{O as D,T as L}from"./TopUpView-55a4ebd7.js";import{S as U}from"./SpendingCapHero-78cf24cf.js";
2
- /*! https://mths.be/punycode v1.4.1 by @mathias */var x=2147483647,k=36,K=1,F=26,j=38,M=700,G=72,W=128,q="-",V=/[^\x20-\x7E]/,$=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=k-K,H=Math.floor,z=String.fromCharCode;function Z(e){throw new RangeError(B[e])}function Q(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function X(e,t,a){var r=0;for(e=a?H(e/M):e>>1,e+=H(e/t);e>J*F>>1;r+=k)e=H(e/J);return H(r+(J+1)*e/(e+j))}function Y(e){return function(e,t){var a=e.split("@"),r="";a.length>1&&(r=a[0]+"@",e=a[1]);var n=function(e,t){for(var a=e.length,r=[];a--;)r[a]=t(e[a]);return r}((e=e.replace($,".")).split("."),t).join(".");return r+n}(e,(function(e){return V.test(e)?"xn--"+function(e){var t,a,r,n,o,s,i,h,c,u,l,p,f,d,m,R=[];for(e=function(e){for(var t,a,r=[],n=0,o=e.length;n<o;)(t=e.charCodeAt(n++))>=55296&&t<=56319&&n<o?56320==(64512&(a=e.charCodeAt(n++)))?r.push(((1023&t)<<10)+(1023&a)+65536):(r.push(t),n--):r.push(t);return r}(e),p=e.length,t=W,a=0,o=G,s=0;s<p;++s)(l=e[s])<128&&R.push(z(l));for(r=n=R.length,n&&R.push(q);r<p;){for(i=x,s=0;s<p;++s)(l=e[s])>=t&&l<i&&(i=l);for(i-t>H((x-a)/(f=r+1))&&Z("overflow"),a+=(i-t)*f,t=i,s=0;s<p;++s)if((l=e[s])<t&&++a>x&&Z("overflow"),l==t){for(h=a,c=k;!(h<(u=c<=o?K:c>=o+F?F:c-o));c+=k)m=h-u,d=k-u,R.push(z(Q(u+m%d,0))),h=H(m/d);R.push(z(Q(h,0))),o=X(a,f,r==n),a=0,++r}++a,++t}return R.join("")}(e):e}))}function ee(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var te=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function ae(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function re(e,t){if(e.map)return e.map(t);for(var a=[],r=0;r<e.length;r++)a.push(t(e[r],r));return a}var ne=Object.keys||function(e){var t=[];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t};function oe(e,t,a,r){t=t||"&",a=a||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var i=e.length;s>0&&i>s&&(i=s);for(var h=0;h<i;++h){var c,u,l,p,f=e[h].replace(o,"%20"),d=f.indexOf(a);d>=0?(c=f.substr(0,d),u=f.substr(d+1)):(c=f,u=""),l=decodeURIComponent(c),p=decodeURIComponent(u),ee(n,l)?te(n[l])?n[l].push(p):n[l]=[n[l],p]:n[l]=p}return n}var se={parse:Oe,resolve:function(e,t){return Oe(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?Oe(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new ie).parse(e);else if(!(e instanceof ie))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof e+String(e));if("file:"!==e.protocol)throw new TypeError("The URL must be of scheme file");return function(e){const t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){const a=32|t.codePointAt(e+2);if("2"===t[e+1]&&102===a)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(t)}(e)},format:function(e){a(e)&&(e=Te({},e));return ye(e)},Url:ie,URL:e.URL,URLSearchParams:e.URLSearchParams};function ie(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var he=/^([a-z0-9.+-]+:)/i,ce=/:[0-9]*$/,ue=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,le=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),pe=["'"].concat(le),fe=["%","/","?",";","#"].concat(pe),de=["/","?","#"],me=255,Re=/^[+a-z0-9A-Z_-]{0,63}$/,Ee=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ve={javascript:!0,"javascript:":!0},Ae={javascript:!0,"javascript:":!0},Se={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Oe(e,a,r){if(e&&t(e)&&e instanceof ie)return e;var n=new ie;return n.parse(e,a,r),n}function Te(e,t,r,n){if(!a(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",i=t.split(s);i[0]=i[0].replace(/\\/g,"/");var h=t=i.join(s);if(h=h.trim(),!n&&1===t.split("#").length){var c=ue.exec(h);if(c)return e.path=h,e.href=h,e.pathname=c[1],c[2]?(e.search=c[2],e.query=r?oe(e.search.substr(1)):e.search.substr(1)):r&&(e.search="",e.query={}),e}var u,l,p,f,d=he.exec(h);if(d){var m=(d=d[0]).toLowerCase();e.protocol=m,h=h.substr(d.length)}if(n||d||h.match(/^\/\/[^@\/]+@[^@\/]+/)){var R="//"===h.substr(0,2);!R||d&&Ae[d]||(h=h.substr(2),e.slashes=!0)}if(!Ae[d]&&(R||d&&!Se[d])){var E,v,A=-1;for(u=0;u<de.length;u++)-1!==(l=h.indexOf(de[u]))&&(-1===A||l<A)&&(A=l);for(-1!==(v=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A))&&(E=h.slice(0,v),h=h.slice(v+1),e.auth=decodeURIComponent(E)),A=-1,u=0;u<fe.length;u++)-1!==(l=h.indexOf(fe[u]))&&(-1===A||l<A)&&(A=l);-1===A&&(A=h.length),e.host=h.slice(0,A),h=h.slice(A),_e(e),e.hostname=e.hostname||"";var S="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!S){var O=e.hostname.split(/\./);for(u=0,p=O.length;u<p;u++){var T=O[u];if(T&&!T.match(Re)){for(var y="",_=0,I=T.length;_<I;_++)T.charCodeAt(_)>127?y+="x":y+=T[_];if(!y.match(Re)){var C=O.slice(0,u),g=O.slice(u+1),w=T.match(Ee);w&&(C.push(w[1]),g.unshift(w[2])),g.length&&(h="/"+g.join(".")+h),e.hostname=C.join(".");break}}}}e.hostname.length>me?e.hostname="":e.hostname=e.hostname.toLowerCase(),S||(e.hostname=Y(e.hostname)),f=e.port?":"+e.port:"";var N=e.hostname||"";e.host=N+f,e.href+=e.host,S&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!ve[m])for(u=0,p=pe.length;u<p;u++){var P=pe[u];if(-1!==h.indexOf(P)){var b=encodeURIComponent(P);b===P&&(b=escape(P)),h=h.split(P).join(b)}}var D=h.indexOf("#");-1!==D&&(e.hash=h.substr(D),h=h.slice(0,D));var L=h.indexOf("?");if(-1!==L?(e.search=h.substr(L),e.query=h.substr(L+1),r&&(e.query=oe(e.query)),h=h.slice(0,L)):r&&(e.search="",e.query={}),h&&(e.pathname=h),Se[m]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){f=e.pathname||"";var U=e.search||"";e.path=f+U}return e.href=ye(e),e}function ye(e){var a=e.auth||"";a&&(a=(a=encodeURIComponent(a)).replace(/%3A/i,":"),a+="@");var r,n,o,s,i=e.protocol||"",h=e.pathname||"",c=e.hash||"",u=!1,l="";e.host?u=a+e.host:e.hostname&&(u=a+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(u+=":"+e.port)),e.query&&t(e.query)&&Object.keys(e.query).length&&(r=e.query,n=n||"&",o=o||"=",null===r&&(r=void 0),l="object"==typeof r?re(ne(r),(function(e){var t=encodeURIComponent(ae(e))+o;return te(r[e])?re(r[e],(function(e){return t+encodeURIComponent(ae(e))})).join(n):t+encodeURIComponent(ae(r[e]))})).join(n):s?encodeURIComponent(ae(s))+o+encodeURIComponent(ae(r)):"");var p=e.search||l&&"?"+l||"";return i&&":"!==i.substr(-1)&&(i+=":"),e.slashes||(!i||Se[i])&&!1!==u?(u="//"+(u||""),h&&"/"!==h.charAt(0)&&(h="/"+h)):u||(u=""),c&&"#"!==c.charAt(0)&&(c="#"+c),p&&"?"!==p.charAt(0)&&(p="?"+p),i+u+(h=h.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(p=p.replace("#","%23"))+c}function _e(e){var t=e.host,a=ce.exec(t);a&&(":"!==(a=a[0])&&(e.port=a.substr(1)),t=t.substr(0,t.length-a.length)),t&&(e.hostname=t)}ie.prototype.parse=function(e,t,a){return Te(this,e,t,a)},ie.prototype.format=function(){return ye(this)},ie.prototype.resolve=function(e){return this.resolveObject(Oe(e,!1,!0)).format()},ie.prototype.resolveObject=function(e){if(a(e)){var t=new ie;t.parse(e,!1,!0),e=t}for(var o,s=new ie,i=Object.keys(this),h=0;h<i.length;h++){var c=i[h];s[c]=this[c]}if(s.hash=e.hash,""===e.href)return s.href=s.format(),s;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),l=0;l<u.length;l++){var p=u[l];"protocol"!==p&&(s[p]=e[p])}return Se[s.protocol]&&s.hostname&&!s.pathname&&(s.path=s.pathname="/"),s.href=s.format(),s}if(e.protocol&&e.protocol!==s.protocol){if(!Se[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var m=f[d];s[m]=e[m]}return s.href=s.format(),s}if(s.protocol=e.protocol,e.host||Ae[e.protocol])s.pathname=e.pathname;else{for(o=(e.pathname||"").split("/");o.length&&!(e.host=o.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),s.pathname=o.join("/")}if(s.search=e.search,s.query=e.query,s.host=e.host||"",s.auth=e.auth,s.hostname=e.hostname||e.host,s.port=e.port,s.pathname||s.search){var R=s.pathname||"",E=s.search||"";s.path=R+E}return s.slashes=s.slashes||e.slashes,s.href=s.format(),s}var v,A=s.pathname&&"/"===s.pathname.charAt(0),S=e.host||e.pathname&&"/"===e.pathname.charAt(0),O=S||A||s.host&&e.pathname,T=O,y=s.pathname&&s.pathname.split("/")||[],_=s.protocol&&!Se[s.protocol];if(o=e.pathname&&e.pathname.split("/")||[],_&&(s.hostname="",s.port=null,s.host&&(""===y[0]?y[0]=s.host:y.unshift(s.host)),s.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===o[0]?o[0]=e.host:o.unshift(e.host)),e.host=null),O=O&&(""===o[0]||""===y[0])),S)s.host=e.host||""===e.host?e.host:s.host,s.hostname=e.hostname||""===e.hostname?e.hostname:s.hostname,s.search=e.search,s.query=e.query,y=o;else if(o.length)y||(y=[]),y.pop(),y=y.concat(o),s.search=e.search,s.query=e.query;else if(!r(e.search))return _&&(s.hostname=s.host=y.shift(),(v=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=v.shift(),s.host=s.hostname=v.shift())),s.search=e.search,s.query=e.query,n(s.pathname)&&n(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s;if(!y.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var I=y.slice(-1)[0],C=(s.host||e.host||y.length>1)&&("."===I||".."===I)||""===I,g=0,w=y.length;w>=0;w--)"."===(I=y[w])?y.splice(w,1):".."===I?(y.splice(w,1),g++):g&&(y.splice(w,1),g--);if(!O&&!T)for(;g--;g)y.unshift("..");!O||""===y[0]||y[0]&&"/"===y[0].charAt(0)||y.unshift(""),C&&"/"!==y.join("/").substr(-1)&&y.push("");var N=""===y[0]||y[0]&&"/"===y[0].charAt(0);return _&&(s.hostname=s.host=N?"":y.length?y.shift():"",(v=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=v.shift(),s.host=s.hostname=v.shift())),(O=O||s.host&&y.length)&&!N&&y.unshift(""),y.length?s.pathname=y.join("/"):(s.pathname=null,s.path=null),n(s.pathname)&&n(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=e.auth||s.auth,s.slashes=s.slashes||e.slashes,s.href=s.format(),s},ie.prototype.parseHost=function(){return _e(this)};const Ie=e=>({position:"relative",maxWidth:"420px",height:"565px",borderRadius:"base.borderRadius.x6",overflow:"hidden",marginLeft:"base.spacing.x2",marginRight:"base.spacing.x2",marginBottom:"base.spacing.x2",display:e?"block":"none"}),Ce=e=>({display:e?"block":"none"});var ge,we,Ne,Pe;!function(e){e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(ge||(ge={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(we||(we={})),function(e){e.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(Ne||(Ne={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(Pe||(Pe={}));const be=["global.transak.com","global-stg.transak.com"],De={[Ne.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[Ne.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${Ne.TRANSAK_ORDER_SUCCESSFUL}${Pe.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${Ne.TRANSAK_ORDER_SUCCESSFUL}${Pe.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[Ne.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},Le=e=>{const{track:t}=o(),{userJourney:a,ref:r,email:n,userId:i,isPassportWallet:h,failedToLoadTimeoutInMs:c,onFailedToLoad:u}=e,[l,p]=s.useState(!1),f=c||1e4,d=s.useRef(void 0),m=s.useCallback((e=>{const r=e.event_id,o=[Ne.TRANSAK_ORDER_SUCCESSFUL].includes(r)?`${r}${e.data.status}`:r,s=De?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:a,extras:{email:n,userId:i,isPassportWallet:h}})}),[]),R=s.useCallback((t=>{switch(t.event_id){case Ne.TRANSAK_WIDGET_INITIALISED:a=t.data,p(!0),clearTimeout(d.current),d.current=void 0,e.onInit?.(a);break;case Ne.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case Ne.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case Ne.TRANSAK_ORDER_SUCCESSFUL:t.data.status===Pe.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===Pe.COMPLETED&&e.onOrderCompleted?.(t.data);break;case Ne.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}var a}),[]),E=s.useCallback((e=>{const t=Oe(e.origin)?.host?.toLowerCase();e.source===r?.current?.contentWindow&&t&&be.includes(t)&&(m(e.data),R(e.data),console.log("@@@ Transak event",e))}),[r]);return s.useEffect((()=>(window.addEventListener("message",E),()=>{clearTimeout(d.current),window.removeEventListener("message",E)})),[]),{initialised:l,onLoad:()=>{void 0!==u&&(void 0!==d.current||l||(d.current=setTimeout((()=>{l||u()}),f)))}}},Ue="transak-iframe",xe=6e3;function ke({passport:e,showIframe:t,tokenAmount:a,tokenAddress:r}){const{connectLoaderState:n}=s.useContext(i),{checkout:S,provider:O}=n,{eventTargetState:{eventTarget:T}}=s.useContext(h),{t:y}=c(),{viewState:_,viewDispatch:I}=s.useContext(u),[C,g]=s.useState(""),w=s.useRef(),N=!!e&&O?.provider?.isPassport,P=s.useMemo((()=>_.history.length>2&&_.history[_.history.length-2].type===l.TOP_UP_VIEW),[_.history]),{track:b}=o();return s.useEffect((()=>{if(!S||!O)return;let t,n="";(async()=>{const t={exchangeType:p.ONRAMP,web3Provider:O,tokenAddress:r,tokenAmount:a,passport:e};g(await S.createFiatRampUrl(t)),n=await O.getSigner().getAddress()})(),(async()=>{if(e){const a=await e.getUserInfo();t=a?.email}})();const o=document.getElementById(Ue);if(!o)return;window.addEventListener("message",(e=>{if(!o)return;const s=se.parse(e.origin)?.host?.toLowerCase();e.source===o.contentWindow&&s&&be.includes(s)&&((async(e,t,a)=>{const r={userId:t.toLowerCase(),isPassportWallet:N,email:a};switch(e.event_id){case ge.TRANSAK_WIDGET_OPEN:b({userJourney:v.ON_RAMP,screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent",extras:{...r}});break;case ge.TRANSAK_ORDER_CREATED:b({userJourney:v.ON_RAMP,screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent",extras:{...r}});break;case ge.TRANSAK_ORDER_SUCCESSFUL:e.data.status===we.PROCESSING&&b({userJourney:v.ON_RAMP,screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent",extras:{...r}}),e.data.status===we.COMPLETED&&b({userJourney:v.ON_RAMP,screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent",extras:{...r}});break;case ge.TRANSAK_ORDER_FAILED:b({userJourney:v.ON_RAMP,screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent",extras:{...r}})}})(e.data,n,t),(e=>{if(w.current&&clearTimeout(w.current),e.event_id!==ge.TRANSAK_WIDGET_OPEN)return e.event_id===ge.TRANSAK_ORDER_SUCCESSFUL&&e.data.status===we.PROCESSING?(I({payload:{type:A.UPDATE_VIEW,view:{type:D.IN_PROGRESS_LOADING}}}),void(w.current=window.setTimeout((()=>{I({payload:{type:A.UPDATE_VIEW,view:{type:D.IN_PROGRESS}}})}),xe))):void(e.event_id!==ge.TRANSAK_ORDER_SUCCESSFUL||e.data.status!==we.COMPLETED?e.event_id===ge.TRANSAK_ORDER_FAILED&&I({payload:{type:A.UPDATE_VIEW,view:{type:D.FAIL,data:{amount:a,tokenAddress:r},reason:`Transaction failed: ${e.data.statusReason}`}}}):I({payload:{type:A.UPDATE_VIEW,view:{type:D.SUCCESS,data:{transactionHash:e.data.transactionHash}}}}));I({payload:{type:A.UPDATE_VIEW,view:{type:D.ONRAMP,data:{amount:_.view.data?.amount??a,tokenAddress:_.view.data?.tokenAddress??r}}}})})(e.data))}))}),[S,O,a,r,e]),f(E,{sx:Ce(t),children:f(d,{header:f(m,{showBack:P,title:y("views.ONRAMP.header.title"),onCloseButtonClick:()=>R(T)}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:f(E,{sx:Ie(t),children:f("iframe",{title:"Transak",id:Ue,src:C,allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute"}})})})})}function Ke(){const{eventTargetState:{eventTarget:e}}=s.useContext(h),{t:t}=c();return f(d,{testId:"order-in-progress-view",header:f(m,{transparent:!0,onCloseButtonClick:()=>R(e)}),footer:f(S,{}),heroContent:f(U,{}),floatHeader:!0,children:O(T,{heading:t("views.ONRAMP.IN_PROGRESS.content.heading"),children:[t("views.ONRAMP.IN_PROGRESS.content.body1"),f("br",{}),f("br",{}),t("views.ONRAMP.IN_PROGRESS.content.body2")]})})}function Fe({amount:e,tokenAddress:t,config:a}){const{isOnRampEnabled:r,isSwapEnabled:n,isBridgeEnabled:o}=a,[p,d]=s.useReducer(y,{..._,history:[]}),m=s.useMemo((()=>({viewState:p,viewDispatch:d})),[p,y]),{connectLoaderState:E}=s.useContext(i),{checkout:S,provider:T}=E,[U,x]=s.useState(t),{eventTargetState:{eventTarget:k}}=s.useContext(h),{t:K}=c(),F=s.useMemo((()=>p.view.type===D.ONRAMP),[p.view.type]);return s.useEffect((()=>{S&&T&&(async()=>{if(!(await S.getNetworkInfo({provider:T})).isSupported)return;const e=U?.toLocaleLowerCase()===I?I:t;x(e)})()}),[S,T,d]),O(u.Provider,{value:m,children:[p.view.type===l.LOADING_VIEW&&f(C,{loadingText:K("views.ONRAMP.initialLoadingText")}),p.view.type===D.IN_PROGRESS_LOADING&&f(C,{loadingText:K("views.ONRAMP.IN_PROGRESS_LOADING.loading.text")}),p.view.type===D.IN_PROGRESS&&f(Ke,{}),p.view.type===D.SUCCESS&&f(N,{statusText:K("views.ONRAMP.SUCCESS.text"),actionText:K("views.ONRAMP.SUCCESS.actionText"),onRenderEvent:()=>g(k,p.view.data.transactionHash),onActionClick:()=>R(k),statusType:w.SUCCESS,testId:"success-view"}),p.view.type===D.FAIL&&f(N,{statusText:K("views.ONRAMP.FAIL.text"),actionText:K("views.ONRAMP.FAIL.actionText"),onRenderEvent:()=>P(k,p.view.reason??"Transaction failed"),onActionClick:()=>{d({payload:{type:A.UPDATE_VIEW,view:{type:D.ONRAMP,data:p.view.data}}})},statusType:w.FAILURE,onCloseClick:()=>R(k),testId:"fail-view"}),p.view.type!==D.SUCCESS&&p.view.type!==D.FAIL&&f(ke,{passport:S?.passport,showIframe:F,tokenAmount:p.view.data?.amount??e,tokenAddress:p.view.data?.tokenAddress??U}),p.view.type===l.TOP_UP_VIEW&&f(L,{analytics:{userJourney:v.ON_RAMP},widgetEvent:b.IMTBL_ONRAMP_WIDGET_EVENT,checkout:S,provider:T,showOnrampOption:r,showSwapOption:n,showBridgeOption:o,onCloseButtonClick:()=>R(k)})]})}var je=Object.freeze({__proto__:null,default:Fe});export{Fe as O,je as a,Le as u};
1
+ import{b5 as e,b6 as t,b7 as a,b8 as r,b9 as n,e as o,r as s,C as i,E as h,u as c,V as u,S as l,ba as p,a as f,J as d,z as m,bb as R,B as E,U as v,d as A,G as S,j as O,W as T,_ as y,$ as _,aT as I,a0 as C,bc as g,aF as w,aG as N,bd as P,I as b}from"./index-38e5d382.js";import{O as D,T as L}from"./TopUpView-57b43da7.js";import{S as x}from"./SpendingCapHero-6abc0869.js";
2
+ /*! https://mths.be/punycode v1.4.1 by @mathias */var U=2147483647,k=36,K=1,F=26,j=38,M=700,G=72,W=128,q="-",V=/[^\x20-\x7E]/,$=/[\x2E\u3002\uFF0E\uFF61]/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},J=k-K,H=Math.floor,z=String.fromCharCode;function Z(e){throw new RangeError(B[e])}function Q(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function X(e,t,a){var r=0;for(e=a?H(e/M):e>>1,e+=H(e/t);e>J*F>>1;r+=k)e=H(e/J);return H(r+(J+1)*e/(e+j))}function Y(e){return function(e,t){var a=e.split("@"),r="";a.length>1&&(r=a[0]+"@",e=a[1]);var n=function(e,t){for(var a=e.length,r=[];a--;)r[a]=t(e[a]);return r}((e=e.replace($,".")).split("."),t).join(".");return r+n}(e,(function(e){return V.test(e)?"xn--"+function(e){var t,a,r,n,o,s,i,h,c,u,l,p,f,d,m,R=[];for(e=function(e){for(var t,a,r=[],n=0,o=e.length;n<o;)(t=e.charCodeAt(n++))>=55296&&t<=56319&&n<o?56320==(64512&(a=e.charCodeAt(n++)))?r.push(((1023&t)<<10)+(1023&a)+65536):(r.push(t),n--):r.push(t);return r}(e),p=e.length,t=W,a=0,o=G,s=0;s<p;++s)(l=e[s])<128&&R.push(z(l));for(r=n=R.length,n&&R.push(q);r<p;){for(i=U,s=0;s<p;++s)(l=e[s])>=t&&l<i&&(i=l);for(i-t>H((U-a)/(f=r+1))&&Z("overflow"),a+=(i-t)*f,t=i,s=0;s<p;++s)if((l=e[s])<t&&++a>U&&Z("overflow"),l==t){for(h=a,c=k;!(h<(u=c<=o?K:c>=o+F?F:c-o));c+=k)m=h-u,d=k-u,R.push(z(Q(u+m%d,0))),h=H(m/d);R.push(z(Q(h,0))),o=X(a,f,r==n),a=0,++r}++a,++t}return R.join("")}(e):e}))}function ee(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var te=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function ae(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function re(e,t){if(e.map)return e.map(t);for(var a=[],r=0;r<e.length;r++)a.push(t(e[r],r));return a}var ne=Object.keys||function(e){var t=[];for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t};function oe(e,t,a,r){t=t||"&",a=a||"=";var n={};if("string"!=typeof e||0===e.length)return n;var o=/\+/g;e=e.split(t);var s=1e3;r&&"number"==typeof r.maxKeys&&(s=r.maxKeys);var i=e.length;s>0&&i>s&&(i=s);for(var h=0;h<i;++h){var c,u,l,p,f=e[h].replace(o,"%20"),d=f.indexOf(a);d>=0?(c=f.substr(0,d),u=f.substr(d+1)):(c=f,u=""),l=decodeURIComponent(c),p=decodeURIComponent(u),ee(n,l)?te(n[l])?n[l].push(p):n[l]=[n[l],p]:n[l]=p}return n}var se={parse:Oe,resolve:function(e,t){return Oe(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?Oe(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new ie).parse(e);else if(!(e instanceof ie))throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof e+String(e));if("file:"!==e.protocol)throw new TypeError("The URL must be of scheme file");return function(e){const t=e.pathname;for(let e=0;e<t.length;e++)if("%"===t[e]){const a=32|t.codePointAt(e+2);if("2"===t[e+1]&&102===a)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(t)}(e)},format:function(e){a(e)&&(e=Te({},e));return ye(e)},Url:ie,URL:e.URL,URLSearchParams:e.URLSearchParams};function ie(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var he=/^([a-z0-9.+-]+:)/i,ce=/:[0-9]*$/,ue=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,le=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),pe=["'"].concat(le),fe=["%","/","?",";","#"].concat(pe),de=["/","?","#"],me=255,Re=/^[+a-z0-9A-Z_-]{0,63}$/,Ee=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ve={javascript:!0,"javascript:":!0},Ae={javascript:!0,"javascript:":!0},Se={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Oe(e,a,r){if(e&&t(e)&&e instanceof ie)return e;var n=new ie;return n.parse(e,a,r),n}function Te(e,t,r,n){if(!a(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",i=t.split(s);i[0]=i[0].replace(/\\/g,"/");var h=t=i.join(s);if(h=h.trim(),!n&&1===t.split("#").length){var c=ue.exec(h);if(c)return e.path=h,e.href=h,e.pathname=c[1],c[2]?(e.search=c[2],e.query=r?oe(e.search.substr(1)):e.search.substr(1)):r&&(e.search="",e.query={}),e}var u,l,p,f,d=he.exec(h);if(d){var m=(d=d[0]).toLowerCase();e.protocol=m,h=h.substr(d.length)}if(n||d||h.match(/^\/\/[^@\/]+@[^@\/]+/)){var R="//"===h.substr(0,2);!R||d&&Ae[d]||(h=h.substr(2),e.slashes=!0)}if(!Ae[d]&&(R||d&&!Se[d])){var E,v,A=-1;for(u=0;u<de.length;u++)-1!==(l=h.indexOf(de[u]))&&(-1===A||l<A)&&(A=l);for(-1!==(v=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A))&&(E=h.slice(0,v),h=h.slice(v+1),e.auth=decodeURIComponent(E)),A=-1,u=0;u<fe.length;u++)-1!==(l=h.indexOf(fe[u]))&&(-1===A||l<A)&&(A=l);-1===A&&(A=h.length),e.host=h.slice(0,A),h=h.slice(A),_e(e),e.hostname=e.hostname||"";var S="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!S){var O=e.hostname.split(/\./);for(u=0,p=O.length;u<p;u++){var T=O[u];if(T&&!T.match(Re)){for(var y="",_=0,I=T.length;_<I;_++)T.charCodeAt(_)>127?y+="x":y+=T[_];if(!y.match(Re)){var C=O.slice(0,u),g=O.slice(u+1),w=T.match(Ee);w&&(C.push(w[1]),g.unshift(w[2])),g.length&&(h="/"+g.join(".")+h),e.hostname=C.join(".");break}}}}e.hostname.length>me?e.hostname="":e.hostname=e.hostname.toLowerCase(),S||(e.hostname=Y(e.hostname)),f=e.port?":"+e.port:"";var N=e.hostname||"";e.host=N+f,e.href+=e.host,S&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!ve[m])for(u=0,p=pe.length;u<p;u++){var P=pe[u];if(-1!==h.indexOf(P)){var b=encodeURIComponent(P);b===P&&(b=escape(P)),h=h.split(P).join(b)}}var D=h.indexOf("#");-1!==D&&(e.hash=h.substr(D),h=h.slice(0,D));var L=h.indexOf("?");if(-1!==L?(e.search=h.substr(L),e.query=h.substr(L+1),r&&(e.query=oe(e.query)),h=h.slice(0,L)):r&&(e.search="",e.query={}),h&&(e.pathname=h),Se[m]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){f=e.pathname||"";var x=e.search||"";e.path=f+x}return e.href=ye(e),e}function ye(e){var a=e.auth||"";a&&(a=(a=encodeURIComponent(a)).replace(/%3A/i,":"),a+="@");var r,n,o,s,i=e.protocol||"",h=e.pathname||"",c=e.hash||"",u=!1,l="";e.host?u=a+e.host:e.hostname&&(u=a+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(u+=":"+e.port)),e.query&&t(e.query)&&Object.keys(e.query).length&&(r=e.query,n=n||"&",o=o||"=",null===r&&(r=void 0),l="object"==typeof r?re(ne(r),(function(e){var t=encodeURIComponent(ae(e))+o;return te(r[e])?re(r[e],(function(e){return t+encodeURIComponent(ae(e))})).join(n):t+encodeURIComponent(ae(r[e]))})).join(n):s?encodeURIComponent(ae(s))+o+encodeURIComponent(ae(r)):"");var p=e.search||l&&"?"+l||"";return i&&":"!==i.substr(-1)&&(i+=":"),e.slashes||(!i||Se[i])&&!1!==u?(u="//"+(u||""),h&&"/"!==h.charAt(0)&&(h="/"+h)):u||(u=""),c&&"#"!==c.charAt(0)&&(c="#"+c),p&&"?"!==p.charAt(0)&&(p="?"+p),i+u+(h=h.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(p=p.replace("#","%23"))+c}function _e(e){var t=e.host,a=ce.exec(t);a&&(":"!==(a=a[0])&&(e.port=a.substr(1)),t=t.substr(0,t.length-a.length)),t&&(e.hostname=t)}ie.prototype.parse=function(e,t,a){return Te(this,e,t,a)},ie.prototype.format=function(){return ye(this)},ie.prototype.resolve=function(e){return this.resolveObject(Oe(e,!1,!0)).format()},ie.prototype.resolveObject=function(e){if(a(e)){var t=new ie;t.parse(e,!1,!0),e=t}for(var o,s=new ie,i=Object.keys(this),h=0;h<i.length;h++){var c=i[h];s[c]=this[c]}if(s.hash=e.hash,""===e.href)return s.href=s.format(),s;if(e.slashes&&!e.protocol){for(var u=Object.keys(e),l=0;l<u.length;l++){var p=u[l];"protocol"!==p&&(s[p]=e[p])}return Se[s.protocol]&&s.hostname&&!s.pathname&&(s.path=s.pathname="/"),s.href=s.format(),s}if(e.protocol&&e.protocol!==s.protocol){if(!Se[e.protocol]){for(var f=Object.keys(e),d=0;d<f.length;d++){var m=f[d];s[m]=e[m]}return s.href=s.format(),s}if(s.protocol=e.protocol,e.host||Ae[e.protocol])s.pathname=e.pathname;else{for(o=(e.pathname||"").split("/");o.length&&!(e.host=o.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),s.pathname=o.join("/")}if(s.search=e.search,s.query=e.query,s.host=e.host||"",s.auth=e.auth,s.hostname=e.hostname||e.host,s.port=e.port,s.pathname||s.search){var R=s.pathname||"",E=s.search||"";s.path=R+E}return s.slashes=s.slashes||e.slashes,s.href=s.format(),s}var v,A=s.pathname&&"/"===s.pathname.charAt(0),S=e.host||e.pathname&&"/"===e.pathname.charAt(0),O=S||A||s.host&&e.pathname,T=O,y=s.pathname&&s.pathname.split("/")||[],_=s.protocol&&!Se[s.protocol];if(o=e.pathname&&e.pathname.split("/")||[],_&&(s.hostname="",s.port=null,s.host&&(""===y[0]?y[0]=s.host:y.unshift(s.host)),s.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===o[0]?o[0]=e.host:o.unshift(e.host)),e.host=null),O=O&&(""===o[0]||""===y[0])),S)s.host=e.host||""===e.host?e.host:s.host,s.hostname=e.hostname||""===e.hostname?e.hostname:s.hostname,s.search=e.search,s.query=e.query,y=o;else if(o.length)y||(y=[]),y.pop(),y=y.concat(o),s.search=e.search,s.query=e.query;else if(!r(e.search))return _&&(s.hostname=s.host=y.shift(),(v=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=v.shift(),s.host=s.hostname=v.shift())),s.search=e.search,s.query=e.query,n(s.pathname)&&n(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s;if(!y.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var I=y.slice(-1)[0],C=(s.host||e.host||y.length>1)&&("."===I||".."===I)||""===I,g=0,w=y.length;w>=0;w--)"."===(I=y[w])?y.splice(w,1):".."===I?(y.splice(w,1),g++):g&&(y.splice(w,1),g--);if(!O&&!T)for(;g--;g)y.unshift("..");!O||""===y[0]||y[0]&&"/"===y[0].charAt(0)||y.unshift(""),C&&"/"!==y.join("/").substr(-1)&&y.push("");var N=""===y[0]||y[0]&&"/"===y[0].charAt(0);return _&&(s.hostname=s.host=N?"":y.length?y.shift():"",(v=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=v.shift(),s.host=s.hostname=v.shift())),(O=O||s.host&&y.length)&&!N&&y.unshift(""),y.length?s.pathname=y.join("/"):(s.pathname=null,s.path=null),n(s.pathname)&&n(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.auth=e.auth||s.auth,s.slashes=s.slashes||e.slashes,s.href=s.format(),s},ie.prototype.parseHost=function(){return _e(this)};const Ie=e=>({position:"relative",maxWidth:"420px",height:"565px",borderRadius:"base.borderRadius.x6",overflow:"hidden",marginLeft:"base.spacing.x2",marginRight:"base.spacing.x2",marginBottom:"base.spacing.x2",display:e?"block":"none"}),Ce=e=>({display:e?"block":"none"});var ge,we,Ne,Pe;!function(e){e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(ge||(ge={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(we||(we={})),function(e){e.TRANSAK_WIDGET_INITIALISED="TRANSAK_WIDGET_INITIALISED",e.TRANSAK_WIDGET_OPEN="TRANSAK_WIDGET_OPEN",e.TRANSAK_ORDER_CREATED="TRANSAK_ORDER_CREATED",e.TRANSAK_ORDER_SUCCESSFUL="TRANSAK_ORDER_SUCCESSFUL",e.TRANSAK_ORDER_FAILED="TRANSAK_ORDER_FAILED"}(Ne||(Ne={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(Pe||(Pe={}));const be=["global.transak.com","global-stg.transak.com"],De={[Ne.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[Ne.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${Ne.TRANSAK_ORDER_SUCCESSFUL}${Pe.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${Ne.TRANSAK_ORDER_SUCCESSFUL}${Pe.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[Ne.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},Le=e=>{const{track:t}=o(),{userJourney:a,ref:r,walletAddress:n,isPassportWallet:i,failedToLoadTimeoutInMs:h,onFailedToLoad:c}=e,[u,l]=s.useState(!1),p=h||1e4,f=s.useRef(void 0),d=s.useCallback((e=>{const r=e.event_id,o=[Ne.TRANSAK_ORDER_SUCCESSFUL].includes(r)?`${r}${e.data.status}`:r,s=De?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:a,extras:{walletAddress:n,isPassportWallet:i}})}),[]),m=s.useCallback((t=>{switch(t.event_id){case Ne.TRANSAK_WIDGET_INITIALISED:a=t.data,l(!0),clearTimeout(f.current),f.current=void 0,e.onInit?.(a);break;case Ne.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case Ne.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case Ne.TRANSAK_ORDER_SUCCESSFUL:t.data.status===Pe.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===Pe.COMPLETED&&e.onOrderCompleted?.(t.data);break;case Ne.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}var a}),[]),R=s.useCallback((e=>{const t=Oe(e.origin)?.host?.toLowerCase();e.source===r?.current?.contentWindow&&t&&be.includes(t)&&(d(e.data),m(e.data),console.log("@@@ Transak event",e))}),[r]);return s.useEffect((()=>(window.addEventListener("message",R),()=>{clearTimeout(f.current),window.removeEventListener("message",R)})),[]),{initialised:u,onLoad:()=>{void 0!==c&&(void 0!==f.current||u||(f.current=setTimeout((()=>{u||c()}),p)))}}},xe="transak-iframe",Ue=6e3;function ke({passport:e,showIframe:t,tokenAmount:a,tokenAddress:r}){const{connectLoaderState:n}=s.useContext(i),{checkout:S,provider:O}=n,{eventTargetState:{eventTarget:T}}=s.useContext(h),{t:y}=c(),{viewState:_,viewDispatch:I}=s.useContext(u),[C,g]=s.useState(""),w=s.useRef(),N=!!e&&O?.provider?.isPassport,P=s.useMemo((()=>_.history.length>2&&_.history[_.history.length-2].type===l.TOP_UP_VIEW),[_.history]),{track:b}=o();return s.useEffect((()=>{if(!S||!O)return;let t="";(async()=>{const n={exchangeType:p.ONRAMP,web3Provider:O,tokenAddress:r,tokenAmount:a,passport:e};g(await S.createFiatRampUrl(n)),t=await O.getSigner().getAddress()})();const n=document.getElementById(xe);if(!n)return;window.addEventListener("message",(e=>{if(!n)return;const o=se.parse(e.origin)?.host?.toLowerCase();e.source===n.contentWindow&&o&&be.includes(o)&&((async(e,t)=>{const a={userId:t.toLowerCase(),isPassportWallet:N};switch(e.event_id){case ge.TRANSAK_WIDGET_OPEN:b({userJourney:v.ON_RAMP,screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent",extras:{...a}});break;case ge.TRANSAK_ORDER_CREATED:b({userJourney:v.ON_RAMP,screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent",extras:{...a}});break;case ge.TRANSAK_ORDER_SUCCESSFUL:e.data.status===we.PROCESSING&&b({userJourney:v.ON_RAMP,screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent",extras:{...a}}),e.data.status===we.COMPLETED&&b({userJourney:v.ON_RAMP,screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent",extras:{...a}});break;case ge.TRANSAK_ORDER_FAILED:b({userJourney:v.ON_RAMP,screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent",extras:{...a}})}})(e.data,t),(e=>{if(w.current&&clearTimeout(w.current),e.event_id!==ge.TRANSAK_WIDGET_OPEN)return e.event_id===ge.TRANSAK_ORDER_SUCCESSFUL&&e.data.status===we.PROCESSING?(I({payload:{type:A.UPDATE_VIEW,view:{type:D.IN_PROGRESS_LOADING}}}),void(w.current=window.setTimeout((()=>{I({payload:{type:A.UPDATE_VIEW,view:{type:D.IN_PROGRESS}}})}),Ue))):void(e.event_id!==ge.TRANSAK_ORDER_SUCCESSFUL||e.data.status!==we.COMPLETED?e.event_id===ge.TRANSAK_ORDER_FAILED&&I({payload:{type:A.UPDATE_VIEW,view:{type:D.FAIL,data:{amount:a,tokenAddress:r},reason:`Transaction failed: ${e.data.statusReason}`}}}):I({payload:{type:A.UPDATE_VIEW,view:{type:D.SUCCESS,data:{transactionHash:e.data.transactionHash}}}}));I({payload:{type:A.UPDATE_VIEW,view:{type:D.ONRAMP,data:{amount:_.view.data?.amount??a,tokenAddress:_.view.data?.tokenAddress??r}}}})})(e.data))}))}),[S,O,a,r,e]),f(E,{sx:Ce(t),children:f(d,{header:f(m,{showBack:P,title:y("views.ONRAMP.header.title"),onCloseButtonClick:()=>R(T)}),footerBackgroundColor:"base.color.translucent.emphasis.200",children:f(E,{sx:Ie(t),children:f("iframe",{title:"Transak",id:xe,src:C,allow:"camera;microphone;fullscreen;payment",style:{height:"100%",width:"100%",border:"none",position:"absolute"}})})})})}function Ke(){const{eventTargetState:{eventTarget:e}}=s.useContext(h),{t:t}=c();return f(d,{testId:"order-in-progress-view",header:f(m,{transparent:!0,onCloseButtonClick:()=>R(e)}),footer:f(S,{}),heroContent:f(x,{}),floatHeader:!0,children:O(T,{heading:t("views.ONRAMP.IN_PROGRESS.content.heading"),children:[t("views.ONRAMP.IN_PROGRESS.content.body1"),f("br",{}),f("br",{}),t("views.ONRAMP.IN_PROGRESS.content.body2")]})})}function Fe({amount:e,tokenAddress:t,config:a}){const{isOnRampEnabled:r,isSwapEnabled:n,isBridgeEnabled:o}=a,[p,d]=s.useReducer(y,{..._,history:[]}),m=s.useMemo((()=>({viewState:p,viewDispatch:d})),[p,y]),{connectLoaderState:E}=s.useContext(i),{checkout:S,provider:T}=E,[x,U]=s.useState(t),{eventTargetState:{eventTarget:k}}=s.useContext(h),{t:K}=c(),F=s.useMemo((()=>p.view.type===D.ONRAMP),[p.view.type]);return s.useEffect((()=>{S&&T&&(async()=>{if(!(await S.getNetworkInfo({provider:T})).isSupported)return;const e=x?.toLocaleLowerCase()===I?I:t;U(e)})()}),[S,T,d]),O(u.Provider,{value:m,children:[p.view.type===l.LOADING_VIEW&&f(C,{loadingText:K("views.ONRAMP.initialLoadingText")}),p.view.type===D.IN_PROGRESS_LOADING&&f(C,{loadingText:K("views.ONRAMP.IN_PROGRESS_LOADING.loading.text")}),p.view.type===D.IN_PROGRESS&&f(Ke,{}),p.view.type===D.SUCCESS&&f(N,{statusText:K("views.ONRAMP.SUCCESS.text"),actionText:K("views.ONRAMP.SUCCESS.actionText"),onRenderEvent:()=>g(k,p.view.data.transactionHash),onActionClick:()=>R(k),statusType:w.SUCCESS,testId:"success-view"}),p.view.type===D.FAIL&&f(N,{statusText:K("views.ONRAMP.FAIL.text"),actionText:K("views.ONRAMP.FAIL.actionText"),onRenderEvent:()=>P(k,p.view.reason??"Transaction failed"),onActionClick:()=>{d({payload:{type:A.UPDATE_VIEW,view:{type:D.ONRAMP,data:p.view.data}}})},statusType:w.FAILURE,onCloseClick:()=>R(k),testId:"fail-view"}),p.view.type!==D.SUCCESS&&p.view.type!==D.FAIL&&f(ke,{passport:S?.passport,showIframe:F,tokenAmount:p.view.data?.amount??e,tokenAddress:p.view.data?.tokenAddress??x}),p.view.type===l.TOP_UP_VIEW&&f(L,{analytics:{userJourney:v.ON_RAMP},widgetEvent:b.IMTBL_ONRAMP_WIDGET_EVENT,checkout:S,provider:T,showOnrampOption:r,showSwapOption:n,showBridgeOption:o,onCloseButtonClick:()=>R(k)})]})}var je=Object.freeze({__proto__:null,default:Fe});export{Fe as O,je as a,Le as u};