@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 2.01 kB
JavaScript
import{httpPost as e}from"../../core/Services/http.js";import{pick as t}from"../../utils/commonUtils.js";import{THREEDS2_FINGERPRINT_SUBMIT as o}from"./constants.js";import{ANALYTICS_ERROR_TYPE as r,Analytics3DS2Errors as n}from"../../core/Analytics/constants.js";import{API_ERROR_CODE as i}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as s}from"../../core/Analytics/AnalyticsErrorEvent.js";function a({data:a}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:i.submitThreeDS2Fingerprint},{...a}).then((e=>{let i;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),i=new s({code:n.NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED,errorType:r.apiError,message:`${o}: no details object in a response indicating either a "frictionless" flow, or a "refused" response`}),void this.submitAnalytics(i))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),i=new s({code:n.NO_ACTION_FOR_CHALLENGE,errorType:r.apiError,message:`${o}: no action object in a response indicating a "challenge" flow`}),void this.submitAnalytics(i);const a=this.props.elementRef??this;return a?"threeDS2"===e.action?.type?a.handleAction(e.action,t("challengeWindowSize").from(this.props)):"redirect"===e.action?.type?a.handleAction(e.action):void 0:(console.debug("Handled Error::callSubmit3DS2Fingerprint::FAILED:: no actionHandler"),i=new s({code:n.NO_COMPONENT_FOR_ACTION,errorType:r.sdkError,message:`${o}: no component defined to handle the action response`}),void this.submitAnalytics(i))})).catch((e=>{this.handleError(e)}))}export{a as default};
//# sourceMappingURL=callSubmit3DS2Fingerprint.js.map