@nivaro/react 0.3.136 → 0.3.138
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 +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/ChatPanel.js +86 -86
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -1,65 +1,66 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { Check as
|
|
4
|
-
import { useState as O, useMemo as
|
|
5
|
-
import { useApiFetchConfig as
|
|
6
|
-
import { useDeadlineNow as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as _e, useQuery as Se, useMutation as R } from "@tanstack/react-query";
|
|
3
|
+
import { Check as Ce, Bot as $e } from "lucide-react";
|
|
4
|
+
import { useState as O, useMemo as z, useRef as ie, useEffect as le } from "react";
|
|
5
|
+
import { useApiFetchConfig as Te, useItemNavigation as je, useNavigation as Oe } from "../context.js";
|
|
6
|
+
import { useDeadlineNow as Ie, liveSlaReading as Me } from "../lib/deadline-ticker.js";
|
|
7
|
+
import { useGapRefresh as Ae } from "../lib/gap-refresh.js";
|
|
8
|
+
import { useLiveEvent as ce } from "../lib/live.js";
|
|
9
|
+
import { useLiveOps as Le, useFreshIds as qe } from "../lib/live-ops.js";
|
|
10
|
+
import { useSettledRows as De } from "../lib/live-screen.js";
|
|
11
|
+
import { resolveNotificationTarget as me, runNotificationTarget as Fe } from "../lib/notification-target.js";
|
|
12
|
+
import { usePrefetchIntent as We } from "../lib/prefetch.js";
|
|
13
|
+
import { useOptionalRealtime as Ee, updateItemIds as Ue } from "../lib/realtime.js";
|
|
14
|
+
import { usePeekOrOpen as Ke, peekable as ue } from "../lib/record-peek.js";
|
|
15
|
+
import { userErrorMessage as Pe } from "../lib/safe-error.js";
|
|
16
|
+
import { withinDay as Qe, slaChip as Be } from "../lib/sla-chip.js";
|
|
17
|
+
import { cn as I, formatRelative as Re } from "../lib/utils.js";
|
|
18
|
+
import { AgentQuestionsCard as ze } from "./AgentQuestionsCard.js";
|
|
19
|
+
import { FirstWeekCard as He } from "./ai/FirstWeekCard.js";
|
|
20
|
+
import { TaskDoButton as Je } from "./ai/TaskDo.js";
|
|
21
|
+
import { openChatRoom as Ve, canOpenChatRoom as Ye } from "./chat/chat-core.js";
|
|
22
|
+
import { useMyRecordRooms as Ze } from "./chat/chat-hooks.js";
|
|
23
|
+
import { useCoveringQuery as Ge, DelegateCoverLine as Xe } from "./DelegateCoverLine.js";
|
|
24
|
+
import { LearningPathCard as et } from "./help-videos/viewer/LearningPathCard.js";
|
|
25
|
+
import { RequiredVideosCard as tt } from "./help-videos/viewer/RequiredVideosCard.js";
|
|
26
|
+
import { SkeletonBar as rt, ListSkeleton as at } from "./Skeletons.js";
|
|
26
27
|
import { TickerNumber as st } from "./TickerNumber.js";
|
|
27
|
-
import { UserAvatar as
|
|
28
|
-
const
|
|
28
|
+
import { UserAvatar as nt } from "./UserAvatar.js";
|
|
29
|
+
const dt = 8e3, pe = ["records", "proposals", "tasks", "team", "waiting", "notifications"], he = /* @__PURE__ */ new Set(["records", "proposals"]), be = {
|
|
29
30
|
records: "Waiting on you",
|
|
30
31
|
proposals: "Changes to review",
|
|
31
32
|
tasks: "My tasks",
|
|
32
33
|
team: "Team tasks",
|
|
33
34
|
waiting: "Waiting on others",
|
|
34
35
|
notifications: "Notifications"
|
|
35
|
-
},
|
|
36
|
+
}, ot = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), F = (d) => !!d && String(d).slice(0, 10) < ot(), it = {
|
|
36
37
|
alert: "bg-red-500/10 text-red-600 dark:text-red-400",
|
|
37
38
|
warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
|
|
38
39
|
neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
|
|
39
40
|
ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
40
41
|
};
|
|
41
|
-
function
|
|
42
|
+
function H(d, u) {
|
|
42
43
|
return d != null && d.due_at ? Me(d, u) : d;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
-
const l =
|
|
45
|
+
function lt(d, u) {
|
|
46
|
+
const l = Ue(d);
|
|
46
47
|
return l == null ? !0 : l.some((g) => String(g) === "*" || u.has(`${d.collection}:${g}`));
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
return !d || d.status === "breached" ? !1 : d.status === "warning" ||
|
|
49
|
+
function J(d) {
|
|
50
|
+
return !d || d.status === "breached" ? !1 : d.status === "warning" || Qe(d);
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
-
const u =
|
|
52
|
+
function ct({ sla: d }) {
|
|
53
|
+
const u = Be(d), l = u && J(d) ? { ...u, tone: "warn" } : u;
|
|
53
54
|
return l ? /* @__PURE__ */ e(
|
|
54
55
|
"span",
|
|
55
56
|
{
|
|
56
57
|
"data-sla-chip": l.tone,
|
|
57
|
-
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${
|
|
58
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${it[l.tone]}`,
|
|
58
59
|
children: l.label
|
|
59
60
|
}
|
|
60
61
|
) : null;
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function mt({ state: d, color: u }) {
|
|
63
64
|
return d ? /* @__PURE__ */ e(
|
|
64
65
|
"span",
|
|
65
66
|
{
|
|
@@ -73,20 +74,20 @@ function ut({ state: d, color: u }) {
|
|
|
73
74
|
}
|
|
74
75
|
) : null;
|
|
75
76
|
}
|
|
76
|
-
function
|
|
77
|
+
function ut({ order: d, hidden: u }) {
|
|
77
78
|
const l = d.filter(
|
|
78
79
|
(p) => !u.includes(p) && (p === "records" || p === "tasks" || p === "notifications")
|
|
79
|
-
), g = (p, w) => /* @__PURE__ */
|
|
80
|
+
), g = (p, w) => /* @__PURE__ */ s(
|
|
80
81
|
"section",
|
|
81
82
|
{
|
|
82
83
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
83
84
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children:
|
|
85
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
86
|
+
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: be[p] ?? p }),
|
|
86
87
|
p === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
87
88
|
] }),
|
|
88
89
|
/* @__PURE__ */ e(
|
|
89
|
-
|
|
90
|
+
at,
|
|
90
91
|
{
|
|
91
92
|
header: !1,
|
|
92
93
|
rows: w,
|
|
@@ -116,15 +117,15 @@ function pt({ order: d, hidden: u }) {
|
|
|
116
117
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((y) => g(y, 4)) }, w.join("+"))
|
|
117
118
|
), p += w.length;
|
|
118
119
|
}
|
|
119
|
-
return /* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
/* @__PURE__ */ e("div", { className: "grid flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: ["Waiting on you", "SLA breached", "Open tasks", "Unread notifications"].map((p) => /* @__PURE__ */
|
|
120
|
+
return /* @__PURE__ */ s("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work-loading": !0, "aria-busy": "true", children: [
|
|
121
|
+
/* @__PURE__ */ s("div", { className: "flex items-start justify-between", children: [
|
|
122
|
+
/* @__PURE__ */ e("div", { className: "grid flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: ["Waiting on you", "SLA breached", "Open tasks", "Unread notifications"].map((p) => /* @__PURE__ */ s(
|
|
122
123
|
"div",
|
|
123
124
|
{
|
|
124
125
|
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
125
126
|
children: [
|
|
126
127
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: p }),
|
|
127
|
-
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(
|
|
128
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(rt, { width: 34, className: "h-[18px] rounded-md" }) })
|
|
128
129
|
]
|
|
129
130
|
},
|
|
130
131
|
p
|
|
@@ -135,8 +136,8 @@ function pt({ order: d, hidden: u }) {
|
|
|
135
136
|
k
|
|
136
137
|
] });
|
|
137
138
|
}
|
|
138
|
-
function
|
|
139
|
-
return /* @__PURE__ */
|
|
139
|
+
function W({ label: d, value: u, tone: l }) {
|
|
140
|
+
return /* @__PURE__ */ s("div", { className: "min-w-0 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
140
141
|
/* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children: d }),
|
|
141
142
|
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${l ?? ""}`, children: /* @__PURE__ */ e(st, { value: u }) })
|
|
142
143
|
] });
|
|
@@ -145,193 +146,190 @@ function Pt({
|
|
|
145
146
|
notificationRoutes: d,
|
|
146
147
|
onOpenPath: u
|
|
147
148
|
} = {}) {
|
|
148
|
-
const { apiBase: l, authHeaders: g, credentials: k } =
|
|
149
|
+
const { apiBase: l, authHeaders: g, credentials: k } = Te(), { open: p } = je(), w = Ke(), y = Oe(), v = _e(), V = We(), Y = (t) => {
|
|
149
150
|
var h, c;
|
|
150
|
-
const
|
|
151
|
-
u ? u(
|
|
152
|
-
},
|
|
151
|
+
const n = ((h = d == null ? void 0 : d.support) == null ? void 0 : h.call(d, String(t))) ?? ((c = y.consoleUrl) == null ? void 0 : c.call(y, `/support?ticket=${t}`)) ?? `/support?ticket=${t}`;
|
|
152
|
+
u ? u(n) : y.navigate(n);
|
|
153
|
+
}, E = Ee(), [x, xe] = O(() => {
|
|
153
154
|
try {
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
156
|
-
const
|
|
157
|
-
if (Array.isArray(
|
|
158
|
-
const h =
|
|
155
|
+
const t = localStorage.getItem("nvr_mywork_sections");
|
|
156
|
+
if (t) {
|
|
157
|
+
const n = JSON.parse(t);
|
|
158
|
+
if (Array.isArray(n == null ? void 0 : n.order) && Array.isArray(n == null ? void 0 : n.hidden)) {
|
|
159
|
+
const h = pe.map((c, b) => ({
|
|
159
160
|
k: c,
|
|
160
|
-
at:
|
|
161
|
+
at: n.order.indexOf(c) >= 0 ? n.order.indexOf(c) : b - 0.5
|
|
161
162
|
})).sort((c, b) => c.at - b.at).map((c) => c.k);
|
|
162
|
-
return { order: h, hidden:
|
|
163
|
+
return { order: h, hidden: n.hidden.filter((c) => h.includes(c)) };
|
|
163
164
|
}
|
|
164
165
|
}
|
|
165
166
|
} catch {
|
|
166
167
|
}
|
|
167
|
-
return { order: [...
|
|
168
|
-
}),
|
|
169
|
-
|
|
168
|
+
return { order: [...pe], hidden: [] };
|
|
169
|
+
}), Z = (t) => {
|
|
170
|
+
xe(t);
|
|
170
171
|
try {
|
|
171
|
-
localStorage.setItem("nvr_mywork_sections", JSON.stringify(
|
|
172
|
+
localStorage.setItem("nvr_mywork_sections", JSON.stringify(t));
|
|
172
173
|
} catch {
|
|
173
174
|
}
|
|
174
|
-
}, [
|
|
175
|
-
const
|
|
176
|
-
return
|
|
177
|
-
}, [
|
|
175
|
+
}, [ge, fe] = O(!1), [_, ke] = O("all"), M = Ie(!0), [A, G] = O(null), { data: L } = Ge(), f = z(() => {
|
|
176
|
+
const t = A ? L == null ? void 0 : L.find((n) => n.user_id === A) : null;
|
|
177
|
+
return t ? { userId: t.user_id, name: t.first_name || t.name, keys: new Set(t.keys) } : null;
|
|
178
|
+
}, [A, L]), { data: a, isLoading: ye, refetch: we, isFetching: X } = Se({
|
|
178
179
|
queryKey: ["my-work"],
|
|
179
180
|
queryFn: async () => {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
182
|
-
return (await
|
|
181
|
+
const t = await fetch(`${l}/my-work`, { headers: g, credentials: k });
|
|
182
|
+
if (!t.ok) throw new Error("my-work failed");
|
|
183
|
+
return (await t.json()).data;
|
|
183
184
|
},
|
|
184
185
|
staleTime: 6e4
|
|
185
|
-
}),
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}, s = ae.current + ot - Date.now();
|
|
189
|
-
$.current || (s <= 0 ? r() : $.current = setTimeout(r, s));
|
|
190
|
-
};
|
|
191
|
-
De("my-work", D, { debounceMs: 1500 }), Ae("notification:new", D, { debounceMs: 1500 }), V(
|
|
192
|
-
() => () => {
|
|
193
|
-
$.current && clearTimeout($.current);
|
|
194
|
-
},
|
|
195
|
-
[]
|
|
186
|
+
}), $ = Ae(
|
|
187
|
+
() => void v.invalidateQueries({ queryKey: ["my-work"] }, { cancelRefetch: !1 }),
|
|
188
|
+
dt
|
|
196
189
|
);
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
...((a == null ? void 0 : a.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
190
|
+
Le("my-work", $, { debounceMs: 1500 }), ce("notification:new", $, { debounceMs: 1500 }), ce(["read:changed", "notification:retired"], $, {
|
|
191
|
+
debounceMs: 1500,
|
|
192
|
+
includeOwn: !0,
|
|
193
|
+
match: (t) => (t == null ? void 0 : t.kind) !== "chat"
|
|
194
|
+
});
|
|
195
|
+
const ee = qe([
|
|
196
|
+
...((a == null ? void 0 : a.owned) ?? []).map((t) => `o:${t.collection}:${t.item}`),
|
|
197
|
+
...((a == null ? void 0 : a.tasks) ?? []).map((t) => `t:${t.id}`),
|
|
198
|
+
...((a == null ? void 0 : a.team_tasks) ?? []).map((t) => `tt:${t.id}`),
|
|
199
|
+
...((a == null ? void 0 : a.requested) ?? []).map((t) => `r:${t.id}`),
|
|
200
|
+
...((a == null ? void 0 : a.notifications) ?? []).map((t) => `n:${t.id}`),
|
|
201
|
+
...((a == null ? void 0 : a.proposals) ?? []).map((t) => `p:${t.id}`)
|
|
202
|
+
]), S = (t) => ee.has(t) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", U = z(() => {
|
|
203
|
+
const t = /* @__PURE__ */ new Set();
|
|
204
|
+
for (const n of (a == null ? void 0 : a.owned) ?? []) n.collection && t.add(n.collection);
|
|
205
|
+
return [...t];
|
|
206
|
+
}, [a]), te = ie(/* @__PURE__ */ new Set());
|
|
207
|
+
te.current = new Set(((a == null ? void 0 : a.owned) ?? []).map((t) => `${t.collection}:${t.item}`));
|
|
208
|
+
const re = ie($);
|
|
209
|
+
re.current = $, le(() => {
|
|
210
|
+
if (!(!E || U.length === 0))
|
|
211
|
+
return E.subscribeCollections(U, (t) => {
|
|
212
|
+
lt(t, te.current) && re.current();
|
|
215
213
|
});
|
|
216
|
-
}, [
|
|
217
|
-
const
|
|
218
|
-
const
|
|
219
|
-
const c =
|
|
220
|
-
return _ === "soon" ?
|
|
214
|
+
}, [E, U]);
|
|
215
|
+
const ae = z(() => {
|
|
216
|
+
const t = (a == null ? void 0 : a.owned) ?? [], n = _ === "all" ? t : t.filter((h) => {
|
|
217
|
+
const c = H(h.sla, M);
|
|
218
|
+
return _ === "soon" ? J(c) : (c == null ? void 0 : c.status) === "breached";
|
|
221
219
|
});
|
|
222
|
-
return f ?
|
|
223
|
-
}, [a, _,
|
|
224
|
-
resetKey: `${_}|${
|
|
225
|
-
}),
|
|
220
|
+
return f ? n.filter((h) => f.keys.has(`${h.collection}:${h.item}`)) : n;
|
|
221
|
+
}, [a, _, M, f]), K = De(ae, (t) => `${t.collection}:${t.item}`, {
|
|
222
|
+
resetKey: `${_}|${A ?? ""}`
|
|
223
|
+
}), se = R({
|
|
226
224
|
// A ticket closes through /support so its requester hears about it.
|
|
227
|
-
mutationFn: (
|
|
225
|
+
mutationFn: (t) => fetch(`${l}/${t.kind === "support" ? "support/tickets" : "tasks"}/${t.id}`, {
|
|
228
226
|
method: "PATCH",
|
|
229
227
|
headers: { ...g, "content-type": "application/json" },
|
|
230
228
|
credentials: k,
|
|
231
229
|
body: JSON.stringify({ status: "done" })
|
|
232
230
|
}),
|
|
233
231
|
onSuccess: () => v.invalidateQueries({ queryKey: ["my-work"] })
|
|
234
|
-
}), q =
|
|
235
|
-
mutationFn: async ({ id:
|
|
236
|
-
const h = await fetch(`${l}/tasks/${
|
|
232
|
+
}), q = R({
|
|
233
|
+
mutationFn: async ({ id: t, action: n }) => {
|
|
234
|
+
const h = await fetch(`${l}/tasks/${t}/${n}`, {
|
|
237
235
|
method: "POST",
|
|
238
236
|
headers: { ...g, "content-type": "application/json" },
|
|
239
237
|
credentials: k,
|
|
240
238
|
body: "{}"
|
|
241
239
|
}), c = await h.json().catch(() => ({}));
|
|
242
240
|
if (!h.ok) throw new Error(c.error ?? "Failed");
|
|
243
|
-
return
|
|
241
|
+
return n;
|
|
244
242
|
},
|
|
245
|
-
onSuccess: (
|
|
246
|
-
|
|
243
|
+
onSuccess: (t) => {
|
|
244
|
+
P(t === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), v.invalidateQueries({ queryKey: ["my-work"] });
|
|
247
245
|
},
|
|
248
|
-
onError: (
|
|
249
|
-
}), [
|
|
250
|
-
|
|
251
|
-
if (!
|
|
252
|
-
const
|
|
253
|
-
return () => clearTimeout(
|
|
254
|
-
}, [
|
|
255
|
-
const
|
|
256
|
-
mutationFn: (
|
|
246
|
+
onError: (t) => P(Pe(t, "Failed"))
|
|
247
|
+
}), [D, P] = O(null);
|
|
248
|
+
le(() => {
|
|
249
|
+
if (!D) return;
|
|
250
|
+
const t = setTimeout(() => P(null), 4e3);
|
|
251
|
+
return () => clearTimeout(t);
|
|
252
|
+
}, [D]);
|
|
253
|
+
const ne = R({
|
|
254
|
+
mutationFn: (t) => fetch(`${l}/notifications/mark-read`, {
|
|
257
255
|
method: "POST",
|
|
258
256
|
headers: { ...g, "content-type": "application/json" },
|
|
259
257
|
credentials: k,
|
|
260
|
-
body: JSON.stringify({ ids:
|
|
258
|
+
body: JSON.stringify({ ids: t })
|
|
261
259
|
}),
|
|
262
260
|
onSuccess: () => {
|
|
263
261
|
v.invalidateQueries({ queryKey: ["my-work"] }), v.invalidateQueries({ queryKey: ["notifications"] });
|
|
264
262
|
}
|
|
265
|
-
}), C = (
|
|
266
|
-
if (
|
|
267
|
-
const m = (c ?? []).filter((o) => o.collection && o.item &&
|
|
268
|
-
if (w({ collection:
|
|
263
|
+
}), C = (t, n, h, c) => {
|
|
264
|
+
if (t && n && ue(t)) {
|
|
265
|
+
const m = (c ?? []).filter((o) => o.collection && o.item && ue(o.collection)).map((o) => ({ collection: o.collection, itemId: String(o.item) }));
|
|
266
|
+
if (w({ collection: t, itemId: String(n) }, h, { list: m }) !== "navigate")
|
|
269
267
|
return;
|
|
270
268
|
}
|
|
271
269
|
const b = {
|
|
272
270
|
record: (m, o) => (p({ collection: m, itemId: o }), null),
|
|
273
271
|
...d
|
|
274
|
-
},
|
|
272
|
+
}, r = me(t, n, {
|
|
275
273
|
...b,
|
|
276
274
|
record: (m, o) => {
|
|
277
275
|
var N;
|
|
278
276
|
return ((N = d == null ? void 0 : d.record) == null ? void 0 : N.call(d, m, o)) ?? null;
|
|
279
277
|
}
|
|
280
278
|
});
|
|
281
|
-
if (
|
|
282
|
-
|
|
279
|
+
if (r) {
|
|
280
|
+
Fe(r, (m) => u == null ? void 0 : u(m));
|
|
283
281
|
return;
|
|
284
282
|
}
|
|
285
|
-
|
|
286
|
-
},
|
|
283
|
+
t && n && !/^nivaro_/i.test(t) && t !== "__chat__" && p({ collection: t, itemId: n });
|
|
284
|
+
}, Ne = (t, n) => t && n && !/^nivaro_/i.test(t) && t !== "__chat__" ? !0 : !!me(t, n, {
|
|
287
285
|
record: () => null,
|
|
288
286
|
...d
|
|
289
287
|
});
|
|
290
|
-
return
|
|
291
|
-
/* @__PURE__ */ e(
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
294
|
-
/* @__PURE__ */ e(
|
|
288
|
+
return ye || !a ? /* @__PURE__ */ e(ut, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ s("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work": !0, children: [
|
|
289
|
+
/* @__PURE__ */ e(He, { onOpenPath: u }),
|
|
290
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col-reverse gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
|
|
291
|
+
/* @__PURE__ */ s("div", { className: "grid min-w-0 flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
|
|
292
|
+
/* @__PURE__ */ e(W, { label: "Waiting on you", value: a.counts.owned }),
|
|
295
293
|
/* @__PURE__ */ e(
|
|
296
|
-
|
|
294
|
+
W,
|
|
297
295
|
{
|
|
298
296
|
label: "SLA breached",
|
|
299
297
|
value: a.counts.owned_breached,
|
|
300
298
|
tone: a.counts.owned_breached > 0 ? "text-red-600 dark:text-red-400" : ""
|
|
301
299
|
}
|
|
302
300
|
),
|
|
303
|
-
/* @__PURE__ */ e(
|
|
304
|
-
/* @__PURE__ */ e(
|
|
301
|
+
/* @__PURE__ */ e(W, { label: "Open tasks", value: a.counts.tasks }),
|
|
302
|
+
/* @__PURE__ */ e(W, { label: "Unread notifications", value: a.counts.notifications })
|
|
305
303
|
] }),
|
|
306
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ s("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: [
|
|
307
305
|
/* @__PURE__ */ e(
|
|
308
306
|
"button",
|
|
309
307
|
{
|
|
310
308
|
type: "button",
|
|
311
|
-
onClick: () => void
|
|
312
|
-
disabled:
|
|
309
|
+
onClick: () => void we(),
|
|
310
|
+
disabled: X,
|
|
313
311
|
className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
314
|
-
children:
|
|
312
|
+
children: X ? "Refreshing…" : "Refresh"
|
|
315
313
|
}
|
|
316
314
|
),
|
|
317
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
318
316
|
/* @__PURE__ */ e(
|
|
319
317
|
"button",
|
|
320
318
|
{
|
|
321
319
|
type: "button",
|
|
322
|
-
onClick: () =>
|
|
320
|
+
onClick: () => fe((t) => !t),
|
|
323
321
|
className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted dark:border-border",
|
|
324
322
|
children: "Customize"
|
|
325
323
|
}
|
|
326
324
|
),
|
|
327
|
-
|
|
325
|
+
ge && /* @__PURE__ */ s("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
|
|
328
326
|
/* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
|
|
329
|
-
x.order.map((
|
|
330
|
-
const h =
|
|
331
|
-
const m = [...x.order], o =
|
|
332
|
-
o < 0 || o >= m.length || ([m[
|
|
327
|
+
x.order.map((t, n) => {
|
|
328
|
+
const h = be[t] ?? t, c = x.hidden.includes(t), b = (r) => {
|
|
329
|
+
const m = [...x.order], o = n + r;
|
|
330
|
+
o < 0 || o >= m.length || ([m[n], m[o]] = [m[o], m[n]], Z({ ...x, order: m }));
|
|
333
331
|
};
|
|
334
|
-
return /* @__PURE__ */
|
|
332
|
+
return /* @__PURE__ */ s(
|
|
335
333
|
"div",
|
|
336
334
|
{
|
|
337
335
|
className: "flex items-center gap-1 rounded px-1 py-1 hover:bg-muted",
|
|
@@ -340,9 +338,9 @@ function Pt({
|
|
|
340
338
|
"button",
|
|
341
339
|
{
|
|
342
340
|
type: "button",
|
|
343
|
-
onClick: () =>
|
|
341
|
+
onClick: () => Z({
|
|
344
342
|
...x,
|
|
345
|
-
hidden: c ? x.hidden.filter((
|
|
343
|
+
hidden: c ? x.hidden.filter((r) => r !== t) : [...x.hidden, t]
|
|
346
344
|
}),
|
|
347
345
|
className: "flex h-4 w-4 items-center justify-center rounded border border-slate-300 text-[10px] dark:border-border",
|
|
348
346
|
title: c ? "Show section" : "Hide section",
|
|
@@ -361,7 +359,7 @@ function Pt({
|
|
|
361
359
|
{
|
|
362
360
|
type: "button",
|
|
363
361
|
onClick: () => b(-1),
|
|
364
|
-
disabled:
|
|
362
|
+
disabled: n === 0,
|
|
365
363
|
className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
|
|
366
364
|
children: "↑"
|
|
367
365
|
}
|
|
@@ -371,63 +369,63 @@ function Pt({
|
|
|
371
369
|
{
|
|
372
370
|
type: "button",
|
|
373
371
|
onClick: () => b(1),
|
|
374
|
-
disabled:
|
|
372
|
+
disabled: n === x.order.length - 1,
|
|
375
373
|
className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
|
|
376
374
|
children: "↓"
|
|
377
375
|
}
|
|
378
376
|
)
|
|
379
377
|
]
|
|
380
378
|
},
|
|
381
|
-
|
|
379
|
+
t
|
|
382
380
|
);
|
|
383
381
|
})
|
|
384
382
|
] })
|
|
385
383
|
] })
|
|
386
384
|
] })
|
|
387
385
|
] }),
|
|
388
|
-
|
|
386
|
+
D && /* @__PURE__ */ e(
|
|
389
387
|
"p",
|
|
390
388
|
{
|
|
391
389
|
className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[12px] dark:border-border dark:bg-card",
|
|
392
390
|
role: "status",
|
|
393
391
|
"data-my-work-task-note": !0,
|
|
394
|
-
children:
|
|
392
|
+
children: D
|
|
395
393
|
}
|
|
396
394
|
),
|
|
397
|
-
/* @__PURE__ */ e(
|
|
395
|
+
/* @__PURE__ */ e(ze, { questions: a.questions ?? [] }),
|
|
398
396
|
/* @__PURE__ */ e(
|
|
399
|
-
|
|
397
|
+
Xe,
|
|
400
398
|
{
|
|
401
399
|
showing: (f == null ? void 0 : f.userId) ?? null,
|
|
402
|
-
onShow: (
|
|
400
|
+
onShow: (t) => G((n) => n === t.user_id ? null : t.user_id)
|
|
403
401
|
}
|
|
404
402
|
),
|
|
405
|
-
/* @__PURE__ */ e(rt, { className: "mb-4" }),
|
|
406
403
|
/* @__PURE__ */ e(tt, { className: "mb-4" }),
|
|
404
|
+
/* @__PURE__ */ e(et, { className: "mb-4" }),
|
|
407
405
|
(() => {
|
|
408
|
-
const
|
|
406
|
+
const t = {
|
|
409
407
|
records: () => {
|
|
410
|
-
const
|
|
408
|
+
const r = new Map(a.owned.map((i) => [i, H(i.sla, M)])), m = (i) => J(r.get(i) ?? null), o = (i) => {
|
|
411
409
|
var j;
|
|
412
|
-
return ((j =
|
|
413
|
-
}, N = a.owned.filter(m).length, T = a.owned.filter(o).length,
|
|
410
|
+
return ((j = r.get(i)) == null ? void 0 : j.status) === "breached";
|
|
411
|
+
}, N = a.owned.filter(m).length, T = a.owned.filter(o).length, Q = ae, ve = [
|
|
414
412
|
{ key: "all", label: `All (${a.owned.length})` },
|
|
415
413
|
{ key: "soon", label: `Due soon (${N})` },
|
|
416
414
|
{ key: "breached", label: `Breached (${T})` }
|
|
417
415
|
];
|
|
418
|
-
return /* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ s("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
417
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
420
418
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Waiting on you" }),
|
|
421
419
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
422
420
|
] }),
|
|
423
|
-
a.owned.length > 0 && /* @__PURE__ */
|
|
424
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children:
|
|
421
|
+
a.owned.length > 0 && /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: [
|
|
422
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: ve.map((i) => /* @__PURE__ */ e(
|
|
425
423
|
"button",
|
|
426
424
|
{
|
|
427
425
|
type: "button",
|
|
428
426
|
"data-my-work-sla-filter": i.key,
|
|
429
427
|
"aria-pressed": _ === i.key,
|
|
430
|
-
onClick: () =>
|
|
428
|
+
onClick: () => ke(i.key),
|
|
431
429
|
className: [
|
|
432
430
|
"rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
|
|
433
431
|
_ === i.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
|
|
@@ -436,12 +434,12 @@ function Pt({
|
|
|
436
434
|
},
|
|
437
435
|
i.key
|
|
438
436
|
)) }),
|
|
439
|
-
f && /* @__PURE__ */
|
|
437
|
+
f && /* @__PURE__ */ s(
|
|
440
438
|
"button",
|
|
441
439
|
{
|
|
442
440
|
type: "button",
|
|
443
441
|
"data-my-work-cover-filter": !0,
|
|
444
|
-
onClick: () =>
|
|
442
|
+
onClick: () => G(null),
|
|
445
443
|
"aria-label": `Show all records, not only ${f.name}'s`,
|
|
446
444
|
className: "ml-1 inline-flex items-center gap-1 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-1 text-[11px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
|
|
447
445
|
children: [
|
|
@@ -452,13 +450,13 @@ function Pt({
|
|
|
452
450
|
}
|
|
453
451
|
)
|
|
454
452
|
] }),
|
|
455
|
-
|
|
453
|
+
K.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e(
|
|
456
454
|
"ul",
|
|
457
455
|
{
|
|
458
|
-
ref:
|
|
456
|
+
ref: K.containerRef,
|
|
459
457
|
className: "divide-y divide-slate-100 dark:divide-border/60",
|
|
460
|
-
children:
|
|
461
|
-
var
|
|
458
|
+
children: K.rows.map(({ row: i, state: j }) => {
|
|
459
|
+
var de, oe;
|
|
462
460
|
return /* @__PURE__ */ e(
|
|
463
461
|
"li",
|
|
464
462
|
{
|
|
@@ -466,19 +464,19 @@ function Pt({
|
|
|
466
464
|
S(`o:${i.collection}:${i.item}`),
|
|
467
465
|
j === "departed" && "opacity-50"
|
|
468
466
|
),
|
|
469
|
-
"data-my-work-fresh":
|
|
467
|
+
"data-my-work-fresh": ee.has(`o:${i.collection}:${i.item}`) || void 0,
|
|
470
468
|
"data-my-work-departed": j === "departed" || void 0,
|
|
471
|
-
children: /* @__PURE__ */
|
|
469
|
+
children: /* @__PURE__ */ s(
|
|
472
470
|
"button",
|
|
473
471
|
{
|
|
474
472
|
type: "button",
|
|
475
|
-
onClick: (
|
|
476
|
-
...
|
|
473
|
+
onClick: (B) => C(i.collection, i.item, B, Q),
|
|
474
|
+
...V.record(i.collection, i.item),
|
|
477
475
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
|
|
478
476
|
children: [
|
|
479
477
|
/* @__PURE__ */ e("span", { className: "min-w-[6.5rem] flex-1 truncate text-[12.5px] font-medium", children: i.label }),
|
|
480
478
|
/* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: i.collection.replace(/_/g, " ") }),
|
|
481
|
-
((
|
|
479
|
+
((de = i.flags) == null ? void 0 : de.some((B) => /^on hold$/i.test(B.name.trim()))) && /* @__PURE__ */ e(
|
|
482
480
|
"span",
|
|
483
481
|
{
|
|
484
482
|
"data-my-work-hold": !0,
|
|
@@ -487,13 +485,13 @@ function Pt({
|
|
|
487
485
|
}
|
|
488
486
|
),
|
|
489
487
|
/* @__PURE__ */ e(
|
|
490
|
-
|
|
488
|
+
mt,
|
|
491
489
|
{
|
|
492
|
-
state: i.state_label || ((
|
|
490
|
+
state: i.state_label || ((oe = i.state) == null ? void 0 : oe.replace(/_/g, " ")) || null,
|
|
493
491
|
color: i.state_color
|
|
494
492
|
}
|
|
495
493
|
),
|
|
496
|
-
/* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(
|
|
494
|
+
/* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(ct, { sla: r.get(i) ?? H(i.sla, M) }) })
|
|
497
495
|
]
|
|
498
496
|
}
|
|
499
497
|
)
|
|
@@ -506,141 +504,141 @@ function Pt({
|
|
|
506
504
|
] });
|
|
507
505
|
},
|
|
508
506
|
// Idea 6 — only when something waits on this person's decision.
|
|
509
|
-
proposals: () => (a.proposals ?? []).length === 0 ? null : /* @__PURE__ */
|
|
507
|
+
proposals: () => (a.proposals ?? []).length === 0 ? null : /* @__PURE__ */ s(
|
|
510
508
|
"section",
|
|
511
509
|
{
|
|
512
510
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
513
511
|
"data-my-work-proposals": !0,
|
|
514
512
|
children: [
|
|
515
|
-
/* @__PURE__ */
|
|
513
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
516
514
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Changes to review" }),
|
|
517
515
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Proposed changes on locked records — open one to compare old and new and accept or decline it." })
|
|
518
516
|
] }),
|
|
519
|
-
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((
|
|
517
|
+
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((r) => /* @__PURE__ */ e("li", { className: S(`p:${r.id}`), "data-my-work-proposal": r.id, children: /* @__PURE__ */ s(
|
|
520
518
|
"button",
|
|
521
519
|
{
|
|
522
520
|
type: "button",
|
|
523
|
-
onClick: () => C(
|
|
524
|
-
...
|
|
521
|
+
onClick: () => C(r.collection, r.item),
|
|
522
|
+
...V.record(r.collection, r.item),
|
|
525
523
|
className: "flex w-full items-start gap-2.5 px-4 py-2 text-left hover:bg-muted",
|
|
526
524
|
children: [
|
|
527
|
-
/* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */
|
|
529
|
-
/* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium", children:
|
|
530
|
-
/* @__PURE__ */ e("span", { className: "text-[11.5px] text-muted-foreground", children:
|
|
525
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
526
|
+
/* @__PURE__ */ s("span", { className: "flex flex-wrap items-baseline gap-x-2", children: [
|
|
527
|
+
/* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium", children: r.item_label }),
|
|
528
|
+
/* @__PURE__ */ e("span", { className: "text-[11.5px] text-muted-foreground", children: r.fields.join(", ") })
|
|
531
529
|
] }),
|
|
532
|
-
/* @__PURE__ */
|
|
533
|
-
|
|
530
|
+
/* @__PURE__ */ s("span", { className: "mt-0.5 block truncate text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
531
|
+
r.created_by_name ?? "Someone",
|
|
534
532
|
": ",
|
|
535
|
-
|
|
533
|
+
r.reason
|
|
536
534
|
] })
|
|
537
535
|
] }),
|
|
538
|
-
/* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children:
|
|
536
|
+
/* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: Re(r.created_at) })
|
|
539
537
|
]
|
|
540
538
|
}
|
|
541
|
-
) },
|
|
539
|
+
) }, r.id)) })
|
|
542
540
|
]
|
|
543
541
|
}
|
|
544
542
|
),
|
|
545
|
-
tasks: () => /* @__PURE__ */
|
|
543
|
+
tasks: () => /* @__PURE__ */ s("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
546
544
|
/* @__PURE__ */ e("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "My tasks" }) }),
|
|
547
|
-
a.tasks.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "No open tasks." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.tasks.map((
|
|
545
|
+
a.tasks.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "No open tasks." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.tasks.map((r) => /* @__PURE__ */ s(
|
|
548
546
|
"li",
|
|
549
547
|
{
|
|
550
|
-
className: I("flex items-center gap-2.5 px-4 py-2", S(`t:${
|
|
548
|
+
className: I("flex items-center gap-2.5 px-4 py-2", S(`t:${r.id}`)),
|
|
551
549
|
children: [
|
|
552
550
|
/* @__PURE__ */ e(
|
|
553
551
|
"button",
|
|
554
552
|
{
|
|
555
553
|
type: "button",
|
|
556
554
|
title: "Mark done",
|
|
557
|
-
onClick: () =>
|
|
558
|
-
disabled:
|
|
555
|
+
onClick: () => se.mutate(r),
|
|
556
|
+
disabled: se.isPending,
|
|
559
557
|
className: "flex h-4 w-4 shrink-0 items-center justify-center rounded border border-slate-300 text-transparent hover:border-emerald-500 hover:text-emerald-500 dark:border-border",
|
|
560
558
|
children: "✓"
|
|
561
559
|
}
|
|
562
560
|
),
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
561
|
+
r.priority === "urgent" && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-red-500/10 px-1 py-px text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" }),
|
|
562
|
+
r.kind === "support" && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-slate-100 px-1 py-px text-[9.5px] font-semibold uppercase tracking-wide text-slate-600 dark:bg-white/10 dark:text-slate-300", children: "support" }),
|
|
563
|
+
r.agent_assignee && /* @__PURE__ */ s(
|
|
566
564
|
"span",
|
|
567
565
|
{
|
|
568
566
|
className: "inline-flex shrink-0 items-center gap-1 rounded bg-nvr-cyan/10 px-1 py-px text-[10px] font-medium text-[#0e7490] dark:text-[#67e8f9]",
|
|
569
|
-
"data-tip": `Handed to ${
|
|
570
|
-
"data-my-work-agent-task":
|
|
567
|
+
"data-tip": `Handed to ${r.agent_name ?? "your agent"} — it picks this up through My Work`,
|
|
568
|
+
"data-my-work-agent-task": r.id,
|
|
571
569
|
children: [
|
|
572
|
-
/* @__PURE__ */ e(
|
|
573
|
-
|
|
570
|
+
/* @__PURE__ */ e($e, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
571
|
+
r.agent_name ?? "Agent"
|
|
574
572
|
]
|
|
575
573
|
}
|
|
576
574
|
),
|
|
577
|
-
/* @__PURE__ */
|
|
575
|
+
/* @__PURE__ */ s(
|
|
578
576
|
"button",
|
|
579
577
|
{
|
|
580
578
|
type: "button",
|
|
581
|
-
onClick: (m) =>
|
|
579
|
+
onClick: (m) => r.kind === "support" ? Y(r.id) : C(r.collection, r.item, m),
|
|
582
580
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
583
581
|
children: [
|
|
584
|
-
|
|
585
|
-
|
|
582
|
+
r.title,
|
|
583
|
+
r.item_label && /* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-muted-foreground", children: r.item_label })
|
|
586
584
|
]
|
|
587
585
|
}
|
|
588
586
|
),
|
|
589
587
|
/* @__PURE__ */ e(
|
|
590
|
-
|
|
588
|
+
Je,
|
|
591
589
|
{
|
|
592
|
-
task:
|
|
590
|
+
task: r,
|
|
593
591
|
isAssignee: !0,
|
|
594
592
|
compact: !0,
|
|
595
593
|
onTaskChanged: () => void v.invalidateQueries({ queryKey: ["my-work"] })
|
|
596
594
|
}
|
|
597
595
|
),
|
|
598
|
-
|
|
596
|
+
r.due_date && /* @__PURE__ */ e(
|
|
599
597
|
"span",
|
|
600
598
|
{
|
|
601
|
-
className: `text-[11px] tabular-nums ${
|
|
602
|
-
children: new Date(
|
|
599
|
+
className: `text-[11px] tabular-nums ${F(r.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
600
|
+
children: new Date(r.due_date).toLocaleDateString(void 0, { timeZone: "UTC" })
|
|
603
601
|
}
|
|
604
602
|
)
|
|
605
603
|
]
|
|
606
604
|
},
|
|
607
|
-
|
|
605
|
+
r.id
|
|
608
606
|
)) })
|
|
609
607
|
] }),
|
|
610
|
-
team: () => !a.on_a_team && !(a.team_tasks ?? []).length ? null : /* @__PURE__ */
|
|
608
|
+
team: () => !a.on_a_team && !(a.team_tasks ?? []).length ? null : /* @__PURE__ */ s(
|
|
611
609
|
"section",
|
|
612
610
|
{
|
|
613
611
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
614
612
|
"data-my-work-team": !0,
|
|
615
613
|
children: [
|
|
616
|
-
/* @__PURE__ */
|
|
614
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
617
615
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Team tasks" }),
|
|
618
616
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Waiting with a team you are on — pick one up to make it yours." })
|
|
619
617
|
] }),
|
|
620
|
-
(a.team_tasks ?? []).length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "Nothing waiting with your teams." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.team_tasks ?? []).map((
|
|
618
|
+
(a.team_tasks ?? []).length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "Nothing waiting with your teams." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.team_tasks ?? []).map((r) => /* @__PURE__ */ s(
|
|
621
619
|
"li",
|
|
622
620
|
{
|
|
623
|
-
className: I("flex items-center gap-2.5 px-4 py-2", S(`tt:${
|
|
624
|
-
"data-my-work-team-task":
|
|
621
|
+
className: I("flex items-center gap-2.5 px-4 py-2", S(`tt:${r.id}`)),
|
|
622
|
+
"data-my-work-team-task": r.id,
|
|
625
623
|
children: [
|
|
626
|
-
|
|
627
|
-
/* @__PURE__ */
|
|
624
|
+
r.priority === "urgent" && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-red-500/10 px-1 py-px text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" }),
|
|
625
|
+
/* @__PURE__ */ s(
|
|
628
626
|
"button",
|
|
629
627
|
{
|
|
630
628
|
type: "button",
|
|
631
|
-
onClick: (m) => C(
|
|
629
|
+
onClick: (m) => C(r.collection, r.item, m),
|
|
632
630
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
633
631
|
children: [
|
|
634
|
-
|
|
635
|
-
/* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-muted-foreground", children: [
|
|
632
|
+
r.title,
|
|
633
|
+
/* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-muted-foreground", children: [r.team_name, r.item_label].filter(Boolean).join(" · ") })
|
|
636
634
|
]
|
|
637
635
|
}
|
|
638
636
|
),
|
|
639
|
-
|
|
637
|
+
r.due_date && /* @__PURE__ */ e(
|
|
640
638
|
"span",
|
|
641
639
|
{
|
|
642
|
-
className: `text-[11px] tabular-nums ${
|
|
643
|
-
children: new Date(
|
|
640
|
+
className: `text-[11px] tabular-nums ${F(r.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
641
|
+
children: new Date(r.due_date).toLocaleDateString(void 0, {
|
|
644
642
|
timeZone: "UTC"
|
|
645
643
|
})
|
|
646
644
|
}
|
|
@@ -649,51 +647,51 @@ function Pt({
|
|
|
649
647
|
"button",
|
|
650
648
|
{
|
|
651
649
|
type: "button",
|
|
652
|
-
onClick: () => q.mutate({ id:
|
|
650
|
+
onClick: () => q.mutate({ id: r.id, action: "claim" }),
|
|
653
651
|
disabled: q.isPending,
|
|
654
652
|
className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted dark:border-border",
|
|
655
|
-
"data-my-work-claim":
|
|
653
|
+
"data-my-work-claim": r.id,
|
|
656
654
|
children: "Pick it up"
|
|
657
655
|
}
|
|
658
656
|
)
|
|
659
657
|
]
|
|
660
658
|
},
|
|
661
|
-
|
|
659
|
+
r.id
|
|
662
660
|
)) })
|
|
663
661
|
]
|
|
664
662
|
}
|
|
665
663
|
),
|
|
666
664
|
waiting: () => {
|
|
667
|
-
const
|
|
668
|
-
return /* @__PURE__ */
|
|
665
|
+
const r = a.requested ?? [], m = r.filter((o) => F(o.due_date)).length;
|
|
666
|
+
return /* @__PURE__ */ s(
|
|
669
667
|
"section",
|
|
670
668
|
{
|
|
671
669
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
672
670
|
"data-my-work-waiting": !0,
|
|
673
671
|
children: [
|
|
674
|
-
/* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ s("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
673
|
+
/* @__PURE__ */ s("h2", { className: "text-[13px] font-medium", children: [
|
|
676
674
|
"Waiting on others",
|
|
677
|
-
m > 0 && /* @__PURE__ */
|
|
675
|
+
m > 0 && /* @__PURE__ */ s("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
|
|
678
676
|
m,
|
|
679
677
|
" overdue"
|
|
680
678
|
] })
|
|
681
679
|
] }),
|
|
682
680
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
|
|
683
681
|
] }),
|
|
684
|
-
|
|
685
|
-
const N =
|
|
686
|
-
return /* @__PURE__ */
|
|
682
|
+
r.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: r.map((o) => {
|
|
683
|
+
const N = F(o.due_date), T = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
|
|
684
|
+
return /* @__PURE__ */ s(
|
|
687
685
|
"li",
|
|
688
686
|
{
|
|
689
687
|
className: I("flex items-center gap-2.5 px-4 py-2", S(`r:${o.id}`)),
|
|
690
688
|
"data-my-work-requested": o.id,
|
|
691
689
|
children: [
|
|
692
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ s(
|
|
693
691
|
"button",
|
|
694
692
|
{
|
|
695
693
|
type: "button",
|
|
696
|
-
onClick: (
|
|
694
|
+
onClick: (Q) => o.kind === "support" ? Y(o.id) : C(o.collection, o.item, Q),
|
|
697
695
|
className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
|
|
698
696
|
children: [
|
|
699
697
|
o.title,
|
|
@@ -704,7 +702,7 @@ function Pt({
|
|
|
704
702
|
]
|
|
705
703
|
}
|
|
706
704
|
),
|
|
707
|
-
o.due_date && /* @__PURE__ */
|
|
705
|
+
o.due_date && /* @__PURE__ */ s(
|
|
708
706
|
"span",
|
|
709
707
|
{
|
|
710
708
|
className: `text-[11px] tabular-nums ${N ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
@@ -737,48 +735,48 @@ function Pt({
|
|
|
737
735
|
}
|
|
738
736
|
);
|
|
739
737
|
},
|
|
740
|
-
notifications: () => /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
738
|
+
notifications: () => /* @__PURE__ */ s("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
739
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
742
740
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Unread notifications" }),
|
|
743
741
|
a.notifications.length > 0 && /* @__PURE__ */ e(
|
|
744
742
|
"button",
|
|
745
743
|
{
|
|
746
744
|
type: "button",
|
|
747
|
-
onClick: () =>
|
|
745
|
+
onClick: () => ne.mutate(a.notifications.map((r) => r.id)),
|
|
748
746
|
className: "text-[11px] text-[#00a5cc] hover:underline",
|
|
749
747
|
children: "Mark all read"
|
|
750
748
|
}
|
|
751
749
|
)
|
|
752
750
|
] }),
|
|
753
|
-
a.notifications.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You're all caught up." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.notifications.map((
|
|
751
|
+
a.notifications.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You're all caught up." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.notifications.map((r) => /* @__PURE__ */ s(
|
|
754
752
|
"li",
|
|
755
753
|
{
|
|
756
|
-
className: I("flex items-start gap-2.5 px-4 py-2", S(`n:${
|
|
754
|
+
className: I("flex items-start gap-2.5 px-4 py-2", S(`n:${r.id}`)),
|
|
757
755
|
children: [
|
|
758
756
|
/* @__PURE__ */ e(
|
|
759
|
-
|
|
757
|
+
nt,
|
|
760
758
|
{
|
|
761
|
-
userId:
|
|
759
|
+
userId: r.sender,
|
|
762
760
|
className: "mt-0.5 h-5 w-5",
|
|
763
761
|
fallback: /* @__PURE__ */ e("span", { className: "mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-slate-100 text-[9px] font-semibold text-slate-500 dark:bg-muted" })
|
|
764
762
|
}
|
|
765
763
|
),
|
|
766
|
-
|
|
764
|
+
Ne(r.collection, r.item) ? /* @__PURE__ */ s(
|
|
767
765
|
"button",
|
|
768
766
|
{
|
|
769
767
|
type: "button",
|
|
770
|
-
onClick: (m) => C(
|
|
768
|
+
onClick: (m) => C(r.collection, r.item, m, a.notifications),
|
|
771
769
|
className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
|
|
772
770
|
children: [
|
|
773
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children:
|
|
774
|
-
|
|
771
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: r.subject }),
|
|
772
|
+
r.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: r.message })
|
|
775
773
|
]
|
|
776
774
|
}
|
|
777
775
|
) : (
|
|
778
776
|
// Nowhere to open: plain text, never a button that does nothing.
|
|
779
|
-
/* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children:
|
|
781
|
-
|
|
777
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", "data-notification-plain": !0, children: [
|
|
778
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: r.subject }),
|
|
779
|
+
r.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: r.message })
|
|
782
780
|
] })
|
|
783
781
|
),
|
|
784
782
|
/* @__PURE__ */ e(
|
|
@@ -787,58 +785,58 @@ function Pt({
|
|
|
787
785
|
type: "button",
|
|
788
786
|
"aria-label": "Mark read",
|
|
789
787
|
"data-tip": "Mark read",
|
|
790
|
-
onClick: () =>
|
|
788
|
+
onClick: () => ne.mutate([r.id]),
|
|
791
789
|
className: "mt-0.5 shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
|
|
792
|
-
children: /* @__PURE__ */ e(
|
|
790
|
+
children: /* @__PURE__ */ e(Ce, { className: "h-3 w-3" })
|
|
793
791
|
}
|
|
794
792
|
)
|
|
795
793
|
]
|
|
796
794
|
},
|
|
797
|
-
|
|
795
|
+
r.id
|
|
798
796
|
)) })
|
|
799
797
|
] })
|
|
800
|
-
},
|
|
801
|
-
x.order.filter((
|
|
802
|
-
), h = [...
|
|
798
|
+
}, n = new Map(
|
|
799
|
+
x.order.filter((r) => !x.hidden.includes(r) && t[r]).map((r) => [r, t[r]()]).filter(([, r]) => r != null)
|
|
800
|
+
), h = [...n.keys()], c = [];
|
|
803
801
|
let b = 0;
|
|
804
802
|
for (; b < h.length; ) {
|
|
805
|
-
const
|
|
806
|
-
if (
|
|
803
|
+
const r = h[b];
|
|
804
|
+
if (he.has(r))
|
|
807
805
|
c.push(
|
|
808
|
-
/* @__PURE__ */ e("div", { className: "min-w-0", children:
|
|
806
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: n.get(r) }, r)
|
|
809
807
|
), b++;
|
|
810
808
|
else {
|
|
811
|
-
const m = [
|
|
812
|
-
b + 1 < h.length && !
|
|
813
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: m.map((o) => /* @__PURE__ */ e("div", { className: "min-w-0", children:
|
|
809
|
+
const m = [r];
|
|
810
|
+
b + 1 < h.length && !he.has(h[b + 1]) && m.push(h[b + 1]), c.push(
|
|
811
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: m.map((o) => /* @__PURE__ */ e("div", { className: "min-w-0", children: n.get(o) }, o)) }, m.join("+"))
|
|
814
812
|
), b += m.length;
|
|
815
813
|
}
|
|
816
814
|
}
|
|
817
815
|
return c;
|
|
818
816
|
})(),
|
|
819
|
-
/* @__PURE__ */ e(
|
|
817
|
+
/* @__PURE__ */ e(pt, {})
|
|
820
818
|
] });
|
|
821
819
|
}
|
|
822
|
-
function
|
|
823
|
-
const d =
|
|
824
|
-
return !d || u.length === 0 ? null : /* @__PURE__ */
|
|
820
|
+
function pt() {
|
|
821
|
+
const d = Ye(), { rooms: u } = Ze(d);
|
|
822
|
+
return !d || u.length === 0 ? null : /* @__PURE__ */ s(
|
|
825
823
|
"section",
|
|
826
824
|
{
|
|
827
825
|
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
828
826
|
"data-my-work-chat": !0,
|
|
829
827
|
children: [
|
|
830
828
|
/* @__PURE__ */ e("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Record conversations" }) }),
|
|
831
|
-
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
|
|
832
830
|
"button",
|
|
833
831
|
{
|
|
834
832
|
type: "button",
|
|
835
|
-
onClick: () =>
|
|
833
|
+
onClick: () => Ve(l.room, l.label),
|
|
836
834
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
837
835
|
"data-my-work-chat-room": l.room,
|
|
838
836
|
children: [
|
|
839
|
-
/* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
|
|
840
838
|
/* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium", children: l.label }),
|
|
841
|
-
l.last_message && /* @__PURE__ */
|
|
839
|
+
l.last_message && /* @__PURE__ */ s("span", { className: "block truncate text-[11.5px] text-muted-foreground", children: [
|
|
842
840
|
l.last_message.sender_name ? `${l.last_message.sender_name}: ` : "",
|
|
843
841
|
l.last_message.message.replace(/@\[([^\]]+)\]/g, "@$1")
|
|
844
842
|
] })
|
|
@@ -854,5 +852,5 @@ function ht() {
|
|
|
854
852
|
}
|
|
855
853
|
export {
|
|
856
854
|
Pt as MyWorkView,
|
|
857
|
-
|
|
855
|
+
lt as touchesOnScreen
|
|
858
856
|
};
|