@paybyrd/threedsecure-service
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -1,2 +0,2 @@ | ||
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},t.apply(this,arguments)}var r,n=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r.flush=function(){return Promise.resolve()},r.log=function(e){var r,n=t({},e,{error:null==(r=e.error)?void 0:r.toString()});console.log(n)},e}();function o(e,t,r){if(!e.s){if(r instanceof i){if(!r.s)return void(r.o=o.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(o.bind(null,e,t),o.bind(null,e,2));e.s=t,e.v=r;const n=e.o;n&&n(e)}}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}));var i=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,i=this.s;if(i){var a=1&i?t:r;if(a){try{o(n,1,a(this.v))}catch(e){o(n,2,e)}return n}return this}return this.o=function(e){try{var i=e.v;1&e.s?o(n,1,t?t(i):i):r?o(n,1,r(i)):o(n,2,i)}catch(e){o(n,2,e)}},n},e}();function a(e){return e instanceof i&&1&e.s}var s=/*#__PURE__*/function(){function e(t,r){void 0===r&&(r=new n),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=r,this._options=t,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))}var t=e.prototype;return t.log=function(t){if(this._logger.log(t),this._options.restLoggerUrl){var r="["+this._options.service.name+"] "+t.message;t.elapsedTimeInMilliseconds&&(r=r+" in "+t.elapsedTimeInMilliseconds+"ms"),this._logs.unshift({customMessage:t.message,message:r,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:t.content,exeption:e.getException(t.error),level:t.level,elapsedTimeInMilliseconds:t.elapsedTimeInMilliseconds})}},t.flush=function(){try{var t=function(){r._interval=setInterval(r.sendBatch.bind(r),1e3*(r._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))},r=this;clearInterval(r._interval);var n=function(e,t,r){for(var n;;){var s=e();if(a(s)&&(s=s.v),!s)return l;if(s.then){n=0;break}var l=r();if(l&&l.then){if(!a(l)){n=1;break}l=l.s}if(t){var c=t();if(c&&c.then&&!a(c)){n=2;break}}}var u=new i,h=o.bind(null,u,2);return(0===n?s.then(m):1===n?l.then(d):c.then(v)).then(void 0,h),u;function d(n){l=n;do{if(t&&(c=t())&&c.then&&!a(c))return void c.then(v).then(void 0,h);if(!(s=e())||a(s)&&!s.v)return void o(u,1,l);if(s.then)return void s.then(m).then(void 0,h);a(l=r())&&(l=l.v)}while(!l||!l.then);l.then(d).then(void 0,h)}function m(e){e?(l=r())&&l.then?l.then(d).then(void 0,h):d(l):o(u,1,l)}function v(){(s=e())?s.then?s.then(m).then(void 0,h):m(s):o(u,1,l)}}(function(){return!!r._logs.length},void 0,function(){return Promise.resolve(r.sendBatch()).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},t.sendBatch=function(){try{var e=this,t=e._logs.splice(0,10);if(!t.length)return Promise.resolve();var n=crypto.randomUUID(),o=function(o,i){try{var a=(s=1e3*(e._options.timeoutInSeconds||30),l=new AbortController,c=setTimeout(function(){return l.abort()},s),Promise.resolve(fetch(e._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(t),signal:l.signal})).then(function(o){clearTimeout(c),o.ok||e._logger.log({message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})}))}catch(e){return i(e)}var s,l,c;return a&&a.then?a.then(void 0,i):a}(0,function(o){e._logger.log({error:o,message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e.getException=function(e){return e?{stackTrace:e.stack,message:e.message,className:e.name}:null},e}();s.DEFAULT_BATCH_TIMEOUT=5;var l=/*#__PURE__*/function(){function e(){this.start=void 0,this.end=void 0,this.start=Date.now()}var t,r;return e.prototype.stop=function(){this.end=Date.now()},t=e,(r=[{key:"elapsed",get:function(){return(this.end||Date.now())-this.start}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key))?o:String(o),n)}var o}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),c=/*#__PURE__*/function(){function e(){}return e.convert=function(e){var t=JSON.stringify(e);return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e}(),u=/*#__PURE__*/function(){function e(){}return e.create=function(){var e=[48,32,24,16,15,8,4,1].find(function(e){return e<=screen.colorDepth});return{javaEnabled:navigator.javaEnabled(),javascriptEnabled:!0,language:navigator.language,userAgent:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,timezoneOffset:(new Date).getTimezoneOffset(),colorDepth:e,acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}},e}(),h=/*#__PURE__*/function(){function e(e){var t=this;this._task=void 0,this._timeout=void 0,this._task=new Promise(function(r){t._timeout=setTimeout(r,e)})}var t=e.prototype;return t.wait=function(){return this._task},t.cancel=function(){clearTimeout(this._timeout),this._task=Promise.reject({message:"Timer cancelled"})},e.sleep=function(t){return new e(t)},e.cancel=function(e){clearTimeout(e)},e}(),d=/*#__PURE__*/function(){function e(){}return e.createIFrame=function(e){var t=document.createElement("iframe");return t.id=e.name,t.name=e.name,e.onReadyFn&&e.onReadyFn(t,e.isVisible),e.onCreatedFn&&(e.onCreatedFn(t),t.style.opacity=e.isVisible?"1":"0"),e.parent.appendChild(t),t},e.createForm=function(e){var t=document.createElement("form");return t.id=e.name,t.name=e.name,t.action=e.actionUrl,t.target=e.target,t.method=e.method,e.parent.appendChild(t),t},e.createInput=function(e){var t=document.createElement("input");return t.id=e.name,t.name=e.name,t.type=e.type,e.parent.appendChild(t),t},e}();function m(e,t,r){if(!e.s){if(r instanceof v){if(!r.s)return void(r.o=m.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(m.bind(null,e,t),m.bind(null,e,2));e.s=t,e.v=r;var n=e.o;n&&n(e)}}var v=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,o=this.s;if(o){var i=1&o?t:r;if(i){try{m(n,1,i(this.v))}catch(e){m(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?m(n,1,t?t(o):o):r?m(n,1,r(o)):m(n,2,o)}catch(e){m(n,2,e)}},n},e}();function g(e){return e instanceof v&&1&e.s}var p,f=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}return e.prototype.execute=function(e){var t=this,n=e.executeFn,o=e.method,i=e.correlationId;return new Promise(function(e,a){try{var s,l=function(e){var n;if(s)return e;a(u),t._logger.log({message:'Unhandled error calling "'+o+'"',error:null==(n=u)?void 0:n.error,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Error})},c=1,u=null,d=function(e,t){var r;do{var n=e();if(n&&n.then){if(!g(n)){r=!0;break}n=n.v}var o=t();if(g(o)&&(o=o.v),!o)return n}while(!o.then);var i=new v,a=m.bind(null,i,2);return(r?n.then(s):o.then(l)).then(void 0,a),i;function s(r){for(n=r;g(o=t())&&(o=o.v),o;){if(o.then)return void o.then(l).then(void 0,a);if((n=e())&&n.then){if(!g(n))return void n.then(s).then(void 0,a);n=n.v}}m(i,1,n)}function l(r){if(r){do{if((n=e())&&n.then){if(!g(n))return void n.then(s).then(void 0,a);n=n.v}if(g(r=t())&&(r=r.v),!r)return void m(i,1,n)}while(!r.then);r.then(l).then(void 0,a)}else m(i,1,n)}}(function(){function l(e){return s?e:(c++,Promise.resolve(h.sleep(1e3*t._options.attemptDelayInSeconds).wait()).then(function(){}))}var d=function(r,o){try{var i=Promise.resolve(n({attempt:c,maxAttempts:t._options.maxAttempts})).then(function(t){if(t.isSuccess)return e(t),void(s=1);t.isTransientError||(a(t),s=1)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){u={message:'Unhandled error calling "'+o+'"',error:e,additionalData:{attempt:c,maxAttempts:t._options.maxAttempts}},t._logger.log({message:'Unhandled error calling "'+o+'"',error:e,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Warning})});return d&&d.then?d.then(l):l(d)},function(){return!s&&c<=t._options.maxAttempts});return Promise.resolve(d&&d.then?d.then(l):l(d))}catch(e){return Promise.reject(e)}})},e}(),I=/*#__PURE__*/function(){function t(e,t,r){void 0===r&&(r=new f(e,t)),this._options=void 0,this._retryPolicy=void 0,this._logger=void 0,this._retryPolicy=r,this._logger=t,this._options=e}var n=t.prototype;return n.send=function(t){try{var n=this,o=n;return Promise.resolve(n._retryPolicy.execute({executeFn:function(i){var a=i.attempt,s=i.maxAttempts;try{var c=function(e){clearTimeout(d);var t={isSuccess:v.ok,isTransientError:n.isTransientError(v),getData:function(){try{return Promise.resolve(v.json()).then(function(e){return e.data})}catch(e){return Promise.reject(e)}}};return t},u=1e3*(o._options.timeoutInSeconds||30),h=new AbortController,d=setTimeout(function(){return h.abort()},u),m=new URL(t.url);n._logger.log({message:"ExternalService - Request ("+m.host+")",content:{request:t,attempt:a,maxAttempts:s},method:"send",correlationId:t.correlationId,level:r.Information});var v,g=new l,p=function(o,i){try{var l=Promise.resolve(fetch(t.url,{headers:e({},t.headers,{"x-attempt":a.toString(),"x-max-attempt":s.toString(),accept:"application/json","content-type":"application/json",correlationId:t.correlationId}),keepalive:!0,body:JSON.stringify(t.body),method:t.method,signal:h.signal})).then(function(e){var o=n._logger,i=o.log,l="ExternalService - Response ("+m.host+")",c=(v=e).status;return Promise.resolve(v.clone().text()).then(function(e){i.call(o,{message:l,content:{request:t,attempt:a,maxAttempts:s,response:{statusCode:c,data:e}},method:"send",correlationId:t.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed})})})}catch(e){return i(e)}return l&&l.then?l.then(void 0,i):l}(0,function(e){throw n._logger.log({message:"ExternalService - Error ("+m.host+")",content:{request:t,attempt:a,maxAttempts:s,error:e},method:"send",correlationId:t.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed}),e});return Promise.resolve(p&&p.then?p.then(c):c())}catch(e){return Promise.reject(e)}},method:"["+t.method+"] "+t.url,correlationId:t.correlationId}))}catch(e){return Promise.reject(e)}},n.isTransientError=function(e){return[409,424,500,503,504].includes(e.status)},t}();!function(e){e.width250xheight400="01",e.width390xheight400="02",e.width500xheight600="03",e.width600xheight400="04",e.fullscreen="05"}(p||(p={}));var _=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}var t=e.prototype;return t.execute=function(t){var n=this;return t.authResponse.challengeUrl?new Promise(function(o,i){try{n._logger.log({message:"Challenge - Start",content:{authResponse:t.authResponse},method:"executeChallenge",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var a=d.createIFrame({parent:n._options.container,name:e.IFRAME_NAME,isVisible:!0,useDefaultStyle:!!n._options.onIFrameCreatedFn,onCreatedFn:n._options.onIFrameCreatedFn,onReadyFn:n._options.onIFrameReadyFn});n._logger.log({message:"Challenge - Create iFrame",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var s=d.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.authResponse.challengeUrl,target:e.IFRAME_NAME,method:"post"});n._logger.log({message:"Challenge - Create form",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var u=d.createInput({parent:s,name:e.CREQ_INPUT_NAME,type:e.CREQ_INPUT_TYPE});n._logger.log({message:"Challenge - Create input",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var h={threeDSServerTransID:t.authResponse.processId,acsTransID:t.authResponse.challengeId,messageVersion:t.authResponse.challengeVersion,messageType:"CReq",challengeWindowSize:n._options.challengeWindowSize||p.width250xheight400},m=c.convert(h);u.value=m,n._logger.log({message:"Challenge - Prepare cReq",content:{cReq:h,base64CReq:m},method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var v=new l;s.submit(),setTimeout(function e(){var o,i=a.contentDocument||(null==(o=a.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"Challenge - iFrame loaded in "+v.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeChallenge",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"Challenge - Submit form",content:{authResponse:t.authResponse,cReq:h,base64CReq:m},method:"executeChallenge",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"Challenge - error",content:{authResponse:t.authResponse},error:e,method:"executeChallenge",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,r,n;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(r=document.getElementById(e.FORM_NAME))||r.remove(),null==(n=document.getElementById(e.CREQ_INPUT_NAME))||n.remove()}catch(e){}},e}();_.IFRAME_NAME="challengeIframe",_.FORM_NAME="challengeForm",_.CREQ_INPUT_NAME="creq",_.CREQ_INPUT_TYPE="hidden";var y=/*#__PURE__*/function(){function e(e,t){this._logger=void 0,this._options=void 0,this._logger=t,this._options=e}var t=e.prototype;return t.execute=function(t){var n=this;return t.preAuthResponse.dsMethodUrl?new Promise(function(o,i){try{var a;n._logger.log({message:"DirectoryServer - Start",content:{preAuthResponse:t},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var s=d.createIFrame({parent:n._options.container,isVisible:!1,name:e.IFRAME_NAME,useDefaultStyle:!!n._options.onIFrameCreatedFn});null==(a=n._options.onIFrameCreatedFn)||a.call(n._options,s),n._logger.log({message:"DirectoryServer - Create iFrame",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var u=d.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.preAuthResponse.dsMethodUrl,target:e.IFRAME_NAME,method:"POST"});n._logger.log({message:"DirectoryServer - Create Form",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var h=d.createInput({parent:u,name:e.FORM_INPUT_NAME,type:e.FROM_INPUT_TYPE});n._logger.log({message:"DirectoryServer - Create Input",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var m={threeDSServerTransID:t.preAuthResponse.processId,threeDSMethodNotificationURL:t.preAuthResponse.notificationUrl},v=c.convert(m);h.value=v,n._logger.log({message:"DirectoryServer - Prepare threeDSMethodData",content:{threeDSMethodData:m,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var g=new l;u.submit(),setTimeout(function e(){var o,i=s.contentDocument||(null==(o=s.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"DirectoryServer - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"DirectoryServer - Submit form",content:{threeDSMethodData:m,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"DirectoryServer - Error",content:{preAuthResponse:t},error:e,method:"directoryServerExecute",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,r,n;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(r=document.getElementById(e.FORM_NAME))||r.remove(),null==(n=document.getElementById(e.FORM_INPUT_NAME))||n.remove()}catch(e){}},e}();y.IFRAME_NAME="threeDSMethodIframe",y.FORM_NAME="threeDSMethodForm",y.FORM_INPUT_NAME="threeDSMethodData",y.FROM_INPUT_TYPE="hidden";var A=/*#__PURE__*/function(){function e(t,r,n,o,i){void 0===r&&(r=new s(e.getLoggerOptions(t))),void 0===n&&(n=new I(e.getHttpClientOptions(t),r)),void 0===o&&(o=new y(t,r)),void 0===i&&(i=new _(t,r)),this._options=void 0,this._logger=void 0,this._client=void 0,this._directoryServer=void 0,this._challenge=void 0,this._observers=[],this._options=t,this._logger=r,this._client=n,this._directoryServer=o,this._challenge=i}var t=e.prototype;return t.subscribe=function(e){this._observers.push(e)},t.unsubscribe=function(e){var t=this._observers.indexOf(e);t>-1&&this._observers.splice(t,1)},t.execute=function(e,t){try{var n=this;return void 0===t&&(t=crypto.randomUUID()),e.correlationId||(e.correlationId=t,n._logger.log({message:"Obsolete request. CorrelationId is not set.",content:e,method:"execute",correlationId:e.correlationId,level:r.Information})),Promise.resolve(function(t,r){try{var o=Promise.resolve(n.preAuth(e)).then(function(t){return Promise.resolve(n._directoryServer.execute({preAuthResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.auth(e)).then(function(t){return Promise.resolve(n._challenge.execute({authResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.postAuth(e))})})})})}catch(e){return r(!0,e)}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):r(!1,o)}(0,function(e,t){return n.reset(),Promise.resolve(n._logger.flush()).then(function(){if(e)throw t;return t})}))}catch(e){return Promise.reject(e)}},t.preAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PreAuth",content:e,method:"_preAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"preAuth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/preAuth",method:"POST",body:{browser:u.create()},correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"preAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.auth=function(e){try{var t=this;return t._logger.log({message:"Executing Auth",content:e,method:"_auth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"auth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v1/"+e.id+"/auth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"auth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.postAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PostAuth",content:e,method:"_postAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/postAuth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.reset=function(){this.notifyAll({name:"reset:started"}),this._challenge.reset(),this._directoryServer.reset(),this.notifyAll({name:"reset:completed"})},t.notifyAll=function(e){this._observers.forEach(function(t){return t.notify(e)})},e.getLoggerOptions=function(e){return{restLoggerUrl:e.logUrl,timeoutInSeconds:e.timeoutInSeconds||30,environment:e.environment||"Development",batchLogIntervalInSeconds:e.batchLogIntervalInSeconds||5,service:{name:"Paybyrd.ThreeDSecure.JS",version:"3.1.1"}}},e.getHttpClientOptions=function(e){return{timeoutInSeconds:e.timeoutInSeconds||30,attemptDelayInSeconds:e.attemptDelayInSeconds||2,maxAttempts:e.maxAttempts||50}},e}();export{p as ChallengeWindowSize,f as LinearRetryPolicy,A as ThreeDSecureService}; | ||
function e(){return e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},t.apply(this,arguments)}var r,n=/*#__PURE__*/function(){function e(){}var r=e.prototype;return r.flush=function(){return Promise.resolve()},r.log=function(e){var r,n=t({},e,{error:null==(r=e.error)?void 0:r.toString()});console.log(n)},e}();function o(e,t,r){if(!e.s){if(r instanceof i){if(!r.s)return void(r.o=o.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(o.bind(null,e,t),o.bind(null,e,2));e.s=t,e.v=r;const n=e.o;n&&n(e)}}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}));var i=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,i=this.s;if(i){var a=1&i?t:r;if(a){try{o(n,1,a(this.v))}catch(e){o(n,2,e)}return n}return this}return this.o=function(e){try{var i=e.v;1&e.s?o(n,1,t?t(i):i):r?o(n,1,r(i)):o(n,2,i)}catch(e){o(n,2,e)}},n},e}();function a(e){return e instanceof i&&1&e.s}var s=/*#__PURE__*/function(){function e(t,r){void 0===r&&(r=new n),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=r,this._options=t,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))}var t=e.prototype;return t.log=function(t){if(this._logger.log(t),this._options.restLoggerUrl){var r="["+this._options.service.name+"] "+t.message;t.elapsedTimeInMilliseconds&&(r=r+" in "+t.elapsedTimeInMilliseconds+"ms"),this._logs.unshift({customMessage:t.message,message:r,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:t.content,exeption:e.getException(t.error),level:t.level,elapsedTimeInMilliseconds:t.elapsedTimeInMilliseconds})}},t.flush=function(){try{var t=function(){r._interval=setInterval(r.sendBatch.bind(r),1e3*(r._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))},r=this;clearInterval(r._interval);var n=function(e,t,r){for(var n;;){var s=e();if(a(s)&&(s=s.v),!s)return l;if(s.then){n=0;break}var l=r();if(l&&l.then){if(!a(l)){n=1;break}l=l.s}if(t){var c=t();if(c&&c.then&&!a(c)){n=2;break}}}var u=new i,h=o.bind(null,u,2);return(0===n?s.then(m):1===n?l.then(d):c.then(v)).then(void 0,h),u;function d(n){l=n;do{if(t&&(c=t())&&c.then&&!a(c))return void c.then(v).then(void 0,h);if(!(s=e())||a(s)&&!s.v)return void o(u,1,l);if(s.then)return void s.then(m).then(void 0,h);a(l=r())&&(l=l.v)}while(!l||!l.then);l.then(d).then(void 0,h)}function m(e){e?(l=r())&&l.then?l.then(d).then(void 0,h):d(l):o(u,1,l)}function v(){(s=e())?s.then?s.then(m).then(void 0,h):m(s):o(u,1,l)}}(function(){return!!r._logs.length},void 0,function(){return Promise.resolve(r.sendBatch()).then(function(){})});return Promise.resolve(n&&n.then?n.then(t):t())}catch(e){return Promise.reject(e)}},t.sendBatch=function(){try{var e=this,t=e._logs.splice(0,10);if(!t.length)return Promise.resolve();var n=crypto.randomUUID(),o=function(o,i){try{var a=(s=1e3*(e._options.timeoutInSeconds||30),l=new AbortController,c=setTimeout(function(){return l.abort()},s),Promise.resolve(fetch(e._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(t),signal:l.signal})).then(function(o){clearTimeout(c),o.ok||e._logger.log({message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})}))}catch(e){return i(e)}var s,l,c;return a&&a.then?a.then(void 0,i):a}(0,function(o){e._logger.log({error:o,message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e.getException=function(e){return e?{stackTrace:e.stack,message:e.message,className:e.name}:null},e}();s.DEFAULT_BATCH_TIMEOUT=5;var l=/*#__PURE__*/function(){function e(){this.start=void 0,this.end=void 0,this.start=Date.now()}var t,r;return e.prototype.stop=function(){this.end=Date.now()},t=e,(r=[{key:"elapsed",get:function(){return(this.end||Date.now())-this.start}}])&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(n.key))?o:String(o),n)}var o}(t.prototype,r),Object.defineProperty(t,"prototype",{writable:!1}),e}(),c=/*#__PURE__*/function(){function e(){}return e.convert=function(e){var t=JSON.stringify(e);return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e}(),u=/*#__PURE__*/function(){function e(){}return e.create=function(){var e=[48,32,24,16,15,8,4,1].find(function(e){return e<=screen.colorDepth});return{javaEnabled:navigator.javaEnabled(),javascriptEnabled:!0,language:navigator.language,userAgent:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,timezoneOffset:(new Date).getTimezoneOffset(),colorDepth:e,acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}},e}(),h=/*#__PURE__*/function(){function e(e){var t=this;this._task=void 0,this._timeout=void 0,this._task=new Promise(function(r){t._timeout=setTimeout(r,e)})}var t=e.prototype;return t.wait=function(){return this._task},t.cancel=function(){clearTimeout(this._timeout),this._task=Promise.reject({message:"Timer cancelled"})},e.sleep=function(t){return new e(t)},e.cancel=function(e){clearTimeout(e)},e}(),d=/*#__PURE__*/function(){function e(){}return e.createIFrame=function(e){var t=document.createElement("iframe");return t.id=e.name,t.name=e.name,e.onReadyFn&&e.onReadyFn(t,e.isVisible),e.onCreatedFn&&(e.onCreatedFn(t),t.style.opacity=e.isVisible?"1":"0"),e.parent.appendChild(t),t},e.createForm=function(e){var t=document.createElement("form");return t.id=e.name,t.name=e.name,t.action=e.actionUrl,t.target=e.target,t.method=e.method,e.parent.appendChild(t),t},e.createInput=function(e){var t=document.createElement("input");return t.id=e.name,t.name=e.name,t.type=e.type,e.parent.appendChild(t),t},e}();function m(e,t,r){if(!e.s){if(r instanceof v){if(!r.s)return void(r.o=m.bind(null,e,t));1&t&&(t=r.s),r=r.v}if(r&&r.then)return void r.then(m.bind(null,e,t),m.bind(null,e,2));e.s=t,e.v=r;var n=e.o;n&&n(e)}}var v=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,r){var n=new e,o=this.s;if(o){var i=1&o?t:r;if(i){try{m(n,1,i(this.v))}catch(e){m(n,2,e)}return n}return this}return this.o=function(e){try{var o=e.v;1&e.s?m(n,1,t?t(o):o):r?m(n,1,r(o)):m(n,2,o)}catch(e){m(n,2,e)}},n},e}();function g(e){return e instanceof v&&1&e.s}var p,f=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}return e.prototype.execute=function(e){var t=this,n=e.executeFn,o=e.method,i=e.correlationId;return new Promise(function(e,a){try{var s,l=function(e){var n;if(s)return e;a(u),t._logger.log({message:'Unhandled error calling "'+o+'"',error:null==(n=u)?void 0:n.error,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Error})},c=1,u=null,d=function(e,t){var r;do{var n=e();if(n&&n.then){if(!g(n)){r=!0;break}n=n.v}var o=t();if(g(o)&&(o=o.v),!o)return n}while(!o.then);var i=new v,a=m.bind(null,i,2);return(r?n.then(s):o.then(l)).then(void 0,a),i;function s(r){for(n=r;g(o=t())&&(o=o.v),o;){if(o.then)return void o.then(l).then(void 0,a);if((n=e())&&n.then){if(!g(n))return void n.then(s).then(void 0,a);n=n.v}}m(i,1,n)}function l(r){if(r){do{if((n=e())&&n.then){if(!g(n))return void n.then(s).then(void 0,a);n=n.v}if(g(r=t())&&(r=r.v),!r)return void m(i,1,n)}while(!r.then);r.then(l).then(void 0,a)}else m(i,1,n)}}(function(){function l(e){return s?e:(c++,Promise.resolve(h.sleep(1e3*t._options.attemptDelayInSeconds).wait()).then(function(){}))}var d=function(r,o){try{var i=Promise.resolve(n({attempt:c,maxAttempts:t._options.maxAttempts})).then(function(t){if(t.isSuccess)return e(t),void(s=1);t.isTransientError||(a(t),s=1)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){u={message:'Unhandled error calling "'+o+'"',error:e,additionalData:{attempt:c,maxAttempts:t._options.maxAttempts}},t._logger.log({message:'Unhandled error calling "'+o+'"',error:e,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Warning})});return d&&d.then?d.then(l):l(d)},function(){return!s&&c<=t._options.maxAttempts});return Promise.resolve(d&&d.then?d.then(l):l(d))}catch(e){return Promise.reject(e)}})},e}(),I=/*#__PURE__*/function(){function t(e,t,r){void 0===r&&(r=new f(e,t)),this._options=void 0,this._retryPolicy=void 0,this._logger=void 0,this._retryPolicy=r,this._logger=t,this._options=e}var n=t.prototype;return n.send=function(t){try{var n=this,o=n;return Promise.resolve(n._retryPolicy.execute({executeFn:function(i){var a=i.attempt,s=i.maxAttempts;try{var c=function(e){clearTimeout(d);var t={isSuccess:v.ok,isTransientError:n.isTransientError(v),getData:function(){try{return Promise.resolve(v.json()).then(function(e){return e.data})}catch(e){return Promise.reject(e)}}};return t},u=1e3*(o._options.timeoutInSeconds||30),h=new AbortController,d=setTimeout(function(){return h.abort()},u),m=new URL(t.url);n._logger.log({message:"ExternalService - Request ("+m.host+")",content:{request:t,attempt:a,maxAttempts:s},method:"send",correlationId:t.correlationId,level:r.Information});var v,g=new l,p=function(o,i){try{var l=Promise.resolve(fetch(t.url,{headers:e({},t.headers,{"x-attempt":a.toString(),"x-max-attempt":s.toString(),accept:"application/json","content-type":"application/json",correlationId:t.correlationId}),keepalive:!0,body:JSON.stringify(t.body),method:t.method,signal:h.signal})).then(function(e){var o=n._logger,i=o.log,l="ExternalService - Response ("+m.host+")",c=(v=e).status;return Promise.resolve(v.clone().text()).then(function(e){i.call(o,{message:l,content:{request:t,attempt:a,maxAttempts:s,response:{statusCode:c,data:e}},method:"send",correlationId:t.correlationId,level:r.Information,elapsedTimeInMilliseconds:g.elapsed})})})}catch(e){return i(e)}return l&&l.then?l.then(void 0,i):l}(0,function(e){throw n._logger.log({message:"ExternalService - Error ("+m.host+")",content:{request:t,attempt:a,maxAttempts:s,error:e},method:"send",correlationId:t.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed}),e});return Promise.resolve(p&&p.then?p.then(c):c())}catch(e){return Promise.reject(e)}},method:"["+t.method+"] "+t.url,correlationId:t.correlationId}))}catch(e){return Promise.reject(e)}},n.isTransientError=function(e){return[409,424,500,503,504].includes(e.status)},t}();!function(e){e.width250xheight400="01",e.width390xheight400="02",e.width500xheight600="03",e.width600xheight400="04",e.fullscreen="05"}(p||(p={}));var _=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}var t=e.prototype;return t.execute=function(t){var n=this;return t.authResponse.challengeUrl?new Promise(function(o,i){try{n._logger.log({message:"Challenge - Start",content:{authResponse:t.authResponse},method:"executeChallenge",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var a=d.createIFrame({parent:n._options.container,name:e.IFRAME_NAME,isVisible:!0,useDefaultStyle:!!n._options.onIFrameCreatedFn,onCreatedFn:n._options.onIFrameCreatedFn,onReadyFn:n._options.onIFrameReadyFn});n._logger.log({message:"Challenge - Create iFrame",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var s=d.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.authResponse.challengeUrl,target:e.IFRAME_NAME,method:"post"});n._logger.log({message:"Challenge - Create form",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var u=d.createInput({parent:s,name:e.CREQ_INPUT_NAME,type:e.CREQ_INPUT_TYPE});n._logger.log({message:"Challenge - Create input",method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var h={threeDSServerTransID:t.authResponse.processId,acsTransID:t.authResponse.challengeId,messageVersion:t.authResponse.challengeVersion,messageType:"CReq",challengeWindowSize:n._options.challengeWindowSize||p.width250xheight400},m=c.convert(h);u.value=m,n._logger.log({message:"Challenge - Prepare cReq",content:{cReq:h,base64CReq:m},method:"executeChallenge",correlationId:t.correlationId,level:r.Information});var v=new l;s.submit(),setTimeout(function e(){var o,i=a.contentDocument||(null==(o=a.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"Challenge - iFrame loaded in "+v.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeChallenge",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"Challenge - Submit form",content:{authResponse:t.authResponse,cReq:h,base64CReq:m},method:"executeChallenge",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"Challenge - error",content:{authResponse:t.authResponse},error:e,method:"executeChallenge",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,r,n;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(r=document.getElementById(e.FORM_NAME))||r.remove(),null==(n=document.getElementById(e.CREQ_INPUT_NAME))||n.remove()}catch(e){}},e}();_.IFRAME_NAME="challengeIframe",_.FORM_NAME="challengeForm",_.CREQ_INPUT_NAME="creq",_.CREQ_INPUT_TYPE="hidden";var y=/*#__PURE__*/function(){function e(e,t){this._logger=void 0,this._options=void 0,this._logger=t,this._options=e}var t=e.prototype;return t.execute=function(t){var n=this;return t.preAuthResponse.dsMethodUrl?new Promise(function(o,i){try{var a;n._logger.log({message:"DirectoryServer - Start",content:{preAuthResponse:t},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var s=d.createIFrame({parent:n._options.container,isVisible:!1,name:e.IFRAME_NAME,useDefaultStyle:!!n._options.onIFrameCreatedFn});null==(a=n._options.onIFrameCreatedFn)||a.call(n._options,s),n._logger.log({message:"DirectoryServer - Create iFrame",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var u=d.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.preAuthResponse.dsMethodUrl,target:e.IFRAME_NAME,method:"POST"});n._logger.log({message:"DirectoryServer - Create Form",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var h=d.createInput({parent:u,name:e.FORM_INPUT_NAME,type:e.FROM_INPUT_TYPE});n._logger.log({message:"DirectoryServer - Create Input",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var m={threeDSServerTransID:t.preAuthResponse.processId,threeDSMethodNotificationURL:t.preAuthResponse.notificationUrl},v=c.convert(m);h.value=v,n._logger.log({message:"DirectoryServer - Prepare threeDSMethodData",content:{threeDSMethodData:m,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var g=new l;u.submit(),setTimeout(function e(){var o,i=s.contentDocument||(null==(o=s.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"DirectoryServer - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"DirectoryServer - Submit form",content:{threeDSMethodData:m,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"DirectoryServer - Error",content:{preAuthResponse:t},error:e,method:"directoryServerExecute",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,r,n;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(r=document.getElementById(e.FORM_NAME))||r.remove(),null==(n=document.getElementById(e.FORM_INPUT_NAME))||n.remove()}catch(e){}},e}();y.IFRAME_NAME="threeDSMethodIframe",y.FORM_NAME="threeDSMethodForm",y.FORM_INPUT_NAME="threeDSMethodData",y.FROM_INPUT_TYPE="hidden";var A=/*#__PURE__*/function(){function e(t,r,n,o,i){void 0===r&&(r=new s(e.getLoggerOptions(t))),void 0===n&&(n=new I(e.getHttpClientOptions(t),r)),void 0===o&&(o=new y(t,r)),void 0===i&&(i=new _(t,r)),this._options=void 0,this._logger=void 0,this._client=void 0,this._directoryServer=void 0,this._challenge=void 0,this._observers=[],this._options=t,this._logger=r,this._client=n,this._directoryServer=o,this._challenge=i}var t=e.prototype;return t.subscribe=function(e){this._observers.push(e)},t.unsubscribe=function(e){var t=this._observers.indexOf(e);t>-1&&this._observers.splice(t,1)},t.execute=function(e,t){try{var n=this;return void 0===t&&(t=crypto.randomUUID()),e.correlationId||(e.correlationId=t,n._logger.log({message:"Obsolete request. CorrelationId is not set.",content:e,method:"execute",correlationId:e.correlationId,level:r.Information})),Promise.resolve(function(t,r){try{var o=Promise.resolve(n.preAuth(e)).then(function(t){return Promise.resolve(n._directoryServer.execute({preAuthResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.auth(e)).then(function(t){return Promise.resolve(n._challenge.execute({authResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.postAuth(e))})})})})}catch(e){return r(!0,e)}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):r(!1,o)}(0,function(e,t){return n.reset(),Promise.resolve(n._logger.flush()).then(function(){if(e)throw t;return t})}))}catch(e){return Promise.reject(e)}},t.preAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PreAuth",content:e,method:"_preAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"preAuth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/preAuth",method:"POST",body:{browser:u.create()},correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"preAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.auth=function(e){try{var t=this;return t._logger.log({message:"Executing Auth",content:e,method:"_auth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"auth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v1/"+e.id+"/auth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"auth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.postAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PostAuth",content:e,method:"_postAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/postAuth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.reset=function(){this.notifyAll({name:"reset:started"}),this._challenge.reset(),this._directoryServer.reset(),this.notifyAll({name:"reset:completed"})},t.notifyAll=function(e){this._observers.forEach(function(t){return t.notify(e)})},e.getLoggerOptions=function(e){return{restLoggerUrl:e.logUrl,timeoutInSeconds:e.timeoutInSeconds||30,environment:e.environment||"Production",batchLogIntervalInSeconds:e.batchLogIntervalInSeconds||5,service:{name:"Paybyrd.ThreeDSecure.JS",version:"3.2.1"}}},e.getHttpClientOptions=function(e){return{timeoutInSeconds:e.timeoutInSeconds||30,attemptDelayInSeconds:e.attemptDelayInSeconds||2,maxAttempts:e.maxAttempts||50}},e}();export{p as ChallengeWindowSize,f as LinearRetryPolicy,A as ThreeDSecureService}; | ||
//# sourceMappingURL=index.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).threedsecureService={})}(this,function(e){function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}var r,o=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.flush=function(){return Promise.resolve()},t.log=function(e){var t,r=n({},e,{error:null==(t=e.error)?void 0:t.toString()});console.log(r)},e}();function i(e,t,n){if(!e.s){if(n instanceof a){if(!n.s)return void(n.o=i.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(i.bind(null,e,t),i.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}));var a=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var a=1&o?t:n;if(a){try{i(r,1,a(this.v))}catch(e){i(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?i(r,1,t?t(o):o):n?i(r,1,n(o)):i(r,2,o)}catch(e){i(r,2,e)}},r},e}();function s(e){return e instanceof a&&1&e.s}var l=/*#__PURE__*/function(){function e(t,n){void 0===n&&(n=new o),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=n,this._options=t,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))}var t=e.prototype;return t.log=function(t){if(this._logger.log(t),this._options.restLoggerUrl){var n="["+this._options.service.name+"] "+t.message;t.elapsedTimeInMilliseconds&&(n=n+" in "+t.elapsedTimeInMilliseconds+"ms"),this._logs.unshift({customMessage:t.message,message:n,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:t.content,exeption:e.getException(t.error),level:t.level,elapsedTimeInMilliseconds:t.elapsedTimeInMilliseconds})}},t.flush=function(){try{var t=function(){n._interval=setInterval(n.sendBatch.bind(n),1e3*(n._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))},n=this;clearInterval(n._interval);var r=function(e,t,n){for(var r;;){var o=e();if(s(o)&&(o=o.v),!o)return l;if(o.then){r=0;break}var l=n();if(l&&l.then){if(!s(l)){r=1;break}l=l.s}if(t){var c=t();if(c&&c.then&&!s(c)){r=2;break}}}var u=new a,h=i.bind(null,u,2);return(0===r?o.then(m):1===r?l.then(d):c.then(v)).then(void 0,h),u;function d(r){l=r;do{if(t&&(c=t())&&c.then&&!s(c))return void c.then(v).then(void 0,h);if(!(o=e())||s(o)&&!o.v)return void i(u,1,l);if(o.then)return void o.then(m).then(void 0,h);s(l=n())&&(l=l.v)}while(!l||!l.then);l.then(d).then(void 0,h)}function m(e){e?(l=n())&&l.then?l.then(d).then(void 0,h):d(l):i(u,1,l)}function v(){(o=e())?o.then?o.then(m).then(void 0,h):m(o):i(u,1,l)}}(function(){return!!n._logs.length},void 0,function(){return Promise.resolve(n.sendBatch()).then(function(){})});return Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}},t.sendBatch=function(){try{var e=this,t=e._logs.splice(0,10);if(!t.length)return Promise.resolve();var n=crypto.randomUUID(),o=function(o,i){try{var a=(s=1e3*(e._options.timeoutInSeconds||30),l=new AbortController,c=setTimeout(function(){return l.abort()},s),Promise.resolve(fetch(e._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(t),signal:l.signal})).then(function(o){clearTimeout(c),o.ok||e._logger.log({message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})}))}catch(e){return i(e)}var s,l,c;return a&&a.then?a.then(void 0,i):a}(0,function(o){e._logger.log({error:o,message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e.getException=function(e){return e?{stackTrace:e.stack,message:e.message,className:e.name}:null},e}();l.DEFAULT_BATCH_TIMEOUT=5;var c=/*#__PURE__*/function(){function e(){this.start=void 0,this.end=void 0,this.start=Date.now()}var t,n;return e.prototype.stop=function(){this.end=Date.now()},t=e,(n=[{key:"elapsed",get:function(){return(this.end||Date.now())-this.start}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key))?o:String(o),r)}var o}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),u=/*#__PURE__*/function(){function e(){}return e.convert=function(e){var t=JSON.stringify(e);return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e}(),h=/*#__PURE__*/function(){function e(){}return e.create=function(){var e=[48,32,24,16,15,8,4,1].find(function(e){return e<=screen.colorDepth});return{javaEnabled:navigator.javaEnabled(),javascriptEnabled:!0,language:navigator.language,userAgent:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,timezoneOffset:(new Date).getTimezoneOffset(),colorDepth:e,acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}},e}(),d=/*#__PURE__*/function(){function e(e){var t=this;this._task=void 0,this._timeout=void 0,this._task=new Promise(function(n){t._timeout=setTimeout(n,e)})}var t=e.prototype;return t.wait=function(){return this._task},t.cancel=function(){clearTimeout(this._timeout),this._task=Promise.reject({message:"Timer cancelled"})},e.sleep=function(t){return new e(t)},e.cancel=function(e){clearTimeout(e)},e}(),m=/*#__PURE__*/function(){function e(){}return e.createIFrame=function(e){var t=document.createElement("iframe");return t.id=e.name,t.name=e.name,e.onReadyFn&&e.onReadyFn(t,e.isVisible),e.onCreatedFn&&(e.onCreatedFn(t),t.style.opacity=e.isVisible?"1":"0"),e.parent.appendChild(t),t},e.createForm=function(e){var t=document.createElement("form");return t.id=e.name,t.name=e.name,t.action=e.actionUrl,t.target=e.target,t.method=e.method,e.parent.appendChild(t),t},e.createInput=function(e){var t=document.createElement("input");return t.id=e.name,t.name=e.name,t.type=e.type,e.parent.appendChild(t),t},e}();function v(e,t,n){if(!e.s){if(n instanceof g){if(!n.s)return void(n.o=v.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(v.bind(null,e,t),v.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var g=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{v(r,1,i(this.v))}catch(e){v(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?v(r,1,t?t(o):o):n?v(r,1,n(o)):v(r,2,o)}catch(e){v(r,2,e)}},r},e}();function p(e){return e instanceof g&&1&e.s}var f,I=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}return e.prototype.execute=function(e){var t=this,n=e.executeFn,o=e.method,i=e.correlationId;return new Promise(function(e,a){try{var s,l=function(e){var n;if(s)return e;a(u),t._logger.log({message:'Unhandled error calling "'+o+'"',error:null==(n=u)?void 0:n.error,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Error})},c=1,u=null,h=function(e,t){var n;do{var r=e();if(r&&r.then){if(!p(r)){n=!0;break}r=r.v}var o=t();if(p(o)&&(o=o.v),!o)return r}while(!o.then);var i=new g,a=v.bind(null,i,2);return(n?r.then(s):o.then(l)).then(void 0,a),i;function s(n){for(r=n;p(o=t())&&(o=o.v),o;){if(o.then)return void o.then(l).then(void 0,a);if((r=e())&&r.then){if(!p(r))return void r.then(s).then(void 0,a);r=r.v}}v(i,1,r)}function l(n){if(n){do{if((r=e())&&r.then){if(!p(r))return void r.then(s).then(void 0,a);r=r.v}if(p(n=t())&&(n=n.v),!n)return void v(i,1,r)}while(!n.then);n.then(l).then(void 0,a)}else v(i,1,r)}}(function(){function l(e){return s?e:(c++,Promise.resolve(d.sleep(1e3*t._options.attemptDelayInSeconds).wait()).then(function(){}))}var h=function(r,o){try{var i=Promise.resolve(n({attempt:c,maxAttempts:t._options.maxAttempts})).then(function(t){if(t.isSuccess)return e(t),void(s=1);t.isTransientError||(a(t),s=1)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){u={message:'Unhandled error calling "'+o+'"',error:e,additionalData:{attempt:c,maxAttempts:t._options.maxAttempts}},t._logger.log({message:'Unhandled error calling "'+o+'"',error:e,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Warning})});return h&&h.then?h.then(l):l(h)},function(){return!s&&c<=t._options.maxAttempts});return Promise.resolve(h&&h.then?h.then(l):l(h))}catch(e){return Promise.reject(e)}})},e}(),_=/*#__PURE__*/function(){function e(e,t,n){void 0===n&&(n=new I(e,t)),this._options=void 0,this._retryPolicy=void 0,this._logger=void 0,this._retryPolicy=n,this._logger=t,this._options=e}var n=e.prototype;return n.send=function(e){try{var n=this,o=n;return Promise.resolve(n._retryPolicy.execute({executeFn:function(i){var a=i.attempt,s=i.maxAttempts;try{var l=function(e){clearTimeout(d);var t={isSuccess:v.ok,isTransientError:n.isTransientError(v),getData:function(){try{return Promise.resolve(v.json()).then(function(e){return e.data})}catch(e){return Promise.reject(e)}}};return t},u=1e3*(o._options.timeoutInSeconds||30),h=new AbortController,d=setTimeout(function(){return h.abort()},u),m=new URL(e.url);n._logger.log({message:"ExternalService - Request ("+m.host+")",content:{request:e,attempt:a,maxAttempts:s},method:"send",correlationId:e.correlationId,level:r.Information});var v,g=new c,p=function(o,i){try{var l=Promise.resolve(fetch(e.url,{headers:t({},e.headers,{"x-attempt":a.toString(),"x-max-attempt":s.toString(),accept:"application/json","content-type":"application/json",correlationId:e.correlationId}),keepalive:!0,body:JSON.stringify(e.body),method:e.method,signal:h.signal})).then(function(t){var o=n._logger,i=o.log,l="ExternalService - Response ("+m.host+")",c=(v=t).status;return Promise.resolve(v.clone().text()).then(function(t){i.call(o,{message:l,content:{request:e,attempt:a,maxAttempts:s,response:{statusCode:c,data:t}},method:"send",correlationId:e.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed})})})}catch(e){return i(e)}return l&&l.then?l.then(void 0,i):l}(0,function(t){throw n._logger.log({message:"ExternalService - Error ("+m.host+")",content:{request:e,attempt:a,maxAttempts:s,error:t},method:"send",correlationId:e.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed}),t});return Promise.resolve(p&&p.then?p.then(l):l())}catch(e){return Promise.reject(e)}},method:"["+e.method+"] "+e.url,correlationId:e.correlationId}))}catch(e){return Promise.reject(e)}},n.isTransientError=function(e){return[409,424,500,503,504].includes(e.status)},e}();e.ChallengeWindowSize=void 0,(f=e.ChallengeWindowSize||(e.ChallengeWindowSize={})).width250xheight400="01",f.width390xheight400="02",f.width500xheight600="03",f.width600xheight400="04",f.fullscreen="05";var y=/*#__PURE__*/function(){function t(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}var n=t.prototype;return n.execute=function(n){var o=this;return n.authResponse.challengeUrl?new Promise(function(i,a){try{o._logger.log({message:"Challenge - Start",content:{authResponse:n.authResponse},method:"executeChallenge",correlationId:n.correlationId,level:r.Information}),o._options.container.innerHTML="";var s=m.createIFrame({parent:o._options.container,name:t.IFRAME_NAME,isVisible:!0,useDefaultStyle:!!o._options.onIFrameCreatedFn,onCreatedFn:o._options.onIFrameCreatedFn,onReadyFn:o._options.onIFrameReadyFn});o._logger.log({message:"Challenge - Create iFrame",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var l=m.createForm({parent:o._options.container,name:t.FORM_NAME,actionUrl:n.authResponse.challengeUrl,target:t.IFRAME_NAME,method:"post"});o._logger.log({message:"Challenge - Create form",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var h=m.createInput({parent:l,name:t.CREQ_INPUT_NAME,type:t.CREQ_INPUT_TYPE});o._logger.log({message:"Challenge - Create input",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var d={threeDSServerTransID:n.authResponse.processId,acsTransID:n.authResponse.challengeId,messageVersion:n.authResponse.challengeVersion,messageType:"CReq",challengeWindowSize:o._options.challengeWindowSize||e.ChallengeWindowSize.width250xheight400},v=u.convert(d);h.value=v,o._logger.log({message:"Challenge - Prepare cReq",content:{cReq:d,base64CReq:v},method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var g=new c;l.submit(),setTimeout(function e(){var t,i=s.contentDocument||(null==(t=s.contentWindow)?void 0:t.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):o._logger.log({message:"Challenge - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeChallenge",correlationId:n.correlationId,level:r.Information})},100),o._logger.log({message:"Challenge - Submit form",content:{authResponse:n.authResponse,cReq:d,base64CReq:v},method:"executeChallenge",correlationId:n.correlationId,level:r.Information}),i()}catch(e){return o._logger.log({message:"Challenge - error",content:{authResponse:n.authResponse},error:e,method:"executeChallenge",correlationId:n.correlationId,level:r.Error}),a({message:e.toString()})}}):Promise.resolve()},n.reset=function(){try{var e,n,r;null==(e=document.getElementById(t.IFRAME_NAME))||e.remove(),null==(n=document.getElementById(t.FORM_NAME))||n.remove(),null==(r=document.getElementById(t.CREQ_INPUT_NAME))||r.remove()}catch(e){}},t}();y.IFRAME_NAME="challengeIframe",y.FORM_NAME="challengeForm",y.CREQ_INPUT_NAME="creq",y.CREQ_INPUT_TYPE="hidden";var S=/*#__PURE__*/function(){function e(e,t){this._logger=void 0,this._options=void 0,this._logger=t,this._options=e}var t=e.prototype;return t.execute=function(t){var n=this;return t.preAuthResponse.dsMethodUrl?new Promise(function(o,i){try{var a;n._logger.log({message:"DirectoryServer - Start",content:{preAuthResponse:t},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var s=m.createIFrame({parent:n._options.container,isVisible:!1,name:e.IFRAME_NAME,useDefaultStyle:!!n._options.onIFrameCreatedFn});null==(a=n._options.onIFrameCreatedFn)||a.call(n._options,s),n._logger.log({message:"DirectoryServer - Create iFrame",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var l=m.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.preAuthResponse.dsMethodUrl,target:e.IFRAME_NAME,method:"POST"});n._logger.log({message:"DirectoryServer - Create Form",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var h=m.createInput({parent:l,name:e.FORM_INPUT_NAME,type:e.FROM_INPUT_TYPE});n._logger.log({message:"DirectoryServer - Create Input",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var d={threeDSServerTransID:t.preAuthResponse.processId,threeDSMethodNotificationURL:t.preAuthResponse.notificationUrl},v=u.convert(d);h.value=v,n._logger.log({message:"DirectoryServer - Prepare threeDSMethodData",content:{threeDSMethodData:d,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var g=new c;l.submit(),setTimeout(function e(){var o,i=s.contentDocument||(null==(o=s.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"DirectoryServer - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"DirectoryServer - Submit form",content:{threeDSMethodData:d,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"DirectoryServer - Error",content:{preAuthResponse:t},error:e,method:"directoryServerExecute",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,n,r;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(n=document.getElementById(e.FORM_NAME))||n.remove(),null==(r=document.getElementById(e.FORM_INPUT_NAME))||r.remove()}catch(e){}},e}();S.IFRAME_NAME="threeDSMethodIframe",S.FORM_NAME="threeDSMethodForm",S.FORM_INPUT_NAME="threeDSMethodData",S.FROM_INPUT_TYPE="hidden";var A=/*#__PURE__*/function(){function e(t,n,r,o,i){void 0===n&&(n=new l(e.getLoggerOptions(t))),void 0===r&&(r=new _(e.getHttpClientOptions(t),n)),void 0===o&&(o=new S(t,n)),void 0===i&&(i=new y(t,n)),this._options=void 0,this._logger=void 0,this._client=void 0,this._directoryServer=void 0,this._challenge=void 0,this._observers=[],this._options=t,this._logger=n,this._client=r,this._directoryServer=o,this._challenge=i}var t=e.prototype;return t.subscribe=function(e){this._observers.push(e)},t.unsubscribe=function(e){var t=this._observers.indexOf(e);t>-1&&this._observers.splice(t,1)},t.execute=function(e,t){try{var n=this;return void 0===t&&(t=crypto.randomUUID()),e.correlationId||(e.correlationId=t,n._logger.log({message:"Obsolete request. CorrelationId is not set.",content:e,method:"execute",correlationId:e.correlationId,level:r.Information})),Promise.resolve(function(t,r){try{var o=Promise.resolve(n.preAuth(e)).then(function(t){return Promise.resolve(n._directoryServer.execute({preAuthResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.auth(e)).then(function(t){return Promise.resolve(n._challenge.execute({authResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.postAuth(e))})})})})}catch(e){return r(!0,e)}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):r(!1,o)}(0,function(e,t){return n.reset(),Promise.resolve(n._logger.flush()).then(function(){if(e)throw t;return t})}))}catch(e){return Promise.reject(e)}},t.preAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PreAuth",content:e,method:"_preAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"preAuth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/preAuth",method:"POST",body:{browser:h.create()},correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"preAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.auth=function(e){try{var t=this;return t._logger.log({message:"Executing Auth",content:e,method:"_auth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"auth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v1/"+e.id+"/auth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"auth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.postAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PostAuth",content:e,method:"_postAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/postAuth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.reset=function(){this.notifyAll({name:"reset:started"}),this._challenge.reset(),this._directoryServer.reset(),this.notifyAll({name:"reset:completed"})},t.notifyAll=function(e){this._observers.forEach(function(t){return t.notify(e)})},e.getLoggerOptions=function(e){return{restLoggerUrl:e.logUrl,timeoutInSeconds:e.timeoutInSeconds||30,environment:e.environment||"Development",batchLogIntervalInSeconds:e.batchLogIntervalInSeconds||5,service:{name:"Paybyrd.ThreeDSecure.JS",version:"3.1.1"}}},e.getHttpClientOptions=function(e){return{timeoutInSeconds:e.timeoutInSeconds||30,attemptDelayInSeconds:e.attemptDelayInSeconds||2,maxAttempts:e.maxAttempts||50}},e}();e.LinearRetryPolicy=I,e.ThreeDSecureService=A}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e||self).threedsecureService={})}(this,function(e){function t(){return t=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.apply(this,arguments)}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}var r,o=/*#__PURE__*/function(){function e(){}var t=e.prototype;return t.flush=function(){return Promise.resolve()},t.log=function(e){var t,r=n({},e,{error:null==(t=e.error)?void 0:t.toString()});console.log(r)},e}();function i(e,t,n){if(!e.s){if(n instanceof a){if(!n.s)return void(n.o=i.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(i.bind(null,e,t),i.bind(null,e,2));e.s=t,e.v=n;const r=e.o;r&&r(e)}}!function(e){e[e.Trace=0]="Trace",e[e.Debug=1]="Debug",e[e.Information=2]="Information",e[e.Warning=3]="Warning",e[e.Error=4]="Error",e[e.Critical=5]="Critical",e[e.None=6]="None"}(r||(r={}));var a=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var a=1&o?t:n;if(a){try{i(r,1,a(this.v))}catch(e){i(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?i(r,1,t?t(o):o):n?i(r,1,n(o)):i(r,2,o)}catch(e){i(r,2,e)}},r},e}();function s(e){return e instanceof a&&1&e.s}var l=/*#__PURE__*/function(){function e(t,n){void 0===n&&(n=new o),this._logger=void 0,this._options=void 0,this._logs=[],this._interval=void 0,this._logger=n,this._options=t,this._interval=setInterval(this.sendBatch.bind(this),1e3*(this._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))}var t=e.prototype;return t.log=function(t){if(this._logger.log(t),this._options.restLoggerUrl){var n="["+this._options.service.name+"] "+t.message;t.elapsedTimeInMilliseconds&&(n=n+" in "+t.elapsedTimeInMilliseconds+"ms"),this._logs.unshift({customMessage:t.message,message:n,service:this._options.service,environment:this._options.environment||"Development",executionDate:new Date,entrypoint:"Execute",method:t.method,correlationId:t.correlationId,content:t.content,exeption:e.getException(t.error),level:t.level,elapsedTimeInMilliseconds:t.elapsedTimeInMilliseconds})}},t.flush=function(){try{var t=function(){n._interval=setInterval(n.sendBatch.bind(n),1e3*(n._options.batchLogIntervalInSeconds||e.DEFAULT_BATCH_TIMEOUT))},n=this;clearInterval(n._interval);var r=function(e,t,n){for(var r;;){var o=e();if(s(o)&&(o=o.v),!o)return l;if(o.then){r=0;break}var l=n();if(l&&l.then){if(!s(l)){r=1;break}l=l.s}if(t){var c=t();if(c&&c.then&&!s(c)){r=2;break}}}var u=new a,h=i.bind(null,u,2);return(0===r?o.then(m):1===r?l.then(d):c.then(v)).then(void 0,h),u;function d(r){l=r;do{if(t&&(c=t())&&c.then&&!s(c))return void c.then(v).then(void 0,h);if(!(o=e())||s(o)&&!o.v)return void i(u,1,l);if(o.then)return void o.then(m).then(void 0,h);s(l=n())&&(l=l.v)}while(!l||!l.then);l.then(d).then(void 0,h)}function m(e){e?(l=n())&&l.then?l.then(d).then(void 0,h):d(l):i(u,1,l)}function v(){(o=e())?o.then?o.then(m).then(void 0,h):m(o):i(u,1,l)}}(function(){return!!n._logs.length},void 0,function(){return Promise.resolve(n.sendBatch()).then(function(){})});return Promise.resolve(r&&r.then?r.then(t):t())}catch(e){return Promise.reject(e)}},t.sendBatch=function(){try{var e=this,t=e._logs.splice(0,10);if(!t.length)return Promise.resolve();var n=crypto.randomUUID(),o=function(o,i){try{var a=(s=1e3*(e._options.timeoutInSeconds||30),l=new AbortController,c=setTimeout(function(){return l.abort()},s),Promise.resolve(fetch(e._options.restLoggerUrl,{headers:{"content-type":"application/json"},method:"POST",keepalive:!0,body:JSON.stringify(t),signal:l.signal})).then(function(o){clearTimeout(c),o.ok||e._logger.log({message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})}))}catch(e){return i(e)}var s,l,c;return a&&a.then?a.then(void 0,i):a}(0,function(o){e._logger.log({error:o,message:"Error sending messages to API",content:t,method:"sendBatch",correlationId:n,level:r.Error})});return Promise.resolve(o&&o.then?o.then(function(){}):void 0)}catch(e){return Promise.reject(e)}},e.getException=function(e){return e?{stackTrace:e.stack,message:e.message,className:e.name}:null},e}();l.DEFAULT_BATCH_TIMEOUT=5;var c=/*#__PURE__*/function(){function e(){this.start=void 0,this.end=void 0,this.start=Date.now()}var t,n;return e.prototype.stop=function(){this.end=Date.now()},t=e,(n=[{key:"elapsed",get:function(){return(this.end||Date.now())-this.start}}])&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,"symbol"==typeof(o=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(r.key))?o:String(o),r)}var o}(t.prototype,n),Object.defineProperty(t,"prototype",{writable:!1}),e}(),u=/*#__PURE__*/function(){function e(){}return e.convert=function(e){var t=JSON.stringify(e);return btoa(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},e}(),h=/*#__PURE__*/function(){function e(){}return e.create=function(){var e=[48,32,24,16,15,8,4,1].find(function(e){return e<=screen.colorDepth});return{javaEnabled:navigator.javaEnabled(),javascriptEnabled:!0,language:navigator.language,userAgent:navigator.userAgent,screenWidth:window.screen.width,screenHeight:window.screen.height,timezoneOffset:(new Date).getTimezoneOffset(),colorDepth:e,acceptHeader:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"}},e}(),d=/*#__PURE__*/function(){function e(e){var t=this;this._task=void 0,this._timeout=void 0,this._task=new Promise(function(n){t._timeout=setTimeout(n,e)})}var t=e.prototype;return t.wait=function(){return this._task},t.cancel=function(){clearTimeout(this._timeout),this._task=Promise.reject({message:"Timer cancelled"})},e.sleep=function(t){return new e(t)},e.cancel=function(e){clearTimeout(e)},e}(),m=/*#__PURE__*/function(){function e(){}return e.createIFrame=function(e){var t=document.createElement("iframe");return t.id=e.name,t.name=e.name,e.onReadyFn&&e.onReadyFn(t,e.isVisible),e.onCreatedFn&&(e.onCreatedFn(t),t.style.opacity=e.isVisible?"1":"0"),e.parent.appendChild(t),t},e.createForm=function(e){var t=document.createElement("form");return t.id=e.name,t.name=e.name,t.action=e.actionUrl,t.target=e.target,t.method=e.method,e.parent.appendChild(t),t},e.createInput=function(e){var t=document.createElement("input");return t.id=e.name,t.name=e.name,t.type=e.type,e.parent.appendChild(t),t},e}();function v(e,t,n){if(!e.s){if(n instanceof g){if(!n.s)return void(n.o=v.bind(null,e,t));1&t&&(t=n.s),n=n.v}if(n&&n.then)return void n.then(v.bind(null,e,t),v.bind(null,e,2));e.s=t,e.v=n;var r=e.o;r&&r(e)}}var g=/*#__PURE__*/function(){function e(){}return e.prototype.then=function(t,n){var r=new e,o=this.s;if(o){var i=1&o?t:n;if(i){try{v(r,1,i(this.v))}catch(e){v(r,2,e)}return r}return this}return this.o=function(e){try{var o=e.v;1&e.s?v(r,1,t?t(o):o):n?v(r,1,n(o)):v(r,2,o)}catch(e){v(r,2,e)}},r},e}();function p(e){return e instanceof g&&1&e.s}var f,I=/*#__PURE__*/function(){function e(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}return e.prototype.execute=function(e){var t=this,n=e.executeFn,o=e.method,i=e.correlationId;return new Promise(function(e,a){try{var s,l=function(e){var n;if(s)return e;a(u),t._logger.log({message:'Unhandled error calling "'+o+'"',error:null==(n=u)?void 0:n.error,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Error})},c=1,u=null,h=function(e,t){var n;do{var r=e();if(r&&r.then){if(!p(r)){n=!0;break}r=r.v}var o=t();if(p(o)&&(o=o.v),!o)return r}while(!o.then);var i=new g,a=v.bind(null,i,2);return(n?r.then(s):o.then(l)).then(void 0,a),i;function s(n){for(r=n;p(o=t())&&(o=o.v),o;){if(o.then)return void o.then(l).then(void 0,a);if((r=e())&&r.then){if(!p(r))return void r.then(s).then(void 0,a);r=r.v}}v(i,1,r)}function l(n){if(n){do{if((r=e())&&r.then){if(!p(r))return void r.then(s).then(void 0,a);r=r.v}if(p(n=t())&&(n=n.v),!n)return void v(i,1,r)}while(!n.then);n.then(l).then(void 0,a)}else v(i,1,r)}}(function(){function l(e){return s?e:(c++,Promise.resolve(d.sleep(1e3*t._options.attemptDelayInSeconds).wait()).then(function(){}))}var h=function(r,o){try{var i=Promise.resolve(n({attempt:c,maxAttempts:t._options.maxAttempts})).then(function(t){if(t.isSuccess)return e(t),void(s=1);t.isTransientError||(a(t),s=1)})}catch(e){return o(e)}return i&&i.then?i.then(void 0,o):i}(0,function(e){u={message:'Unhandled error calling "'+o+'"',error:e,additionalData:{attempt:c,maxAttempts:t._options.maxAttempts}},t._logger.log({message:'Unhandled error calling "'+o+'"',error:e,content:{attempt:c,maxAttempts:t._options.maxAttempts},method:o,correlationId:i,level:r.Warning})});return h&&h.then?h.then(l):l(h)},function(){return!s&&c<=t._options.maxAttempts});return Promise.resolve(h&&h.then?h.then(l):l(h))}catch(e){return Promise.reject(e)}})},e}(),_=/*#__PURE__*/function(){function e(e,t,n){void 0===n&&(n=new I(e,t)),this._options=void 0,this._retryPolicy=void 0,this._logger=void 0,this._retryPolicy=n,this._logger=t,this._options=e}var n=e.prototype;return n.send=function(e){try{var n=this,o=n;return Promise.resolve(n._retryPolicy.execute({executeFn:function(i){var a=i.attempt,s=i.maxAttempts;try{var l=function(e){clearTimeout(d);var t={isSuccess:v.ok,isTransientError:n.isTransientError(v),getData:function(){try{return Promise.resolve(v.json()).then(function(e){return e.data})}catch(e){return Promise.reject(e)}}};return t},u=1e3*(o._options.timeoutInSeconds||30),h=new AbortController,d=setTimeout(function(){return h.abort()},u),m=new URL(e.url);n._logger.log({message:"ExternalService - Request ("+m.host+")",content:{request:e,attempt:a,maxAttempts:s},method:"send",correlationId:e.correlationId,level:r.Information});var v,g=new c,p=function(o,i){try{var l=Promise.resolve(fetch(e.url,{headers:t({},e.headers,{"x-attempt":a.toString(),"x-max-attempt":s.toString(),accept:"application/json","content-type":"application/json",correlationId:e.correlationId}),keepalive:!0,body:JSON.stringify(e.body),method:e.method,signal:h.signal})).then(function(t){var o=n._logger,i=o.log,l="ExternalService - Response ("+m.host+")",c=(v=t).status;return Promise.resolve(v.clone().text()).then(function(t){i.call(o,{message:l,content:{request:e,attempt:a,maxAttempts:s,response:{statusCode:c,data:t}},method:"send",correlationId:e.correlationId,level:r.Information,elapsedTimeInMilliseconds:g.elapsed})})})}catch(e){return i(e)}return l&&l.then?l.then(void 0,i):l}(0,function(t){throw n._logger.log({message:"ExternalService - Error ("+m.host+")",content:{request:e,attempt:a,maxAttempts:s,error:t},method:"send",correlationId:e.correlationId,level:r.Error,elapsedTimeInMilliseconds:g.elapsed}),t});return Promise.resolve(p&&p.then?p.then(l):l())}catch(e){return Promise.reject(e)}},method:"["+e.method+"] "+e.url,correlationId:e.correlationId}))}catch(e){return Promise.reject(e)}},n.isTransientError=function(e){return[409,424,500,503,504].includes(e.status)},e}();e.ChallengeWindowSize=void 0,(f=e.ChallengeWindowSize||(e.ChallengeWindowSize={})).width250xheight400="01",f.width390xheight400="02",f.width500xheight600="03",f.width600xheight400="04",f.fullscreen="05";var y=/*#__PURE__*/function(){function t(e,t){this._options=void 0,this._logger=void 0,this._options=e,this._logger=t}var n=t.prototype;return n.execute=function(n){var o=this;return n.authResponse.challengeUrl?new Promise(function(i,a){try{o._logger.log({message:"Challenge - Start",content:{authResponse:n.authResponse},method:"executeChallenge",correlationId:n.correlationId,level:r.Information}),o._options.container.innerHTML="";var s=m.createIFrame({parent:o._options.container,name:t.IFRAME_NAME,isVisible:!0,useDefaultStyle:!!o._options.onIFrameCreatedFn,onCreatedFn:o._options.onIFrameCreatedFn,onReadyFn:o._options.onIFrameReadyFn});o._logger.log({message:"Challenge - Create iFrame",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var l=m.createForm({parent:o._options.container,name:t.FORM_NAME,actionUrl:n.authResponse.challengeUrl,target:t.IFRAME_NAME,method:"post"});o._logger.log({message:"Challenge - Create form",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var h=m.createInput({parent:l,name:t.CREQ_INPUT_NAME,type:t.CREQ_INPUT_TYPE});o._logger.log({message:"Challenge - Create input",method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var d={threeDSServerTransID:n.authResponse.processId,acsTransID:n.authResponse.challengeId,messageVersion:n.authResponse.challengeVersion,messageType:"CReq",challengeWindowSize:o._options.challengeWindowSize||e.ChallengeWindowSize.width250xheight400},v=u.convert(d);h.value=v,o._logger.log({message:"Challenge - Prepare cReq",content:{cReq:d,base64CReq:v},method:"executeChallenge",correlationId:n.correlationId,level:r.Information});var g=new c;l.submit(),setTimeout(function e(){var t,i=s.contentDocument||(null==(t=s.contentWindow)?void 0:t.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):o._logger.log({message:"Challenge - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeChallenge",correlationId:n.correlationId,level:r.Information})},100),o._logger.log({message:"Challenge - Submit form",content:{authResponse:n.authResponse,cReq:d,base64CReq:v},method:"executeChallenge",correlationId:n.correlationId,level:r.Information}),i()}catch(e){return o._logger.log({message:"Challenge - error",content:{authResponse:n.authResponse},error:e,method:"executeChallenge",correlationId:n.correlationId,level:r.Error}),a({message:e.toString()})}}):Promise.resolve()},n.reset=function(){try{var e,n,r;null==(e=document.getElementById(t.IFRAME_NAME))||e.remove(),null==(n=document.getElementById(t.FORM_NAME))||n.remove(),null==(r=document.getElementById(t.CREQ_INPUT_NAME))||r.remove()}catch(e){}},t}();y.IFRAME_NAME="challengeIframe",y.FORM_NAME="challengeForm",y.CREQ_INPUT_NAME="creq",y.CREQ_INPUT_TYPE="hidden";var S=/*#__PURE__*/function(){function e(e,t){this._logger=void 0,this._options=void 0,this._logger=t,this._options=e}var t=e.prototype;return t.execute=function(t){var n=this;return t.preAuthResponse.dsMethodUrl?new Promise(function(o,i){try{var a;n._logger.log({message:"DirectoryServer - Start",content:{preAuthResponse:t},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),n._options.container.innerHTML="";var s=m.createIFrame({parent:n._options.container,isVisible:!1,name:e.IFRAME_NAME,useDefaultStyle:!!n._options.onIFrameCreatedFn});null==(a=n._options.onIFrameCreatedFn)||a.call(n._options,s),n._logger.log({message:"DirectoryServer - Create iFrame",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var l=m.createForm({parent:n._options.container,name:e.FORM_NAME,actionUrl:t.preAuthResponse.dsMethodUrl,target:e.IFRAME_NAME,method:"POST"});n._logger.log({message:"DirectoryServer - Create Form",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var h=m.createInput({parent:l,name:e.FORM_INPUT_NAME,type:e.FROM_INPUT_TYPE});n._logger.log({message:"DirectoryServer - Create Input",method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var d={threeDSServerTransID:t.preAuthResponse.processId,threeDSMethodNotificationURL:t.preAuthResponse.notificationUrl},v=u.convert(d);h.value=v,n._logger.log({message:"DirectoryServer - Prepare threeDSMethodData",content:{threeDSMethodData:d,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information});var g=new c;l.submit(),setTimeout(function e(){var o,i=s.contentDocument||(null==(o=s.contentWindow)?void 0:o.document);"complete"!=(null==i?void 0:i.readyState)?setTimeout(e,100):n._logger.log({message:"DirectoryServer - iFrame loaded in "+g.elapsed+"ms",content:{iFrame:i.body.innerText},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information})},100),n._logger.log({message:"DirectoryServer - Submit form",content:{threeDSMethodData:d,threeDSMethodDataBase64:v},method:"executeDirectoryServer",correlationId:t.correlationId,level:r.Information}),o()}catch(e){return n._logger.log({message:"DirectoryServer - Error",content:{preAuthResponse:t},error:e,method:"directoryServerExecute",correlationId:t.correlationId,level:r.Error}),i({message:e.toString()})}}):Promise.resolve()},t.reset=function(){try{var t,n,r;null==(t=document.getElementById(e.IFRAME_NAME))||t.remove(),null==(n=document.getElementById(e.FORM_NAME))||n.remove(),null==(r=document.getElementById(e.FORM_INPUT_NAME))||r.remove()}catch(e){}},e}();S.IFRAME_NAME="threeDSMethodIframe",S.FORM_NAME="threeDSMethodForm",S.FORM_INPUT_NAME="threeDSMethodData",S.FROM_INPUT_TYPE="hidden";var A=/*#__PURE__*/function(){function e(t,n,r,o,i){void 0===n&&(n=new l(e.getLoggerOptions(t))),void 0===r&&(r=new _(e.getHttpClientOptions(t),n)),void 0===o&&(o=new S(t,n)),void 0===i&&(i=new y(t,n)),this._options=void 0,this._logger=void 0,this._client=void 0,this._directoryServer=void 0,this._challenge=void 0,this._observers=[],this._options=t,this._logger=n,this._client=r,this._directoryServer=o,this._challenge=i}var t=e.prototype;return t.subscribe=function(e){this._observers.push(e)},t.unsubscribe=function(e){var t=this._observers.indexOf(e);t>-1&&this._observers.splice(t,1)},t.execute=function(e,t){try{var n=this;return void 0===t&&(t=crypto.randomUUID()),e.correlationId||(e.correlationId=t,n._logger.log({message:"Obsolete request. CorrelationId is not set.",content:e,method:"execute",correlationId:e.correlationId,level:r.Information})),Promise.resolve(function(t,r){try{var o=Promise.resolve(n.preAuth(e)).then(function(t){return Promise.resolve(n._directoryServer.execute({preAuthResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.auth(e)).then(function(t){return Promise.resolve(n._challenge.execute({authResponse:t,correlationId:e.correlationId})).then(function(){return Promise.resolve(n.postAuth(e))})})})})}catch(e){return r(!0,e)}return o&&o.then?o.then(r.bind(null,!1),r.bind(null,!0)):r(!1,o)}(0,function(e,t){return n.reset(),Promise.resolve(n._logger.flush()).then(function(){if(e)throw t;return t})}))}catch(e){return Promise.reject(e)}},t.preAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PreAuth",content:e,method:"_preAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"preAuth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/preAuth",method:"POST",body:{browser:h.create()},correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"preAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.auth=function(e){try{var t=this;return t._logger.log({message:"Executing Auth",content:e,method:"_auth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"auth:started",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v1/"+e.id+"/auth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"auth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.postAuth=function(e){try{var t=this;return t._logger.log({message:"Executing PostAuth",content:e,method:"_postAuth",correlationId:e.correlationId,level:r.Information}),t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(t._client.send({url:t._options.threeDSecureUrl+"/api/v2/"+e.id+"/postAuth",method:"POST",correlationId:e.correlationId})).then(function(e){return t.notifyAll({name:"postAuth:completed",data:e}),Promise.resolve(e.getData())})}catch(e){return Promise.reject(e)}},t.reset=function(){this.notifyAll({name:"reset:started"}),this._challenge.reset(),this._directoryServer.reset(),this.notifyAll({name:"reset:completed"})},t.notifyAll=function(e){this._observers.forEach(function(t){return t.notify(e)})},e.getLoggerOptions=function(e){return{restLoggerUrl:e.logUrl,timeoutInSeconds:e.timeoutInSeconds||30,environment:e.environment||"Production",batchLogIntervalInSeconds:e.batchLogIntervalInSeconds||5,service:{name:"Paybyrd.ThreeDSecure.JS",version:"3.2.1"}}},e.getHttpClientOptions=function(e){return{timeoutInSeconds:e.timeoutInSeconds||30,attemptDelayInSeconds:e.attemptDelayInSeconds||2,maxAttempts:e.maxAttempts||50}},e}();e.LinearRetryPolicy=I,e.ThreeDSecureService=A}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "@paybyrd/threedsecure-service", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "JS service implementation to control the 3DS flow over Paybyrd API", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
268081