@nivaro/react 0.3.66 → 0.3.68

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 (41) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -1
  4. package/dist/index.js +836 -835
  5. package/dist/shared/components/ActivityEntry.js +28 -28
  6. package/dist/shared/components/CollectionBrowserView.js +584 -585
  7. package/dist/shared/components/ConformanceView.js +34 -34
  8. package/dist/shared/components/ItemEditForm.js +1758 -1758
  9. package/dist/shared/components/RecordCompare.js +149 -129
  10. package/dist/shared/components/ReportView.js +196 -196
  11. package/dist/shared/components/SlaRulesView.js +36 -36
  12. package/dist/shared/components/bulk/BulkCompareButton.js +16 -16
  13. package/dist/shared/components/chat/ChatPanel.js +484 -487
  14. package/dist/shared/components/chat/ChatViews.js +66 -66
  15. package/dist/shared/components/chat/RoomParts.js +159 -157
  16. package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
  17. package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
  18. package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  20. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  21. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  22. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  23. package/dist/shared/components/integrations/console/tone.js +22 -21
  24. package/dist/shared/components/item-edit/FieldRow.js +188 -188
  25. package/dist/shared/components/item-edit/FilePickerField.js +281 -297
  26. package/dist/shared/components/item-edit/GroupSection.js +209 -209
  27. package/dist/shared/components/item-edit/RecordInsights.js +101 -101
  28. package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
  29. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
  30. package/dist/shared/components/panels/AddendumPanel.js +409 -411
  31. package/dist/shared/components/panels/BranchLanes.js +7 -7
  32. package/dist/shared/components/panels/CommentPanel.js +204 -197
  33. package/dist/shared/components/panels/PipelinePanel.js +264 -264
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  35. package/dist/shared/components/panels/RevisionsPanel.js +229 -229
  36. package/dist/shared/components/panels/TaskPanel.js +75 -75
  37. package/dist/shared/components/queue/QueueWorklist.js +591 -589
  38. package/dist/shared/lib/compare-value.js +73 -0
  39. package/dist/shared/lib/format-value.js +18 -17
  40. package/dist/shared/lib/utils.js +87 -80
  41. package/package.json +1 -1
@@ -1,10 +1,11 @@
1
- import { jsxs as d, jsx as s, Fragment as y } from "react/jsx-runtime";
1
+ import { jsxs as o, jsx as s, Fragment as w } from "react/jsx-runtime";
2
2
  import { useQuery as p } from "@tanstack/react-query";
3
- import { Info as w } from "lucide-react";
4
- import { useState as f, useRef as v, useEffect as N } from "react";
5
- import { useNivaroClient as h } from "../../context.js";
3
+ import { Info as N } from "lucide-react";
4
+ import { useState as y, useRef as k, useEffect as _ } from "react";
5
+ import { useNivaroClient as m } from "../../context.js";
6
6
  import { get as u } from "../../lib/commands.js";
7
- function C(a, t, n) {
7
+ import { toLocalDateString as f, formatDateTime as v } from "../../lib/utils.js";
8
+ function P(a, t, n) {
8
9
  for (const r of [
9
10
  ["record-audience", t, n],
10
11
  ["erp-submissions", t, String(n)],
@@ -17,105 +18,105 @@ function C(a, t, n) {
17
18
  ])
18
19
  a.invalidateQueries({ queryKey: r });
19
20
  }
20
- function M(a, t, n) {
21
+ function U(a, t, n) {
21
22
  a.invalidateQueries({ queryKey: ["item", t, n] }), a.invalidateQueries({
22
23
  predicate: (r) => r.queryKey[0] === "o2m-rows" && String(r.queryKey[3]) === n
23
24
  }), a.invalidateQueries({ queryKey: ["child-summary", t, n] }), a.invalidateQueries({ queryKey: ["last-touch", t, n] }), a.invalidateQueries({ queryKey: ["sla-breach", t, n] }), a.invalidateQueries({
24
25
  predicate: (r) => (r.queryKey[0] === "item-actions" || r.queryKey[0] === "ext-item-actions") && r.queryKey[1] === t && String(r.queryKey[2]) === n
25
- }), _(a, t, n);
26
+ }), q(a, t, n);
26
27
  }
27
- const k = 4e3;
28
- function _(a, t, n) {
28
+ const $ = 4e3;
29
+ function q(a, t, n) {
29
30
  var e;
30
31
  const r = () => {
31
32
  a.invalidateQueries({ queryKey: ["comments", t, n] }), a.invalidateQueries({ queryKey: ["comments-related", t, n] });
32
33
  };
33
34
  r();
34
- const l = setTimeout(r, k);
35
+ const l = setTimeout(r, $);
35
36
  (e = l.unref) == null || e.call(l);
36
37
  }
37
- function B({
38
+ function W({
38
39
  collection: a,
39
40
  itemId: t,
40
41
  compact: n
41
42
  }) {
42
- const [r, l] = f(!1), [e, i] = f("audience"), c = v(null);
43
- return N(() => {
43
+ const [r, l] = y(!1), [e, i] = y("audience"), c = k(null);
44
+ return _(() => {
44
45
  if (!r) return;
45
- const o = (x) => {
46
- var m;
47
- (m = c.current) != null && m.contains(x.target) || l(!1);
46
+ const d = (x) => {
47
+ var h;
48
+ (h = c.current) != null && h.contains(x.target) || l(!1);
48
49
  };
49
- return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
50
- }, [r]), /* @__PURE__ */ d("div", { ref: c, className: "relative", children: [
50
+ return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
51
+ }, [r]), /* @__PURE__ */ o("div", { ref: c, className: "relative", children: [
51
52
  /* @__PURE__ */ s(
52
53
  "button",
53
54
  {
54
55
  type: "button",
55
- onClick: () => l((o) => !o),
56
+ onClick: () => l((d) => !d),
56
57
  "data-tip": "Record insights — audience, integrations, owner history",
57
58
  title: "Record insights",
58
59
  "aria-label": "Record insights",
59
60
  className: n ? "inline-flex h-8 w-8 items-center justify-center transition-colors hover:bg-accent hover:text-accent-foreground" : "inline-flex h-9 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground",
60
- children: /* @__PURE__ */ s(w, { className: n ? "h-4 w-4" : "h-3.5 w-3.5" })
61
+ children: /* @__PURE__ */ s(N, { className: n ? "h-4 w-4" : "h-3.5 w-3.5" })
61
62
  }
62
63
  ),
63
- r && /* @__PURE__ */ d("div", { className: "absolute right-0 top-full z-[60] mt-1 w-[480px] max-w-[92vw] rounded-lg border border-slate-200 bg-white p-3 shadow-xl dark:border-border dark:bg-card", children: [
64
+ r && /* @__PURE__ */ o("div", { className: "absolute right-0 top-full z-[60] mt-1 w-[480px] max-w-[92vw] rounded-lg border border-slate-200 bg-white p-3 shadow-xl dark:border-border dark:bg-card", children: [
64
65
  /* @__PURE__ */ s("div", { className: "mb-2 flex gap-1", children: [
65
66
  ["audience", "Audience"],
66
67
  ["integrations", "Integrations"],
67
68
  ["owners", "Owner history"],
68
69
  ["mail", "Mail"],
69
70
  ["chat", "Chat"]
70
- ].map(([o, x]) => /* @__PURE__ */ s(
71
+ ].map(([d, x]) => /* @__PURE__ */ s(
71
72
  "button",
72
73
  {
73
74
  type: "button",
74
- onClick: () => i(o),
75
- className: e === o ? "whitespace-nowrap rounded-md bg-nvr-cyan/10 px-2 py-1 text-[11.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "whitespace-nowrap rounded-md px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted",
75
+ onClick: () => i(d),
76
+ className: e === d ? "whitespace-nowrap rounded-md bg-nvr-cyan/10 px-2 py-1 text-[11.5px] font-medium text-nvr-navy dark:text-nvr-cyan" : "whitespace-nowrap rounded-md px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted",
76
77
  children: x
77
78
  },
78
- o
79
+ d
79
80
  )) }),
80
- e === "audience" && /* @__PURE__ */ s($, { collection: a, itemId: t }),
81
- e === "integrations" && /* @__PURE__ */ s(q, { collection: a, itemId: t }),
82
- e === "owners" && /* @__PURE__ */ s(T, { collection: a, itemId: t }),
83
- e === "mail" && /* @__PURE__ */ s(D, { collection: a, itemId: t }),
84
- e === "chat" && /* @__PURE__ */ s(R, { collection: a, itemId: t })
81
+ e === "audience" && /* @__PURE__ */ s(L, { collection: a, itemId: t }),
82
+ e === "integrations" && /* @__PURE__ */ s(K, { collection: a, itemId: t }),
83
+ e === "owners" && /* @__PURE__ */ s(S, { collection: a, itemId: t }),
84
+ e === "mail" && /* @__PURE__ */ s(E, { collection: a, itemId: t }),
85
+ e === "chat" && /* @__PURE__ */ s(Q, { collection: a, itemId: t })
85
86
  ] })
86
87
  ] });
87
88
  }
88
- const L = {
89
+ const T = {
89
90
  all: "all changes",
90
91
  create: "new records",
91
92
  update: "updates",
92
93
  delete: "deletions",
93
94
  workflow_transition: "state changes"
94
95
  };
95
- function $({ collection: a, itemId: t }) {
96
- const n = h(), { data: r, isLoading: l } = p({
96
+ function L({ collection: a, itemId: t }) {
97
+ const n = m(), { data: r, isLoading: l } = p({
97
98
  queryKey: ["record-audience", a, t],
98
99
  queryFn: () => n.request(u(`/audience/${a}/${t}`)).then((i) => i.data),
99
100
  staleTime: 3e4
100
101
  });
101
102
  if (l) return /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" });
102
103
  const e = (r == null ? void 0 : r.people) ?? [];
103
- return e.length === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Nobody hears about changes here automatically — no owners, watchers, or subscribers." }) : /* @__PURE__ */ d("div", { className: "max-h-72 overflow-y-auto", children: [
104
- /* @__PURE__ */ d("p", { className: "pb-1.5 text-[10.5px] text-slate-400", children: [
104
+ return e.length === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Nobody hears about changes here automatically — no owners, watchers, or subscribers." }) : /* @__PURE__ */ o("div", { className: "max-h-72 overflow-y-auto", children: [
105
+ /* @__PURE__ */ o("p", { className: "pb-1.5 text-[10.5px] text-slate-400", children: [
105
106
  e.length,
106
107
  " ",
107
108
  e.length === 1 ? "person hears" : "people hear",
108
109
  " about changes to this record"
109
110
  ] }),
110
- e.map((i) => /* @__PURE__ */ d(
111
+ e.map((i) => /* @__PURE__ */ o(
111
112
  "div",
112
113
  {
113
114
  className: "border-t border-slate-100 py-1.5 first:border-t-0 dark:border-border/50",
114
115
  children: [
115
116
  /* @__PURE__ */ s("p", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: i.name }),
116
- /* @__PURE__ */ d("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [
117
+ /* @__PURE__ */ o("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [
117
118
  i.owner && /* @__PURE__ */ s("span", { className: "rounded-full bg-nvr-cyan/10 px-1.5 py-px text-[10.5px] font-medium text-nvr-navy dark:text-nvr-cyan", children: "Owner — notified on transitions" }),
118
- i.watch_fields.length > 0 && /* @__PURE__ */ d(
119
+ i.watch_fields.length > 0 && /* @__PURE__ */ o(
119
120
  "span",
120
121
  {
121
122
  className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] text-slate-600 dark:bg-muted dark:text-slate-300",
@@ -128,12 +129,12 @@ function $({ collection: a, itemId: t }) {
128
129
  ]
129
130
  }
130
131
  ),
131
- i.subscriptions.map((c) => /* @__PURE__ */ d(
132
+ i.subscriptions.map((c) => /* @__PURE__ */ o(
132
133
  "span",
133
134
  {
134
135
  className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] text-slate-600 dark:bg-muted dark:text-slate-300",
135
136
  children: [
136
- c.reason ?? `Subscribed to ${L[c.event_type] ?? c.event_type}`,
137
+ c.reason ?? `Subscribed to ${T[c.event_type] ?? c.event_type}`,
137
138
  " ·",
138
139
  " ",
139
140
  c.cadence
@@ -148,91 +149,90 @@ function $({ collection: a, itemId: t }) {
148
149
  ))
149
150
  ] });
150
151
  }
151
- function q({ collection: a, itemId: t }) {
152
- const n = h(), { data: r = [], isLoading: l } = p({
152
+ function K({ collection: a, itemId: t }) {
153
+ const n = m(), { data: r = [], isLoading: l } = p({
153
154
  queryKey: ["erp-submissions", a, String(t)],
154
155
  queryFn: () => n.request(
155
156
  u(`/erp-submissions/${a}/${encodeURIComponent(t)}`)
156
- ).then((o) => o.data ?? []).catch(() => []),
157
+ ).then((d) => d.data ?? []).catch(() => []),
157
158
  staleTime: 3e4
158
159
  }), { data: e, isLoading: i } = p({
159
160
  queryKey: ["record-integrations", a, t],
160
- queryFn: () => n.request(u(`/record-integrations/${a}/${t}`)).then((o) => o.data),
161
+ queryFn: () => n.request(u(`/record-integrations/${a}/${t}`)).then((d) => d.data),
161
162
  staleTime: 3e4
162
163
  }), { data: c = [] } = p({
163
164
  queryKey: ["record-external-ids", a, t],
164
- queryFn: () => n.request(u(`/items/${a}/${t}`)).then((o) => {
165
- const x = o.data ?? {}, m = /(external|nuvolo|mwf|oracle|sap|erp|legacy|fusion|mdsi).*(id|number|ref)|^(order_number|requisition_id|sales_order_id)$/i;
166
- return Object.entries(x).filter(([b, g]) => b !== "id" && g != null && g !== "" && m.test(b)).map(([b, g]) => ({ field: b, value: String(g).slice(0, 60) })).slice(0, 12);
165
+ queryFn: () => n.request(u(`/items/${a}/${t}`)).then((d) => {
166
+ const x = d.data ?? {}, h = /(external|nuvolo|mwf|oracle|sap|erp|legacy|fusion|mdsi).*(id|number|ref)|^(order_number|requisition_id|sales_order_id)$/i;
167
+ return Object.entries(x).filter(([b, g]) => b !== "id" && g != null && g !== "" && h.test(b)).map(([b, g]) => ({ field: b, value: String(g).slice(0, 60) })).slice(0, 12);
167
168
  }).catch(() => []),
168
169
  staleTime: 6e4
169
170
  });
170
- return i || l ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : r.length + ((e == null ? void 0 : e.webhooks.length) ?? 0) === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "No integration activity for this record." }) : /* @__PURE__ */ d(y, { children: [
171
- c.length > 0 && /* @__PURE__ */ d("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border/50", children: [
171
+ return i || l ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : r.length + ((e == null ? void 0 : e.webhooks.length) ?? 0) === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "No integration activity for this record." }) : /* @__PURE__ */ o(w, { children: [
172
+ c.length > 0 && /* @__PURE__ */ o("div", { className: "border-b border-slate-100 px-3 py-2 dark:border-border/50", children: [
172
173
  /* @__PURE__ */ s("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "External identifiers" }),
173
- /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap gap-1.5", children: c.map((o) => /* @__PURE__ */ d(
174
+ /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap gap-1.5", children: c.map((d) => /* @__PURE__ */ o(
174
175
  "span",
175
176
  {
176
177
  className: "inline-flex items-center gap-1 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[11px] dark:border-border dark:bg-muted/40",
177
178
  children: [
178
- /* @__PURE__ */ d("span", { className: "text-slate-400", children: [
179
- o.field,
179
+ /* @__PURE__ */ o("span", { className: "text-slate-400", children: [
180
+ d.field,
180
181
  ":"
181
182
  ] }),
182
- /* @__PURE__ */ s("span", { className: "font-mono text-slate-700 dark:text-slate-200", children: o.value })
183
+ /* @__PURE__ */ s("span", { className: "font-mono text-slate-700 dark:text-slate-200", children: d.value })
183
184
  ]
184
185
  },
185
- o.field
186
+ d.field
186
187
  )) })
187
188
  ] }),
188
- /* @__PURE__ */ d("div", { className: "max-h-72 space-y-1 overflow-y-auto text-[12px]", children: [
189
- r.map((o) => /* @__PURE__ */ d("p", { className: "flex items-baseline justify-between gap-2", children: [
190
- /* @__PURE__ */ s("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: o.external_api_name ?? o.target ?? o.endpoint_path ?? "ERP push" }),
191
- /* @__PURE__ */ d(
189
+ /* @__PURE__ */ o("div", { className: "max-h-72 space-y-1 overflow-y-auto text-[12px]", children: [
190
+ r.map((d) => /* @__PURE__ */ o("p", { className: "flex items-baseline justify-between gap-2", children: [
191
+ /* @__PURE__ */ s("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: d.external_api_name ?? d.target ?? d.endpoint_path ?? "ERP push" }),
192
+ /* @__PURE__ */ o(
192
193
  "span",
193
194
  {
194
- className: o.status === "failed" ? "shrink-0 text-red-500" : o.status === "accepted" ? "shrink-0 text-emerald-600" : "shrink-0 text-slate-400",
195
+ className: d.status === "failed" ? "shrink-0 text-red-500" : d.status === "accepted" ? "shrink-0 text-emerald-600" : "shrink-0 text-slate-400",
195
196
  children: [
196
- o.status,
197
+ d.status,
197
198
  " · ",
198
- new Date(o.created_at).toLocaleDateString()
199
+ f(d.created_at)
199
200
  ]
200
201
  }
201
202
  )
202
- ] }, `e${o.id}`)),
203
- e == null ? void 0 : e.webhooks.map((o) => /* @__PURE__ */ d("p", { className: "flex items-baseline justify-between gap-2", children: [
204
- /* @__PURE__ */ d("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: [
203
+ ] }, `e${d.id}`)),
204
+ e == null ? void 0 : e.webhooks.map((d) => /* @__PURE__ */ o("p", { className: "flex items-baseline justify-between gap-2", children: [
205
+ /* @__PURE__ */ o("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children: [
205
206
  "webhook: ",
206
- o.webhook
207
+ d.webhook
207
208
  ] }),
208
- /* @__PURE__ */ d("span", { className: "shrink-0 text-slate-400", children: [
209
- o.response_status,
209
+ /* @__PURE__ */ o("span", { className: "shrink-0 text-slate-400", children: [
210
+ d.response_status,
210
211
  " · ",
211
- new Date(o.created_at).toLocaleDateString()
212
+ f(d.created_at)
212
213
  ] })
213
- ] }, `w${o.id}`))
214
+ ] }, `w${d.id}`))
214
215
  ] })
215
216
  ] });
216
217
  }
217
- function T({ collection: a, itemId: t }) {
218
- const n = h(), { data: r = [], isLoading: l } = p({
218
+ function S({ collection: a, itemId: t }) {
219
+ const n = m(), { data: r = [], isLoading: l } = p({
219
220
  queryKey: ["record-owner-history", a, t],
220
221
  queryFn: () => n.request(u(`/owner-history/${a}/${t}`)).then((e) => e.data),
221
222
  staleTime: 3e4
222
223
  });
223
- return l ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : r.length === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "No workflow history on this record." }) : /* @__PURE__ */ d("div", { className: "max-h-72 space-y-2 overflow-y-auto text-[12px]", children: [
224
+ return l ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" }) : r.length === 0 ? /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "No workflow history on this record." }) : /* @__PURE__ */ o("div", { className: "max-h-72 space-y-2 overflow-y-auto text-[12px]", children: [
224
225
  /* @__PURE__ */ s("p", { className: "text-[10.5px] text-amber-600 dark:text-amber-400", children: "Owners shown are resolved with TODAY's matrix config — membership changes since then aren't snapshotted." }),
225
226
  r.map((e, i) => (
226
227
  // biome-ignore lint/suspicious/noArrayIndexKey: ordered stays
227
- /* @__PURE__ */ d("div", { children: [
228
- /* @__PURE__ */ d("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
228
+ /* @__PURE__ */ o("div", { children: [
229
+ /* @__PURE__ */ o("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
229
230
  e.state_label ?? "—",
230
231
  " ",
231
- /* @__PURE__ */ d("span", { className: "font-normal text-[10.5px] text-slate-400", children: [
232
- new Date(e.entered_at).toLocaleDateString(),
233
- " →",
234
- " ",
235
- e.left_at ? new Date(e.left_at).toLocaleDateString() : "now",
232
+ /* @__PURE__ */ o("span", { className: "font-normal text-[10.5px] text-slate-400", children: [
233
+ f(e.entered_at),
234
+ " → ",
235
+ e.left_at ? f(e.left_at) : "now",
236
236
  e.moved_by ? ` · moved by ${e.moved_by}` : ""
237
237
  ] })
238
238
  ] }),
@@ -241,7 +241,7 @@ function T({ collection: a, itemId: t }) {
241
241
  ))
242
242
  ] });
243
243
  }
244
- const S = {
244
+ const R = {
245
245
  sent: { label: "Sent", cls: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
246
246
  failed: { label: "Failed", cls: "bg-red-500/10 text-red-600 dark:text-red-400" },
247
247
  deferred: { label: "In daily digest", cls: "bg-amber-500/10 text-amber-600 dark:text-amber-400" },
@@ -250,27 +250,27 @@ const S = {
250
250
  cls: "bg-slate-500/10 text-slate-500 dark:text-slate-400"
251
251
  }
252
252
  };
253
- function K(a) {
253
+ function j(a) {
254
254
  const t = a.split(/[,;]/).map((r) => r.trim()).filter(Boolean);
255
255
  return t.slice(0, 2).map((r) => r.split("@")[0]).join(", ") + (t.length > 2 ? ` +${t.length - 2}` : "");
256
256
  }
257
- function D({ collection: a, itemId: t }) {
258
- const n = h(), { data: r = [], isLoading: l } = p({
257
+ function E({ collection: a, itemId: t }) {
258
+ const n = m(), { data: r = [], isLoading: l } = p({
259
259
  queryKey: ["record-mail-log", a, t],
260
260
  queryFn: () => n.request(u(`/mail-log/record/${a}/${t}`)).then((e) => e.data ?? []).catch(() => []),
261
261
  staleTime: 3e4
262
262
  });
263
263
  return l ? /* @__PURE__ */ s("p", { className: "p-3 text-[12px] text-slate-400", children: "Loading…" }) : r.length === 0 ? /* @__PURE__ */ s("p", { className: "p-3 text-[12px] text-slate-400", children: "No emails have been sent about this record." }) : /* @__PURE__ */ s("div", { className: "max-h-80 overflow-y-auto", children: r.map((e) => {
264
- const i = S[e.status] ?? {
264
+ const i = R[e.status] ?? {
265
265
  label: e.status,
266
266
  cls: "bg-slate-500/10 text-slate-500"
267
267
  };
268
- return /* @__PURE__ */ d(
268
+ return /* @__PURE__ */ o(
269
269
  "div",
270
270
  {
271
271
  className: "border-t border-slate-100 py-2 first:border-t-0 dark:border-border/50",
272
272
  children: [
273
- /* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-2", children: [
273
+ /* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-2", children: [
274
274
  /* @__PURE__ */ s(
275
275
  "p",
276
276
  {
@@ -287,13 +287,13 @@ function D({ collection: a, itemId: t }) {
287
287
  }
288
288
  )
289
289
  ] }),
290
- /* @__PURE__ */ d("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
291
- /* @__PURE__ */ d("span", { "data-tip": e.to, children: [
290
+ /* @__PURE__ */ o("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
291
+ /* @__PURE__ */ o("span", { "data-tip": e.to, children: [
292
292
  "to ",
293
- K(e.to)
293
+ j(e.to)
294
294
  ] }),
295
295
  " · ",
296
- /* @__PURE__ */ s("span", { "data-tip": new Date(e.created_at).toLocaleString(), children: new Date(e.created_at).toLocaleDateString(void 0, {
296
+ /* @__PURE__ */ s("span", { "data-tip": v(e.created_at), children: new Date(e.created_at).toLocaleDateString(void 0, {
297
297
  month: "short",
298
298
  day: "numeric"
299
299
  }) })
@@ -312,8 +312,8 @@ function D({ collection: a, itemId: t }) {
312
312
  );
313
313
  }) });
314
314
  }
315
- function R({ collection: a, itemId: t }) {
316
- const n = h(), { data: r = [], isLoading: l } = p({
315
+ function Q({ collection: a, itemId: t }) {
316
+ const n = m(), { data: r = [], isLoading: l } = p({
317
317
  queryKey: ["record-chat-mentions", a, t],
318
318
  queryFn: () => n.request(u(`/chat/record-mentions/${a}/${t}`)).then((i) => i.data ?? []).catch(() => []),
319
319
  staleTime: 6e4
@@ -322,30 +322,30 @@ function R({ collection: a, itemId: t }) {
322
322
  if (r.length === 0)
323
323
  return /* @__PURE__ */ s("p", { className: "p-3 text-[12px] text-slate-400", children: "No chat messages mention this record outside its own room." });
324
324
  const e = (i) => i === "global" ? "#global" : i.startsWith("ch:") ? `#${i.slice(3)}` : i.startsWith("dm:") ? "a direct message" : i;
325
- return /* @__PURE__ */ s("div", { className: "max-h-72 overflow-y-auto", children: r.map((i) => /* @__PURE__ */ d(
325
+ return /* @__PURE__ */ s("div", { className: "max-h-72 overflow-y-auto", children: r.map((i) => /* @__PURE__ */ o(
326
326
  "div",
327
327
  {
328
328
  className: "border-b border-slate-100 px-3 py-1.5 last:border-b-0 dark:border-border/50",
329
329
  children: [
330
- /* @__PURE__ */ d("p", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
330
+ /* @__PURE__ */ o("p", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
331
331
  /* @__PURE__ */ s("span", { className: "font-medium", children: i.sender_name ?? "Someone" }),
332
332
  " ",
333
- /* @__PURE__ */ d("span", { className: "text-slate-400", children: [
333
+ /* @__PURE__ */ o("span", { className: "text-slate-400", children: [
334
334
  "in ",
335
335
  e(i.room)
336
336
  ] })
337
337
  ] }),
338
338
  /* @__PURE__ */ s("p", { className: "truncate text-[11.5px] text-slate-500", children: i.message.slice(0, 160) }),
339
- /* @__PURE__ */ s("p", { className: "text-[10px] text-slate-400", children: new Date(i.date_created).toLocaleString() })
339
+ /* @__PURE__ */ s("p", { className: "text-[10px] text-slate-400", children: v(i.date_created) })
340
340
  ]
341
341
  },
342
342
  i.id
343
343
  )) });
344
344
  }
345
345
  export {
346
- k as NOTES_SETTLE_MS,
347
- B as RecordInsightsButton,
348
- M as invalidateRecordData,
349
- C as invalidateRecordInsights,
350
- _ as invalidateRecordNotes
346
+ $ as NOTES_SETTLE_MS,
347
+ W as RecordInsightsButton,
348
+ U as invalidateRecordData,
349
+ P as invalidateRecordInsights,
350
+ q as invalidateRecordNotes
351
351
  };
@@ -1,16 +1,16 @@
1
1
  import { jsx as i, jsxs as h } from "react/jsx-runtime";
2
2
  import { useQuery as $ } from "@tanstack/react-query";
3
- import { Check as ye, Copy as pe, ChevronRight as he, Loader2 as xe } from "lucide-react";
4
- import { useState as Z, useRef as be, createContext as ge, useContext as _e } from "react";
3
+ import { Check as pe, Copy as he, ChevronRight as xe, Loader2 as be } from "lucide-react";
4
+ import { useState as Z, useRef as ge, createContext as _e, useContext as ke } from "react";
5
5
  import { useNivaroClient as U } from "../../context.js";
6
6
  import { get as L } from "../../lib/commands.js";
7
- import { useRecordReader as ke } from "../../lib/record-loader.js";
8
- import { cn as v, titleCase as ee, toLocalDateString as Se, choiceLabel as Ne } from "../../lib/utils.js";
7
+ import { useRecordReader as Se } from "../../lib/record-loader.js";
8
+ import { cn as v, titleCase as ee, toLocalDateString as ie, choiceLabel as Ne } from "../../lib/utils.js";
9
9
  import { useChangePulse as we } from "./GroupSection.js";
10
- import { SYSTEM_FIELDS as qe, SENTINEL_FIELDS as Te, applyDisplayTemplate as ie, parseJson as re, richTextToPlain as te } from "./helpers.js";
10
+ import { SYSTEM_FIELDS as qe, SENTINEL_FIELDS as Te, applyDisplayTemplate as re, parseJson as oe, richTextToPlain as te } from "./helpers.js";
11
11
  import { resolveM2MRelatedCollection as $e, m2mIdKey as ne } from "./M2MCombobox.js";
12
- import { RelatedItemLabel as oe } from "./RelationCombobox.js";
13
- const se = ge({});
12
+ import { RelatedItemLabel as se } from "./RelationCombobox.js";
13
+ const ce = _e({});
14
14
  function Oe(e, n) {
15
15
  return n ? Object.entries(n).every(
16
16
  ([a, l]) => l !== null && typeof l == "object" || String(e[a] ?? "") === String(l ?? "")
@@ -84,7 +84,7 @@ function je({
84
84
  s.map((y, P) => /* @__PURE__ */ h("span", { children: [
85
85
  P > 0 && ", ",
86
86
  /* @__PURE__ */ i(
87
- oe,
87
+ se,
88
88
  {
89
89
  collection: o,
90
90
  id: y,
@@ -137,7 +137,7 @@ function je({
137
137
  function Le(e) {
138
138
  return e === "directus_users" ? "nivaro_users" : e;
139
139
  }
140
- function ce(e) {
140
+ function de(e) {
141
141
  const n = U();
142
142
  return $({
143
143
  queryKey: ["summary-display-template", e],
@@ -150,8 +150,8 @@ function ce(e) {
150
150
  }).data;
151
151
  }
152
152
  function X({ collection: e, id: n }) {
153
- const a = ce(e);
154
- return /* @__PURE__ */ i(oe, { collection: e, id: n, displayTemplate: a ?? void 0 });
153
+ const a = de(e);
154
+ return /* @__PURE__ */ i(se, { collection: e, id: n, displayTemplate: a ?? void 0 });
155
155
  }
156
156
  const Me = ["name", "title", "label", "subject", "description", "line_number"], Ce = ["amount", "total", "cost"], C = (e) => {
157
157
  if (typeof e == "number") return Number.isFinite(e) ? e : null;
@@ -176,7 +176,7 @@ function ve(e) {
176
176
  const V = 4, H = 200;
177
177
  function Ee(e, n) {
178
178
  if (n) {
179
- const a = ie(n, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
179
+ const a = re(n, e).replace(/\s*[·|\-–—/]\s*(?=[·|\-–—/]|$)/g, "").replace(/^\s*[·|\-–—/]\s*/, "").trim();
180
180
  if (a !== "") return a;
181
181
  }
182
182
  for (const a of Me) {
@@ -208,7 +208,7 @@ function Pe(e, n, a) {
208
208
  ), c = Ke.map((r) => l.find((m) => m.many_field === r)).find(Boolean) ?? l[0];
209
209
  return c != null && c.many_field && c.one_collection ? { field: c.many_field, collection: c.one_collection } : null;
210
210
  }
211
- function de({
211
+ function me({
212
212
  relatedCollection: e,
213
213
  manyField: n,
214
214
  parentId: a,
@@ -216,7 +216,7 @@ function de({
216
216
  expanded: c
217
217
  }) {
218
218
  var K, T;
219
- const r = U(), m = _e(se), f = l && Object.keys(l).length > 0 ? {
219
+ const r = U(), m = ke(ce), f = l && Object.keys(l).length > 0 ? {
220
220
  _and: [
221
221
  { [n]: { _eq: a } },
222
222
  Object.fromEntries(
@@ -242,7 +242,7 @@ function de({
242
242
  ).then((t) => t.data ?? []),
243
243
  enabled: !!a && a !== "new",
244
244
  staleTime: 3e4
245
- }), b = ce(e), { data: o = [] } = $({
245
+ }), b = de(e), { data: o = [] } = $({
246
246
  queryKey: ["collection-relations", e],
247
247
  queryFn: () => r.request(L(`/collections/${e}`)).then((t) => {
248
248
  var s;
@@ -275,7 +275,7 @@ function de({
275
275
  ...R
276
276
  ];
277
277
  if (g && R.length === 0)
278
- return /* @__PURE__ */ i(xe, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
278
+ return /* @__PURE__ */ i(be, { className: "h-3 w-3 animate-spin text-slate-400 dark:text-slate-500" });
279
279
  if (S.length === 0)
280
280
  return /* @__PURE__ */ i("span", { className: "italic text-[11px] text-slate-400 dark:text-slate-500", children: "None yet" });
281
281
  const j = ((p == null ? void 0 : p.length) ?? 0) >= H, _ = ve(S), D = _ && !j ? Math.round(S.reduce((t, s) => t + (_.of(s) ?? 0), 0) * 100) / 100 : null, q = (_ == null ? void 0 : _.currency) ?? !1;
@@ -350,7 +350,7 @@ function Ie({
350
350
  }
351
351
  })();
352
352
  return /* @__PURE__ */ i(
353
- de,
353
+ me,
354
354
  {
355
355
  relatedCollection: o.many_collection,
356
356
  manyField: o.many_field,
@@ -370,7 +370,7 @@ function Ie({
370
370
  return u ? { ...o, junction_field: u.many_field } : null;
371
371
  })() : null;
372
372
  if (d) {
373
- const u = re(e.options);
373
+ const u = oe(e.options);
374
374
  return /* @__PURE__ */ i(
375
375
  je,
376
376
  {
@@ -401,7 +401,7 @@ function Ie({
401
401
  return /* @__PURE__ */ i(X, { collection: g.one_collection, id: n });
402
402
  if (e.type === "datetime" || e.type === "date")
403
403
  try {
404
- return /* @__PURE__ */ i("span", { className: "text-slate-700 dark:text-slate-200", children: Se(n) });
404
+ return /* @__PURE__ */ i("span", { className: "text-slate-700 dark:text-slate-200", children: ie(n) });
405
405
  } catch {
406
406
  }
407
407
  const b = Je(e.options, n);
@@ -410,7 +410,7 @@ function Ie({
410
410
  function Je(e, n) {
411
411
  var c;
412
412
  if (n == null || typeof n == "object") return null;
413
- const a = re(
413
+ const a = oe(
414
414
  e
415
415
  ), l = (c = a == null ? void 0 : a.choices) == null ? void 0 : c.find((r) => r && String(r.value) === String(n));
416
416
  return (l == null ? void 0 : l.text) != null ? Ne(l.text) : null;
@@ -433,7 +433,7 @@ function Ue(e) {
433
433
  const n = String(e);
434
434
  if (/^\d{4}-\d{2}-\d{2}T/.test(n))
435
435
  try {
436
- return new Date(n).toLocaleDateString();
436
+ return ie(n);
437
437
  } catch {
438
438
  }
439
439
  return n;
@@ -447,7 +447,7 @@ const le = (e) => {
447
447
  return n.length > 48 ? `${n.slice(0, 48)}…` : n;
448
448
  };
449
449
  function ae(e, n) {
450
- const a = U(), l = ke(), c = !!e && n != null && n !== "", { data: r } = $({
450
+ const a = U(), l = Se(), c = !!e && n != null && n !== "", { data: r } = $({
451
451
  queryKey: ["cbv-collection-meta", e],
452
452
  queryFn: () => a.request(L(`/collections/${e}`)).then((p) => p.data),
453
453
  enabled: c,
@@ -462,7 +462,7 @@ function ae(e, n) {
462
462
  });
463
463
  if (!c) return null;
464
464
  if (!m) return "a linked record";
465
- const f = ie(r == null ? void 0 : r.display_template, m).trim();
465
+ const f = re(r == null ? void 0 : r.display_template, m).trim();
466
466
  if (f) return f;
467
467
  for (const p of ["name", "title", "label", "number", "email"]) if (m[p]) return String(m[p]);
468
468
  return "a linked record";
@@ -529,7 +529,7 @@ function it({
529
529
  stagedO2MRows: F,
530
530
  stagedO2MDeletes: I
531
531
  }) {
532
- const [O, w] = Z(null), [R, S] = Z(null), j = be(/* @__PURE__ */ new Map()), q = [
532
+ const [O, w] = Z(null), [R, S] = Z(null), j = ge(/* @__PURE__ */ new Map()), q = [
533
533
  ...!e.some((t) => t.key === "__general__") && a.length > 0 ? [{ key: "__general__", label: "General" }] : [],
534
534
  ...e
535
535
  ].map((t) => {
@@ -539,7 +539,7 @@ function it({
539
539
  (t) => !t.junction_field && t.many_field && t.many_collection && (t.one_collection === m || t.one_collection == null) && t.one_field != null && !K.has(t.one_field) && // Off-layout aliases stay out — the sidebar summarizes THIS layout.
540
540
  (!d || d.has(t.one_field))
541
541
  ) : [];
542
- return q.length === 0 && T.length === 0 ? null : /* @__PURE__ */ i(se.Provider, { value: { rows: F, deletes: I }, children: /* @__PURE__ */ h("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
542
+ return q.length === 0 && T.length === 0 ? null : /* @__PURE__ */ i(ce.Provider, { value: { rows: F, deletes: I }, children: /* @__PURE__ */ h("div", { className: "overflow-hidden bg-white dark:bg-card", children: [
543
543
  /* @__PURE__ */ i("div", { className: "bg-slate-200 border-b border-slate-300 px-4 py-2.5 dark:bg-white/[0.1] dark:border-border", children: /* @__PURE__ */ i("span", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "Summary" }) }),
544
544
  q.map(({ step: t, fields: s }, x) => /* @__PURE__ */ h("div", { children: [
545
545
  /* @__PURE__ */ i(
@@ -553,7 +553,7 @@ function it({
553
553
  }
554
554
  ),
555
555
  s.map((y, P) => {
556
- const N = c[y.field], M = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], me = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, ue = J === null, W = !!y.required && me && !A && !ue, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
556
+ const N = c[y.field], M = y.label ?? ee(y.field), A = !!(g != null && g[y.field]), J = o == null ? void 0 : o[y.field], ue = J !== void 0 ? J === !0 : N == null || typeof N == "string" && N.trim() === "" || Array.isArray(N) && N.length === 0, fe = J === null, W = !!y.required && ue && !A && !fe, Y = (b == null ? void 0 : b.has(y.field)) ?? !1;
557
557
  return /* @__PURE__ */ h(
558
558
  "div",
559
559
  {
@@ -637,8 +637,8 @@ function it({
637
637
  onClick: (B) => {
638
638
  var G, Q;
639
639
  B.stopPropagation();
640
- const fe = ((Q = (G = j.current.get(y.field)) == null ? void 0 : G.textContent) == null ? void 0 : Q.trim()) ?? Ue(N);
641
- navigator.clipboard.writeText(fe).catch(() => {
640
+ const ye = ((Q = (G = j.current.get(y.field)) == null ? void 0 : G.textContent) == null ? void 0 : Q.trim()) ?? Ue(N);
641
+ navigator.clipboard.writeText(ye).catch(() => {
642
642
  }), w(y.field), setTimeout(
643
643
  () => w((z) => z === y.field ? null : z),
644
644
  1500
@@ -648,7 +648,7 @@ function it({
648
648
  "flex items-center px-2 opacity-0 group-hover/row:opacity-100 transition-all duration-150",
649
649
  O === y.field ? "text-emerald-500" : "text-slate-400 hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300"
650
650
  ),
651
- children: O === y.field ? /* @__PURE__ */ i(ye, { className: "h-3 w-3" }) : /* @__PURE__ */ i(pe, { className: "h-3 w-3" })
651
+ children: O === y.field ? /* @__PURE__ */ i(pe, { className: "h-3 w-3" }) : /* @__PURE__ */ i(he, { className: "h-3 w-3" })
652
652
  }
653
653
  )
654
654
  ]
@@ -693,7 +693,7 @@ function it({
693
693
  children: [
694
694
  /* @__PURE__ */ h("span", { className: "flex items-center gap-1 text-[10px] font-medium truncate text-slate-400 dark:text-slate-500", children: [
695
695
  /* @__PURE__ */ i(
696
- he,
696
+ xe,
697
697
  {
698
698
  className: v(
699
699
  "h-3 w-3 shrink-0 transition-transform",
@@ -704,7 +704,7 @@ function it({
704
704
  ee(t.one_field ?? t.many_collection ?? "")
705
705
  ] }),
706
706
  /* @__PURE__ */ i("span", { className: "mt-0.5 text-[12px]", children: /* @__PURE__ */ i(
707
- de,
707
+ me,
708
708
  {
709
709
  relatedCollection: t.many_collection ?? "",
710
710
  manyField: t.many_field,