@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 2.08 kB
JavaScript
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 o}from"../../core/Services/sessions/constants.js";import{AnalyticsErrorEvent as r,ErrorEventType as i,ErrorEventCode as s}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function a({data:a}){e({path:`v1/submitThreeDS2Fingerprint?token=${this.props.clientKey}`,loadingContext:this.props.loadingContext,errorLevel:"fatal",errorCode:o.submitThreeDS2Fingerprint},{...a}).then(e=>{let o;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),o=new r({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(o))}if(!e.action)return console.debug('Handled Error::callSubmit3DS2Fingerprint::FAILED:: no action object in a response indicating a "challenge". resData=',e),o=new r({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(o);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"),o=new r({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(o))}).catch(e=>{this.handleError(e)})}export{a as default};
//# sourceMappingURL=callSubmit3DS2Fingerprint.js.map