@doujins/payments-ui 0.0.0 → 0.0.2

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
 
@@ -498,17 +508,17 @@ var createPaymentStore = (options) => vanilla.createStore((set, get) => {
498
508
  resetAll: () => set(initialState)
499
509
  };
500
510
  });
501
- var PaymentContext = react.createContext(void 0);
511
+ var PaymentContext = React3.createContext(void 0);
502
512
  var PaymentProvider = ({
503
513
  config,
504
514
  children
505
515
  }) => {
506
- const app = react.useMemo(() => new PaymentApp({ config }), [config]);
507
- const store = react.useMemo(
516
+ const app = React3.useMemo(() => new PaymentApp({ config }), [config]);
517
+ const store = React3.useMemo(
508
518
  () => createPaymentStore({ callbacks: config.callbacks }),
509
519
  [config.callbacks]
510
520
  );
511
- const value = react.useMemo(() => {
521
+ const value = React3.useMemo(() => {
512
522
  return {
513
523
  config: app.getConfig(),
514
524
  fetcher: app.getFetcher(),
@@ -518,14 +528,14 @@ var PaymentProvider = ({
518
528
  store
519
529
  };
520
530
  }, [app, store]);
521
- react.useEffect(() => {
531
+ React3.useEffect(() => {
522
532
  if (!value.config.collectJsKey) return;
523
533
  loadCollectJs(value.config.collectJsKey);
524
534
  }, [value.config.collectJsKey]);
525
535
  return /* @__PURE__ */ jsxRuntime.jsx(PaymentContext.Provider, { value, children });
526
536
  };
527
537
  var usePaymentContext = () => {
528
- const context = react.useContext(PaymentContext);
538
+ const context = React3.useContext(PaymentContext);
529
539
  if (!context) {
530
540
  throw new Error("usePaymentContext must be used within a PaymentProvider");
531
541
  }
@@ -546,38 +556,261 @@ var customCountries = [
546
556
  ];
547
557
  countryList__default.default.overwrite(customCountries);
548
558
  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);
559
+ function setRef(ref, value) {
560
+ if (typeof ref === "function") {
561
+ return ref(value);
562
+ } else if (ref !== null && ref !== void 0) {
563
+ ref.current = value;
564
+ }
565
+ }
566
+ function composeRefs(...refs) {
567
+ return (node) => {
568
+ let hasCleanup = false;
569
+ const cleanups = refs.map((ref) => {
570
+ const cleanup = setRef(ref, node);
571
+ if (!hasCleanup && typeof cleanup == "function") {
572
+ hasCleanup = true;
563
573
  }
574
+ return cleanup;
575
+ });
576
+ if (hasCleanup) {
577
+ return () => {
578
+ for (let i = 0; i < cleanups.length; i++) {
579
+ const cleanup = cleanups[i];
580
+ if (typeof cleanup == "function") {
581
+ cleanup();
582
+ } else {
583
+ setRef(refs[i], null);
584
+ }
585
+ }
586
+ };
564
587
  }
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
588
  };
580
589
  }
590
+ // @__NO_SIDE_EFFECTS__
591
+ function createSlot(ownerName) {
592
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
593
+ const Slot2 = React3__namespace.forwardRef((props, forwardedRef) => {
594
+ const { children, ...slotProps } = props;
595
+ const childrenArray = React3__namespace.Children.toArray(children);
596
+ const slottable = childrenArray.find(isSlottable);
597
+ if (slottable) {
598
+ const newElement = slottable.props.children;
599
+ const newChildren = childrenArray.map((child) => {
600
+ if (child === slottable) {
601
+ if (React3__namespace.Children.count(newElement) > 1) return React3__namespace.Children.only(null);
602
+ return React3__namespace.isValidElement(newElement) ? newElement.props.children : null;
603
+ } else {
604
+ return child;
605
+ }
606
+ });
607
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React3__namespace.isValidElement(newElement) ? React3__namespace.cloneElement(newElement, void 0, newChildren) : null });
608
+ }
609
+ return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
610
+ });
611
+ Slot2.displayName = `${ownerName}.Slot`;
612
+ return Slot2;
613
+ }
614
+ var Slot = /* @__PURE__ */ createSlot("Slot");
615
+ // @__NO_SIDE_EFFECTS__
616
+ function createSlotClone(ownerName) {
617
+ const SlotClone = React3__namespace.forwardRef((props, forwardedRef) => {
618
+ const { children, ...slotProps } = props;
619
+ if (React3__namespace.isValidElement(children)) {
620
+ const childrenRef = getElementRef(children);
621
+ const props2 = mergeProps(slotProps, children.props);
622
+ if (children.type !== React3__namespace.Fragment) {
623
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
624
+ }
625
+ return React3__namespace.cloneElement(children, props2);
626
+ }
627
+ return React3__namespace.Children.count(children) > 1 ? React3__namespace.Children.only(null) : null;
628
+ });
629
+ SlotClone.displayName = `${ownerName}.SlotClone`;
630
+ return SlotClone;
631
+ }
632
+ var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
633
+ function isSlottable(child) {
634
+ return React3__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
635
+ }
636
+ function mergeProps(slotProps, childProps) {
637
+ const overrideProps = { ...childProps };
638
+ for (const propName in childProps) {
639
+ const slotPropValue = slotProps[propName];
640
+ const childPropValue = childProps[propName];
641
+ const isHandler = /^on[A-Z]/.test(propName);
642
+ if (isHandler) {
643
+ if (slotPropValue && childPropValue) {
644
+ overrideProps[propName] = (...args) => {
645
+ const result = childPropValue(...args);
646
+ slotPropValue(...args);
647
+ return result;
648
+ };
649
+ } else if (slotPropValue) {
650
+ overrideProps[propName] = slotPropValue;
651
+ }
652
+ } else if (propName === "style") {
653
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
654
+ } else if (propName === "className") {
655
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
656
+ }
657
+ }
658
+ return { ...slotProps, ...overrideProps };
659
+ }
660
+ function getElementRef(element) {
661
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
662
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
663
+ if (mayWarn) {
664
+ return element.ref;
665
+ }
666
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
667
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
668
+ if (mayWarn) {
669
+ return element.props.ref;
670
+ }
671
+ return element.props.ref || element.ref;
672
+ }
673
+ function cn(...inputs) {
674
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
675
+ }
676
+ var buttonVariants = classVarianceAuthority.cva(
677
+ "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",
678
+ {
679
+ variants: {
680
+ variant: {
681
+ default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
682
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
683
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
684
+ ghost: "hover:bg-accent hover:text-accent-foreground",
685
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
686
+ link: "text-primary underline-offset-4 hover:underline"
687
+ },
688
+ size: {
689
+ default: "h-10 px-4 py-2",
690
+ sm: "h-9 rounded-md px-3",
691
+ lg: "h-11 rounded-md px-8",
692
+ icon: "h-10 w-10"
693
+ }
694
+ },
695
+ defaultVariants: {
696
+ variant: "default",
697
+ size: "default"
698
+ }
699
+ }
700
+ );
701
+ var Button = React3__namespace.forwardRef(
702
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
703
+ const Comp = asChild ? Slot : "button";
704
+ return /* @__PURE__ */ jsxRuntime.jsx(
705
+ Comp,
706
+ {
707
+ className: cn(buttonVariants({ variant, size, className })),
708
+ ref,
709
+ ...props
710
+ }
711
+ );
712
+ }
713
+ );
714
+ Button.displayName = "Button";
715
+ var Input = React3__namespace.forwardRef(
716
+ ({ className, type, ...props }, ref) => {
717
+ return /* @__PURE__ */ jsxRuntime.jsx(
718
+ "input",
719
+ {
720
+ type,
721
+ className: cn(
722
+ "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",
723
+ className
724
+ ),
725
+ ref,
726
+ ...props
727
+ }
728
+ );
729
+ }
730
+ );
731
+ Input.displayName = "Input";
732
+ var Label = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
733
+ LabelPrimitive__namespace.Root,
734
+ {
735
+ ref,
736
+ className: cn(
737
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
738
+ className
739
+ ),
740
+ ...props
741
+ }
742
+ ));
743
+ Label.displayName = LabelPrimitive__namespace.Root.displayName;
744
+ var Select = SelectPrimitive__namespace.Root;
745
+ var SelectValue = SelectPrimitive__namespace.Value;
746
+ var SelectTrigger = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
747
+ SelectPrimitive__namespace.Trigger,
748
+ {
749
+ ref,
750
+ className: cn(
751
+ "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",
752
+ className
753
+ ),
754
+ ...props,
755
+ children: [
756
+ children,
757
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4 opacity-50" }) })
758
+ ]
759
+ }
760
+ ));
761
+ SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
762
+ var SelectContent = React3__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
763
+ SelectPrimitive__namespace.Content,
764
+ {
765
+ ref,
766
+ className: cn(
767
+ "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",
768
+ className
769
+ ),
770
+ position,
771
+ ...props,
772
+ children: [
773
+ /* @__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" }) }),
774
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Viewport, { className: "p-1", children }),
775
+ /* @__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" }) })
776
+ ]
777
+ }
778
+ ) }));
779
+ SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
780
+ var SelectLabel = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
781
+ SelectPrimitive__namespace.Label,
782
+ {
783
+ ref,
784
+ className: cn("px-2 py-1.5 text-sm font-semibold text-muted-foreground", className),
785
+ ...props
786
+ }
787
+ ));
788
+ SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
789
+ var SelectItem = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
790
+ SelectPrimitive__namespace.Item,
791
+ {
792
+ ref,
793
+ className: cn(
794
+ "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",
795
+ className
796
+ ),
797
+ ...props,
798
+ children: [
799
+ /* @__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" }) }) }),
800
+ /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.ItemText, { children })
801
+ ]
802
+ }
803
+ ));
804
+ SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
805
+ var SelectSeparator = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
806
+ SelectPrimitive__namespace.Separator,
807
+ {
808
+ ref,
809
+ className: cn("mx-1 my-1 h-px bg-muted", className),
810
+ ...props
811
+ }
812
+ ));
813
+ SelectSeparator.displayName = SelectPrimitive__namespace.Separator.displayName;
581
814
  var defaultBilling = {
582
815
  firstName: "",
583
816
  lastName: "",
@@ -604,8 +837,8 @@ var CardDetailsForm = ({
604
837
  submitDisabled = false
605
838
  }) => {
606
839
  const { config } = usePaymentContext();
607
- const defaultValuesKey = react.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
608
- const mergedDefaults = react.useMemo(
840
+ const defaultValuesKey = React3.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
841
+ const mergedDefaults = React3.useMemo(
609
842
  () => ({
610
843
  ...defaultBilling,
611
844
  ...defaultValues,
@@ -613,32 +846,24 @@ var CardDetailsForm = ({
613
846
  }),
614
847
  [defaultValuesKey, config.defaultUser?.email]
615
848
  );
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(() => {
849
+ const [firstName, setFirstName] = React3.useState(mergedDefaults.firstName);
850
+ const [lastName, setLastName] = React3.useState(mergedDefaults.lastName);
851
+ const [address1, setAddress1] = React3.useState(mergedDefaults.address1);
852
+ const [address2, setAddress2] = React3.useState(mergedDefaults.address2 ?? "");
853
+ const [city, setCity] = React3.useState(mergedDefaults.city);
854
+ const [stateRegion, setStateRegion] = React3.useState(mergedDefaults.stateRegion ?? "");
855
+ const [postalCode, setPostalCode] = React3.useState(mergedDefaults.postalCode);
856
+ const [country, setCountry] = React3.useState(mergedDefaults.country);
857
+ const [email, setEmail] = React3.useState(mergedDefaults.email ?? "");
858
+ const [localError, setLocalError] = React3.useState(null);
859
+ const [isTokenizing, setIsTokenizing] = React3.useState(false);
860
+ React3.useEffect(() => {
636
861
  if (!visible) {
637
862
  setLocalError(null);
638
863
  setIsTokenizing(false);
639
864
  }
640
865
  }, [visible]);
641
- react.useEffect(() => {
866
+ React3.useEffect(() => {
642
867
  if (!visible) return;
643
868
  setFirstName(mergedDefaults.firstName);
644
869
  setLastName(mergedDefaults.lastName);
@@ -650,7 +875,7 @@ var CardDetailsForm = ({
650
875
  setCountry(mergedDefaults.country);
651
876
  setEmail(mergedDefaults.email ?? "");
652
877
  }, [defaultValuesKey, mergedDefaults, visible]);
653
- react.useEffect(() => {
878
+ React3.useEffect(() => {
654
879
  if (!onBillingChange) return;
655
880
  onBillingChange({
656
881
  firstName,
@@ -677,7 +902,7 @@ var CardDetailsForm = ({
677
902
  mergedDefaults.provider,
678
903
  onBillingChange
679
904
  ]);
680
- react.useEffect(() => {
905
+ React3.useEffect(() => {
681
906
  if (typeof window === "undefined" || !window.CollectJS || !visible) {
682
907
  return;
683
908
  }
@@ -752,38 +977,43 @@ var CardDetailsForm = ({
752
977
  window.CollectJS.startPaymentRequest();
753
978
  };
754
979
  const errorMessage = localError ?? externalError;
980
+ 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
981
  return /* @__PURE__ */ jsxRuntime.jsxs(
756
982
  "form",
757
983
  {
758
- className: clsx__default.default("payments-ui-card-form", className),
984
+ className: cn(
985
+ "space-y-6 rounded-2xl border border-border/60 bg-card/90 p-6 shadow-lg",
986
+ className
987
+ ),
759
988
  onSubmit: handleSubmit,
760
989
  noValidate: true,
761
990
  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" }),
991
+ 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 }),
992
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
993
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
994
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-first", className: "flex items-center gap-2 text-muted-foreground", children: [
995
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "h-4 w-4" }),
766
996
  " First name"
767
997
  ] }),
768
998
  /* @__PURE__ */ jsxRuntime.jsx(
769
- "input",
999
+ Input,
770
1000
  {
771
- className: "payments-ui-input",
1001
+ id: "payments-first",
772
1002
  value: firstName,
773
1003
  onChange: (e) => setFirstName(e.target.value),
774
1004
  required: true
775
1005
  }
776
1006
  )
777
1007
  ] }),
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" }),
1008
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1009
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-last", className: "flex items-center gap-2 text-muted-foreground", children: [
1010
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.User, { className: "h-4 w-4" }),
781
1011
  " Last name"
782
1012
  ] }),
783
1013
  /* @__PURE__ */ jsxRuntime.jsx(
784
- "input",
1014
+ Input,
785
1015
  {
786
- className: "payments-ui-input",
1016
+ id: "payments-last",
787
1017
  value: lastName,
788
1018
  onChange: (e) => setLastName(e.target.value),
789
1019
  required: true
@@ -791,178 +1021,132 @@ var CardDetailsForm = ({
791
1021
  )
792
1022
  ] })
793
1023
  ] }),
794
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
795
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Email" }),
1024
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1025
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-email", children: "Email" }),
796
1026
  /* @__PURE__ */ jsxRuntime.jsx(
797
- "input",
1027
+ Input,
798
1028
  {
1029
+ id: "payments-email",
799
1030
  type: "email",
800
- className: "payments-ui-input",
801
1031
  value: email,
802
1032
  onChange: (e) => setEmail(e.target.value),
803
1033
  required: true
804
1034
  }
805
1035
  )
806
1036
  ] }),
807
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
808
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Address line 1" }),
1037
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1038
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-address1", children: "Address line 1" }),
809
1039
  /* @__PURE__ */ jsxRuntime.jsx(
810
- "input",
1040
+ Input,
811
1041
  {
812
- className: "payments-ui-input",
1042
+ id: "payments-address1",
813
1043
  value: address1,
814
1044
  onChange: (e) => setAddress1(e.target.value),
815
1045
  required: true
816
1046
  }
817
1047
  )
818
1048
  ] }),
819
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
820
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Address line 2 (optional)" }),
1049
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1050
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-address2", children: "Address line 2 (optional)" }),
821
1051
  /* @__PURE__ */ jsxRuntime.jsx(
822
- "input",
1052
+ Input,
823
1053
  {
824
- className: "payments-ui-input",
1054
+ id: "payments-address2",
825
1055
  value: address2,
826
1056
  onChange: (e) => setAddress2(e.target.value)
827
1057
  }
828
1058
  )
829
1059
  ] }),
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" }),
1060
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1061
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1062
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-city", children: "City" }),
833
1063
  /* @__PURE__ */ jsxRuntime.jsx(
834
- "input",
1064
+ Input,
835
1065
  {
836
- className: "payments-ui-input",
1066
+ id: "payments-city",
837
1067
  value: city,
838
1068
  onChange: (e) => setCity(e.target.value),
839
1069
  required: true
840
1070
  }
841
1071
  )
842
1072
  ] }),
843
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "payments-ui-label", children: [
844
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "State / Region" }),
1073
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1074
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-state", children: "State / Region" }),
845
1075
  /* @__PURE__ */ jsxRuntime.jsx(
846
- "input",
1076
+ Input,
847
1077
  {
848
- className: "payments-ui-input",
1078
+ id: "payments-state",
849
1079
  value: stateRegion,
850
1080
  onChange: (e) => setStateRegion(e.target.value)
851
1081
  }
852
1082
  )
853
1083
  ] })
854
1084
  ] }),
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" }),
1085
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1086
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1087
+ /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: "payments-postal", className: "flex items-center gap-2 text-muted-foreground", children: [
1088
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MapPin, { className: "h-4 w-4" }),
859
1089
  " Postal code"
860
1090
  ] }),
861
1091
  /* @__PURE__ */ jsxRuntime.jsx(
862
- "input",
1092
+ Input,
863
1093
  {
864
- className: "payments-ui-input",
1094
+ id: "payments-postal",
865
1095
  value: postalCode,
866
1096
  onChange: (e) => setPostalCode(e.target.value),
867
1097
  required: true
868
1098
  }
869
1099
  )
870
1100
  ] }),
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
- ] })
1101
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1102
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Country" }),
1103
+ /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: country, onValueChange: setCountry, children: [
1104
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select a country" }) }),
1105
+ /* @__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
1106
  ] })
911
1107
  ] })
912
1108
  ] }),
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
- )
1109
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1110
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Card number" }),
1111
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccnumber").slice(1), className: collectFieldClass })
922
1112
  ] }),
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
- )
1113
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
1114
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1115
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Expiry" }),
1116
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccexp").slice(1), className: collectFieldClass })
933
1117
  ] }),
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
- )
1118
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1119
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "CVV" }),
1120
+ /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "cvv").slice(1), className: collectFieldClass })
943
1121
  ] })
944
1122
  ] }),
945
- errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-error", children: errorMessage }),
946
- /* @__PURE__ */ jsxRuntime.jsxs(
947
- "button",
1123
+ /* @__PURE__ */ jsxRuntime.jsx(
1124
+ Button,
948
1125
  {
949
1126
  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
- ]
1127
+ className: "w-full",
1128
+ disabled: submitting || submitDisabled || isTokenizing,
1129
+ children: submitting || isTokenizing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1130
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1131
+ " Processing\u2026"
1132
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1133
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
1134
+ " ",
1135
+ submitLabel
1136
+ ] })
957
1137
  }
958
- )
1138
+ ),
1139
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1140
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-4 w-4" }),
1141
+ " Your payment information is encrypted and processed securely."
1142
+ ] })
959
1143
  ]
960
1144
  }
961
1145
  );
962
1146
  };
963
1147
  var usePaymentMethodService = () => {
964
1148
  const { services } = usePaymentContext();
965
- return react.useMemo(() => services.paymentMethods, [services]);
1149
+ return React3.useMemo(() => services.paymentMethods, [services]);
966
1150
  };
967
1151
 
968
1152
  // src/hooks/usePaymentMethods.ts
@@ -1007,6 +1191,149 @@ var usePaymentMethods = () => {
1007
1191
  deleteMutation
1008
1192
  };
1009
1193
  };
1194
+ var Dialog = DialogPrimitive__namespace.Root;
1195
+ var DialogPortal = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { className: cn(className), ...props });
1196
+ DialogPortal.displayName = DialogPrimitive__namespace.Portal.displayName;
1197
+ var DialogOverlay = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1198
+ DialogPrimitive__namespace.Overlay,
1199
+ {
1200
+ ref,
1201
+ className: cn(
1202
+ "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",
1203
+ className
1204
+ ),
1205
+ ...props
1206
+ }
1207
+ ));
1208
+ DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
1209
+ var DialogContent = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
1210
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
1211
+ /* @__PURE__ */ jsxRuntime.jsxs(
1212
+ DialogPrimitive__namespace.Content,
1213
+ {
1214
+ ref,
1215
+ className: cn(
1216
+ "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%]",
1217
+ className
1218
+ ),
1219
+ ...props,
1220
+ children: [
1221
+ children,
1222
+ /* @__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: [
1223
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
1224
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
1225
+ ] })
1226
+ ]
1227
+ }
1228
+ )
1229
+ ] }));
1230
+ DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
1231
+ var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
1232
+ DialogHeader.displayName = "DialogHeader";
1233
+ var DialogTitle = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1234
+ DialogPrimitive__namespace.Title,
1235
+ {
1236
+ ref,
1237
+ className: cn("text-lg font-semibold leading-none tracking-tight", className),
1238
+ ...props
1239
+ }
1240
+ ));
1241
+ DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
1242
+ var DialogDescription = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1243
+ DialogPrimitive__namespace.Description,
1244
+ {
1245
+ ref,
1246
+ className: cn("text-sm text-muted-foreground", className),
1247
+ ...props
1248
+ }
1249
+ ));
1250
+ DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
1251
+ var badgeVariants = classVarianceAuthority.cva(
1252
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none",
1253
+ {
1254
+ variants: {
1255
+ variant: {
1256
+ default: "border-transparent bg-primary text-primary-foreground",
1257
+ secondary: "border-transparent bg-secondary text-secondary-foreground",
1258
+ outline: "text-foreground",
1259
+ destructive: "border-transparent bg-destructive text-destructive-foreground"
1260
+ }
1261
+ },
1262
+ defaultVariants: {
1263
+ variant: "default"
1264
+ }
1265
+ }
1266
+ );
1267
+ function Badge({ className, variant, ...props }) {
1268
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
1269
+ }
1270
+ var ScrollArea = React3__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1271
+ ScrollAreaPrimitive__namespace.Root,
1272
+ {
1273
+ ref,
1274
+ className: cn("relative overflow-hidden", className),
1275
+ ...props,
1276
+ children: [
1277
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
1278
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollBar, {}),
1279
+ /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.Corner, {})
1280
+ ]
1281
+ }
1282
+ ));
1283
+ ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
1284
+ var ScrollBar = React3__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1285
+ ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
1286
+ {
1287
+ ref,
1288
+ orientation,
1289
+ className: cn(
1290
+ "flex touch-none select-none transition-colors",
1291
+ orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
1292
+ orientation === "horizontal" && "h-2.5 border-t border-t-transparent p-[1px]",
1293
+ className
1294
+ ),
1295
+ ...props,
1296
+ children: /* @__PURE__ */ jsxRuntime.jsx(ScrollAreaPrimitive__namespace.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1297
+ }
1298
+ ));
1299
+ ScrollBar.displayName = ScrollAreaPrimitive__namespace.ScrollAreaScrollbar.displayName;
1300
+ var Card = React3__namespace.forwardRef(
1301
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1302
+ "div",
1303
+ {
1304
+ ref,
1305
+ className: cn("rounded-xl border bg-card text-card-foreground shadow", className),
1306
+ ...props
1307
+ }
1308
+ )
1309
+ );
1310
+ Card.displayName = "Card";
1311
+ var CardHeader = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1312
+ "div",
1313
+ {
1314
+ ref,
1315
+ className: cn("flex flex-col space-y-1.5 p-6", className),
1316
+ ...props
1317
+ }
1318
+ ));
1319
+ CardHeader.displayName = "CardHeader";
1320
+ var CardTitle = React3__namespace.forwardRef(
1321
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })
1322
+ );
1323
+ CardTitle.displayName = "CardTitle";
1324
+ var CardDescription = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props }));
1325
+ CardDescription.displayName = "CardDescription";
1326
+ var CardContent = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1327
+ CardContent.displayName = "CardContent";
1328
+ var CardFooter = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1329
+ "div",
1330
+ {
1331
+ ref,
1332
+ className: cn("flex items-center p-6 pt-0", className),
1333
+ ...props
1334
+ }
1335
+ ));
1336
+ CardFooter.displayName = "CardFooter";
1010
1337
  var formatCardLabel = (method) => {
1011
1338
  const brand = method.card_type ? method.card_type.toUpperCase() : "CARD";
1012
1339
  const lastFour = method.last_four ? `\u2022\u2022\u2022\u2022 ${method.last_four}` : "";
@@ -1020,9 +1347,9 @@ var StoredPaymentMethods = ({
1020
1347
  description = "Manage your saved cards"
1021
1348
  }) => {
1022
1349
  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]);
1350
+ const [isModalOpen, setIsModalOpen] = React3.useState(false);
1351
+ const [deletingId, setDeletingId] = React3.useState(null);
1352
+ const payments = React3.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1026
1353
  const handleCardTokenize = (token, billing) => {
1027
1354
  createMutation.mutate({ token, billing });
1028
1355
  };
@@ -1035,67 +1362,72 @@ var StoredPaymentMethods = ({
1035
1362
  }
1036
1363
  );
1037
1364
  };
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" }),
1365
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card/95", children: [
1366
+ /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-row items-start justify-between space-y-0", children: [
1367
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1368
+ /* @__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: [
1369
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WalletCards, { className: "h-4 w-4" }),
1043
1370
  " ",
1044
1371
  heading
1045
- ] }),
1046
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "payments-ui-panel-description", children: description })
1372
+ ] }) }),
1373
+ /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: description })
1047
1374
  ] }),
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
- )
1375
+ showAddButton && /* @__PURE__ */ jsxRuntime.jsxs(Button, { size: "sm", onClick: () => setIsModalOpen(true), children: [
1376
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
1377
+ " Add card"
1378
+ ] })
1060
1379
  ] }),
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) => {
1380
+ /* @__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: [
1381
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1382
+ " Loading cards\u2026"
1383
+ ] }) : 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
1384
  const isSelected = selectedMethodId === method.id;
1066
1385
  return /* @__PURE__ */ jsxRuntime.jsxs(
1067
1386
  "div",
1068
1387
  {
1069
- className: clsx__default.default("payments-ui-method-item", {
1070
- "is-selected": isSelected
1071
- }),
1388
+ className: cn(
1389
+ "flex flex-col gap-3 rounded-lg border px-4 py-3 transition-colors md:flex-row md:items-center md:justify-between",
1390
+ isSelected ? "border-primary/60 bg-primary/5" : "border-border/60 bg-background"
1391
+ ),
1072
1392
  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: [
1393
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1394
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
1395
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
1076
1396
  "Added on",
1077
1397
  " ",
1078
1398
  method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown"
1079
1399
  ] })
1080
1400
  ] }),
1081
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-method-actions", children: [
1401
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1402
+ /* @__PURE__ */ jsxRuntime.jsx(
1403
+ Badge,
1404
+ {
1405
+ variant: method.is_active ? "default" : "secondary",
1406
+ className: cn(
1407
+ method.is_active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground"
1408
+ ),
1409
+ children: method.is_active ? "Active" : "Inactive"
1410
+ }
1411
+ ),
1412
+ method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason }),
1082
1413
  onMethodSelect && /* @__PURE__ */ jsxRuntime.jsx(
1083
- "button",
1414
+ Button,
1084
1415
  {
1085
- type: "button",
1086
- className: "payments-ui-text-button",
1416
+ size: "sm",
1417
+ variant: isSelected ? "default" : "outline",
1087
1418
  onClick: () => onMethodSelect(method),
1088
1419
  children: isSelected ? "Selected" : "Use card"
1089
1420
  }
1090
1421
  ),
1091
1422
  /* @__PURE__ */ jsxRuntime.jsx(
1092
- "button",
1423
+ Button,
1093
1424
  {
1094
- type: "button",
1095
- className: "payments-ui-icon-button payments-ui-danger",
1425
+ size: "icon",
1426
+ variant: "outline",
1427
+ className: "text-destructive",
1096
1428
  onClick: () => handleDelete(method),
1097
1429
  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" })
1430
+ 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
1431
  }
1100
1432
  )
1101
1433
  ] })
@@ -1103,35 +1435,29 @@ var StoredPaymentMethods = ({
1103
1435
  },
1104
1436
  method.id
1105
1437
  );
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
- ] })
1438
+ }) }) }) }),
1439
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-h-[90vh] overflow-y-auto", children: [
1440
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
1441
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Add a new card" }),
1442
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: "Your card details are tokenized securely via our payment provider." })
1443
+ ] }),
1444
+ /* @__PURE__ */ jsxRuntime.jsx(
1445
+ CardDetailsForm,
1446
+ {
1447
+ visible: isModalOpen,
1448
+ collectPrefix: "payments-ui-card",
1449
+ submitting: createMutation.isPending,
1450
+ submitLabel: "Save card",
1451
+ externalError: createMutation.error?.message ?? null,
1452
+ onTokenize: handleCardTokenize
1453
+ }
1454
+ )
1129
1455
  ] }) })
1130
1456
  ] });
1131
1457
  };
1132
1458
  var useSolanaService = () => {
1133
1459
  const { services } = usePaymentContext();
1134
- return react.useMemo(() => services.solanaPayments, [services]);
1460
+ return React3.useMemo(() => services.solanaPayments, [services]);
1135
1461
  };
1136
1462
  var getSolBalance = async (connection, publicKey) => {
1137
1463
  try {
@@ -1226,14 +1552,14 @@ var useSolanaDirectPayment = (options) => {
1226
1552
  const { connected, publicKey, wallet, signTransaction } = walletAdapterReact.useWallet();
1227
1553
  const { config } = usePaymentContext();
1228
1554
  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(() => {
1555
+ const [tokenBalance, setTokenBalance] = React3.useState(null);
1556
+ const [isBalanceLoading, setIsBalanceLoading] = React3.useState(false);
1557
+ const [isProcessing, setIsProcessing] = React3.useState(false);
1558
+ const connection = React3.useMemo(() => {
1233
1559
  const rpc = config.solanaRpcUrl ?? "https://api.mainnet-beta.solana.com";
1234
1560
  return new web3_js.Connection(rpc);
1235
1561
  }, [config.solanaRpcUrl]);
1236
- const fetchTokenBalance = react.useCallback(async () => {
1562
+ const fetchTokenBalance = React3.useCallback(async () => {
1237
1563
  if (!connected || !publicKey || !selectedToken) {
1238
1564
  setTokenBalance({ balance: 0, hasBalance: false });
1239
1565
  return;
@@ -1258,12 +1584,12 @@ var useSolanaDirectPayment = (options) => {
1258
1584
  setIsBalanceLoading(false);
1259
1585
  }
1260
1586
  }, [connected, publicKey, connection, selectedToken, tokenAmount, supportedTokens]);
1261
- react.useEffect(() => {
1587
+ React3.useEffect(() => {
1262
1588
  if (connected && publicKey && selectedToken) {
1263
1589
  void fetchTokenBalance();
1264
1590
  }
1265
1591
  }, [connected, publicKey, selectedToken, tokenAmount, fetchTokenBalance]);
1266
- const decodeTransaction = react.useCallback((serialized) => {
1592
+ const decodeTransaction = React3.useCallback((serialized) => {
1267
1593
  const buffer$1 = buffer.Buffer.from(serialized, "base64");
1268
1594
  try {
1269
1595
  return web3_js.VersionedTransaction.deserialize(buffer$1);
@@ -1279,7 +1605,7 @@ var useSolanaDirectPayment = (options) => {
1279
1605
  const isVersionedTransaction = (tx) => {
1280
1606
  return !!tx && typeof tx === "object" && "version" in tx;
1281
1607
  };
1282
- const signWithWallet = react.useCallback(
1608
+ const signWithWallet = React3.useCallback(
1283
1609
  async (tx) => {
1284
1610
  if (!wallet) {
1285
1611
  throw new Error("Wallet adapter is not available");
@@ -1306,7 +1632,7 @@ var useSolanaDirectPayment = (options) => {
1306
1632
  },
1307
1633
  [wallet, signTransaction]
1308
1634
  );
1309
- const pay = react.useCallback(async () => {
1635
+ const pay = React3.useCallback(async () => {
1310
1636
  if (!connected || !publicKey) {
1311
1637
  onError("Wallet not connected");
1312
1638
  return;
@@ -1398,46 +1724,47 @@ var DirectPayment = ({
1398
1724
  onSuccess: onPaymentSuccess,
1399
1725
  onError: onPaymentError
1400
1726
  });
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" }),
1727
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6", children: [
1728
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
1729
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: [
1730
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "h-4 w-4" }),
1405
1731
  " Pay with connected wallet"
1406
1732
  ] }),
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
- ] })
1733
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Sign the transaction directly in your Solana wallet." })
1734
+ ] }),
1735
+ /* @__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: [
1736
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: "Available balance" }),
1737
+ 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 })
1738
+ ] }),
1739
+ /* @__PURE__ */ jsxRuntime.jsx(
1740
+ Button,
1741
+ {
1742
+ type: "button",
1743
+ className: "w-full",
1744
+ disabled: !canPay,
1745
+ onClick: pay,
1746
+ children: isProcessing ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1747
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1748
+ " Processing\u2026"
1749
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1750
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "mr-2 h-4 w-4" }),
1751
+ " Pay with wallet"
1752
+ ] })
1753
+ }
1754
+ )
1428
1755
  ] });
1429
1756
  };
1430
1757
  var useSolanaQrPayment = (options) => {
1431
1758
  const { priceId, selectedToken, onSuccess, onError } = options;
1432
1759
  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(() => {
1760
+ const [intent, setIntent] = React3.useState(null);
1761
+ const [qrDataUri, setQrDataUri] = React3.useState(null);
1762
+ const [isLoading, setIsLoading] = React3.useState(false);
1763
+ const [error, setError] = React3.useState(null);
1764
+ const [timeRemaining, setTimeRemaining] = React3.useState(0);
1765
+ const pollRef = React3.useRef(null);
1766
+ const countdownRef = React3.useRef(null);
1767
+ const clearTimers = React3.useCallback(() => {
1441
1768
  if (pollRef.current) {
1442
1769
  clearInterval(pollRef.current);
1443
1770
  pollRef.current = null;
@@ -1447,12 +1774,12 @@ var useSolanaQrPayment = (options) => {
1447
1774
  countdownRef.current = null;
1448
1775
  }
1449
1776
  }, []);
1450
- react.useEffect(() => {
1777
+ React3.useEffect(() => {
1451
1778
  return () => {
1452
1779
  clearTimers();
1453
1780
  };
1454
1781
  }, [clearTimers]);
1455
- const handleError = react.useCallback(
1782
+ const handleError = React3.useCallback(
1456
1783
  (message, notifyParent = false) => {
1457
1784
  clearTimers();
1458
1785
  setError(message);
@@ -1465,7 +1792,7 @@ var useSolanaQrPayment = (options) => {
1465
1792
  },
1466
1793
  [clearTimers, onError]
1467
1794
  );
1468
- const handleSuccess = react.useCallback(
1795
+ const handleSuccess = React3.useCallback(
1469
1796
  (status) => {
1470
1797
  clearTimers();
1471
1798
  setTimeRemaining(0);
@@ -1474,7 +1801,7 @@ var useSolanaQrPayment = (options) => {
1474
1801
  },
1475
1802
  [clearTimers, onSuccess]
1476
1803
  );
1477
- const pollStatus = react.useCallback(
1804
+ const pollStatus = React3.useCallback(
1478
1805
  async (reference) => {
1479
1806
  try {
1480
1807
  const status = await solanaService.checkPaymentStatus(reference);
@@ -1493,7 +1820,7 @@ var useSolanaQrPayment = (options) => {
1493
1820
  },
1494
1821
  [handleError, handleSuccess, solanaService]
1495
1822
  );
1496
- const startCountdown = react.useCallback(
1823
+ const startCountdown = React3.useCallback(
1497
1824
  (expiresAt, reference) => {
1498
1825
  const updateTime = () => {
1499
1826
  const remaining = Math.max(0, Math.floor(expiresAt - Date.now() / 1e3));
@@ -1508,7 +1835,7 @@ var useSolanaQrPayment = (options) => {
1508
1835
  },
1509
1836
  [handleError, pollStatus]
1510
1837
  );
1511
- const renderQr = react.useCallback(async (qrIntent) => {
1838
+ const renderQr = React3.useCallback(async (qrIntent) => {
1512
1839
  try {
1513
1840
  const dataUri = await QRCode__default.default.toDataURL(qrIntent.url, {
1514
1841
  width: 320,
@@ -1524,7 +1851,7 @@ var useSolanaQrPayment = (options) => {
1524
1851
  handleError("Unable to render QR code");
1525
1852
  }
1526
1853
  }, [handleError]);
1527
- const fetchIntent = react.useCallback(async () => {
1854
+ const fetchIntent = React3.useCallback(async () => {
1528
1855
  if (!selectedToken) {
1529
1856
  setIntent(null);
1530
1857
  setQrDataUri(null);
@@ -1565,7 +1892,7 @@ var useSolanaQrPayment = (options) => {
1565
1892
  startCountdown,
1566
1893
  renderQr
1567
1894
  ]);
1568
- react.useEffect(() => {
1895
+ React3.useEffect(() => {
1569
1896
  void fetchIntent();
1570
1897
  }, [fetchIntent]);
1571
1898
  return {
@@ -1590,31 +1917,32 @@ var QRCodePayment = ({
1590
1917
  onSuccess: onPaymentSuccess
1591
1918
  });
1592
1919
  if (!selectedToken) {
1593
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "payments-ui-empty", children: "Select a token to continue." });
1920
+ 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
1921
  }
1595
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel", children: [
1596
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-panel-header", children: [
1922
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6", children: [
1923
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between", children: [
1597
1924
  /* @__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." })
1925
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Scan with Solana Pay" }),
1926
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Use any Solana Pay compatible wallet to scan and confirm." })
1600
1927
  ] }),
1601
1928
  /* @__PURE__ */ jsxRuntime.jsx(
1602
- "button",
1929
+ Button,
1603
1930
  {
1604
1931
  type: "button",
1605
- className: "payments-ui-icon-button",
1932
+ variant: "outline",
1933
+ size: "icon",
1606
1934
  onClick: () => refresh(),
1607
1935
  disabled: isLoading,
1608
- children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "payments-ui-spinner" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { className: "payments-ui-icon" })
1936
+ 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
1937
  }
1610
1938
  )
1611
1939
  ] }),
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..."
1940
+ 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 }),
1941
+ /* @__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: [
1942
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin" }),
1943
+ " Generating QR code\u2026"
1616
1944
  ] }) : "QR code unavailable" }) }),
1617
- intent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-countdown", children: [
1945
+ intent && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center text-sm text-muted-foreground", children: [
1618
1946
  "Expires in ",
1619
1947
  timeRemaining,
1620
1948
  "s \xB7 ",
@@ -1628,67 +1956,68 @@ var PaymentStatus = ({
1628
1956
  state,
1629
1957
  usdAmount,
1630
1958
  solAmount,
1631
- errorMessage,
1632
1959
  transactionId,
1960
+ errorMessage,
1633
1961
  onRetry,
1634
1962
  onClose
1635
1963
  }) => {
1964
+ if (state === "processing" || state === "confirming") {
1965
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
1966
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-10 w-10 animate-spin text-primary" }),
1967
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1968
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: state === "processing" ? "Processing payment\u2026" : "Awaiting confirmation\u2026" }),
1969
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-muted-foreground", children: [
1970
+ "$",
1971
+ usdAmount.toFixed(2),
1972
+ " ",
1973
+ solAmount ? `\xB7 \u2248 ${solAmount.toFixed(4)} SOL` : ""
1974
+ ] })
1975
+ ] })
1976
+ ] });
1977
+ }
1636
1978
  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
1979
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [
1980
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle, { className: "h-12 w-12 text-primary" }),
1981
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1982
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: "Payment complete" }),
1983
+ transactionId && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
1984
+ "Txn: ",
1985
+ transactionId
1986
+ ] })
1649
1987
  ] }),
1650
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "payments-ui-button", type: "button", onClick: onClose, children: "Close" })
1988
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "secondary", onClick: onClose, className: "w-full", children: "Close" })
1651
1989
  ] });
1652
1990
  }
1653
1991
  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"
1992
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-4 text-center", children: [
1993
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XCircle, { className: "h-12 w-12 text-destructive" }),
1994
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1995
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-lg font-semibold text-foreground", children: "Payment failed" }),
1996
+ errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: errorMessage })
1997
+ ] }),
1998
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex w-full flex-col gap-2 sm:flex-row", children: [
1999
+ onRetry && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "secondary", className: "flex-1", onClick: onRetry, children: [
2000
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { className: "mr-2 h-4 w-4" }),
2001
+ " Try again"
1662
2002
  ] }),
1663
- /* @__PURE__ */ jsxRuntime.jsx("button", { className: "payments-ui-text-button", type: "button", onClick: onClose, children: "Cancel" })
2003
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { className: "flex-1", onClick: onClose, children: "Close" })
1664
2004
  ] })
1665
2005
  ] });
1666
2006
  }
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
- ] });
2007
+ return null;
1679
2008
  };
1680
2009
  var useSupportedTokens = () => {
1681
2010
  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);
2011
+ const [tokens, setTokens] = React3.useState([]);
2012
+ const [isLoading, setIsLoading] = React3.useState(false);
2013
+ const [error, setError] = React3.useState(null);
2014
+ const [lastFetched, setLastFetched] = React3.useState(null);
1686
2015
  const CACHE_DURATION = 5 * 60 * 1e3;
1687
- const tokensRef = react.useRef(tokens);
1688
- const lastFetchedRef = react.useRef(lastFetched);
2016
+ const tokensRef = React3.useRef(tokens);
2017
+ const lastFetchedRef = React3.useRef(lastFetched);
1689
2018
  tokensRef.current = tokens;
1690
2019
  lastFetchedRef.current = lastFetched;
1691
- const fetchSupportedTokens = react.useCallback(async () => {
2020
+ const fetchSupportedTokens = React3.useCallback(async () => {
1692
2021
  if (tokensRef.current.length > 0 && lastFetchedRef.current && Date.now() - lastFetchedRef.current < CACHE_DURATION) {
1693
2022
  return tokensRef.current;
1694
2023
  }
@@ -1711,50 +2040,50 @@ var useSupportedTokens = () => {
1711
2040
  setIsLoading(false);
1712
2041
  }
1713
2042
  }, [solanaService]);
1714
- react.useEffect(() => {
2043
+ React3.useEffect(() => {
1715
2044
  if (tokens.length === 0) {
1716
2045
  fetchSupportedTokens();
1717
2046
  }
1718
2047
  }, [tokens.length, fetchSupportedTokens]);
1719
- const getTokenBySymbol = react.useCallback(
2048
+ const getTokenBySymbol = React3.useCallback(
1720
2049
  (symbol) => {
1721
2050
  return tokens.find((token) => token.symbol === symbol);
1722
2051
  },
1723
2052
  [tokens]
1724
2053
  );
1725
- const getTokenByMint = react.useCallback(
2054
+ const getTokenByMint = React3.useCallback(
1726
2055
  (mintAddress) => {
1727
2056
  return tokens.find((token) => token.mint === mintAddress);
1728
2057
  },
1729
2058
  [tokens]
1730
2059
  );
1731
- const isTokenSupported = react.useCallback(
2060
+ const isTokenSupported = React3.useCallback(
1732
2061
  (symbol) => {
1733
2062
  return tokens.some((token) => token.symbol === symbol);
1734
2063
  },
1735
2064
  [tokens]
1736
2065
  );
1737
- const getUSDCToken = react.useCallback(() => {
2066
+ const getUSDCToken = React3.useCallback(() => {
1738
2067
  return getTokenBySymbol("USDC");
1739
2068
  }, [getTokenBySymbol]);
1740
- const getPYUSDToken = react.useCallback(() => {
2069
+ const getPYUSDToken = React3.useCallback(() => {
1741
2070
  return getTokenBySymbol("PYUSD");
1742
2071
  }, [getTokenBySymbol]);
1743
- const getSOLToken = react.useCallback(() => {
2072
+ const getSOLToken = React3.useCallback(() => {
1744
2073
  return getTokenBySymbol("SOL");
1745
2074
  }, [getTokenBySymbol]);
1746
- const getStablecoins = react.useCallback(() => {
2075
+ const getStablecoins = React3.useCallback(() => {
1747
2076
  return tokens.filter((token) => ["USDC", "PYUSD"].includes(token.symbol));
1748
2077
  }, [tokens]);
1749
- const refreshTokens = react.useCallback(async () => {
2078
+ const refreshTokens = React3.useCallback(async () => {
1750
2079
  setLastFetched(null);
1751
2080
  return await fetchSupportedTokens();
1752
2081
  }, [fetchSupportedTokens]);
1753
- const isCacheStale = react.useCallback(() => {
2082
+ const isCacheStale = React3.useCallback(() => {
1754
2083
  if (!lastFetched) return true;
1755
2084
  return Date.now() - lastFetched > CACHE_DURATION;
1756
2085
  }, [lastFetched]);
1757
- const getTokenDisplayInfo = react.useCallback((token) => {
2086
+ const getTokenDisplayInfo = React3.useCallback((token) => {
1758
2087
  return {
1759
2088
  ...token,
1760
2089
  displayName: `${token.name} (${token.symbol})`,
@@ -1762,7 +2091,7 @@ var useSupportedTokens = () => {
1762
2091
  decimalPlaces: token.decimals
1763
2092
  };
1764
2093
  }, []);
1765
- const getTokenPrice = react.useCallback(
2094
+ const getTokenPrice = React3.useCallback(
1766
2095
  (symbol) => {
1767
2096
  const token = getTokenBySymbol(symbol);
1768
2097
  if (!token) return 0;
@@ -1771,7 +2100,7 @@ var useSupportedTokens = () => {
1771
2100
  },
1772
2101
  [getTokenBySymbol]
1773
2102
  );
1774
- const calculateTokenAmount = react.useCallback(
2103
+ const calculateTokenAmount = React3.useCallback(
1775
2104
  (usdAmount, tokenSymbol) => {
1776
2105
  const token = getTokenBySymbol(tokenSymbol);
1777
2106
  const price = getTokenPrice(tokenSymbol);
@@ -1782,7 +2111,7 @@ var useSupportedTokens = () => {
1782
2111
  },
1783
2112
  [getTokenBySymbol, getTokenPrice]
1784
2113
  );
1785
- const formatTokenAmount = react.useCallback(
2114
+ const formatTokenAmount = React3.useCallback(
1786
2115
  (amount, tokenSymbol) => {
1787
2116
  const token = getTokenBySymbol(tokenSymbol);
1788
2117
  if (!token) return "0";
@@ -1855,6 +2184,43 @@ var selectSolanaFlow = (state) => ({
1855
2184
  failSolanaPayment: state.failSolanaPayment,
1856
2185
  resetSolanaPayment: state.resetSolanaPayment
1857
2186
  });
2187
+ var Tabs = TabsPrimitive__namespace.Root;
2188
+ var TabsList = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2189
+ TabsPrimitive__namespace.List,
2190
+ {
2191
+ ref,
2192
+ className: cn(
2193
+ "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
2194
+ className
2195
+ ),
2196
+ ...props
2197
+ }
2198
+ ));
2199
+ TabsList.displayName = TabsPrimitive__namespace.List.displayName;
2200
+ var TabsTrigger = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2201
+ TabsPrimitive__namespace.Trigger,
2202
+ {
2203
+ ref,
2204
+ className: cn(
2205
+ "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",
2206
+ className
2207
+ ),
2208
+ ...props
2209
+ }
2210
+ ));
2211
+ TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
2212
+ var TabsContent = React3__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2213
+ TabsPrimitive__namespace.Content,
2214
+ {
2215
+ ref,
2216
+ className: cn(
2217
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
2218
+ className
2219
+ ),
2220
+ ...props
2221
+ }
2222
+ ));
2223
+ TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1858
2224
  var SolanaPaymentSelector = ({
1859
2225
  isOpen,
1860
2226
  onClose,
@@ -1886,24 +2252,24 @@ var SolanaPaymentSelector = ({
1886
2252
  isLoading: tokensLoading,
1887
2253
  error: tokensError
1888
2254
  } = useSupportedTokens();
1889
- const selectedToken = react.useMemo(() => {
2255
+ const selectedToken = React3.useMemo(() => {
1890
2256
  if (!tokens.length) return null;
1891
2257
  const explicit = tokens.find((token) => token.symbol === selectedTokenSymbol);
1892
2258
  return explicit || tokens[0];
1893
2259
  }, [tokens, selectedTokenSymbol]);
1894
- react.useEffect(() => {
2260
+ React3.useEffect(() => {
1895
2261
  if (!selectedTokenSymbol && tokens.length) {
1896
2262
  const defaultToken = tokens.find((token) => token.symbol === "SOL") || tokens[0];
1897
2263
  setSelectedTokenSymbol(defaultToken.symbol);
1898
2264
  }
1899
2265
  }, [tokens, selectedTokenSymbol, setSelectedTokenSymbol]);
1900
- const handlePaymentStart = react.useCallback(() => {
2266
+ const handlePaymentStart = React3.useCallback(() => {
1901
2267
  startSolanaPayment();
1902
2268
  }, [startSolanaPayment]);
1903
- const handlePaymentConfirming = react.useCallback(() => {
2269
+ const handlePaymentConfirming = React3.useCallback(() => {
1904
2270
  confirmSolanaPayment();
1905
2271
  }, [confirmSolanaPayment]);
1906
- const handlePaymentSuccess = react.useCallback(
2272
+ const handlePaymentSuccess = React3.useCallback(
1907
2273
  (result, txId) => {
1908
2274
  const resolvedTx = txId || (typeof result === "string" ? result : result.transaction_id);
1909
2275
  setTransactionId(resolvedTx);
@@ -1929,18 +2295,18 @@ var SolanaPaymentSelector = ({
1929
2295
  },
1930
2296
  [completeSolanaPayment, onSuccess, setTransactionId]
1931
2297
  );
1932
- const handlePaymentError = react.useCallback(
2298
+ const handlePaymentError = React3.useCallback(
1933
2299
  (error) => {
1934
2300
  failSolanaPayment(error);
1935
2301
  onError?.(error);
1936
2302
  },
1937
2303
  [failSolanaPayment, onError]
1938
2304
  );
1939
- const handleRetry = react.useCallback(() => {
2305
+ const handleRetry = React3.useCallback(() => {
1940
2306
  resetSolanaPayment();
1941
2307
  setTransactionId(null);
1942
2308
  }, [resetSolanaPayment, setTransactionId]);
1943
- const handleClose = react.useCallback(() => {
2309
+ const handleClose = React3.useCallback(() => {
1944
2310
  if (paymentState === "processing" || paymentState === "confirming") {
1945
2311
  return;
1946
2312
  }
@@ -1948,7 +2314,7 @@ var SolanaPaymentSelector = ({
1948
2314
  setTransactionId(null);
1949
2315
  onClose();
1950
2316
  }, [paymentState, resetSolanaPayment, setTransactionId, onClose]);
1951
- react.useEffect(() => {
2317
+ React3.useEffect(() => {
1952
2318
  if (!isOpen || !selectedToken || usdAmount === 0) {
1953
2319
  setTokenAmount(0);
1954
2320
  return;
@@ -1960,14 +2326,14 @@ var SolanaPaymentSelector = ({
1960
2326
  }
1961
2327
  setTokenAmount(usdAmount / price);
1962
2328
  }, [isOpen, usdAmount, selectedToken, setTokenAmount]);
1963
- const handleTokenChange = react.useCallback(
1964
- (event) => {
1965
- setSelectedTokenSymbol(event.target.value);
2329
+ const handleTokenChange = React3.useCallback(
2330
+ (value) => {
2331
+ setSelectedTokenSymbol(value);
1966
2332
  },
1967
2333
  [setSelectedTokenSymbol]
1968
2334
  );
1969
- const wasConnectedRef = react.useRef(connected);
1970
- react.useEffect(() => {
2335
+ const wasConnectedRef = React3.useRef(connected);
2336
+ React3.useEffect(() => {
1971
2337
  if (connected && !wasConnectedRef.current) {
1972
2338
  setTab("wallet");
1973
2339
  }
@@ -1976,124 +2342,98 @@ var SolanaPaymentSelector = ({
1976
2342
  }
1977
2343
  wasConnectedRef.current = connected;
1978
2344
  }, [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." });
2345
+ const renderBody = () => {
2346
+ if (paymentState !== "selecting") {
2347
+ return /* @__PURE__ */ jsxRuntime.jsx(
2348
+ PaymentStatus,
2349
+ {
2350
+ state: paymentState,
2351
+ usdAmount,
2352
+ solAmount: tokenAmount,
2353
+ onRetry: handleRetry,
2354
+ onClose: handleClose,
2355
+ errorMessage,
2356
+ transactionId
2357
+ }
2358
+ );
1991
2359
  }
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: [
2360
+ 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: [
2361
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
2362
+ " Loading supported tokens\u2026"
2363
+ ] }) : 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: [
2364
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-xl border border-border/60 bg-muted/10 p-4 text-center", children: [
2365
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-2xl font-semibold text-foreground", children: [
2366
+ "$",
2367
+ usdAmount.toFixed(2),
2368
+ " USD"
2369
+ ] }),
2370
+ selectedToken && tokenAmount > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-muted-foreground", children: [
2371
+ "\u2248 ",
2372
+ tokenAmount.toFixed(selectedToken.symbol === "SOL" ? 4 : 2),
2373
+ " ",
2374
+ selectedToken.symbol
2375
+ ] })
2376
+ ] }),
2377
+ /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: selectedToken?.symbol ?? "", onValueChange: handleTokenChange, children: [
2378
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select token" }) }),
2379
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "max-h-64", children: tokens.map((token) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: token.symbol, children: [
1996
2380
  token.name,
1997
2381
  " (",
1998
2382
  token.symbol,
1999
2383
  ")"
2000
2384
  ] }, token.symbol)) })
2001
2385
  ] }),
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,
2386
+ /* @__PURE__ */ jsxRuntime.jsxs(
2387
+ Tabs,
2089
2388
  {
2090
- priceId,
2091
- selectedToken,
2092
- onPaymentError: handlePaymentError,
2093
- onPaymentSuccess: handlePaymentSuccess
2389
+ value: activeTab,
2390
+ onValueChange: (value) => setTab(value),
2391
+ className: "w-full",
2392
+ children: [
2393
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-2 bg-muted/20", children: [
2394
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsTrigger, { value: "wallet", disabled: !connected, children: [
2395
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "mr-2 h-4 w-4" }),
2396
+ " Pay with Wallet"
2397
+ ] }),
2398
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsTrigger, { value: "qr", children: [
2399
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
2400
+ " Scan QR Code"
2401
+ ] })
2402
+ ] }),
2403
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "wallet", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2404
+ DirectPayment,
2405
+ {
2406
+ priceId,
2407
+ tokenAmount,
2408
+ selectedToken,
2409
+ supportedTokens: tokens,
2410
+ onPaymentStart: handlePaymentStart,
2411
+ onPaymentConfirming: handlePaymentConfirming,
2412
+ onPaymentSuccess: handlePaymentSuccess,
2413
+ onPaymentError: handlePaymentError
2414
+ }
2415
+ ) }),
2416
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "qr", className: "mt-4", children: /* @__PURE__ */ jsxRuntime.jsx(
2417
+ QRCodePayment,
2418
+ {
2419
+ priceId,
2420
+ selectedToken,
2421
+ onPaymentError: handlePaymentError,
2422
+ onPaymentSuccess: handlePaymentSuccess
2423
+ }
2424
+ ) })
2425
+ ]
2094
2426
  }
2095
- )
2096
- ] })
2427
+ ),
2428
+ !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." })
2429
+ ] }) });
2430
+ };
2431
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "sm:max-w-lg", children: [
2432
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "space-y-1", children: [
2433
+ /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Complete your payment" }),
2434
+ /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: "Select a token and preferred method. We\u2019ll guide you through the rest." })
2435
+ ] }),
2436
+ renderBody()
2097
2437
  ] }) });
2098
2438
  };
2099
2439
  var PaymentExperience = ({
@@ -2156,81 +2496,74 @@ var PaymentExperience = ({
2156
2496
  failSavedPayment(message);
2157
2497
  }
2158
2498
  };
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"
2499
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-8", children: [
2500
+ /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "border-border/60 bg-card/95", children: [
2501
+ /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between", children: [
2502
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2503
+ /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { className: "flex items-center gap-2 text-lg text-foreground", children: [
2504
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-5 w-5 text-primary" }),
2505
+ " Secure checkout"
2506
+ ] }),
2507
+ /* @__PURE__ */ jsxRuntime.jsxs(CardDescription, { children: [
2508
+ "Amount due: $",
2509
+ usdAmount.toFixed(2)
2510
+ ] })
2165
2511
  ] }),
2166
- /* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
2167
- "Amount due: $",
2168
- usdAmount.toFixed(2)
2169
- ] })
2512
+ checkoutSummary && /* @__PURE__ */ jsxRuntime.jsx("div", { children: checkoutSummary })
2170
2513
  ] }),
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"
2514
+ /* @__PURE__ */ jsxRuntime.jsx(CardContent, { children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-8 lg:grid-cols-2", children: [
2515
+ showStored && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
2516
+ /* @__PURE__ */ jsxRuntime.jsx(
2517
+ StoredPaymentMethods,
2518
+ {
2519
+ selectedMethodId,
2520
+ onMethodSelect: handleMethodSelect,
2521
+ heading: "Saved cards",
2522
+ description: "Use or manage your saved payment methods."
2523
+ }
2524
+ ),
2525
+ onSavedMethodPayment && /* @__PURE__ */ jsxRuntime.jsx(
2526
+ Button,
2527
+ {
2528
+ className: "w-full",
2529
+ disabled: !selectedMethodId || savedStatus === "processing",
2530
+ onClick: handleSavedPayment,
2531
+ children: savedStatus === "processing" ? "Processing\u2026" : "Pay with selected card"
2532
+ }
2533
+ ),
2534
+ savedError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: savedError })
2535
+ ] }),
2536
+ 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: [
2537
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-4 space-y-1", children: [
2538
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-muted-foreground", children: [
2539
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "h-4 w-4" }),
2540
+ " Pay with a new card"
2541
+ ] }),
2542
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: "Card details are tokenized via Collect.js and never hit your server." })
2201
2543
  ] }),
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
- )
2544
+ /* @__PURE__ */ jsxRuntime.jsx(
2545
+ CardDetailsForm,
2546
+ {
2547
+ visible: true,
2548
+ submitLabel: "Pay now",
2549
+ submitting: newCardStatus === "processing",
2550
+ externalError: newCardError,
2551
+ onTokenize: handleNewCardTokenize
2552
+ }
2553
+ )
2554
+ ] }) })
2214
2555
  ] }) })
2215
2556
  ] }),
2216
- enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "payments-ui-solana-banner", children: [
2557
+ 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
2558
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2218
- /* @__PURE__ */ jsxRuntime.jsxs("h3", { children: [
2219
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "payments-ui-icon" }),
2559
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 text-base font-semibold text-primary", children: [
2560
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "h-4 w-4" }),
2220
2561
  " Prefer Solana Pay?"
2221
2562
  ] }),
2222
- /* @__PURE__ */ jsxRuntime.jsx("p", { children: "Use a Solana wallet or QR code for instant settlement." })
2563
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-primary/80", children: "Use a Solana wallet or QR code for instant settlement." })
2223
2564
  ] }),
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
- ] }),
2565
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { onClick: () => setSolanaModalOpen(true), children: "Open Solana Pay" })
2566
+ ] }) }),
2234
2567
  enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsx(
2235
2568
  SolanaPaymentSelector,
2236
2569
  {
@@ -2250,10 +2583,10 @@ var PaymentExperience = ({
2250
2583
  var useTokenBalance = (tokens) => {
2251
2584
  const { publicKey } = walletAdapterReact.useWallet();
2252
2585
  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(
2586
+ const [balances, setBalances] = React3.useState([]);
2587
+ const [isLoading, setIsLoading] = React3.useState(false);
2588
+ const [error, setError] = React3.useState(null);
2589
+ const fetchTokenBalance = React3.useCallback(
2257
2590
  async (token, walletAddress) => {
2258
2591
  try {
2259
2592
  const mintPublicKey = new web3_js.PublicKey(token.mint);
@@ -2294,8 +2627,8 @@ var useTokenBalance = (tokens) => {
2294
2627
  },
2295
2628
  [connection]
2296
2629
  );
2297
- const tokensKey = react.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
2298
- react.useEffect(() => {
2630
+ const tokensKey = React3.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
2631
+ React3.useEffect(() => {
2299
2632
  if (!publicKey || tokens.length === 0) {
2300
2633
  setBalances([]);
2301
2634
  return;
@@ -2319,20 +2652,20 @@ var useTokenBalance = (tokens) => {
2319
2652
  };
2320
2653
  fetchAllBalances();
2321
2654
  }, [publicKey, tokensKey, fetchTokenBalance]);
2322
- const getTokenBalance = react.useCallback(
2655
+ const getTokenBalance = React3.useCallback(
2323
2656
  (tokenSymbol) => {
2324
2657
  return balances.find((balance) => balance.token.symbol === tokenSymbol);
2325
2658
  },
2326
2659
  [balances]
2327
2660
  );
2328
- const hasSufficientBalance2 = react.useCallback(
2661
+ const hasSufficientBalance2 = React3.useCallback(
2329
2662
  (tokenSymbol, requiredAmount) => {
2330
2663
  const balance = getTokenBalance(tokenSymbol);
2331
2664
  return balance ? balance.uiAmount >= requiredAmount : false;
2332
2665
  },
2333
2666
  [getTokenBalance]
2334
2667
  );
2335
- const getFormattedBalance = react.useCallback(
2668
+ const getFormattedBalance = React3.useCallback(
2336
2669
  (tokenSymbol) => {
2337
2670
  const balance = getTokenBalance(tokenSymbol);
2338
2671
  if (!balance) return "0.00";
@@ -2346,7 +2679,7 @@ var useTokenBalance = (tokens) => {
2346
2679
  },
2347
2680
  [getTokenBalance]
2348
2681
  );
2349
- const refreshBalances = react.useCallback(async () => {
2682
+ const refreshBalances = React3.useCallback(async () => {
2350
2683
  if (!publicKey || tokens.length === 0) {
2351
2684
  setBalances([]);
2352
2685
  return;
@@ -2367,7 +2700,7 @@ var useTokenBalance = (tokens) => {
2367
2700
  setIsLoading(false);
2368
2701
  }
2369
2702
  }, [publicKey, tokens, fetchTokenBalance]);
2370
- const getTotalValue = react.useCallback(
2703
+ const getTotalValue = React3.useCallback(
2371
2704
  (priceData) => {
2372
2705
  if (!priceData) return 0;
2373
2706
  return balances.reduce((total, balance) => {
@@ -2396,13 +2729,13 @@ var useTokenBalance = (tokens) => {
2396
2729
  var useDirectWalletPayment = () => {
2397
2730
  const { publicKey, signTransaction, connected } = walletAdapterReact.useWallet();
2398
2731
  const solanaService = useSolanaService();
2399
- const [paymentState, setPaymentState] = react.useState({
2732
+ const [paymentState, setPaymentState] = React3.useState({
2400
2733
  loading: false,
2401
2734
  error: null,
2402
2735
  success: false,
2403
2736
  transactionId: null
2404
2737
  });
2405
- const resetPayment = react.useCallback(() => {
2738
+ const resetPayment = React3.useCallback(() => {
2406
2739
  setPaymentState({
2407
2740
  loading: false,
2408
2741
  error: null,
@@ -2410,7 +2743,7 @@ var useDirectWalletPayment = () => {
2410
2743
  transactionId: null
2411
2744
  });
2412
2745
  }, []);
2413
- const payWithWallet = react.useCallback(
2746
+ const payWithWallet = React3.useCallback(
2414
2747
  async (token, priceId) => {
2415
2748
  if (!connected || !publicKey || !signTransaction) {
2416
2749
  setPaymentState((prev) => ({
@@ -2496,21 +2829,21 @@ var usePaymentStatus = (options = {}) => {
2496
2829
  retryInterval = 1e4
2497
2830
  // 10 seconds
2498
2831
  } = 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(() => {
2832
+ const [status, setStatus] = React3.useState(null);
2833
+ const [paymentStatus, setPaymentStatus] = React3.useState(null);
2834
+ const [isLoading, setIsLoading] = React3.useState(false);
2835
+ const [error, setError] = React3.useState(null);
2836
+ const [retryCount, setRetryCount] = React3.useState(0);
2837
+ const intervalRef = React3.useRef(null);
2838
+ const isMonitoringRef = React3.useRef(false);
2839
+ React3.useEffect(() => {
2507
2840
  return () => {
2508
2841
  if (intervalRef.current) {
2509
2842
  clearInterval(intervalRef.current);
2510
2843
  }
2511
2844
  };
2512
2845
  }, []);
2513
- const checkTransactionStatus = react.useCallback(
2846
+ const checkTransactionStatus = React3.useCallback(
2514
2847
  async (signature) => {
2515
2848
  try {
2516
2849
  const statusResponse = await connection.getSignatureStatus(signature, {
@@ -2552,7 +2885,7 @@ var usePaymentStatus = (options = {}) => {
2552
2885
  },
2553
2886
  [connection]
2554
2887
  );
2555
- const checkPaymentStatus = react.useCallback(
2888
+ const checkPaymentStatus = React3.useCallback(
2556
2889
  async (id) => {
2557
2890
  try {
2558
2891
  const data = await billingApi.get(
@@ -2569,7 +2902,7 @@ var usePaymentStatus = (options = {}) => {
2569
2902
  },
2570
2903
  [billingApi]
2571
2904
  );
2572
- const startMonitoring = react.useCallback(async () => {
2905
+ const startMonitoring = React3.useCallback(async () => {
2573
2906
  if (isMonitoringRef.current || !transactionId && !purchaseId) {
2574
2907
  return;
2575
2908
  }
@@ -2653,14 +2986,14 @@ var usePaymentStatus = (options = {}) => {
2653
2986
  retryInterval,
2654
2987
  retryCount
2655
2988
  ]);
2656
- const stopMonitoring = react.useCallback(() => {
2989
+ const stopMonitoring = React3.useCallback(() => {
2657
2990
  if (intervalRef.current) {
2658
2991
  clearInterval(intervalRef.current);
2659
2992
  }
2660
2993
  isMonitoringRef.current = false;
2661
2994
  setIsLoading(false);
2662
2995
  }, []);
2663
- const checkStatus = react.useCallback(async () => {
2996
+ const checkStatus = React3.useCallback(async () => {
2664
2997
  if (!transactionId && !purchaseId) return;
2665
2998
  setIsLoading(true);
2666
2999
  setError(null);
@@ -2680,7 +3013,7 @@ var usePaymentStatus = (options = {}) => {
2680
3013
  setIsLoading(false);
2681
3014
  }
2682
3015
  }, [transactionId, purchaseId, checkTransactionStatus, checkPaymentStatus]);
2683
- react.useEffect(() => {
3016
+ React3.useEffect(() => {
2684
3017
  if ((transactionId || purchaseId) && !isMonitoringRef.current) {
2685
3018
  startMonitoring();
2686
3019
  }
@@ -2688,7 +3021,7 @@ var usePaymentStatus = (options = {}) => {
2688
3021
  stopMonitoring();
2689
3022
  };
2690
3023
  }, [transactionId, purchaseId, startMonitoring, stopMonitoring]);
2691
- const getConfirmationStatus = react.useCallback(() => {
3024
+ const getConfirmationStatus = React3.useCallback(() => {
2692
3025
  if (paymentStatus?.status === "confirmed") return "confirmed";
2693
3026
  if (paymentStatus?.status === "failed") return "failed";
2694
3027
  if (status?.confirmationStatus === "finalized") return "confirmed";
@@ -2697,7 +3030,7 @@ var usePaymentStatus = (options = {}) => {
2697
3030
  return "failed";
2698
3031
  return "pending";
2699
3032
  }, [status, paymentStatus]);
2700
- const getSolscanUrl = react.useCallback(
3033
+ const getSolscanUrl = React3.useCallback(
2701
3034
  (signature) => {
2702
3035
  const txId = signature || transactionId;
2703
3036
  if (!txId) return null;
@@ -2731,7 +3064,7 @@ var useSubscriptionActions = () => {
2731
3064
  }
2732
3065
  return priceId;
2733
3066
  };
2734
- const subscribeWithCard = react.useCallback(
3067
+ const subscribeWithCard = React3.useCallback(
2735
3068
  async ({
2736
3069
  priceId,
2737
3070
  processor = "nmi",
@@ -2757,7 +3090,7 @@ var useSubscriptionActions = () => {
2757
3090
  },
2758
3091
  [services]
2759
3092
  );
2760
- const subscribeWithSavedMethod = react.useCallback(
3093
+ const subscribeWithSavedMethod = React3.useCallback(
2761
3094
  async ({
2762
3095
  priceId,
2763
3096
  processor = "nmi",
@@ -2776,7 +3109,7 @@ var useSubscriptionActions = () => {
2776
3109
  },
2777
3110
  [services]
2778
3111
  );
2779
- const subscribeWithCCBill = react.useCallback(
3112
+ const subscribeWithCCBill = React3.useCallback(
2780
3113
  async ({
2781
3114
  priceId,
2782
3115
  email,
@@ -2799,7 +3132,7 @@ var useSubscriptionActions = () => {
2799
3132
  },
2800
3133
  [services]
2801
3134
  );
2802
- const generateFlexFormUrl = react.useCallback(
3135
+ const generateFlexFormUrl = React3.useCallback(
2803
3136
  async ({
2804
3137
  priceId,
2805
3138
  firstName,