@reevit/react 0.3.7 → 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 +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -163,8 +163,9 @@ interface PaymentMethodSelectorProps {
|
|
|
163
163
|
selectedMethod: PaymentMethod | null;
|
|
164
164
|
onSelect: (method: PaymentMethod) => void;
|
|
165
165
|
disabled?: boolean;
|
|
166
|
+
provider?: string;
|
|
166
167
|
}
|
|
167
|
-
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;
|
|
168
169
|
|
|
169
170
|
interface MobileMoneyFormProps {
|
|
170
171
|
onSubmit: (data: MobileMoneyFormData) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -163,8 +163,9 @@ interface PaymentMethodSelectorProps {
|
|
|
163
163
|
selectedMethod: PaymentMethod | null;
|
|
164
164
|
onSelect: (method: PaymentMethod) => void;
|
|
165
165
|
disabled?: boolean;
|
|
166
|
+
provider?: string;
|
|
166
167
|
}
|
|
167
|
-
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;
|
|
168
169
|
|
|
169
170
|
interface MobileMoneyFormProps {
|
|
170
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
|
|
@@ -1866,7 +1891,8 @@ function ReevitCheckout({
|
|
|
1866
1891
|
methods: paymentMethods,
|
|
1867
1892
|
selectedMethod,
|
|
1868
1893
|
onSelect: handleMethodSelect,
|
|
1869
|
-
disabled: isLoading
|
|
1894
|
+
disabled: isLoading,
|
|
1895
|
+
provider: psp
|
|
1870
1896
|
}
|
|
1871
1897
|
),
|
|
1872
1898
|
selectedMethod && selectedMethod !== "mobile_money" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-step__actions", children: /* @__PURE__ */ jsxRuntime.jsx(
|