@nivaro/react 0.3.9 → 0.3.10

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 (47) hide show
  1. package/dist/components/fields/FileField.js +20 -19
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useNivaroForm.js +129 -126
  4. package/dist/hooks/useSessionRecorder.js +1 -1
  5. package/dist/index.d.ts +69 -1
  6. package/dist/index.js +512 -501
  7. package/dist/shared/components/CollectionBrowserView.js +1000 -1001
  8. package/dist/shared/components/ConformanceView.js +36 -35
  9. package/dist/shared/components/ForceReloadBanner.js +58 -34
  10. package/dist/shared/components/ItemEditForm.js +3687 -3580
  11. package/dist/shared/components/JsonMapEditor.js +18 -17
  12. package/dist/shared/components/MatrixEditor.js +8 -7
  13. package/dist/shared/components/MyWorkView.js +32 -31
  14. package/dist/shared/components/PageRenderer.js +146 -145
  15. package/dist/shared/components/RecordGridEditor.js +76 -75
  16. package/dist/shared/components/ai/AiMemorySuggestions.js +15 -14
  17. package/dist/shared/components/ai/AskPanel.js +55 -54
  18. package/dist/shared/components/bulk/BulkActionButtons.js +30 -29
  19. package/dist/shared/components/bulk/PushBulkButtons.js +57 -56
  20. package/dist/shared/components/chat/SlashCommands.js +30 -29
  21. package/dist/shared/components/chat/chat-outbox.js +76 -75
  22. package/dist/shared/components/help-videos/recorder/useLeaveWarning.js +6 -5
  23. package/dist/shared/components/integrations/console/SignalCard.js +124 -123
  24. package/dist/shared/components/integrations/console/SnoozeMenu.js +24 -23
  25. package/dist/shared/components/item-edit/CloneDialog.js +85 -78
  26. package/dist/shared/components/item-edit/InlineTableField.js +301 -300
  27. package/dist/shared/components/item-edit/MembershipSetField.js +24 -23
  28. package/dist/shared/components/item-edit/QuickCreateButton.js +8 -7
  29. package/dist/shared/components/item-edit/RecordLiveSync.js +101 -100
  30. package/dist/shared/components/item-edit/staged-links.js +86 -0
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +275 -274
  32. package/dist/shared/components/layout-editor/editors/cascade-rule-row.js +18 -17
  33. package/dist/shared/components/layout-editor/inspector/HelpTab.js +37 -36
  34. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +50 -49
  35. package/dist/shared/components/profile/AiMemoryCard.js +15 -14
  36. package/dist/shared/components/profile/PersonAdminTools.js +70 -67
  37. package/dist/shared/components/queue/QueueItemSheet.js +36 -35
  38. package/dist/shared/components/queue/QueueWorklist.js +597 -598
  39. package/dist/shared/lib/client-version.js +63 -0
  40. package/dist/shared/lib/force-reload.js +36 -0
  41. package/dist/shared/lib/load-error.js +11 -10
  42. package/dist/shared/lib/presence-live.js +54 -35
  43. package/dist/shared/lib/record-outbox.js +76 -75
  44. package/dist/shared/lib/safe-error.js +39 -0
  45. package/dist/shared/lib/server-clock.js +11 -7
  46. package/dist/shared/lib/unsaved-work.js +62 -0
  47. package/package.json +1 -1
@@ -1,28 +1,31 @@
1
1
  import { jsxs as o, jsx as e, Fragment as E } from "react/jsx-runtime";
2
- import { useMutation as f, useQuery as M } from "@tanstack/react-query";
2
+ import { useMutation as v, useQuery as M } from "@tanstack/react-query";
3
3
  import { RefreshCw as P, GitMerge as U, UserMinus as B } from "lucide-react";
4
4
  import { useState as m } from "react";
5
- import { toast as g } from "sonner";
6
- import { useNivaroClient as y } from "../../context.js";
7
- import { post as v, get as $ } from "../../lib/commands.js";
5
+ import { toast as x } from "sonner";
6
+ import { useNivaroClient as k } from "../../context.js";
7
+ import { post as w, get as $ } from "../../lib/commands.js";
8
8
  import { cn as I } from "../../lib/utils.js";
9
9
  import { SectionCard as C, EmptyLine as S } from "./primitives.js";
10
- import { errorText as w, useInvalidatePerson as j } from "./types.js";
10
+ import { errorText as y, useInvalidatePerson as j } from "./types.js";
11
11
  function te({ profile: d }) {
12
- const u = y(), [p, t] = m("15"), [h, i] = m(""), l = f({
12
+ const u = k(), [h, t] = m("15"), [p, i] = m(""), l = v({
13
13
  mutationFn: () => u.request(
14
- v("/realtime/force-refresh", {
14
+ w("/realtime/force-refresh", {
15
15
  user_ids: [d.id],
16
- seconds: Number(p) || 15,
17
- message: h
16
+ seconds: Number(h) || 15,
17
+ message: p
18
18
  })
19
- ).then((n) => n.data),
19
+ ).then((a) => a.data),
20
20
  // The reload rides the person's room on every server; only the tab count can fall short.
21
21
  // A server without `nodes` counts only the tabs on the server that took this request.
22
- onSuccess: ({ sockets: n, nodes: s, partial: c }) => g.success(
23
- n > 0 ? `Reload pushed to ${n} open tab${n === 1 ? "" : "s"}${c ? " (another server did not answer — there may be more)" : ""}` : c ? "Reload sent — another server did not answer, so their open tabs could not be counted" : s != null ? "Reload sent — they have no tab open right now" : "Reload sent to every tab they have open (tabs on other servers are not counted)"
24
- ),
25
- onError: (n) => g.error(w(n, "Failed to push the reload"))
22
+ onSuccess: ({ sockets: a, nodes: s, partial: c, remembered: b, remember_hours: r }) => {
23
+ const f = b ? ` Tabs that connect in the next ${r ?? 24} h reload too.` : "";
24
+ x.success(
25
+ (a > 0 ? `Reload pushed to ${a} open tab${a === 1 ? "" : "s"}${c ? " (another server did not answer — there may be more)" : ""}.` : c ? "Reload sent — another server did not answer, so their open tabs could not be counted." : s != null ? "Reload sent — they have no tab open right now." : "Reload sent to every tab they have open (tabs on other servers are not counted).") + f
26
+ );
27
+ },
28
+ onError: (a) => x.error(y(a, "Failed to push the reload"))
26
29
  });
27
30
  return /* @__PURE__ */ o(
28
31
  C,
@@ -39,8 +42,8 @@ function te({ profile: d }) {
39
42
  /* @__PURE__ */ e(
40
43
  "input",
41
44
  {
42
- value: p,
43
- onChange: (n) => t(n.target.value),
45
+ value: h,
46
+ onChange: (a) => t(a.target.value),
44
47
  inputMode: "numeric",
45
48
  className: "h-7 w-14 rounded-md border border-slate-200 bg-white px-2 text-right text-[12px] dark:border-border dark:bg-background"
46
49
  }
@@ -50,8 +53,8 @@ function te({ profile: d }) {
50
53
  /* @__PURE__ */ e(
51
54
  "input",
52
55
  {
53
- value: h,
54
- onChange: (n) => i(n.target.value),
56
+ value: p,
57
+ onChange: (a) => i(a.target.value),
55
58
  placeholder: "Optional message in their banner",
56
59
  className: "h-7 min-w-[200px] flex-1 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] dark:border-border dark:bg-background"
57
60
  }
@@ -78,12 +81,12 @@ function te({ profile: d }) {
78
81
  function D({
79
82
  excludeId: d,
80
83
  value: u,
81
- label: p,
84
+ label: h,
82
85
  onPick: t
83
86
  }) {
84
- const h = y(), [i, l] = m(""), { data: n = [] } = M({
87
+ const p = k(), [i, l] = m(""), { data: a = [] } = M({
85
88
  queryKey: ["nvr-offboard-user-search", i],
86
- queryFn: () => h.request($("/users", { search: i, limit: 8 })).then((s) => s.data),
89
+ queryFn: () => p.request($("/users", { search: i, limit: 8 })).then((s) => s.data),
87
90
  enabled: i.length > 1
88
91
  });
89
92
  return u ? /* @__PURE__ */ o("span", { className: "inline-flex items-center gap-1.5 rounded-full bg-nvr-cyan/10 px-2.5 py-1 text-[12px] font-medium text-nvr-navy dark:text-nvr-cyan", children: [
@@ -104,11 +107,11 @@ function D({
104
107
  {
105
108
  value: i,
106
109
  onChange: (s) => l(s.target.value),
107
- placeholder: p,
110
+ placeholder: h,
108
111
  className: "h-8 w-[260px] rounded-md border border-slate-200 bg-white px-2.5 text-[12.5px] dark:border-border dark:bg-background"
109
112
  }
110
113
  ),
111
- i.length > 1 && n.length > 0 && /* @__PURE__ */ e("div", { className: "absolute z-10 mt-1 w-[260px] rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card", children: n.filter((s) => s.id.toUpperCase() !== d.toUpperCase()).map((s) => {
114
+ i.length > 1 && a.length > 0 && /* @__PURE__ */ e("div", { className: "absolute z-10 mt-1 w-[260px] rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-card", children: a.filter((s) => s.id.toUpperCase() !== d.toUpperCase()).map((s) => {
112
115
  const c = `${s.first_name ?? ""} ${s.last_name ?? ""}`.trim() || s.email;
113
116
  return /* @__PURE__ */ o(
114
117
  "button",
@@ -148,18 +151,18 @@ const q = {
148
151
  field_watches: "notification_subscriptions"
149
152
  };
150
153
  function re({ profile: d }) {
151
- const u = y(), p = j(d.id), [t, h] = m(null), [i, l] = m({}), [n, s] = m(!0), [c, x] = m(null), { data: a, refetch: k } = M({
154
+ const u = k(), h = j(d.id), [t, p] = m(null), [i, l] = m({}), [a, s] = m(!0), [c, b] = m(null), { data: r, refetch: f } = M({
152
155
  queryKey: ["nvr-offboarding", d.id],
153
- queryFn: () => u.request($(`/offboarding/${d.id}`)).then((r) => r.data)
154
- }), N = f({
156
+ queryFn: () => u.request($(`/offboarding/${d.id}`)).then((n) => n.data)
157
+ }), N = v({
155
158
  mutationFn: () => u.request(
156
- v(`/offboarding/${d.id}/run`, { successor: t == null ? void 0 : t.id, include: i, suspend: n })
157
- ).then((r) => r.data),
158
- onSuccess: (r) => {
159
- x(r), g.success("Offboarding complete"), k(), p();
159
+ w(`/offboarding/${d.id}/run`, { successor: t == null ? void 0 : t.id, include: i, suspend: a })
160
+ ).then((n) => n.data),
161
+ onSuccess: (n) => {
162
+ b(n), x.success("Offboarding complete"), f(), h();
160
163
  },
161
- onError: (r) => g.error(w(r, "Offboarding failed"))
162
- }), L = Object.values((a == null ? void 0 : a.holdings) ?? {}).reduce((r, b) => r + b, 0), [O, A] = m("");
164
+ onError: (n) => x.error(y(n, "Offboarding failed"))
165
+ }), L = Object.values((r == null ? void 0 : r.holdings) ?? {}).reduce((n, g) => n + g, 0), [O, T] = m("");
163
166
  return /* @__PURE__ */ e(
164
167
  C,
165
168
  {
@@ -168,14 +171,14 @@ function re({ profile: d }) {
168
171
  hint: "Hand everything they hold to a successor in one pass",
169
172
  tone: "danger",
170
173
  testId: "offboarding",
171
- children: a ? /* @__PURE__ */ o("div", { className: "space-y-3", children: [
172
- /* @__PURE__ */ e("div", { className: "grid gap-x-6 gap-y-1 sm:grid-cols-2", children: Object.entries(a.holdings).map(([r, b]) => {
173
- const _ = H[r], F = I(
174
+ children: r ? /* @__PURE__ */ o("div", { className: "space-y-3", children: [
175
+ /* @__PURE__ */ e("div", { className: "grid gap-x-6 gap-y-1 sm:grid-cols-2", children: Object.entries(r.holdings).map(([n, g]) => {
176
+ const _ = H[n], F = I(
174
177
  "flex items-center gap-2 text-[12.5px]",
175
- b === 0 ? "text-slate-300 dark:text-slate-600" : "text-slate-700 dark:text-slate-200"
178
+ g === 0 ? "text-slate-300 dark:text-slate-600" : "text-slate-700 dark:text-slate-200"
176
179
  ), R = /* @__PURE__ */ o(E, { children: [
177
- /* @__PURE__ */ e("span", { className: "flex-1", children: q[r] ?? r }),
178
- /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: b })
180
+ /* @__PURE__ */ e("span", { className: "flex-1", children: q[n] ?? n }),
181
+ /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums", children: g })
179
182
  ] });
180
183
  return _ ? /* @__PURE__ */ o("label", { className: F, children: [
181
184
  /* @__PURE__ */ e(
@@ -183,16 +186,16 @@ function re({ profile: d }) {
183
186
  {
184
187
  type: "checkbox",
185
188
  checked: i[_] !== !1,
186
- disabled: b === 0,
187
- onChange: (G) => l((T) => ({ ...T, [_]: G.target.checked })),
189
+ disabled: g === 0,
190
+ onChange: (A) => l((G) => ({ ...G, [_]: A.target.checked })),
188
191
  className: "h-3.5 w-3.5"
189
192
  }
190
193
  ),
191
194
  R
192
- ] }, r) : /* @__PURE__ */ o("div", { className: F, children: [
195
+ ] }, n) : /* @__PURE__ */ o("div", { className: F, children: [
193
196
  /* @__PURE__ */ e("span", { className: "w-3.5" }),
194
197
  R
195
- ] }, r);
198
+ ] }, n);
196
199
  }) }),
197
200
  L === 0 ? /* @__PURE__ */ e(S, { children: "Nothing to hand over — this account holds no work." }) : /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2.5", children: [
198
201
  /* @__PURE__ */ e(
@@ -201,7 +204,7 @@ function re({ profile: d }) {
201
204
  excludeId: d.id,
202
205
  value: t,
203
206
  label: "Successor (who takes it over)…",
204
- onPick: h
207
+ onPick: p
205
208
  }
206
209
  ),
207
210
  /* @__PURE__ */ o("label", { className: "flex items-center gap-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: [
@@ -209,8 +212,8 @@ function re({ profile: d }) {
209
212
  "input",
210
213
  {
211
214
  type: "checkbox",
212
- checked: n,
213
- onChange: (r) => s(r.target.checked),
215
+ checked: a,
216
+ onChange: (n) => s(n.target.checked),
214
217
  className: "h-3.5 w-3.5"
215
218
  }
216
219
  ),
@@ -221,7 +224,7 @@ function re({ profile: d }) {
221
224
  "input",
222
225
  {
223
226
  value: O,
224
- onChange: (r) => A(r.target.value),
227
+ onChange: (n) => T(n.target.value),
225
228
  placeholder: "Type OFFBOARD",
226
229
  "aria-label": "Type OFFBOARD to confirm",
227
230
  className: "h-8 w-[150px] rounded-md border border-amber-300 bg-white px-2.5 text-[12.5px] dark:border-amber-500/40 dark:bg-background"
@@ -241,25 +244,25 @@ function re({ profile: d }) {
241
244
  c && /* @__PURE__ */ o("p", { className: "rounded-md bg-emerald-50 px-3 py-2 text-[12px] text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400", children: [
242
245
  "Done:",
243
246
  " ",
244
- Object.entries(c).map(([r, b]) => `${(q[r] ?? r).toLowerCase()} ${b}`).join(" · ")
247
+ Object.entries(c).map(([n, g]) => `${(q[n] ?? n).toLowerCase()} ${g}`).join(" · ")
245
248
  ] })
246
249
  ] }) : /* @__PURE__ */ e(S, { children: "Loading what they hold…" })
247
250
  }
248
251
  );
249
252
  }
250
253
  function ne({ profile: d }) {
251
- const u = y(), p = j(d.id), [t, h] = m(null), [i, l] = m(null), [n, s] = m(""), c = f({
254
+ const u = k(), h = j(d.id), [t, p] = m(null), [i, l] = m(null), [a, s] = m(""), c = v({
252
255
  mutationFn: () => u.request(
253
- v(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id, dry_run: !0 })
254
- ).then((a) => a.data),
255
- onSuccess: (a) => l(a.references),
256
- onError: (a) => g.error(w(a, "Preview failed"))
257
- }), x = f({
258
- mutationFn: () => u.request(v(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id })),
256
+ w(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id, dry_run: !0 })
257
+ ).then((r) => r.data),
258
+ onSuccess: (r) => l(r.references),
259
+ onError: (r) => x.error(y(r, "Preview failed"))
260
+ }), b = v({
261
+ mutationFn: () => u.request(w(`/offboarding/${d.id}/merge`, { into: t == null ? void 0 : t.id })),
259
262
  onSuccess: () => {
260
- g.success("Accounts merged — the duplicate is suspended"), l(null), s(""), p();
263
+ x.success("Accounts merged — the duplicate is suspended"), l(null), s(""), h();
261
264
  },
262
- onError: (a) => g.error(w(a, "Merge failed"))
265
+ onError: (r) => x.error(y(r, "Merge failed"))
263
266
  });
264
267
  return /* @__PURE__ */ e(
265
268
  C,
@@ -277,8 +280,8 @@ function ne({ profile: d }) {
277
280
  excludeId: d.id,
278
281
  value: t,
279
282
  label: "Survivor account (keeps everything)…",
280
- onPick: (a) => {
281
- h(a), l(null);
283
+ onPick: (r) => {
284
+ p(r), l(null);
282
285
  }
283
286
  }
284
287
  ),
@@ -294,23 +297,23 @@ function ne({ profile: d }) {
294
297
  )
295
298
  ] }),
296
299
  i && /* @__PURE__ */ o(E, { children: [
297
- /* @__PURE__ */ e("div", { className: "max-h-[220px] overflow-y-auto rounded-md border border-slate-100 dark:border-border/60", children: Object.keys(i).length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Nothing references this account." }) : Object.entries(i).map(([a, k]) => /* @__PURE__ */ o(
300
+ /* @__PURE__ */ e("div", { className: "max-h-[220px] overflow-y-auto rounded-md border border-slate-100 dark:border-border/60", children: Object.keys(i).length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "Nothing references this account." }) : Object.entries(i).map(([r, f]) => /* @__PURE__ */ o(
298
301
  "div",
299
302
  {
300
303
  className: "flex items-center justify-between border-b border-slate-50 px-3 py-1 text-[12px] last:border-0 dark:border-border/40",
301
304
  children: [
302
- /* @__PURE__ */ e("span", { className: "font-mono text-slate-600 dark:text-slate-300", children: a }),
303
- /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-700 dark:text-slate-200", children: k })
305
+ /* @__PURE__ */ e("span", { className: "font-mono text-slate-600 dark:text-slate-300", children: r }),
306
+ /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-700 dark:text-slate-200", children: f })
304
307
  ]
305
308
  },
306
- a
309
+ r
307
310
  )) }),
308
311
  /* @__PURE__ */ o("div", { className: "flex flex-wrap items-center gap-2", children: [
309
312
  /* @__PURE__ */ e(
310
313
  "input",
311
314
  {
312
- value: n,
313
- onChange: (a) => s(a.target.value),
315
+ value: a,
316
+ onChange: (r) => s(r.target.value),
314
317
  placeholder: "Type MERGE to confirm",
315
318
  "aria-label": "Type MERGE to confirm",
316
319
  className: "h-8 w-[180px] rounded-md border border-amber-300 bg-white px-2.5 text-[12.5px] dark:border-amber-500/40 dark:bg-background"
@@ -320,10 +323,10 @@ function ne({ profile: d }) {
320
323
  "button",
321
324
  {
322
325
  type: "button",
323
- disabled: n !== "MERGE" || x.isPending,
324
- onClick: () => x.mutate(),
326
+ disabled: a !== "MERGE" || b.isPending,
327
+ onClick: () => b.mutate(),
325
328
  className: "h-8 rounded-md bg-amber-500 px-4 text-[12.5px] font-semibold text-white hover:bg-amber-600 disabled:opacity-50",
326
- children: x.isPending ? "Merging…" : `Merge into ${(t == null ? void 0 : t.name) ?? ""}`
329
+ children: b.isPending ? "Merging…" : `Merge into ${(t == null ? void 0 : t.name) ?? ""}`
327
330
  }
328
331
  )
329
332
  ] })
@@ -1,22 +1,23 @@
1
1
  import { jsxs as a, jsx as r, Fragment as U } from "react/jsx-runtime";
2
- import { useQueryClient as W, useQuery as A, useMutation as j } from "@tanstack/react-query";
3
- import { ExternalLink as z, ArrowRight as E } from "lucide-react";
4
- import { useState as I } from "react";
2
+ import { useQueryClient as W, useQuery as A, useMutation as M } from "@tanstack/react-query";
3
+ import { ExternalLink as z, ArrowRight as j } from "lucide-react";
4
+ import { useState as E } from "react";
5
5
  import { toast as k } from "sonner";
6
6
  import { useNivaroClient as G, useItemNavigation as J } from "../../context.js";
7
- import { get as M, post as Q } from "../../lib/commands.js";
7
+ import { get as I, post as Q } from "../../lib/commands.js";
8
8
  import { formatMultiValue as X } from "../../lib/format-value.js";
9
9
  import { useLiveRecord as Y, batchTouches as K, LIVE_ASPECTS as P } from "../../lib/live.js";
10
- import { cn as Z, formatRelative as L, humanHours as ee } from "../../lib/utils.js";
11
- import { transitionRequirementsFromError as te } from "../panels/PipelinePanel.js";
12
- import { TransitionRequirementsDialog as re } from "../panels/TransitionRequirementsDialog.js";
13
- import { Badge as ae } from "../ui/badge.js";
14
- import { Sheet as ne, SheetContent as oe, SheetHeader as se, SheetTitle as de } from "../ui/sheet.js";
15
- import { OwnerAvatars as ie } from "./OwnerAvatars.js";
16
- function le(e) {
17
- return ee(e);
18
- }
10
+ import { userErrorMessage as Z } from "../../lib/safe-error.js";
11
+ import { cn as L, formatRelative as ee, humanHours as te } from "../../lib/utils.js";
12
+ import { transitionRequirementsFromError as re } from "../panels/PipelinePanel.js";
13
+ import { TransitionRequirementsDialog as ae } from "../panels/TransitionRequirementsDialog.js";
14
+ import { Badge as ne } from "../ui/badge.js";
15
+ import { Sheet as oe, SheetContent as se, SheetHeader as de, SheetTitle as ie } from "../ui/sheet.js";
16
+ import { OwnerAvatars as le } from "./OwnerAvatars.js";
19
17
  function ce(e) {
18
+ return te(e);
19
+ }
20
+ function me(e) {
20
21
  return e.split(".").map((c) => c.replace(/_/g, " ").replace(/\b\w/g, (h) => h.toUpperCase())).join(" → ");
21
22
  }
22
23
  function l({ label: e, children: c }) {
@@ -25,7 +26,7 @@ function l({ label: e, children: c }) {
25
26
  /* @__PURE__ */ r("div", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: c })
26
27
  ] });
27
28
  }
28
- function Ce({
29
+ function Re({
29
30
  item: e,
30
31
  onOpenChange: c,
31
32
  onClaim: h,
@@ -41,15 +42,15 @@ function Ce({
41
42
  itemLayout: F
42
43
  }) {
43
44
  var R;
44
- const p = W(), x = G(), { open: H } = J(), [f, _] = I(""), [m, y] = I(null), n = e == null ? void 0 : e.collection, o = e == null ? void 0 : e.item_id, { data: d } = A({
45
+ const p = W(), x = G(), { open: H } = J(), [f, _] = E(""), [m, y] = E(null), n = e == null ? void 0 : e.collection, o = e == null ? void 0 : e.item_id, { data: d } = A({
45
46
  queryKey: ["queue-sheet-instance", n, o],
46
- queryFn: () => x.request(M(`/pipelines/instance/${n}/${o}`)).then((t) => t.data),
47
+ queryFn: () => x.request(I(`/pipelines/instance/${n}/${o}`)).then((t) => t.data),
47
48
  enabled: !!n && !!o
48
49
  }), { data: i } = A({
49
50
  queryKey: ["queue-sheet-comments", n, o],
50
- queryFn: () => x.request(M("/comments", { collection: n, item: o })).catch(() => ({ data: [] })),
51
+ queryFn: () => x.request(I("/comments", { collection: n, item: o })).catch(() => ({ data: [] })),
51
52
  enabled: !!n && !!o
52
- }), b = j({
53
+ }), b = M({
53
54
  mutationFn: (t) => x.request(
54
55
  Q(`/pipelines/instance/${n}/${o}/transition`, {
55
56
  transition_id: t
@@ -59,7 +60,7 @@ function Ce({
59
60
  y(null), p.invalidateQueries({ queryKey: ["queue-sheet-instance", n, o] }), w(), k.success("Transitioned");
60
61
  },
61
62
  onError: (t, s) => {
62
- const T = te(t);
63
+ const T = re(t);
63
64
  if (T) {
64
65
  y((v) => ({
65
66
  payload: T,
@@ -68,9 +69,9 @@ function Ce({
68
69
  }));
69
70
  return;
70
71
  }
71
- k.error(t instanceof Error ? t.message : "Transition failed");
72
+ k.error(Z(t, "Transition failed"));
72
73
  }
73
- }), C = j({
74
+ }), C = M({
74
75
  mutationFn: (t) => x.request(Q("/comments", { collection: n, item: o, text: t })),
75
76
  onSuccess: () => {
76
77
  _(""), p.invalidateQueries({ queryKey: ["queue-sheet-comments", n, o] });
@@ -81,19 +82,19 @@ function Ce({
81
82
  K(t, P.state) && (p.invalidateQueries({ queryKey: ["queue-sheet-instance", n, o] }), t.own || w()), K(t, P.comments) && p.invalidateQueries({ queryKey: ["queue-sheet-comments", n, o] });
82
83
  });
83
84
  const S = (d == null ? void 0 : d.available_transitions) ?? [], V = new Map(((d == null ? void 0 : d.states) ?? []).map((t) => [t.id, t]));
84
- return /* @__PURE__ */ a(ne, { open: !!e, onOpenChange: c, children: [
85
+ return /* @__PURE__ */ a(oe, { open: !!e, onOpenChange: c, children: [
85
86
  /* @__PURE__ */ r(
86
- oe,
87
+ se,
87
88
  {
88
89
  side: "right",
89
90
  className: "flex max-w-full flex-col gap-0 p-0",
90
91
  style: { width: D ?? 480, maxWidth: "96vw" },
91
92
  children: e && /* @__PURE__ */ a(U, { children: [
92
- /* @__PURE__ */ r(se, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3 pr-6", children: [
93
+ /* @__PURE__ */ r(de, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3 pr-6", children: [
93
94
  /* @__PURE__ */ a("div", { className: "min-w-0", children: [
94
- /* @__PURE__ */ r(de, { className: "truncate text-[15px] font-semibold", children: e.label }),
95
+ /* @__PURE__ */ r(ie, { className: "truncate text-[15px] font-semibold", children: e.label }),
95
96
  /* @__PURE__ */ a("div", { className: "mt-1.5 flex items-center gap-2", children: [
96
- /* @__PURE__ */ r(ae, { variant: "outline", children: q ? q(e.collection) : e.collection }),
97
+ /* @__PURE__ */ r(ne, { variant: "outline", children: q ? q(e.collection) : e.collection }),
97
98
  e.state && /* @__PURE__ */ r(
98
99
  "span",
99
100
  {
@@ -126,21 +127,21 @@ function Ce({
126
127
  ] }) }),
127
128
  /* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto px-5 py-4", children: [
128
129
  /* @__PURE__ */ a("div", { className: "mb-4 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 dark:border-border dark:bg-border", children: [
129
- /* @__PURE__ */ r(l, { label: "Owners", children: /* @__PURE__ */ r(ie, { owners: e.owners, max: 6 }) }),
130
+ /* @__PURE__ */ r(l, { label: "Owners", children: /* @__PURE__ */ r(le, { owners: e.owners, max: 6 }) }),
130
131
  /* @__PURE__ */ r(l, { label: "Claimed by", children: ((R = e.claimed_by) == null ? void 0 : R.name) ?? "—" }),
131
132
  /* @__PURE__ */ r(l, { label: "SLA", children: e.sla_status ? /* @__PURE__ */ r(
132
133
  "span",
133
134
  {
134
- className: Z(
135
+ className: L(
135
136
  "rounded px-1.5 py-0.5 text-[11px] font-medium",
136
137
  e.sla_status === "breached" ? "bg-red-50 text-red-600 dark:bg-red-500/10 dark:text-red-400" : e.sla_status === "warning" ? "bg-amber-50 text-amber-600 dark:bg-amber-500/10 dark:text-amber-400" : "bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10 dark:text-emerald-400"
137
138
  ),
138
139
  children: e.sla_status
139
140
  }
140
141
  ) : "—" }),
141
- /* @__PURE__ */ r(l, { label: "Aging", children: le(e.aging_hours) }),
142
+ /* @__PURE__ */ r(l, { label: "Aging", children: ce(e.aging_hours) }),
142
143
  e.at_risk && /* @__PURE__ */ r(l, { label: "Risk", children: /* @__PURE__ */ r("span", { className: "text-red-500", children: "⚑ At risk" }) }),
143
- Object.entries(e.extra ?? {}).map(([t, s]) => /* @__PURE__ */ r(l, { label: ce(t), children: s == null || s === "" ? "—" : u != null && u[t] ? X(String(s), u[t]) : String(s) }, t))
144
+ Object.entries(e.extra ?? {}).map(([t, s]) => /* @__PURE__ */ r(l, { label: me(t), children: s == null || s === "" ? "—" : u != null && u[t] ? X(String(s), u[t]) : String(s) }, t))
144
145
  ] }),
145
146
  S.length > 0 && /* @__PURE__ */ a("div", { className: "mb-4", children: [
146
147
  /* @__PURE__ */ r("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: "Transitions" }),
@@ -155,7 +156,7 @@ function Ce({
155
156
  className: "flex items-center gap-1 rounded-md border border-slate-200 bg-white px-2.5 py-1.5 text-[12px] font-medium text-slate-700 hover:border-nvr-cyan hover:text-nvr-navy disabled:opacity-50 dark:border-border dark:bg-card dark:text-slate-200 dark:hover:text-nvr-cyan",
156
157
  children: [
157
158
  t.label || (s == null ? void 0 : s.label) || (s == null ? void 0 : s.key) || "Move",
158
- /* @__PURE__ */ r(E, { className: "h-3 w-3 text-slate-400" })
159
+ /* @__PURE__ */ r(j, { className: "h-3 w-3 text-slate-400" })
159
160
  ]
160
161
  },
161
162
  t.id
@@ -177,7 +178,7 @@ function Ce({
177
178
  ((i == null ? void 0 : i.data) ?? []).map((t) => /* @__PURE__ */ a("div", { className: "rounded-md bg-slate-50 px-3 py-2 dark:bg-muted/40", children: [
178
179
  /* @__PURE__ */ a("p", { className: "text-[11px] font-medium text-slate-500 dark:text-muted-foreground", children: [
179
180
  [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email || "—",
180
- /* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-400", children: L(t.created_at) })
181
+ /* @__PURE__ */ r("span", { className: "ml-1.5 font-normal text-slate-400", children: ee(t.created_at) })
181
182
  ] }),
182
183
  /* @__PURE__ */ r("p", { className: "mt-0.5 whitespace-pre-wrap text-[12px] text-slate-700 dark:text-slate-200", children: t.text })
183
184
  ] }, t.id)),
@@ -215,7 +216,7 @@ function Ce({
215
216
  className: "flex w-full items-center justify-center gap-1.5 rounded-md bg-nvr-cyan px-3 py-2 text-[13px] font-semibold text-white hover:bg-nvr-cyan/90",
216
217
  children: [
217
218
  "Next ",
218
- /* @__PURE__ */ r(E, { className: "h-3.5 w-3.5" })
219
+ /* @__PURE__ */ r(j, { className: "h-3.5 w-3.5" })
219
220
  ]
220
221
  }
221
222
  ) })
@@ -223,7 +224,7 @@ function Ce({
223
224
  }
224
225
  ),
225
226
  m && /* @__PURE__ */ r(
226
- re,
227
+ ae,
227
228
  {
228
229
  payload: m.payload,
229
230
  isRetry: m.revision > 1,
@@ -236,5 +237,5 @@ function Ce({
236
237
  ] });
237
238
  }
238
239
  export {
239
- Ce as QueueItemSheet
240
+ Re as QueueItemSheet
240
241
  };