@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.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: config.label }),
553
- /* @__PURE__ */ jsx("span", { className: "reevit-method-option__description", children: config.description })
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
@@ -1715,13 +1740,14 @@ function ReevitCheckout({
1715
1740
  return /* @__PURE__ */ jsx(
1716
1741
  HubtelBridge,
1717
1742
  {
1718
- merchantAccount: pspKey,
1743
+ merchantAccount: paymentIntent?.pspCredentials?.merchantAccount || pspKey,
1719
1744
  amount: paymentIntent?.amount ?? amount,
1720
1745
  currency: paymentIntent?.currency ?? currency,
1721
1746
  reference: paymentIntent?.reference || reference,
1722
1747
  email,
1723
1748
  phone: momoData?.phone || phone,
1724
1749
  description: `Payment ${paymentIntent?.reference || reference || ""}`,
1750
+ basicAuth: paymentIntent?.pspCredentials?.basicAuth,
1725
1751
  onSuccess: handlePSPSuccess,
1726
1752
  onError: (err) => handlePSPError(err),
1727
1753
  onClose: handlePSPClose
@@ -1859,7 +1885,8 @@ function ReevitCheckout({
1859
1885
  methods: paymentMethods,
1860
1886
  selectedMethod,
1861
1887
  onSelect: handleMethodSelect,
1862
- disabled: isLoading
1888
+ disabled: isLoading,
1889
+ provider: psp
1863
1890
  }
1864
1891
  ),
1865
1892
  selectedMethod && selectedMethod !== "mobile_money" && /* @__PURE__ */ jsx("div", { className: "reevit-method-step__actions", children: /* @__PURE__ */ jsx(