@w3payments/react 1.3.0 → 1.4.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/main.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  export declare const W3_PAYMENTS_REACT_VERSION = "1.0.0";
2
- export { W3PaymentsProvider, W3PaymentWidget } from './components';
3
- export { useW3Payments } from './hooks/useW3Payments';
4
- export type { W3PaymentsProviderProps, W3PaymentWidgetProps, PaymentInitiateData, PaymentCompleteData, PaymentErrorData, PaymentMethodRowProps, W3PaymentFooterProps, } from './components';
2
+ export { W3PaymentWidget } from './components';
3
+ export type { W3PaymentWidgetProps, PaymentMethodRowProps, W3PaymentFooterProps, } from './components';
5
4
  export type { PaymentEvent, PaymentError, PaymentMethodDisplayData, } from './types';
6
5
  declare const _default: {
7
6
  W3_PAYMENTS_REACT_VERSION: string;
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../lib/main.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,YAAY,CAAC;AAGpB,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAGjD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,wBAAwB,GACzB,MAAM,SAAS,CAAC;;;;AAGjB,wBAEE"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,YAAY,CAAC;AAGpB,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,cAAc,CAAC;AAGtB,YAAY,EACV,YAAY,EACZ,YAAY,EACZ,wBAAwB,GACzB,MAAM,SAAS,CAAC;;;;AAGjB,wBAEE"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../lib/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EACA,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,CAAC;IACxB,oBAAoB;IACpB,OAAO,EAAE,GAAG,CAAC;IACb,sBAAsB;IACtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EACA,mBAAmB,GACnB,oBAAoB,GACpB,mBAAmB,GACnB,gBAAgB,GAChB,mBAAmB,CAAC;IACxB,oBAAoB;IACpB,OAAO,EAAE,GAAG,CAAC;IACb,sBAAsB;IACtB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * QR Code Utilities for Payment Addresses
3
+ */
4
+ export interface QRCodeOptions {
5
+ /** Error correction level */
6
+ errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
7
+ /** QR code type */
8
+ type?: 'image/png' | 'image/jpeg' | 'image/webp';
9
+ /** Quality (0-1) for JPEG */
10
+ quality?: number;
11
+ /** Margin around QR code */
12
+ margin?: number;
13
+ /** Color options */
14
+ color?: {
15
+ dark?: string;
16
+ light?: string;
17
+ };
18
+ /** Width/height in pixels */
19
+ width?: number;
20
+ }
21
+ /**
22
+ * Generate QR code as data URL for payment addresses
23
+ */
24
+ export declare function generatePaymentQR(address: string, symbol?: string, amount?: string, options?: QRCodeOptions): Promise<string>;
25
+ /**
26
+ * Generate simple QR code for text/addresses
27
+ */
28
+ export declare function generateQRCode(data: string, options?: QRCodeOptions): Promise<string>;
29
+ /**
30
+ * Generate QR code as SVG string
31
+ */
32
+ export declare function generateQRCodeSVG(data: string, options?: Omit<QRCodeOptions, 'type' | 'quality'>): Promise<string>;
33
+ /**
34
+ * Validate if a string can be encoded as QR code
35
+ */
36
+ export declare function validateQRData(data: string): boolean;
37
+ /**
38
+ * Copy text to clipboard (browser utility)
39
+ */
40
+ export declare function copyToClipboard(text: string): Promise<boolean>;
41
+ //# sourceMappingURL=qr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../src/utils/qr.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,aAAa;IAC5B,6BAA6B;IAC7B,oBAAoB,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC7C,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;IACjD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oBAAoB;IACpB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAoBjB;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAM,GACpD,OAAO,CAAC,MAAM,CAAC,CAqBjB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASpD;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAsBpE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w3payments/react",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "React component library for universal Web3 payment processing with multi-vendor support",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,10 +53,10 @@
53
53
  ],
54
54
  "dependencies": {
55
55
  "@mantine/core": "^8.3.10",
56
+ "@types/qrcode": "^1.5.6",
56
57
  "framer-motion": "^12.23.26",
57
- "@w3payments/adapters": "1.2.2",
58
- "@w3payments/common": "1.3.0",
59
- "@w3payments/core": "1.2.2"
58
+ "qrcode": "^1.5.4",
59
+ "@w3payments/core": "1.3.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "react": ">=18.0.0",
@@ -1,21 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { PaymentEvent } from '../types';
3
- /**
4
- * W3PaymentsProvider component props
5
- */
6
- export interface W3PaymentsProviderProps {
7
- /** Server endpoint for W3Payments API */
8
- endpoint: string;
9
- /** Environment for payment adapters */
10
- environment?: 'sandbox' | 'production';
11
- /** Child components that will have access to payment context */
12
- children: ReactNode;
13
- /** Optional callback for payment events */
14
- onPaymentEvent?: (event: PaymentEvent) => void;
15
- }
16
- /**
17
- * W3PaymentsProvider component - HTTP client wrapper
18
- */
19
- export declare const W3PaymentsProvider: React.FC<W3PaymentsProviderProps>;
20
- export default W3PaymentsProvider;
21
- //# sourceMappingURL=W3PaymentsProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"W3PaymentsProvider.d.ts","sourceRoot":"","sources":["../../lib/components/W3PaymentsProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAQ5C;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,WAAW,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC;IACvC,gEAAgE;IAChE,QAAQ,EAAE,SAAS,CAAC;IACpB,2CAA2C;IAC3C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;CAChD;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA8FhE,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,28 +0,0 @@
1
- import { W3Payments } from '@w3payments/core';
2
- import { W3PaymentsClient } from '../http/W3PaymentsClient';
3
- /**
4
- * Context value - provides both W3Payments and HTTP client
5
- */
6
- export interface W3PaymentsContextValue {
7
- /** W3Payments client instance - for data access (currencies, payment methods) */
8
- w3payments: W3Payments | null;
9
- /** HTTP client - for secure payment processing */
10
- httpClient: W3PaymentsClient | null;
11
- /** Indicates whether both clients are initialized */
12
- isInitialized: boolean;
13
- /** Server endpoint for payment API */
14
- endpoint: string;
15
- }
16
- /**
17
- * React Context for W3 Payments system
18
- *
19
- * Usage:
20
- * ```tsx
21
- * const context = useContext(W3PaymentsContext);
22
- * if (!context) {
23
- * throw new Error('useW3Payments must be used within W3PaymentsProvider');
24
- * }
25
- * ```
26
- */
27
- export declare const W3PaymentsContext: import('react').Context<W3PaymentsContextValue | null>;
28
- //# sourceMappingURL=W3PaymentsContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"W3PaymentsContext.d.ts","sourceRoot":"","sources":["../../lib/context/W3PaymentsContext.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,iFAAiF;IACjF,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAE9B,kDAAkD;IAClD,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEpC,qDAAqD;IACrD,aAAa,EAAE,OAAO,CAAC;IAEvB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,wDAE7B,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * Hook Exports
3
- *
4
- * Central export point for React hooks in the W3 Payments React library.
5
- */
6
- export { useW3Payments } from './useW3Payments';
7
- export type { W3PaymentsContextValue } from '../context/W3PaymentsContext';
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,32 +0,0 @@
1
- import { W3PaymentsContextValue } from '../context/W3PaymentsContext';
2
- /**
3
- * Custom hook to access W3Payments client
4
- *
5
- * @returns W3PaymentsContextValue containing the client instance and initialization state
6
- * @throws Error when used outside of W3PaymentsProvider
7
- *
8
- * @example
9
- * ```tsx
10
- * function PaymentWidget() {
11
- * const { w3payments, isInitialized } = useW3Payments();
12
- *
13
- * if (!isInitialized || !w3payments) {
14
- * return <div>Loading payment client...</div>;
15
- * }
16
- *
17
- * const handlePayment = async () => {
18
- * const session = await w3payments.paymentIntents.create({
19
- * amount: 100,
20
- * currency: 'USD',
21
- * customerId: 'customer_123',
22
- * destinations: [...]
23
- * });
24
- * };
25
- *
26
- * return <button onClick={handlePayment}>Pay Now</button>;
27
- * }
28
- * ```
29
- */
30
- export declare const useW3Payments: () => W3PaymentsContextValue;
31
- export default useW3Payments;
32
- //# sourceMappingURL=useW3Payments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useW3Payments.d.ts","sourceRoot":"","sources":["../../lib/hooks/useW3Payments.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,6BAA6B,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,aAAa,QAAO,sBAWhC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,16 +0,0 @@
1
- import { CreatePaymentOptions, CheckoutSession, PaymentResult } from '@w3payments/common';
2
- export interface W3PaymentsClientConfig {
3
- endpoint: string;
4
- headers?: Record<string, string>;
5
- }
6
- export declare class W3PaymentsClient {
7
- private config;
8
- constructor(config: W3PaymentsClientConfig);
9
- private makeRequest;
10
- createPayment(options: CreatePaymentOptions): Promise<CheckoutSession & {
11
- selectedVendor: string;
12
- }>;
13
- getPaymentStatus(sessionId: string, vendorId: string): Promise<PaymentResult>;
14
- isInitialized(): boolean;
15
- }
16
- //# sourceMappingURL=W3PaymentsClient.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"W3PaymentsClient.d.ts","sourceRoot":"","sources":["../../lib/http/W3PaymentsClient.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EACf,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAyB;gBAE3B,MAAM,EAAE,sBAAsB;YAI5B,WAAW;IAoBnB,aAAa,CACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,eAAe,GAAG;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IAOlD,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC;IAMzB,aAAa,IAAI,OAAO;CAGzB"}