Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@paybyrd/threedsecure-service

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@paybyrd/threedsecure-service - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

dist/threedsecure-service.min.js

@@ -1,1 +0,1 @@

function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function define(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function wrap(a,b,c,d){var e=b&&b.prototype instanceof Generator?b:Generator,f=Object.create(e.prototype),g=new Context(d||[]);return f._invoke=function(a,b,c){var d="suspendedStart";return function(e,f){if("executing"===d)throw new Error("Generator is already running");if("completed"===d){if("throw"===e)throw f;return doneResult()}for(c.method=e,c.arg=f;;){var g=c.delegate;if(g){var i=maybeInvokeDelegate(g,c);if(i){if(i===h)continue;return i}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===d)throw d="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);d="executing";var j=tryCatch(a,b,c);if("normal"===j.type){if(d=c.done?"completed":"suspendedYield",j.arg===h)continue;return{value:j.arg,done:c.done}}"throw"===j.type&&(d="completed",c.method="throw",c.arg=j.arg)}}}(a,c,g),f}function tryCatch(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(a){["next","throw","return"].forEach(function(b){define(a,b,function(a){return this._invoke(b,a)})})}function AsyncIterator(a,b){function invoke(d,e,f,g){var h=tryCatch(a[d],a,e);if("throw"!==h.type){var i=h.arg,j=i.value;return j&&"object"==_typeof(j)&&c.call(j,"__await")?b.resolve(j.__await).then(function(a){invoke("next",a,f,g)},function(a){invoke("throw",a,f,g)}):b.resolve(j).then(function(a){i.value=a,f(i)},function(a){return invoke("throw",a,f,g)})}g(h.arg)}var d;this._invoke=function(a,c){function callInvokeWithMethodAndArg(){return new b(function(b,d){invoke(a,c,b,d)})}return d=d?d.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(a,b){var c=a.iterator[b.method];if(void 0===c){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,maybeInvokeDelegate(a,b),"throw"===b.method))return h;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var d=tryCatch(c,a.iterator,b.arg);if("throw"===d.type)return b.method="throw",b.arg=d.arg,b.delegate=null,h;var e=d.arg;return e?e.done?(b[a.resultName]=e.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,h):e:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,h)}function pushTryEntry(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function resetTryEntry(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function Context(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(pushTryEntry,this),this.reset(!0)}function values(a){if(a){var b=a[e];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var d=-1,f=function next(){for(;++d<a.length;)if(c.call(a,d))return next.value=a[d],next.done=!1,next;return next.value=void 0,next.done=!0,next};return f.next=f}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function _regeneratorRuntime(){return a};var a={},b=Object.prototype,c=b.hasOwnProperty,d="function"==typeof Symbol?Symbol:{},e=d.iterator||"@@iterator",f=d.asyncIterator||"@@asyncIterator",g=d.toStringTag||"@@toStringTag";try{define({},"")}catch(a){define=function define(a,b,c){return a[b]=c}}a.wrap=wrap;var h={},i={};define(i,e,function(){return this});var j=Object.getPrototypeOf,k=j&&j(j(values([])));k&&k!==b&&c.call(k,e)&&(i=k);var l=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(i);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(l,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,g,"GeneratorFunction"),a.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===GeneratorFunction||"GeneratorFunction"===(b.displayName||b.name))},a.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,define(a,g,"GeneratorFunction")),a.prototype=Object.create(l),a},a.awrap=function(a){return{__await:a}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,f,function(){return this}),a.AsyncIterator=AsyncIterator,a.async=function(b,c,d,e,f){void 0===f&&(f=Promise);var g=new AsyncIterator(wrap(b,c,d,e),f);return a.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},defineIteratorMethods(l),define(l,g,"Generator"),define(l,e,function(){return this}),define(l,"toString",function(){return"[object Generator]"}),a.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function next(){for(;b.length;){var c=b.pop();if(c in a)return next.value=c,next.done=!1,next}return next.done=!0,next}},a.values=values,Context.prototype={constructor:Context,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!a)for(var b in this)"t"===b.charAt(0)&&c.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function handle(c,d){return f.type="throw",f.arg=a,b.next=c,d&&(b.method="next",b.arg=void 0),!!d}if(this.done)throw a;for(var b=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return handle("end");if(e.tryLoc<=this.prev){var g=c.call(e,"catchLoc"),h=c.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return handle(e.catchLoc,!0);if(this.prev<e.finallyLoc)return handle(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return handle(e.finallyLoc)}else if(this.prev<e.catchLoc)return handle(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&c.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===a||"continue"===a)&&f.tryLoc<=b&&b<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=a,g.arg=b,f?(this.method="next",this.next=f.finallyLoc,h):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),h},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),resetTryEntry(b),h},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;resetTryEntry(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:values(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),h}},a}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function _next(a){asyncGeneratorStep(f,d,e,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(f,d,e,_next,_throw,"throw",a)}var f=a.apply(b,c);_next(void 0)})}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}var ThreeDSecureService=/*#__PURE__*/function(){function ThreeDSecureService(a){var b=a.threeDSecureUrl,c=a.container,d=a.maxAttempts,e=a.attemptDelay,f=a.culture,g=a.onProgressFn,h=a.onIFrameCreatedFn,i=a.onContainerCreatedFn;_classCallCheck(this,ThreeDSecureService),this._onProgressFn=g,this._maxAttempts=d||50,this._attemptDelay=e||2e3,this._threeDSecureUrl=b||"https://threedsecure.paybyrd.com",this._culture=f||"en-US",this._container=c||document.body,this._onIFrameCreatedFn=h,this._onContainerCreatedFn=i,this.IFRAME_DSMETHOD_NAME="threeDSMethodIframe",this.FORM_DSMETHOD_NAME="threeDSMethodForm",this.IFRAME_CHALLENGE_NAME="challengeIframe",this.FORM_CHALLENGE_NAME="challengeForm",this._fixContainer()}return _createClass(ThreeDSecureService,[{key:"createAndExecute",value:function createAndExecute(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:crypto.randomUUID();return this.create(a,c).then(function(a){return b.preAuth(a,c)}).then(function(a){return b.auth(a,c)}).then(function(a){return b.postAuth(a,c)}).then(function(a){return _objectSpread(_objectSpread({},a),{},{correlationId:c})})["catch"](function(a){return b._onProgress({type:"event:error",error:a}),Promise.reject(_objectSpread(_objectSpread({},a),{},{correlationId:c}))})["finally"](this._destroy.bind(this))}},{key:"execute",value:function execute(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:crypto.randomUUID();return this.preAuthV2(a,c).then(function(a){return b.auth(a,c)}).then(function(a){return b.postAuthV2(a,c)}).then(function(a){return _objectSpread(_objectSpread({},a),{},{correlationId:c})})["catch"](function(d){return b._onProgress({type:"event:error",error:d}),b.postAuthV2(a,c)["catch"](function(a){return b._onProgress({type:"event:error",error:a}),Promise.reject(_objectSpread(_objectSpread({},a),{},{correlationId:c}))})})["finally"](this._destroy.bind(this))}},{key:"create",value:function create(a,b){var c=this;return this._retry(this._isTransientStatusCode.bind(this),function(d){return c._sendRequest({path:"/api/v1",method:"POST",payload:_objectSpread(_objectSpread({},a),{},{browser:c._getBrowserData()}),correlationId:b,attempt:d})},"event:create")}},{key:"preAuthV2",value:function preAuthV2(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v2/".concat(d,"/preauth"),payload:{browser:c._getBrowserData()},method:"POST",correlationId:b,attempt:a})},"event:preAuth").then(function(a){return a.isDsMethodRequired?c._executeDsMethod(a).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"preAuth",value:function preAuth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/preauth"),method:"POST",correlationId:b,attempt:a})},"event:preAuth").then(function(a){return a.isDsMethodRequired?c._executeDsMethod(a).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"auth",value:function auth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/auth"),method:"POST",correlationId:b,attempt:a})},"event:auth").then(function(a){return a.isChallengeRequired?("1.0.0"===a.challengeVersion?c._executeChallengeV1(a):c._executeChallengeV2(a)).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"postAuth",value:function postAuth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/postAuth"),method:"POST",correlationId:b,attempt:a})},"event:postAuth")}},{key:"postAuthV2",value:function postAuthV2(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v2/".concat(d,"/postAuth"),method:"POST",correlationId:b,attempt:a})},"event:postAuth").then(function(a){return"Authorized"!==a.status&&c._onProgress({type:"event:error",error:a}),a})}},{key:"_executeDsMethod",value:function _executeDsMethod(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:dsMethod:start"});var e=b.IFRAME_DSMETHOD_NAME,f=b.FORM_DSMETHOD_NAME;b._createIFrame(e,!1);var g=b._createForm(f,a.dsMethodUrl,e),h=b._createInput(g,"threeDSMethodData","hidden"),i={threeDSServerTransID:a.processId,threeDSMethodNotificationURL:a.notificationUrl};h.value=b._convertToBase64UriJson(i),g.submit(),b._onProgress({type:"event:dsMethod:success"}),c()}catch(a){return b._onProgress({type:"event:dsMethod:fail"}),d({message:a.toString()})}})}},{key:"_executeChallengeV1",value:function _executeChallengeV1(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:challenge:v1:start"});var e=b.IFRAME_CHALLENGE_NAME,f=b.FORM_CHALLENGE_NAME,g="hidden";b._createIFrame(e);var h=b._createForm(f,a.challengeUrl,e,"post"),i=b._createInput(h,"PaReq",g),j=b._createInput(h,"TermUrl",g);i.value=a.preAuthRequest,j.value=a.notificationUrl,h.submit(),c(),b._onProgress({type:"event:challenge:v1:success"})}catch(a){return b._onProgress({type:"event:challenge:v1:fail",error:a}),d({message:a.toString()})}})}},{key:"_executeChallengeV2",value:function _executeChallengeV2(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:challenge:v2:start"});var e=b.IFRAME_CHALLENGE_NAME,f=b.FORM_CHALLENGE_NAME,g="hidden";b._createIFrame(e);var j=b._createForm(f,a.challengeUrl,e,"post");b._createInput(j,"threeDSSessionData",g);var h=b._createInput(j,"creq",g),i={threeDSServerTransID:a.processId,acsTransID:a.challengeId,messageVersion:a.challengeVersion,messageType:"CReq",challengeWindowSize:"01"};h.value=b._convertToBase64UriJson(i),j.submit(),c(),b._onProgress({type:"event:challenge:v2:success"})}catch(a){return b._onProgress({type:"event:challenge:v2:fail",error:a}),d({message:a.toString()})}})}},{key:"_delay",value:function _delay(a){var b=this;return this._onProgress({type:"event:delay:start",data:{timeout:a}}),new Promise(function(c){setTimeout(function(){b._onProgress({type:"event:delay:end",data:{timeout:a}}),c()},a)})}},{key:"_fixContainer",value:function _fixContainer(){return this._onContainerCreatedFn?void this._onContainerCreatedFn(this._container):void this._container.setAttribute("style","position: relative; overflow: hidden;")}},{key:"_createForm",value:function _createForm(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"POST",e=document.createElement("form");return e.id=a,e.name=a,e.action=b,e.target=c,e.method=d,this._container.appendChild(e),e}},{key:"_createInput",value:function _createInput(a,b,c){var d=document.createElement("input");return d.id=b,d.name=b,d.type=c,a.appendChild(d),d}},{key:"_createIFrame",value:function _createIFrame(a){var b=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],c=document.createElement("iframe");return c.id=a,c.name=a,this._onIFrameCreatedFn?(this._onIFrameCreatedFn(c),c.style.opacity=b?1:0):c.setAttribute("style","border: none;position: absolute; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%;opacity: ".concat(b?"1":"0")),this._container.appendChild(c),c}},{key:"_getBrowserData",value:function _getBrowserData(){var a=[48,32,24,16,15,8,4,1].find(function(a){return a<=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:a,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"}}},{key:"_retry",value:function _retry(a,b,c){var d=this;return new Promise(/*#__PURE__*/function(){var e=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e,f){var g,h,i,j,k;return _regeneratorRuntime().wrap(function _callee$(l){for(;1;)switch(l.prev=l.next){case 0:j=null,k=1;case 2:return l.prev=2,d._onProgress({type:"".concat(c,":start"),data:{attempt:k}}),l.prev=4,l.next=7,b(k);case 7:j=l.sent,l.next=14;break;case 10:l.prev=10,l.t0=l["catch"](4),d._onProgress({type:"".concat(c,":error"),error:l.t0.data,data:{statusCode:l.t0.status}}),j=l.t0;case 14:if(!j.isSuccess){l.next=18;break}return d._onProgress({type:"".concat(c,":success"),data:j.data.data}),e(j.data.data),l.abrupt("return");case 18:l.next=23;break;case 20:l.prev=20,l.t1=l["catch"](2),d._onProgress({type:"".concat(c,":error"),error:l.t1});case 23:return k++,l.next=26,d._delay(d._attemptDelay);case 26:if(k<=d._maxAttempts&&a(j)){l.next=2;break}case 27:d._onProgress({type:"".concat(c,":fail"),error:null===(g=j.data)||void 0===g?void 0:g.error}),f(null!==(h=null===(i=j.data)||void 0===i?void 0:i.error)&&void 0!==h?h:{message:"Unhandled error"});case 29:case"end":return l.stop();}},_callee,null,[[2,20],[4,10]])}));return function(a,b){return e.apply(this,arguments)}}())}},{key:"_onProgress",value:function _onProgress(a){var b=this;this._safeExecute(function(){var c;return null===(c=b._onProgressFn)||void 0===c?void 0:c.call(null,a)})}},{key:"_isTransientStatusCode",value:function _isTransientStatusCode(a){return this._safeExecute(function(){return 409===a.status||424===a.status||500==a.status||503==a.status||504===a.status},!0)}},{key:"_convertToBase64UriJson",value:function _convertToBase64UriJson(a){var b=JSON.stringify(a),c=btoa(b),d=c.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");return d}},{key:"_sendRequest",value:function(){function _sendRequest(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(a){var b,c,d,e,f,g,h,i;return _regeneratorRuntime().wrap(function _callee2$(j){for(;1;)switch(j.prev=j.next){case 0:return b=a.path,c=a.method,d=a.payload,e=a.correlationId,f=a.attempt,j.prev=1,g=new AbortController,h=setTimeout(function(){return g.abort()},3e4),j.next=6,fetch("".concat(this._threeDSecureUrl).concat(b),{headers:{correlationId:e,"x-attempt":f,"x-max-attempt":this._maxAttempts,accept:"application/json","content-type":"application/json","accept-language":this._culture},keepalive:!0,body:JSON.stringify(d),method:c,signal:g.signal});case 6:return i=j.sent,clearTimeout(h),j.t0=i.ok,j.t1=i.status,j.next=12,i.json();case 12:return j.t2=j.sent,j.abrupt("return",{isSuccess:j.t0,status:j.t1,data:j.t2});case 16:return j.prev=16,j.t3=j["catch"](1),j.abrupt("return",{isSuccess:!1,status:500,data:{message:j.t3.toString()}});case 19:case"end":return j.stop();}},_callee2,this,[[1,16]])}));return _sendRequest}()},{key:"_destroy",value:function _destroy(){var a=this;this._safeExecute(function(){var b;return null===(b=document.getElementById(a.IFRAME_DSMETHOD_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.FORM_DSMETHOD_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.IFRAME_CHALLENGE_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.FORM_CHALLENGE_NAME))||void 0===b?void 0:b.remove()})}},{key:"_safeExecute",value:function _safeExecute(a,b){try{return a()}catch(a){return console.log(a),b}}}]),ThreeDSecureService}();export{ThreeDSecureService as default};
function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */function define(a,b,c){return Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}),a[b]}function wrap(a,b,c,d){var e=b&&b.prototype instanceof Generator?b:Generator,f=Object.create(e.prototype),g=new Context(d||[]);return f._invoke=function(a,b,c){var d="suspendedStart";return function(e,f){if("executing"===d)throw new Error("Generator is already running");if("completed"===d){if("throw"===e)throw f;return doneResult()}for(c.method=e,c.arg=f;;){var g=c.delegate;if(g){var i=maybeInvokeDelegate(g,c);if(i){if(i===h)continue;return i}}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if("suspendedStart"===d)throw d="completed",c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);d="executing";var j=tryCatch(a,b,c);if("normal"===j.type){if(d=c.done?"completed":"suspendedYield",j.arg===h)continue;return{value:j.arg,done:c.done}}"throw"===j.type&&(d="completed",c.method="throw",c.arg=j.arg)}}}(a,c,g),f}function tryCatch(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(a){return{type:"throw",arg:a}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(a){["next","throw","return"].forEach(function(b){define(a,b,function(a){return this._invoke(b,a)})})}function AsyncIterator(a,b){function invoke(d,e,f,g){var h=tryCatch(a[d],a,e);if("throw"!==h.type){var i=h.arg,j=i.value;return j&&"object"==_typeof(j)&&c.call(j,"__await")?b.resolve(j.__await).then(function(a){invoke("next",a,f,g)},function(a){invoke("throw",a,f,g)}):b.resolve(j).then(function(a){i.value=a,f(i)},function(a){return invoke("throw",a,f,g)})}g(h.arg)}var d;this._invoke=function(a,c){function callInvokeWithMethodAndArg(){return new b(function(b,d){invoke(a,c,b,d)})}return d=d?d.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(a,b){var c=a.iterator[b.method];if(void 0===c){if(b.delegate=null,"throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=void 0,maybeInvokeDelegate(a,b),"throw"===b.method))return h;b.method="throw",b.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var d=tryCatch(c,a.iterator,b.arg);if("throw"===d.type)return b.method="throw",b.arg=d.arg,b.delegate=null,h;var e=d.arg;return e?e.done?(b[a.resultName]=e.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=void 0),b.delegate=null,h):e:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,h)}function pushTryEntry(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]),2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]),this.tryEntries.push(b)}function resetTryEntry(a){var b=a.completion||{};b.type="normal",delete b.arg,a.completion=b}function Context(a){this.tryEntries=[{tryLoc:"root"}],a.forEach(pushTryEntry,this),this.reset(!0)}function values(a){if(a){var b=a[e];if(b)return b.call(a);if("function"==typeof a.next)return a;if(!isNaN(a.length)){var d=-1,f=function next(){for(;++d<a.length;)if(c.call(a,d))return next.value=a[d],next.done=!1,next;return next.value=void 0,next.done=!0,next};return f.next=f}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function _regeneratorRuntime(){return a};var a={},b=Object.prototype,c=b.hasOwnProperty,d="function"==typeof Symbol?Symbol:{},e=d.iterator||"@@iterator",f=d.asyncIterator||"@@asyncIterator",g=d.toStringTag||"@@toStringTag";try{define({},"")}catch(a){define=function define(a,b,c){return a[b]=c}}a.wrap=wrap;var h={},i={};define(i,e,function(){return this});var j=Object.getPrototypeOf,k=j&&j(j(values([])));k&&k!==b&&c.call(k,e)&&(i=k);var l=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(i);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(l,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,g,"GeneratorFunction"),a.isGeneratorFunction=function(a){var b="function"==typeof a&&a.constructor;return!!b&&(b===GeneratorFunction||"GeneratorFunction"===(b.displayName||b.name))},a.mark=function(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,GeneratorFunctionPrototype):(a.__proto__=GeneratorFunctionPrototype,define(a,g,"GeneratorFunction")),a.prototype=Object.create(l),a},a.awrap=function(a){return{__await:a}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,f,function(){return this}),a.AsyncIterator=AsyncIterator,a.async=function(b,c,d,e,f){void 0===f&&(f=Promise);var g=new AsyncIterator(wrap(b,c,d,e),f);return a.isGeneratorFunction(c)?g:g.next().then(function(a){return a.done?a.value:g.next()})},defineIteratorMethods(l),define(l,g,"Generator"),define(l,e,function(){return this}),define(l,"toString",function(){return"[object Generator]"}),a.keys=function(a){var b=[];for(var c in a)b.push(c);return b.reverse(),function next(){for(;b.length;){var c=b.pop();if(c in a)return next.value=c,next.done=!1,next}return next.done=!0,next}},a.values=values,Context.prototype={constructor:Context,reset:function reset(a){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!a)for(var b in this)"t"===b.charAt(0)&&c.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=void 0)},stop:function stop(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;return this.rval},dispatchException:function dispatchException(a){function handle(c,d){return f.type="throw",f.arg=a,b.next=c,d&&(b.method="next",b.arg=void 0),!!d}if(this.done)throw a;for(var b=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return handle("end");if(e.tryLoc<=this.prev){var g=c.call(e,"catchLoc"),h=c.call(e,"finallyLoc");if(g&&h){if(this.prev<e.catchLoc)return handle(e.catchLoc,!0);if(this.prev<e.finallyLoc)return handle(e.finallyLoc)}else if(!g){if(!h)throw new Error("try statement without catch or finally");if(this.prev<e.finallyLoc)return handle(e.finallyLoc)}else if(this.prev<e.catchLoc)return handle(e.catchLoc,!0)}}},abrupt:function abrupt(a,b){for(var d,e=this.tryEntries.length-1;0<=e;--e)if(d=this.tryEntries[e],d.tryLoc<=this.prev&&c.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var f=d;break}f&&("break"===a||"continue"===a)&&f.tryLoc<=b&&b<=f.finallyLoc&&(f=null);var g=f?f.completion:{};return g.type=a,g.arg=b,f?(this.method="next",this.next=f.finallyLoc,h):this.complete(g)},complete:function complete(a,b){if("throw"===a.type)throw a.arg;return"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b),h},finish:function finish(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.finallyLoc===a)return this.complete(b.completion,b.afterLoc),resetTryEntry(b),h},catch:function _catch(a){for(var b,c=this.tryEntries.length-1;0<=c;--c)if(b=this.tryEntries[c],b.tryLoc===a){var d=b.completion;if("throw"===d.type){var e=d.arg;resetTryEntry(b)}return e}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(a,b,c){return this.delegate={iterator:values(a),resultName:b,nextLoc:c},"next"===this.method&&(this.arg=void 0),h}},a}function asyncGeneratorStep(a,b,c,d,e,f,g){try{var h=a[f](g),i=h.value}catch(a){return void c(a)}h.done?b(i):Promise.resolve(i).then(d,e)}function _asyncToGenerator(a){return function(){var b=this,c=arguments;return new Promise(function(d,e){function _next(a){asyncGeneratorStep(f,d,e,_next,_throw,"next",a)}function _throw(a){asyncGeneratorStep(f,d,e,_next,_throw,"throw",a)}var f=a.apply(b,c);_next(void 0)})}}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}var ThreeDSecureService=/*#__PURE__*/function(){function ThreeDSecureService(a){var b=a.threeDSecureUrl,c=a.container,d=a.maxAttempts,e=a.attemptDelay,f=a.culture,g=a.onProgressFn,h=a.onIFrameCreatedFn,i=a.onContainerCreatedFn;_classCallCheck(this,ThreeDSecureService),this._onProgressFn=g,this._maxAttempts=d||50,this._attemptDelay=e||2e3,this._threeDSecureUrl=b||"https://threedsecure.paybyrd.com",this._culture=f||"en-US",this._container=c||document.body,this._onIFrameCreatedFn=h,this._onContainerCreatedFn=i,this.IFRAME_DSMETHOD_NAME="threeDSMethodIframe",this.FORM_DSMETHOD_NAME="threeDSMethodForm",this.IFRAME_CHALLENGE_NAME="challengeIframe",this.FORM_CHALLENGE_NAME="challengeForm",this._fixContainer()}return _createClass(ThreeDSecureService,[{key:"createAndExecute",value:function createAndExecute(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:crypto.randomUUID();return this.create(a,c).then(function(a){return b.preAuth(a,c)}).then(function(a){return b.auth(a,c)}).then(function(a){return b.postAuth(a,c)}).then(function(a){return _objectSpread(_objectSpread({},a),{},{correlationId:c})})["catch"](function(a){return b._onProgress({type:"event:error",error:a}),Promise.reject(_objectSpread(_objectSpread({},a),{},{correlationId:c}))})["finally"](this._destroy.bind(this))}},{key:"execute",value:function execute(a){var b=this,c=1<arguments.length&&void 0!==arguments[1]?arguments[1]:crypto.randomUUID();return this.preAuthV2(a,c).then(function(a){return b.auth(a,c)}).then(function(a){return b.postAuthV2(a,c)}).then(function(a){return _objectSpread(_objectSpread({},a),{},{correlationId:c})})["catch"](function(d){return b._onProgress({type:"event:error",error:d}),b.postAuthV2(a,c)["catch"](function(a){return b._onProgress({type:"event:error",error:a}),Promise.reject(_objectSpread(_objectSpread({},a),{},{correlationId:c}))})})["finally"](this._destroy.bind(this))}},{key:"create",value:function create(a,b){var c=this;return this._retry(this._isTransientStatusCode.bind(this),function(d){return c._sendRequest({path:"/api/v1",method:"POST",payload:_objectSpread(_objectSpread({},a),{},{browser:c._getBrowserData()}),correlationId:b,attempt:d})},"event:create")}},{key:"preAuthV2",value:function preAuthV2(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v2/".concat(d,"/preauth"),payload:{browser:c._getBrowserData()},method:"POST",correlationId:b,attempt:a})},"event:preAuth").then(function(a){return a.isDsMethodRequired?c._executeDsMethod(a).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"preAuth",value:function preAuth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/preauth"),method:"POST",correlationId:b,attempt:a})},"event:preAuth").then(function(a){return a.isDsMethodRequired?c._executeDsMethod(a).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"auth",value:function auth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/auth"),method:"POST",correlationId:b,attempt:a})},"event:auth").then(function(a){return a.isChallengeRequired?("1.0.0"===a.challengeVersion?c._executeChallengeV1(a):c._executeChallengeV2(a)).then(function(){return _objectSpread({id:d},a)}):_objectSpread({id:d},a)})}},{key:"postAuth",value:function postAuth(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v1/".concat(d,"/postAuth"),method:"POST",correlationId:b,attempt:a})},"event:postAuth")}},{key:"postAuthV2",value:function postAuthV2(a,b){var c=this,d=a.id;return this._retry(this._isTransientStatusCode.bind(this),function(a){return c._sendRequest({path:"/api/v2/".concat(d,"/postAuth"),method:"POST",correlationId:b,attempt:a})},"event:postAuth").then(function(a){return"Authorized"!==a.status&&c._onProgress({type:"event:error",error:a}),a})}},{key:"_executeDsMethod",value:function _executeDsMethod(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:dsMethod:start"});var e=b.IFRAME_DSMETHOD_NAME,f=b.FORM_DSMETHOD_NAME;b._container.innerHTML="",b._createIFrame(e,!1);var g=b._createForm(f,a.dsMethodUrl,e),h=b._createInput(g,"threeDSMethodData","hidden"),i={threeDSServerTransID:a.processId,threeDSMethodNotificationURL:a.notificationUrl};h.value=b._convertToBase64UriJson(i),g.submit(),b._onProgress({type:"event:dsMethod:success"}),c()}catch(a){return b._onProgress({type:"event:dsMethod:fail"}),d({message:a.toString()})}})}},{key:"_executeChallengeV1",value:function _executeChallengeV1(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:challenge:v1:start"});var e=b.IFRAME_CHALLENGE_NAME,f=b.FORM_CHALLENGE_NAME,g="hidden";b._container.innerHTML="",b._createIFrame(e);var h=b._createForm(f,a.challengeUrl,e,"post"),i=b._createInput(h,"PaReq",g),j=b._createInput(h,"TermUrl",g);i.value=a.preAuthRequest,j.value=a.notificationUrl,h.submit(),c(),b._onProgress({type:"event:challenge:v1:success"})}catch(a){return b._onProgress({type:"event:challenge:v1:fail",error:a}),d({message:a.toString()})}})}},{key:"_executeChallengeV2",value:function _executeChallengeV2(a){var b=this;return new Promise(function(c,d){try{b._onProgress({type:"event:challenge:v2:start"});var e=b.IFRAME_CHALLENGE_NAME,f=b.FORM_CHALLENGE_NAME,g="hidden";b._container.innerHTML="",b._createIFrame(e);var j=b._createForm(f,a.challengeUrl,e,"post");b._createInput(j,"threeDSSessionData",g);var h=b._createInput(j,"creq",g),i={threeDSServerTransID:a.processId,acsTransID:a.challengeId,messageVersion:a.challengeVersion,messageType:"CReq",challengeWindowSize:"01"};h.value=b._convertToBase64UriJson(i),j.submit(),c(),b._onProgress({type:"event:challenge:v2:success"})}catch(a){return b._onProgress({type:"event:challenge:v2:fail",error:a}),d({message:a.toString()})}})}},{key:"_delay",value:function _delay(a){var b=this;return this._onProgress({type:"event:delay:start",data:{timeout:a}}),new Promise(function(c){setTimeout(function(){b._onProgress({type:"event:delay:end",data:{timeout:a}}),c()},a)})}},{key:"_fixContainer",value:function _fixContainer(){return this._onContainerCreatedFn?void this._onContainerCreatedFn(this._container):void this._container.setAttribute("style","position: relative; overflow: hidden;")}},{key:"_createForm",value:function _createForm(a,b,c){var d=3<arguments.length&&void 0!==arguments[3]?arguments[3]:"POST",e=document.createElement("form");return e.id=a,e.name=a,e.action=b,e.target=c,e.method=d,this._container.appendChild(e),e}},{key:"_createInput",value:function _createInput(a,b,c){var d=document.createElement("input");return d.id=b,d.name=b,d.type=c,a.appendChild(d),d}},{key:"_createIFrame",value:function _createIFrame(a){var b=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],c=document.createElement("iframe");return c.id=a,c.name=a,this._onIFrameCreatedFn?(this._onIFrameCreatedFn(c),c.style.opacity=b?1:0):c.setAttribute("style","border: none;position: absolute; top: 0; left: 0; bottom: 0; right: 0; width: 100%; height: 100%;opacity: ".concat(b?"1":"0")),this._container.appendChild(c),c}},{key:"_getBrowserData",value:function _getBrowserData(){var a=[48,32,24,16,15,8,4,1].find(function(a){return a<=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:a,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"}}},{key:"_retry",value:function _retry(a,b,c){var d=this;return new Promise(/*#__PURE__*/function(){var e=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(e,f){var g,h,i,j,k;return _regeneratorRuntime().wrap(function _callee$(l){for(;1;)switch(l.prev=l.next){case 0:j=null,k=1;case 2:return l.prev=2,d._onProgress({type:"".concat(c,":start"),data:{attempt:k}}),l.prev=4,l.next=7,b(k);case 7:j=l.sent,l.next=14;break;case 10:l.prev=10,l.t0=l["catch"](4),d._onProgress({type:"".concat(c,":error"),error:l.t0.data,data:{statusCode:l.t0.status}}),j=l.t0;case 14:if(!j.isSuccess){l.next=18;break}return d._onProgress({type:"".concat(c,":success"),data:j.data.data}),e(j.data.data),l.abrupt("return");case 18:l.next=23;break;case 20:l.prev=20,l.t1=l["catch"](2),d._onProgress({type:"".concat(c,":error"),error:l.t1});case 23:return k++,l.next=26,d._delay(d._attemptDelay);case 26:if(k<=d._maxAttempts&&a(j)){l.next=2;break}case 27:d._onProgress({type:"".concat(c,":fail"),error:null===(g=j.data)||void 0===g?void 0:g.error}),f(null!==(h=null===(i=j.data)||void 0===i?void 0:i.error)&&void 0!==h?h:{message:"Unhandled error"});case 29:case"end":return l.stop();}},_callee,null,[[2,20],[4,10]])}));return function(a,b){return e.apply(this,arguments)}}())}},{key:"_onProgress",value:function _onProgress(a){var b=this;this._safeExecute(function(){var c;return null===(c=b._onProgressFn)||void 0===c?void 0:c.call(null,a)})}},{key:"_isTransientStatusCode",value:function _isTransientStatusCode(a){return this._safeExecute(function(){return 409===a.status||424===a.status||500==a.status||503==a.status||504===a.status},!0)}},{key:"_convertToBase64UriJson",value:function _convertToBase64UriJson(a){var b=JSON.stringify(a),c=btoa(b),d=c.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_");return d}},{key:"_sendRequest",value:function(){function _sendRequest(b){return a.apply(this,arguments)}var a=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(a){var b,c,d,e,f,g,h,i;return _regeneratorRuntime().wrap(function _callee2$(j){for(;1;)switch(j.prev=j.next){case 0:return b=a.path,c=a.method,d=a.payload,e=a.correlationId,f=a.attempt,j.prev=1,g=new AbortController,h=setTimeout(function(){return g.abort()},3e4),j.next=6,fetch("".concat(this._threeDSecureUrl).concat(b),{headers:{correlationId:e,"x-attempt":f,"x-max-attempt":this._maxAttempts,accept:"application/json","content-type":"application/json","accept-language":this._culture},keepalive:!0,body:JSON.stringify(d),method:c,signal:g.signal});case 6:return i=j.sent,clearTimeout(h),j.t0=i.ok,j.t1=i.status,j.next=12,i.json();case 12:return j.t2=j.sent,j.abrupt("return",{isSuccess:j.t0,status:j.t1,data:j.t2});case 16:return j.prev=16,j.t3=j["catch"](1),j.abrupt("return",{isSuccess:!1,status:500,data:{message:j.t3.toString()}});case 19:case"end":return j.stop();}},_callee2,this,[[1,16]])}));return _sendRequest}()},{key:"_destroy",value:function _destroy(){var a=this;this._safeExecute(function(){var b;return null===(b=document.getElementById(a.IFRAME_DSMETHOD_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.FORM_DSMETHOD_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.IFRAME_CHALLENGE_NAME))||void 0===b?void 0:b.remove()}),this._safeExecute(function(){var b;return null===(b=document.getElementById(a.FORM_CHALLENGE_NAME))||void 0===b?void 0:b.remove()})}},{key:"_safeExecute",value:function _safeExecute(a,b){try{return a()}catch(a){return console.log(a),b}}}]),ThreeDSecureService}();export{ThreeDSecureService as default};
{
"name": "@paybyrd/threedsecure-service",
"version": "2.0.0",
"version": "2.0.1",
"description": "JS service implementation to control the 3DS flow over Paybyrd API",

@@ -5,0 +5,0 @@ "main": "dist/threedsecure-service.min.js",

@@ -228,2 +228,4 @@ export default class ThreeDSecureService {

this._container.innerHTML = '';
this._createIFrame(iframeName, false);

@@ -270,2 +272,4 @@ const form = this._createForm(formName, preAuthResponse.dsMethodUrl, iframeName);

this._container.innerHTML = '';
this._createIFrame(iframeName);

@@ -327,2 +331,4 @@ const form = this._createForm(

this._container.innerHTML = '';
this._createIFrame(iframeName);

@@ -329,0 +335,0 @@ const form = this._createForm(

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc