@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,10 +1,11 @@
1
1
  import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as k } from "@tanstack/react-query";
3
- import { BarChart3 as v } from "lucide-react";
2
+ import { useQuery as _ } from "@tanstack/react-query";
3
+ import { BarChart3 as $ } from "lucide-react";
4
4
  import { useState as f } from "react";
5
- import { useNivaroClient as w } from "../../context.js";
6
- import { get as _ } from "../../lib/commands.js";
5
+ import { useNivaroClient as M } from "../../context.js";
6
+ import { get as S } from "../../lib/commands.js";
7
7
  import { cn as p } from "../../lib/utils.js";
8
+ import { QueryErrorState as C } from "../QueryErrorState.js";
8
9
  const o = (l) => `${Math.round(l * 100)}%`, y = (l) => l == null ? "—" : l < 60 ? `${Math.round(l)}m` : l < 1440 ? `${(l / 60).toFixed(1)}h` : `${(l / 1440).toFixed(1)}d`;
9
10
  function m({ label: l, value: n, hint: s }) {
10
11
  return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
@@ -94,17 +95,17 @@ function h({ title: l, counts: n }) {
94
95
  ] }, t)) })
95
96
  ] });
96
97
  }
97
- function R({ className: l }) {
98
+ function H({ className: l }) {
98
99
  var g;
99
- const n = w(), [s, c] = f(30), [t, i] = f(24), { data: r, isLoading: N } = k({
100
+ const n = M(), [s, c] = f(30), [t, i] = f(24), { data: r, isLoading: N, isError: k, error: v, refetch: w } = _({
100
101
  queryKey: ["notification-analytics", s, t],
101
102
  queryFn: () => n.request(
102
- _("/notifications/analytics", { days: s, acted_hours: t })
103
+ S("/notifications/analytics", { days: s, acted_hours: t })
103
104
  ).then((a) => a.data)
104
105
  }), u = (r == null ? void 0 : r.series) ?? [], b = Math.max(1, ...u.map((a) => a.sent));
105
106
  return /* @__PURE__ */ d("div", { className: p("flex flex-1 min-h-0 flex-col", l), "data-nvr-notification-analytics": !0, children: [
106
107
  /* @__PURE__ */ e("header", { className: "shrink-0 border-b border-slate-200 bg-white px-6 py-4 dark:border-border dark:bg-card", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2.5", children: [
107
- /* @__PURE__ */ e(v, { className: "h-5 w-5 text-muted-foreground" }),
108
+ /* @__PURE__ */ e($, { className: "h-5 w-5 text-muted-foreground" }),
108
109
  /* @__PURE__ */ d("div", { children: [
109
110
  /* @__PURE__ */ e("h1", { className: "text-[17px] font-semibold text-slate-900 dark:text-foreground", children: "Notification analytics" }),
110
111
  /* @__PURE__ */ e("p", { className: "mt-0.5 text-[12.5px] text-slate-500 dark:text-muted-foreground", children: "Where the noise comes from and whether anyone reads it — by category, sender, collection and channel, plus what people have muted." })
@@ -156,7 +157,14 @@ function R({ className: l }) {
156
157
  }
157
158
  )
158
159
  ] }) }),
159
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: N || !r ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500 dark:text-muted-foreground", children: "Loading…" }) : /* @__PURE__ */ d("div", { className: "space-y-5", children: [
160
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: k && !r ? /* @__PURE__ */ e(
161
+ C,
162
+ {
163
+ error: v,
164
+ what: "notification analytics",
165
+ onRetry: () => void w()
166
+ }
167
+ ) : N || !r ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-500 dark:text-muted-foreground", children: "Loading…" }) : /* @__PURE__ */ d("div", { className: "space-y-5", children: [
160
168
  /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-5", children: [
161
169
  /* @__PURE__ */ e(m, { label: "Sent", value: String(r.total), hint: `last ${r.days} days` }),
162
170
  /* @__PURE__ */ e(m, { label: "Read rate", value: o(r.read_rate), hint: `${r.read} read` }),
@@ -261,5 +269,5 @@ function R({ className: l }) {
261
269
  ] });
262
270
  }
263
271
  export {
264
- R as NotificationAnalyticsView
272
+ H as NotificationAnalyticsView
265
273
  };