@w3payments/common 1.1.1 → 1.2.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 +46 -0
- package/dist/index.js +2229 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2230 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,11 @@ export declare interface CheckoutSession {
|
|
|
83
83
|
metadata?: Record<string, any>;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Copy text to clipboard (browser utility)
|
|
88
|
+
*/
|
|
89
|
+
export declare function copyToClipboard(text: string): Promise<boolean>;
|
|
90
|
+
|
|
86
91
|
export declare type CreatePaymentOptions = {
|
|
87
92
|
/** Unique payment intent ID */
|
|
88
93
|
id: string;
|
|
@@ -297,6 +302,21 @@ export declare function formatNumberDisplay(value: string | number, decimals: nu
|
|
|
297
302
|
*/
|
|
298
303
|
export declare function formatUSD(value: number): string;
|
|
299
304
|
|
|
305
|
+
/**
|
|
306
|
+
* Generate QR code as data URL for payment addresses
|
|
307
|
+
*/
|
|
308
|
+
export declare function generatePaymentQR(address: string, symbol?: string, amount?: string, options?: QRCodeOptions): Promise<string>;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Generate simple QR code for text/addresses
|
|
312
|
+
*/
|
|
313
|
+
export declare function generateQRCode(data: string, options?: QRCodeOptions): Promise<string>;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Generate QR code as SVG string
|
|
317
|
+
*/
|
|
318
|
+
export declare function generateQRCodeSVG(data: string, options?: Omit<QRCodeOptions, 'type' | 'quality'>): Promise<string>;
|
|
319
|
+
|
|
300
320
|
export declare function getCurrencyIcon(code: string): string | undefined;
|
|
301
321
|
|
|
302
322
|
export declare function getExchangeIcon(exchange: string): string | undefined;
|
|
@@ -578,6 +598,27 @@ export declare interface PaymentResult {
|
|
|
578
598
|
*/
|
|
579
599
|
export declare type PaymentStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled';
|
|
580
600
|
|
|
601
|
+
/**
|
|
602
|
+
* QR Code Utilities for Payment Addresses
|
|
603
|
+
*/
|
|
604
|
+
export declare interface QRCodeOptions {
|
|
605
|
+
/** Error correction level */
|
|
606
|
+
errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
607
|
+
/** QR code type */
|
|
608
|
+
type?: 'image/png' | 'image/jpeg' | 'image/webp';
|
|
609
|
+
/** Quality (0-1) for JPEG */
|
|
610
|
+
quality?: number;
|
|
611
|
+
/** Margin around QR code */
|
|
612
|
+
margin?: number;
|
|
613
|
+
/** Color options */
|
|
614
|
+
color?: {
|
|
615
|
+
dark?: string;
|
|
616
|
+
light?: string;
|
|
617
|
+
};
|
|
618
|
+
/** Width/height in pixels */
|
|
619
|
+
width?: number;
|
|
620
|
+
}
|
|
621
|
+
|
|
581
622
|
/**
|
|
582
623
|
* Truncate value to currency's maximum decimal places
|
|
583
624
|
*/
|
|
@@ -588,6 +629,11 @@ export declare function truncateToCurrencyDecimals(value: string, currency: Curr
|
|
|
588
629
|
*/
|
|
589
630
|
export declare function validateCurrencyDecimals(value: string, currency: Currency): boolean;
|
|
590
631
|
|
|
632
|
+
/**
|
|
633
|
+
* Validate if a string can be encoded as QR code
|
|
634
|
+
*/
|
|
635
|
+
export declare function validateQRData(data: string): boolean;
|
|
636
|
+
|
|
591
637
|
/**
|
|
592
638
|
* Standard vendor adapter interface
|
|
593
639
|
*/
|