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) 3 kB
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/BlikInput.js";import r from"../internal/Await/Await.js";import{CoreProvider as n}from"../../core/Context/CoreProvider.js";import s from"./config.js";import i from"../internal/RedirectButton/RedirectButton.js";import p from"../../core/Errors/SRPanelProvider.js";import{TxVariants as a}from"../tx-variants.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]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter((function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable})))),r.forEach((function(e){l(t,e,o[e])}))}return t}function d(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 o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach((function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))})),t}class h extends e{formatData(){var t,e;const o=!!this.props.storedPaymentMethodId;return{paymentMethod:m({type:h.type},!o&&{blikCode:null===(e=this.state)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.blikCode},o&&{storedPaymentMethodId:this.props.storedPaymentMethodId})}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId&&this.props.label?this.props.name:null}render(){return this.props.paymentData?t(n,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},t(p,{srPanel:this.props.modules.srPanel},t(r,{ref:t=>{this.componentRef=t},clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.handleError,onComplete:this.onComplete,brandLogo:this.icon,type:s.type,messageText:this.props.i18n.get(s.messageTextId),awaitText:this.props.i18n.get(s.awaitTextId),showCountdownTimer:s.showCountdownTimer,delay:s.STATUS_INTERVAL,countdownTime:s.COUNTDOWN_MINUTES,throttleTime:s.THROTTLE_TIME,throttleInterval:s.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}))):t(n,{i18n:this.props.i18n,loadingContext:this.props.loadingContext,resources:this.resources},this.props.storedPaymentMethodId?t(i,{showPayButton:this.props.showPayButton,name:this.displayName,amount:this.props.amount,payButton:this.payButton,onSubmit:this.submit,ref:t=>{this.componentRef=t}}):t(o,d(m({ref:t=>{this.componentRef=t}},this.props),{onChange:this.setState,onSubmit:this.submit,payButton:this.payButton})))}}l(h,"type",a.blik);export{h as default}; //# sourceMappingURL=Blik.js.map