@reevit/react 0.3.6 → 0.3.8
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 +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +33 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -115,6 +115,15 @@ interface PaymentIntent {
|
|
|
115
115
|
clientSecret: string;
|
|
116
116
|
/** PSP's public key for client-side SDK initialization */
|
|
117
117
|
pspPublicKey?: string;
|
|
118
|
+
/** PSP-specific credentials for client-side checkout (e.g., Hubtel's merchantAccount, basicAuth) */
|
|
119
|
+
pspCredentials?: {
|
|
120
|
+
/** Hubtel merchant account number */
|
|
121
|
+
merchantAccount?: string | number;
|
|
122
|
+
/** Hubtel basic auth header value */
|
|
123
|
+
basicAuth?: string;
|
|
124
|
+
/** Any other PSP-specific credential fields */
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
};
|
|
118
127
|
/** Amount in smallest currency unit */
|
|
119
128
|
amount: number;
|
|
120
129
|
/** Currency code */
|
|
@@ -154,8 +163,9 @@ interface PaymentMethodSelectorProps {
|
|
|
154
163
|
selectedMethod: PaymentMethod | null;
|
|
155
164
|
onSelect: (method: PaymentMethod) => void;
|
|
156
165
|
disabled?: boolean;
|
|
166
|
+
provider?: string;
|
|
157
167
|
}
|
|
158
|
-
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
159
169
|
|
|
160
170
|
interface MobileMoneyFormProps {
|
|
161
171
|
onSubmit: (data: MobileMoneyFormData) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,15 @@ interface PaymentIntent {
|
|
|
115
115
|
clientSecret: string;
|
|
116
116
|
/** PSP's public key for client-side SDK initialization */
|
|
117
117
|
pspPublicKey?: string;
|
|
118
|
+
/** PSP-specific credentials for client-side checkout (e.g., Hubtel's merchantAccount, basicAuth) */
|
|
119
|
+
pspCredentials?: {
|
|
120
|
+
/** Hubtel merchant account number */
|
|
121
|
+
merchantAccount?: string | number;
|
|
122
|
+
/** Hubtel basic auth header value */
|
|
123
|
+
basicAuth?: string;
|
|
124
|
+
/** Any other PSP-specific credential fields */
|
|
125
|
+
[key: string]: unknown;
|
|
126
|
+
};
|
|
118
127
|
/** Amount in smallest currency unit */
|
|
119
128
|
amount: number;
|
|
120
129
|
/** Currency code */
|
|
@@ -154,8 +163,9 @@ interface PaymentMethodSelectorProps {
|
|
|
154
163
|
selectedMethod: PaymentMethod | null;
|
|
155
164
|
onSelect: (method: PaymentMethod) => void;
|
|
156
165
|
disabled?: boolean;
|
|
166
|
+
provider?: string;
|
|
157
167
|
}
|
|
158
|
-
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
168
|
+
declare function PaymentMethodSelector({ methods, selectedMethod, onSelect, disabled, provider, }: PaymentMethodSelectorProps): react_jsx_runtime.JSX.Element;
|
|
159
169
|
|
|
160
170
|
interface MobileMoneyFormProps {
|
|
161
171
|
onSubmit: (data: MobileMoneyFormData) => void;
|
package/dist/index.js
CHANGED
|
@@ -512,6 +512,14 @@ function detectCountryFromCurrency(currency) {
|
|
|
512
512
|
};
|
|
513
513
|
return currencyToCountry[currency.toUpperCase()] || "GH";
|
|
514
514
|
}
|
|
515
|
+
var pspNames = {
|
|
516
|
+
hubtel: "Hubtel",
|
|
517
|
+
paystack: "Paystack",
|
|
518
|
+
flutterwave: "Flutterwave",
|
|
519
|
+
monnify: "Monnify",
|
|
520
|
+
mpesa: "M-Pesa",
|
|
521
|
+
stripe: "Stripe"
|
|
522
|
+
};
|
|
515
523
|
var methodConfig = {
|
|
516
524
|
card: {
|
|
517
525
|
label: "Card",
|
|
@@ -533,13 +541,30 @@ function PaymentMethodSelector({
|
|
|
533
541
|
methods,
|
|
534
542
|
selectedMethod,
|
|
535
543
|
onSelect,
|
|
536
|
-
disabled = false
|
|
544
|
+
disabled = false,
|
|
545
|
+
provider
|
|
537
546
|
}) {
|
|
547
|
+
const getMethodLabel = (method, psp) => {
|
|
548
|
+
const config = methodConfig[method];
|
|
549
|
+
if (psp?.toLowerCase().includes("hubtel") && method === "mobile_money") {
|
|
550
|
+
return `Pay with ${pspNames[psp.toLowerCase()] || "Hubtel"}`;
|
|
551
|
+
}
|
|
552
|
+
return config.label;
|
|
553
|
+
};
|
|
554
|
+
const getMethodDescription = (method, psp) => {
|
|
555
|
+
const config = methodConfig[method];
|
|
556
|
+
if (psp?.toLowerCase().includes("hubtel")) {
|
|
557
|
+
return "Card, Mobile Money, and Bank Transfer";
|
|
558
|
+
}
|
|
559
|
+
return config.description;
|
|
560
|
+
};
|
|
538
561
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-method-selector", children: [
|
|
539
562
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-selector__label", children: "Select payment method" }),
|
|
540
563
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-selector__options", children: methods.map((method) => {
|
|
541
564
|
const config = methodConfig[method];
|
|
542
565
|
const isSelected = selectedMethod === method;
|
|
566
|
+
const methodLabel = getMethodLabel(method, provider);
|
|
567
|
+
const methodDescription = getMethodDescription(method, provider);
|
|
543
568
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
544
569
|
"button",
|
|
545
570
|
{
|
|
@@ -555,8 +580,8 @@ function PaymentMethodSelector({
|
|
|
555
580
|
children: [
|
|
556
581
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__icon", children: config.icon }),
|
|
557
582
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-method-option__content", children: [
|
|
558
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__label", children:
|
|
559
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__description", children:
|
|
583
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__label", children: methodLabel }),
|
|
584
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__description", children: methodDescription })
|
|
560
585
|
] }),
|
|
561
586
|
isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__check", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
562
587
|
"path",
|
|
@@ -1687,9 +1712,9 @@ function ReevitCheckout({
|
|
|
1687
1712
|
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "reevit-btn reevit-btn--primary", onClick: handleBack, children: "Try Again" })
|
|
1688
1713
|
] });
|
|
1689
1714
|
}
|
|
1715
|
+
const psp = paymentIntent?.recommendedPsp || "paystack";
|
|
1690
1716
|
if (showPSPBridge) {
|
|
1691
1717
|
const pspKey = paymentIntent?.pspPublicKey || publicKey;
|
|
1692
|
-
const psp = paymentIntent?.recommendedPsp || "paystack";
|
|
1693
1718
|
const bridgeMetadata = {
|
|
1694
1719
|
...metadata,
|
|
1695
1720
|
// Override with correct payment intent ID for webhook routing
|
|
@@ -1721,13 +1746,14 @@ function ReevitCheckout({
|
|
|
1721
1746
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1722
1747
|
HubtelBridge,
|
|
1723
1748
|
{
|
|
1724
|
-
merchantAccount: pspKey,
|
|
1749
|
+
merchantAccount: paymentIntent?.pspCredentials?.merchantAccount || pspKey,
|
|
1725
1750
|
amount: paymentIntent?.amount ?? amount,
|
|
1726
1751
|
currency: paymentIntent?.currency ?? currency,
|
|
1727
1752
|
reference: paymentIntent?.reference || reference,
|
|
1728
1753
|
email,
|
|
1729
1754
|
phone: momoData?.phone || phone,
|
|
1730
1755
|
description: `Payment ${paymentIntent?.reference || reference || ""}`,
|
|
1756
|
+
basicAuth: paymentIntent?.pspCredentials?.basicAuth,
|
|
1731
1757
|
onSuccess: handlePSPSuccess,
|
|
1732
1758
|
onError: (err) => handlePSPError(err),
|
|
1733
1759
|
onClose: handlePSPClose
|
|
@@ -1865,7 +1891,8 @@ function ReevitCheckout({
|
|
|
1865
1891
|
methods: paymentMethods,
|
|
1866
1892
|
selectedMethod,
|
|
1867
1893
|
onSelect: handleMethodSelect,
|
|
1868
|
-
disabled: isLoading
|
|
1894
|
+
disabled: isLoading,
|
|
1895
|
+
provider: psp
|
|
1869
1896
|
}
|
|
1870
1897
|
),
|
|
1871
1898
|
selectedMethod && selectedMethod !== "mobile_money" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-step__actions", children: /* @__PURE__ */ jsxRuntime.jsx(
|