@reevit/react 0.4.7 → 0.4.9
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 +38 -13
- package/dist/index.d.ts +38 -13
- package/dist/index.js +200 -138
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +200 -138
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +128 -169
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -56,61 +56,45 @@ function detectNetwork(phone) {
|
|
|
56
56
|
}
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
61
|
-
if (theme.primaryColor) {
|
|
62
|
-
variables["--reevit-primary"] = theme.primaryColor;
|
|
63
|
-
if (theme.primaryForegroundColor) {
|
|
64
|
-
variables["--reevit-primary-foreground"] = theme.primaryForegroundColor;
|
|
65
|
-
} else {
|
|
66
|
-
const contrast = getContrastingColor(theme.primaryColor);
|
|
67
|
-
if (contrast) {
|
|
68
|
-
variables["--reevit-primary-foreground"] = contrast;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (theme.backgroundColor) {
|
|
73
|
-
variables["--reevit-background"] = theme.backgroundColor;
|
|
74
|
-
}
|
|
75
|
-
if (theme.surfaceColor) {
|
|
76
|
-
variables["--reevit-surface"] = theme.surfaceColor;
|
|
77
|
-
}
|
|
78
|
-
if (theme.textColor) {
|
|
79
|
-
variables["--reevit-text"] = theme.textColor;
|
|
80
|
-
}
|
|
81
|
-
if (theme.mutedTextColor) {
|
|
82
|
-
variables["--reevit-text-secondary"] = theme.mutedTextColor;
|
|
83
|
-
}
|
|
84
|
-
if (theme.borderRadius) {
|
|
85
|
-
variables["--reevit-radius"] = theme.borderRadius;
|
|
86
|
-
variables["--reevit-radius-sm"] = theme.borderRadius;
|
|
87
|
-
variables["--reevit-radius-lg"] = theme.borderRadius;
|
|
88
|
-
}
|
|
89
|
-
if (theme.fontFamily) {
|
|
90
|
-
variables["--reevit-font"] = theme.fontFamily;
|
|
91
|
-
}
|
|
92
|
-
return variables;
|
|
59
|
+
function cn(...classes) {
|
|
60
|
+
return classes.filter(Boolean).join(" ");
|
|
93
61
|
}
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
62
|
+
function getCountryFromCurrency(currency) {
|
|
63
|
+
const currencyToCountry = {
|
|
64
|
+
GHS: "GH",
|
|
65
|
+
NGN: "NG",
|
|
66
|
+
KES: "KE",
|
|
67
|
+
ZAR: "ZA",
|
|
68
|
+
USD: "US",
|
|
69
|
+
GBP: "GB",
|
|
70
|
+
EUR: "EU"
|
|
71
|
+
};
|
|
72
|
+
return currencyToCountry[currency.toUpperCase()] || "GH";
|
|
73
|
+
}
|
|
74
|
+
function getMethodLogos(country, method) {
|
|
75
|
+
const c = country.toUpperCase();
|
|
76
|
+
const LOGOS = {
|
|
77
|
+
visa: "https://js.stripe.com/v3/fingerprinted/img/visa-729c05c240c4bdb47b03ac81d9945bfe.svg",
|
|
78
|
+
mastercard: "https://js.stripe.com/v3/fingerprinted/img/mastercard-4d8844094130711885b5e41b28c9848f.svg",
|
|
79
|
+
apple_pay: "https://js.stripe.com/v3/fingerprinted/img/apple_pay_mark-ea40d9a0f83ff6c94c3aa5c2c1ba4427.svg",
|
|
80
|
+
google_pay: "https://js.stripe.com/v3/fingerprinted/img/google_pay_mark-ed0c5a85e00a6e95f57a3c89e9d2a69c.svg",
|
|
81
|
+
mtn: "https://play-lh.googleusercontent.com/WdLBv6Ck6Xk4VJQvPxODXXjLNmxEGHDnXML_TVqWOBBzXpWLV1K3xXlStCfFLrl0Tw=w240-h480-rw",
|
|
82
|
+
vodafone: "https://play-lh.googleusercontent.com/cTpsmMl_ZXKvPLKWwCvC0VaKgT1ISyH0fNDgVbXHMGJl4PYvGMnlFFe8Kj3vTqz0Xg=w240-h480-rw",
|
|
83
|
+
airtel: "https://play-lh.googleusercontent.com/Mh2OxhKPKMfxCn2Y7J3gD3TLvkvOeFXwPLLGqrDHD5qJ5le_ph7Y6PmfwwZKJMZWcYU=w240-h480-rw",
|
|
84
|
+
mpesa: "https://play-lh.googleusercontent.com/2wd-PssHqg1Xv0HnKzH7ecFfozXo_vr5M-Hf7k7X7kqxMGqj5PmKWnFhTqCYXCPCAYE=w240-h480-rw"
|
|
85
|
+
};
|
|
86
|
+
if (method === "card") {
|
|
87
|
+
return [LOGOS.visa, LOGOS.mastercard];
|
|
102
88
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return
|
|
89
|
+
if (method === "apple_pay") return [LOGOS.apple_pay];
|
|
90
|
+
if (method === "google_pay") return [LOGOS.google_pay];
|
|
91
|
+
if (method === "mobile_money") {
|
|
92
|
+
if (c === "GH") return [LOGOS.mtn, LOGOS.vodafone, LOGOS.airtel];
|
|
93
|
+
if (c === "KE") return [LOGOS.mpesa, LOGOS.airtel];
|
|
94
|
+
if (c === "NG") return [LOGOS.mtn, LOGOS.airtel];
|
|
95
|
+
return [LOGOS.mtn];
|
|
108
96
|
}
|
|
109
|
-
|
|
110
|
-
return brightness >= 140 ? "#0b1120" : "#ffffff";
|
|
111
|
-
}
|
|
112
|
-
function cn(...classes) {
|
|
113
|
-
return classes.filter(Boolean).join(" ");
|
|
97
|
+
return [];
|
|
114
98
|
}
|
|
115
99
|
|
|
116
100
|
// src/api/client.ts
|
|
@@ -388,6 +372,10 @@ function normalizeBranding(branding) {
|
|
|
388
372
|
setIf("pspSelectorTextColor", getString(raw.pspSelectorTextColor ?? raw.psp_selector_text_color));
|
|
389
373
|
setIf("pspSelectorBorderColor", getString(raw.pspSelectorBorderColor ?? raw.psp_selector_border_color));
|
|
390
374
|
setIf("pspSelectorUseBorder", getBoolean(raw.pspSelectorUseBorder ?? raw.psp_selector_use_border));
|
|
375
|
+
setIf("selectedBackgroundColor", getString(raw.selectedBackgroundColor ?? raw.selected_background_color));
|
|
376
|
+
setIf("selectedTextColor", getString(raw.selectedTextColor ?? raw.selected_text_color));
|
|
377
|
+
setIf("selectedDescriptionColor", getString(raw.selectedDescriptionColor ?? raw.selected_description_color));
|
|
378
|
+
setIf("selectedBorderColor", getString(raw.selectedBorderColor ?? raw.selected_border_color));
|
|
391
379
|
return theme;
|
|
392
380
|
}
|
|
393
381
|
function mapToPaymentIntent(response, config) {
|
|
@@ -395,6 +383,7 @@ function mapToPaymentIntent(response, config) {
|
|
|
395
383
|
id: response.id,
|
|
396
384
|
clientSecret: response.client_secret,
|
|
397
385
|
pspPublicKey: response.psp_public_key,
|
|
386
|
+
pspCredentials: response.psp_credentials,
|
|
398
387
|
amount: response.amount,
|
|
399
388
|
currency: response.currency,
|
|
400
389
|
status: response.status,
|
|
@@ -422,6 +411,7 @@ function useReevit(options) {
|
|
|
422
411
|
});
|
|
423
412
|
const apiClientRef = useRef(null);
|
|
424
413
|
const initializingRef = useRef(!!config.initialPaymentIntent);
|
|
414
|
+
const initRequestIdRef = useRef(0);
|
|
425
415
|
useEffect(() => {
|
|
426
416
|
if (config.initialPaymentIntent) {
|
|
427
417
|
if (!state.paymentIntent || state.paymentIntent.id !== config.initialPaymentIntent.id) {
|
|
@@ -445,11 +435,11 @@ function useReevit(options) {
|
|
|
445
435
|
return;
|
|
446
436
|
}
|
|
447
437
|
initializingRef.current = true;
|
|
438
|
+
const requestId = ++initRequestIdRef.current;
|
|
448
439
|
dispatch({ type: "INIT_START" });
|
|
449
440
|
try {
|
|
450
441
|
const apiClient = apiClientRef.current;
|
|
451
442
|
if (!apiClient) {
|
|
452
|
-
initializingRef.current = false;
|
|
453
443
|
throw new Error("API client not initialized");
|
|
454
444
|
}
|
|
455
445
|
const reference = config.reference || generateReference();
|
|
@@ -498,6 +488,9 @@ function useReevit(options) {
|
|
|
498
488
|
data = result.data;
|
|
499
489
|
error = result.error;
|
|
500
490
|
}
|
|
491
|
+
if (requestId !== initRequestIdRef.current) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
501
494
|
if (error) {
|
|
502
495
|
dispatch({ type: "INIT_ERROR", payload: error });
|
|
503
496
|
onError?.(error);
|
|
@@ -517,6 +510,9 @@ function useReevit(options) {
|
|
|
517
510
|
const paymentIntent = mapToPaymentIntent(data, { ...config, reference });
|
|
518
511
|
dispatch({ type: "INIT_SUCCESS", payload: paymentIntent });
|
|
519
512
|
} catch (err) {
|
|
513
|
+
if (requestId !== initRequestIdRef.current) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
520
516
|
const error = {
|
|
521
517
|
code: "INIT_FAILED",
|
|
522
518
|
message: err instanceof Error ? err.message : "Failed to initialize checkout",
|
|
@@ -598,6 +594,7 @@ function useReevit(options) {
|
|
|
598
594
|
);
|
|
599
595
|
const reset = useCallback(() => {
|
|
600
596
|
initializingRef.current = false;
|
|
597
|
+
initRequestIdRef.current += 1;
|
|
601
598
|
dispatch({ type: "RESET" });
|
|
602
599
|
}, []);
|
|
603
600
|
const close = useCallback(async () => {
|
|
@@ -686,59 +683,90 @@ function PaymentMethodSelector({
|
|
|
686
683
|
disabled = false,
|
|
687
684
|
provider,
|
|
688
685
|
layout = "list",
|
|
689
|
-
showLabel = true
|
|
686
|
+
showLabel = true,
|
|
687
|
+
country = "GH",
|
|
688
|
+
selectedTheme
|
|
690
689
|
}) {
|
|
691
690
|
const getMethodLabel = (method, psp) => {
|
|
692
691
|
const config = methodConfig[method];
|
|
693
692
|
return config.label;
|
|
694
693
|
};
|
|
695
|
-
const getMethodDescription = (method, psp) => {
|
|
696
|
-
const
|
|
697
|
-
if (
|
|
698
|
-
|
|
694
|
+
const getMethodDescription = (method, psp, countryCode) => {
|
|
695
|
+
const c = (country).toUpperCase();
|
|
696
|
+
if (method === "mobile_money") {
|
|
697
|
+
const mobileMoneyDescriptions = {
|
|
698
|
+
GH: "MTN, Vodafone Cash, AirtelTigo Money",
|
|
699
|
+
KE: "M-Pesa, Airtel Money",
|
|
700
|
+
NG: "MTN MoMo, Airtel Money",
|
|
701
|
+
ZA: "Mobile Money"
|
|
702
|
+
};
|
|
703
|
+
return mobileMoneyDescriptions[c] || "Mobile Money";
|
|
704
|
+
}
|
|
705
|
+
if (method === "card") {
|
|
706
|
+
return "Pay with Visa, Mastercard, or other cards";
|
|
699
707
|
}
|
|
700
|
-
|
|
708
|
+
if (method === "bank_transfer") {
|
|
709
|
+
return "Pay directly from your bank account";
|
|
710
|
+
}
|
|
711
|
+
return "";
|
|
701
712
|
};
|
|
702
713
|
const isGrid = layout === "grid";
|
|
703
714
|
return /* @__PURE__ */ jsxs("div", { className: cn("reevit-method-selector", isGrid && "reevit-method-selector--grid"), children: [
|
|
704
715
|
showLabel && /* @__PURE__ */ jsx("div", { className: "reevit-method-selector__label", children: "Select payment method" }),
|
|
705
|
-
/* @__PURE__ */ jsx(
|
|
706
|
-
"
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
716
|
+
/* @__PURE__ */ jsx(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
className: cn(
|
|
720
|
+
"reevit-method-selector__options",
|
|
721
|
+
isGrid ? "reevit-method-selector__options--grid" : "reevit-method-selector__options--list"
|
|
722
|
+
),
|
|
723
|
+
style: selectedTheme?.backgroundColor ? { backgroundColor: selectedTheme.backgroundColor } : void 0,
|
|
724
|
+
children: methods.map((method, index) => {
|
|
725
|
+
const config = methodConfig[method];
|
|
726
|
+
const isSelected = selectedMethod === method;
|
|
727
|
+
const methodLabel = getMethodLabel(method);
|
|
728
|
+
const methodDescription = getMethodDescription(method);
|
|
729
|
+
const logos = getMethodLogos(country, method);
|
|
730
|
+
return /* @__PURE__ */ jsxs(
|
|
731
|
+
"button",
|
|
732
|
+
{
|
|
733
|
+
type: "button",
|
|
734
|
+
className: cn(
|
|
735
|
+
"reevit-method-option",
|
|
736
|
+
isGrid ? "reevit-method-option--grid" : "reevit-method-option--list",
|
|
737
|
+
isSelected && "reevit-method-option--selected",
|
|
738
|
+
disabled && "reevit-method-option--disabled"
|
|
739
|
+
),
|
|
740
|
+
style: {
|
|
741
|
+
animationDelay: `${index * 0.05}s`,
|
|
742
|
+
borderBottomColor: selectedTheme?.borderColor
|
|
743
|
+
},
|
|
744
|
+
onClick: () => onSelect(method),
|
|
745
|
+
disabled,
|
|
746
|
+
"aria-pressed": isSelected,
|
|
747
|
+
children: [
|
|
748
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__icon-wrapper", children: logos.length > 0 ? /* @__PURE__ */ jsx("span", { className: "reevit-method-option__logos", children: logos.slice(0, 3).map((logo, i) => /* @__PURE__ */ jsx(
|
|
749
|
+
"img",
|
|
750
|
+
{
|
|
751
|
+
src: logo,
|
|
752
|
+
alt: "",
|
|
753
|
+
className: "reevit-method-option__logo-img"
|
|
754
|
+
},
|
|
755
|
+
i
|
|
756
|
+
)) }) : /* @__PURE__ */ jsx("span", { className: "reevit-method-option__icon", children: config.icon }) }),
|
|
757
|
+
/* @__PURE__ */ jsxs("div", { className: "reevit-method-option__content", children: [
|
|
758
|
+
/* @__PURE__ */ jsx("span", { className: "reevit-method-option__label", style: selectedTheme?.textColor ? { color: selectedTheme.textColor } : void 0, children: methodLabel }),
|
|
759
|
+
!isGrid && /* @__PURE__ */ jsx("span", { className: "reevit-method-option__description", style: selectedTheme?.descriptionColor ? { color: selectedTheme.descriptionColor } : void 0, children: methodDescription })
|
|
760
|
+
] }),
|
|
761
|
+
!isGrid && isSelected && /* @__PURE__ */ jsx("span", { className: "reevit-method-option__check", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
|
|
762
|
+
!isGrid && !isSelected && /* @__PURE__ */ jsx("span", { className: "reevit-method-option__chevron", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "9 18 15 12 9 6" }) }) })
|
|
763
|
+
]
|
|
764
|
+
},
|
|
765
|
+
method
|
|
766
|
+
);
|
|
767
|
+
})
|
|
768
|
+
}
|
|
769
|
+
)
|
|
742
770
|
] });
|
|
743
771
|
}
|
|
744
772
|
var networks = [
|
|
@@ -906,28 +934,11 @@ function ProviderSelector({
|
|
|
906
934
|
onSelect,
|
|
907
935
|
disabled = false,
|
|
908
936
|
theme,
|
|
937
|
+
country = "GH",
|
|
909
938
|
selectedMethod,
|
|
910
939
|
onMethodSelect,
|
|
911
940
|
renderMethodContent
|
|
912
941
|
}) {
|
|
913
|
-
const useBorder = theme?.pspSelectorUseBorder ?? false;
|
|
914
|
-
const bgColor = theme?.pspSelectorBgColor || "#0a0a0a";
|
|
915
|
-
const textColor = theme?.pspSelectorTextColor || "#ffffff";
|
|
916
|
-
const borderColor = theme?.pspSelectorBorderColor || "#374151";
|
|
917
|
-
const getOptionStyle = (isSelected) => {
|
|
918
|
-
if (useBorder) {
|
|
919
|
-
return {
|
|
920
|
-
backgroundColor: "transparent",
|
|
921
|
-
border: `2px solid ${isSelected ? borderColor : "#374151"}`,
|
|
922
|
-
color: isSelected ? textColor : "var(--reevit-text)"
|
|
923
|
-
};
|
|
924
|
-
}
|
|
925
|
-
return {
|
|
926
|
-
backgroundColor: isSelected ? bgColor : "transparent",
|
|
927
|
-
border: `2px solid ${isSelected ? bgColor : "#374151"}`,
|
|
928
|
-
color: isSelected ? textColor : "var(--reevit-text)"
|
|
929
|
-
};
|
|
930
|
-
};
|
|
931
942
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-psp-selector", children: [
|
|
932
943
|
/* @__PURE__ */ jsx("div", { className: "reevit-psp-selector__label", children: "Select payment provider" }),
|
|
933
944
|
/* @__PURE__ */ jsx("div", { className: "reevit-psp-selector__options", children: providers.map((provider) => {
|
|
@@ -938,7 +949,7 @@ function ProviderSelector({
|
|
|
938
949
|
const providerMethods = sanitizeMethods(provider.provider, provider.methods);
|
|
939
950
|
const isSelected = selectedProvider === provider.provider;
|
|
940
951
|
const fallbackInitial = provider.name.slice(0, 1).toUpperCase();
|
|
941
|
-
const
|
|
952
|
+
const providerCountry = provider.countries?.[0] || country;
|
|
942
953
|
return /* @__PURE__ */ jsxs("div", { className: "reevit-psp-accordion", children: [
|
|
943
954
|
/* @__PURE__ */ jsxs(
|
|
944
955
|
"button",
|
|
@@ -949,7 +960,6 @@ function ProviderSelector({
|
|
|
949
960
|
isSelected && "reevit-psp-option--selected",
|
|
950
961
|
disabled && "reevit-psp-option--disabled"
|
|
951
962
|
),
|
|
952
|
-
style: optionStyle,
|
|
953
963
|
onClick: () => onSelect(provider.provider),
|
|
954
964
|
disabled,
|
|
955
965
|
"aria-expanded": isSelected,
|
|
@@ -964,27 +974,46 @@ function ProviderSelector({
|
|
|
964
974
|
}
|
|
965
975
|
) : /* @__PURE__ */ jsx("span", { className: "reevit-psp-option__logo-fallback", children: fallbackInitial }) }),
|
|
966
976
|
/* @__PURE__ */ jsxs("div", { className: "reevit-psp-option__content", children: [
|
|
967
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ jsxs("span", { className: "reevit-psp-option__name", children: [
|
|
978
|
+
"Pay with ",
|
|
979
|
+
provider.name
|
|
980
|
+
] }),
|
|
968
981
|
/* @__PURE__ */ jsx("span", { className: "reevit-psp-option__methods", children: formatMethods(providerMethods) || meta.hint })
|
|
969
982
|
] })
|
|
970
983
|
]
|
|
971
984
|
}
|
|
972
985
|
),
|
|
973
|
-
isSelected && onMethodSelect && /* @__PURE__ */ jsxs(
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
986
|
+
isSelected && onMethodSelect && /* @__PURE__ */ jsxs(
|
|
987
|
+
"div",
|
|
988
|
+
{
|
|
989
|
+
className: "reevit-psp-accordion__content",
|
|
990
|
+
style: theme?.selectedBorderColor ? {
|
|
991
|
+
borderTop: `1px solid ${theme.selectedBorderColor}`
|
|
992
|
+
} : void 0,
|
|
993
|
+
children: [
|
|
994
|
+
/* @__PURE__ */ jsx("div", { className: "reevit-psp-methods", children: /* @__PURE__ */ jsx(
|
|
995
|
+
PaymentMethodSelector,
|
|
996
|
+
{
|
|
997
|
+
methods: providerMethods,
|
|
998
|
+
selectedMethod: selectedMethod || null,
|
|
999
|
+
onSelect: onMethodSelect,
|
|
1000
|
+
disabled,
|
|
1001
|
+
provider: provider.provider,
|
|
1002
|
+
layout: "list",
|
|
1003
|
+
showLabel: false,
|
|
1004
|
+
country: providerCountry,
|
|
1005
|
+
selectedTheme: theme ? {
|
|
1006
|
+
backgroundColor: theme.selectedBackgroundColor,
|
|
1007
|
+
textColor: theme.selectedTextColor,
|
|
1008
|
+
descriptionColor: theme.selectedDescriptionColor,
|
|
1009
|
+
borderColor: theme.selectedBorderColor
|
|
1010
|
+
} : void 0
|
|
1011
|
+
}
|
|
1012
|
+
) }),
|
|
1013
|
+
selectedMethod && renderMethodContent && /* @__PURE__ */ jsx("div", { className: "reevit-psp-accordion__method-content", children: renderMethodContent(provider.provider, selectedMethod) })
|
|
1014
|
+
]
|
|
1015
|
+
}
|
|
1016
|
+
)
|
|
988
1017
|
] }, provider.provider);
|
|
989
1018
|
}) })
|
|
990
1019
|
] });
|
|
@@ -2207,7 +2236,29 @@ function ReevitCheckout({
|
|
|
2207
2236
|
...theme || {}
|
|
2208
2237
|
};
|
|
2209
2238
|
}, [paymentIntent?.branding, theme]);
|
|
2210
|
-
const themeStyles =
|
|
2239
|
+
const themeStyles = useMemo(() => {
|
|
2240
|
+
if (!resolvedTheme) return {};
|
|
2241
|
+
const vars = {};
|
|
2242
|
+
if (resolvedTheme.backgroundColor) {
|
|
2243
|
+
vars["--reevit-background"] = resolvedTheme.backgroundColor;
|
|
2244
|
+
vars["--reevit-surface"] = resolvedTheme.backgroundColor;
|
|
2245
|
+
}
|
|
2246
|
+
if (resolvedTheme.primaryColor) {
|
|
2247
|
+
vars["--reevit-text"] = resolvedTheme.primaryColor;
|
|
2248
|
+
}
|
|
2249
|
+
if (resolvedTheme.primaryForegroundColor) {
|
|
2250
|
+
vars["--reevit-text-secondary"] = resolvedTheme.primaryForegroundColor;
|
|
2251
|
+
vars["--reevit-muted"] = resolvedTheme.primaryForegroundColor;
|
|
2252
|
+
}
|
|
2253
|
+
if (resolvedTheme.borderColor) {
|
|
2254
|
+
vars["--reevit-border"] = resolvedTheme.borderColor;
|
|
2255
|
+
}
|
|
2256
|
+
if (resolvedTheme.borderRadius) {
|
|
2257
|
+
vars["--reevit-radius"] = resolvedTheme.borderRadius;
|
|
2258
|
+
vars["--reevit-radius-lg"] = resolvedTheme.borderRadius;
|
|
2259
|
+
}
|
|
2260
|
+
return vars;
|
|
2261
|
+
}, [resolvedTheme]);
|
|
2211
2262
|
const brandName = resolvedTheme?.companyName;
|
|
2212
2263
|
const themeMode = resolvedTheme?.darkMode;
|
|
2213
2264
|
const dataTheme = useMemo(() => {
|
|
@@ -2405,6 +2456,7 @@ function ReevitCheckout({
|
|
|
2405
2456
|
onSelect: handleProviderSelect,
|
|
2406
2457
|
disabled: isLoading,
|
|
2407
2458
|
theme: resolvedTheme,
|
|
2459
|
+
country: getCountryFromCurrency(currency),
|
|
2408
2460
|
selectedMethod,
|
|
2409
2461
|
onMethodSelect: handleMethodSelect,
|
|
2410
2462
|
renderMethodContent
|
|
@@ -2421,7 +2473,14 @@ function ReevitCheckout({
|
|
|
2421
2473
|
disabled: isLoading,
|
|
2422
2474
|
provider: psp,
|
|
2423
2475
|
layout: "list",
|
|
2424
|
-
showLabel: false
|
|
2476
|
+
showLabel: false,
|
|
2477
|
+
country: getCountryFromCurrency(currency),
|
|
2478
|
+
selectedTheme: resolvedTheme ? {
|
|
2479
|
+
backgroundColor: resolvedTheme.selectedBackgroundColor,
|
|
2480
|
+
textColor: resolvedTheme.selectedTextColor,
|
|
2481
|
+
descriptionColor: resolvedTheme.selectedDescriptionColor,
|
|
2482
|
+
borderColor: resolvedTheme.selectedBorderColor
|
|
2483
|
+
} : void 0
|
|
2425
2484
|
}
|
|
2426
2485
|
),
|
|
2427
2486
|
selectedMethod && /* @__PURE__ */ jsx("div", { className: "reevit-method-step__actions reevit-animate-slide-up", children: selectedMethod === "mobile_money" && pspLower.includes("mpesa") && !phone ? /* @__PURE__ */ jsx(MobileMoneyForm, { onSubmit: handleMomoSubmit, onCancel: () => selectMethod(null), isLoading, initialPhone: phone }) : /* @__PURE__ */ jsxs("div", { className: "reevit-card-info reevit-animate-fade-in", children: [
|
|
@@ -2452,17 +2511,20 @@ function ReevitCheckout({
|
|
|
2452
2511
|
children: [
|
|
2453
2512
|
/* @__PURE__ */ jsxs("div", { className: "reevit-modal__header", children: [
|
|
2454
2513
|
/* @__PURE__ */ jsxs("div", { className: "reevit-modal__branding", children: [
|
|
2455
|
-
/* @__PURE__ */ jsx(
|
|
2514
|
+
resolvedTheme?.logoUrl && /* @__PURE__ */ jsx(
|
|
2456
2515
|
"img",
|
|
2457
2516
|
{
|
|
2458
|
-
src: resolvedTheme
|
|
2459
|
-
alt: brandName || "
|
|
2517
|
+
src: resolvedTheme.logoUrl,
|
|
2518
|
+
alt: brandName || "",
|
|
2460
2519
|
className: "reevit-modal__logo"
|
|
2461
2520
|
}
|
|
2462
2521
|
),
|
|
2463
2522
|
brandName && /* @__PURE__ */ jsx("span", { className: "reevit-modal__brand-name", children: brandName })
|
|
2464
2523
|
] }),
|
|
2465
|
-
/* @__PURE__ */ jsx("button", { className: "reevit-modal__close", onClick: handleClose, "aria-label": "Close", children: "
|
|
2524
|
+
/* @__PURE__ */ jsx("button", { className: "reevit-modal__close", onClick: handleClose, "aria-label": "Close", children: /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2525
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
2526
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2527
|
+
] }) })
|
|
2466
2528
|
] }),
|
|
2467
2529
|
/* @__PURE__ */ jsxs("div", { className: "reevit-modal__amount", children: [
|
|
2468
2530
|
/* @__PURE__ */ jsx("span", { className: "reevit-modal__amount-label", children: "Amount" }),
|