@nivaro/react 0.3.126 → 0.3.128

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 (40) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +20 -2
  4. package/dist/index.js +150 -147
  5. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  6. package/dist/shared/components/DataTable.js +406 -401
  7. package/dist/shared/components/ItemEditForm.js +4359 -4299
  8. package/dist/shared/components/MatrixEditor.js +548 -490
  9. package/dist/shared/components/MyWorkView.js +284 -274
  10. package/dist/shared/components/NotificationBell.js +264 -218
  11. package/dist/shared/components/RecordGridEditor.js +582 -472
  12. package/dist/shared/components/chat/chat-core.js +331 -346
  13. package/dist/shared/components/chat/chat-typing.js +25 -0
  14. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  15. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  16. package/dist/shared/components/command-center/api.js +17 -9
  17. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  18. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  19. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  20. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  22. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  23. package/dist/shared/components/item-edit/RowComments.js +33 -30
  24. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  25. package/dist/shared/components/item-edit/live-related.js +29 -16
  26. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  27. package/dist/shared/components/item-edit/reimport-m2m.js +17 -0
  28. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  29. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  30. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  31. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  32. package/dist/shared/components/record-grid-guard.js +85 -0
  33. package/dist/shared/components/support/TicketDetailSheet.js +168 -151
  34. package/dist/shared/lib/at-risk-fields.js +14 -0
  35. package/dist/shared/lib/live-queries.js +9 -8
  36. package/dist/shared/lib/live-screen.js +77 -76
  37. package/dist/shared/lib/presence-hooks.js +190 -127
  38. package/dist/shared/lib/user-sync.js +78 -65
  39. package/dist/shared/lib/waiting-count.js +40 -29
  40. package/package.json +1 -1
@@ -1,166 +1,181 @@
1
- import { jsx as a, jsxs as r, Fragment as f } from "react/jsx-runtime";
2
- import { useQueryClient as M, useQuery as q, useMutation as y } from "@tanstack/react-query";
3
- import { Loader2 as J, PlayCircle as V, Paperclip as X } from "lucide-react";
4
- import { useState as b } from "react";
5
- import { useNivaroClient as Y, useApiFetchConfig as Z, useItemNavigation as I, useNavigation as ee } from "../../context.js";
6
- import { get as T, post as C, patch as te } from "../../lib/commands.js";
7
- import { useLiveFade as ae } from "../../lib/live-screen.js";
8
- import { useBackgroundArm as re } from "../../lib/live-views.js";
9
- import { useTopicPresence as se, signalSentence as $ } from "../../lib/presence-signals.js";
10
- import { replayHref as ne } from "../../lib/replay-capture.js";
11
- import { foldShareHistory as le, historyLine as ie } from "../../lib/screen-share.js";
12
- import { TaskDoButton as oe } from "../ai/TaskDo.js";
13
- import { RelationCombobox as de } from "../item-edit/RelationCombobox.js";
14
- import { SimpleSelect as R } from "../ui/SimpleSelect.js";
15
- import { Sheet as ce, SheetContent as ue, SheetTitle as F, SheetDescription as K, SheetHeader as pe } from "../ui/sheet.js";
16
- import { ScreenSharePanel as me } from "./ScreenShare.js";
17
- import { isSupportContextFile as v } from "./support-context.js";
18
- import { TicketSlowScreens as xe } from "./TicketSlowScreens.js";
19
- import { TicketTraffic as he } from "./TicketTraffic.js";
20
- import { STATUS_TONE as A } from "./types.js";
21
- const L = [
1
+ import { jsx as a, jsxs as n, Fragment as y } from "react/jsx-runtime";
2
+ import { useQueryClient as V, useQuery as C, useMutation as b } from "@tanstack/react-query";
3
+ import { Loader2 as X, PlayCircle as Y, Paperclip as Z } from "lucide-react";
4
+ import { useState as v, useEffect as I } from "react";
5
+ import { useNivaroClient as ee, useApiFetchConfig as te, useItemNavigation as ae, useNavigation as re } from "../../context.js";
6
+ import { get as R, post as $, patch as ne } from "../../lib/commands.js";
7
+ import { useLiveFade as se } from "../../lib/live-screen.js";
8
+ import { useBackgroundArm as le } from "../../lib/live-views.js";
9
+ import { useTopicPresence as ie, signalSentence as F } from "../../lib/presence-signals.js";
10
+ import { replayHref as oe } from "../../lib/replay-capture.js";
11
+ import { foldShareHistory as de, historyLine as ce } from "../../lib/screen-share.js";
12
+ import { TaskDoButton as ue } from "../ai/TaskDo.js";
13
+ import { RelationCombobox as pe } from "../item-edit/RelationCombobox.js";
14
+ import { SimpleSelect as K } from "../ui/SimpleSelect.js";
15
+ import { Sheet as me, SheetContent as xe, SheetTitle as A, SheetDescription as P, SheetHeader as he } from "../ui/sheet.js";
16
+ import { ScreenSharePanel as ge } from "./ScreenShare.js";
17
+ import { isSupportContextFile as k } from "./support-context.js";
18
+ import { TicketSlowScreens as fe } from "./TicketSlowScreens.js";
19
+ import { TicketTraffic as ye } from "./TicketTraffic.js";
20
+ import { STATUS_TONE as D } from "./types.js";
21
+ const O = [
22
22
  { value: "open", label: "Open" },
23
23
  { value: "in_progress", label: "In progress" },
24
24
  { value: "done", label: "Done" },
25
25
  { value: "cancelled", label: "Cancelled" }
26
26
  ];
27
- function k(s) {
28
- return s ? new Date(s).toLocaleString(void 0, {
27
+ function N(r) {
28
+ return r ? new Date(r).toLocaleString(void 0, {
29
29
  month: "short",
30
30
  day: "numeric",
31
31
  hour: "numeric",
32
32
  minute: "2-digit"
33
33
  }) : "";
34
34
  }
35
- const P = "mt-1 h-9 w-full min-w-0 gap-2 rounded-md border-slate-200 bg-white px-3 text-[13px] font-normal text-slate-900 dark:border-border dark:bg-card dark:text-slate-100 [&>span]:min-w-0 [&>span]:flex-1 [&>span]:truncate [&>span]:text-left [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0", ge = "mt-1 font-normal [&>div>button]:h-9 [&>div>button]:border-slate-200 [&>div>button]:bg-white [&>div>button]:text-[13px] [&>div>button]:text-slate-900 dark:[&>div>button]:border-border dark:[&>div>button]:bg-card dark:[&>div>button]:text-slate-100";
36
- function fe({ status: s, label: c }) {
35
+ const L = "mt-1 h-9 w-full min-w-0 gap-2 rounded-md border-slate-200 bg-white px-3 text-[13px] font-normal text-slate-900 dark:border-border dark:bg-card dark:text-slate-100 [&>span]:min-w-0 [&>span]:flex-1 [&>span]:truncate [&>span]:text-left [&>svg]:h-4 [&>svg]:w-4 [&>svg]:shrink-0", be = "mt-1 font-normal [&>div>button]:h-9 [&>div>button]:border-slate-200 [&>div>button]:bg-white [&>div>button]:text-[13px] [&>div>button]:text-slate-900 dark:[&>div>button]:border-border dark:[&>div>button]:bg-card dark:[&>div>button]:text-slate-100";
36
+ function ve({ status: r, label: o }) {
37
37
  var l;
38
38
  return /* @__PURE__ */ a(
39
39
  "span",
40
40
  {
41
- "data-ticket-status": s,
42
- className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${A[s] ?? A.open}`,
43
- children: c ?? ((l = L.find((i) => i.value === s)) == null ? void 0 : l.label) ?? s
41
+ "data-ticket-status": r,
42
+ className: `inline-flex shrink-0 items-center rounded-full px-2 py-0.5 text-[11px] font-medium ${D[r] ?? D.open}`,
43
+ children: o ?? ((l = O.find((i) => i.value === r)) == null ? void 0 : l.label) ?? r
44
44
  }
45
45
  );
46
46
  }
47
- function Ue({
48
- ticketId: s,
49
- onOpenChange: c
47
+ function ke(r, o) {
48
+ return o == null ? "" : r[String(o)] ?? "";
49
+ }
50
+ function Ne(r, o, l) {
51
+ if (o == null) return r;
52
+ const i = String(o);
53
+ if (!l) {
54
+ if (!(i in r)) return r;
55
+ const p = { ...r };
56
+ return delete p[i], p;
57
+ }
58
+ return { ...r, [i]: l };
59
+ }
60
+ function We({
61
+ ticketId: r,
62
+ onOpenChange: o
50
63
  }) {
51
- const l = Y(), i = M(), { apiBase: O } = Z(), { urlFor: D, open: U } = I(), u = ee(), [p, N] = b(""), [w, Q] = b(null), [j, E] = b(!1), o = se(
52
- s != null && Number.isSafeInteger(s) && s > 0 ? `ticket:${s}` : null
53
- ), m = s != null && Number.isSafeInteger(s) && s > 0, {
64
+ const l = ee(), i = V(), { apiBase: p } = te(), { urlFor: U, open: Q } = ae(), m = re(), [j, E] = v({}), x = ke(j, r), w = (t, s = r) => E((u) => Ne(u, s, t)), [S, _] = v(null);
65
+ I(() => _(null), [r]);
66
+ const [H, W] = v(!1), d = ie(
67
+ r != null && Number.isSafeInteger(r) && r > 0 ? `ticket:${r}` : null
68
+ ), h = r != null && Number.isSafeInteger(r) && r > 0, {
54
69
  data: e,
55
- isLoading: H,
56
- isError: W,
57
- dataUpdatedAt: B
58
- } = q({
59
- queryKey: ["support-ticket", s],
60
- queryFn: () => l.request(T(`/support/tickets/${s}`)).then((t) => t.data),
61
- enabled: m,
62
- retry: (t, n) => {
63
- const g = n == null ? void 0 : n.status;
64
- return g !== 404 && g !== 403 && g !== 400 && t < 2;
70
+ isLoading: B,
71
+ isError: z,
72
+ dataUpdatedAt: G
73
+ } = C({
74
+ queryKey: ["support-ticket", r],
75
+ queryFn: () => l.request(R(`/support/tickets/${r}`)).then((t) => t.data),
76
+ enabled: h,
77
+ retry: (t, s) => {
78
+ const u = s == null ? void 0 : s.status;
79
+ return u !== 404 && u !== 403 && u !== 400 && t < 2;
65
80
  }
66
- }), z = ae(re(B, String(s))), { data: G = [] } = q({
81
+ }), M = se(le(G, String(r))), { data: J = [] } = C({
67
82
  queryKey: ["support-categories", "all-for", (e == null ? void 0 : e.collection) ?? null],
68
83
  queryFn: () => l.request(
69
- T("/support/categories", e != null && e.collection ? { collection: e.collection } : void 0)
84
+ R("/support/categories", e != null && e.collection ? { collection: e.collection } : void 0)
70
85
  ).then((t) => t.data ?? []),
71
86
  enabled: !!(e != null && e.can.work)
72
- }), x = () => {
73
- i.invalidateQueries({ queryKey: ["support-ticket", s] }), i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), i.invalidateQueries({ queryKey: ["my-work"] });
74
- }, h = (t) => Q(t.message || "That did not work"), S = y({
75
- mutationFn: () => l.request(C(`/support/tickets/${s}/claim`)),
76
- onSuccess: x,
77
- onError: h
78
- }), d = y({
79
- mutationFn: (t) => l.request(te(`/support/tickets/${s}`, t)),
80
- onSuccess: x,
81
- onError: h
82
- }), _ = y({
83
- mutationFn: () => l.request(C(`/support/tickets/${s}/comments`, { text: p.trim() })),
84
- onSuccess: () => {
85
- N(""), o.signalReplying(!1), x();
87
+ }), g = () => {
88
+ i.invalidateQueries({ queryKey: ["support-ticket", r] }), i.invalidateQueries({ queryKey: ["support-tickets"] }), i.invalidateQueries({ queryKey: ["support-summary"] }), i.invalidateQueries({ queryKey: ["my-work"] });
89
+ }, f = (t) => _(t.message || "That did not work"), q = b({
90
+ mutationFn: () => l.request($(`/support/tickets/${r}/claim`)),
91
+ onSuccess: g,
92
+ onError: f
93
+ }), c = b({
94
+ mutationFn: (t) => l.request(ne(`/support/tickets/${r}`, t)),
95
+ onSuccess: g,
96
+ onError: f
97
+ }), T = b({
98
+ mutationFn: (t) => l.request($(`/support/tickets/${t.id}/comments`, { text: t.text })),
99
+ onSuccess: (t, s) => {
100
+ w("", s.id), d.signalReplying(!1), g();
86
101
  },
87
- onError: h
102
+ onError: f
88
103
  });
89
- return /* @__PURE__ */ a(ce, { open: s != null, onOpenChange: c, children: /* @__PURE__ */ a(
90
- ue,
104
+ return /* @__PURE__ */ a(me, { open: r != null, onOpenChange: o, children: /* @__PURE__ */ a(
105
+ xe,
91
106
  {
92
107
  side: "right",
93
- ref: z,
94
- className: `flex max-w-[96vw] flex-col gap-0 p-0 outline-none focus:outline-none transition-[width] duration-300 ease-out dark:bg-card ${j ? "w-[min(1280px,96vw)] sm:max-w-[min(1280px,96vw)]" : "w-[560px] sm:max-w-[560px]"}`,
95
- "data-support-ticket": s ?? "",
108
+ ref: M,
109
+ className: `flex max-w-[96vw] flex-col gap-0 p-0 outline-none focus:outline-none transition-[width] duration-300 ease-out dark:bg-card ${H ? "w-[min(1280px,96vw)] sm:max-w-[min(1280px,96vw)]" : "w-[560px] sm:max-w-[560px]"}`,
110
+ "data-support-ticket": r ?? "",
96
111
  onOpenAutoFocus: (t) => {
97
- var n;
98
- t.preventDefault(), (n = t.currentTarget) == null || n.focus({ preventScroll: !0 });
112
+ var s;
113
+ t.preventDefault(), (s = t.currentTarget) == null || s.focus({ preventScroll: !0 });
99
114
  },
100
- children: !m || W ? /* @__PURE__ */ r("div", { className: "flex flex-1 flex-col items-center justify-center gap-1 px-6 text-center", children: [
101
- /* @__PURE__ */ a(F, { className: "text-[14px] font-semibold text-slate-800 dark:text-slate-100", children: "Request not found" }),
102
- /* @__PURE__ */ a(K, { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: m ? `Request #${s} does not exist, or it is not one you can open.` : "This link does not point to a request." })
103
- ] }) : H || !e ? /* @__PURE__ */ a("div", { className: "flex flex-1 items-center justify-center text-slate-400", children: /* @__PURE__ */ a(J, { className: "h-5 w-5 animate-spin" }) }) : /* @__PURE__ */ r(f, { children: [
104
- /* @__PURE__ */ r(pe, { className: "space-y-1.5 border-b border-slate-200 px-5 py-4 text-left dark:border-border", children: [
105
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2 pr-6", children: [
106
- /* @__PURE__ */ r("span", { className: "font-mono text-[11.5px] text-slate-400", children: [
115
+ children: !h || z ? /* @__PURE__ */ n("div", { className: "flex flex-1 flex-col items-center justify-center gap-1 px-6 text-center", children: [
116
+ /* @__PURE__ */ a(A, { className: "text-[14px] font-semibold text-slate-800 dark:text-slate-100", children: "Request not found" }),
117
+ /* @__PURE__ */ a(P, { className: "text-[12.5px] text-slate-500 dark:text-muted-foreground", children: h ? `Request #${r} does not exist, or it is not one you can open.` : "This link does not point to a request." })
118
+ ] }) : B || !e ? /* @__PURE__ */ a("div", { className: "flex flex-1 items-center justify-center text-slate-400", children: /* @__PURE__ */ a(X, { className: "h-5 w-5 animate-spin" }) }) : /* @__PURE__ */ n(y, { children: [
119
+ /* @__PURE__ */ n(he, { className: "space-y-1.5 border-b border-slate-200 px-5 py-4 text-left dark:border-border", children: [
120
+ /* @__PURE__ */ n("div", { className: "flex items-center gap-2 pr-6", children: [
121
+ /* @__PURE__ */ n("span", { className: "font-mono text-[11.5px] text-slate-400", children: [
107
122
  "#",
108
123
  e.id
109
124
  ] }),
110
- /* @__PURE__ */ a(fe, { status: e.status, label: e.status_label }),
125
+ /* @__PURE__ */ a(ve, { status: e.status, label: e.status_label }),
111
126
  e.priority === "urgent" && /* @__PURE__ */ a("span", { className: "rounded-full bg-red-500/10 px-2 py-0.5 text-[11px] font-medium text-red-600 dark:text-red-400", children: "Urgent" })
112
127
  ] }),
113
- /* @__PURE__ */ a(F, { className: "text-left text-[16px] font-semibold leading-snug text-slate-900 dark:text-slate-100", children: e.title }),
114
- /* @__PURE__ */ r(K, { className: "text-left text-[12px] text-slate-500 dark:text-muted-foreground", children: [
128
+ /* @__PURE__ */ a(A, { className: "text-left text-[16px] font-semibold leading-snug text-slate-900 dark:text-slate-100", children: e.title }),
129
+ /* @__PURE__ */ n(P, { className: "text-left text-[12px] text-slate-500 dark:text-muted-foreground", children: [
115
130
  e.requester_name ?? "Someone",
116
131
  " · ",
117
- k(e.created_at),
132
+ N(e.created_at),
118
133
  e.category_name ? ` · ${e.category_name}` : ""
119
134
  ] }),
120
135
  /* @__PURE__ */ a("div", { className: "text-left text-[12px]", children: e.collection && e.item ? /* @__PURE__ */ a(
121
136
  "a",
122
137
  {
123
- href: D({ collection: e.collection, itemId: e.item }),
138
+ href: U({ collection: e.collection, itemId: e.item }),
124
139
  onClick: (t) => {
125
- t.metaKey || t.ctrlKey || t.shiftKey || t.button !== 0 || (t.preventDefault(), U({ collection: e.collection, itemId: e.item }));
140
+ t.metaKey || t.ctrlKey || t.shiftKey || t.button !== 0 || (t.preventDefault(), Q({ collection: e.collection, itemId: e.item }));
126
141
  },
127
142
  "data-ticket-record": !0,
128
143
  className: "inline-flex items-center gap-1 rounded-md bg-slate-100 px-2 py-0.5 font-medium text-[#00789a] hover:bg-slate-200/70 dark:bg-white/[0.06] dark:text-nvr-cyan dark:hover:bg-white/10",
129
144
  children: e.record_label ?? e.item
130
145
  }
131
146
  ) : /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: "General Support" }) }),
132
- o.viewers.length > 0 && /* @__PURE__ */ r(
147
+ d.viewers.length > 0 && /* @__PURE__ */ n(
133
148
  "p",
134
149
  {
135
150
  className: "mt-1 flex items-center gap-1.5 text-[11.5px] text-sky-700 dark:text-sky-300",
136
151
  "data-ticket-viewing": !0,
137
152
  children: [
138
153
  /* @__PURE__ */ a("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-sky-400" }),
139
- $(
140
- o.viewers.map((t) => t.name),
154
+ F(
155
+ d.viewers.map((t) => t.name),
141
156
  "looking at this"
142
157
  )
143
158
  ]
144
159
  }
145
160
  )
146
161
  ] }),
147
- /* @__PURE__ */ r("div", { "data-sheet-body": !0, className: "flex-1 space-y-6 overflow-y-auto px-5 py-5", children: [
148
- e.can.work && /* @__PURE__ */ r(
162
+ /* @__PURE__ */ n("div", { "data-sheet-body": !0, className: "flex-1 space-y-6 overflow-y-auto px-5 py-5", children: [
163
+ e.can.work && /* @__PURE__ */ n(
149
164
  "div",
150
165
  {
151
166
  "data-ticket-controls": !0,
152
167
  className: "grid grid-cols-2 gap-x-3 gap-y-3.5 rounded-lg border border-slate-200/80 bg-slate-50/70 p-4 dark:border-border dark:bg-white/[0.04]",
153
168
  children: [
154
- /* @__PURE__ */ r("div", { className: "col-span-2 flex items-center gap-2", children: [
155
- /* @__PURE__ */ a("span", { className: "mr-auto text-[12.5px] text-slate-600 dark:text-slate-300", children: e.assignee_name ? /* @__PURE__ */ r(f, { children: [
169
+ /* @__PURE__ */ n("div", { className: "col-span-2 flex items-center gap-2", children: [
170
+ /* @__PURE__ */ a("span", { className: "mr-auto text-[12.5px] text-slate-600 dark:text-slate-300", children: e.assignee_name ? /* @__PURE__ */ n(y, { children: [
156
171
  "Assigned to ",
157
172
  /* @__PURE__ */ a("b", { className: "font-medium", children: e.assignee_name })
158
- ] }) : /* @__PURE__ */ r(f, { children: [
173
+ ] }) : /* @__PURE__ */ n(y, { children: [
159
174
  "Not picked up yet",
160
175
  e.team_name ? ` · ${e.team_name}` : " · Administrators"
161
176
  ] }) }),
162
177
  /* @__PURE__ */ a(
163
- oe,
178
+ ue,
164
179
  {
165
180
  task: {
166
181
  id: e.id,
@@ -170,7 +185,7 @@ function Ue({
170
185
  category_id: e.category_id,
171
186
  title: e.title
172
187
  },
173
- onTaskChanged: () => void i.invalidateQueries({ queryKey: ["support-ticket", s] })
188
+ onTaskChanged: () => void i.invalidateQueries({ queryKey: ["support-ticket", r] })
174
189
  }
175
190
  ),
176
191
  (e.status === "open" || e.status === "in_progress") && /* @__PURE__ */ a(
@@ -178,50 +193,50 @@ function Ue({
178
193
  {
179
194
  type: "button",
180
195
  "data-ticket-claim": !0,
181
- disabled: S.isPending,
182
- onClick: () => S.mutate(),
196
+ disabled: q.isPending,
197
+ onClick: () => q.mutate(),
183
198
  className: "h-7 rounded-md border border-nvr-cyan/60 bg-nvr-cyan/10 px-2.5 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 disabled:opacity-50 dark:text-nvr-cyan",
184
199
  children: e.assignee ? "Take it over" : "Pick it up"
185
200
  }
186
201
  )
187
202
  ] }),
188
- /* @__PURE__ */ r("div", { className: "block text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
203
+ /* @__PURE__ */ n("div", { className: "block text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
189
204
  "Status",
190
205
  /* @__PURE__ */ a(
191
- R,
206
+ K,
192
207
  {
193
208
  value: e.status,
194
- onChange: (t) => d.mutate({ status: t }),
195
- options: L,
209
+ onChange: (t) => c.mutate({ status: t }),
210
+ options: O,
196
211
  ariaLabel: "Status",
197
- className: P
212
+ className: L
198
213
  }
199
214
  )
200
215
  ] }),
201
- /* @__PURE__ */ r("div", { className: "block text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
216
+ /* @__PURE__ */ n("div", { className: "block text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
202
217
  "Type",
203
218
  /* @__PURE__ */ a(
204
- R,
219
+ K,
205
220
  {
206
221
  value: e.category_id != null ? String(e.category_id) : "",
207
- onChange: (t) => d.mutate({ category_id: t ? Number(t) : null }),
222
+ onChange: (t) => c.mutate({ category_id: t ? Number(t) : null }),
208
223
  options: [
209
224
  { value: "", label: "No type" },
210
- ...G.map((t) => ({ value: String(t.id), label: t.name }))
225
+ ...J.map((t) => ({ value: String(t.id), label: t.name }))
211
226
  ],
212
227
  ariaLabel: "Type",
213
- className: P
228
+ className: L
214
229
  }
215
230
  )
216
231
  ] }),
217
- /* @__PURE__ */ r("div", { className: "col-span-2 text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
232
+ /* @__PURE__ */ n("div", { className: "col-span-2 text-[11.5px] font-medium text-slate-500 dark:text-slate-400", children: [
218
233
  "Assignee",
219
- /* @__PURE__ */ a("div", { className: ge, children: /* @__PURE__ */ a(
220
- de,
234
+ /* @__PURE__ */ a("div", { className: be, children: /* @__PURE__ */ a(
235
+ pe,
221
236
  {
222
237
  collection: "nivaro_users",
223
238
  value: e.assignee,
224
- onChange: (t) => d.mutate({ assignee: t ? String(t) : null }),
239
+ onChange: (t) => c.mutate({ assignee: t ? String(t) : null }),
225
240
  placeholder: "Nobody yet"
226
241
  }
227
242
  ) })
@@ -229,33 +244,33 @@ function Ue({
229
244
  ]
230
245
  }
231
246
  ),
232
- (e.status === "open" || e.status === "in_progress") && /* @__PURE__ */ a(me, { ticketId: e.id, onWideChange: E }),
233
- /* @__PURE__ */ r("section", { children: [
247
+ (e.status === "open" || e.status === "in_progress") && /* @__PURE__ */ a(ge, { ticketId: e.id, onWideChange: W }),
248
+ /* @__PURE__ */ n("section", { children: [
234
249
  /* @__PURE__ */ a("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: "Request" }),
235
250
  /* @__PURE__ */ a("p", { className: "whitespace-pre-wrap text-[13px] leading-relaxed text-slate-800 dark:text-slate-200", children: e.description || /* @__PURE__ */ a("span", { className: "text-slate-400", children: "No details given." }) }),
236
251
  e.replay && e.can.work && (() => {
237
- const t = ne(e.replay), n = u.consoleUrl ? u.consoleUrl(t) : t;
238
- return n ? /* @__PURE__ */ r(
252
+ const t = oe(e.replay), s = m.consoleUrl ? m.consoleUrl(t) : t;
253
+ return s ? /* @__PURE__ */ n(
239
254
  "a",
240
255
  {
241
- href: n,
256
+ href: s,
242
257
  target: "_blank",
243
258
  rel: "noreferrer",
244
259
  "data-ticket-replay": e.replay.recording_id,
245
260
  className: "mt-2 inline-flex items-center gap-1.5 rounded-md border border-nvr-cyan/50 bg-nvr-cyan/10 px-2 py-1 text-[12px] font-medium text-nvr-navy hover:bg-nvr-cyan/15 dark:text-nvr-cyan",
246
261
  children: [
247
- /* @__PURE__ */ a(V, { className: "h-3.5 w-3.5" }),
262
+ /* @__PURE__ */ a(Y, { className: "h-3.5 w-3.5" }),
248
263
  "Replay their screen"
249
264
  ]
250
265
  }
251
266
  ) : null;
252
267
  })(),
253
268
  e.issue_id != null && e.can.work && (() => {
254
- const t = `/issues/${e.issue_id}`, n = u.consoleUrl ? u.consoleUrl(t) : t;
255
- return n ? /* @__PURE__ */ r(
269
+ const t = `/issues/${e.issue_id}`, s = m.consoleUrl ? m.consoleUrl(t) : t;
270
+ return s ? /* @__PURE__ */ n(
256
271
  "a",
257
272
  {
258
- href: n,
273
+ href: s,
259
274
  target: "_blank",
260
275
  rel: "noreferrer",
261
276
  "data-ticket-issue": e.issue_id,
@@ -268,88 +283,88 @@ function Ue({
268
283
  ) : null;
269
284
  })(),
270
285
  (() => {
271
- const t = e.files.filter((n) => e.can.work || !v(n));
272
- return t.length === 0 ? null : /* @__PURE__ */ a("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: t.map((n) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ r(
286
+ const t = e.files.filter((s) => e.can.work || !k(s));
287
+ return t.length === 0 ? null : /* @__PURE__ */ a("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: t.map((s) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ n(
273
288
  "a",
274
289
  {
275
- href: `${O}/files/${n.id}`,
290
+ href: `${p}/files/${s.id}`,
276
291
  target: "_blank",
277
292
  rel: "noreferrer",
278
- "data-tip": v(n) ? "The page they were on, browser errors and their last 20 requests when they asked" : void 0,
293
+ "data-tip": k(s) ? "The page they were on, browser errors and their last 20 requests when they asked" : void 0,
279
294
  className: "inline-flex items-center gap-1 rounded bg-slate-100 px-2 py-0.5 text-[11.5px] text-slate-700 hover:underline dark:bg-white/10 dark:text-slate-200",
280
295
  children: [
281
- /* @__PURE__ */ a(X, { className: "h-3 w-3" }),
282
- v(n) ? "Technical details" : n.title || n.filename_download || "File"
296
+ /* @__PURE__ */ a(Z, { className: "h-3 w-3" }),
297
+ k(s) ? "Technical details" : s.title || s.filename_download || "File"
283
298
  ]
284
299
  }
285
- ) }, n.id)) });
300
+ ) }, s.id)) });
286
301
  })()
287
302
  ] }),
288
- e.can.work && /* @__PURE__ */ a(he, { ticketId: e.id }),
303
+ e.can.work && /* @__PURE__ */ a(ye, { ticketId: e.id }),
289
304
  /* @__PURE__ */ a(
290
- xe,
305
+ fe,
291
306
  {
292
307
  userId: e.created_by,
293
308
  name: e.requester_name,
294
309
  text: `${e.title} ${e.description ?? ""}`
295
310
  }
296
311
  ),
297
- /* @__PURE__ */ r("section", { "data-ticket-thread": !0, children: [
312
+ /* @__PURE__ */ n("section", { "data-ticket-thread": !0, children: [
298
313
  /* @__PURE__ */ a("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: "Conversation" }),
299
- e.thread.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: "No replies yet." }) : /* @__PURE__ */ a("ul", { className: "space-y-2.5", children: e.thread.map((t) => /* @__PURE__ */ r(
314
+ e.thread.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: "No replies yet." }) : /* @__PURE__ */ a("ul", { className: "space-y-2.5", children: e.thread.map((t) => /* @__PURE__ */ n(
300
315
  "li",
301
316
  {
302
317
  className: t.from_requester ? "rounded-lg bg-slate-50 px-3 py-2 dark:bg-white/5" : "rounded-lg border border-nvr-cyan/30 bg-nvr-cyan/5 px-3 py-2",
303
318
  children: [
304
- /* @__PURE__ */ r("div", { className: "mb-0.5 flex items-baseline justify-between gap-2 text-[11.5px]", children: [
319
+ /* @__PURE__ */ n("div", { className: "mb-0.5 flex items-baseline justify-between gap-2 text-[11.5px]", children: [
305
320
  /* @__PURE__ */ a("b", { className: "font-medium text-slate-800 dark:text-slate-100", children: t.user_name ?? "Someone" }),
306
- /* @__PURE__ */ a("span", { className: "text-slate-400", children: k(t.created_at) })
321
+ /* @__PURE__ */ a("span", { className: "text-slate-400", children: N(t.created_at) })
307
322
  ] }),
308
323
  /* @__PURE__ */ a("p", { className: "whitespace-pre-wrap text-[12.5px] text-slate-700 dark:text-slate-200", children: t.text })
309
324
  ]
310
325
  },
311
326
  t.id
312
327
  )) }),
313
- e.can.reply && /* @__PURE__ */ r(
328
+ e.can.reply && /* @__PURE__ */ n(
314
329
  "form",
315
330
  {
316
331
  className: "mt-3",
317
332
  onSubmit: (t) => {
318
- t.preventDefault(), p.trim() && _.mutate();
333
+ t.preventDefault(), x.trim() && T.mutate({ id: r, text: x.trim() });
319
334
  },
320
335
  children: [
321
336
  /* @__PURE__ */ a(
322
337
  "textarea",
323
338
  {
324
339
  "data-ticket-reply": !0,
325
- value: p,
340
+ value: x,
326
341
  onChange: (t) => {
327
- N(t.target.value), o.signalReplying(!!t.target.value.trim());
342
+ w(t.target.value), d.signalReplying(!!t.target.value.trim());
328
343
  },
329
344
  rows: 3,
330
345
  placeholder: "Write a reply",
331
346
  className: "min-h-[76px] w-full resize-y rounded-md border border-slate-200 bg-white px-3 py-2 text-[12.5px] text-slate-900 outline-none placeholder:text-slate-400 focus:border-nvr-cyan focus:ring-2 focus:ring-nvr-cyan/20 dark:border-border dark:bg-background dark:text-slate-100"
332
347
  }
333
348
  ),
334
- o.replying.length > 0 && /* @__PURE__ */ r(
349
+ d.replying.length > 0 && /* @__PURE__ */ n(
335
350
  "p",
336
351
  {
337
352
  className: "mt-1 flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
338
353
  "data-ticket-replying": !0,
339
354
  children: [
340
355
  /* @__PURE__ */ a("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
341
- $(o.replying, "replying"),
356
+ F(d.replying, "replying"),
342
357
  "…"
343
358
  ]
344
359
  }
345
360
  ),
346
- /* @__PURE__ */ r("div", { className: "mt-2 flex items-center justify-end gap-2", children: [
361
+ /* @__PURE__ */ n("div", { className: "mt-2 flex items-center justify-end gap-2", children: [
347
362
  e.can.cancel && !e.can.work && /* @__PURE__ */ a(
348
363
  "button",
349
364
  {
350
365
  type: "button",
351
366
  "data-ticket-cancel": !0,
352
- onClick: () => d.mutate({ status: "cancelled" }),
367
+ onClick: () => c.mutate({ status: "cancelled" }),
353
368
  className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500 hover:text-slate-800 dark:hover:text-slate-100",
354
369
  children: "Withdraw request"
355
370
  }
@@ -359,7 +374,7 @@ function Ue({
359
374
  {
360
375
  type: "button",
361
376
  "data-ticket-reopen": !0,
362
- onClick: () => d.mutate({ status: "open" }),
377
+ onClick: () => c.mutate({ status: "open" }),
363
378
  className: "h-7 rounded-md px-2.5 text-[12px] text-slate-500 hover:text-slate-800 dark:hover:text-slate-100",
364
379
  children: "Reopen"
365
380
  }
@@ -369,7 +384,7 @@ function Ue({
369
384
  {
370
385
  type: "submit",
371
386
  "data-ticket-send": !0,
372
- disabled: !p.trim() || _.isPending,
387
+ disabled: !x.trim() || T.isPending,
373
388
  className: "h-8 rounded-md bg-nvr-cyan px-3.5 text-[12.5px] font-medium text-white transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",
374
389
  children: "Reply"
375
390
  }
@@ -378,23 +393,23 @@ function Ue({
378
393
  ]
379
394
  }
380
395
  ),
381
- w && /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-red-600 dark:text-red-400", role: "alert", children: w })
396
+ S && /* @__PURE__ */ a("p", { className: "mt-1 text-[12px] text-red-600 dark:text-red-400", role: "alert", children: S })
382
397
  ] }),
383
- /* @__PURE__ */ r("section", { "data-ticket-history": !0, children: [
398
+ /* @__PURE__ */ n("section", { "data-ticket-history": !0, children: [
384
399
  /* @__PURE__ */ a("h3", { className: "mb-2 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: "History" }),
385
- e.history.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: "No history yet." }) : /* @__PURE__ */ a("ol", { className: "space-y-2 border-l border-slate-200 pl-3.5 dark:border-border", children: le(e.history, { requester: e.created_by }).reverse().map((t) => {
386
- const n = ie(t, {
400
+ e.history.length === 0 ? /* @__PURE__ */ a("p", { className: "text-[12.5px] text-slate-500 dark:text-slate-400", children: "No history yet." }) : /* @__PURE__ */ a("ol", { className: "space-y-2 border-l border-slate-200 pl-3.5 dark:border-border", children: de(e.history, { requester: e.created_by }).reverse().map((t) => {
401
+ const s = ce(t, {
387
402
  isRequester: e.can.requester ?? !e.can.work,
388
403
  requesterName: e.requester_name
389
404
  });
390
- return /* @__PURE__ */ r("li", { className: "text-[12px] text-slate-600 dark:text-slate-300", children: [
391
- /* @__PURE__ */ a("span", { className: "text-slate-800 dark:text-slate-100", children: n.text }),
392
- /* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-slate-400", children: [
405
+ return /* @__PURE__ */ n("li", { className: "text-[12px] text-slate-600 dark:text-slate-300", children: [
406
+ /* @__PURE__ */ a("span", { className: "text-slate-800 dark:text-slate-100", children: s.text }),
407
+ /* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-slate-400", children: [
393
408
  " ",
394
- /* @__PURE__ */ r("span", { className: "whitespace-nowrap", children: [
409
+ /* @__PURE__ */ n("span", { className: "whitespace-nowrap", children: [
395
410
  "· ",
396
- n.showAuthor ? `${t.user_name ?? "System"} · ` : "",
397
- k(t.at)
411
+ s.showAuthor ? `${t.user_name ?? "System"} · ` : "",
412
+ N(t.at)
398
413
  ] })
399
414
  ] })
400
415
  ] }, t.id);
@@ -406,6 +421,8 @@ function Ue({
406
421
  ) });
407
422
  }
408
423
  export {
409
- fe as StatusPill,
410
- Ue as TicketDetailSheet
424
+ ve as StatusPill,
425
+ We as TicketDetailSheet,
426
+ ke as draftFor,
427
+ Ne as withTicketDraft
411
428
  };
@@ -0,0 +1,14 @@
1
+ const s = /^\{\{\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}\}(?:\s*([*+])\s*(-?\d+(?:\.\d+)?))?$/, n = /^[A-Za-z_][A-Za-z0-9_]*$/;
2
+ function o(i) {
3
+ const t = /* @__PURE__ */ new Set();
4
+ for (const e of i ?? [])
5
+ if (!(!e || typeof e != "object") && (typeof e.field == "string" && n.test(e.field) && t.add(e.field), typeof e.value == "string")) {
6
+ const f = s.exec(e.value.trim());
7
+ f && t.add(f[1]);
8
+ }
9
+ return [...t];
10
+ }
11
+ export {
12
+ s as AT_RISK_FIELD_REF_RE,
13
+ o as atRiskReferencedFields
14
+ };