@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.d.ts +641 -0
- package/dist/index.js +630 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +630 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +78 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,641 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply theme to container element
|
|
3
|
+
*/
|
|
4
|
+
export declare function applyTheme(themeInput: W3ThemeInput, container: HTMLElement): void;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Currency Types
|
|
8
|
+
*
|
|
9
|
+
* Clean currency type definitions using discriminated unions.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Base currency properties shared by all currencies
|
|
13
|
+
*/
|
|
14
|
+
export declare type BaseCurrency = {
|
|
15
|
+
/** Currency code (e.g., 'BTC', 'USD', 'USDC') */
|
|
16
|
+
code: string;
|
|
17
|
+
/** Display name (e.g., 'Bitcoin', 'US Dollar') */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Currency symbol for display (e.g., '₿', '$') */
|
|
20
|
+
symbol: string;
|
|
21
|
+
/** Number of decimal places */
|
|
22
|
+
decimals: number;
|
|
23
|
+
/** Icon URL */
|
|
24
|
+
iconUrl?: string;
|
|
25
|
+
/** Description */
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Whether actively supported */
|
|
28
|
+
isActive?: boolean;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Payment Method Types
|
|
33
|
+
*
|
|
34
|
+
* Minimal payment method definitions for current support:
|
|
35
|
+
* - Fiat: ACH only
|
|
36
|
+
* - Crypto: Wallet and Exchange (with network + currency)
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* Base payment method properties shared by all methods
|
|
40
|
+
*/
|
|
41
|
+
export declare type BasePaymentMethod = {
|
|
42
|
+
/** Unique identifier (e.g., 'ach-meshpay', 'wallet-usdc-eth-ironpay') */
|
|
43
|
+
id: string;
|
|
44
|
+
/** Display name (e.g., 'ACH via MeshPay', 'USDC Wallet (Ethereum) via IronPay') */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Vendor that provides this payment method */
|
|
47
|
+
vendorId: string;
|
|
48
|
+
/** Description of the payment method */
|
|
49
|
+
description?: string;
|
|
50
|
+
/** Supported currency codes */
|
|
51
|
+
supportedCurrencies: string[];
|
|
52
|
+
/** Supported regions (if empty, assume all regions supported) */
|
|
53
|
+
regions?: string[];
|
|
54
|
+
/** Fee structure (if undefined, no fees) */
|
|
55
|
+
fees?: {
|
|
56
|
+
percentage?: number;
|
|
57
|
+
fixed?: number;
|
|
58
|
+
currency?: string;
|
|
59
|
+
};
|
|
60
|
+
/** Transaction limits (if undefined, no limits) */
|
|
61
|
+
limits?: {
|
|
62
|
+
min?: number;
|
|
63
|
+
max?: number;
|
|
64
|
+
currency?: string;
|
|
65
|
+
};
|
|
66
|
+
/** Processing time (if undefined, assume instant) */
|
|
67
|
+
processingTime?: string;
|
|
68
|
+
/** Whether this method is currently active */
|
|
69
|
+
isActive: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Checkout session created by vendor adapter
|
|
74
|
+
*/
|
|
75
|
+
export declare interface CheckoutSession {
|
|
76
|
+
/** Unique session identifier */
|
|
77
|
+
id: string;
|
|
78
|
+
/** Checkout URL for client to open (optional - some vendors use tokens instead) */
|
|
79
|
+
url?: string;
|
|
80
|
+
/** Session expiration timestamp (optional) */
|
|
81
|
+
expiresAt?: string;
|
|
82
|
+
/** Additional vendor-specific metadata */
|
|
83
|
+
metadata?: Record<string, any>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export declare type CreatePaymentOptions = {
|
|
87
|
+
/** Unique payment intent ID */
|
|
88
|
+
id: string;
|
|
89
|
+
/** Amount in base currency units */
|
|
90
|
+
amount: number;
|
|
91
|
+
/** Currency code */
|
|
92
|
+
currency: string;
|
|
93
|
+
/** Customer ID */
|
|
94
|
+
customerId: string;
|
|
95
|
+
/** Destination addresses for crypto payments */
|
|
96
|
+
destinations: Array<{
|
|
97
|
+
address: string;
|
|
98
|
+
networkId: string;
|
|
99
|
+
symbol: string;
|
|
100
|
+
}>;
|
|
101
|
+
/** Optional vendor preference (if not provided, core will select best) */
|
|
102
|
+
preferredVendor?: string;
|
|
103
|
+
/** Optional metadata */
|
|
104
|
+
metadata?: Record<string, any>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Cryptocurrency variant
|
|
109
|
+
*/
|
|
110
|
+
export declare type CryptoCurrency = BaseCurrency & {
|
|
111
|
+
type: 'crypto';
|
|
112
|
+
/** Network this currency runs on */
|
|
113
|
+
network: string;
|
|
114
|
+
/** Contract address for tokens */
|
|
115
|
+
contractAddress?: string;
|
|
116
|
+
/** Whether this is a stablecoin */
|
|
117
|
+
isStablecoin?: boolean;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Crypto destination for payments
|
|
122
|
+
*/
|
|
123
|
+
export declare interface CryptoDestination {
|
|
124
|
+
/** Blockchain network ID */
|
|
125
|
+
networkId: string;
|
|
126
|
+
/** Token symbol */
|
|
127
|
+
symbol: string;
|
|
128
|
+
/** Destination address */
|
|
129
|
+
address: string;
|
|
130
|
+
/** Optional amount for this destination */
|
|
131
|
+
amount?: number;
|
|
132
|
+
/** Optional percentage split for this destination */
|
|
133
|
+
percentage?: number;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Crypto payment method - wallet and exchange with network + currency
|
|
138
|
+
*/
|
|
139
|
+
export declare type CryptoPaymentMethod = BasePaymentMethod & {
|
|
140
|
+
type: 'crypto';
|
|
141
|
+
method: 'wallet' | 'exchange';
|
|
142
|
+
/** Blockchain network (e.g., 'ethereum', 'solana', 'bitcoin') */
|
|
143
|
+
network: string;
|
|
144
|
+
/** Specific currency/token (e.g., 'USDC', 'BTC', 'ETH') */
|
|
145
|
+
currency: string;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* W3 Payments Theme System
|
|
150
|
+
*
|
|
151
|
+
* Stripe-style appearance API for simple, powerful theming
|
|
152
|
+
* Framework-agnostic - works with React, Vue, vanilla JS, etc.
|
|
153
|
+
*/
|
|
154
|
+
/**
|
|
155
|
+
* CSS properties type (framework-agnostic)
|
|
156
|
+
* Simple record of CSS properties - allows any property name and value
|
|
157
|
+
*/
|
|
158
|
+
export declare interface CSSStyleProperties {
|
|
159
|
+
[property: string]: string | number | undefined;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export declare const CURRENCIES: Record<string, Currency>;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Currency union type - can be either crypto or fiat
|
|
166
|
+
*/
|
|
167
|
+
export declare type Currency = CryptoCurrency | FiatCurrency;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Currency service for managing currency registration and lookup
|
|
171
|
+
*/
|
|
172
|
+
declare class CurrencyService {
|
|
173
|
+
private static instance;
|
|
174
|
+
private currencies;
|
|
175
|
+
private supportedCurrencies;
|
|
176
|
+
private constructor();
|
|
177
|
+
static getInstance(): CurrencyService;
|
|
178
|
+
/**
|
|
179
|
+
* Register a new currency
|
|
180
|
+
*/
|
|
181
|
+
register(currency: Currency): void;
|
|
182
|
+
/**
|
|
183
|
+
* Register multiple currencies
|
|
184
|
+
*/
|
|
185
|
+
registerMany(currencies: Currency[]): void;
|
|
186
|
+
/**
|
|
187
|
+
* Get currency by code
|
|
188
|
+
*/
|
|
189
|
+
getCurrency(code: string): Currency | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Get all registered currencies
|
|
192
|
+
*/
|
|
193
|
+
getAllCurrencies(): Currency[];
|
|
194
|
+
/**
|
|
195
|
+
* Check if currency exists
|
|
196
|
+
*/
|
|
197
|
+
hasCurrency(code: string): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Get currency icon URL
|
|
200
|
+
*/
|
|
201
|
+
getCurrencyIcon(code: string): string;
|
|
202
|
+
/**
|
|
203
|
+
* Get cryptocurrencies only
|
|
204
|
+
*/
|
|
205
|
+
getCryptoCurrencies(): CryptoCurrency[];
|
|
206
|
+
/**
|
|
207
|
+
* Get fiat currencies only
|
|
208
|
+
*/
|
|
209
|
+
getFiatCurrencies(): FiatCurrency[];
|
|
210
|
+
/**
|
|
211
|
+
* Get stablecoins only
|
|
212
|
+
*/
|
|
213
|
+
getStablecoins(): CryptoCurrency[];
|
|
214
|
+
/**
|
|
215
|
+
* Get currencies by network
|
|
216
|
+
*/
|
|
217
|
+
getCurrenciesByNetwork(networkId: string): CryptoCurrency[];
|
|
218
|
+
/**
|
|
219
|
+
* Search currencies by code or name
|
|
220
|
+
*/
|
|
221
|
+
searchCurrencies(query: string): Currency[];
|
|
222
|
+
/**
|
|
223
|
+
* Add currency to supported list for environment
|
|
224
|
+
*/
|
|
225
|
+
addSupportedCurrency(code: string, environment: Environment): void;
|
|
226
|
+
/**
|
|
227
|
+
* Get supported currencies for environment
|
|
228
|
+
*/
|
|
229
|
+
getSupportedCurrencies(environment: Environment): string[];
|
|
230
|
+
/**
|
|
231
|
+
* Check if currency is supported in environment
|
|
232
|
+
*/
|
|
233
|
+
isCurrencySupported(code: string, environment: Environment): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Clear all currencies (useful for testing)
|
|
236
|
+
*/
|
|
237
|
+
clear(): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Default currency service instance
|
|
242
|
+
*/
|
|
243
|
+
export declare const currencyService: CurrencyService;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Environment Types
|
|
247
|
+
*
|
|
248
|
+
* Common environment definitions used across services.
|
|
249
|
+
*/
|
|
250
|
+
/**
|
|
251
|
+
* Application environment types
|
|
252
|
+
*/
|
|
253
|
+
export declare type Environment = 'sandbox' | 'production';
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Fiat currency variant
|
|
257
|
+
*/
|
|
258
|
+
export declare type FiatCurrency = BaseCurrency & {
|
|
259
|
+
type: 'fiat';
|
|
260
|
+
/** ISO country code */
|
|
261
|
+
countryCode: string;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Fiat payment method - ACH only for now
|
|
266
|
+
*/
|
|
267
|
+
export declare type FiatPaymentMethod = BasePaymentMethod & {
|
|
268
|
+
type: 'fiat';
|
|
269
|
+
method: 'ach';
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export declare function getCurrencyIcon(code: string): string | undefined;
|
|
273
|
+
|
|
274
|
+
export declare function getExchangeIcon(exchange: string): string | undefined;
|
|
275
|
+
|
|
276
|
+
export declare function getFiatIcon(method: string): string | undefined;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Network Types
|
|
280
|
+
*
|
|
281
|
+
* Blockchain network definitions for crypto currencies.
|
|
282
|
+
*/
|
|
283
|
+
/**
|
|
284
|
+
* Blockchain network definition
|
|
285
|
+
*/
|
|
286
|
+
export declare type Network = {
|
|
287
|
+
/** Network identifier (e.g., 'ethereum', 'bitcoin') */
|
|
288
|
+
id: string;
|
|
289
|
+
/** Display name (e.g., 'Ethereum', 'Bitcoin') */
|
|
290
|
+
name: string;
|
|
291
|
+
/** Network symbol (e.g., 'ETH', 'BTC') */
|
|
292
|
+
symbol: string;
|
|
293
|
+
/** Whether this is a testnet */
|
|
294
|
+
isTestnet?: boolean;
|
|
295
|
+
/** Chain ID for EVM networks */
|
|
296
|
+
chainId?: number;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
export declare const NETWORKS: Record<string, Network>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Network service for managing blockchain network registration and lookup
|
|
303
|
+
*/
|
|
304
|
+
declare class NetworkService {
|
|
305
|
+
private static instance;
|
|
306
|
+
private networks;
|
|
307
|
+
private constructor();
|
|
308
|
+
static getInstance(): NetworkService;
|
|
309
|
+
/**
|
|
310
|
+
* Register a new network
|
|
311
|
+
*/
|
|
312
|
+
register(network: Network): void;
|
|
313
|
+
/**
|
|
314
|
+
* Register multiple networks
|
|
315
|
+
*/
|
|
316
|
+
registerMany(networks: Network[]): void;
|
|
317
|
+
/**
|
|
318
|
+
* Get network by ID
|
|
319
|
+
*/
|
|
320
|
+
getNetwork(id: string): Network | undefined;
|
|
321
|
+
/**
|
|
322
|
+
* Get all registered networks
|
|
323
|
+
*/
|
|
324
|
+
getAllNetworks(): Network[];
|
|
325
|
+
/**
|
|
326
|
+
* Check if network exists
|
|
327
|
+
*/
|
|
328
|
+
hasNetwork(id: string): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* Get mainnet networks only
|
|
331
|
+
*/
|
|
332
|
+
getMainnetNetworks(): Network[];
|
|
333
|
+
/**
|
|
334
|
+
* Get testnet networks only
|
|
335
|
+
*/
|
|
336
|
+
getTestnetNetworks(): Network[];
|
|
337
|
+
/**
|
|
338
|
+
* Clear all networks (useful for testing)
|
|
339
|
+
*/
|
|
340
|
+
clear(): void;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Default network service instance
|
|
345
|
+
*/
|
|
346
|
+
export declare const networkService: NetworkService;
|
|
347
|
+
|
|
348
|
+
export declare type PaymentClientOptions = {
|
|
349
|
+
/** Payment configuration - adapters auto-discovered from config keys */
|
|
350
|
+
config: PaymentConfig;
|
|
351
|
+
/** Optional environment override */
|
|
352
|
+
environment?: 'sandbox' | 'production';
|
|
353
|
+
/** Optional timeout settings */
|
|
354
|
+
timeout?: {
|
|
355
|
+
/** Timeout for payment creation (ms) */
|
|
356
|
+
create?: number;
|
|
357
|
+
/** Timeout for payment confirmation (ms) */
|
|
358
|
+
confirm?: number;
|
|
359
|
+
/** Timeout for status checks (ms) */
|
|
360
|
+
status?: number;
|
|
361
|
+
};
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Vendor Configuration Types
|
|
366
|
+
*
|
|
367
|
+
* Generic vendor configuration interface that adapters can extend
|
|
368
|
+
* for their specific needs while maintaining vendor-agnostic core types.
|
|
369
|
+
*/
|
|
370
|
+
/**
|
|
371
|
+
* Payment system configuration
|
|
372
|
+
*/
|
|
373
|
+
export declare interface PaymentConfig {
|
|
374
|
+
/** Global environment and vendor-specific configurations */
|
|
375
|
+
[key: string]: any;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Payment intent - represents the intent to collect a payment
|
|
380
|
+
*/
|
|
381
|
+
export declare interface PaymentIntent {
|
|
382
|
+
/** Unique payment intent ID */
|
|
383
|
+
id: string;
|
|
384
|
+
/** Payment amount in the smallest currency unit */
|
|
385
|
+
amount: number;
|
|
386
|
+
/** Currency code */
|
|
387
|
+
currency: string;
|
|
388
|
+
/** Crypto destinations for the payment */
|
|
389
|
+
destinations: CryptoDestination[];
|
|
390
|
+
/** Customer ID */
|
|
391
|
+
customerId: string;
|
|
392
|
+
/** Payment method ID to use */
|
|
393
|
+
paymentMethodId?: string;
|
|
394
|
+
/** Order/transaction ID */
|
|
395
|
+
orderId?: string;
|
|
396
|
+
/** Return URL after payment */
|
|
397
|
+
returnUrl?: string;
|
|
398
|
+
/** Additional metadata */
|
|
399
|
+
metadata?: Record<string, any>;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Payment method union type
|
|
404
|
+
*/
|
|
405
|
+
export declare type PaymentMethod = FiatPaymentMethod | CryptoPaymentMethod;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Payment method service for managing payment method registration and lookup
|
|
409
|
+
*/
|
|
410
|
+
export declare class PaymentMethodService {
|
|
411
|
+
private static instance;
|
|
412
|
+
private paymentMethods;
|
|
413
|
+
private constructor();
|
|
414
|
+
static getInstance(): PaymentMethodService;
|
|
415
|
+
/**
|
|
416
|
+
* Register a new payment method
|
|
417
|
+
*/
|
|
418
|
+
register(method: PaymentMethod): void;
|
|
419
|
+
/**
|
|
420
|
+
* Register multiple payment methods
|
|
421
|
+
*/
|
|
422
|
+
registerMany(methods: PaymentMethod[]): void;
|
|
423
|
+
/**
|
|
424
|
+
* Get payment method by ID
|
|
425
|
+
*/
|
|
426
|
+
getPaymentMethod(id: string): PaymentMethod | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Get all registered payment methods
|
|
429
|
+
*/
|
|
430
|
+
getAllPaymentMethods(): PaymentMethod[];
|
|
431
|
+
/**
|
|
432
|
+
* Check if payment method exists
|
|
433
|
+
*/
|
|
434
|
+
hasPaymentMethod(id: string): boolean;
|
|
435
|
+
/**
|
|
436
|
+
* Get payment methods by vendor
|
|
437
|
+
*/
|
|
438
|
+
getByVendor(vendorId: string): PaymentMethod[];
|
|
439
|
+
/**
|
|
440
|
+
* Get payment methods by method type (ach, wallet, exchange)
|
|
441
|
+
*/
|
|
442
|
+
getByMethod(methodType: string): PaymentMethod[];
|
|
443
|
+
/**
|
|
444
|
+
* Get payment methods by type (fiat or crypto)
|
|
445
|
+
*/
|
|
446
|
+
getByType(type: 'fiat' | 'crypto'): PaymentMethod[];
|
|
447
|
+
/**
|
|
448
|
+
* Get fiat payment methods only
|
|
449
|
+
*/
|
|
450
|
+
getFiatPaymentMethods(): FiatPaymentMethod[];
|
|
451
|
+
/**
|
|
452
|
+
* Get crypto payment methods only
|
|
453
|
+
*/
|
|
454
|
+
getCryptoPaymentMethods(): CryptoPaymentMethod[];
|
|
455
|
+
/**
|
|
456
|
+
* Get payment methods by currency
|
|
457
|
+
*/
|
|
458
|
+
getByCurrency(currencyCode: string): PaymentMethod[];
|
|
459
|
+
/**
|
|
460
|
+
* Get crypto payment methods by network
|
|
461
|
+
*/
|
|
462
|
+
getByNetwork(networkId: string): CryptoPaymentMethod[];
|
|
463
|
+
/**
|
|
464
|
+
* Get crypto payment methods by network and currency combination
|
|
465
|
+
*/
|
|
466
|
+
getByNetworkAndCurrency(networkId: string, currencyCode: string): CryptoPaymentMethod[];
|
|
467
|
+
/**
|
|
468
|
+
* Get payment methods by region
|
|
469
|
+
*/
|
|
470
|
+
getByRegion(region: string): PaymentMethod[];
|
|
471
|
+
/**
|
|
472
|
+
* Get active payment methods only
|
|
473
|
+
*/
|
|
474
|
+
getActive(): PaymentMethod[];
|
|
475
|
+
/**
|
|
476
|
+
* Get available payment methods for currency and region
|
|
477
|
+
*/
|
|
478
|
+
getAvailableFor(currencyCode: string, region?: string): PaymentMethod[];
|
|
479
|
+
/**
|
|
480
|
+
* Search payment methods by name or description
|
|
481
|
+
*/
|
|
482
|
+
searchPaymentMethods(query: string): PaymentMethod[];
|
|
483
|
+
/**
|
|
484
|
+
* Get wallet payment methods with optional currency and target filters
|
|
485
|
+
*/
|
|
486
|
+
getWalletMethods(filters?: {
|
|
487
|
+
currencies?: string[];
|
|
488
|
+
targetCurrency?: string;
|
|
489
|
+
targetNetwork?: string;
|
|
490
|
+
}): CryptoPaymentMethod[];
|
|
491
|
+
/**
|
|
492
|
+
* Get exchange payment methods with optional exchange and target filters
|
|
493
|
+
*/
|
|
494
|
+
getExchangeMethods(filters?: {
|
|
495
|
+
exchanges?: string[];
|
|
496
|
+
targetCurrency?: string;
|
|
497
|
+
}): CryptoPaymentMethod[];
|
|
498
|
+
/**
|
|
499
|
+
* Get fiat payment methods with optional method type filter
|
|
500
|
+
*/
|
|
501
|
+
getFiatMethods(filters?: {
|
|
502
|
+
methods?: string[];
|
|
503
|
+
}): FiatPaymentMethod[];
|
|
504
|
+
/**
|
|
505
|
+
* Get simple display options from filter values
|
|
506
|
+
*/
|
|
507
|
+
getDisplayOptions(filters?: {
|
|
508
|
+
walletFilter?: string[];
|
|
509
|
+
exchangeFilter?: string[];
|
|
510
|
+
fiatFilter?: string[];
|
|
511
|
+
targetCurrency?: string;
|
|
512
|
+
targetNetwork?: string;
|
|
513
|
+
}): Array<{
|
|
514
|
+
id: string;
|
|
515
|
+
displayName: string;
|
|
516
|
+
method: string;
|
|
517
|
+
}>;
|
|
518
|
+
/**
|
|
519
|
+
* Clear all payment methods (useful for testing)
|
|
520
|
+
*/
|
|
521
|
+
clear(): void;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Default payment method service instance
|
|
526
|
+
*/
|
|
527
|
+
export declare const paymentMethodService: PaymentMethodService;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Payment result from vendor
|
|
531
|
+
*/
|
|
532
|
+
export declare interface PaymentResult {
|
|
533
|
+
/** Payment ID from vendor */
|
|
534
|
+
id: string;
|
|
535
|
+
/** Payment status */
|
|
536
|
+
status: PaymentStatus;
|
|
537
|
+
/** Payment URL if applicable */
|
|
538
|
+
url?: string;
|
|
539
|
+
/** Additional result data */
|
|
540
|
+
data?: Record<string, any>;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Payment Types
|
|
545
|
+
*
|
|
546
|
+
* Core payment-related types for payment processing.
|
|
547
|
+
*/
|
|
548
|
+
/**
|
|
549
|
+
* Payment status types
|
|
550
|
+
*/
|
|
551
|
+
export declare type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Standard vendor adapter interface
|
|
555
|
+
*/
|
|
556
|
+
export declare interface VendorAdapter {
|
|
557
|
+
/** Unique adapter identifier */
|
|
558
|
+
readonly id: string;
|
|
559
|
+
/** Human-readable adapter name */
|
|
560
|
+
readonly name: string;
|
|
561
|
+
/**
|
|
562
|
+
* Initialize the adapter with configuration
|
|
563
|
+
*/
|
|
564
|
+
initialize(config: PaymentConfig): Promise<void>;
|
|
565
|
+
/**
|
|
566
|
+
* Register onramp payment methods this adapter supports
|
|
567
|
+
*/
|
|
568
|
+
registerOnrampMethods(paymentMethodService: PaymentMethodService): void;
|
|
569
|
+
/**
|
|
570
|
+
* Create checkout session for onramp payment
|
|
571
|
+
*/
|
|
572
|
+
createCheckoutSession(intent: PaymentIntent): Promise<CheckoutSession>;
|
|
573
|
+
/**
|
|
574
|
+
* Open checkout UI for client-side payment flow (optional)
|
|
575
|
+
* Uses session data returned from createCheckoutSession
|
|
576
|
+
*/
|
|
577
|
+
openCheckout?(session: CheckoutSession): Promise<PaymentResult>;
|
|
578
|
+
/**
|
|
579
|
+
* Get payment status
|
|
580
|
+
*/
|
|
581
|
+
getPaymentStatus(sessionId: string): Promise<PaymentResult>;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Complete theme configuration (Stripe-style)
|
|
586
|
+
*/
|
|
587
|
+
export declare interface W3Theme {
|
|
588
|
+
/** Named theme preset */
|
|
589
|
+
theme?: 'light' | 'dark' | string;
|
|
590
|
+
/** Design token overrides */
|
|
591
|
+
variables?: W3ThemeVariables;
|
|
592
|
+
/** Component-level style rules */
|
|
593
|
+
rules?: W3ThemeRules;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* Theme input - can be just a string for named themes or full config
|
|
598
|
+
*/
|
|
599
|
+
export declare type W3ThemeInput = string | W3Theme;
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* Component-level style overrides
|
|
603
|
+
* Record of CSS selectors to style properties
|
|
604
|
+
*/
|
|
605
|
+
export declare type W3ThemeRules = Record<string, CSSStyleProperties>;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Design token variables for common customizations
|
|
609
|
+
*/
|
|
610
|
+
export declare interface W3ThemeVariables {
|
|
611
|
+
/** Primary brand color */
|
|
612
|
+
colorPrimary?: string;
|
|
613
|
+
/** Primary color on hover/focus */
|
|
614
|
+
colorPrimaryHover?: string;
|
|
615
|
+
/** Light variant of primary color */
|
|
616
|
+
colorPrimaryLight?: string;
|
|
617
|
+
/** Background color */
|
|
618
|
+
colorBackground?: string;
|
|
619
|
+
/** Primary text color */
|
|
620
|
+
colorText?: string;
|
|
621
|
+
/** Secondary/muted text color */
|
|
622
|
+
colorTextMuted?: string;
|
|
623
|
+
/** Border color */
|
|
624
|
+
colorBorder?: string;
|
|
625
|
+
/** Light border color */
|
|
626
|
+
colorBorderLight?: string;
|
|
627
|
+
/** Error/danger color */
|
|
628
|
+
colorDanger?: string;
|
|
629
|
+
/** Success color */
|
|
630
|
+
colorSuccess?: string;
|
|
631
|
+
/** Font family */
|
|
632
|
+
fontFamily?: string;
|
|
633
|
+
/** Base font size */
|
|
634
|
+
fontSize?: string;
|
|
635
|
+
/** Border radius */
|
|
636
|
+
borderRadius?: string;
|
|
637
|
+
/** Base spacing unit */
|
|
638
|
+
spacing?: string;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
export { }
|