@superlogic/spree-pay 0.1.42 → 0.2.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/build/index.cjs CHANGED
@@ -72,7 +72,7 @@ var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
72
72
  })(PaymentType || {});
73
73
 
74
74
  // package.json
75
- var version = "0.1.41";
75
+ var version = "0.2.0";
76
76
 
77
77
  // src/utils/logger.ts
78
78
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -540,7 +540,7 @@ function Label({ className, ...props }) {
540
540
  {
541
541
  "data-slot": "label",
542
542
  className: cn(
543
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
543
+ "flex items-center gap-2 text-sm leading-none font-medium text-(--primary) select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
544
544
  className
545
545
  ),
546
546
  ...props
@@ -662,7 +662,7 @@ var PointsSwitch = (props) => {
662
662
  Boolean(appProps.topUpLink) && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
663
663
  "a",
664
664
  {
665
- className: "cursor-pointer rounded-full bg-(--primary) px-2 py-1.5 text-xs font-medium text-(--inverse)",
665
+ className: "cursor-pointer rounded-full bg-(--s-brand) px-2 py-1.5 text-xs font-medium text-(--inverse) hover:bg-(--s-brand-hover)",
666
666
  rel: "noreferrer",
667
667
  target: "_blank",
668
668
  href: appProps.topUpLink,
@@ -802,7 +802,7 @@ function DialogOverlay({ className, ...props }) {
802
802
  {
803
803
  "data-slot": "dialog-overlay",
804
804
  className: cn(
805
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
805
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-(--overlay)",
806
806
  className
807
807
  ),
808
808
  ...props
@@ -832,7 +832,7 @@ function DialogContent({
832
832
  DialogPrimitive.Close,
833
833
  {
834
834
  "data-slot": "dialog-close",
835
- className: "ring-offset-background focus:ring-ring data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-(--accent) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
835
+ className: "ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-(--accent) data-[state=open]:text-(--secondary) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
836
836
  children: [
837
837
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react.XIcon, {}),
838
838
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: "Close" })
@@ -859,7 +859,7 @@ function DialogDescription({ className, ...props }) {
859
859
  DialogPrimitive.Description,
860
860
  {
861
861
  "data-slot": "dialog-description",
862
- className: cn("text-muted-foreground text-sm", className),
862
+ className: cn("text-sm text-(--secondary)", className),
863
863
  ...props
864
864
  }
865
865
  );
@@ -1774,32 +1774,6 @@ function Checkbox({ className, ...props }) {
1774
1774
  // src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
1775
1775
  var import_jsx_runtime15 = require("react/jsx-runtime");
1776
1776
  var cardFormLogger = logger.child("card-form");
1777
- var styleDark = {
1778
- base: {
1779
- fontSize: "16px",
1780
- fontWeight: "500",
1781
- color: "rgba(255, 255, 255, 0.70)",
1782
- "::placeholder": {
1783
- color: "rgba(255, 255, 255, 0.5)"
1784
- }
1785
- },
1786
- invalid: {
1787
- color: "rgba(255, 255, 255, 0.70)"
1788
- }
1789
- };
1790
- var styleLight = {
1791
- base: {
1792
- fontSize: "16px",
1793
- fontWeight: "500",
1794
- color: "#000",
1795
- "::placeholder": {
1796
- color: "rgba(0, 0, 0, 0.5)"
1797
- }
1798
- },
1799
- invalid: {
1800
- color: "#000"
1801
- }
1802
- };
1803
1777
  var stripeElementClasses = {
1804
1778
  base: "w-full rounded-[12px] bg-(--s-primary) px-5 py-4 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
1805
1779
  invalid: "focus-visible:ring-destructive",
@@ -1807,10 +1781,35 @@ var stripeElementClasses = {
1807
1781
  };
1808
1782
  var CreditCardForm = ({ cancel, saveCard }) => {
1809
1783
  const [cardError, setCardError] = (0, import_react6.useState)(void 0);
1810
- const { env } = useSpreePayEnv();
1784
+ const [stripeStyles, setStripeStyles] = (0, import_react6.useState)({});
1785
+ const formRef = (0, import_react6.useRef)(null);
1811
1786
  const elements = (0, import_react_stripe_js.useElements)();
1812
1787
  const stripe = (0, import_react_stripe_js.useStripe)();
1813
1788
  const id = (0, import_react6.useId)();
1789
+ const computeStripeStyles = (0, import_react6.useCallback)(() => {
1790
+ const formRefCurrent = formRef.current;
1791
+ if (typeof window === "undefined" || !formRefCurrent) return {};
1792
+ const container = formRefCurrent.closest(".sl-spreepay");
1793
+ if (!container) return {};
1794
+ const primary = getComputedStyle(container).getPropertyValue("--primary").trim() || "rgba(255, 255, 255, 0.70)";
1795
+ const secondary = getComputedStyle(container).getPropertyValue("--secondary").trim() || "rgba(255, 255, 255, 0.5)";
1796
+ return {
1797
+ base: {
1798
+ fontSize: "16px",
1799
+ fontWeight: "500",
1800
+ color: primary,
1801
+ "::placeholder": {
1802
+ color: secondary
1803
+ }
1804
+ },
1805
+ invalid: {
1806
+ color: primary
1807
+ }
1808
+ };
1809
+ }, []);
1810
+ (0, import_react6.useEffect)(() => {
1811
+ setStripeStyles(computeStripeStyles());
1812
+ }, [computeStripeStyles]);
1814
1813
  const handleSaveCard = async () => {
1815
1814
  if (!elements || !stripe) return;
1816
1815
  setCardError(void 0);
@@ -1845,14 +1844,13 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1845
1844
  setCardError("An error occurred while processing your card. Please try again.");
1846
1845
  }
1847
1846
  };
1848
- const isDarkMode = env.tenantId === "cdc";
1849
1847
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
1850
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex w-full flex-col gap-4", children: [
1848
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { ref: formRef, className: "flex w-full flex-col gap-4", children: [
1851
1849
  /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1852
1850
  import_react_stripe_js.CardNumberElement,
1853
1851
  {
1854
1852
  options: {
1855
- style: isDarkMode ? styleDark : styleLight,
1853
+ style: stripeStyles,
1856
1854
  placeholder: "Card Number",
1857
1855
  classes: stripeElementClasses
1858
1856
  }
@@ -1863,7 +1861,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1863
1861
  import_react_stripe_js.CardExpiryElement,
1864
1862
  {
1865
1863
  options: {
1866
- style: isDarkMode ? styleDark : styleLight,
1864
+ style: stripeStyles,
1867
1865
  placeholder: "MM / YY",
1868
1866
  classes: stripeElementClasses
1869
1867
  }
@@ -1873,7 +1871,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1873
1871
  import_react_stripe_js.CardCvcElement,
1874
1872
  {
1875
1873
  options: {
1876
- style: isDarkMode ? styleDark : styleLight,
1874
+ style: stripeStyles,
1877
1875
  placeholder: "CVV",
1878
1876
  classes: stripeElementClasses
1879
1877
  }
@@ -1974,7 +1972,7 @@ function Input({ className, type, ...props }) {
1974
1972
  type,
1975
1973
  "data-slot": "input",
1976
1974
  className: cn(
1977
- "file:text-foreground dark:bg-input/30 border-input placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-(--primary) selection:text-(--inverse) file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1975
+ "file:text-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base text-(--brand-primary) shadow-xs transition-[color,box-shadow] outline-none selection:bg-(--primary) selection:text-(--inverse) file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-(--tertiary) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1978
1976
  "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
1979
1977
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
1980
1978
  className
@@ -2974,7 +2972,7 @@ var PointsSelector = (props) => {
2974
2972
  disabled: isDisabled,
2975
2973
  onClick: onSelect,
2976
2974
  className: cn(
2977
- "cursor-pointer overflow-hidden rounded-md border-2 border-transparent opacity-50 disabled:cursor-not-allowed",
2975
+ "cursor-pointer overflow-hidden rounded-md border-2 border-transparent disabled:cursor-not-allowed disabled:opacity-50",
2978
2976
  {
2979
2977
  "border-(--b-brand)": isSelected
2980
2978
  }
@@ -3271,7 +3269,7 @@ var Checkout = () => {
3271
3269
  {
3272
3270
  onClick: appProps.onProcess,
3273
3271
  disabled: appProps.isProcessing,
3274
- className: "flex flex-col items-center rounded-md bg-[#00307D] p-2 text-(--brand-primary) hover:bg-[#002655] disabled:cursor-not-allowed disabled:bg-[#002655] disabled:text-(--disabled)",
3272
+ className: "flex flex-col items-center rounded-md bg-(--crypto-pay-bg) p-2 text-(--brand-primary) hover:bg-(--crypto-pay-bg-hover) disabled:cursor-not-allowed disabled:bg-(--crypto-pay-bg-hover) disabled:text-(--disabled)",
3275
3273
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-7 w-[76px]", fill: "none", viewBox: "0 0 76 28", children: [
3276
3274
  /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3277
3275
  "path",
package/build/index.css CHANGED
@@ -21,7 +21,6 @@
21
21
  "Liberation Mono",
22
22
  "Courier New",
23
23
  monospace;
24
- --color-black: #000;
25
24
  --spacing: 0.25rem;
26
25
  --container-lg: 32rem;
27
26
  --text-xs: 0.75rem;
@@ -644,6 +643,12 @@
644
643
  .sl-spreepay .bg-\(--brand-primary\) {
645
644
  background-color: var(--brand-primary);
646
645
  }
646
+ .sl-spreepay .bg-\(--crypto-pay-bg\) {
647
+ background-color: var(--crypto-pay-bg);
648
+ }
649
+ .sl-spreepay .bg-\(--overlay\) {
650
+ background-color: var(--overlay);
651
+ }
647
652
  .sl-spreepay .bg-\(--primary\) {
648
653
  background-color: var(--primary);
649
654
  }
@@ -680,15 +685,6 @@
680
685
  .sl-spreepay .bg-\(--surface-component-specific-card-default-card\) {
681
686
  background-color: var(--surface-component-specific-card-default-card);
682
687
  }
683
- .sl-spreepay .bg-\[\#00307D\] {
684
- background-color: #00307D;
685
- }
686
- .sl-spreepay .bg-black\/50 {
687
- background-color: color-mix(in srgb, #000 50%, transparent);
688
- @supports (color: color-mix(in lab, red, red)) {
689
- background-color: color-mix(in oklab, var(--color-black) 50%, transparent);
690
- }
691
- }
692
688
  .sl-spreepay .bg-transparent {
693
689
  background-color: transparent;
694
690
  }
@@ -1083,6 +1079,11 @@
1083
1079
  font-weight: var(--font-weight-medium);
1084
1080
  }
1085
1081
  }
1082
+ .sl-spreepay .placeholder\:text-\(--tertiary\) {
1083
+ &::placeholder {
1084
+ color: var(--tertiary);
1085
+ }
1086
+ }
1086
1087
  .sl-spreepay .hover\:bg-\(--accent\) {
1087
1088
  &:hover {
1088
1089
  @media (hover: hover) {
@@ -1090,6 +1091,13 @@
1090
1091
  }
1091
1092
  }
1092
1093
  }
1094
+ .sl-spreepay .hover\:bg-\(--crypto-pay-bg-hover\) {
1095
+ &:hover {
1096
+ @media (hover: hover) {
1097
+ background-color: var(--crypto-pay-bg-hover);
1098
+ }
1099
+ }
1100
+ }
1093
1101
  .sl-spreepay .hover\:bg-\(--primary\)\/90 {
1094
1102
  &:hover {
1095
1103
  @media (hover: hover) {
@@ -1138,13 +1146,6 @@
1138
1146
  }
1139
1147
  }
1140
1148
  }
1141
- .sl-spreepay .hover\:bg-\[\#002655\] {
1142
- &:hover {
1143
- @media (hover: hover) {
1144
- background-color: #002655;
1145
- }
1146
- }
1147
- }
1148
1149
  .sl-spreepay .hover\:text-\(--brand-primary\) {
1149
1150
  &:hover {
1150
1151
  @media (hover: hover) {
@@ -1271,14 +1272,14 @@
1271
1272
  cursor: not-allowed;
1272
1273
  }
1273
1274
  }
1274
- .sl-spreepay .disabled\:bg-\(--s-disabled\) {
1275
+ .sl-spreepay .disabled\:bg-\(--crypto-pay-bg-hover\) {
1275
1276
  &:disabled {
1276
- background-color: var(--s-disabled);
1277
+ background-color: var(--crypto-pay-bg-hover);
1277
1278
  }
1278
1279
  }
1279
- .sl-spreepay .disabled\:bg-\[\#002655\] {
1280
+ .sl-spreepay .disabled\:bg-\(--s-disabled\) {
1280
1281
  &:disabled {
1281
- background-color: #002655;
1282
+ background-color: var(--s-disabled);
1282
1283
  }
1283
1284
  }
1284
1285
  .sl-spreepay .disabled\:text-\(--disabled\) {
@@ -1414,6 +1415,11 @@
1414
1415
  background-color: var(--accent);
1415
1416
  }
1416
1417
  }
1418
+ .sl-spreepay .data-\[state\=open\]\:text-\(--secondary\) {
1419
+ &[data-state=open] {
1420
+ color: var(--secondary);
1421
+ }
1422
+ }
1417
1423
  .sl-spreepay .data-\[state\=open\]\:fade-in-0 {
1418
1424
  &[data-state=open] {
1419
1425
  --tw-enter-opacity: calc(0/100);
@@ -1641,6 +1647,9 @@
1641
1647
  --border-component-specific-card: #d0d4d7;
1642
1648
  --surface-component-specific-card-default-card: #fff;
1643
1649
  --shadow-component-specific-card: rgba(0, 0, 0, 0.05);
1650
+ --overlay: rgba(0, 0, 0, 0.4);
1651
+ --crypto-pay-bg: #00307d;
1652
+ --crypto-pay-bg-hover: #002655;
1644
1653
  }
1645
1654
  .sl-spreepay .sl-spreepay__portal {
1646
1655
  position: relative;
package/build/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/SpreePay.tsx
2
- import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo10, useState as useState14 } from "react";
2
+ import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo10, useState as useState14 } from "react";
3
3
  import NiceModal9 from "@ebay/nice-modal-react";
4
4
  import { SWRConfig } from "swr";
5
5
 
@@ -29,7 +29,7 @@ var PaymentType = /* @__PURE__ */ ((PaymentType2) => {
29
29
  })(PaymentType || {});
30
30
 
31
31
  // package.json
32
- var version = "0.1.41";
32
+ var version = "0.2.0";
33
33
 
34
34
  // src/utils/logger.ts
35
35
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
@@ -497,7 +497,7 @@ function Label({ className, ...props }) {
497
497
  {
498
498
  "data-slot": "label",
499
499
  className: cn(
500
- "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
500
+ "flex items-center gap-2 text-sm leading-none font-medium text-(--primary) select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
501
501
  className
502
502
  ),
503
503
  ...props
@@ -619,7 +619,7 @@ var PointsSwitch = (props) => {
619
619
  Boolean(appProps.topUpLink) && /* @__PURE__ */ jsx7(
620
620
  "a",
621
621
  {
622
- className: "cursor-pointer rounded-full bg-(--primary) px-2 py-1.5 text-xs font-medium text-(--inverse)",
622
+ className: "cursor-pointer rounded-full bg-(--s-brand) px-2 py-1.5 text-xs font-medium text-(--inverse) hover:bg-(--s-brand-hover)",
623
623
  rel: "noreferrer",
624
624
  target: "_blank",
625
625
  href: appProps.topUpLink,
@@ -703,7 +703,7 @@ var CheckoutButton = ({ isLoggedIn }) => {
703
703
  };
704
704
 
705
705
  // src/components/CreditCardTab/CreditCardTab.tsx
706
- import { useCallback as useCallback5, useEffect as useEffect7 } from "react";
706
+ import { useCallback as useCallback6, useEffect as useEffect8 } from "react";
707
707
 
708
708
  // src/hooks/payments/useCardPayment.ts
709
709
  import NiceModal2 from "@ebay/nice-modal-react";
@@ -759,7 +759,7 @@ function DialogOverlay({ className, ...props }) {
759
759
  {
760
760
  "data-slot": "dialog-overlay",
761
761
  className: cn(
762
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
762
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-(--overlay)",
763
763
  className
764
764
  ),
765
765
  ...props
@@ -789,7 +789,7 @@ function DialogContent({
789
789
  DialogPrimitive.Close,
790
790
  {
791
791
  "data-slot": "dialog-close",
792
- className: "ring-offset-background focus:ring-ring data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-(--accent) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
792
+ className: "ring-offset-background focus:ring-ring absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-(--accent) data-[state=open]:text-(--secondary) [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
793
793
  children: [
794
794
  /* @__PURE__ */ jsx10(XIcon, {}),
795
795
  /* @__PURE__ */ jsx10("span", { className: "sr-only", children: "Close" })
@@ -816,7 +816,7 @@ function DialogDescription({ className, ...props }) {
816
816
  DialogPrimitive.Description,
817
817
  {
818
818
  "data-slot": "dialog-description",
819
- className: cn("text-muted-foreground text-sm", className),
819
+ className: cn("text-sm text-(--secondary)", className),
820
820
  ...props
821
821
  }
822
822
  );
@@ -1658,7 +1658,7 @@ var CardsList = ({ selectedCard, setCard }) => {
1658
1658
  };
1659
1659
 
1660
1660
  // src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
1661
- import { useId as useId2, useState as useState3 } from "react";
1661
+ import { useCallback as useCallback2, useEffect as useEffect3, useId as useId2, useRef as useRef2, useState as useState3 } from "react";
1662
1662
  import { CardCvcElement, CardExpiryElement, CardNumberElement, useElements, useStripe } from "@stripe/react-stripe-js";
1663
1663
 
1664
1664
  // src/ui/button.tsx
@@ -1731,32 +1731,6 @@ function Checkbox({ className, ...props }) {
1731
1731
  // src/components/CreditCardTab/CreditCard/CreditCardForm.tsx
1732
1732
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
1733
1733
  var cardFormLogger = logger.child("card-form");
1734
- var styleDark = {
1735
- base: {
1736
- fontSize: "16px",
1737
- fontWeight: "500",
1738
- color: "rgba(255, 255, 255, 0.70)",
1739
- "::placeholder": {
1740
- color: "rgba(255, 255, 255, 0.5)"
1741
- }
1742
- },
1743
- invalid: {
1744
- color: "rgba(255, 255, 255, 0.70)"
1745
- }
1746
- };
1747
- var styleLight = {
1748
- base: {
1749
- fontSize: "16px",
1750
- fontWeight: "500",
1751
- color: "#000",
1752
- "::placeholder": {
1753
- color: "rgba(0, 0, 0, 0.5)"
1754
- }
1755
- },
1756
- invalid: {
1757
- color: "#000"
1758
- }
1759
- };
1760
1734
  var stripeElementClasses = {
1761
1735
  base: "w-full rounded-[12px] bg-(--s-primary) px-5 py-4 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 disabled:cursor-not-allowed disabled:opacity-50",
1762
1736
  invalid: "focus-visible:ring-destructive",
@@ -1764,10 +1738,35 @@ var stripeElementClasses = {
1764
1738
  };
1765
1739
  var CreditCardForm = ({ cancel, saveCard }) => {
1766
1740
  const [cardError, setCardError] = useState3(void 0);
1767
- const { env } = useSpreePayEnv();
1741
+ const [stripeStyles, setStripeStyles] = useState3({});
1742
+ const formRef = useRef2(null);
1768
1743
  const elements = useElements();
1769
1744
  const stripe = useStripe();
1770
1745
  const id = useId2();
1746
+ const computeStripeStyles = useCallback2(() => {
1747
+ const formRefCurrent = formRef.current;
1748
+ if (typeof window === "undefined" || !formRefCurrent) return {};
1749
+ const container = formRefCurrent.closest(".sl-spreepay");
1750
+ if (!container) return {};
1751
+ const primary = getComputedStyle(container).getPropertyValue("--primary").trim() || "rgba(255, 255, 255, 0.70)";
1752
+ const secondary = getComputedStyle(container).getPropertyValue("--secondary").trim() || "rgba(255, 255, 255, 0.5)";
1753
+ return {
1754
+ base: {
1755
+ fontSize: "16px",
1756
+ fontWeight: "500",
1757
+ color: primary,
1758
+ "::placeholder": {
1759
+ color: secondary
1760
+ }
1761
+ },
1762
+ invalid: {
1763
+ color: primary
1764
+ }
1765
+ };
1766
+ }, []);
1767
+ useEffect3(() => {
1768
+ setStripeStyles(computeStripeStyles());
1769
+ }, [computeStripeStyles]);
1771
1770
  const handleSaveCard = async () => {
1772
1771
  if (!elements || !stripe) return;
1773
1772
  setCardError(void 0);
@@ -1802,14 +1801,13 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1802
1801
  setCardError("An error occurred while processing your card. Please try again.");
1803
1802
  }
1804
1803
  };
1805
- const isDarkMode = env.tenantId === "cdc";
1806
1804
  return /* @__PURE__ */ jsxs9(Fragment2, { children: [
1807
- /* @__PURE__ */ jsxs9("div", { className: "flex w-full flex-col gap-4", children: [
1805
+ /* @__PURE__ */ jsxs9("div", { ref: formRef, className: "flex w-full flex-col gap-4", children: [
1808
1806
  /* @__PURE__ */ jsx15(
1809
1807
  CardNumberElement,
1810
1808
  {
1811
1809
  options: {
1812
- style: isDarkMode ? styleDark : styleLight,
1810
+ style: stripeStyles,
1813
1811
  placeholder: "Card Number",
1814
1812
  classes: stripeElementClasses
1815
1813
  }
@@ -1820,7 +1818,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1820
1818
  CardExpiryElement,
1821
1819
  {
1822
1820
  options: {
1823
- style: isDarkMode ? styleDark : styleLight,
1821
+ style: stripeStyles,
1824
1822
  placeholder: "MM / YY",
1825
1823
  classes: stripeElementClasses
1826
1824
  }
@@ -1830,7 +1828,7 @@ var CreditCardForm = ({ cancel, saveCard }) => {
1830
1828
  CardCvcElement,
1831
1829
  {
1832
1830
  options: {
1833
- style: isDarkMode ? styleDark : styleLight,
1831
+ style: stripeStyles,
1834
1832
  placeholder: "CVV",
1835
1833
  classes: stripeElementClasses
1836
1834
  }
@@ -1916,7 +1914,7 @@ var CreditCard = () => {
1916
1914
  import { useState as useState10 } from "react";
1917
1915
 
1918
1916
  // src/components/CreditCardTab/Points/SplitBlock.tsx
1919
- import { useCallback as useCallback4, useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
1917
+ import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef7, useState as useState9 } from "react";
1920
1918
  import { BUILD_ENV as BUILD_ENV2 } from "@mocanetwork/airkit";
1921
1919
 
1922
1920
  // src/components/CreditCardTab/Points/PointsSelector.tsx
@@ -1931,7 +1929,7 @@ function Input({ className, type, ...props }) {
1931
1929
  type,
1932
1930
  "data-slot": "input",
1933
1931
  className: cn(
1934
- "file:text-foreground dark:bg-input/30 border-input placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none selection:bg-(--primary) selection:text-(--inverse) file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1932
+ "file:text-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base text-(--brand-primary) shadow-xs transition-[color,box-shadow] outline-none selection:bg-(--primary) selection:text-(--inverse) file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-(--tertiary) disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1935
1933
  "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
1936
1934
  "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
1937
1935
  className
@@ -2931,7 +2929,7 @@ var PointsSelector = (props) => {
2931
2929
  disabled: isDisabled,
2932
2930
  onClick: onSelect,
2933
2931
  className: cn(
2934
- "cursor-pointer overflow-hidden rounded-md border-2 border-transparent opacity-50 disabled:cursor-not-allowed",
2932
+ "cursor-pointer overflow-hidden rounded-md border-2 border-transparent disabled:cursor-not-allowed disabled:opacity-50",
2935
2933
  {
2936
2934
  "border-(--b-brand)": isSelected
2937
2935
  }
@@ -3010,8 +3008,8 @@ var SplitBlock = (props) => {
3010
3008
  const [walletReady, setWalletReady] = useState9(false);
3011
3009
  const { pointsConversionRatio, pointsTitle } = spreePayConfig || {};
3012
3010
  const { env } = useSpreePayEnv();
3013
- const prevPointsChainRef = useRef6(spreePayConfig?.pointsChain);
3014
- const initWallet = useCallback4(
3011
+ const prevPointsChainRef = useRef7(spreePayConfig?.pointsChain);
3012
+ const initWallet = useCallback5(
3015
3013
  async (pointsChain) => {
3016
3014
  if (!pointsChain) return;
3017
3015
  try {
@@ -3034,7 +3032,7 @@ var SplitBlock = (props) => {
3034
3032
  },
3035
3033
  [onToggle, env.environment]
3036
3034
  );
3037
- useEffect6(() => {
3035
+ useEffect7(() => {
3038
3036
  if (!env.useWeb3Points) return;
3039
3037
  const pointsChainChanged = prevPointsChainRef.current !== spreePayConfig?.pointsChain;
3040
3038
  prevPointsChainRef.current = spreePayConfig?.pointsChain;
@@ -3111,7 +3109,7 @@ var CreditCardTab = () => {
3111
3109
  const { cardPayment } = useCardPayment();
3112
3110
  const { splitPayment } = useSplitCardPayments(isWeb3Enabled ? "web3" : "web2");
3113
3111
  const { pointsPayment } = usePointsPayment(isWeb3Enabled ? "web3" : "web2");
3114
- const handlePay = useCallback5(
3112
+ const handlePay = useCallback6(
3115
3113
  async (data) => {
3116
3114
  try {
3117
3115
  let res = null;
@@ -3150,7 +3148,7 @@ var CreditCardTab = () => {
3150
3148
  mutateBalance
3151
3149
  ]
3152
3150
  );
3153
- useEffect7(() => {
3151
+ useEffect8(() => {
3154
3152
  register(handlePay);
3155
3153
  }, [register, handlePay]);
3156
3154
  return /* @__PURE__ */ jsxs16("div", { children: [
@@ -3160,7 +3158,7 @@ var CreditCardTab = () => {
3160
3158
  };
3161
3159
 
3162
3160
  // src/components/CryptoComTab/CryptoComTab.tsx
3163
- import { useCallback as useCallback6, useEffect as useEffect8 } from "react";
3161
+ import { useCallback as useCallback7, useEffect as useEffect9 } from "react";
3164
3162
 
3165
3163
  // src/hooks/payments/useCryptoComPayment.ts
3166
3164
  import NiceModal5 from "@ebay/nice-modal-react";
@@ -3228,7 +3226,7 @@ var Checkout = () => {
3228
3226
  {
3229
3227
  onClick: appProps.onProcess,
3230
3228
  disabled: appProps.isProcessing,
3231
- className: "flex flex-col items-center rounded-md bg-[#00307D] p-2 text-(--brand-primary) hover:bg-[#002655] disabled:cursor-not-allowed disabled:bg-[#002655] disabled:text-(--disabled)",
3229
+ className: "flex flex-col items-center rounded-md bg-(--crypto-pay-bg) p-2 text-(--brand-primary) hover:bg-(--crypto-pay-bg-hover) disabled:cursor-not-allowed disabled:bg-(--crypto-pay-bg-hover) disabled:text-(--disabled)",
3232
3230
  children: /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-7 w-[76px]", fill: "none", viewBox: "0 0 76 28", children: [
3233
3231
  /* @__PURE__ */ jsx29(
3234
3232
  "path",
@@ -3286,7 +3284,7 @@ var CryptoComTab = () => {
3286
3284
  const { register } = useSpreePayRegister();
3287
3285
  const { cryptoComPayment } = useCryptoComPayment();
3288
3286
  const { spreePayConfig } = useSpreePayConfig();
3289
- const handlePay = useCallback6(
3287
+ const handlePay = useCallback7(
3290
3288
  async (data) => {
3291
3289
  try {
3292
3290
  const res = await cryptoComPayment(data);
@@ -3300,7 +3298,7 @@ var CryptoComTab = () => {
3300
3298
  },
3301
3299
  [cryptoComPayment]
3302
3300
  );
3303
- useEffect8(() => {
3301
+ useEffect9(() => {
3304
3302
  register(handlePay);
3305
3303
  }, [register, handlePay]);
3306
3304
  return /* @__PURE__ */ jsxs18("div", { className: "flex w-full flex-col gap-4 border-b border-b-(--border-component-specific-card) px-5 py-5 md:px-7 md:py-6", children: [
@@ -3320,7 +3318,7 @@ import { WagmiProvider } from "wagmi";
3320
3318
  import { base } from "wagmi/chains";
3321
3319
 
3322
3320
  // src/components/CryptoTab/Crypto/Crypto.tsx
3323
- import { useCallback as useCallback7, useEffect as useEffect10 } from "react";
3321
+ import { useCallback as useCallback8, useEffect as useEffect11 } from "react";
3324
3322
  import { useAccount as useAccount3 } from "wagmi";
3325
3323
 
3326
3324
  // ../../node_modules/@wagmi/core/dist/esm/utils/getAction.js
@@ -4053,7 +4051,7 @@ var Crypto = () => {
4053
4051
  const { spreePayConfig } = useSpreePayConfig();
4054
4052
  const isWalletConnected = Boolean(address);
4055
4053
  const { register } = useSpreePayRegister();
4056
- const handlePay = useCallback7(
4054
+ const handlePay = useCallback8(
4057
4055
  async (data) => {
4058
4056
  try {
4059
4057
  const res = await cryptoPayment(data);
@@ -4067,7 +4065,7 @@ var Crypto = () => {
4067
4065
  },
4068
4066
  [cryptoPayment]
4069
4067
  );
4070
- useEffect10(() => {
4068
+ useEffect11(() => {
4071
4069
  register(handlePay);
4072
4070
  }, [register, handlePay]);
4073
4071
  return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col items-baseline gap-4", children: [
@@ -4265,21 +4263,21 @@ var ErrorBoundary = class extends Component {
4265
4263
  };
4266
4264
 
4267
4265
  // src/hooks/useKeycloakSSO.ts
4268
- import { useCallback as useCallback8, useEffect as useEffect11, useRef as useRef7, useState as useState13 } from "react";
4266
+ import { useCallback as useCallback9, useEffect as useEffect12, useRef as useRef8, useState as useState13 } from "react";
4269
4267
  import Keycloak from "keycloak-js";
4270
4268
  var refreshAheadSeconds = 60;
4271
4269
  var keycloakLogger = logger.child("keycloak");
4272
4270
  function useKeycloakSSO(config2) {
4273
4271
  const { url, realm, clientId, ssoPageURI, enabled } = config2;
4274
- const initRef = useRef7(false);
4275
- const kcRef = useRef7(null);
4276
- const refreshTimerRef = useRef7(null);
4277
- const scheduleRefreshRef = useRef7(() => {
4272
+ const initRef = useRef8(false);
4273
+ const kcRef = useRef8(null);
4274
+ const refreshTimerRef = useRef8(null);
4275
+ const scheduleRefreshRef = useRef8(() => {
4278
4276
  });
4279
4277
  const [error, setError] = useState13(null);
4280
4278
  const [isChecking, setIsChecking] = useState13(enabled);
4281
4279
  const [accessToken, setAccessToken] = useState13(null);
4282
- const scheduleRefresh = useCallback8(() => {
4280
+ const scheduleRefresh = useCallback9(() => {
4283
4281
  const kc = kcRef.current;
4284
4282
  if (!kc || !kc.tokenParsed || !kc.tokenParsed.exp) {
4285
4283
  return;
@@ -4303,10 +4301,10 @@ function useKeycloakSSO(config2) {
4303
4301
  });
4304
4302
  }, delayMs);
4305
4303
  }, []);
4306
- useEffect11(() => {
4304
+ useEffect12(() => {
4307
4305
  scheduleRefreshRef.current = scheduleRefresh;
4308
4306
  }, [scheduleRefresh]);
4309
- useEffect11(() => {
4307
+ useEffect12(() => {
4310
4308
  if (initRef.current || !enabled) return;
4311
4309
  initRef.current = true;
4312
4310
  const kc = new Keycloak({ url, realm, clientId });
@@ -4343,13 +4341,13 @@ function useKeycloakSSO(config2) {
4343
4341
  import { jsx as jsx47, jsxs as jsxs30 } from "react/jsx-runtime";
4344
4342
  var SpreePayInner = () => {
4345
4343
  const [portalEl, setPortalEl] = useState14(null);
4346
- const rootRef = useCallback9((node) => {
4344
+ const rootRef = useCallback10((node) => {
4347
4345
  if (!node) return;
4348
4346
  const el = node.querySelector(":scope > .sl-spreepay__portal");
4349
4347
  setPortalEl(el ?? null);
4350
4348
  }, []);
4351
4349
  const { env } = useSpreePayEnv();
4352
- useEffect12(() => {
4350
+ useEffect13(() => {
4353
4351
  configureLogger({ environment: env.environment });
4354
4352
  logger.logVersion();
4355
4353
  }, [env.environment]);
@@ -4363,7 +4361,7 @@ var SpreePayInner = () => {
4363
4361
  enabled: !env?.accessToken
4364
4362
  });
4365
4363
  const _accessToken = env.accessToken ?? accessToken;
4366
- const unauthenticatedFetcher = useCallback9(() => Promise.resolve(null), []);
4364
+ const unauthenticatedFetcher = useCallback10(() => Promise.resolve(null), []);
4367
4365
  const slapiFetcher = useMemo10(() => {
4368
4366
  if (_accessToken) {
4369
4367
  return registerApi({
@@ -4404,9 +4402,9 @@ var SpreePay = (props) => {
4404
4402
  };
4405
4403
 
4406
4404
  // src/hooks/useCapture3DS.ts
4407
- import { useEffect as useEffect13 } from "react";
4405
+ import { useEffect as useEffect14 } from "react";
4408
4406
  var useCapture3DS = (searchParams) => {
4409
- useEffect13(() => {
4407
+ useEffect14(() => {
4410
4408
  if (typeof window !== "undefined" && window.parent && searchParams?.paymentIntent) {
4411
4409
  window.parent.SP_EVENT_BUS?.emit("paymentIntent", { paymentIntent: searchParams.paymentIntent });
4412
4410
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superlogic/spree-pay",
3
- "version": "0.1.42",
3
+ "version": "0.2.0",
4
4
  "description": "Spree-pay React component and utilities",
5
5
  "private": false,
6
6
  "type": "module",