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