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