idpay-b2b-sdk 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/.version.d.ts +1 -1
- package/index.esm.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
package/assets/.version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.1.
|
|
1
|
+
declare const _default: "2.1.2";
|
|
2
2
|
export default _default;
|
package/index.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n="2.1.1";let e,t,o,i,s=!1,c=!1;const a="IFRAME",r="REDIRECT",l="SILENT",d="dev",u="uat",p="prod",h={[d]:"https://idpay-dev.unico.io",[u]:"https://idpay-uat.unico.io",[p]:"https://idpay.unico.io"},k=()=>{console.log(">>> reset"),e=void 0,t=void 0,s=!1,c=!1,o=void 0},S=async d=>{let{token:u,useCurrentOrigin:k,env:S=p,type:I=a}=d;switch(e=I,t=k?window.location.origin:h[S],await(()=>{if(i)return Promise.resolve();i=document.createElement("script"),i.src=`${t}/sdk-assets/index.js`;const n=new Promise((n=>{i.onload=n}));return document.body.appendChild(i),Promise.all([n])})(),UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),e){case l:o=await UnicoSDKAssets.clientBoxControl.initSilent();break;case r:break;default:await(()=>{const n=document.createElement("link");n.setAttribute("href",`${t}/sdk-assets/assets/styles.css`),n.setAttribute("rel","stylesheet");const e=new Promise((e=>{n.onload=e}));return document.head.appendChild(n),Promise.all([e])})(),UnicoSDKAssets.clientBoxControl.create({host:t,token:u,sdkVersion:n})}if(s=!0,c&&y(c),o)return o},I=i=>{let{transactionId:a,token:d,onFinish:u}=i;const p={transactionId:a,token:d,onFinish:u,host:t,sdkVersion:n,collectionId:o};if(console.log("open",p),s)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,p),e){case l:UnicoSDKAssets.clientBoxControl.verify(p);break;case r:UnicoSDKAssets.clientBoxControl.redirect(a,d,t,n);break;default:UnicoSDKAssets.clientBoxControl.open(p)}else c=p},y=n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:o})},D=()=>{k(),UnicoSDKAssets.clientBoxControl.close()},A={init:async n=>(console.log(">>> initByUnicoSDK > options:",n),S({...n})),close:D,open:n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:n=>{k(),o?.(n)}})}},E={init:async n=>(console.log(">>> initIDPaySDK > options:",n),S({...n,token:null})),close:D,open:n=>{let{transactionId:e,token:t,onFinish:o}=n;I({transactionId:e,token:t,onFinish:o})}},m={init:async n=>(console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),S(n)),close:D,open:y};export{A as ByUnicoSDK,E as IDPaySDK,m as UnicoSDK};
|
|
1
|
+
function t(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,u,"next",e)}function u(e){t(a,o,i,c,u,"throw",e)}c(void 0)}))}}function r(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function n(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?n(Object(o),!0).forEach((function(e){r(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(){i=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new _(n||[]);return o(a,"_invoke",{value:S(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",y="executing",d="completed",g={};function m(){}function w(){}function b(){}var x={};l(x,c,(function(){return this}));var E=Object.getPrototypeOf,k=E&&E(E(A([])));k&&k!==r&&n.call(k,c)&&(x=k);var O=b.prototype=m.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function P(t,e){function r(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function S(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,o(O,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},L(P.prototype),l(P.prototype,u,(function(){return this})),e.AsyncIterator=P,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new P(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}var a,c,u,s,l="2.1.2",f=!1,h=!1,p="REDIRECT",v="SILENT",y="prod",d=r(r(r({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),y,"https://idpay.unico.io"),g=function(){console.log(">>> reset"),a=void 0,c=void 0,f=!1,h=!1,u=void 0},m=function(){if(s)return Promise.resolve();(s=document.createElement("script")).src="".concat(c,"/sdk-assets/index.js");var t=new Promise((function(t){s.onload=t}));return document.body.appendChild(s),Promise.all([t])},w=function(){var t=document.createElement("link");t.setAttribute("href","".concat(c,"/sdk-assets/assets/styles.css")),t.setAttribute("rel","stylesheet");var e=new Promise((function(e){t.onload=e}));return document.head.appendChild(t),Promise.all([e])},b=function(){var t=e(i().mark((function t(e){var r,n,o,s,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.useCurrentOrigin,o=e.env,s=void 0===o?y:o,g=e.type,a=void 0===g?"IFRAME":g,c=n?window.location.origin:d[s],t.next=5,m();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=a,t.next=t.t0===v?9:t.t0===p?13:14;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return u=t.sent,t.abrupt("break",17);case 13:return t.abrupt("break",17);case 14:return t.next=16,w();case 16:UnicoSDKAssets.clientBoxControl.create({host:c,token:r,sdkVersion:l});case 17:if(f=!0,h&&k(h),!u){t.next=21;break}return t.abrupt("return",u);case 21:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),x=function(){var t=e(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",b(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),E=function(t){var e=t.transactionId,r=t.token,n={transactionId:e,token:r,onFinish:t.onFinish,host:c,sdkVersion:l,collectionId:u};if(console.log("open",n),f)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,n),a){case v:UnicoSDKAssets.clientBoxControl.verify(n);break;case p:UnicoSDKAssets.clientBoxControl.redirect(e,r,c,l);break;default:UnicoSDKAssets.clientBoxControl.open(n)}else h=n},k=function(t){var e=t.transactionId,r=t.token,n=t.onFinish;E({transactionId:e,token:r,onFinish:n})},O=function(){g(),UnicoSDKAssets.clientBoxControl.close()},L={init:function(){var t=e(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initByUnicoSDK > options:",e),t.abrupt("return",b(o({},e)));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:O,open:function(t){var e=t.transactionId,r=t.token,n=t.onFinish;E({transactionId:e,token:r,onFinish:function(t){g(),null==n||n(t)}})}},P={init:function(){var t=e(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initIDPaySDK > options:",e),t.abrupt("return",b(o(o({},e),{},{token:null})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:O,open:function(t){var e=t.transactionId,r=t.token,n=t.onFinish;E({transactionId:e,token:r,onFinish:n})}},S={init:x,close:O,open:k};export{L as ByUnicoSDK,P as IDPaySDK,S as UnicoSDK};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).UnicoSDK={})}(this,(function(e){"use strict";var n="2.1.1";let o,t,i,s,c=!1,a=!1;const r="IFRAME",l="REDIRECT",d="SILENT",u="dev",p="uat",h="prod",S={[u]:"https://idpay-dev.unico.io",[p]:"https://idpay-uat.unico.io",[h]:"https://idpay.unico.io"},f=()=>{console.log(">>> reset"),o=void 0,t=void 0,c=!1,a=!1,i=void 0},y=async e=>{let{token:u,useCurrentOrigin:p,env:f=h,type:y=r}=e;switch(o=y,t=p?window.location.origin:S[f],await(()=>{if(s)return Promise.resolve();s=document.createElement("script"),s.src=`${t}/sdk-assets/index.js`;const e=new Promise((e=>{s.onload=e}));return document.body.appendChild(s),Promise.all([e])})(),UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),o){case d:i=await UnicoSDKAssets.clientBoxControl.initSilent();break;case l:break;default:await(()=>{const e=document.createElement("link");e.setAttribute("href",`${t}/sdk-assets/assets/styles.css`),e.setAttribute("rel","stylesheet");const n=new Promise((n=>{e.onload=n}));return document.head.appendChild(e),Promise.all([n])})(),UnicoSDKAssets.clientBoxControl.create({host:t,token:u,sdkVersion:n})}if(c=!0,a&&D(a),i)return i},k=e=>{let{transactionId:s,token:r,onFinish:u}=e;const p={transactionId:s,token:r,onFinish:u,host:t,sdkVersion:n,collectionId:i};if(console.log("open",p),c)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,p),o){case d:UnicoSDKAssets.clientBoxControl.verify(p);break;case l:UnicoSDKAssets.clientBoxControl.redirect(s,r,t,n);break;default:UnicoSDKAssets.clientBoxControl.open(p)}else a=p},D=e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:t})},I=()=>{f(),UnicoSDKAssets.clientBoxControl.close()},K={init:async e=>(console.log(">>> initByUnicoSDK > options:",e),y({...e})),close:I,open:e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:e=>{f(),t?.(e)}})}},m={init:async e=>(console.log(">>> initIDPaySDK > options:",e),y({...e,token:null})),close:I,open:e=>{let{transactionId:n,token:o,onFinish:t}=e;k({transactionId:n,token:o,onFinish:t})}},A={init:async e=>(console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),y(e)),close:I,open:D};e.ByUnicoSDK=K,e.IDPaySDK=m,e.UnicoSDK=A}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).UnicoSDK={})}(this,(function(t){"use strict";function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new T(n||[]);return o(a,"_invoke",{value:P(t,r,c)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function m(){}function b(){}function w(){}var x={};l(x,c,(function(){return this}));var E=Object.getPrototypeOf,k=E&&E(E(K([])));k&&k!==r&&n.call(k,c)&&(x=k);var O=w.prototype=m.prototype=Object.create(x);function S(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function L(t,e){function r(o,i,a,c){var u=h(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function P(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(e,r,n);if("normal"===s.type){if(o=n.done?v:d,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function K(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,o(O,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=l(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},e.awrap=function(t){return{__await:t}},S(L.prototype),l(L.prototype,u,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(O),l(O,s,"Generator"),l(O,c,(function(){return this})),l(O,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=K,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:K(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}var c,u,s,l,f="2.1.2",h=!1,p=!1,d="REDIRECT",y="SILENT",v="prod",g=n(n(n({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),v,"https://idpay.unico.io"),m=function(){console.log(">>> reset"),c=void 0,u=void 0,h=!1,p=!1,s=void 0},b=function(){if(l)return Promise.resolve();(l=document.createElement("script")).src="".concat(u,"/sdk-assets/index.js");var t=new Promise((function(t){l.onload=t}));return document.body.appendChild(l),Promise.all([t])},w=function(){var t=document.createElement("link");t.setAttribute("href","".concat(u,"/sdk-assets/assets/styles.css")),t.setAttribute("rel","stylesheet");var e=new Promise((function(e){t.onload=e}));return document.head.appendChild(t),Promise.all([e])},x=function(){var t=r(a().mark((function t(e){var r,n,o,i,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.token,n=e.useCurrentOrigin,o=e.env,i=void 0===o?v:o,l=e.type,c=void 0===l?"IFRAME":l,u=n?window.location.origin:g[i],t.next=5,b();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=c,t.next=t.t0===y?9:t.t0===d?13:14;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return s=t.sent,t.abrupt("break",17);case 13:return t.abrupt("break",17);case 14:return t.next=16,w();case 16:UnicoSDKAssets.clientBoxControl.create({host:u,token:r,sdkVersion:f});case 17:if(h=!0,p&&L(p),!s){t.next=21;break}return t.abrupt("return",s);case 21:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),E=function(){var t=r(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.warn("Warning: The `init()` function is deprecated and will be removed in future versions. Please initialize directly on the product object, e.g., `IDPaySDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",x(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=r(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initByUnicoSDK > options:",e),t.abrupt("return",x(i({},e)));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),O=function(){var t=r(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initIDPaySDK > options:",e),t.abrupt("return",x(i(i({},e),{},{token:null})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=function(t){var e=t.transactionId,r=t.token,n={transactionId:e,token:r,onFinish:t.onFinish,host:u,sdkVersion:f,collectionId:s};if(console.log("open",n),h)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,n),c){case y:UnicoSDKAssets.clientBoxControl.verify(n);break;case d:UnicoSDKAssets.clientBoxControl.redirect(e,r,u,f);break;default:UnicoSDKAssets.clientBoxControl.open(n)}else p=n},L=function(t){var e=t.transactionId,r=t.token,n=t.onFinish;S({transactionId:e,token:r,onFinish:n})},P=function(){m(),UnicoSDKAssets.clientBoxControl.close()},j={init:k,close:P,open:function(t){var e=t.transactionId,r=t.token,n=t.onFinish;S({transactionId:e,token:r,onFinish:function(t){m(),null==n||n(t)}})}},D={init:O,close:P,open:function(t){var e=t.transactionId,r=t.token,n=t.onFinish;S({transactionId:e,token:r,onFinish:n})}},I={init:E,close:P,open:L};t.ByUnicoSDK=j,t.IDPaySDK=D,t.UnicoSDK=I}));
|