@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/appearance.d.ts +30 -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.map +1 -1
- package/dist/components/W3PaymentFooter.d.ts.map +1 -1
- package/dist/components/W3PaymentWidget.d.ts +28 -57
- 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 +9485 -14301
- 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 +4 -4
- 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"}
|
|
@@ -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;AAGxC,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,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,CA+F5D,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,CAuE1D,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,74 +1,45 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
export interface
|
|
4
|
-
|
|
2
|
+
import { PaymentIntent } from '@w3payments/core';
|
|
3
|
+
export interface Destination {
|
|
4
|
+
address: string;
|
|
5
5
|
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;
|
|
6
|
+
network: string;
|
|
26
7
|
}
|
|
27
8
|
export interface W3PaymentWidgetProps {
|
|
9
|
+
/** API endpoint for W3 Payments backend */
|
|
10
|
+
endpoint: string;
|
|
11
|
+
/** Target currency to receive (e.g., 'USDC', 'BTC') */
|
|
12
|
+
currency: string;
|
|
13
|
+
/** Target network (e.g., 'ethereum', 'solana') */
|
|
14
|
+
network: string;
|
|
15
|
+
/** Destination addresses where payments will be sent */
|
|
16
|
+
destinations: Destination[];
|
|
17
|
+
/** Amount in target currency (optional, if not provided shows input) */
|
|
18
|
+
amount?: string;
|
|
28
19
|
/** Widget title (displayed in header) */
|
|
29
20
|
title?: string;
|
|
30
21
|
/** Widget subtitle */
|
|
31
22
|
subtitle?: string;
|
|
32
23
|
/** Widget logo URL (displayed in header) */
|
|
33
24
|
logo?: string;
|
|
34
|
-
/** Show payment amount section (default: true) */
|
|
35
|
-
showAmount?: boolean;
|
|
36
|
-
/** Show header with title/logo (default: true) */
|
|
37
|
-
showHeader?: boolean;
|
|
38
25
|
/** Theme preset name */
|
|
39
26
|
theme?: 'default' | 'night';
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
/** Payment currency code (default: 'USD') */
|
|
53
|
-
currency?: string;
|
|
54
|
-
/** Target currency to receive (e.g., 'USDC', 'BTC'). Filters payment methods to only show those supporting this currency */
|
|
55
|
-
targetCurrency?: string;
|
|
56
|
-
/** Target network to receive on (e.g., 'ethereum', 'solana', 'bitcoin'). Works with targetCurrency to filter methods */
|
|
57
|
-
targetNetwork?: string;
|
|
58
|
-
/** Crypto destinations where payments will be sent */
|
|
59
|
-
destinations?: CryptoDestination[];
|
|
60
|
-
/** Filter for wallet payment methods. Format: ['BTC', 'ETH'] for main networks, ['BTC-ETH'] for BTC on Ethereum */
|
|
61
|
-
walletFilter?: string[];
|
|
62
|
-
/** Filter for exchange payment methods. Format: ['exchangeTypeA', 'exchangeTypeB'] */
|
|
63
|
-
exchangeFilter?: string[];
|
|
64
|
-
/** Filter for fiat payment methods. Format: ['ACH'] */
|
|
65
|
-
fiatFilter?: string[];
|
|
66
|
-
/** Called when payment is initiated (Buy button clicked) */
|
|
67
|
-
onInitiate?: (data: PaymentInitiateData) => void | Promise<void>;
|
|
27
|
+
/** Enable direct payment option with QR code */
|
|
28
|
+
enableDirect?: boolean;
|
|
29
|
+
/** Transaction/Order ID from merchant system */
|
|
30
|
+
transactionId?: string | number;
|
|
31
|
+
/** Customer ID from merchant system */
|
|
32
|
+
customerId?: string | number;
|
|
33
|
+
/** Idempotency key to prevent duplicate charges */
|
|
34
|
+
idempotencyKey?: string;
|
|
35
|
+
/** URL to redirect after payment completion */
|
|
36
|
+
callbackUrl?: string;
|
|
37
|
+
/** Called when payment is initiated */
|
|
38
|
+
onInitiate?: (intent: PaymentIntent) => void | Promise<void>;
|
|
68
39
|
/** Called when payment completes successfully */
|
|
69
|
-
onComplete?: (
|
|
40
|
+
onComplete?: (response: any) => void;
|
|
70
41
|
/** Called when payment fails */
|
|
71
|
-
onError?: (error:
|
|
42
|
+
onError?: (error: Error) => void;
|
|
72
43
|
}
|
|
73
44
|
export declare const W3PaymentWidget: React.FC<W3PaymentWidgetProps>;
|
|
74
45
|
export default W3PaymentWidget;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"W3PaymentWidget.d.ts","sourceRoot":"","sources":["../../
|
|
1
|
+
{"version":3,"file":"W3PaymentWidget.d.ts","sourceRoot":"","sources":["../../src/components/W3PaymentWidget.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAA8B,MAAM,OAAO,CAAC;AAmBnD,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,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,CAkrB1D,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"}
|