@atlas-kitchen/adyen-web
Version:
3 lines (2 loc) • 2.14 kB
JavaScript
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/DeviceFingerprint/PrepareFingerprint3DS2.js";import n from"./callSubmit3DS2Fingerprint.js";import{existy as i}from"../../utils/commonUtils.js";import{TxVariants as o}from"../tx-variants.js";import s,{API_ERROR as a}from"../../core/Errors/AdyenCheckoutError.js";import{ANALYTICS_ERROR_TYPE as p,Analytics3DS2Errors as m,ANALYTICS_RENDERED_STR as c,Analytics3DS2Events as l}from"../../core/Analytics/constants.js";import{THREEDS2_FINGERPRINT_ERROR as u,THREEDS2_FULL as y,THREEDS2_FINGERPRINT as A}from"./constants.js";import{AnalyticsLogEvent as f}from"../../core/Analytics/AnalyticsLogEvent.js";import{AnalyticsInfoEvent as d}from"../../core/Analytics/AnalyticsInfoEvent.js";import{AnalyticsErrorEvent as h}from"../../core/Analytics/AnalyticsErrorEvent.js";function D(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class b extends e{onComplete(t){super.onComplete(t),this.unmount()}render(){if(!i(this.props.paymentData)){this.props.onError(new s(a,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const t=new h({code:m.ACTION_IS_MISSING_PAYMENT_DATA,errorType:p.apiError,message:`${u}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return t(r,{...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),D(this,"callSubmit3DS2Fingerprint",n.bind(this)),D(this,"submitAnalytics",(t=>{t instanceof d&&t.type===c||super.submitAnalytics(t)})),D(this,"onActionHandled",(t=>{const e=new f({type:y,message:t.actionDescription,subType:l.FINGERPRINT_IFRAME_LOADED});this.submitAnalytics(e),super.onActionHandled(t)}))}}D(b,"type",o.threeDS2Fingerprint),D(b,"defaultProps",{dataKey:"fingerprintResult",type:A});export{b as default};
//# sourceMappingURL=ThreeDS2DeviceFingerprint.js.map