@nivaro/react 0.3.100 → 0.3.101

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 (30) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +46 -3
  4. package/dist/index.js +623 -620
  5. package/dist/shared/components/ActivityEntry.js +5 -5
  6. package/dist/shared/components/ItemEditForm.js +2708 -2704
  7. package/dist/shared/components/JobsTray.js +74 -63
  8. package/dist/shared/components/NotificationBell.js +80 -73
  9. package/dist/shared/components/TipLayer.js +56 -41
  10. package/dist/shared/components/integrations/console/SignalCard.js +40 -40
  11. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +95 -73
  12. package/dist/shared/components/integrations/console/drill/status.js +23 -18
  13. package/dist/shared/components/item-edit/RecordInsights.js +86 -86
  14. package/dist/shared/components/item-edit/header-path-preview.js +46 -34
  15. package/dist/shared/components/notifications/DeliveryChips.js +1 -2
  16. package/dist/shared/components/panels/BackgroundMove.js +152 -85
  17. package/dist/shared/components/panels/PipelinePanel.js +602 -594
  18. package/dist/shared/components/profile/ActivityFeedCard.js +322 -0
  19. package/dist/shared/components/profile/DayTimeline.js +145 -140
  20. package/dist/shared/components/profile/PersonAccess.js +679 -383
  21. package/dist/shared/components/profile/PersonActivity.js +404 -427
  22. package/dist/shared/components/profile/PersonDidPanel.js +248 -134
  23. package/dist/shared/components/profile/PersonProfile.js +33 -32
  24. package/dist/shared/components/profile/journey-view.js +166 -0
  25. package/dist/shared/lib/activity-sentence.js +319 -236
  26. package/dist/shared/lib/jobs-tray.js +60 -41
  27. package/dist/shared/lib/move-failure.js +16 -6
  28. package/dist/shared/lib/obligation-banner.js +16 -16
  29. package/dist/shared/lib/partner-failure.js +44 -32
  30. package/package.json +1 -1
@@ -1,78 +1,86 @@
1
- import { jsxs as o, jsx as t } from "react/jsx-runtime";
2
- import { useQuery as b } from "@tanstack/react-query";
3
- import { Loader2 as x, Check as f, ChevronDown as g, ChevronUp as y, AlertCircle as N, Timer as w, Download as C, X as _ } from "lucide-react";
4
- import { useState as v, useEffect as $ } from "react";
5
- import { createPortal as q } from "react-dom";
6
- import { useOptionalNivaroClient as J, useNavigation as D } from "../context.js";
7
- import { clock as F } from "../lib/background-runs.js";
8
- import { get as T, post as E } from "../lib/commands.js";
9
- import { jobFailureText as M } from "../lib/job-failure-text.js";
10
- import { useTrayJobs as O, seedJobs as U, dismissFinishedJobs as L, dismissJob as R, applyJobUpdate as S } from "../lib/jobs-tray.js";
11
- import { useLiveEvent as z } from "../lib/live.js";
12
- import { cn as A } from "../lib/utils.js";
13
- import { queueStanding as B } from "./imports/run-parts.js";
14
- function ae() {
15
- const e = J(), d = D(), s = O(), [l, c] = v(!0);
16
- z("job:progress", (a) => S(a), { includeOwn: !0 });
17
- const m = s.some((a) => a.status === "running" || a.status === "queued"), { data: i } = b({
1
+ import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
+ import { useQuery as N } from "@tanstack/react-query";
3
+ import { Loader2 as f, AlertCircle as v, CircleSlash as k, Check as g, ChevronDown as w, ChevronUp as C, Timer as _, Download as q, X as J } from "lucide-react";
4
+ import { useState as b, useEffect as D } from "react";
5
+ import { createPortal as F } from "react-dom";
6
+ import { useOptionalNivaroClient as T, useNavigation as $ } from "../context.js";
7
+ import { clock as E } from "../lib/background-runs.js";
8
+ import { get as M, post as O } from "../lib/commands.js";
9
+ import { jobFailureText as S } from "../lib/job-failure-text.js";
10
+ import { useTrayJobs as U, seedJobs as H, trayHeadline as L, dismissFinishedJobs as R, dismissJob as z, applyJobUpdate as A } from "../lib/jobs-tray.js";
11
+ import { useLiveEvent as B } from "../lib/live.js";
12
+ import { cn as I } from "../lib/utils.js";
13
+ import { queueStanding as K } from "./imports/run-parts.js";
14
+ function re() {
15
+ const e = T(), o = $(), s = U(), [l, d] = b(!0);
16
+ B("job:progress", (a) => A(a), { includeOwn: !0 });
17
+ const m = s.some((a) => a.status === "running" || a.status === "queued"), { data: i } = N({
18
18
  queryKey: ["jobs-tray-seed"],
19
19
  enabled: !!e,
20
20
  staleTime: 0,
21
21
  refetchInterval: m ? 2e4 : !1,
22
- queryFn: () => e.request(T("/my-jobs")).then((a) => a.data ?? []).catch(() => [])
22
+ queryFn: () => e.request(M("/my-jobs")).then((a) => a.data ?? []).catch(() => [])
23
23
  });
24
- if ($(() => {
25
- i && U(i);
24
+ if (D(() => {
25
+ i && H(i);
26
26
  }, [i]), s.length === 0 || typeof document > "u") return null;
27
- const r = s.filter((a) => a.status === "running" || a.status === "queued").length, n = s.length - r, u = (a) => d.navigate ? d.navigate(a) : window.location.assign(a);
28
- return q(
29
- /* @__PURE__ */ o(
27
+ const c = s.filter((a) => a.status === "running" || a.status === "queued").length, p = s.length - c, n = L(s), u = (a) => o.navigate ? o.navigate(a) : window.location.assign(a);
28
+ return F(
29
+ /* @__PURE__ */ r(
30
30
  "div",
31
31
  {
32
32
  "data-jobs-tray": s.length,
33
+ "data-jobs-tray-tone": n.tone,
33
34
  "data-nvr-dock-aware": !0,
34
35
  "data-nvr-recording-hide": !0,
35
36
  className: "fixed bottom-4 left-1/2 z-[110] w-[min(420px,calc(100vw-2rem))] -translate-x-1/2 overflow-hidden rounded-xl border border-slate-200 bg-white text-slate-700 shadow-xl dark:border-[#334155] dark:bg-[#1e293b] dark:text-slate-200",
36
37
  children: [
37
- /* @__PURE__ */ o("div", { className: "flex items-center gap-2 px-3 py-2", children: [
38
- r > 0 ? /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5 shrink-0 animate-spin text-nvr-cyan" }) : /* @__PURE__ */ t(f, { className: "h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
39
- /* @__PURE__ */ t(
38
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2 px-3 py-2", children: [
39
+ n.tone === "running" ? /* @__PURE__ */ t(f, { className: "h-3.5 w-3.5 shrink-0 animate-spin text-nvr-cyan" }) : n.tone === "failed" ? /* @__PURE__ */ t(v, { className: "h-3.5 w-3.5 shrink-0 text-rose-500" }) : n.tone === "cancelled" ? /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }) : /* @__PURE__ */ t(g, { className: "h-3.5 w-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" }),
40
+ /* @__PURE__ */ r(
40
41
  "button",
41
42
  {
42
43
  type: "button",
43
- onClick: () => c((a) => !a),
44
- className: "min-w-0 flex-1 text-left text-[12.5px] font-medium",
44
+ onClick: () => d((a) => !a),
45
+ className: "min-w-0 flex-1 truncate text-left text-[12.5px] font-medium",
45
46
  "aria-expanded": l,
46
- children: r > 0 ? `${r} job${r === 1 ? "" : "s"} running` : `${n} job${n === 1 ? "" : "s"} finished`
47
+ "data-jobs-tray-head": !0,
48
+ children: [
49
+ n.text,
50
+ n.note && /* @__PURE__ */ r("span", { className: "font-normal text-rose-600 dark:text-rose-300", children: [
51
+ " · ",
52
+ n.note
53
+ ] })
54
+ ]
47
55
  }
48
56
  ),
49
- n > 0 && /* @__PURE__ */ t(
57
+ p > 0 && /* @__PURE__ */ t(
50
58
  "button",
51
59
  {
52
60
  type: "button",
53
- onClick: L,
61
+ onClick: R,
54
62
  "data-jobs-tray-clear": !0,
55
63
  className: "text-[11px] text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100",
56
- children: "Clear finished"
64
+ children: c > 0 ? "Clear finished" : "Clear"
57
65
  }
58
66
  ),
59
67
  /* @__PURE__ */ t(
60
68
  "button",
61
69
  {
62
70
  type: "button",
63
- onClick: () => c((a) => !a),
71
+ onClick: () => d((a) => !a),
64
72
  "aria-label": l ? "Collapse" : "Expand",
65
73
  className: "flex h-6 w-6 items-center justify-center rounded hover:bg-black/5 dark:hover:bg-white/10",
66
- children: l ? /* @__PURE__ */ t(g, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(y, { className: "h-3.5 w-3.5" })
74
+ children: l ? /* @__PURE__ */ t(w, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(C, { className: "h-3.5 w-3.5" })
67
75
  }
68
76
  )
69
77
  ] }),
70
78
  l && /* @__PURE__ */ t("ul", { className: "max-h-[40vh] divide-y divide-slate-100 overflow-y-auto border-t border-slate-100 dark:divide-[#334155] dark:border-[#334155]", children: s.map((a) => /* @__PURE__ */ t(
71
- H,
79
+ P,
72
80
  {
73
81
  job: a,
74
82
  onOpen: u,
75
- onCancel: e && a.cancel_path ? (h) => e.request(E(h)).then(() => {
83
+ onCancel: e && a.cancel_path ? (h) => e.request(O(h)).then(() => {
76
84
  }) : void 0
77
85
  },
78
86
  a.key
@@ -83,38 +91,41 @@ function ae() {
83
91
  document.body
84
92
  );
85
93
  }
86
- function H({
94
+ function P({
87
95
  job: e,
88
- onOpen: d,
96
+ onOpen: o,
89
97
  onCancel: s
90
98
  }) {
91
- const [l, c] = v("idle"), m = e.status === "completed", i = e.status === "error", r = e.status === "queued", n = e.progress ?? {}, u = Number(n.total), a = Number(n.done), h = Number.isFinite(u) && u > 0 && Number.isFinite(a) ? Math.max(0, Math.min(100, Math.round(a / u * 100))) : null, k = typeof n.phase == "string" ? n.phase : null, p = r ? B(
99
+ const [l, d] = b("idle"), m = e.status === "completed", i = e.status === "error", c = e.status === "queued", p = e.status === "canceled", n = e.progress ?? {}, u = Number(n.total), a = Number(n.done), h = Number.isFinite(u) && u > 0 && Number.isFinite(a) ? Math.max(0, Math.min(100, Math.round(a / u * 100))) : null, y = typeof n.phase == "string" ? n.phase : null, x = c ? K(
92
100
  e.position != null ? { position: e.position, eta_seconds: e.eta_seconds ?? null } : void 0
93
101
  ) : i ? (
94
102
  // Read, never shown as stored: a job's error is written for the log (lib/job-failure-text).
95
- M(e.error)
96
- ) : m ? e.outcome : e.kind === "background-run" ? (
103
+ S(e.error)
104
+ ) : m ? e.outcome : p ? (
105
+ // An import's cancel sends no outcome: the row still says what happened.
106
+ e.outcome || "Cancelled"
107
+ ) : e.kind === "background-run" ? (
97
108
  // #2759 — a slow read the server is finishing: say how long it usually takes.
98
- Number(n.expected_ms) >= 1e3 ? `Usually takes about ${F(Number(n.expected_ms))}` : "Running on the server"
99
- ) : [k, h != null ? `${a} of ${u}` : null].filter(Boolean).join(" · ") || null;
100
- return /* @__PURE__ */ o(
109
+ Number(n.expected_ms) >= 1e3 ? `Usually takes about ${E(Number(n.expected_ms))}` : "Running on the server"
110
+ ) : [y, h != null ? `${a} of ${u}` : null].filter(Boolean).join(" · ") || null;
111
+ return /* @__PURE__ */ r(
101
112
  "li",
102
113
  {
103
114
  "data-job": e.key,
104
115
  "data-job-status": e.status,
105
116
  className: "flex items-start gap-2.5 px-3 py-2",
106
117
  children: [
107
- /* @__PURE__ */ t("span", { className: "mt-0.5 shrink-0", children: i ? /* @__PURE__ */ t(N, { className: "h-3.5 w-3.5 text-rose-500" }) : m ? /* @__PURE__ */ t(f, { className: "h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" }) : r ? /* @__PURE__ */ t(w, { className: "h-3.5 w-3.5 text-slate-400" }) : /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5 animate-spin text-nvr-cyan" }) }),
108
- /* @__PURE__ */ o("div", { className: "min-w-0 flex-1", children: [
118
+ /* @__PURE__ */ t("span", { className: "mt-0.5 shrink-0", children: i ? /* @__PURE__ */ t(v, { className: "h-3.5 w-3.5 text-rose-500" }) : m ? /* @__PURE__ */ t(g, { className: "h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400" }) : p ? /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5 text-slate-400" }) : c ? /* @__PURE__ */ t(_, { className: "h-3.5 w-3.5 text-slate-400" }) : /* @__PURE__ */ t(f, { className: "h-3.5 w-3.5 animate-spin text-nvr-cyan" }) }),
119
+ /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
109
120
  /* @__PURE__ */ t("p", { className: "truncate text-[12.5px] font-medium", children: e.label }),
110
- p && /* @__PURE__ */ t(
121
+ x && /* @__PURE__ */ t(
111
122
  "p",
112
123
  {
113
- className: A(
124
+ className: I(
114
125
  "line-clamp-2 text-[11px]",
115
126
  i ? "text-rose-600 dark:text-rose-300" : "text-slate-500 dark:text-slate-400"
116
127
  ),
117
- children: p
128
+ children: x
118
129
  }
119
130
  ),
120
131
  e.status === "running" && h != null && /* @__PURE__ */ t("div", { className: "mt-1 h-1 overflow-hidden rounded-full bg-slate-100 dark:bg-[#334155]", children: /* @__PURE__ */ t(
@@ -124,15 +135,15 @@ function H({
124
135
  style: { width: `${h}%` }
125
136
  }
126
137
  ) }),
127
- (e.file_id || e.href) && (e.status === "completed" || e.status === "error") && /* @__PURE__ */ o("div", { className: "mt-1 flex items-center gap-2", children: [
128
- e.file_id && m && /* @__PURE__ */ o(
138
+ (e.file_id || e.href) && (e.status === "completed" || e.status === "error") && /* @__PURE__ */ r("div", { className: "mt-1 flex items-center gap-2", children: [
139
+ e.file_id && m && /* @__PURE__ */ r(
129
140
  "a",
130
141
  {
131
142
  href: `/api/files/${e.file_id}?download=1`,
132
143
  "data-job-download": !0,
133
144
  className: "inline-flex items-center gap-1 rounded-full border border-nvr-cyan/50 bg-nvr-cyan/10 px-2 py-0.5 text-[11px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
134
145
  children: [
135
- /* @__PURE__ */ t(C, { className: "h-3 w-3" }),
146
+ /* @__PURE__ */ t(q, { className: "h-3 w-3" }),
136
147
  "Download"
137
148
  ]
138
149
  }
@@ -141,18 +152,18 @@ function H({
141
152
  "button",
142
153
  {
143
154
  type: "button",
144
- onClick: () => d(e.href),
155
+ onClick: () => o(e.href),
145
156
  className: "text-[11px] text-slate-500 underline-offset-2 hover:underline dark:text-slate-400",
146
157
  children: "Details"
147
158
  }
148
159
  )
149
160
  ] }),
150
- e.status === "running" && e.cancel_path && s && /* @__PURE__ */ o("div", { className: "mt-1 flex items-center gap-2", children: [
161
+ e.status === "running" && e.cancel_path && s && /* @__PURE__ */ r("div", { className: "mt-1 flex items-center gap-2", children: [
151
162
  e.href && /* @__PURE__ */ t(
152
163
  "button",
153
164
  {
154
165
  type: "button",
155
- onClick: () => d(e.href),
166
+ onClick: () => o(e.href),
156
167
  className: "text-[11px] text-slate-500 underline-offset-2 hover:underline dark:text-slate-400",
157
168
  children: "Open"
158
169
  }
@@ -164,9 +175,9 @@ function H({
164
175
  "data-job-cancel": !0,
165
176
  disabled: l === "asking",
166
177
  onClick: () => {
167
- c("asking"), s(e.cancel_path).then(
168
- () => c("idle"),
169
- () => c("failed")
178
+ d("asking"), s(e.cancel_path).then(
179
+ () => d("idle"),
180
+ () => d("failed")
170
181
  );
171
182
  },
172
183
  className: "text-[11px] text-slate-500 underline-offset-2 hover:text-rose-600 hover:underline disabled:opacity-50 dark:text-slate-400 dark:hover:text-rose-300",
@@ -175,11 +186,11 @@ function H({
175
186
  ),
176
187
  l === "failed" && /* @__PURE__ */ t("span", { className: "text-[11px] text-rose-600 dark:text-rose-300", children: "Could not cancel" })
177
188
  ] }),
178
- r && e.href && /* @__PURE__ */ t(
189
+ c && e.href && /* @__PURE__ */ t(
179
190
  "button",
180
191
  {
181
192
  type: "button",
182
- onClick: () => d(e.href),
193
+ onClick: () => o(e.href),
183
194
  className: "mt-0.5 text-[11px] text-slate-500 underline-offset-2 hover:underline dark:text-slate-400",
184
195
  children: "Details"
185
196
  }
@@ -189,11 +200,11 @@ function H({
189
200
  "button",
190
201
  {
191
202
  type: "button",
192
- onClick: () => R(e.key),
203
+ onClick: () => z(e.key),
193
204
  "aria-label": "Dismiss",
194
205
  "data-job-dismiss": !0,
195
206
  className: "flex h-6 w-6 shrink-0 items-center justify-center rounded hover:bg-black/5 dark:hover:bg-white/10",
196
- children: /* @__PURE__ */ t(_, { className: "h-3 w-3" })
207
+ children: /* @__PURE__ */ t(J, { className: "h-3 w-3" })
197
208
  }
198
209
  )
199
210
  ]
@@ -201,5 +212,5 @@ function H({
201
212
  );
202
213
  }
203
214
  export {
204
- ae as JobsTray
215
+ re as JobsTray
205
216
  };