@nivaro/react 0.3.12 → 0.3.14

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 (50) hide show
  1. package/dist/components/slots/pipeline/OwnersSection.js +79 -75
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +50 -2
  5. package/dist/index.js +601 -596
  6. package/dist/shared/components/CollectionBrowserView.js +2373 -2298
  7. package/dist/shared/components/DataTable.js +347 -335
  8. package/dist/shared/components/ItemEditForm.js +5278 -5149
  9. package/dist/shared/components/ListLoadError.js +33 -0
  10. package/dist/shared/components/PageRenderer.js +562 -529
  11. package/dist/shared/components/ProfileView.js +53 -51
  12. package/dist/shared/components/RecordReadView.js +119 -117
  13. package/dist/shared/components/ReportView.js +1268 -1241
  14. package/dist/shared/components/cbv/export-rows.js +69 -0
  15. package/dist/shared/components/cbv/saved-view-risk.js +35 -0
  16. package/dist/shared/components/cbv/unknown-fields.js +18 -0
  17. package/dist/shared/components/integrations/console/AlertsView.js +27 -25
  18. package/dist/shared/components/integrations/console/EventsView.js +244 -209
  19. package/dist/shared/components/item-edit/CatalogPickerField.js +946 -878
  20. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +84 -57
  21. package/dist/shared/components/item-edit/FieldAffordances.js +63 -61
  22. package/dist/shared/components/item-edit/FieldRow.js +195 -179
  23. package/dist/shared/components/item-edit/FilePickerField.js +257 -254
  24. package/dist/shared/components/item-edit/HeaderTools.js +139 -95
  25. package/dist/shared/components/item-edit/InlineTableField.js +2087 -2075
  26. package/dist/shared/components/item-edit/RecordLiveSync.js +196 -181
  27. package/dist/shared/components/item-edit/RowComments.js +1 -3
  28. package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
  29. package/dist/shared/components/item-edit/UserChip.js +113 -113
  30. package/dist/shared/components/item-edit/file-download.js +18 -0
  31. package/dist/shared/components/item-edit/line-qty.js +67 -32
  32. package/dist/shared/components/item-edit/save-refusal.js +23 -0
  33. package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
  34. package/dist/shared/components/panels/CommentPanel.js +30 -30
  35. package/dist/shared/components/panels/ItemLockBanner.js +207 -185
  36. package/dist/shared/components/panels/PipelinePanel.js +915 -786
  37. package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
  38. package/dist/shared/components/profile/DelegationCard.js +1 -1
  39. package/dist/shared/components/profile/session-actions.js +24 -24
  40. package/dist/shared/components/queue/QueueItemSheet.js +18 -18
  41. package/dist/shared/components/queue/QueueWorklist.js +517 -504
  42. package/dist/shared/components/ui/dropdown-menu.js +8 -7
  43. package/dist/shared/context.js +71 -66
  44. package/dist/shared/lib/draft-store.js +60 -33
  45. package/dist/shared/lib/leave-guard.js +38 -0
  46. package/dist/shared/lib/load-error.js +38 -17
  47. package/dist/shared/lib/summary-mode.js +25 -25
  48. package/dist/shared/lib/table-pins.js +23 -0
  49. package/dist/shared/lib/validation-rules.js +55 -51
  50. package/package.json +1 -1
@@ -3,7 +3,7 @@ import { useSensors as jt, useSensor as Ye, PointerSensor as Mt, KeyboardSensor
3
3
  import { sortableKeyboardCoordinates as Kt, SortableContext as Ue, verticalListSortingStrategy as Ve, arrayMove as He, useSortable as ct } from "@dnd-kit/sortable";
4
4
  import { CSS as dt } from "@dnd-kit/utilities";
5
5
  import { useMutation as z, useQueryClient as Ne, useQuery as V } from "@tanstack/react-query";
6
- import { X as ye, ArrowLeft as oa, Check as ve, Pencil as Te, Download as ca, Plus as be, Trash2 as Ce, ArrowRight as Bt, Zap as da, PlugZap as ma, Filter as mt, Link2 as Ft, LayoutGrid as pa, Link2Off as ua, ListChecks as Qt, Loader2 as Se, GripVertical as pt, Settings as ha, GitFork as xa, ChevronDown as Ee, Search as ut, History as fa, ChevronRight as ht, ExternalLink as ga } from "lucide-react";
6
+ import { X as ye, ArrowLeft as oa, Check as ve, Pencil as Te, Download as ca, Plus as be, Trash2 as Ce, ArrowRight as Bt, Zap as da, PlugZap as ma, Filter as mt, Link2 as Ft, LayoutGrid as pa, Link2Off as ua, ListChecks as Qt, Loader2 as Se, GripVertical as pt, Settings as ha, GitFork as xa, ChevronDown as Oe, Search as ut, History as fa, ChevronRight as ht, ExternalLink as ga } from "lucide-react";
7
7
  import { useState as $, useEffect as he, useContext as ba, useRef as Je, useMemo as ya, createContext as va } from "react";
8
8
  import { createPortal as Na } from "react-dom";
9
9
  import { toast as T } from "sonner";
@@ -20,7 +20,7 @@ import { Label as G } from "../ui/label.js";
20
20
  import { Popover as Ae, PopoverTrigger as Le, PopoverContent as je } from "../ui/popover.js";
21
21
  import { Select as $a, SelectTrigger as Fa, SelectValue as Ea, SelectContent as Oa, SelectItem as Ra } from "../ui/select.js";
22
22
  import { Skeleton as De } from "../ui/skeleton.js";
23
- import { Switch as Pe } from "../ui/switch.js";
23
+ import { Switch as Ee } from "../ui/switch.js";
24
24
  import { Textarea as Wt } from "../ui/textarea.js";
25
25
  import { FieldPicker as ot } from "./FieldPicker.js";
26
26
  import { OwnerMatrix as Pa } from "./OwnerMatrix.js";
@@ -58,7 +58,7 @@ function xe({
58
58
  className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-[13px] text-slate-700 hover:border-slate-300",
59
59
  children: [
60
60
  /* @__PURE__ */ e("span", { className: p ? "" : "text-slate-400", children: p ?? f }),
61
- /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
61
+ /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
62
62
  ]
63
63
  }
64
64
  ) }),
@@ -156,7 +156,7 @@ function Wa({
156
156
  className: "flex h-full w-full items-center justify-between gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-[13px] text-slate-700 hover:border-slate-300",
157
157
  children: [
158
158
  /* @__PURE__ */ e("span", { className: m ? "" : "text-slate-400", children: m ?? f }),
159
- /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
159
+ /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
160
160
  ]
161
161
  }
162
162
  ) }),
@@ -488,6 +488,7 @@ function Tt(a) {
488
488
  to_previous: !!f.to_previous,
489
489
  in_row_menu: f.in_row_menu !== !1,
490
490
  require_owner: f.require_owner === !0,
491
+ allow_creator: f.allow_creator === !0,
491
492
  notify_text: f.notify_text ?? null,
492
493
  comment_mode: f.comment_mode ?? "none",
493
494
  actions: f.actions ?? null,
@@ -623,7 +624,7 @@ function Ha({
623
624
  },
624
625
  O
625
626
  )),
626
- /* @__PURE__ */ e(Ee, { className: "ml-auto h-3.5 w-3.5 shrink-0 text-slate-400" })
627
+ /* @__PURE__ */ e(Oe, { className: "ml-auto h-3.5 w-3.5 shrink-0 text-slate-400" })
627
628
  ]
628
629
  }
629
630
  ) }) }),
@@ -715,7 +716,7 @@ function Xa({
715
716
  onClick: () => x((v) => !v),
716
717
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
717
718
  children: [
718
- i ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
719
+ i ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
719
720
  /* @__PURE__ */ e(mt, { className: "h-3 w-3" }),
720
721
  "Conditions ",
721
722
  /* @__PURE__ */ e("span", { className: "font-normal text-slate-400", children: "(optional)" }),
@@ -973,7 +974,7 @@ function es({
973
974
  onClick: () => x((m) => !m),
974
975
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
975
976
  children: [
976
- i ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
977
+ i ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
977
978
  /* @__PURE__ */ e(Qt, { className: "h-3 w-3" }),
978
979
  "Requirements ",
979
980
  /* @__PURE__ */ e("span", { className: "font-normal text-slate-400", children: "(optional)" }),
@@ -1119,7 +1120,7 @@ function ss({
1119
1120
  onClick: () => f((c) => !c),
1120
1121
  className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 hover:text-slate-800",
1121
1122
  children: [
1122
- d ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
1123
+ d ? /* @__PURE__ */ e(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(ht, { className: "h-3.5 w-3.5" }),
1123
1124
  "Actions",
1124
1125
  a.length > 0 && /* @__PURE__ */ e("span", { className: "rounded-full bg-teal-100 px-1.5 py-0.5 text-[10px] font-medium text-teal-700", children: a.length })
1125
1126
  ]
@@ -1365,6 +1366,7 @@ function it({
1365
1366
  to_previous: a.to_previous ?? !1,
1366
1367
  in_row_menu: a.in_row_menu ?? !0,
1367
1368
  require_owner: a.require_owner ?? !1,
1369
+ allow_creator: a.allow_creator ?? !1,
1368
1370
  notify_text: a.notify_text ?? null,
1369
1371
  comment_mode: a.comment_mode ?? "none",
1370
1372
  actions: a.actions ?? null
@@ -1492,7 +1494,7 @@ function it({
1492
1494
  /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: "Automatic" }),
1493
1495
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Fired by the engine when the conditions above match — never shown to users. Evaluated after record writes, after manual transitions, and hourly." })
1494
1496
  ] }),
1495
- /* @__PURE__ */ e(Pe, { checked: r.auto_trigger, onCheckedChange: (s) => b("auto_trigger", s) })
1497
+ /* @__PURE__ */ e(Ee, { checked: r.auto_trigger, onCheckedChange: (s) => b("auto_trigger", s) })
1496
1498
  ] }),
1497
1499
  /* @__PURE__ */ t("label", { className: "flex cursor-pointer items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2", children: [
1498
1500
  /* @__PURE__ */ t("div", { children: [
@@ -1500,7 +1502,7 @@ function it({
1500
1502
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Offer this move from the per-row Actions menu in the collection browser and queues. Off keeps it on the record form only — typical for approvals, so a list never advances a record in one click while send-backs and cancels stay reachable." })
1501
1503
  ] }),
1502
1504
  /* @__PURE__ */ e(
1503
- Pe,
1505
+ Ee,
1504
1506
  {
1505
1507
  checked: r.in_row_menu,
1506
1508
  onCheckedChange: (s) => b("in_row_menu", s),
@@ -1514,7 +1516,7 @@ function it({
1514
1516
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Only the people who own the record's current step — delegates covering for them included — and administrators can run this move. Everyone else gets a refusal, from the form, the list menus and the API alike." })
1515
1517
  ] }),
1516
1518
  /* @__PURE__ */ e(
1517
- Pe,
1519
+ Ee,
1518
1520
  {
1519
1521
  checked: r.require_owner,
1520
1522
  onCheckedChange: (s) => b("require_owner", s),
@@ -1522,6 +1524,20 @@ function it({
1522
1524
  }
1523
1525
  )
1524
1526
  ] }),
1527
+ r.require_owner && /* @__PURE__ */ t("label", { className: "flex cursor-pointer items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2", children: [
1528
+ /* @__PURE__ */ t("div", { children: [
1529
+ /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: "…or the person who created the record" }),
1530
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "The record's creator can run this move as well, even when they don't own the step — for moves like Cancel that belong to the requester. Leave it off for approvals." })
1531
+ ] }),
1532
+ /* @__PURE__ */ e(
1533
+ Ee,
1534
+ {
1535
+ checked: r.allow_creator,
1536
+ onCheckedChange: (s) => b("allow_creator", s),
1537
+ "data-transition-allow-creator": !0
1538
+ }
1539
+ )
1540
+ ] }),
1525
1541
  /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white px-3 py-2", children: [
1526
1542
  /* @__PURE__ */ e(
1527
1543
  "label",
@@ -1551,7 +1567,7 @@ function it({
1551
1567
  /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700", children: "Return to the record's previous state" }),
1552
1568
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Uncancel and friends: the target becomes whatever state the record was in before it entered this one, mined from its history. The state picked above is only the fallback for records with no usable history." })
1553
1569
  ] }),
1554
- /* @__PURE__ */ e(Pe, { checked: r.to_previous, onCheckedChange: (s) => b("to_previous", s) })
1570
+ /* @__PURE__ */ e(Ee, { checked: r.to_previous, onCheckedChange: (s) => b("to_previous", s) })
1555
1571
  ] }),
1556
1572
  /* @__PURE__ */ t("div", { className: "flex gap-2 justify-end", children: [
1557
1573
  /* @__PURE__ */ e(P, { type: "button", variant: "outline", size: "sm", onClick: x, children: "Cancel" }),
@@ -1785,7 +1801,7 @@ function os({
1785
1801
  ),
1786
1802
  /* @__PURE__ */ t("label", { className: "flex shrink-0 items-center gap-1 text-[11px] text-slate-500", children: [
1787
1803
  /* @__PURE__ */ e(
1788
- Pe,
1804
+ Ee,
1789
1805
  {
1790
1806
  checked: !!b.via_many,
1791
1807
  onCheckedChange: (m) => r(c.map((p, s) => s === h ? { ...p, via_many: m } : p))
@@ -2263,6 +2279,7 @@ function ln({
2263
2279
  to_previous: n.to_previous,
2264
2280
  in_row_menu: n.in_row_menu,
2265
2281
  require_owner: n.require_owner,
2282
+ allow_creator: n.require_owner && n.allow_creator,
2266
2283
  notify_text: n.notify_text,
2267
2284
  comment_mode: n.comment_mode,
2268
2285
  group_label: null,
@@ -2294,6 +2311,7 @@ function ln({
2294
2311
  to_previous: k.to_previous,
2295
2312
  in_row_menu: k.in_row_menu,
2296
2313
  require_owner: k.require_owner,
2314
+ allow_creator: k.require_owner && k.allow_creator,
2297
2315
  notify_text: k.notify_text,
2298
2316
  group_label: null,
2299
2317
  actions: k.actions,
@@ -2323,6 +2341,7 @@ function ln({
2323
2341
  to_previous: k.to_previous,
2324
2342
  in_row_menu: k.in_row_menu,
2325
2343
  require_owner: k.require_owner,
2344
+ allow_creator: k.require_owner && k.allow_creator,
2326
2345
  notify_text: k.notify_text,
2327
2346
  comment_mode: k.comment_mode,
2328
2347
  actions: k.actions
@@ -2370,7 +2389,7 @@ function ln({
2370
2389
  },
2371
2390
  onSuccess: () => le(),
2372
2391
  onError: () => T.error("Failed to update color")
2373
- }), [qe, Ke] = $(null), Oe = z({
2392
+ }), [qe, Ke] = $(null), Re = z({
2374
2393
  mutationFn: async ({
2375
2394
  from: n,
2376
2395
  label: k,
@@ -2755,7 +2774,7 @@ function ln({
2755
2774
  ] }),
2756
2775
  (C == null ? void 0 : C.from) === n.label ? (() => {
2757
2776
  const S = C.value, A = S.trim(), se = A !== n.label && Ct.some((ie) => ie.label === A), fe = A.length > 0 && A !== n.label && !se, ue = () => {
2758
- !fe || Oe.isPending || (qe && qe.to !== A && Ke(null), Oe.mutate({ from: n.label, label: A }));
2777
+ !fe || Re.isPending || (qe && qe.to !== A && Ke(null), Re.mutate({ from: n.label, label: A }));
2759
2778
  }, ne = (qe == null ? void 0 : qe.from) === n.label && qe.to === A ? qe.references : null;
2760
2779
  return /* @__PURE__ */ t(
2761
2780
  "div",
@@ -2785,7 +2804,7 @@ function ln({
2785
2804
  {
2786
2805
  type: "button",
2787
2806
  onClick: ue,
2788
- disabled: !fe || Oe.isPending,
2807
+ disabled: !fe || Re.isPending,
2789
2808
  title: "Save (Enter)",
2790
2809
  className: "rounded p-1 text-emerald-600 hover:bg-emerald-50 disabled:opacity-40",
2791
2810
  children: /* @__PURE__ */ e(ve, { className: "h-3.5 w-3.5" })
@@ -2826,12 +2845,12 @@ function ln({
2826
2845
  "button",
2827
2846
  {
2828
2847
  type: "button",
2829
- onClick: () => Oe.mutate({
2848
+ onClick: () => Re.mutate({
2830
2849
  from: n.label,
2831
2850
  label: A,
2832
2851
  confirmed: !0
2833
2852
  }),
2834
- disabled: Oe.isPending,
2853
+ disabled: Re.isPending,
2835
2854
  "data-transition-rename-confirm": !0,
2836
2855
  className: "mt-1.5 rounded bg-amber-600 px-2 py-0.5 text-[11px] font-medium text-white hover:bg-amber-700 disabled:opacity-50",
2837
2856
  children: [
@@ -2924,6 +2943,7 @@ function ln({
2924
2943
  to_previous: S.to_previous,
2925
2944
  in_row_menu: S.in_row_menu,
2926
2945
  require_owner: S.require_owner,
2946
+ allow_creator: S.allow_creator,
2927
2947
  notify_text: S.notify_text,
2928
2948
  // Without this the form always opened
2929
2949
  // on 'No note', whatever was stored —
@@ -2979,7 +2999,7 @@ function ln({
2979
2999
  className: "ml-1 inline-flex items-center rounded-full bg-violet-100 px-1.5 py-0.5 text-[10px] font-semibold text-violet-700 dark:bg-violet-900/30 dark:text-violet-300",
2980
3000
  title: "Only the current step's owner (or a delegate covering for them) and admins can run this move",
2981
3001
  "data-transition-owner-only": !0,
2982
- children: "Owner only"
3002
+ children: S.allow_creator ? "Owner or creator" : "Owner only"
2983
3003
  }
2984
3004
  ),
2985
3005
  S.to_previous && /* @__PURE__ */ e(
@@ -3827,7 +3847,7 @@ function gs({ bindings: a }) {
3827
3847
  ] })
3828
3848
  ] });
3829
3849
  }
3830
- const Re = 900, ge = 230;
3850
+ const Pe = 900, ge = 230;
3831
3851
  function Ht({
3832
3852
  selected: a,
3833
3853
  onChange: l
@@ -4962,7 +4982,7 @@ function ks({ templateId: a }) {
4962
4982
  if (!o || !w) return null;
4963
4983
  const F = g.count / Math.max(1, h.get(g.from) ?? 1), E = g.count / Math.max(1, m.get(g.to) ?? 1), K = Math.max(1.5, o.h * F), j = Math.max(1.5, w.h * E), M = o.y + (_.get(g.from) ?? 0), W = w.y + (N.get(g.to) ?? 0);
4964
4984
  _.set(g.from, (_.get(g.from) ?? 0) + K), N.set(g.to, (N.get(g.to) ?? 0) + j);
4965
- const te = ge + 8, ae = Re - ge - 8, oe = (te + ae) / 2, ce = `M ${te} ${M} C ${oe} ${M}, ${oe} ${W}, ${ae} ${W} L ${ae} ${W + j} C ${oe} ${W + j}, ${oe} ${M + K}, ${te} ${M + K} Z`;
4985
+ const te = ge + 8, ae = Pe - ge - 8, oe = (te + ae) / 2, ce = `M ${te} ${M} C ${oe} ${M}, ${oe} ${W}, ${ae} ${W} L ${ae} ${W + j} C ${oe} ${W + j}, ${oe} ${M + K}, ${te} ${M + K} Z`;
4966
4986
  return { f: g, path: ce };
4967
4987
  }), D = new Map(r.map((g) => [g.id, g]));
4968
4988
  return r.length === 0 ? null : /* @__PURE__ */ t("div", { className: "rounded-xl border border-slate-200 bg-white p-6 space-y-4 dark:border-border dark:bg-card", children: [
@@ -4993,7 +5013,7 @@ function ks({ templateId: a }) {
4993
5013
  g
4994
5014
  )) })
4995
5015
  ] }),
4996
- /* @__PURE__ */ t("svg", { viewBox: `0 0 ${Re} ${v}`, className: "w-full select-none", children: [
5016
+ /* @__PURE__ */ t("svg", { viewBox: `0 0 ${Pe} ${v}`, className: "w-full select-none", children: [
4997
5017
  /* @__PURE__ */ e("title", { children: "Transition flow map" }),
4998
5018
  C.map(
4999
5019
  (g, o) => g ? /* @__PURE__ */ e(
@@ -5052,7 +5072,7 @@ function ks({ templateId: a }) {
5052
5072
  /* @__PURE__ */ e(
5053
5073
  "rect",
5054
5074
  {
5055
- x: Re - ge,
5075
+ x: Pe - ge,
5056
5076
  y: o.y,
5057
5077
  width: ge,
5058
5078
  height: o.h,
@@ -5064,7 +5084,7 @@ function ks({ templateId: a }) {
5064
5084
  /* @__PURE__ */ e(
5065
5085
  "rect",
5066
5086
  {
5067
- x: Re - ge - 6,
5087
+ x: Pe - ge - 6,
5068
5088
  y: o.y,
5069
5089
  width: 6,
5070
5090
  height: o.h,
@@ -5075,7 +5095,7 @@ function ks({ templateId: a }) {
5075
5095
  /* @__PURE__ */ e(
5076
5096
  "text",
5077
5097
  {
5078
- x: Re - ge + 8,
5098
+ x: Pe - ge + 8,
5079
5099
  y: o.y + o.h / 2 + 3,
5080
5100
  className: "fill-slate-700 text-[10.5px] font-medium dark:fill-slate-200",
5081
5101
  children: (((E = D.get(g)) == null ? void 0 : E.label) ?? "").slice(0, 32)
@@ -149,7 +149,7 @@ function se({
149
149
  o ? "Assign a delegate below." : "Pick a delegate below."
150
150
  ] }),
151
151
  d && x && /* @__PURE__ */ a("div", { className: "mt-2 rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-[12px] text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", children: [
152
- "Your delegate would inherit roughly",
152
+ "Your delegate would inherit",
153
153
  " ",
154
154
  /* @__PURE__ */ t("b", { className: "tabular-nums", children: x.approx_open_approvals }),
155
155
  " open approval",
@@ -4,49 +4,49 @@ import { useOptionalNivaroClient as u } from "../../context.js";
4
4
  import { post as c } from "../../lib/commands.js";
5
5
  import { errorText as d } from "./types.js";
6
6
  function h(e) {
7
- const o = e.remembered ? ` Tabs that connect in the next ${e.remember_hours ?? 24} h reload too.` : "";
8
- return (e.sockets > 0 ? `Reload pushed to ${e.sockets} open tab${e.sockets === 1 ? "" : "s"}${e.partial ? " (another server did not answer — there may be more)" : ""}.` : e.partial ? "Reload sent — another server did not answer, so their open tabs could not be counted." : e.nodes != 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).") + o;
7
+ const t = e.remembered ? ` Tabs that connect in the next ${e.remember_hours ?? 24} h reload too.` : "", o = typeof e.tabs == "number" && e.sockets > 0 ? Math.max(1, e.tabs) : e.sockets;
8
+ return (o > 0 ? `Reload pushed to ${o} open tab${o === 1 ? "" : "s"}${e.partial ? " (another server did not answer — there may be more)" : ""}.` : e.partial ? "Reload sent — another server did not answer, so their open tabs could not be counted." : e.nodes != 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).") + t;
9
9
  }
10
- function l(e, o) {
11
- return o > 0 ? `${e} is signed out of ${o} session${o === 1 ? "" : "s"} — every open tab goes back to sign-in.` : `${e} had no session open.`;
10
+ function m(e, t) {
11
+ return t > 0 ? `${e} is signed out of ${t} session${t === 1 ? "" : "s"} — every open tab goes back to sign-in.` : `${e} had no session open.`;
12
12
  }
13
- function $(e, o = {}) {
14
- const r = u();
13
+ function $(e, t = {}) {
14
+ const o = u();
15
15
  return i({
16
- mutationFn: (n = {}) => {
17
- if (!r) throw new Error("Not connected");
18
- return r.request(
16
+ mutationFn: (r = {}) => {
17
+ if (!o) throw new Error("Not connected");
18
+ return o.request(
19
19
  c("/realtime/force-refresh", {
20
20
  user_ids: [e],
21
- seconds: n.seconds ?? 15,
22
- message: n.message ?? ""
21
+ seconds: r.seconds ?? 15,
22
+ message: r.message ?? ""
23
23
  })
24
- ).then((t) => t.data);
24
+ ).then((n) => n.data);
25
25
  },
26
- onSuccess: (n) => {
27
- var t;
28
- s.success(h(n)), (t = o.onDone) == null || t.call(o);
26
+ onSuccess: (r) => {
27
+ var n;
28
+ s.success(h(r)), (n = t.onDone) == null || n.call(t);
29
29
  },
30
- onError: (n) => s.error(d(n, "Failed to push the reload"))
30
+ onError: (r) => s.error(d(r, "Failed to push the reload"))
31
31
  });
32
32
  }
33
- function w(e, o, r = {}) {
34
- const n = u();
33
+ function w(e, t, o = {}) {
34
+ const r = u();
35
35
  return i({
36
36
  mutationFn: () => {
37
- if (!n) throw new Error("Not connected");
38
- return n.request(c(`/security/users/${e}/sign-out`)).then((t) => t.data);
37
+ if (!r) throw new Error("Not connected");
38
+ return r.request(c(`/security/users/${e}/sign-out`)).then((n) => n.data);
39
39
  },
40
- onSuccess: (t) => {
40
+ onSuccess: (n) => {
41
41
  var a;
42
- s.success(l(o, t.revoked)), (a = r.onDone) == null || a.call(r);
42
+ s.success(m(t, n.revoked)), (a = o.onDone) == null || a.call(o);
43
43
  },
44
- onError: (t) => s.error(d(t, "Could not sign them out"))
44
+ onError: (n) => s.error(d(n, "Could not sign them out"))
45
45
  });
46
46
  }
47
47
  export {
48
48
  h as reloadPushedText,
49
- l as signedOutText,
49
+ m as signedOutText,
50
50
  $ as useReloadTheirTabs,
51
51
  w as useSignOutEverywhere
52
52
  };
@@ -42,29 +42,29 @@ function Re({
42
42
  itemLayout: F
43
43
  }) {
44
44
  var R;
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({
46
- queryKey: ["queue-sheet-instance", n, o],
47
- queryFn: () => x.request(I(`/pipelines/instance/${n}/${o}`)).then((t) => t.data),
48
- enabled: !!n && !!o
45
+ const p = W(), x = G(), { open: H } = J(), [f, _] = E(""), [m, y] = E(null), o = e == null ? void 0 : e.collection, s = e == null ? void 0 : e.item_id, { data: d } = A({
46
+ queryKey: ["queue-sheet-instance", o, s],
47
+ queryFn: () => x.request(I(`/pipelines/instance/${o}/${s}`)).then((t) => t.data),
48
+ enabled: !!o && !!s
49
49
  }), { data: i } = A({
50
- queryKey: ["queue-sheet-comments", n, o],
51
- queryFn: () => x.request(I("/comments", { collection: n, item: o })).catch(() => ({ data: [] })),
52
- enabled: !!n && !!o
50
+ queryKey: ["queue-sheet-comments", o, s],
51
+ queryFn: () => x.request(I("/comments", { collection: o, item: s })).then((t) => ({ data: (t.data ?? []).filter((n) => !n.deleted) })).catch(() => ({ data: [] })),
52
+ enabled: !!o && !!s
53
53
  }), b = M({
54
54
  mutationFn: (t) => x.request(
55
- Q(`/pipelines/instance/${n}/${o}/transition`, {
55
+ Q(`/pipelines/instance/${o}/${s}/transition`, {
56
56
  transition_id: t
57
57
  })
58
58
  ),
59
59
  onSuccess: () => {
60
- y(null), p.invalidateQueries({ queryKey: ["queue-sheet-instance", n, o] }), w(), k.success("Transitioned");
60
+ y(null), p.invalidateQueries({ queryKey: ["queue-sheet-instance", o, s] }), w(), k.success("Transitioned");
61
61
  },
62
- onError: (t, s) => {
62
+ onError: (t, n) => {
63
63
  const T = re(t);
64
64
  if (T) {
65
65
  y((v) => ({
66
66
  payload: T,
67
- transitionId: s,
67
+ transitionId: n,
68
68
  revision: ((v == null ? void 0 : v.revision) ?? 0) + 1
69
69
  }));
70
70
  return;
@@ -72,14 +72,14 @@ function Re({
72
72
  k.error(Z(t, "Transition failed"));
73
73
  }
74
74
  }), C = M({
75
- mutationFn: (t) => x.request(Q("/comments", { collection: n, item: o, text: t })),
75
+ mutationFn: (t) => x.request(Q("/comments", { collection: o, item: s, text: t })),
76
76
  onSuccess: () => {
77
- _(""), p.invalidateQueries({ queryKey: ["queue-sheet-comments", n, o] });
77
+ _(""), p.invalidateQueries({ queryKey: ["queue-sheet-comments", o, s] });
78
78
  },
79
79
  onError: () => k.error("Failed to post comment")
80
80
  });
81
- Y(n, o, (t) => {
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] });
81
+ Y(o, s, (t) => {
82
+ K(t, P.state) && (p.invalidateQueries({ queryKey: ["queue-sheet-instance", o, s] }), t.own || w()), K(t, P.comments) && p.invalidateQueries({ queryKey: ["queue-sheet-comments", o, s] });
83
83
  });
84
84
  const S = (d == null ? void 0 : d.available_transitions) ?? [], V = new Map(((d == null ? void 0 : d.states) ?? []).map((t) => [t.id, t]));
85
85
  return /* @__PURE__ */ a(oe, { open: !!e, onOpenChange: c, children: [
@@ -141,12 +141,12 @@ function Re({
141
141
  ) : "—" }),
142
142
  /* @__PURE__ */ r(l, { label: "Aging", children: ce(e.aging_hours) }),
143
143
  e.at_risk && /* @__PURE__ */ r(l, { label: "Risk", children: /* @__PURE__ */ r("span", { className: "text-red-500", children: "⚑ At risk" }) }),
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
+ Object.entries(e.extra ?? {}).map(([t, n]) => /* @__PURE__ */ r(l, { label: me(t), children: n == null || n === "" ? "—" : u != null && u[t] ? X(String(n), u[t]) : String(n) }, t))
145
145
  ] }),
146
146
  S.length > 0 && /* @__PURE__ */ a("div", { className: "mb-4", children: [
147
147
  /* @__PURE__ */ r("p", { className: "mb-1.5 text-[11px] font-medium uppercase tracking-wide text-slate-400 dark:text-muted-foreground", children: "Transitions" }),
148
148
  /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1.5", children: S.map((t) => {
149
- const s = V.get(t.to_state);
149
+ const n = V.get(t.to_state);
150
150
  return /* @__PURE__ */ a(
151
151
  "button",
152
152
  {
@@ -155,7 +155,7 @@ function Re({
155
155
  onClick: () => b.mutate(t.id),
156
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",
157
157
  children: [
158
- t.label || (s == null ? void 0 : s.label) || (s == null ? void 0 : s.key) || "Move",
158
+ t.label || (n == null ? void 0 : n.label) || (n == null ? void 0 : n.key) || "Move",
159
159
  /* @__PURE__ */ r(j, { className: "h-3 w-3 text-slate-400" })
160
160
  ]
161
161
  },