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.17 kB
import e from"./VisaSdk.js";import t from"./MastercardSdk.js";import o from"../../../../../core/Errors/AdyenCheckoutError.js";import{isRejected as s,isFulfilled as r}from"../../../../../utils/promise-util.js";function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}const a={visa:e,mc:t,default:null};class n{async load(e,t){if(!this.schemes||0===this.schemes.length)throw new o("ERROR","ClickToPay -> SrcSdkLoader: There are no schemes set to be loaded");return new Promise((i,n)=>{const c=this.schemes.map(o=>((e,t,o,s)=>{const r=a[e]||a.default;return r?new r(t,o,s):null})(o,e,this.customSdkConfiguration,t)),d=c.map(e=>e.loadSdkScript());Promise.allSettled(d).then(e=>{e.every(s)&&n(new o("ERROR",`ClickToPay -> SrcSdkLoader # Unable to load network schemes: ${this.schemes.toString()}`));const t=c.filter((t,o)=>r(e[o]));i(t)})})}constructor(e,{dpaLocale:t="en_US",dpaPresentationName:o=""}){i(this,"schemes",void 0),i(this,"customSdkConfiguration",void 0),this.schemes=e,this.customSdkConfiguration={dpaLocale:t,dpaPresentationName:o}}}export{n as default}; //# sourceMappingURL=SrcSdkLoader.js.map