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.41 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BoletoInput/BoletoInput.js";import{cleanCPFCNPJ as r}from"../internal/SocialSecurityNumberBrazil/utils.js";import i from"./components/BoletoVoucherResult/BoletoVoucherResult.js";import{TxVariants as a}from"../tx-variants.js";function n(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class s extends e{get isValid(){return!!this.state.isValid}formatData(){const{data:t={}}=this.state,{billingAddress:e,shopperEmail:o,firstName:i,lastName:a,socialSecurityNumber:n=""}=t;return{paymentMethod:{type:this.type},...e&&{billingAddress:e},...o&&{shopperEmail:o},...i&&a&&{shopperName:{firstName:i,lastName:a}},...n&&{socialSecurityNumber:r(n)}}}componentToRender(){return this.props.reference?t(i,{ref:this.handleRef,icon:this.icon,...this.props,onActionHandled:this.onActionHandled}):t(o,{setComponentRef:this.handleRef,...this.props,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton})}constructor(...t){super(...t),n(this,"handleRef",t=>{this.componentRef=t})}}n(s,"type",a.boletobancario),n(s,"txVariants",[a.boletobancario,a.boletobancario_itau,a.boletobancario_santander,a.primeiropay_boleto]);export{s as BoletoElement,s as default}; //# sourceMappingURL=Boleto.js.map