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.01 kB
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import r from"./components/DeviceFingerprint/PrepareFingerprint3DS2.js";import n from"./callSubmit3DS2Fingerprint.js";import{existy as o}from"../../utils/commonUtils.js";import{TxVariants as i}from"../tx-variants.js";import s,{API_ERROR as p}from"../../core/Errors/AdyenCheckoutError.js";import{THREEDS2_FINGERPRINT_ERROR as a,THREEDS2_FINGERPRINT as m}from"./constants.js";import{AnalyticsLogEvent as c,LogEventSubtype as l,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as d,ErrorEventType as h,ErrorEventCode as f}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class D extends t{beforeRender(){}onComplete(e){this.props.isMDFlow?this.props.on3DS2RedirectFlowComplete?.(e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!o(this.props.paymentData)){this.props.onError(new s(p,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const e=new d({component:this.type,code:f.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:h.threeDS2,message:`${a}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(e),null}return e(r,{...this.props,onComplete:this.props.isMDFlow?this.onComplete:this.callSubmit3DS2Fingerprint,onSubmitAnalytics:this.submitAnalytics,onActionHandled:this.onActionHandled})}constructor(...e){super(...e),y(this,"callSubmit3DS2Fingerprint",n.bind(this)),y(this,"onActionHandled",e=>{const t=new c({component:this.type,type:u.threeDS2,subType:l.fingerprintIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}y(D,"type",i.threeDS2Fingerprint),y(D,"defaultProps",{dataKey:"fingerprintResult",type:m});export{D as default}; //# sourceMappingURL=ThreeDS2DeviceFingerprint.js.map