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) 1.46 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/RedirectShopper/RedirectShopper.js";import o from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as n}from"../tx-variants.js";import s from"../../utils/browserInfo.js";import{AnalyticsErrorEvent as i,ErrorEventCode as p,ErrorEventType as a}from"../../core/Analytics/events/AnalyticsErrorEvent.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class m extends e{formatData(){return{paymentMethod:{type:this.type},browserInfo:this.browserInfo}}get isRedirecting(){return!!this.props.url&&!!this.props.method}get isValid(){return!0}get browserInfo(){return s()}componentToRender(){return this.isRedirecting?t(r,{url:this.props.url,...this.props,onActionHandled:this.onActionHandled,onRedirectError:this.handleRedirectError}):this.props.showPayButton?t(o,{...this.props,showPayButton:this.props.showPayButton,name:this.displayName,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}}):null}constructor(...t){super(...t),c(this,"handleRedirectError",()=>{const t=new i({component:this.props.paymentMethodType,errorType:a.redirect,code:p.REDIRECT});super.submitAnalytics(t)})}}c(m,"type",n.redirect),c(m,"defaultProps",{type:m.type});export{m as default}; //# sourceMappingURL=Redirect.js.map