@doujins/payments-ui 0.0.1 → 0.0.3

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,19 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var react = require('react');
3
+ var React3 = require('react');
4
4
  var vanilla = require('zustand/vanilla');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var lucideReact = require('lucide-react');
7
7
  var countryList = require('country-list');
8
+ var classVarianceAuthority = require('class-variance-authority');
8
9
  var clsx = require('clsx');
9
- var Dialog2 = require('@radix-ui/react-dialog');
10
+ var tailwindMerge = require('tailwind-merge');
11
+ var LabelPrimitive = require('@radix-ui/react-label');
12
+ var SelectPrimitive = require('@radix-ui/react-select');
10
13
  var reactQuery = require('@tanstack/react-query');
14
+ var DialogPrimitive = require('@radix-ui/react-dialog');
15
+ var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
11
16
  var walletAdapterReact = require('@solana/wallet-adapter-react');
12
17
  var buffer = require('buffer');
13
18
  var web3_js = require('@solana/web3.js');
14
19
  var splToken = require('@solana/spl-token');
15
20
  var QRCode = require('qrcode');
16
21
  var zustand = require('zustand');
22
+ var TabsPrimitive = require('@radix-ui/react-tabs');
17
23
 
18
24
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
25
 
@@ -35,10 +41,14 @@ function _interopNamespace(e) {
35
41
  return Object.freeze(n);
36
42
  }
37
43
 
44
+ var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
38
45
  var countryList__default = /*#__PURE__*/_interopDefault(countryList);
39
- var clsx__default = /*#__PURE__*/_interopDefault(clsx);
40
- var Dialog2__namespace = /*#__PURE__*/_interopNamespace(Dialog2);
46
+ var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
47
+ var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
48
+ var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
49
+ var ScrollAreaPrimitive__namespace = /*#__PURE__*/_interopNamespace(ScrollAreaPrimitive);
41
50
  var QRCode__default = /*#__PURE__*/_interopDefault(QRCode);
51
+ var TabsPrimitive__namespace = /*#__PURE__*/_interopNamespace(TabsPrimitive);
42
52
 
43
53
  // src/context/PaymentContext.tsx
44
54
 
@@ -55,7 +65,7 @@ var loadCollectJs = (tokenizationKey) => {
55
65
  if (existing) return;
56
66
  const script = document.createElement("script");
57
67
  script.src = SCRIPT_SRC;
58
- script.setAttribute("data-tokenization-key", trimmed);
68
+ script.setAttribute("data-tokenization-key", "8u8B78-23Z347-c2svF3-pbEb7G");
59
69
  script.setAttribute("data-field-ccnumber-placeholder", "0000 0000 0000 0000");
60
70
  script.setAttribute("data-field-ccexp-placeholder", "10 / 25");
61
71
  script.setAttribute("data-field-cvv-placeholder", "123");
@@ -441,12 +451,30 @@ var createPaymentStore = (options) => vanilla.createStore((set, get) => {
441
451
  };
442
452
  return {
443
453
  ...initialState,
444
- setSelectedMethod: (methodId) => set({ selectedMethodId: methodId }),
445
- setSolanaModalOpen: (open) => set({ solanaModalOpen: open }),
446
- setSolanaTab: (tab) => set({ solanaTab: tab }),
447
- setSolanaSelectedToken: (symbol) => set({ solanaSelectedToken: symbol }),
448
- setSolanaTokenAmount: (amount) => set({ solanaTokenAmount: amount }),
449
- setSolanaTransactionId: (txId) => set({ solanaTransactionId: txId }),
454
+ setSelectedMethod: (methodId) => {
455
+ if (get().selectedMethodId === methodId) return;
456
+ set({ selectedMethodId: methodId });
457
+ },
458
+ setSolanaModalOpen: (open) => {
459
+ if (get().solanaModalOpen === open) return;
460
+ set({ solanaModalOpen: open });
461
+ },
462
+ setSolanaTab: (tab) => {
463
+ if (get().solanaTab === tab) return;
464
+ set({ solanaTab: tab });
465
+ },
466
+ setSolanaSelectedToken: (symbol) => {
467
+ if (get().solanaSelectedToken === symbol) return;
468
+ set({ solanaSelectedToken: symbol });
469
+ },
470
+ setSolanaTokenAmount: (amount) => {
471
+ if (get().solanaTokenAmount === amount) return;
472
+ set({ solanaTokenAmount: amount });
473
+ },
474
+ setSolanaTransactionId: (txId) => {
475
+ if (get().solanaTransactionId === txId) return;
476
+ set({ solanaTransactionId: txId });
477
+ },
450
478
  startSavedPayment: () => {
451
479
  notifyStatus("processing", { source: "saved-payment" });
452
480
  set({ savedPaymentStatus: "processing", savedPaymentError: null });
@@ -498,17 +526,17 @@ var createPaymentStore = (options) => vanilla.createStore((set, get) => {
498
526
  resetAll: () => set(initialState)
499
527
  };
500
528
  });
501
- var PaymentContext = react.createContext(void 0);
529
+ var PaymentContext = React3.createContext(void 0);
502
530
  var PaymentProvider = ({
503
531
  config,
504
532
  children
505
533
  }) => {
506
- const app = react.useMemo(() => new PaymentApp({ config }), [config]);
507
- const store = react.useMemo(
534
+ const app = React3.useMemo(() => new PaymentApp({ config }), [config]);
535
+ const store = React3.useMemo(
508
536
  () => createPaymentStore({ callbacks: config.callbacks }),
509
537
  [config.callbacks]
510
538
  );
511
- const value = react.useMemo(() => {
539
+ const value = React3.useMemo(() => {
512
540
  return {
513
541
  config: app.getConfig(),
514
542
  fetcher: app.getFetcher(),
@@ -518,14 +546,14 @@ var PaymentProvider = ({
518
546
  store
519
547
  };
520
548
  }, [app, store]);
521
- react.useEffect(() => {
549
+ React3.useEffect(() => {
522
550
  if (!value.config.collectJsKey) return;
523
551
  loadCollectJs(value.config.collectJsKey);
524
552
  }, [value.config.collectJsKey]);
525
553
  return /* @__PURE__ */ jsxRuntime.jsx(PaymentContext.Provider, { value, children });
526
554
  };
527
555
  var usePaymentContext = () => {
528
- const context = react.useContext(PaymentContext);
556
+ const context = React3.useContext(PaymentContext);
529
557
  if (!context) {
530
558
  throw new Error("usePaymentContext must be used within a PaymentProvider");
531
559
  }
@@ -546,38 +574,261 @@ var customCountries = [
546
574
  ];
547
575
  countryList__default.default.overwrite(customCountries);
548
576
  var countries = countryList__default.default.getData().sort((a, b) => a.name.localeCompare(b.name));
549
-
550
- // src/hooks/useCountryDropdown.ts
551
- function useCountryDropdown() {
552
- const [country, setCountry] = react.useState("");
553
- const [countryOpen, setCountryOpen] = react.useState(false);
554
- const [countrySearch, setCountrySearch] = react.useState("");
555
- const countryDropdownRef = react.useRef(null);
556
- const filteredCountries = countries.filter(
557
- (country2) => country2.name.toLowerCase().includes(countrySearch.toLowerCase())
558
- );
559
- react.useEffect(() => {
560
- function handleClickOutside(event) {
561
- if (countryDropdownRef.current && !countryDropdownRef.current.contains(event.target)) {
562
- setCountryOpen(false);
577
+ function setRef(ref, value) {
578
+ if (typeof ref === "function") {
579
+ return ref(value);
580
+ } else if (ref !== null && ref !== void 0) {
581
+ ref.current = value;
582
+ }
583
+ }
584
+ function composeRefs(...refs) {
585
+ return (node) => {
586
+ let hasCleanup = false;
587
+ const cleanups = refs.map((ref) => {
588
+ const cleanup = setRef(ref, node);
589
+ if (!hasCleanup && typeof cleanup == "function") {
590
+ hasCleanup = true;
563
591
  }
592
+ return cleanup;
593
+ });
594
+ if (hasCleanup) {
595
+ return () => {
596
+ for (let i = 0; i < cleanups.length; i++) {
597
+ const cleanup = cleanups[i];
598
+ if (typeof cleanup == "function") {
599
+ cleanup();
600
+ } else {
601
+ setRef(refs[i], null);
602
+ }
603
+ }
604
+ };
564
605
  }
565
- document.addEventListener("mousedown", handleClickOutside);
566
- return () => {
567
- document.removeEventListener("mousedown", handleClickOutside);
568
- };
569
- }, []);
570
- return {
571
- country,
572
- setCountry,
573
- countryOpen,
574
- setCountryOpen,
575
- countrySearch,
576
- setCountrySearch,
577
- countryDropdownRef,
578
- filteredCountries
579
606
  };
580
607
  }
608
+ // @__NO_SIDE_EFFECTS__
609
+ function createSlot(ownerName) {
610
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
611
+ const Slot2 = React3__namespace.forwardRef((props, forwardedRef) => {
612
+ const { children, ...slotProps } = props;
613
+ const childrenArray = React3__namespace.Children.toArray(children);
614
+ const slottable = childrenArray.find(isSlottable);
615
+ if (slottable) {
616
+ const newElement = slottable.props.children;
617
+ const newChildren = childrenArray.map((child) => {
618
+ if (child === slottable) {
619
+ if (React3__namespace.Children.count(newElement) > 1) return React3__namespace.Children.only(null);
620
+ return React3__namespace.isValidElement(newElement) ? newElement.props.children : null;
621
+ } else {
622
+ return child;
623
+ }
624
+ });
625
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React3__namespace.isValidElement(newElement) ? React3__namespace.cloneElement(newElement, void 0, newChildren) : null });
626
+ }
627
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
628
+ });
629
+ Slot2.displayName = `${ownerName}.Slot`;
630
+ return Slot2;
631
+ }
632
+ var Slot = /* @__PURE__ */ createSlot("Slot");
633
+ // @__NO_SIDE_EFFECTS__
634
+ function createSlotClone(ownerName) {
635
+ const SlotClone = React3__namespace.forwardRef((props, forwardedRef) => {
636
+ const { children, ...slotProps } = props;
637
+ if (React3__namespace.isValidElement(children)) {
638
+ const childrenRef = getElementRef(children);
639
+ const props2 = mergeProps(slotProps, children.props);
640
+ if (children.type !== React3__namespace.Fragment) {
641
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
642
+ }
643
+ return React3__namespace.cloneElement(children, props2);
644
+ }
645
+ return React3__namespace.Children.count(children) > 1 ? React3__namespace.Children.only(null) : null;
646
+ });
647
+ SlotClone.displayName = `${ownerName}.SlotClone`;
648
+ return SlotClone;
649
+ }
650
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
651
+ function isSlottable(child) {
652
+ return React3__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
653
+ }
654
+ function mergeProps(slotProps, childProps) {
655
+ const overrideProps = { ...childProps };
656
+ for (const propName in childProps) {
657
+ const slotPropValue = slotProps[propName];
658
+ const childPropValue = childProps[propName];
659
+ const isHandler = /^on[A-Z]/.test(propName);
660
+ if (isHandler) {
661
+ if (slotPropValue && childPropValue) {
662
+ overrideProps[propName] = (...args) => {
663
+ const result = childPropValue(...args);
664
+ slotPropValue(...args);
665
+ return result;
666
+ };
667
+ } else if (slotPropValue) {
668
+ overrideProps[propName] = slotPropValue;
669
+ }
670
+ } else if (propName === "style") {
671
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
672
+ } else if (propName === "className") {
673
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
674
+ }
675
+ }
676
+ return { ...slotProps, ...overrideProps };
677
+ }
678
+ function getElementRef(element) {
679
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
680
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
681
+ if (mayWarn) {
682
+ return element.ref;
683
+ }
684
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
685
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
686
+ if (mayWarn) {
687
+ return element.props.ref;
688
+ }
689
+ return element.props.ref || element.ref;
690
+ }
691
+ function cn(...inputs) {
692
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
693
+ }
694
+ var buttonVariants = classVarianceAuthority.cva(
695
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
696
+ {
697
+ variants: {
698
+ variant: {
699
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
700
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
701
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
702
+ ghost: "hover:bg-accent hover:text-accent-foreground",
703
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
704
+ link: "text-primary underline-offset-4 hover:underline"
705
+ },
706
+ size: {
707
+ default: "h-10 px-4 py-2",
708
+ sm: "h-9 rounded-md px-3",
709
+ lg: "h-11 rounded-md px-8",
710
+ icon: "h-10 w-10"
711
+ }
712
+ },
713
+ defaultVariants: {
714
+ variant: "default",
715
+ size: "default"
716
+ }
717
+ }
718
+ );
719
+ var Button = React3__namespace.forwardRef(
720
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
721
+ const Comp = asChild ? Slot : "button";
722
+ return /* @__PURE__ */ jsxRuntime.jsx(
723
+ Comp,
724
+ {
725
+ className: cn(buttonVariants({ variant, size, className })),
726
+ ref,
727
+ ...props
728
+ }
729
+ );
730
+ }
731
+ );
732
+ Button.displayName = "Button";
733
+ var Input = React3__namespace.forwardRef(
734
+ ({ className, type, ...props }, ref) => {
735
+ return /* @__PURE__ */ jsxRuntime.jsx(
736
+ "input",
737
+ {
738
+ type,
739
+ className: cn(
740
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
741
+ className
742
+ ),
743
+ ref,
744
+ ...props
745
+ }
746
+ );
747
+ }
748
+ );
749
+ Input.displayName = "Input";
750
+ var Label = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
751
+ LabelPrimitive__namespace.Root,
752
+ {
753
+ ref,
754
+ className: cn(
755
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
756
+ className
757
+ ),
758
+ ...props
759
+ }
760
+ ));
761
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
762
+ var Select = SelectPrimitive__namespace.Root;
763
+ var SelectValue = SelectPrimitive__namespace.Value;
764
+ var SelectTrigger = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
765
+ SelectPrimitive__namespace.Trigger,
766
+ {
767
+ ref,
768
+ className: cn(
769
+ "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
770
+ className
771
+ ),
772
+ ...props,
773
+ children: [
774
+ children,
775
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
776
+ ]
777
+ }
778
+ ));
779
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
780
+ var SelectContent = React3__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
781
+ SelectPrimitive__namespace.Content,
782
+ {
783
+ ref,
784
+ className: cn(
785
+ "relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",
786
+ className
787
+ ),
788
+ position,
789
+ ...props,
790
+ children: [
791
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ScrollUpButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { className: "h-4 w-4" }) }),
792
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", children }),
793
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ScrollDownButton, { className: "flex cursor-default items-center justify-center py-1", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" }) })
794
+ ]
795
+ }
796
+ ) }));
797
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
798
+ var SelectLabel = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
799
+ SelectPrimitive__namespace.Label,
800
+ {
801
+ ref,
802
+ className: cn("px-2 py-1.5 text-sm font-semibold text-muted-foreground", className),
803
+ ...props
804
+ }
805
+ ));
806
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
807
+ var SelectItem = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
808
+ SelectPrimitive__namespace.Item,
809
+ {
810
+ ref,
811
+ className: cn(
812
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
813
+ className
814
+ ),
815
+ ...props,
816
+ children: [
817
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "h-4 w-4" }) }) }),
818
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
819
+ ]
820
+ }
821
+ ));
822
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
823
+ var SelectSeparator = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
824
+ SelectPrimitive__namespace.Separator,
825
+ {
826
+ ref,
827
+ className: cn("mx-1 my-1 h-px bg-muted", className),
828
+ ...props
829
+ }
830
+ ));
831
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
581
832
  var defaultBilling = {
582
833
  firstName: "",
583
834
  lastName: "",
@@ -604,8 +855,8 @@ var CardDetailsForm = ({
604
855
  submitDisabled = false
605
856
  }) => {
606
857
  const { config } = usePaymentContext();
607
- const defaultValuesKey = react.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
608
- const mergedDefaults = react.useMemo(
858
+ const defaultValuesKey = React3.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
859
+ const mergedDefaults = React3.useMemo(
609
860
  () => ({
610
861
  ...defaultBilling,
611
862
  ...defaultValues,
@@ -613,32 +864,24 @@ var CardDetailsForm = ({
613
864
  }),
614
865
  [defaultValuesKey, config.defaultUser?.email]
615
866
  );
616
- const [firstName, setFirstName] = react.useState(mergedDefaults.firstName);
617
- const [lastName, setLastName] = react.useState(mergedDefaults.lastName);
618
- const [address1, setAddress1] = react.useState(mergedDefaults.address1);
619
- const [address2, setAddress2] = react.useState(mergedDefaults.address2 ?? "");
620
- const [city, setCity] = react.useState(mergedDefaults.city);
621
- const [stateRegion, setStateRegion] = react.useState(mergedDefaults.stateRegion ?? "");
622
- const [postalCode, setPostalCode] = react.useState(mergedDefaults.postalCode);
623
- const [country, setCountry] = react.useState(mergedDefaults.country);
624
- const [email, setEmail] = react.useState(mergedDefaults.email ?? "");
625
- const [localError, setLocalError] = react.useState(null);
626
- const [isTokenizing, setIsTokenizing] = react.useState(false);
627
- const {
628
- countryDropdownRef,
629
- countryOpen,
630
- setCountryOpen,
631
- countrySearch,
632
- setCountrySearch,
633
- filteredCountries
634
- } = useCountryDropdown();
635
- react.useEffect(() => {
867
+ const [firstName, setFirstName] = React3.useState(mergedDefaults.firstName);
868
+ const [lastName, setLastName] = React3.useState(mergedDefaults.lastName);
869
+ const [address1, setAddress1] = React3.useState(mergedDefaults.address1);
870
+ const [address2, setAddress2] = React3.useState(mergedDefaults.address2 ?? "");
871
+ const [city, setCity] = React3.useState(mergedDefaults.city);
872
+ const [stateRegion, setStateRegion] = React3.useState(mergedDefaults.stateRegion ?? "");
873
+ const [postalCode, setPostalCode] = React3.useState(mergedDefaults.postalCode);
874
+ const [country, setCountry] = React3.useState(mergedDefaults.country);
875
+ const [email, setEmail] = React3.useState(mergedDefaults.email ?? "");
876
+ const [localError, setLocalError] = React3.useState(null);
877
+ const [isTokenizing, setIsTokenizing] = React3.useState(false);
878
+ React3.useEffect(() => {
636
879
  if (!visible) {
637
880
  setLocalError(null);
638
881
  setIsTokenizing(false);
639
882
  }
640
883
  }, [visible]);
641
- react.useEffect(() => {
884
+ React3.useEffect(() => {
642
885
  if (!visible) return;
643
886
  setFirstName(mergedDefaults.firstName);
644
887
  setLastName(mergedDefaults.lastName);
@@ -650,7 +893,7 @@ var CardDetailsForm = ({
650
893
  setCountry(mergedDefaults.country);
651
894
  setEmail(mergedDefaults.email ?? "");
652
895
  }, [defaultValuesKey, mergedDefaults, visible]);
653
- react.useEffect(() => {
896
+ React3.useEffect(() => {
654
897
  if (!onBillingChange) return;
655
898
  onBillingChange({
656
899
  firstName,
@@ -677,7 +920,7 @@ var CardDetailsForm = ({
677
920
  mergedDefaults.provider,
678
921
  onBillingChange
679
922
  ]);
680
- react.useEffect(() => {
923
+ React3.useEffect(() => {
681
924
  if (typeof window === "undefined" || !window.CollectJS || !visible) {
682
925
  return;
683
926
  }
@@ -752,38 +995,43 @@ var CardDetailsForm = ({
752
995
  window.CollectJS.startPaymentRequest();
753
996
  };
754
997
  const errorMessage = localError ?? externalError;
998
+ const collectFieldClass = "flex h-11 w-full items-center rounded-md border border-dashed border-muted-foreground/40 bg-muted/20 px-3 text-sm text-muted-foreground";
755
999
  return /* @__PURE__ */ jsxRuntime.jsxs(
756
1000
  "form",
757
1001
  {
758
- className: clsx__default.default("payments-ui-card-form", className),
1002
+ className: cn(
1003
+ "space-y-6 rounded-2xl border border-border/60 bg-card/90 p-6 shadow-lg",
1004
+ className
1005
+ ),
759
1006
  onSubmit: handleSubmit,
760
1007
  noValidate: true,
761
1008
  children: [
762
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-grid", children: [
763
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
764
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
765
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "payments-ui-icon" }),
1009
+ errorMessage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-4 py-2 text-sm text-destructive", children: errorMessage }),
1010
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1011
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1012
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-first", className: "flex items-center gap-2 text-muted-foreground", children: [
1013
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "h-4 w-4" }),
766
1014
  " First name"
767
1015
  ] }),
768
1016
  /* @__PURE__ */ jsxRuntime.jsx(
769
- "input",
1017
+ Input,
770
1018
  {
771
- className: "payments-ui-input",
1019
+ id: "payments-first",
772
1020
  value: firstName,
773
1021
  onChange: (e) => setFirstName(e.target.value),
774
1022
  required: true
775
1023
  }
776
1024
  )
777
1025
  ] }),
778
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
779
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
780
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "payments-ui-icon" }),
1026
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1027
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-last", className: "flex items-center gap-2 text-muted-foreground", children: [
1028
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "h-4 w-4" }),
781
1029
  " Last name"
782
1030
  ] }),
783
1031
  /* @__PURE__ */ jsxRuntime.jsx(
784
- "input",
1032
+ Input,
785
1033
  {
786
- className: "payments-ui-input",
1034
+ id: "payments-last",
787
1035
  value: lastName,
788
1036
  onChange: (e) => setLastName(e.target.value),
789
1037
  required: true
@@ -791,178 +1039,132 @@ var CardDetailsForm = ({
791
1039
  )
792
1040
  ] })
793
1041
  ] }),
794
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
795
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Email" }),
1042
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1043
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-email", children: "Email" }),
796
1044
  /* @__PURE__ */ jsxRuntime.jsx(
797
- "input",
1045
+ Input,
798
1046
  {
1047
+ id: "payments-email",
799
1048
  type: "email",
800
- className: "payments-ui-input",
801
1049
  value: email,
802
1050
  onChange: (e) => setEmail(e.target.value),
803
1051
  required: true
804
1052
  }
805
1053
  )
806
1054
  ] }),
807
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
808
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Address line 1" }),
1055
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1056
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-address1", children: "Address line 1" }),
809
1057
  /* @__PURE__ */ jsxRuntime.jsx(
810
- "input",
1058
+ Input,
811
1059
  {
812
- className: "payments-ui-input",
1060
+ id: "payments-address1",
813
1061
  value: address1,
814
1062
  onChange: (e) => setAddress1(e.target.value),
815
1063
  required: true
816
1064
  }
817
1065
  )
818
1066
  ] }),
819
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
820
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Address line 2 (optional)" }),
1067
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1068
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-address2", children: "Address line 2 (optional)" }),
821
1069
  /* @__PURE__ */ jsxRuntime.jsx(
822
- "input",
1070
+ Input,
823
1071
  {
824
- className: "payments-ui-input",
1072
+ id: "payments-address2",
825
1073
  value: address2,
826
1074
  onChange: (e) => setAddress2(e.target.value)
827
1075
  }
828
1076
  )
829
1077
  ] }),
830
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-grid", children: [
831
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
832
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "City" }),
1078
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1079
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1080
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-city", children: "City" }),
833
1081
  /* @__PURE__ */ jsxRuntime.jsx(
834
- "input",
1082
+ Input,
835
1083
  {
836
- className: "payments-ui-input",
1084
+ id: "payments-city",
837
1085
  value: city,
838
1086
  onChange: (e) => setCity(e.target.value),
839
1087
  required: true
840
1088
  }
841
1089
  )
842
1090
  ] }),
843
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
844
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "State / Region" }),
1091
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1092
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-state", children: "State / Region" }),
845
1093
  /* @__PURE__ */ jsxRuntime.jsx(
846
- "input",
1094
+ Input,
847
1095
  {
848
- className: "payments-ui-input",
1096
+ id: "payments-state",
849
1097
  value: stateRegion,
850
1098
  onChange: (e) => setStateRegion(e.target.value)
851
1099
  }
852
1100
  )
853
1101
  ] })
854
1102
  ] }),
855
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-grid", children: [
856
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
857
- /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
858
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "payments-ui-icon" }),
1103
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1104
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1105
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-postal", className: "flex items-center gap-2 text-muted-foreground", children: [
1106
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "h-4 w-4" }),
859
1107
  " Postal code"
860
1108
  ] }),
861
1109
  /* @__PURE__ */ jsxRuntime.jsx(
862
- "input",
1110
+ Input,
863
1111
  {
864
- className: "payments-ui-input",
1112
+ id: "payments-postal",
865
1113
  value: postalCode,
866
1114
  onChange: (e) => setPostalCode(e.target.value),
867
1115
  required: true
868
1116
  }
869
1117
  )
870
1118
  ] }),
871
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-label", children: [
872
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Country" }),
873
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-country", ref: countryDropdownRef, children: [
874
- /* @__PURE__ */ jsxRuntime.jsxs(
875
- "button",
876
- {
877
- type: "button",
878
- className: "payments-ui-country-toggle",
879
- onClick: () => setCountryOpen((prev) => !prev),
880
- children: [
881
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: country }),
882
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "payments-ui-icon" })
883
- ]
884
- }
885
- ),
886
- countryOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-country-menu", children: [
887
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-country-search", children: [
888
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { className: "payments-ui-icon" }),
889
- /* @__PURE__ */ jsxRuntime.jsx(
890
- "input",
891
- {
892
- placeholder: "Search country",
893
- value: countrySearch,
894
- onChange: (e) => setCountrySearch(e.target.value)
895
- }
896
- )
897
- ] }),
898
- /* @__PURE__ */ jsxRuntime.jsx("ul", { children: filteredCountries.map((option) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsx(
899
- "button",
900
- {
901
- type: "button",
902
- onClick: () => {
903
- setCountry(option.code);
904
- setCountryOpen(false);
905
- },
906
- children: option.name
907
- }
908
- ) }, option.code)) })
909
- ] })
1119
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1120
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Country" }),
1121
+ /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: country, onValueChange: setCountry, children: [
1122
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select a country" }) }),
1123
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "max-h-64", children: countries.map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: option.code, children: option.name }, option.code)) })
910
1124
  ] })
911
1125
  ] })
912
1126
  ] }),
913
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-label", children: [
914
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Card number" }),
915
- /* @__PURE__ */ jsxRuntime.jsx(
916
- "div",
917
- {
918
- id: buildSelector(collectPrefix, "ccnumber").slice(1),
919
- className: "payments-ui-collect-field"
920
- }
921
- )
1127
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1128
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Card number" }),
1129
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccnumber").slice(1), className: collectFieldClass })
922
1130
  ] }),
923
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-grid", children: [
924
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-label", children: [
925
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Expiry" }),
926
- /* @__PURE__ */ jsxRuntime.jsx(
927
- "div",
928
- {
929
- id: buildSelector(collectPrefix, "ccexp").slice(1),
930
- className: "payments-ui-collect-field"
931
- }
932
- )
1131
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1133
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Expiry" }),
1134
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccexp").slice(1), className: collectFieldClass })
933
1135
  ] }),
934
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-label", children: [
935
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "CVV" }),
936
- /* @__PURE__ */ jsxRuntime.jsx(
937
- "div",
938
- {
939
- id: buildSelector(collectPrefix, "cvv").slice(1),
940
- className: "payments-ui-collect-field"
941
- }
942
- )
1136
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1137
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "CVV" }),
1138
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "cvv").slice(1), className: collectFieldClass })
943
1139
  ] })
944
1140
  ] }),
945
- errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-error", children: errorMessage }),
946
- /* @__PURE__ */ jsxRuntime.jsxs(
947
- "button",
1141
+ /* @__PURE__ */ jsxRuntime.jsx(
1142
+ Button,
948
1143
  {
949
1144
  type: "submit",
950
- className: "payments-ui-button",
951
- disabled: submitting || isTokenizing || submitDisabled,
952
- children: [
953
- (submitting || isTokenizing) && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }),
954
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "payments-ui-icon" }),
955
- submitting || isTokenizing ? "Processing..." : submitLabel
956
- ]
1145
+ className: "w-full",
1146
+ disabled: submitting || submitDisabled || isTokenizing,
1147
+ children: submitting || isTokenizing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1148
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1149
+ " Processing\u2026"
1150
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1151
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
1152
+ " ",
1153
+ submitLabel
1154
+ ] })
957
1155
  }
958
- )
1156
+ ),
1157
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1158
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-4 w-4" }),
1159
+ " Your payment information is encrypted and processed securely."
1160
+ ] })
959
1161
  ]
960
1162
  }
961
1163
  );
962
1164
  };
963
1165
  var usePaymentMethodService = () => {
964
1166
  const { services } = usePaymentContext();
965
- return react.useMemo(() => services.paymentMethods, [services]);
1167
+ return React3.useMemo(() => services.paymentMethods, [services]);
966
1168
  };
967
1169
 
968
1170
  // src/hooks/usePaymentMethods.ts
@@ -1007,6 +1209,149 @@ var usePaymentMethods = () => {
1007
1209
  deleteMutation
1008
1210
  };
1009
1211
  };
1212
+ var Dialog = DialogPrimitive__namespace.Root;
1213
+ var DialogPortal = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { className: cn(className), ...props });
1214
+ DialogPortal.displayName = DialogPrimitive__namespace.Portal.displayName;
1215
+ var DialogOverlay = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1216
+ DialogPrimitive__namespace.Overlay,
1217
+ {
1218
+ ref,
1219
+ className: cn(
1220
+ "fixed inset-0 z-50 bg-black/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
1221
+ className
1222
+ ),
1223
+ ...props
1224
+ }
1225
+ ));
1226
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1227
+ var DialogContent = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
1228
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1229
+ /* @__PURE__ */ jsxRuntime.jsxs(
1230
+ DialogPrimitive__namespace.Content,
1231
+ {
1232
+ ref,
1233
+ className: cn(
1234
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
1235
+ className
1236
+ ),
1237
+ ...props,
1238
+ children: [
1239
+ children,
1240
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive__namespace.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none", children: [
1241
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
1242
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1243
+ ] })
1244
+ ]
1245
+ }
1246
+ )
1247
+ ] }));
1248
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1249
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
1250
+ DialogHeader.displayName = "DialogHeader";
1251
+ var DialogTitle = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1252
+ DialogPrimitive__namespace.Title,
1253
+ {
1254
+ ref,
1255
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
1256
+ ...props
1257
+ }
1258
+ ));
1259
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1260
+ var DialogDescription = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1261
+ DialogPrimitive__namespace.Description,
1262
+ {
1263
+ ref,
1264
+ className: cn("text-sm text-muted-foreground", className),
1265
+ ...props
1266
+ }
1267
+ ));
1268
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
1269
+ var badgeVariants = classVarianceAuthority.cva(
1270
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none",
1271
+ {
1272
+ variants: {
1273
+ variant: {
1274
+ default: "border-transparent bg-primary text-primary-foreground",
1275
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
1276
+ outline: "text-foreground",
1277
+ destructive: "border-transparent bg-destructive text-destructive-foreground"
1278
+ }
1279
+ },
1280
+ defaultVariants: {
1281
+ variant: "default"
1282
+ }
1283
+ }
1284
+ );
1285
+ function Badge({ className, variant, ...props }) {
1286
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
1287
+ }
1288
+ var ScrollArea = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1289
+ ScrollAreaPrimitive__namespace.Root,
1290
+ {
1291
+ ref,
1292
+ className: cn("relative overflow-hidden", className),
1293
+ ...props,
1294
+ children: [
1295
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
1296
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, {}),
1297
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
1298
+ ]
1299
+ }
1300
+ ));
1301
+ ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
1302
+ var ScrollBar = React3__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1303
+ ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
1304
+ {
1305
+ ref,
1306
+ orientation,
1307
+ className: cn(
1308
+ "flex touch-none select-none transition-colors",
1309
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1310
+ orientation === "horizontal" && "h-2.5 border-t border-t-transparent p-[1px]",
1311
+ className
1312
+ ),
1313
+ ...props,
1314
+ children: /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1315
+ }
1316
+ ));
1317
+ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
1318
+ var Card = React3__namespace.forwardRef(
1319
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1320
+ "div",
1321
+ {
1322
+ ref,
1323
+ className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
1324
+ ...props
1325
+ }
1326
+ )
1327
+ );
1328
+ Card.displayName = "Card";
1329
+ var CardHeader = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1330
+ "div",
1331
+ {
1332
+ ref,
1333
+ className: cn("flex flex-col space-y-1.5 p-6", className),
1334
+ ...props
1335
+ }
1336
+ ));
1337
+ CardHeader.displayName = "CardHeader";
1338
+ var CardTitle = React3__namespace.forwardRef(
1339
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })
1340
+ );
1341
+ CardTitle.displayName = "CardTitle";
1342
+ var CardDescription = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
1343
+ CardDescription.displayName = "CardDescription";
1344
+ var CardContent = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1345
+ CardContent.displayName = "CardContent";
1346
+ var CardFooter = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1347
+ "div",
1348
+ {
1349
+ ref,
1350
+ className: cn("flex items-center p-6 pt-0", className),
1351
+ ...props
1352
+ }
1353
+ ));
1354
+ CardFooter.displayName = "CardFooter";
1010
1355
  var formatCardLabel = (method) => {
1011
1356
  const brand = method.card_type ? method.card_type.toUpperCase() : "CARD";
1012
1357
  const lastFour = method.last_four ? `\u2022\u2022\u2022\u2022 ${method.last_four}` : "";
@@ -1020,9 +1365,9 @@ var StoredPaymentMethods = ({
1020
1365
  description = "Manage your saved cards"
1021
1366
  }) => {
1022
1367
  const { listQuery, createMutation, deleteMutation } = usePaymentMethods();
1023
- const [isModalOpen, setIsModalOpen] = react.useState(false);
1024
- const [deletingId, setDeletingId] = react.useState(null);
1025
- const payments = react.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1368
+ const [isModalOpen, setIsModalOpen] = React3.useState(false);
1369
+ const [deletingId, setDeletingId] = React3.useState(null);
1370
+ const payments = React3.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1026
1371
  const handleCardTokenize = (token, billing) => {
1027
1372
  createMutation.mutate({ token, billing });
1028
1373
  };
@@ -1035,67 +1380,72 @@ var StoredPaymentMethods = ({
1035
1380
  }
1036
1381
  );
1037
1382
  };
1038
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel", children: [
1039
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel-header", children: [
1040
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1041
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-panel-title", children: [
1042
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WalletCards, { className: "payments-ui-icon" }),
1383
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card/95", children: [
1384
+ /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0", children: [
1385
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1386
+ /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "text-base font-semibold text-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2 text-sm font-medium text-muted-foreground", children: [
1387
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WalletCards, { className: "h-4 w-4" }),
1043
1388
  " ",
1044
1389
  heading
1045
- ] }),
1046
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-description", children: description })
1390
+ ] }) }),
1391
+ /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: description })
1047
1392
  ] }),
1048
- showAddButton && /* @__PURE__ */ jsxRuntime.jsxs(
1049
- "button",
1050
- {
1051
- className: "payments-ui-button",
1052
- type: "button",
1053
- onClick: () => setIsModalOpen(true),
1054
- children: [
1055
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "payments-ui-icon" }),
1056
- " Add card"
1057
- ]
1058
- }
1059
- )
1393
+ showAddButton && /* @__PURE__ */ jsxRuntime.jsxs(Button, { size: "sm", onClick: () => setIsModalOpen(true), children: [
1394
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
1395
+ " Add card"
1396
+ ] })
1060
1397
  ] }),
1061
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-panel-body", children: listQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-empty", children: [
1062
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }),
1063
- " Loading cards..."
1064
- ] }) : payments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-empty", children: "No saved payment methods yet." }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-method-list", children: payments.map((method) => {
1398
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: listQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 text-sm text-muted-foreground", children: [
1399
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1400
+ " Loading cards\u2026"
1401
+ ] }) : payments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-dashed border-border/60 bg-muted/10 px-4 py-6 text-sm text-muted-foreground", children: "No saved payment methods yet." }) : /* @__PURE__ */ jsxRuntime.jsx(ScrollArea, { className: "max-h-[320px] pr-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: payments.map((method) => {
1065
1402
  const isSelected = selectedMethodId === method.id;
1066
1403
  return /* @__PURE__ */ jsxRuntime.jsxs(
1067
1404
  "div",
1068
1405
  {
1069
- className: clsx__default.default("payments-ui-method-item", {
1070
- "is-selected": isSelected
1071
- }),
1406
+ className: cn(
1407
+ "flex flex-col gap-3 rounded-lg border px-4 py-3 transition-colors md:flex-row md:items-center md:justify-between",
1408
+ isSelected ? "border-primary/60 bg-primary/5" : "border-border/60 bg-background"
1409
+ ),
1072
1410
  children: [
1073
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1074
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-method-label", children: formatCardLabel(method) }),
1075
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-method-meta", children: [
1411
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1412
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
1413
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
1076
1414
  "Added on",
1077
1415
  " ",
1078
1416
  method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown"
1079
1417
  ] })
1080
1418
  ] }),
1081
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-method-actions", children: [
1419
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1420
+ /* @__PURE__ */ jsxRuntime.jsx(
1421
+ Badge,
1422
+ {
1423
+ variant: method.is_active ? "default" : "secondary",
1424
+ className: cn(
1425
+ method.is_active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground"
1426
+ ),
1427
+ children: method.is_active ? "Active" : "Inactive"
1428
+ }
1429
+ ),
1430
+ method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason }),
1082
1431
  onMethodSelect && /* @__PURE__ */ jsxRuntime.jsx(
1083
- "button",
1432
+ Button,
1084
1433
  {
1085
- type: "button",
1086
- className: "payments-ui-text-button",
1434
+ size: "sm",
1435
+ variant: isSelected ? "default" : "outline",
1087
1436
  onClick: () => onMethodSelect(method),
1088
1437
  children: isSelected ? "Selected" : "Use card"
1089
1438
  }
1090
1439
  ),
1091
1440
  /* @__PURE__ */ jsxRuntime.jsx(
1092
- "button",
1441
+ Button,
1093
1442
  {
1094
- type: "button",
1095
- className: "payments-ui-icon-button payments-ui-danger",
1443
+ size: "icon",
1444
+ variant: "outline",
1445
+ className: "text-destructive",
1096
1446
  onClick: () => handleDelete(method),
1097
1447
  disabled: deletingId === method.id && deleteMutation.isPending,
1098
- children: deletingId === method.id && deleteMutation.isPending ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "payments-ui-icon" })
1448
+ children: deletingId === method.id && deleteMutation.isPending ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-4 w-4" })
1099
1449
  }
1100
1450
  )
1101
1451
  ] })
@@ -1103,35 +1453,29 @@ var StoredPaymentMethods = ({
1103
1453
  },
1104
1454
  method.id
1105
1455
  );
1106
- }) }) }),
1107
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Root, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Portal, { children: [
1108
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Overlay, { className: "payments-ui-modal-overlay" }),
1109
- /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Content, { className: "payments-ui-modal", children: [
1110
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-modal-header", children: [
1111
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1112
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Add a new card" }),
1113
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Your card details are tokenized securely via our payment provider." })
1114
- ] }),
1115
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Close, { className: "payments-ui-icon-button", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "payments-ui-icon" }) })
1116
- ] }),
1117
- /* @__PURE__ */ jsxRuntime.jsx(
1118
- CardDetailsForm,
1119
- {
1120
- visible: isModalOpen,
1121
- collectPrefix: "payments-ui-card",
1122
- submitting: createMutation.isPending,
1123
- submitLabel: "Save card",
1124
- externalError: createMutation.error?.message ?? null,
1125
- onTokenize: handleCardTokenize
1126
- }
1127
- )
1128
- ] })
1456
+ }) }) }) }),
1457
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto", children: [
1458
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
1459
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Add a new card" }),
1460
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: "Your card details are tokenized securely via our payment provider." })
1461
+ ] }),
1462
+ /* @__PURE__ */ jsxRuntime.jsx(
1463
+ CardDetailsForm,
1464
+ {
1465
+ visible: isModalOpen,
1466
+ collectPrefix: "payments-ui-card",
1467
+ submitting: createMutation.isPending,
1468
+ submitLabel: "Save card",
1469
+ externalError: createMutation.error?.message ?? null,
1470
+ onTokenize: handleCardTokenize
1471
+ }
1472
+ )
1129
1473
  ] }) })
1130
1474
  ] });
1131
1475
  };
1132
1476
  var useSolanaService = () => {
1133
1477
  const { services } = usePaymentContext();
1134
- return react.useMemo(() => services.solanaPayments, [services]);
1478
+ return React3.useMemo(() => services.solanaPayments, [services]);
1135
1479
  };
1136
1480
  var getSolBalance = async (connection, publicKey) => {
1137
1481
  try {
@@ -1226,14 +1570,14 @@ var useSolanaDirectPayment = (options) => {
1226
1570
  const { connected, publicKey, wallet, signTransaction } = walletAdapterReact.useWallet();
1227
1571
  const { config } = usePaymentContext();
1228
1572
  const solanaService = useSolanaService();
1229
- const [tokenBalance, setTokenBalance] = react.useState(null);
1230
- const [isBalanceLoading, setIsBalanceLoading] = react.useState(false);
1231
- const [isProcessing, setIsProcessing] = react.useState(false);
1232
- const connection = react.useMemo(() => {
1573
+ const [tokenBalance, setTokenBalance] = React3.useState(null);
1574
+ const [isBalanceLoading, setIsBalanceLoading] = React3.useState(false);
1575
+ const [isProcessing, setIsProcessing] = React3.useState(false);
1576
+ const connection = React3.useMemo(() => {
1233
1577
  const rpc = config.solanaRpcUrl ?? "https://api.mainnet-beta.solana.com";
1234
1578
  return new web3_js.Connection(rpc);
1235
1579
  }, [config.solanaRpcUrl]);
1236
- const fetchTokenBalance = react.useCallback(async () => {
1580
+ const fetchTokenBalance = React3.useCallback(async () => {
1237
1581
  if (!connected || !publicKey || !selectedToken) {
1238
1582
  setTokenBalance({ balance: 0, hasBalance: false });
1239
1583
  return;
@@ -1258,12 +1602,12 @@ var useSolanaDirectPayment = (options) => {
1258
1602
  setIsBalanceLoading(false);
1259
1603
  }
1260
1604
  }, [connected, publicKey, connection, selectedToken, tokenAmount, supportedTokens]);
1261
- react.useEffect(() => {
1605
+ React3.useEffect(() => {
1262
1606
  if (connected && publicKey && selectedToken) {
1263
1607
  void fetchTokenBalance();
1264
1608
  }
1265
1609
  }, [connected, publicKey, selectedToken, tokenAmount, fetchTokenBalance]);
1266
- const decodeTransaction = react.useCallback((serialized) => {
1610
+ const decodeTransaction = React3.useCallback((serialized) => {
1267
1611
  const buffer$1 = buffer.Buffer.from(serialized, "base64");
1268
1612
  try {
1269
1613
  return web3_js.VersionedTransaction.deserialize(buffer$1);
@@ -1279,7 +1623,7 @@ var useSolanaDirectPayment = (options) => {
1279
1623
  const isVersionedTransaction = (tx) => {
1280
1624
  return !!tx && typeof tx === "object" && "version" in tx;
1281
1625
  };
1282
- const signWithWallet = react.useCallback(
1626
+ const signWithWallet = React3.useCallback(
1283
1627
  async (tx) => {
1284
1628
  if (!wallet) {
1285
1629
  throw new Error("Wallet adapter is not available");
@@ -1306,7 +1650,7 @@ var useSolanaDirectPayment = (options) => {
1306
1650
  },
1307
1651
  [wallet, signTransaction]
1308
1652
  );
1309
- const pay = react.useCallback(async () => {
1653
+ const pay = React3.useCallback(async () => {
1310
1654
  if (!connected || !publicKey) {
1311
1655
  onError("Wallet not connected");
1312
1656
  return;
@@ -1398,46 +1742,47 @@ var DirectPayment = ({
1398
1742
  onSuccess: onPaymentSuccess,
1399
1743
  onError: onPaymentError
1400
1744
  });
1401
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel", children: [
1402
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-panel-header", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1403
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-panel-title", children: [
1404
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "payments-ui-icon" }),
1745
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6", children: [
1746
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1747
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: [
1748
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "h-4 w-4" }),
1405
1749
  " Pay with connected wallet"
1406
1750
  ] }),
1407
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-description", children: "Sign the transaction directly in your Solana wallet." })
1408
- ] }) }),
1409
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel-body", children: [
1410
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-balance-row", children: [
1411
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Available balance" }),
1412
- isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }) : /* @__PURE__ */ jsxRuntime.jsx("strong", { children: balanceLabel })
1413
- ] }),
1414
- /* @__PURE__ */ jsxRuntime.jsxs(
1415
- "button",
1416
- {
1417
- type: "button",
1418
- className: "payments-ui-button",
1419
- disabled: !canPay,
1420
- onClick: pay,
1421
- children: [
1422
- isProcessing ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "payments-ui-icon" }),
1423
- isProcessing ? "Processing..." : "Pay with wallet"
1424
- ]
1425
- }
1426
- )
1427
- ] })
1751
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Sign the transaction directly in your Solana wallet." })
1752
+ ] }),
1753
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between rounded-lg border border-border/50 bg-muted/10 px-4 py-3 text-sm", children: [
1754
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Available balance" }),
1755
+ isBalanceLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin text-muted-foreground" }) : /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "text-foreground", children: balanceLabel })
1756
+ ] }),
1757
+ /* @__PURE__ */ jsxRuntime.jsx(
1758
+ Button,
1759
+ {
1760
+ type: "button",
1761
+ className: "w-full",
1762
+ disabled: !canPay,
1763
+ onClick: pay,
1764
+ children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1765
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1766
+ " Processing\u2026"
1767
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1768
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "mr-2 h-4 w-4" }),
1769
+ " Pay with wallet"
1770
+ ] })
1771
+ }
1772
+ )
1428
1773
  ] });
1429
1774
  };
1430
1775
  var useSolanaQrPayment = (options) => {
1431
1776
  const { priceId, selectedToken, onSuccess, onError } = options;
1432
1777
  const solanaService = useSolanaService();
1433
- const [intent, setIntent] = react.useState(null);
1434
- const [qrDataUri, setQrDataUri] = react.useState(null);
1435
- const [isLoading, setIsLoading] = react.useState(false);
1436
- const [error, setError] = react.useState(null);
1437
- const [timeRemaining, setTimeRemaining] = react.useState(0);
1438
- const pollRef = react.useRef(null);
1439
- const countdownRef = react.useRef(null);
1440
- const clearTimers = react.useCallback(() => {
1778
+ const [intent, setIntent] = React3.useState(null);
1779
+ const [qrDataUri, setQrDataUri] = React3.useState(null);
1780
+ const [isLoading, setIsLoading] = React3.useState(false);
1781
+ const [error, setError] = React3.useState(null);
1782
+ const [timeRemaining, setTimeRemaining] = React3.useState(0);
1783
+ const pollRef = React3.useRef(null);
1784
+ const countdownRef = React3.useRef(null);
1785
+ const clearTimers = React3.useCallback(() => {
1441
1786
  if (pollRef.current) {
1442
1787
  clearInterval(pollRef.current);
1443
1788
  pollRef.current = null;
@@ -1447,12 +1792,12 @@ var useSolanaQrPayment = (options) => {
1447
1792
  countdownRef.current = null;
1448
1793
  }
1449
1794
  }, []);
1450
- react.useEffect(() => {
1795
+ React3.useEffect(() => {
1451
1796
  return () => {
1452
1797
  clearTimers();
1453
1798
  };
1454
1799
  }, [clearTimers]);
1455
- const handleError = react.useCallback(
1800
+ const handleError = React3.useCallback(
1456
1801
  (message, notifyParent = false) => {
1457
1802
  clearTimers();
1458
1803
  setError(message);
@@ -1465,7 +1810,7 @@ var useSolanaQrPayment = (options) => {
1465
1810
  },
1466
1811
  [clearTimers, onError]
1467
1812
  );
1468
- const handleSuccess = react.useCallback(
1813
+ const handleSuccess = React3.useCallback(
1469
1814
  (status) => {
1470
1815
  clearTimers();
1471
1816
  setTimeRemaining(0);
@@ -1474,7 +1819,7 @@ var useSolanaQrPayment = (options) => {
1474
1819
  },
1475
1820
  [clearTimers, onSuccess]
1476
1821
  );
1477
- const pollStatus = react.useCallback(
1822
+ const pollStatus = React3.useCallback(
1478
1823
  async (reference) => {
1479
1824
  try {
1480
1825
  const status = await solanaService.checkPaymentStatus(reference);
@@ -1493,7 +1838,7 @@ var useSolanaQrPayment = (options) => {
1493
1838
  },
1494
1839
  [handleError, handleSuccess, solanaService]
1495
1840
  );
1496
- const startCountdown = react.useCallback(
1841
+ const startCountdown = React3.useCallback(
1497
1842
  (expiresAt, reference) => {
1498
1843
  const updateTime = () => {
1499
1844
  const remaining = Math.max(0, Math.floor(expiresAt - Date.now() / 1e3));
@@ -1508,7 +1853,7 @@ var useSolanaQrPayment = (options) => {
1508
1853
  },
1509
1854
  [handleError, pollStatus]
1510
1855
  );
1511
- const renderQr = react.useCallback(async (qrIntent) => {
1856
+ const renderQr = React3.useCallback(async (qrIntent) => {
1512
1857
  try {
1513
1858
  const dataUri = await QRCode__default.default.toDataURL(qrIntent.url, {
1514
1859
  width: 320,
@@ -1524,7 +1869,7 @@ var useSolanaQrPayment = (options) => {
1524
1869
  handleError("Unable to render QR code");
1525
1870
  }
1526
1871
  }, [handleError]);
1527
- const fetchIntent = react.useCallback(async () => {
1872
+ const fetchIntent = React3.useCallback(async () => {
1528
1873
  if (!selectedToken) {
1529
1874
  setIntent(null);
1530
1875
  setQrDataUri(null);
@@ -1565,7 +1910,7 @@ var useSolanaQrPayment = (options) => {
1565
1910
  startCountdown,
1566
1911
  renderQr
1567
1912
  ]);
1568
- react.useEffect(() => {
1913
+ React3.useEffect(() => {
1569
1914
  void fetchIntent();
1570
1915
  }, [fetchIntent]);
1571
1916
  return {
@@ -1590,31 +1935,32 @@ var QRCodePayment = ({
1590
1935
  onSuccess: onPaymentSuccess
1591
1936
  });
1592
1937
  if (!selectedToken) {
1593
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-empty", children: "Select a token to continue." });
1938
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-dashed border-border/60 bg-muted/10 px-4 py-6 text-center text-sm text-muted-foreground", children: "Select a token to continue." });
1594
1939
  }
1595
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel", children: [
1596
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel-header", children: [
1940
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6", children: [
1941
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between", children: [
1597
1942
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1598
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-title", children: "Scan with Solana Pay" }),
1599
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-description", children: "Use any Solana Pay compatible wallet to scan and confirm." })
1943
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Scan with Solana Pay" }),
1944
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Use any Solana Pay compatible wallet to scan and confirm." })
1600
1945
  ] }),
1601
1946
  /* @__PURE__ */ jsxRuntime.jsx(
1602
- "button",
1947
+ Button,
1603
1948
  {
1604
1949
  type: "button",
1605
- className: "payments-ui-icon-button",
1950
+ variant: "outline",
1951
+ size: "icon",
1606
1952
  onClick: () => refresh(),
1607
1953
  disabled: isLoading,
1608
- children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "payments-ui-icon" })
1954
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "h-4 w-4" })
1609
1955
  }
1610
1956
  )
1611
1957
  ] }),
1612
- error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-error", children: error }),
1613
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-qr-wrapper", children: qrDataUri ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: qrDataUri, alt: "Solana Pay QR" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-empty", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1614
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }),
1615
- "Generating QR code..."
1958
+ error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-4 py-2 text-sm text-destructive", children: error }),
1959
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed border-border/70 bg-muted/5 p-6", children: qrDataUri ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: qrDataUri, alt: "Solana Pay QR", className: "h-72 w-72 rounded-lg border border-border/40 bg-card" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center gap-2 text-sm text-muted-foreground", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1960
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin" }),
1961
+ " Generating QR code\u2026"
1616
1962
  ] }) : "QR code unavailable" }) }),
1617
- intent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-countdown", children: [
1963
+ intent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center text-sm text-muted-foreground", children: [
1618
1964
  "Expires in ",
1619
1965
  timeRemaining,
1620
1966
  "s \xB7 ",
@@ -1628,67 +1974,68 @@ var PaymentStatus = ({
1628
1974
  state,
1629
1975
  usdAmount,
1630
1976
  solAmount,
1631
- errorMessage,
1632
1977
  transactionId,
1978
+ errorMessage,
1633
1979
  onRetry,
1634
1980
  onClose
1635
1981
  }) => {
1982
+ if (state === "processing" || state === "confirming") {
1983
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
1984
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-10 w-10 animate-spin text-primary" }),
1985
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1986
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: state === "processing" ? "Processing payment\u2026" : "Awaiting confirmation\u2026" }),
1987
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
1988
+ "$",
1989
+ usdAmount.toFixed(2),
1990
+ " ",
1991
+ solAmount ? `\xB7 \u2248 ${solAmount.toFixed(4)} SOL` : ""
1992
+ ] })
1993
+ ] })
1994
+ ] });
1995
+ }
1636
1996
  if (state === "success") {
1637
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-status success", children: [
1638
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle, { className: "payments-ui-status-icon" }),
1639
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Payment confirmed" }),
1640
- /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
1641
- usdAmount.toFixed(2),
1642
- " USD (~",
1643
- solAmount.toFixed(4),
1644
- " SOL)."
1645
- ] }),
1646
- transactionId && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-status-meta", children: [
1647
- "Txn: ",
1648
- transactionId
1997
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [
1998
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle, { className: "h-12 w-12 text-primary" }),
1999
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2000
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: "Payment complete" }),
2001
+ transactionId && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
2002
+ "Txn: ",
2003
+ transactionId
2004
+ ] })
1649
2005
  ] }),
1650
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "payments-ui-button", type: "button", onClick: onClose, children: "Close" })
2006
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: onClose, className: "w-full", children: "Close" })
1651
2007
  ] });
1652
2008
  }
1653
2009
  if (state === "error") {
1654
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-status error", children: [
1655
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "payments-ui-status-icon" }),
1656
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Payment failed" }),
1657
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: errorMessage ?? "Please try again." }),
1658
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-status-actions", children: [
1659
- /* @__PURE__ */ jsxRuntime.jsxs("button", { className: "payments-ui-button", type: "button", onClick: onRetry, children: [
1660
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "payments-ui-icon" }),
1661
- " Retry"
2010
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [
2011
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-12 w-12 text-destructive" }),
2012
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2013
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: "Payment failed" }),
2014
+ errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
2015
+ ] }),
2016
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-2 sm:flex-row", children: [
2017
+ onRetry && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "secondary", className: "flex-1", onClick: onRetry, children: [
2018
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "mr-2 h-4 w-4" }),
2019
+ " Try again"
1662
2020
  ] }),
1663
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "payments-ui-text-button", type: "button", onClick: onClose, children: "Cancel" })
2021
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { className: "flex-1", onClick: onClose, children: "Close" })
1664
2022
  ] })
1665
2023
  ] });
1666
2024
  }
1667
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-status pending", children: [
1668
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }),
1669
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: state === "confirming" ? "Waiting for confirmations" : "Processing payment" }),
1670
- /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
1671
- "Paying ",
1672
- usdAmount.toFixed(2),
1673
- " USD (~",
1674
- solAmount.toFixed(4),
1675
- " SOL)."
1676
- ] }),
1677
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-status-meta", children: "This can take up to 60 seconds on Solana mainnet." })
1678
- ] });
2025
+ return null;
1679
2026
  };
1680
2027
  var useSupportedTokens = () => {
1681
2028
  const solanaService = useSolanaService();
1682
- const [tokens, setTokens] = react.useState([]);
1683
- const [isLoading, setIsLoading] = react.useState(false);
1684
- const [error, setError] = react.useState(null);
1685
- const [lastFetched, setLastFetched] = react.useState(null);
2029
+ const [tokens, setTokens] = React3.useState([]);
2030
+ const [isLoading, setIsLoading] = React3.useState(false);
2031
+ const [error, setError] = React3.useState(null);
2032
+ const [lastFetched, setLastFetched] = React3.useState(null);
1686
2033
  const CACHE_DURATION = 5 * 60 * 1e3;
1687
- const tokensRef = react.useRef(tokens);
1688
- const lastFetchedRef = react.useRef(lastFetched);
2034
+ const tokensRef = React3.useRef(tokens);
2035
+ const lastFetchedRef = React3.useRef(lastFetched);
1689
2036
  tokensRef.current = tokens;
1690
2037
  lastFetchedRef.current = lastFetched;
1691
- const fetchSupportedTokens = react.useCallback(async () => {
2038
+ const fetchSupportedTokens = React3.useCallback(async () => {
1692
2039
  if (tokensRef.current.length > 0 && lastFetchedRef.current && Date.now() - lastFetchedRef.current < CACHE_DURATION) {
1693
2040
  return tokensRef.current;
1694
2041
  }
@@ -1711,50 +2058,50 @@ var useSupportedTokens = () => {
1711
2058
  setIsLoading(false);
1712
2059
  }
1713
2060
  }, [solanaService]);
1714
- react.useEffect(() => {
2061
+ React3.useEffect(() => {
1715
2062
  if (tokens.length === 0) {
1716
2063
  fetchSupportedTokens();
1717
2064
  }
1718
2065
  }, [tokens.length, fetchSupportedTokens]);
1719
- const getTokenBySymbol = react.useCallback(
2066
+ const getTokenBySymbol = React3.useCallback(
1720
2067
  (symbol) => {
1721
2068
  return tokens.find((token) => token.symbol === symbol);
1722
2069
  },
1723
2070
  [tokens]
1724
2071
  );
1725
- const getTokenByMint = react.useCallback(
2072
+ const getTokenByMint = React3.useCallback(
1726
2073
  (mintAddress) => {
1727
2074
  return tokens.find((token) => token.mint === mintAddress);
1728
2075
  },
1729
2076
  [tokens]
1730
2077
  );
1731
- const isTokenSupported = react.useCallback(
2078
+ const isTokenSupported = React3.useCallback(
1732
2079
  (symbol) => {
1733
2080
  return tokens.some((token) => token.symbol === symbol);
1734
2081
  },
1735
2082
  [tokens]
1736
2083
  );
1737
- const getUSDCToken = react.useCallback(() => {
2084
+ const getUSDCToken = React3.useCallback(() => {
1738
2085
  return getTokenBySymbol("USDC");
1739
2086
  }, [getTokenBySymbol]);
1740
- const getPYUSDToken = react.useCallback(() => {
2087
+ const getPYUSDToken = React3.useCallback(() => {
1741
2088
  return getTokenBySymbol("PYUSD");
1742
2089
  }, [getTokenBySymbol]);
1743
- const getSOLToken = react.useCallback(() => {
2090
+ const getSOLToken = React3.useCallback(() => {
1744
2091
  return getTokenBySymbol("SOL");
1745
2092
  }, [getTokenBySymbol]);
1746
- const getStablecoins = react.useCallback(() => {
2093
+ const getStablecoins = React3.useCallback(() => {
1747
2094
  return tokens.filter((token) => ["USDC", "PYUSD"].includes(token.symbol));
1748
2095
  }, [tokens]);
1749
- const refreshTokens = react.useCallback(async () => {
2096
+ const refreshTokens = React3.useCallback(async () => {
1750
2097
  setLastFetched(null);
1751
2098
  return await fetchSupportedTokens();
1752
2099
  }, [fetchSupportedTokens]);
1753
- const isCacheStale = react.useCallback(() => {
2100
+ const isCacheStale = React3.useCallback(() => {
1754
2101
  if (!lastFetched) return true;
1755
2102
  return Date.now() - lastFetched > CACHE_DURATION;
1756
2103
  }, [lastFetched]);
1757
- const getTokenDisplayInfo = react.useCallback((token) => {
2104
+ const getTokenDisplayInfo = React3.useCallback((token) => {
1758
2105
  return {
1759
2106
  ...token,
1760
2107
  displayName: `${token.name} (${token.symbol})`,
@@ -1762,7 +2109,7 @@ var useSupportedTokens = () => {
1762
2109
  decimalPlaces: token.decimals
1763
2110
  };
1764
2111
  }, []);
1765
- const getTokenPrice = react.useCallback(
2112
+ const getTokenPrice = React3.useCallback(
1766
2113
  (symbol) => {
1767
2114
  const token = getTokenBySymbol(symbol);
1768
2115
  if (!token) return 0;
@@ -1771,7 +2118,7 @@ var useSupportedTokens = () => {
1771
2118
  },
1772
2119
  [getTokenBySymbol]
1773
2120
  );
1774
- const calculateTokenAmount = react.useCallback(
2121
+ const calculateTokenAmount = React3.useCallback(
1775
2122
  (usdAmount, tokenSymbol) => {
1776
2123
  const token = getTokenBySymbol(tokenSymbol);
1777
2124
  const price = getTokenPrice(tokenSymbol);
@@ -1782,7 +2129,7 @@ var useSupportedTokens = () => {
1782
2129
  },
1783
2130
  [getTokenBySymbol, getTokenPrice]
1784
2131
  );
1785
- const formatTokenAmount = react.useCallback(
2132
+ const formatTokenAmount = React3.useCallback(
1786
2133
  (amount, tokenSymbol) => {
1787
2134
  const token = getTokenBySymbol(tokenSymbol);
1788
2135
  if (!token) return "0";
@@ -1855,6 +2202,43 @@ var selectSolanaFlow = (state) => ({
1855
2202
  failSolanaPayment: state.failSolanaPayment,
1856
2203
  resetSolanaPayment: state.resetSolanaPayment
1857
2204
  });
2205
+ var Tabs = TabsPrimitive__namespace.Root;
2206
+ var TabsList = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2207
+ TabsPrimitive__namespace.List,
2208
+ {
2209
+ ref,
2210
+ className: cn(
2211
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
2212
+ className
2213
+ ),
2214
+ ...props
2215
+ }
2216
+ ));
2217
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
2218
+ var TabsTrigger = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2219
+ TabsPrimitive__namespace.Trigger,
2220
+ {
2221
+ ref,
2222
+ className: cn(
2223
+ "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
2224
+ className
2225
+ ),
2226
+ ...props
2227
+ }
2228
+ ));
2229
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
2230
+ var TabsContent = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2231
+ TabsPrimitive__namespace.Content,
2232
+ {
2233
+ ref,
2234
+ className: cn(
2235
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
2236
+ className
2237
+ ),
2238
+ ...props
2239
+ }
2240
+ ));
2241
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1858
2242
  var SolanaPaymentSelector = ({
1859
2243
  isOpen,
1860
2244
  onClose,
@@ -1886,24 +2270,24 @@ var SolanaPaymentSelector = ({
1886
2270
  isLoading: tokensLoading,
1887
2271
  error: tokensError
1888
2272
  } = useSupportedTokens();
1889
- const selectedToken = react.useMemo(() => {
2273
+ const selectedToken = React3.useMemo(() => {
1890
2274
  if (!tokens.length) return null;
1891
2275
  const explicit = tokens.find((token) => token.symbol === selectedTokenSymbol);
1892
2276
  return explicit || tokens[0];
1893
2277
  }, [tokens, selectedTokenSymbol]);
1894
- react.useEffect(() => {
2278
+ React3.useEffect(() => {
1895
2279
  if (!selectedTokenSymbol && tokens.length) {
1896
2280
  const defaultToken = tokens.find((token) => token.symbol === "SOL") || tokens[0];
1897
2281
  setSelectedTokenSymbol(defaultToken.symbol);
1898
2282
  }
1899
2283
  }, [tokens, selectedTokenSymbol, setSelectedTokenSymbol]);
1900
- const handlePaymentStart = react.useCallback(() => {
2284
+ const handlePaymentStart = React3.useCallback(() => {
1901
2285
  startSolanaPayment();
1902
2286
  }, [startSolanaPayment]);
1903
- const handlePaymentConfirming = react.useCallback(() => {
2287
+ const handlePaymentConfirming = React3.useCallback(() => {
1904
2288
  confirmSolanaPayment();
1905
2289
  }, [confirmSolanaPayment]);
1906
- const handlePaymentSuccess = react.useCallback(
2290
+ const handlePaymentSuccess = React3.useCallback(
1907
2291
  (result, txId) => {
1908
2292
  const resolvedTx = txId || (typeof result === "string" ? result : result.transaction_id);
1909
2293
  setTransactionId(resolvedTx);
@@ -1929,18 +2313,18 @@ var SolanaPaymentSelector = ({
1929
2313
  },
1930
2314
  [completeSolanaPayment, onSuccess, setTransactionId]
1931
2315
  );
1932
- const handlePaymentError = react.useCallback(
2316
+ const handlePaymentError = React3.useCallback(
1933
2317
  (error) => {
1934
2318
  failSolanaPayment(error);
1935
2319
  onError?.(error);
1936
2320
  },
1937
2321
  [failSolanaPayment, onError]
1938
2322
  );
1939
- const handleRetry = react.useCallback(() => {
2323
+ const handleRetry = React3.useCallback(() => {
1940
2324
  resetSolanaPayment();
1941
2325
  setTransactionId(null);
1942
2326
  }, [resetSolanaPayment, setTransactionId]);
1943
- const handleClose = react.useCallback(() => {
2327
+ const handleClose = React3.useCallback(() => {
1944
2328
  if (paymentState === "processing" || paymentState === "confirming") {
1945
2329
  return;
1946
2330
  }
@@ -1948,7 +2332,7 @@ var SolanaPaymentSelector = ({
1948
2332
  setTransactionId(null);
1949
2333
  onClose();
1950
2334
  }, [paymentState, resetSolanaPayment, setTransactionId, onClose]);
1951
- react.useEffect(() => {
2335
+ React3.useEffect(() => {
1952
2336
  if (!isOpen || !selectedToken || usdAmount === 0) {
1953
2337
  setTokenAmount(0);
1954
2338
  return;
@@ -1960,14 +2344,14 @@ var SolanaPaymentSelector = ({
1960
2344
  }
1961
2345
  setTokenAmount(usdAmount / price);
1962
2346
  }, [isOpen, usdAmount, selectedToken, setTokenAmount]);
1963
- const handleTokenChange = react.useCallback(
1964
- (event) => {
1965
- setSelectedTokenSymbol(event.target.value);
2347
+ const handleTokenChange = React3.useCallback(
2348
+ (value) => {
2349
+ setSelectedTokenSymbol(value);
1966
2350
  },
1967
2351
  [setSelectedTokenSymbol]
1968
2352
  );
1969
- const wasConnectedRef = react.useRef(connected);
1970
- react.useEffect(() => {
2353
+ const wasConnectedRef = React3.useRef(connected);
2354
+ React3.useEffect(() => {
1971
2355
  if (connected && !wasConnectedRef.current) {
1972
2356
  setTab("wallet");
1973
2357
  }
@@ -1976,124 +2360,98 @@ var SolanaPaymentSelector = ({
1976
2360
  }
1977
2361
  wasConnectedRef.current = connected;
1978
2362
  }, [connected, setTab]);
1979
- const renderSelector = () => {
1980
- if (tokensLoading) {
1981
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-empty", children: [
1982
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }),
1983
- " Loading tokens\u2026"
1984
- ] });
1985
- }
1986
- if (tokensError) {
1987
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-error", children: tokensError });
1988
- }
1989
- if (!tokens.length) {
1990
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-empty", children: "No payment tokens available." });
2363
+ const renderBody = () => {
2364
+ if (paymentState !== "selecting") {
2365
+ return /* @__PURE__ */ jsxRuntime.jsx(
2366
+ PaymentStatus,
2367
+ {
2368
+ state: paymentState,
2369
+ usdAmount,
2370
+ solAmount: tokenAmount,
2371
+ onRetry: handleRetry,
2372
+ onClose: handleClose,
2373
+ errorMessage,
2374
+ transactionId
2375
+ }
2376
+ );
1991
2377
  }
1992
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-token-select", children: [
1993
- /* @__PURE__ */ jsxRuntime.jsxs("label", { children: [
1994
- "Payment token",
1995
- /* @__PURE__ */ jsxRuntime.jsx("select", { value: selectedTokenSymbol ?? "", onChange: handleTokenChange, children: tokens.map((token) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: token.symbol, children: [
2378
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-6", children: tokensLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center rounded-lg border border-dashed border-border/60 bg-muted/10 py-8 text-sm text-muted-foreground", children: [
2379
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
2380
+ " Loading supported tokens\u2026"
2381
+ ] }) : tokensError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: tokensError }) : !tokens.length ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-lg border border-dashed border-border/60 bg-muted/10 px-4 py-6 text-sm text-muted-foreground", children: "No payment tokens available." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2382
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border/60 bg-muted/10 p-4 text-center", children: [
2383
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-2xl font-semibold text-foreground", children: [
2384
+ "$",
2385
+ usdAmount.toFixed(2),
2386
+ " USD"
2387
+ ] }),
2388
+ selectedToken && tokenAmount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
2389
+ "\u2248 ",
2390
+ tokenAmount.toFixed(selectedToken.symbol === "SOL" ? 4 : 2),
2391
+ " ",
2392
+ selectedToken.symbol
2393
+ ] })
2394
+ ] }),
2395
+ /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: selectedToken?.symbol ?? "", onValueChange: handleTokenChange, children: [
2396
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select token" }) }),
2397
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "max-h-64", children: tokens.map((token) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: token.symbol, children: [
1996
2398
  token.name,
1997
2399
  " (",
1998
2400
  token.symbol,
1999
2401
  ")"
2000
2402
  ] }, token.symbol)) })
2001
2403
  ] }),
2002
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-token-meta", children: [
2003
- "\u2248 ",
2004
- tokenAmount.toFixed(4),
2005
- " ",
2006
- selectedToken?.symbol
2007
- ] })
2008
- ] });
2009
- };
2010
- if (paymentState !== "selecting") {
2011
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Portal, { children: [
2012
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Overlay, { className: "payments-ui-modal-overlay" }),
2013
- /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Content, { className: "payments-ui-modal", children: [
2014
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-modal-header", children: [
2015
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2016
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Complete your payment" }),
2017
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Follow the prompts below to finish." })
2018
- ] }),
2019
- /* @__PURE__ */ jsxRuntime.jsx(
2020
- Dialog2__namespace.Close,
2021
- {
2022
- className: "payments-ui-icon-button",
2023
- disabled: paymentState === "processing" || paymentState === "confirming",
2024
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "payments-ui-icon" })
2025
- }
2026
- )
2027
- ] }),
2028
- /* @__PURE__ */ jsxRuntime.jsx(
2029
- PaymentStatus,
2030
- {
2031
- state: paymentState,
2032
- usdAmount,
2033
- solAmount: tokenAmount,
2034
- onRetry: handleRetry,
2035
- onClose: handleClose,
2036
- errorMessage,
2037
- transactionId
2038
- }
2039
- )
2040
- ] })
2041
- ] }) });
2042
- }
2043
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Root, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Portal, { children: [
2044
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Overlay, { className: "payments-ui-modal-overlay" }),
2045
- /* @__PURE__ */ jsxRuntime.jsxs(Dialog2__namespace.Content, { className: "payments-ui-modal", children: [
2046
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-modal-header", children: [
2047
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2048
- /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "Complete your payment" }),
2049
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Select a token and preferred method." })
2050
- ] }),
2051
- /* @__PURE__ */ jsxRuntime.jsx(Dialog2__namespace.Close, { className: "payments-ui-icon-button", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "payments-ui-icon" }) })
2052
- ] }),
2053
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-tab-header", children: [
2054
- /* @__PURE__ */ jsxRuntime.jsx(
2055
- "button",
2056
- {
2057
- type: "button",
2058
- className: activeTab === "wallet" ? "active" : "",
2059
- onClick: () => setTab("wallet"),
2060
- disabled: !connected,
2061
- children: "Pay with wallet"
2062
- }
2063
- ),
2064
- /* @__PURE__ */ jsxRuntime.jsx(
2065
- "button",
2066
- {
2067
- type: "button",
2068
- className: activeTab === "qr" ? "active" : "",
2069
- onClick: () => setTab("qr"),
2070
- children: "Scan QR"
2071
- }
2072
- )
2073
- ] }),
2074
- renderSelector(),
2075
- activeTab === "wallet" ? /* @__PURE__ */ jsxRuntime.jsx(
2076
- DirectPayment,
2077
- {
2078
- priceId,
2079
- tokenAmount,
2080
- selectedToken,
2081
- supportedTokens: tokens,
2082
- onPaymentStart: handlePaymentStart,
2083
- onPaymentConfirming: handlePaymentConfirming,
2084
- onPaymentSuccess: handlePaymentSuccess,
2085
- onPaymentError: handlePaymentError
2086
- }
2087
- ) : /* @__PURE__ */ jsxRuntime.jsx(
2088
- QRCodePayment,
2404
+ /* @__PURE__ */ jsxRuntime.jsxs(
2405
+ Tabs,
2089
2406
  {
2090
- priceId,
2091
- selectedToken,
2092
- onPaymentError: handlePaymentError,
2093
- onPaymentSuccess: handlePaymentSuccess
2407
+ value: activeTab,
2408
+ onValueChange: (value) => setTab(value),
2409
+ className: "w-full",
2410
+ children: [
2411
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-2 bg-muted/20", children: [
2412
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsTrigger, { value: "wallet", disabled: !connected, children: [
2413
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "mr-2 h-4 w-4" }),
2414
+ " Pay with Wallet"
2415
+ ] }),
2416
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsTrigger, { value: "qr", children: [
2417
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
2418
+ " Scan QR Code"
2419
+ ] })
2420
+ ] }),
2421
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "wallet", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2422
+ DirectPayment,
2423
+ {
2424
+ priceId,
2425
+ tokenAmount,
2426
+ selectedToken,
2427
+ supportedTokens: tokens,
2428
+ onPaymentStart: handlePaymentStart,
2429
+ onPaymentConfirming: handlePaymentConfirming,
2430
+ onPaymentSuccess: handlePaymentSuccess,
2431
+ onPaymentError: handlePaymentError
2432
+ }
2433
+ ) }),
2434
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "qr", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2435
+ QRCodePayment,
2436
+ {
2437
+ priceId,
2438
+ selectedToken,
2439
+ onPaymentError: handlePaymentError,
2440
+ onPaymentSuccess: handlePaymentSuccess
2441
+ }
2442
+ ) })
2443
+ ]
2094
2444
  }
2095
- )
2096
- ] })
2445
+ ),
2446
+ !connected && activeTab === "wallet" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-xl border border-amber-500/40 bg-amber-500/10 p-4 text-sm text-amber-100", children: "Please connect your Solana wallet to complete this payment, or switch to QR mode." })
2447
+ ] }) });
2448
+ };
2449
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-lg", children: [
2450
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "space-y-1", children: [
2451
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Complete your payment" }),
2452
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: "Select a token and preferred method. We\u2019ll guide you through the rest." })
2453
+ ] }),
2454
+ renderBody()
2097
2455
  ] }) });
2098
2456
  };
2099
2457
  var PaymentExperience = ({
@@ -2156,81 +2514,74 @@ var PaymentExperience = ({
2156
2514
  failSavedPayment(message);
2157
2515
  }
2158
2516
  };
2159
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-experience", children: [
2160
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "payments-ui-experience-header", children: [
2161
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2162
- /* @__PURE__ */ jsxRuntime.jsxs("h2", { children: [
2163
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "payments-ui-icon" }),
2164
- " Secure checkout"
2517
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-8", children: [
2518
+ /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card/95", children: [
2519
+ /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
2520
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2521
+ /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { className: "flex items-center gap-2 text-lg text-foreground", children: [
2522
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-5 w-5 text-primary" }),
2523
+ " Secure checkout"
2524
+ ] }),
2525
+ /* @__PURE__ */ jsxRuntime.jsxs(CardDescription, { children: [
2526
+ "Amount due: $",
2527
+ usdAmount.toFixed(2)
2528
+ ] })
2165
2529
  ] }),
2166
- /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
2167
- "Amount due: $",
2168
- usdAmount.toFixed(2)
2169
- ] })
2530
+ checkoutSummary && /* @__PURE__ */ jsxRuntime.jsx("div", { children: checkoutSummary })
2170
2531
  ] }),
2171
- checkoutSummary && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-summary", children: checkoutSummary })
2172
- ] }),
2173
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-experience-grid", children: [
2174
- showStored && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-column", children: [
2175
- /* @__PURE__ */ jsxRuntime.jsx(
2176
- StoredPaymentMethods,
2177
- {
2178
- selectedMethodId,
2179
- onMethodSelect: handleMethodSelect,
2180
- heading: "Saved cards",
2181
- description: "Use or manage your saved payment methods."
2182
- }
2183
- ),
2184
- onSavedMethodPayment && /* @__PURE__ */ jsxRuntime.jsx(
2185
- "button",
2186
- {
2187
- type: "button",
2188
- className: "payments-ui-button",
2189
- disabled: !selectedMethodId || savedStatus === "processing",
2190
- onClick: handleSavedPayment,
2191
- children: savedStatus === "processing" ? "Processing\u2026" : "Pay with selected card"
2192
- }
2193
- ),
2194
- savedError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-error", children: savedError })
2195
- ] }),
2196
- showNewCard && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-column", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel", children: [
2197
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-panel-header", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2198
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "payments-ui-panel-title", children: [
2199
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "payments-ui-icon" }),
2200
- " Pay with a new card"
2532
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-8 lg:grid-cols-2", children: [
2533
+ showStored && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2534
+ /* @__PURE__ */ jsxRuntime.jsx(
2535
+ StoredPaymentMethods,
2536
+ {
2537
+ selectedMethodId,
2538
+ onMethodSelect: handleMethodSelect,
2539
+ heading: "Saved cards",
2540
+ description: "Use or manage your saved payment methods."
2541
+ }
2542
+ ),
2543
+ onSavedMethodPayment && /* @__PURE__ */ jsxRuntime.jsx(
2544
+ Button,
2545
+ {
2546
+ className: "w-full",
2547
+ disabled: !selectedMethodId || savedStatus === "processing",
2548
+ onClick: handleSavedPayment,
2549
+ children: savedStatus === "processing" ? "Processing\u2026" : "Pay with selected card"
2550
+ }
2551
+ ),
2552
+ savedError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: savedError })
2553
+ ] }),
2554
+ showNewCard && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-2xl border border-border/60 bg-background/80 p-6", children: [
2555
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 space-y-1", children: [
2556
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: [
2557
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-4 w-4" }),
2558
+ " Pay with a new card"
2559
+ ] }),
2560
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Card details are tokenized via Collect.js and never hit your server." })
2201
2561
  ] }),
2202
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-description", children: "Card details are tokenized via Collect.js and never hit your server." })
2203
- ] }) }),
2204
- /* @__PURE__ */ jsxRuntime.jsx(
2205
- CardDetailsForm,
2206
- {
2207
- visible: true,
2208
- submitLabel: "Pay now",
2209
- submitting: newCardStatus === "processing",
2210
- externalError: newCardError,
2211
- onTokenize: handleNewCardTokenize
2212
- }
2213
- )
2562
+ /* @__PURE__ */ jsxRuntime.jsx(
2563
+ CardDetailsForm,
2564
+ {
2565
+ visible: true,
2566
+ submitLabel: "Pay now",
2567
+ submitting: newCardStatus === "processing",
2568
+ externalError: newCardError,
2569
+ onTokenize: handleNewCardTokenize
2570
+ }
2571
+ )
2572
+ ] }) })
2214
2573
  ] }) })
2215
2574
  ] }),
2216
- enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-solana-banner", children: [
2575
+ enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsx(Card, { className: "border border-primary/40 bg-primary/5", children: /* @__PURE__ */ jsxRuntime.jsxs(CardContent, { className: "flex flex-col gap-4 text-sm text-primary md:flex-row md:items-center md:justify-between", children: [
2217
2576
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2218
- /* @__PURE__ */ jsxRuntime.jsxs("h3", { children: [
2219
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "payments-ui-icon" }),
2577
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-base font-semibold text-primary", children: [
2578
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-4 w-4" }),
2220
2579
  " Prefer Solana Pay?"
2221
2580
  ] }),
2222
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Use a Solana wallet or QR code for instant settlement." })
2581
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-primary/80", children: "Use a Solana wallet or QR code for instant settlement." })
2223
2582
  ] }),
2224
- /* @__PURE__ */ jsxRuntime.jsx(
2225
- "button",
2226
- {
2227
- type: "button",
2228
- className: "payments-ui-button",
2229
- onClick: () => setSolanaModalOpen(true),
2230
- children: "Open Solana Pay"
2231
- }
2232
- )
2233
- ] }),
2583
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setSolanaModalOpen(true), children: "Open Solana Pay" })
2584
+ ] }) }),
2234
2585
  enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsx(
2235
2586
  SolanaPaymentSelector,
2236
2587
  {
@@ -2250,10 +2601,10 @@ var PaymentExperience = ({
2250
2601
  var useTokenBalance = (tokens) => {
2251
2602
  const { publicKey } = walletAdapterReact.useWallet();
2252
2603
  const { connection } = walletAdapterReact.useConnection();
2253
- const [balances, setBalances] = react.useState([]);
2254
- const [isLoading, setIsLoading] = react.useState(false);
2255
- const [error, setError] = react.useState(null);
2256
- const fetchTokenBalance = react.useCallback(
2604
+ const [balances, setBalances] = React3.useState([]);
2605
+ const [isLoading, setIsLoading] = React3.useState(false);
2606
+ const [error, setError] = React3.useState(null);
2607
+ const fetchTokenBalance = React3.useCallback(
2257
2608
  async (token, walletAddress) => {
2258
2609
  try {
2259
2610
  const mintPublicKey = new web3_js.PublicKey(token.mint);
@@ -2294,8 +2645,8 @@ var useTokenBalance = (tokens) => {
2294
2645
  },
2295
2646
  [connection]
2296
2647
  );
2297
- const tokensKey = react.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
2298
- react.useEffect(() => {
2648
+ const tokensKey = React3.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
2649
+ React3.useEffect(() => {
2299
2650
  if (!publicKey || tokens.length === 0) {
2300
2651
  setBalances([]);
2301
2652
  return;
@@ -2319,20 +2670,20 @@ var useTokenBalance = (tokens) => {
2319
2670
  };
2320
2671
  fetchAllBalances();
2321
2672
  }, [publicKey, tokensKey, fetchTokenBalance]);
2322
- const getTokenBalance = react.useCallback(
2673
+ const getTokenBalance = React3.useCallback(
2323
2674
  (tokenSymbol) => {
2324
2675
  return balances.find((balance) => balance.token.symbol === tokenSymbol);
2325
2676
  },
2326
2677
  [balances]
2327
2678
  );
2328
- const hasSufficientBalance2 = react.useCallback(
2679
+ const hasSufficientBalance2 = React3.useCallback(
2329
2680
  (tokenSymbol, requiredAmount) => {
2330
2681
  const balance = getTokenBalance(tokenSymbol);
2331
2682
  return balance ? balance.uiAmount >= requiredAmount : false;
2332
2683
  },
2333
2684
  [getTokenBalance]
2334
2685
  );
2335
- const getFormattedBalance = react.useCallback(
2686
+ const getFormattedBalance = React3.useCallback(
2336
2687
  (tokenSymbol) => {
2337
2688
  const balance = getTokenBalance(tokenSymbol);
2338
2689
  if (!balance) return "0.00";
@@ -2346,7 +2697,7 @@ var useTokenBalance = (tokens) => {
2346
2697
  },
2347
2698
  [getTokenBalance]
2348
2699
  );
2349
- const refreshBalances = react.useCallback(async () => {
2700
+ const refreshBalances = React3.useCallback(async () => {
2350
2701
  if (!publicKey || tokens.length === 0) {
2351
2702
  setBalances([]);
2352
2703
  return;
@@ -2367,7 +2718,7 @@ var useTokenBalance = (tokens) => {
2367
2718
  setIsLoading(false);
2368
2719
  }
2369
2720
  }, [publicKey, tokens, fetchTokenBalance]);
2370
- const getTotalValue = react.useCallback(
2721
+ const getTotalValue = React3.useCallback(
2371
2722
  (priceData) => {
2372
2723
  if (!priceData) return 0;
2373
2724
  return balances.reduce((total, balance) => {
@@ -2396,13 +2747,13 @@ var useTokenBalance = (tokens) => {
2396
2747
  var useDirectWalletPayment = () => {
2397
2748
  const { publicKey, signTransaction, connected } = walletAdapterReact.useWallet();
2398
2749
  const solanaService = useSolanaService();
2399
- const [paymentState, setPaymentState] = react.useState({
2750
+ const [paymentState, setPaymentState] = React3.useState({
2400
2751
  loading: false,
2401
2752
  error: null,
2402
2753
  success: false,
2403
2754
  transactionId: null
2404
2755
  });
2405
- const resetPayment = react.useCallback(() => {
2756
+ const resetPayment = React3.useCallback(() => {
2406
2757
  setPaymentState({
2407
2758
  loading: false,
2408
2759
  error: null,
@@ -2410,7 +2761,7 @@ var useDirectWalletPayment = () => {
2410
2761
  transactionId: null
2411
2762
  });
2412
2763
  }, []);
2413
- const payWithWallet = react.useCallback(
2764
+ const payWithWallet = React3.useCallback(
2414
2765
  async (token, priceId) => {
2415
2766
  if (!connected || !publicKey || !signTransaction) {
2416
2767
  setPaymentState((prev) => ({
@@ -2496,21 +2847,21 @@ var usePaymentStatus = (options = {}) => {
2496
2847
  retryInterval = 1e4
2497
2848
  // 10 seconds
2498
2849
  } = options;
2499
- const [status, setStatus] = react.useState(null);
2500
- const [paymentStatus, setPaymentStatus] = react.useState(null);
2501
- const [isLoading, setIsLoading] = react.useState(false);
2502
- const [error, setError] = react.useState(null);
2503
- const [retryCount, setRetryCount] = react.useState(0);
2504
- const intervalRef = react.useRef(null);
2505
- const isMonitoringRef = react.useRef(false);
2506
- react.useEffect(() => {
2850
+ const [status, setStatus] = React3.useState(null);
2851
+ const [paymentStatus, setPaymentStatus] = React3.useState(null);
2852
+ const [isLoading, setIsLoading] = React3.useState(false);
2853
+ const [error, setError] = React3.useState(null);
2854
+ const [retryCount, setRetryCount] = React3.useState(0);
2855
+ const intervalRef = React3.useRef(null);
2856
+ const isMonitoringRef = React3.useRef(false);
2857
+ React3.useEffect(() => {
2507
2858
  return () => {
2508
2859
  if (intervalRef.current) {
2509
2860
  clearInterval(intervalRef.current);
2510
2861
  }
2511
2862
  };
2512
2863
  }, []);
2513
- const checkTransactionStatus = react.useCallback(
2864
+ const checkTransactionStatus = React3.useCallback(
2514
2865
  async (signature) => {
2515
2866
  try {
2516
2867
  const statusResponse = await connection.getSignatureStatus(signature, {
@@ -2552,7 +2903,7 @@ var usePaymentStatus = (options = {}) => {
2552
2903
  },
2553
2904
  [connection]
2554
2905
  );
2555
- const checkPaymentStatus = react.useCallback(
2906
+ const checkPaymentStatus = React3.useCallback(
2556
2907
  async (id) => {
2557
2908
  try {
2558
2909
  const data = await billingApi.get(
@@ -2569,7 +2920,7 @@ var usePaymentStatus = (options = {}) => {
2569
2920
  },
2570
2921
  [billingApi]
2571
2922
  );
2572
- const startMonitoring = react.useCallback(async () => {
2923
+ const startMonitoring = React3.useCallback(async () => {
2573
2924
  if (isMonitoringRef.current || !transactionId && !purchaseId) {
2574
2925
  return;
2575
2926
  }
@@ -2653,14 +3004,14 @@ var usePaymentStatus = (options = {}) => {
2653
3004
  retryInterval,
2654
3005
  retryCount
2655
3006
  ]);
2656
- const stopMonitoring = react.useCallback(() => {
3007
+ const stopMonitoring = React3.useCallback(() => {
2657
3008
  if (intervalRef.current) {
2658
3009
  clearInterval(intervalRef.current);
2659
3010
  }
2660
3011
  isMonitoringRef.current = false;
2661
3012
  setIsLoading(false);
2662
3013
  }, []);
2663
- const checkStatus = react.useCallback(async () => {
3014
+ const checkStatus = React3.useCallback(async () => {
2664
3015
  if (!transactionId && !purchaseId) return;
2665
3016
  setIsLoading(true);
2666
3017
  setError(null);
@@ -2680,7 +3031,7 @@ var usePaymentStatus = (options = {}) => {
2680
3031
  setIsLoading(false);
2681
3032
  }
2682
3033
  }, [transactionId, purchaseId, checkTransactionStatus, checkPaymentStatus]);
2683
- react.useEffect(() => {
3034
+ React3.useEffect(() => {
2684
3035
  if ((transactionId || purchaseId) && !isMonitoringRef.current) {
2685
3036
  startMonitoring();
2686
3037
  }
@@ -2688,7 +3039,7 @@ var usePaymentStatus = (options = {}) => {
2688
3039
  stopMonitoring();
2689
3040
  };
2690
3041
  }, [transactionId, purchaseId, startMonitoring, stopMonitoring]);
2691
- const getConfirmationStatus = react.useCallback(() => {
3042
+ const getConfirmationStatus = React3.useCallback(() => {
2692
3043
  if (paymentStatus?.status === "confirmed") return "confirmed";
2693
3044
  if (paymentStatus?.status === "failed") return "failed";
2694
3045
  if (status?.confirmationStatus === "finalized") return "confirmed";
@@ -2697,7 +3048,7 @@ var usePaymentStatus = (options = {}) => {
2697
3048
  return "failed";
2698
3049
  return "pending";
2699
3050
  }, [status, paymentStatus]);
2700
- const getSolscanUrl = react.useCallback(
3051
+ const getSolscanUrl = React3.useCallback(
2701
3052
  (signature) => {
2702
3053
  const txId = signature || transactionId;
2703
3054
  if (!txId) return null;
@@ -2731,7 +3082,7 @@ var useSubscriptionActions = () => {
2731
3082
  }
2732
3083
  return priceId;
2733
3084
  };
2734
- const subscribeWithCard = react.useCallback(
3085
+ const subscribeWithCard = React3.useCallback(
2735
3086
  async ({
2736
3087
  priceId,
2737
3088
  processor = "nmi",
@@ -2757,7 +3108,7 @@ var useSubscriptionActions = () => {
2757
3108
  },
2758
3109
  [services]
2759
3110
  );
2760
- const subscribeWithSavedMethod = react.useCallback(
3111
+ const subscribeWithSavedMethod = React3.useCallback(
2761
3112
  async ({
2762
3113
  priceId,
2763
3114
  processor = "nmi",
@@ -2776,7 +3127,7 @@ var useSubscriptionActions = () => {
2776
3127
  },
2777
3128
  [services]
2778
3129
  );
2779
- const subscribeWithCCBill = react.useCallback(
3130
+ const subscribeWithCCBill = React3.useCallback(
2780
3131
  async ({
2781
3132
  priceId,
2782
3133
  email,
@@ -2799,7 +3150,7 @@ var useSubscriptionActions = () => {
2799
3150
  },
2800
3151
  [services]
2801
3152
  );
2802
- const generateFlexFormUrl = react.useCallback(
3153
+ const generateFlexFormUrl = React3.useCallback(
2803
3154
  async ({
2804
3155
  priceId,
2805
3156
  firstName,