@nivaro/react 0.2.56 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/components/slots/TasksSlot.js +31 -29
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +414 -1
  5. package/dist/index.js +767 -716
  6. package/dist/shared/components/ClientChaosToolbar.js +410 -0
  7. package/dist/shared/components/ItemEditForm.js +666 -658
  8. package/dist/shared/components/LoadErrorNote.js +49 -0
  9. package/dist/shared/components/MyWorkView.js +47 -37
  10. package/dist/shared/components/PretendDown.js +258 -0
  11. package/dist/shared/components/ProfileView.js +208 -184
  12. package/dist/shared/components/QueryErrorState.js +16 -0
  13. package/dist/shared/components/ReportView.js +1351 -1338
  14. package/dist/shared/components/WidgetSlot.js +438 -418
  15. package/dist/shared/components/ai/AiPlanCard.js +427 -0
  16. package/dist/shared/components/ai/AiPlanChanges.js +117 -0
  17. package/dist/shared/components/ai/TaskDo.js +1022 -0
  18. package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
  19. package/dist/shared/components/chaos/DrillBanner.js +119 -0
  20. package/dist/shared/components/chaos/DrillTag.js +62 -0
  21. package/dist/shared/components/chaos/GameDayStrip.js +61 -0
  22. package/dist/shared/components/chat/ChatAnalyticsView.js +19 -17
  23. package/dist/shared/components/chat/ChatPanel.js +1356 -1317
  24. package/dist/shared/components/chat/HuddleAnalyticsTab.js +198 -0
  25. package/dist/shared/components/chat/RoomHeaderMenu.js +78 -65
  26. package/dist/shared/components/chat/chat-core.js +273 -264
  27. package/dist/shared/components/chat/huddle/HuddleAudioUi.js +397 -0
  28. package/dist/shared/components/chat/huddle/HuddleCallBar.js +296 -0
  29. package/dist/shared/components/chat/huddle/HuddleCallLayer.js +180 -0
  30. package/dist/shared/components/chat/huddle/HuddleCamera.js +124 -0
  31. package/dist/shared/components/chat/huddle/HuddleCollab.js +320 -0
  32. package/dist/shared/components/chat/huddle/HuddleControls.js +82 -121
  33. package/dist/shared/components/chat/huddle/HuddleDraw.js +231 -0
  34. package/dist/shared/components/chat/huddle/HuddleLiveBadge.js +52 -0
  35. package/dist/shared/components/chat/huddle/HuddlePeoplePicker.js +143 -0
  36. package/dist/shared/components/chat/huddle/HuddleScheduleCard.js +190 -0
  37. package/dist/shared/components/chat/huddle/HuddleScheduleForm.js +188 -0
  38. package/dist/shared/components/chat/huddle/HuddleStage.js +184 -89
  39. package/dist/shared/components/chat/huddle/HuddleStageTools.js +197 -0
  40. package/dist/shared/components/chat/huddle/huddle-audio-logic.js +156 -0
  41. package/dist/shared/components/chat/huddle/huddle-audio.js +69 -0
  42. package/dist/shared/components/chat/huddle/huddle-calls.js +129 -0
  43. package/dist/shared/components/chat/huddle/huddle-camera.js +143 -0
  44. package/dist/shared/components/chat/huddle/huddle-collab-store.js +391 -0
  45. package/dist/shared/components/chat/huddle/huddle-device-prefs.js +55 -0
  46. package/dist/shared/components/chat/huddle/huddle-devices.js +99 -0
  47. package/dist/shared/components/chat/huddle/huddle-draw.js +226 -0
  48. package/dist/shared/components/chat/huddle/huddle-follow-bus.js +96 -0
  49. package/dist/shared/components/chat/huddle/huddle-hold.js +62 -0
  50. package/dist/shared/components/chat/huddle/huddle-link-quality.js +159 -0
  51. package/dist/shared/components/chat/huddle/huddle-live.js +82 -0
  52. package/dist/shared/components/chat/huddle/huddle-pip.js +343 -0
  53. package/dist/shared/components/chat/huddle/huddle-quality.js +22 -0
  54. package/dist/shared/components/chat/huddle/huddle-reactions.js +71 -0
  55. package/dist/shared/components/chat/huddle/huddle-ring-refused.js +34 -0
  56. package/dist/shared/components/chat/huddle/huddle-schedule.js +102 -0
  57. package/dist/shared/components/chat/huddle/huddle-sfu.js +176 -0
  58. package/dist/shared/components/chat/huddle/huddle-shortcuts.js +91 -0
  59. package/dist/shared/components/chat/huddle/huddle-speaking.js +100 -0
  60. package/dist/shared/components/chat/huddle/huddle-store.js +431 -157
  61. package/dist/shared/components/chat/huddle/useHuddle.js +46 -38
  62. package/dist/shared/components/chat/huddle/useHuddleAudio.js +35 -0
  63. package/dist/shared/components/client-chaos-gate.js +51 -0
  64. package/dist/shared/components/integrations/console/SignalCard.js +172 -167
  65. package/dist/shared/components/item-edit/GroupSection.js +1 -0
  66. package/dist/shared/components/item-edit/RecordChatActions.js +68 -59
  67. package/dist/shared/components/item-edit/UserChip.js +145 -142
  68. package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
  69. package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
  70. package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
  71. package/dist/shared/components/panels/TaskPanel.js +51 -49
  72. package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
  73. package/dist/shared/components/pipeline/TeamsView.js +184 -169
  74. package/dist/shared/components/support/TicketDetailSheet.js +57 -42
  75. package/dist/shared/lib/client-chaos.js +359 -0
  76. package/dist/shared/lib/load-error.js +26 -0
  77. package/dist/shared/lib/notification-sound.js +25 -16
  78. package/dist/shared/lib/socket-realtime.js +31 -30
  79. package/dist/shared/lib/worker-socket.js +108 -89
  80. package/package.json +2 -1
@@ -1,10 +1,11 @@
1
1
  import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as k } from "@tanstack/react-query";
3
- import { BarChart3 as v } from "lucide-react";
2
+ import { useQuery as _ } from "@tanstack/react-query";
3
+ import { BarChart3 as $ } from "lucide-react";
4
4
  import { useState as f } from "react";
5
- import { useNivaroClient as w } from "../../context.js";
6
- import { get as _ } from "../../lib/commands.js";
5
+ import { useNivaroClient as M } from "../../context.js";
6
+ import { get as S } from "../../lib/commands.js";
7
7
  import { cn as p } from "../../lib/utils.js";
8
+ import { QueryErrorState as C } from "../QueryErrorState.js";
8
9
  const o = (l) => `${Math.round(l * 100)}%`, y = (l) => l == null ? "—" : l < 60 ? `${Math.round(l)}m` : l < 1440 ? `${(l / 60).toFixed(1)}h` : `${(l / 1440).toFixed(1)}d`;
9
10
  function m({ label: l, value: n, hint: s }) {
10
11
  return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
@@ -94,17 +95,17 @@ function h({ title: l, counts: n }) {
94
95
  ] }, t)) })
95
96
  ] });
96
97
  }
97
- function R({ className: l }) {
98
+ function H({ className: l }) {
98
99
  var g;
99
- const n = w(), [s, c] = f(30), [t, i] = f(24), { data: r, isLoading: N } = k({
100
+ const n = M(), [s, c] = f(30), [t, i] = f(24), { data: r, isLoading: N, isError: k, error: v, refetch: w } = _({
100
101
  queryKey: ["notification-analytics", s, t],
101
102
  queryFn: () => n.request(
102
- _("/notifications/analytics", { days: s, acted_hours: t })
103
+ S("/notifications/analytics", { days: s, acted_hours: t })
103
104
  ).then((a) => a.data)
104
105
  }), u = (r == null ? void 0 : r.series) ?? [], b = Math.max(1, ...u.map((a) => a.sent));
105
106
  return /* @__PURE__ */ d("div", { className: p("flex flex-1 min-h-0 flex-col", l), "data-nvr-notification-analytics": !0, children: [
106
107
  /* @__PURE__ */ e("header", { className: "shrink-0 border-b border-slate-200 bg-white px-6 py-4 dark:border-border dark:bg-card", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2.5", children: [
107
- /* @__PURE__ */ e(v, { className: "h-5 w-5 text-muted-foreground" }),
108
+ /* @__PURE__ */ e($, { className: "h-5 w-5 text-muted-foreground" }),
108
109
  /* @__PURE__ */ d("div", { children: [
109
110
  /* @__PURE__ */ e("h1", { className: "text-[17px] font-semibold text-slate-900 dark:text-foreground", children: "Notification analytics" }),
110
111
  /* @__PURE__ */ e("p", { className: "mt-0.5 text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Where the noise comes from and whether anyone reads it — by category, sender, collection and channel, plus what people have muted." })
@@ -156,7 +157,14 @@ function R({ className: l }) {
156
157
  }
157
158
  )
158
159
  ] }) }),
159
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: N || !r ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500 dark:text-muted-foreground", children: "Loading…" }) : /* @__PURE__ */ d("div", { className: "space-y-5", children: [
160
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: k && !r ? /* @__PURE__ */ e(
161
+ C,
162
+ {
163
+ error: v,
164
+ what: "notification analytics",
165
+ onRetry: () => void w()
166
+ }
167
+ ) : N || !r ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500 dark:text-muted-foreground", children: "Loading…" }) : /* @__PURE__ */ d("div", { className: "space-y-5", children: [
160
168
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-5", children: [
161
169
  /* @__PURE__ */ e(m, { label: "Sent", value: String(r.total), hint: `last ${r.days} days` }),
162
170
  /* @__PURE__ */ e(m, { label: "Read rate", value: o(r.read_rate), hint: `${r.read} read` }),
@@ -261,5 +269,5 @@ function R({ className: l }) {
261
269
  ] });
262
270
  }
263
271
  export {
264
- R as NotificationAnalyticsView
272
+ H as NotificationAnalyticsView
265
273
  };
@@ -5,18 +5,19 @@ import { useState as y, useRef as Ue, useEffect as ge, useMemo as Re } from "rea
5
5
  import { toast as k } from "sonner";
6
6
  import { useNivaroClient as R, useItemEditAuth as Ke } from "../../context.js";
7
7
  import { get as F, post as J, patch as Me, del as He } from "../../lib/commands.js";
8
- import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as ze } from "../../lib/record-tasks.js";
8
+ import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as Be } from "../../lib/record-tasks.js";
9
9
  import { formatDate as X, cn as U, formatRelative as be } from "../../lib/utils.js";
10
- import { Button as z } from "../ui/button.js";
10
+ import { TaskDoButton as ze } from "../ai/TaskDo.js";
11
+ import { Button as B } from "../ui/button.js";
11
12
  import { Checkbox as me } from "../ui/checkbox.js";
12
13
  import { Command as fe, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as Y, CommandItem as ve } from "../ui/command.js";
13
14
  import { Input as Z } from "../ui/input.js";
14
- import { Label as I } from "../ui/label.js";
15
+ import { Label as A } from "../ui/label.js";
15
16
  import { Popover as we, PopoverTrigger as _e, PopoverContent as Ce } from "../ui/popover.js";
16
17
  import { SimpleSelect as ee } from "../ui/SimpleSelect.js";
17
- import { Textarea as Be } from "../ui/textarea.js";
18
- const Ve = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
19
- function B(a) {
18
+ import { Textarea as Ve } from "../ui/textarea.js";
19
+ const Ge = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
20
+ function z(a) {
20
21
  return a && ([a.first_name, a.last_name].filter(Boolean).join(" ") || a.email) || "Unknown";
21
22
  }
22
23
  const C = (a, i) => a != null && i != null && String(a).toUpperCase() === String(i).toUpperCase();
@@ -29,7 +30,7 @@ function Se(a) {
29
30
  return [];
30
31
  }
31
32
  }
32
- function Ge(a, i) {
33
+ function Je(a, i) {
33
34
  return a.map((o) => {
34
35
  const m = i.get(o.field) ?? o.field.replace(/_/g, " ");
35
36
  return o.op === "nnull" ? `${m} is filled in` : o.op === "eq" ? `${m} is ${String(o.value ?? "")}` : o.op === "null" ? `${m} is empty` : `${m} ${o.op} ${String(o.value ?? "")}`.trim();
@@ -44,7 +45,7 @@ function ue({ priority: a }) {
44
45
  }
45
46
  );
46
47
  }
47
- function Je({
48
+ function Xe({
48
49
  collection: a,
49
50
  item: i,
50
51
  value: o,
@@ -67,20 +68,20 @@ function Je({
67
68
  F("/users", {
68
69
  limit: 25,
69
70
  people: 1,
70
- fields: Ve,
71
+ fields: Ge,
71
72
  ...h ? { search: h } : {}
72
73
  })
73
74
  ).then((n) => n.data).catch(() => []),
74
75
  enabled: g,
75
76
  staleTime: 6e4
76
77
  }), u = v.data ?? [], x = new Set(u.map((n) => String(n.id).toUpperCase())), f = h.toLowerCase(), S = u.filter(
77
- (n) => !f || `${B(n)} ${n.email ?? ""}`.toLowerCase().includes(f)
78
- ), $ = (_.data ?? []).filter((n) => !x.has(String(n.id).toUpperCase())), A = [...S, ...$].map((n) => n.id), { data: D } = T({
79
- queryKey: ["task-open-counts", A.join(",")],
78
+ (n) => !f || `${z(n)} ${n.email ?? ""}`.toLowerCase().includes(f)
79
+ ), $ = (_.data ?? []).filter((n) => !x.has(String(n.id).toUpperCase())), L = [...S, ...$].map((n) => n.id), { data: D } = T({
80
+ queryKey: ["task-open-counts", L.join(",")],
80
81
  queryFn: () => c.request(
81
- F("/tasks/open-counts", { ids: A.join(",") })
82
+ F("/tasks/open-counts", { ids: L.join(",") })
82
83
  ).then((n) => n.data).catch(() => ({})),
83
- enabled: g && A.length > 0,
84
+ enabled: g && L.length > 0,
84
85
  staleTime: 6e4
85
86
  }), K = (n, q) => {
86
87
  const E = (D == null ? void 0 : D[String(n.id).toUpperCase()]) ?? 0;
@@ -101,7 +102,7 @@ function Je({
101
102
  }
102
103
  ),
103
104
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: [
104
- B(n),
105
+ z(n),
105
106
  q != null && q.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: q.join(", ") }) : null
106
107
  ] }),
107
108
  n.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
@@ -120,7 +121,7 @@ function Je({
120
121
  };
121
122
  return /* @__PURE__ */ s(we, { open: g, onOpenChange: d, children: [
122
123
  /* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
123
- z,
124
+ B,
124
125
  {
125
126
  variant: "outline",
126
127
  role: "combobox",
@@ -151,7 +152,7 @@ function Je({
151
152
  ] }) })
152
153
  ] });
153
154
  }
154
- function Xe({
155
+ function Qe({
155
156
  value: a,
156
157
  onChange: i
157
158
  }) {
@@ -192,18 +193,18 @@ function $e(a) {
192
193
  );
193
194
  return { fields: m, labels: r };
194
195
  }
195
- function Qe({
196
+ function Ye({
196
197
  collection: a,
197
198
  value: i,
198
199
  onChange: o
199
200
  }) {
200
201
  const { fields: m, labels: r } = $e(a), [c, g] = y(!1), d = i[0] ?? null;
201
202
  return /* @__PURE__ */ s("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
202
- /* @__PURE__ */ t(I, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
203
+ /* @__PURE__ */ t(A, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
203
204
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1.5", children: [
204
205
  /* @__PURE__ */ s(we, { open: c, onOpenChange: g, children: [
205
206
  /* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
206
- z,
207
+ B,
207
208
  {
208
209
  variant: "outline",
209
210
  className: "h-8 max-w-[220px] justify-between px-2.5 text-[12px] font-normal",
@@ -269,7 +270,7 @@ function Qe({
269
270
  ] })
270
271
  ] });
271
272
  }
272
- const Ye = () => ({
273
+ const Ze = () => ({
273
274
  title: "",
274
275
  description: "",
275
276
  mode: "person",
@@ -282,7 +283,7 @@ const Ye = () => ({
282
283
  priority: "normal",
283
284
  doneWhen: []
284
285
  });
285
- function Ze(a) {
286
+ function et(a) {
286
287
  return {
287
288
  title: a.title,
288
289
  description: a.description ?? "",
@@ -316,7 +317,7 @@ function pe({
316
317
  "data-task-form": !0,
317
318
  children: [
318
319
  /* @__PURE__ */ s("div", { children: [
319
- /* @__PURE__ */ t(I, { className: "mb-1 block text-[11px]", children: "Title" }),
320
+ /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Title" }),
320
321
  /* @__PURE__ */ t(
321
322
  Z,
322
323
  {
@@ -330,9 +331,9 @@ function pe({
330
331
  )
331
332
  ] }),
332
333
  /* @__PURE__ */ s("div", { children: [
333
- /* @__PURE__ */ t(I, { className: "mb-1 block text-[11px]", children: "Details (optional)" }),
334
+ /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Details (optional)" }),
334
335
  /* @__PURE__ */ t(
335
- Be,
336
+ Ve,
336
337
  {
337
338
  value: l.description,
338
339
  onChange: (u) => h("description", u.target.value),
@@ -346,7 +347,7 @@ function pe({
346
347
  /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
347
348
  /* @__PURE__ */ s("div", { className: "col-span-2 sm:col-span-1", children: [
348
349
  /* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between", children: [
349
- /* @__PURE__ */ t(I, { className: "text-[11px]", children: l.mode === "team" ? "Team" : "Assignee" }),
350
+ /* @__PURE__ */ t(A, { className: "text-[11px]", children: l.mode === "team" ? "Team" : "Assignee" }),
350
351
  c && /* @__PURE__ */ t(
351
352
  "button",
352
353
  {
@@ -359,13 +360,13 @@ function pe({
359
360
  )
360
361
  ] }),
361
362
  l.mode === "team" ? /* @__PURE__ */ t(
362
- Xe,
363
+ Qe,
363
364
  {
364
365
  value: l.teamId,
365
366
  onChange: (u, x) => w((f) => ({ ...f, teamId: u, teamName: (x == null ? void 0 : x.name) ?? null }))
366
367
  }
367
368
  ) : /* @__PURE__ */ t(
368
- Je,
369
+ Xe,
369
370
  {
370
371
  collection: a,
371
372
  item: i,
@@ -374,13 +375,13 @@ function pe({
374
375
  onChange: (u, x) => w((f) => ({
375
376
  ...f,
376
377
  assignee: u,
377
- assigneeName: x ? B(x) : null,
378
+ assigneeName: x ? z(x) : null,
378
379
  assigneePerson: x
379
380
  }))
380
381
  }
381
382
  ),
382
383
  v && /* @__PURE__ */ s("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
383
- B(v),
384
+ z(v),
384
385
  " is out of office",
385
386
  v.ooo_end ? ` until ${String(v.ooo_end).slice(0, 10)}` : "",
386
387
  " — the task goes to their delegate if one is set."
@@ -388,7 +389,7 @@ function pe({
388
389
  l.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." })
389
390
  ] }),
390
391
  /* @__PURE__ */ s("div", { children: [
391
- /* @__PURE__ */ t(I, { className: "mb-1 block text-[11px]", children: "Due date" }),
392
+ /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Due date" }),
392
393
  /* @__PURE__ */ t(
393
394
  Z,
394
395
  {
@@ -401,7 +402,7 @@ function pe({
401
402
  )
402
403
  ] }),
403
404
  /* @__PURE__ */ s("div", { children: [
404
- /* @__PURE__ */ t(I, { className: "mb-1 block text-[11px]", children: "Priority" }),
405
+ /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Priority" }),
405
406
  /* @__PURE__ */ t(
406
407
  ee,
407
408
  {
@@ -417,7 +418,7 @@ function pe({
417
418
  ] })
418
419
  ] }),
419
420
  /* @__PURE__ */ t(
420
- Qe,
421
+ Ye,
421
422
  {
422
423
  collection: a,
423
424
  value: l.doneWhen,
@@ -426,7 +427,7 @@ function pe({
426
427
  ),
427
428
  /* @__PURE__ */ s("div", { className: "flex justify-end gap-2", children: [
428
429
  /* @__PURE__ */ t(
429
- z,
430
+ B,
430
431
  {
431
432
  type: "button",
432
433
  variant: "outline",
@@ -437,7 +438,7 @@ function pe({
437
438
  }
438
439
  ),
439
440
  /* @__PURE__ */ t(
440
- z,
441
+ B,
441
442
  {
442
443
  type: "button",
443
444
  size: "sm",
@@ -476,7 +477,7 @@ function he({ taskId: a }) {
476
477
  }
477
478
  ) : /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "No history yet." });
478
479
  }
479
- function bt({
480
+ function kt({
480
481
  collection: a,
481
482
  item: i,
482
483
  title: o,
@@ -489,12 +490,12 @@ function bt({
489
490
  ge(() => {
490
491
  !_.current && m !== void 0 && (_.current = !0, v(m));
491
492
  }, [m]);
492
- const [u, x] = y(!1), [f, S] = y(null), [$, A] = y(null), [D, K] = y(!1), n = !i || i === "new", { data: q = [] } = T({
493
+ const [u, x] = y(!1), [f, S] = y(null), [$, L] = y(null), [D, K] = y(!1), n = !i || i === "new", { data: q = [] } = T({
493
494
  queryKey: ["tasks", a, i],
494
495
  queryFn: () => d.request(F("/tasks", { collection: a, item: i })).then((e) => e.data),
495
496
  enabled: !!a && !n
496
- }), { labels: E } = $e(a), L = () => {
497
- ze(l, a, i), l.invalidateQueries({ queryKey: ["task-history"] });
497
+ }), { labels: E } = $e(a), I = () => {
498
+ Be(l, a, i), l.invalidateQueries({ queryKey: ["task-history"] });
498
499
  }, O = (e, p) => {
499
500
  var P;
500
501
  return ((P = e == null ? void 0 : e.response) == null ? void 0 : P.error) ?? (e instanceof Error && e.message ? e.message : p);
@@ -512,7 +513,7 @@ function bt({
512
513
  ),
513
514
  onSuccess: (e) => {
514
515
  var p;
515
- L(), x(!1), k.success(
516
+ I(), x(!1), k.success(
516
517
  (p = e == null ? void 0 : e.data) != null && p.delegated_from ? "Task created — it went to their delegate" : "Task created"
517
518
  );
518
519
  },
@@ -520,25 +521,25 @@ function bt({
520
521
  }), M = j({
521
522
  mutationFn: ({ id: e, body: p }) => d.request(Me(`/tasks/${e}`, p)),
522
523
  onSuccess: (e, p) => {
523
- L(), S(null), p.body.status === "open" ? k.success("Task reopened") : k.success("Task updated");
524
+ I(), S(null), p.body.status === "open" ? k.success("Task reopened") : k.success("Task updated");
524
525
  },
525
526
  onError: (e) => k.error(O(e, "Could not update the task"))
526
527
  }), se = j({
527
528
  mutationFn: (e) => d.request(J(`/tasks/${e}/complete`, {})),
528
529
  onSuccess: () => {
529
- L(), k.success("Task completed");
530
+ I(), k.success("Task completed");
530
531
  },
531
532
  onError: (e) => k.error(O(e, "Could not complete the task"))
532
533
  }), ne = j({
533
534
  mutationFn: (e) => d.request(J(`/tasks/${e}/claim`, {})),
534
535
  onSuccess: () => {
535
- L(), k.success("It’s yours");
536
+ I(), k.success("It’s yours");
536
537
  },
537
538
  onError: (e) => k.error(O(e, "Could not pick it up"))
538
539
  }), le = j({
539
540
  mutationFn: (e) => d.request(He(`/tasks/${e}`)),
540
541
  onSuccess: () => {
541
- L(), k.success("Task deleted");
542
+ I(), k.success("Task deleted");
542
543
  },
543
544
  onError: (e) => k.error(O(e, "Could not delete the task"))
544
545
  });
@@ -581,11 +582,12 @@ function bt({
581
582
  ] })
582
583
  ] });
583
584
  }, ie = (e, p) => /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5", children: [
585
+ !p && /* @__PURE__ */ t(ze, { task: e, compact: !0, onTaskChanged: I }),
584
586
  /* @__PURE__ */ t(
585
587
  "button",
586
588
  {
587
589
  type: "button",
588
- onClick: () => A($ === e.id ? null : e.id),
590
+ onClick: () => L($ === e.id ? null : e.id),
589
591
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
590
592
  "aria-label": `History of ${e.title}`,
591
593
  title: "History",
@@ -718,7 +720,7 @@ function bt({
718
720
  re(e, !1),
719
721
  p.length > 0 && /* @__PURE__ */ s("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
720
722
  "Closes itself when ",
721
- Ge(p, E)
723
+ Je(p, E)
722
724
  ] }),
723
725
  P && /* @__PURE__ */ t(
724
726
  "button",
@@ -739,7 +741,7 @@ function bt({
739
741
  {
740
742
  collection: a,
741
743
  item: i,
742
- initial: Ze(e),
744
+ initial: et(e),
743
745
  submitLabel: "Save changes",
744
746
  busy: M.isPending,
745
747
  allowTeam: !1,
@@ -777,7 +779,7 @@ function bt({
777
779
  {
778
780
  collection: a,
779
781
  item: i,
780
- initial: Ye(),
782
+ initial: Ze(),
781
783
  submitLabel: n ? "Queue task" : "Create task",
782
784
  busy: ae.isPending,
783
785
  allowTeam: !0,
@@ -832,5 +834,5 @@ function bt({
832
834
  ] });
833
835
  }
834
836
  export {
835
- bt as TaskPanel
837
+ kt as TaskPanel
836
838
  };