UNPKG

@adyen/adyen-web

Version:

[![npm](https://img.shields.io/npm/v/@adyen/adyen-web.svg)](https://www.npmjs.com/package/@adyen/adyen-web)

3 lines (2 loc) 2.62 kB
import{httpPost as e}from"../../core/Services/http.js";import{pick as t}from"../../utils/commonUtils.js";import{THREEDS2_FINGERPRINT_SUBMIT as n}from"./constants.js";import{API_ERROR_CODE as r}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as o,ErrorEventType as i,ErrorEventCode as s}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c({data:c}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:r.submitThreeDS2Fingerprint},function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){a(e,t,n[t])})}return e}({},c)).then(e=>{var r,a,c;let l;if("completed"===e.type){const{details:t}=e;return e.details?this.onComplete({data:{details:t}}):(console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no details object in a response indicating either a "frictionless" flow, or a "refused" response. resData=',e),l=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:i.threeDS2,message:`${n}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(l))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),l=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_ACTION_FOR_CHALLENGE,errorType:i.threeDS2,message:`${n}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(l);const d=null!==(r=this.props.elementRef)&&void 0!==r?r:this;return d?"threeDS2"===(null===(a=e.action)||void 0===a?void 0:a.type)?d.handleAction(e.action,t("challengeWindowSize").from(this.props)):"redirect"===(null===(c=e.action)||void 0===c?void 0:c.type)?d.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),l=new o({component:"threeDS2Fingerprint",code:s.THREEDS2_NO_COMPONENT_FOR_ACTION,errorType:i.threeDS2,message:`${n}: no component defined to handle the action response`}),void this.submitAnalytics(l))}).catch(e=>{this.handleError(e)})}export{c as default}; //# sourceMappingURL=callSubmit3DS2Fingerprint.js.map