@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.mjs
CHANGED
|
@@ -506,6 +506,14 @@ function detectCountryFromCurrency(currency) {
|
|
|
506
506
|
};
|
|
507
507
|
return currencyToCountry[currency.toUpperCase()] || "GH";
|
|
508
508
|
}
|
|
509
|
+
var pspNames = {
|
|
510
|
+
hubtel: "Hubtel",
|
|
511
|
+
paystack: "Paystack",
|
|
512
|
+
flutterwave: "Flutterwave",
|
|
513
|
+
monnify: "Monnify",
|
|
514
|
+
mpesa: "M-Pesa",
|
|
515
|
+
stripe: "Stripe"
|
|
516
|
+
};
|
|
509
517
|
var methodConfig = {
|
|
510
518
|
card: {
|
|
511
519
|
label: "Card",
|
|
@@ -527,13 +535,30 @@ function PaymentMethodSelector({
|
|
|
527
535
|
methods,
|
|
528
536
|
selectedMethod,
|
|
529
537
|
onSelect,
|
|
530
|
-
disabled = false
|
|
538
|
+
disabled = false,
|
|
539
|
+
provider
|
|
531
540
|
}) {
|
|
541
|
+
const getMethodLabel = (method, psp) => {
|
|
542
|
+
const config = methodConfig[method];
|
|
543
|
+
if (psp?.toLowerCase().includes("hubtel") && method === "mobile_money") {
|
|
544
|
+
return `Pay with ${pspNames[psp.toLowerCase()] || "Hubtel"}`;
|
|
545
|
+
}
|
|
546
|
+
return config.label;
|
|
547
|
+
};
|
|
548
|
+
const getMethodDescription = (method, psp) => {
|
|
549
|
+
const config = methodConfig[method];
|
|
550
|
+
if (psp?.toLowerCase().includes("hubtel")) {
|
|
551
|
+
return "Card, Mobile Money, and Bank Transfer";
|
|
552
|
+
}
|
|
553
|
+
return config.description;
|
|
554
|
+
};
|
|
532
555
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-method-selector", children: [
|
|
533
556
|
/* @__PURE__ */ jsx("div", { className: "reevit-method-selector__label", children: "Select payment method" }),
|
|
534
557
|
/* @__PURE__ */ jsx("div", { className: "reevit-method-selector__options", children: methods.map((method) => {
|
|
535
558
|
const config = methodConfig[method];
|
|
536
559
|
const isSelected = selectedMethod === method;
|
|
560
|
+
const methodLabel = getMethodLabel(method, provider);
|
|
561
|
+
const methodDescription = getMethodDescription(method, provider);
|
|
537
562
|
return /* @__PURE__ */ jsxs(
|
|
538
563
|
"button",
|
|
539
564
|
{
|
|
@@ -549,8 +574,8 @@ function PaymentMethodSelector({
|
|
|
549
574
|
children: [
|
|
550
575
|
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__icon", children: config.icon }),
|
|
551
576
|
/* @__PURE__ */ jsxs("div", { className: "reevit-method-option__content", children: [
|
|
552
|
-
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__label", children:
|
|
553
|
-
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__description", children:
|
|
577
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__label", children: methodLabel }),
|
|
578
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__description", children: methodDescription })
|
|
554
579
|
] }),
|
|
555
580
|
isSelected && /* @__PURE__ */ jsx("span", { className: "reevit-method-option__check", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx(
|
|
556
581
|
"path",
|
|
@@ -1681,9 +1706,9 @@ function ReevitCheckout({
|
|
|
1681
1706
|
/* @__PURE__ */ jsx("button", { className: "reevit-btn reevit-btn--primary", onClick: handleBack, children: "Try Again" })
|
|
1682
1707
|
] });
|
|
1683
1708
|
}
|
|
1709
|
+
const psp = paymentIntent?.recommendedPsp || "paystack";
|
|
1684
1710
|
if (showPSPBridge) {
|
|
1685
1711
|
const pspKey = paymentIntent?.pspPublicKey || publicKey;
|
|
1686
|
-
const psp = paymentIntent?.recommendedPsp || "paystack";
|
|
1687
1712
|
const bridgeMetadata = {
|
|
1688
1713
|
...metadata,
|
|
1689
1714
|
// Override with correct payment intent ID for webhook routing
|
|
@@ -1860,7 +1885,8 @@ function ReevitCheckout({
|
|
|
1860
1885
|
methods: paymentMethods,
|
|
1861
1886
|
selectedMethod,
|
|
1862
1887
|
onSelect: handleMethodSelect,
|
|
1863
|
-
disabled: isLoading
|
|
1888
|
+
disabled: isLoading,
|
|
1889
|
+
provider: psp
|
|
1864
1890
|
}
|
|
1865
1891
|
),
|
|
1866
1892
|
selectedMethod && selectedMethod !== "mobile_money" && /* @__PURE__ */ jsx("div", { className: "reevit-method-step__actions", children: /* @__PURE__ */ jsx(
|