@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 2.84 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 o}from"../../utils/commonUtils.js";import{TxVariants as i}from"../tx-variants.js";import s,{API_ERROR as c}from"../../core/Errors/AdyenCheckoutError.js";import{ANALYTICS_ERROR_TYPE as p,Analytics3DS2Errors as a,ANALYTICS_RENDERED_STR as l,Analytics3DS2Events as m}from"../../core/Analytics/constants.js";import{THREEDS2_FINGERPRINT_ERROR as u,THREEDS2_FULL as y,THREEDS2_FINGERPRINT as f}from"./constants.js";import{AnalyticsLogEvent as b}from"../../core/Analytics/AnalyticsLogEvent.js";import{AnalyticsInfoEvent as j}from"../../core/Analytics/AnalyticsInfoEvent.js";import{AnalyticsErrorEvent as h}from"../../core/Analytics/AnalyticsErrorEvent.js";function A(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}class g extends e{onComplete(t){super.onComplete(t),this.unmount()}render(){if(!o(this.props.paymentData)){this.props.onError(new s(c,"No paymentData received. 3DS2 Fingerprint cannot proceed"));const t=new h({code:a.ACTION_IS_MISSING_PAYMENT_DATA,errorType:p.apiError,message:`${u}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return t(r,O(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){A(t,e,r[e])}))}return t}({},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),A(this,"callSubmit3DS2Fingerprint",n.bind(this)),A(this,"submitAnalytics",(t=>{t instanceof j&&t.type===l||super.submitAnalytics(t)})),A(this,"onActionHandled",(t=>{const e=new b({type:y,message:t.actionDescription,subType:m.FINGERPRINT_IFRAME_LOADED});this.submitAnalytics(e),super.onActionHandled(t)}))}}A(g,"type",i.threeDS2Fingerprint),A(g,"defaultProps",{dataKey:"fingerprintResult",type:f});export{g as default};
//# sourceMappingURL=ThreeDS2DeviceFingerprint.js.map