@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.js CHANGED
@@ -1,5 +1,5 @@
1
- import * as React17 from 'react';
2
- import React17__default, { createContext, useMemo, useState, useEffect, useCallback, useRef, useContext } from 'react';
1
+ import * as React15 from 'react';
2
+ import React15__default, { createContext, useMemo, useState, useEffect, useCallback, useRef, useContext } from 'react';
3
3
  import { useQueryClient, useQuery, useMutation, QueryClient, QueryClientProvider, useInfiniteQuery } from '@tanstack/react-query';
4
4
  import { ConnectionProvider, WalletProvider, useWallet, useConnection } from '@solana/wallet-adapter-react';
5
5
  import { WalletModalProvider } from '@solana/wallet-adapter-react-ui';
@@ -11,8 +11,8 @@ import { SolflareWalletAdapter } from '@solana/wallet-adapter-solflare';
11
11
  import { TrustWalletAdapter } from '@solana/wallet-adapter-trust';
12
12
  import { CoinbaseWalletAdapter } from '@solana/wallet-adapter-coinbase';
13
13
  import * as DialogPrimitive from '@radix-ui/react-dialog';
14
- import { X, ChevronDown, ChevronUp, Check, Loader2, CheckCircle, AlertCircle, Wallet, Ban, TriangleAlert, WalletCards, CreditCard, Trash2, Shield, UserRound, Calendar, KeyRound, Sparkles, XCircle, RotateCcw, RefreshCw } from 'lucide-react';
15
- import { clsx } from 'clsx';
14
+ import { ChevronDown, ChevronUp, Check, Loader2, CheckCircle, AlertCircle, Wallet, Ban, TriangleAlert, CreditCard, Trash2, Shield, UserRound, Calendar, KeyRound, XIcon, XCircle, RotateCcw, RefreshCw } from 'lucide-react';
15
+ import clsx2, { clsx } from 'clsx';
16
16
  import { twMerge } from 'tailwind-merge';
17
17
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
18
  import countryList from 'country-list';
@@ -31,30 +31,119 @@ import { getAssociatedTokenAddress, getAccount } from '@solana/spl-token';
31
31
 
32
32
  // src/utils/collect.ts
33
33
  var SCRIPT_SRC = "https://secure.networkmerchants.com/token/Collect.js";
34
+ var baseFieldReset = {
35
+ border: "none",
36
+ "border-bottom": "0",
37
+ "border-top": "0",
38
+ "border-left": "0",
39
+ "border-right": "0",
40
+ "border-width": "0",
41
+ "border-color": "transparent",
42
+ "border-style": "none",
43
+ outline: "none",
44
+ "box-shadow": "none",
45
+ "background-clip": "padding-box",
46
+ "text-decoration": "none"
47
+ };
48
+ var customCss = {
49
+ ...baseFieldReset,
50
+ background: "#0d1325",
51
+ "background-color": "#0d1325",
52
+ color: "#e2e8f0",
53
+ padding: "0",
54
+ margin: "0",
55
+ width: "100%",
56
+ height: "100%",
57
+ "font-size": "15px",
58
+ "letter-spacing": "0.05em",
59
+ "line-height": "1.5"
60
+ };
61
+ var focusCss = {
62
+ ...baseFieldReset,
63
+ color: "#f8fafc",
64
+ "box-shadow": "0 0 0 1px rgba(94,234,212,0.3)"
65
+ };
66
+ var invalidCss = {
67
+ ...baseFieldReset,
68
+ color: "#fecaca",
69
+ "box-shadow": "0 0 0 1px rgba(248,113,113,0.5)"
70
+ };
71
+ var placeholderCss = {
72
+ color: "rgba(226,232,240,0.45)",
73
+ "font-size": "14px",
74
+ "letter-spacing": "0.03em"
75
+ };
76
+ var baseCssString = JSON.stringify(customCss);
77
+ var focusCssString = JSON.stringify(focusCss);
78
+ var invalidCssString = JSON.stringify(invalidCss);
79
+ var placeholderCssString = JSON.stringify(placeholderCss);
80
+ var collectCssConfig = {
81
+ customCss,
82
+ focusCss,
83
+ invalidCss,
84
+ placeholderCss
85
+ };
86
+ var loadPromise = null;
34
87
  var loadCollectJs = (tokenizationKey) => {
35
88
  if (typeof document === "undefined") return;
89
+ if (typeof window !== "undefined" && window.CollectJS) {
90
+ return Promise.resolve();
91
+ }
36
92
  const trimmed = tokenizationKey?.trim();
37
93
  if (!trimmed || trimmed.length < 10) {
38
94
  console.warn("payments-ui: invalid Collect.js key, skipping load");
39
95
  return;
40
96
  }
97
+ if (loadPromise) {
98
+ return loadPromise;
99
+ }
41
100
  const existing = document.querySelector(`script[src="${SCRIPT_SRC}"]`);
42
- if (existing) return;
43
- const script = document.createElement("script");
44
- script.src = SCRIPT_SRC;
45
- script.setAttribute("data-tokenization-key", trimmed);
46
- script.setAttribute("data-field-ccnumber-placeholder", "0000 0000 0000 0000");
47
- script.setAttribute("data-field-ccexp-placeholder", "10 / 25");
48
- script.setAttribute("data-field-cvv-placeholder", "123");
49
- script.setAttribute("data-variant", "inline");
50
- script.async = true;
51
- script.addEventListener("load", () => {
52
- console.log("payments-ui: Collect.js loaded");
53
- });
54
- script.addEventListener("error", (event) => {
55
- console.error("payments-ui: failed to load Collect.js", event);
101
+ if (existing) {
102
+ loadPromise = new Promise((resolve) => {
103
+ existing.addEventListener("load", () => resolve(), { once: true });
104
+ existing.addEventListener("error", () => resolve(), { once: true });
105
+ });
106
+ return loadPromise;
107
+ }
108
+ loadPromise = new Promise((resolve, reject) => {
109
+ const script = document.createElement("script");
110
+ script.src = SCRIPT_SRC;
111
+ script.setAttribute("data-tokenization-key", trimmed);
112
+ script.setAttribute("data-field-ccnumber-placeholder", "0000 0000 0000 0000");
113
+ script.setAttribute("data-field-ccexp-placeholder", "10 / 25");
114
+ script.setAttribute("data-field-cvv-placeholder", "123");
115
+ script.setAttribute("data-variant", "inline");
116
+ script.setAttribute("data-style-sniffer", "false");
117
+ script.setAttribute("data-custom-css", baseCssString);
118
+ script.setAttribute("data-placeholder-css", placeholderCssString);
119
+ script.setAttribute("data-focus-css", focusCssString);
120
+ script.setAttribute("data-invalid-css", invalidCssString);
121
+ script.async = true;
122
+ script.addEventListener("load", () => {
123
+ console.log("payments-ui: Collect.js loaded");
124
+ resolve();
125
+ });
126
+ script.addEventListener("error", (event) => {
127
+ console.error("payments-ui: failed to load Collect.js", event);
128
+ reject(event);
129
+ });
130
+ document.head.appendChild(script);
56
131
  });
57
- document.head.appendChild(script);
132
+ window.__doujinsCollectPromise = loadPromise;
133
+ return loadPromise;
134
+ };
135
+ var waitForCollectJs = async () => {
136
+ if (typeof window === "undefined") return null;
137
+ if (window.CollectJS) return window.CollectJS;
138
+ const promise = loadPromise ?? window.__doujinsCollectPromise;
139
+ if (!promise) return null;
140
+ try {
141
+ await promise;
142
+ return window.CollectJS ?? null;
143
+ } catch (error) {
144
+ console.error("payments-ui: Collect.js failed to initialise", error);
145
+ return null;
146
+ }
58
147
  };
59
148
 
60
149
  // src/lib/client.ts
@@ -262,77 +351,103 @@ var createClient = (config) => {
262
351
  function cn(...inputs) {
263
352
  return twMerge(clsx(inputs));
264
353
  }
265
- var Dialog = DialogPrimitive.Root;
266
- var DialogPortal = DialogPrimitive.Portal;
267
- var DialogOverlay = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
268
- DialogPrimitive.Overlay,
269
- {
270
- ref,
271
- className: cn(
272
- "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",
273
- className
274
- ),
275
- ...props
276
- }
277
- ));
278
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
279
- var DialogContent = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
280
- /* @__PURE__ */ jsx(DialogOverlay, {}),
281
- /* @__PURE__ */ jsxs(
282
- DialogPrimitive.Content,
354
+ function Dialog({
355
+ ...props
356
+ }) {
357
+ return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
358
+ }
359
+ function DialogPortal({
360
+ ...props
361
+ }) {
362
+ return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
363
+ }
364
+ function DialogOverlay({
365
+ className,
366
+ ...props
367
+ }) {
368
+ return /* @__PURE__ */ jsx(
369
+ DialogPrimitive.Overlay,
283
370
  {
284
- ref,
371
+ "data-slot": "dialog-overlay",
285
372
  className: cn(
286
- "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",
373
+ "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",
287
374
  className
288
375
  ),
289
- ...props,
290
- children: [
291
- children,
292
- /* @__PURE__ */ jsxs(DialogPrimitive.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: [
293
- /* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
294
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
295
- ] })
296
- ]
376
+ ...props
297
377
  }
298
- )
299
- ] }));
300
- DialogContent.displayName = DialogPrimitive.Content.displayName;
301
- var DialogHeader = ({
378
+ );
379
+ }
380
+ function DialogContent({
302
381
  className,
382
+ children,
383
+ showCloseButton = true,
303
384
  ...props
304
- }) => /* @__PURE__ */ jsx(
305
- "div",
306
- {
307
- className: cn(
308
- "flex flex-col space-y-1.5 text-center sm:text-left",
309
- className
310
- ),
311
- ...props
312
- }
313
- );
314
- DialogHeader.displayName = "DialogHeader";
315
- var DialogTitle = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
316
- DialogPrimitive.Title,
317
- {
318
- ref,
319
- className: cn(
320
- "text-lg font-semibold leading-none tracking-tight",
321
- className
322
- ),
323
- ...props
324
- }
325
- ));
326
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
327
- var DialogDescription = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
328
- DialogPrimitive.Description,
329
- {
330
- ref,
331
- className: cn("text-sm text-muted-foreground", className),
332
- ...props
333
- }
334
- ));
335
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
385
+ }) {
386
+ return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
387
+ /* @__PURE__ */ jsx(DialogOverlay, {}),
388
+ /* @__PURE__ */ jsxs(
389
+ DialogPrimitive.Content,
390
+ {
391
+ "data-slot": "dialog-content",
392
+ className: cn(
393
+ "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",
394
+ className
395
+ ),
396
+ ...props,
397
+ children: [
398
+ children,
399
+ showCloseButton && /* @__PURE__ */ jsxs(
400
+ DialogPrimitive.Close,
401
+ {
402
+ "data-slot": "dialog-close",
403
+ 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",
404
+ children: [
405
+ /* @__PURE__ */ jsx(XIcon, {}),
406
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
407
+ ]
408
+ }
409
+ )
410
+ ]
411
+ }
412
+ )
413
+ ] });
414
+ }
415
+ function DialogHeader({ className, ...props }) {
416
+ return /* @__PURE__ */ jsx(
417
+ "div",
418
+ {
419
+ "data-slot": "dialog-header",
420
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
421
+ ...props
422
+ }
423
+ );
424
+ }
425
+ function DialogTitle({
426
+ className,
427
+ ...props
428
+ }) {
429
+ return /* @__PURE__ */ jsx(
430
+ DialogPrimitive.Title,
431
+ {
432
+ "data-slot": "dialog-title",
433
+ className: cn("text-lg leading-none font-semibold", className),
434
+ ...props
435
+ }
436
+ );
437
+ }
438
+ function DialogDescription({
439
+ className,
440
+ ...props
441
+ }) {
442
+ return /* @__PURE__ */ jsx(
443
+ DialogPrimitive.Description,
444
+ {
445
+ "data-slot": "dialog-description",
446
+ className: cn("text-muted-foreground text-sm", className),
447
+ ...props
448
+ }
449
+ );
450
+ }
336
451
  var customCountries = [
337
452
  { code: "TW", name: "Taiwan, Province of China" },
338
453
  { code: "KR", name: "Korea" },
@@ -373,7 +488,7 @@ var buttonVariants = cva(
373
488
  }
374
489
  }
375
490
  );
376
- var Button = React17.forwardRef(
491
+ var Button = React15.forwardRef(
377
492
  ({ className, variant, size, asChild = false, ...props }, ref) => {
378
493
  const Comp = asChild ? Slot : "button";
379
494
  return /* @__PURE__ */ jsx(
@@ -387,7 +502,7 @@ var Button = React17.forwardRef(
387
502
  }
388
503
  );
389
504
  Button.displayName = "Button";
390
- var Input = React17.forwardRef(
505
+ var Input = React15.forwardRef(
391
506
  ({ className, type, ...props }, ref) => {
392
507
  return /* @__PURE__ */ jsx(
393
508
  "input",
@@ -407,7 +522,7 @@ Input.displayName = "Input";
407
522
  var labelVariants = cva(
408
523
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
409
524
  );
410
- var Label = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
525
+ var Label = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
411
526
  LabelPrimitive.Root,
412
527
  {
413
528
  ref,
@@ -418,7 +533,7 @@ var Label = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
418
533
  Label.displayName = LabelPrimitive.Root.displayName;
419
534
  var Select = SelectPrimitive.Root;
420
535
  var SelectValue = SelectPrimitive.Value;
421
- var SelectTrigger = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
536
+ var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
422
537
  SelectPrimitive.Trigger,
423
538
  {
424
539
  ref,
@@ -434,7 +549,7 @@ var SelectTrigger = React17.forwardRef(({ className, children, ...props }, ref)
434
549
  }
435
550
  ));
436
551
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
437
- var SelectScrollUpButton = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
552
+ var SelectScrollUpButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
438
553
  SelectPrimitive.ScrollUpButton,
439
554
  {
440
555
  ref,
@@ -447,7 +562,7 @@ var SelectScrollUpButton = React17.forwardRef(({ className, ...props }, ref) =>
447
562
  }
448
563
  ));
449
564
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
450
- var SelectScrollDownButton = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
565
+ var SelectScrollDownButton = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
451
566
  SelectPrimitive.ScrollDownButton,
452
567
  {
453
568
  ref,
@@ -460,7 +575,7 @@ var SelectScrollDownButton = React17.forwardRef(({ className, ...props }, ref) =
460
575
  }
461
576
  ));
462
577
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
463
- var SelectContent = React17.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
578
+ var SelectContent = React15.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
464
579
  SelectPrimitive.Content,
465
580
  {
466
581
  ref,
@@ -488,7 +603,7 @@ var SelectContent = React17.forwardRef(({ className, children, position = "poppe
488
603
  }
489
604
  ) }));
490
605
  SelectContent.displayName = SelectPrimitive.Content.displayName;
491
- var SelectLabel = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
606
+ var SelectLabel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
492
607
  SelectPrimitive.Label,
493
608
  {
494
609
  ref,
@@ -497,7 +612,7 @@ var SelectLabel = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
497
612
  }
498
613
  ));
499
614
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
500
- var SelectItem = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
615
+ var SelectItem = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
501
616
  SelectPrimitive.Item,
502
617
  {
503
618
  ref,
@@ -513,7 +628,7 @@ var SelectItem = React17.forwardRef(({ className, children, ...props }, ref) =>
513
628
  }
514
629
  ));
515
630
  SelectItem.displayName = SelectPrimitive.Item.displayName;
516
- var SelectSeparator = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
631
+ var SelectSeparator = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
517
632
  SelectPrimitive.Separator,
518
633
  {
519
634
  ref,
@@ -568,6 +683,21 @@ var CardDetailsForm = ({
568
683
  const [email, setEmail] = useState(mergedDefaults.email ?? "");
569
684
  const [localError, setLocalError] = useState(null);
570
685
  const [isTokenizing, setIsTokenizing] = useState(false);
686
+ const [collectReady, setCollectReady] = useState(
687
+ typeof window !== "undefined" && Boolean(window.CollectJS)
688
+ );
689
+ useEffect(() => {
690
+ if (collectReady) return;
691
+ let active = true;
692
+ waitForCollectJs().then((instance) => {
693
+ if (active && instance) {
694
+ setCollectReady(true);
695
+ }
696
+ });
697
+ return () => {
698
+ active = false;
699
+ };
700
+ }, [collectReady]);
571
701
  useEffect(() => {
572
702
  if (!visible) {
573
703
  setLocalError(null);
@@ -610,8 +740,22 @@ var CardDetailsForm = ({
610
740
  mergedDefaults.provider,
611
741
  onBillingChange
612
742
  ]);
743
+ const sanitizeCollectField = (field) => {
744
+ const sanitized = { ...field };
745
+ if ("style_input" in sanitized || "style_placeholder" in sanitized) {
746
+ delete sanitized.style_input;
747
+ delete sanitized.style_placeholder;
748
+ if (typeof window !== "undefined") {
749
+ console.warn(
750
+ "[payments-ui] stripping unsupported Collect.js style fields",
751
+ Object.keys(field).filter((key) => key.startsWith("style_"))
752
+ );
753
+ }
754
+ }
755
+ return sanitized;
756
+ };
613
757
  useEffect(() => {
614
- if (typeof window === "undefined" || !window.CollectJS || !visible) {
758
+ if (!collectReady || typeof window === "undefined" || !window.CollectJS || !visible) {
615
759
  return;
616
760
  }
617
761
  const handlers = window.__doujinsCollectHandlers || (window.__doujinsCollectHandlers = {});
@@ -638,10 +782,14 @@ var CardDetailsForm = ({
638
782
  if (!configured[collectPrefix]) {
639
783
  window.CollectJS.configure({
640
784
  variant: "inline",
785
+ customCss: collectCssConfig.customCss,
786
+ focusCss: collectCssConfig.focusCss,
787
+ invalidCss: collectCssConfig.invalidCss,
788
+ placeholderCss: collectCssConfig.placeholderCss,
641
789
  fields: {
642
- ccnumber: { selector: buildSelector(collectPrefix, "ccnumber") },
643
- ccexp: { selector: buildSelector(collectPrefix, "ccexp") },
644
- cvv: { selector: buildSelector(collectPrefix, "cvv") }
790
+ ccnumber: sanitizeCollectField({ selector: buildSelector(collectPrefix, "ccnumber") }),
791
+ ccexp: sanitizeCollectField({ selector: buildSelector(collectPrefix, "ccexp") }),
792
+ cvv: sanitizeCollectField({ selector: buildSelector(collectPrefix, "cvv") })
645
793
  },
646
794
  callback: (response) => {
647
795
  const fn = window.__doujinsCollectHandlers?.[collectPrefix];
@@ -652,6 +800,7 @@ var CardDetailsForm = ({
652
800
  }
653
801
  }, [
654
802
  collectPrefix,
803
+ collectReady,
655
804
  firstName,
656
805
  lastName,
657
806
  address1,
@@ -683,22 +832,22 @@ var CardDetailsForm = ({
683
832
  window.CollectJS.startPaymentRequest();
684
833
  };
685
834
  const errorMessage = localError ?? externalError;
686
- const collectFieldClass = "flex h-11 w-full items-center rounded-md border border-white/10 bg-white/5 px-3 text-sm text-white";
835
+ 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";
687
836
  return /* @__PURE__ */ jsxs(
688
837
  "form",
689
838
  {
690
- className: cn("space-y-5", className),
839
+ className: cn("space-y-2", className),
691
840
  onSubmit: handleSubmit,
692
841
  noValidate: true,
693
842
  children: [
694
843
  errorMessage && /* @__PURE__ */ 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 }),
695
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4 md:flex-row", children: [
844
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 md:flex-row", children: [
696
845
  /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
697
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-first", children: "First name" }),
846
+ /* @__PURE__ */ jsx(Label, { htmlFor: "firstName", children: "First name" }),
698
847
  /* @__PURE__ */ jsx(
699
848
  Input,
700
849
  {
701
- id: "payments-first",
850
+ id: "firstName",
702
851
  value: firstName,
703
852
  onChange: (e) => setFirstName(e.target.value),
704
853
  required: true
@@ -706,11 +855,11 @@ var CardDetailsForm = ({
706
855
  )
707
856
  ] }),
708
857
  /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
709
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-last", children: "Last name" }),
858
+ /* @__PURE__ */ jsx(Label, { htmlFor: "lastName", children: "Last name" }),
710
859
  /* @__PURE__ */ jsx(
711
860
  Input,
712
861
  {
713
- id: "payments-last",
862
+ id: "lastName",
714
863
  value: lastName,
715
864
  onChange: (e) => setLastName(e.target.value),
716
865
  required: true
@@ -719,11 +868,11 @@ var CardDetailsForm = ({
719
868
  ] })
720
869
  ] }),
721
870
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
722
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-email", children: "Email" }),
871
+ /* @__PURE__ */ jsx(Label, { htmlFor: "email", children: "Email" }),
723
872
  /* @__PURE__ */ jsx(
724
873
  Input,
725
874
  {
726
- id: "payments-email",
875
+ id: "email",
727
876
  type: "email",
728
877
  value: email,
729
878
  onChange: (e) => setEmail(e.target.value),
@@ -732,24 +881,24 @@ var CardDetailsForm = ({
732
881
  )
733
882
  ] }),
734
883
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
735
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-address1", children: "Address" }),
884
+ /* @__PURE__ */ jsx(Label, { htmlFor: "address1", children: "Address" }),
736
885
  /* @__PURE__ */ jsx(
737
886
  Input,
738
887
  {
739
- id: "payments-address1",
888
+ id: "address1",
740
889
  value: address1,
741
890
  onChange: (e) => setAddress1(e.target.value),
742
891
  required: true
743
892
  }
744
893
  )
745
894
  ] }),
746
- /* @__PURE__ */ jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
895
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
747
896
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
748
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-city", children: "City" }),
897
+ /* @__PURE__ */ jsx(Label, { htmlFor: "city", children: "City" }),
749
898
  /* @__PURE__ */ jsx(
750
899
  Input,
751
900
  {
752
- id: "payments-city",
901
+ id: "city",
753
902
  value: city,
754
903
  onChange: (e) => setCity(e.target.value),
755
904
  required: true
@@ -757,24 +906,24 @@ var CardDetailsForm = ({
757
906
  )
758
907
  ] }),
759
908
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
760
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-state", children: "State / Region" }),
909
+ /* @__PURE__ */ jsx(Label, { htmlFor: "state", children: "State / Region" }),
761
910
  /* @__PURE__ */ jsx(
762
911
  Input,
763
912
  {
764
- id: "payments-state",
913
+ id: "state",
765
914
  value: stateRegion,
766
915
  onChange: (e) => setStateRegion(e.target.value)
767
916
  }
768
917
  )
769
918
  ] })
770
919
  ] }),
771
- /* @__PURE__ */ jsxs("div", { className: "grid gap-5 md:grid-cols-2", children: [
920
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
772
921
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
773
- /* @__PURE__ */ jsx(Label, { htmlFor: "payments-postal", children: "Postal code" }),
922
+ /* @__PURE__ */ jsx(Label, { htmlFor: "postal", children: "Postal code" }),
774
923
  /* @__PURE__ */ jsx(
775
924
  Input,
776
925
  {
777
- id: "payments-postal",
926
+ id: "postal",
778
927
  value: postalCode,
779
928
  onChange: (e) => setPostalCode(e.target.value),
780
929
  required: true
@@ -793,7 +942,7 @@ var CardDetailsForm = ({
793
942
  /* @__PURE__ */ jsx(Label, { children: "Card number" }),
794
943
  /* @__PURE__ */ jsx("div", { id: buildSelector(collectPrefix, "ccnumber").slice(1), className: collectFieldClass })
795
944
  ] }),
796
- /* @__PURE__ */ jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [
945
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2 md:grid-cols-2", children: [
797
946
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
798
947
  /* @__PURE__ */ jsx(Label, { children: "Expiry" }),
799
948
  /* @__PURE__ */ jsx("div", { id: buildSelector(collectPrefix, "ccexp").slice(1), className: collectFieldClass })
@@ -891,7 +1040,7 @@ var badgeVariants = cva(
891
1040
  function Badge({ className, variant, ...props }) {
892
1041
  return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant }), className), ...props });
893
1042
  }
894
- var ScrollArea = React17.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1043
+ var ScrollArea = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
895
1044
  ScrollAreaPrimitive.Root,
896
1045
  {
897
1046
  ref,
@@ -905,7 +1054,7 @@ var ScrollArea = React17.forwardRef(({ className, children, ...props }, ref) =>
905
1054
  }
906
1055
  ));
907
1056
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
908
- var ScrollBar = React17.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
1057
+ var ScrollBar = React15.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ jsx(
909
1058
  ScrollAreaPrimitive.ScrollAreaScrollbar,
910
1059
  {
911
1060
  ref,
@@ -928,143 +1077,104 @@ var formatCardLabel = (method) => {
928
1077
  };
929
1078
  var StoredPaymentMethods = ({
930
1079
  selectedMethodId,
931
- onMethodSelect,
932
- showAddButton = true
1080
+ onMethodSelect
933
1081
  }) => {
934
- const { listQuery, createMutation, deleteMutation } = usePaymentMethods();
935
- const [isModalOpen, setIsModalOpen] = useState(false);
936
- const [deletingId, setDeletingId] = useState(null);
1082
+ const { listQuery } = usePaymentMethods();
937
1083
  const payments = useMemo(() => listQuery.data?.data ?? [], [listQuery.data]);
938
- const handleCardTokenize = (token, billing) => {
939
- createMutation.mutate({ token, billing });
940
- };
941
- const handleDelete = (method) => {
942
- setDeletingId(method.id);
943
- deleteMutation.mutate(
944
- { id: method.id },
1084
+ return /* @__PURE__ */ jsx("div", { className: "space-y-4", children: listQuery.isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
1085
+ /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
1086
+ " Loading cards..."
1087
+ ] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No saved payment methods yet." }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[320px] pr-2", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payments.map((method) => {
1088
+ const isSelected = selectedMethodId === method.id;
1089
+ return /* @__PURE__ */ jsxs(
1090
+ "div",
945
1091
  {
946
- onSettled: () => setDeletingId(null)
947
- }
1092
+ className: cn(
1093
+ "flex border border-border rounded-md px-4 py-3 flex-row items-center justify-between",
1094
+ {
1095
+ "bg-muted/20": isSelected
1096
+ }
1097
+ ),
1098
+ children: [
1099
+ /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
1100
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1101
+ method.failure_reason && /* @__PURE__ */ jsx(Badge, { variant: "destructive", children: method.failure_reason }),
1102
+ onMethodSelect && /* @__PURE__ */ jsx(
1103
+ Button,
1104
+ {
1105
+ size: "sm",
1106
+ variant: "ghost",
1107
+ disabled: isSelected,
1108
+ onClick: () => onMethodSelect(method),
1109
+ className: clsx2("px-3", { "bg-muted/90": !isSelected, "bg-inherit": isSelected }),
1110
+ children: isSelected ? "Selected" : "Use card"
1111
+ }
1112
+ )
1113
+ ] })
1114
+ ]
1115
+ },
1116
+ method.id
948
1117
  );
949
- };
950
- return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
951
- /* @__PURE__ */ jsx("div", { className: "flex items-start justify-between gap-4", children: showAddButton && /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: () => setIsModalOpen(true), children: "Add card" }) }),
952
- listQuery.isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-4 text-sm text-muted-foreground", children: [
953
- /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
954
- " Loading cards..."
955
- ] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No saved payment methods yet." }) : /* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[320px] pr-2", children: /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payments.map((method) => {
956
- const isSelected = selectedMethodId === method.id;
957
- return /* @__PURE__ */ jsxs(
958
- "div",
959
- {
960
- className: cn(
961
- "flex flex-col gap-3 rounded-md px-4 py-3 transition-colors md:flex-row md:items-center md:justify-between",
962
- isSelected ? "ring-1 ring-primary/70 bg-primary/5" : "ring-1 ring-border/40 bg-transparent"
963
- ),
964
- children: [
965
- /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
966
- /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: formatCardLabel(method) }),
967
- /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
968
- "Added on",
969
- " ",
970
- method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown"
971
- ] })
972
- ] }),
973
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
974
- /* @__PURE__ */ jsx(
975
- Badge,
976
- {
977
- variant: method.is_active ? "default" : "secondary",
978
- className: cn(
979
- method.is_active ? "bg-primary/20 text-primary" : "bg-muted text-muted-foreground"
980
- ),
981
- children: method.is_active ? "Active" : "Inactive"
982
- }
983
- ),
984
- method.failure_reason && /* @__PURE__ */ jsx(Badge, { variant: "destructive", children: method.failure_reason }),
985
- onMethodSelect && /* @__PURE__ */ jsx(
986
- Button,
987
- {
988
- size: "sm",
989
- variant: "ghost",
990
- className: "px-3",
991
- onClick: () => onMethodSelect(method),
992
- children: isSelected ? "Selected" : "Use card"
993
- }
994
- ),
995
- /* @__PURE__ */ jsx(
996
- Button,
997
- {
998
- size: "sm",
999
- variant: "ghost",
1000
- className: "px-3 text-destructive",
1001
- onClick: () => handleDelete(method),
1002
- disabled: deletingId === method.id && deleteMutation.isPending,
1003
- children: deletingId === method.id && deleteMutation.isPending ? "Removing\u2026" : "Remove"
1004
- }
1005
- )
1006
- ] })
1007
- ]
1008
- },
1009
- method.id
1010
- );
1011
- }) }) }),
1012
- /* @__PURE__ */ jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto", children: [
1013
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
1014
- /* @__PURE__ */ jsx(DialogTitle, { children: "Add a new card" }),
1015
- /* @__PURE__ */ jsx(DialogDescription, { children: "Your card details are tokenized securely via our payment provider." })
1016
- ] }),
1017
- /* @__PURE__ */ jsx(
1018
- CardDetailsForm,
1019
- {
1020
- visible: isModalOpen,
1021
- collectPrefix: "payments-ui-card",
1022
- submitting: createMutation.isPending,
1023
- submitLabel: "Save card",
1024
- externalError: createMutation.error?.message ?? null,
1025
- onTokenize: handleCardTokenize
1026
- }
1027
- )
1028
- ] }) })
1029
- ] });
1118
+ }) }) }) });
1030
1119
  };
1031
- var Tabs = TabsPrimitive.Root;
1032
- var TabsList = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1033
- TabsPrimitive.List,
1034
- {
1035
- ref,
1036
- className: cn(
1037
- "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
1038
- className
1039
- ),
1040
- ...props
1041
- }
1042
- ));
1043
- TabsList.displayName = TabsPrimitive.List.displayName;
1044
- var TabsTrigger = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1045
- TabsPrimitive.Trigger,
1046
- {
1047
- ref,
1048
- className: cn(
1049
- "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",
1050
- className
1051
- ),
1052
- ...props
1053
- }
1054
- ));
1055
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
1056
- var TabsContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1057
- TabsPrimitive.Content,
1058
- {
1059
- ref,
1060
- className: cn(
1061
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
1062
- className
1063
- ),
1064
- ...props
1065
- }
1066
- ));
1067
- TabsContent.displayName = TabsPrimitive.Content.displayName;
1120
+ function Tabs({
1121
+ className,
1122
+ ...props
1123
+ }) {
1124
+ return /* @__PURE__ */ jsx(
1125
+ TabsPrimitive.Root,
1126
+ {
1127
+ "data-slot": "tabs",
1128
+ className: cn("flex flex-col gap-2", className),
1129
+ ...props
1130
+ }
1131
+ );
1132
+ }
1133
+ function TabsList({
1134
+ className,
1135
+ ...props
1136
+ }) {
1137
+ return /* @__PURE__ */ jsx(
1138
+ TabsPrimitive.List,
1139
+ {
1140
+ "data-slot": "tabs-list",
1141
+ className: cn(
1142
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
1143
+ className
1144
+ ),
1145
+ ...props
1146
+ }
1147
+ );
1148
+ }
1149
+ function TabsTrigger({
1150
+ className,
1151
+ ...props
1152
+ }) {
1153
+ return /* @__PURE__ */ jsx(
1154
+ TabsPrimitive.Trigger,
1155
+ {
1156
+ "data-slot": "tabs-trigger",
1157
+ className: cn(
1158
+ "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",
1159
+ className
1160
+ ),
1161
+ ...props
1162
+ }
1163
+ );
1164
+ }
1165
+ function TabsContent({
1166
+ className,
1167
+ ...props
1168
+ }) {
1169
+ return /* @__PURE__ */ jsx(
1170
+ TabsPrimitive.Content,
1171
+ {
1172
+ "data-slot": "tabs-content",
1173
+ className: cn("flex-1 outline-none", className),
1174
+ ...props
1175
+ }
1176
+ );
1177
+ }
1068
1178
  var usePaymentNotifications = () => {
1069
1179
  const { config } = usePaymentContext();
1070
1180
  const notifyStatus = useCallback(
@@ -1289,7 +1399,7 @@ var useSolanaQrPayment = (options) => {
1289
1399
  refresh
1290
1400
  };
1291
1401
  };
1292
- var Card = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1402
+ var Card = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1293
1403
  "div",
1294
1404
  {
1295
1405
  ref,
@@ -1301,7 +1411,7 @@ var Card = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
1301
1411
  }
1302
1412
  ));
1303
1413
  Card.displayName = "Card";
1304
- var CardHeader = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1414
+ var CardHeader = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1305
1415
  "div",
1306
1416
  {
1307
1417
  ref,
@@ -1310,7 +1420,7 @@ var CardHeader = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE
1310
1420
  }
1311
1421
  ));
1312
1422
  CardHeader.displayName = "CardHeader";
1313
- var CardTitle = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1423
+ var CardTitle = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1314
1424
  "div",
1315
1425
  {
1316
1426
  ref,
@@ -1322,7 +1432,7 @@ var CardTitle = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE_
1322
1432
  }
1323
1433
  ));
1324
1434
  CardTitle.displayName = "CardTitle";
1325
- var CardDescription = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1435
+ var CardDescription = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1326
1436
  "div",
1327
1437
  {
1328
1438
  ref,
@@ -1331,9 +1441,9 @@ var CardDescription = React17.forwardRef(({ className, ...props }, ref) => /* @_
1331
1441
  }
1332
1442
  ));
1333
1443
  CardDescription.displayName = "CardDescription";
1334
- var CardContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1444
+ var CardContent = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
1335
1445
  CardContent.displayName = "CardContent";
1336
- var CardFooter = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1446
+ var CardFooter = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1337
1447
  "div",
1338
1448
  {
1339
1449
  ref,
@@ -1348,7 +1458,7 @@ var QRCodePayment = ({
1348
1458
  onPaymentError,
1349
1459
  onPaymentSuccess
1350
1460
  }) => {
1351
- const handleQrSuccess = React17__default.useCallback(
1461
+ const handleQrSuccess = React15__default.useCallback(
1352
1462
  (paymentId, txId) => {
1353
1463
  if (!paymentId && !txId) {
1354
1464
  onPaymentError("Missing payment confirmation details");
@@ -1366,9 +1476,9 @@ var QRCodePayment = ({
1366
1476
  onSuccess: handleQrSuccess
1367
1477
  });
1368
1478
  if (!selectedToken) {
1369
- return /* @__PURE__ */ 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." });
1479
+ return /* @__PURE__ */ 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." });
1370
1480
  }
1371
- return /* @__PURE__ */ jsxs(Card, { className: "space-y-4 border border-border/60 bg-background/80 p-6 shadow-none rounded-md", children: [
1481
+ return /* @__PURE__ */ jsxs(Card, { className: "space-y-4 border bg-background/80 p-6 shadow-none rounded-md", children: [
1372
1482
  /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
1373
1483
  /* @__PURE__ */ jsxs("div", { children: [
1374
1484
  /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-foreground", children: "Scan with Solana Pay" }),
@@ -1387,7 +1497,7 @@ var QRCodePayment = ({
1387
1497
  )
1388
1498
  ] }),
1389
1499
  error && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 px-4 py-2 text-sm text-destructive", children: error }),
1390
- /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed border-border/70 bg-muted/5 p-6", children: qrDataUri ? /* @__PURE__ */ jsx("img", { src: qrDataUri, alt: "Solana Pay QR", className: "h-72 w-72 rounded-lg border border-border/40 bg-card" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2 text-sm text-muted-foreground", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
1500
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center rounded-2xl border border-dashed bg-muted/5 p-6", children: qrDataUri ? /* @__PURE__ */ jsx("img", { src: qrDataUri, alt: "Solana Pay QR", className: "h-72 w-72 rounded-lg border bg-card" }) : /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center gap-2 text-sm text-muted-foreground", children: isLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
1391
1501
  /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin" }),
1392
1502
  " Generating QR code\u2026"
1393
1503
  ] }) : "QR code unavailable" }) }),
@@ -1739,7 +1849,7 @@ var SolanaPaymentView = ({
1739
1849
  /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
1740
1850
  /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: "Select token" }),
1741
1851
  /* @__PURE__ */ jsxs(Select, { value: selectedToken?.symbol ?? "", onValueChange: handleTokenChange, children: [
1742
- /* @__PURE__ */ jsx(SelectTrigger, { className: "border border-border/60 bg-transparent", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select token" }) }),
1852
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "border bg-transparent", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select token" }) }),
1743
1853
  /* @__PURE__ */ jsx(SelectContent, { className: "max-h-64", children: tokens.map((token) => /* @__PURE__ */ jsxs(SelectItem, { value: token.symbol, children: [
1744
1854
  token.name,
1745
1855
  " (",
@@ -1806,7 +1916,7 @@ var PaymentExperience = ({
1806
1916
  const [savedError, setSavedError] = useState(null);
1807
1917
  const [newCardStatus, setNewCardStatus] = useState("idle");
1808
1918
  const [newCardError, setNewCardError] = useState(null);
1809
- const { notifyStatus, notifySuccess, notifyError } = usePaymentNotifications();
1919
+ const { notifyStatus, notifyError } = usePaymentNotifications();
1810
1920
  useEffect(() => {
1811
1921
  setActiveTab(showStored ? "saved" : "new");
1812
1922
  }, [showStored]);
@@ -1866,7 +1976,7 @@ var PaymentExperience = ({
1866
1976
  },
1867
1977
  [notifyError, notifyStatus, onNewCardPayment]
1868
1978
  );
1869
- const showSolanaView = useCallback(() => {
1979
+ useCallback(() => {
1870
1980
  if (!enableSolanaPay) return;
1871
1981
  setMode("solana");
1872
1982
  }, [enableSolanaPay]);
@@ -1894,7 +2004,6 @@ var PaymentExperience = ({
1894
2004
  /* @__PURE__ */ jsx(
1895
2005
  StoredPaymentMethods,
1896
2006
  {
1897
- showAddButton: false,
1898
2007
  selectedMethodId,
1899
2008
  onMethodSelect: handleMethodSelect
1900
2009
  }
@@ -1926,27 +2035,13 @@ var PaymentExperience = ({
1926
2035
  }
1927
2036
  );
1928
2037
  };
1929
- const renderCardExperience = () => /* @__PURE__ */ jsxs(Fragment, { children: [
1930
- /* @__PURE__ */ jsxs(
1931
- Tabs,
1932
- {
1933
- value: activeTab,
1934
- onValueChange: (value) => setActiveTab(value),
1935
- className: "space-y-3",
1936
- children: [
1937
- /* @__PURE__ */ jsxs(TabsList, { className: "grid w-full grid-cols-2 border border-border/60", children: [
1938
- /* @__PURE__ */ jsx(TabsTrigger, { value: "saved", disabled: !showStored, children: "Use saved card" }),
1939
- /* @__PURE__ */ jsx(TabsTrigger, { value: "new", disabled: !showNewCard, children: "Add new card" })
1940
- ] }),
1941
- /* @__PURE__ */ jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
1942
- /* @__PURE__ */ jsx(TabsContent, { value: "new", children: renderNewTab() })
1943
- ]
1944
- }
1945
- ),
1946
- enableSolanaPay && /* @__PURE__ */ jsxs(Button, { className: "w-full", variant: "secondary", onClick: showSolanaView, children: [
1947
- /* @__PURE__ */ jsx(Sparkles, { className: "mr-2 h-4 w-4" }),
1948
- " Pay with Solana"
1949
- ] })
2038
+ const renderCardExperience = () => /* @__PURE__ */ jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, children: [
2039
+ /* @__PURE__ */ jsxs(TabsList, { className: "w-full rounded-md mb-4", children: [
2040
+ /* @__PURE__ */ jsx(TabsTrigger, { className: clsx("cursor-pointer", { "bg-background": activeTab == "saved" }), value: "saved", children: "Use saved card" }),
2041
+ /* @__PURE__ */ jsx(TabsTrigger, { className: clsx("cursor-pointer", { "bg-background": activeTab == "new" }), value: "new", children: "Add new card" })
2042
+ ] }),
2043
+ /* @__PURE__ */ jsx(TabsContent, { value: "saved", children: renderSavedTab() }),
2044
+ /* @__PURE__ */ jsx(TabsContent, { value: "new", children: renderNewTab() })
1950
2045
  ] });
1951
2046
  return /* @__PURE__ */ jsxs("div", { className: "space-y-6 pt-4", children: [
1952
2047
  mode === "cards" && renderCardExperience(),
@@ -1971,7 +2066,7 @@ var SubscriptionSuccessDialog = ({
1971
2066
  }) => {
1972
2067
  return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (value) => {
1973
2068
  if (!value) onClose();
1974
- }, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border border-border/70 bg-background/95 p-0 shadow-2xl", children: [
2069
+ }, children: /* @__PURE__ */ jsxs(DialogContent, { className: "w-full max-w-md overflow-hidden border bg-background/95 p-0 shadow-2xl", children: [
1975
2070
  /* @__PURE__ */ jsxs("div", { className: "bg-gradient-to-b from-primary/25 via-primary/10 to-background px-6 py-8 text-center", children: [
1976
2071
  /* @__PURE__ */ jsx("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-background/60", children: /* @__PURE__ */ jsx(CheckCircle, { className: "h-10 w-10 text-primary" }) }),
1977
2072
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
@@ -2156,16 +2251,17 @@ var SubscriptionCheckoutModal = ({
2156
2251
  onSolanaError?.(error);
2157
2252
  };
2158
2253
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2159
- /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsx(
2254
+ /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: handleClose, children: /* @__PURE__ */ jsxs(
2160
2255
  DialogContent,
2161
2256
  {
2162
- className: "max-w-3xl max-h-[90vh] overflow-y-auto p-0 [&::-webkit-scrollbar]:hidden",
2163
- children: /* @__PURE__ */ jsxs("div", { className: "p-6 space-y-6", children: [
2164
- !priceId && /* @__PURE__ */ 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: [
2257
+ className: "max-w-3xl max-h-[90vh] overflow-y-auto border-border rounded-md [&::-webkit-scrollbar]:hidden",
2258
+ children: [
2259
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: "Checkout" }) }),
2260
+ /* @__PURE__ */ jsx("div", { className: "space-y-4", children: !priceId ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-center px-3 py-2 text-sm text-destructive", children: [
2165
2261
  /* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
2166
- " Select a subscription plan to continue."
2167
- ] }),
2168
- /* @__PURE__ */ jsx(
2262
+ " ",
2263
+ /* @__PURE__ */ jsx("span", { children: "Select a subscription plan to continue." })
2264
+ ] }) : /* @__PURE__ */ jsx(
2169
2265
  PaymentExperience,
2170
2266
  {
2171
2267
  usdAmount,
@@ -2179,8 +2275,8 @@ var SubscriptionCheckoutModal = ({
2179
2275
  onNewCardPayment: priceId ? handleNewCardPayment : void 0,
2180
2276
  onSavedMethodPayment: priceId ? handleSavedMethodPayment : void 0
2181
2277
  }
2182
- )
2183
- ] })
2278
+ ) })
2279
+ ]
2184
2280
  }
2185
2281
  ) }),
2186
2282
  /* @__PURE__ */ jsx(
@@ -2209,8 +2305,8 @@ var wallets = [
2209
2305
  ];
2210
2306
  var WalletModal = ({ open, onOpenChange }) => {
2211
2307
  const [expandedWallet, setExpandedWallet] = useState(null);
2212
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ 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: [
2213
- /* @__PURE__ */ 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: [
2308
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange, children: /* @__PURE__ */ 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: [
2309
+ /* @__PURE__ */ jsxs(DialogHeader, { className: "border-b bg-gradient-to-r from-primary/10 via-background to-background px-6 py-5 text-left", children: [
2214
2310
  /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-foreground", children: [
2215
2311
  /* @__PURE__ */ jsx(Wallet, { className: "h-5 w-5 text-primary" }),
2216
2312
  " Connect a Solana wallet"
@@ -2221,7 +2317,7 @@ var WalletModal = ({ open, onOpenChange }) => {
2221
2317
  wallets.map((wallet) => /* @__PURE__ */ jsxs(
2222
2318
  "div",
2223
2319
  {
2224
- className: "rounded-2xl border border-border/60 bg-background/80 p-4 shadow-sm",
2320
+ className: "rounded-2xl border bg-background/80 p-4 shadow-sm",
2225
2321
  children: [
2226
2322
  /* @__PURE__ */ jsxs(
2227
2323
  "button",
@@ -2256,7 +2352,7 @@ var WalletModal = ({ open, onOpenChange }) => {
2256
2352
  },
2257
2353
  wallet.id
2258
2354
  )),
2259
- /* @__PURE__ */ 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." })
2355
+ /* @__PURE__ */ 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." })
2260
2356
  ] })
2261
2357
  ] }) });
2262
2358
  };
@@ -2415,48 +2511,14 @@ var usePaymentContext = () => {
2415
2511
  }
2416
2512
  return context;
2417
2513
  };
2418
- var BillingThemeProvider = ({
2419
- children,
2420
- className,
2421
- dark = false
2422
- }) => {
2423
- return /* @__PURE__ */ jsx(
2424
- "div",
2425
- {
2426
- className: cn(
2427
- "payments-ui-root",
2428
- dark && "dark",
2429
- className
2430
- ),
2431
- children
2432
- }
2433
- );
2434
- };
2435
- var BillingThemePortal = ({
2436
- children,
2437
- className,
2438
- dark = false
2439
- }) => {
2440
- return /* @__PURE__ */ jsx(
2441
- "div",
2442
- {
2443
- className: cn(
2444
- "payments-ui-portal",
2445
- dark && "dark",
2446
- className
2447
- ),
2448
- children
2449
- }
2450
- );
2451
- };
2452
2514
  var SolanaPaymentSelector = ({
2453
2515
  isOpen,
2454
2516
  onClose,
2455
2517
  ...props
2456
2518
  }) => {
2457
- return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ 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__ */ jsx(SolanaPaymentView, { ...props, onClose }) }) });
2519
+ return /* @__PURE__ */ jsx(Dialog, { open: isOpen, onOpenChange: (value) => value ? void 0 : onClose(), children: /* @__PURE__ */ 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__ */ jsx(SolanaPaymentView, { ...props, onClose }) }) });
2458
2520
  };
2459
- var Table = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
2521
+ var Table = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
2460
2522
  "table",
2461
2523
  {
2462
2524
  ref,
@@ -2465,9 +2527,9 @@ var Table = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
2465
2527
  }
2466
2528
  ) }));
2467
2529
  Table.displayName = "Table";
2468
- var TableHeader = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2530
+ var TableHeader = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2469
2531
  TableHeader.displayName = "TableHeader";
2470
- var TableBody = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2532
+ var TableBody = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2471
2533
  "tbody",
2472
2534
  {
2473
2535
  ref,
@@ -2476,7 +2538,7 @@ var TableBody = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE_
2476
2538
  }
2477
2539
  ));
2478
2540
  TableBody.displayName = "TableBody";
2479
- var TableFooter = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2541
+ var TableFooter = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2480
2542
  "tfoot",
2481
2543
  {
2482
2544
  ref,
@@ -2488,7 +2550,7 @@ var TableFooter = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
2488
2550
  }
2489
2551
  ));
2490
2552
  TableFooter.displayName = "TableFooter";
2491
- var TableRow = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2553
+ var TableRow = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2492
2554
  "tr",
2493
2555
  {
2494
2556
  ref,
@@ -2500,7 +2562,7 @@ var TableRow = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__
2500
2562
  }
2501
2563
  ));
2502
2564
  TableRow.displayName = "TableRow";
2503
- var TableHead = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2565
+ var TableHead = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2504
2566
  "th",
2505
2567
  {
2506
2568
  ref,
@@ -2512,7 +2574,7 @@ var TableHead = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE_
2512
2574
  }
2513
2575
  ));
2514
2576
  TableHead.displayName = "TableHead";
2515
- var TableCell = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2577
+ var TableCell = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2516
2578
  "td",
2517
2579
  {
2518
2580
  ref,
@@ -2521,7 +2583,7 @@ var TableCell = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE_
2521
2583
  }
2522
2584
  ));
2523
2585
  TableCell.displayName = "TableCell";
2524
- var TableCaption = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2586
+ var TableCaption = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2525
2587
  "caption",
2526
2588
  {
2527
2589
  ref,
@@ -2533,7 +2595,7 @@ TableCaption.displayName = "TableCaption";
2533
2595
  var AlertDialog = AlertDialogPrimitive.Root;
2534
2596
  var AlertDialogTrigger = AlertDialogPrimitive.Trigger;
2535
2597
  var AlertDialogPortal = AlertDialogPrimitive.Portal;
2536
- var AlertDialogOverlay = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2598
+ var AlertDialogOverlay = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2537
2599
  AlertDialogPrimitive.Overlay,
2538
2600
  {
2539
2601
  className: cn(
@@ -2545,7 +2607,7 @@ var AlertDialogOverlay = React17.forwardRef(({ className, ...props }, ref) => /*
2545
2607
  }
2546
2608
  ));
2547
2609
  AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
2548
- var AlertDialogContent = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
2610
+ var AlertDialogContent = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxs(AlertDialogPortal, { children: [
2549
2611
  /* @__PURE__ */ jsx(AlertDialogOverlay, {}),
2550
2612
  /* @__PURE__ */ jsx(
2551
2613
  AlertDialogPrimitive.Content,
@@ -2588,7 +2650,7 @@ var AlertDialogFooter = ({
2588
2650
  }
2589
2651
  );
2590
2652
  AlertDialogFooter.displayName = "AlertDialogFooter";
2591
- var AlertDialogTitle = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2653
+ var AlertDialogTitle = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2592
2654
  AlertDialogPrimitive.Title,
2593
2655
  {
2594
2656
  ref,
@@ -2597,7 +2659,7 @@ var AlertDialogTitle = React17.forwardRef(({ className, ...props }, ref) => /* @
2597
2659
  }
2598
2660
  ));
2599
2661
  AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
2600
- var AlertDialogDescription = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2662
+ var AlertDialogDescription = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2601
2663
  AlertDialogPrimitive.Description,
2602
2664
  {
2603
2665
  ref,
@@ -2606,7 +2668,7 @@ var AlertDialogDescription = React17.forwardRef(({ className, ...props }, ref) =
2606
2668
  }
2607
2669
  ));
2608
2670
  AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
2609
- var AlertDialogAction = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2671
+ var AlertDialogAction = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2610
2672
  AlertDialogPrimitive.Action,
2611
2673
  {
2612
2674
  ref,
@@ -2615,7 +2677,7 @@ var AlertDialogAction = React17.forwardRef(({ className, ...props }, ref) => /*
2615
2677
  }
2616
2678
  ));
2617
2679
  AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
2618
- var AlertDialogCancel = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2680
+ var AlertDialogCancel = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2619
2681
  AlertDialogPrimitive.Cancel,
2620
2682
  {
2621
2683
  ref,
@@ -2628,7 +2690,7 @@ var AlertDialogCancel = React17.forwardRef(({ className, ...props }, ref) => /*
2628
2690
  }
2629
2691
  ));
2630
2692
  AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
2631
- var Textarea = React17.forwardRef(({ className, ...props }, ref) => {
2693
+ var Textarea = React15.forwardRef(({ className, ...props }, ref) => {
2632
2694
  return /* @__PURE__ */ jsx(
2633
2695
  "textarea",
2634
2696
  {
@@ -2894,8 +2956,8 @@ var BillingHistory = ({
2894
2956
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t.reviewActivity }),
2895
2957
  enableCancel && /* @__PURE__ */ jsx(CancelMembershipDialog, { onNotify: notify })
2896
2958
  ] }),
2897
- /* @__PURE__ */ jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border border-border/70", children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: historyQuery.isLoading ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: t.loading }) : historyQuery.isError ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-destructive", children: t.error }) : /* @__PURE__ */ jsxs(Table, { children: [
2898
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "border-border/60", children: [
2959
+ /* @__PURE__ */ jsx("div", { className: "max-h-[300px] overflow-y-auto rounded-lg border ", children: /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: historyQuery.isLoading ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-muted-foreground", children: t.loading }) : historyQuery.isError ? /* @__PURE__ */ jsx("p", { className: "p-4 text-center text-sm text-destructive", children: t.error }) : /* @__PURE__ */ jsxs(Table, { children: [
2960
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { className: "", children: [
2899
2961
  /* @__PURE__ */ jsx(TableHead, { children: t.reference }),
2900
2962
  /* @__PURE__ */ jsx(TableHead, { children: t.date }),
2901
2963
  /* @__PURE__ */ jsx(TableHead, { children: t.amount }),
@@ -2903,7 +2965,7 @@ var BillingHistory = ({
2903
2965
  /* @__PURE__ */ jsx(TableHead, { children: t.status })
2904
2966
  ] }) }),
2905
2967
  /* @__PURE__ */ jsx(TableBody, { children: payments.map(
2906
- (page) => page.data.map((payment) => /* @__PURE__ */ jsxs(TableRow, { className: "border-border/40", children: [
2968
+ (page) => page.data.map((payment) => /* @__PURE__ */ jsxs(TableRow, { className: "", children: [
2907
2969
  /* @__PURE__ */ jsx(TableCell, { className: "font-mono text-sm", children: payment.id.slice(0, 7).toUpperCase() }),
2908
2970
  /* @__PURE__ */ jsx(TableCell, { children: formatDate(payment.purchased_at) }),
2909
2971
  /* @__PURE__ */ jsx(TableCell, { children: formatAmount(payment.amount, payment.currency) }),
@@ -2936,21 +2998,17 @@ var defaultTranslations3 = {
2936
2998
  addedOn: "Added on",
2937
2999
  active: "Active",
2938
3000
  inactive: "Inactive",
2939
- replaceCard: "Replace card",
2940
3001
  makeDefault: "Make default",
2941
3002
  defaultMethod: "Default method",
2942
3003
  remove: "Remove",
2943
3004
  addNewCard: "Add a new card",
2944
3005
  addNewCardDescription: "Your card details are tokenized securely via our payment provider.",
2945
3006
  saveCard: "Save card",
2946
- replaceCardTitle: "Replace card",
2947
- replaceCardDescription: "Update this card with new billing details.",
2948
3007
  cardAddedSuccess: "Card added successfully",
2949
3008
  unableToAddCard: "Unable to add card",
2950
3009
  cardRemoved: "Card removed",
2951
- unableToRemoveCard: "Unable to remove card",
2952
3010
  cardUpdated: "Card updated",
2953
- unableToReplaceCard: "Unable to replace card",
3011
+ unableToRemoveCard: "Unable to remove card",
2954
3012
  defaultPaymentMethodUpdated: "Default payment method updated",
2955
3013
  unableToSetDefault: "Unable to set default payment method"
2956
3014
  };
@@ -2974,7 +3032,6 @@ var PaymentMethodsSection = ({
2974
3032
  };
2975
3033
  const [isModalOpen, setIsModalOpen] = useState(false);
2976
3034
  const [deletingId, setDeletingId] = useState(null);
2977
- const [methodBeingReplaced, setMethodBeingReplaced] = useState(null);
2978
3035
  const notify = onNotify ?? notifyDefault3;
2979
3036
  const t = { ...defaultTranslations3, ...customTranslations };
2980
3037
  const queryKey = ["payments-ui", "payment-methods"];
@@ -3015,21 +3072,6 @@ var PaymentMethodsSection = ({
3015
3072
  },
3016
3073
  onSettled: () => setDeletingId(null)
3017
3074
  });
3018
- const replaceMutation = useMutation({
3019
- mutationFn: ({ id, payload }) => paymentMethods.update(id, payload),
3020
- onSuccess: () => {
3021
- notify({ title: t.cardUpdated, status: "success" });
3022
- setMethodBeingReplaced(null);
3023
- void queryClient.invalidateQueries({ queryKey });
3024
- },
3025
- onError: (error) => {
3026
- notify({
3027
- title: t.unableToReplaceCard,
3028
- description: error.message,
3029
- status: "destructive"
3030
- });
3031
- }
3032
- });
3033
3075
  const activateMutation = useMutation({
3034
3076
  mutationFn: (id) => paymentMethods.activate(id),
3035
3077
  onSuccess: () => {
@@ -3067,18 +3109,10 @@ var PaymentMethodsSection = ({
3067
3109
  const handleCardTokenize = (token, billing) => {
3068
3110
  createMutation.mutate(buildPayload(token, billing));
3069
3111
  };
3070
- const handleReplaceTokenize = (token, billing) => {
3071
- if (!methodBeingReplaced) return;
3072
- replaceMutation.mutate({ id: methodBeingReplaced.id, payload: buildPayload(token, billing) });
3073
- };
3074
- return /* @__PURE__ */ jsxs(Card, { children: [
3112
+ return /* @__PURE__ */ jsxs(Card, { className: "bg-bckground border-border rounded-md", children: [
3075
3113
  /* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-col gap-4 md:flex-row md:items-center md:justify-between", children: [
3076
3114
  /* @__PURE__ */ jsxs("div", { children: [
3077
- /* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2", children: [
3078
- /* @__PURE__ */ jsx(WalletCards, { className: "h-5 w-5 text-emerald-400" }),
3079
- " ",
3080
- t.title
3081
- ] }),
3115
+ /* @__PURE__ */ jsx(CardTitle, { className: "flex items-center gap-2", children: t.title }),
3082
3116
  /* @__PURE__ */ jsx(CardDescription, { children: t.description })
3083
3117
  ] }),
3084
3118
  /* @__PURE__ */ jsxs(Button, { onClick: () => setIsModalOpen(true), children: [
@@ -3094,42 +3128,16 @@ var PaymentMethodsSection = ({
3094
3128
  ] }) : payments.length === 0 ? /* @__PURE__ */ jsx("div", { className: "p-6 text-sm text-center", children: t.noPaymentMethods }) : /* @__PURE__ */ jsx("div", { className: "space-y-3", children: payments.map((method) => /* @__PURE__ */ jsxs(
3095
3129
  "div",
3096
3130
  {
3097
- className: "rounded-lg border border-white/10 bg-white/5 p-4 shadow-sm",
3131
+ className: "rounded-lg border bg-white/5 p-4 shadow-sm",
3098
3132
  children: [
3099
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 md:flex-row md:items-center md:justify-between", children: [
3100
- /* @__PURE__ */ jsxs("div", { children: [
3101
- /* @__PURE__ */ jsx("h4", { className: "text-base font-medium text-white", children: formatCardLabel2(method) }),
3102
- /* @__PURE__ */ jsxs("p", { className: "text-sm text-white/60", children: [
3103
- t.addedOn,
3104
- " ",
3105
- method.created_at ? new Date(method.created_at).toLocaleDateString() : "unknown date"
3106
- ] })
3133
+ /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
3134
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
3135
+ /* @__PURE__ */ jsx("div", { className: "text-base font-medium text-white", children: formatCardLabel2(method) }),
3136
+ /* @__PURE__ */ jsx(Badge, { variant: method.is_active ? "default" : "secondary", children: method.is_active ? t.active : t.inactive })
3107
3137
  ] }),
3108
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
3109
- /* @__PURE__ */ jsx(
3110
- Badge,
3111
- {
3112
- variant: method.is_active ? "default" : "secondary",
3113
- children: method.is_active ? t.active : t.inactive
3114
- }
3115
- ),
3116
- method.failure_reason && /* @__PURE__ */ jsx(Badge, { variant: "destructive", children: method.failure_reason })
3117
- ] })
3138
+ /* @__PURE__ */ jsx("div", { children: method.failure_reason && /* @__PURE__ */ jsx(Badge, { variant: "destructive", children: method.failure_reason }) })
3118
3139
  ] }),
3119
3140
  /* @__PURE__ */ jsxs("div", { className: "mt-3 flex flex-wrap gap-2", children: [
3120
- /* @__PURE__ */ jsxs(
3121
- Button,
3122
- {
3123
- variant: "ghost",
3124
- className: "text-blue-400",
3125
- disabled: replaceMutation.isPending && methodBeingReplaced?.id === method.id,
3126
- onClick: () => setMethodBeingReplaced(method),
3127
- children: [
3128
- replaceMutation.isPending && methodBeingReplaced?.id === method.id ? /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(CreditCard, { className: "mr-2 h-4 w-4" }),
3129
- t.replaceCard
3130
- ]
3131
- }
3132
- ),
3133
3141
  /* @__PURE__ */ jsxs(
3134
3142
  Button,
3135
3143
  {
@@ -3160,55 +3168,34 @@ var PaymentMethodsSection = ({
3160
3168
  },
3161
3169
  method.id
3162
3170
  )) }) }),
3163
- /* @__PURE__ */ jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[95vh] overflow-y-auto", children: [
3164
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
3165
- /* @__PURE__ */ jsx(DialogTitle, { children: t.addNewCard }),
3166
- /* @__PURE__ */ jsx(DialogDescription, { children: t.addNewCardDescription })
3167
- ] }),
3168
- /* @__PURE__ */ jsx(
3169
- CardDetailsForm,
3170
- {
3171
- visible: isModalOpen,
3172
- collectPrefix,
3173
- submitting: createMutation.isPending,
3174
- submitLabel: t.saveCard,
3175
- defaultValues: {
3176
- email: userEmail ?? "",
3177
- country: defaultCountry,
3178
- provider
3179
- },
3180
- externalError: createMutation.error?.message ?? null,
3181
- onTokenize: handleCardTokenize,
3182
- className: "rounded-2xl border border-white/10 bg-white/5 p-6"
3183
- }
3184
- )
3185
- ] }) }),
3186
- /* @__PURE__ */ jsx(Dialog, { open: Boolean(methodBeingReplaced), onOpenChange: (open) => !open && setMethodBeingReplaced(null), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-h-[95vh] overflow-y-auto", children: [
3187
- /* @__PURE__ */ jsxs(DialogHeader, { children: [
3188
- /* @__PURE__ */ jsx(DialogTitle, { children: t.replaceCardTitle }),
3189
- /* @__PURE__ */ jsx(DialogDescription, { children: t.replaceCardDescription })
3190
- ] }),
3191
- methodBeingReplaced && /* @__PURE__ */ jsx(
3192
- CardDetailsForm,
3193
- {
3194
- visible: true,
3195
- collectPrefix: `${collectPrefix}-replace-${methodBeingReplaced.id}`,
3196
- submitting: replaceMutation.isPending,
3197
- submitLabel: t.replaceCard,
3198
- defaultValues: {
3199
- email: userEmail ?? "",
3200
- country: defaultCountry,
3201
- provider
3202
- },
3203
- externalError: replaceMutation.error?.message ?? null,
3204
- onTokenize: handleReplaceTokenize,
3205
- className: "rounded-2xl border border-white/10 bg-white/5 p-6"
3206
- }
3207
- )
3208
- ] }) })
3171
+ /* @__PURE__ */ jsx(Dialog, { open: isModalOpen, onOpenChange: setIsModalOpen, children: /* @__PURE__ */ jsxs(
3172
+ DialogContent,
3173
+ {
3174
+ className: "max-w-3xl max-h-[90vh] overflow-y-auto border-border rounded-md [&::-webkit-scrollbar]:hidden",
3175
+ children: [
3176
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t.addNewCard }) }),
3177
+ /* @__PURE__ */ jsx(
3178
+ CardDetailsForm,
3179
+ {
3180
+ visible: isModalOpen,
3181
+ submitLabel: t.saveCard,
3182
+ collectPrefix,
3183
+ onTokenize: handleCardTokenize,
3184
+ submitting: createMutation.isPending,
3185
+ defaultValues: {
3186
+ provider,
3187
+ email: userEmail ?? "",
3188
+ country: defaultCountry
3189
+ },
3190
+ externalError: createMutation.error?.message ?? null
3191
+ }
3192
+ )
3193
+ ]
3194
+ }
3195
+ ) })
3209
3196
  ] });
3210
3197
  };
3211
- var Checkbox = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3198
+ var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3212
3199
  CheckboxPrimitive.Root,
3213
3200
  {
3214
3201
  ref,
@@ -3271,7 +3258,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
3271
3258
  setForm(initialState);
3272
3259
  };
3273
3260
  return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { className: "max-h-[95vh] max-w-lg overflow-y-auto rounded-2xl border border-border bg-background", children: [
3274
- /* @__PURE__ */ jsxs(AlertDialogHeader, { className: "border-b border-border/60 pb-4", children: [
3261
+ /* @__PURE__ */ jsxs(AlertDialogHeader, { className: "border-b pb-4", children: [
3275
3262
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2", children: [
3276
3263
  /* @__PURE__ */ jsx(Shield, { className: "h-5 w-5 text-primary" }),
3277
3264
  /* @__PURE__ */ jsx(AlertDialogTitle, { className: "text-center text-base font-semibold uppercase tracking-wide", children: "Secure Payment via Mobius Pay" })
@@ -3315,7 +3302,7 @@ var WalletDialog = ({ open, onOpenChange }) => {
3315
3302
  ] })
3316
3303
  ] })
3317
3304
  ] }),
3318
- /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border border-border/70 bg-muted/10 p-4", children: [
3305
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 rounded-md border bg-muted/10 p-4", children: [
3319
3306
  /* @__PURE__ */ jsx(Checkbox, { id: "terms-agree", checked: form.termsAccepted, onCheckedChange: (checked) => updateField("termsAccepted", Boolean(checked)) }),
3320
3307
  /* @__PURE__ */ 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." })
3321
3308
  ] }),
@@ -3723,6 +3710,6 @@ var usePaymentStatus = (options = {}) => {
3723
3710
  };
3724
3711
  };
3725
3712
 
3726
- export { BillingHistory, BillingThemePortal, BillingThemeProvider, CancelMembershipDialog, CardDetailsForm, ClientApiError, PaymentContext, PaymentExperience, PaymentMethodsSection, PaymentProvider, PaymentsDialogProvider, SolanaPaymentSelector, SolanaPaymentView, StoredPaymentMethods, SubscriptionCheckoutModal, SubscriptionSuccessDialog, WalletDialog, WalletModal, createClient, usePaymentContext, usePaymentDialogs, usePaymentMethods, usePaymentNotifications, usePaymentStatus, useSolanaQrPayment, useSubscriptionActions, useSupportedTokens, useTokenBalance };
3713
+ export { BillingHistory, CancelMembershipDialog, CardDetailsForm, ClientApiError, PaymentContext, PaymentExperience, PaymentMethodsSection, PaymentProvider, PaymentsDialogProvider, SolanaPaymentSelector, SolanaPaymentView, StoredPaymentMethods, SubscriptionCheckoutModal, SubscriptionSuccessDialog, WalletDialog, WalletModal, createClient, usePaymentContext, usePaymentDialogs, usePaymentMethods, usePaymentNotifications, usePaymentStatus, useSolanaQrPayment, useSubscriptionActions, useSupportedTokens, useTokenBalance };
3727
3714
  //# sourceMappingURL=index.js.map
3728
3715
  //# sourceMappingURL=index.js.map