@reevit/react 0.4.2 → 0.4.4
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 +33 -10
- package/dist/index.d.ts +33 -10
- package/dist/index.js +297 -198
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +297 -198
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +268 -69
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -8,8 +8,8 @@ type MobileMoneyNetwork = 'mtn' | 'vodafone' | 'airteltigo';
|
|
|
8
8
|
/** Payment source type - indicates where the payment originated from */
|
|
9
9
|
type PaymentSource = 'payment_link' | 'api' | 'subscription';
|
|
10
10
|
interface ReevitCheckoutConfig {
|
|
11
|
-
/** Your Reevit public key (
|
|
12
|
-
publicKey
|
|
11
|
+
/** Your Reevit public key (required for API-created intents; omit for payment links) */
|
|
12
|
+
publicKey?: string;
|
|
13
13
|
/** Amount in the smallest currency unit (e.g., pesewas for GHS) */
|
|
14
14
|
amount: number;
|
|
15
15
|
/** Currency code (e.g., 'GHS', 'NGN', 'USD') */
|
|
@@ -18,10 +18,16 @@ interface ReevitCheckoutConfig {
|
|
|
18
18
|
email?: string;
|
|
19
19
|
/** Customer phone number (required for mobile money) */
|
|
20
20
|
phone?: string;
|
|
21
|
+
/** Customer name (optional, used for payment links) */
|
|
22
|
+
customerName?: string;
|
|
21
23
|
/** Unique reference for this transaction */
|
|
22
24
|
reference?: string;
|
|
23
25
|
/** Additional metadata to attach to the payment */
|
|
24
26
|
metadata?: Record<string, unknown>;
|
|
27
|
+
/** Custom fields for payment links (if applicable) */
|
|
28
|
+
customFields?: Record<string, unknown>;
|
|
29
|
+
/** Payment link code (for public checkout flows) */
|
|
30
|
+
paymentLinkCode?: string;
|
|
25
31
|
/** Payment methods to display */
|
|
26
32
|
paymentMethods?: PaymentMethod[];
|
|
27
33
|
/** Optional existing payment intent to use instead of creating a new one */
|
|
@@ -109,6 +115,16 @@ interface ReevitTheme {
|
|
|
109
115
|
fontFamily?: string;
|
|
110
116
|
/** Whether to use dark mode */
|
|
111
117
|
darkMode?: boolean;
|
|
118
|
+
/** Custom logo URL to display in checkout header */
|
|
119
|
+
logoUrl?: string;
|
|
120
|
+
/** PSP selector background color */
|
|
121
|
+
pspSelectorBgColor?: string;
|
|
122
|
+
/** PSP selector text color */
|
|
123
|
+
pspSelectorTextColor?: string;
|
|
124
|
+
/** PSP selector border color */
|
|
125
|
+
pspSelectorBorderColor?: string;
|
|
126
|
+
/** Use border-only style for PSP selector (no filled background) */
|
|
127
|
+
pspSelectorUseBorder?: boolean;
|
|
112
128
|
}
|
|
113
129
|
interface CheckoutProviderOption {
|
|
114
130
|
provider: string;
|
|
@@ -172,7 +188,7 @@ interface ReevitContextValue {
|
|
|
172
188
|
currency: string;
|
|
173
189
|
}
|
|
174
190
|
declare function useReevitContext(): ReevitContextValue;
|
|
175
|
-
declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, initialPaymentIntent, onSuccess, onError, onClose, onStateChange, children, autoOpen, isOpen: controlledIsOpen, onOpenChange, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
191
|
+
declare function ReevitCheckout({ publicKey, amount, currency, email, phone, customerName, reference, metadata, customFields, paymentLinkCode, paymentMethods, initialPaymentIntent, onSuccess, onError, onClose, onStateChange, children, autoOpen, isOpen: controlledIsOpen, onOpenChange, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
176
192
|
|
|
177
193
|
interface PaymentMethodSelectorProps {
|
|
178
194
|
methods: PaymentMethod[];
|
|
@@ -180,16 +196,19 @@ interface PaymentMethodSelectorProps {
|
|
|
180
196
|
onSelect: (method: PaymentMethod) => void;
|
|
181
197
|
disabled?: boolean;
|
|
182
198
|
provider?: string;
|
|
199
|
+
layout?: 'grid' | 'list';
|
|
200
|
+
showLabel?: boolean;
|
|
183
201
|
}
|
|
184
|
-
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, layout, showLabel, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
185
203
|
|
|
186
204
|
interface MobileMoneyFormProps {
|
|
187
205
|
onSubmit: (data: MobileMoneyFormData) => void;
|
|
188
|
-
onCancel
|
|
206
|
+
onCancel?: () => void;
|
|
189
207
|
isLoading?: boolean;
|
|
190
208
|
initialPhone?: string;
|
|
209
|
+
hideCancel?: boolean;
|
|
191
210
|
}
|
|
192
|
-
declare function MobileMoneyForm({ onSubmit, onCancel, isLoading, initialPhone, }: MobileMoneyFormProps): react_jsx_runtime.JSX.Element;
|
|
211
|
+
declare function MobileMoneyForm({ onSubmit, onCancel, isLoading, initialPhone, hideCancel, }: MobileMoneyFormProps): react_jsx_runtime.JSX.Element;
|
|
193
212
|
|
|
194
213
|
/**
|
|
195
214
|
* useReevit hook
|
|
@@ -278,7 +297,7 @@ declare function PaystackBridge({ publicKey, email, phone, amount, currency, ref
|
|
|
278
297
|
|
|
279
298
|
interface HubtelBridgeProps {
|
|
280
299
|
paymentId: string;
|
|
281
|
-
publicKey
|
|
300
|
+
publicKey?: string;
|
|
282
301
|
merchantAccount: string | number;
|
|
283
302
|
amount: number;
|
|
284
303
|
currency?: string;
|
|
@@ -287,16 +306,19 @@ interface HubtelBridgeProps {
|
|
|
287
306
|
phone?: string;
|
|
288
307
|
description?: string;
|
|
289
308
|
callbackUrl?: string;
|
|
309
|
+
apiBaseUrl?: string;
|
|
310
|
+
clientSecret?: string;
|
|
290
311
|
/** Session token from server (recommended - credentials never exposed to client) */
|
|
291
312
|
hubtelSessionToken?: string;
|
|
292
313
|
/** Basic auth credential (legacy - credentials exposed to client, deprecated) */
|
|
293
314
|
basicAuth?: string;
|
|
315
|
+
preferredMethod?: PaymentMethod;
|
|
294
316
|
onSuccess: (result: PaymentResult) => void;
|
|
295
317
|
onError: (error: PaymentError) => void;
|
|
296
318
|
onClose: () => void;
|
|
297
319
|
autoStart?: boolean;
|
|
298
320
|
}
|
|
299
|
-
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, hubtelSessionToken, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
321
|
+
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, apiBaseUrl, clientSecret, hubtelSessionToken, basicAuth, preferredMethod, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
300
322
|
/**
|
|
301
323
|
* Opens Hubtel checkout modal directly
|
|
302
324
|
* Uses the @hubteljs/checkout npm package
|
|
@@ -309,6 +331,7 @@ declare function openHubtelPopup(config: {
|
|
|
309
331
|
callbackUrl?: string;
|
|
310
332
|
customerPhoneNumber?: string;
|
|
311
333
|
basicAuth?: string;
|
|
334
|
+
preferredMethod?: PaymentMethod;
|
|
312
335
|
onSuccess?: (data: Record<string, unknown>) => void;
|
|
313
336
|
onError?: (data: Record<string, unknown>) => void;
|
|
314
337
|
onClose?: () => void;
|
|
@@ -624,7 +647,7 @@ interface PaymentDetailResponse {
|
|
|
624
647
|
}
|
|
625
648
|
interface ReevitAPIClientConfig {
|
|
626
649
|
/** Your Reevit public key */
|
|
627
|
-
publicKey
|
|
650
|
+
publicKey?: string;
|
|
628
651
|
/** Base URL for the Reevit API (defaults to production) */
|
|
629
652
|
baseUrl?: string;
|
|
630
653
|
/** Request timeout in milliseconds */
|
|
@@ -688,7 +711,7 @@ declare class ReevitAPIClient {
|
|
|
688
711
|
* @param paymentId - The payment intent ID for Hubtel checkout
|
|
689
712
|
* @returns Hubtel session with token, merchant account, and expiry information
|
|
690
713
|
*/
|
|
691
|
-
createHubtelSession(paymentId: string): Promise<{
|
|
714
|
+
createHubtelSession(paymentId: string, clientSecret?: string): Promise<{
|
|
692
715
|
data?: HubtelSessionResponse;
|
|
693
716
|
error?: PaymentError;
|
|
694
717
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ type MobileMoneyNetwork = 'mtn' | 'vodafone' | 'airteltigo';
|
|
|
8
8
|
/** Payment source type - indicates where the payment originated from */
|
|
9
9
|
type PaymentSource = 'payment_link' | 'api' | 'subscription';
|
|
10
10
|
interface ReevitCheckoutConfig {
|
|
11
|
-
/** Your Reevit public key (
|
|
12
|
-
publicKey
|
|
11
|
+
/** Your Reevit public key (required for API-created intents; omit for payment links) */
|
|
12
|
+
publicKey?: string;
|
|
13
13
|
/** Amount in the smallest currency unit (e.g., pesewas for GHS) */
|
|
14
14
|
amount: number;
|
|
15
15
|
/** Currency code (e.g., 'GHS', 'NGN', 'USD') */
|
|
@@ -18,10 +18,16 @@ interface ReevitCheckoutConfig {
|
|
|
18
18
|
email?: string;
|
|
19
19
|
/** Customer phone number (required for mobile money) */
|
|
20
20
|
phone?: string;
|
|
21
|
+
/** Customer name (optional, used for payment links) */
|
|
22
|
+
customerName?: string;
|
|
21
23
|
/** Unique reference for this transaction */
|
|
22
24
|
reference?: string;
|
|
23
25
|
/** Additional metadata to attach to the payment */
|
|
24
26
|
metadata?: Record<string, unknown>;
|
|
27
|
+
/** Custom fields for payment links (if applicable) */
|
|
28
|
+
customFields?: Record<string, unknown>;
|
|
29
|
+
/** Payment link code (for public checkout flows) */
|
|
30
|
+
paymentLinkCode?: string;
|
|
25
31
|
/** Payment methods to display */
|
|
26
32
|
paymentMethods?: PaymentMethod[];
|
|
27
33
|
/** Optional existing payment intent to use instead of creating a new one */
|
|
@@ -109,6 +115,16 @@ interface ReevitTheme {
|
|
|
109
115
|
fontFamily?: string;
|
|
110
116
|
/** Whether to use dark mode */
|
|
111
117
|
darkMode?: boolean;
|
|
118
|
+
/** Custom logo URL to display in checkout header */
|
|
119
|
+
logoUrl?: string;
|
|
120
|
+
/** PSP selector background color */
|
|
121
|
+
pspSelectorBgColor?: string;
|
|
122
|
+
/** PSP selector text color */
|
|
123
|
+
pspSelectorTextColor?: string;
|
|
124
|
+
/** PSP selector border color */
|
|
125
|
+
pspSelectorBorderColor?: string;
|
|
126
|
+
/** Use border-only style for PSP selector (no filled background) */
|
|
127
|
+
pspSelectorUseBorder?: boolean;
|
|
112
128
|
}
|
|
113
129
|
interface CheckoutProviderOption {
|
|
114
130
|
provider: string;
|
|
@@ -172,7 +188,7 @@ interface ReevitContextValue {
|
|
|
172
188
|
currency: string;
|
|
173
189
|
}
|
|
174
190
|
declare function useReevitContext(): ReevitContextValue;
|
|
175
|
-
declare function ReevitCheckout({ publicKey, amount, currency, email, phone, reference, metadata, paymentMethods, initialPaymentIntent, onSuccess, onError, onClose, onStateChange, children, autoOpen, isOpen: controlledIsOpen, onOpenChange, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
191
|
+
declare function ReevitCheckout({ publicKey, amount, currency, email, phone, customerName, reference, metadata, customFields, paymentLinkCode, paymentMethods, initialPaymentIntent, onSuccess, onError, onClose, onStateChange, children, autoOpen, isOpen: controlledIsOpen, onOpenChange, theme, apiBaseUrl, }: ReevitCheckoutProps): react_jsx_runtime.JSX.Element;
|
|
176
192
|
|
|
177
193
|
interface PaymentMethodSelectorProps {
|
|
178
194
|
methods: PaymentMethod[];
|
|
@@ -180,16 +196,19 @@ interface PaymentMethodSelectorProps {
|
|
|
180
196
|
onSelect: (method: PaymentMethod) => void;
|
|
181
197
|
disabled?: boolean;
|
|
182
198
|
provider?: string;
|
|
199
|
+
layout?: 'grid' | 'list';
|
|
200
|
+
showLabel?: boolean;
|
|
183
201
|
}
|
|
184
|
-
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, layout, showLabel, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
185
203
|
|
|
186
204
|
interface MobileMoneyFormProps {
|
|
187
205
|
onSubmit: (data: MobileMoneyFormData) => void;
|
|
188
|
-
onCancel
|
|
206
|
+
onCancel?: () => void;
|
|
189
207
|
isLoading?: boolean;
|
|
190
208
|
initialPhone?: string;
|
|
209
|
+
hideCancel?: boolean;
|
|
191
210
|
}
|
|
192
|
-
declare function MobileMoneyForm({ onSubmit, onCancel, isLoading, initialPhone, }: MobileMoneyFormProps): react_jsx_runtime.JSX.Element;
|
|
211
|
+
declare function MobileMoneyForm({ onSubmit, onCancel, isLoading, initialPhone, hideCancel, }: MobileMoneyFormProps): react_jsx_runtime.JSX.Element;
|
|
193
212
|
|
|
194
213
|
/**
|
|
195
214
|
* useReevit hook
|
|
@@ -278,7 +297,7 @@ declare function PaystackBridge({ publicKey, email, phone, amount, currency, ref
|
|
|
278
297
|
|
|
279
298
|
interface HubtelBridgeProps {
|
|
280
299
|
paymentId: string;
|
|
281
|
-
publicKey
|
|
300
|
+
publicKey?: string;
|
|
282
301
|
merchantAccount: string | number;
|
|
283
302
|
amount: number;
|
|
284
303
|
currency?: string;
|
|
@@ -287,16 +306,19 @@ interface HubtelBridgeProps {
|
|
|
287
306
|
phone?: string;
|
|
288
307
|
description?: string;
|
|
289
308
|
callbackUrl?: string;
|
|
309
|
+
apiBaseUrl?: string;
|
|
310
|
+
clientSecret?: string;
|
|
290
311
|
/** Session token from server (recommended - credentials never exposed to client) */
|
|
291
312
|
hubtelSessionToken?: string;
|
|
292
313
|
/** Basic auth credential (legacy - credentials exposed to client, deprecated) */
|
|
293
314
|
basicAuth?: string;
|
|
315
|
+
preferredMethod?: PaymentMethod;
|
|
294
316
|
onSuccess: (result: PaymentResult) => void;
|
|
295
317
|
onError: (error: PaymentError) => void;
|
|
296
318
|
onClose: () => void;
|
|
297
319
|
autoStart?: boolean;
|
|
298
320
|
}
|
|
299
|
-
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, hubtelSessionToken, basicAuth, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
321
|
+
declare function HubtelBridge({ paymentId, publicKey, merchantAccount, amount, reference, phone, description, callbackUrl, apiBaseUrl, clientSecret, hubtelSessionToken, basicAuth, preferredMethod, onSuccess, onError, onClose, autoStart, }: HubtelBridgeProps): react_jsx_runtime.JSX.Element;
|
|
300
322
|
/**
|
|
301
323
|
* Opens Hubtel checkout modal directly
|
|
302
324
|
* Uses the @hubteljs/checkout npm package
|
|
@@ -309,6 +331,7 @@ declare function openHubtelPopup(config: {
|
|
|
309
331
|
callbackUrl?: string;
|
|
310
332
|
customerPhoneNumber?: string;
|
|
311
333
|
basicAuth?: string;
|
|
334
|
+
preferredMethod?: PaymentMethod;
|
|
312
335
|
onSuccess?: (data: Record<string, unknown>) => void;
|
|
313
336
|
onError?: (data: Record<string, unknown>) => void;
|
|
314
337
|
onClose?: () => void;
|
|
@@ -624,7 +647,7 @@ interface PaymentDetailResponse {
|
|
|
624
647
|
}
|
|
625
648
|
interface ReevitAPIClientConfig {
|
|
626
649
|
/** Your Reevit public key */
|
|
627
|
-
publicKey
|
|
650
|
+
publicKey?: string;
|
|
628
651
|
/** Base URL for the Reevit API (defaults to production) */
|
|
629
652
|
baseUrl?: string;
|
|
630
653
|
/** Request timeout in milliseconds */
|
|
@@ -688,7 +711,7 @@ declare class ReevitAPIClient {
|
|
|
688
711
|
* @param paymentId - The payment intent ID for Hubtel checkout
|
|
689
712
|
* @returns Hubtel session with token, merchant account, and expiry information
|
|
690
713
|
*/
|
|
691
|
-
createHubtelSession(paymentId: string): Promise<{
|
|
714
|
+
createHubtelSession(paymentId: string, clientSecret?: string): Promise<{
|
|
692
715
|
data?: HubtelSessionResponse;
|
|
693
716
|
error?: PaymentError;
|
|
694
717
|
}>;
|