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.16 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import s from"../internal/RedirectButton/RedirectButton.js";import{TxVariants as r}from"../tx-variants.js";import a from"./components/AchComponent.js";import n from"./defaultProps.js";import i from"../../core/Errors/SRPanelProvider.js";function p(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class d extends e{formatData(){return!!this.props.storedPaymentMethodId?{paymentMethod:{type:d.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:{paymentMethod:{type:d.type,ownerName:this.state.data.ownerName,accountHolderType:this.state.data.selectedAccountType?.split(".")[0],bankAccountType:this.state.data.selectedAccountType?.split(".")[1],bankLocationId:this.state.data.routingNumber,bankAccountNumber:this.state.data.accountNumber},...this.state.storePaymentMethod&&{storePaymentMethod:this.state.storePaymentMethod}}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.bankAccountNumber?`•••• ${this.props.bankAccountNumber.slice(-4)}`:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.i18n.get("ach.savedBankAccount"):""}render(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.storedPaymentMethodId?t(s,{showPayButton:this.props.showPayButton,name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(i,{srPanel:this.props.modules.srPanel},t(a,{onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton,hasHolderName:this.props.hasHolderName,placeholders:this.props.placeholders,setComponentRef:this.setComponentRef,enableStoreDetails:this.props.enableStoreDetails})))}}p(d,"type",r.ach),p(d,"defaultProps",n);export{d as AchElement,d as default}; //# sourceMappingURL=Ach.js.map