@adyen/adyen-web
Version:
[](https://www.npmjs.com/package/@adyen/adyen-web)
3 lines (2 loc) • 1.91 kB
JavaScript
import{createElement as t}from"../../../external/preact/dist/preact.js";import{UIElement as s}from"../../internal/UIElement/UIElement.js";import e from"../../internal/IssuerList/IssuerList.js";import i from"../../../utils/get-issuer-image.js";import{FALLBACK_CONTEXT as r}from"../../../core/config.js";import o from"../../internal/RedirectButton/RedirectButton.js";class n extends s{formatProps(t){const s=t.details&&t.details.length&&(t.details.find(t=>"issuer"===t.key)||{}).items||t.issuers||[];return{...t,issuers:s}}formatData(){return{paymentMethod:{type:this.type,issuer:this.state?.data?.issuer}}}get isValid(){return 0===this.props.issuers.length||!!this.state?.isValid}get brands(){return this.props.showPaymentMethodItemImages?this.props.issuers.map(t=>({icon:t.icon,name:t.id})):[]}componentToRender(){return this.props.issuers.length>0?t(e,{ref:t=>{this.componentRef=t},items:this.props.issuers,highlightedIds:this.props.highlightedIssuers,...this.props,...this.state,showImage:this.props.showImage,type:this.constructor.type,onChange:this.setState,onSubmit:this.submit,payButton:this.payButton,contextualText:this.props.i18n.get("issuerList.selectField.contextualText"),onSubmitAnalytics:this.submitAnalytics}):t(o,{showPayButton:this.props.showPayButton,name:this.props.name,...this.props,onSubmit:this.submit,payButton:this.payButton,ref:t=>{this.componentRef=t}})}constructor(t,s){super(t,s);const e=t=>this.resources.getImage(t);if(this.props.showImage){const t=i({loadingContext:this.props.loadingContext},this.constructor.type,e);this.props.issuers=this.props.issuers.map(s=>({...s,icon:t(s.id)}))}}}var a,p,h;h={showImage:!0,issuers:[],highlightedIssuers:[],loadingContext:r,showPaymentMethodItemImages:!1},(p="defaultProps")in(a=n)?Object.defineProperty(a,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):a[p]=h;export{n as default};
//# sourceMappingURL=IssuerListContainer.js.map