@w3payments/common 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,630 @@
1
+ class PaymentMethodService {
2
+ static instance;
3
+ paymentMethods = /* @__PURE__ */ new Map();
4
+ constructor() {
5
+ }
6
+ static getInstance() {
7
+ if (!PaymentMethodService.instance) {
8
+ PaymentMethodService.instance = new PaymentMethodService();
9
+ }
10
+ return PaymentMethodService.instance;
11
+ }
12
+ /**
13
+ * Register a new payment method
14
+ */
15
+ register(method) {
16
+ this.paymentMethods.set(method.id, method);
17
+ }
18
+ /**
19
+ * Register multiple payment methods
20
+ */
21
+ registerMany(methods) {
22
+ methods.forEach((method) => this.register(method));
23
+ }
24
+ /**
25
+ * Get payment method by ID
26
+ */
27
+ getPaymentMethod(id) {
28
+ return this.paymentMethods.get(id);
29
+ }
30
+ /**
31
+ * Get all registered payment methods
32
+ */
33
+ getAllPaymentMethods() {
34
+ return Array.from(this.paymentMethods.values());
35
+ }
36
+ /**
37
+ * Check if payment method exists
38
+ */
39
+ hasPaymentMethod(id) {
40
+ return this.paymentMethods.has(id);
41
+ }
42
+ /**
43
+ * Get payment methods by vendor
44
+ */
45
+ getByVendor(vendorId) {
46
+ return this.getAllPaymentMethods().filter(
47
+ (method) => method.vendorId === vendorId
48
+ );
49
+ }
50
+ /**
51
+ * Get payment methods by method type (ach, wallet, exchange)
52
+ */
53
+ getByMethod(methodType) {
54
+ return this.getAllPaymentMethods().filter(
55
+ (method) => method.method === methodType
56
+ );
57
+ }
58
+ /**
59
+ * Get payment methods by type (fiat or crypto)
60
+ */
61
+ getByType(type) {
62
+ return this.getAllPaymentMethods().filter((method) => method.type === type);
63
+ }
64
+ /**
65
+ * Get fiat payment methods only
66
+ */
67
+ getFiatPaymentMethods() {
68
+ return this.getAllPaymentMethods().filter(
69
+ (method) => method.type === "fiat"
70
+ );
71
+ }
72
+ /**
73
+ * Get crypto payment methods only
74
+ */
75
+ getCryptoPaymentMethods() {
76
+ return this.getAllPaymentMethods().filter(
77
+ (method) => method.type === "crypto"
78
+ );
79
+ }
80
+ /**
81
+ * Get payment methods by currency
82
+ */
83
+ getByCurrency(currencyCode) {
84
+ return this.getAllPaymentMethods().filter(
85
+ (method) => method.supportedCurrencies.includes(currencyCode)
86
+ );
87
+ }
88
+ /**
89
+ * Get crypto payment methods by network
90
+ */
91
+ getByNetwork(networkId) {
92
+ return this.getCryptoPaymentMethods().filter(
93
+ (method) => method.network === networkId
94
+ );
95
+ }
96
+ /**
97
+ * Get crypto payment methods by network and currency combination
98
+ */
99
+ getByNetworkAndCurrency(networkId, currencyCode) {
100
+ return this.getCryptoPaymentMethods().filter(
101
+ (method) => method.network === networkId && method.currency === currencyCode
102
+ );
103
+ }
104
+ /**
105
+ * Get payment methods by region
106
+ */
107
+ getByRegion(region) {
108
+ return this.getAllPaymentMethods().filter(
109
+ (method) => !method.regions || method.regions.length === 0 || method.regions.includes(region)
110
+ );
111
+ }
112
+ /**
113
+ * Get active payment methods only
114
+ */
115
+ getActive() {
116
+ return this.getAllPaymentMethods().filter((method) => method.isActive);
117
+ }
118
+ /**
119
+ * Get available payment methods for currency and region
120
+ */
121
+ getAvailableFor(currencyCode, region) {
122
+ const methods = this.getByCurrency(currencyCode).filter(
123
+ (method) => method.isActive
124
+ );
125
+ if (region) {
126
+ return methods.filter(
127
+ (method) => !method.regions || method.regions.length === 0 || method.regions.includes(region)
128
+ );
129
+ }
130
+ return methods;
131
+ }
132
+ /**
133
+ * Search payment methods by name or description
134
+ */
135
+ searchPaymentMethods(query) {
136
+ const lowerQuery = query.toLowerCase();
137
+ return this.getAllPaymentMethods().filter(
138
+ (method) => method.name.toLowerCase().includes(lowerQuery) || method.description?.toLowerCase().includes(lowerQuery)
139
+ );
140
+ }
141
+ /**
142
+ * Get wallet payment methods with optional currency and target filters
143
+ */
144
+ getWalletMethods(filters) {
145
+ const walletMethods = this.getCryptoPaymentMethods().filter(
146
+ (method) => method.method === "wallet"
147
+ );
148
+ console.log("getWalletMethods: All wallet methods:", walletMethods.length);
149
+ console.log("getWalletMethods: Filters:", filters);
150
+ if (!filters) return walletMethods;
151
+ const filtered = walletMethods.filter((method) => {
152
+ const currencyMatches = !filters.currencies?.length || filters.currencies.some(
153
+ (curr) => method.currency.toLowerCase() === curr.toLowerCase()
154
+ );
155
+ const targetMatches = (!filters.targetCurrency || method.currency.toLowerCase() === filters.targetCurrency.toLowerCase()) && (!filters.targetNetwork || method.network.toLowerCase() === filters.targetNetwork.toLowerCase());
156
+ const matches = currencyMatches && targetMatches;
157
+ console.log(
158
+ `getWalletMethods: Method ${method.currency}/${method.network} - currencyMatches: ${currencyMatches}, targetMatches: ${targetMatches}, overall: ${matches}`
159
+ );
160
+ return matches;
161
+ });
162
+ console.log("getWalletMethods: Filtered result:", filtered.length);
163
+ return filtered;
164
+ }
165
+ /**
166
+ * Get exchange payment methods with optional exchange and target filters
167
+ */
168
+ getExchangeMethods(filters) {
169
+ const exchangeMethods = this.getCryptoPaymentMethods().filter(
170
+ (method) => method.method === "exchange"
171
+ );
172
+ if (!filters) return exchangeMethods;
173
+ return exchangeMethods.filter((method) => {
174
+ const exchangeMatches = !filters.exchanges?.length || filters.exchanges.some(
175
+ (exchange) => method.name.toLowerCase().includes(exchange.toLowerCase())
176
+ );
177
+ const targetMatches = !filters.targetCurrency || method.currency.toLowerCase() === filters.targetCurrency.toLowerCase();
178
+ return exchangeMatches && targetMatches;
179
+ });
180
+ }
181
+ /**
182
+ * Get fiat payment methods with optional method type filter
183
+ */
184
+ getFiatMethods(filters) {
185
+ const fiatMethods = this.getFiatPaymentMethods();
186
+ if (!filters?.methods?.length) return fiatMethods;
187
+ return fiatMethods.filter(
188
+ (method) => filters.methods.some(
189
+ (fiat) => method.method.toLowerCase() === fiat.toLowerCase()
190
+ )
191
+ );
192
+ }
193
+ /**
194
+ * Get simple display options from filter values
195
+ */
196
+ getDisplayOptions(filters) {
197
+ const result = [];
198
+ console.log(
199
+ "getDisplayOptions: Processing walletFilter:",
200
+ filters?.walletFilter
201
+ );
202
+ filters?.walletFilter?.forEach((currency) => {
203
+ console.log(`getDisplayOptions: Processing wallet currency: ${currency}`);
204
+ const walletMethods = this.getWalletMethods({
205
+ currencies: [currency],
206
+ targetCurrency: filters.targetCurrency,
207
+ targetNetwork: filters.targetNetwork
208
+ });
209
+ console.log(
210
+ `getDisplayOptions: Found ${walletMethods.length} wallet methods for ${currency}`
211
+ );
212
+ if (walletMethods.length > 0) {
213
+ result.push({
214
+ id: `wallet-${currency.toLowerCase()}`,
215
+ displayName: currency,
216
+ method: "wallet"
217
+ });
218
+ console.log(`getDisplayOptions: Added wallet option for ${currency}`);
219
+ }
220
+ });
221
+ filters?.exchangeFilter?.forEach((exchange) => {
222
+ const exchangeMethods = this.getExchangeMethods({
223
+ exchanges: [exchange],
224
+ targetCurrency: filters.targetCurrency
225
+ });
226
+ if (exchangeMethods.length > 0) {
227
+ result.push({
228
+ id: `exchange-${exchange.toLowerCase()}`,
229
+ displayName: exchange,
230
+ method: "exchange"
231
+ });
232
+ }
233
+ });
234
+ filters?.fiatFilter?.forEach((fiatMethod) => {
235
+ const fiatMethods = this.getFiatMethods({
236
+ methods: [fiatMethod]
237
+ });
238
+ if (fiatMethods.length > 0) {
239
+ result.push({
240
+ id: `fiat-${fiatMethod.toLowerCase()}`,
241
+ displayName: fiatMethod,
242
+ method: "fiat"
243
+ });
244
+ }
245
+ });
246
+ return result;
247
+ }
248
+ /**
249
+ * Clear all payment methods (useful for testing)
250
+ */
251
+ clear() {
252
+ this.paymentMethods.clear();
253
+ }
254
+ }
255
+ const paymentMethodService = PaymentMethodService.getInstance();
256
+ class CurrencyService {
257
+ static instance;
258
+ currencies = /* @__PURE__ */ new Map();
259
+ supportedCurrencies = {
260
+ sandbox: /* @__PURE__ */ new Set(),
261
+ production: /* @__PURE__ */ new Set()
262
+ };
263
+ constructor() {
264
+ }
265
+ static getInstance() {
266
+ if (!CurrencyService.instance) {
267
+ CurrencyService.instance = new CurrencyService();
268
+ }
269
+ return CurrencyService.instance;
270
+ }
271
+ /**
272
+ * Register a new currency
273
+ */
274
+ register(currency) {
275
+ this.currencies.set(currency.code, currency);
276
+ }
277
+ /**
278
+ * Register multiple currencies
279
+ */
280
+ registerMany(currencies) {
281
+ currencies.forEach((currency) => this.register(currency));
282
+ }
283
+ /**
284
+ * Get currency by code
285
+ */
286
+ getCurrency(code) {
287
+ return this.currencies.get(code);
288
+ }
289
+ /**
290
+ * Get all registered currencies
291
+ */
292
+ getAllCurrencies() {
293
+ return Array.from(this.currencies.values());
294
+ }
295
+ /**
296
+ * Check if currency exists
297
+ */
298
+ hasCurrency(code) {
299
+ return this.currencies.has(code);
300
+ }
301
+ /**
302
+ * Get currency icon URL
303
+ */
304
+ getCurrencyIcon(code) {
305
+ const currency = this.getCurrency(code);
306
+ return currency?.iconUrl || "";
307
+ }
308
+ /**
309
+ * Get cryptocurrencies only
310
+ */
311
+ getCryptoCurrencies() {
312
+ return this.getAllCurrencies().filter(
313
+ (currency) => currency.type === "crypto"
314
+ );
315
+ }
316
+ /**
317
+ * Get fiat currencies only
318
+ */
319
+ getFiatCurrencies() {
320
+ return this.getAllCurrencies().filter(
321
+ (currency) => currency.type === "fiat"
322
+ );
323
+ }
324
+ /**
325
+ * Get stablecoins only
326
+ */
327
+ getStablecoins() {
328
+ return this.getCryptoCurrencies().filter((currency) => currency.isStablecoin);
329
+ }
330
+ /**
331
+ * Get currencies by network
332
+ */
333
+ getCurrenciesByNetwork(networkId) {
334
+ return this.getCryptoCurrencies().filter(
335
+ (currency) => currency.network === networkId
336
+ );
337
+ }
338
+ /**
339
+ * Search currencies by code or name
340
+ */
341
+ searchCurrencies(query) {
342
+ const lowerQuery = query.toLowerCase();
343
+ return this.getAllCurrencies().filter(
344
+ (currency) => currency.code.toLowerCase().includes(lowerQuery) || currency.name.toLowerCase().includes(lowerQuery)
345
+ );
346
+ }
347
+ /**
348
+ * Add currency to supported list for environment
349
+ */
350
+ addSupportedCurrency(code, environment) {
351
+ this.supportedCurrencies[environment].add(code);
352
+ }
353
+ /**
354
+ * Get supported currencies for environment
355
+ */
356
+ getSupportedCurrencies(environment) {
357
+ return Array.from(this.supportedCurrencies[environment]);
358
+ }
359
+ /**
360
+ * Check if currency is supported in environment
361
+ */
362
+ isCurrencySupported(code, environment) {
363
+ return this.supportedCurrencies[environment].has(code);
364
+ }
365
+ /**
366
+ * Clear all currencies (useful for testing)
367
+ */
368
+ clear() {
369
+ this.currencies.clear();
370
+ this.supportedCurrencies.sandbox.clear();
371
+ this.supportedCurrencies.production.clear();
372
+ }
373
+ }
374
+ const currencyService = CurrencyService.getInstance();
375
+ class NetworkService {
376
+ static instance;
377
+ networks = /* @__PURE__ */ new Map();
378
+ constructor() {
379
+ }
380
+ static getInstance() {
381
+ if (!NetworkService.instance) {
382
+ NetworkService.instance = new NetworkService();
383
+ }
384
+ return NetworkService.instance;
385
+ }
386
+ /**
387
+ * Register a new network
388
+ */
389
+ register(network) {
390
+ this.networks.set(network.id, network);
391
+ }
392
+ /**
393
+ * Register multiple networks
394
+ */
395
+ registerMany(networks) {
396
+ networks.forEach((network) => this.register(network));
397
+ }
398
+ /**
399
+ * Get network by ID
400
+ */
401
+ getNetwork(id) {
402
+ return this.networks.get(id);
403
+ }
404
+ /**
405
+ * Get all registered networks
406
+ */
407
+ getAllNetworks() {
408
+ return Array.from(this.networks.values());
409
+ }
410
+ /**
411
+ * Check if network exists
412
+ */
413
+ hasNetwork(id) {
414
+ return this.networks.has(id);
415
+ }
416
+ /**
417
+ * Get mainnet networks only
418
+ */
419
+ getMainnetNetworks() {
420
+ return this.getAllNetworks().filter((network) => !network.isTestnet);
421
+ }
422
+ /**
423
+ * Get testnet networks only
424
+ */
425
+ getTestnetNetworks() {
426
+ return this.getAllNetworks().filter((network) => network.isTestnet);
427
+ }
428
+ /**
429
+ * Clear all networks (useful for testing)
430
+ */
431
+ clear() {
432
+ this.networks.clear();
433
+ }
434
+ }
435
+ const networkService = NetworkService.getInstance();
436
+ function camelToKebab(str) {
437
+ return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
438
+ }
439
+ function getDefaultVariables() {
440
+ return {
441
+ colorPrimary: "#6366f1",
442
+ colorPrimaryHover: "#4f46e5",
443
+ colorPrimaryLight: "#e0e7ff",
444
+ colorBackground: "#ffffff",
445
+ colorText: "#1f2937",
446
+ colorTextMuted: "#6b7280",
447
+ colorBorder: "#e5e7eb",
448
+ colorBorderLight: "#f3f4f6",
449
+ colorDanger: "#ef4444",
450
+ colorSuccess: "#10b981",
451
+ fontFamily: "system-ui, -apple-system, sans-serif",
452
+ fontSize: "1rem",
453
+ borderRadius: "0.5rem",
454
+ spacing: "1rem"
455
+ };
456
+ }
457
+ function getThemePreset(themeName) {
458
+ const defaults = getDefaultVariables();
459
+ switch (themeName) {
460
+ case "dark":
461
+ return {
462
+ ...defaults,
463
+ colorPrimary: "#6366f1",
464
+ colorPrimaryHover: "#7c3aed",
465
+ colorPrimaryLight: "#1e1b4b",
466
+ colorBackground: "#111827",
467
+ colorText: "#f9fafb",
468
+ colorTextMuted: "#9ca3af",
469
+ colorBorder: "#374151",
470
+ colorBorderLight: "#4b5563"
471
+ };
472
+ case "light":
473
+ default:
474
+ return defaults;
475
+ }
476
+ }
477
+ function applyTheme(themeInput, container) {
478
+ const theme = typeof themeInput === "string" ? { theme: themeInput } : themeInput;
479
+ const baseVariables = getThemePreset(theme.theme ?? "light");
480
+ const finalVariables = { ...baseVariables, ...theme.variables };
481
+ Object.entries(finalVariables).forEach(([key, value]) => {
482
+ if (value !== void 0) {
483
+ const cssVar = `--${camelToKebab(key)}`;
484
+ container.style.setProperty(cssVar, value);
485
+ }
486
+ });
487
+ if (theme.theme) {
488
+ container.setAttribute("data-theme", theme.theme);
489
+ }
490
+ if (theme.rules) {
491
+ applyComponentRules(theme.rules);
492
+ }
493
+ }
494
+ function applyComponentRules(rules) {
495
+ const styleId = "w3-theme-rules";
496
+ let styleElement = document.getElementById(styleId);
497
+ if (!styleElement) {
498
+ styleElement = document.createElement("style");
499
+ styleElement.id = styleId;
500
+ document.head.appendChild(styleElement);
501
+ }
502
+ const css = Object.entries(rules).map(([selector, styles]) => {
503
+ const cssProperties = Object.entries(styles).map(([prop, value]) => `${camelToKebab(prop)}: ${value};`).join(" ");
504
+ return `.w3-widget ${selector} { ${cssProperties} }`;
505
+ }).join("\n");
506
+ styleElement.textContent = css;
507
+ }
508
+ const CURRENCIES = {
509
+ USD: {
510
+ code: "USD",
511
+ name: "US Dollar",
512
+ symbol: "$",
513
+ decimals: 2,
514
+ type: "fiat",
515
+ countryCode: "US",
516
+ iconUrl: "https://cdn.jsdelivr.net/gh/atomiclabs/cryptocurrency-icons@1a63530be6e374711a8554f31b17e4cb92c25fa5/svg/icon/usd.svg"
517
+ },
518
+ BTC: {
519
+ code: "BTC",
520
+ name: "Bitcoin",
521
+ symbol: "₿",
522
+ decimals: 8,
523
+ type: "crypto",
524
+ network: "bitcoin",
525
+ isStablecoin: false,
526
+ iconUrl: "https://cdn.jsdelivr.net/gh/atomiclabs/cryptocurrency-icons@1a63530be6e374711a8554f31b17e4cb92c25fa5/svg/icon/btc.svg"
527
+ },
528
+ ETH: {
529
+ code: "ETH",
530
+ name: "Ethereum",
531
+ symbol: "Ξ",
532
+ decimals: 18,
533
+ type: "crypto",
534
+ network: "ethereum",
535
+ isStablecoin: false,
536
+ iconUrl: "https://cdn.jsdelivr.net/gh/atomiclabs/cryptocurrency-icons@1a63530be6e374711a8554f31b17e4cb92c25fa5/svg/icon/eth.svg"
537
+ }
538
+ };
539
+ const NETWORKS = {
540
+ bitcoin: {
541
+ id: "bitcoin",
542
+ name: "Bitcoin",
543
+ symbol: "BTC"
544
+ },
545
+ ethereum: {
546
+ id: "ethereum",
547
+ name: "Ethereum",
548
+ symbol: "ETH",
549
+ chainId: 1
550
+ }
551
+ };
552
+ const currencyIcons = {
553
+ // Major Cryptocurrencies
554
+ BTC: "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
555
+ ETH: "https://cryptologos.cc/logos/ethereum-eth-logo.svg",
556
+ USDC: "https://cryptologos.cc/logos/usd-coin-usdc-logo.svg",
557
+ USDT: "https://cryptologos.cc/logos/tether-usdt-logo.svg",
558
+ DAI: "https://cryptologos.cc/logos/multi-collateral-dai-dai-logo.svg",
559
+ // Layer 1 Networks
560
+ SOL: "https://cryptologos.cc/logos/solana-sol-logo.svg",
561
+ AVAX: "https://cryptologos.cc/logos/avalanche-avax-logo.svg",
562
+ MATIC: "https://cryptologos.cc/logos/polygon-matic-logo.svg",
563
+ BNB: "https://cryptologos.cc/logos/bnb-bnb-logo.svg",
564
+ // DeFi Tokens
565
+ UNI: "https://cryptologos.cc/logos/uniswap-uni-logo.svg",
566
+ LINK: "https://cryptologos.cc/logos/chainlink-link-logo.svg",
567
+ AAVE: "https://cryptologos.cc/logos/aave-aave-logo.svg",
568
+ // Layer 2
569
+ ARB: "https://cryptologos.cc/logos/arbitrum-arb-logo.svg",
570
+ OP: "https://cryptologos.cc/logos/optimism-ethereum-op-logo.svg",
571
+ // Other Popular
572
+ DOGE: "https://cryptologos.cc/logos/dogecoin-doge-logo.svg",
573
+ XRP: "https://cryptologos.cc/logos/xrp-xrp-logo.svg",
574
+ ADA: "https://cryptologos.cc/logos/cardano-ada-logo.svg",
575
+ DOT: "https://cryptologos.cc/logos/polkadot-new-dot-logo.svg"
576
+ };
577
+ function getCurrencyIcon(code) {
578
+ return currencyIcons[code.toUpperCase()];
579
+ }
580
+ const exchangeIcons = {
581
+ // Major Exchanges
582
+ coinbase: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiMwMDUyRkYiLz4KPHJlY3QgeD0iOSIgeT0iOSIgd2lkdGg9IjYiIGhlaWdodD0iNiIgcng9IjEiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
583
+ kraken: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiM1NzQxOUEiLz4KPHBhdGggZD0iTTggN0wxNiA5VjE3TDggMTVWN1oiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
584
+ binance: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiNGM0JBMkYiLz4KPHBhdGggZD0iTTEyIDZMMTUgOVYxNUwxMiAxOEw5IDE1VjlMMTIgNloiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
585
+ // Other Exchanges
586
+ gemini: "https://assets.coincap.io/assets/icons/256/gemini.png",
587
+ kucoin: "https://assets.coincap.io/assets/icons/256/kucoin.png",
588
+ huobi: "https://assets.coincap.io/assets/icons/256/huobi.png",
589
+ okx: "https://assets.coincap.io/assets/icons/256/okx.png",
590
+ gate: "https://assets.coincap.io/assets/icons/256/gate.png",
591
+ bitfinex: "https://assets.coincap.io/assets/icons/256/bitfinex.png",
592
+ // Alternative sources if needed
593
+ "coinbase-pro": "https://assets.coincap.io/assets/icons/256/coinbase.png",
594
+ "binance-us": "https://assets.coincap.io/assets/icons/256/binance.png"
595
+ };
596
+ function getExchangeIcon(exchange) {
597
+ return exchangeIcons[exchange.toLowerCase()];
598
+ }
599
+ const fiatIcons = {
600
+ // Bank Transfer Methods
601
+ ach: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
602
+ wire: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
603
+ sepa: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwIDRIOEE0IDQgMCAwIDAgNCA4VjE2QTQgNCAwIDAgMCA4IDIwSDE2QTggOCAwIDAgMCAyMCA0Wk04IDZIMTZBMiAyIDAgMCAxIDE4IDhWMTZBNiA2IDAgMCAxIDYgMTBWOEEyIDIgMCAwIDEgOCA2WiIgZmlsbD0iY3VycmVudENvbG9yIi8+Cjwvc3ZnPg==",
604
+ // Cards
605
+ credit: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwIDRINEMyLjg5IDQgMiA0Ljg5IDIgNlYxOEMyIDE5LjExIDIuODkgMjAgNCAyMEgyMEMyMS4xMSAyMCAyMiAxOS4xMSAyMiAxOFY2QzIyIDQuODkgMjEuMTEgNCAyMCA0Wk0yMCA2VjhINFY2SDIwWk0yMCAxOEg0VjEwSDIwVjE4WiIgZmlsbD0iY3VycmVudENvbG9yIi8+Cjwvc3ZnPg==",
606
+ debit: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTIwIDRINEMyLjg5IDQgMiA0Ljg5IDIgNlYxOEMyIDE5LjExIDIuODkgMjAgNCAyMEgyMEMyMS4xMSAyMCAyMiAxOS4xMSAyMiAxOFY2QzIyIDQuODkgMjEuMTEgNCAyMCA0Wk0yMCA2VjhINFY2SDIwWk0yMCAxOEg0VjEwSDIwVjE4WiIgZmlsbD0iY3VycmVudENvbG9yIi8+Cjwvc3ZnPg==",
607
+ // Digital Wallets
608
+ paypal: "https://cdn.jsdelivr.net/gh/devicons/devicon/icons/paypal/paypal-original.svg",
609
+ applepay: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE4Ljc0IDguNDNDMTguNzQgMTEuNTQgMTUuNzQgMTMgMTIuNzQgMTNIMTBWMjBINlYzSDEyLjc0QzE1Ljc0IDMgMTguNzQgNC40NiAxOC43NCA4LjQzWk0xNC41IDguNDNDMTQuNSA2LjY3IDEzLjU5IDUuNzUgMTEuOTggNS43NUgxMFYxMS4yNUgxMS45OEMxMy41OSAxMS4yNSAxNC41IDEwLjMzIDE0LjUgOC40M1oiIGZpbGw9ImN1cnJlbnRDb2xvciIvPgo8L3N2Zz4K",
610
+ googlepay: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJDNi40OCAyIDIgNi40OCAyIDEyUzYuNDggMjIgMTIgMjJTMjIgMTcuNTIgMjIgMTJTMTcuNTIgMiAxMiAyWk0xMyAxN0g5VjE1SDE1VjE3SDE3VjE5SDE1VjIxSDEzVjE5SDlWMTVIMTNWMTdaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
611
+ // Others/Fallback
612
+ bank: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
613
+ other: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDhDMTMuMSA4IDE0IDcuMSAxNCA2UzEzLjEgNCAxMiA0IDEwIDQuOSAxMCA2UzEwLjkgOCAxMiA4Wk0xMiAxMEMxMC45IDEwIDEwIDEwLjkgMTAgMTJTMTAuOSAxNCAxMiAxNFMxNCAxMy4xIDE0IDEyUzEzLjEgMTAgMTIgMTBaTTEyIDE2QzEwLjkgMTYgMTAgMTYuOSAxMCAxOFMxMC45IDIwIDEyIDIwUzE0IDE5LjEgMTQgMThTMTMuMSAxNiAxMiAxNloiIGZpbGw9ImN1cnJlbnRDb2xvciIvPgo8L3N2Zz4K"
614
+ };
615
+ function getFiatIcon(method) {
616
+ return fiatIcons[method.toLowerCase()];
617
+ }
618
+ export {
619
+ CURRENCIES,
620
+ NETWORKS,
621
+ PaymentMethodService,
622
+ applyTheme,
623
+ currencyService,
624
+ getCurrencyIcon,
625
+ getExchangeIcon,
626
+ getFiatIcon,
627
+ networkService,
628
+ paymentMethodService
629
+ };
630
+ //# sourceMappingURL=index.mjs.map