@reevit/react 0.4.0 → 0.4.2
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.mts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/index.js +306 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +307 -16
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +212 -82
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -93,10 +93,16 @@ interface PaymentError {
|
|
|
93
93
|
interface ReevitTheme {
|
|
94
94
|
/** Primary brand color */
|
|
95
95
|
primaryColor?: string;
|
|
96
|
+
/** Primary text color on brand surfaces */
|
|
97
|
+
primaryForegroundColor?: string;
|
|
96
98
|
/** Background color */
|
|
97
99
|
backgroundColor?: string;
|
|
100
|
+
/** Surface color for cards/panels */
|
|
101
|
+
surfaceColor?: string;
|
|
98
102
|
/** Text color */
|
|
99
103
|
textColor?: string;
|
|
104
|
+
/** Muted text color */
|
|
105
|
+
mutedTextColor?: string;
|
|
100
106
|
/** Border radius for inputs and buttons */
|
|
101
107
|
borderRadius?: string;
|
|
102
108
|
/** Font family to use */
|
|
@@ -104,6 +110,12 @@ interface ReevitTheme {
|
|
|
104
110
|
/** Whether to use dark mode */
|
|
105
111
|
darkMode?: boolean;
|
|
106
112
|
}
|
|
113
|
+
interface CheckoutProviderOption {
|
|
114
|
+
provider: string;
|
|
115
|
+
name: string;
|
|
116
|
+
methods: PaymentMethod[];
|
|
117
|
+
countries?: string[];
|
|
118
|
+
}
|
|
107
119
|
interface MobileMoneyFormData {
|
|
108
120
|
phone: string;
|
|
109
121
|
network: MobileMoneyNetwork;
|
|
@@ -148,6 +160,10 @@ interface PaymentIntent {
|
|
|
148
160
|
netAmount?: number;
|
|
149
161
|
/** Additional metadata */
|
|
150
162
|
metadata?: Record<string, unknown>;
|
|
163
|
+
/** Available PSPs for this checkout session */
|
|
164
|
+
availableProviders?: CheckoutProviderOption[];
|
|
165
|
+
/** Brand theme from checkout settings */
|
|
166
|
+
branding?: ReevitTheme;
|
|
151
167
|
}
|
|
152
168
|
|
|
153
169
|
interface ReevitContextValue {
|
|
@@ -195,7 +211,10 @@ declare function useReevit(options: UseReevitOptions): {
|
|
|
195
211
|
selectedMethod: PaymentMethod | null;
|
|
196
212
|
error: PaymentError | null;
|
|
197
213
|
result: PaymentResult | null;
|
|
198
|
-
initialize: (method?: PaymentMethod
|
|
214
|
+
initialize: (method?: PaymentMethod, options?: {
|
|
215
|
+
preferredProvider?: string;
|
|
216
|
+
allowedProviders?: string[];
|
|
217
|
+
}) => Promise<void>;
|
|
199
218
|
selectMethod: (method: PaymentMethod) => void;
|
|
200
219
|
processPayment: (paymentData: Record<string, unknown>) => Promise<void>;
|
|
201
220
|
handlePspSuccess: (pspData: Record<string, unknown>) => Promise<void>;
|
|
@@ -258,6 +277,8 @@ declare function loadPaystackScript(): Promise<void>;
|
|
|
258
277
|
declare function PaystackBridge({ publicKey, email, phone, amount, currency, reference, accessCode, metadata, channels, onSuccess, onError, onClose, autoStart, }: PaystackBridgeProps): react_jsx_runtime.JSX.Element;
|
|
259
278
|
|
|
260
279
|
interface HubtelBridgeProps {
|
|
280
|
+
paymentId: string;
|
|
281
|
+
publicKey: string;
|
|
261
282
|
merchantAccount: string | number;
|
|
262
283
|
amount: number;
|
|
263
284
|
currency?: string;
|
|
@@ -266,13 +287,16 @@ interface HubtelBridgeProps {
|
|
|
266
287
|
phone?: string;
|
|
267
288
|
description?: string;
|
|
268
289
|
callbackUrl?: string;
|
|
290
|
+
/** Session token from server (recommended - credentials never exposed to client) */
|
|
291
|
+
hubtelSessionToken?: string;
|
|
292
|
+
/** Basic auth credential (legacy - credentials exposed to client, deprecated) */
|
|
269
293
|
basicAuth?: string;
|
|
270
294
|
onSuccess: (result: PaymentResult) => void;
|
|
271
295
|
onError: (error: PaymentError) => void;
|
|
272
296
|
onClose: () => void;
|
|
273
297
|
autoStart?: boolean;
|
|
274
298
|
}
|
|
275
|
-
declare function HubtelBridge({ merchantAccount, amount, reference, phone, description, callbackUrl, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
299
|
+
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, hubtelSessionToken, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
276
300
|
/**
|
|
277
301
|
* Opens Hubtel checkout modal directly
|
|
278
302
|
* Uses the @hubteljs/checkout npm package
|
|
@@ -552,6 +576,27 @@ interface PaymentIntentResponse {
|
|
|
552
576
|
fee_currency: string;
|
|
553
577
|
net_amount: number;
|
|
554
578
|
reference?: string;
|
|
579
|
+
available_psps?: Array<{
|
|
580
|
+
provider: string;
|
|
581
|
+
name: string;
|
|
582
|
+
methods: string[];
|
|
583
|
+
countries?: string[];
|
|
584
|
+
}>;
|
|
585
|
+
branding?: Record<string, unknown>;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Response from creating a Hubtel session token.
|
|
589
|
+
* The token provides secure, short-lived access to Hubtel checkout without exposing credentials.
|
|
590
|
+
*/
|
|
591
|
+
interface HubtelSessionResponse {
|
|
592
|
+
/** Short-lived session token for Hubtel checkout */
|
|
593
|
+
token: string;
|
|
594
|
+
/** Hubtel merchant account number */
|
|
595
|
+
merchantAccount: string;
|
|
596
|
+
/** Token expiry time in seconds */
|
|
597
|
+
expiresInSeconds: number;
|
|
598
|
+
/** Unix timestamp when the token expires */
|
|
599
|
+
expiresAt: number;
|
|
555
600
|
}
|
|
556
601
|
interface PaymentDetailResponse {
|
|
557
602
|
id: string;
|
|
@@ -600,7 +645,10 @@ declare class ReevitAPIClient {
|
|
|
600
645
|
/**
|
|
601
646
|
* Creates a payment intent
|
|
602
647
|
*/
|
|
603
|
-
createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string
|
|
648
|
+
createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string, options?: {
|
|
649
|
+
preferredProviders?: string[];
|
|
650
|
+
allowedProviders?: string[];
|
|
651
|
+
}): Promise<{
|
|
604
652
|
data?: PaymentIntentResponse;
|
|
605
653
|
error?: PaymentError;
|
|
606
654
|
}>;
|
|
@@ -632,6 +680,18 @@ declare class ReevitAPIClient {
|
|
|
632
680
|
data?: PaymentDetailResponse;
|
|
633
681
|
error?: PaymentError;
|
|
634
682
|
}>;
|
|
683
|
+
/**
|
|
684
|
+
* Creates a Hubtel session token for secure checkout.
|
|
685
|
+
* This endpoint generates a short-lived token that maps to Hubtel credentials server-side,
|
|
686
|
+
* avoiding exposure of sensitive credentials to the client.
|
|
687
|
+
*
|
|
688
|
+
* @param paymentId - The payment intent ID for Hubtel checkout
|
|
689
|
+
* @returns Hubtel session with token, merchant account, and expiry information
|
|
690
|
+
*/
|
|
691
|
+
createHubtelSession(paymentId: string): Promise<{
|
|
692
|
+
data?: HubtelSessionResponse;
|
|
693
|
+
error?: PaymentError;
|
|
694
|
+
}>;
|
|
635
695
|
/**
|
|
636
696
|
* Maps SDK payment method to backend format
|
|
637
697
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -93,10 +93,16 @@ interface PaymentError {
|
|
|
93
93
|
interface ReevitTheme {
|
|
94
94
|
/** Primary brand color */
|
|
95
95
|
primaryColor?: string;
|
|
96
|
+
/** Primary text color on brand surfaces */
|
|
97
|
+
primaryForegroundColor?: string;
|
|
96
98
|
/** Background color */
|
|
97
99
|
backgroundColor?: string;
|
|
100
|
+
/** Surface color for cards/panels */
|
|
101
|
+
surfaceColor?: string;
|
|
98
102
|
/** Text color */
|
|
99
103
|
textColor?: string;
|
|
104
|
+
/** Muted text color */
|
|
105
|
+
mutedTextColor?: string;
|
|
100
106
|
/** Border radius for inputs and buttons */
|
|
101
107
|
borderRadius?: string;
|
|
102
108
|
/** Font family to use */
|
|
@@ -104,6 +110,12 @@ interface ReevitTheme {
|
|
|
104
110
|
/** Whether to use dark mode */
|
|
105
111
|
darkMode?: boolean;
|
|
106
112
|
}
|
|
113
|
+
interface CheckoutProviderOption {
|
|
114
|
+
provider: string;
|
|
115
|
+
name: string;
|
|
116
|
+
methods: PaymentMethod[];
|
|
117
|
+
countries?: string[];
|
|
118
|
+
}
|
|
107
119
|
interface MobileMoneyFormData {
|
|
108
120
|
phone: string;
|
|
109
121
|
network: MobileMoneyNetwork;
|
|
@@ -148,6 +160,10 @@ interface PaymentIntent {
|
|
|
148
160
|
netAmount?: number;
|
|
149
161
|
/** Additional metadata */
|
|
150
162
|
metadata?: Record<string, unknown>;
|
|
163
|
+
/** Available PSPs for this checkout session */
|
|
164
|
+
availableProviders?: CheckoutProviderOption[];
|
|
165
|
+
/** Brand theme from checkout settings */
|
|
166
|
+
branding?: ReevitTheme;
|
|
151
167
|
}
|
|
152
168
|
|
|
153
169
|
interface ReevitContextValue {
|
|
@@ -195,7 +211,10 @@ declare function useReevit(options: UseReevitOptions): {
|
|
|
195
211
|
selectedMethod: PaymentMethod | null;
|
|
196
212
|
error: PaymentError | null;
|
|
197
213
|
result: PaymentResult | null;
|
|
198
|
-
initialize: (method?: PaymentMethod
|
|
214
|
+
initialize: (method?: PaymentMethod, options?: {
|
|
215
|
+
preferredProvider?: string;
|
|
216
|
+
allowedProviders?: string[];
|
|
217
|
+
}) => Promise<void>;
|
|
199
218
|
selectMethod: (method: PaymentMethod) => void;
|
|
200
219
|
processPayment: (paymentData: Record<string, unknown>) => Promise<void>;
|
|
201
220
|
handlePspSuccess: (pspData: Record<string, unknown>) => Promise<void>;
|
|
@@ -258,6 +277,8 @@ declare function loadPaystackScript(): Promise<void>;
|
|
|
258
277
|
declare function PaystackBridge({ publicKey, email, phone, amount, currency, reference, accessCode, metadata, channels, onSuccess, onError, onClose, autoStart, }: PaystackBridgeProps): react_jsx_runtime.JSX.Element;
|
|
259
278
|
|
|
260
279
|
interface HubtelBridgeProps {
|
|
280
|
+
paymentId: string;
|
|
281
|
+
publicKey: string;
|
|
261
282
|
merchantAccount: string | number;
|
|
262
283
|
amount: number;
|
|
263
284
|
currency?: string;
|
|
@@ -266,13 +287,16 @@ interface HubtelBridgeProps {
|
|
|
266
287
|
phone?: string;
|
|
267
288
|
description?: string;
|
|
268
289
|
callbackUrl?: string;
|
|
290
|
+
/** Session token from server (recommended - credentials never exposed to client) */
|
|
291
|
+
hubtelSessionToken?: string;
|
|
292
|
+
/** Basic auth credential (legacy - credentials exposed to client, deprecated) */
|
|
269
293
|
basicAuth?: string;
|
|
270
294
|
onSuccess: (result: PaymentResult) => void;
|
|
271
295
|
onError: (error: PaymentError) => void;
|
|
272
296
|
onClose: () => void;
|
|
273
297
|
autoStart?: boolean;
|
|
274
298
|
}
|
|
275
|
-
declare function HubtelBridge({ merchantAccount, amount, reference, phone, description, callbackUrl, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
299
|
+
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, hubtelSessionToken, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
276
300
|
/**
|
|
277
301
|
* Opens Hubtel checkout modal directly
|
|
278
302
|
* Uses the @hubteljs/checkout npm package
|
|
@@ -552,6 +576,27 @@ interface PaymentIntentResponse {
|
|
|
552
576
|
fee_currency: string;
|
|
553
577
|
net_amount: number;
|
|
554
578
|
reference?: string;
|
|
579
|
+
available_psps?: Array<{
|
|
580
|
+
provider: string;
|
|
581
|
+
name: string;
|
|
582
|
+
methods: string[];
|
|
583
|
+
countries?: string[];
|
|
584
|
+
}>;
|
|
585
|
+
branding?: Record<string, unknown>;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Response from creating a Hubtel session token.
|
|
589
|
+
* The token provides secure, short-lived access to Hubtel checkout without exposing credentials.
|
|
590
|
+
*/
|
|
591
|
+
interface HubtelSessionResponse {
|
|
592
|
+
/** Short-lived session token for Hubtel checkout */
|
|
593
|
+
token: string;
|
|
594
|
+
/** Hubtel merchant account number */
|
|
595
|
+
merchantAccount: string;
|
|
596
|
+
/** Token expiry time in seconds */
|
|
597
|
+
expiresInSeconds: number;
|
|
598
|
+
/** Unix timestamp when the token expires */
|
|
599
|
+
expiresAt: number;
|
|
555
600
|
}
|
|
556
601
|
interface PaymentDetailResponse {
|
|
557
602
|
id: string;
|
|
@@ -600,7 +645,10 @@ declare class ReevitAPIClient {
|
|
|
600
645
|
/**
|
|
601
646
|
* Creates a payment intent
|
|
602
647
|
*/
|
|
603
|
-
createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string
|
|
648
|
+
createPaymentIntent(config: ReevitCheckoutConfig, method: PaymentMethod, country?: string, options?: {
|
|
649
|
+
preferredProviders?: string[];
|
|
650
|
+
allowedProviders?: string[];
|
|
651
|
+
}): Promise<{
|
|
604
652
|
data?: PaymentIntentResponse;
|
|
605
653
|
error?: PaymentError;
|
|
606
654
|
}>;
|
|
@@ -632,6 +680,18 @@ declare class ReevitAPIClient {
|
|
|
632
680
|
data?: PaymentDetailResponse;
|
|
633
681
|
error?: PaymentError;
|
|
634
682
|
}>;
|
|
683
|
+
/**
|
|
684
|
+
* Creates a Hubtel session token for secure checkout.
|
|
685
|
+
* This endpoint generates a short-lived token that maps to Hubtel credentials server-side,
|
|
686
|
+
* avoiding exposure of sensitive credentials to the client.
|
|
687
|
+
*
|
|
688
|
+
* @param paymentId - The payment intent ID for Hubtel checkout
|
|
689
|
+
* @returns Hubtel session with token, merchant account, and expiry information
|
|
690
|
+
*/
|
|
691
|
+
createHubtelSession(paymentId: string): Promise<{
|
|
692
|
+
data?: HubtelSessionResponse;
|
|
693
|
+
error?: PaymentError;
|
|
694
|
+
}>;
|
|
635
695
|
/**
|
|
636
696
|
* Maps SDK payment method to backend format
|
|
637
697
|
*/
|