@nivaro/react 0.3.67 → 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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +836 -835
- package/dist/shared/components/ConformanceView.js +34 -34
- package/dist/shared/components/ReportView.js +196 -196
- package/dist/shared/components/SlaRulesView.js +36 -36
- package/dist/shared/components/chat/ChatPanel.js +484 -487
- package/dist/shared/components/chat/ChatViews.js +66 -66
- package/dist/shared/components/chat/RoomParts.js +159 -157
- package/dist/shared/components/help-videos/editor/StatsTab.js +48 -47
- package/dist/shared/components/help-videos/editor/VersionsTab.js +17 -16
- package/dist/shared/components/imports/CollectionImportPanel.js +72 -72
- package/dist/shared/components/item-edit/FieldRow.js +87 -87
- package/dist/shared/components/item-edit/FilePickerField.js +281 -297
- package/dist/shared/components/item-edit/RecordInsights.js +90 -91
- package/dist/shared/components/item-edit/SummaryPanel.js +31 -31
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +12 -12
- package/dist/shared/components/panels/AddendumPanel.js +409 -411
- package/dist/shared/components/panels/CommentPanel.js +169 -162
- package/dist/shared/components/panels/PipelinePanel.js +75 -75
- package/dist/shared/components/panels/RevisionsPanel.js +103 -103
- package/dist/shared/components/queue/QueueWorklist.js +142 -141
- package/dist/shared/lib/format-value.js +15 -15
- package/dist/shared/lib/utils.js +58 -53
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
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
|
|
4
|
-
import { useState as
|
|
3
|
+
import { Info as N } from "lucide-react";
|
|
4
|
+
import { useState as y, useRef as k, useEffect as _ } from "react";
|
|
5
5
|
import { useNivaroClient as m } from "../../context.js";
|
|
6
6
|
import { get as u } from "../../lib/commands.js";
|
|
7
|
-
import { formatDateTime as
|
|
8
|
-
function
|
|
7
|
+
import { toLocalDateString as f, formatDateTime as v } from "../../lib/utils.js";
|
|
8
|
+
function P(a, t, n) {
|
|
9
9
|
for (const r of [
|
|
10
10
|
["record-audience", t, n],
|
|
11
11
|
["erp-submissions", t, String(n)],
|
|
@@ -18,75 +18,75 @@ function B(a, t, n) {
|
|
|
18
18
|
])
|
|
19
19
|
a.invalidateQueries({ queryKey: r });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function U(a, t, n) {
|
|
22
22
|
a.invalidateQueries({ queryKey: ["item", t, n] }), a.invalidateQueries({
|
|
23
23
|
predicate: (r) => r.queryKey[0] === "o2m-rows" && String(r.queryKey[3]) === n
|
|
24
24
|
}), a.invalidateQueries({ queryKey: ["child-summary", t, n] }), a.invalidateQueries({ queryKey: ["last-touch", t, n] }), a.invalidateQueries({ queryKey: ["sla-breach", t, n] }), a.invalidateQueries({
|
|
25
25
|
predicate: (r) => (r.queryKey[0] === "item-actions" || r.queryKey[0] === "ext-item-actions") && r.queryKey[1] === t && String(r.queryKey[2]) === n
|
|
26
|
-
}),
|
|
26
|
+
}), q(a, t, n);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const $ = 4e3;
|
|
29
|
+
function q(a, t, n) {
|
|
30
30
|
var e;
|
|
31
31
|
const r = () => {
|
|
32
32
|
a.invalidateQueries({ queryKey: ["comments", t, n] }), a.invalidateQueries({ queryKey: ["comments-related", t, n] });
|
|
33
33
|
};
|
|
34
34
|
r();
|
|
35
|
-
const l = setTimeout(r,
|
|
35
|
+
const l = setTimeout(r, $);
|
|
36
36
|
(e = l.unref) == null || e.call(l);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function W({
|
|
39
39
|
collection: a,
|
|
40
40
|
itemId: t,
|
|
41
41
|
compact: n
|
|
42
42
|
}) {
|
|
43
|
-
const [r, l] =
|
|
44
|
-
return
|
|
43
|
+
const [r, l] = y(!1), [e, i] = y("audience"), c = k(null);
|
|
44
|
+
return _(() => {
|
|
45
45
|
if (!r) return;
|
|
46
|
-
const
|
|
46
|
+
const d = (x) => {
|
|
47
47
|
var h;
|
|
48
48
|
(h = c.current) != null && h.contains(x.target) || l(!1);
|
|
49
49
|
};
|
|
50
|
-
return document.addEventListener("mousedown",
|
|
51
|
-
}, [r]), /* @__PURE__ */
|
|
50
|
+
return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
|
|
51
|
+
}, [r]), /* @__PURE__ */ o("div", { ref: c, className: "relative", children: [
|
|
52
52
|
/* @__PURE__ */ s(
|
|
53
53
|
"button",
|
|
54
54
|
{
|
|
55
55
|
type: "button",
|
|
56
|
-
onClick: () => l((
|
|
56
|
+
onClick: () => l((d) => !d),
|
|
57
57
|
"data-tip": "Record insights — audience, integrations, owner history",
|
|
58
58
|
title: "Record insights",
|
|
59
59
|
"aria-label": "Record insights",
|
|
60
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",
|
|
61
|
-
children: /* @__PURE__ */ s(
|
|
61
|
+
children: /* @__PURE__ */ s(N, { className: n ? "h-4 w-4" : "h-3.5 w-3.5" })
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
r && /* @__PURE__ */
|
|
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: [
|
|
65
65
|
/* @__PURE__ */ s("div", { className: "mb-2 flex gap-1", children: [
|
|
66
66
|
["audience", "Audience"],
|
|
67
67
|
["integrations", "Integrations"],
|
|
68
68
|
["owners", "Owner history"],
|
|
69
69
|
["mail", "Mail"],
|
|
70
70
|
["chat", "Chat"]
|
|
71
|
-
].map(([
|
|
71
|
+
].map(([d, x]) => /* @__PURE__ */ s(
|
|
72
72
|
"button",
|
|
73
73
|
{
|
|
74
74
|
type: "button",
|
|
75
|
-
onClick: () => i(
|
|
76
|
-
className: e ===
|
|
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",
|
|
77
77
|
children: x
|
|
78
78
|
},
|
|
79
|
-
|
|
79
|
+
d
|
|
80
80
|
)) }),
|
|
81
81
|
e === "audience" && /* @__PURE__ */ s(L, { collection: a, itemId: t }),
|
|
82
|
-
e === "integrations" && /* @__PURE__ */ s(
|
|
83
|
-
e === "owners" && /* @__PURE__ */ s(
|
|
84
|
-
e === "mail" && /* @__PURE__ */ s(
|
|
85
|
-
e === "chat" && /* @__PURE__ */ s(
|
|
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 })
|
|
86
86
|
] })
|
|
87
87
|
] });
|
|
88
88
|
}
|
|
89
|
-
const
|
|
89
|
+
const T = {
|
|
90
90
|
all: "all changes",
|
|
91
91
|
create: "new records",
|
|
92
92
|
update: "updates",
|
|
@@ -101,22 +101,22 @@ function L({ collection: a, itemId: t }) {
|
|
|
101
101
|
});
|
|
102
102
|
if (l) return /* @__PURE__ */ s("p", { className: "text-[12px] text-slate-400", children: "Loading…" });
|
|
103
103
|
const e = (r == null ? void 0 : r.people) ?? [];
|
|
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__ */
|
|
105
|
-
/* @__PURE__ */
|
|
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: [
|
|
106
106
|
e.length,
|
|
107
107
|
" ",
|
|
108
108
|
e.length === 1 ? "person hears" : "people hear",
|
|
109
109
|
" about changes to this record"
|
|
110
110
|
] }),
|
|
111
|
-
e.map((i) => /* @__PURE__ */
|
|
111
|
+
e.map((i) => /* @__PURE__ */ o(
|
|
112
112
|
"div",
|
|
113
113
|
{
|
|
114
114
|
className: "border-t border-slate-100 py-1.5 first:border-t-0 dark:border-border/50",
|
|
115
115
|
children: [
|
|
116
116
|
/* @__PURE__ */ s("p", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: i.name }),
|
|
117
|
-
/* @__PURE__ */
|
|
117
|
+
/* @__PURE__ */ o("div", { className: "mt-0.5 flex flex-wrap gap-1", children: [
|
|
118
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" }),
|
|
119
|
-
i.watch_fields.length > 0 && /* @__PURE__ */
|
|
119
|
+
i.watch_fields.length > 0 && /* @__PURE__ */ o(
|
|
120
120
|
"span",
|
|
121
121
|
{
|
|
122
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",
|
|
@@ -129,12 +129,12 @@ function L({ collection: a, itemId: t }) {
|
|
|
129
129
|
]
|
|
130
130
|
}
|
|
131
131
|
),
|
|
132
|
-
i.subscriptions.map((c) => /* @__PURE__ */
|
|
132
|
+
i.subscriptions.map((c) => /* @__PURE__ */ o(
|
|
133
133
|
"span",
|
|
134
134
|
{
|
|
135
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",
|
|
136
136
|
children: [
|
|
137
|
-
c.reason ?? `Subscribed to ${
|
|
137
|
+
c.reason ?? `Subscribed to ${T[c.event_type] ?? c.event_type}`,
|
|
138
138
|
" ·",
|
|
139
139
|
" ",
|
|
140
140
|
c.cadence
|
|
@@ -149,91 +149,90 @@ function L({ collection: a, itemId: t }) {
|
|
|
149
149
|
))
|
|
150
150
|
] });
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function K({ collection: a, itemId: t }) {
|
|
153
153
|
const n = m(), { data: r = [], isLoading: l } = p({
|
|
154
154
|
queryKey: ["erp-submissions", a, String(t)],
|
|
155
155
|
queryFn: () => n.request(
|
|
156
156
|
u(`/erp-submissions/${a}/${encodeURIComponent(t)}`)
|
|
157
|
-
).then((
|
|
157
|
+
).then((d) => d.data ?? []).catch(() => []),
|
|
158
158
|
staleTime: 3e4
|
|
159
159
|
}), { data: e, isLoading: i } = p({
|
|
160
160
|
queryKey: ["record-integrations", a, t],
|
|
161
|
-
queryFn: () => n.request(u(`/record-integrations/${a}/${t}`)).then((
|
|
161
|
+
queryFn: () => n.request(u(`/record-integrations/${a}/${t}`)).then((d) => d.data),
|
|
162
162
|
staleTime: 3e4
|
|
163
163
|
}), { data: c = [] } = p({
|
|
164
164
|
queryKey: ["record-external-ids", a, t],
|
|
165
|
-
queryFn: () => n.request(u(`/items/${a}/${t}`)).then((
|
|
166
|
-
const x =
|
|
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
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);
|
|
168
168
|
}).catch(() => []),
|
|
169
169
|
staleTime: 6e4
|
|
170
170
|
});
|
|
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__ */
|
|
172
|
-
c.length > 0 && /* @__PURE__ */
|
|
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: [
|
|
173
173
|
/* @__PURE__ */ s("p", { className: "text-[10px] font-semibold uppercase tracking-wide text-slate-400", children: "External identifiers" }),
|
|
174
|
-
/* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap gap-1.5", children: c.map((
|
|
174
|
+
/* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap gap-1.5", children: c.map((d) => /* @__PURE__ */ o(
|
|
175
175
|
"span",
|
|
176
176
|
{
|
|
177
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",
|
|
178
178
|
children: [
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
-
|
|
179
|
+
/* @__PURE__ */ o("span", { className: "text-slate-400", children: [
|
|
180
|
+
d.field,
|
|
181
181
|
":"
|
|
182
182
|
] }),
|
|
183
|
-
/* @__PURE__ */ s("span", { className: "font-mono text-slate-700 dark:text-slate-200", children:
|
|
183
|
+
/* @__PURE__ */ s("span", { className: "font-mono text-slate-700 dark:text-slate-200", children: d.value })
|
|
184
184
|
]
|
|
185
185
|
},
|
|
186
|
-
|
|
186
|
+
d.field
|
|
187
187
|
)) })
|
|
188
188
|
] }),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
r.map((
|
|
191
|
-
/* @__PURE__ */ s("span", { className: "min-w-0 truncate text-slate-700 dark:text-slate-200", children:
|
|
192
|
-
/* @__PURE__ */
|
|
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(
|
|
193
193
|
"span",
|
|
194
194
|
{
|
|
195
|
-
className:
|
|
195
|
+
className: d.status === "failed" ? "shrink-0 text-red-500" : d.status === "accepted" ? "shrink-0 text-emerald-600" : "shrink-0 text-slate-400",
|
|
196
196
|
children: [
|
|
197
|
-
|
|
197
|
+
d.status,
|
|
198
198
|
" · ",
|
|
199
|
-
|
|
199
|
+
f(d.created_at)
|
|
200
200
|
]
|
|
201
201
|
}
|
|
202
202
|
)
|
|
203
|
-
] }, `e${
|
|
204
|
-
e == null ? void 0 : e.webhooks.map((
|
|
205
|
-
/* @__PURE__ */
|
|
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: [
|
|
206
206
|
"webhook: ",
|
|
207
|
-
|
|
207
|
+
d.webhook
|
|
208
208
|
] }),
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
|
|
209
|
+
/* @__PURE__ */ o("span", { className: "shrink-0 text-slate-400", children: [
|
|
210
|
+
d.response_status,
|
|
211
211
|
" · ",
|
|
212
|
-
|
|
212
|
+
f(d.created_at)
|
|
213
213
|
] })
|
|
214
|
-
] }, `w${
|
|
214
|
+
] }, `w${d.id}`))
|
|
215
215
|
] })
|
|
216
216
|
] });
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function S({ collection: a, itemId: t }) {
|
|
219
219
|
const n = m(), { data: r = [], isLoading: l } = p({
|
|
220
220
|
queryKey: ["record-owner-history", a, t],
|
|
221
221
|
queryFn: () => n.request(u(`/owner-history/${a}/${t}`)).then((e) => e.data),
|
|
222
222
|
staleTime: 3e4
|
|
223
223
|
});
|
|
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__ */
|
|
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: [
|
|
225
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." }),
|
|
226
226
|
r.map((e, i) => (
|
|
227
227
|
// biome-ignore lint/suspicious/noArrayIndexKey: ordered stays
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ o("div", { children: [
|
|
229
|
+
/* @__PURE__ */ o("p", { className: "font-medium text-slate-700 dark:text-slate-200", children: [
|
|
230
230
|
e.state_label ?? "—",
|
|
231
231
|
" ",
|
|
232
|
-
/* @__PURE__ */
|
|
233
|
-
|
|
234
|
-
" →",
|
|
235
|
-
|
|
236
|
-
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",
|
|
237
236
|
e.moved_by ? ` · moved by ${e.moved_by}` : ""
|
|
238
237
|
] })
|
|
239
238
|
] }),
|
|
@@ -242,7 +241,7 @@ function K({ collection: a, itemId: t }) {
|
|
|
242
241
|
))
|
|
243
242
|
] });
|
|
244
243
|
}
|
|
245
|
-
const
|
|
244
|
+
const R = {
|
|
246
245
|
sent: { label: "Sent", cls: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
|
|
247
246
|
failed: { label: "Failed", cls: "bg-red-500/10 text-red-600 dark:text-red-400" },
|
|
248
247
|
deferred: { label: "In daily digest", cls: "bg-amber-500/10 text-amber-600 dark:text-amber-400" },
|
|
@@ -251,27 +250,27 @@ const S = {
|
|
|
251
250
|
cls: "bg-slate-500/10 text-slate-500 dark:text-slate-400"
|
|
252
251
|
}
|
|
253
252
|
};
|
|
254
|
-
function
|
|
253
|
+
function j(a) {
|
|
255
254
|
const t = a.split(/[,;]/).map((r) => r.trim()).filter(Boolean);
|
|
256
255
|
return t.slice(0, 2).map((r) => r.split("@")[0]).join(", ") + (t.length > 2 ? ` +${t.length - 2}` : "");
|
|
257
256
|
}
|
|
258
|
-
function
|
|
257
|
+
function E({ collection: a, itemId: t }) {
|
|
259
258
|
const n = m(), { data: r = [], isLoading: l } = p({
|
|
260
259
|
queryKey: ["record-mail-log", a, t],
|
|
261
260
|
queryFn: () => n.request(u(`/mail-log/record/${a}/${t}`)).then((e) => e.data ?? []).catch(() => []),
|
|
262
261
|
staleTime: 3e4
|
|
263
262
|
});
|
|
264
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) => {
|
|
265
|
-
const i =
|
|
264
|
+
const i = R[e.status] ?? {
|
|
266
265
|
label: e.status,
|
|
267
266
|
cls: "bg-slate-500/10 text-slate-500"
|
|
268
267
|
};
|
|
269
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ o(
|
|
270
269
|
"div",
|
|
271
270
|
{
|
|
272
271
|
className: "border-t border-slate-100 py-2 first:border-t-0 dark:border-border/50",
|
|
273
272
|
children: [
|
|
274
|
-
/* @__PURE__ */
|
|
273
|
+
/* @__PURE__ */ o("div", { className: "flex items-start justify-between gap-2", children: [
|
|
275
274
|
/* @__PURE__ */ s(
|
|
276
275
|
"p",
|
|
277
276
|
{
|
|
@@ -288,13 +287,13 @@ function R({ collection: a, itemId: t }) {
|
|
|
288
287
|
}
|
|
289
288
|
)
|
|
290
289
|
] }),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
/* @__PURE__ */
|
|
290
|
+
/* @__PURE__ */ o("p", { className: "mt-0.5 text-[10.5px] text-slate-400", children: [
|
|
291
|
+
/* @__PURE__ */ o("span", { "data-tip": e.to, children: [
|
|
293
292
|
"to ",
|
|
294
|
-
|
|
293
|
+
j(e.to)
|
|
295
294
|
] }),
|
|
296
295
|
" · ",
|
|
297
|
-
/* @__PURE__ */ s("span", { "data-tip":
|
|
296
|
+
/* @__PURE__ */ s("span", { "data-tip": v(e.created_at), children: new Date(e.created_at).toLocaleDateString(void 0, {
|
|
298
297
|
month: "short",
|
|
299
298
|
day: "numeric"
|
|
300
299
|
}) })
|
|
@@ -313,7 +312,7 @@ function R({ collection: a, itemId: t }) {
|
|
|
313
312
|
);
|
|
314
313
|
}) });
|
|
315
314
|
}
|
|
316
|
-
function
|
|
315
|
+
function Q({ collection: a, itemId: t }) {
|
|
317
316
|
const n = m(), { data: r = [], isLoading: l } = p({
|
|
318
317
|
queryKey: ["record-chat-mentions", a, t],
|
|
319
318
|
queryFn: () => n.request(u(`/chat/record-mentions/${a}/${t}`)).then((i) => i.data ?? []).catch(() => []),
|
|
@@ -323,30 +322,30 @@ function j({ collection: a, itemId: t }) {
|
|
|
323
322
|
if (r.length === 0)
|
|
324
323
|
return /* @__PURE__ */ s("p", { className: "p-3 text-[12px] text-slate-400", children: "No chat messages mention this record outside its own room." });
|
|
325
324
|
const e = (i) => i === "global" ? "#global" : i.startsWith("ch:") ? `#${i.slice(3)}` : i.startsWith("dm:") ? "a direct message" : i;
|
|
326
|
-
return /* @__PURE__ */ s("div", { className: "max-h-72 overflow-y-auto", children: r.map((i) => /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ s("div", { className: "max-h-72 overflow-y-auto", children: r.map((i) => /* @__PURE__ */ o(
|
|
327
326
|
"div",
|
|
328
327
|
{
|
|
329
328
|
className: "border-b border-slate-100 px-3 py-1.5 last:border-b-0 dark:border-border/50",
|
|
330
329
|
children: [
|
|
331
|
-
/* @__PURE__ */
|
|
330
|
+
/* @__PURE__ */ o("p", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
332
331
|
/* @__PURE__ */ s("span", { className: "font-medium", children: i.sender_name ?? "Someone" }),
|
|
333
332
|
" ",
|
|
334
|
-
/* @__PURE__ */
|
|
333
|
+
/* @__PURE__ */ o("span", { className: "text-slate-400", children: [
|
|
335
334
|
"in ",
|
|
336
335
|
e(i.room)
|
|
337
336
|
] })
|
|
338
337
|
] }),
|
|
339
338
|
/* @__PURE__ */ s("p", { className: "truncate text-[11.5px] text-slate-500", children: i.message.slice(0, 160) }),
|
|
340
|
-
/* @__PURE__ */ s("p", { className: "text-[10px] text-slate-400", children:
|
|
339
|
+
/* @__PURE__ */ s("p", { className: "text-[10px] text-slate-400", children: v(i.date_created) })
|
|
341
340
|
]
|
|
342
341
|
},
|
|
343
342
|
i.id
|
|
344
343
|
)) });
|
|
345
344
|
}
|
|
346
345
|
export {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
346
|
+
$ as NOTES_SETTLE_MS,
|
|
347
|
+
W as RecordInsightsButton,
|
|
348
|
+
U as invalidateRecordData,
|
|
349
|
+
P as invalidateRecordInsights,
|
|
350
|
+
q as invalidateRecordNotes
|
|
352
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
|
|
4
|
-
import { useState as Z, useRef as
|
|
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
|
|
8
|
-
import { cn as v, titleCase as ee, toLocalDateString as
|
|
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
|
|
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
|
|
13
|
-
const
|
|
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
|
-
|
|
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
|
|
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 =
|
|
154
|
-
return /* @__PURE__ */ i(
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
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(
|
|
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
|
-
|
|
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 =
|
|
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:
|
|
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 =
|
|
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
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
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],
|
|
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
|
|
641
|
-
navigator.clipboard.writeText(
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
707
|
+
me,
|
|
708
708
|
{
|
|
709
709
|
relatedCollection: t.many_collection ?? "",
|
|
710
710
|
manyField: t.many_field,
|