@nivaro/react 0.3.49 → 0.3.51
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/components/InlineGridField.js +166 -105
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +38 -4
- package/dist/shared/components/ItemEditForm.js +5258 -5034
- package/dist/shared/components/QueryTable.js +489 -347
- package/dist/shared/components/ReportView.js +105 -99
- package/dist/shared/components/alerts/AlertManagerView.js +327 -301
- package/dist/shared/components/item-edit/CatalogPickerField.js +1230 -1175
- package/dist/shared/components/item-edit/CloneDialog.js +192 -142
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
- package/dist/shared/components/item-edit/FieldRenderer.js +249 -244
- package/dist/shared/components/item-edit/FieldRow.js +402 -370
- package/dist/shared/components/item-edit/FilePickerField.js +315 -307
- package/dist/shared/components/item-edit/InlineGridField.js +92 -90
- package/dist/shared/components/item-edit/InlineTableField.js +3119 -2951
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
- package/dist/shared/components/item-edit/PlanGrid.js +162 -162
- package/dist/shared/components/item-edit/PolishFields.js +169 -162
- package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
- package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
- package/dist/shared/components/item-edit/RelationCombobox.js +198 -191
- package/dist/shared/components/item-edit/SummaryPanel.js +282 -259
- package/dist/shared/components/item-edit/UserChip.js +233 -200
- package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
- package/dist/shared/components/item-edit/header-midair.js +51 -0
- package/dist/shared/components/item-edit/helpers.js +181 -155
- package/dist/shared/components/item-edit/line-midair.js +207 -0
- package/dist/shared/components/item-edit/soft-rules.js +27 -0
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/panels/CommentPanel.js +290 -284
- package/dist/shared/components/panels/ItemLockBanner.js +414 -358
- package/dist/shared/components/panels/PipelinePanel.js +1241 -992
- package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
- package/dist/shared/components/panels/TaskPanel.js +71 -61
- package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
- package/dist/shared/components/panels/requirement-side-effects.js +40 -0
- package/dist/shared/components/queue/QueueWorklist.js +925 -871
- package/dist/shared/components/queue/column-chooser.js +21 -0
- package/dist/shared/components/queue/live-state-aspect.js +6 -0
- package/dist/shared/components/ui/number-draft-input.js +93 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
- package/dist/shared/lib/draft-store.js +48 -34
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/query-stats.js +60 -60
- package/package.json +1 -1
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as s, jsx as e, Fragment as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { MessageSquare as
|
|
4
|
-
import { useState as N, useRef as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { toast as
|
|
7
|
-
import { useNivaroClient as oe, useItemEditAuth as
|
|
8
|
-
import { useDebounced as
|
|
9
|
-
import { get as W, post as B, patch as
|
|
10
|
-
import { usePresenceOnlinePoll as
|
|
11
|
-
import { useRecordSignalPeers as
|
|
12
|
-
import { invalidateRecordTasks as
|
|
13
|
-
import { formatRelative as le, titleCase as
|
|
14
|
-
import { AgentBadge as
|
|
1
|
+
import { jsxs as s, jsx as e, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as ge, useQuery as z, useMutation as L } from "@tanstack/react-query";
|
|
3
|
+
import { MessageSquare as qe, ChevronDown as De, ClipboardPlus as Pe, Pencil as Te, Trash2 as Fe, Check as Re, X as Me, SmilePlus as ye } from "lucide-react";
|
|
4
|
+
import { useState as N, useRef as U, useEffect as Q, useMemo as V } from "react";
|
|
5
|
+
import { createPortal as Ie } from "react-dom";
|
|
6
|
+
import { toast as I } from "sonner";
|
|
7
|
+
import { useNivaroClient as oe, useItemEditAuth as je, useDrilldown as Oe } from "../../context.js";
|
|
8
|
+
import { useDebounced as Le } from "../../hooks/useDebounced.js";
|
|
9
|
+
import { get as W, post as B, patch as Ae, del as Ke } from "../../lib/commands.js";
|
|
10
|
+
import { usePresenceOnlinePoll as Be } from "../../lib/presence-live.js";
|
|
11
|
+
import { useRecordSignalPeers as Qe, useRecordSignalSender as ze, signalSentence as Ue } from "../../lib/presence-signals.js";
|
|
12
|
+
import { invalidateRecordTasks as We } from "../../lib/record-tasks.js";
|
|
13
|
+
import { formatRelative as le, titleCase as Ge } from "../../lib/utils.js";
|
|
14
|
+
import { AgentBadge as He } from "../AgentBadge.js";
|
|
15
15
|
import { AutolinkedText as se } from "../AutolinkedText.js";
|
|
16
|
-
import { InboundRequestPopover as
|
|
17
|
-
import { useFieldComments as
|
|
18
|
-
import { UserAvatar as
|
|
19
|
-
import { Avatar as
|
|
20
|
-
import { Button as
|
|
21
|
-
import { Separator as
|
|
22
|
-
import { Textarea as
|
|
23
|
-
import { RecordEventPathSheet as
|
|
24
|
-
const
|
|
25
|
-
function
|
|
16
|
+
import { InboundRequestPopover as Xe } from "../integrations/InboundRequest.js";
|
|
17
|
+
import { useFieldComments as Je } from "../item-edit/field-comments-context.js";
|
|
18
|
+
import { UserAvatar as Ve } from "../UserAvatar.js";
|
|
19
|
+
import { Avatar as Ze, AvatarFallback as Ye } from "../ui/avatar.js";
|
|
20
|
+
import { Button as Z } from "../ui/button.js";
|
|
21
|
+
import { Separator as he } from "../ui/separator.js";
|
|
22
|
+
import { Textarea as et } from "../ui/textarea.js";
|
|
23
|
+
import { RecordEventPathSheet as tt } from "./IntegrationActivitySection.js";
|
|
24
|
+
const ve = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
|
|
25
|
+
function nt(t) {
|
|
26
26
|
var d, c, h, m;
|
|
27
27
|
return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (h = t.email) == null ? void 0 : h[0]) == null ? void 0 : m.toUpperCase()) || "?";
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function rt({ comment: t }) {
|
|
30
30
|
const i = (t.mentions ?? []).filter(
|
|
31
31
|
(d) => {
|
|
32
32
|
var c;
|
|
@@ -58,16 +58,16 @@ function tt({ comment: t }) {
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function re(t) {
|
|
62
62
|
return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function at({
|
|
65
65
|
field: t,
|
|
66
66
|
label: i,
|
|
67
67
|
resolved: d,
|
|
68
68
|
onJump: c
|
|
69
69
|
}) {
|
|
70
|
-
const h = /* @__PURE__ */ s(
|
|
70
|
+
const h = /* @__PURE__ */ s(Y, { children: [
|
|
71
71
|
"on ",
|
|
72
72
|
/* @__PURE__ */ e("span", { className: "font-medium", children: i }),
|
|
73
73
|
d && /* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: " · resolved" })
|
|
@@ -84,124 +84,124 @@ function nt({
|
|
|
84
84
|
}
|
|
85
85
|
) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children: h });
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function st(t, i) {
|
|
88
88
|
const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
|
|
89
89
|
return c ? { start: i - c[2].length - 1, query: c[2] } : null;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function be(t) {
|
|
92
92
|
return t.email.split("@")[0];
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function ae({
|
|
95
95
|
value: t,
|
|
96
96
|
onChange: i,
|
|
97
97
|
...d
|
|
98
98
|
}) {
|
|
99
|
-
const c = oe(), h =
|
|
99
|
+
const c = oe(), h = U(null), [m, C] = N(null), [y, w] = N(0), v = Le((m == null ? void 0 : m.query) ?? "", 200), { data: q = [] } = z({
|
|
100
100
|
queryKey: ["users", "mention-search", v],
|
|
101
101
|
queryFn: () => c.request(
|
|
102
102
|
W("/users", { limit: 8, sort: "first_name", search: v })
|
|
103
103
|
).then((n) => n.data),
|
|
104
104
|
enabled: !!m && v.length >= 2,
|
|
105
105
|
staleTime: 3e4
|
|
106
|
-
}),
|
|
106
|
+
}), R = Be(15e3, !!m), { data: D } = z({
|
|
107
107
|
queryKey: ["presence-online"],
|
|
108
108
|
queryFn: () => c.request(
|
|
109
109
|
W("/presence/online")
|
|
110
110
|
),
|
|
111
111
|
enabled: !!m,
|
|
112
|
-
refetchInterval:
|
|
112
|
+
refetchInterval: R,
|
|
113
113
|
staleTime: 5e3
|
|
114
|
-
}),
|
|
115
|
-
var
|
|
116
|
-
const l = (
|
|
114
|
+
}), _ = (n) => {
|
|
115
|
+
var p;
|
|
116
|
+
const l = (p = D == null ? void 0 : D.data) == null ? void 0 : p.find((b) => String(b.user_id).toUpperCase() === n.toUpperCase());
|
|
117
117
|
return l ? l.is_idle || l.away ? 1 : 0 : 2;
|
|
118
|
-
},
|
|
118
|
+
}, u = [...q].sort((n, l) => _(n.id) - _(l.id)), { data: P = [] } = z({
|
|
119
119
|
queryKey: ["mention-roles"],
|
|
120
120
|
queryFn: () => c.request(W("/chat/roles")).then((n) => n.data).catch(() => []),
|
|
121
121
|
enabled: !!m,
|
|
122
122
|
staleTime: 5 * 6e4
|
|
123
|
-
}),
|
|
123
|
+
}), S = m ? P.filter(
|
|
124
124
|
(n) => n.name.toLowerCase().replace(/\s+/g, "-").startsWith(v.toLowerCase())
|
|
125
|
-
).slice(0, 3) : [],
|
|
126
|
-
|
|
127
|
-
if (!
|
|
128
|
-
|
|
125
|
+
).slice(0, 3) : [], k = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), T = !!m && v.length >= 2 && (u.length > 0 || k || S.length > 0), o = u.length + (k ? 1 : 0) + S.length, [f, $] = N(null), O = U(null);
|
|
126
|
+
Q(() => {
|
|
127
|
+
if (!T || !h.current) {
|
|
128
|
+
$(null);
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
const n = h.current.getBoundingClientRect();
|
|
132
|
-
|
|
133
|
-
const l = (
|
|
134
|
-
var
|
|
135
|
-
(
|
|
136
|
-
},
|
|
137
|
-
return window.addEventListener("scroll", l, !0), window.addEventListener("resize",
|
|
138
|
-
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize",
|
|
132
|
+
$({ top: n.bottom + 4, left: n.left, width: Math.min(n.width, 360) });
|
|
133
|
+
const l = (b) => {
|
|
134
|
+
var g;
|
|
135
|
+
(g = O.current) != null && g.contains(b.target) || C(null);
|
|
136
|
+
}, p = () => C(null);
|
|
137
|
+
return window.addEventListener("scroll", l, !0), window.addEventListener("resize", p), () => {
|
|
138
|
+
window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", p);
|
|
139
139
|
};
|
|
140
|
-
}, [
|
|
141
|
-
function
|
|
142
|
-
const l =
|
|
143
|
-
|
|
140
|
+
}, [T]);
|
|
141
|
+
function G(n) {
|
|
142
|
+
const l = st(n.value, n.selectionStart ?? n.value.length);
|
|
143
|
+
C(l), l || w(0);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function F(n) {
|
|
146
146
|
if (!m || !h.current) return;
|
|
147
|
-
const l = h.current.selectionStart ?? t.length,
|
|
148
|
-
i(
|
|
149
|
-
const
|
|
147
|
+
const l = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${be(n)} `, b = t.slice(0, m.start) + p + t.slice(l);
|
|
148
|
+
i(b), C(null), w(0);
|
|
149
|
+
const g = m.start + p.length;
|
|
150
150
|
requestAnimationFrame(() => {
|
|
151
|
-
var j,
|
|
152
|
-
(j = h.current) == null || j.focus(), (
|
|
151
|
+
var j, A;
|
|
152
|
+
(j = h.current) == null || j.focus(), (A = h.current) == null || A.setSelectionRange(g, g);
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
function
|
|
156
|
-
if (
|
|
155
|
+
function H(n) {
|
|
156
|
+
if (T)
|
|
157
157
|
if (n.key === "ArrowDown")
|
|
158
|
-
n.preventDefault(),
|
|
158
|
+
n.preventDefault(), w((l) => (l + 1) % o);
|
|
159
159
|
else if (n.key === "ArrowUp")
|
|
160
|
-
n.preventDefault(),
|
|
160
|
+
n.preventDefault(), w((l) => (l - 1 + o) % o);
|
|
161
161
|
else if (n.key === "Enter" || n.key === "Tab") {
|
|
162
162
|
n.preventDefault();
|
|
163
|
-
const l = Math.min(
|
|
164
|
-
if (
|
|
165
|
-
else if (l >=
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
} else
|
|
169
|
-
} else n.key === "Escape" && (n.preventDefault(),
|
|
163
|
+
const l = Math.min(y, o - 1), p = k ? 1 : 0, b = p + u.length;
|
|
164
|
+
if (k && l === 0) F("__owners__");
|
|
165
|
+
else if (l >= b) {
|
|
166
|
+
const g = S[l - b];
|
|
167
|
+
g && F({ role: g.name });
|
|
168
|
+
} else F(u[l - p]);
|
|
169
|
+
} else n.key === "Escape" && (n.preventDefault(), C(null));
|
|
170
170
|
}
|
|
171
171
|
return /* @__PURE__ */ s("div", { className: "relative", children: [
|
|
172
172
|
/* @__PURE__ */ e(
|
|
173
|
-
|
|
173
|
+
et,
|
|
174
174
|
{
|
|
175
175
|
...d,
|
|
176
176
|
ref: h,
|
|
177
177
|
value: t,
|
|
178
178
|
onChange: (n) => {
|
|
179
|
-
i(n.target.value),
|
|
179
|
+
i(n.target.value), G(n.target);
|
|
180
180
|
},
|
|
181
|
-
onKeyDown:
|
|
182
|
-
onClick: (n) =>
|
|
183
|
-
onBlur: () => setTimeout(() =>
|
|
181
|
+
onKeyDown: H,
|
|
182
|
+
onClick: (n) => G(n.currentTarget),
|
|
183
|
+
onBlur: () => setTimeout(() => C(null), 150)
|
|
184
184
|
}
|
|
185
185
|
),
|
|
186
|
-
|
|
186
|
+
T && f && Ie(
|
|
187
187
|
/* @__PURE__ */ s(
|
|
188
188
|
"div",
|
|
189
189
|
{
|
|
190
|
-
ref:
|
|
190
|
+
ref: O,
|
|
191
191
|
"data-mention-menu": "",
|
|
192
192
|
className: "fixed z-[110] max-h-60 overflow-y-auto rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-popover",
|
|
193
|
-
style: { top:
|
|
193
|
+
style: { top: f.top, left: f.left, width: f.width },
|
|
194
194
|
onMouseDown: (n) => n.preventDefault(),
|
|
195
195
|
children: [
|
|
196
|
-
|
|
196
|
+
k && /* @__PURE__ */ s(
|
|
197
197
|
"button",
|
|
198
198
|
{
|
|
199
199
|
type: "button",
|
|
200
200
|
onMouseDown: (n) => {
|
|
201
|
-
n.preventDefault(),
|
|
201
|
+
n.preventDefault(), F("__owners__");
|
|
202
202
|
},
|
|
203
|
-
onMouseEnter: () =>
|
|
204
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${
|
|
203
|
+
onMouseEnter: () => w(0),
|
|
204
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${y === 0 ? "bg-nvr-cyan/10" : ""}`,
|
|
205
205
|
children: [
|
|
206
206
|
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: "★" }),
|
|
207
207
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -211,39 +211,39 @@ function re({
|
|
|
211
211
|
]
|
|
212
212
|
}
|
|
213
213
|
),
|
|
214
|
-
|
|
215
|
-
var
|
|
216
|
-
const
|
|
214
|
+
u.map((n, l) => {
|
|
215
|
+
var g, j;
|
|
216
|
+
const p = k ? l + 1 : l, b = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
|
|
217
217
|
return /* @__PURE__ */ s(
|
|
218
218
|
"button",
|
|
219
219
|
{
|
|
220
220
|
type: "button",
|
|
221
|
-
onMouseDown: (
|
|
222
|
-
|
|
221
|
+
onMouseDown: (A) => {
|
|
222
|
+
A.preventDefault(), F(n);
|
|
223
223
|
},
|
|
224
|
-
onMouseEnter: () =>
|
|
225
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${
|
|
224
|
+
onMouseEnter: () => w(p),
|
|
225
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
|
|
226
226
|
children: [
|
|
227
227
|
/* @__PURE__ */ s("span", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: [
|
|
228
|
-
(`${((
|
|
229
|
-
|
|
228
|
+
(`${((g = n.first_name) == null ? void 0 : g[0]) ?? ""}${((j = n.last_name) == null ? void 0 : j[0]) ?? ""}`.trim() || n.email[0]).toUpperCase(),
|
|
229
|
+
_(n.id) < 2 && /* @__PURE__ */ e(
|
|
230
230
|
"span",
|
|
231
231
|
{
|
|
232
|
-
"data-mention-presence":
|
|
233
|
-
title:
|
|
234
|
-
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${
|
|
232
|
+
"data-mention-presence": _(n.id) === 0 ? "online" : "idle",
|
|
233
|
+
title: _(n.id) === 0 ? "Online" : "Idle",
|
|
234
|
+
className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${_(n.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
|
|
235
235
|
}
|
|
236
236
|
)
|
|
237
237
|
] }),
|
|
238
238
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
239
|
-
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children:
|
|
239
|
+
/* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: b }),
|
|
240
240
|
/* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-slate-400", children: [
|
|
241
241
|
n.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
|
|
242
242
|
"OOO",
|
|
243
243
|
n.ooo_end ? ` until ${String(n.ooo_end).slice(0, 10)}` : ""
|
|
244
244
|
] }),
|
|
245
245
|
"@",
|
|
246
|
-
|
|
246
|
+
be(n),
|
|
247
247
|
(n.title || n.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
|
|
248
248
|
" · ",
|
|
249
249
|
[n.title, n.department].filter(Boolean).join(", ")
|
|
@@ -255,17 +255,17 @@ function re({
|
|
|
255
255
|
n.id
|
|
256
256
|
);
|
|
257
257
|
}),
|
|
258
|
-
|
|
259
|
-
const
|
|
258
|
+
S.map((n, l) => {
|
|
259
|
+
const p = u.length + (k ? 1 : 0) + l;
|
|
260
260
|
return /* @__PURE__ */ s(
|
|
261
261
|
"button",
|
|
262
262
|
{
|
|
263
263
|
type: "button",
|
|
264
|
-
onMouseDown: (
|
|
265
|
-
|
|
264
|
+
onMouseDown: (b) => {
|
|
265
|
+
b.preventDefault(), F({ role: n.name });
|
|
266
266
|
},
|
|
267
|
-
onMouseEnter: () =>
|
|
268
|
-
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${
|
|
267
|
+
onMouseEnter: () => w(p),
|
|
268
|
+
className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
|
|
269
269
|
children: [
|
|
270
270
|
/* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15 text-[10px] font-semibold text-violet-600 dark:text-violet-300", children: "R" }),
|
|
271
271
|
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -284,7 +284,7 @@ function re({
|
|
|
284
284
|
)
|
|
285
285
|
] });
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function fe(t) {
|
|
288
288
|
if (t.kind === "comment") return "people";
|
|
289
289
|
switch (t.note.source) {
|
|
290
290
|
case "note":
|
|
@@ -296,81 +296,81 @@ function be(t) {
|
|
|
296
296
|
return "system";
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const ot = {
|
|
300
300
|
people: "People",
|
|
301
301
|
system: "System",
|
|
302
302
|
integration: "Integration"
|
|
303
|
-
},
|
|
304
|
-
function
|
|
303
|
+
}, lt = "integrations:";
|
|
304
|
+
function it({
|
|
305
305
|
note: t,
|
|
306
306
|
collection: i,
|
|
307
307
|
item: d
|
|
308
308
|
}) {
|
|
309
|
-
var
|
|
310
|
-
const c =
|
|
311
|
-
mutationFn: (o) =>
|
|
309
|
+
var T;
|
|
310
|
+
const c = Oe(), [h, m] = N(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(lt), y = oe(), w = ge(), [v, q] = N(!1), R = L({
|
|
311
|
+
mutationFn: (o) => y.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
|
|
312
312
|
onSuccess: () => {
|
|
313
|
-
|
|
313
|
+
q(!1), w.invalidateQueries({ queryKey: ["comments-related"] }), w.invalidateQueries({ queryKey: ["row-comment-counts"] });
|
|
314
314
|
},
|
|
315
|
-
onError: () =>
|
|
316
|
-
}), [
|
|
317
|
-
mutationFn: () =>
|
|
315
|
+
onError: () => I.error("Failed to react")
|
|
316
|
+
}), [D, _] = N(!1), u = L({
|
|
317
|
+
mutationFn: () => y.request(
|
|
318
318
|
B(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
|
|
319
319
|
entry_id: t.id.replace(/^external:/, "")
|
|
320
320
|
})
|
|
321
321
|
),
|
|
322
322
|
onSuccess: (o) => {
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
description: (
|
|
326
|
-
}),
|
|
323
|
+
var f;
|
|
324
|
+
_(!1), I.success("Event replayed", {
|
|
325
|
+
description: (f = o == null ? void 0 : o.data) == null ? void 0 : f.detail
|
|
326
|
+
}), w.invalidateQueries({ queryKey: ["comments-related"] });
|
|
327
327
|
},
|
|
328
328
|
onError: (o) => {
|
|
329
|
-
var
|
|
330
|
-
|
|
331
|
-
const
|
|
332
|
-
|
|
329
|
+
var $;
|
|
330
|
+
_(!1);
|
|
331
|
+
const f = ($ = o == null ? void 0 : o.response) == null ? void 0 : $.error;
|
|
332
|
+
I.error(f ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
|
|
333
333
|
}
|
|
334
|
-
}),
|
|
334
|
+
}), P = t.link ? () => {
|
|
335
335
|
const o = t.link;
|
|
336
336
|
if (!o) return;
|
|
337
|
-
const
|
|
338
|
-
if (
|
|
339
|
-
|
|
337
|
+
const f = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
|
|
338
|
+
if (f) {
|
|
339
|
+
f.scrollIntoView({ behavior: "smooth", block: "center" }), f.classList.add("nvr-row-flash"), setTimeout(() => f.classList.remove("nvr-row-flash"), 2400);
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
c == null || c.open({ collection: o.collection, itemId: o.item_id });
|
|
343
|
-
} : null,
|
|
343
|
+
} : null, S = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", k = t.source === "import" && ((T = t.import) != null && T.file_id) ? t.import : null;
|
|
344
344
|
return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
|
|
345
345
|
/* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
|
|
346
346
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
347
347
|
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
348
|
-
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${
|
|
348
|
+
/* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${S}`, children: t.label }),
|
|
349
349
|
t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
|
|
350
|
-
t.context && (
|
|
350
|
+
t.context && (P ? /* @__PURE__ */ e(
|
|
351
351
|
"button",
|
|
352
352
|
{
|
|
353
353
|
type: "button",
|
|
354
|
-
onClick:
|
|
354
|
+
onClick: P,
|
|
355
355
|
className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
356
356
|
"data-line-comment-link": !0,
|
|
357
357
|
children: t.context
|
|
358
358
|
}
|
|
359
|
-
) :
|
|
359
|
+
) : k ? /* @__PURE__ */ e(
|
|
360
360
|
"a",
|
|
361
361
|
{
|
|
362
|
-
href: `/api/files/${
|
|
362
|
+
href: `/api/files/${k.file_id}?download=1`,
|
|
363
363
|
target: "_blank",
|
|
364
364
|
rel: "noreferrer",
|
|
365
365
|
onClick: (o) => o.stopPropagation(),
|
|
366
366
|
className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
|
|
367
|
-
"data-note-import-file":
|
|
367
|
+
"data-note-import-file": k.file_id ?? void 0,
|
|
368
368
|
children: t.context
|
|
369
369
|
}
|
|
370
370
|
) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
|
|
371
371
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(t.created_at) }),
|
|
372
372
|
t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
|
|
373
|
-
|
|
373
|
+
Xe,
|
|
374
374
|
{
|
|
375
375
|
activityId: t.inbound.activity_id,
|
|
376
376
|
callerName: t.label,
|
|
@@ -390,7 +390,7 @@ function ot({
|
|
|
390
390
|
}
|
|
391
391
|
),
|
|
392
392
|
t.source === "external" && t.status === "error" && /* @__PURE__ */ e("span", { className: "rounded bg-red-50 px-1 text-[10px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400", children: "error" }),
|
|
393
|
-
|
|
393
|
+
C && /* @__PURE__ */ e(
|
|
394
394
|
"button",
|
|
395
395
|
{
|
|
396
396
|
type: "button",
|
|
@@ -405,13 +405,13 @@ function ot({
|
|
|
405
405
|
"button",
|
|
406
406
|
{
|
|
407
407
|
type: "button",
|
|
408
|
-
onClick: () =>
|
|
409
|
-
onBlur: () =>
|
|
410
|
-
disabled:
|
|
408
|
+
onClick: () => D ? u.mutate() : _(!0),
|
|
409
|
+
onBlur: () => _(!1),
|
|
410
|
+
disabled: u.isPending,
|
|
411
411
|
"data-note-replay": t.id,
|
|
412
|
-
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${
|
|
412
|
+
className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${D ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
|
|
413
413
|
"data-tip": "Re-apply this event from its stored payload",
|
|
414
|
-
children:
|
|
414
|
+
children: u.isPending ? "Replaying…" : D ? "Replay this event?" : "Replay"
|
|
415
415
|
}
|
|
416
416
|
)
|
|
417
417
|
] }),
|
|
@@ -421,7 +421,7 @@ function ot({
|
|
|
421
421
|
"button",
|
|
422
422
|
{
|
|
423
423
|
type: "button",
|
|
424
|
-
onClick: () =>
|
|
424
|
+
onClick: () => R.mutate(o.emoji),
|
|
425
425
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${o.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
|
|
426
426
|
children: [
|
|
427
427
|
o.emoji,
|
|
@@ -435,17 +435,17 @@ function ot({
|
|
|
435
435
|
"button",
|
|
436
436
|
{
|
|
437
437
|
type: "button",
|
|
438
|
-
onClick: () =>
|
|
438
|
+
onClick: () => q((o) => !o),
|
|
439
439
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
440
440
|
"aria-label": "Add reaction",
|
|
441
|
-
children: /* @__PURE__ */ e(
|
|
441
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
442
442
|
}
|
|
443
443
|
),
|
|
444
|
-
v && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children:
|
|
444
|
+
v && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: ve.map((o) => /* @__PURE__ */ e(
|
|
445
445
|
"button",
|
|
446
446
|
{
|
|
447
447
|
type: "button",
|
|
448
|
-
onClick: () =>
|
|
448
|
+
onClick: () => R.mutate(o),
|
|
449
449
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
450
450
|
children: o
|
|
451
451
|
},
|
|
@@ -454,8 +454,8 @@ function ot({
|
|
|
454
454
|
] })
|
|
455
455
|
] })
|
|
456
456
|
] }),
|
|
457
|
-
|
|
458
|
-
|
|
457
|
+
C && t.provider && /* @__PURE__ */ e(
|
|
458
|
+
tt,
|
|
459
459
|
{
|
|
460
460
|
target: h ? {
|
|
461
461
|
source: t.provider,
|
|
@@ -468,99 +468,105 @@ function ot({
|
|
|
468
468
|
)
|
|
469
469
|
] });
|
|
470
470
|
}
|
|
471
|
-
function
|
|
471
|
+
function Tt({
|
|
472
472
|
collection: t,
|
|
473
473
|
item: i,
|
|
474
474
|
title: d,
|
|
475
475
|
defaultExpanded: c,
|
|
476
476
|
queuedComments: h,
|
|
477
|
-
onQueueComment: m
|
|
477
|
+
onQueueComment: m,
|
|
478
|
+
onUnsentDraft: C
|
|
478
479
|
}) {
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
const y = oe(), { userId: w } = je(), v = ge(), q = Je(), [R, D] = N(!1), _ = U(!1);
|
|
481
|
+
Q(() => {
|
|
482
|
+
!_.current && c !== void 0 && (_.current = !0, D(c));
|
|
482
483
|
}, [c]);
|
|
483
|
-
const [
|
|
484
|
+
const [u, P] = N(""), S = U(C);
|
|
485
|
+
S.current = C, Q(() => {
|
|
486
|
+
var r;
|
|
487
|
+
(r = S.current) == null || r.call(S, u);
|
|
488
|
+
}, [u]);
|
|
489
|
+
const [k, T] = N(!1), o = async () => {
|
|
484
490
|
var r;
|
|
485
|
-
if (!(!
|
|
486
|
-
|
|
491
|
+
if (!(!u.trim() || k)) {
|
|
492
|
+
T(!0);
|
|
487
493
|
try {
|
|
488
|
-
const a = await
|
|
489
|
-
B("/ai/cleanup", { text:
|
|
494
|
+
const a = await y.request(
|
|
495
|
+
B("/ai/cleanup", { text: u })
|
|
490
496
|
);
|
|
491
|
-
(r = a.data) != null && r.text &&
|
|
497
|
+
(r = a.data) != null && r.text && P(a.data.text);
|
|
492
498
|
} catch {
|
|
493
499
|
} finally {
|
|
494
|
-
|
|
500
|
+
T(!1);
|
|
495
501
|
}
|
|
496
502
|
}
|
|
497
|
-
},
|
|
498
|
-
|
|
499
|
-
if (!
|
|
500
|
-
|
|
503
|
+
}, f = Qe(t, i, "note"), $ = ze(t, i, "note"), O = U(0);
|
|
504
|
+
Q(() => {
|
|
505
|
+
if (!u.trim()) {
|
|
506
|
+
O.current && $("stop"), O.current = 0;
|
|
501
507
|
return;
|
|
502
508
|
}
|
|
503
509
|
const r = Date.now();
|
|
504
|
-
r -
|
|
505
|
-
}, [
|
|
506
|
-
const [
|
|
507
|
-
queryKey:
|
|
508
|
-
queryFn: () =>
|
|
509
|
-
enabled: !
|
|
510
|
-
}),
|
|
510
|
+
r - O.current < 2500 || (O.current = r, $("start"));
|
|
511
|
+
}, [u, $]), Q(() => () => $("stop"), [$]);
|
|
512
|
+
const [G, F] = N(null), [H, n] = N(null), [l, p] = N(""), b = !i || i === "new", g = ["comments", t, String(i)], { data: j, isLoading: A, isError: ke } = z({
|
|
513
|
+
queryKey: g,
|
|
514
|
+
queryFn: () => y.request(W("/comments", { collection: t, item: i })).then((r) => r.data),
|
|
515
|
+
enabled: !b
|
|
516
|
+
}), ie = V(() => (j ?? []).filter((r) => !r.deleted), [j]), { data: Ne } = z({
|
|
511
517
|
queryKey: ["comments-related", t, String(i)],
|
|
512
|
-
queryFn: () =>
|
|
513
|
-
enabled: !
|
|
518
|
+
queryFn: () => y.request(W("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
|
|
519
|
+
enabled: !b,
|
|
514
520
|
staleTime: 3e4
|
|
515
|
-
}),
|
|
516
|
-
const r =
|
|
521
|
+
}), de = Ne ?? [], E = V(() => {
|
|
522
|
+
const r = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), a = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
|
|
517
523
|
return [...r, ...a].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
|
|
518
|
-
}, [
|
|
524
|
+
}, [ie, de]), [X, we] = N(() => /* @__PURE__ */ new Set()), [J, _e] = N(""), Ce = V(() => {
|
|
519
525
|
const r = { people: 0, system: 0, integration: 0 };
|
|
520
|
-
for (const a of
|
|
526
|
+
for (const a of E) r[fe(a)]++;
|
|
521
527
|
return r;
|
|
522
|
-
}, [
|
|
523
|
-
const r =
|
|
524
|
-
return
|
|
525
|
-
}, [
|
|
528
|
+
}, [E]), ee = V(() => {
|
|
529
|
+
const r = J.trim().toLowerCase();
|
|
530
|
+
return E.filter((a) => X.has(fe(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);
|
|
531
|
+
}, [E, X, J]), Se = (r) => we((a) => {
|
|
526
532
|
const x = new Set(a);
|
|
527
533
|
return x.has(r) ? x.delete(r) : x.add(r), x;
|
|
528
|
-
}),
|
|
529
|
-
mutationFn: (r) =>
|
|
534
|
+
}), $e = X.size > 0 || J.trim() !== "", te = L({
|
|
535
|
+
mutationFn: (r) => y.request(B("/comments", { collection: t, item: i, text: r })),
|
|
530
536
|
onSuccess: () => {
|
|
531
|
-
|
|
537
|
+
v.invalidateQueries({ queryKey: g }), P("");
|
|
532
538
|
},
|
|
533
|
-
onError: () =>
|
|
534
|
-
}),
|
|
535
|
-
mutationFn: ({ id: r, text: a }) =>
|
|
539
|
+
onError: () => I.error("Failed to post comment")
|
|
540
|
+
}), ce = L({
|
|
541
|
+
mutationFn: ({ id: r, text: a }) => y.request(Ae(`/comments/${r}`, { text: a })),
|
|
536
542
|
onSuccess: () => {
|
|
537
|
-
|
|
543
|
+
v.invalidateQueries({ queryKey: g }), F(null), p("");
|
|
538
544
|
},
|
|
539
|
-
onError: () =>
|
|
545
|
+
onError: () => I.error("Failed to update comment")
|
|
540
546
|
}), ne = L({
|
|
541
|
-
mutationFn: (r) =>
|
|
542
|
-
onSuccess: () =>
|
|
543
|
-
onError: () =>
|
|
544
|
-
}),
|
|
545
|
-
mutationFn: ({ id: r, emoji: a }) =>
|
|
546
|
-
onSuccess: () =>
|
|
547
|
-
onError: () =>
|
|
548
|
-
}), [
|
|
549
|
-
mutationFn: (r) =>
|
|
547
|
+
mutationFn: (r) => y.request(Ke(`/comments/${r}`)),
|
|
548
|
+
onSuccess: () => v.invalidateQueries({ queryKey: g }),
|
|
549
|
+
onError: () => I.error("Failed to delete comment")
|
|
550
|
+
}), me = L({
|
|
551
|
+
mutationFn: ({ id: r, emoji: a }) => y.request(B(`/comments/${r}/reactions`, { emoji: a })),
|
|
552
|
+
onSuccess: () => v.invalidateQueries({ queryKey: g }),
|
|
553
|
+
onError: () => I.error("Failed to react")
|
|
554
|
+
}), [ue, pe] = N(null), Ee = L({
|
|
555
|
+
mutationFn: (r) => y.request(
|
|
550
556
|
B("/tasks", {
|
|
551
557
|
collection: t,
|
|
552
558
|
item: i,
|
|
553
559
|
title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
|
|
554
|
-
assignee:
|
|
560
|
+
assignee: w
|
|
555
561
|
})
|
|
556
562
|
),
|
|
557
563
|
onSuccess: () => {
|
|
558
|
-
|
|
564
|
+
We(v, t, i), I.success("Task created from comment — assigned to you");
|
|
559
565
|
},
|
|
560
|
-
onError: () =>
|
|
566
|
+
onError: () => I.error("Could not create a task")
|
|
561
567
|
});
|
|
562
|
-
function
|
|
563
|
-
r.preventDefault(),
|
|
568
|
+
function xe(r) {
|
|
569
|
+
r.preventDefault(), u.trim() && (b && m ? (m(u.trim()), P("")) : te.mutate(u.trim()));
|
|
564
570
|
}
|
|
565
571
|
return (
|
|
566
572
|
// Addressable from elsewhere (the summary panel jumps here), which needs
|
|
@@ -569,7 +575,7 @@ function Dt({
|
|
|
569
575
|
"div",
|
|
570
576
|
{
|
|
571
577
|
"data-panel": "notes",
|
|
572
|
-
"data-panel-expanded":
|
|
578
|
+
"data-panel-expanded": R ? "true" : "false",
|
|
573
579
|
className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
|
|
574
580
|
children: [
|
|
575
581
|
/* @__PURE__ */ s(
|
|
@@ -577,22 +583,22 @@ function Dt({
|
|
|
577
583
|
{
|
|
578
584
|
type: "button",
|
|
579
585
|
"data-panel-toggle": "notes",
|
|
580
|
-
onClick: () =>
|
|
586
|
+
onClick: () => D((r) => !r),
|
|
581
587
|
className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
|
|
582
588
|
children: [
|
|
583
589
|
/* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
|
|
584
|
-
/* @__PURE__ */ e(
|
|
590
|
+
/* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
|
|
585
591
|
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
|
|
586
|
-
(
|
|
592
|
+
(E.length > 0 || (h ?? []).length > 0) && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: b ? (h ?? []).length : E.length }),
|
|
587
593
|
/* @__PURE__ */ e(
|
|
588
|
-
|
|
594
|
+
De,
|
|
589
595
|
{
|
|
590
|
-
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${
|
|
596
|
+
className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${R ? " rotate-180" : ""}`
|
|
591
597
|
}
|
|
592
598
|
)
|
|
593
599
|
] }),
|
|
594
|
-
!
|
|
595
|
-
const r =
|
|
600
|
+
!R && !b && E.length > 0 && (() => {
|
|
601
|
+
const r = E[0], a = r.kind === "comment" ? re(r.comment.user) : r.note.user_name ?? "System", x = (r.kind === "comment" ? r.comment.text : r.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
|
|
596
602
|
return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
|
|
597
603
|
/* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
|
|
598
604
|
a,
|
|
@@ -605,13 +611,13 @@ function Dt({
|
|
|
605
611
|
]
|
|
606
612
|
}
|
|
607
613
|
),
|
|
608
|
-
|
|
609
|
-
/* @__PURE__ */ s("form", { onSubmit:
|
|
614
|
+
R && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: b ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
|
|
615
|
+
/* @__PURE__ */ s("form", { onSubmit: xe, className: "space-y-2", children: [
|
|
610
616
|
/* @__PURE__ */ e(
|
|
611
|
-
|
|
617
|
+
ae,
|
|
612
618
|
{
|
|
613
|
-
value:
|
|
614
|
-
onChange:
|
|
619
|
+
value: u,
|
|
620
|
+
onChange: P,
|
|
615
621
|
placeholder: "Write a comment…",
|
|
616
622
|
rows: 3,
|
|
617
623
|
className: "text-[13px]"
|
|
@@ -619,11 +625,11 @@ function Dt({
|
|
|
619
625
|
),
|
|
620
626
|
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
621
627
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
|
|
622
|
-
/* @__PURE__ */ e(
|
|
628
|
+
/* @__PURE__ */ e(Z, { type: "submit", size: "sm", disabled: !u.trim(), children: "Queue" })
|
|
623
629
|
] })
|
|
624
630
|
] }),
|
|
625
631
|
(h ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
626
|
-
/* @__PURE__ */ e(
|
|
632
|
+
/* @__PURE__ */ e(he, {}),
|
|
627
633
|
(h ?? []).map((r, a) => /* @__PURE__ */ s(
|
|
628
634
|
"div",
|
|
629
635
|
{
|
|
@@ -636,13 +642,13 @@ function Dt({
|
|
|
636
642
|
a
|
|
637
643
|
))
|
|
638
644
|
] })
|
|
639
|
-
] }) : /* @__PURE__ */ s(
|
|
640
|
-
/* @__PURE__ */ s("form", { onSubmit:
|
|
645
|
+
] }) : /* @__PURE__ */ s(Y, { children: [
|
|
646
|
+
/* @__PURE__ */ s("form", { onSubmit: xe, className: "space-y-2", children: [
|
|
641
647
|
/* @__PURE__ */ e(
|
|
642
|
-
|
|
648
|
+
ae,
|
|
643
649
|
{
|
|
644
|
-
value:
|
|
645
|
-
onChange:
|
|
650
|
+
value: u,
|
|
651
|
+
onChange: P,
|
|
646
652
|
placeholder: "Write a comment…",
|
|
647
653
|
rows: 3,
|
|
648
654
|
className: "text-[13px]"
|
|
@@ -655,45 +661,45 @@ function Dt({
|
|
|
655
661
|
"button",
|
|
656
662
|
{
|
|
657
663
|
type: "button",
|
|
658
|
-
disabled: !
|
|
659
|
-
onClick: () => void
|
|
664
|
+
disabled: !u.trim() || k,
|
|
665
|
+
onClick: () => void o(),
|
|
660
666
|
"data-tip": "✨ Fix grammar & clarity (meaning preserved)",
|
|
661
667
|
className: "rounded-md border border-slate-200 px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
662
|
-
children:
|
|
668
|
+
children: k ? "…" : "✨ Polish"
|
|
663
669
|
}
|
|
664
670
|
),
|
|
665
|
-
/* @__PURE__ */ e(
|
|
671
|
+
/* @__PURE__ */ e(Z, { type: "submit", size: "sm", disabled: !u.trim() || te.isPending, children: te.isPending ? "Posting…" : "Comment" })
|
|
666
672
|
] })
|
|
667
673
|
] })
|
|
668
674
|
] }),
|
|
669
|
-
|
|
675
|
+
f.length > 0 && /* @__PURE__ */ s(
|
|
670
676
|
"p",
|
|
671
677
|
{
|
|
672
678
|
className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
|
|
673
679
|
"data-note-typing": !0,
|
|
674
680
|
children: [
|
|
675
681
|
/* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
|
|
676
|
-
|
|
682
|
+
Ue(f, "writing a note"),
|
|
677
683
|
"…"
|
|
678
684
|
]
|
|
679
685
|
}
|
|
680
686
|
),
|
|
681
|
-
/* @__PURE__ */ e(
|
|
682
|
-
|
|
687
|
+
/* @__PURE__ */ e(he, { className: "my-4" }),
|
|
688
|
+
E.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
|
|
683
689
|
["people", "system", "integration"].map((r) => {
|
|
684
|
-
const a = !
|
|
690
|
+
const a = !X.has(r), x = Ce[r];
|
|
685
691
|
return /* @__PURE__ */ s(
|
|
686
692
|
"button",
|
|
687
693
|
{
|
|
688
694
|
type: "button",
|
|
689
|
-
onClick: () =>
|
|
695
|
+
onClick: () => Se(r),
|
|
690
696
|
"aria-pressed": a,
|
|
691
697
|
"data-notes-filter": r,
|
|
692
698
|
disabled: x === 0 && a,
|
|
693
699
|
className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${a ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
|
|
694
700
|
title: r === "people" ? "Comments and notes people wrote" : r === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
|
|
695
701
|
children: [
|
|
696
|
-
|
|
702
|
+
ot[r],
|
|
697
703
|
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: x })
|
|
698
704
|
]
|
|
699
705
|
},
|
|
@@ -703,65 +709,65 @@ function Dt({
|
|
|
703
709
|
/* @__PURE__ */ e(
|
|
704
710
|
"input",
|
|
705
711
|
{
|
|
706
|
-
value:
|
|
707
|
-
onChange: (r) =>
|
|
712
|
+
value: J,
|
|
713
|
+
onChange: (r) => _e(r.target.value),
|
|
708
714
|
placeholder: "Search notes…",
|
|
709
715
|
"aria-label": "Search notes",
|
|
710
716
|
"data-notes-search": !0,
|
|
711
717
|
className: "ml-auto h-6 w-[150px] rounded-md border border-slate-200 bg-background px-2 text-[11.5px] dark:border-border"
|
|
712
718
|
}
|
|
713
719
|
),
|
|
714
|
-
|
|
720
|
+
$e && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
|
|
715
721
|
ee.length,
|
|
716
722
|
" of ",
|
|
717
|
-
|
|
723
|
+
E.length
|
|
718
724
|
] })
|
|
719
725
|
] }),
|
|
720
|
-
|
|
726
|
+
A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
|
|
721
727
|
/* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
722
728
|
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
|
|
723
729
|
/* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
|
|
724
730
|
/* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
|
|
725
731
|
] })
|
|
726
|
-
] }, r)) }) :
|
|
732
|
+
] }, r)) }) : ke ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : E.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.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: ee.map((r) => {
|
|
727
733
|
if (r.kind === "related")
|
|
728
734
|
return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
|
|
729
|
-
|
|
735
|
+
it,
|
|
730
736
|
{
|
|
731
737
|
note: r.note,
|
|
732
738
|
collection: t,
|
|
733
739
|
item: String(i)
|
|
734
740
|
}
|
|
735
741
|
) }, r.note.id);
|
|
736
|
-
const a = r.comment, x =
|
|
742
|
+
const a = r.comment, x = w === a.user.id, K = G === a.id;
|
|
737
743
|
return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
|
|
738
744
|
/* @__PURE__ */ e(
|
|
739
|
-
|
|
745
|
+
Ve,
|
|
740
746
|
{
|
|
741
747
|
userId: a.user.id,
|
|
742
748
|
className: "h-8 w-8",
|
|
743
|
-
fallback: /* @__PURE__ */ e(
|
|
749
|
+
fallback: /* @__PURE__ */ e(Ze, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ye, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: nt(a.user) }) })
|
|
744
750
|
}
|
|
745
751
|
),
|
|
746
752
|
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
747
753
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
748
|
-
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children:
|
|
749
|
-
/* @__PURE__ */ e(
|
|
754
|
+
/* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: re(a.user) }),
|
|
755
|
+
/* @__PURE__ */ e(He, { label: a.via_agent }),
|
|
750
756
|
/* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(a.created_at) }),
|
|
751
757
|
a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
|
|
752
758
|
a.field && /* @__PURE__ */ e(
|
|
753
|
-
|
|
759
|
+
at,
|
|
754
760
|
{
|
|
755
761
|
field: a.field,
|
|
756
|
-
label: (
|
|
762
|
+
label: (q == null ? void 0 : q.labelOf(a.field)) ?? Ge(a.field),
|
|
757
763
|
resolved: !!a.resolved_at,
|
|
758
|
-
onJump:
|
|
764
|
+
onJump: q ? () => q.jump(a.field) : void 0
|
|
759
765
|
}
|
|
760
766
|
),
|
|
761
767
|
!K && /* @__PURE__ */ s(
|
|
762
768
|
"div",
|
|
763
769
|
{
|
|
764
|
-
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${
|
|
770
|
+
className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H === a.id ? "opacity-100" : "opacity-0"}`,
|
|
765
771
|
children: [
|
|
766
772
|
/* @__PURE__ */ e(
|
|
767
773
|
"button",
|
|
@@ -770,11 +776,11 @@ function Dt({
|
|
|
770
776
|
title: "Make a task from this comment",
|
|
771
777
|
"aria-label": "Make a task from this comment",
|
|
772
778
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
|
|
773
|
-
onClick: () =>
|
|
774
|
-
children: /* @__PURE__ */ e(
|
|
779
|
+
onClick: () => Ee.mutate(a),
|
|
780
|
+
children: /* @__PURE__ */ e(Pe, { className: "h-3 w-3" })
|
|
775
781
|
}
|
|
776
782
|
),
|
|
777
|
-
x && (
|
|
783
|
+
x && (H === a.id ? /* @__PURE__ */ s(Y, { children: [
|
|
778
784
|
/* @__PURE__ */ e(
|
|
779
785
|
"button",
|
|
780
786
|
{
|
|
@@ -784,7 +790,7 @@ function Dt({
|
|
|
784
790
|
"data-comment-delete-confirm": a.id,
|
|
785
791
|
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",
|
|
786
792
|
onClick: () => ne.mutate(a.id, {
|
|
787
|
-
onSettled: () =>
|
|
793
|
+
onSettled: () => n(null)
|
|
788
794
|
}),
|
|
789
795
|
children: ne.isPending ? "Deleting…" : "Delete comment?"
|
|
790
796
|
}
|
|
@@ -794,11 +800,11 @@ function Dt({
|
|
|
794
800
|
{
|
|
795
801
|
type: "button",
|
|
796
802
|
className: "rounded px-1.5 py-px text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
|
|
797
|
-
onClick: () =>
|
|
803
|
+
onClick: () => n(null),
|
|
798
804
|
children: "Keep"
|
|
799
805
|
}
|
|
800
806
|
)
|
|
801
|
-
] }) : /* @__PURE__ */ s(
|
|
807
|
+
] }) : /* @__PURE__ */ s(Y, { children: [
|
|
802
808
|
/* @__PURE__ */ e(
|
|
803
809
|
"button",
|
|
804
810
|
{
|
|
@@ -807,9 +813,9 @@ function Dt({
|
|
|
807
813
|
"aria-label": "Edit comment",
|
|
808
814
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
|
|
809
815
|
onClick: () => {
|
|
810
|
-
|
|
816
|
+
F(a.id), p(a.text);
|
|
811
817
|
},
|
|
812
|
-
children: /* @__PURE__ */ e(
|
|
818
|
+
children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
|
|
813
819
|
}
|
|
814
820
|
),
|
|
815
821
|
/* @__PURE__ */ e(
|
|
@@ -819,8 +825,8 @@ function Dt({
|
|
|
819
825
|
title: "Delete comment",
|
|
820
826
|
"aria-label": "Delete comment",
|
|
821
827
|
className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
|
|
822
|
-
onClick: () =>
|
|
823
|
-
children: /* @__PURE__ */ e(
|
|
828
|
+
onClick: () => n(a.id),
|
|
829
|
+
children: /* @__PURE__ */ e(Fe, { className: "h-3 w-3" })
|
|
824
830
|
}
|
|
825
831
|
)
|
|
826
832
|
] }))
|
|
@@ -830,82 +836,82 @@ function Dt({
|
|
|
830
836
|
] }),
|
|
831
837
|
K ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
|
|
832
838
|
/* @__PURE__ */ e(
|
|
833
|
-
|
|
839
|
+
ae,
|
|
834
840
|
{
|
|
835
|
-
value:
|
|
836
|
-
onChange:
|
|
841
|
+
value: l,
|
|
842
|
+
onChange: p,
|
|
837
843
|
rows: 3,
|
|
838
844
|
className: "text-[13px]"
|
|
839
845
|
}
|
|
840
846
|
),
|
|
841
847
|
/* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
|
|
842
848
|
/* @__PURE__ */ s(
|
|
843
|
-
|
|
849
|
+
Z,
|
|
844
850
|
{
|
|
845
851
|
size: "sm",
|
|
846
852
|
className: "h-7 gap-1.5",
|
|
847
|
-
disabled: !
|
|
848
|
-
onClick: () =>
|
|
853
|
+
disabled: !l.trim() || ce.isPending,
|
|
854
|
+
onClick: () => ce.mutate({ id: a.id, text: l.trim() }),
|
|
849
855
|
children: [
|
|
850
|
-
/* @__PURE__ */ e(
|
|
856
|
+
/* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
|
|
851
857
|
" Save"
|
|
852
858
|
]
|
|
853
859
|
}
|
|
854
860
|
),
|
|
855
861
|
/* @__PURE__ */ s(
|
|
856
|
-
|
|
862
|
+
Z,
|
|
857
863
|
{
|
|
858
864
|
size: "sm",
|
|
859
865
|
variant: "outline",
|
|
860
866
|
className: "h-7 gap-1.5",
|
|
861
867
|
onClick: () => {
|
|
862
|
-
|
|
868
|
+
F(null), p("");
|
|
863
869
|
},
|
|
864
870
|
children: [
|
|
865
|
-
/* @__PURE__ */ e(
|
|
871
|
+
/* @__PURE__ */ e(Me, { className: "h-3 w-3" }),
|
|
866
872
|
" Cancel"
|
|
867
873
|
]
|
|
868
874
|
}
|
|
869
875
|
)
|
|
870
876
|
] })
|
|
871
877
|
] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: a.text }) }),
|
|
872
|
-
!K && /* @__PURE__ */ e(
|
|
878
|
+
!K && /* @__PURE__ */ e(rt, { comment: a }),
|
|
873
879
|
!K && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
|
|
874
|
-
(a.reactions ?? []).map((
|
|
880
|
+
(a.reactions ?? []).map((M) => /* @__PURE__ */ s(
|
|
875
881
|
"button",
|
|
876
882
|
{
|
|
877
883
|
type: "button",
|
|
878
|
-
onClick: () =>
|
|
879
|
-
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${
|
|
884
|
+
onClick: () => me.mutate({ id: a.id, emoji: M.emoji }),
|
|
885
|
+
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${M.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
|
|
880
886
|
children: [
|
|
881
|
-
|
|
882
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children:
|
|
887
|
+
M.emoji,
|
|
888
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: M.count })
|
|
883
889
|
]
|
|
884
890
|
},
|
|
885
|
-
|
|
891
|
+
M.emoji
|
|
886
892
|
)),
|
|
887
893
|
/* @__PURE__ */ s("span", { className: "relative", children: [
|
|
888
894
|
/* @__PURE__ */ e(
|
|
889
895
|
"button",
|
|
890
896
|
{
|
|
891
897
|
type: "button",
|
|
892
|
-
onClick: () => pe(
|
|
898
|
+
onClick: () => pe(ue === a.id ? null : a.id),
|
|
893
899
|
className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
|
|
894
900
|
"aria-label": "Add reaction",
|
|
895
|
-
children: /* @__PURE__ */ e(
|
|
901
|
+
children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
|
|
896
902
|
}
|
|
897
903
|
),
|
|
898
|
-
|
|
904
|
+
ue === a.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: ve.map((M) => /* @__PURE__ */ e(
|
|
899
905
|
"button",
|
|
900
906
|
{
|
|
901
907
|
type: "button",
|
|
902
908
|
onClick: () => {
|
|
903
|
-
|
|
909
|
+
me.mutate({ id: a.id, emoji: M }), pe(null);
|
|
904
910
|
},
|
|
905
911
|
className: "rounded-full px-1 text-[14px] hover:bg-muted",
|
|
906
|
-
children:
|
|
912
|
+
children: M
|
|
907
913
|
},
|
|
908
|
-
|
|
914
|
+
M
|
|
909
915
|
)) })
|
|
910
916
|
] })
|
|
911
917
|
] })
|
|
@@ -919,6 +925,6 @@ function Dt({
|
|
|
919
925
|
);
|
|
920
926
|
}
|
|
921
927
|
export {
|
|
922
|
-
|
|
923
|
-
|
|
928
|
+
Tt as CommentPanel,
|
|
929
|
+
ae as MentionTextarea
|
|
924
930
|
};
|