@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 2.83 kB
JavaScript
import{createElement as t,Fragment as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{CoreProvider as n}from"../../core/Context/CoreProvider.js";import{TxVariants as r}from"../tx-variants.js";import s from"./components/PreAuthorizedDebitCanadaComponent.js";import{SettlementInfo as a}from"./components/SettlementInfo.js";import i from"../internal/RedirectButton/RedirectButton.js";import"../internal/Button/Button.js";import{payAmountLabel as p}from"../internal/PayButton/utils.js";function l(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function m(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),n.forEach((function(e){l(t,e,o[e])}))}return t}class d extends o{formatData(){return!!this.props.storedPaymentMethodId?{paymentMethod:{type:d.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:m({paymentMethod:{type:d.type,ownerName:this.state.data.ownerName,bankAccountNumber:this.state.data.bankAccountNumber,bankCode:this.state.data.bankCode,bankLocationId:this.state.data.bankLocationId}},this.state.storePaymentMethod&&{storePaymentMethod:this.state.storePaymentMethod})}formatProps(t){var e,o,n;return m({enableStoreDetails:null!==(n=null===(o=t.session)||void 0===o||null===(e=o.configuration)||void 0===e?void 0:e.enableStoreDetails)&&void 0!==n?n:t.enableStoreDetails},t)}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.lastFour?`•••• ${this.props.lastFour}`:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.label:""}render(){var o;return t(n,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.storedPaymentMethodId?t(e,null,t(a,null),t(i,{showPayButton:this.props.showPayButton,icon:null===(o=this.resources)||void 0===o?void 0:o.getImage({imageFolder:"components/"})("bento_lock"),label:p(this.props.i18n,this.props.amount),name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}})):t(s,{onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton,placeholders:this.props.placeholders,setComponentRef:this.setComponentRef,showContextualElement:this.props.showContextualElement,enableStoreDetails:this.props.enableStoreDetails}))}}l(d,"type",r.eft_directdebit_CA);export{d as PreAuthorizedDebitCanada,d as default};
//# sourceMappingURL=PreAuthorizedDebitCanada.js.map