@carlonicora/nextjs-jsonapi 1.112.1 → 1.114.0

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.
Files changed (71) hide show
  1. package/dist/{AssistantInterface-B1c8FhGA.d.mts → AssistantInterface-B56qznuH.d.mts} +2 -0
  2. package/dist/{AssistantInterface-BBUHxOCd.d.ts → AssistantInterface-CHiJIYDY.d.ts} +2 -0
  3. package/dist/{AssistantMessageInterface-DrgHDjZ5.d.mts → AssistantMessageInterface-BuUZFkE5.d.mts} +16 -1
  4. package/dist/{AssistantMessageInterface-BNzf1etU.d.ts → AssistantMessageInterface-CQwh5tEb.d.ts} +16 -1
  5. package/dist/{BlockNoteEditor-HNQNKCFP.js → BlockNoteEditor-DT5L5AAB.js} +19 -19
  6. package/dist/{BlockNoteEditor-HNQNKCFP.js.map → BlockNoteEditor-DT5L5AAB.js.map} +1 -1
  7. package/dist/{BlockNoteEditor-A5LNFWHW.mjs → BlockNoteEditor-HIEAHXR4.mjs} +4 -4
  8. package/dist/billing/index.js +346 -346
  9. package/dist/billing/index.mjs +3 -3
  10. package/dist/{chunk-6XWW67F2.js → chunk-4BUZUKER.js} +7 -7
  11. package/dist/{chunk-6XWW67F2.js.map → chunk-4BUZUKER.js.map} +1 -1
  12. package/dist/{chunk-U2HR57MY.js → chunk-7EQ46GUL.js} +76 -25
  13. package/dist/chunk-7EQ46GUL.js.map +1 -0
  14. package/dist/{chunk-CWVYU4YZ.mjs → chunk-DJSH6VHF.mjs} +2 -2
  15. package/dist/{chunk-ZYPNVEHB.mjs → chunk-FBTTIGLL.mjs} +53 -2
  16. package/dist/{chunk-ZYPNVEHB.mjs.map → chunk-FBTTIGLL.mjs.map} +1 -1
  17. package/dist/{chunk-LYLGU2BK.mjs → chunk-TVOW47AP.mjs} +3011 -2853
  18. package/dist/chunk-TVOW47AP.mjs.map +1 -0
  19. package/dist/{chunk-DRJUN4R6.js → chunk-VA2KFKHD.js} +1080 -922
  20. package/dist/chunk-VA2KFKHD.js.map +1 -0
  21. package/dist/client/index.js +4 -4
  22. package/dist/client/index.mjs +3 -3
  23. package/dist/components/index.d.mts +56 -8
  24. package/dist/components/index.d.ts +56 -8
  25. package/dist/components/index.js +12 -4
  26. package/dist/components/index.js.map +1 -1
  27. package/dist/components/index.mjs +11 -3
  28. package/dist/contexts/index.d.mts +7 -2
  29. package/dist/contexts/index.d.ts +7 -2
  30. package/dist/contexts/index.js +4 -4
  31. package/dist/contexts/index.mjs +3 -3
  32. package/dist/core/index.d.mts +26 -4
  33. package/dist/core/index.d.ts +26 -4
  34. package/dist/core/index.js +2 -2
  35. package/dist/core/index.mjs +1 -1
  36. package/dist/features/help/index.js +36 -36
  37. package/dist/features/help/index.mjs +3 -3
  38. package/dist/index.d.mts +2 -2
  39. package/dist/index.d.ts +2 -2
  40. package/dist/index.js +3 -3
  41. package/dist/index.mjs +2 -2
  42. package/dist/server/index.js +3 -3
  43. package/dist/server/index.mjs +1 -1
  44. package/package.json +1 -1
  45. package/src/components/tables/ContentListTable.tsx +2 -1
  46. package/src/features/assistant/components/containers/AssistantContainer.tsx +18 -2
  47. package/src/features/assistant/components/parts/AssistantEmptyState.tsx +22 -1
  48. package/src/features/assistant/components/parts/AssistantThread.tsx +12 -1
  49. package/src/features/assistant/contexts/AssistantContext.tsx +42 -9
  50. package/src/features/assistant/contexts/__tests__/AssistantContext.spec.tsx +94 -3
  51. package/src/features/assistant/data/Assistant.ts +6 -0
  52. package/src/features/assistant/data/AssistantInterface.ts +2 -0
  53. package/src/features/assistant/data/AssistantService.ts +38 -0
  54. package/src/features/assistant/data/__tests__/Assistant.spec.ts +30 -0
  55. package/src/features/assistant-message/AssistantMessageModule.ts +2 -0
  56. package/src/features/assistant-message/components/MessageItem.tsx +26 -4
  57. package/src/features/assistant-message/components/MessageList.tsx +4 -2
  58. package/src/features/assistant-message/data/AssistantMessage.ts +21 -1
  59. package/src/features/assistant-message/data/AssistantMessageInterface.ts +16 -0
  60. package/src/shadcnui/index.ts +3 -0
  61. package/src/shadcnui/ui/__tests__/confirm-dialog.test.tsx +46 -0
  62. package/src/shadcnui/ui/__tests__/empty-state.test.tsx +26 -0
  63. package/src/shadcnui/ui/__tests__/spinner.test.tsx +18 -0
  64. package/src/shadcnui/ui/confirm-dialog.tsx +79 -0
  65. package/src/shadcnui/ui/empty-state.tsx +32 -0
  66. package/src/shadcnui/ui/spinner.tsx +36 -0
  67. package/dist/chunk-DRJUN4R6.js.map +0 -1
  68. package/dist/chunk-LYLGU2BK.mjs.map +0 -1
  69. package/dist/chunk-U2HR57MY.js.map +0 -1
  70. /package/dist/{BlockNoteEditor-A5LNFWHW.mjs.map → BlockNoteEditor-HIEAHXR4.mjs.map} +0 -0
  71. /package/dist/{chunk-CWVYU4YZ.mjs.map → chunk-DJSH6VHF.mjs.map} +0 -0
@@ -0,0 +1,79 @@
1
+ "use client";
2
+
3
+ import * as React from "react";
4
+
5
+ import {
6
+ AlertDialog,
7
+ AlertDialogCancel,
8
+ AlertDialogContent,
9
+ AlertDialogDescription,
10
+ AlertDialogFooter,
11
+ AlertDialogHeader,
12
+ AlertDialogTitle,
13
+ } from "@/components/ui/alert-dialog";
14
+ import { Button } from "@/components/ui/button";
15
+
16
+ type ConfirmDialogProps = {
17
+ open: boolean;
18
+ onOpenChange: (open: boolean) => void;
19
+ title: string;
20
+ description?: React.ReactNode;
21
+ confirmLabel: string;
22
+ cancelLabel: string;
23
+ destructive?: boolean;
24
+ onConfirm: () => void | Promise<void>;
25
+ };
26
+
27
+ /**
28
+ * Convenience confirmation dialog. Controlled-only and trigger-less by design:
29
+ * callers render their own trigger Button and own the open state, which avoids
30
+ * every trigger-composition pitfall (no asChild, no nested <button>).
31
+ */
32
+ function ConfirmDialog({
33
+ open,
34
+ onOpenChange,
35
+ title,
36
+ description,
37
+ confirmLabel,
38
+ cancelLabel,
39
+ destructive = false,
40
+ onConfirm,
41
+ }: ConfirmDialogProps) {
42
+ const [pending, setPending] = React.useState(false);
43
+
44
+ const handleConfirm = async () => {
45
+ try {
46
+ setPending(true);
47
+ await onConfirm();
48
+ onOpenChange(false);
49
+ } catch {
50
+ // A rejecting onConfirm keeps the dialog open; the caller owns user-facing
51
+ // error feedback inside onConfirm.
52
+ } finally {
53
+ setPending(false);
54
+ }
55
+ };
56
+
57
+ return (
58
+ <AlertDialog open={open} onOpenChange={(next) => !pending && onOpenChange(next)}>
59
+ <AlertDialogContent>
60
+ <AlertDialogHeader>
61
+ <AlertDialogTitle>{title}</AlertDialogTitle>
62
+ {description && <AlertDialogDescription>{description}</AlertDialogDescription>}
63
+ </AlertDialogHeader>
64
+ <AlertDialogFooter>
65
+ <AlertDialogCancel disabled={pending}>{cancelLabel}</AlertDialogCancel>
66
+ <Button
67
+ variant={destructive ? "destructive" : "default"}
68
+ onClick={() => void handleConfirm()}
69
+ disabled={pending}
70
+ >
71
+ {confirmLabel}
72
+ </Button>
73
+ </AlertDialogFooter>
74
+ </AlertDialogContent>
75
+ </AlertDialog>
76
+ );
77
+ }
78
+
79
+ export { ConfirmDialog, type ConfirmDialogProps };
@@ -0,0 +1,32 @@
1
+ import type { LucideIcon } from "lucide-react";
2
+ import * as React from "react";
3
+
4
+ import { cn } from "@/lib/utils";
5
+
6
+ type EmptyStateProps = React.ComponentProps<"div"> & {
7
+ icon?: LucideIcon;
8
+ title: string;
9
+ description?: string;
10
+ action?: React.ReactNode;
11
+ };
12
+
13
+ function EmptyState({ icon: Icon, title, description, action, className, ...props }: EmptyStateProps) {
14
+ return (
15
+ <div
16
+ data-slot="empty-state"
17
+ className={cn("flex flex-col items-center justify-center gap-1.5 rounded-md p-6 text-center", className)}
18
+ {...props}
19
+ >
20
+ {Icon && (
21
+ <div className="bg-muted text-muted-foreground mb-1 inline-flex size-8 items-center justify-center rounded-md">
22
+ <Icon className="size-4" />
23
+ </div>
24
+ )}
25
+ <div className="text-sm font-medium">{title}</div>
26
+ {description && <div className="text-muted-foreground text-xs/relaxed">{description}</div>}
27
+ {action && <div className="mt-2">{action}</div>}
28
+ </div>
29
+ );
30
+ }
31
+
32
+ export { EmptyState };
@@ -0,0 +1,36 @@
1
+ import { cva, type VariantProps } from "class-variance-authority";
2
+ import { Loader2Icon } from "lucide-react";
3
+ import * as React from "react";
4
+
5
+ import { cn } from "@/lib/utils";
6
+
7
+ const spinnerVariants = cva("animate-spin", {
8
+ variants: {
9
+ size: {
10
+ sm: "size-3.5",
11
+ default: "size-4",
12
+ lg: "size-8",
13
+ },
14
+ },
15
+ defaultVariants: {
16
+ size: "default",
17
+ },
18
+ });
19
+
20
+ function Spinner({
21
+ className,
22
+ size,
23
+ ...props
24
+ }: React.ComponentProps<typeof Loader2Icon> & VariantProps<typeof spinnerVariants>) {
25
+ return (
26
+ <Loader2Icon
27
+ data-slot="spinner"
28
+ role="status"
29
+ aria-label="Loading"
30
+ className={cn(spinnerVariants({ size, className }))}
31
+ {...props}
32
+ />
33
+ );
34
+ }
35
+
36
+ export { Spinner, spinnerVariants };