@nivaro/react 0.3.44 → 0.3.45

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 (33) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +38 -5
  4. package/dist/shared/components/CollectionBrowserView.js +1390 -1358
  5. package/dist/shared/components/DataTable.js +356 -334
  6. package/dist/shared/components/ProfileView.js +16 -21
  7. package/dist/shared/components/command-center/CommandCenterView.js +90 -355
  8. package/dist/shared/components/command-center/Header.js +70 -0
  9. package/dist/shared/components/command-center/PeekPanel.js +6 -0
  10. package/dist/shared/components/command-center/api.js +26 -0
  11. package/dist/shared/components/command-center/panels/AttentionPanel.js +6 -0
  12. package/dist/shared/components/command-center/panels/FeedPanel.js +33 -0
  13. package/dist/shared/components/command-center/panels/FlowPanel.js +61 -0
  14. package/dist/shared/components/command-center/panels/ForecastPanel.js +6 -0
  15. package/dist/shared/components/command-center/panels/MapPanel.js +74 -0
  16. package/dist/shared/components/command-center/panels/PartnersPanel.js +6 -0
  17. package/dist/shared/components/command-center/panels/PeoplePanel.js +47 -0
  18. package/dist/shared/components/command-center/panels/RegionPicker.js +6 -0
  19. package/dist/shared/components/command-center/panels/SystemPanel.js +53 -0
  20. package/dist/shared/components/command-center/panels/ThroughputPanel.js +6 -0
  21. package/dist/shared/components/command-center/panels/TimeBar.js +10 -0
  22. package/dist/shared/components/command-center/panels/TrafficPanel.js +11 -0
  23. package/dist/shared/components/command-center/panels/WorkloadPanel.js +6 -0
  24. package/dist/shared/components/command-center/panels/registry.js +28 -0
  25. package/dist/shared/components/command-center/state.js +12 -0
  26. package/dist/shared/components/command-center/theme.js +66 -0
  27. package/dist/shared/components/imports/ImportConsole.js +48 -47
  28. package/dist/shared/components/notifications/TestMyRules.js +39 -38
  29. package/dist/shared/components/profile/TeamsConnect.js +2 -2
  30. package/dist/shared/components/queue/QueueQuickFilters.js +81 -63
  31. package/dist/shared/components/queue/QueueWorklist.js +598 -586
  32. package/dist/shared/lib/quick-filter-cascade.js +29 -0
  33. package/package.json +1 -1
@@ -0,0 +1,61 @@
1
+ import { jsxs as l, jsx as a } from "react/jsx-runtime";
2
+ import { useCc as m } from "../state.js";
3
+ import { PANEL as d, PANEL_HEAD as p, TITLE as u, FAINT as s } from "../theme.js";
4
+ function b() {
5
+ const { snapshot: c, navigate: i } = m(), n = (c == null ? void 0 : c.flow) ?? [];
6
+ return /* @__PURE__ */ l("section", { className: d, "data-cc-panel": "flow", children: [
7
+ /* @__PURE__ */ a("div", { className: p, children: /* @__PURE__ */ a("h2", { className: u, children: "Pipeline flow" }) }),
8
+ /* @__PURE__ */ l("div", { className: "space-y-3 p-3", children: [
9
+ n.map((t) => {
10
+ const o = t.states.reduce((e, r) => e + r.count, 0);
11
+ return /* @__PURE__ */ l("div", { children: [
12
+ /* @__PURE__ */ l("div", { className: "mb-1 flex items-baseline justify-between", children: [
13
+ /* @__PURE__ */ a("span", { className: "text-[12px] font-medium text-[var(--cc-text)]", children: t.template_name }),
14
+ /* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${s}`, children: [
15
+ o,
16
+ " open"
17
+ ] })
18
+ ] }),
19
+ /* @__PURE__ */ a("div", { className: "flex h-2.5 overflow-hidden rounded-full bg-[var(--cc-chip)]", children: t.states.map((e) => /* @__PURE__ */ a(
20
+ "button",
21
+ {
22
+ type: "button",
23
+ onClick: () => i(`/collections/${t.collection}`),
24
+ className: "h-full transition-opacity hover:opacity-75",
25
+ style: {
26
+ width: `${Math.max(2, e.count / Math.max(1, o) * 100)}%`,
27
+ background: e.color ?? "#00a5cc"
28
+ },
29
+ "aria-label": `${e.label}: ${e.count}`,
30
+ "data-tip": `${e.label}: ${e.count}`
31
+ },
32
+ e.key
33
+ )) }),
34
+ /* @__PURE__ */ a("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-0.5", children: t.states.map((e) => /* @__PURE__ */ l(
35
+ "span",
36
+ {
37
+ className: "flex items-center gap-1 text-[11px] text-[var(--cc-muted)]",
38
+ children: [
39
+ /* @__PURE__ */ a(
40
+ "span",
41
+ {
42
+ className: "h-1.5 w-1.5 rounded-full",
43
+ style: { background: e.color ?? "#00a5cc" }
44
+ }
45
+ ),
46
+ e.label,
47
+ " ",
48
+ /* @__PURE__ */ a("b", { className: "tabular-nums text-[var(--cc-text)]", children: e.count })
49
+ ]
50
+ },
51
+ e.key
52
+ )) })
53
+ ] }, t.collection);
54
+ }),
55
+ n.length === 0 && /* @__PURE__ */ a("p", { className: `text-[12px] ${s}`, children: "No workflow-bound collections visible to you." })
56
+ ] })
57
+ ] });
58
+ }
59
+ export {
60
+ b as FlowPanel
61
+ };
@@ -0,0 +1,6 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ export {
5
+ n as ForecastPanel
6
+ };
@@ -0,0 +1,74 @@
1
+ import { jsxs as f, jsx as o } from "react/jsx-runtime";
2
+ import { useMemo as u } from "react";
3
+ import { titleCase as y } from "../../../lib/utils.js";
4
+ import { BaseMap as k } from "../../BaseMap.js";
5
+ import { useCcQuery as b } from "../api.js";
6
+ import { useCc as N } from "../state.js";
7
+ import { PANEL as w, PANEL_HEAD as C, TITLE as L } from "../theme.js";
8
+ function T() {
9
+ var g;
10
+ const s = N(), { snapshot: n, config: c, mapCollection: $ } = s, m = (c == null ? void 0 : c.geo_collections) ?? [], l = $ ?? ((g = m[0]) == null ? void 0 : g.key) ?? null, i = !!l, { data: a } = b(
11
+ "/geo",
12
+ { collection: l },
13
+ { enabled: !!l, refetchInterval: 6e4 }
14
+ ), { data: d = [] } = b("/people-geo", void 0, { staleTime: 10 * 6e4, lenses: !1 }), p = u(
15
+ () => (i ? a ?? [] : []).map((e) => ({
16
+ id: e.id,
17
+ lat: e.lat,
18
+ lng: e.lng,
19
+ label: `${e.label}${e.state ? ` — ${e.state}` : ""}${e.sla === "breached" ? " · SLA breached" : e.sla === "warning" ? " · SLA warning" : ""}`,
20
+ color: e.sla === "breached" ? "#ef4444" : e.sla === "warning" ? "#f59e0b" : e.state_color ?? "#00a5cc",
21
+ pulse: e.sla === "breached"
22
+ })),
23
+ [a, i]
24
+ ), r = u(() => {
25
+ const e = ((n == null ? void 0 : n.people.offices) ?? []).map((t, v) => ({
26
+ id: `office-${v}`,
27
+ lat: t.lat,
28
+ lng: t.lng,
29
+ count: t.count,
30
+ label: `${t.label}${t.names.length ? ` — ${t.names.slice(0, 5).join(", ")}${t.names.length > 5 ? ` +${t.names.length - 5}` : ""}` : ""}`,
31
+ color: "#10b981"
32
+ })), h = new Map(
33
+ ((n == null ? void 0 : n.people.by_region) ?? []).map((t) => [String(t.region_id), t.count])
34
+ ), x = d.filter((t) => (h.get(String(t.id)) ?? 0) > 0).map((t) => ({
35
+ id: String(t.id),
36
+ lat: t.lat,
37
+ lng: t.lng,
38
+ count: h.get(String(t.id)) ?? 0,
39
+ label: t.label,
40
+ color: "#10b981"
41
+ }));
42
+ return [...e, ...x];
43
+ }, [d, n]);
44
+ return /* @__PURE__ */ f("div", { className: `${w} flex min-h-[420px] flex-col overflow-hidden`, "data-cc-panel": "map", children: [
45
+ /* @__PURE__ */ f("div", { className: C, children: [
46
+ /* @__PURE__ */ o("h2", { className: L, children: "Live map" }),
47
+ /* @__PURE__ */ o("div", { className: "flex items-center gap-2", children: m.map((e) => /* @__PURE__ */ o(
48
+ "button",
49
+ {
50
+ type: "button",
51
+ "aria-pressed": l === e.key,
52
+ onClick: () => s.setMapCollection(e.key),
53
+ className: `rounded px-2 py-0.5 text-[11px] ${l === e.key ? "bg-nvr-cyan font-medium text-[#172940]" : "text-[var(--cc-muted)] hover:bg-[var(--cc-chip)]"}`,
54
+ children: e.label || y(e.key.replace(/_/g, " "))
55
+ },
56
+ e.key
57
+ )) })
58
+ ] }),
59
+ /* @__PURE__ */ o("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ o(
60
+ k,
61
+ {
62
+ pins: p,
63
+ bubbles: r,
64
+ focus: s.mapFocus,
65
+ onPinClick: (e) => l && s.setPeek({ collection: l, id: e }),
66
+ statusLine: `${i ? `${p.length} ${(l ?? "").replace(/_/g, " ")}${a != null && a.truncated ? " (first 500)" : ""}` : "No map collection"}${r.length > 0 ? ` · ${r.length} groups with people on` : ""} · © OpenStreetMap`,
67
+ minHeight: 380
68
+ }
69
+ ) })
70
+ ] });
71
+ }
72
+ export {
73
+ T as MapPanel
74
+ };
@@ -0,0 +1,6 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ export {
5
+ n as PartnersPanel
6
+ };
@@ -0,0 +1,47 @@
1
+ import { jsxs as o, jsx as l } from "react/jsx-runtime";
2
+ import { useCcQuery as d } from "../api.js";
3
+ import { useCc as u } from "../state.js";
4
+ import { PANEL as m, PANEL_HEAD as h, TITLE as x, FAINT as c } from "../theme.js";
5
+ function v() {
6
+ const r = u(), n = r.snapshot, { data: i = [] } = d("/people-geo", void 0, { staleTime: 10 * 6e4, lenses: !1 }), p = (n == null ? void 0 : n.people.regions) ?? [];
7
+ return /* @__PURE__ */ o("section", { className: m, "data-cc-panel": "people", children: [
8
+ /* @__PURE__ */ o("div", { className: h, children: [
9
+ /* @__PURE__ */ l("h2", { className: x, children: "People on now" }),
10
+ /* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${c}`, children: (n == null ? void 0 : n.people.online_count) ?? 0 })
11
+ ] }),
12
+ /* @__PURE__ */ o("div", { className: "space-y-2.5 p-3", children: [
13
+ p.map((e) => {
14
+ const s = e.region_id != null ? i.find((a) => String(a.id) === String(e.region_id)) : null, t = e.lat != null && e.lng != null ? { lat: e.lat, lng: e.lng, zoom: 12 } : s ? { lat: s.lat, lng: s.lng, zoom: 8 } : null;
15
+ return /* @__PURE__ */ o("div", { children: [
16
+ /* @__PURE__ */ o(
17
+ "button",
18
+ {
19
+ type: "button",
20
+ disabled: !t,
21
+ onClick: () => t && r.focusMap(t),
22
+ className: `flex w-full items-center gap-1.5 text-left ${t ? "group cursor-pointer" : "cursor-default"}`,
23
+ "data-tip": t ? "Show this group on the map" : "No map placement for this group",
24
+ children: [
25
+ /* @__PURE__ */ l("span", { className: "h-2.5 w-2.5 rounded-full bg-[var(--cc-people)]" }),
26
+ /* @__PURE__ */ l("span", { className: "text-[12px] font-semibold text-[var(--cc-people-text)] group-hover:underline", children: e.label }),
27
+ /* @__PURE__ */ l("span", { className: `text-[11px] tabular-nums ${c}`, children: e.count })
28
+ ]
29
+ }
30
+ ),
31
+ /* @__PURE__ */ l("div", { className: "mt-1 flex flex-wrap gap-1.5 pl-4", children: e.names.map((a) => /* @__PURE__ */ l(
32
+ "span",
33
+ {
34
+ className: "rounded-full bg-[var(--cc-chip)] px-2 py-0.5 text-[11.5px] text-[var(--cc-text)]",
35
+ children: a
36
+ },
37
+ a
38
+ )) })
39
+ ] }, `${e.region_id ?? "x"}:${e.label}`);
40
+ }),
41
+ p.length === 0 && /* @__PURE__ */ l("p", { className: `text-[12px] ${c}`, children: "Nobody online right now." })
42
+ ] })
43
+ ] });
44
+ }
45
+ export {
46
+ v as PeoplePanel
47
+ };
@@ -0,0 +1,6 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ export {
5
+ n as RegionPicker
6
+ };
@@ -0,0 +1,53 @@
1
+ import { jsxs as e, jsx as a } from "react/jsx-runtime";
2
+ import { useCc as c } from "../state.js";
3
+ import { PANEL as i, PANEL_HEAD as d, TITLE as m, FAINT as l } from "../theme.js";
4
+ function u() {
5
+ const { snapshot: n } = c(), s = n == null ? void 0 : n.health;
6
+ if (!s) return null;
7
+ const r = (t) => `h-2 w-2 rounded-full ${t ? "bg-emerald-500" : "bg-red-500"}`;
8
+ return /* @__PURE__ */ e("section", { className: i, "data-cc-panel": "system", children: [
9
+ /* @__PURE__ */ e("div", { className: d, children: [
10
+ /* @__PURE__ */ a("h2", { className: m, children: "System" }),
11
+ /* @__PURE__ */ e("span", { className: `text-[11px] ${l}`, children: [
12
+ s.instances,
13
+ " instance(s)"
14
+ ] })
15
+ ] }),
16
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-x-4 gap-y-1.5 p-3 text-[12px] text-[var(--cc-text)]", children: [
17
+ /* @__PURE__ */ e("span", { className: "flex items-center gap-1.5", children: [
18
+ /* @__PURE__ */ a("span", { className: r(s.db_ok) }),
19
+ "Database"
20
+ ] }),
21
+ /* @__PURE__ */ e("span", { className: "flex items-center gap-1.5", children: [
22
+ /* @__PURE__ */ a("span", { className: r(s.redis_ok) }),
23
+ "Redis"
24
+ ] }),
25
+ /* @__PURE__ */ e("span", { children: [
26
+ "Errors 1h: ",
27
+ /* @__PURE__ */ a("b", { className: "tabular-nums", children: s.errors_1h }),
28
+ /* @__PURE__ */ e("span", { className: l, children: [
29
+ " / ",
30
+ s.requests_1h.toLocaleString(),
31
+ " req"
32
+ ] })
33
+ ] }),
34
+ /* @__PURE__ */ e("span", { children: [
35
+ "Jobs: ",
36
+ /* @__PURE__ */ a("b", { className: "tabular-nums", children: s.jobs_running }),
37
+ " running",
38
+ s.jobs_failed_1h > 0 && /* @__PURE__ */ e("b", { className: "tabular-nums text-[var(--cc-warn-text)]", children: [
39
+ " · ",
40
+ s.jobs_failed_1h,
41
+ " failed"
42
+ ] })
43
+ ] })
44
+ ] })
45
+ ] });
46
+ }
47
+ function N() {
48
+ return null;
49
+ }
50
+ export {
51
+ u as SystemPanel,
52
+ N as SystemPill
53
+ };
@@ -0,0 +1,6 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ export {
5
+ n as ThroughputPanel
6
+ };
@@ -0,0 +1,10 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ function r() {
5
+ return null;
6
+ }
7
+ export {
8
+ r as BriefButton,
9
+ n as TimeBar
10
+ };
@@ -0,0 +1,11 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { TrafficMiniMap as i } from "../../monitoring/TrafficMiniMap.js";
3
+ import { useCc as n } from "../state.js";
4
+ import { useAppIsDark as a } from "../theme.js";
5
+ function c() {
6
+ const { snapshot: r, tv: o } = n(), t = a();
7
+ return r != null && r.health ? /* @__PURE__ */ f(i, { tone: t || o ? "dark" : "auto" }) : null;
8
+ }
9
+ export {
10
+ c as TrafficPanel
11
+ };
@@ -0,0 +1,6 @@
1
+ function n() {
2
+ return null;
3
+ }
4
+ export {
5
+ n as WorkloadPanel
6
+ };
@@ -0,0 +1,28 @@
1
+ import { AttentionPanel as a } from "./AttentionPanel.js";
2
+ import { FeedPanel as o } from "./FeedPanel.js";
3
+ import { FlowPanel as r } from "./FlowPanel.js";
4
+ import { ForecastPanel as l } from "./ForecastPanel.js";
5
+ import { MapPanel as t } from "./MapPanel.js";
6
+ import { PartnersPanel as n } from "./PartnersPanel.js";
7
+ import { PeoplePanel as m } from "./PeoplePanel.js";
8
+ import { SystemPanel as p } from "./SystemPanel.js";
9
+ import { ThroughputPanel as i } from "./ThroughputPanel.js";
10
+ import { TrafficPanel as f } from "./TrafficPanel.js";
11
+ import { WorkloadPanel as y } from "./WorkloadPanel.js";
12
+ const c = [
13
+ { key: "map", label: "Live map", area: "main", component: t },
14
+ { key: "attention", label: "Needs attention", area: "rail", component: a },
15
+ { key: "flow", label: "Pipeline flow", area: "rail", component: r },
16
+ { key: "throughput", label: "Throughput today", area: "rail", component: i },
17
+ { key: "forecast", label: "Today’s forecast", area: "rail", component: l },
18
+ { key: "workload", label: "Workload", area: "rail", component: y },
19
+ { key: "people", label: "People on now", area: "rail", component: m },
20
+ { key: "partners", label: "Partners", area: "rail", component: n },
21
+ { key: "traffic", label: "Traffic", area: "rail", adminOnly: !0, component: f },
22
+ { key: "system", label: "System", area: "rail", adminOnly: !0, component: p },
23
+ { key: "feed", label: "Live feed", area: "bottom", component: o }
24
+ ];
25
+ c.map((e) => e.key);
26
+ export {
27
+ c as CC_PANELS
28
+ };
@@ -0,0 +1,12 @@
1
+ import { createContext as e, useContext as n } from "react";
2
+ const s = { states: [], sla: [], owner: null }, o = e(null);
3
+ function c() {
4
+ const t = n(o);
5
+ if (!t) throw new Error("useCc outside the Command Center");
6
+ return t;
7
+ }
8
+ export {
9
+ o as CcContext,
10
+ s as EMPTY_FILTERS,
11
+ c as useCc
12
+ };
@@ -0,0 +1,66 @@
1
+ import { useState as o, useEffect as n } from "react";
2
+ const a = {
3
+ light: {
4
+ "--cc-bg": "#f6f8fa",
5
+ "--cc-panel": "#ffffff",
6
+ "--cc-raised": "#f1f5f9",
7
+ "--cc-border": "#e2e8f0",
8
+ "--cc-text": "#0f172a",
9
+ "--cc-strong": "#020617",
10
+ "--cc-muted": "#475569",
11
+ "--cc-faint": "#64748b",
12
+ "--cc-chip": "rgba(15, 23, 42, 0.05)",
13
+ "--cc-chip-hover": "rgba(15, 23, 42, 0.09)",
14
+ "--cc-people": "#059669",
15
+ "--cc-people-text": "#047857",
16
+ "--cc-warn-text": "#b45309",
17
+ "--cc-bad-text": "#b91c1c",
18
+ "--cc-good-text": "#047857",
19
+ "--cc-map-tint": "0"
20
+ },
21
+ dark: {
22
+ "--cc-bg": "#0b1220",
23
+ "--cc-panel": "#101828",
24
+ "--cc-raised": "#162033",
25
+ "--cc-border": "rgba(255, 255, 255, 0.1)",
26
+ "--cc-text": "#e2e8f0",
27
+ "--cc-strong": "#ffffff",
28
+ "--cc-muted": "#94a3b8",
29
+ "--cc-faint": "#8291a8",
30
+ "--cc-chip": "rgba(255, 255, 255, 0.05)",
31
+ "--cc-chip-hover": "rgba(255, 255, 255, 0.1)",
32
+ "--cc-people": "#34d399",
33
+ "--cc-people-text": "#6ee7b7",
34
+ "--cc-warn-text": "#fbbf24",
35
+ "--cc-bad-text": "#f87171",
36
+ "--cc-good-text": "#34d399",
37
+ "--cc-map-tint": "1"
38
+ }
39
+ };
40
+ function d(e) {
41
+ return a[e];
42
+ }
43
+ const r = () => typeof document < "u" && document.documentElement.classList.contains("dark");
44
+ function b() {
45
+ const [e, c] = o(r);
46
+ return n(() => {
47
+ if (typeof MutationObserver > "u") return;
48
+ const t = new MutationObserver(() => c(r()));
49
+ return t.observe(document.documentElement, { attributes: !0, attributeFilter: ["class"] }), () => t.disconnect();
50
+ }, []), e;
51
+ }
52
+ const s = "rounded-lg border border-[var(--cc-border)] bg-[var(--cc-panel)]", i = "flex items-center justify-between gap-2 border-b border-[var(--cc-border)] px-3 py-2", p = "text-[12.5px] font-semibold text-[var(--cc-strong)]", u = "text-[var(--cc-faint)]", x = "rounded-md border border-[var(--cc-border)] px-2.5 py-1 text-[11.5px] text-[var(--cc-text)] hover:bg-[var(--cc-chip)] disabled:opacity-50";
53
+ function l(e) {
54
+ const c = Math.max(0, Math.floor((Date.now() - new Date(e).getTime()) / 1e3));
55
+ return c < 60 ? `${c}s` : c < 3600 ? `${Math.floor(c / 60)}m` : c < 86400 ? `${Math.floor(c / 3600)}h` : `${Math.floor(c / 86400)}d`;
56
+ }
57
+ export {
58
+ x as BUTTON,
59
+ u as FAINT,
60
+ s as PANEL,
61
+ i as PANEL_HEAD,
62
+ p as TITLE,
63
+ d as ccVars,
64
+ l as rel,
65
+ b as useAppIsDark
66
+ };