@nivaro/react 0.3.117 → 0.3.118

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 (137) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +136 -14
  4. package/dist/index.js +488 -485
  5. package/dist/shared/components/ActivityEntry.js +130 -125
  6. package/dist/shared/components/AgentPresenceChip.js +36 -26
  7. package/dist/shared/components/CellCopyLayer.js +50 -45
  8. package/dist/shared/components/CollectionBrowserView.js +3757 -3695
  9. package/dist/shared/components/FilePreviewLightbox.js +96 -58
  10. package/dist/shared/components/InStep.js +18 -17
  11. package/dist/shared/components/ItemEditForm.js +4220 -4175
  12. package/dist/shared/components/JobsTray.js +8 -8
  13. package/dist/shared/components/LiveNewMatchesPill.js +21 -14
  14. package/dist/shared/components/LiveOffNote.js +3 -2
  15. package/dist/shared/components/LiveRowMark.js +53 -23
  16. package/dist/shared/components/LiveTraceView.js +162 -123
  17. package/dist/shared/components/MyWorkView.js +320 -299
  18. package/dist/shared/components/NotificationBell.js +14 -14
  19. package/dist/shared/components/OverflowRail.js +1 -1
  20. package/dist/shared/components/PageRenderer.js +120 -116
  21. package/dist/shared/components/ProfileView.js +203 -202
  22. package/dist/shared/components/RealtimeStatusBanner.js +31 -29
  23. package/dist/shared/components/RecordDrilldownSheet.js +7 -7
  24. package/dist/shared/components/RecordHoverCard.js +102 -84
  25. package/dist/shared/components/RecordReadView.js +146 -146
  26. package/dist/shared/components/ScreenRefreshButton.js +34 -32
  27. package/dist/shared/components/TipLayer.js +65 -58
  28. package/dist/shared/components/WidgetImageMenu.js +83 -43
  29. package/dist/shared/components/activity/RecordActivityStream.js +175 -173
  30. package/dist/shared/components/bulk/BulkSelectionNotices.js +142 -119
  31. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +158 -143
  32. package/dist/shared/components/change-proposals/ProposeChangeButton.js +17 -11
  33. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +201 -173
  34. package/dist/shared/components/chat/ChatAnalyticsView.js +27 -27
  35. package/dist/shared/components/chat/HuddleAnalyticsTab.js +17 -17
  36. package/dist/shared/components/collections-directory/CollectionsToolbar.js +39 -41
  37. package/dist/shared/components/collections-directory/page-model.js +72 -67
  38. package/dist/shared/components/integrations/RecordIntegrationPreview.js +48 -56
  39. package/dist/shared/components/integrations/SendStatus.js +65 -59
  40. package/dist/shared/components/integrations/console/ReadyToSendView.js +275 -209
  41. package/dist/shared/components/integrations/console/SignalCard.js +237 -230
  42. package/dist/shared/components/item-edit/CatalogPickerField.js +227 -205
  43. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +131 -92
  44. package/dist/shared/components/item-edit/CloneDialog.js +191 -161
  45. package/dist/shared/components/item-edit/DerivedCauseNote.js +44 -30
  46. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +153 -134
  47. package/dist/shared/components/item-edit/FieldComments.js +54 -53
  48. package/dist/shared/components/item-edit/FieldPointer.js +82 -67
  49. package/dist/shared/components/item-edit/FieldRow.js +106 -100
  50. package/dist/shared/components/item-edit/FieldSourceBadge.js +58 -56
  51. package/dist/shared/components/item-edit/FilePickerField.js +452 -387
  52. package/dist/shared/components/item-edit/HeaderSummaryChip.js +78 -56
  53. package/dist/shared/components/item-edit/HeaderTools.js +94 -85
  54. package/dist/shared/components/item-edit/InlineTableField.js +1242 -1218
  55. package/dist/shared/components/item-edit/ListNeighborNav.js +47 -50
  56. package/dist/shared/components/item-edit/LiveTraceSheet.js +15 -10
  57. package/dist/shared/components/item-edit/MembershipSetField.js +285 -254
  58. package/dist/shared/components/item-edit/OutboxReviewTray.js +155 -144
  59. package/dist/shared/components/item-edit/QueueReturnChip.js +15 -36
  60. package/dist/shared/components/item-edit/RecalcValue.js +57 -32
  61. package/dist/shared/components/item-edit/RecordHelpChip.js +21 -22
  62. package/dist/shared/components/item-edit/RecordLiveSync.js +283 -231
  63. package/dist/shared/components/item-edit/RelationCombobox.js +439 -393
  64. package/dist/shared/components/item-edit/RemoteChangeUi.js +292 -224
  65. package/dist/shared/components/item-edit/RemoteUploads.js +26 -20
  66. package/dist/shared/components/item-edit/RemovedLineNote.js +77 -67
  67. package/dist/shared/components/item-edit/RichTextEditorImpl.js +184 -179
  68. package/dist/shared/components/item-edit/ScheduledChangeChip.js +168 -134
  69. package/dist/shared/components/item-edit/SectionPresence.js +18 -10
  70. package/dist/shared/components/item-edit/SplitLinesButton.js +163 -139
  71. package/dist/shared/components/item-edit/UserChip.js +1 -1
  72. package/dist/shared/components/item-edit/file-live.js +69 -54
  73. package/dist/shared/components/item-edit/layout-switch.js +98 -89
  74. package/dist/shared/components/item-edit/partner-needs.js +12 -12
  75. package/dist/shared/components/item-edit/removed-line.js +31 -25
  76. package/dist/shared/components/layout-editor/pickers/field-picker.js +112 -104
  77. package/dist/shared/components/list/ListViewers.js +46 -35
  78. package/dist/shared/components/notifications/NotificationCenterView.js +479 -437
  79. package/dist/shared/components/panels/AccessDeniedPanel.js +176 -101
  80. package/dist/shared/components/panels/AlertBanners.js +82 -72
  81. package/dist/shared/components/panels/BranchLanes.js +22 -22
  82. package/dist/shared/components/panels/CommentImages.js +123 -102
  83. package/dist/shared/components/panels/CommentPanel.js +186 -185
  84. package/dist/shared/components/panels/ExternalRequestsChip.js +111 -119
  85. package/dist/shared/components/panels/OwnerOpenedLine.js +31 -24
  86. package/dist/shared/components/panels/PipelinePanel.js +2037 -1885
  87. package/dist/shared/components/panels/ResubmissionDiff.js +163 -142
  88. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +400 -288
  89. package/dist/shared/components/pipeline/PipelineEditorView.js +7 -2
  90. package/dist/shared/components/profile/AgentNameField.js +107 -81
  91. package/dist/shared/components/profile/AgentsPanel.js +184 -184
  92. package/dist/shared/components/profile/PersonAccess.js +599 -495
  93. package/dist/shared/components/profile/SignInTroubleshooter.js +160 -127
  94. package/dist/shared/components/profile/SignedInDevices.js +17 -17
  95. package/dist/shared/components/profile/primitives.js +1 -1
  96. package/dist/shared/components/queue/OwnerAvatars.js +91 -54
  97. package/dist/shared/components/queue/QueueTeamStrip.js +56 -46
  98. package/dist/shared/components/queue/QueueWorklist.js +1002 -983
  99. package/dist/shared/components/support/AssignRules.js +1733 -0
  100. package/dist/shared/components/support/PersonPick.js +88 -0
  101. package/dist/shared/components/support/RequestList.js +790 -0
  102. package/dist/shared/components/support/ScreenShare.js +158 -152
  103. package/dist/shared/components/support/SupportRequestDialog.js +50 -48
  104. package/dist/shared/components/support/SupportView.js +140 -246
  105. package/dist/shared/components/support/TicketDetailSheet.js +82 -75
  106. package/dist/shared/components/support/TicketSlowScreens.js +9 -9
  107. package/dist/shared/components/support/assign-rules-text.js +171 -0
  108. package/dist/shared/components/support/support-list.js +125 -0
  109. package/dist/shared/components/ui/SimpleSelect.js +28 -20
  110. package/dist/shared/components/ui/checkbox.js +6 -6
  111. package/dist/shared/components/ui/select.js +43 -39
  112. package/dist/shared/components/ui/sheet.js +9 -9
  113. package/dist/shared/components/ui/switch.js +12 -11
  114. package/dist/shared/components/watch-list/WatchDock.js +532 -459
  115. package/dist/shared/components/watch-list/WatchExtras.js +332 -286
  116. package/dist/shared/components/watch-list/WatchRows.js +164 -140
  117. package/dist/shared/lib/activity-sentence.js +103 -91
  118. package/dist/shared/lib/agent-presence.js +27 -21
  119. package/dist/shared/lib/approval-progress.js +2 -2
  120. package/dist/shared/lib/copy-rules.js +31 -24
  121. package/dist/shared/lib/derived-causes.js +113 -78
  122. package/dist/shared/lib/grid-cursors.js +26 -26
  123. package/dist/shared/lib/label-flash.js +27 -0
  124. package/dist/shared/lib/list-return.js +137 -125
  125. package/dist/shared/lib/live-deltas.js +40 -34
  126. package/dist/shared/lib/live-groups.js +56 -52
  127. package/dist/shared/lib/live-preference.js +64 -59
  128. package/dist/shared/lib/live-screen.js +223 -192
  129. package/dist/shared/lib/partner-failure.js +11 -11
  130. package/dist/shared/lib/rollup-recalc.js +68 -64
  131. package/dist/shared/lib/screen-refresh.js +74 -68
  132. package/dist/shared/lib/screen-share.js +108 -104
  133. package/dist/shared/lib/send-status.js +77 -61
  134. package/dist/shared/lib/text-diff-window.js +29 -0
  135. package/dist/shared/lib/watch-list.js +210 -209
  136. package/dist/shared/lib/widget-image-render.js +72 -49
  137. package/package.json +1 -1
@@ -1,85 +1,92 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { useQueryClient as fe, useQuery as ke, useMutation as K } from "@tanstack/react-query";
3
- import { Check as ye, Bot as we } from "lucide-react";
4
- import { useState as $, useRef as B, useMemo as ne, useEffect as z } from "react";
5
- import { useApiFetchConfig as Ne, useItemNavigation as ve, useNavigation as _e } from "../context.js";
6
- import { useDeadlineNow as Ce, liveSlaReading as Se } from "../lib/deadline-ticker.js";
7
- import { useLiveEvent as $e } from "../lib/live.js";
8
- import { useLiveOps as Te, useFreshIds as je } from "../lib/live-ops.js";
9
- import { resolveNotificationTarget as se, runNotificationTarget as Oe } from "../lib/notification-target.js";
10
- import { usePrefetchIntent as Ie } from "../lib/prefetch.js";
11
- import { useOptionalRealtime as Le } from "../lib/realtime.js";
12
- import { usePeekOrOpen as Ae, peekable as de } from "../lib/record-peek.js";
13
- import { userErrorMessage as Me } from "../lib/safe-error.js";
14
- import { withinDay as oe, slaChip as De } from "../lib/sla-chip.js";
15
- import { cn as D, formatRelative as qe } from "../lib/utils.js";
16
- import { AgentQuestionsCard as Fe } from "./AgentQuestionsCard.js";
17
- import { FirstWeekCard as Ue } from "./ai/FirstWeekCard.js";
18
- import { TaskDoButton as We } from "./ai/TaskDo.js";
19
- import { openChatRoom as Ee, canOpenChatRoom as Pe } from "./chat/chat-core.js";
20
- import { useMyRecordRooms as Qe } from "./chat/chat-hooks.js";
21
- import { useCoveringQuery as Ke, DelegateCoverLine as Be } from "./DelegateCoverLine.js";
22
- import { LearningPathCard as ze } from "./help-videos/viewer/LearningPathCard.js";
23
- import { RequiredVideosCard as He } from "./help-videos/viewer/RequiredVideosCard.js";
24
- import { SkeletonBar as Je, ListSkeleton as Ve } from "./Skeletons.js";
25
- import { TickerNumber as Ye } from "./TickerNumber.js";
26
- import { UserAvatar as Ze } from "./UserAvatar.js";
27
- const Re = 8e3, ie = ["records", "proposals", "tasks", "team", "waiting", "notifications"], le = /* @__PURE__ */ new Set(["records", "proposals"]), ce = {
2
+ import { useQueryClient as ve, useQuery as _e, useMutation as z } from "@tanstack/react-query";
3
+ import { Check as Ce, Bot as Se } from "lucide-react";
4
+ import { useState as S, useRef as H, useMemo as oe, useEffect as J } from "react";
5
+ import { useApiFetchConfig as $e, useItemNavigation as Te, useNavigation as je } from "../context.js";
6
+ import { useDeadlineNow as Oe, liveSlaReading as Ie } from "../lib/deadline-ticker.js";
7
+ import { useLiveEvent as Le } from "../lib/live.js";
8
+ import { useLiveOps as Me, useFreshIds as Ae } from "../lib/live-ops.js";
9
+ import { resolveNotificationTarget as ie, runNotificationTarget as De } from "../lib/notification-target.js";
10
+ import { usePrefetchIntent as qe } from "../lib/prefetch.js";
11
+ import { useOptionalRealtime as Fe } from "../lib/realtime.js";
12
+ import { usePeekOrOpen as Ue, peekable as le } from "../lib/record-peek.js";
13
+ import { userErrorMessage as We } from "../lib/safe-error.js";
14
+ import { slaChip as Ee, withinDay as Pe } from "../lib/sla-chip.js";
15
+ import { cn as q, formatRelative as Qe } from "../lib/utils.js";
16
+ import { AgentQuestionsCard as Ke } from "./AgentQuestionsCard.js";
17
+ import { FirstWeekCard as Be } from "./ai/FirstWeekCard.js";
18
+ import { TaskDoButton as ze } from "./ai/TaskDo.js";
19
+ import { openChatRoom as He, canOpenChatRoom as Je } from "./chat/chat-core.js";
20
+ import { useMyRecordRooms as Re } from "./chat/chat-hooks.js";
21
+ import { useCoveringQuery as Ve, DelegateCoverLine as Ye } from "./DelegateCoverLine.js";
22
+ import { LearningPathCard as Ze } from "./help-videos/viewer/LearningPathCard.js";
23
+ import { RequiredVideosCard as Ge } from "./help-videos/viewer/RequiredVideosCard.js";
24
+ import { SkeletonBar as Xe, ListSkeleton as et } from "./Skeletons.js";
25
+ import { TickerNumber as tt } from "./TickerNumber.js";
26
+ import { UserAvatar as rt } from "./UserAvatar.js";
27
+ const at = 8e3, ce = ["records", "proposals", "tasks", "team", "waiting", "notifications"], me = /* @__PURE__ */ new Set(["records", "proposals"]), ue = {
28
28
  records: "Waiting on you",
29
29
  proposals: "Changes to review",
30
30
  tasks: "My tasks",
31
31
  team: "Team tasks",
32
32
  waiting: "Waiting on others",
33
33
  notifications: "Notifications"
34
- }, Ge = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), q = (i) => !!i && String(i).slice(0, 10) < Ge(), Xe = {
34
+ }, nt = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), F = (o) => !!o && String(o).slice(0, 10) < nt(), st = {
35
35
  alert: "bg-red-500/10 text-red-600 dark:text-red-400",
36
36
  warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
37
37
  neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
38
38
  ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
39
39
  };
40
- function et({ sla: i }) {
41
- const p = Ce(!!(i != null && i.due_at)), c = i != null && i.due_at ? Se(i, p) : i, x = De(c);
42
- return x ? /* @__PURE__ */ e(
40
+ function dt(o, u) {
41
+ return o != null && o.due_at ? Ie(o, u) : o;
42
+ }
43
+ function pe(o) {
44
+ return !o || o.status === "breached" ? !1 : o.status === "warning" || Pe(o);
45
+ }
46
+ function ot({ sla: o }) {
47
+ const u = Ee(o), c = u && pe(o) ? { ...u, tone: "warn" } : u;
48
+ return c ? /* @__PURE__ */ e(
43
49
  "span",
44
50
  {
45
- "data-sla-chip": x.tone,
46
- className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${Xe[x.tone]}`,
47
- children: x.label
51
+ "data-sla-chip": c.tone,
52
+ className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${st[c.tone]}`,
53
+ children: c.label
48
54
  }
49
55
  ) : null;
50
56
  }
51
- function tt({ state: i, color: p }) {
52
- return i ? /* @__PURE__ */ e(
57
+ function it({ state: o, color: u }) {
58
+ return o ? /* @__PURE__ */ e(
53
59
  "span",
54
60
  {
55
- className: "rounded-full px-2 py-0.5 text-[10.5px] font-medium",
61
+ "data-tip": o,
62
+ className: "min-w-0 truncate rounded-full px-2 py-0.5 text-[10.5px] font-medium",
56
63
  style: {
57
- backgroundColor: p ? `${p}22` : "rgba(100,116,139,.12)",
58
- color: p ?? void 0
64
+ backgroundColor: u ? `${u}22` : "rgba(100,116,139,.12)",
65
+ color: u ?? void 0
59
66
  },
60
- children: i.replace(/_/g, " ")
67
+ children: o
61
68
  }
62
69
  ) : null;
63
70
  }
64
- function rt({ order: i, hidden: p }) {
65
- const c = i.filter(
66
- (u) => !p.includes(u) && (u === "records" || u === "tasks" || u === "notifications")
67
- ), x = (u, v) => /* @__PURE__ */ n(
71
+ function lt({ order: o, hidden: u }) {
72
+ const c = o.filter(
73
+ (p) => !u.includes(p) && (p === "records" || p === "tasks" || p === "notifications")
74
+ ), y = (p, w) => /* @__PURE__ */ n(
68
75
  "section",
69
76
  {
70
77
  className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
71
78
  children: [
72
79
  /* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
73
- /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: ce[u] ?? u }),
74
- u === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
80
+ /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: ue[p] ?? p }),
81
+ p === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
75
82
  ] }),
76
83
  /* @__PURE__ */ e(
77
- Ve,
84
+ et,
78
85
  {
79
86
  header: !1,
80
- rows: v,
87
+ rows: w,
81
88
  rowClassName: "h-[37px] px-4",
82
- columns: u === "records" ? [
89
+ columns: p === "records" ? [
83
90
  { key: "label", grow: 6 },
84
91
  { key: "where", width: 90, shape: "short" },
85
92
  { key: "state", width: 72, shape: "badge" },
@@ -92,58 +99,58 @@ function rt({ order: i, hidden: p }) {
92
99
  )
93
100
  ]
94
101
  },
95
- u
96
- ), k = [];
97
- for (let u = 0; u < c.length; ) {
98
- if (c[u] === "records") {
99
- k.push(x("records", 5)), u++;
102
+ p
103
+ ), g = [];
104
+ for (let p = 0; p < c.length; ) {
105
+ if (c[p] === "records") {
106
+ g.push(y("records", 5)), p++;
100
107
  continue;
101
108
  }
102
- const v = c.slice(u, u + 2).filter((y) => y !== "records");
103
- k.push(
104
- /* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children: v.map((y) => x(y, 4)) }, v.join("+"))
105
- ), u += v.length;
109
+ const w = c.slice(p, p + 2).filter((f) => f !== "records");
110
+ g.push(
111
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((f) => y(f, 4)) }, w.join("+"))
112
+ ), p += w.length;
106
113
  }
107
- return /* @__PURE__ */ n("div", { className: "space-y-5 p-6", "data-my-work-loading": !0, "aria-busy": "true", children: [
114
+ return /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work-loading": !0, "aria-busy": "true", children: [
108
115
  /* @__PURE__ */ n("div", { className: "flex items-start justify-between", children: [
109
- /* @__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((u) => /* @__PURE__ */ n(
116
+ /* @__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__ */ n(
110
117
  "div",
111
118
  {
112
119
  className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
113
120
  children: [
114
- /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: u }),
115
- /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Je, { width: 34, className: "h-[18px] rounded-md" }) })
121
+ /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: p }),
122
+ /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Xe, { width: 34, className: "h-[18px] rounded-md" }) })
116
123
  ]
117
124
  },
118
- u
125
+ p
119
126
  )) }),
120
127
  /* @__PURE__ */ e("span", { className: "ml-3 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Refresh" }),
121
128
  /* @__PURE__ */ e("span", { className: "ml-2 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Customize" })
122
129
  ] }),
123
- k
130
+ g
124
131
  ] });
125
132
  }
126
- function F({ label: i, value: p, tone: c }) {
127
- return /* @__PURE__ */ n("div", { className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
128
- /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: i }),
129
- /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(Ye, { value: p }) })
133
+ function U({ label: o, value: u, tone: c }) {
134
+ return /* @__PURE__ */ n("div", { className: "min-w-0 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
135
+ /* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children: o }),
136
+ /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(tt, { value: u }) })
130
137
  ] });
131
138
  }
132
- function Ot({
133
- notificationRoutes: i,
134
- onOpenPath: p
139
+ function Ft({
140
+ notificationRoutes: o,
141
+ onOpenPath: u
135
142
  } = {}) {
136
- const { apiBase: c, authHeaders: x, credentials: k } = Ne(), { open: u } = ve(), v = Ae(), y = _e(), _ = fe(), H = Ie(), J = (r) => {
143
+ const { apiBase: c, authHeaders: y, credentials: g } = $e(), { open: p } = Te(), w = Ue(), f = je(), v = ve(), R = qe(), V = (r) => {
137
144
  var h, m;
138
- const s = ((h = i == null ? void 0 : i.support) == null ? void 0 : h.call(i, String(r))) ?? ((m = y.consoleUrl) == null ? void 0 : m.call(y, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
139
- p ? p(s) : y.navigate(s);
140
- }, U = Le(), [me, O] = $(!1), [g, ue] = $(() => {
145
+ const s = ((h = o == null ? void 0 : o.support) == null ? void 0 : h.call(o, String(r))) ?? ((m = f.consoleUrl) == null ? void 0 : m.call(f, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
146
+ u ? u(s) : f.navigate(s);
147
+ }, W = Fe(), [he, O] = S(!1), [x, be] = S(() => {
141
148
  try {
142
149
  const r = localStorage.getItem("nvr_mywork_sections");
143
150
  if (r) {
144
151
  const s = JSON.parse(r);
145
152
  if (Array.isArray(s == null ? void 0 : s.order) && Array.isArray(s == null ? void 0 : s.hidden)) {
146
- const h = ie.map((m, b) => ({
153
+ const h = ce.map((m, b) => ({
147
154
  k: m,
148
155
  at: s.order.indexOf(m) >= 0 ? s.order.indexOf(m) : b - 0.5
149
156
  })).sort((m, b) => m.at - b.at).map((m) => m.k);
@@ -152,257 +159,263 @@ function Ot({
152
159
  }
153
160
  } catch {
154
161
  }
155
- return { order: [...ie], hidden: [] };
156
- }), V = (r) => {
157
- ue(r);
162
+ return { order: [...ce], hidden: [] };
163
+ }), Y = (r) => {
164
+ be(r);
158
165
  try {
159
166
  localStorage.setItem("nvr_mywork_sections", JSON.stringify(r));
160
167
  } catch {
161
168
  }
162
- }, [pe, he] = $(!1), Y = B(0), [I, be] = $("all"), [W, Z] = $(null), { data: L } = Ke(), w = ne(() => {
163
- const r = W ? L == null ? void 0 : L.find((s) => s.user_id === W) : null;
169
+ }, [xe, ge] = S(!1), Z = H(0), [I, fe] = S("all"), ke = Oe(!0), [E, G] = S(null), { data: L } = Ve(), k = oe(() => {
170
+ const r = E ? L == null ? void 0 : L.find((s) => s.user_id === E) : null;
164
171
  return r ? { userId: r.user_id, name: r.first_name || r.name, keys: new Set(r.keys) } : null;
165
- }, [W, L]), { data: a, isLoading: xe, refetch: R, isFetching: G } = ke({
172
+ }, [E, L]), { data: a, isLoading: ye, refetch: X, isFetching: ee } = _e({
166
173
  queryKey: ["my-work"],
167
174
  queryFn: async () => {
168
- const r = await fetch(`${c}/my-work`, { headers: x, credentials: k });
175
+ const r = await fetch(`${c}/my-work`, { headers: y, credentials: g });
169
176
  if (!r.ok) throw new Error("my-work failed");
170
177
  return (await r.json()).data;
171
178
  },
172
179
  staleTime: 6e4
173
- }), X = B(0), T = B(null), ee = () => {
180
+ }), te = H(0), $ = H(null), re = () => {
174
181
  const r = () => {
175
- T.current = null, X.current = Date.now(), O(!1), _.invalidateQueries({ queryKey: ["my-work"] });
176
- }, s = X.current + Re - Date.now();
177
- T.current || (s <= 0 ? r() : T.current = setTimeout(r, s));
182
+ $.current = null, te.current = Date.now(), O(!1), v.invalidateQueries({ queryKey: ["my-work"] });
183
+ }, s = te.current + at - Date.now();
184
+ $.current || (s <= 0 ? r() : $.current = setTimeout(r, s));
178
185
  };
179
- Te("my-work", ee, { debounceMs: 1500 }), $e("notification:new", ee, { debounceMs: 1500 }), z(
186
+ Me("my-work", re, { debounceMs: 1500 }), Le("notification:new", re, { debounceMs: 1500 }), J(
180
187
  () => () => {
181
- T.current && clearTimeout(T.current);
188
+ $.current && clearTimeout($.current);
182
189
  },
183
190
  []
184
191
  );
185
- const te = je([
192
+ const ae = Ae([
186
193
  ...((a == null ? void 0 : a.owned) ?? []).map((r) => `o:${r.collection}:${r.item}`),
187
194
  ...((a == null ? void 0 : a.tasks) ?? []).map((r) => `t:${r.id}`),
188
195
  ...((a == null ? void 0 : a.team_tasks) ?? []).map((r) => `tt:${r.id}`),
189
196
  ...((a == null ? void 0 : a.requested) ?? []).map((r) => `r:${r.id}`),
190
197
  ...((a == null ? void 0 : a.notifications) ?? []).map((r) => `n:${r.id}`),
191
198
  ...((a == null ? void 0 : a.proposals) ?? []).map((r) => `p:${r.id}`)
192
- ]), C = (r) => te.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", E = ne(() => {
199
+ ]), _ = (r) => ae.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", P = oe(() => {
193
200
  const r = /* @__PURE__ */ new Set();
194
201
  for (const s of (a == null ? void 0 : a.owned) ?? []) s.collection && r.add(s.collection);
195
202
  return [...r];
196
203
  }, [a]);
197
- z(() => {
198
- if (!(!U || E.length === 0))
199
- return U.subscribeCollections(E, () => {
204
+ J(() => {
205
+ if (!(!W || P.length === 0))
206
+ return W.subscribeCollections(P, () => {
200
207
  const r = Date.now();
201
- r - Y.current < 3e4 || (Y.current = r, O(!0));
208
+ r - Z.current < 3e4 || (Z.current = r, O(!0));
202
209
  });
203
- }, [U, E]);
204
- const re = K({
210
+ }, [W, P]);
211
+ const ne = z({
205
212
  // A ticket closes through /support so its requester hears about it.
206
213
  mutationFn: (r) => fetch(`${c}/${r.kind === "support" ? "support/tickets" : "tasks"}/${r.id}`, {
207
214
  method: "PATCH",
208
- headers: { ...x, "content-type": "application/json" },
209
- credentials: k,
215
+ headers: { ...y, "content-type": "application/json" },
216
+ credentials: g,
210
217
  body: JSON.stringify({ status: "done" })
211
218
  }),
212
- onSuccess: () => _.invalidateQueries({ queryKey: ["my-work"] })
213
- }), A = K({
219
+ onSuccess: () => v.invalidateQueries({ queryKey: ["my-work"] })
220
+ }), M = z({
214
221
  mutationFn: async ({ id: r, action: s }) => {
215
222
  const h = await fetch(`${c}/tasks/${r}/${s}`, {
216
223
  method: "POST",
217
- headers: { ...x, "content-type": "application/json" },
218
- credentials: k,
224
+ headers: { ...y, "content-type": "application/json" },
225
+ credentials: g,
219
226
  body: "{}"
220
227
  }), m = await h.json().catch(() => ({}));
221
228
  if (!h.ok) throw new Error(m.error ?? "Failed");
222
229
  return s;
223
230
  },
224
231
  onSuccess: (r) => {
225
- P(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), _.invalidateQueries({ queryKey: ["my-work"] });
232
+ Q(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), v.invalidateQueries({ queryKey: ["my-work"] });
226
233
  },
227
- onError: (r) => P(Me(r, "Failed"))
228
- }), [M, P] = $(null);
229
- z(() => {
230
- if (!M) return;
231
- const r = setTimeout(() => P(null), 4e3);
234
+ onError: (r) => Q(We(r, "Failed"))
235
+ }), [A, Q] = S(null);
236
+ J(() => {
237
+ if (!A) return;
238
+ const r = setTimeout(() => Q(null), 4e3);
232
239
  return () => clearTimeout(r);
233
- }, [M]);
234
- const ae = K({
240
+ }, [A]);
241
+ const se = z({
235
242
  mutationFn: (r) => fetch(`${c}/notifications/mark-read`, {
236
243
  method: "POST",
237
- headers: { ...x, "content-type": "application/json" },
238
- credentials: k,
244
+ headers: { ...y, "content-type": "application/json" },
245
+ credentials: g,
239
246
  body: JSON.stringify({ ids: r })
240
247
  }),
241
248
  onSuccess: () => {
242
- _.invalidateQueries({ queryKey: ["my-work"] }), _.invalidateQueries({ queryKey: ["notifications"] });
249
+ v.invalidateQueries({ queryKey: ["my-work"] }), v.invalidateQueries({ queryKey: ["notifications"] });
243
250
  }
244
- }), S = (r, s, h, m) => {
245
- if (r && s && de(r)) {
246
- const l = (m ?? []).filter((d) => d.collection && d.item && de(d.collection)).map((d) => ({ collection: d.collection, itemId: String(d.item) }));
247
- if (v({ collection: r, itemId: String(s) }, h, { list: l }) !== "navigate")
251
+ }), C = (r, s, h, m) => {
252
+ if (r && s && le(r)) {
253
+ const l = (m ?? []).filter((d) => d.collection && d.item && le(d.collection)).map((d) => ({ collection: d.collection, itemId: String(d.item) }));
254
+ if (w({ collection: r, itemId: String(s) }, h, { list: l }) !== "navigate")
248
255
  return;
249
256
  }
250
257
  const b = {
251
- record: (l, d) => (u({ collection: l, itemId: d }), null),
252
- ...i
253
- }, t = se(r, s, {
258
+ record: (l, d) => (p({ collection: l, itemId: d }), null),
259
+ ...o
260
+ }, t = ie(r, s, {
254
261
  ...b,
255
262
  record: (l, d) => {
256
- var f;
257
- return ((f = i == null ? void 0 : i.record) == null ? void 0 : f.call(i, l, d)) ?? null;
263
+ var N;
264
+ return ((N = o == null ? void 0 : o.record) == null ? void 0 : N.call(o, l, d)) ?? null;
258
265
  }
259
266
  });
260
267
  if (t) {
261
- Oe(t, (l) => p == null ? void 0 : p(l));
268
+ De(t, (l) => u == null ? void 0 : u(l));
262
269
  return;
263
270
  }
264
- r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && u({ collection: r, itemId: s });
265
- }, ge = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!se(r, s, {
271
+ r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && p({ collection: r, itemId: s });
272
+ }, we = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!ie(r, s, {
266
273
  record: () => null,
267
- ...i
274
+ ...o
268
275
  });
269
- return xe || !a ? /* @__PURE__ */ e(rt, { order: g.order, hidden: g.hidden }) : /* @__PURE__ */ n("div", { className: "space-y-5 p-6", "data-my-work": !0, children: [
270
- /* @__PURE__ */ e(Ue, { onOpenPath: p }),
271
- /* @__PURE__ */ n("div", { className: "flex items-start justify-between", children: [
272
- /* @__PURE__ */ n("div", { className: "grid flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
273
- /* @__PURE__ */ e(F, { label: "Waiting on you", value: a.counts.owned }),
276
+ return ye || !a ? /* @__PURE__ */ e(lt, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work": !0, children: [
277
+ /* @__PURE__ */ e(Be, { onOpenPath: u }),
278
+ /* @__PURE__ */ n("div", { className: "flex flex-col-reverse gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
279
+ /* @__PURE__ */ n("div", { className: "grid min-w-0 flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
280
+ /* @__PURE__ */ e(U, { label: "Waiting on you", value: a.counts.owned }),
274
281
  /* @__PURE__ */ e(
275
- F,
282
+ U,
276
283
  {
277
284
  label: "SLA breached",
278
285
  value: a.counts.owned_breached,
279
286
  tone: a.counts.owned_breached > 0 ? "text-red-600 dark:text-red-400" : ""
280
287
  }
281
288
  ),
282
- /* @__PURE__ */ e(F, { label: "Open tasks", value: a.counts.tasks }),
283
- /* @__PURE__ */ e(F, { label: "Unread notifications", value: a.counts.notifications })
289
+ /* @__PURE__ */ e(U, { label: "Open tasks", value: a.counts.tasks }),
290
+ /* @__PURE__ */ e(U, { label: "Unread notifications", value: a.counts.notifications })
284
291
  ] }),
285
- me && /* @__PURE__ */ n(
286
- "button",
287
- {
288
- type: "button",
289
- onClick: () => {
290
- O(!1), R();
291
- },
292
- className: "ml-3 inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
293
- children: [
294
- /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
295
- "Updates available — refresh"
296
- ]
297
- }
298
- ),
299
- /* @__PURE__ */ e(
300
- "button",
301
- {
302
- type: "button",
303
- onClick: () => {
304
- O(!1), R();
305
- },
306
- disabled: G,
307
- className: "ml-3 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted disabled:opacity-50 dark:border-border",
308
- children: G ? "Refreshing…" : "Refresh"
309
- }
310
- ),
311
- /* @__PURE__ */ n("div", { className: "relative ml-2", children: [
292
+ /* @__PURE__ */ n("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: [
293
+ he && /* @__PURE__ */ n(
294
+ "button",
295
+ {
296
+ type: "button",
297
+ onClick: () => {
298
+ O(!1), X();
299
+ },
300
+ className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
301
+ children: [
302
+ /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
303
+ "Updates available — refresh"
304
+ ]
305
+ }
306
+ ),
312
307
  /* @__PURE__ */ e(
313
308
  "button",
314
309
  {
315
310
  type: "button",
316
- onClick: () => he((r) => !r),
317
- className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted dark:border-border",
318
- children: "Customize"
311
+ onClick: () => {
312
+ O(!1), X();
313
+ },
314
+ disabled: ee,
315
+ className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted disabled:opacity-50 dark:border-border",
316
+ children: ee ? "Refreshing…" : "Refresh"
319
317
  }
320
318
  ),
321
- pe && /* @__PURE__ */ n("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: [
322
- /* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
323
- g.order.map((r, s) => {
324
- const h = ce[r] ?? r, m = g.hidden.includes(r), b = (t) => {
325
- const l = [...g.order], d = s + t;
326
- d < 0 || d >= l.length || ([l[s], l[d]] = [l[d], l[s]], V({ ...g, order: l }));
327
- };
328
- return /* @__PURE__ */ n("div", { className: "flex items-center gap-1 rounded px-1 py-1 hover:bg-muted", children: [
329
- /* @__PURE__ */ e(
330
- "button",
331
- {
332
- type: "button",
333
- onClick: () => V({
334
- ...g,
335
- hidden: m ? g.hidden.filter((t) => t !== r) : [...g.hidden, r]
336
- }),
337
- className: "flex h-4 w-4 items-center justify-center rounded border border-slate-300 text-[10px] dark:border-border",
338
- title: m ? "Show section" : "Hide section",
339
- children: m ? "" : "✓"
340
- }
341
- ),
342
- /* @__PURE__ */ e(
343
- "span",
344
- {
345
- className: `min-w-0 flex-1 truncate text-[12px] ${m ? "text-slate-400 line-through" : ""}`,
346
- children: h
347
- }
348
- ),
349
- /* @__PURE__ */ e(
350
- "button",
351
- {
352
- type: "button",
353
- onClick: () => b(-1),
354
- disabled: s === 0,
355
- className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
356
- children: "↑"
357
- }
358
- ),
359
- /* @__PURE__ */ e(
360
- "button",
319
+ /* @__PURE__ */ n("div", { className: "relative", children: [
320
+ /* @__PURE__ */ e(
321
+ "button",
322
+ {
323
+ type: "button",
324
+ onClick: () => ge((r) => !r),
325
+ className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted dark:border-border",
326
+ children: "Customize"
327
+ }
328
+ ),
329
+ xe && /* @__PURE__ */ n("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: [
330
+ /* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
331
+ x.order.map((r, s) => {
332
+ const h = ue[r] ?? r, m = x.hidden.includes(r), b = (t) => {
333
+ const l = [...x.order], d = s + t;
334
+ d < 0 || d >= l.length || ([l[s], l[d]] = [l[d], l[s]], Y({ ...x, order: l }));
335
+ };
336
+ return /* @__PURE__ */ n(
337
+ "div",
361
338
  {
362
- type: "button",
363
- onClick: () => b(1),
364
- disabled: s === g.order.length - 1,
365
- className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
366
- children: "↓"
367
- }
368
- )
369
- ] }, r);
370
- })
339
+ className: "flex items-center gap-1 rounded px-1 py-1 hover:bg-muted",
340
+ children: [
341
+ /* @__PURE__ */ e(
342
+ "button",
343
+ {
344
+ type: "button",
345
+ onClick: () => Y({
346
+ ...x,
347
+ hidden: m ? x.hidden.filter((t) => t !== r) : [...x.hidden, r]
348
+ }),
349
+ className: "flex h-4 w-4 items-center justify-center rounded border border-slate-300 text-[10px] dark:border-border",
350
+ title: m ? "Show section" : "Hide section",
351
+ children: m ? "" : "✓"
352
+ }
353
+ ),
354
+ /* @__PURE__ */ e(
355
+ "span",
356
+ {
357
+ className: `min-w-0 flex-1 truncate text-[12px] ${m ? "text-slate-400 line-through" : ""}`,
358
+ children: h
359
+ }
360
+ ),
361
+ /* @__PURE__ */ e(
362
+ "button",
363
+ {
364
+ type: "button",
365
+ onClick: () => b(-1),
366
+ disabled: s === 0,
367
+ className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
368
+ children: "↑"
369
+ }
370
+ ),
371
+ /* @__PURE__ */ e(
372
+ "button",
373
+ {
374
+ type: "button",
375
+ onClick: () => b(1),
376
+ disabled: s === x.order.length - 1,
377
+ className: "px-1 text-[11px] text-slate-400 hover:text-foreground disabled:opacity-30",
378
+ children: "↓"
379
+ }
380
+ )
381
+ ]
382
+ },
383
+ r
384
+ );
385
+ })
386
+ ] })
371
387
  ] })
372
388
  ] })
373
389
  ] }),
374
- M && /* @__PURE__ */ e(
390
+ A && /* @__PURE__ */ e(
375
391
  "p",
376
392
  {
377
393
  className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[12px] dark:border-border dark:bg-card",
378
394
  role: "status",
379
395
  "data-my-work-task-note": !0,
380
- children: M
396
+ children: A
381
397
  }
382
398
  ),
383
- /* @__PURE__ */ e(Fe, { questions: a.questions ?? [] }),
399
+ /* @__PURE__ */ e(Ke, { questions: a.questions ?? [] }),
384
400
  /* @__PURE__ */ e(
385
- Be,
401
+ Ye,
386
402
  {
387
- showing: (w == null ? void 0 : w.userId) ?? null,
388
- onShow: (r) => Z((s) => s === r.user_id ? null : r.user_id)
403
+ showing: (k == null ? void 0 : k.userId) ?? null,
404
+ onShow: (r) => G((s) => s === r.user_id ? null : r.user_id)
389
405
  }
390
406
  ),
391
- /* @__PURE__ */ e(He, { className: "mb-4" }),
392
- /* @__PURE__ */ e(ze, { className: "mb-4" }),
407
+ /* @__PURE__ */ e(Ge, { className: "mb-4" }),
408
+ /* @__PURE__ */ e(Ze, { className: "mb-4" }),
393
409
  (() => {
394
410
  const r = {
395
411
  records: () => {
396
- const t = a.owned.filter((o) => oe(o.sla)).length, l = a.owned.filter((o) => {
397
- var N;
398
- return ((N = o.sla) == null ? void 0 : N.status) === "breached";
399
- }).length, d = I === "soon" ? a.owned.filter((o) => oe(o.sla)) : I === "breached" ? a.owned.filter((o) => {
400
- var N;
401
- return ((N = o.sla) == null ? void 0 : N.status) === "breached";
402
- }) : a.owned, f = w ? d.filter((o) => w.keys.has(`${o.collection}:${o.item}`)) : d, j = [
412
+ const t = new Map(a.owned.map((i) => [i, dt(i.sla, ke)])), l = (i) => pe(t.get(i) ?? null), d = (i) => {
413
+ var j;
414
+ return ((j = t.get(i)) == null ? void 0 : j.status) === "breached";
415
+ }, N = a.owned.filter(l).length, T = a.owned.filter(d).length, D = I === "soon" ? a.owned.filter(l) : I === "breached" ? a.owned.filter(d) : a.owned, K = k ? D.filter((i) => k.keys.has(`${i.collection}:${i.item}`)) : D, Ne = [
403
416
  { key: "all", label: `All (${a.owned.length})` },
404
- { key: "soon", label: `Warning within 24h (${t})` },
405
- { key: "breached", label: `Breached (${l})` }
417
+ { key: "soon", label: `Due soon (${N})` },
418
+ { key: "breached", label: `Breached (${T})` }
406
419
  ];
407
420
  return /* @__PURE__ */ n("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
408
421
  /* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
@@ -410,55 +423,55 @@ function Ot({
410
423
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
411
424
  ] }),
412
425
  a.owned.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: [
413
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: j.map((o) => /* @__PURE__ */ e(
426
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: Ne.map((i) => /* @__PURE__ */ e(
414
427
  "button",
415
428
  {
416
429
  type: "button",
417
- "data-my-work-sla-filter": o.key,
418
- "aria-pressed": I === o.key,
419
- onClick: () => be(o.key),
430
+ "data-my-work-sla-filter": i.key,
431
+ "aria-pressed": I === i.key,
432
+ onClick: () => fe(i.key),
420
433
  className: [
421
434
  "rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
422
- I === o.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"
435
+ I === 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"
423
436
  ].join(" "),
424
- children: o.label
437
+ children: i.label
425
438
  },
426
- o.key
439
+ i.key
427
440
  )) }),
428
- w && /* @__PURE__ */ n(
441
+ k && /* @__PURE__ */ n(
429
442
  "button",
430
443
  {
431
444
  type: "button",
432
445
  "data-my-work-cover-filter": !0,
433
- onClick: () => Z(null),
434
- "aria-label": `Show all records, not only ${w.name}'s`,
446
+ onClick: () => G(null),
447
+ "aria-label": `Show all records, not only ${k.name}'s`,
435
448
  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]",
436
449
  children: [
437
- w.name,
450
+ k.name,
438
451
  "'s records",
439
452
  /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "text-[12px] leading-none", children: "×" })
440
453
  ]
441
454
  }
442
455
  )
443
456
  ] }),
444
- f.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: f.map((o) => {
445
- var N;
457
+ K.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: K.map((i) => {
458
+ var j, de;
446
459
  return /* @__PURE__ */ e(
447
460
  "li",
448
461
  {
449
- className: C(`o:${o.collection}:${o.item}`),
450
- "data-my-work-fresh": te.has(`o:${o.collection}:${o.item}`) || void 0,
462
+ className: _(`o:${i.collection}:${i.item}`),
463
+ "data-my-work-fresh": ae.has(`o:${i.collection}:${i.item}`) || void 0,
451
464
  children: /* @__PURE__ */ n(
452
465
  "button",
453
466
  {
454
467
  type: "button",
455
- onClick: (Q) => S(o.collection, o.item, Q, f),
456
- ...H.record(o.collection, o.item),
468
+ onClick: (B) => C(i.collection, i.item, B, K),
469
+ ...R.record(i.collection, i.item),
457
470
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
458
471
  children: [
459
- /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium", children: o.label }),
460
- /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: o.collection.replace(/_/g, " ") }),
461
- ((N = o.flags) == null ? void 0 : N.some((Q) => /^on hold$/i.test(Q.name.trim()))) && /* @__PURE__ */ e(
472
+ /* @__PURE__ */ e("span", { className: "min-w-[6.5rem] flex-1 truncate text-[12.5px] font-medium", children: i.label }),
473
+ /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: i.collection.replace(/_/g, " ") }),
474
+ ((j = i.flags) == null ? void 0 : j.some((B) => /^on hold$/i.test(B.name.trim()))) && /* @__PURE__ */ e(
462
475
  "span",
463
476
  {
464
477
  "data-my-work-hold": !0,
@@ -466,13 +479,19 @@ function Ot({
466
479
  children: "On hold"
467
480
  }
468
481
  ),
469
- /* @__PURE__ */ e(tt, { state: o.state, color: o.state_color }),
470
- /* @__PURE__ */ e(et, { sla: o.sla })
482
+ /* @__PURE__ */ e(
483
+ it,
484
+ {
485
+ state: i.state_label || ((de = i.state) == null ? void 0 : de.replace(/_/g, " ")) || null,
486
+ color: i.state_color
487
+ }
488
+ ),
489
+ /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(ot, { sla: t.get(i) ?? null }) })
471
490
  ]
472
491
  }
473
492
  )
474
493
  },
475
- `${o.collection}:${o.item}`
494
+ `${i.collection}:${i.item}`
476
495
  );
477
496
  }) })
478
497
  ] });
@@ -488,12 +507,12 @@ function Ot({
488
507
  /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Changes to review" }),
489
508
  /* @__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." })
490
509
  ] }),
491
- /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className: C(`p:${t.id}`), "data-my-work-proposal": t.id, children: /* @__PURE__ */ n(
510
+ /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className: _(`p:${t.id}`), "data-my-work-proposal": t.id, children: /* @__PURE__ */ n(
492
511
  "button",
493
512
  {
494
513
  type: "button",
495
- onClick: () => S(t.collection, t.item),
496
- ...H.record(t.collection, t.item),
514
+ onClick: () => C(t.collection, t.item),
515
+ ...R.record(t.collection, t.item),
497
516
  className: "flex w-full items-start gap-2.5 px-4 py-2 text-left hover:bg-muted",
498
517
  children: [
499
518
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
@@ -507,7 +526,7 @@ function Ot({
507
526
  t.reason
508
527
  ] })
509
528
  ] }),
510
- /* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: qe(t.created_at) })
529
+ /* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: Qe(t.created_at) })
511
530
  ]
512
531
  }
513
532
  ) }, t.id)) })
@@ -519,15 +538,15 @@ function Ot({
519
538
  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((t) => /* @__PURE__ */ n(
520
539
  "li",
521
540
  {
522
- className: D("flex items-center gap-2.5 px-4 py-2", C(`t:${t.id}`)),
541
+ className: q("flex items-center gap-2.5 px-4 py-2", _(`t:${t.id}`)),
523
542
  children: [
524
543
  /* @__PURE__ */ e(
525
544
  "button",
526
545
  {
527
546
  type: "button",
528
547
  title: "Mark done",
529
- onClick: () => re.mutate(t),
530
- disabled: re.isPending,
548
+ onClick: () => ne.mutate(t),
549
+ disabled: ne.isPending,
531
550
  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",
532
551
  children: "✓"
533
552
  }
@@ -541,7 +560,7 @@ function Ot({
541
560
  "data-tip": `Handed to ${t.agent_name ?? "your agent"} — it picks this up through My Work`,
542
561
  "data-my-work-agent-task": t.id,
543
562
  children: [
544
- /* @__PURE__ */ e(we, { className: "h-3 w-3", "aria-hidden": !0 }),
563
+ /* @__PURE__ */ e(Se, { className: "h-3 w-3", "aria-hidden": !0 }),
545
564
  t.agent_name ?? "Agent"
546
565
  ]
547
566
  }
@@ -550,7 +569,7 @@ function Ot({
550
569
  "button",
551
570
  {
552
571
  type: "button",
553
- onClick: (l) => t.kind === "support" ? J(t.id) : S(t.collection, t.item, l),
572
+ onClick: (l) => t.kind === "support" ? V(t.id) : C(t.collection, t.item, l),
554
573
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
555
574
  children: [
556
575
  t.title,
@@ -559,18 +578,18 @@ function Ot({
559
578
  }
560
579
  ),
561
580
  /* @__PURE__ */ e(
562
- We,
581
+ ze,
563
582
  {
564
583
  task: t,
565
584
  isAssignee: !0,
566
585
  compact: !0,
567
- onTaskChanged: () => void _.invalidateQueries({ queryKey: ["my-work"] })
586
+ onTaskChanged: () => void v.invalidateQueries({ queryKey: ["my-work"] })
568
587
  }
569
588
  ),
570
589
  t.due_date && /* @__PURE__ */ e(
571
590
  "span",
572
591
  {
573
- className: `text-[11px] tabular-nums ${q(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
592
+ className: `text-[11px] tabular-nums ${F(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
574
593
  children: new Date(t.due_date).toLocaleDateString(void 0, { timeZone: "UTC" })
575
594
  }
576
595
  )
@@ -592,7 +611,7 @@ function Ot({
592
611
  (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((t) => /* @__PURE__ */ n(
593
612
  "li",
594
613
  {
595
- className: D("flex items-center gap-2.5 px-4 py-2", C(`tt:${t.id}`)),
614
+ className: q("flex items-center gap-2.5 px-4 py-2", _(`tt:${t.id}`)),
596
615
  "data-my-work-team-task": t.id,
597
616
  children: [
598
617
  t.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" }),
@@ -600,7 +619,7 @@ function Ot({
600
619
  "button",
601
620
  {
602
621
  type: "button",
603
- onClick: (l) => S(t.collection, t.item, l),
622
+ onClick: (l) => C(t.collection, t.item, l),
604
623
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
605
624
  children: [
606
625
  t.title,
@@ -611,7 +630,7 @@ function Ot({
611
630
  t.due_date && /* @__PURE__ */ e(
612
631
  "span",
613
632
  {
614
- className: `text-[11px] tabular-nums ${q(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
633
+ className: `text-[11px] tabular-nums ${F(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
615
634
  children: new Date(t.due_date).toLocaleDateString(void 0, {
616
635
  timeZone: "UTC"
617
636
  })
@@ -621,8 +640,8 @@ function Ot({
621
640
  "button",
622
641
  {
623
642
  type: "button",
624
- onClick: () => A.mutate({ id: t.id, action: "claim" }),
625
- disabled: A.isPending,
643
+ onClick: () => M.mutate({ id: t.id, action: "claim" }),
644
+ disabled: M.isPending,
626
645
  className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted dark:border-border",
627
646
  "data-my-work-claim": t.id,
628
647
  children: "Pick it up"
@@ -636,7 +655,7 @@ function Ot({
636
655
  }
637
656
  ),
638
657
  waiting: () => {
639
- const t = a.requested ?? [], l = t.filter((d) => q(d.due_date)).length;
658
+ const t = a.requested ?? [], l = t.filter((d) => F(d.due_date)).length;
640
659
  return /* @__PURE__ */ n(
641
660
  "section",
642
661
  {
@@ -654,18 +673,18 @@ function Ot({
654
673
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
655
674
  ] }),
656
675
  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((d) => {
657
- const f = q(d.due_date), j = !!d.nudged_at && Date.now() - new Date(d.nudged_at).getTime() < 20 * 36e5;
676
+ const N = F(d.due_date), T = !!d.nudged_at && Date.now() - new Date(d.nudged_at).getTime() < 20 * 36e5;
658
677
  return /* @__PURE__ */ n(
659
678
  "li",
660
679
  {
661
- className: D("flex items-center gap-2.5 px-4 py-2", C(`r:${d.id}`)),
680
+ className: q("flex items-center gap-2.5 px-4 py-2", _(`r:${d.id}`)),
662
681
  "data-my-work-requested": d.id,
663
682
  children: [
664
683
  /* @__PURE__ */ n(
665
684
  "button",
666
685
  {
667
686
  type: "button",
668
- onClick: (o) => d.kind === "support" ? J(d.id) : S(d.collection, d.item, o),
687
+ onClick: (D) => d.kind === "support" ? V(d.id) : C(d.collection, d.item, D),
669
688
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
670
689
  children: [
671
690
  d.title,
@@ -679,9 +698,9 @@ function Ot({
679
698
  d.due_date && /* @__PURE__ */ n(
680
699
  "span",
681
700
  {
682
- className: `text-[11px] tabular-nums ${f ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
701
+ className: `text-[11px] tabular-nums ${N ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
683
702
  children: [
684
- f ? "Overdue · " : "",
703
+ N ? "Overdue · " : "",
685
704
  new Date(d.due_date).toLocaleDateString(void 0, {
686
705
  timeZone: "UTC"
687
706
  })
@@ -692,12 +711,12 @@ function Ot({
692
711
  "button",
693
712
  {
694
713
  type: "button",
695
- onClick: () => A.mutate({ id: d.id, action: "nudge" }),
696
- disabled: A.isPending || j,
697
- title: j ? "Already nudged today" : "Send a reminder",
714
+ onClick: () => M.mutate({ id: d.id, action: "nudge" }),
715
+ disabled: M.isPending || T,
716
+ title: T ? "Already nudged today" : "Send a reminder",
698
717
  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",
699
718
  "data-my-work-nudge": d.id,
700
- children: j ? "Nudged" : "Nudge"
719
+ children: T ? "Nudged" : "Nudge"
701
720
  }
702
721
  )
703
722
  ]
@@ -716,7 +735,7 @@ function Ot({
716
735
  "button",
717
736
  {
718
737
  type: "button",
719
- onClick: () => ae.mutate(a.notifications.map((t) => t.id)),
738
+ onClick: () => se.mutate(a.notifications.map((t) => t.id)),
720
739
  className: "text-[11px] text-[#00a5cc] hover:underline",
721
740
  children: "Mark all read"
722
741
  }
@@ -725,21 +744,21 @@ function Ot({
725
744
  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((t) => /* @__PURE__ */ n(
726
745
  "li",
727
746
  {
728
- className: D("flex items-start gap-2.5 px-4 py-2", C(`n:${t.id}`)),
747
+ className: q("flex items-start gap-2.5 px-4 py-2", _(`n:${t.id}`)),
729
748
  children: [
730
749
  /* @__PURE__ */ e(
731
- Ze,
750
+ rt,
732
751
  {
733
752
  userId: t.sender,
734
753
  className: "mt-0.5 h-5 w-5",
735
754
  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" })
736
755
  }
737
756
  ),
738
- ge(t.collection, t.item) ? /* @__PURE__ */ n(
757
+ we(t.collection, t.item) ? /* @__PURE__ */ n(
739
758
  "button",
740
759
  {
741
760
  type: "button",
742
- onClick: (l) => S(t.collection, t.item, l, a.notifications),
761
+ onClick: (l) => C(t.collection, t.item, l, a.notifications),
743
762
  className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
744
763
  children: [
745
764
  /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
@@ -759,9 +778,9 @@ function Ot({
759
778
  type: "button",
760
779
  "aria-label": "Mark read",
761
780
  "data-tip": "Mark read",
762
- onClick: () => ae.mutate([t.id]),
781
+ onClick: () => se.mutate([t.id]),
763
782
  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",
764
- children: /* @__PURE__ */ e(ye, { className: "h-3 w-3" })
783
+ children: /* @__PURE__ */ e(Ce, { className: "h-3 w-3" })
765
784
  }
766
785
  )
767
786
  ]
@@ -770,39 +789,41 @@ function Ot({
770
789
  )) })
771
790
  ] })
772
791
  }, s = new Map(
773
- g.order.filter((t) => !g.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
792
+ x.order.filter((t) => !x.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
774
793
  ), h = [...s.keys()], m = [];
775
794
  let b = 0;
776
795
  for (; b < h.length; ) {
777
796
  const t = h[b];
778
- if (le.has(t))
779
- m.push(/* @__PURE__ */ e("div", { children: s.get(t) }, t)), b++;
797
+ if (me.has(t))
798
+ m.push(
799
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(t) }, t)
800
+ ), b++;
780
801
  else {
781
802
  const l = [t];
782
- b + 1 < h.length && !le.has(h[b + 1]) && l.push(h[b + 1]), m.push(
783
- /* @__PURE__ */ e("div", { className: "grid gap-5 lg:grid-cols-2", children: l.map((d) => /* @__PURE__ */ e("div", { children: s.get(d) }, d)) }, l.join("+"))
803
+ b + 1 < h.length && !me.has(h[b + 1]) && l.push(h[b + 1]), m.push(
804
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: l.map((d) => /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(d) }, d)) }, l.join("+"))
784
805
  ), b += l.length;
785
806
  }
786
807
  }
787
808
  return m;
788
809
  })(),
789
- /* @__PURE__ */ e(at, {})
810
+ /* @__PURE__ */ e(ct, {})
790
811
  ] });
791
812
  }
792
- function at() {
793
- const i = Pe(), { rooms: p } = Qe(i);
794
- return !i || p.length === 0 ? null : /* @__PURE__ */ n(
813
+ function ct() {
814
+ const o = Je(), { rooms: u } = Re(o);
815
+ return !o || u.length === 0 ? null : /* @__PURE__ */ n(
795
816
  "section",
796
817
  {
797
818
  className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
798
819
  "data-my-work-chat": !0,
799
820
  children: [
800
821
  /* @__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" }) }),
801
- /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: p.map((c) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
822
+ /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((c) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
802
823
  "button",
803
824
  {
804
825
  type: "button",
805
- onClick: () => Ee(c.room, c.label),
826
+ onClick: () => He(c.room, c.label),
806
827
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
807
828
  "data-my-work-chat-room": c.room,
808
829
  children: [
@@ -823,5 +844,5 @@ function at() {
823
844
  );
824
845
  }
825
846
  export {
826
- Ot as MyWorkView
847
+ Ft as MyWorkView
827
848
  };