@nivaro/react 0.3.99 → 0.3.100
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/useFormSchema.js +82 -85
- package/dist/hooks/useSessionRecorder.js +206 -175
- package/dist/index.d.ts +38 -13
- package/dist/index.js +182 -180
- package/dist/lib/commands.js +15 -11
- package/dist/shared/components/CollectionBrowserView.js +516 -503
- package/dist/shared/components/ItemEditForm.js +3021 -3019
- package/dist/shared/components/JobsTray.js +20 -16
- package/dist/shared/components/MyWorkView.js +133 -126
- package/dist/shared/components/NotificationBell.js +314 -288
- package/dist/shared/components/RecordCompare.js +38 -40
- package/dist/shared/components/RecordReadView.js +119 -119
- package/dist/shared/components/cbv/FoundElsewhere.js +61 -0
- package/dist/shared/components/item-edit/InlineGridField.js +45 -45
- package/dist/shared/components/item-edit/InlineTableField.js +750 -749
- package/dist/shared/components/item-edit/QuickPickerDialog.js +44 -44
- package/dist/shared/components/item-edit/RawEditSheet.js +122 -114
- package/dist/shared/components/item-edit/RelationCombobox.js +454 -378
- package/dist/shared/components/item-edit/SummaryPanel.js +56 -48
- package/dist/shared/components/item-edit/related-missing.js +75 -19
- package/dist/shared/components/notifications/NotificationCenterView.js +249 -226
- package/dist/shared/components/panels/AccessDeniedPanel.js +31 -28
- package/dist/shared/components/panels/BackgroundMove.js +175 -0
- package/dist/shared/components/panels/MoveAdvisory.js +204 -0
- package/dist/shared/components/panels/PipelinePanel.js +1450 -1219
- package/dist/shared/components/panels/RecordIntegrityBanner.js +113 -112
- package/dist/shared/lib/commands.js +18 -14
- package/dist/shared/lib/error-hints.js +1 -1
- package/dist/shared/lib/job-failure-text.js +12 -0
- package/dist/shared/lib/move-failure.js +9 -0
- package/dist/shared/lib/obligation-banner.js +15 -14
- package/dist/shared/lib/partner-failure.js +71 -0
- package/dist/shared/lib/prefetch.js +73 -73
- package/dist/shared/lib/replay-checkout.js +18 -13
- package/dist/shared/lib/replay-context.js +90 -77
- package/dist/shared/lib/replay-idle.js +21 -0
- package/dist/shared/lib/replay-socket.js +21 -17
- package/dist/shared/lib/rum.js +56 -51
- package/dist/shared/lib/safe-error.js +17 -13
- package/dist/shared/lib/stale-chunk.js +69 -26
- package/dist/shared/lib/system-collections.js +20 -0
- package/package.json +1 -1
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { jsx as e, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as le, useQuery as ce, useMutation as F } from "@tanstack/react-query";
|
|
3
|
-
import {
|
|
4
|
-
import { useState as C, useRef as W, useEffect as E, useMemo as
|
|
5
|
-
import { useApiFetchConfig as
|
|
6
|
-
import { useLiveEvent as
|
|
7
|
-
import { useLiveOps as
|
|
8
|
-
import { resolveNotificationTarget as Z, runNotificationTarget as
|
|
9
|
-
import { usePrefetchIntent as
|
|
10
|
-
import { useOptionalRealtime as
|
|
11
|
-
import { userErrorMessage as
|
|
12
|
-
import { withinDay as G, slaChip as
|
|
3
|
+
import { Check as me, Bot as ue } from "lucide-react";
|
|
4
|
+
import { useState as C, useRef as W, useEffect as E, useMemo as pe } from "react";
|
|
5
|
+
import { useApiFetchConfig as he, useItemNavigation as be, useNavigation as xe } from "../context.js";
|
|
6
|
+
import { useLiveEvent as ge } from "../lib/live.js";
|
|
7
|
+
import { useLiveOps as fe, useFreshIds as ke } from "../lib/live-ops.js";
|
|
8
|
+
import { resolveNotificationTarget as Z, runNotificationTarget as ye } from "../lib/notification-target.js";
|
|
9
|
+
import { usePrefetchIntent as we } from "../lib/prefetch.js";
|
|
10
|
+
import { useOptionalRealtime as Ne } from "../lib/realtime.js";
|
|
11
|
+
import { userErrorMessage as ve } from "../lib/safe-error.js";
|
|
12
|
+
import { withinDay as G, slaChip as _e } from "../lib/sla-chip.js";
|
|
13
13
|
import { cn as M } from "../lib/utils.js";
|
|
14
|
-
import { AgentQuestionsCard as
|
|
15
|
-
import { FirstWeekCard as
|
|
16
|
-
import { TaskDoButton as
|
|
17
|
-
import { openChatRoom as
|
|
18
|
-
import { useMyRecordRooms as
|
|
19
|
-
import { LearningPathCard as
|
|
20
|
-
import { RequiredVideosCard as
|
|
21
|
-
import { SkeletonBar as
|
|
22
|
-
import { TickerNumber as
|
|
23
|
-
import { UserAvatar as
|
|
24
|
-
const
|
|
14
|
+
import { AgentQuestionsCard as Ce } from "./AgentQuestionsCard.js";
|
|
15
|
+
import { FirstWeekCard as $e } from "./ai/FirstWeekCard.js";
|
|
16
|
+
import { TaskDoButton as Se } from "./ai/TaskDo.js";
|
|
17
|
+
import { openChatRoom as Te, canOpenChatRoom as je } from "./chat/chat-core.js";
|
|
18
|
+
import { useMyRecordRooms as Ae } from "./chat/chat-hooks.js";
|
|
19
|
+
import { LearningPathCard as Me } from "./help-videos/viewer/LearningPathCard.js";
|
|
20
|
+
import { RequiredVideosCard as Oe } from "./help-videos/viewer/RequiredVideosCard.js";
|
|
21
|
+
import { SkeletonBar as Le, ListSkeleton as qe } from "./Skeletons.js";
|
|
22
|
+
import { TickerNumber as Ie } from "./TickerNumber.js";
|
|
23
|
+
import { UserAvatar as De } from "./UserAvatar.js";
|
|
24
|
+
const Fe = 8e3, R = ["records", "tasks", "team", "waiting", "notifications"], X = {
|
|
25
25
|
records: "Waiting on you",
|
|
26
26
|
tasks: "My tasks",
|
|
27
27
|
team: "Team tasks",
|
|
28
28
|
waiting: "Waiting on others",
|
|
29
29
|
notifications: "Notifications"
|
|
30
|
-
},
|
|
30
|
+
}, We = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), O = (i) => !!i && String(i).slice(0, 10) < We(), Ee = {
|
|
31
31
|
alert: "bg-red-500/10 text-red-600 dark:text-red-400",
|
|
32
32
|
warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
|
|
33
33
|
neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
|
|
34
34
|
ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
const u =
|
|
36
|
+
function Ue({ sla: i }) {
|
|
37
|
+
const u = _e(i);
|
|
38
38
|
return u ? /* @__PURE__ */ e(
|
|
39
39
|
"span",
|
|
40
40
|
{
|
|
41
41
|
"data-sla-chip": u.tone,
|
|
42
|
-
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${
|
|
42
|
+
className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums ${Ee[u.tone]}`,
|
|
43
43
|
children: u.label
|
|
44
44
|
}
|
|
45
45
|
) : null;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Ke({ state: i, color: u }) {
|
|
48
48
|
return i ? /* @__PURE__ */ e(
|
|
49
49
|
"span",
|
|
50
50
|
{
|
|
@@ -57,7 +57,7 @@ function Ue({ state: i, color: u }) {
|
|
|
57
57
|
}
|
|
58
58
|
) : null;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function Pe({ order: i, hidden: u }) {
|
|
61
61
|
const c = i.filter(
|
|
62
62
|
(m) => !u.includes(m) && (m === "records" || m === "tasks" || m === "notifications")
|
|
63
63
|
), w = (m, g) => /* @__PURE__ */ d(
|
|
@@ -70,7 +70,7 @@ function Ke({ order: i, hidden: u }) {
|
|
|
70
70
|
m === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
71
71
|
] }),
|
|
72
72
|
/* @__PURE__ */ e(
|
|
73
|
-
|
|
73
|
+
qe,
|
|
74
74
|
{
|
|
75
75
|
header: !1,
|
|
76
76
|
rows: g,
|
|
@@ -108,7 +108,7 @@ function Ke({ order: i, hidden: u }) {
|
|
|
108
108
|
className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
|
|
109
109
|
children: [
|
|
110
110
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: m }),
|
|
111
|
-
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(
|
|
111
|
+
/* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Le, { width: 34, className: "h-[18px] rounded-md" }) })
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
114
|
m
|
|
@@ -122,28 +122,28 @@ function Ke({ order: i, hidden: u }) {
|
|
|
122
122
|
function L({ label: i, value: u, tone: c }) {
|
|
123
123
|
return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
|
|
124
124
|
/* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: i }),
|
|
125
|
-
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(
|
|
125
|
+
/* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(Ie, { value: u }) })
|
|
126
126
|
] });
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function pt({
|
|
129
129
|
notificationRoutes: i,
|
|
130
130
|
onOpenPath: u
|
|
131
131
|
} = {}) {
|
|
132
|
-
const { apiBase: c, authHeaders: w, credentials: k } =
|
|
133
|
-
var
|
|
134
|
-
const
|
|
135
|
-
u ? u(
|
|
136
|
-
}, q =
|
|
132
|
+
const { apiBase: c, authHeaders: w, credentials: k } = he(), { open: m } = be(), g = xe(), f = le(), ee = we(), U = (r) => {
|
|
133
|
+
var b, l;
|
|
134
|
+
const s = ((b = i == null ? void 0 : i.support) == null ? void 0 : b.call(i, String(r))) ?? ((l = g.consoleUrl) == null ? void 0 : l.call(g, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
|
|
135
|
+
u ? u(s) : g.navigate(s);
|
|
136
|
+
}, q = Ne(), [te, $] = C(!1), [x, re] = C(() => {
|
|
137
137
|
try {
|
|
138
138
|
const r = localStorage.getItem("nvr_mywork_sections");
|
|
139
139
|
if (r) {
|
|
140
|
-
const
|
|
141
|
-
if (Array.isArray(
|
|
142
|
-
const
|
|
140
|
+
const s = JSON.parse(r);
|
|
141
|
+
if (Array.isArray(s == null ? void 0 : s.order) && Array.isArray(s == null ? void 0 : s.hidden)) {
|
|
142
|
+
const b = R.map((l, p) => ({
|
|
143
143
|
k: l,
|
|
144
|
-
at:
|
|
144
|
+
at: s.order.indexOf(l) >= 0 ? s.order.indexOf(l) : p - 0.5
|
|
145
145
|
})).sort((l, p) => l.at - p.at).map((l) => l.k);
|
|
146
|
-
return { order:
|
|
146
|
+
return { order: b, hidden: s.hidden.filter((l) => b.includes(l)) };
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
} catch {
|
|
@@ -155,7 +155,7 @@ function ut({
|
|
|
155
155
|
localStorage.setItem("nvr_mywork_sections", JSON.stringify(r));
|
|
156
156
|
} catch {
|
|
157
157
|
}
|
|
158
|
-
}, [ae, de] = C(!1), P = W(0), [S,
|
|
158
|
+
}, [ae, de] = C(!1), P = W(0), [S, se] = C("all"), { data: a, isLoading: ne, refetch: Q, isFetching: B } = ce({
|
|
159
159
|
queryKey: ["my-work"],
|
|
160
160
|
queryFn: async () => {
|
|
161
161
|
const r = await fetch(`${c}/my-work`, { headers: w, credentials: k });
|
|
@@ -166,24 +166,24 @@ function ut({
|
|
|
166
166
|
}), z = W(0), N = W(null), H = () => {
|
|
167
167
|
const r = () => {
|
|
168
168
|
N.current = null, z.current = Date.now(), $(!1), f.invalidateQueries({ queryKey: ["my-work"] });
|
|
169
|
-
},
|
|
170
|
-
N.current || (
|
|
169
|
+
}, s = z.current + Fe - Date.now();
|
|
170
|
+
N.current || (s <= 0 ? r() : N.current = setTimeout(r, s));
|
|
171
171
|
};
|
|
172
|
-
|
|
172
|
+
fe("my-work", H, { debounceMs: 1500 }), ge("notification:new", H, { debounceMs: 1500 }), E(
|
|
173
173
|
() => () => {
|
|
174
174
|
N.current && clearTimeout(N.current);
|
|
175
175
|
},
|
|
176
176
|
[]
|
|
177
177
|
);
|
|
178
|
-
const J =
|
|
178
|
+
const J = ke([
|
|
179
179
|
...((a == null ? void 0 : a.owned) ?? []).map((r) => `o:${r.collection}:${r.item}`),
|
|
180
180
|
...((a == null ? void 0 : a.tasks) ?? []).map((r) => `t:${r.id}`),
|
|
181
181
|
...((a == null ? void 0 : a.team_tasks) ?? []).map((r) => `tt:${r.id}`),
|
|
182
182
|
...((a == null ? void 0 : a.requested) ?? []).map((r) => `r:${r.id}`),
|
|
183
183
|
...((a == null ? void 0 : a.notifications) ?? []).map((r) => `n:${r.id}`)
|
|
184
|
-
]), v = (r) => J.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", I =
|
|
184
|
+
]), v = (r) => J.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", I = pe(() => {
|
|
185
185
|
const r = /* @__PURE__ */ new Set();
|
|
186
|
-
for (const
|
|
186
|
+
for (const s of (a == null ? void 0 : a.owned) ?? []) s.collection && r.add(s.collection);
|
|
187
187
|
return [...r];
|
|
188
188
|
}, [a]);
|
|
189
189
|
E(() => {
|
|
@@ -203,20 +203,20 @@ function ut({
|
|
|
203
203
|
}),
|
|
204
204
|
onSuccess: () => f.invalidateQueries({ queryKey: ["my-work"] })
|
|
205
205
|
}), T = F({
|
|
206
|
-
mutationFn: async ({ id: r, action:
|
|
207
|
-
const
|
|
206
|
+
mutationFn: async ({ id: r, action: s }) => {
|
|
207
|
+
const b = await fetch(`${c}/tasks/${r}/${s}`, {
|
|
208
208
|
method: "POST",
|
|
209
209
|
headers: { ...w, "content-type": "application/json" },
|
|
210
210
|
credentials: k,
|
|
211
211
|
body: "{}"
|
|
212
|
-
}), l = await
|
|
213
|
-
if (!
|
|
214
|
-
return
|
|
212
|
+
}), l = await b.json().catch(() => ({}));
|
|
213
|
+
if (!b.ok) throw new Error(l.error ?? "Failed");
|
|
214
|
+
return s;
|
|
215
215
|
},
|
|
216
216
|
onSuccess: (r) => {
|
|
217
217
|
D(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), f.invalidateQueries({ queryKey: ["my-work"] });
|
|
218
218
|
},
|
|
219
|
-
onError: (r) => D(
|
|
219
|
+
onError: (r) => D(ve(r, "Failed"))
|
|
220
220
|
}), [j, D] = C(null);
|
|
221
221
|
E(() => {
|
|
222
222
|
if (!j) return;
|
|
@@ -233,28 +233,28 @@ function ut({
|
|
|
233
233
|
onSuccess: () => {
|
|
234
234
|
f.invalidateQueries({ queryKey: ["my-work"] }), f.invalidateQueries({ queryKey: ["notifications"] });
|
|
235
235
|
}
|
|
236
|
-
}), _ = (r,
|
|
237
|
-
const
|
|
236
|
+
}), _ = (r, s) => {
|
|
237
|
+
const b = {
|
|
238
238
|
record: (p, t) => (m({ collection: p, itemId: t }), null),
|
|
239
239
|
...i
|
|
240
|
-
}, l = Z(r,
|
|
241
|
-
...
|
|
240
|
+
}, l = Z(r, s, {
|
|
241
|
+
...b,
|
|
242
242
|
record: (p, t) => {
|
|
243
|
-
var
|
|
244
|
-
return ((
|
|
243
|
+
var h;
|
|
244
|
+
return ((h = i == null ? void 0 : i.record) == null ? void 0 : h.call(i, p, t)) ?? null;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
if (l) {
|
|
248
|
-
|
|
248
|
+
ye(l, (p) => u == null ? void 0 : u(p));
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
|
-
r &&
|
|
252
|
-
}, oe = (r,
|
|
251
|
+
r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && m({ collection: r, itemId: s });
|
|
252
|
+
}, oe = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!Z(r, s, {
|
|
253
253
|
record: () => null,
|
|
254
254
|
...i
|
|
255
255
|
});
|
|
256
|
-
return
|
|
257
|
-
/* @__PURE__ */ e(
|
|
256
|
+
return ne || !a ? /* @__PURE__ */ e(Pe, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ d("div", { className: "space-y-5 p-6", "data-my-work": !0, children: [
|
|
257
|
+
/* @__PURE__ */ e($e, { onOpenPath: u }),
|
|
258
258
|
/* @__PURE__ */ d("div", { className: "flex items-start justify-between", children: [
|
|
259
259
|
/* @__PURE__ */ d("div", { className: "grid flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
|
|
260
260
|
/* @__PURE__ */ e(L, { label: "Waiting on you", value: a.counts.owned }),
|
|
@@ -307,10 +307,10 @@ function ut({
|
|
|
307
307
|
),
|
|
308
308
|
ae && /* @__PURE__ */ d("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: [
|
|
309
309
|
/* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
|
|
310
|
-
x.order.map((r,
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
o < 0 || o >=
|
|
310
|
+
x.order.map((r, s) => {
|
|
311
|
+
const b = X[r] ?? r, l = x.hidden.includes(r), p = (t) => {
|
|
312
|
+
const h = [...x.order], o = s + t;
|
|
313
|
+
o < 0 || o >= h.length || ([h[s], h[o]] = [h[o], h[s]], K({ ...x, order: h }));
|
|
314
314
|
};
|
|
315
315
|
return /* @__PURE__ */ d("div", { className: "flex items-center gap-1 rounded px-1 py-1 hover:bg-muted", children: [
|
|
316
316
|
/* @__PURE__ */ e(
|
|
@@ -330,7 +330,7 @@ function ut({
|
|
|
330
330
|
"span",
|
|
331
331
|
{
|
|
332
332
|
className: `min-w-0 flex-1 truncate text-[12px] ${l ? "text-slate-400 line-through" : ""}`,
|
|
333
|
-
children:
|
|
333
|
+
children: b
|
|
334
334
|
}
|
|
335
335
|
),
|
|
336
336
|
/* @__PURE__ */ e(
|
|
@@ -338,7 +338,7 @@ function ut({
|
|
|
338
338
|
{
|
|
339
339
|
type: "button",
|
|
340
340
|
onClick: () => p(-1),
|
|
341
|
-
disabled:
|
|
341
|
+
disabled: s === 0,
|
|
342
342
|
className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
|
|
343
343
|
children: "↑"
|
|
344
344
|
}
|
|
@@ -348,7 +348,7 @@ function ut({
|
|
|
348
348
|
{
|
|
349
349
|
type: "button",
|
|
350
350
|
onClick: () => p(1),
|
|
351
|
-
disabled:
|
|
351
|
+
disabled: s === x.order.length - 1,
|
|
352
352
|
className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
|
|
353
353
|
children: "↓"
|
|
354
354
|
}
|
|
@@ -367,61 +367,61 @@ function ut({
|
|
|
367
367
|
children: j
|
|
368
368
|
}
|
|
369
369
|
),
|
|
370
|
-
/* @__PURE__ */ e(
|
|
370
|
+
/* @__PURE__ */ e(Ce, { questions: a.questions ?? [] }),
|
|
371
|
+
/* @__PURE__ */ e(Oe, { className: "mb-4" }),
|
|
371
372
|
/* @__PURE__ */ e(Me, { className: "mb-4" }),
|
|
372
|
-
/* @__PURE__ */ e(Ae, { className: "mb-4" }),
|
|
373
373
|
(() => {
|
|
374
374
|
const r = {
|
|
375
375
|
records: () => {
|
|
376
|
-
const t = a.owned.filter((
|
|
376
|
+
const t = a.owned.filter((n) => G(n.sla)).length, h = a.owned.filter((n) => {
|
|
377
377
|
var y;
|
|
378
|
-
return ((y =
|
|
379
|
-
}).length, o = S === "soon" ? a.owned.filter((
|
|
378
|
+
return ((y = n.sla) == null ? void 0 : y.status) === "breached";
|
|
379
|
+
}).length, o = S === "soon" ? a.owned.filter((n) => G(n.sla)) : S === "breached" ? a.owned.filter((n) => {
|
|
380
380
|
var y;
|
|
381
|
-
return ((y =
|
|
381
|
+
return ((y = n.sla) == null ? void 0 : y.status) === "breached";
|
|
382
382
|
}) : a.owned, A = [
|
|
383
383
|
{ key: "all", label: `All (${a.owned.length})` },
|
|
384
384
|
{ key: "soon", label: `Warning within 24h (${t})` },
|
|
385
|
-
{ key: "breached", label: `Breached (${
|
|
385
|
+
{ key: "breached", label: `Breached (${h})` }
|
|
386
386
|
];
|
|
387
387
|
return /* @__PURE__ */ d("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
388
388
|
/* @__PURE__ */ d("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
389
389
|
/* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Waiting on you" }),
|
|
390
390
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
|
|
391
391
|
] }),
|
|
392
|
-
a.owned.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: A.map((
|
|
392
|
+
a.owned.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: A.map((n) => /* @__PURE__ */ e(
|
|
393
393
|
"button",
|
|
394
394
|
{
|
|
395
395
|
type: "button",
|
|
396
|
-
"data-my-work-sla-filter":
|
|
397
|
-
"aria-pressed": S ===
|
|
398
|
-
onClick: () =>
|
|
396
|
+
"data-my-work-sla-filter": n.key,
|
|
397
|
+
"aria-pressed": S === n.key,
|
|
398
|
+
onClick: () => se(n.key),
|
|
399
399
|
className: [
|
|
400
400
|
"rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
|
|
401
|
-
S ===
|
|
401
|
+
S === n.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"
|
|
402
402
|
].join(" "),
|
|
403
|
-
children:
|
|
403
|
+
children: n.label
|
|
404
404
|
},
|
|
405
|
-
|
|
405
|
+
n.key
|
|
406
406
|
)) }) }),
|
|
407
|
-
o.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("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: o.map((
|
|
407
|
+
o.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("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: o.map((n) => {
|
|
408
408
|
var y;
|
|
409
409
|
return /* @__PURE__ */ e(
|
|
410
410
|
"li",
|
|
411
411
|
{
|
|
412
|
-
className: v(`o:${
|
|
413
|
-
"data-my-work-fresh": J.has(`o:${
|
|
412
|
+
className: v(`o:${n.collection}:${n.item}`),
|
|
413
|
+
"data-my-work-fresh": J.has(`o:${n.collection}:${n.item}`) || void 0,
|
|
414
414
|
children: /* @__PURE__ */ d(
|
|
415
415
|
"button",
|
|
416
416
|
{
|
|
417
417
|
type: "button",
|
|
418
|
-
onClick: () => _(
|
|
419
|
-
...ee.record(
|
|
418
|
+
onClick: () => _(n.collection, n.item),
|
|
419
|
+
...ee.record(n.collection, n.item),
|
|
420
420
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
|
|
421
421
|
children: [
|
|
422
|
-
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children:
|
|
423
|
-
/* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children:
|
|
424
|
-
((y =
|
|
422
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: n.label }),
|
|
423
|
+
/* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: n.collection.replace(/_/g, " ") }),
|
|
424
|
+
((y = n.flags) == null ? void 0 : y.some((ie) => /^on hold$/i.test(ie.name.trim()))) && /* @__PURE__ */ e(
|
|
425
425
|
"span",
|
|
426
426
|
{
|
|
427
427
|
"data-my-work-hold": !0,
|
|
@@ -429,13 +429,13 @@ function ut({
|
|
|
429
429
|
children: "On hold"
|
|
430
430
|
}
|
|
431
431
|
),
|
|
432
|
-
/* @__PURE__ */ e(
|
|
433
|
-
/* @__PURE__ */ e(
|
|
432
|
+
/* @__PURE__ */ e(Ke, { state: n.state, color: n.state_color }),
|
|
433
|
+
/* @__PURE__ */ e(Ue, { sla: n.sla })
|
|
434
434
|
]
|
|
435
435
|
}
|
|
436
436
|
)
|
|
437
437
|
},
|
|
438
|
-
`${
|
|
438
|
+
`${n.collection}:${n.item}`
|
|
439
439
|
);
|
|
440
440
|
}) })
|
|
441
441
|
] });
|
|
@@ -467,7 +467,7 @@ function ut({
|
|
|
467
467
|
"data-tip": `Handed to ${t.agent_name ?? "your agent"} — it picks this up through My Work`,
|
|
468
468
|
"data-my-work-agent-task": t.id,
|
|
469
469
|
children: [
|
|
470
|
-
/* @__PURE__ */ e(
|
|
470
|
+
/* @__PURE__ */ e(ue, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
471
471
|
t.agent_name ?? "Agent"
|
|
472
472
|
]
|
|
473
473
|
}
|
|
@@ -485,7 +485,7 @@ function ut({
|
|
|
485
485
|
}
|
|
486
486
|
),
|
|
487
487
|
/* @__PURE__ */ e(
|
|
488
|
-
|
|
488
|
+
Se,
|
|
489
489
|
{
|
|
490
490
|
task: t,
|
|
491
491
|
isAssignee: !0,
|
|
@@ -562,7 +562,7 @@ function ut({
|
|
|
562
562
|
}
|
|
563
563
|
),
|
|
564
564
|
waiting: () => {
|
|
565
|
-
const t = a.requested ?? [],
|
|
565
|
+
const t = a.requested ?? [], h = t.filter((o) => O(o.due_date)).length;
|
|
566
566
|
return /* @__PURE__ */ d(
|
|
567
567
|
"section",
|
|
568
568
|
{
|
|
@@ -572,15 +572,15 @@ function ut({
|
|
|
572
572
|
/* @__PURE__ */ d("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
|
|
573
573
|
/* @__PURE__ */ d("h2", { className: "text-[13px] font-medium", children: [
|
|
574
574
|
"Waiting on others",
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
h > 0 && /* @__PURE__ */ d("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: [
|
|
576
|
+
h,
|
|
577
577
|
" overdue"
|
|
578
578
|
] })
|
|
579
579
|
] }),
|
|
580
580
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
|
|
581
581
|
] }),
|
|
582
582
|
t.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: t.map((o) => {
|
|
583
|
-
const A = O(o.due_date),
|
|
583
|
+
const A = O(o.due_date), n = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
|
|
584
584
|
return /* @__PURE__ */ d(
|
|
585
585
|
"li",
|
|
586
586
|
{
|
|
@@ -619,11 +619,11 @@ function ut({
|
|
|
619
619
|
{
|
|
620
620
|
type: "button",
|
|
621
621
|
onClick: () => T.mutate({ id: o.id, action: "nudge" }),
|
|
622
|
-
disabled: T.isPending ||
|
|
623
|
-
title:
|
|
622
|
+
disabled: T.isPending || n,
|
|
623
|
+
title: n ? "Already nudged today" : "Send a reminder",
|
|
624
624
|
className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted disabled:opacity-50 dark:border-border",
|
|
625
625
|
"data-my-work-nudge": o.id,
|
|
626
|
-
children:
|
|
626
|
+
children: n ? "Nudged" : "Nudge"
|
|
627
627
|
}
|
|
628
628
|
)
|
|
629
629
|
]
|
|
@@ -654,33 +654,40 @@ function ut({
|
|
|
654
654
|
className: M("flex items-start gap-2.5 px-4 py-2", v(`n:${t.id}`)),
|
|
655
655
|
children: [
|
|
656
656
|
/* @__PURE__ */ e(
|
|
657
|
-
|
|
657
|
+
De,
|
|
658
658
|
{
|
|
659
659
|
userId: t.sender,
|
|
660
660
|
className: "mt-0.5 h-5 w-5",
|
|
661
661
|
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" })
|
|
662
662
|
}
|
|
663
663
|
),
|
|
664
|
-
/* @__PURE__ */ d(
|
|
664
|
+
oe(t.collection, t.item) ? /* @__PURE__ */ d(
|
|
665
665
|
"button",
|
|
666
666
|
{
|
|
667
667
|
type: "button",
|
|
668
668
|
onClick: () => _(t.collection, t.item),
|
|
669
|
-
className:
|
|
669
|
+
className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
|
|
670
670
|
children: [
|
|
671
671
|
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
|
|
672
672
|
t.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: t.message })
|
|
673
673
|
]
|
|
674
674
|
}
|
|
675
|
+
) : (
|
|
676
|
+
// Nowhere to open: plain text, never a button that does nothing.
|
|
677
|
+
/* @__PURE__ */ d("div", { className: "min-w-0 flex-1", "data-notification-plain": !0, children: [
|
|
678
|
+
/* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
|
|
679
|
+
t.message && /* @__PURE__ */ e("p", { className: "truncate text-[11.5px] text-muted-foreground", children: t.message })
|
|
680
|
+
] })
|
|
675
681
|
),
|
|
676
682
|
/* @__PURE__ */ e(
|
|
677
683
|
"button",
|
|
678
684
|
{
|
|
679
685
|
type: "button",
|
|
680
|
-
|
|
686
|
+
"aria-label": "Mark read",
|
|
687
|
+
"data-tip": "Mark read",
|
|
681
688
|
onClick: () => Y.mutate([t.id]),
|
|
682
|
-
className: "text-
|
|
683
|
-
children: "
|
|
689
|
+
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",
|
|
690
|
+
children: /* @__PURE__ */ e(me, { className: "h-3 w-3" })
|
|
684
691
|
}
|
|
685
692
|
)
|
|
686
693
|
]
|
|
@@ -688,28 +695,28 @@ function ut({
|
|
|
688
695
|
t.id
|
|
689
696
|
)) })
|
|
690
697
|
] })
|
|
691
|
-
},
|
|
698
|
+
}, s = new Map(
|
|
692
699
|
x.order.filter((t) => !x.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
|
|
693
|
-
),
|
|
700
|
+
), b = [...s.keys()], l = [];
|
|
694
701
|
let p = 0;
|
|
695
|
-
for (; p <
|
|
696
|
-
const t =
|
|
702
|
+
for (; p < b.length; ) {
|
|
703
|
+
const t = b[p];
|
|
697
704
|
if (t === "records")
|
|
698
|
-
l.push(/* @__PURE__ */ e("div", { children:
|
|
705
|
+
l.push(/* @__PURE__ */ e("div", { children: s.get(t) }, t)), p++;
|
|
699
706
|
else {
|
|
700
|
-
const
|
|
701
|
-
p + 1 <
|
|
702
|
-
/* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children:
|
|
703
|
-
), p +=
|
|
707
|
+
const h = [t];
|
|
708
|
+
p + 1 < b.length && b[p + 1] !== "records" && h.push(b[p + 1]), l.push(
|
|
709
|
+
/* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children: h.map((o) => /* @__PURE__ */ e("div", { children: s.get(o) }, o)) }, h.join("+"))
|
|
710
|
+
), p += h.length;
|
|
704
711
|
}
|
|
705
712
|
}
|
|
706
713
|
return l;
|
|
707
714
|
})(),
|
|
708
|
-
/* @__PURE__ */ e(
|
|
715
|
+
/* @__PURE__ */ e(Qe, {})
|
|
709
716
|
] });
|
|
710
717
|
}
|
|
711
|
-
function
|
|
712
|
-
const i =
|
|
718
|
+
function Qe() {
|
|
719
|
+
const i = je(), { rooms: u } = Ae(i);
|
|
713
720
|
return !i || u.length === 0 ? null : /* @__PURE__ */ d(
|
|
714
721
|
"section",
|
|
715
722
|
{
|
|
@@ -721,7 +728,7 @@ function Pe() {
|
|
|
721
728
|
"button",
|
|
722
729
|
{
|
|
723
730
|
type: "button",
|
|
724
|
-
onClick: () =>
|
|
731
|
+
onClick: () => Te(c.room, c.label),
|
|
725
732
|
className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
|
|
726
733
|
"data-my-work-chat-room": c.room,
|
|
727
734
|
children: [
|
|
@@ -742,5 +749,5 @@ function Pe() {
|
|
|
742
749
|
);
|
|
743
750
|
}
|
|
744
751
|
export {
|
|
745
|
-
|
|
752
|
+
pt as MyWorkView
|
|
746
753
|
};
|