@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 2.03 kB
JavaScript
import{createElement as e}from"../../external/preact/dist/preact.js";import{UIElement as t}from"../internal/UIElement/UIElement.js";import o from"./components/Challenge/PrepareChallenge3DS2.js";import{THREEDS2_CHALLENGE_ERROR as n,THREEDS2_CHALLENGE as r,DEFAULT_CHALLENGE_WINDOW_SIZE as s}from"./constants.js";import{existy as i}from"../../utils/commonUtils.js";import{hasOwnProperty as a}from"../../utils/hasOwnProperty.js";import{TxVariants as p}from"../tx-variants.js";import l,{API_ERROR as m}from"../../core/Errors/AdyenCheckoutError.js";import{AnalyticsLogEvent as c,LogEventSubtype as h,LogEventType as u}from"../../core/Analytics/events/AnalyticsLogEvent.js";import{AnalyticsErrorEvent as y,ErrorEventType as d,ErrorEventCode as f}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function A(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}class D extends t{beforeRender(){}onComplete(e){this.props.onComplete?this.props.onComplete(e,this.elementRef):super.onComplete(e),this.unmount()}componentToRender(){if(!i(this.props.paymentData)){const e=a(this.props,"isMDFlow")?"paymentData":"authorisationToken";this.props.onError(new l(m,`No ${e} received. 3DS2 Challenge cannot proceed`));const t=new y({component:this.type,code:f.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,errorType:d.threeDS2,message:`${n}: Missing 'paymentData' property from threeDS2 action`});return this.submitAnalytics(t),null}return e(o,{...this.props,onComplete:this.onComplete,onSubmitAnalytics:this.submitAnalytics,isMDFlow:this.props.paymentData.length<15,onActionHandled:this.onActionHandled})}constructor(...e){super(...e),A(this,"onActionHandled",e=>{const t=new c({component:this.type,type:u.threeDS2,subType:h.challengeIframeLoaded,message:e.actionDescription});this.submitAnalytics(t),super.onActionHandled(e)})}}A(D,"type",p.threeDS2Challenge),A(D,"defaultProps",{dataKey:"threeDSResult",size:s,type:r});export{D as default};
//# sourceMappingURL=ThreeDS2Challenge.js.map