@reevit/react 0.6.0 → 0.7.0
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/README.md +14 -0
- package/dist/index.js +45 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -11
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +457 -237
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -811,30 +811,47 @@ function detectCountryFromCurrency(currency) {
|
|
|
811
811
|
};
|
|
812
812
|
return currencyToCountry[currency.toUpperCase()] || "GH";
|
|
813
813
|
}
|
|
814
|
+
var MethodIcons = {
|
|
815
|
+
card: () => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
816
|
+
/* @__PURE__ */ jsx("rect", { x: "1", y: "4", width: "22", height: "16", rx: "3" }),
|
|
817
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "10", x2: "23", y2: "10" }),
|
|
818
|
+
/* @__PURE__ */ jsx("line", { x1: "5", y1: "15", x2: "9", y2: "15" })
|
|
819
|
+
] }),
|
|
820
|
+
mobile_money: () => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
821
|
+
/* @__PURE__ */ jsx("rect", { x: "5", y: "2", width: "14", height: "20", rx: "3" }),
|
|
822
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "18", x2: "12", y2: "18.01", strokeWidth: "2", strokeLinecap: "round" })
|
|
823
|
+
] }),
|
|
824
|
+
bank_transfer: () => /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
825
|
+
/* @__PURE__ */ jsx("path", { d: "M3 21h18" }),
|
|
826
|
+
/* @__PURE__ */ jsx("path", { d: "M3 10h18" }),
|
|
827
|
+
/* @__PURE__ */ jsx("path", { d: "M12 3l9 7H3l9-7z" }),
|
|
828
|
+
/* @__PURE__ */ jsx("path", { d: "M6 10v8" }),
|
|
829
|
+
/* @__PURE__ */ jsx("path", { d: "M10 10v8" }),
|
|
830
|
+
/* @__PURE__ */ jsx("path", { d: "M14 10v8" }),
|
|
831
|
+
/* @__PURE__ */ jsx("path", { d: "M18 10v8" })
|
|
832
|
+
] }),
|
|
833
|
+
apple_pay: () => /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.53 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" }) }),
|
|
834
|
+
google_pay: () => /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M12.24 10.285V14.4h6.806c-.275 1.765-2.056 5.174-6.806 5.174-4.095 0-7.439-3.389-7.439-7.574s3.345-7.574 7.439-7.574c2.33 0 3.891.989 4.785 1.849l3.254-3.138C18.189 1.186 15.479 0 12.24 0c-6.635 0-12 5.365-12 12s5.365 12 12 12c6.926 0 11.52-4.869 11.52-11.726 0-.788-.085-1.39-.189-1.989H12.24z", fill: "currentColor" }) })
|
|
835
|
+
};
|
|
814
836
|
var methodConfig = {
|
|
815
837
|
card: {
|
|
816
838
|
label: "Card",
|
|
817
|
-
icon: "\u{1F4B3}",
|
|
818
839
|
description: "Pay with Visa, Mastercard, or other cards"
|
|
819
840
|
},
|
|
820
841
|
mobile_money: {
|
|
821
842
|
label: "Mobile Money",
|
|
822
|
-
icon: "\u{1F4F1}",
|
|
823
843
|
description: "MTN, Telecel, AirtelTigo Money"
|
|
824
844
|
},
|
|
825
845
|
bank_transfer: {
|
|
826
846
|
label: "Bank Transfer",
|
|
827
|
-
icon: "\u{1F3E6}",
|
|
828
847
|
description: "Pay directly from your bank account"
|
|
829
848
|
},
|
|
830
849
|
apple_pay: {
|
|
831
850
|
label: "Apple Pay",
|
|
832
|
-
icon: "\u{1F34E}",
|
|
833
851
|
description: "Pay with Apple Pay"
|
|
834
852
|
},
|
|
835
853
|
google_pay: {
|
|
836
854
|
label: "Google Pay",
|
|
837
|
-
icon: "\u{1F916}",
|
|
838
855
|
description: "Pay with Google Pay"
|
|
839
856
|
}
|
|
840
857
|
};
|
|
@@ -884,7 +901,6 @@ function PaymentMethodSelector({
|
|
|
884
901
|
),
|
|
885
902
|
style: selectedTheme?.backgroundColor ? { backgroundColor: selectedTheme.backgroundColor } : void 0,
|
|
886
903
|
children: methods.map((method, index) => {
|
|
887
|
-
const config = methodConfig[method];
|
|
888
904
|
const isSelected = selectedMethod === method;
|
|
889
905
|
const methodLabel = getMethodLabel(method);
|
|
890
906
|
const methodDescription = getMethodDescription(method);
|
|
@@ -915,7 +931,7 @@ function PaymentMethodSelector({
|
|
|
915
931
|
className: "reevit-method-option__logo-img"
|
|
916
932
|
},
|
|
917
933
|
i
|
|
918
|
-
)) }) : /* @__PURE__ */ jsx("span", { className: "reevit-method-option__icon", children:
|
|
934
|
+
)) }) : /* @__PURE__ */ jsx("span", { className: "reevit-method-option__icon", children: MethodIcons[method]() }) }),
|
|
919
935
|
/* @__PURE__ */ jsxs("div", { className: "reevit-method-option__content", children: [
|
|
920
936
|
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__label", style: selectedTheme?.textColor ? { color: selectedTheme.textColor } : void 0, children: methodLabel }),
|
|
921
937
|
!isGrid && /* @__PURE__ */ jsx("span", { className: "reevit-method-option__description", style: selectedTheme?.descriptionColor ? { color: selectedTheme.descriptionColor } : void 0, children: methodDescription })
|
|
@@ -2475,7 +2491,11 @@ function ReevitCheckout({
|
|
|
2475
2491
|
const renderContent = () => {
|
|
2476
2492
|
if (status === "loading" || status === "processing") {
|
|
2477
2493
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-loading reevit-animate-fade-in", children: [
|
|
2478
|
-
/* @__PURE__ */
|
|
2494
|
+
/* @__PURE__ */ jsxs("div", { className: "reevit-dot-pulse", children: [
|
|
2495
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-dot-pulse__dot" }),
|
|
2496
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-dot-pulse__dot" }),
|
|
2497
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-dot-pulse__dot" })
|
|
2498
|
+
] }),
|
|
2479
2499
|
/* @__PURE__ */ jsx("p", { children: status === "loading" ? "Preparing checkout..." : "Processing payment..." })
|
|
2480
2500
|
] });
|
|
2481
2501
|
}
|
|
@@ -2491,12 +2511,22 @@ function ReevitCheckout({
|
|
|
2491
2511
|
"Reference: ",
|
|
2492
2512
|
result.reference
|
|
2493
2513
|
] }),
|
|
2494
|
-
/* @__PURE__ */ jsx("p", { className: "reevit-success__redirect", children: "Redirecting in a moment..." })
|
|
2514
|
+
/* @__PURE__ */ jsx("p", { className: "reevit-success__redirect", children: "Redirecting in a moment..." }),
|
|
2515
|
+
/* @__PURE__ */ jsx(
|
|
2516
|
+
"div",
|
|
2517
|
+
{
|
|
2518
|
+
className: "reevit-success__countdown",
|
|
2519
|
+
style: { animationDuration: `${successDelayMs}ms` }
|
|
2520
|
+
}
|
|
2521
|
+
)
|
|
2495
2522
|
] });
|
|
2496
2523
|
}
|
|
2497
2524
|
if (status === "failed" && error && !error.recoverable) {
|
|
2498
2525
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-error reevit-animate-fade-in", children: [
|
|
2499
|
-
/* @__PURE__ */ jsx("div", { className: "reevit-error__icon", children: "
|
|
2526
|
+
/* @__PURE__ */ jsx("div", { className: "reevit-error__icon", children: /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2527
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
2528
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2529
|
+
] }) }),
|
|
2500
2530
|
/* @__PURE__ */ jsx("h3", { children: "Payment Failed" }),
|
|
2501
2531
|
/* @__PURE__ */ jsx("p", { children: error.message }),
|
|
2502
2532
|
/* @__PURE__ */ jsx("button", { className: "reevit-btn reevit-btn--primary", onClick: handleBack, children: "Try Again" })
|
|
@@ -2618,7 +2648,11 @@ function ReevitCheckout({
|
|
|
2618
2648
|
);
|
|
2619
2649
|
default:
|
|
2620
2650
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-error", children: [
|
|
2621
|
-
/* @__PURE__ */ jsx("div", { className: "reevit-error__icon", children: "
|
|
2651
|
+
/* @__PURE__ */ jsx("div", { className: "reevit-error__icon", children: /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2652
|
+
/* @__PURE__ */ jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
2653
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
2654
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
2655
|
+
] }) }),
|
|
2622
2656
|
/* @__PURE__ */ jsx("h3", { children: "Provider Not Supported" }),
|
|
2623
2657
|
/* @__PURE__ */ jsxs("p", { children: [
|
|
2624
2658
|
"Provider (",
|