@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.js CHANGED
@@ -62,61 +62,45 @@ function detectNetwork(phone) {
62
62
  }
63
63
  return null;
64
64
  }
65
- function createThemeVariables(theme) {
66
- const variables = {};
67
- if (theme.primaryColor) {
68
- variables["--reevit-primary"] = theme.primaryColor;
69
- if (theme.primaryForegroundColor) {
70
- variables["--reevit-primary-foreground"] = theme.primaryForegroundColor;
71
- } else {
72
- const contrast = getContrastingColor(theme.primaryColor);
73
- if (contrast) {
74
- variables["--reevit-primary-foreground"] = contrast;
75
- }
76
- }
77
- }
78
- if (theme.backgroundColor) {
79
- variables["--reevit-background"] = theme.backgroundColor;
80
- }
81
- if (theme.surfaceColor) {
82
- variables["--reevit-surface"] = theme.surfaceColor;
83
- }
84
- if (theme.textColor) {
85
- variables["--reevit-text"] = theme.textColor;
86
- }
87
- if (theme.mutedTextColor) {
88
- variables["--reevit-text-secondary"] = theme.mutedTextColor;
89
- }
90
- if (theme.borderRadius) {
91
- variables["--reevit-radius"] = theme.borderRadius;
92
- variables["--reevit-radius-sm"] = theme.borderRadius;
93
- variables["--reevit-radius-lg"] = theme.borderRadius;
94
- }
95
- if (theme.fontFamily) {
96
- variables["--reevit-font"] = theme.fontFamily;
97
- }
98
- return variables;
65
+ function cn(...classes) {
66
+ return classes.filter(Boolean).join(" ");
99
67
  }
100
- function getContrastingColor(color) {
101
- const hex = color.trim();
102
- if (!hex.startsWith("#")) {
103
- return null;
104
- }
105
- const normalized = hex.length === 4 ? `#${hex[1]}${hex[1]}${hex[2]}${hex[2]}${hex[3]}${hex[3]}` : hex;
106
- if (normalized.length !== 7) {
107
- return null;
68
+ function getCountryFromCurrency(currency) {
69
+ const currencyToCountry = {
70
+ GHS: "GH",
71
+ NGN: "NG",
72
+ KES: "KE",
73
+ ZAR: "ZA",
74
+ USD: "US",
75
+ GBP: "GB",
76
+ EUR: "EU"
77
+ };
78
+ return currencyToCountry[currency.toUpperCase()] || "GH";
79
+ }
80
+ function getMethodLogos(country, method) {
81
+ const c = country.toUpperCase();
82
+ const LOGOS = {
83
+ visa: "https://js.stripe.com/v3/fingerprinted/img/visa-729c05c240c4bdb47b03ac81d9945bfe.svg",
84
+ mastercard: "https://js.stripe.com/v3/fingerprinted/img/mastercard-4d8844094130711885b5e41b28c9848f.svg",
85
+ apple_pay: "https://js.stripe.com/v3/fingerprinted/img/apple_pay_mark-ea40d9a0f83ff6c94c3aa5c2c1ba4427.svg",
86
+ google_pay: "https://js.stripe.com/v3/fingerprinted/img/google_pay_mark-ed0c5a85e00a6e95f57a3c89e9d2a69c.svg",
87
+ mtn: "https://play-lh.googleusercontent.com/WdLBv6Ck6Xk4VJQvPxODXXjLNmxEGHDnXML_TVqWOBBzXpWLV1K3xXlStCfFLrl0Tw=w240-h480-rw",
88
+ vodafone: "https://play-lh.googleusercontent.com/cTpsmMl_ZXKvPLKWwCvC0VaKgT1ISyH0fNDgVbXHMGJl4PYvGMnlFFe8Kj3vTqz0Xg=w240-h480-rw",
89
+ airtel: "https://play-lh.googleusercontent.com/Mh2OxhKPKMfxCn2Y7J3gD3TLvkvOeFXwPLLGqrDHD5qJ5le_ph7Y6PmfwwZKJMZWcYU=w240-h480-rw",
90
+ mpesa: "https://play-lh.googleusercontent.com/2wd-PssHqg1Xv0HnKzH7ecFfozXo_vr5M-Hf7k7X7kqxMGqj5PmKWnFhTqCYXCPCAYE=w240-h480-rw"
91
+ };
92
+ if (method === "card") {
93
+ return [LOGOS.visa, LOGOS.mastercard];
108
94
  }
109
- const r = parseInt(normalized.slice(1, 3), 16);
110
- const g = parseInt(normalized.slice(3, 5), 16);
111
- const b = parseInt(normalized.slice(5, 7), 16);
112
- if (Number.isNaN(r) || Number.isNaN(g) || Number.isNaN(b)) {
113
- return null;
95
+ if (method === "apple_pay") return [LOGOS.apple_pay];
96
+ if (method === "google_pay") return [LOGOS.google_pay];
97
+ if (method === "mobile_money") {
98
+ if (c === "GH") return [LOGOS.mtn, LOGOS.vodafone, LOGOS.airtel];
99
+ if (c === "KE") return [LOGOS.mpesa, LOGOS.airtel];
100
+ if (c === "NG") return [LOGOS.mtn, LOGOS.airtel];
101
+ return [LOGOS.mtn];
114
102
  }
115
- const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
116
- return brightness >= 140 ? "#0b1120" : "#ffffff";
117
- }
118
- function cn(...classes) {
119
- return classes.filter(Boolean).join(" ");
103
+ return [];
120
104
  }
121
105
 
122
106
  // src/api/client.ts
@@ -394,6 +378,10 @@ function normalizeBranding(branding) {
394
378
  setIf("pspSelectorTextColor", getString(raw.pspSelectorTextColor ?? raw.psp_selector_text_color));
395
379
  setIf("pspSelectorBorderColor", getString(raw.pspSelectorBorderColor ?? raw.psp_selector_border_color));
396
380
  setIf("pspSelectorUseBorder", getBoolean(raw.pspSelectorUseBorder ?? raw.psp_selector_use_border));
381
+ setIf("selectedBackgroundColor", getString(raw.selectedBackgroundColor ?? raw.selected_background_color));
382
+ setIf("selectedTextColor", getString(raw.selectedTextColor ?? raw.selected_text_color));
383
+ setIf("selectedDescriptionColor", getString(raw.selectedDescriptionColor ?? raw.selected_description_color));
384
+ setIf("selectedBorderColor", getString(raw.selectedBorderColor ?? raw.selected_border_color));
397
385
  return theme;
398
386
  }
399
387
  function mapToPaymentIntent(response, config) {
@@ -401,6 +389,7 @@ function mapToPaymentIntent(response, config) {
401
389
  id: response.id,
402
390
  clientSecret: response.client_secret,
403
391
  pspPublicKey: response.psp_public_key,
392
+ pspCredentials: response.psp_credentials,
404
393
  amount: response.amount,
405
394
  currency: response.currency,
406
395
  status: response.status,
@@ -428,6 +417,7 @@ function useReevit(options) {
428
417
  });
429
418
  const apiClientRef = react.useRef(null);
430
419
  const initializingRef = react.useRef(!!config.initialPaymentIntent);
420
+ const initRequestIdRef = react.useRef(0);
431
421
  react.useEffect(() => {
432
422
  if (config.initialPaymentIntent) {
433
423
  if (!state.paymentIntent || state.paymentIntent.id !== config.initialPaymentIntent.id) {
@@ -451,11 +441,11 @@ function useReevit(options) {
451
441
  return;
452
442
  }
453
443
  initializingRef.current = true;
444
+ const requestId = ++initRequestIdRef.current;
454
445
  dispatch({ type: "INIT_START" });
455
446
  try {
456
447
  const apiClient = apiClientRef.current;
457
448
  if (!apiClient) {
458
- initializingRef.current = false;
459
449
  throw new Error("API client not initialized");
460
450
  }
461
451
  const reference = config.reference || generateReference();
@@ -504,6 +494,9 @@ function useReevit(options) {
504
494
  data = result.data;
505
495
  error = result.error;
506
496
  }
497
+ if (requestId !== initRequestIdRef.current) {
498
+ return;
499
+ }
507
500
  if (error) {
508
501
  dispatch({ type: "INIT_ERROR", payload: error });
509
502
  onError?.(error);
@@ -523,6 +516,9 @@ function useReevit(options) {
523
516
  const paymentIntent = mapToPaymentIntent(data, { ...config, reference });
524
517
  dispatch({ type: "INIT_SUCCESS", payload: paymentIntent });
525
518
  } catch (err) {
519
+ if (requestId !== initRequestIdRef.current) {
520
+ return;
521
+ }
526
522
  const error = {
527
523
  code: "INIT_FAILED",
528
524
  message: err instanceof Error ? err.message : "Failed to initialize checkout",
@@ -604,6 +600,7 @@ function useReevit(options) {
604
600
  );
605
601
  const reset = react.useCallback(() => {
606
602
  initializingRef.current = false;
603
+ initRequestIdRef.current += 1;
607
604
  dispatch({ type: "RESET" });
608
605
  }, []);
609
606
  const close = react.useCallback(async () => {
@@ -692,59 +689,90 @@ function PaymentMethodSelector({
692
689
  disabled = false,
693
690
  provider,
694
691
  layout = "list",
695
- showLabel = true
692
+ showLabel = true,
693
+ country = "GH",
694
+ selectedTheme
696
695
  }) {
697
696
  const getMethodLabel = (method, psp) => {
698
697
  const config = methodConfig[method];
699
698
  return config.label;
700
699
  };
701
- const getMethodDescription = (method, psp) => {
702
- const config = methodConfig[method];
703
- if (psp?.toLowerCase().includes("hubtel")) {
704
- return config.description;
700
+ const getMethodDescription = (method, psp, countryCode) => {
701
+ const c = (country).toUpperCase();
702
+ if (method === "mobile_money") {
703
+ const mobileMoneyDescriptions = {
704
+ GH: "MTN, Vodafone Cash, AirtelTigo Money",
705
+ KE: "M-Pesa, Airtel Money",
706
+ NG: "MTN MoMo, Airtel Money",
707
+ ZA: "Mobile Money"
708
+ };
709
+ return mobileMoneyDescriptions[c] || "Mobile Money";
710
+ }
711
+ if (method === "card") {
712
+ return "Pay with Visa, Mastercard, or other cards";
705
713
  }
706
- return config.description;
714
+ if (method === "bank_transfer") {
715
+ return "Pay directly from your bank account";
716
+ }
717
+ return "";
707
718
  };
708
719
  const isGrid = layout === "grid";
709
720
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("reevit-method-selector", isGrid && "reevit-method-selector--grid"), children: [
710
721
  showLabel && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-selector__label", children: "Select payment method" }),
711
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(
712
- "reevit-method-selector__options",
713
- isGrid ? "reevit-method-selector__options--grid" : "reevit-method-selector__options--list"
714
- ), children: methods.map((method, index) => {
715
- const config = methodConfig[method];
716
- const isSelected = selectedMethod === method;
717
- const methodLabel = getMethodLabel(method);
718
- const methodDescription = getMethodDescription(method, provider);
719
- return /* @__PURE__ */ jsxRuntime.jsxs(
720
- "button",
721
- {
722
- type: "button",
723
- className: cn(
724
- "reevit-method-option",
725
- isGrid ? "reevit-method-option--grid" : "reevit-method-option--list",
726
- isSelected && "reevit-method-option--selected",
727
- disabled && "reevit-method-option--disabled"
728
- ),
729
- style: {
730
- animationDelay: `${index * 0.05}s`
731
- },
732
- onClick: () => onSelect(method),
733
- disabled,
734
- "aria-pressed": isSelected,
735
- children: [
736
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__icon-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__icon", children: config.icon }) }),
737
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-method-option__content", children: [
738
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__label", children: methodLabel }),
739
- !isGrid && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__description", children: methodDescription })
740
- ] }),
741
- !isGrid && isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__check", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
742
- !isGrid && !isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__chevron", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "9 18 15 12 9 6" }) }) })
743
- ]
744
- },
745
- method
746
- );
747
- }) })
722
+ /* @__PURE__ */ jsxRuntime.jsx(
723
+ "div",
724
+ {
725
+ className: cn(
726
+ "reevit-method-selector__options",
727
+ isGrid ? "reevit-method-selector__options--grid" : "reevit-method-selector__options--list"
728
+ ),
729
+ style: selectedTheme?.backgroundColor ? { backgroundColor: selectedTheme.backgroundColor } : void 0,
730
+ children: methods.map((method, index) => {
731
+ const config = methodConfig[method];
732
+ const isSelected = selectedMethod === method;
733
+ const methodLabel = getMethodLabel(method);
734
+ const methodDescription = getMethodDescription(method);
735
+ const logos = getMethodLogos(country, method);
736
+ return /* @__PURE__ */ jsxRuntime.jsxs(
737
+ "button",
738
+ {
739
+ type: "button",
740
+ className: cn(
741
+ "reevit-method-option",
742
+ isGrid ? "reevit-method-option--grid" : "reevit-method-option--list",
743
+ isSelected && "reevit-method-option--selected",
744
+ disabled && "reevit-method-option--disabled"
745
+ ),
746
+ style: {
747
+ animationDelay: `${index * 0.05}s`,
748
+ borderBottomColor: selectedTheme?.borderColor
749
+ },
750
+ onClick: () => onSelect(method),
751
+ disabled,
752
+ "aria-pressed": isSelected,
753
+ children: [
754
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__icon-wrapper", children: logos.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__logos", children: logos.slice(0, 3).map((logo, i) => /* @__PURE__ */ jsxRuntime.jsx(
755
+ "img",
756
+ {
757
+ src: logo,
758
+ alt: "",
759
+ className: "reevit-method-option__logo-img"
760
+ },
761
+ i
762
+ )) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__icon", children: config.icon }) }),
763
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-method-option__content", children: [
764
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__label", style: selectedTheme?.textColor ? { color: selectedTheme.textColor } : void 0, children: methodLabel }),
765
+ !isGrid && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__description", style: selectedTheme?.descriptionColor ? { color: selectedTheme.descriptionColor } : void 0, children: methodDescription })
766
+ ] }),
767
+ !isGrid && isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__check", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
768
+ !isGrid && !isSelected && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-method-option__chevron", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "9 18 15 12 9 6" }) }) })
769
+ ]
770
+ },
771
+ method
772
+ );
773
+ })
774
+ }
775
+ )
748
776
  ] });
749
777
  }
750
778
  var networks = [
@@ -912,28 +940,11 @@ function ProviderSelector({
912
940
  onSelect,
913
941
  disabled = false,
914
942
  theme,
943
+ country = "GH",
915
944
  selectedMethod,
916
945
  onMethodSelect,
917
946
  renderMethodContent
918
947
  }) {
919
- const useBorder = theme?.pspSelectorUseBorder ?? false;
920
- const bgColor = theme?.pspSelectorBgColor || "#0a0a0a";
921
- const textColor = theme?.pspSelectorTextColor || "#ffffff";
922
- const borderColor = theme?.pspSelectorBorderColor || "#374151";
923
- const getOptionStyle = (isSelected) => {
924
- if (useBorder) {
925
- return {
926
- backgroundColor: "transparent",
927
- border: `2px solid ${isSelected ? borderColor : "#374151"}`,
928
- color: isSelected ? textColor : "var(--reevit-text)"
929
- };
930
- }
931
- return {
932
- backgroundColor: isSelected ? bgColor : "transparent",
933
- border: `2px solid ${isSelected ? bgColor : "#374151"}`,
934
- color: isSelected ? textColor : "var(--reevit-text)"
935
- };
936
- };
937
948
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-psp-selector", children: [
938
949
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-selector__label", children: "Select payment provider" }),
939
950
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-selector__options", children: providers.map((provider) => {
@@ -944,7 +955,7 @@ function ProviderSelector({
944
955
  const providerMethods = sanitizeMethods(provider.provider, provider.methods);
945
956
  const isSelected = selectedProvider === provider.provider;
946
957
  const fallbackInitial = provider.name.slice(0, 1).toUpperCase();
947
- const optionStyle = getOptionStyle(isSelected);
958
+ const providerCountry = provider.countries?.[0] || country;
948
959
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-psp-accordion", children: [
949
960
  /* @__PURE__ */ jsxRuntime.jsxs(
950
961
  "button",
@@ -955,7 +966,6 @@ function ProviderSelector({
955
966
  isSelected && "reevit-psp-option--selected",
956
967
  disabled && "reevit-psp-option--disabled"
957
968
  ),
958
- style: optionStyle,
959
969
  onClick: () => onSelect(provider.provider),
960
970
  disabled,
961
971
  "aria-expanded": isSelected,
@@ -970,27 +980,46 @@ function ProviderSelector({
970
980
  }
971
981
  ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-psp-option__logo-fallback", children: fallbackInitial }) }),
972
982
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-psp-option__content", children: [
973
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-psp-option__name", children: provider.name }),
983
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "reevit-psp-option__name", children: [
984
+ "Pay with ",
985
+ provider.name
986
+ ] }),
974
987
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-psp-option__methods", children: formatMethods(providerMethods) || meta.hint })
975
988
  ] })
976
989
  ]
977
990
  }
978
991
  ),
979
- isSelected && onMethodSelect && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-psp-accordion__content", children: [
980
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-methods", children: /* @__PURE__ */ jsxRuntime.jsx(
981
- PaymentMethodSelector,
982
- {
983
- methods: providerMethods,
984
- selectedMethod: selectedMethod || null,
985
- onSelect: onMethodSelect,
986
- disabled,
987
- provider: provider.provider,
988
- layout: "list",
989
- showLabel: false
990
- }
991
- ) }),
992
- selectedMethod && renderMethodContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-accordion__method-content", children: renderMethodContent(provider.provider, selectedMethod) })
993
- ] })
992
+ isSelected && onMethodSelect && /* @__PURE__ */ jsxRuntime.jsxs(
993
+ "div",
994
+ {
995
+ className: "reevit-psp-accordion__content",
996
+ style: theme?.selectedBorderColor ? {
997
+ borderTop: `1px solid ${theme.selectedBorderColor}`
998
+ } : void 0,
999
+ children: [
1000
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-methods", children: /* @__PURE__ */ jsxRuntime.jsx(
1001
+ PaymentMethodSelector,
1002
+ {
1003
+ methods: providerMethods,
1004
+ selectedMethod: selectedMethod || null,
1005
+ onSelect: onMethodSelect,
1006
+ disabled,
1007
+ provider: provider.provider,
1008
+ layout: "list",
1009
+ showLabel: false,
1010
+ country: providerCountry,
1011
+ selectedTheme: theme ? {
1012
+ backgroundColor: theme.selectedBackgroundColor,
1013
+ textColor: theme.selectedTextColor,
1014
+ descriptionColor: theme.selectedDescriptionColor,
1015
+ borderColor: theme.selectedBorderColor
1016
+ } : void 0
1017
+ }
1018
+ ) }),
1019
+ selectedMethod && renderMethodContent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-psp-accordion__method-content", children: renderMethodContent(provider.provider, selectedMethod) })
1020
+ ]
1021
+ }
1022
+ )
994
1023
  ] }, provider.provider);
995
1024
  }) })
996
1025
  ] });
@@ -2213,7 +2242,29 @@ function ReevitCheckout({
2213
2242
  ...theme || {}
2214
2243
  };
2215
2244
  }, [paymentIntent?.branding, theme]);
2216
- const themeStyles = resolvedTheme ? createThemeVariables(resolvedTheme) : {};
2245
+ const themeStyles = react.useMemo(() => {
2246
+ if (!resolvedTheme) return {};
2247
+ const vars = {};
2248
+ if (resolvedTheme.backgroundColor) {
2249
+ vars["--reevit-background"] = resolvedTheme.backgroundColor;
2250
+ vars["--reevit-surface"] = resolvedTheme.backgroundColor;
2251
+ }
2252
+ if (resolvedTheme.primaryColor) {
2253
+ vars["--reevit-text"] = resolvedTheme.primaryColor;
2254
+ }
2255
+ if (resolvedTheme.primaryForegroundColor) {
2256
+ vars["--reevit-text-secondary"] = resolvedTheme.primaryForegroundColor;
2257
+ vars["--reevit-muted"] = resolvedTheme.primaryForegroundColor;
2258
+ }
2259
+ if (resolvedTheme.borderColor) {
2260
+ vars["--reevit-border"] = resolvedTheme.borderColor;
2261
+ }
2262
+ if (resolvedTheme.borderRadius) {
2263
+ vars["--reevit-radius"] = resolvedTheme.borderRadius;
2264
+ vars["--reevit-radius-lg"] = resolvedTheme.borderRadius;
2265
+ }
2266
+ return vars;
2267
+ }, [resolvedTheme]);
2217
2268
  const brandName = resolvedTheme?.companyName;
2218
2269
  const themeMode = resolvedTheme?.darkMode;
2219
2270
  const dataTheme = react.useMemo(() => {
@@ -2411,6 +2462,7 @@ function ReevitCheckout({
2411
2462
  onSelect: handleProviderSelect,
2412
2463
  disabled: isLoading,
2413
2464
  theme: resolvedTheme,
2465
+ country: getCountryFromCurrency(currency),
2414
2466
  selectedMethod,
2415
2467
  onMethodSelect: handleMethodSelect,
2416
2468
  renderMethodContent
@@ -2427,7 +2479,14 @@ function ReevitCheckout({
2427
2479
  disabled: isLoading,
2428
2480
  provider: psp,
2429
2481
  layout: "list",
2430
- showLabel: false
2482
+ showLabel: false,
2483
+ country: getCountryFromCurrency(currency),
2484
+ selectedTheme: resolvedTheme ? {
2485
+ backgroundColor: resolvedTheme.selectedBackgroundColor,
2486
+ textColor: resolvedTheme.selectedTextColor,
2487
+ descriptionColor: resolvedTheme.selectedDescriptionColor,
2488
+ borderColor: resolvedTheme.selectedBorderColor
2489
+ } : void 0
2431
2490
  }
2432
2491
  ),
2433
2492
  selectedMethod && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "reevit-method-step__actions reevit-animate-slide-up", children: selectedMethod === "mobile_money" && pspLower.includes("mpesa") && !phone ? /* @__PURE__ */ jsxRuntime.jsx(MobileMoneyForm, { onSubmit: handleMomoSubmit, onCancel: () => selectMethod(null), isLoading, initialPhone: phone }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-card-info reevit-animate-fade-in", children: [
@@ -2458,17 +2517,20 @@ function ReevitCheckout({
2458
2517
  children: [
2459
2518
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-modal__header", children: [
2460
2519
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-modal__branding", children: [
2461
- /* @__PURE__ */ jsxRuntime.jsx(
2520
+ resolvedTheme?.logoUrl && /* @__PURE__ */ jsxRuntime.jsx(
2462
2521
  "img",
2463
2522
  {
2464
- src: resolvedTheme?.logoUrl || "https://i.imgur.com/bzUR5Lm.png",
2465
- alt: brandName || "Reevit",
2523
+ src: resolvedTheme.logoUrl,
2524
+ alt: brandName || "",
2466
2525
  className: "reevit-modal__logo"
2467
2526
  }
2468
2527
  ),
2469
2528
  brandName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-modal__brand-name", children: brandName })
2470
2529
  ] }),
2471
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "reevit-modal__close", onClick: handleClose, "aria-label": "Close", children: "\u2715" })
2530
+ /* @__PURE__ */ jsxRuntime.jsx("button", { className: "reevit-modal__close", onClick: handleClose, "aria-label": "Close", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
2531
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2532
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2533
+ ] }) })
2472
2534
  ] }),
2473
2535
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "reevit-modal__amount", children: [
2474
2536
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "reevit-modal__amount-label", children: "Amount" }),