idpay-b2b-sdk 2.1.3 → 2.1.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.
@@ -1,2 +1,2 @@
1
- declare const _default: "2.1.3";
1
+ declare const _default: "2.1.4";
2
2
  export default _default;
package/index.esm.js CHANGED
@@ -1 +1 @@
1
- function t(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function e(e){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=e.apply(n,r);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 n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(Object(o),!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(){i=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new _(r||[]);return o(a,"_invoke",{value:D(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",d="executing",y="completed",g={};function m(){}function w(){}function b(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,P=x&&x(x(T([])));P&&P!==n&&r.call(P,c)&&(E=P);var O=b.prototype=m.prototype=Object.create(E);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(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&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function D(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=I(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?y:v,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function I(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function T(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};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}},k(S.prototype),l(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new S(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(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),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=T,_.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(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=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 n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.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=r.call(a,"catchLoc"),s=r.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 n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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 n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}var a,c,u,s,l="2.1.3",f=!1,h=!1,p="REDIRECT",v="SILENT",d="prod",y="idpay",g="idcash",m="byunico",w=n(n(n({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),d,"https://idpay.unico.io"),b={DEVICE_SUPPORTED:"DEVICE_SUPPORTED",DEVICE_NOT_SUPPORT:"DEVICE_NOT_SUPPORT"},E=function(){console.log(">>> reset"),a=void 0,c=void 0,f=!1,h=!1,u=void 0,s=void 0},x=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])},P=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])},O=function(){var t=e(i().mark((function t(e){var n,r,o,s,y,g,m,E,O,k,S;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.token,s=e.useCurrentOrigin,y=e.env,g=void 0===y?d:y,m=e.type,E=void 0===m?"IFRAME":m,O=e.app,a=E,c=s?window.location.origin:w[g],t.next=5,x();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=a,t.next=t.t0===v?9:t.t0===p?14:15;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return u=t.sent,k={collectionId:u},t.abrupt("break",20);case 14:return t.abrupt("break",20);case 15:return t.next=17,P();case 17:return t.next=19,UnicoSDKAssets.clientBoxControl.create({host:c,token:o,sdkVersion:l,app:O,env:g});case 19:k=t.sent;case 20:if(f=!0,S=!(null!==(n=k)&&void 0!==n&&n.statusPreValidation)||(null===(r=k)||void 0===r?void 0:r.statusPreValidation)===b.DEVICE_SUPPORTED,h&&S&&D(h),!k){t.next=25;break}return t.abrupt("return",k);case 25:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=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({ ... })`, `IDCashSDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",O(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=function(t){var e=t.transactionId,n=t.token,r={transactionId:e,token:n,onFinish:t.onFinish,host:c,sdkVersion:l,collectionId:u};if(console.log("open",r),f)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,r),a){case v:UnicoSDKAssets.clientBoxControl.verify(r);break;case p:UnicoSDKAssets.clientBoxControl.redirect(e,n,c,l);break;default:UnicoSDKAssets.clientBoxControl.open(r)}else h=r},D=function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})},I=function(){E(),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",O(o(o({},e),{},{app:m})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:function(t){E(),null==r||r(t)}})}},j={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",O(o(o({},e),{},{app:y})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})}},_={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(">>> initIDCashSDK > options:",e),t.next=3,O(o(o({},e),{},{app:g}));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.invoiceId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})}},T={init:k,close:I,open:D};export{L as ByUnicoSDK,_ as IDCashSDK,j as IDPaySDK,b as PRE_VALIDATION_STATUS,T as UnicoSDK};
1
+ function t(t,e,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function e(e){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=e.apply(n,r);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 n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?r(Object(o),!0).forEach((function(e){n(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):r(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(){i=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new _(r||[]);return o(a,"_invoke",{value:D(t,n,c)}),a}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",v="suspendedYield",d="executing",y="completed",g={};function m(){}function w(){}function b(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,P=x&&x(x(T([])));P&&P!==n&&r.call(P,c)&&(E=P);var O=b.prototype=m.prototype=Object.create(E);function k(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function n(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&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function D(e,n,r){var o=p;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=I(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===p)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=d;var s=h(e,n,r);if("normal"===s.type){if(o=r.done?y:v,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function I(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function T(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};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}},k(S.prototype),l(S.prototype,u,(function(){return this})),e.AsyncIterator=S,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new S(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(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),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=T,_.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(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=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 n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.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=r.call(a,"catchLoc"),s=r.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 n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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 n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:T(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}var a,c,u,s,l="2.1.4",f=!1,h=!1,p="REDIRECT",v="SILENT",d="prod",y="idpay",g="idcash",m="byunico",w=n(n(n({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),d,"https://idpay.unico.io"),b={DEVICE_SUPPORTED:"DEVICE_SUPPORTED",DEVICE_NOT_SUPPORT:"DEVICE_NOT_SUPPORT"},E=function(){console.log(">>> reset"),a=void 0,c=void 0,f=!1,h=!1,u=void 0,s=void 0},x=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])},P=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])},O=function(){var t=e(i().mark((function t(e){var n,r,o,s,y,g,m,E,O,k,S;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.token,s=e.useCurrentOrigin,y=e.env,g=void 0===y?d:y,m=e.type,E=void 0===m?"IFRAME":m,O=e.app,a=E,c=s?window.location.origin:w[g],t.next=5,x();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=a,t.next=t.t0===v?9:t.t0===p?14:15;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return u=t.sent,k={collectionId:u},t.abrupt("break",20);case 14:return t.abrupt("break",20);case 15:return t.next=17,P();case 17:return t.next=19,UnicoSDKAssets.clientBoxControl.create({host:c,token:o,sdkVersion:l,app:O,env:g});case 19:k=t.sent;case 20:if(f=!0,S=!(null!==(n=k)&&void 0!==n&&n.statusPreValidation)||(null===(r=k)||void 0===r?void 0:r.statusPreValidation)===b.DEVICE_SUPPORTED,h&&S&&D(h),!k){t.next=25;break}return t.abrupt("return",k);case 25:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=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({ ... })`, `IDCashSDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",O(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),S=function(t){var e=t.transactionId,n=t.token,r={transactionId:e,token:n,onFinish:t.onFinish,host:c,sdkVersion:l,collectionId:u};if(console.log("open",r),f)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,r),a){case v:UnicoSDKAssets.clientBoxControl.verify(r);break;case p:UnicoSDKAssets.clientBoxControl.redirect(e,n,c,l);break;default:UnicoSDKAssets.clientBoxControl.open(r)}else h=r},D=function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})},I=function(){E(),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",O(o(o({},e),{},{app:m})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:function(t){E(),null==r||r(t)}})}},j={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",O(o(o({},e),{},{app:y})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})}},_={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(">>> initIDCashSDK > options:",e),t.next=3,O(o(o({},e),{},{app:g}));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),close:I,open:function(t){var e=t.invoiceId,n=t.token,r=t.onFinish;S({transactionId:e,token:n,onFinish:r})}},T={init:k,close:I,open:D};export{L as ByUnicoSDK,_ as IDCashSDK,j as IDPaySDK,b as PRE_VALIDATION_STATUS,T as UnicoSDK};
package/index.js CHANGED
@@ -1 +1 @@
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,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);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 r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(){a=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new T(r||[]);return o(a,"_invoke",{value:k(t,n,c)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",v="executing",y="completed",g={};function m(){}function b(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,P=x&&x(x(_([])));P&&P!==n&&r.call(P,c)&&(E=P);var S=w.prototype=m.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function n(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function k(e,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=I(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var s=p(e,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function I(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function _(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,o(S,"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(S),t},e.awrap=function(t){return{__await:t}},O(D.prototype),l(D.prototype,u,(function(){return this})),e.AsyncIterator=D,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new D(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),l(S,s,"Generator"),l(S,c,(function(){return this})),l(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=_,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(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=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 n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.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=r.call(a,"catchLoc"),s=r.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 n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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 n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:_(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}var c,u,s,l,f="2.1.3",p=!1,h=!1,d="REDIRECT",v="SILENT",y="prod",g="idpay",m="idcash",b="byunico",w=r(r(r({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),y,"https://idpay.unico.io"),E={DEVICE_SUPPORTED:"DEVICE_SUPPORTED",DEVICE_NOT_SUPPORT:"DEVICE_NOT_SUPPORT"},x=function(){console.log(">>> reset"),c=void 0,u=void 0,p=!1,h=!1,s=void 0,l=void 0},P=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])},S=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])},O=function(){var t=n(a().mark((function t(e){var n,r,o,i,l,g,m,b,x,O,D;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.token,i=e.useCurrentOrigin,l=e.env,g=void 0===l?y:l,m=e.type,b=void 0===m?"IFRAME":m,x=e.app,c=b,u=i?window.location.origin:w[g],t.next=5,P();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=c,t.next=t.t0===v?9:t.t0===d?14:15;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return s=t.sent,O={collectionId:s},t.abrupt("break",20);case 14:return t.abrupt("break",20);case 15:return t.next=17,S();case 17:return t.next=19,UnicoSDKAssets.clientBoxControl.create({host:u,token:o,sdkVersion:f,app:x,env:g});case 19:O=t.sent;case 20:if(p=!0,D=!(null!==(n=O)&&void 0!==n&&n.statusPreValidation)||(null===(r=O)||void 0===r?void 0:r.statusPreValidation)===E.DEVICE_SUPPORTED,h&&D&&T(h),!O){t.next=25;break}return t.abrupt("return",O);case 25:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),D=function(){var t=n(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({ ... })`, `IDCashSDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",O(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=n(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",O(i(i({},e),{},{app:b})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),I=function(){var t=n(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",O(i(i({},e),{},{app:g})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),L=function(){var t=n(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initIDCashSDK > options:",e),t.next=3,O(i(i({},e),{},{app:m}));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),j=function(t){var e=t.transactionId,n=t.token,r={transactionId:e,token:n,onFinish:t.onFinish,host:u,sdkVersion:f,collectionId:s};if(console.log("open",r),p)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,r),c){case v:UnicoSDKAssets.clientBoxControl.verify(r);break;case d:UnicoSDKAssets.clientBoxControl.redirect(e,n,u,f);break;default:UnicoSDKAssets.clientBoxControl.open(r)}else h=r},T=function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})},_=function(){x(),UnicoSDKAssets.clientBoxControl.close()},K={init:k,close:_,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:function(t){x(),null==r||r(t)}})}},U={init:I,close:_,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})}},A={init:L,close:_,open:function(t){var e=t.invoiceId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})}},C={init:D,close:_,open:T};t.ByUnicoSDK=K,t.IDCashSDK=A,t.IDPaySDK=U,t.PRE_VALIDATION_STATUS=E,t.UnicoSDK=C}));
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,n,r,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void n(t)}c.done?e(u):Promise.resolve(u).then(r,o)}function n(t){return function(){var n=this,r=arguments;return new Promise((function(o,i){var a=t.apply(n,r);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 r(t,e,n){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e);if("object"!=typeof r)return r;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:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(){a=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(t,e,n){t[e]=n.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function f(t,e,n,r){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new T(r||[]);return o(a,"_invoke",{value:k(t,n,c)}),a}function p(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",d="suspendedYield",v="executing",y="completed",g={};function m(){}function b(){}function w(){}var E={};l(E,c,(function(){return this}));var x=Object.getPrototypeOf,P=x&&x(x(_([])));P&&P!==n&&r.call(P,c)&&(E=P);var S=w.prototype=m.prototype=Object.create(E);function O(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function D(t,e){function n(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,r){function o(){return new e((function(e,o){n(t,r,e,o)}))}return i=i?i.then(o,o):o()}})}function k(e,n,r){var o=h;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(r.method=i,r.arg=a;;){var c=r.delegate;if(c){var u=I(c,r);if(u){if(u===g)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===h)throw o=y,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=v;var s=p(e,n,r);if("normal"===s.type){if(o=r.done?y:d,s.arg===g)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(o=y,r.method="throw",r.arg=s.arg)}}}function I(e,n){var r=n.method,o=e.iterator[r];if(o===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,I(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=p(o,e.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,g;var a=i.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function L(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 j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function _(e){if(e||""===e){var n=e[c];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return b.prototype=w,o(S,"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(S),t},e.awrap=function(t){return{__await:t}},O(D.prototype),l(D.prototype,u,(function(){return this})),e.AsyncIterator=D,e.async=function(t,n,r,o,i){void 0===i&&(i=Promise);var a=new D(f(t,n,r,o),i);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),l(S,s,"Generator"),l(S,c,(function(){return this})),l(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=_,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(j),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=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 n=this;function o(r,o){return c.type="throw",c.arg=e,n.next=r,o&&(n.method="next",n.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=r.call(a,"catchLoc"),s=r.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 n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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 n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),j(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;j(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:_(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),g}},e}var c,u,s,l,f="2.1.4",p=!1,h=!1,d="REDIRECT",v="SILENT",y="prod",g="idpay",m="idcash",b="byunico",w=r(r(r({},"dev","https://idpay-dev.unico.io"),"uat","https://idpay-uat.unico.io"),y,"https://idpay.unico.io"),E={DEVICE_SUPPORTED:"DEVICE_SUPPORTED",DEVICE_NOT_SUPPORT:"DEVICE_NOT_SUPPORT"},x=function(){console.log(">>> reset"),c=void 0,u=void 0,p=!1,h=!1,s=void 0,l=void 0},P=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])},S=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])},O=function(){var t=n(a().mark((function t(e){var n,r,o,i,l,g,m,b,x,O,D;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=e.token,i=e.useCurrentOrigin,l=e.env,g=void 0===l?y:l,m=e.type,b=void 0===m?"IFRAME":m,x=e.app,c=b,u=i?window.location.origin:w[g],t.next=5,P();case 5:UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.INITIALIZE),t.t0=c,t.next=t.t0===v?9:t.t0===d?14:15;break;case 9:return t.next=11,UnicoSDKAssets.clientBoxControl.initSilent();case 11:return s=t.sent,O={collectionId:s},t.abrupt("break",20);case 14:return t.abrupt("break",20);case 15:return t.next=17,S();case 17:return t.next=19,UnicoSDKAssets.clientBoxControl.create({host:u,token:o,sdkVersion:f,app:x,env:g});case 19:O=t.sent;case 20:if(p=!0,D=!(null!==(n=O)&&void 0!==n&&n.statusPreValidation)||(null===(r=O)||void 0===r?void 0:r.statusPreValidation)===E.DEVICE_SUPPORTED,h&&D&&T(h),!O){t.next=25;break}return t.abrupt("return",O);case 25:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),D=function(){var t=n(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({ ... })`, `IDCashSDK.init({ ... })` or `ByUnicoSDK.init({ ... })`. See our documentation for more details."),t.abrupt("return",O(e));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),k=function(){var t=n(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",O(i(i({},e),{},{app:b})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),I=function(){var t=n(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",O(i(i({},e),{},{app:g})));case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),L=function(){var t=n(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log(">>> initIDCashSDK > options:",e),t.next=3,O(i(i({},e),{},{app:m}));case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),j=function(t){var e=t.transactionId,n=t.token,r={transactionId:e,token:n,onFinish:t.onFinish,host:u,sdkVersion:f,collectionId:s};if(console.log("open",r),p)switch(UnicoSDKAssets.trackEvent(UnicoSDKAssets.EVENT_TYPES.START_FLOW,r),c){case v:UnicoSDKAssets.clientBoxControl.verify(r);break;case d:UnicoSDKAssets.clientBoxControl.redirect(e,n,u,f);break;default:UnicoSDKAssets.clientBoxControl.open(r)}else h=r},T=function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})},_=function(){x(),UnicoSDKAssets.clientBoxControl.close()},K={init:k,close:_,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:function(t){x(),null==r||r(t)}})}},U={init:I,close:_,open:function(t){var e=t.transactionId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})}},A={init:L,close:_,open:function(t){var e=t.invoiceId,n=t.token,r=t.onFinish;j({transactionId:e,token:n,onFinish:r})}},C={init:D,close:_,open:T};t.ByUnicoSDK=K,t.IDCashSDK=A,t.IDPaySDK=U,t.PRE_VALIDATION_STATUS=E,t.UnicoSDK=C}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "idpay-b2b-sdk",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "main": "./index.js",
5
5
  "module": "./index.esm.js",
6
6
  "types": "./index.d.ts",