@doujins/payments-ui 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React17 = require('react');
3
+ var React15 = require('react');
4
4
  var reactQuery = require('@tanstack/react-query');
5
5
  var walletAdapterReact = require('@solana/wallet-adapter-react');
6
6
  var walletAdapterReactUi = require('@solana/wallet-adapter-react-ui');
@@ -13,7 +13,7 @@ var walletAdapterTrust = require('@solana/wallet-adapter-trust');
13
13
  var walletAdapterCoinbase = require('@solana/wallet-adapter-coinbase');
14
14
  var DialogPrimitive = require('@radix-ui/react-dialog');
15
15
  var lucideReact = require('lucide-react');
16
- var clsx = require('clsx');
16
+ var clsx2 = require('clsx');
17
17
  var tailwindMerge = require('tailwind-merge');
18
18
  var jsxRuntime = require('react/jsx-runtime');
19
19
  var countryList = require('country-list');
@@ -48,8 +48,9 @@ function _interopNamespace(e) {
48
48
  return Object.freeze(n);
49
49
  }
50
50
 
51
- var React17__namespace = /*#__PURE__*/_interopNamespace(React17);
51
+ var React15__namespace = /*#__PURE__*/_interopNamespace(React15);
52
52
  var DialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive);
53
+ var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
53
54
  var countryList__default = /*#__PURE__*/_interopDefault(countryList);
54
55
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
55
56
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
@@ -63,30 +64,119 @@ var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimit
63
64
 
64
65
  // src/utils/collect.ts
65
66
  var SCRIPT_SRC = "https://secure.networkmerchants.com/token/Collect.js";
67
+ var baseFieldReset = {
68
+ border: "none",
69
+ "border-bottom": "0",
70
+ "border-top": "0",
71
+ "border-left": "0",
72
+ "border-right": "0",
73
+ "border-width": "0",
74
+ "border-color": "transparent",
75
+ "border-style": "none",
76
+ outline: "none",
77
+ "box-shadow": "none",
78
+ "background-clip": "padding-box",
79
+ "text-decoration": "none"
80
+ };
81
+ var customCss = {
82
+ ...baseFieldReset,
83
+ background: "#0d1325",
84
+ "background-color": "#0d1325",
85
+ color: "#e2e8f0",
86
+ padding: "0",
87
+ margin: "0",
88
+ width: "100%",
89
+ height: "100%",
90
+ "font-size": "15px",
91
+ "letter-spacing": "0.05em",
92
+ "line-height": "1.5"
93
+ };
94
+ var focusCss = {
95
+ ...baseFieldReset,
96
+ color: "#f8fafc",
97
+ "box-shadow": "0 0 0 1px rgba(94,234,212,0.3)"
98
+ };
99
+ var invalidCss = {
100
+ ...baseFieldReset,
101
+ color: "#fecaca",
102
+ "box-shadow": "0 0 0 1px rgba(248,113,113,0.5)"
103
+ };
104
+ var placeholderCss = {
105
+ color: "rgba(226,232,240,0.45)",
106
+ "font-size": "14px",
107
+ "letter-spacing": "0.03em"
108
+ };
109
+ var baseCssString = JSON.stringify(customCss);
110
+ var focusCssString = JSON.stringify(focusCss);
111
+ var invalidCssString = JSON.stringify(invalidCss);
112
+ var placeholderCssString = JSON.stringify(placeholderCss);
113
+ var collectCssConfig = {
114
+ customCss,
115
+ focusCss,
116
+ invalidCss,
117
+ placeholderCss
118
+ };
119
+ var loadPromise = null;
66
120
  var loadCollectJs = (tokenizationKey) => {
67
121
  if (typeof document === "undefined") return;
122
+ if (typeof window !== "undefined" && window.CollectJS) {
123
+ return Promise.resolve();
124
+ }
68
125
  const trimmed = tokenizationKey?.trim();
69
126
  if (!trimmed || trimmed.length < 10) {
70
127
  console.warn("payments-ui: invalid Collect.js key, skipping load");
71
128
  return;
72
129
  }
130
+ if (loadPromise) {
131
+ return loadPromise;
132
+ }
73
133
  const existing = document.querySelector(`script[src="${SCRIPT_SRC}"]`);
74
- if (existing) return;
75
- const script = document.createElement("script");
76
- script.src = SCRIPT_SRC;
77
- script.setAttribute("data-tokenization-key", trimmed);
78
- script.setAttribute("data-field-ccnumber-placeholder", "0000 0000 0000 0000");
79
- script.setAttribute("data-field-ccexp-placeholder", "10 / 25");
80
- script.setAttribute("data-field-cvv-placeholder", "123");
81
- script.setAttribute("data-variant", "inline");
82
- script.async = true;
83
- script.addEventListener("load", () => {
84
- console.log("payments-ui: Collect.js loaded");
85
- });
86
- script.addEventListener("error", (event) => {
87
- console.error("payments-ui: failed to load Collect.js", event);
134
+ if (existing) {
135
+ loadPromise = new Promise((resolve) => {
136
+ existing.addEventListener("load", () => resolve(), { once: true });
137
+ existing.addEventListener("error", () => resolve(), { once: true });
138
+ });
139
+ return loadPromise;
140
+ }
141
+ loadPromise = new Promise((resolve, reject) => {
142
+ const script = document.createElement("script");
143
+ script.src = SCRIPT_SRC;
144
+ script.setAttribute("data-tokenization-key", trimmed);
145
+ script.setAttribute("data-field-ccnumber-placeholder", "0000 0000 0000 0000");
146
+ script.setAttribute("data-field-ccexp-placeholder", "10 / 25");
147
+ script.setAttribute("data-field-cvv-placeholder", "123");
148
+ script.setAttribute("data-variant", "inline");
149
+ script.setAttribute("data-style-sniffer", "false");
150
+ script.setAttribute("data-custom-css", baseCssString);
151
+ script.setAttribute("data-placeholder-css", placeholderCssString);
152
+ script.setAttribute("data-focus-css", focusCssString);
153
+ script.setAttribute("data-invalid-css", invalidCssString);
154
+ script.async = true;
155
+ script.addEventListener("load", () => {
156
+ console.log("payments-ui: Collect.js loaded");
157
+ resolve();
158
+ });
159
+ script.addEventListener("error", (event) => {
160
+ console.error("payments-ui: failed to load Collect.js", event);
161
+ reject(event);
162
+ });
163
+ document.head.appendChild(script);
88
164
  });
89
- document.head.appendChild(script);
165
+ window.__doujinsCollectPromise = loadPromise;
166
+ return loadPromise;
167
+ };
168
+ var waitForCollectJs = async () => {
169
+ if (typeof window === "undefined") return null;
170
+ if (window.CollectJS) return window.CollectJS;
171
+ const promise = loadPromise ?? window.__doujinsCollectPromise;
172
+ if (!promise) return null;
173
+ try {
174
+ await promise;
175
+ return window.CollectJS ?? null;
176
+ } catch (error) {
177
+ console.error("payments-ui: Collect.js failed to initialise", error);
178
+ return null;
179
+ }
90
180
  };
91
181
 
92
182
  // src/lib/client.ts
@@ -292,79 +382,105 @@ var createClient = (config) => {
292
382
  };
293
383
  };
294
384
  function cn(...inputs) {
295
- return tailwindMerge.twMerge(clsx.clsx(inputs));
385
+ return tailwindMerge.twMerge(clsx2.clsx(inputs));
296
386
  }
297
- var Dialog = DialogPrimitive__namespace.Root;
298
- var DialogPortal = DialogPrimitive__namespace.Portal;
299
- var DialogOverlay = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
300
- DialogPrimitive__namespace.Overlay,
301
- {
302
- ref,
303
- className: cn(
304
- "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
305
- className
306
- ),
307
- ...props
308
- }
309
- ));
310
- DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
311
- var DialogContent = React17__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
312
- /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
313
- /* @__PURE__ */ jsxRuntime.jsxs(
314
- DialogPrimitive__namespace.Content,
387
+ function Dialog({
388
+ ...props
389
+ }) {
390
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
391
+ }
392
+ function DialogPortal({
393
+ ...props
394
+ }) {
395
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
396
+ }
397
+ function DialogOverlay({
398
+ className,
399
+ ...props
400
+ }) {
401
+ return /* @__PURE__ */ jsxRuntime.jsx(
402
+ DialogPrimitive__namespace.Overlay,
315
403
  {
316
- ref,
404
+ "data-slot": "dialog-overlay",
317
405
  className: cn(
318
- "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%] sm:rounded-lg",
406
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
319
407
  className
320
408
  ),
321
- ...props,
322
- children: [
323
- children,
324
- /* @__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 data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
325
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" }),
326
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
327
- ] })
328
- ]
409
+ ...props
329
410
  }
330
- )
331
- ] }));
332
- DialogContent.displayName = DialogPrimitive__namespace.Content.displayName;
333
- var DialogHeader = ({
411
+ );
412
+ }
413
+ function DialogContent({
334
414
  className,
415
+ children,
416
+ showCloseButton = true,
335
417
  ...props
336
- }) => /* @__PURE__ */ jsxRuntime.jsx(
337
- "div",
338
- {
339
- className: cn(
340
- "flex flex-col space-y-1.5 text-center sm:text-left",
341
- className
342
- ),
343
- ...props
344
- }
345
- );
346
- DialogHeader.displayName = "DialogHeader";
347
- var DialogTitle = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
348
- DialogPrimitive__namespace.Title,
349
- {
350
- ref,
351
- className: cn(
352
- "text-lg font-semibold leading-none tracking-tight",
353
- className
354
- ),
355
- ...props
356
- }
357
- ));
358
- DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
359
- var DialogDescription = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
360
- DialogPrimitive__namespace.Description,
361
- {
362
- ref,
363
- className: cn("text-sm text-muted-foreground", className),
364
- ...props
365
- }
366
- ));
367
- DialogDescription.displayName = DialogPrimitive__namespace.Description.displayName;
418
+ }) {
419
+ return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
420
+ /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
421
+ /* @__PURE__ */ jsxRuntime.jsxs(
422
+ DialogPrimitive__namespace.Content,
423
+ {
424
+ "data-slot": "dialog-content",
425
+ className: cn(
426
+ "bg-background 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 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg",
427
+ className
428
+ ),
429
+ ...props,
430
+ children: [
431
+ children,
432
+ showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
433
+ DialogPrimitive__namespace.Close,
434
+ {
435
+ "data-slot": "dialog-close",
436
+ className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
437
+ children: [
438
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, {}),
439
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
440
+ ]
441
+ }
442
+ )
443
+ ]
444
+ }
445
+ )
446
+ ] });
447
+ }
448
+ function DialogHeader({ className, ...props }) {
449
+ return /* @__PURE__ */ jsxRuntime.jsx(
450
+ "div",
451
+ {
452
+ "data-slot": "dialog-header",
453
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
454
+ ...props
455
+ }
456
+ );
457
+ }
458
+ function DialogTitle({
459
+ className,
460
+ ...props
461
+ }) {
462
+ return /* @__PURE__ */ jsxRuntime.jsx(
463
+ DialogPrimitive__namespace.Title,
464
+ {
465
+ "data-slot": "dialog-title",
466
+ className: cn("text-lg leading-none font-semibold", className),
467
+ ...props
468
+ }
469
+ );
470
+ }
471
+ function DialogDescription({
472
+ className,
473
+ ...props
474
+ }) {
475
+ return /* @__PURE__ */ jsxRuntime.jsx(
476
+ DialogPrimitive__namespace.Description,
477
+ {
478
+ "data-slot": "dialog-description",
479
+ className: cn("text-muted-foreground text-sm", className),
480
+ ...props
481
+ }
482
+ );
483
+ }
368
484
  var customCountries = [
369
485
  { code: "TW", name: "Taiwan, Province of China" },
370
486
  { code: "KR", name: "Korea" },
@@ -405,7 +521,7 @@ var buttonVariants = classVarianceAuthority.cva(
405
521
  }
406
522
  }
407
523
  );
408
- var Button = React17__namespace.forwardRef(
524
+ var Button = React15__namespace.forwardRef(
409
525
  ({ className, variant, size, asChild = false, ...props }, ref) => {
410
526
  const Comp = asChild ? reactSlot.Slot : "button";
411
527
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -419,7 +535,7 @@ var Button = React17__namespace.forwardRef(
419
535
  }
420
536
  );
421
537
  Button.displayName = "Button";
422
- var Input = React17__namespace.forwardRef(
538
+ var Input = React15__namespace.forwardRef(
423
539
  ({ className, type, ...props }, ref) => {
424
540
  return /* @__PURE__ */ jsxRuntime.jsx(
425
541
  "input",
@@ -439,7 +555,7 @@ Input.displayName = "Input";
439
555
  var labelVariants = classVarianceAuthority.cva(
440
556
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
441
557
  );
442
- var Label = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
558
+ var Label = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
443
559
  LabelPrimitive__namespace.Root,
444
560
  {
445
561
  ref,
@@ -450,7 +566,7 @@ var Label = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @
450
566
  Label.displayName = LabelPrimitive__namespace.Root.displayName;
451
567
  var Select = SelectPrimitive__namespace.Root;
452
568
  var SelectValue = SelectPrimitive__namespace.Value;
453
- var SelectTrigger = React17__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
569
+ var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
454
570
  SelectPrimitive__namespace.Trigger,
455
571
  {
456
572
  ref,
@@ -466,7 +582,7 @@ var SelectTrigger = React17__namespace.forwardRef(({ className, children, ...pro
466
582
  }
467
583
  ));
468
584
  SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
469
- var SelectScrollUpButton = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
585
+ var SelectScrollUpButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
470
586
  SelectPrimitive__namespace.ScrollUpButton,
471
587
  {
472
588
  ref,
@@ -479,7 +595,7 @@ var SelectScrollUpButton = React17__namespace.forwardRef(({ className, ...props
479
595
  }
480
596
  ));
481
597
  SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
482
- var SelectScrollDownButton = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
598
+ var SelectScrollDownButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
483
599
  SelectPrimitive__namespace.ScrollDownButton,
484
600
  {
485
601
  ref,
@@ -492,7 +608,7 @@ var SelectScrollDownButton = React17__namespace.forwardRef(({ className, ...prop
492
608
  }
493
609
  ));
494
610
  SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
495
- var SelectContent = React17__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
611
+ var SelectContent = React15__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
496
612
  SelectPrimitive__namespace.Content,
497
613
  {
498
614
  ref,
@@ -520,7 +636,7 @@ var SelectContent = React17__namespace.forwardRef(({ className, children, positi
520
636
  }
521
637
  ) }));
522
638
  SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
523
- var SelectLabel = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
639
+ var SelectLabel = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
524
640
  SelectPrimitive__namespace.Label,
525
641
  {
526
642
  ref,
@@ -529,7 +645,7 @@ var SelectLabel = React17__namespace.forwardRef(({ className, ...props }, ref) =
529
645
  }
530
646
  ));
531
647
  SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
532
- var SelectItem = React17__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
648
+ var SelectItem = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
533
649
  SelectPrimitive__namespace.Item,
534
650
  {
535
651
  ref,
@@ -545,7 +661,7 @@ var SelectItem = React17__namespace.forwardRef(({ className, children, ...props
545
661
  }
546
662
  ));
547
663
  SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
548
- var SelectSeparator = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
664
+ var SelectSeparator = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
549
665
  SelectPrimitive__namespace.Separator,
550
666
  {
551
667
  ref,
@@ -581,8 +697,8 @@ var CardDetailsForm = ({
581
697
  submitDisabled = false
582
698
  }) => {
583
699
  const { config } = usePaymentContext();
584
- const defaultValuesKey = React17.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
585
- const mergedDefaults = React17.useMemo(
700
+ const defaultValuesKey = React15.useMemo(() => JSON.stringify(defaultValues ?? {}), [defaultValues]);
701
+ const mergedDefaults = React15.useMemo(
586
702
  () => ({
587
703
  ...defaultBillingDetails,
588
704
  ...defaultValues,
@@ -590,23 +706,38 @@ var CardDetailsForm = ({
590
706
  }),
591
707
  [defaultValuesKey, config.defaultUser?.email]
592
708
  );
593
- const [firstName, setFirstName] = React17.useState(mergedDefaults.firstName);
594
- const [lastName, setLastName] = React17.useState(mergedDefaults.lastName);
595
- const [address1, setAddress1] = React17.useState(mergedDefaults.address1);
596
- const [city, setCity] = React17.useState(mergedDefaults.city);
597
- const [stateRegion, setStateRegion] = React17.useState(mergedDefaults.stateRegion ?? "");
598
- const [postalCode, setPostalCode] = React17.useState(mergedDefaults.postalCode);
599
- const [country, setCountry] = React17.useState(mergedDefaults.country);
600
- const [email, setEmail] = React17.useState(mergedDefaults.email ?? "");
601
- const [localError, setLocalError] = React17.useState(null);
602
- const [isTokenizing, setIsTokenizing] = React17.useState(false);
603
- React17.useEffect(() => {
709
+ const [firstName, setFirstName] = React15.useState(mergedDefaults.firstName);
710
+ const [lastName, setLastName] = React15.useState(mergedDefaults.lastName);
711
+ const [address1, setAddress1] = React15.useState(mergedDefaults.address1);
712
+ const [city, setCity] = React15.useState(mergedDefaults.city);
713
+ const [stateRegion, setStateRegion] = React15.useState(mergedDefaults.stateRegion ?? "");
714
+ const [postalCode, setPostalCode] = React15.useState(mergedDefaults.postalCode);
715
+ const [country, setCountry] = React15.useState(mergedDefaults.country);
716
+ const [email, setEmail] = React15.useState(mergedDefaults.email ?? "");
717
+ const [localError, setLocalError] = React15.useState(null);
718
+ const [isTokenizing, setIsTokenizing] = React15.useState(false);
719
+ const [collectReady, setCollectReady] = React15.useState(
720
+ typeof window !== "undefined" && Boolean(window.CollectJS)
721
+ );
722
+ React15.useEffect(() => {
723
+ if (collectReady) return;
724
+ let active = true;
725
+ waitForCollectJs().then((instance) => {
726
+ if (active && instance) {
727
+ setCollectReady(true);
728
+ }
729
+ });
730
+ return () => {
731
+ active = false;
732
+ };
733
+ }, [collectReady]);
734
+ React15.useEffect(() => {
604
735
  if (!visible) {
605
736
  setLocalError(null);
606
737
  setIsTokenizing(false);
607
738
  }
608
739
  }, [visible]);
609
- React17.useEffect(() => {
740
+ React15.useEffect(() => {
610
741
  if (!visible) return;
611
742
  setFirstName(mergedDefaults.firstName);
612
743
  setLastName(mergedDefaults.lastName);
@@ -617,7 +748,7 @@ var CardDetailsForm = ({
617
748
  setCountry(mergedDefaults.country);
618
749
  setEmail(mergedDefaults.email ?? "");
619
750
  }, [defaultValuesKey, mergedDefaults, visible]);
620
- React17.useEffect(() => {
751
+ React15.useEffect(() => {
621
752
  if (!onBillingChange) return;
622
753
  onBillingChange({
623
754
  firstName,
@@ -642,8 +773,22 @@ var CardDetailsForm = ({
642
773
  mergedDefaults.provider,
643
774
  onBillingChange
644
775
  ]);
645
- React17.useEffect(() => {
646
- if (typeof window === "undefined" || !window.CollectJS || !visible) {
776
+ const sanitizeCollectField = (field) => {
777
+ const sanitized = { ...field };
778
+ if ("style_input" in sanitized || "style_placeholder" in sanitized) {
779
+ delete sanitized.style_input;
780
+ delete sanitized.style_placeholder;
781
+ if (typeof window !== "undefined") {
782
+ console.warn(
783
+ "[payments-ui] stripping unsupported Collect.js style fields",
784
+ Object.keys(field).filter((key) => key.startsWith("style_"))
785
+ );
786
+ }
787
+ }
788
+ return sanitized;
789
+ };
790
+ React15.useEffect(() => {
791
+ if (!collectReady || typeof window === "undefined" || !window.CollectJS || !visible) {
647
792
  return;
648
793
  }
649
794
  const handlers = window.__doujinsCollectHandlers || (window.__doujinsCollectHandlers = {});
@@ -670,10 +815,14 @@ var CardDetailsForm = ({
670
815
  if (!configured[collectPrefix]) {
671
816
  window.CollectJS.configure({
672
817
  variant: "inline",
818
+ customCss: collectCssConfig.customCss,
819
+ focusCss: collectCssConfig.focusCss,
820
+ invalidCss: collectCssConfig.invalidCss,
821
+ placeholderCss: collectCssConfig.placeholderCss,
673
822
  fields: {
674
- ccnumber: { selector: buildSelector(collectPrefix, "ccnumber") },
675
- ccexp: { selector: buildSelector(collectPrefix, "ccexp") },
676
- cvv: { selector: buildSelector(collectPrefix, "cvv") }
823
+ ccnumber: sanitizeCollectField({ selector: buildSelector(collectPrefix, "ccnumber") }),
824
+ ccexp: sanitizeCollectField({ selector: buildSelector(collectPrefix, "ccexp") }),
825
+ cvv: sanitizeCollectField({ selector: buildSelector(collectPrefix, "cvv") })
677
826
  },
678
827
  callback: (response) => {
679
828
  const fn = window.__doujinsCollectHandlers?.[collectPrefix];
@@ -684,6 +833,7 @@ var CardDetailsForm = ({
684
833
  }
685
834
  }, [
686
835
  collectPrefix,
836
+ collectReady,
687
837
  firstName,
688
838
  lastName,
689
839
  address1,
@@ -715,22 +865,22 @@ var CardDetailsForm = ({
715
865
  window.CollectJS.startPaymentRequest();
716
866
  };
717
867
  const errorMessage = localError ?? externalError;
718
- const collectFieldClass = "flex h-11 w-full items-center rounded-md border border-white/10 bg-white/5 px-3 text-sm text-white";
868
+ const collectFieldClass = "relative flex h-11 w-full items-center overflow-hidden rounded-md border border-border/60 bg-background/40 px-3 text-sm text-foreground";
719
869
  return /* @__PURE__ */ jsxRuntime.jsxs(
720
870
  "form",
721
871
  {
722
- className: cn("space-y-5", className),
872
+ className: cn("space-y-2", className),
723
873
  onSubmit: handleSubmit,
724
874
  noValidate: true,
725
875
  children: [
726
876
  errorMessage && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-red-500/40 bg-red-500/10 px-4 py-2 text-sm text-red-400", children: errorMessage }),
727
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 md:flex-row", children: [
877
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 md:flex-row", children: [
728
878
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
729
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-first", children: "First name" }),
879
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "firstName", children: "First name" }),
730
880
  /* @__PURE__ */ jsxRuntime.jsx(
731
881
  Input,
732
882
  {
733
- id: "payments-first",
883
+ id: "firstName",
734
884
  value: firstName,
735
885
  onChange: (e) => setFirstName(e.target.value),
736
886
  required: true
@@ -738,11 +888,11 @@ var CardDetailsForm = ({
738
888
  )
739
889
  ] }),
740
890
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 space-y-2", children: [
741
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-last", children: "Last name" }),
891
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "lastName", children: "Last name" }),
742
892
  /* @__PURE__ */ jsxRuntime.jsx(
743
893
  Input,
744
894
  {
745
- id: "payments-last",
895
+ id: "lastName",
746
896
  value: lastName,
747
897
  onChange: (e) => setLastName(e.target.value),
748
898
  required: true
@@ -751,11 +901,11 @@ var CardDetailsForm = ({
751
901
  ] })
752
902
  ] }),
753
903
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
754
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-email", children: "Email" }),
904
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "email", children: "Email" }),
755
905
  /* @__PURE__ */ jsxRuntime.jsx(
756
906
  Input,
757
907
  {
758
- id: "payments-email",
908
+ id: "email",
759
909
  type: "email",
760
910
  value: email,
761
911
  onChange: (e) => setEmail(e.target.value),
@@ -764,24 +914,24 @@ var CardDetailsForm = ({
764
914
  )
765
915
  ] }),
766
916
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
767
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-address1", children: "Address" }),
917
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "address1", children: "Address" }),
768
918
  /* @__PURE__ */ jsxRuntime.jsx(
769
919
  Input,
770
920
  {
771
- id: "payments-address1",
921
+ id: "address1",
772
922
  value: address1,
773
923
  onChange: (e) => setAddress1(e.target.value),
774
924
  required: true
775
925
  }
776
926
  )
777
927
  ] }),
778
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
928
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
779
929
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
780
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-city", children: "City" }),
930
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "city", children: "City" }),
781
931
  /* @__PURE__ */ jsxRuntime.jsx(
782
932
  Input,
783
933
  {
784
- id: "payments-city",
934
+ id: "city",
785
935
  value: city,
786
936
  onChange: (e) => setCity(e.target.value),
787
937
  required: true
@@ -789,24 +939,24 @@ var CardDetailsForm = ({
789
939
  )
790
940
  ] }),
791
941
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
792
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-state", children: "State / Region" }),
942
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "state", children: "State / Region" }),
793
943
  /* @__PURE__ */ jsxRuntime.jsx(
794
944
  Input,
795
945
  {
796
- id: "payments-state",
946
+ id: "state",
797
947
  value: stateRegion,
798
948
  onChange: (e) => setStateRegion(e.target.value)
799
949
  }
800
950
  )
801
951
  ] })
802
952
  ] }),
803
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
953
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
804
954
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
805
- /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "payments-postal", children: "Postal code" }),
955
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "postal", children: "Postal code" }),
806
956
  /* @__PURE__ */ jsxRuntime.jsx(
807
957
  Input,
808
958
  {
809
- id: "payments-postal",
959
+ id: "postal",
810
960
  value: postalCode,
811
961
  onChange: (e) => setPostalCode(e.target.value),
812
962
  required: true
@@ -825,7 +975,7 @@ var CardDetailsForm = ({
825
975
  /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Card number" }),
826
976
  /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccnumber").slice(1), className: collectFieldClass })
827
977
  ] }),
828
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
978
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
829
979
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
830
980
  /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Expiry" }),
831
981
  /* @__PURE__ */ jsxRuntime.jsx("div", { id: buildSelector(collectPrefix, "ccexp").slice(1), className: collectFieldClass })
@@ -923,7 +1073,7 @@ var badgeVariants = classVarianceAuthority.cva(
923
1073
  function Badge({ className, variant, ...props }) {
924
1074
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
925
1075
  }
926
- var ScrollArea = React17__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
1076
+ var ScrollArea = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
927
1077
  ScrollAreaPrimitive__namespace.Root,
928
1078
  {
929
1079
  ref,
@@ -937,7 +1087,7 @@ var ScrollArea = React17__namespace.forwardRef(({ className, children, ...props
937
1087
  }
938
1088
  ));
939
1089
  ScrollArea.displayName = ScrollAreaPrimitive__namespace.Root.displayName;
940
- var ScrollBar = React17__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1090
+ var ScrollBar = React15__namespace.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
941
1091
  ScrollAreaPrimitive__namespace.ScrollAreaScrollbar,
942
1092
  {
943
1093
  ref,
@@ -960,158 +1110,119 @@ var formatCardLabel = (method) => {
960
1110
  };
961
1111
  var StoredPaymentMethods = ({
962
1112
  selectedMethodId,
963
- onMethodSelect,
964
- showAddButton = true
1113
+ onMethodSelect
965
1114
  }) => {
966
- const { listQuery, createMutation, deleteMutation } = usePaymentMethods();
967
- const [isModalOpen, setIsModalOpen] = React17.useState(false);
968
- const [deletingId, setDeletingId] = React17.useState(null);
969
- const payments = React17.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
970
- const handleCardTokenize = (token, billing) => {
971
- createMutation.mutate({ token, billing });
972
- };
973
- const handleDelete = (method) => {
974
- setDeletingId(method.id);
975
- deleteMutation.mutate(
976
- { id: method.id },
1115
+ const { listQuery } = usePaymentMethods();
1116
+ const payments = React15.useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
1117
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: listQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
1118
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1119
+ " Loading cards..."
1120
+ ] }) : payments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center 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) => {
1121
+ const isSelected = selectedMethodId === method.id;
1122
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1123
+ "div",
977
1124
  {
978
- onSettled: () => setDeletingId(null)
979
- }
1125
+ className: cn(
1126
+ "flex border border-border rounded-md px-4 py-3 flex-row items-center justify-between",
1127
+ {
1128
+ "bg-muted/20": isSelected
1129
+ }
1130
+ ),
1131
+ children: [
1132
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
1133
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1134
+ method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason }),
1135
+ onMethodSelect && /* @__PURE__ */ jsxRuntime.jsx(
1136
+ Button,
1137
+ {
1138
+ size: "sm",
1139
+ variant: "ghost",
1140
+ disabled: isSelected,
1141
+ onClick: () => onMethodSelect(method),
1142
+ className: clsx2__default.default("px-3", { "bg-muted/90": !isSelected, "bg-inherit": isSelected }),
1143
+ children: isSelected ? "Selected" : "Use card"
1144
+ }
1145
+ )
1146
+ ] })
1147
+ ]
1148
+ },
1149
+ method.id
980
1150
  );
981
- };
982
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
983
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start justify-between gap-4", children: showAddButton && /* @__PURE__ */ jsxRuntime.jsx(Button, { size: "sm", variant: "ghost", onClick: () => setIsModalOpen(true), children: "Add card" }) }),
984
- listQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
985
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
986
- " Loading cards..."
987
- ] }) : payments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center 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) => {
988
- const isSelected = selectedMethodId === method.id;
989
- return /* @__PURE__ */ jsxRuntime.jsxs(
990
- "div",
991
- {
992
- className: cn(
993
- "flex flex-col gap-3 rounded-md px-4 py-3 transition-colors md:flex-row md:items-center md:justify-between",
994
- isSelected ? "ring-1 ring-primary/70 bg-primary/5" : "ring-1 ring-border/40 bg-transparent"
995
- ),
996
- children: [
997
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
998
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
999
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
1000
- "Added on",
1001
- " ",
1002
- method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown"
1003
- ] })
1004
- ] }),
1005
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1006
- /* @__PURE__ */ jsxRuntime.jsx(
1007
- Badge,
1008
- {
1009
- variant: method.is_active ? "default" : "secondary",
1010
- className: cn(
1011
- method.is_active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground"
1012
- ),
1013
- children: method.is_active ? "Active" : "Inactive"
1014
- }
1015
- ),
1016
- method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason }),
1017
- onMethodSelect && /* @__PURE__ */ jsxRuntime.jsx(
1018
- Button,
1019
- {
1020
- size: "sm",
1021
- variant: "ghost",
1022
- className: "px-3",
1023
- onClick: () => onMethodSelect(method),
1024
- children: isSelected ? "Selected" : "Use card"
1025
- }
1026
- ),
1027
- /* @__PURE__ */ jsxRuntime.jsx(
1028
- Button,
1029
- {
1030
- size: "sm",
1031
- variant: "ghost",
1032
- className: "px-3 text-destructive",
1033
- onClick: () => handleDelete(method),
1034
- disabled: deletingId === method.id && deleteMutation.isPending,
1035
- children: deletingId === method.id && deleteMutation.isPending ? "Removing\u2026" : "Remove"
1036
- }
1037
- )
1038
- ] })
1039
- ]
1040
- },
1041
- method.id
1042
- );
1043
- }) }) }),
1044
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto", children: [
1045
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
1046
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Add a new card" }),
1047
- /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: "Your card details are tokenized securely via our payment provider." })
1048
- ] }),
1049
- /* @__PURE__ */ jsxRuntime.jsx(
1050
- CardDetailsForm,
1051
- {
1052
- visible: isModalOpen,
1053
- collectPrefix: "payments-ui-card",
1054
- submitting: createMutation.isPending,
1055
- submitLabel: "Save card",
1056
- externalError: createMutation.error?.message ?? null,
1057
- onTokenize: handleCardTokenize
1058
- }
1059
- )
1060
- ] }) })
1061
- ] });
1151
+ }) }) }) });
1062
1152
  };
1063
- var Tabs = TabsPrimitive__namespace.Root;
1064
- var TabsList = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1065
- TabsPrimitive__namespace.List,
1066
- {
1067
- ref,
1068
- className: cn(
1069
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
1070
- className
1071
- ),
1072
- ...props
1073
- }
1074
- ));
1075
- TabsList.displayName = TabsPrimitive__namespace.List.displayName;
1076
- var TabsTrigger = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1077
- TabsPrimitive__namespace.Trigger,
1078
- {
1079
- ref,
1080
- className: cn(
1081
- "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-sm",
1082
- className
1083
- ),
1084
- ...props
1085
- }
1086
- ));
1087
- TabsTrigger.displayName = TabsPrimitive__namespace.Trigger.displayName;
1088
- var TabsContent = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1089
- TabsPrimitive__namespace.Content,
1090
- {
1091
- ref,
1092
- className: cn(
1093
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1094
- className
1095
- ),
1096
- ...props
1097
- }
1098
- ));
1099
- TabsContent.displayName = TabsPrimitive__namespace.Content.displayName;
1153
+ function Tabs({
1154
+ className,
1155
+ ...props
1156
+ }) {
1157
+ return /* @__PURE__ */ jsxRuntime.jsx(
1158
+ TabsPrimitive__namespace.Root,
1159
+ {
1160
+ "data-slot": "tabs",
1161
+ className: cn("flex flex-col gap-2", className),
1162
+ ...props
1163
+ }
1164
+ );
1165
+ }
1166
+ function TabsList({
1167
+ className,
1168
+ ...props
1169
+ }) {
1170
+ return /* @__PURE__ */ jsxRuntime.jsx(
1171
+ TabsPrimitive__namespace.List,
1172
+ {
1173
+ "data-slot": "tabs-list",
1174
+ className: cn(
1175
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
1176
+ className
1177
+ ),
1178
+ ...props
1179
+ }
1180
+ );
1181
+ }
1182
+ function TabsTrigger({
1183
+ className,
1184
+ ...props
1185
+ }) {
1186
+ return /* @__PURE__ */ jsxRuntime.jsx(
1187
+ TabsPrimitive__namespace.Trigger,
1188
+ {
1189
+ "data-slot": "tabs-trigger",
1190
+ className: cn(
1191
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
1192
+ className
1193
+ ),
1194
+ ...props
1195
+ }
1196
+ );
1197
+ }
1198
+ function TabsContent({
1199
+ className,
1200
+ ...props
1201
+ }) {
1202
+ return /* @__PURE__ */ jsxRuntime.jsx(
1203
+ TabsPrimitive__namespace.Content,
1204
+ {
1205
+ "data-slot": "tabs-content",
1206
+ className: cn("flex-1 outline-none", className),
1207
+ ...props
1208
+ }
1209
+ );
1210
+ }
1100
1211
  var usePaymentNotifications = () => {
1101
1212
  const { config } = usePaymentContext();
1102
- const notifyStatus = React17.useCallback(
1213
+ const notifyStatus = React15.useCallback(
1103
1214
  (status, context) => {
1104
1215
  config.callbacks?.onStatusChange?.({ status, context });
1105
1216
  },
1106
1217
  [config.callbacks]
1107
1218
  );
1108
- const notifySuccess = React17.useCallback(
1219
+ const notifySuccess = React15.useCallback(
1109
1220
  (payload) => {
1110
1221
  config.callbacks?.onSuccess?.(payload ?? {});
1111
1222
  },
1112
1223
  [config.callbacks]
1113
1224
  );
1114
- const notifyError = React17.useCallback(
1225
+ const notifyError = React15.useCallback(
1115
1226
  (error) => {
1116
1227
  config.callbacks?.onError?.(
1117
1228
  typeof error === "string" ? new Error(error) : error
@@ -1129,17 +1240,17 @@ var useSolanaQrPayment = (options) => {
1129
1240
  const { priceId, selectedToken, onSuccess, onError } = options;
1130
1241
  const { client } = usePaymentContext();
1131
1242
  const tokenSymbol = selectedToken?.symbol ?? null;
1132
- const onSuccessRef = React17.useRef(onSuccess);
1133
- const onErrorRef = React17.useRef(onError);
1134
- const [intent, setIntent] = React17.useState(null);
1135
- const [qrDataUri, setQrDataUri] = React17.useState(null);
1136
- const [isLoading, setIsLoading] = React17.useState(false);
1137
- const [error, setError] = React17.useState(null);
1138
- const [timeRemaining, setTimeRemaining] = React17.useState(0);
1139
- const [refreshNonce, setRefreshNonce] = React17.useState(0);
1140
- const pollRef = React17.useRef(null);
1141
- const countdownRef = React17.useRef(null);
1142
- const clearTimers = React17.useCallback(() => {
1243
+ const onSuccessRef = React15.useRef(onSuccess);
1244
+ const onErrorRef = React15.useRef(onError);
1245
+ const [intent, setIntent] = React15.useState(null);
1246
+ const [qrDataUri, setQrDataUri] = React15.useState(null);
1247
+ const [isLoading, setIsLoading] = React15.useState(false);
1248
+ const [error, setError] = React15.useState(null);
1249
+ const [timeRemaining, setTimeRemaining] = React15.useState(0);
1250
+ const [refreshNonce, setRefreshNonce] = React15.useState(0);
1251
+ const pollRef = React15.useRef(null);
1252
+ const countdownRef = React15.useRef(null);
1253
+ const clearTimers = React15.useCallback(() => {
1143
1254
  if (pollRef.current) {
1144
1255
  clearInterval(pollRef.current);
1145
1256
  pollRef.current = null;
@@ -1149,12 +1260,12 @@ var useSolanaQrPayment = (options) => {
1149
1260
  countdownRef.current = null;
1150
1261
  }
1151
1262
  }, []);
1152
- React17.useEffect(() => {
1263
+ React15.useEffect(() => {
1153
1264
  return () => {
1154
1265
  clearTimers();
1155
1266
  };
1156
1267
  }, [clearTimers]);
1157
- const resetState = React17.useCallback(
1268
+ const resetState = React15.useCallback(
1158
1269
  (message) => {
1159
1270
  clearTimers();
1160
1271
  setIntent(null);
@@ -1164,13 +1275,13 @@ var useSolanaQrPayment = (options) => {
1164
1275
  },
1165
1276
  [clearTimers]
1166
1277
  );
1167
- React17.useEffect(() => {
1278
+ React15.useEffect(() => {
1168
1279
  onSuccessRef.current = onSuccess;
1169
1280
  }, [onSuccess]);
1170
- React17.useEffect(() => {
1281
+ React15.useEffect(() => {
1171
1282
  onErrorRef.current = onError;
1172
1283
  }, [onError]);
1173
- const handleError = React17.useCallback(
1284
+ const handleError = React15.useCallback(
1174
1285
  (message, notifyParent = false) => {
1175
1286
  console.error("[payments-ui] Solana Pay QR error:", message);
1176
1287
  clearTimers();
@@ -1181,7 +1292,7 @@ var useSolanaQrPayment = (options) => {
1181
1292
  },
1182
1293
  [clearTimers, resetState]
1183
1294
  );
1184
- const handleSuccess = React17.useCallback(
1295
+ const handleSuccess = React15.useCallback(
1185
1296
  (status) => {
1186
1297
  clearTimers();
1187
1298
  resetState(null);
@@ -1195,7 +1306,7 @@ var useSolanaQrPayment = (options) => {
1195
1306
  },
1196
1307
  [clearTimers, resetState]
1197
1308
  );
1198
- const pollStatus = React17.useCallback(
1309
+ const pollStatus = React15.useCallback(
1199
1310
  async (reference) => {
1200
1311
  try {
1201
1312
  const status = await client.getSolanaPayStatus(reference);
@@ -1214,7 +1325,7 @@ var useSolanaQrPayment = (options) => {
1214
1325
  },
1215
1326
  [handleError, handleSuccess, client]
1216
1327
  );
1217
- const startCountdown = React17.useCallback(
1328
+ const startCountdown = React15.useCallback(
1218
1329
  (expiresAt, reference) => {
1219
1330
  const updateTime = () => {
1220
1331
  const remaining = Math.max(0, Math.floor(expiresAt - Date.now() / 1e3));
@@ -1229,7 +1340,7 @@ var useSolanaQrPayment = (options) => {
1229
1340
  },
1230
1341
  [handleError, pollStatus]
1231
1342
  );
1232
- const renderQr = React17.useCallback(async (qrIntent) => {
1343
+ const renderQr = React15.useCallback(async (qrIntent) => {
1233
1344
  try {
1234
1345
  const dataUri = await QRCode__default.default.toDataURL(qrIntent.url, {
1235
1346
  width: 320,
@@ -1245,7 +1356,7 @@ var useSolanaQrPayment = (options) => {
1245
1356
  handleError("Unable to render QR code");
1246
1357
  }
1247
1358
  }, [handleError]);
1248
- React17.useEffect(() => {
1359
+ React15.useEffect(() => {
1249
1360
  let cancelled = false;
1250
1361
  const generateIntent = async () => {
1251
1362
  clearTimers();
@@ -1309,7 +1420,7 @@ var useSolanaQrPayment = (options) => {
1309
1420
  tokenSymbol,
1310
1421
  refreshNonce
1311
1422
  ]);
1312
- const refresh = React17.useCallback(() => {
1423
+ const refresh = React15.useCallback(() => {
1313
1424
  setRefreshNonce((value) => value + 1);
1314
1425
  }, []);
1315
1426
  return {
@@ -1321,7 +1432,7 @@ var useSolanaQrPayment = (options) => {
1321
1432
  refresh
1322
1433
  };
1323
1434
  };
1324
- var Card = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1435
+ var Card = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1325
1436
  "div",
1326
1437
  {
1327
1438
  ref,
@@ -1333,7 +1444,7 @@ var Card = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @_
1333
1444
  }
1334
1445
  ));
1335
1446
  Card.displayName = "Card";
1336
- var CardHeader = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1447
+ var CardHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1337
1448
  "div",
1338
1449
  {
1339
1450
  ref,
@@ -1342,7 +1453,7 @@ var CardHeader = React17__namespace.forwardRef(({ className, ...props }, ref) =>
1342
1453
  }
1343
1454
  ));
1344
1455
  CardHeader.displayName = "CardHeader";
1345
- var CardTitle = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1456
+ var CardTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1346
1457
  "div",
1347
1458
  {
1348
1459
  ref,
@@ -1354,7 +1465,7 @@ var CardTitle = React17__namespace.forwardRef(({ className, ...props }, ref) =>
1354
1465
  }
1355
1466
  ));
1356
1467
  CardTitle.displayName = "CardTitle";
1357
- var CardDescription = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1468
+ var CardDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1358
1469
  "div",
1359
1470
  {
1360
1471
  ref,
@@ -1363,9 +1474,9 @@ var CardDescription = React17__namespace.forwardRef(({ className, ...props }, re
1363
1474
  }
1364
1475
  ));
1365
1476
  CardDescription.displayName = "CardDescription";
1366
- var CardContent = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1477
+ var CardContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1367
1478
  CardContent.displayName = "CardContent";
1368
- var CardFooter = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1479
+ var CardFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
1369
1480
  "div",
1370
1481
  {
1371
1482
  ref,
@@ -1380,7 +1491,7 @@ var QRCodePayment = ({
1380
1491
  onPaymentError,
1381
1492
  onPaymentSuccess
1382
1493
  }) => {
1383
- const handleQrSuccess = React17__namespace.default.useCallback(
1494
+ const handleQrSuccess = React15__namespace.default.useCallback(
1384
1495
  (paymentId, txId) => {
1385
1496
  if (!paymentId && !txId) {
1386
1497
  onPaymentError("Missing payment confirmation details");
@@ -1398,9 +1509,9 @@ var QRCodePayment = ({
1398
1509
  onSuccess: handleQrSuccess
1399
1510
  });
1400
1511
  if (!selectedToken) {
1401
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md 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." });
1512
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-md border border-dashed bg-muted/10 px-4 py-6 text-center text-sm text-muted-foreground", children: "Select a token to continue." });
1402
1513
  }
1403
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6 shadow-none rounded-md", children: [
1514
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "space-y-4 border bg-background/80 p-6 shadow-none rounded-md", children: [
1404
1515
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between", children: [
1405
1516
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1406
1517
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Scan with Solana Pay" }),
@@ -1419,7 +1530,7 @@ var QRCodePayment = ({
1419
1530
  )
1420
1531
  ] }),
1421
1532
  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 }),
1422
- /* @__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: [
1533
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed 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 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: [
1423
1534
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-5 w-5 animate-spin" }),
1424
1535
  " Generating QR code\u2026"
1425
1536
  ] }) : "QR code unavailable" }) }),
@@ -1489,16 +1600,16 @@ var PaymentStatus = ({
1489
1600
  };
1490
1601
  var useSupportedTokens = () => {
1491
1602
  const { client } = usePaymentContext();
1492
- const [tokens, setTokens] = React17.useState([]);
1493
- const [isLoading, setIsLoading] = React17.useState(false);
1494
- const [error, setError] = React17.useState(null);
1495
- const [lastFetched, setLastFetched] = React17.useState(null);
1603
+ const [tokens, setTokens] = React15.useState([]);
1604
+ const [isLoading, setIsLoading] = React15.useState(false);
1605
+ const [error, setError] = React15.useState(null);
1606
+ const [lastFetched, setLastFetched] = React15.useState(null);
1496
1607
  const CACHE_DURATION = 5 * 60 * 1e3;
1497
- const tokensRef = React17.useRef(tokens);
1498
- const lastFetchedRef = React17.useRef(lastFetched);
1608
+ const tokensRef = React15.useRef(tokens);
1609
+ const lastFetchedRef = React15.useRef(lastFetched);
1499
1610
  tokensRef.current = tokens;
1500
1611
  lastFetchedRef.current = lastFetched;
1501
- const fetchSupportedTokens = React17.useCallback(async () => {
1612
+ const fetchSupportedTokens = React15.useCallback(async () => {
1502
1613
  if (tokensRef.current.length > 0 && lastFetchedRef.current && Date.now() - lastFetchedRef.current < CACHE_DURATION) {
1503
1614
  return tokensRef.current;
1504
1615
  }
@@ -1525,50 +1636,50 @@ var useSupportedTokens = () => {
1525
1636
  setIsLoading(false);
1526
1637
  }
1527
1638
  }, [client]);
1528
- React17.useEffect(() => {
1639
+ React15.useEffect(() => {
1529
1640
  if (tokens.length === 0) {
1530
1641
  fetchSupportedTokens();
1531
1642
  }
1532
1643
  }, [tokens.length, fetchSupportedTokens]);
1533
- const getTokenBySymbol = React17.useCallback(
1644
+ const getTokenBySymbol = React15.useCallback(
1534
1645
  (symbol) => {
1535
1646
  return tokens.find((token) => token.symbol === symbol);
1536
1647
  },
1537
1648
  [tokens]
1538
1649
  );
1539
- const getTokenByMint = React17.useCallback(
1650
+ const getTokenByMint = React15.useCallback(
1540
1651
  (mintAddress) => {
1541
1652
  return tokens.find((token) => token.mint === mintAddress);
1542
1653
  },
1543
1654
  [tokens]
1544
1655
  );
1545
- const isTokenSupported = React17.useCallback(
1656
+ const isTokenSupported = React15.useCallback(
1546
1657
  (symbol) => {
1547
1658
  return tokens.some((token) => token.symbol === symbol);
1548
1659
  },
1549
1660
  [tokens]
1550
1661
  );
1551
- const getUSDCToken = React17.useCallback(() => {
1662
+ const getUSDCToken = React15.useCallback(() => {
1552
1663
  return getTokenBySymbol("USDC");
1553
1664
  }, [getTokenBySymbol]);
1554
- const getPYUSDToken = React17.useCallback(() => {
1665
+ const getPYUSDToken = React15.useCallback(() => {
1555
1666
  return getTokenBySymbol("PYUSD");
1556
1667
  }, [getTokenBySymbol]);
1557
- const getSOLToken = React17.useCallback(() => {
1668
+ const getSOLToken = React15.useCallback(() => {
1558
1669
  return getTokenBySymbol("SOL");
1559
1670
  }, [getTokenBySymbol]);
1560
- const getStablecoins = React17.useCallback(() => {
1671
+ const getStablecoins = React15.useCallback(() => {
1561
1672
  return tokens.filter((token) => ["USDC", "PYUSD"].includes(token.symbol));
1562
1673
  }, [tokens]);
1563
- const refreshTokens = React17.useCallback(async () => {
1674
+ const refreshTokens = React15.useCallback(async () => {
1564
1675
  setLastFetched(null);
1565
1676
  return await fetchSupportedTokens();
1566
1677
  }, [fetchSupportedTokens]);
1567
- const isCacheStale = React17.useCallback(() => {
1678
+ const isCacheStale = React15.useCallback(() => {
1568
1679
  if (!lastFetched) return true;
1569
1680
  return Date.now() - lastFetched > CACHE_DURATION;
1570
1681
  }, [lastFetched]);
1571
- const getTokenDisplayInfo = React17.useCallback((token) => {
1682
+ const getTokenDisplayInfo = React15.useCallback((token) => {
1572
1683
  return {
1573
1684
  ...token,
1574
1685
  displayName: `${token.name} (${token.symbol})`,
@@ -1576,7 +1687,7 @@ var useSupportedTokens = () => {
1576
1687
  decimalPlaces: token.decimals
1577
1688
  };
1578
1689
  }, []);
1579
- const getTokenPrice = React17.useCallback(
1690
+ const getTokenPrice = React15.useCallback(
1580
1691
  (symbol) => {
1581
1692
  const token = getTokenBySymbol(symbol);
1582
1693
  if (!token) return 0;
@@ -1585,7 +1696,7 @@ var useSupportedTokens = () => {
1585
1696
  },
1586
1697
  [getTokenBySymbol]
1587
1698
  );
1588
- const calculateTokenAmount = React17.useCallback(
1699
+ const calculateTokenAmount = React15.useCallback(
1589
1700
  (usdAmount, tokenSymbol) => {
1590
1701
  const token = getTokenBySymbol(tokenSymbol);
1591
1702
  const price = getTokenPrice(tokenSymbol);
@@ -1596,7 +1707,7 @@ var useSupportedTokens = () => {
1596
1707
  },
1597
1708
  [getTokenBySymbol, getTokenPrice]
1598
1709
  );
1599
- const formatTokenAmount = React17.useCallback(
1710
+ const formatTokenAmount = React15.useCallback(
1600
1711
  (amount, tokenSymbol) => {
1601
1712
  const token = getTokenBySymbol(tokenSymbol);
1602
1713
  if (!token) return "0";
@@ -1637,28 +1748,28 @@ var SolanaPaymentView = ({
1637
1748
  onClose
1638
1749
  }) => {
1639
1750
  const { notifyStatus, notifyError, notifySuccess } = usePaymentNotifications();
1640
- const [paymentState, setPaymentState] = React17.useState("selecting");
1641
- const [errorMessage, setErrorMessage] = React17.useState(null);
1642
- const [transactionId, setTransactionId] = React17.useState(null);
1643
- const [tokenAmount, setTokenAmount] = React17.useState(0);
1644
- const [selectedTokenSymbol, setSelectedTokenSymbol] = React17.useState(null);
1751
+ const [paymentState, setPaymentState] = React15.useState("selecting");
1752
+ const [errorMessage, setErrorMessage] = React15.useState(null);
1753
+ const [transactionId, setTransactionId] = React15.useState(null);
1754
+ const [tokenAmount, setTokenAmount] = React15.useState(0);
1755
+ const [selectedTokenSymbol, setSelectedTokenSymbol] = React15.useState(null);
1645
1756
  const {
1646
1757
  tokens,
1647
1758
  isLoading: tokensLoading,
1648
1759
  error: tokensError
1649
1760
  } = useSupportedTokens();
1650
- const selectedToken = React17.useMemo(() => {
1761
+ const selectedToken = React15.useMemo(() => {
1651
1762
  if (!tokens.length) return null;
1652
1763
  const explicit = tokens.find((token) => token.symbol === selectedTokenSymbol);
1653
1764
  return explicit || tokens[0];
1654
1765
  }, [tokens, selectedTokenSymbol]);
1655
- React17.useEffect(() => {
1766
+ React15.useEffect(() => {
1656
1767
  if (!selectedTokenSymbol && tokens.length) {
1657
1768
  const defaultToken = tokens.find((token) => token.symbol === "SOL") || tokens[0];
1658
1769
  setSelectedTokenSymbol(defaultToken.symbol);
1659
1770
  }
1660
1771
  }, [tokens, selectedTokenSymbol]);
1661
- const handlePaymentSuccess = React17.useCallback(
1772
+ const handlePaymentSuccess = React15.useCallback(
1662
1773
  (result, txId) => {
1663
1774
  const resolvedTx = txId || (typeof result === "string" ? result : result.transaction_id);
1664
1775
  setTransactionId(resolvedTx);
@@ -1686,7 +1797,7 @@ var SolanaPaymentView = ({
1686
1797
  },
1687
1798
  [notifyStatus, notifySuccess, onSuccess]
1688
1799
  );
1689
- const handlePaymentError = React17.useCallback(
1800
+ const handlePaymentError = React15.useCallback(
1690
1801
  (error) => {
1691
1802
  setPaymentState("error");
1692
1803
  setErrorMessage(error);
@@ -1696,22 +1807,22 @@ var SolanaPaymentView = ({
1696
1807
  },
1697
1808
  [notifyError, notifyStatus, onError]
1698
1809
  );
1699
- const resetState = React17.useCallback(() => {
1810
+ const resetState = React15.useCallback(() => {
1700
1811
  setPaymentState("selecting");
1701
1812
  setErrorMessage(null);
1702
1813
  setTransactionId(null);
1703
1814
  }, []);
1704
- const handleRetry = React17.useCallback(() => {
1815
+ const handleRetry = React15.useCallback(() => {
1705
1816
  resetState();
1706
1817
  }, [resetState]);
1707
- const handleClose = React17.useCallback(() => {
1818
+ const handleClose = React15.useCallback(() => {
1708
1819
  if (paymentState === "processing" || paymentState === "confirming") {
1709
1820
  return;
1710
1821
  }
1711
1822
  resetState();
1712
1823
  onClose?.();
1713
1824
  }, [paymentState, onClose, resetState]);
1714
- React17.useEffect(() => {
1825
+ React15.useEffect(() => {
1715
1826
  if (!selectedToken || usdAmount === 0) {
1716
1827
  setTokenAmount(0);
1717
1828
  return;
@@ -1723,7 +1834,7 @@ var SolanaPaymentView = ({
1723
1834
  }
1724
1835
  setTokenAmount(usdAmount / price);
1725
1836
  }, [usdAmount, selectedToken]);
1726
- const handleTokenChange = React17.useCallback((value) => {
1837
+ const handleTokenChange = React15.useCallback((value) => {
1727
1838
  setSelectedTokenSymbol(value);
1728
1839
  }, []);
1729
1840
  const renderBody = () => {
@@ -1771,7 +1882,7 @@ var SolanaPaymentView = ({
1771
1882
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1772
1883
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-foreground", children: "Select token" }),
1773
1884
  /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: selectedToken?.symbol ?? "", onValueChange: handleTokenChange, children: [
1774
- /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "border border-border/60 bg-transparent", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select token" }) }),
1885
+ /* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "border bg-transparent", children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select token" }) }),
1775
1886
  /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "max-h-64", children: tokens.map((token) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: token.symbol, children: [
1776
1887
  token.name,
1777
1888
  " (",
@@ -1829,20 +1940,20 @@ var PaymentExperience = ({
1829
1940
  const showNewCard = enableNewCard && Boolean(onNewCardPayment);
1830
1941
  const showStored = enableStoredMethods && Boolean(onSavedMethodPayment);
1831
1942
  const defaultTab = showStored ? "saved" : "new";
1832
- const [activeTab, setActiveTab] = React17.useState(defaultTab);
1833
- const [mode, setMode] = React17.useState(
1943
+ const [activeTab, setActiveTab] = React15.useState(defaultTab);
1944
+ const [mode, setMode] = React15.useState(
1834
1945
  () => initialMode === "solana" && enableSolanaPay ? "solana" : "cards"
1835
1946
  );
1836
- const [selectedMethodId, setSelectedMethodId] = React17.useState(null);
1837
- const [savedStatus, setSavedStatus] = React17.useState("idle");
1838
- const [savedError, setSavedError] = React17.useState(null);
1839
- const [newCardStatus, setNewCardStatus] = React17.useState("idle");
1840
- const [newCardError, setNewCardError] = React17.useState(null);
1841
- const { notifyStatus, notifySuccess, notifyError } = usePaymentNotifications();
1842
- React17.useEffect(() => {
1947
+ const [selectedMethodId, setSelectedMethodId] = React15.useState(null);
1948
+ const [savedStatus, setSavedStatus] = React15.useState("idle");
1949
+ const [savedError, setSavedError] = React15.useState(null);
1950
+ const [newCardStatus, setNewCardStatus] = React15.useState("idle");
1951
+ const [newCardError, setNewCardError] = React15.useState(null);
1952
+ const { notifyStatus, notifyError } = usePaymentNotifications();
1953
+ React15.useEffect(() => {
1843
1954
  setActiveTab(showStored ? "saved" : "new");
1844
1955
  }, [showStored]);
1845
- React17.useEffect(() => {
1956
+ React15.useEffect(() => {
1846
1957
  if (!enableSolanaPay) {
1847
1958
  setMode("cards");
1848
1959
  return;
@@ -1853,12 +1964,12 @@ var PaymentExperience = ({
1853
1964
  setMode("cards");
1854
1965
  }
1855
1966
  }, [enableSolanaPay, initialMode]);
1856
- const handleMethodSelect = React17.useCallback((method) => {
1967
+ const handleMethodSelect = React15.useCallback((method) => {
1857
1968
  setSelectedMethodId(method.id);
1858
1969
  setSavedStatus("idle");
1859
1970
  setSavedError(null);
1860
1971
  }, []);
1861
- const handleSavedPayment = React17.useCallback(async () => {
1972
+ const handleSavedPayment = React15.useCallback(async () => {
1862
1973
  if (!onSavedMethodPayment || !selectedMethodId) return;
1863
1974
  try {
1864
1975
  setSavedStatus("processing");
@@ -1878,7 +1989,7 @@ var PaymentExperience = ({
1878
1989
  notifyError(message);
1879
1990
  }
1880
1991
  }, [notifyError, notifyStatus, onSavedMethodPayment, selectedMethodId, usdAmount]);
1881
- const handleNewCardTokenize = React17.useCallback(
1992
+ const handleNewCardTokenize = React15.useCallback(
1882
1993
  async (token, billing) => {
1883
1994
  if (!onNewCardPayment) return;
1884
1995
  try {
@@ -1898,21 +2009,21 @@ var PaymentExperience = ({
1898
2009
  },
1899
2010
  [notifyError, notifyStatus, onNewCardPayment]
1900
2011
  );
1901
- const showSolanaView = React17.useCallback(() => {
2012
+ React15.useCallback(() => {
1902
2013
  if (!enableSolanaPay) return;
1903
2014
  setMode("solana");
1904
2015
  }, [enableSolanaPay]);
1905
- const exitSolanaView = React17.useCallback(() => {
2016
+ const exitSolanaView = React15.useCallback(() => {
1906
2017
  setMode("cards");
1907
2018
  }, []);
1908
- const handleSolanaSuccess = React17.useCallback(
2019
+ const handleSolanaSuccess = React15.useCallback(
1909
2020
  (result) => {
1910
2021
  onSolanaSuccess?.(result);
1911
2022
  exitSolanaView();
1912
2023
  },
1913
2024
  [exitSolanaView, onSolanaSuccess]
1914
2025
  );
1915
- const handleSolanaError = React17.useCallback(
2026
+ const handleSolanaError = React15.useCallback(
1916
2027
  (error) => {
1917
2028
  onSolanaError?.(error);
1918
2029
  },
@@ -1926,7 +2037,6 @@ var PaymentExperience = ({
1926
2037
  /* @__PURE__ */ jsxRuntime.jsx(
1927
2038
  StoredPaymentMethods,
1928
2039
  {
1929
- showAddButton: false,
1930
2040
  selectedMethodId,
1931
2041
  onMethodSelect: handleMethodSelect
1932
2042
  }
@@ -1958,27 +2068,13 @@ var PaymentExperience = ({
1958
2068
  }
1959
2069
  );
1960
2070
  };
1961
- const renderCardExperience = () => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1962
- /* @__PURE__ */ jsxRuntime.jsxs(
1963
- Tabs,
1964
- {
1965
- value: activeTab,
1966
- onValueChange: (value) => setActiveTab(value),
1967
- className: "space-y-3",
1968
- children: [
1969
- /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "grid w-full grid-cols-2 border border-border/60", children: [
1970
- /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "saved", disabled: !showStored, children: "Use saved card" }),
1971
- /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { value: "new", disabled: !showNewCard, children: "Add new card" })
1972
- ] }),
1973
- /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
1974
- /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "new", children: renderNewTab() })
1975
- ]
1976
- }
1977
- ),
1978
- enableSolanaPay && /* @__PURE__ */ jsxRuntime.jsxs(Button, { className: "w-full", variant: "secondary", onClick: showSolanaView, children: [
1979
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sparkles, { className: "mr-2 h-4 w-4" }),
1980
- " Pay with Solana"
1981
- ] })
2071
+ const renderCardExperience = () => /* @__PURE__ */ jsxRuntime.jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, children: [
2072
+ /* @__PURE__ */ jsxRuntime.jsxs(TabsList, { className: "w-full rounded-md mb-4", children: [
2073
+ /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: clsx2.clsx("cursor-pointer", { "bg-background": activeTab == "saved" }), value: "saved", children: "Use saved card" }),
2074
+ /* @__PURE__ */ jsxRuntime.jsx(TabsTrigger, { className: clsx2.clsx("cursor-pointer", { "bg-background": activeTab == "new" }), value: "new", children: "Add new card" })
2075
+ ] }),
2076
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
2077
+ /* @__PURE__ */ jsxRuntime.jsx(TabsContent, { value: "new", children: renderNewTab() })
1982
2078
  ] });
1983
2079
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-6 pt-4", children: [
1984
2080
  mode === "cards" && renderCardExperience(),
@@ -2003,7 +2099,7 @@ var SubscriptionSuccessDialog = ({
2003
2099
  }) => {
2004
2100
  return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: (value) => {
2005
2101
  if (!value) onClose();
2006
- }, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border border-border/70 bg-background/95 p-0 shadow-2xl", children: [
2102
+ }, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border bg-background/95 p-0 shadow-2xl", children: [
2007
2103
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-gradient-to-b from-primary/25 via-primary/10 to-background px-6 py-8 text-center", children: [
2008
2104
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-background/60", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCircle, { className: "h-10 w-10 text-primary" }) }),
2009
2105
  /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
@@ -2030,7 +2126,7 @@ var useSubscriptionActions = () => {
2030
2126
  }
2031
2127
  return priceId;
2032
2128
  };
2033
- const subscribeWithCard = React17.useCallback(
2129
+ const subscribeWithCard = React15.useCallback(
2034
2130
  async ({
2035
2131
  priceId,
2036
2132
  processor = "nmi",
@@ -2057,7 +2153,7 @@ var useSubscriptionActions = () => {
2057
2153
  },
2058
2154
  [client]
2059
2155
  );
2060
- const subscribeWithSavedMethod = React17.useCallback(
2156
+ const subscribeWithSavedMethod = React15.useCallback(
2061
2157
  async ({
2062
2158
  priceId,
2063
2159
  processor = "nmi",
@@ -2077,7 +2173,7 @@ var useSubscriptionActions = () => {
2077
2173
  },
2078
2174
  [client]
2079
2175
  );
2080
- const subscribeWithCCBill = React17.useCallback(
2176
+ const subscribeWithCCBill = React15.useCallback(
2081
2177
  async ({
2082
2178
  priceId,
2083
2179
  email,
@@ -2123,15 +2219,15 @@ var SubscriptionCheckoutModal = ({
2123
2219
  onSolanaError,
2124
2220
  initialMode = "cards"
2125
2221
  }) => {
2126
- const [showSuccess, setShowSuccess] = React17.useState(false);
2127
- const [idempotencyKey, setIdempotencyKey] = React17.useState(() => crypto.randomUUID());
2222
+ const [showSuccess, setShowSuccess] = React15.useState(false);
2223
+ const [idempotencyKey, setIdempotencyKey] = React15.useState(() => crypto.randomUUID());
2128
2224
  const { subscribeWithCard, subscribeWithSavedMethod } = useSubscriptionActions();
2129
- React17.useEffect(() => {
2225
+ React15.useEffect(() => {
2130
2226
  if (open) {
2131
2227
  setIdempotencyKey(crypto.randomUUID());
2132
2228
  }
2133
2229
  }, [open, priceId]);
2134
- const handleClose = React17.useCallback(
2230
+ const handleClose = React15.useCallback(
2135
2231
  (nextOpen) => {
2136
2232
  onOpenChange(nextOpen);
2137
2233
  if (!nextOpen) setShowSuccess(false);
@@ -2188,16 +2284,17 @@ var SubscriptionCheckoutModal = ({
2188
2284
  onSolanaError?.(error);
2189
2285
  };
2190
2286
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2191
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsx(
2287
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxRuntime.jsxs(
2192
2288
  DialogContent,
2193
2289
  {
2194
- className: "max-w-3xl max-h-[90vh] overflow-y-auto p-0 [&::-webkit-scrollbar]:hidden",
2195
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-6 space-y-6", children: [
2196
- !priceId && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: [
2290
+ className: "max-w-3xl max-h-[90vh] overflow-y-auto border-border rounded-md [&::-webkit-scrollbar]:hidden",
2291
+ children: [
2292
+ /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: "Checkout" }) }),
2293
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-4", children: !priceId ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-center px-3 py-2 text-sm text-destructive", children: [
2197
2294
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { className: "h-4 w-4" }),
2198
- " Select a subscription plan to continue."
2199
- ] }),
2200
- /* @__PURE__ */ jsxRuntime.jsx(
2295
+ " ",
2296
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Select a subscription plan to continue." })
2297
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx(
2201
2298
  PaymentExperience,
2202
2299
  {
2203
2300
  usdAmount,
@@ -2211,8 +2308,8 @@ var SubscriptionCheckoutModal = ({
2211
2308
  onNewCardPayment: priceId ? handleNewCardPayment : void 0,
2212
2309
  onSavedMethodPayment: priceId ? handleSavedMethodPayment : void 0
2213
2310
  }
2214
- )
2215
- ] })
2311
+ ) })
2312
+ ]
2216
2313
  }
2217
2314
  ) }),
2218
2315
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2240,9 +2337,9 @@ var wallets = [
2240
2337
  }
2241
2338
  ];
2242
2339
  var WalletModal = ({ open, onOpenChange }) => {
2243
- const [expandedWallet, setExpandedWallet] = React17.useState(null);
2244
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-md border border-border/70 bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: [
2245
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "border-b border-border/40 bg-gradient-to-r from-primary/10 via-background to-background px-6 py-5 text-left", children: [
2340
+ const [expandedWallet, setExpandedWallet] = React15.useState(null);
2341
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "w-full max-w-lg max-h-[90vh] overflow-y-auto rounded-md border bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: [
2342
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { className: "border-b bg-gradient-to-r from-primary/10 via-background to-background px-6 py-5 text-left", children: [
2246
2343
  /* @__PURE__ */ jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: [
2247
2344
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wallet, { className: "h-5 w-5 text-primary" }),
2248
2345
  " Connect a Solana wallet"
@@ -2253,7 +2350,7 @@ var WalletModal = ({ open, onOpenChange }) => {
2253
2350
  wallets.map((wallet) => /* @__PURE__ */ jsxRuntime.jsxs(
2254
2351
  "div",
2255
2352
  {
2256
- className: "rounded-2xl border border-border/60 bg-background/80 p-4 shadow-sm",
2353
+ className: "rounded-2xl border bg-background/80 p-4 shadow-sm",
2257
2354
  children: [
2258
2355
  /* @__PURE__ */ jsxRuntime.jsxs(
2259
2356
  "button",
@@ -2288,7 +2385,7 @@ var WalletModal = ({ open, onOpenChange }) => {
2288
2385
  },
2289
2386
  wallet.id
2290
2387
  )),
2291
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-2xl border border-border/60 bg-muted/10 p-4 text-xs text-muted-foreground", children: "Don\u2019t see your wallet? Additional providers will be added soon. Contact support if you need manual verification." })
2388
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded-2xl border bg-muted/10 p-4 text-xs text-muted-foreground", children: "Don\u2019t see your wallet? Additional providers will be added soon. Contact support if you need manual verification." })
2292
2389
  ] })
2293
2390
  ] }) });
2294
2391
  };
@@ -2296,17 +2393,17 @@ var createDialogState = () => ({
2296
2393
  isOpen: false,
2297
2394
  props: null
2298
2395
  });
2299
- var PaymentsDialogContext = React17.createContext(void 0);
2396
+ var PaymentsDialogContext = React15.createContext(void 0);
2300
2397
  var PaymentsDialogProvider = ({
2301
2398
  children
2302
2399
  }) => {
2303
- const [checkoutState, setCheckoutState] = React17.useState(
2400
+ const [checkoutState, setCheckoutState] = React15.useState(
2304
2401
  () => createDialogState()
2305
2402
  );
2306
- const [walletState, setWalletState] = React17.useState(
2403
+ const [walletState, setWalletState] = React15.useState(
2307
2404
  () => createDialogState()
2308
2405
  );
2309
- const contextValue = React17.useMemo(() => {
2406
+ const contextValue = React15.useMemo(() => {
2310
2407
  const openCheckout = (options) => setCheckoutState({
2311
2408
  isOpen: true,
2312
2409
  props: options
@@ -2360,18 +2457,18 @@ var PaymentsDialogProvider = ({
2360
2457
  ] });
2361
2458
  };
2362
2459
  var usePaymentDialogs = () => {
2363
- const context = React17.useContext(PaymentsDialogContext);
2460
+ const context = React15.useContext(PaymentsDialogContext);
2364
2461
  if (!context) {
2365
2462
  throw new Error("usePaymentDialogs must be used within PaymentProvider");
2366
2463
  }
2367
2464
  return context;
2368
2465
  };
2369
- var PaymentContext = React17.createContext(void 0);
2466
+ var PaymentContext = React15.createContext(void 0);
2370
2467
  var PaymentProvider = ({
2371
2468
  config,
2372
2469
  children
2373
2470
  }) => {
2374
- const queryClient = React17.useMemo(() => {
2471
+ const queryClient = React15.useMemo(() => {
2375
2472
  return new reactQuery.QueryClient({
2376
2473
  defaultOptions: {
2377
2474
  queries: {
@@ -2386,7 +2483,7 @@ var PaymentProvider = ({
2386
2483
  }
2387
2484
  });
2388
2485
  }, []);
2389
- const client = React17.useMemo(() => {
2486
+ const client = React15.useMemo(() => {
2390
2487
  const authProvider = config.getAuthToken ? async () => {
2391
2488
  try {
2392
2489
  const result = config.getAuthToken?.();
@@ -2410,12 +2507,12 @@ var PaymentProvider = ({
2410
2507
  defaultHeaders: config.defaultHeaders
2411
2508
  });
2412
2509
  }, [config]);
2413
- const solanaEndpoint = React17.useMemo(() => {
2510
+ const solanaEndpoint = React15.useMemo(() => {
2414
2511
  if (config.solana?.endpoint) return config.solana.endpoint;
2415
2512
  const network = config.solana?.network ?? walletAdapterBase.WalletAdapterNetwork.Mainnet;
2416
2513
  return web3_js.clusterApiUrl(network);
2417
2514
  }, [config.solana?.endpoint, config.solana?.network]);
2418
- const walletAdapters = React17.useMemo(() => {
2515
+ const walletAdapters = React15.useMemo(() => {
2419
2516
  if (config.solana?.wallets?.length) {
2420
2517
  return config.solana.wallets;
2421
2518
  }
@@ -2427,68 +2524,34 @@ var PaymentProvider = ({
2427
2524
  ];
2428
2525
  }, [config.solana?.wallets]);
2429
2526
  const autoConnect = config.solana?.autoConnect ?? true;
2430
- const value = React17.useMemo(() => {
2527
+ const value = React15.useMemo(() => {
2431
2528
  return {
2432
2529
  config,
2433
2530
  client,
2434
2531
  queryClient
2435
2532
  };
2436
2533
  }, [client, config, queryClient]);
2437
- React17.useEffect(() => {
2534
+ React15.useEffect(() => {
2438
2535
  if (!config.collectJsKey) return;
2439
2536
  loadCollectJs(config.collectJsKey);
2440
2537
  }, [config.collectJsKey]);
2441
2538
  return /* @__PURE__ */ jsxRuntime.jsx(PaymentContext.Provider, { value, children: /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReact.ConnectionProvider, { endpoint: solanaEndpoint, config: { commitment: "confirmed" }, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReact.WalletProvider, { wallets: walletAdapters, autoConnect, children: /* @__PURE__ */ jsxRuntime.jsx(walletAdapterReactUi.WalletModalProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(PaymentsDialogProvider, { children }) }) }) }) }) });
2442
2539
  };
2443
2540
  var usePaymentContext = () => {
2444
- const context = React17.useContext(PaymentContext);
2541
+ const context = React15.useContext(PaymentContext);
2445
2542
  if (!context) {
2446
2543
  throw new Error("usePaymentContext must be used within a PaymentProvider");
2447
2544
  }
2448
2545
  return context;
2449
2546
  };
2450
- var BillingThemeProvider = ({
2451
- children,
2452
- className,
2453
- dark = false
2454
- }) => {
2455
- return /* @__PURE__ */ jsxRuntime.jsx(
2456
- "div",
2457
- {
2458
- className: cn(
2459
- "payments-ui-root",
2460
- dark && "dark",
2461
- className
2462
- ),
2463
- children
2464
- }
2465
- );
2466
- };
2467
- var BillingThemePortal = ({
2468
- children,
2469
- className,
2470
- dark = false
2471
- }) => {
2472
- return /* @__PURE__ */ jsxRuntime.jsx(
2473
- "div",
2474
- {
2475
- className: cn(
2476
- "payments-ui-portal",
2477
- dark && "dark",
2478
- className
2479
- ),
2480
- children
2481
- }
2482
- );
2483
- };
2484
2547
  var SolanaPaymentSelector = ({
2485
2548
  isOpen,
2486
2549
  onClose,
2487
2550
  ...props
2488
2551
  }) => {
2489
- return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-md border border-border/70 bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(SolanaPaymentView, { ...props, onClose }) }) });
2552
+ return /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ jsxRuntime.jsx(DialogContent, { className: "w-full max-w-2xl max-h-[90vh] overflow-y-auto rounded-md border bg-background/95 p-0 shadow-2xl [&::-webkit-scrollbar]:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(SolanaPaymentView, { ...props, onClose }) }) });
2490
2553
  };
2491
- var Table = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
2554
+ var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
2492
2555
  "table",
2493
2556
  {
2494
2557
  ref,
@@ -2497,9 +2560,9 @@ var Table = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @
2497
2560
  }
2498
2561
  ) }));
2499
2562
  Table.displayName = "Table";
2500
- var TableHeader = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2563
+ var TableHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2501
2564
  TableHeader.displayName = "TableHeader";
2502
- var TableBody = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2565
+ var TableBody = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2503
2566
  "tbody",
2504
2567
  {
2505
2568
  ref,
@@ -2508,7 +2571,7 @@ var TableBody = React17__namespace.forwardRef(({ className, ...props }, ref) =>
2508
2571
  }
2509
2572
  ));
2510
2573
  TableBody.displayName = "TableBody";
2511
- var TableFooter = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2574
+ var TableFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2512
2575
  "tfoot",
2513
2576
  {
2514
2577
  ref,
@@ -2520,7 +2583,7 @@ var TableFooter = React17__namespace.forwardRef(({ className, ...props }, ref) =
2520
2583
  }
2521
2584
  ));
2522
2585
  TableFooter.displayName = "TableFooter";
2523
- var TableRow = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2586
+ var TableRow = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2524
2587
  "tr",
2525
2588
  {
2526
2589
  ref,
@@ -2532,7 +2595,7 @@ var TableRow = React17__namespace.forwardRef(({ className, ...props }, ref) => /
2532
2595
  }
2533
2596
  ));
2534
2597
  TableRow.displayName = "TableRow";
2535
- var TableHead = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2598
+ var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2536
2599
  "th",
2537
2600
  {
2538
2601
  ref,
@@ -2544,7 +2607,7 @@ var TableHead = React17__namespace.forwardRef(({ className, ...props }, ref) =>
2544
2607
  }
2545
2608
  ));
2546
2609
  TableHead.displayName = "TableHead";
2547
- var TableCell = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2610
+ var TableCell = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2548
2611
  "td",
2549
2612
  {
2550
2613
  ref,
@@ -2553,7 +2616,7 @@ var TableCell = React17__namespace.forwardRef(({ className, ...props }, ref) =>
2553
2616
  }
2554
2617
  ));
2555
2618
  TableCell.displayName = "TableCell";
2556
- var TableCaption = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2619
+ var TableCaption = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2557
2620
  "caption",
2558
2621
  {
2559
2622
  ref,
@@ -2565,7 +2628,7 @@ TableCaption.displayName = "TableCaption";
2565
2628
  var AlertDialog = AlertDialogPrimitive__namespace.Root;
2566
2629
  var AlertDialogTrigger = AlertDialogPrimitive__namespace.Trigger;
2567
2630
  var AlertDialogPortal = AlertDialogPrimitive__namespace.Portal;
2568
- var AlertDialogOverlay = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2631
+ var AlertDialogOverlay = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2569
2632
  AlertDialogPrimitive__namespace.Overlay,
2570
2633
  {
2571
2634
  className: cn(
@@ -2577,7 +2640,7 @@ var AlertDialogOverlay = React17__namespace.forwardRef(({ className, ...props },
2577
2640
  }
2578
2641
  ));
2579
2642
  AlertDialogOverlay.displayName = AlertDialogPrimitive__namespace.Overlay.displayName;
2580
- var AlertDialogContent = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
2643
+ var AlertDialogContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogPortal, { children: [
2581
2644
  /* @__PURE__ */ jsxRuntime.jsx(AlertDialogOverlay, {}),
2582
2645
  /* @__PURE__ */ jsxRuntime.jsx(
2583
2646
  AlertDialogPrimitive__namespace.Content,
@@ -2620,7 +2683,7 @@ var AlertDialogFooter = ({
2620
2683
  }
2621
2684
  );
2622
2685
  AlertDialogFooter.displayName = "AlertDialogFooter";
2623
- var AlertDialogTitle = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2686
+ var AlertDialogTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2624
2687
  AlertDialogPrimitive__namespace.Title,
2625
2688
  {
2626
2689
  ref,
@@ -2629,7 +2692,7 @@ var AlertDialogTitle = React17__namespace.forwardRef(({ className, ...props }, r
2629
2692
  }
2630
2693
  ));
2631
2694
  AlertDialogTitle.displayName = AlertDialogPrimitive__namespace.Title.displayName;
2632
- var AlertDialogDescription = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2695
+ var AlertDialogDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2633
2696
  AlertDialogPrimitive__namespace.Description,
2634
2697
  {
2635
2698
  ref,
@@ -2638,7 +2701,7 @@ var AlertDialogDescription = React17__namespace.forwardRef(({ className, ...prop
2638
2701
  }
2639
2702
  ));
2640
2703
  AlertDialogDescription.displayName = AlertDialogPrimitive__namespace.Description.displayName;
2641
- var AlertDialogAction = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2704
+ var AlertDialogAction = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2642
2705
  AlertDialogPrimitive__namespace.Action,
2643
2706
  {
2644
2707
  ref,
@@ -2647,7 +2710,7 @@ var AlertDialogAction = React17__namespace.forwardRef(({ className, ...props },
2647
2710
  }
2648
2711
  ));
2649
2712
  AlertDialogAction.displayName = AlertDialogPrimitive__namespace.Action.displayName;
2650
- var AlertDialogCancel = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2713
+ var AlertDialogCancel = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
2651
2714
  AlertDialogPrimitive__namespace.Cancel,
2652
2715
  {
2653
2716
  ref,
@@ -2660,7 +2723,7 @@ var AlertDialogCancel = React17__namespace.forwardRef(({ className, ...props },
2660
2723
  }
2661
2724
  ));
2662
2725
  AlertDialogCancel.displayName = AlertDialogPrimitive__namespace.Cancel.displayName;
2663
- var Textarea = React17__namespace.forwardRef(({ className, ...props }, ref) => {
2726
+ var Textarea = React15__namespace.forwardRef(({ className, ...props }, ref) => {
2664
2727
  return /* @__PURE__ */ jsxRuntime.jsx(
2665
2728
  "textarea",
2666
2729
  {
@@ -2705,12 +2768,12 @@ var CancelMembershipDialog = ({
2705
2768
  const { client } = usePaymentContext();
2706
2769
  const notify = onNotify ?? notifyDefault;
2707
2770
  const t = { ...defaultTranslations, ...customTranslations };
2708
- const [cancelReason, setCancelReason] = React17.useState("");
2709
- const [isOpen, setIsOpen] = React17.useState(false);
2710
- const [isReasonValid, setIsReasonValid] = React17.useState(false);
2711
- const [hasInteracted, setHasInteracted] = React17.useState(false);
2712
- const [isSubmitting, setIsSubmitting] = React17.useState(false);
2713
- React17.useEffect(() => {
2771
+ const [cancelReason, setCancelReason] = React15.useState("");
2772
+ const [isOpen, setIsOpen] = React15.useState(false);
2773
+ const [isReasonValid, setIsReasonValid] = React15.useState(false);
2774
+ const [hasInteracted, setHasInteracted] = React15.useState(false);
2775
+ const [isSubmitting, setIsSubmitting] = React15.useState(false);
2776
+ React15.useEffect(() => {
2714
2777
  const trimmed = cancelReason.trim();
2715
2778
  setIsReasonValid(trimmed.length >= minReasonLength);
2716
2779
  }, [cancelReason, minReasonLength]);
@@ -2843,9 +2906,9 @@ var BillingHistory = ({
2843
2906
  const { client } = usePaymentContext();
2844
2907
  const notify = onNotify ?? notifyDefault2;
2845
2908
  const t = { ...defaultTranslations2, ...customTranslations };
2846
- const [isExpanded, setIsExpanded] = React17.useState(false);
2847
- const observerRef = React17.useRef(null);
2848
- const loadMoreRef = React17.useRef(null);
2909
+ const [isExpanded, setIsExpanded] = React15.useState(false);
2910
+ const observerRef = React15.useRef(null);
2911
+ const loadMoreRef = React15.useRef(null);
2849
2912
  const historyQuery = reactQuery.useInfiniteQuery({
2850
2913
  queryKey: ["payments-ui", "billing-history", pageSize],
2851
2914
  queryFn: async ({ pageParam = initialPage }) => {
@@ -2872,7 +2935,7 @@ var BillingHistory = ({
2872
2935
  },
2873
2936
  staleTime: 5 * 60 * 1e3
2874
2937
  });
2875
- React17.useEffect(() => {
2938
+ React15.useEffect(() => {
2876
2939
  if (!loadMoreRef.current || !isExpanded) return;
2877
2940
  observerRef.current = new IntersectionObserver((entries) => {
2878
2941
  const [entry] = entries;
@@ -2887,7 +2950,7 @@ var BillingHistory = ({
2887
2950
  observerRef.current?.disconnect();
2888
2951
  };
2889
2952
  }, [historyQuery, isExpanded, notify]);
2890
- const payments = React17.useMemo(() => {
2953
+ const payments = React15.useMemo(() => {
2891
2954
  const data = historyQuery.data;
2892
2955
  return data?.pages ?? [];
2893
2956
  }, [historyQuery.data]);
@@ -2926,8 +2989,8 @@ var BillingHistory = ({
2926
2989
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: t.reviewActivity }),
2927
2990
  enableCancel && /* @__PURE__ */ jsxRuntime.jsx(CancelMembershipDialog, { onNotify: notify })
2928
2991
  ] }),
2929
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border border-border/70", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: historyQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: t.loading }) : historyQuery.isError ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-4 text-center text-sm text-destructive", children: t.error }) : /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
2930
- /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "border-border/60", children: [
2992
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border ", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: historyQuery.isLoading ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: t.loading }) : historyQuery.isError ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "p-4 text-center text-sm text-destructive", children: t.error }) : /* @__PURE__ */ jsxRuntime.jsxs(Table, { children: [
2993
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeader, { children: /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "", children: [
2931
2994
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: t.reference }),
2932
2995
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: t.date }),
2933
2996
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: t.amount }),
@@ -2935,7 +2998,7 @@ var BillingHistory = ({
2935
2998
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: t.status })
2936
2999
  ] }) }),
2937
3000
  /* @__PURE__ */ jsxRuntime.jsx(TableBody, { children: payments.map(
2938
- (page) => page.data.map((payment) => /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "border-border/40", children: [
3001
+ (page) => page.data.map((payment) => /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { className: "", children: [
2939
3002
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { className: "font-mono text-sm", children: payment.id.slice(0, 7).toUpperCase() }),
2940
3003
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: formatDate(payment.purchased_at) }),
2941
3004
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: formatAmount(payment.amount, payment.currency) }),
@@ -2968,21 +3031,17 @@ var defaultTranslations3 = {
2968
3031
  addedOn: "Added on",
2969
3032
  active: "Active",
2970
3033
  inactive: "Inactive",
2971
- replaceCard: "Replace card",
2972
3034
  makeDefault: "Make default",
2973
3035
  defaultMethod: "Default method",
2974
3036
  remove: "Remove",
2975
3037
  addNewCard: "Add a new card",
2976
3038
  addNewCardDescription: "Your card details are tokenized securely via our payment provider.",
2977
3039
  saveCard: "Save card",
2978
- replaceCardTitle: "Replace card",
2979
- replaceCardDescription: "Update this card with new billing details.",
2980
3040
  cardAddedSuccess: "Card added successfully",
2981
3041
  unableToAddCard: "Unable to add card",
2982
3042
  cardRemoved: "Card removed",
2983
- unableToRemoveCard: "Unable to remove card",
2984
3043
  cardUpdated: "Card updated",
2985
- unableToReplaceCard: "Unable to replace card",
3044
+ unableToRemoveCard: "Unable to remove card",
2986
3045
  defaultPaymentMethodUpdated: "Default payment method updated",
2987
3046
  unableToSetDefault: "Unable to set default payment method"
2988
3047
  };
@@ -3004,9 +3063,8 @@ var PaymentMethodsSection = ({
3004
3063
  remove: (id) => client.deletePaymentMethod(id),
3005
3064
  activate: (id) => client.activatePaymentMethod(id)
3006
3065
  };
3007
- const [isModalOpen, setIsModalOpen] = React17.useState(false);
3008
- const [deletingId, setDeletingId] = React17.useState(null);
3009
- const [methodBeingReplaced, setMethodBeingReplaced] = React17.useState(null);
3066
+ const [isModalOpen, setIsModalOpen] = React15.useState(false);
3067
+ const [deletingId, setDeletingId] = React15.useState(null);
3010
3068
  const notify = onNotify ?? notifyDefault3;
3011
3069
  const t = { ...defaultTranslations3, ...customTranslations };
3012
3070
  const queryKey = ["payments-ui", "payment-methods"];
@@ -3047,21 +3105,6 @@ var PaymentMethodsSection = ({
3047
3105
  },
3048
3106
  onSettled: () => setDeletingId(null)
3049
3107
  });
3050
- const replaceMutation = reactQuery.useMutation({
3051
- mutationFn: ({ id, payload }) => paymentMethods.update(id, payload),
3052
- onSuccess: () => {
3053
- notify({ title: t.cardUpdated, status: "success" });
3054
- setMethodBeingReplaced(null);
3055
- void queryClient.invalidateQueries({ queryKey });
3056
- },
3057
- onError: (error) => {
3058
- notify({
3059
- title: t.unableToReplaceCard,
3060
- description: error.message,
3061
- status: "destructive"
3062
- });
3063
- }
3064
- });
3065
3108
  const activateMutation = reactQuery.useMutation({
3066
3109
  mutationFn: (id) => paymentMethods.activate(id),
3067
3110
  onSuccess: () => {
@@ -3076,12 +3119,12 @@ var PaymentMethodsSection = ({
3076
3119
  });
3077
3120
  }
3078
3121
  });
3079
- React17.useEffect(() => {
3122
+ React15.useEffect(() => {
3080
3123
  if (!isModalOpen) {
3081
3124
  createMutation.reset();
3082
3125
  }
3083
3126
  }, [createMutation, isModalOpen]);
3084
- const payments = React17.useMemo(() => paymentQuery.data?.data ?? [], [paymentQuery.data]);
3127
+ const payments = React15.useMemo(() => paymentQuery.data?.data ?? [], [paymentQuery.data]);
3085
3128
  const loading = paymentQuery.isLoading || paymentQuery.isFetching;
3086
3129
  const buildPayload = (token, billing) => ({
3087
3130
  payment_token: token,
@@ -3099,18 +3142,10 @@ var PaymentMethodsSection = ({
3099
3142
  const handleCardTokenize = (token, billing) => {
3100
3143
  createMutation.mutate(buildPayload(token, billing));
3101
3144
  };
3102
- const handleReplaceTokenize = (token, billing) => {
3103
- if (!methodBeingReplaced) return;
3104
- replaceMutation.mutate({ id: methodBeingReplaced.id, payload: buildPayload(token, billing) });
3105
- };
3106
- return /* @__PURE__ */ jsxRuntime.jsxs(Card, { children: [
3145
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "bg-bckground border-border rounded-md", children: [
3107
3146
  /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
3108
3147
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3109
- /* @__PURE__ */ jsxRuntime.jsxs(CardTitle, { className: "flex items-center gap-2", children: [
3110
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.WalletCards, { className: "h-5 w-5 text-emerald-400" }),
3111
- " ",
3112
- t.title
3113
- ] }),
3148
+ /* @__PURE__ */ jsxRuntime.jsx(CardTitle, { className: "flex items-center gap-2", children: t.title }),
3114
3149
  /* @__PURE__ */ jsxRuntime.jsx(CardDescription, { children: t.description })
3115
3150
  ] }),
3116
3151
  /* @__PURE__ */ jsxRuntime.jsxs(Button, { onClick: () => setIsModalOpen(true), children: [
@@ -3126,42 +3161,16 @@ var PaymentMethodsSection = ({
3126
3161
  ] }) : payments.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-6 text-sm text-center", children: t.noPaymentMethods }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-3", children: payments.map((method) => /* @__PURE__ */ jsxRuntime.jsxs(
3127
3162
  "div",
3128
3163
  {
3129
- className: "rounded-lg border border-white/10 bg-white/5 p-4 shadow-sm",
3164
+ className: "rounded-lg border bg-white/5 p-4 shadow-sm",
3130
3165
  children: [
3131
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 md:flex-row md:items-center md:justify-between", children: [
3132
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
3133
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-base font-medium text-white", children: formatCardLabel2(method) }),
3134
- /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-sm text-white/60", children: [
3135
- t.addedOn,
3136
- " ",
3137
- method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown date"
3138
- ] })
3166
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
3167
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between", children: [
3168
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-base font-medium text-white", children: formatCardLabel2(method) }),
3169
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: method.is_active ? "default" : "secondary", children: method.is_active ? t.active : t.inactive })
3139
3170
  ] }),
3140
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2", children: [
3141
- /* @__PURE__ */ jsxRuntime.jsx(
3142
- Badge,
3143
- {
3144
- variant: method.is_active ? "default" : "secondary",
3145
- children: method.is_active ? t.active : t.inactive
3146
- }
3147
- ),
3148
- method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason })
3149
- ] })
3171
+ /* @__PURE__ */ jsxRuntime.jsx("div", { children: method.failure_reason && /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "destructive", children: method.failure_reason }) })
3150
3172
  ] }),
3151
3173
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3152
- /* @__PURE__ */ jsxRuntime.jsxs(
3153
- Button,
3154
- {
3155
- variant: "ghost",
3156
- className: "text-blue-400",
3157
- disabled: replaceMutation.isPending && methodBeingReplaced?.id === method.id,
3158
- onClick: () => setMethodBeingReplaced(method),
3159
- children: [
3160
- replaceMutation.isPending && methodBeingReplaced?.id === method.id ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CreditCard, { className: "mr-2 h-4 w-4" }),
3161
- t.replaceCard
3162
- ]
3163
- }
3164
- ),
3165
3174
  /* @__PURE__ */ jsxRuntime.jsxs(
3166
3175
  Button,
3167
3176
  {
@@ -3192,55 +3201,34 @@ var PaymentMethodsSection = ({
3192
3201
  },
3193
3202
  method.id
3194
3203
  )) }) }),
3195
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-h-[95vh] overflow-y-auto", children: [
3196
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
3197
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: t.addNewCard }),
3198
- /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: t.addNewCardDescription })
3199
- ] }),
3200
- /* @__PURE__ */ jsxRuntime.jsx(
3201
- CardDetailsForm,
3202
- {
3203
- visible: isModalOpen,
3204
- collectPrefix,
3205
- submitting: createMutation.isPending,
3206
- submitLabel: t.saveCard,
3207
- defaultValues: {
3208
- email: userEmail ?? "",
3209
- country: defaultCountry,
3210
- provider
3211
- },
3212
- externalError: createMutation.error?.message ?? null,
3213
- onTokenize: handleCardTokenize,
3214
- className: "rounded-2xl border border-white/10 bg-white/5 p-6"
3215
- }
3216
- )
3217
- ] }) }),
3218
- /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: Boolean(methodBeingReplaced), onOpenChange: (open) => !open && setMethodBeingReplaced(null), children: /* @__PURE__ */ jsxRuntime.jsxs(DialogContent, { className: "max-h-[95vh] overflow-y-auto", children: [
3219
- /* @__PURE__ */ jsxRuntime.jsxs(DialogHeader, { children: [
3220
- /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: t.replaceCardTitle }),
3221
- /* @__PURE__ */ jsxRuntime.jsx(DialogDescription, { children: t.replaceCardDescription })
3222
- ] }),
3223
- methodBeingReplaced && /* @__PURE__ */ jsxRuntime.jsx(
3224
- CardDetailsForm,
3225
- {
3226
- visible: true,
3227
- collectPrefix: `${collectPrefix}-replace-${methodBeingReplaced.id}`,
3228
- submitting: replaceMutation.isPending,
3229
- submitLabel: t.replaceCard,
3230
- defaultValues: {
3231
- email: userEmail ?? "",
3232
- country: defaultCountry,
3233
- provider
3234
- },
3235
- externalError: replaceMutation.error?.message ?? null,
3236
- onTokenize: handleReplaceTokenize,
3237
- className: "rounded-2xl border border-white/10 bg-white/5 p-6"
3238
- }
3239
- )
3240
- ] }) })
3204
+ /* @__PURE__ */ jsxRuntime.jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxRuntime.jsxs(
3205
+ DialogContent,
3206
+ {
3207
+ className: "max-w-3xl max-h-[90vh] overflow-y-auto border-border rounded-md [&::-webkit-scrollbar]:hidden",
3208
+ children: [
3209
+ /* @__PURE__ */ jsxRuntime.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntime.jsx(DialogTitle, { children: t.addNewCard }) }),
3210
+ /* @__PURE__ */ jsxRuntime.jsx(
3211
+ CardDetailsForm,
3212
+ {
3213
+ visible: isModalOpen,
3214
+ submitLabel: t.saveCard,
3215
+ collectPrefix,
3216
+ onTokenize: handleCardTokenize,
3217
+ submitting: createMutation.isPending,
3218
+ defaultValues: {
3219
+ provider,
3220
+ email: userEmail ?? "",
3221
+ country: defaultCountry
3222
+ },
3223
+ externalError: createMutation.error?.message ?? null
3224
+ }
3225
+ )
3226
+ ]
3227
+ }
3228
+ ) })
3241
3229
  ] });
3242
3230
  };
3243
- var Checkbox = React17__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3231
+ var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3244
3232
  CheckboxPrimitive__namespace.Root,
3245
3233
  {
3246
3234
  ref,
@@ -3267,9 +3255,9 @@ var initialState = {
3267
3255
  termsAccepted: false
3268
3256
  };
3269
3257
  var WalletDialog = ({ open, onOpenChange }) => {
3270
- const [form, setForm] = React17.useState(initialState);
3271
- const [errors, setErrors] = React17.useState({});
3272
- const validators = React17.useMemo(
3258
+ const [form, setForm] = React15.useState(initialState);
3259
+ const [errors, setErrors] = React15.useState({});
3260
+ const validators = React15.useMemo(
3273
3261
  () => ({
3274
3262
  nameOnCard: (value) => !value ? "Name is required" : void 0,
3275
3263
  cardNumber: (value) => /^\d{16}$/.test(value) ? void 0 : "Card number must be 16 digits",
@@ -3303,7 +3291,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
3303
3291
  setForm(initialState);
3304
3292
  };
3305
3293
  return /* @__PURE__ */ jsxRuntime.jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogContent, { className: "max-h-[95vh] max-w-lg overflow-y-auto rounded-2xl border border-border bg-background", children: [
3306
- /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { className: "border-b border-border/60 pb-4", children: [
3294
+ /* @__PURE__ */ jsxRuntime.jsxs(AlertDialogHeader, { className: "border-b pb-4", children: [
3307
3295
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-center gap-2", children: [
3308
3296
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Shield, { className: "h-5 w-5 text-primary" }),
3309
3297
  /* @__PURE__ */ jsxRuntime.jsx(AlertDialogTitle, { className: "text-center text-base font-semibold uppercase tracking-wide", children: "Secure Payment via Mobius Pay" })
@@ -3347,7 +3335,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
3347
3335
  ] })
3348
3336
  ] })
3349
3337
  ] }),
3350
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 rounded-md border border-border/70 bg-muted/10 p-4", children: [
3338
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/10 p-4", children: [
3351
3339
  /* @__PURE__ */ jsxRuntime.jsx(Checkbox, { id: "terms-agree", checked: form.termsAccepted, onCheckedChange: (checked) => updateField("termsAccepted", Boolean(checked)) }),
3352
3340
  /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "terms-agree", className: "text-sm text-muted-foreground", children: "By completing this order, I confirm that I am 18 years or older and agree to your privacy policy and terms." })
3353
3341
  ] }),
@@ -3362,10 +3350,10 @@ var WalletDialog = ({ open, onOpenChange }) => {
3362
3350
  var useTokenBalance = (tokens) => {
3363
3351
  const { publicKey } = walletAdapterReact.useWallet();
3364
3352
  const { connection } = walletAdapterReact.useConnection();
3365
- const [balances, setBalances] = React17.useState([]);
3366
- const [isLoading, setIsLoading] = React17.useState(false);
3367
- const [error, setError] = React17.useState(null);
3368
- const fetchTokenBalance = React17.useCallback(
3353
+ const [balances, setBalances] = React15.useState([]);
3354
+ const [isLoading, setIsLoading] = React15.useState(false);
3355
+ const [error, setError] = React15.useState(null);
3356
+ const fetchTokenBalance = React15.useCallback(
3369
3357
  async (token, walletAddress) => {
3370
3358
  try {
3371
3359
  const mintPublicKey = new web3_js.PublicKey(token.mint);
@@ -3406,8 +3394,8 @@ var useTokenBalance = (tokens) => {
3406
3394
  },
3407
3395
  [connection]
3408
3396
  );
3409
- const tokensKey = React17.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
3410
- React17.useEffect(() => {
3397
+ const tokensKey = React15.useMemo(() => tokens.map((t) => t.mint).join(","), [tokens]);
3398
+ React15.useEffect(() => {
3411
3399
  if (!publicKey || tokens.length === 0) {
3412
3400
  setBalances([]);
3413
3401
  return;
@@ -3431,20 +3419,20 @@ var useTokenBalance = (tokens) => {
3431
3419
  };
3432
3420
  fetchAllBalances();
3433
3421
  }, [publicKey, tokensKey, fetchTokenBalance]);
3434
- const getTokenBalance = React17.useCallback(
3422
+ const getTokenBalance = React15.useCallback(
3435
3423
  (tokenSymbol) => {
3436
3424
  return balances.find((balance) => balance.token.symbol === tokenSymbol);
3437
3425
  },
3438
3426
  [balances]
3439
3427
  );
3440
- const hasSufficientBalance = React17.useCallback(
3428
+ const hasSufficientBalance = React15.useCallback(
3441
3429
  (tokenSymbol, requiredAmount) => {
3442
3430
  const balance = getTokenBalance(tokenSymbol);
3443
3431
  return balance ? balance.uiAmount >= requiredAmount : false;
3444
3432
  },
3445
3433
  [getTokenBalance]
3446
3434
  );
3447
- const getFormattedBalance = React17.useCallback(
3435
+ const getFormattedBalance = React15.useCallback(
3448
3436
  (tokenSymbol) => {
3449
3437
  const balance = getTokenBalance(tokenSymbol);
3450
3438
  if (!balance) return "0.00";
@@ -3458,7 +3446,7 @@ var useTokenBalance = (tokens) => {
3458
3446
  },
3459
3447
  [getTokenBalance]
3460
3448
  );
3461
- const refreshBalances = React17.useCallback(async () => {
3449
+ const refreshBalances = React15.useCallback(async () => {
3462
3450
  if (!publicKey || tokens.length === 0) {
3463
3451
  setBalances([]);
3464
3452
  return;
@@ -3479,7 +3467,7 @@ var useTokenBalance = (tokens) => {
3479
3467
  setIsLoading(false);
3480
3468
  }
3481
3469
  }, [publicKey, tokens, fetchTokenBalance]);
3482
- const getTotalValue = React17.useCallback(
3470
+ const getTotalValue = React15.useCallback(
3483
3471
  (priceData) => {
3484
3472
  if (!priceData) return 0;
3485
3473
  return balances.reduce((total, balance) => {
@@ -3518,21 +3506,21 @@ var usePaymentStatus = (options = {}) => {
3518
3506
  retryInterval = 1e4
3519
3507
  // 10 seconds
3520
3508
  } = options;
3521
- const [status, setStatus] = React17.useState(null);
3522
- const [paymentStatus, setPaymentStatus] = React17.useState(null);
3523
- const [isLoading, setIsLoading] = React17.useState(false);
3524
- const [error, setError] = React17.useState(null);
3525
- const [retryCount, setRetryCount] = React17.useState(0);
3526
- const intervalRef = React17.useRef(null);
3527
- const isMonitoringRef = React17.useRef(false);
3528
- React17.useEffect(() => {
3509
+ const [status, setStatus] = React15.useState(null);
3510
+ const [paymentStatus, setPaymentStatus] = React15.useState(null);
3511
+ const [isLoading, setIsLoading] = React15.useState(false);
3512
+ const [error, setError] = React15.useState(null);
3513
+ const [retryCount, setRetryCount] = React15.useState(0);
3514
+ const intervalRef = React15.useRef(null);
3515
+ const isMonitoringRef = React15.useRef(false);
3516
+ React15.useEffect(() => {
3529
3517
  return () => {
3530
3518
  if (intervalRef.current) {
3531
3519
  clearInterval(intervalRef.current);
3532
3520
  }
3533
3521
  };
3534
3522
  }, []);
3535
- const checkTransactionStatus = React17.useCallback(
3523
+ const checkTransactionStatus = React15.useCallback(
3536
3524
  async (signature) => {
3537
3525
  try {
3538
3526
  const statusResponse = await connection.getSignatureStatus(signature, {
@@ -3577,7 +3565,7 @@ var usePaymentStatus = (options = {}) => {
3577
3565
  },
3578
3566
  [connection]
3579
3567
  );
3580
- const checkPaymentStatus = React17.useCallback(
3568
+ const checkPaymentStatus = React15.useCallback(
3581
3569
  async (id) => {
3582
3570
  try {
3583
3571
  return await client.getPaymentStatus(id);
@@ -3591,7 +3579,7 @@ var usePaymentStatus = (options = {}) => {
3591
3579
  },
3592
3580
  [client]
3593
3581
  );
3594
- const startMonitoring = React17.useCallback(async () => {
3582
+ const startMonitoring = React15.useCallback(async () => {
3595
3583
  if (isMonitoringRef.current || !transactionId && !purchaseId) {
3596
3584
  return;
3597
3585
  }
@@ -3679,14 +3667,14 @@ var usePaymentStatus = (options = {}) => {
3679
3667
  retryInterval,
3680
3668
  retryCount
3681
3669
  ]);
3682
- const stopMonitoring = React17.useCallback(() => {
3670
+ const stopMonitoring = React15.useCallback(() => {
3683
3671
  if (intervalRef.current) {
3684
3672
  clearInterval(intervalRef.current);
3685
3673
  }
3686
3674
  isMonitoringRef.current = false;
3687
3675
  setIsLoading(false);
3688
3676
  }, []);
3689
- const checkStatus = React17.useCallback(async () => {
3677
+ const checkStatus = React15.useCallback(async () => {
3690
3678
  if (!transactionId && !purchaseId) return;
3691
3679
  setIsLoading(true);
3692
3680
  setError(null);
@@ -3711,7 +3699,7 @@ var usePaymentStatus = (options = {}) => {
3711
3699
  setIsLoading(false);
3712
3700
  }
3713
3701
  }, [transactionId, purchaseId, checkTransactionStatus, checkPaymentStatus]);
3714
- React17.useEffect(() => {
3702
+ React15.useEffect(() => {
3715
3703
  if ((transactionId || purchaseId) && !isMonitoringRef.current) {
3716
3704
  startMonitoring();
3717
3705
  }
@@ -3719,7 +3707,7 @@ var usePaymentStatus = (options = {}) => {
3719
3707
  stopMonitoring();
3720
3708
  };
3721
3709
  }, [transactionId, purchaseId, startMonitoring, stopMonitoring]);
3722
- const getConfirmationStatus = React17.useCallback(() => {
3710
+ const getConfirmationStatus = React15.useCallback(() => {
3723
3711
  if (paymentStatus?.status === "confirmed") return "confirmed";
3724
3712
  if (paymentStatus?.status === "failed") return "failed";
3725
3713
  if (status?.confirmationStatus === "finalized") return "confirmed";
@@ -3728,7 +3716,7 @@ var usePaymentStatus = (options = {}) => {
3728
3716
  return "failed";
3729
3717
  return "pending";
3730
3718
  }, [status, paymentStatus]);
3731
- const getSolscanUrl = React17.useCallback(
3719
+ const getSolscanUrl = React15.useCallback(
3732
3720
  (signature) => {
3733
3721
  const txId = signature || transactionId;
3734
3722
  if (!txId) return null;
@@ -3756,8 +3744,6 @@ var usePaymentStatus = (options = {}) => {
3756
3744
  };
3757
3745
 
3758
3746
  exports.BillingHistory = BillingHistory;
3759
- exports.BillingThemePortal = BillingThemePortal;
3760
- exports.BillingThemeProvider = BillingThemeProvider;
3761
3747
  exports.CancelMembershipDialog = CancelMembershipDialog;
3762
3748
  exports.CardDetailsForm = CardDetailsForm;
3763
3749
  exports.ClientApiError = ClientApiError;