@w3payments/react 1.3.0 → 1.5.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/README.md +259 -28
- package/dist/appearance.d.ts +47 -0
- package/dist/appearance.d.ts.map +1 -0
- package/dist/assets/main.css +1 -1
- package/dist/components/CurrencyIcon.d.ts +71 -0
- package/dist/components/CurrencyIcon.d.ts.map +1 -0
- package/dist/components/ExchangeIcon.d.ts +8 -0
- package/dist/components/ExchangeIcon.d.ts.map +1 -0
- package/dist/components/PaymentMethodRow.d.ts +2 -0
- package/dist/components/PaymentMethodRow.d.ts.map +1 -1
- package/dist/components/W3PaymentFooter.d.ts.map +1 -1
- package/dist/components/W3PaymentWidget.d.ts +46 -56
- package/dist/components/W3PaymentWidget.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +15 -15
- package/dist/index.mjs +10061 -14449
- package/dist/main.d.ts +2 -3
- package/dist/main.d.ts.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/qr.d.ts +41 -0
- package/dist/utils/qr.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/assets/3.svg +0 -1
- package/dist/assets/io.svg +0 -1
- package/dist/assets/vite.svg +0 -1
- package/dist/assets/w.svg +0 -1
- package/dist/components/W3PaymentsProvider.d.ts +0 -21
- package/dist/components/W3PaymentsProvider.d.ts.map +0 -1
- package/dist/context/W3PaymentsContext.d.ts +0 -28
- package/dist/context/W3PaymentsContext.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -8
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/useW3Payments.d.ts +0 -32
- package/dist/hooks/useW3Payments.d.ts.map +0 -1
- package/dist/http/W3PaymentsClient.d.ts +0 -16
- package/dist/http/W3PaymentsClient.d.ts.map +0 -1
- package/dist/index-B9KdNmCT.cjs +0 -94
- package/dist/index-Cu_k1Q9p.js +0 -13544
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AvatarProps } from '@mantine/core';
|
|
3
|
+
export declare const CURRENCIES: {
|
|
4
|
+
BTC: {
|
|
5
|
+
name: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
color: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
};
|
|
10
|
+
ETH: {
|
|
11
|
+
name: string;
|
|
12
|
+
decimals: number;
|
|
13
|
+
color: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
};
|
|
16
|
+
USDC: {
|
|
17
|
+
name: string;
|
|
18
|
+
decimals: number;
|
|
19
|
+
color: string;
|
|
20
|
+
symbol: string;
|
|
21
|
+
};
|
|
22
|
+
USDT: {
|
|
23
|
+
name: string;
|
|
24
|
+
decimals: number;
|
|
25
|
+
color: string;
|
|
26
|
+
symbol: string;
|
|
27
|
+
};
|
|
28
|
+
SOL: {
|
|
29
|
+
name: string;
|
|
30
|
+
decimals: number;
|
|
31
|
+
color: string;
|
|
32
|
+
symbol: string;
|
|
33
|
+
};
|
|
34
|
+
ADA: {
|
|
35
|
+
name: string;
|
|
36
|
+
decimals: number;
|
|
37
|
+
color: string;
|
|
38
|
+
symbol: string;
|
|
39
|
+
};
|
|
40
|
+
USD: {
|
|
41
|
+
name: string;
|
|
42
|
+
decimals: number;
|
|
43
|
+
color: string;
|
|
44
|
+
symbol: string;
|
|
45
|
+
};
|
|
46
|
+
EUR: {
|
|
47
|
+
name: string;
|
|
48
|
+
decimals: number;
|
|
49
|
+
color: string;
|
|
50
|
+
symbol: string;
|
|
51
|
+
};
|
|
52
|
+
GBP: {
|
|
53
|
+
name: string;
|
|
54
|
+
decimals: number;
|
|
55
|
+
color: string;
|
|
56
|
+
symbol: string;
|
|
57
|
+
};
|
|
58
|
+
PHP: {
|
|
59
|
+
name: string;
|
|
60
|
+
decimals: number;
|
|
61
|
+
color: string;
|
|
62
|
+
symbol: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
interface CurrencyIconProps extends Omit<AvatarProps, 'children'> {
|
|
66
|
+
currency: keyof typeof CURRENCIES;
|
|
67
|
+
}
|
|
68
|
+
export declare const CurrencyIcon: React.FC<CurrencyIconProps>;
|
|
69
|
+
export declare const formatAmount: (amount: number, currency: keyof typeof CURRENCIES) => string;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=CurrencyIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencyIcon.d.ts","sourceRoot":"","sources":["../../src/components/CurrencyIcon.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAWtB,CAAC;AAEF,UAAU,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC;IAC/D,QAAQ,EAAE,MAAM,OAAO,UAAU,CAAC;CACnC;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAYpD,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,QAAQ,MAAM,EACd,UAAU,MAAM,OAAO,UAAU,WACe,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AvatarProps } from '@mantine/core';
|
|
3
|
+
interface ExchangeIconProps extends Omit<AvatarProps, 'children' | 'src'> {
|
|
4
|
+
exchange: 'coinbase' | 'binance' | 'kraken';
|
|
5
|
+
}
|
|
6
|
+
export declare const ExchangeIcon: React.FC<ExchangeIconProps>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ExchangeIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExchangeIcon.d.ts","sourceRoot":"","sources":["../../src/components/ExchangeIcon.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAYjD,UAAU,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,KAAK,CAAC;IACvE,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC7C;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAQpD,CAAC"}
|
|
@@ -8,6 +8,8 @@ export interface PaymentMethodRowProps {
|
|
|
8
8
|
description: string;
|
|
9
9
|
/** Icon URL for the payment method */
|
|
10
10
|
iconUrl?: string;
|
|
11
|
+
/** Custom icon component */
|
|
12
|
+
icon?: React.ReactNode;
|
|
11
13
|
/** Fallback text for avatar if no icon */
|
|
12
14
|
fallbackText?: string;
|
|
13
15
|
/** Avatar color for fallback */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PaymentMethodRow.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"PaymentMethodRow.d.ts","sourceRoot":"","sources":["../../src/components/PaymentMethodRow.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,MAAM,WAAW,qBAAqB;IACpC,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oBAAoB;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiG5D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"W3PaymentFooter.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"W3PaymentFooter.d.ts","sourceRoot":"","sources":["../../src/components/W3PaymentFooter.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAsE1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,74 +1,64 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { W3Appearance } from '../appearance';
|
|
3
|
+
import { PaymentIntent } from '@w3payments/core';
|
|
4
|
+
export interface Destination {
|
|
5
|
+
address: string;
|
|
5
6
|
currency: string;
|
|
6
|
-
|
|
7
|
-
userId?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface PaymentCompleteData {
|
|
10
|
-
amount: string;
|
|
11
|
-
currency: string;
|
|
12
|
-
paymentMethodId: string;
|
|
13
|
-
transactionId: string;
|
|
14
|
-
vendorId: string;
|
|
15
|
-
status: 'pending' | 'processing' | 'completed' | 'failed' | 'expired';
|
|
16
|
-
userId?: string;
|
|
17
|
-
checkoutData?: Record<string, any>;
|
|
18
|
-
}
|
|
19
|
-
export interface PaymentErrorData {
|
|
20
|
-
code?: string;
|
|
21
|
-
message: string;
|
|
22
|
-
transactionId?: string;
|
|
23
|
-
vendorId?: string;
|
|
24
|
-
userId?: string;
|
|
25
|
-
details?: unknown;
|
|
7
|
+
network: string;
|
|
26
8
|
}
|
|
27
9
|
export interface W3PaymentWidgetProps {
|
|
10
|
+
/** API endpoint for W3 Payments backend */
|
|
11
|
+
endpoint: string;
|
|
12
|
+
/** Target currency to receive (e.g., 'USDC', 'BTC') */
|
|
13
|
+
currency: string;
|
|
14
|
+
/** Target network (e.g., 'ethereum', 'solana') */
|
|
15
|
+
network: string;
|
|
16
|
+
/** Destination addresses where payments will be sent */
|
|
17
|
+
destinations: Destination[];
|
|
18
|
+
/** Amount in target currency (optional, if not provided shows input) */
|
|
19
|
+
amount?: string;
|
|
28
20
|
/** Widget title (displayed in header) */
|
|
29
21
|
title?: string;
|
|
22
|
+
/** Description text below title */
|
|
23
|
+
description?: string;
|
|
30
24
|
/** Widget subtitle */
|
|
31
25
|
subtitle?: string;
|
|
32
26
|
/** Widget logo URL (displayed in header) */
|
|
33
27
|
logo?: string;
|
|
34
|
-
/** Show payment amount section (default: true) */
|
|
35
|
-
showAmount?: boolean;
|
|
36
|
-
/** Show header with title/logo (default: true) */
|
|
37
|
-
showHeader?: boolean;
|
|
38
28
|
/** Theme preset name */
|
|
39
29
|
theme?: 'default' | 'night';
|
|
40
|
-
/**
|
|
30
|
+
/** Custom appearance overrides */
|
|
41
31
|
appearance?: W3Appearance;
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
/** Called when payment is initiated
|
|
67
|
-
onInitiate?: (
|
|
32
|
+
/** Show amount display */
|
|
33
|
+
showAmount?: boolean;
|
|
34
|
+
/** Show USD conversion */
|
|
35
|
+
showUsdConversion?: boolean;
|
|
36
|
+
/** USD conversion rate */
|
|
37
|
+
usdRate?: number;
|
|
38
|
+
/** Enable direct payment option with QR code */
|
|
39
|
+
enableDirect?: boolean;
|
|
40
|
+
/** Transaction/Order ID from merchant system */
|
|
41
|
+
transactionId?: string | number;
|
|
42
|
+
/** QR screen payment label (e.g., "Paying:", "Staking:") */
|
|
43
|
+
qrPaymentLabel?: string;
|
|
44
|
+
/** QR screen receiving label (e.g., "Receiving:") */
|
|
45
|
+
qrReceivingLabel?: string;
|
|
46
|
+
/** QR screen receiving amount/token */
|
|
47
|
+
qrReceivingAmount?: string;
|
|
48
|
+
/** QR screen description text */
|
|
49
|
+
qrDescription?: string;
|
|
50
|
+
/** Customer ID from merchant system */
|
|
51
|
+
customerId?: string | number;
|
|
52
|
+
/** Idempotency key to prevent duplicate charges */
|
|
53
|
+
idempotencyKey?: string;
|
|
54
|
+
/** URL to redirect after payment completion */
|
|
55
|
+
callbackUrl?: string;
|
|
56
|
+
/** Called when payment is initiated */
|
|
57
|
+
onInitiate?: (intent: PaymentIntent) => void | Promise<void>;
|
|
68
58
|
/** Called when payment completes successfully */
|
|
69
|
-
onComplete?: (
|
|
59
|
+
onComplete?: (response: any) => void;
|
|
70
60
|
/** Called when payment fails */
|
|
71
|
-
onError?: (error:
|
|
61
|
+
onError?: (error: Error) => void;
|
|
72
62
|
}
|
|
73
63
|
export declare const W3PaymentWidget: React.FC<W3PaymentWidgetProps>;
|
|
74
64
|
export default W3PaymentWidget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"W3PaymentWidget.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"W3PaymentW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AAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uCAAuC;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,iDAAiD;IACjD,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IACrC,gCAAgC;IAChC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAy6B1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Central export point for React components in the W3 Payments React library.
|
|
5
5
|
*/
|
|
6
|
-
export { W3PaymentsProvider } from './W3PaymentsProvider';
|
|
7
6
|
export { W3PaymentWidget } from './W3PaymentWidget';
|
|
8
7
|
export { PaymentMethodRow } from './PaymentMethodRow';
|
|
9
8
|
export { W3PaymentFooter } from './W3PaymentFooter';
|
|
10
|
-
export type {
|
|
11
|
-
export type { W3PaymentWidgetProps, PaymentInitiateData, PaymentCompleteData, PaymentErrorData, } from './W3PaymentWidget';
|
|
9
|
+
export type { W3PaymentWidgetProps } from './W3PaymentWidget';
|
|
12
10
|
export type { PaymentMethodRowProps } from './PaymentMethodRow';
|
|
13
11
|
export type { W3PaymentFooterProps } from './W3PaymentFooter';
|
|
14
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|