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.27 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/DragonpayInput/DragonpayInput.js";import n from"./components/DragonpayVoucherResult/DragonpayVoucherResult.js";import{CoreProvider as o}from"../../core/Context/CoreProvider.js";import{TxVariants as s}from"../tx-variants.js";function i(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable})))),n.forEach((function(e){i(t,e,r[e])}))}return t}function p(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})),t}class c extends e{get isValid(){return!!this.state.isValid}formatData(){const{issuer:t,shopperEmail:e}=this.state.data;return p(a({},e&&{shopperEmail:e}),{paymentMethod:p(a({},t&&{issuer:t}),{type:this.type})})}formatProps(t){var e,r,n;return p(a({},t),{issuers:null!==(n=null===(r=t.details)||void 0===r||null===(e=r.find((t=>"issuer"===t.key)))||void 0===e?void 0:e.items)&&void 0!==n?n:t.issuers})}render(){return t(o,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.reference?t(n,p(a({ref:t=>{this.componentRef=t},icon:this.icon},this.props),{onActionHandled:this.onActionHandled})):t(r,p(a({ref:t=>{this.componentRef=t},items:this.props.issuers},this.props),{showPayButton:this.props.showPayButton,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton})))}}i(c,"type",s.dragonpay),i(c,"txVariants",[s.dragonpay,s.dragonpay_ebanking,s.dragonpay_otc_banking,s.dragonpay_otc_non_banking,s.dragonpay_otc_philippines]);export{c as DragonpayElement,c as default}; //# sourceMappingURL=Dragonpay.js.map