@nivaro/react 0.3.0 → 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 (27) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +341 -0
  4. package/dist/index.js +764 -723
  5. package/dist/shared/components/ClientChaosToolbar.js +410 -0
  6. package/dist/shared/components/LoadErrorNote.js +49 -0
  7. package/dist/shared/components/PretendDown.js +258 -0
  8. package/dist/shared/components/ProfileView.js +54 -49
  9. package/dist/shared/components/QueryErrorState.js +16 -0
  10. package/dist/shared/components/ReportView.js +1351 -1338
  11. package/dist/shared/components/WidgetSlot.js +438 -418
  12. package/dist/shared/components/chaos/DeclareIncidentButton.js +72 -0
  13. package/dist/shared/components/chaos/DrillBanner.js +119 -0
  14. package/dist/shared/components/chaos/DrillTag.js +62 -0
  15. package/dist/shared/components/chaos/GameDayStrip.js +61 -0
  16. package/dist/shared/components/client-chaos-gate.js +51 -0
  17. package/dist/shared/components/integrations/console/SignalCard.js +172 -167
  18. package/dist/shared/components/layout-editor/EditorTopBar.js +108 -105
  19. package/dist/shared/components/layout-editor/LayoutEditor.js +514 -508
  20. package/dist/shared/components/notifications/NotificationAnalyticsView.js +18 -10
  21. package/dist/shared/components/pipeline/PipelineEditorView.js +495 -479
  22. package/dist/shared/components/pipeline/TeamsView.js +184 -169
  23. package/dist/shared/lib/client-chaos.js +359 -0
  24. package/dist/shared/lib/load-error.js +26 -0
  25. package/dist/shared/lib/socket-realtime.js +31 -30
  26. package/dist/shared/lib/worker-socket.js +108 -89
  27. package/package.json +1 -1
@@ -1,39 +1,40 @@
1
1
  import { jsxs as a, jsx as e, Fragment as H } from "react/jsx-runtime";
2
- import { useQueryClient as W, useQuery as q, useMutation as k } from "@tanstack/react-query";
2
+ import { useQueryClient as M, useQuery as $, useMutation as w } from "@tanstack/react-query";
3
3
  import { Plus as V, Sparkles as X, Users2 as Y, X as G, Loader2 as J } from "lucide-react";
4
- import { useState as h, useEffect as Z } from "react";
5
- import { toast as w } from "sonner";
6
- import { useNivaroClient as K, useItemNavigation as ee } from "../../context.js";
7
- import { get as S, post as M, patch as te, del as E } from "../../lib/commands.js";
4
+ import { useState as b, useEffect as Z } from "react";
5
+ import { toast as C } from "sonner";
6
+ import { useNivaroClient as T, useItemNavigation as ee } from "../../context.js";
7
+ import { get as F, post as B, patch as te, del as O } from "../../lib/commands.js";
8
8
  import { useLiveOps as ae } from "../../lib/live-ops.js";
9
- import { cn as y, formatRelative as B } from "../../lib/utils.js";
10
- import { Button as v } from "../ui/button.js";
11
- import { Input as $ } from "../ui/input.js";
12
- import { Textarea as R } from "../ui/textarea.js";
13
- import { MemberPickerCombobox as se } from "./OwnerMatrix.js";
14
- import { TeamScopeEditor as re } from "./TeamScopeEditor.js";
15
- import { TeamSuggestionsPanel as le } from "./TeamSuggestions.js";
16
- function O(t) {
9
+ import { cn as _, formatRelative as R } from "../../lib/utils.js";
10
+ import { Button as N } from "../ui/button.js";
11
+ import { Input as j } from "../ui/input.js";
12
+ import { QueryErrorState as se } from "../QueryErrorState.js";
13
+ import { Textarea as U } from "../ui/textarea.js";
14
+ import { MemberPickerCombobox as re } from "./OwnerMatrix.js";
15
+ import { TeamScopeEditor as le } from "./TeamScopeEditor.js";
16
+ import { TeamSuggestionsPanel as ne } from "./TeamSuggestions.js";
17
+ function W(t) {
17
18
  return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
18
19
  }
19
- function ne({
20
+ function ie({
20
21
  onCreated: t,
21
22
  onCancel: n
22
23
  }) {
23
- const r = K(), [l, o] = h(""), [c, u] = h(""), [b, p] = h(""), g = k({
24
+ const r = T(), [l, c] = b(""), [d, m] = b(""), [v, p] = b(""), f = w({
24
25
  mutationFn: () => r.request(
25
- M("/user-groups", {
26
+ B("/user-groups", {
26
27
  name: l.trim(),
27
- ...c.trim() ? { slug: c.trim() } : {},
28
- ...b.trim() ? { description: b.trim() } : {}
28
+ ...d.trim() ? { slug: d.trim() } : {},
29
+ ...v.trim() ? { description: v.trim() } : {}
29
30
  })
30
- ).then((d) => d.data),
31
- onSuccess: (d) => {
32
- w.success(`Created ${d.name}`), t(d.id);
31
+ ).then((i) => i.data),
32
+ onSuccess: (i) => {
33
+ C.success(`Created ${i.name}`), t(i.id);
33
34
  },
34
- onError: (d) => {
35
- var x;
36
- return w.error(((x = d == null ? void 0 : d.response) == null ? void 0 : x.error) ?? "Create failed");
35
+ onError: (i) => {
36
+ var h;
37
+ return C.error(((h = i == null ? void 0 : i.response) == null ? void 0 : h.error) ?? "Create failed");
37
38
  }
38
39
  });
39
40
  return /* @__PURE__ */ e("div", { className: "mx-auto max-w-xl p-5", children: /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
@@ -42,11 +43,11 @@ function ne({
42
43
  /* @__PURE__ */ a("div", { children: [
43
44
  /* @__PURE__ */ e("label", { className: "mb-1 block text-[11.5px] font-medium text-slate-500", htmlFor: "tv-name", children: "Name" }),
44
45
  /* @__PURE__ */ e(
45
- $,
46
+ j,
46
47
  {
47
48
  id: "tv-name",
48
49
  value: l,
49
- onChange: (d) => o(d.target.value),
50
+ onChange: (i) => c(i.target.value),
50
51
  placeholder: "Field Techs",
51
52
  className: "h-8 text-[13px]"
52
53
  }
@@ -59,11 +60,11 @@ function ne({
59
60
  /* @__PURE__ */ e("span", { className: "font-normal text-slate-400", children: "(mention handle — blank derives from the name)" })
60
61
  ] }),
61
62
  /* @__PURE__ */ e(
62
- $,
63
+ j,
63
64
  {
64
65
  id: "tv-slug",
65
- value: c,
66
- onChange: (d) => u(d.target.value),
66
+ value: d,
67
+ onChange: (i) => m(i.target.value),
67
68
  placeholder: "field-techs",
68
69
  className: "h-8 font-mono text-[12.5px]"
69
70
  }
@@ -72,11 +73,11 @@ function ne({
72
73
  /* @__PURE__ */ a("div", { children: [
73
74
  /* @__PURE__ */ e("label", { className: "mb-1 block text-[11.5px] font-medium text-slate-500", htmlFor: "tv-desc", children: "Description" }),
74
75
  /* @__PURE__ */ e(
75
- R,
76
+ U,
76
77
  {
77
78
  id: "tv-desc",
78
- value: b,
79
- onChange: (d) => p(d.target.value),
79
+ value: v,
80
+ onChange: (i) => p(i.target.value),
80
81
  rows: 2,
81
82
  className: "text-[13px]"
82
83
  }
@@ -84,30 +85,30 @@ function ne({
84
85
  ] }),
85
86
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2 pt-1", children: [
86
87
  /* @__PURE__ */ e(
87
- v,
88
+ N,
88
89
  {
89
90
  size: "sm",
90
91
  className: "text-[12px]",
91
- disabled: !l.trim() || g.isPending,
92
- onClick: () => g.mutate(),
92
+ disabled: !l.trim() || f.isPending,
93
+ onClick: () => f.mutate(),
93
94
  children: "Create team"
94
95
  }
95
96
  ),
96
- /* @__PURE__ */ e(v, { size: "sm", variant: "ghost", className: "text-[12px]", onClick: n, children: "Cancel" })
97
+ /* @__PURE__ */ e(N, { size: "sm", variant: "ghost", className: "text-[12px]", onClick: n, children: "Cancel" })
97
98
  ] })
98
99
  ] })
99
100
  ] }) });
100
101
  }
101
- function F({ children: t }) {
102
+ function D({ children: t }) {
102
103
  return /* @__PURE__ */ e("p", { className: "text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400 dark:text-slate-500", children: t });
103
104
  }
104
- function N({ label: t, value: n, tone: r }) {
105
+ function y({ label: t, value: n, tone: r }) {
105
106
  return /* @__PURE__ */ a("div", { className: "bg-white px-4 py-3 dark:bg-card", children: [
106
107
  /* @__PURE__ */ e("p", { className: "text-[10px] font-semibold uppercase tracking-[0.08em] text-slate-400 dark:text-slate-500", children: t }),
107
108
  /* @__PURE__ */ e(
108
109
  "p",
109
110
  {
110
- className: y(
111
+ className: _(
111
112
  "mt-0.5 text-[18px] font-semibold tabular-nums",
112
113
  r === "red" ? "text-red-600 dark:text-red-400" : r === "amber" ? "text-amber-600 dark:text-amber-400" : "text-slate-800 dark:text-foreground"
113
114
  ),
@@ -116,13 +117,13 @@ function N({ label: t, value: n, tone: r }) {
116
117
  )
117
118
  ] });
118
119
  }
119
- function ie({ weekly: t }) {
120
+ function de({ weekly: t }) {
120
121
  if (t.length < 2) return null;
121
- const n = 220, r = 36, l = Math.max(...t.map((c) => c.count), 1), o = t.map(
122
- (c, u) => `${(u / (t.length - 1) * (n - 4) + 2).toFixed(1)},${(r - 4 - c.count / l * (r - 8)).toFixed(1)}`
122
+ const n = 220, r = 36, l = Math.max(...t.map((d) => d.count), 1), c = t.map(
123
+ (d, m) => `${(m / (t.length - 1) * (n - 4) + 2).toFixed(1)},${(r - 4 - d.count / l * (r - 8)).toFixed(1)}`
123
124
  ).join(" ");
124
125
  return /* @__PURE__ */ a("svg", { width: n, height: r, viewBox: `0 0 ${n} ${r}`, className: "shrink-0", "aria-hidden": !0, children: [
125
- /* @__PURE__ */ e("polyline", { points: o, fill: "none", stroke: "#8b5cf6", strokeWidth: "1.5", strokeLinejoin: "round" }),
126
+ /* @__PURE__ */ e("polyline", { points: c, fill: "none", stroke: "#8b5cf6", strokeWidth: "1.5", strokeLinejoin: "round" }),
126
127
  t.length > 0 && /* @__PURE__ */ e(
127
128
  "circle",
128
129
  {
@@ -134,17 +135,17 @@ function ie({ weekly: t }) {
134
135
  )
135
136
  ] });
136
137
  }
137
- function de(t) {
138
+ function ce(t) {
138
139
  return t === "breached" ? /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-red-500", title: "SLA breached" }) : t === "warning" ? /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500", title: "SLA warning" }) : null;
139
140
  }
140
- function ce({ overview: t }) {
141
+ function oe({ overview: t }) {
141
142
  const n = t.cells.states;
142
143
  return n.length === 0 ? /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
143
- /* @__PURE__ */ e(F, { children: "Owns" }),
144
+ /* @__PURE__ */ e(D, { children: "Owns" }),
144
145
  /* @__PURE__ */ e("p", { className: "mt-2 text-[12.5px] italic text-slate-400", children: "Not linked to any owner-matrix cells yet — link this team from a pipeline's Owner Matrix." })
145
146
  ] }) : /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
146
147
  /* @__PURE__ */ a("div", { className: "flex items-baseline justify-between", children: [
147
- /* @__PURE__ */ e(F, { children: "Owns" }),
148
+ /* @__PURE__ */ e(D, { children: "Owns" }),
148
149
  /* @__PURE__ */ a("span", { className: "text-[11px] tabular-nums text-slate-400", children: [
149
150
  t.cells.total,
150
151
  " matrix cell",
@@ -162,30 +163,30 @@ function ce({ overview: t }) {
162
163
  r.count === 1 ? "" : "s"
163
164
  ] })
164
165
  ] }),
165
- /* @__PURE__ */ e("div", { className: "mt-1.5 space-y-1 pl-3.5", children: Object.entries(r.dims).map(([l, o]) => /* @__PURE__ */ a("div", { className: "flex flex-wrap items-baseline gap-1", children: [
166
+ /* @__PURE__ */ e("div", { className: "mt-1.5 space-y-1 pl-3.5", children: Object.entries(r.dims).map(([l, c]) => /* @__PURE__ */ a("div", { className: "flex flex-wrap items-baseline gap-1", children: [
166
167
  /* @__PURE__ */ e("span", { className: "mr-0.5 text-[10.5px] font-medium text-slate-400", children: l }),
167
- o.slice(0, 8).map((c) => /* @__PURE__ */ e(
168
+ c.slice(0, 8).map((d) => /* @__PURE__ */ e(
168
169
  "span",
169
170
  {
170
171
  className: "rounded bg-slate-100 px-1.5 py-px text-[10.5px] text-slate-600 dark:bg-muted dark:text-slate-300",
171
- children: c
172
+ children: d
172
173
  },
173
- c
174
+ d
174
175
  )),
175
- o.length > 8 && /* @__PURE__ */ a("span", { className: "text-[10.5px] text-slate-400", children: [
176
+ c.length > 8 && /* @__PURE__ */ a("span", { className: "text-[10.5px] text-slate-400", children: [
176
177
  "+",
177
- o.length - 8,
178
+ c.length - 8,
178
179
  " more"
179
180
  ] })
180
181
  ] }, l)) })
181
182
  ] }, `${r.template_name}:${r.state_label}`)) })
182
183
  ] });
183
184
  }
184
- function oe({ workload: t, loading: n }) {
185
+ function me({ workload: t, loading: n }) {
185
186
  const r = ee();
186
187
  return /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
187
188
  /* @__PURE__ */ a("div", { className: "flex items-baseline justify-between", children: [
188
- /* @__PURE__ */ e(F, { children: "Waiting on this team" }),
189
+ /* @__PURE__ */ e(D, { children: "Waiting on this team" }),
189
190
  n ? /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5 text-[11px] text-slate-400", children: [
190
191
  /* @__PURE__ */ e(J, { className: "h-3 w-3 animate-spin" }),
191
192
  " resolving live…"
@@ -222,10 +223,10 @@ function oe({ workload: t, loading: n }) {
222
223
  onClick: () => r.open({ collection: l.collection, itemId: l.item_id }),
223
224
  className: "flex w-full items-baseline gap-2 py-1.5 text-left hover:bg-muted",
224
225
  children: [
225
- de(l.sla_status),
226
+ ce(l.sla_status),
226
227
  /* @__PURE__ */ e("span", { className: "truncate text-[12.5px] font-medium text-nvr-navy underline decoration-nvr-cyan/50 decoration-[1.5px] underline-offset-2 dark:text-nvr-cyan", children: l.label }),
227
228
  /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: l.state_label }),
228
- l.started_at && /* @__PURE__ */ e("span", { className: "ml-auto shrink-0 text-[11px] tabular-nums text-slate-400", children: B(l.started_at) })
229
+ l.started_at && /* @__PURE__ */ e("span", { className: "ml-auto shrink-0 text-[11px] tabular-nums text-slate-400", children: R(l.started_at) })
229
230
  ]
230
231
  },
231
232
  `${l.collection}:${l.item_id}`
@@ -234,12 +235,12 @@ function oe({ workload: t, loading: n }) {
234
235
  ] })
235
236
  ] });
236
237
  }
237
- function me({ overview: t }) {
238
+ function ue({ overview: t }) {
238
239
  const n = t.throughput;
239
240
  return /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
240
241
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-3", children: [
241
242
  /* @__PURE__ */ a("div", { children: [
242
- /* @__PURE__ */ e(F, { children: "Activity" }),
243
+ /* @__PURE__ */ e(D, { children: "Activity" }),
243
244
  /* @__PURE__ */ a("p", { className: "mt-1 text-[12.5px] text-slate-600 dark:text-slate-300", children: [
244
245
  /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-800 dark:text-foreground", children: n.total_30d }),
245
246
  " ",
@@ -259,7 +260,7 @@ function me({ overview: t }) {
259
260
  ] })
260
261
  ] })
261
262
  ] }),
262
- /* @__PURE__ */ e(ie, { weekly: n.weekly })
263
+ /* @__PURE__ */ e(de, { weekly: n.weekly })
263
264
  ] }),
264
265
  /* @__PURE__ */ e("div", { className: "mt-3 divide-y divide-slate-100 dark:divide-border/60", children: [...t.roster].sort((r, l) => l.actions_30d - r.actions_30d).map((r) => /* @__PURE__ */ a("div", { className: "flex items-baseline gap-2 py-1.5", children: [
265
266
  /* @__PURE__ */ e("span", { className: "text-[12.5px] text-slate-700 dark:text-slate-200", children: [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email }),
@@ -269,85 +270,85 @@ function me({ overview: t }) {
269
270
  " action",
270
271
  r.actions_30d === 1 ? "" : "s"
271
272
  ] }),
272
- /* @__PURE__ */ e("span", { className: "w-24 shrink-0 text-right text-[11px] text-slate-400", children: r.last_action_at ? B(r.last_action_at) : "no actions" })
273
+ /* @__PURE__ */ e("span", { className: "w-24 shrink-0 text-right text-[11px] text-slate-400", children: r.last_action_at ? R(r.last_action_at) : "no actions" })
273
274
  ] }, r.id)) })
274
275
  ] });
275
276
  }
276
- function ue({
277
+ function pe({
277
278
  team: t,
278
279
  canManage: n,
279
280
  onChanged: r,
280
281
  onDeleted: l
281
282
  }) {
282
- const o = K(), c = W(), [u, b] = h(t.name), [p, g] = h(t.slug), [d, x] = h(t.description ?? ""), [j, f] = h(!1);
283
+ const c = T(), d = M(), [m, v] = b(t.name), [p, f] = b(t.slug), [i, h] = b(t.description ?? ""), [L, q] = b(!1);
283
284
  Z(() => {
284
- b(t.name), g(t.slug), x(t.description ?? "");
285
+ v(t.name), f(t.slug), h(t.description ?? "");
285
286
  }, [t.name, t.slug, t.description]);
286
- const { data: m } = q({
287
+ const { data: u } = $({
287
288
  queryKey: ["team-overview", t.id],
288
- queryFn: () => o.request(S(`/user-groups/${t.id}/overview`)).then((s) => s.data),
289
+ queryFn: () => c.request(F(`/user-groups/${t.id}/overview`)).then((s) => s.data),
289
290
  staleTime: 6e4
290
- }), { data: i, isLoading: D } = q({
291
+ }), { data: x, isLoading: k } = $({
291
292
  queryKey: ["team-workload", t.id],
292
- queryFn: () => o.request(S(`/user-groups/${t.id}/workload`)).then((s) => s.data),
293
+ queryFn: () => c.request(F(`/user-groups/${t.id}/workload`)).then((s) => s.data),
293
294
  staleTime: 6e4
294
295
  });
295
296
  ae(
296
297
  "team",
297
298
  () => {
298
- c.invalidateQueries({ queryKey: ["team-overview", t.id] }), c.invalidateQueries({ queryKey: ["team-workload", t.id] }), c.invalidateQueries({ queryKey: ["team-members", t.id] });
299
+ d.invalidateQueries({ queryKey: ["team-overview", t.id] }), d.invalidateQueries({ queryKey: ["team-workload", t.id] }), d.invalidateQueries({ queryKey: ["team-members", t.id] });
299
300
  },
300
301
  { debounceMs: 2e3 }
301
302
  );
302
- const { data: _ = [] } = q({
303
+ const { data: g = [] } = $({
303
304
  queryKey: ["team-members", t.id],
304
- queryFn: () => o.request(S(`/user-groups/${t.id}/members`)).then((s) => s.data)
305
- }), U = u.trim() !== t.name || p.trim() !== t.slug || d.trim() !== (t.description ?? ""), C = (s, L) => {
305
+ queryFn: () => c.request(F(`/user-groups/${t.id}/members`)).then((s) => s.data)
306
+ }), o = m.trim() !== t.name || p.trim() !== t.slug || i.trim() !== (t.description ?? ""), S = (s, K) => {
306
307
  var A;
307
- return w.error(((A = s == null ? void 0 : s.response) == null ? void 0 : A.error) ?? L);
308
- }, T = k({
309
- mutationFn: () => o.request(
308
+ return C.error(((A = s == null ? void 0 : s.response) == null ? void 0 : A.error) ?? K);
309
+ }, P = w({
310
+ mutationFn: () => c.request(
310
311
  te(`/user-groups/${t.id}`, {
311
- name: u.trim(),
312
+ name: m.trim(),
312
313
  slug: p.trim(),
313
- description: d.trim() || null
314
+ description: i.trim() || null
314
315
  })
315
316
  ),
316
317
  onSuccess: () => {
317
- w.success("Team updated"), r();
318
+ C.success("Team updated"), r();
318
319
  },
319
- onError: (s) => C(s, "Update failed")
320
- }), P = k({
321
- mutationFn: () => o.request(E(`/user-groups/${t.id}`)),
320
+ onError: (s) => S(s, "Update failed")
321
+ }), Q = w({
322
+ mutationFn: () => c.request(O(`/user-groups/${t.id}`)),
322
323
  onSuccess: () => {
323
- w.success(`Deleted ${t.name}`), l();
324
+ C.success(`Deleted ${t.name}`), l();
324
325
  },
325
- onError: (s) => C(s, "Delete failed")
326
- }), Q = () => {
327
- c.invalidateQueries({ queryKey: ["team-members", t.id] }), c.invalidateQueries({ queryKey: ["team-candidates"] }), r();
328
- }, z = k({
329
- mutationFn: (s) => o.request(M(`/user-groups/${t.id}/members`, { user_ids: [s] })),
330
- onSuccess: Q,
331
- onError: (s) => C(s, "Could not add member")
332
- }), I = k({
333
- mutationFn: (s) => o.request(E(`/user-groups/${t.id}/members/${s}`)),
334
- onSuccess: Q,
335
- onError: (s) => C(s, "Could not remove member")
326
+ onError: (s) => S(s, "Delete failed")
327
+ }), E = () => {
328
+ d.invalidateQueries({ queryKey: ["team-members", t.id] }), d.invalidateQueries({ queryKey: ["team-candidates"] }), r();
329
+ }, z = w({
330
+ mutationFn: (s) => c.request(B(`/user-groups/${t.id}/members`, { user_ids: [s] })),
331
+ onSuccess: E,
332
+ onError: (s) => S(s, "Could not add member")
333
+ }), I = w({
334
+ mutationFn: (s) => c.request(O(`/user-groups/${t.id}/members/${s}`)),
335
+ onSuccess: E,
336
+ onError: (s) => S(s, "Could not remove member")
336
337
  });
337
338
  return /* @__PURE__ */ a("div", { className: "space-y-4 p-5", children: [
338
339
  /* @__PURE__ */ a("div", { className: "grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-slate-200 bg-slate-200 sm:grid-cols-5 dark:border-border dark:bg-border", children: [
339
- /* @__PURE__ */ e(N, { label: "Members", value: m ? m.roster.length : "—" }),
340
- /* @__PURE__ */ e(N, { label: "Matrix cells", value: m ? m.cells.total : "—" }),
341
- /* @__PURE__ */ e(N, { label: "Waiting now", value: D ? "…" : (i == null ? void 0 : i.total) ?? "—" }),
340
+ /* @__PURE__ */ e(y, { label: "Members", value: u ? u.roster.length : "—" }),
341
+ /* @__PURE__ */ e(y, { label: "Matrix cells", value: u ? u.cells.total : "—" }),
342
+ /* @__PURE__ */ e(y, { label: "Waiting now", value: k ? "…" : (x == null ? void 0 : x.total) ?? "—" }),
342
343
  /* @__PURE__ */ e(
343
- N,
344
+ y,
344
345
  {
345
346
  label: "SLA breached",
346
- value: D ? "…" : (i == null ? void 0 : i.by_state.reduce((s, L) => s + L.sla_breached, 0)) ?? "—",
347
- tone: (i == null ? void 0 : i.by_state.some((s) => s.sla_breached > 0)) ?? !1 ? "red" : void 0
347
+ value: k ? "…" : (x == null ? void 0 : x.by_state.reduce((s, K) => s + K.sla_breached, 0)) ?? "—",
348
+ tone: (x == null ? void 0 : x.by_state.some((s) => s.sla_breached > 0)) ?? !1 ? "red" : void 0
348
349
  }
349
350
  ),
350
- /* @__PURE__ */ e(N, { label: "Actions · 30d", value: m ? m.throughput.total_30d : "—" })
351
+ /* @__PURE__ */ e(y, { label: "Actions · 30d", value: u ? u.throughput.total_30d : "—" })
351
352
  ] }),
352
353
  /* @__PURE__ */ a("div", { className: "grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_400px]", children: [
353
354
  /* @__PURE__ */ a("div", { className: "min-w-0 space-y-4", children: [
@@ -363,11 +364,11 @@ function ue({
363
364
  }
364
365
  ),
365
366
  /* @__PURE__ */ e(
366
- $,
367
+ j,
367
368
  {
368
369
  id: "tvd-name",
369
- value: u,
370
- onChange: (s) => b(s.target.value),
370
+ value: m,
371
+ onChange: (s) => v(s.target.value),
371
372
  className: "h-8 text-[13px]"
372
373
  }
373
374
  )
@@ -382,11 +383,11 @@ function ue({
382
383
  }
383
384
  ),
384
385
  /* @__PURE__ */ e(
385
- $,
386
+ j,
386
387
  {
387
388
  id: "tvd-slug",
388
389
  value: p,
389
- onChange: (s) => g(s.target.value),
390
+ onChange: (s) => f(s.target.value),
390
391
  className: "h-8 font-mono text-[12.5px]"
391
392
  }
392
393
  )
@@ -402,11 +403,11 @@ function ue({
402
403
  }
403
404
  ),
404
405
  /* @__PURE__ */ e(
405
- R,
406
+ U,
406
407
  {
407
408
  id: "tvd-desc",
408
- value: d,
409
- onChange: (s) => x(s.target.value),
409
+ value: i,
410
+ onChange: (s) => h(s.target.value),
410
411
  rows: 2,
411
412
  className: "text-[13px]"
412
413
  }
@@ -414,13 +415,13 @@ function ue({
414
415
  ] }),
415
416
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between pt-1", children: [
416
417
  /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
417
- U && /* @__PURE__ */ e(
418
- v,
418
+ o && /* @__PURE__ */ e(
419
+ N,
419
420
  {
420
421
  size: "sm",
421
422
  className: "text-[12px]",
422
- disabled: !u.trim() || !p.trim() || T.isPending,
423
- onClick: () => T.mutate(),
423
+ disabled: !m.trim() || !p.trim() || P.isPending,
424
+ onClick: () => P.mutate(),
424
425
  children: "Save changes"
425
426
  }
426
427
  ),
@@ -432,36 +433,36 @@ function ue({
432
433
  ] })
433
434
  ] })
434
435
  ] }),
435
- j ? /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
436
+ L ? /* @__PURE__ */ a("span", { className: "flex items-center gap-2", children: [
436
437
  /* @__PURE__ */ e("span", { className: "text-[11.5px] text-slate-500", children: "Delete this team?" }),
437
438
  /* @__PURE__ */ e(
438
- v,
439
+ N,
439
440
  {
440
441
  size: "sm",
441
442
  variant: "destructive",
442
443
  className: "h-6 text-[11px]",
443
- disabled: P.isPending,
444
- onClick: () => P.mutate(),
444
+ disabled: Q.isPending,
445
+ onClick: () => Q.mutate(),
445
446
  children: "Yes, delete"
446
447
  }
447
448
  ),
448
449
  /* @__PURE__ */ e(
449
- v,
450
+ N,
450
451
  {
451
452
  size: "sm",
452
453
  variant: "outline",
453
454
  className: "h-6 text-[11px]",
454
- onClick: () => f(!1),
455
+ onClick: () => q(!1),
455
456
  children: "Cancel"
456
457
  }
457
458
  )
458
459
  ] }) : /* @__PURE__ */ e(
459
- v,
460
+ N,
460
461
  {
461
462
  size: "sm",
462
463
  variant: "ghost",
463
464
  className: "text-[12px] text-slate-400 hover:text-red-500",
464
- onClick: () => f(!0),
465
+ onClick: () => q(!0),
465
466
  children: "Delete team"
466
467
  }
467
468
  )
@@ -477,12 +478,12 @@ function ue({
477
478
  ] }),
478
479
  t.description && /* @__PURE__ */ e("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: t.description })
479
480
  ] }) }),
480
- m && /* @__PURE__ */ e(ce, { overview: m }),
481
- /* @__PURE__ */ e(oe, { workload: i, loading: D })
481
+ u && /* @__PURE__ */ e(oe, { overview: u }),
482
+ /* @__PURE__ */ e(me, { workload: x, loading: k })
482
483
  ] }),
483
484
  /* @__PURE__ */ a("div", { className: "space-y-4", children: [
484
- m && m.roster.length > 0 && /* @__PURE__ */ e(me, { overview: m }),
485
- n && /* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: /* @__PURE__ */ e(re, { teamId: t.id, scopes: t.scopes ?? {}, onSaved: () => r() }) }),
485
+ u && u.roster.length > 0 && /* @__PURE__ */ e(ue, { overview: u }),
486
+ n && /* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: /* @__PURE__ */ e(le, { teamId: t.id, scopes: t.scopes ?? {}, onSaved: () => r() }) }),
486
487
  /* @__PURE__ */ a("div", { className: "rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
487
488
  /* @__PURE__ */ a("div", { className: "flex items-center justify-between gap-3", children: [
488
489
  /* @__PURE__ */ a("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-foreground", children: [
@@ -490,27 +491,27 @@ function ue({
490
491
  " ",
491
492
  /* @__PURE__ */ a("span", { className: "font-normal tabular-nums text-slate-400", children: [
492
493
  "(",
493
- _.length,
494
+ g.length,
494
495
  ")"
495
496
  ] })
496
497
  ] }),
497
498
  n && /* @__PURE__ */ e("div", { className: "w-56", children: /* @__PURE__ */ e(
498
- se,
499
+ re,
499
500
  {
500
501
  teamId: t.id,
501
- excludeIds: _.map((s) => s.id),
502
+ excludeIds: g.map((s) => s.id),
502
503
  isPending: z.isPending,
503
504
  onPick: (s) => z.mutate(s)
504
505
  }
505
506
  ) })
506
507
  ] }),
507
- /* @__PURE__ */ e("div", { className: "mt-3", children: _.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12.5px] text-slate-400", children: "No members yet." }) : _.map((s) => /* @__PURE__ */ a(
508
+ /* @__PURE__ */ e("div", { className: "mt-3", children: g.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12.5px] text-slate-400", children: "No members yet." }) : g.map((s) => /* @__PURE__ */ a(
508
509
  "div",
509
510
  {
510
511
  className: "flex items-center gap-3 border-b border-slate-100 py-2 last:border-0 dark:border-border/60",
511
512
  children: [
512
513
  /* @__PURE__ */ a("div", { className: "min-w-0 flex-1", children: [
513
- /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: O(s) }),
514
+ /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium text-slate-700 dark:text-slate-200", children: W(s) }),
514
515
  /* @__PURE__ */ e("p", { className: "truncate text-[11px] text-slate-400", children: s.email })
515
516
  ] }),
516
517
  n && /* @__PURE__ */ e(
@@ -520,7 +521,7 @@ function ue({
520
521
  disabled: I.isPending,
521
522
  onClick: () => I.mutate(s.id),
522
523
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-950/30",
523
- "aria-label": `Remove ${O(s)}`,
524
+ "aria-label": `Remove ${W(s)}`,
524
525
  children: /* @__PURE__ */ e(G, { className: "h-3.5 w-3.5" })
525
526
  }
526
527
  )
@@ -533,35 +534,41 @@ function ue({
533
534
  ] })
534
535
  ] });
535
536
  }
536
- function $e({
537
+ function je({
537
538
  canManage: t = !0,
538
539
  compact: n = !1,
539
540
  initialTeamId: r = null
540
541
  }) {
541
- const l = K(), o = W(), [c, u] = h(r), [b, p] = h(!1), [g, d] = h(!1), { data: x = [], isLoading: j } = q({
542
+ const l = T(), c = M(), [d, m] = b(r), [v, p] = b(!1), [f, i] = b(!1), {
543
+ data: h = [],
544
+ isLoading: L,
545
+ isError: q,
546
+ error: u,
547
+ refetch: x
548
+ } = $({
542
549
  queryKey: ["user-groups"],
543
- queryFn: () => l.request(S("/user-groups")).then((i) => i.data)
544
- }), f = x.find((i) => i.id === c) ?? null, m = () => {
545
- o.invalidateQueries({ queryKey: ["user-groups"] }), o.invalidateQueries({ queryKey: ["user-groups-teams"] });
550
+ queryFn: () => l.request(F("/user-groups")).then((o) => o.data)
551
+ }), k = h.find((o) => o.id === d) ?? null, g = () => {
552
+ c.invalidateQueries({ queryKey: ["user-groups"] }), c.invalidateQueries({ queryKey: ["user-groups-teams"] });
546
553
  };
547
554
  return /* @__PURE__ */ a("div", { className: "flex h-full min-h-0 flex-1 overflow-hidden", children: [
548
555
  /* @__PURE__ */ a(
549
556
  "aside",
550
557
  {
551
- className: y(
558
+ className: _(
552
559
  "flex shrink-0 flex-col overflow-hidden border-r border-slate-200 bg-white dark:border-border dark:bg-card",
553
560
  n ? "w-[200px]" : "w-[272px]"
554
561
  ),
555
562
  children: [
556
563
  t && /* @__PURE__ */ a("div", { className: "shrink-0 border-b border-slate-100 p-2 dark:border-border/60", children: [
557
564
  /* @__PURE__ */ a(
558
- v,
565
+ N,
559
566
  {
560
567
  size: "sm",
561
568
  variant: "outline",
562
569
  className: "h-7 w-full gap-1.5 text-[12px]",
563
570
  onClick: () => {
564
- p(!0), d(!1), u(null);
571
+ p(!0), i(!1), m(null);
565
572
  },
566
573
  children: [
567
574
  /* @__PURE__ */ e(V, { className: "h-3.5 w-3.5" }),
@@ -570,16 +577,16 @@ function $e({
570
577
  }
571
578
  ),
572
579
  /* @__PURE__ */ a(
573
- v,
580
+ N,
574
581
  {
575
582
  size: "sm",
576
583
  variant: "ghost",
577
- className: y(
584
+ className: _(
578
585
  "mt-1 h-7 w-full gap-1.5 text-[12px]",
579
- g && "bg-accent text-accent-foreground"
586
+ f && "bg-accent text-accent-foreground"
580
587
  ),
581
588
  onClick: () => {
582
- d(!0), p(!1), u(null);
589
+ i(!0), p(!1), m(null);
583
590
  },
584
591
  "data-team-suggestions-open": !0,
585
592
  children: [
@@ -589,75 +596,83 @@ function $e({
589
596
  }
590
597
  )
591
598
  ] }),
592
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: j ? /* @__PURE__ */ e("p", { className: "p-4 text-[12.5px] text-slate-400", children: "Loading…" }) : x.length === 0 ? /* @__PURE__ */ e("p", { className: "p-4 text-[12.5px] text-slate-400", children: "No teams yet." }) : x.map((i) => /* @__PURE__ */ a(
599
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto", children: L ? /* @__PURE__ */ e("p", { className: "p-4 text-[12.5px] text-slate-400", children: "Loading…" }) : q && h.length === 0 ? /* @__PURE__ */ e(
600
+ se,
601
+ {
602
+ error: u,
603
+ what: "teams",
604
+ onRetry: () => void x(),
605
+ className: "min-h-0 p-4"
606
+ }
607
+ ) : h.length === 0 ? /* @__PURE__ */ e("p", { className: "p-4 text-[12.5px] text-slate-400", children: "No teams yet." }) : h.map((o) => /* @__PURE__ */ a(
593
608
  "button",
594
609
  {
595
610
  type: "button",
596
611
  onClick: () => {
597
- u(i.id), p(!1), d(!1);
612
+ m(o.id), p(!1), i(!1);
598
613
  },
599
- className: y(
614
+ className: _(
600
615
  "block w-full border-b border-slate-100 px-4 py-2.5 text-left dark:border-border/60",
601
- c === i.id ? "bg-nvr-cyan/10" : "hover:bg-slate-50 dark:hover:bg-muted/40"
616
+ d === o.id ? "bg-nvr-cyan/10" : "hover:bg-slate-50 dark:hover:bg-muted/40"
602
617
  ),
603
618
  children: [
604
- /* @__PURE__ */ e("p", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-foreground", children: i.name }),
619
+ /* @__PURE__ */ e("p", { className: "truncate text-[13px] font-medium text-slate-800 dark:text-foreground", children: o.name }),
605
620
  /* @__PURE__ */ a(
606
621
  "p",
607
622
  {
608
- className: y(
623
+ className: _(
609
624
  "truncate text-[11px]",
610
- c === i.id ? "text-nvr-navy/70 dark:text-nvr-cyan/80" : "text-slate-400"
625
+ d === o.id ? "text-nvr-navy/70 dark:text-nvr-cyan/80" : "text-slate-400"
611
626
  ),
612
627
  children: [
613
628
  "@",
614
- i.slug,
629
+ o.slug,
615
630
  " · ",
616
- i.member_count,
631
+ o.member_count,
617
632
  " member",
618
- i.member_count === 1 ? "" : "s"
633
+ o.member_count === 1 ? "" : "s"
619
634
  ]
620
635
  }
621
636
  )
622
637
  ]
623
638
  },
624
- i.id
639
+ o.id
625
640
  )) })
626
641
  ]
627
642
  }
628
643
  ),
629
- /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto bg-slate-50 dark:bg-background", children: g && t ? /* @__PURE__ */ e(
630
- le,
644
+ /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-y-auto bg-slate-50 dark:bg-background", children: f && t ? /* @__PURE__ */ e(
645
+ ne,
631
646
  {
632
- onApplied: (i) => {
633
- d(!1), u(i), m();
647
+ onApplied: (o) => {
648
+ i(!1), m(o), g();
634
649
  }
635
650
  }
636
- ) : b && t ? /* @__PURE__ */ e(
637
- ne,
651
+ ) : v && t ? /* @__PURE__ */ e(
652
+ ie,
638
653
  {
639
- onCreated: (i) => {
640
- p(!1), u(i), m();
654
+ onCreated: (o) => {
655
+ p(!1), m(o), g();
641
656
  },
642
657
  onCancel: () => p(!1)
643
658
  }
644
- ) : f ? /* @__PURE__ */ e(
645
- ue,
659
+ ) : k ? /* @__PURE__ */ e(
660
+ pe,
646
661
  {
647
- team: f,
662
+ team: k,
648
663
  canManage: t,
649
- onChanged: m,
664
+ onChanged: g,
650
665
  onDeleted: () => {
651
- u(null), m();
666
+ m(null), g();
652
667
  }
653
668
  },
654
- f.id
669
+ k.id
655
670
  ) : /* @__PURE__ */ a("div", { className: "pt-24 text-center text-slate-400", children: [
656
671
  /* @__PURE__ */ e(Y, { className: "mx-auto h-8 w-8 opacity-40" }),
657
- /* @__PURE__ */ e("p", { className: "mt-3 text-[13px]", children: x.length === 0 ? t ? "Create your first team to get started." : "No teams have been created yet." : "Select a team to view its members and scope." })
672
+ /* @__PURE__ */ e("p", { className: "mt-3 text-[13px]", children: h.length === 0 ? t ? "Create your first team to get started." : "No teams have been created yet." : "Select a team to view its members and scope." })
658
673
  ] }) })
659
674
  ] });
660
675
  }
661
676
  export {
662
- $e as TeamsView
677
+ je as TeamsView
663
678
  };