@nivaro/react 0.3.13 → 0.3.15

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 (48) 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 +33 -2
  5. package/dist/index.js +520 -516
  6. package/dist/shared/components/CollectionBrowserView.js +2393 -2318
  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/RowComments.js +1 -3
  27. package/dist/shared/components/item-edit/SummaryPanel.js +62 -62
  28. package/dist/shared/components/item-edit/UserChip.js +113 -113
  29. package/dist/shared/components/item-edit/file-download.js +18 -0
  30. package/dist/shared/components/item-edit/line-qty.js +67 -32
  31. package/dist/shared/components/item-edit/save-refusal.js +23 -0
  32. package/dist/shared/components/monitoring/TrafficMiniMap.js +9 -9
  33. package/dist/shared/components/panels/CommentPanel.js +30 -30
  34. package/dist/shared/components/panels/ItemLockBanner.js +207 -185
  35. package/dist/shared/components/panels/PipelinePanel.js +915 -786
  36. package/dist/shared/components/pipeline/PipelineEditorView.js +45 -25
  37. package/dist/shared/components/profile/DelegationCard.js +1 -1
  38. package/dist/shared/components/profile/session-actions.js +24 -24
  39. package/dist/shared/components/queue/QueueItemSheet.js +18 -18
  40. package/dist/shared/components/queue/QueueWorklist.js +517 -504
  41. package/dist/shared/components/ui/dropdown-menu.js +8 -7
  42. package/dist/shared/lib/draft-store.js +60 -33
  43. package/dist/shared/lib/leave-guard.js +38 -0
  44. package/dist/shared/lib/load-error.js +38 -17
  45. package/dist/shared/lib/summary-mode.js +25 -25
  46. package/dist/shared/lib/table-pins.js +23 -0
  47. package/dist/shared/lib/validation-rules.js +55 -51
  48. package/package.json +1 -1
@@ -0,0 +1,23 @@
1
+ function d(o) {
2
+ const t = o == null ? void 0 : o.response;
3
+ if (!t || typeof t != "object") return null;
4
+ const e = t.data;
5
+ return e && typeof e == "object" && !Array.isArray(e) ? e : t;
6
+ }
7
+ const u = /^([A-Za-z0-9_]+)\[([^\]]*)\]:\s*/, a = /\s+—\s+nothing was changed.*$/s;
8
+ function g(o, t) {
9
+ const e = d(o);
10
+ if (!e) return null;
11
+ const r = String(e.error ?? e.message ?? ""), n = u.exec(r);
12
+ if (n && t.has(n[1])) {
13
+ const l = r.slice(n[0].length).replace(a, "").trim(), f = /^\d{1,4}$/.test(n[2]) ? `Line ${Number(n[2]) + 1}: ` : "";
14
+ return { field: n[1], message: `${f}${l || "A line was refused"}` };
15
+ }
16
+ const s = Array.isArray(e.violations) ? e.violations[0] : void 0, i = typeof e.field == "string" ? e.field : s == null ? void 0 : s.field;
17
+ if (typeof i != "string" || !t.has(i)) return null;
18
+ const c = String((s == null ? void 0 : s.message) ?? (r.replace(a, "").trim() || "Invalid"));
19
+ return { field: i, message: c };
20
+ }
21
+ export {
22
+ g as refusedFieldOf
23
+ };
@@ -64,7 +64,7 @@ function w({ data: e, className: d }) {
64
64
  }
65
65
  );
66
66
  }
67
- const f = (e) => Math.round(e).toLocaleString(), $ = (e) => e < 10 ? e.toFixed(1) : f(e), y = (e) => e ? e >= 1e3 ? `${(e / 1e3).toFixed(1)} s` : `${Math.round(e)} ms` : "—", _ = {
67
+ const h = (e) => Math.round(e).toLocaleString(), $ = (e) => e < 10 ? e.toFixed(1) : h(e), y = (e) => e ? e >= 1e3 ? `${(e / 1e3).toFixed(1)} s` : `${Math.round(e)} ms` : "—", _ = {
68
68
  // always dark (Command Center)
69
69
  dark: {
70
70
  card: "rounded-lg border border-white/10 bg-[#101828] text-[#e2e8f0]",
@@ -99,7 +99,7 @@ function A({
99
99
  staleTime: c / 2
100
100
  });
101
101
  if (!m.data) return null;
102
- const o = v(m.data), h = p ?? "/traffic-map", u = /^https?:\/\//.test(h), x = e === 60 ? "last minute" : `last ${e / 60} min`;
102
+ const o = v(m.data), f = p ?? "/traffic-map", u = /^https?:\/\//.test(f), x = e === 60 ? "last minute" : `last ${e / 60} min`;
103
103
  return /* @__PURE__ */ n(
104
104
  "section",
105
105
  {
@@ -115,20 +115,20 @@ function A({
115
115
  x
116
116
  ] })
117
117
  ] }),
118
- /* @__PURE__ */ a(
118
+ f ? /* @__PURE__ */ a(
119
119
  "a",
120
120
  {
121
- href: h,
121
+ href: f,
122
122
  target: u ? "_blank" : void 0,
123
123
  rel: u ? "noreferrer" : void 0,
124
124
  className: `rounded text-[12px] font-medium ${i.link}`,
125
125
  onClick: (s) => {
126
- u || s.metaKey || s.ctrlKey || (s.preventDefault(), r(h));
126
+ u || s.metaKey || s.ctrlKey || (s.preventDefault(), r(f));
127
127
  },
128
128
  "data-traffic-mini-open": "",
129
129
  children: "Open map"
130
130
  }
131
- )
131
+ ) : null
132
132
  ] }),
133
133
  /* @__PURE__ */ n("div", { className: "grid grid-cols-3 gap-2 px-3 pt-2.5 text-[12px] tabular-nums", children: [
134
134
  /* @__PURE__ */ n("div", { children: [
@@ -136,7 +136,7 @@ function A({
136
136
  /* @__PURE__ */ a("p", { className: i.muted, children: "requests/min" })
137
137
  ] }),
138
138
  /* @__PURE__ */ n("div", { children: [
139
- /* @__PURE__ */ a("p", { className: `text-[18px] font-semibold leading-tight ${o.errors ? i.error : ""}`, children: f(o.errors) }),
139
+ /* @__PURE__ */ a("p", { className: `text-[18px] font-semibold leading-tight ${o.errors ? i.error : ""}`, children: h(o.errors) }),
140
140
  /* @__PURE__ */ n("p", { className: i.muted, children: [
141
141
  "errors",
142
142
  o.req ? ` · ${o.errPct.toFixed(1)}%` : ""
@@ -150,11 +150,11 @@ function A({
150
150
  o.lanes.length === 0 ? /* @__PURE__ */ a("p", { className: `px-3 py-2.5 text-[12px] ${i.muted}`, children: "No API traffic in the window." }) : /* @__PURE__ */ a("ul", { className: "space-y-1 px-3 pb-1 pt-2.5 text-[12px]", children: o.lanes.map((s) => /* @__PURE__ */ n("li", { className: "flex items-center gap-2", "data-traffic-mini-lane": s.lane, children: [
151
151
  /* @__PURE__ */ a("span", { className: "w-[84px] shrink-0 truncate", children: s.label }),
152
152
  /* @__PURE__ */ a(w, { data: s.series, className: `min-w-0 flex-1 ${i.spark}` }),
153
- /* @__PURE__ */ a("span", { className: `w-[52px] shrink-0 text-right tabular-nums ${i.muted}`, children: f(s.req) })
153
+ /* @__PURE__ */ a("span", { className: `w-[52px] shrink-0 text-right tabular-nums ${i.muted}`, children: h(s.req) })
154
154
  ] }, s.lane)) }),
155
155
  o.top.length > 0 && /* @__PURE__ */ n("p", { className: `truncate px-3 pb-2.5 pt-1 text-[11.5px] ${i.muted}`, children: [
156
156
  "Busiest: ",
157
- o.top.map((s) => `${s.label} (${f(s.req)})`).join(", ")
157
+ o.top.map((s) => `${s.label} (${h(s.req)})`).join(", ")
158
158
  ] })
159
159
  ]
160
160
  }
@@ -1,7 +1,7 @@
1
- import { jsxs as s, jsx as e, Fragment as te } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as e, Fragment as ne } from "react/jsx-runtime";
2
2
  import { useQueryClient as fe, useQuery as U, useMutation as O } from "@tanstack/react-query";
3
3
  import { MessageSquare as Se, ChevronDown as $e, ClipboardPlus as Ee, Pencil as qe, Trash2 as De, Check as Pe, X as Re, SmilePlus as ge } from "lucide-react";
4
- import { useState as v, useRef as V, useEffect as J, useMemo as ne } from "react";
4
+ import { useState as v, useRef as Z, useEffect as V, useMemo as G } from "react";
5
5
  import { createPortal as Te } from "react-dom";
6
6
  import { toast as R } from "sonner";
7
7
  import { useNivaroClient as oe, useItemEditAuth as Fe, useDrilldown as Me } from "../../context.js";
@@ -15,7 +15,7 @@ import { AutolinkedText as se } from "../AutolinkedText.js";
15
15
  import { InboundRequestPopover as Be } from "../integrations/InboundRequest.js";
16
16
  import { UserAvatar as Ue } from "../UserAvatar.js";
17
17
  import { Avatar as We, AvatarFallback as He } from "../ui/avatar.js";
18
- import { Button as G } from "../ui/button.js";
18
+ import { Button as J } from "../ui/button.js";
19
19
  import { Separator as xe } from "../ui/separator.js";
20
20
  import { Textarea as Xe } from "../ui/textarea.js";
21
21
  import { RecordEventPathSheet as Ge } from "./IntegrationActivitySection.js";
@@ -71,7 +71,7 @@ function ae({
71
71
  onChange: i,
72
72
  ...d
73
73
  }) {
74
- const c = oe(), b = V(null), [m, h] = v(null), [E, f] = v(0), k = Ie((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = U({
74
+ const c = oe(), b = Z(null), [m, h] = v(null), [E, f] = v(0), k = Ie((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = U({
75
75
  queryKey: ["users", "mention-search", k],
76
76
  queryFn: () => c.request(
77
77
  W("/users", { limit: 8, sort: "first_name", search: k })
@@ -97,8 +97,8 @@ function ae({
97
97
  staleTime: 5 * 6e4
98
98
  }), T = m ? j.filter(
99
99
  (n) => n.name.toLowerCase().replace(/\s+/g, "-").startsWith(k.toLowerCase())
100
- ).slice(0, 3) : [], w = !!m && k.length >= 2 && "owners".startsWith(k.toLowerCase()), C = !!m && k.length >= 2 && (N.length > 0 || w || T.length > 0), o = N.length + (w ? 1 : 0) + T.length, [y, D] = v(null), B = V(null);
101
- J(() => {
100
+ ).slice(0, 3) : [], w = !!m && k.length >= 2 && "owners".startsWith(k.toLowerCase()), C = !!m && k.length >= 2 && (N.length > 0 || w || T.length > 0), o = N.length + (w ? 1 : 0) + T.length, [y, D] = v(null), B = Z(null);
101
+ V(() => {
102
102
  if (!C || !b.current) {
103
103
  D(null);
104
104
  return;
@@ -450,8 +450,8 @@ function wt({
450
450
  queuedComments: b,
451
451
  onQueueComment: m
452
452
  }) {
453
- const h = oe(), { userId: E } = Fe(), f = fe(), [k, M] = v(!1), I = V(!1);
454
- J(() => {
453
+ const h = oe(), { userId: E } = Fe(), f = fe(), [k, M] = v(!1), I = Z(!1);
454
+ V(() => {
455
455
  !I.current && c !== void 0 && (I.current = !0, M(c));
456
456
  }, [c]);
457
457
  const [p, g] = v(""), [N, j] = v(!1), T = async () => {
@@ -468,38 +468,38 @@ function wt({
468
468
  j(!1);
469
469
  }
470
470
  }
471
- }, w = Ae(t, i, "note"), C = Ke(t, i, "note"), o = V(0);
472
- J(() => {
471
+ }, w = Ae(t, i, "note"), C = Ke(t, i, "note"), o = Z(0);
472
+ V(() => {
473
473
  if (!p.trim()) {
474
474
  o.current && C("stop"), o.current = 0;
475
475
  return;
476
476
  }
477
477
  const r = Date.now();
478
478
  r - o.current < 2500 || (o.current = r, C("start"));
479
- }, [p, C]), J(() => () => C("stop"), [C]);
479
+ }, [p, C]), V(() => () => C("stop"), [C]);
480
480
  const [y, D] = v(null), [B, L] = v(null), [q, A] = v(""), n = !i || i === "new", l = ["comments", t, String(i)], { data: x, isLoading: _, isError: S } = U({
481
481
  queryKey: l,
482
482
  queryFn: () => h.request(W("/comments", { collection: t, item: i })).then((r) => r.data),
483
483
  enabled: !n
484
- }), F = x ?? [], { data: K } = U({
484
+ }), F = G(() => (x ?? []).filter((r) => !r.deleted), [x]), { data: K } = U({
485
485
  queryKey: ["comments-related", t, String(i)],
486
486
  queryFn: () => h.request(W("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
487
487
  enabled: !n,
488
488
  staleTime: 3e4
489
- }), ie = K ?? [], $ = ne(() => {
489
+ }), ie = K ?? [], $ = G(() => {
490
490
  const r = F.map((u) => ({ kind: "comment", at: u.created_at, comment: u })), a = ie.map((u) => ({ kind: "related", at: u.created_at, note: u }));
491
491
  return [...r, ...a].sort((u, Q) => new Date(Q.at).getTime() - new Date(u.at).getTime());
492
- }, [F, ie]), [H, ve] = v(() => /* @__PURE__ */ new Set()), [X, ke] = v(""), Ne = ne(() => {
492
+ }, [F, ie]), [H, ve] = v(() => /* @__PURE__ */ new Set()), [X, ke] = v(""), Ne = G(() => {
493
493
  const r = { people: 0, system: 0, integration: 0 };
494
494
  for (const a of $) r[be(a)]++;
495
495
  return r;
496
- }, [$]), Z = ne(() => {
496
+ }, [$]), Y = G(() => {
497
497
  const r = X.trim().toLowerCase();
498
498
  return $.filter((a) => H.has(be(a)) ? !1 : r ? (a.kind === "comment" ? `${a.comment.text} ${re(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
499
499
  }, [$, H, X]), we = (r) => ve((a) => {
500
500
  const u = new Set(a);
501
501
  return u.has(r) ? u.delete(r) : u.add(r), u;
502
- }), _e = H.size > 0 || X.trim() !== "", Y = O({
502
+ }), _e = H.size > 0 || X.trim() !== "", ee = O({
503
503
  mutationFn: (r) => h.request(z("/comments", { collection: t, item: i, text: r })),
504
504
  onSuccess: () => {
505
505
  f.invalidateQueries({ queryKey: l }), g("");
@@ -511,7 +511,7 @@ function wt({
511
511
  f.invalidateQueries({ queryKey: l }), D(null), A("");
512
512
  },
513
513
  onError: () => R.error("Failed to update comment")
514
- }), ee = O({
514
+ }), te = O({
515
515
  mutationFn: (r) => h.request(Oe(`/comments/${r}`)),
516
516
  onSuccess: () => f.invalidateQueries({ queryKey: l }),
517
517
  onError: () => R.error("Failed to delete comment")
@@ -534,7 +534,7 @@ function wt({
534
534
  onError: () => R.error("Could not create a task")
535
535
  });
536
536
  function pe(r) {
537
- r.preventDefault(), p.trim() && (n && m ? (m(p.trim()), g("")) : Y.mutate(p.trim()));
537
+ r.preventDefault(), p.trim() && (n && m ? (m(p.trim()), g("")) : ee.mutate(p.trim()));
538
538
  }
539
539
  return (
540
540
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -593,7 +593,7 @@ function wt({
593
593
  ),
594
594
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
595
595
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
596
- /* @__PURE__ */ e(G, { type: "submit", size: "sm", disabled: !p.trim(), children: "Queue" })
596
+ /* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !p.trim(), children: "Queue" })
597
597
  ] })
598
598
  ] }),
599
599
  (b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
@@ -610,7 +610,7 @@ function wt({
610
610
  a
611
611
  ))
612
612
  ] })
613
- ] }) : /* @__PURE__ */ s(te, { children: [
613
+ ] }) : /* @__PURE__ */ s(ne, { children: [
614
614
  /* @__PURE__ */ s("form", { onSubmit: pe, className: "space-y-2", children: [
615
615
  /* @__PURE__ */ e(
616
616
  ae,
@@ -636,7 +636,7 @@ function wt({
636
636
  children: N ? "…" : "✨ Polish"
637
637
  }
638
638
  ),
639
- /* @__PURE__ */ e(G, { type: "submit", size: "sm", disabled: !p.trim() || Y.isPending, children: Y.isPending ? "Posting…" : "Comment" })
639
+ /* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !p.trim() || ee.isPending, children: ee.isPending ? "Posting…" : "Comment" })
640
640
  ] })
641
641
  ] })
642
642
  ] }),
@@ -686,7 +686,7 @@ function wt({
686
686
  }
687
687
  ),
688
688
  _e && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
689
- Z.length,
689
+ Y.length,
690
690
  " of ",
691
691
  $.length
692
692
  ] })
@@ -697,7 +697,7 @@ function wt({
697
697
  /* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
698
698
  /* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
699
699
  ] })
700
- ] }, r)) }) : S ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : Z.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: Z.map((r) => {
700
+ ] }, r)) }) : S ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : Y.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: Y.map((r) => {
701
701
  if (r.kind === "related")
702
702
  return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
703
703
  tt,
@@ -738,19 +738,19 @@ function wt({
738
738
  children: /* @__PURE__ */ e(Ee, { className: "h-3 w-3" })
739
739
  }
740
740
  ),
741
- u && (B === a.id ? /* @__PURE__ */ s(te, { children: [
741
+ u && (B === a.id ? /* @__PURE__ */ s(ne, { children: [
742
742
  /* @__PURE__ */ e(
743
743
  "button",
744
744
  {
745
745
  type: "button",
746
746
  autoFocus: !0,
747
- disabled: ee.isPending,
747
+ disabled: te.isPending,
748
748
  "data-comment-delete-confirm": a.id,
749
749
  className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
750
- onClick: () => ee.mutate(a.id, {
750
+ onClick: () => te.mutate(a.id, {
751
751
  onSettled: () => L(null)
752
752
  }),
753
- children: ee.isPending ? "Deleting…" : "Delete comment?"
753
+ children: te.isPending ? "Deleting…" : "Delete comment?"
754
754
  }
755
755
  ),
756
756
  /* @__PURE__ */ e(
@@ -762,7 +762,7 @@ function wt({
762
762
  children: "Keep"
763
763
  }
764
764
  )
765
- ] }) : /* @__PURE__ */ s(te, { children: [
765
+ ] }) : /* @__PURE__ */ s(ne, { children: [
766
766
  /* @__PURE__ */ e(
767
767
  "button",
768
768
  {
@@ -804,7 +804,7 @@ function wt({
804
804
  ),
805
805
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
806
806
  /* @__PURE__ */ s(
807
- G,
807
+ J,
808
808
  {
809
809
  size: "sm",
810
810
  className: "h-7 gap-1.5",
@@ -817,7 +817,7 @@ function wt({
817
817
  }
818
818
  ),
819
819
  /* @__PURE__ */ s(
820
- G,
820
+ J,
821
821
  {
822
822
  size: "sm",
823
823
  variant: "outline",