@imtbl/sdk 1.5.3-alpha.3 → 1.5.3-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockchain_data.js +2 -2
- package/dist/browser/checkout/{BridgeWidget-2e0093b4.js → BridgeWidget-895c2ff8.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-444ebe2b.js → OnRampWidget-93e6c462.js} +1 -1
- package/dist/browser/checkout/{SaleWidget-5f6ea630.js → SaleWidget-af43a403.js} +1 -1
- package/dist/browser/checkout/{SpendingCapHero-a6ef1dcc.js → SpendingCapHero-03968ac0.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-aee793d7.js → SwapWidget-61e779d8.js} +1 -1
- package/dist/browser/checkout/{TopUpView-def404d5.js → TopUpView-09a61709.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-f87f80b4.js → WalletWidget-68b65814.js} +1 -1
- package/dist/browser/checkout/{auto-track-e03d4bb9.js → auto-track-7c8945e1.js} +1 -1
- package/dist/browser/checkout/{balance-c8477685.js → balance-5343fb20.js} +1 -1
- package/dist/browser/checkout/{index-43973ac4.js → index-2657c3d3.js} +1 -1
- package/dist/browser/checkout/index-2c059c42.js +1 -0
- package/dist/browser/checkout/{index-49582766.js → index-3ef57b96.js} +1 -1
- package/dist/browser/checkout/{index-ea3645ce.js → index-8130cf40.js} +3 -3
- package/dist/browser/checkout/{index-a8155f8b.js → index-a12ebc45.js} +1 -1
- package/dist/browser/checkout/{index-35beb3eb.js → index-d949d325.js} +1 -1
- package/dist/browser/checkout/{index-6984b667.js → index-f2726576.js} +1 -1
- package/dist/browser/checkout/{index.umd-9e885d58.js → index.umd-31af21e6.js} +1 -1
- package/dist/browser/checkout/{retry-fc920719.js → retry-07d04bc8.js} +1 -1
- package/dist/browser/checkout/sdk.js +4 -4
- package/dist/browser/checkout/{useTransakEvents-cffde72e.js → useTransakEvents-33875f8a.js} +1 -1
- package/dist/browser/checkout/widgets.js +1 -1
- package/dist/checkout.js +23 -34
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +25 -36
- package/dist/index.js +25 -36
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +3 -3
- package/dist/x.js +2 -2
- package/package.json +1 -1
- package/dist/browser/checkout/index-500dddb2.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a_ as e,a$ as t,b0 as r,b1 as n,b2 as a,a as o,r as s}from"./index-
|
|
1
|
+
import{a_ as e,a$ as t,b0 as r,b1 as n,b2 as a,a as o,r as s}from"./index-8130cf40.js";
|
|
2
2
|
/*! https://mths.be/punycode v1.4.1 by @mathias */var h=2147483647,c=36,i=1,l=26,u=38,p=700,f=72,m=128,d="-",v=/[^\x20-\x7E]/,R=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},A=c-i,g=Math.floor,y=String.fromCharCode;function O(e){throw new RangeError(E[e])}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function S(e,t,r){var n=0;for(e=r?g(e/p):e>>1,e+=g(e/t);e>A*l>>1;n+=c)e=g(e/A);return g(n+(A+1)*e/(e+u))}function I(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var a=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace(R,".")).split("."),t).join(".");return n+a}(e,(function(e){return v.test(e)?"xn--"+function(e){var t,r,n,a,o,s,u,p,v,R,E,A,I,b,C,_=[];for(e=function(e){for(var t,r,n=[],a=0,o=e.length;a<o;)(t=e.charCodeAt(a++))>=55296&&t<=56319&&a<o?56320==(64512&(r=e.charCodeAt(a++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),a--):n.push(t);return n}(e),A=e.length,t=m,r=0,o=f,s=0;s<A;++s)(E=e[s])<128&&_.push(y(E));for(n=a=_.length,a&&_.push(d);n<A;){for(u=h,s=0;s<A;++s)(E=e[s])>=t&&E<u&&(u=E);for(u-t>g((h-r)/(I=n+1))&&O("overflow"),r+=(u-t)*I,t=u,s=0;s<A;++s)if((E=e[s])<t&&++r>h&&O("overflow"),E==t){for(p=r,v=c;!(p<(R=v<=o?i:v>=o+l?l:v-o));v+=c)C=p-R,b=c-R,_.push(y(T(R+C%b,0))),p=g(C/b);_.push(y(T(p,0))),o=S(r,I,n==a),r=0,++n}++r,++t}return _.join("")}(e):e}))}function b(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var C=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function _(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function D(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var L=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function N(e,t,r,n){t=t||"&",r=r||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var h=e.length;s>0&&h>s&&(h=s);for(var c=0;c<h;++c){var i,l,u,p,f=e[c].replace(o,"%20"),m=f.indexOf(r);m>=0?(i=f.substr(0,m),l=f.substr(m+1)):(i=f,l=""),u=decodeURIComponent(i),p=decodeURIComponent(l),b(a,u)?C(a[u])?a[u].push(p):a[u]=[a[u],p]:a[u]=p}return a}var U={parse:B,resolve:function(e,t){return B(e,!1,!0).resolve(t)},resolveObject:function(e,t){return e?B(e,!1,!0).resolveObject(t):t},fileURLToPath:function(e){if("string"==typeof e)e=(new j).parse(e);else if(!(e instanceof j))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 r=32|t.codePointAt(e+2);if("2"===t[e+1]&&102===r)throw new TypeError("must not include encoded / characters")}return decodeURIComponent(t)}(e)},format:function(e){r(e)&&(e=Q({},e));return V(e)},Url:j,URL:e.URL,URLSearchParams:e.URLSearchParams};function j(){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 w,x,P=/^([a-z0-9.+-]+:)/i,K=/:[0-9]*$/,k=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,q=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),F=["'"].concat(q),G=["%","/","?",";","#"].concat(F),W=["/","?","#"],$=255,M=/^[+a-z0-9A-Z_-]{0,63}$/,z=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,J={javascript:!0,"javascript:":!0},Z={javascript:!0,"javascript:":!0},H={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function B(e,r,n){if(e&&t(e)&&e instanceof j)return e;var a=new j;return a.parse(e,r,n),a}function Q(e,t,n,a){if(!r(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var o=t.indexOf("?"),s=-1!==o&&o<t.indexOf("#")?"?":"#",h=t.split(s);h[0]=h[0].replace(/\\/g,"/");var c=t=h.join(s);if(c=c.trim(),!a&&1===t.split("#").length){var i=k.exec(c);if(i)return e.path=c,e.href=c,e.pathname=i[1],i[2]?(e.search=i[2],e.query=n?N(e.search.substr(1)):e.search.substr(1)):n&&(e.search="",e.query={}),e}var l,u,p,f,m=P.exec(c);if(m){var d=(m=m[0]).toLowerCase();e.protocol=d,c=c.substr(m.length)}if(a||m||c.match(/^\/\/[^@\/]+@[^@\/]+/)){var v="//"===c.substr(0,2);!v||m&&Z[m]||(c=c.substr(2),e.slashes=!0)}if(!Z[m]&&(v||m&&!H[m])){var R,E,A=-1;for(l=0;l<W.length;l++)-1!==(u=c.indexOf(W[l]))&&(-1===A||u<A)&&(A=u);for(-1!==(E=-1===A?c.lastIndexOf("@"):c.lastIndexOf("@",A))&&(R=c.slice(0,E),c=c.slice(E+1),e.auth=decodeURIComponent(R)),A=-1,l=0;l<G.length;l++)-1!==(u=c.indexOf(G[l]))&&(-1===A||u<A)&&(A=u);-1===A&&(A=c.length),e.host=c.slice(0,A),c=c.slice(A),X(e),e.hostname=e.hostname||"";var g="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!g){var y=e.hostname.split(/\./);for(l=0,p=y.length;l<p;l++){var O=y[l];if(O&&!O.match(M)){for(var T="",S=0,b=O.length;S<b;S++)O.charCodeAt(S)>127?T+="x":T+=O[S];if(!T.match(M)){var C=y.slice(0,l),_=y.slice(l+1),D=O.match(z);D&&(C.push(D[1]),_.unshift(D[2])),_.length&&(c="/"+_.join(".")+c),e.hostname=C.join(".");break}}}}e.hostname.length>$?e.hostname="":e.hostname=e.hostname.toLowerCase(),g||(e.hostname=I(e.hostname)),f=e.port?":"+e.port:"";var L=e.hostname||"";e.host=L+f,e.href+=e.host,g&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==c[0]&&(c="/"+c))}if(!J[d])for(l=0,p=F.length;l<p;l++){var U=F[l];if(-1!==c.indexOf(U)){var j=encodeURIComponent(U);j===U&&(j=escape(U)),c=c.split(U).join(j)}}var w=c.indexOf("#");-1!==w&&(e.hash=c.substr(w),c=c.slice(0,w));var x=c.indexOf("?");if(-1!==x?(e.search=c.substr(x),e.query=c.substr(x+1),n&&(e.query=N(e.query)),c=c.slice(0,x)):n&&(e.search="",e.query={}),c&&(e.pathname=c),H[d]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){f=e.pathname||"";var K=e.search||"";e.path=f+K}return e.href=V(e),e}function V(e){var r=e.auth||"";r&&(r=(r=encodeURIComponent(r)).replace(/%3A/i,":"),r+="@");var n,a,o,s,h=e.protocol||"",c=e.pathname||"",i=e.hash||"",l=!1,u="";e.host?l=r+e.host:e.hostname&&(l=r+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(l+=":"+e.port)),e.query&&t(e.query)&&Object.keys(e.query).length&&(n=e.query,a=a||"&",o=o||"=",null===n&&(n=void 0),u="object"==typeof n?D(L(n),(function(e){var t=encodeURIComponent(_(e))+o;return C(n[e])?D(n[e],(function(e){return t+encodeURIComponent(_(e))})).join(a):t+encodeURIComponent(_(n[e]))})).join(a):s?encodeURIComponent(_(s))+o+encodeURIComponent(_(n)):"");var p=e.search||u&&"?"+u||"";return h&&":"!==h.substr(-1)&&(h+=":"),e.slashes||(!h||H[h])&&!1!==l?(l="//"+(l||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):l||(l=""),i&&"#"!==i.charAt(0)&&(i="#"+i),p&&"?"!==p.charAt(0)&&(p="?"+p),h+l+(c=c.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(p=p.replace("#","%23"))+i}function X(e){var t=e.host,r=K.exec(t);r&&(":"!==(r=r[0])&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}j.prototype.parse=function(e,t,r){return Q(this,e,t,r)},j.prototype.format=function(){return V(this)},j.prototype.resolve=function(e){return this.resolveObject(B(e,!1,!0)).format()},j.prototype.resolveObject=function(e){if(r(e)){var t=new j;t.parse(e,!1,!0),e=t}for(var o,s=new j,h=Object.keys(this),c=0;c<h.length;c++){var i=h[c];s[i]=this[i]}if(s.hash=e.hash,""===e.href)return s.href=s.format(),s;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),u=0;u<l.length;u++){var p=l[u];"protocol"!==p&&(s[p]=e[p])}return H[s.protocol]&&s.hostname&&!s.pathname&&(s.path=s.pathname="/"),s.href=s.format(),s}if(e.protocol&&e.protocol!==s.protocol){if(!H[e.protocol]){for(var f=Object.keys(e),m=0;m<f.length;m++){var d=f[m];s[d]=e[d]}return s.href=s.format(),s}if(s.protocol=e.protocol,e.host||Z[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 v=s.pathname||"",R=s.search||"";s.path=v+R}return s.slashes=s.slashes||e.slashes,s.href=s.format(),s}var E,A=s.pathname&&"/"===s.pathname.charAt(0),g=e.host||e.pathname&&"/"===e.pathname.charAt(0),y=g||A||s.host&&e.pathname,O=y,T=s.pathname&&s.pathname.split("/")||[],S=s.protocol&&!H[s.protocol];if(o=e.pathname&&e.pathname.split("/")||[],S&&(s.hostname="",s.port=null,s.host&&(""===T[0]?T[0]=s.host:T.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),y=y&&(""===o[0]||""===T[0])),g)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,T=o;else if(o.length)T||(T=[]),T.pop(),T=T.concat(o),s.search=e.search,s.query=e.query;else if(!n(e.search))return S&&(s.hostname=s.host=T.shift(),(E=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=E.shift(),s.host=s.hostname=E.shift())),s.search=e.search,s.query=e.query,a(s.pathname)&&a(s.search)||(s.path=(s.pathname?s.pathname:"")+(s.search?s.search:"")),s.href=s.format(),s;if(!T.length)return s.pathname=null,s.search?s.path="/"+s.search:s.path=null,s.href=s.format(),s;for(var I=T.slice(-1)[0],b=(s.host||e.host||T.length>1)&&("."===I||".."===I)||""===I,C=0,_=T.length;_>=0;_--)"."===(I=T[_])?T.splice(_,1):".."===I?(T.splice(_,1),C++):C&&(T.splice(_,1),C--);if(!y&&!O)for(;C--;C)T.unshift("..");!y||""===T[0]||T[0]&&"/"===T[0].charAt(0)||T.unshift(""),b&&"/"!==T.join("/").substr(-1)&&T.push("");var D=""===T[0]||T[0]&&"/"===T[0].charAt(0);return S&&(s.hostname=s.host=D?"":T.length?T.shift():"",(E=!!(s.host&&s.host.indexOf("@")>0)&&s.host.split("@"))&&(s.auth=E.shift(),s.host=s.hostname=E.shift())),(y=y||s.host&&T.length)&&!D&&T.unshift(""),T.length?s.pathname=T.join("/"):(s.pathname=null,s.path=null),a(s.pathname)&&a(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},j.prototype.parseHost=function(){return X(this)},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"}(w||(w={})),function(e){e.PROCESSING="PROCESSING",e.COMPLETED="COMPLETED"}(x||(x={}));const Y=["global.transak.com","global-stg.transak.com"],ee={[w.TRANSAK_WIDGET_OPEN]:{screen:"InputScreen",control:"TransakWidgetOpen",controlType:"IframeEvent"},[w.TRANSAK_ORDER_CREATED]:{screen:"InputScreen",control:"OrderCreated",controlType:"IframeEvent"},[`${w.TRANSAK_ORDER_SUCCESSFUL}${x.PROCESSING}`]:{screen:"OrderInProgress",control:"PaymentProcessing",controlType:"IframeEvent"},[`${w.TRANSAK_ORDER_SUCCESSFUL}${x.COMPLETED}`]:{screen:"Success",control:"PaymentCompleted",controlType:"IframeEvent"},[w.TRANSAK_ORDER_FAILED]:{screen:"Failure",control:"PaymentFailed",controlType:"IframeEvent"}},te=e=>{const{track:t}=o(),{userJourney:r,ref:n,email:a,userId:h,isPassportWallet:c,failedToLoadTimeoutInMs:i,onFailedToLoad:l}=e,[u,p]=s.useState(!1),f=i||1e4,m=s.useRef(void 0),d=s.useCallback((e=>{const n=e.event_id,o=[w.TRANSAK_ORDER_SUCCESSFUL].includes(n)?`${n}${e.data.status}`:n,s=ee?.[o]||{};Object.keys(s).length>=0&&t({...s,userJourney:r,extras:{email:a,userId:h,isPassportWallet:c}})}),[]),v=s.useCallback((t=>{switch(t.event_id){case w.TRANSAK_WIDGET_INITIALISED:r=t.data,p(!0),clearTimeout(m.current),m.current=void 0,e.onInit?.(r);break;case w.TRANSAK_WIDGET_OPEN:e.onOpen?.(t.data);break;case w.TRANSAK_ORDER_CREATED:e.onOrderCreated?.(t.data);break;case w.TRANSAK_ORDER_SUCCESSFUL:t.data.status===x.PROCESSING&&e.onOrderProcessing?.(t.data),t.data.status===x.COMPLETED&&e.onOrderCompleted?.(t.data);break;case w.TRANSAK_ORDER_FAILED:e.onOrderFailed?.(t.data)}var r}),[]),R=s.useCallback((e=>{const t=B(e.origin)?.host?.toLowerCase();e.source===n?.current?.contentWindow&&t&&Y.includes(t)&&(d(e.data),v(e.data),console.log("@@@ Transak event",e))}),[n]);return s.useEffect((()=>(window.addEventListener("message",R),()=>{clearTimeout(m.current),window.removeEventListener("message",R)})),[]),{initialised:u,onLoad:()=>{void 0!==l&&(void 0!==m.current||u||(m.current=setTimeout((()=>{u||l()}),f)))}}};export{Y as T,te as a,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b$ as WidgetsFactory}from"./index-
|
|
1
|
+
export{b$ as WidgetsFactory}from"./index-8130cf40.js";
|
package/dist/checkout.js
CHANGED
|
@@ -139,7 +139,7 @@ const flattenProperties$1 = (properties) => {
|
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
142
|
-
const SDK_VERSION$1 = '1.5.3-alpha.
|
|
142
|
+
const SDK_VERSION$1 = '1.5.3-alpha.4';
|
|
143
143
|
const getReferrer$1 = () => {
|
|
144
144
|
if (isNode$1()) {
|
|
145
145
|
return '';
|
|
@@ -17478,7 +17478,7 @@ const flattenProperties = (properties) => {
|
|
|
17478
17478
|
};
|
|
17479
17479
|
|
|
17480
17480
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
17481
|
-
const SDK_VERSION = '1.5.3-alpha.
|
|
17481
|
+
const SDK_VERSION = '1.5.3-alpha.4';
|
|
17482
17482
|
const getReferrer = () => {
|
|
17483
17483
|
if (isNode()) {
|
|
17484
17484
|
return '';
|
|
@@ -27715,7 +27715,7 @@ class APIError extends Error {
|
|
|
27715
27715
|
|
|
27716
27716
|
/* eslint-disable implicit-arrow-linebreak */
|
|
27717
27717
|
const defaultHeaders = {
|
|
27718
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.3-alpha.
|
|
27718
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.5.3-alpha.4',
|
|
27719
27719
|
};
|
|
27720
27720
|
/**
|
|
27721
27721
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -29082,7 +29082,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
29082
29082
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
29083
29083
|
};
|
|
29084
29084
|
|
|
29085
|
-
const SDK_VERSION_MARKER = '1.5.3-alpha.
|
|
29085
|
+
const SDK_VERSION_MARKER = '1.5.3-alpha.4';
|
|
29086
29086
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
29087
29087
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
29088
29088
|
|
|
@@ -32704,21 +32704,21 @@ function loadUnresolved(version) {
|
|
|
32704
32704
|
if (document === undefined) {
|
|
32705
32705
|
throw new Error('missing document object: please run Checkout client side');
|
|
32706
32706
|
}
|
|
32707
|
-
const scriptId = 'immutable-checkout-widgets-bundle';
|
|
32707
|
+
// const scriptId = 'immutable-checkout-widgets-bundle';
|
|
32708
32708
|
const validVersion = validateAndBuildVersion(version);
|
|
32709
32709
|
// Prevent the script to be loaded more than once
|
|
32710
32710
|
// by checking the presence of the script and its version.
|
|
32711
|
-
const initScript = document.getElementById(scriptId);
|
|
32712
|
-
if (initScript)
|
|
32713
|
-
|
|
32714
|
-
const
|
|
32715
|
-
|
|
32716
|
-
tag.setAttribute('id', scriptId);
|
|
32717
|
-
tag.setAttribute('data-version', validVersion);
|
|
32718
|
-
tag.setAttribute('type', 'module');
|
|
32719
|
-
tag.setAttribute('src', cdnUrl);
|
|
32720
|
-
document.head.appendChild(tag);
|
|
32721
|
-
return { loaded: false,
|
|
32711
|
+
// const initScript = document.getElementById(scriptId) as HTMLScriptElement;
|
|
32712
|
+
// if (initScript) return { loaded: true, element: initScript };
|
|
32713
|
+
// const tag = document.createElement('script');
|
|
32714
|
+
const cdnUrl = `https://cdn.jsdelivr.net/npm/@imtbl/sdk@${validVersion}/dist/browser/checkout/widgets.js`;
|
|
32715
|
+
// if (useLocalBundle()) cdnUrl = `http://${window.location.host}/lib/js/widgets.js`;
|
|
32716
|
+
// tag.setAttribute('id', scriptId);
|
|
32717
|
+
// tag.setAttribute('data-version', validVersion);
|
|
32718
|
+
// tag.setAttribute('type', 'module');
|
|
32719
|
+
// tag.setAttribute('src', cdnUrl);
|
|
32720
|
+
// document.head.appendChild(tag);
|
|
32721
|
+
return { loaded: false, cdnUrl };
|
|
32722
32722
|
}
|
|
32723
32723
|
|
|
32724
32724
|
const PUBLISHABLE_KEY_PREFIX = 'pk_imapik-';
|
|
@@ -32797,7 +32797,6 @@ const SANDBOX_CONFIGURATION = {
|
|
|
32797
32797
|
},
|
|
32798
32798
|
passport: undefined,
|
|
32799
32799
|
};
|
|
32800
|
-
const WIDGETS_SCRIPT_TIMEOUT = 100;
|
|
32801
32800
|
// Checkout SDK
|
|
32802
32801
|
class Checkout {
|
|
32803
32802
|
readOnlyProviders;
|
|
@@ -32827,29 +32826,19 @@ class Checkout {
|
|
|
32827
32826
|
const checkout = this;
|
|
32828
32827
|
// Preload the configurations
|
|
32829
32828
|
await checkout.config.remote.getConfig();
|
|
32829
|
+
const load = loadUnresolved(init.version);
|
|
32830
|
+
const checkoutWidgetsModule = await import(load.cdnUrl);
|
|
32830
32831
|
const factory = new Promise((resolve, reject) => {
|
|
32831
|
-
function checkForWidgetsBundleLoaded() {
|
|
32832
|
-
if (typeof ImmutableCheckoutWidgets !== 'undefined') {
|
|
32833
|
-
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
|
|
32834
|
-
}
|
|
32835
|
-
else {
|
|
32836
|
-
// If ImmutableCheckoutWidgets is not defined, wait for set amount of time.
|
|
32837
|
-
// When time has elapsed, check again if ImmutableCheckoutWidgets is defined.
|
|
32838
|
-
// Once it's defined, the promise will resolve and setTimeout won't be called again.
|
|
32839
|
-
setTimeout(checkForWidgetsBundleLoaded, WIDGETS_SCRIPT_TIMEOUT);
|
|
32840
|
-
}
|
|
32841
|
-
}
|
|
32842
32832
|
try {
|
|
32843
|
-
|
|
32844
|
-
|
|
32845
|
-
resolve(new ImmutableCheckoutWidgets.WidgetsFactory(checkout, init.config));
|
|
32833
|
+
if (checkoutWidgetsModule && checkoutWidgetsModule.WidgetsFactory) {
|
|
32834
|
+
resolve(new checkoutWidgetsModule.WidgetsFactory(checkout, init.config));
|
|
32846
32835
|
}
|
|
32847
32836
|
else {
|
|
32848
|
-
|
|
32837
|
+
throw new Error('WidgetsFactory is not found in the imported module.');
|
|
32849
32838
|
}
|
|
32850
32839
|
}
|
|
32851
|
-
catch (
|
|
32852
|
-
reject(
|
|
32840
|
+
catch (error) {
|
|
32841
|
+
reject(error);
|
|
32853
32842
|
}
|
|
32854
32843
|
});
|
|
32855
32844
|
return factory;
|
package/dist/config.js
CHANGED
|
@@ -128,7 +128,7 @@ const flattenProperties = (properties) => {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
|
|
131
|
-
const SDK_VERSION = '1.5.3-alpha.
|
|
131
|
+
const SDK_VERSION = '1.5.3-alpha.4';
|
|
132
132
|
const getReferrer = () => {
|
|
133
133
|
if (isNode()) {
|
|
134
134
|
return '';
|