@doujins/payments-ui 0.1.15 → 0.1.16

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React15 = require('react');
3
+ var React4 = require('react');
4
4
  var reactQuery = require('@tanstack/react-query');
5
5
  var walletAdapterReact = require('@solana/wallet-adapter-react');
6
6
  var walletAdapterReactUi = require('@solana/wallet-adapter-react-ui');
@@ -48,7 +48,7 @@ function _interopNamespace(e) {
48
48
  return Object.freeze(n);
49
49
  }
50
50
 
51
- var React15__namespace = /*#__PURE__*/_interopNamespace(React15);
51
+ var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
52
52
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
53
53
  var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
54
54
  var countryList__default = /*#__PURE__*/_interopDefault(countryList);
@@ -521,7 +521,7 @@ var buttonVariants = classVarianceAuthority.cva(
521
521
  }
522
522
  }
523
523
  );
524
- var Button = React15__namespace.forwardRef(
524
+ var Button = React4__namespace.forwardRef(
525
525
  ({ className, variant, size, asChild = false, ...props }, ref) => {
526
526
  const Comp = asChild ? reactSlot.Slot : "button";
527
527
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -535,7 +535,7 @@ var Button = React15__namespace.forwardRef(
535
535
  }
536
536
  );
537
537
  Button.displayName = "Button";
538
- var Input = React15__namespace.forwardRef(
538
+ var Input = React4__namespace.forwardRef(
539
539
  ({ className, type, ...props }, ref) => {
540
540
  return /* @__PURE__ */ jsxRuntime.jsx(
541
541
  "input",
@@ -555,7 +555,7 @@ Input.displayName = "Input";
555
555
  var labelVariants = classVarianceAuthority.cva(
556
556
  "text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
557
557
  );
558
- var Label = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
558
+ var Label = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
559
559
  LabelPrimitive__namespace.Root,
560
560
  {
561
561
  ref,
@@ -564,9 +564,9 @@ var Label = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @
564
564
  }
565
565
  ));
566
566
  Label.displayName = LabelPrimitive__namespace.Root.displayName;
567
- var Select = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Root, { ...props, children }) });
567
+ var Select = SelectPrimitive__namespace.Root;
568
568
  var SelectValue = SelectPrimitive__namespace.Value;
569
- var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
569
+ var SelectTrigger = React4__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
570
570
  SelectPrimitive__namespace.Trigger,
571
571
  {
572
572
  ref,
@@ -582,7 +582,7 @@ var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...pro
582
582
  }
583
583
  ));
584
584
  SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
585
- var SelectScrollUpButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
585
+ var SelectScrollUpButton = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
586
586
  SelectPrimitive__namespace.ScrollUpButton,
587
587
  {
588
588
  ref,
@@ -595,7 +595,7 @@ var SelectScrollUpButton = React15__namespace.forwardRef(({ className, ...props
595
595
  }
596
596
  ));
597
597
  SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
598
- var SelectScrollDownButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
598
+ var SelectScrollDownButton = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
599
599
  SelectPrimitive__namespace.ScrollDownButton,
600
600
  {
601
601
  ref,
@@ -608,39 +608,61 @@ var SelectScrollDownButton = React15__namespace.forwardRef(({ className, ...prop
608
608
  }
609
609
  ));
610
610
  SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
611
- var SelectContent = React15__namespace.forwardRef(
612
- ({
613
- className,
614
- children,
615
- position = "popper",
616
- side = "bottom",
617
- sideOffset = 4,
618
- align = "start",
619
- ...props
620
- }, ref) => {
621
- const popperProps = position === "popper" ? { side, sideOffset, align } : {};
622
- return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
623
- SelectPrimitive__namespace.Content,
624
- {
625
- ref,
626
- className: cn(
627
- "z-[200] max-h-64 w-[var(--radix-select-trigger-width)] overflow-y-auto overflow-x-hidden rounded-md border border-white/20 bg-background-regular text-foreground shadow-lg backdrop-blur-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
628
- className
629
- ),
630
- position,
631
- ...popperProps,
632
- ...props,
633
- children: [
634
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
635
- /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", children }),
636
- /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
637
- ]
611
+ var SelectContent = React4__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => {
612
+ const viewportRef = React4__namespace.useRef(null);
613
+ const contentRef = React4__namespace.useCallback((node) => {
614
+ if (node) {
615
+ node.style.setProperty("max-height", "40vh", "important");
616
+ const anchorWidth = window.getComputedStyle(node).getPropertyValue("--radix-popper-anchor-width");
617
+ if (anchorWidth) {
618
+ node.style.setProperty("width", anchorWidth, "important");
638
619
  }
639
- ) });
640
- }
641
- );
620
+ }
621
+ }, []);
622
+ const combinedRef = React4__namespace.useCallback((node) => {
623
+ contentRef(node);
624
+ if (typeof ref === "function") {
625
+ ref(node);
626
+ } else if (ref) {
627
+ ref.current = node;
628
+ }
629
+ }, [contentRef, ref]);
630
+ React4__namespace.useEffect(() => {
631
+ if (viewportRef.current) {
632
+ viewportRef.current.style.setProperty("max-height", "40vh", "important");
633
+ }
634
+ });
635
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
636
+ SelectPrimitive__namespace.Content,
637
+ {
638
+ ref: combinedRef,
639
+ className: cn(
640
+ "relative z-50 min-w-[8rem] overflow-hidden rounded-md border border-white/20 bg-background-regular text-foreground shadow-lg backdrop-blur-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
641
+ position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
642
+ className
643
+ ),
644
+ position,
645
+ ...props,
646
+ children: [
647
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
648
+ /* @__PURE__ */ jsxRuntime.jsx(
649
+ SelectPrimitive__namespace.Viewport,
650
+ {
651
+ ref: viewportRef,
652
+ className: cn(
653
+ "p-1 overflow-y-auto",
654
+ position === "popper" && "w-full min-w-[var(--radix-select-trigger-width)]"
655
+ ),
656
+ children
657
+ }
658
+ ),
659
+ /* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
660
+ ]
661
+ }
662
+ ) });
663
+ });
642
664
  SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
643
- var SelectLabel = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
665
+ var SelectLabel = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
644
666
  SelectPrimitive__namespace.Label,
645
667
  {
646
668
  ref,
@@ -649,7 +671,7 @@ var SelectLabel = React15__namespace.forwardRef(({ className, ...props }, ref) =
649
671
  }
650
672
  ));
651
673
  SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
652
- var SelectItem = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
674
+ var SelectItem = React4__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
653
675
  SelectPrimitive__namespace.Item,
654
676
  {
655
677
  ref,
@@ -665,7 +687,7 @@ var SelectItem = React15__namespace.forwardRef(({ className, children, ...props
665
687
  }
666
688
  ));
667
689
  SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
668
- var SelectSeparator = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
690
+ var SelectSeparator = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
669
691
  SelectPrimitive__namespace.Separator,
670
692
  {
671
693
  ref,
@@ -701,8 +723,8 @@ var CardDetailsForm = ({
701
723
  submitDisabled = false
702
724
  }) => {
703
725
  const { config } = usePaymentContext();
704
- const defaultValuesKey = React15.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
705
- const mergedDefaults = React15.useMemo(
726
+ const defaultValuesKey = React4.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
727
+ const mergedDefaults = React4.useMemo(
706
728
  () => ({
707
729
  ...defaultBillingDetails,
708
730
  ...defaultValues,
@@ -710,20 +732,21 @@ var CardDetailsForm = ({
710
732
  }),
711
733
  [defaultValuesKey, config.defaultUser?.email]
712
734
  );
713
- const [firstName, setFirstName] = React15.useState(mergedDefaults.firstName);
714
- const [lastName, setLastName] = React15.useState(mergedDefaults.lastName);
715
- const [address1, setAddress1] = React15.useState(mergedDefaults.address1);
716
- const [city, setCity] = React15.useState(mergedDefaults.city);
717
- const [stateRegion, setStateRegion] = React15.useState(mergedDefaults.stateRegion ?? "");
718
- const [postalCode, setPostalCode] = React15.useState(mergedDefaults.postalCode);
719
- const [country, setCountry] = React15.useState(mergedDefaults.country);
720
- const [email, setEmail] = React15.useState(mergedDefaults.email ?? "");
721
- const [localError, setLocalError] = React15.useState(null);
722
- const [isTokenizing, setIsTokenizing] = React15.useState(false);
723
- const [collectReady, setCollectReady] = React15.useState(
735
+ const [firstName, setFirstName] = React4.useState(mergedDefaults.firstName);
736
+ const [lastName, setLastName] = React4.useState(mergedDefaults.lastName);
737
+ const [address1, setAddress1] = React4.useState(mergedDefaults.address1);
738
+ const [city, setCity] = React4.useState(mergedDefaults.city);
739
+ const [stateRegion, setStateRegion] = React4.useState(mergedDefaults.stateRegion ?? "");
740
+ const [postalCode, setPostalCode] = React4.useState(mergedDefaults.postalCode);
741
+ const [country, setCountry] = React4.useState(mergedDefaults.country);
742
+ const [email, setEmail] = React4.useState(mergedDefaults.email ?? "");
743
+ const [isEditingEmail, setIsEditingEmail] = React4.useState(false);
744
+ const [localError, setLocalError] = React4.useState(null);
745
+ const [isTokenizing, setIsTokenizing] = React4.useState(false);
746
+ const [collectReady, setCollectReady] = React4.useState(
724
747
  typeof window !== "undefined" && Boolean(window.CollectJS)
725
748
  );
726
- React15.useEffect(() => {
749
+ React4.useEffect(() => {
727
750
  if (collectReady) return;
728
751
  let active = true;
729
752
  waitForCollectJs().then((instance) => {
@@ -735,13 +758,13 @@ var CardDetailsForm = ({
735
758
  active = false;
736
759
  };
737
760
  }, [collectReady]);
738
- React15.useEffect(() => {
761
+ React4.useEffect(() => {
739
762
  if (!visible) {
740
763
  setLocalError(null);
741
764
  setIsTokenizing(false);
742
765
  }
743
766
  }, [visible]);
744
- React15.useEffect(() => {
767
+ React4.useEffect(() => {
745
768
  if (!visible) return;
746
769
  setFirstName(mergedDefaults.firstName);
747
770
  setLastName(mergedDefaults.lastName);
@@ -752,7 +775,7 @@ var CardDetailsForm = ({
752
775
  setCountry(mergedDefaults.country);
753
776
  setEmail(mergedDefaults.email ?? "");
754
777
  }, [defaultValuesKey, mergedDefaults, visible]);
755
- React15.useEffect(() => {
778
+ React4.useEffect(() => {
756
779
  if (!onBillingChange) return;
757
780
  onBillingChange({
758
781
  firstName,
@@ -791,7 +814,7 @@ var CardDetailsForm = ({
791
814
  }
792
815
  return sanitized;
793
816
  };
794
- React15.useEffect(() => {
817
+ React4.useEffect(() => {
795
818
  if (!collectReady || typeof window === "undefined" || !window.CollectJS || !visible) {
796
819
  return;
797
820
  }
@@ -851,8 +874,7 @@ var CardDetailsForm = ({
851
874
  visible
852
875
  ]);
853
876
  const validate = () => {
854
- const emailRequired = !defaultValues?.email && !config.defaultUser?.email;
855
- if (!firstName.trim() || !lastName.trim() || !address1.trim() || !city.trim() || !postalCode.trim() || !country.trim() || emailRequired && !email.trim()) {
877
+ if (!firstName.trim() || !lastName.trim() || !address1.trim() || !city.trim() || !postalCode.trim() || !country.trim() || !email.trim()) {
856
878
  setLocalError("Please complete all required billing fields.");
857
879
  return false;
858
880
  }
@@ -871,7 +893,8 @@ var CardDetailsForm = ({
871
893
  };
872
894
  const errorMessage = localError ?? externalError;
873
895
  const collectFieldClass = "relative flex h-9 w-full items-center overflow-hidden rounded-md border border-white/30 bg-transparent px-3 text-sm text-foreground";
874
- const showEmailField = !defaultValues?.email && !config.defaultUser?.email;
896
+ const hasDefaultEmail = Boolean(defaultValues?.email || config.defaultUser?.email);
897
+ const showEmailInput = !hasDefaultEmail || isEditingEmail;
875
898
  return /* @__PURE__ */ jsxRuntime.jsxs(
876
899
  "form",
877
900
  {
@@ -906,18 +929,47 @@ var CardDetailsForm = ({
906
929
  )
907
930
  ] })
908
931
  ] }),
909
- showEmailField && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
932
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
910
933
  /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "email", children: "Email" }),
911
- /* @__PURE__ */ jsxRuntime.jsx(
912
- Input,
913
- {
914
- id: "email",
915
- type: "email",
916
- value: email,
917
- onChange: (e) => setEmail(e.target.value),
918
- required: true
919
- }
920
- )
934
+ showEmailInput ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center", children: [
935
+ /* @__PURE__ */ jsxRuntime.jsx(
936
+ Input,
937
+ {
938
+ id: "email",
939
+ type: "email",
940
+ value: email,
941
+ onChange: (e) => setEmail(e.target.value),
942
+ required: true,
943
+ className: "flex-1"
944
+ }
945
+ ),
946
+ hasDefaultEmail && /* @__PURE__ */ jsxRuntime.jsx(
947
+ Button,
948
+ {
949
+ type: "button",
950
+ variant: "ghost",
951
+ size: "sm",
952
+ onClick: () => {
953
+ setIsEditingEmail(false);
954
+ setEmail(mergedDefaults.email ?? "");
955
+ },
956
+ className: "px-3 text-xs text-muted-foreground hover:text-foreground",
957
+ children: "Cancel"
958
+ }
959
+ )
960
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between h-9 w-full rounded-md border border-white/30 bg-transparent px-3 text-sm text-foreground", children: [
961
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: email }),
962
+ /* @__PURE__ */ jsxRuntime.jsx(
963
+ "button",
964
+ {
965
+ type: "button",
966
+ onClick: () => setIsEditingEmail(true),
967
+ className: "text-muted-foreground hover:text-foreground transition-colors",
968
+ "aria-label": "Edit email",
969
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "h-4 w-4" })
970
+ }
971
+ )
972
+ ] })
921
973
  ] }),
922
974
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
923
975
  /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "address1", children: "Address" }),
@@ -973,7 +1025,7 @@ var CardDetailsForm = ({
973
1025
  /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Country" }),
974
1026
  /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: country, onValueChange: setCountry, children: [
975
1027
  /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select a country" }) }),
976
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "max-h-64 w-full", children: countries.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.code, children: option.name }, option.code)) })
1028
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: countries.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.code, children: option.name }, option.code)) })
977
1029
  ] })
978
1030
  ] })
979
1031
  ] }),
@@ -1079,7 +1131,7 @@ var badgeVariants = classVarianceAuthority.cva(
1079
1131
  function Badge({ className, variant, ...props }) {
1080
1132
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
1081
1133
  }
1082
- var ScrollArea = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1134
+ var ScrollArea = React4__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1083
1135
  ScrollAreaPrimitive__namespace.Root,
1084
1136
  {
1085
1137
  ref,
@@ -1093,7 +1145,7 @@ var ScrollArea = React15__namespace.forwardRef(({ className, children, ...props
1093
1145
  }
1094
1146
  ));
1095
1147
  ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
1096
- var ScrollBar = React15__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1148
+ var ScrollBar = React4__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1097
1149
  ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
1098
1150
  {
1099
1151
  ref,
@@ -1119,7 +1171,7 @@ var StoredPaymentMethods = ({
1119
1171
  onMethodSelect
1120
1172
  }) => {
1121
1173
  const { listQuery } = usePaymentMethods();
1122
- const payments = React15.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1174
+ const payments = React4.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1123
1175
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: listQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
1124
1176
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1125
1177
  " Loading cards..."
@@ -1178,7 +1230,7 @@ function TabsList({
1178
1230
  {
1179
1231
  "data-slot": "tabs-list",
1180
1232
  className: cn(
1181
- "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
1233
+ "bg-transparent border border-white/30 text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1",
1182
1234
  className
1183
1235
  ),
1184
1236
  ...props
@@ -1189,12 +1241,32 @@ function TabsTrigger({
1189
1241
  className,
1190
1242
  ...props
1191
1243
  }) {
1244
+ const triggerRef = React4__namespace.useRef(null);
1245
+ React4__namespace.useEffect(() => {
1246
+ const element = triggerRef.current;
1247
+ if (!element) return;
1248
+ const updateStyles = () => {
1249
+ const isActive = element.getAttribute("data-state") === "active";
1250
+ if (isActive) {
1251
+ element.style.setProperty("background-color", "rgba(255, 255, 255, 0.3)", "important");
1252
+ element.style.setProperty("border-color", "transparent", "important");
1253
+ } else {
1254
+ element.style.removeProperty("background-color");
1255
+ element.style.removeProperty("border-color");
1256
+ }
1257
+ };
1258
+ updateStyles();
1259
+ const observer = new MutationObserver(updateStyles);
1260
+ observer.observe(element, { attributes: true, attributeFilter: ["data-state"] });
1261
+ return () => observer.disconnect();
1262
+ }, []);
1192
1263
  return /* @__PURE__ */ jsxRuntime.jsx(
1193
1264
  TabsPrimitive__namespace.Trigger,
1194
1265
  {
1266
+ ref: triggerRef,
1195
1267
  "data-slot": "tabs-trigger",
1196
1268
  className: cn(
1197
- "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1269
+ "data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/70 inline-flex h-[calc(100%-0.5rem)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color,border-color] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1198
1270
  className
1199
1271
  ),
1200
1272
  ...props
@@ -1216,19 +1288,19 @@ function TabsContent({
1216
1288
  }
1217
1289
  var usePaymentNotifications = () => {
1218
1290
  const { config } = usePaymentContext();
1219
- const notifyStatus = React15.useCallback(
1291
+ const notifyStatus = React4.useCallback(
1220
1292
  (status, context) => {
1221
1293
  config.callbacks?.onStatusChange?.({ status, context });
1222
1294
  },
1223
1295
  [config.callbacks]
1224
1296
  );
1225
- const notifySuccess = React15.useCallback(
1297
+ const notifySuccess = React4.useCallback(
1226
1298
  (payload) => {
1227
1299
  config.callbacks?.onSuccess?.(payload ?? {});
1228
1300
  },
1229
1301
  [config.callbacks]
1230
1302
  );
1231
- const notifyError = React15.useCallback(
1303
+ const notifyError = React4.useCallback(
1232
1304
  (error) => {
1233
1305
  config.callbacks?.onError?.(
1234
1306
  typeof error === "string" ? new Error(error) : error
@@ -1246,17 +1318,17 @@ var useSolanaQrPayment = (options) => {
1246
1318
  const { priceId, selectedToken, onSuccess, onError } = options;
1247
1319
  const { client } = usePaymentContext();
1248
1320
  const tokenSymbol = selectedToken?.symbol ?? null;
1249
- const onSuccessRef = React15.useRef(onSuccess);
1250
- const onErrorRef = React15.useRef(onError);
1251
- const [intent, setIntent] = React15.useState(null);
1252
- const [qrDataUri, setQrDataUri] = React15.useState(null);
1253
- const [isLoading, setIsLoading] = React15.useState(false);
1254
- const [error, setError] = React15.useState(null);
1255
- const [timeRemaining, setTimeRemaining] = React15.useState(0);
1256
- const [refreshNonce, setRefreshNonce] = React15.useState(0);
1257
- const pollRef = React15.useRef(null);
1258
- const countdownRef = React15.useRef(null);
1259
- const clearTimers = React15.useCallback(() => {
1321
+ const onSuccessRef = React4.useRef(onSuccess);
1322
+ const onErrorRef = React4.useRef(onError);
1323
+ const [intent, setIntent] = React4.useState(null);
1324
+ const [qrDataUri, setQrDataUri] = React4.useState(null);
1325
+ const [isLoading, setIsLoading] = React4.useState(false);
1326
+ const [error, setError] = React4.useState(null);
1327
+ const [timeRemaining, setTimeRemaining] = React4.useState(0);
1328
+ const [refreshNonce, setRefreshNonce] = React4.useState(0);
1329
+ const pollRef = React4.useRef(null);
1330
+ const countdownRef = React4.useRef(null);
1331
+ const clearTimers = React4.useCallback(() => {
1260
1332
  if (pollRef.current) {
1261
1333
  clearInterval(pollRef.current);
1262
1334
  pollRef.current = null;
@@ -1266,12 +1338,12 @@ var useSolanaQrPayment = (options) => {
1266
1338
  countdownRef.current = null;
1267
1339
  }
1268
1340
  }, []);
1269
- React15.useEffect(() => {
1341
+ React4.useEffect(() => {
1270
1342
  return () => {
1271
1343
  clearTimers();
1272
1344
  };
1273
1345
  }, [clearTimers]);
1274
- const resetState = React15.useCallback(
1346
+ const resetState = React4.useCallback(
1275
1347
  (message) => {
1276
1348
  clearTimers();
1277
1349
  setIntent(null);
@@ -1281,13 +1353,13 @@ var useSolanaQrPayment = (options) => {
1281
1353
  },
1282
1354
  [clearTimers]
1283
1355
  );
1284
- React15.useEffect(() => {
1356
+ React4.useEffect(() => {
1285
1357
  onSuccessRef.current = onSuccess;
1286
1358
  }, [onSuccess]);
1287
- React15.useEffect(() => {
1359
+ React4.useEffect(() => {
1288
1360
  onErrorRef.current = onError;
1289
1361
  }, [onError]);
1290
- const handleError = React15.useCallback(
1362
+ const handleError = React4.useCallback(
1291
1363
  (message, notifyParent = false) => {
1292
1364
  console.error("[payments-ui] Solana Pay QR error:", message);
1293
1365
  clearTimers();
@@ -1298,7 +1370,7 @@ var useSolanaQrPayment = (options) => {
1298
1370
  },
1299
1371
  [clearTimers, resetState]
1300
1372
  );
1301
- const handleSuccess = React15.useCallback(
1373
+ const handleSuccess = React4.useCallback(
1302
1374
  (status) => {
1303
1375
  clearTimers();
1304
1376
  resetState(null);
@@ -1312,7 +1384,7 @@ var useSolanaQrPayment = (options) => {
1312
1384
  },
1313
1385
  [clearTimers, resetState]
1314
1386
  );
1315
- const pollStatus = React15.useCallback(
1387
+ const pollStatus = React4.useCallback(
1316
1388
  async (reference) => {
1317
1389
  try {
1318
1390
  const status = await client.getSolanaPayStatus(reference);
@@ -1331,7 +1403,7 @@ var useSolanaQrPayment = (options) => {
1331
1403
  },
1332
1404
  [handleError, handleSuccess, client]
1333
1405
  );
1334
- const startCountdown = React15.useCallback(
1406
+ const startCountdown = React4.useCallback(
1335
1407
  (expiresAt, reference) => {
1336
1408
  const updateTime = () => {
1337
1409
  const remaining = Math.max(0, Math.floor(expiresAt - Date.now() / 1e3));
@@ -1346,7 +1418,7 @@ var useSolanaQrPayment = (options) => {
1346
1418
  },
1347
1419
  [handleError, pollStatus]
1348
1420
  );
1349
- const renderQr = React15.useCallback(async (qrIntent) => {
1421
+ const renderQr = React4.useCallback(async (qrIntent) => {
1350
1422
  try {
1351
1423
  const dataUri = await QRCode__default.default.toDataURL(qrIntent.url, {
1352
1424
  width: 320,
@@ -1362,7 +1434,7 @@ var useSolanaQrPayment = (options) => {
1362
1434
  handleError("Unable to render QR code");
1363
1435
  }
1364
1436
  }, [handleError]);
1365
- React15.useEffect(() => {
1437
+ React4.useEffect(() => {
1366
1438
  let cancelled = false;
1367
1439
  const generateIntent = async () => {
1368
1440
  clearTimers();
@@ -1426,7 +1498,7 @@ var useSolanaQrPayment = (options) => {
1426
1498
  tokenSymbol,
1427
1499
  refreshNonce
1428
1500
  ]);
1429
- const refresh = React15.useCallback(() => {
1501
+ const refresh = React4.useCallback(() => {
1430
1502
  setRefreshNonce((value) => value + 1);
1431
1503
  }, []);
1432
1504
  return {
@@ -1438,7 +1510,7 @@ var useSolanaQrPayment = (options) => {
1438
1510
  refresh
1439
1511
  };
1440
1512
  };
1441
- var Card = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1513
+ var Card = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1442
1514
  "div",
1443
1515
  {
1444
1516
  ref,
@@ -1450,7 +1522,7 @@ var Card = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @_
1450
1522
  }
1451
1523
  ));
1452
1524
  Card.displayName = "Card";
1453
- var CardHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1525
+ var CardHeader = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1454
1526
  "div",
1455
1527
  {
1456
1528
  ref,
@@ -1459,7 +1531,7 @@ var CardHeader = React15__namespace.forwardRef(({ className, ...props }, ref) =>
1459
1531
  }
1460
1532
  ));
1461
1533
  CardHeader.displayName = "CardHeader";
1462
- var CardTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1534
+ var CardTitle = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1463
1535
  "div",
1464
1536
  {
1465
1537
  ref,
@@ -1471,7 +1543,7 @@ var CardTitle = React15__namespace.forwardRef(({ className, ...props }, ref) =>
1471
1543
  }
1472
1544
  ));
1473
1545
  CardTitle.displayName = "CardTitle";
1474
- var CardDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1546
+ var CardDescription = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1475
1547
  "div",
1476
1548
  {
1477
1549
  ref,
@@ -1480,9 +1552,9 @@ var CardDescription = React15__namespace.forwardRef(({ className, ...props }, re
1480
1552
  }
1481
1553
  ));
1482
1554
  CardDescription.displayName = "CardDescription";
1483
- var CardContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1555
+ var CardContent = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1484
1556
  CardContent.displayName = "CardContent";
1485
- var CardFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1557
+ var CardFooter = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1486
1558
  "div",
1487
1559
  {
1488
1560
  ref,
@@ -1497,7 +1569,7 @@ var QRCodePayment = ({
1497
1569
  onPaymentError,
1498
1570
  onPaymentSuccess
1499
1571
  }) => {
1500
- const handleQrSuccess = React15__namespace.default.useCallback(
1572
+ const handleQrSuccess = React4__namespace.default.useCallback(
1501
1573
  (paymentId, txId) => {
1502
1574
  if (!paymentId && !txId) {
1503
1575
  onPaymentError("Missing payment confirmation details");
@@ -1606,16 +1678,16 @@ var PaymentStatus = ({
1606
1678
  };
1607
1679
  var useSupportedTokens = () => {
1608
1680
  const { client } = usePaymentContext();
1609
- const [tokens, setTokens] = React15.useState([]);
1610
- const [isLoading, setIsLoading] = React15.useState(false);
1611
- const [error, setError] = React15.useState(null);
1612
- const [lastFetched, setLastFetched] = React15.useState(null);
1681
+ const [tokens, setTokens] = React4.useState([]);
1682
+ const [isLoading, setIsLoading] = React4.useState(false);
1683
+ const [error, setError] = React4.useState(null);
1684
+ const [lastFetched, setLastFetched] = React4.useState(null);
1613
1685
  const CACHE_DURATION = 5 * 60 * 1e3;
1614
- const tokensRef = React15.useRef(tokens);
1615
- const lastFetchedRef = React15.useRef(lastFetched);
1686
+ const tokensRef = React4.useRef(tokens);
1687
+ const lastFetchedRef = React4.useRef(lastFetched);
1616
1688
  tokensRef.current = tokens;
1617
1689
  lastFetchedRef.current = lastFetched;
1618
- const fetchSupportedTokens = React15.useCallback(async () => {
1690
+ const fetchSupportedTokens = React4.useCallback(async () => {
1619
1691
  if (tokensRef.current.length > 0 && lastFetchedRef.current && Date.now() - lastFetchedRef.current < CACHE_DURATION) {
1620
1692
  return tokensRef.current;
1621
1693
  }
@@ -1642,50 +1714,50 @@ var useSupportedTokens = () => {
1642
1714
  setIsLoading(false);
1643
1715
  }
1644
1716
  }, [client]);
1645
- React15.useEffect(() => {
1717
+ React4.useEffect(() => {
1646
1718
  if (tokens.length === 0) {
1647
1719
  fetchSupportedTokens();
1648
1720
  }
1649
1721
  }, [tokens.length, fetchSupportedTokens]);
1650
- const getTokenBySymbol = React15.useCallback(
1722
+ const getTokenBySymbol = React4.useCallback(
1651
1723
  (symbol) => {
1652
1724
  return tokens.find((token) => token.symbol === symbol);
1653
1725
  },
1654
1726
  [tokens]
1655
1727
  );
1656
- const getTokenByMint = React15.useCallback(
1728
+ const getTokenByMint = React4.useCallback(
1657
1729
  (mintAddress) => {
1658
1730
  return tokens.find((token) => token.mint === mintAddress);
1659
1731
  },
1660
1732
  [tokens]
1661
1733
  );
1662
- const isTokenSupported = React15.useCallback(
1734
+ const isTokenSupported = React4.useCallback(
1663
1735
  (symbol) => {
1664
1736
  return tokens.some((token) => token.symbol === symbol);
1665
1737
  },
1666
1738
  [tokens]
1667
1739
  );
1668
- const getUSDCToken = React15.useCallback(() => {
1740
+ const getUSDCToken = React4.useCallback(() => {
1669
1741
  return getTokenBySymbol("USDC");
1670
1742
  }, [getTokenBySymbol]);
1671
- const getPYUSDToken = React15.useCallback(() => {
1743
+ const getPYUSDToken = React4.useCallback(() => {
1672
1744
  return getTokenBySymbol("PYUSD");
1673
1745
  }, [getTokenBySymbol]);
1674
- const getSOLToken = React15.useCallback(() => {
1746
+ const getSOLToken = React4.useCallback(() => {
1675
1747
  return getTokenBySymbol("SOL");
1676
1748
  }, [getTokenBySymbol]);
1677
- const getStablecoins = React15.useCallback(() => {
1749
+ const getStablecoins = React4.useCallback(() => {
1678
1750
  return tokens.filter((token) => ["USDC", "PYUSD"].includes(token.symbol));
1679
1751
  }, [tokens]);
1680
- const refreshTokens = React15.useCallback(async () => {
1752
+ const refreshTokens = React4.useCallback(async () => {
1681
1753
  setLastFetched(null);
1682
1754
  return await fetchSupportedTokens();
1683
1755
  }, [fetchSupportedTokens]);
1684
- const isCacheStale = React15.useCallback(() => {
1756
+ const isCacheStale = React4.useCallback(() => {
1685
1757
  if (!lastFetched) return true;
1686
1758
  return Date.now() - lastFetched > CACHE_DURATION;
1687
1759
  }, [lastFetched]);
1688
- const getTokenDisplayInfo = React15.useCallback((token) => {
1760
+ const getTokenDisplayInfo = React4.useCallback((token) => {
1689
1761
  return {
1690
1762
  ...token,
1691
1763
  displayName: `${token.name} (${token.symbol})`,
@@ -1693,7 +1765,7 @@ var useSupportedTokens = () => {
1693
1765
  decimalPlaces: token.decimals
1694
1766
  };
1695
1767
  }, []);
1696
- const getTokenPrice = React15.useCallback(
1768
+ const getTokenPrice = React4.useCallback(
1697
1769
  (symbol) => {
1698
1770
  const token = getTokenBySymbol(symbol);
1699
1771
  if (!token) return 0;
@@ -1702,7 +1774,7 @@ var useSupportedTokens = () => {
1702
1774
  },
1703
1775
  [getTokenBySymbol]
1704
1776
  );
1705
- const calculateTokenAmount = React15.useCallback(
1777
+ const calculateTokenAmount = React4.useCallback(
1706
1778
  (usdAmount, tokenSymbol) => {
1707
1779
  const token = getTokenBySymbol(tokenSymbol);
1708
1780
  const price = getTokenPrice(tokenSymbol);
@@ -1713,7 +1785,7 @@ var useSupportedTokens = () => {
1713
1785
  },
1714
1786
  [getTokenBySymbol, getTokenPrice]
1715
1787
  );
1716
- const formatTokenAmount = React15.useCallback(
1788
+ const formatTokenAmount = React4.useCallback(
1717
1789
  (amount, tokenSymbol) => {
1718
1790
  const token = getTokenBySymbol(tokenSymbol);
1719
1791
  if (!token) return "0";
@@ -1754,28 +1826,28 @@ var SolanaPaymentView = ({
1754
1826
  onClose
1755
1827
  }) => {
1756
1828
  const { notifyStatus, notifyError, notifySuccess } = usePaymentNotifications();
1757
- const [paymentState, setPaymentState] = React15.useState("selecting");
1758
- const [errorMessage, setErrorMessage] = React15.useState(null);
1759
- const [transactionId, setTransactionId] = React15.useState(null);
1760
- const [tokenAmount, setTokenAmount] = React15.useState(0);
1761
- const [selectedTokenSymbol, setSelectedTokenSymbol] = React15.useState(null);
1829
+ const [paymentState, setPaymentState] = React4.useState("selecting");
1830
+ const [errorMessage, setErrorMessage] = React4.useState(null);
1831
+ const [transactionId, setTransactionId] = React4.useState(null);
1832
+ const [tokenAmount, setTokenAmount] = React4.useState(0);
1833
+ const [selectedTokenSymbol, setSelectedTokenSymbol] = React4.useState(null);
1762
1834
  const {
1763
1835
  tokens,
1764
1836
  isLoading: tokensLoading,
1765
1837
  error: tokensError
1766
1838
  } = useSupportedTokens();
1767
- const selectedToken = React15.useMemo(() => {
1839
+ const selectedToken = React4.useMemo(() => {
1768
1840
  if (!tokens.length) return null;
1769
1841
  const explicit = tokens.find((token) => token.symbol === selectedTokenSymbol);
1770
1842
  return explicit || tokens[0];
1771
1843
  }, [tokens, selectedTokenSymbol]);
1772
- React15.useEffect(() => {
1844
+ React4.useEffect(() => {
1773
1845
  if (!selectedTokenSymbol && tokens.length) {
1774
1846
  const defaultToken = tokens.find((token) => token.symbol === "SOL") || tokens[0];
1775
1847
  setSelectedTokenSymbol(defaultToken.symbol);
1776
1848
  }
1777
1849
  }, [tokens, selectedTokenSymbol]);
1778
- const handlePaymentSuccess = React15.useCallback(
1850
+ const handlePaymentSuccess = React4.useCallback(
1779
1851
  (result, txId) => {
1780
1852
  const resolvedTx = txId || (typeof result === "string" ? result : result.transaction_id);
1781
1853
  setTransactionId(resolvedTx);
@@ -1803,7 +1875,7 @@ var SolanaPaymentView = ({
1803
1875
  },
1804
1876
  [notifyStatus, notifySuccess, onSuccess]
1805
1877
  );
1806
- const handlePaymentError = React15.useCallback(
1878
+ const handlePaymentError = React4.useCallback(
1807
1879
  (error) => {
1808
1880
  setPaymentState("error");
1809
1881
  setErrorMessage(error);
@@ -1813,22 +1885,22 @@ var SolanaPaymentView = ({
1813
1885
  },
1814
1886
  [notifyError, notifyStatus, onError]
1815
1887
  );
1816
- const resetState = React15.useCallback(() => {
1888
+ const resetState = React4.useCallback(() => {
1817
1889
  setPaymentState("selecting");
1818
1890
  setErrorMessage(null);
1819
1891
  setTransactionId(null);
1820
1892
  }, []);
1821
- const handleRetry = React15.useCallback(() => {
1893
+ const handleRetry = React4.useCallback(() => {
1822
1894
  resetState();
1823
1895
  }, [resetState]);
1824
- const handleClose = React15.useCallback(() => {
1896
+ const handleClose = React4.useCallback(() => {
1825
1897
  if (paymentState === "processing" || paymentState === "confirming") {
1826
1898
  return;
1827
1899
  }
1828
1900
  resetState();
1829
1901
  onClose?.();
1830
1902
  }, [paymentState, onClose, resetState]);
1831
- React15.useEffect(() => {
1903
+ React4.useEffect(() => {
1832
1904
  if (!selectedToken || usdAmount === 0) {
1833
1905
  setTokenAmount(0);
1834
1906
  return;
@@ -1840,7 +1912,7 @@ var SolanaPaymentView = ({
1840
1912
  }
1841
1913
  setTokenAmount(usdAmount / price);
1842
1914
  }, [usdAmount, selectedToken]);
1843
- const handleTokenChange = React15.useCallback((value) => {
1915
+ const handleTokenChange = React4.useCallback((value) => {
1844
1916
  setSelectedTokenSymbol(value);
1845
1917
  }, []);
1846
1918
  const renderBody = () => {
@@ -1946,20 +2018,20 @@ var PaymentExperience = ({
1946
2018
  const showNewCard = enableNewCard && Boolean(onNewCardPayment);
1947
2019
  const showStored = enableStoredMethods && Boolean(onSavedMethodPayment);
1948
2020
  const defaultTab = showStored ? "saved" : "new";
1949
- const [activeTab, setActiveTab] = React15.useState(defaultTab);
1950
- const [mode, setMode] = React15.useState(
2021
+ const [activeTab, setActiveTab] = React4.useState(defaultTab);
2022
+ const [mode, setMode] = React4.useState(
1951
2023
  () => initialMode === "solana" && enableSolanaPay ? "solana" : "cards"
1952
2024
  );
1953
- const [selectedMethodId, setSelectedMethodId] = React15.useState(null);
1954
- const [savedStatus, setSavedStatus] = React15.useState("idle");
1955
- const [savedError, setSavedError] = React15.useState(null);
1956
- const [newCardStatus, setNewCardStatus] = React15.useState("idle");
1957
- const [newCardError, setNewCardError] = React15.useState(null);
2025
+ const [selectedMethodId, setSelectedMethodId] = React4.useState(null);
2026
+ const [savedStatus, setSavedStatus] = React4.useState("idle");
2027
+ const [savedError, setSavedError] = React4.useState(null);
2028
+ const [newCardStatus, setNewCardStatus] = React4.useState("idle");
2029
+ const [newCardError, setNewCardError] = React4.useState(null);
1958
2030
  const { notifyStatus, notifyError } = usePaymentNotifications();
1959
- React15.useEffect(() => {
2031
+ React4.useEffect(() => {
1960
2032
  setActiveTab(showStored ? "saved" : "new");
1961
2033
  }, [showStored]);
1962
- React15.useEffect(() => {
2034
+ React4.useEffect(() => {
1963
2035
  if (!enableSolanaPay) {
1964
2036
  setMode("cards");
1965
2037
  return;
@@ -1970,12 +2042,12 @@ var PaymentExperience = ({
1970
2042
  setMode("cards");
1971
2043
  }
1972
2044
  }, [enableSolanaPay, initialMode]);
1973
- const handleMethodSelect = React15.useCallback((method) => {
2045
+ const handleMethodSelect = React4.useCallback((method) => {
1974
2046
  setSelectedMethodId(method.id);
1975
2047
  setSavedStatus("idle");
1976
2048
  setSavedError(null);
1977
2049
  }, []);
1978
- const handleSavedPayment = React15.useCallback(async () => {
2050
+ const handleSavedPayment = React4.useCallback(async () => {
1979
2051
  if (!onSavedMethodPayment || !selectedMethodId) return;
1980
2052
  try {
1981
2053
  setSavedStatus("processing");
@@ -1995,7 +2067,7 @@ var PaymentExperience = ({
1995
2067
  notifyError(message);
1996
2068
  }
1997
2069
  }, [notifyError, notifyStatus, onSavedMethodPayment, selectedMethodId, usdAmount]);
1998
- const handleNewCardTokenize = React15.useCallback(
2070
+ const handleNewCardTokenize = React4.useCallback(
1999
2071
  async (token, billing) => {
2000
2072
  if (!onNewCardPayment) return;
2001
2073
  try {
@@ -2015,21 +2087,21 @@ var PaymentExperience = ({
2015
2087
  },
2016
2088
  [notifyError, notifyStatus, onNewCardPayment]
2017
2089
  );
2018
- React15.useCallback(() => {
2090
+ React4.useCallback(() => {
2019
2091
  if (!enableSolanaPay) return;
2020
2092
  setMode("solana");
2021
2093
  }, [enableSolanaPay]);
2022
- const exitSolanaView = React15.useCallback(() => {
2094
+ const exitSolanaView = React4.useCallback(() => {
2023
2095
  setMode("cards");
2024
2096
  }, []);
2025
- const handleSolanaSuccess = React15.useCallback(
2097
+ const handleSolanaSuccess = React4.useCallback(
2026
2098
  (result) => {
2027
2099
  onSolanaSuccess?.(result);
2028
2100
  exitSolanaView();
2029
2101
  },
2030
2102
  [exitSolanaView, onSolanaSuccess]
2031
2103
  );
2032
- const handleSolanaError = React15.useCallback(
2104
+ const handleSolanaError = React4.useCallback(
2033
2105
  (error) => {
2034
2106
  onSolanaError?.(error);
2035
2107
  },
@@ -2076,8 +2148,8 @@ var PaymentExperience = ({
2076
2148
  };
2077
2149
  const renderCardExperience = () => /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, children: [
2078
2150
  /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "w-full rounded-md mb-4", children: [
2079
- /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: clsx2.clsx("cursor-pointer", { "bg-background": activeTab == "saved" }), value: "saved", children: "Use saved card" }),
2080
- /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: clsx2.clsx("cursor-pointer", { "bg-background": activeTab == "new" }), value: "new", children: "Add new card" })
2151
+ /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: "cursor-pointer", value: "saved", children: "Use saved card" }),
2152
+ /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: "cursor-pointer", value: "new", children: "Add new card" })
2081
2153
  ] }),
2082
2154
  /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
2083
2155
  /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "new", children: renderNewTab() })
@@ -2132,7 +2204,7 @@ var useSubscriptionActions = () => {
2132
2204
  }
2133
2205
  return priceId;
2134
2206
  };
2135
- const subscribeWithCard = React15.useCallback(
2207
+ const subscribeWithCard = React4.useCallback(
2136
2208
  async ({
2137
2209
  priceId,
2138
2210
  processor = "nmi",
@@ -2159,7 +2231,7 @@ var useSubscriptionActions = () => {
2159
2231
  },
2160
2232
  [client]
2161
2233
  );
2162
- const subscribeWithSavedMethod = React15.useCallback(
2234
+ const subscribeWithSavedMethod = React4.useCallback(
2163
2235
  async ({
2164
2236
  priceId,
2165
2237
  processor = "nmi",
@@ -2179,7 +2251,7 @@ var useSubscriptionActions = () => {
2179
2251
  },
2180
2252
  [client]
2181
2253
  );
2182
- const subscribeWithCCBill = React15.useCallback(
2254
+ const subscribeWithCCBill = React4.useCallback(
2183
2255
  async ({
2184
2256
  priceId,
2185
2257
  email,
@@ -2225,15 +2297,15 @@ var SubscriptionCheckoutModal = ({
2225
2297
  onSolanaError,
2226
2298
  initialMode = "cards"
2227
2299
  }) => {
2228
- const [showSuccess, setShowSuccess] = React15.useState(false);
2229
- const [idempotencyKey, setIdempotencyKey] = React15.useState(() => crypto.randomUUID());
2300
+ const [showSuccess, setShowSuccess] = React4.useState(false);
2301
+ const [idempotencyKey, setIdempotencyKey] = React4.useState(() => crypto.randomUUID());
2230
2302
  const { subscribeWithCard, subscribeWithSavedMethod } = useSubscriptionActions();
2231
- React15.useEffect(() => {
2303
+ React4.useEffect(() => {
2232
2304
  if (open) {
2233
2305
  setIdempotencyKey(crypto.randomUUID());
2234
2306
  }
2235
2307
  }, [open, priceId]);
2236
- const handleClose = React15.useCallback(
2308
+ const handleClose = React4.useCallback(
2237
2309
  (nextOpen) => {
2238
2310
  onOpenChange(nextOpen);
2239
2311
  if (!nextOpen) setShowSuccess(false);
@@ -2343,7 +2415,7 @@ var wallets = [
2343
2415
  }
2344
2416
  ];
2345
2417
  var WalletModal = ({ open, onOpenChange }) => {
2346
- const [expandedWallet, setExpandedWallet] = React15.useState(null);
2418
+ const [expandedWallet, setExpandedWallet] = React4.useState(null);
2347
2419
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "z-[100] w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-md border border-white/20 p-0 backdrop-blur-xl bg-background-regular shadow-2xl [&::-webkit-scrollbar]:hidden", children: [
2348
2420
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "border-b border-white/10 bg-gradient-to-r from-primary/10 via-transparent to-transparent px-6 py-5 text-left", children: [
2349
2421
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: [
@@ -2399,17 +2471,17 @@ var createDialogState = () => ({
2399
2471
  isOpen: false,
2400
2472
  props: null
2401
2473
  });
2402
- var PaymentsDialogContext = React15.createContext(void 0);
2474
+ var PaymentsDialogContext = React4.createContext(void 0);
2403
2475
  var PaymentsDialogProvider = ({
2404
2476
  children
2405
2477
  }) => {
2406
- const [checkoutState, setCheckoutState] = React15.useState(
2478
+ const [checkoutState, setCheckoutState] = React4.useState(
2407
2479
  () => createDialogState()
2408
2480
  );
2409
- const [walletState, setWalletState] = React15.useState(
2481
+ const [walletState, setWalletState] = React4.useState(
2410
2482
  () => createDialogState()
2411
2483
  );
2412
- const contextValue = React15.useMemo(() => {
2484
+ const contextValue = React4.useMemo(() => {
2413
2485
  const openCheckout = (options) => setCheckoutState({
2414
2486
  isOpen: true,
2415
2487
  props: options
@@ -2463,18 +2535,18 @@ var PaymentsDialogProvider = ({
2463
2535
  ] });
2464
2536
  };
2465
2537
  var usePaymentDialogs = () => {
2466
- const context = React15.useContext(PaymentsDialogContext);
2538
+ const context = React4.useContext(PaymentsDialogContext);
2467
2539
  if (!context) {
2468
2540
  throw new Error("usePaymentDialogs must be used within PaymentProvider");
2469
2541
  }
2470
2542
  return context;
2471
2543
  };
2472
- var PaymentContext = React15.createContext(void 0);
2544
+ var PaymentContext = React4.createContext(void 0);
2473
2545
  var PaymentProvider = ({
2474
2546
  config,
2475
2547
  children
2476
2548
  }) => {
2477
- const queryClient = React15.useMemo(() => {
2549
+ const queryClient = React4.useMemo(() => {
2478
2550
  return new reactQuery.QueryClient({
2479
2551
  defaultOptions: {
2480
2552
  queries: {
@@ -2489,7 +2561,7 @@ var PaymentProvider = ({
2489
2561
  }
2490
2562
  });
2491
2563
  }, []);
2492
- const client = React15.useMemo(() => {
2564
+ const client = React4.useMemo(() => {
2493
2565
  const authProvider = config.getAuthToken ? async () => {
2494
2566
  try {
2495
2567
  const result = config.getAuthToken?.();
@@ -2513,12 +2585,12 @@ var PaymentProvider = ({
2513
2585
  defaultHeaders: config.defaultHeaders
2514
2586
  });
2515
2587
  }, [config]);
2516
- const solanaEndpoint = React15.useMemo(() => {
2588
+ const solanaEndpoint = React4.useMemo(() => {
2517
2589
  if (config.solana?.endpoint) return config.solana.endpoint;
2518
2590
  const network = config.solana?.network ?? walletAdapterBase.WalletAdapterNetwork.Mainnet;
2519
2591
  return web3_js.clusterApiUrl(network);
2520
2592
  }, [config.solana?.endpoint, config.solana?.network]);
2521
- const walletAdapters = React15.useMemo(() => {
2593
+ const walletAdapters = React4.useMemo(() => {
2522
2594
  if (config.solana?.wallets?.length) {
2523
2595
  return config.solana.wallets;
2524
2596
  }
@@ -2530,21 +2602,21 @@ var PaymentProvider = ({
2530
2602
  ];
2531
2603
  }, [config.solana?.wallets]);
2532
2604
  const autoConnect = config.solana?.autoConnect ?? true;
2533
- const value = React15.useMemo(() => {
2605
+ const value = React4.useMemo(() => {
2534
2606
  return {
2535
2607
  config,
2536
2608
  client,
2537
2609
  queryClient
2538
2610
  };
2539
2611
  }, [client, config, queryClient]);
2540
- React15.useEffect(() => {
2612
+ React4.useEffect(() => {
2541
2613
  if (!config.collectJsKey) return;
2542
2614
  loadCollectJs(config.collectJsKey);
2543
2615
  }, [config.collectJsKey]);
2544
2616
  return /* @__PURE__ */ jsxRuntime.jsx(PaymentContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReact.ConnectionProvider, { endpoint: solanaEndpoint, config: { commitment: "confirmed" }, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReact.WalletProvider, { wallets: walletAdapters, autoConnect, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReactUi.WalletModalProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(PaymentsDialogProvider, { children }) }) }) }) }) });
2545
2617
  };
2546
2618
  var usePaymentContext = () => {
2547
- const context = React15.useContext(PaymentContext);
2619
+ const context = React4.useContext(PaymentContext);
2548
2620
  if (!context) {
2549
2621
  throw new Error("usePaymentContext must be used within a PaymentProvider");
2550
2622
  }
@@ -2557,7 +2629,7 @@ var SolanaPaymentSelector = ({
2557
2629
  }) => {
2558
2630
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-md border bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(SolanaPaymentView, { ...props, onClose }) }) });
2559
2631
  };
2560
- var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
2632
+ var Table = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
2561
2633
  "table",
2562
2634
  {
2563
2635
  ref,
@@ -2566,9 +2638,9 @@ var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @
2566
2638
  }
2567
2639
  ) }));
2568
2640
  Table.displayName = "Table";
2569
- var TableHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2641
+ var TableHeader = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2570
2642
  TableHeader.displayName = "TableHeader";
2571
- var TableBody = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2643
+ var TableBody = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2572
2644
  "tbody",
2573
2645
  {
2574
2646
  ref,
@@ -2577,7 +2649,7 @@ var TableBody = React15__namespace.forwardRef(({ className, ...props }, ref) =>
2577
2649
  }
2578
2650
  ));
2579
2651
  TableBody.displayName = "TableBody";
2580
- var TableFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2652
+ var TableFooter = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2581
2653
  "tfoot",
2582
2654
  {
2583
2655
  ref,
@@ -2589,7 +2661,7 @@ var TableFooter = React15__namespace.forwardRef(({ className, ...props }, ref) =
2589
2661
  }
2590
2662
  ));
2591
2663
  TableFooter.displayName = "TableFooter";
2592
- var TableRow = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2664
+ var TableRow = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2593
2665
  "tr",
2594
2666
  {
2595
2667
  ref,
@@ -2601,7 +2673,7 @@ var TableRow = React15__namespace.forwardRef(({ className, ...props }, ref) => /
2601
2673
  }
2602
2674
  ));
2603
2675
  TableRow.displayName = "TableRow";
2604
- var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2676
+ var TableHead = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2605
2677
  "th",
2606
2678
  {
2607
2679
  ref,
@@ -2613,7 +2685,7 @@ var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) =>
2613
2685
  }
2614
2686
  ));
2615
2687
  TableHead.displayName = "TableHead";
2616
- var TableCell = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2688
+ var TableCell = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2617
2689
  "td",
2618
2690
  {
2619
2691
  ref,
@@ -2622,7 +2694,7 @@ var TableCell = React15__namespace.forwardRef(({ className, ...props }, ref) =>
2622
2694
  }
2623
2695
  ));
2624
2696
  TableCell.displayName = "TableCell";
2625
- var TableCaption = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2697
+ var TableCaption = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2626
2698
  "caption",
2627
2699
  {
2628
2700
  ref,
@@ -2634,7 +2706,7 @@ TableCaption.displayName = "TableCaption";
2634
2706
  var AlertDialog = AlertDialogPrimitive__namespace.Root;
2635
2707
  var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
2636
2708
  var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
2637
- var AlertDialogOverlay = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2709
+ var AlertDialogOverlay = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2638
2710
  AlertDialogPrimitive__namespace.Overlay,
2639
2711
  {
2640
2712
  className: cn(
@@ -2646,7 +2718,7 @@ var AlertDialogOverlay = React15__namespace.forwardRef(({ className, ...props },
2646
2718
  }
2647
2719
  ));
2648
2720
  AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
2649
- var AlertDialogContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
2721
+ var AlertDialogContent = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
2650
2722
  /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
2651
2723
  /* @__PURE__ */ jsxRuntime.jsx(
2652
2724
  AlertDialogPrimitive__namespace.Content,
@@ -2689,7 +2761,7 @@ var AlertDialogFooter = ({
2689
2761
  }
2690
2762
  );
2691
2763
  AlertDialogFooter.displayName = "AlertDialogFooter";
2692
- var AlertDialogTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2764
+ var AlertDialogTitle = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2693
2765
  AlertDialogPrimitive__namespace.Title,
2694
2766
  {
2695
2767
  ref,
@@ -2698,7 +2770,7 @@ var AlertDialogTitle = React15__namespace.forwardRef(({ className, ...props }, r
2698
2770
  }
2699
2771
  ));
2700
2772
  AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
2701
- var AlertDialogDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2773
+ var AlertDialogDescription = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2702
2774
  AlertDialogPrimitive__namespace.Description,
2703
2775
  {
2704
2776
  ref,
@@ -2707,7 +2779,7 @@ var AlertDialogDescription = React15__namespace.forwardRef(({ className, ...prop
2707
2779
  }
2708
2780
  ));
2709
2781
  AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
2710
- var AlertDialogAction = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2782
+ var AlertDialogAction = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2711
2783
  AlertDialogPrimitive__namespace.Action,
2712
2784
  {
2713
2785
  ref,
@@ -2716,7 +2788,7 @@ var AlertDialogAction = React15__namespace.forwardRef(({ className, ...props },
2716
2788
  }
2717
2789
  ));
2718
2790
  AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
2719
- var AlertDialogCancel = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2791
+ var AlertDialogCancel = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2720
2792
  AlertDialogPrimitive__namespace.Cancel,
2721
2793
  {
2722
2794
  ref,
@@ -2729,7 +2801,7 @@ var AlertDialogCancel = React15__namespace.forwardRef(({ className, ...props },
2729
2801
  }
2730
2802
  ));
2731
2803
  AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
2732
- var Textarea = React15__namespace.forwardRef(({ className, ...props }, ref) => {
2804
+ var Textarea = React4__namespace.forwardRef(({ className, ...props }, ref) => {
2733
2805
  return /* @__PURE__ */ jsxRuntime.jsx(
2734
2806
  "textarea",
2735
2807
  {
@@ -2774,12 +2846,12 @@ var CancelMembershipDialog = ({
2774
2846
  const { client } = usePaymentContext();
2775
2847
  const notify = onNotify ?? notifyDefault;
2776
2848
  const t = { ...defaultTranslations, ...customTranslations };
2777
- const [cancelReason, setCancelReason] = React15.useState("");
2778
- const [isOpen, setIsOpen] = React15.useState(false);
2779
- const [isReasonValid, setIsReasonValid] = React15.useState(false);
2780
- const [hasInteracted, setHasInteracted] = React15.useState(false);
2781
- const [isSubmitting, setIsSubmitting] = React15.useState(false);
2782
- React15.useEffect(() => {
2849
+ const [cancelReason, setCancelReason] = React4.useState("");
2850
+ const [isOpen, setIsOpen] = React4.useState(false);
2851
+ const [isReasonValid, setIsReasonValid] = React4.useState(false);
2852
+ const [hasInteracted, setHasInteracted] = React4.useState(false);
2853
+ const [isSubmitting, setIsSubmitting] = React4.useState(false);
2854
+ React4.useEffect(() => {
2783
2855
  const trimmed = cancelReason.trim();
2784
2856
  setIsReasonValid(trimmed.length >= minReasonLength);
2785
2857
  }, [cancelReason, minReasonLength]);
@@ -2912,9 +2984,9 @@ var BillingHistory = ({
2912
2984
  const { client } = usePaymentContext();
2913
2985
  const notify = onNotify ?? notifyDefault2;
2914
2986
  const t = { ...defaultTranslations2, ...customTranslations };
2915
- const [isExpanded, setIsExpanded] = React15.useState(false);
2916
- const observerRef = React15.useRef(null);
2917
- const loadMoreRef = React15.useRef(null);
2987
+ const [isExpanded, setIsExpanded] = React4.useState(false);
2988
+ const observerRef = React4.useRef(null);
2989
+ const loadMoreRef = React4.useRef(null);
2918
2990
  const historyQuery = reactQuery.useInfiniteQuery({
2919
2991
  queryKey: ["payments-ui", "billing-history", pageSize],
2920
2992
  queryFn: async ({ pageParam = initialPage }) => {
@@ -2941,7 +3013,7 @@ var BillingHistory = ({
2941
3013
  },
2942
3014
  staleTime: 5 * 60 * 1e3
2943
3015
  });
2944
- React15.useEffect(() => {
3016
+ React4.useEffect(() => {
2945
3017
  if (!loadMoreRef.current || !isExpanded) return;
2946
3018
  observerRef.current = new IntersectionObserver((entries) => {
2947
3019
  const [entry] = entries;
@@ -2956,7 +3028,7 @@ var BillingHistory = ({
2956
3028
  observerRef.current?.disconnect();
2957
3029
  };
2958
3030
  }, [historyQuery, isExpanded, notify]);
2959
- const payments = React15.useMemo(() => {
3031
+ const payments = React4.useMemo(() => {
2960
3032
  const data = historyQuery.data;
2961
3033
  return data?.pages ?? [];
2962
3034
  }, [historyQuery.data]);
@@ -3069,8 +3141,8 @@ var PaymentMethodsSection = ({
3069
3141
  remove: (id) => client.deletePaymentMethod(id),
3070
3142
  activate: (id) => client.activatePaymentMethod(id)
3071
3143
  };
3072
- const [isModalOpen, setIsModalOpen] = React15.useState(false);
3073
- const [deletingId, setDeletingId] = React15.useState(null);
3144
+ const [isModalOpen, setIsModalOpen] = React4.useState(false);
3145
+ const [deletingId, setDeletingId] = React4.useState(null);
3074
3146
  const notify = onNotify ?? notifyDefault3;
3075
3147
  const t = { ...defaultTranslations3, ...customTranslations };
3076
3148
  const queryKey = ["payments-ui", "payment-methods"];
@@ -3125,12 +3197,12 @@ var PaymentMethodsSection = ({
3125
3197
  });
3126
3198
  }
3127
3199
  });
3128
- React15.useEffect(() => {
3200
+ React4.useEffect(() => {
3129
3201
  if (!isModalOpen) {
3130
3202
  createMutation.reset();
3131
3203
  }
3132
3204
  }, [createMutation, isModalOpen]);
3133
- const payments = React15.useMemo(() => paymentQuery.data?.data ?? [], [paymentQuery.data]);
3205
+ const payments = React4.useMemo(() => paymentQuery.data?.data ?? [], [paymentQuery.data]);
3134
3206
  const loading = paymentQuery.isLoading || paymentQuery.isFetching;
3135
3207
  const buildPayload = (token, billing) => ({
3136
3208
  payment_token: token,
@@ -3237,7 +3309,7 @@ var PaymentMethodsSection = ({
3237
3309
  ) })
3238
3310
  ] });
3239
3311
  };
3240
- var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3312
+ var Checkbox = React4__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3241
3313
  CheckboxPrimitive__namespace.Root,
3242
3314
  {
3243
3315
  ref,
@@ -3264,9 +3336,9 @@ var initialState = {
3264
3336
  termsAccepted: false
3265
3337
  };
3266
3338
  var WalletDialog = ({ open, onOpenChange }) => {
3267
- const [form, setForm] = React15.useState(initialState);
3268
- const [errors, setErrors] = React15.useState({});
3269
- const validators = React15.useMemo(
3339
+ const [form, setForm] = React4.useState(initialState);
3340
+ const [errors, setErrors] = React4.useState({});
3341
+ const validators = React4.useMemo(
3270
3342
  () => ({
3271
3343
  nameOnCard: (value) => !value ? "Name is required" : void 0,
3272
3344
  cardNumber: (value) => /^\d{16}$/.test(value) ? void 0 : "Card number must be 16 digits",
@@ -3359,10 +3431,10 @@ var WalletDialog = ({ open, onOpenChange }) => {
3359
3431
  var useTokenBalance = (tokens) => {
3360
3432
  const { publicKey } = walletAdapterReact.useWallet();
3361
3433
  const { connection } = walletAdapterReact.useConnection();
3362
- const [balances, setBalances] = React15.useState([]);
3363
- const [isLoading, setIsLoading] = React15.useState(false);
3364
- const [error, setError] = React15.useState(null);
3365
- const fetchTokenBalance = React15.useCallback(
3434
+ const [balances, setBalances] = React4.useState([]);
3435
+ const [isLoading, setIsLoading] = React4.useState(false);
3436
+ const [error, setError] = React4.useState(null);
3437
+ const fetchTokenBalance = React4.useCallback(
3366
3438
  async (token, walletAddress) => {
3367
3439
  try {
3368
3440
  const mintPublicKey = new web3_js.PublicKey(token.mint);
@@ -3403,8 +3475,8 @@ var useTokenBalance = (tokens) => {
3403
3475
  },
3404
3476
  [connection]
3405
3477
  );
3406
- const tokensKey = React15.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
3407
- React15.useEffect(() => {
3478
+ const tokensKey = React4.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
3479
+ React4.useEffect(() => {
3408
3480
  if (!publicKey || tokens.length === 0) {
3409
3481
  setBalances([]);
3410
3482
  return;
@@ -3428,20 +3500,20 @@ var useTokenBalance = (tokens) => {
3428
3500
  };
3429
3501
  fetchAllBalances();
3430
3502
  }, [publicKey, tokensKey, fetchTokenBalance]);
3431
- const getTokenBalance = React15.useCallback(
3503
+ const getTokenBalance = React4.useCallback(
3432
3504
  (tokenSymbol) => {
3433
3505
  return balances.find((balance) => balance.token.symbol === tokenSymbol);
3434
3506
  },
3435
3507
  [balances]
3436
3508
  );
3437
- const hasSufficientBalance = React15.useCallback(
3509
+ const hasSufficientBalance = React4.useCallback(
3438
3510
  (tokenSymbol, requiredAmount) => {
3439
3511
  const balance = getTokenBalance(tokenSymbol);
3440
3512
  return balance ? balance.uiAmount >= requiredAmount : false;
3441
3513
  },
3442
3514
  [getTokenBalance]
3443
3515
  );
3444
- const getFormattedBalance = React15.useCallback(
3516
+ const getFormattedBalance = React4.useCallback(
3445
3517
  (tokenSymbol) => {
3446
3518
  const balance = getTokenBalance(tokenSymbol);
3447
3519
  if (!balance) return "0.00";
@@ -3455,7 +3527,7 @@ var useTokenBalance = (tokens) => {
3455
3527
  },
3456
3528
  [getTokenBalance]
3457
3529
  );
3458
- const refreshBalances = React15.useCallback(async () => {
3530
+ const refreshBalances = React4.useCallback(async () => {
3459
3531
  if (!publicKey || tokens.length === 0) {
3460
3532
  setBalances([]);
3461
3533
  return;
@@ -3476,7 +3548,7 @@ var useTokenBalance = (tokens) => {
3476
3548
  setIsLoading(false);
3477
3549
  }
3478
3550
  }, [publicKey, tokens, fetchTokenBalance]);
3479
- const getTotalValue = React15.useCallback(
3551
+ const getTotalValue = React4.useCallback(
3480
3552
  (priceData) => {
3481
3553
  if (!priceData) return 0;
3482
3554
  return balances.reduce((total, balance) => {
@@ -3515,21 +3587,21 @@ var usePaymentStatus = (options = {}) => {
3515
3587
  retryInterval = 1e4
3516
3588
  // 10 seconds
3517
3589
  } = options;
3518
- const [status, setStatus] = React15.useState(null);
3519
- const [paymentStatus, setPaymentStatus] = React15.useState(null);
3520
- const [isLoading, setIsLoading] = React15.useState(false);
3521
- const [error, setError] = React15.useState(null);
3522
- const [retryCount, setRetryCount] = React15.useState(0);
3523
- const intervalRef = React15.useRef(null);
3524
- const isMonitoringRef = React15.useRef(false);
3525
- React15.useEffect(() => {
3590
+ const [status, setStatus] = React4.useState(null);
3591
+ const [paymentStatus, setPaymentStatus] = React4.useState(null);
3592
+ const [isLoading, setIsLoading] = React4.useState(false);
3593
+ const [error, setError] = React4.useState(null);
3594
+ const [retryCount, setRetryCount] = React4.useState(0);
3595
+ const intervalRef = React4.useRef(null);
3596
+ const isMonitoringRef = React4.useRef(false);
3597
+ React4.useEffect(() => {
3526
3598
  return () => {
3527
3599
  if (intervalRef.current) {
3528
3600
  clearInterval(intervalRef.current);
3529
3601
  }
3530
3602
  };
3531
3603
  }, []);
3532
- const checkTransactionStatus = React15.useCallback(
3604
+ const checkTransactionStatus = React4.useCallback(
3533
3605
  async (signature) => {
3534
3606
  try {
3535
3607
  const statusResponse = await connection.getSignatureStatus(signature, {
@@ -3574,7 +3646,7 @@ var usePaymentStatus = (options = {}) => {
3574
3646
  },
3575
3647
  [connection]
3576
3648
  );
3577
- const checkPaymentStatus = React15.useCallback(
3649
+ const checkPaymentStatus = React4.useCallback(
3578
3650
  async (id) => {
3579
3651
  try {
3580
3652
  return await client.getPaymentStatus(id);
@@ -3588,7 +3660,7 @@ var usePaymentStatus = (options = {}) => {
3588
3660
  },
3589
3661
  [client]
3590
3662
  );
3591
- const startMonitoring = React15.useCallback(async () => {
3663
+ const startMonitoring = React4.useCallback(async () => {
3592
3664
  if (isMonitoringRef.current || !transactionId && !purchaseId) {
3593
3665
  return;
3594
3666
  }
@@ -3676,14 +3748,14 @@ var usePaymentStatus = (options = {}) => {
3676
3748
  retryInterval,
3677
3749
  retryCount
3678
3750
  ]);
3679
- const stopMonitoring = React15.useCallback(() => {
3751
+ const stopMonitoring = React4.useCallback(() => {
3680
3752
  if (intervalRef.current) {
3681
3753
  clearInterval(intervalRef.current);
3682
3754
  }
3683
3755
  isMonitoringRef.current = false;
3684
3756
  setIsLoading(false);
3685
3757
  }, []);
3686
- const checkStatus = React15.useCallback(async () => {
3758
+ const checkStatus = React4.useCallback(async () => {
3687
3759
  if (!transactionId && !purchaseId) return;
3688
3760
  setIsLoading(true);
3689
3761
  setError(null);
@@ -3708,7 +3780,7 @@ var usePaymentStatus = (options = {}) => {
3708
3780
  setIsLoading(false);
3709
3781
  }
3710
3782
  }, [transactionId, purchaseId, checkTransactionStatus, checkPaymentStatus]);
3711
- React15.useEffect(() => {
3783
+ React4.useEffect(() => {
3712
3784
  if ((transactionId || purchaseId) && !isMonitoringRef.current) {
3713
3785
  startMonitoring();
3714
3786
  }
@@ -3716,7 +3788,7 @@ var usePaymentStatus = (options = {}) => {
3716
3788
  stopMonitoring();
3717
3789
  };
3718
3790
  }, [transactionId, purchaseId, startMonitoring, stopMonitoring]);
3719
- const getConfirmationStatus = React15.useCallback(() => {
3791
+ const getConfirmationStatus = React4.useCallback(() => {
3720
3792
  if (paymentStatus?.status === "confirmed") return "confirmed";
3721
3793
  if (paymentStatus?.status === "failed") return "failed";
3722
3794
  if (status?.confirmationStatus === "finalized") return "confirmed";
@@ -3725,7 +3797,7 @@ var usePaymentStatus = (options = {}) => {
3725
3797
  return "failed";
3726
3798
  return "pending";
3727
3799
  }, [status, paymentStatus]);
3728
- const getSolscanUrl = React15.useCallback(
3800
+ const getSolscanUrl = React4.useCallback(
3729
3801
  (signature) => {
3730
3802
  const txId = signature || transactionId;
3731
3803
  if (!txId) return null;