@nivaro/react 0.2.54 → 0.2.55

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 (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,37 +1,53 @@
1
- import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
- import { useQuery as g } from "@tanstack/react-query";
3
- import { BarChart3 as y } from "lucide-react";
4
- import { useState as N } from "react";
5
- import { useNivaroClient as f } from "../../context.js";
6
- import { get as k } from "../../lib/commands.js";
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";
4
+ import { useState as f } from "react";
5
+ import { useNivaroClient as w } from "../../context.js";
6
+ import { get as _ } from "../../lib/commands.js";
7
7
  import { cn as p } from "../../lib/utils.js";
8
- const x = (l) => `${Math.round(l * 100)}%`, u = (l) => l == null ? "—" : l < 60 ? `${Math.round(l)}m` : l < 1440 ? `${(l / 60).toFixed(1)}h` : `${(l / 1440).toFixed(1)}d`;
9
- function o({ label: l, value: d, hint: s }) {
10
- return /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
11
- /* @__PURE__ */ e("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: l }),
12
- /* @__PURE__ */ e("p", { className: "mt-1 text-[22px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: d }),
13
- s && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: s })
8
+ 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
+ function m({ label: l, value: n, hint: s }) {
10
+ return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
11
+ /* @__PURE__ */ e("p", { className: "text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: l }),
12
+ /* @__PURE__ */ e("p", { className: "mt-1 text-[22px] font-semibold tabular-nums text-slate-900 dark:text-foreground", children: n }),
13
+ s && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: s })
14
14
  ] });
15
15
  }
16
- function c({ title: l, rows: d, keyLabel: s }) {
17
- const i = Math.max(1, ...d.map((t) => t.sent));
18
- return /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
16
+ function x({ title: l, rows: n, keyLabel: s }) {
17
+ const c = Math.max(1, ...n.map((t) => t.sent));
18
+ return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
19
19
  /* @__PURE__ */ e("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: l }) }),
20
- d.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "Nothing in this window." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px] tabular-nums", children: [
21
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "text-left text-[10.5px] uppercase tracking-wide text-slate-400", children: [
20
+ n.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-500 dark:text-muted-foreground", children: "Nothing in this window." }) : /* @__PURE__ */ d("table", { className: "w-full text-[12px] tabular-nums", children: [
21
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { className: "text-left text-[11px] text-slate-500 dark:text-muted-foreground", children: [
22
22
  /* @__PURE__ */ e("th", { className: "px-4 py-1.5 font-semibold", children: s }),
23
23
  /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Sent" }),
24
24
  /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Read" }),
25
- /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Time to read" })
25
+ /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Time to read" }),
26
+ /* @__PURE__ */ e(
27
+ "th",
28
+ {
29
+ className: "px-2 py-1.5 text-right font-semibold",
30
+ "data-tip": "Share of record notifications the recipient acted on (transition, comment or task) within the window",
31
+ children: "Acted"
32
+ }
33
+ ),
34
+ /* @__PURE__ */ e(
35
+ "th",
36
+ {
37
+ className: "px-2 py-1.5 text-right font-semibold",
38
+ "data-tip": "Opened but never acted on within the window",
39
+ children: "Read, no action"
40
+ }
41
+ )
26
42
  ] }) }),
27
- /* @__PURE__ */ e("tbody", { children: d.map((t) => /* @__PURE__ */ r("tr", { className: "border-t border-slate-100 dark:border-border", children: [
28
- /* @__PURE__ */ e("td", { className: "px-4 py-1.5", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
43
+ /* @__PURE__ */ e("tbody", { children: n.map((t) => /* @__PURE__ */ d("tr", { className: "border-t border-slate-100 dark:border-border", children: [
44
+ /* @__PURE__ */ e("td", { className: "px-4 py-1.5", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
29
45
  /* @__PURE__ */ e("span", { className: "min-w-0 truncate text-slate-700 dark:text-foreground", children: t.label ?? t.key.replace(/_/g, " ") }),
30
46
  /* @__PURE__ */ e(
31
47
  "span",
32
48
  {
33
49
  className: "h-1.5 rounded-full bg-nvr-cyan/40",
34
- style: { width: `${Math.max(4, t.sent / i * 80)}px` }
50
+ style: { width: `${Math.max(4, t.sent / c * 80)}px` }
35
51
  }
36
52
  )
37
53
  ] }) }),
@@ -42,45 +58,64 @@ function c({ title: l, rows: d, keyLabel: s }) {
42
58
  className: p(
43
59
  t.read_rate >= 0.6 ? "text-emerald-700 dark:text-emerald-400" : t.read_rate >= 0.3 ? "text-slate-700 dark:text-foreground" : "text-amber-700 dark:text-amber-400"
44
60
  ),
45
- children: x(t.read_rate)
61
+ children: o(t.read_rate)
46
62
  }
47
63
  ) }),
48
- /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-slate-500", children: u(t.median_minutes_to_read) })
64
+ /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-slate-500", children: y(t.median_minutes_to_read) }),
65
+ /* @__PURE__ */ e(
66
+ "td",
67
+ {
68
+ className: "px-2 py-1.5 text-right text-slate-700 dark:text-foreground",
69
+ "data-tip": t.acted_eligible ? `${t.acted} of ${t.acted_eligible} record notifications` : "",
70
+ children: t.acted_rate == null ? "—" : o(t.acted_rate)
71
+ }
72
+ ),
73
+ /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: t.read_ignored_rate == null ? /* @__PURE__ */ e("span", { className: "text-slate-400", children: "—" }) : /* @__PURE__ */ e(
74
+ "span",
75
+ {
76
+ className: t.read_ignored_rate >= 0.5 ? "text-amber-700 dark:text-amber-400" : "text-slate-500",
77
+ children: o(t.read_ignored_rate)
78
+ }
79
+ ) })
49
80
  ] }, t.key)) })
50
81
  ] })
51
82
  ] });
52
83
  }
53
- function m({ title: l, counts: d }) {
54
- const s = Object.entries(d).filter(([, t]) => t > 0), i = s.reduce((t, [, n]) => t + n, 0);
55
- return /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
56
- /* @__PURE__ */ e("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: l }),
57
- i === 0 ? /* @__PURE__ */ e("p", { className: "mt-1 text-[12px] text-slate-400", children: "No tracked deliveries yet." }) : /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[12px]", children: s.sort((t, n) => n[1] - t[1]).map(([t, n]) => /* @__PURE__ */ r("li", { className: "flex items-center justify-between", children: [
84
+ function h({ title: l, counts: n }) {
85
+ const s = Object.entries(n).filter(([, t]) => t > 0), c = s.reduce((t, [, i]) => t + i, 0);
86
+ return /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
87
+ /* @__PURE__ */ e("p", { className: "text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: l }),
88
+ c === 0 ? /* @__PURE__ */ e("p", { className: "mt-1 text-[12px] text-slate-500 dark:text-muted-foreground", children: "No tracked deliveries yet." }) : /* @__PURE__ */ e("ul", { className: "mt-1 space-y-0.5 text-[12px]", children: s.sort((t, i) => i[1] - t[1]).map(([t, i]) => /* @__PURE__ */ d("li", { className: "flex items-center justify-between", children: [
58
89
  /* @__PURE__ */ e("span", { className: "text-slate-600 dark:text-muted-foreground", children: t.replace(/_/g, " ") }),
59
- /* @__PURE__ */ r("span", { className: "tabular-nums text-slate-800 dark:text-foreground", children: [
60
- n,
61
- /* @__PURE__ */ e("span", { className: "ml-1 text-[10.5px] text-slate-400", children: x(n / i) })
90
+ /* @__PURE__ */ d("span", { className: "tabular-nums text-slate-800 dark:text-foreground", children: [
91
+ i,
92
+ /* @__PURE__ */ e("span", { className: "ml-1 text-[10.5px] text-slate-500 dark:text-muted-foreground", children: o(i / c) })
62
93
  ] })
63
94
  ] }, t)) })
64
95
  ] });
65
96
  }
66
- function L({ className: l }) {
67
- const d = f(), [s, i] = N(30), { data: t, isLoading: n } = g({
68
- queryKey: ["notification-analytics", s],
69
- queryFn: () => d.request(k("/notifications/analytics", { days: s })).then((a) => a.data)
70
- }), h = (t == null ? void 0 : t.series) ?? [], b = Math.max(1, ...h.map((a) => a.sent));
71
- return /* @__PURE__ */ r("div", { className: p("flex flex-1 min-h-0 flex-col", l), "data-nvr-notification-analytics": !0, children: [
72
- /* @__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__ */ r("div", { className: "flex items-center gap-2.5", children: [
73
- /* @__PURE__ */ e(y, { className: "h-5 w-5 text-muted-foreground" }),
74
- /* @__PURE__ */ r("div", { children: [
97
+ function R({ className: l }) {
98
+ var g;
99
+ const n = w(), [s, c] = f(30), [t, i] = f(24), { data: r, isLoading: N } = k({
100
+ queryKey: ["notification-analytics", s, t],
101
+ queryFn: () => n.request(
102
+ _("/notifications/analytics", { days: s, acted_hours: t })
103
+ ).then((a) => a.data)
104
+ }), u = (r == null ? void 0 : r.series) ?? [], b = Math.max(1, ...u.map((a) => a.sent));
105
+ return /* @__PURE__ */ d("div", { className: p("flex flex-1 min-h-0 flex-col", l), "data-nvr-notification-analytics": !0, children: [
106
+ /* @__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__ */ d("div", { children: [
75
109
  /* @__PURE__ */ e("h1", { className: "text-[17px] font-semibold text-slate-900 dark:text-foreground", children: "Notification analytics" }),
76
110
  /* @__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." })
77
111
  ] }),
78
112
  /* @__PURE__ */ e("span", { className: "flex-1" }),
79
- /* @__PURE__ */ e("div", { className: "inline-flex rounded-md border border-slate-200 p-0.5 dark:border-border", children: [7, 30, 90].map((a) => /* @__PURE__ */ r(
113
+ /* @__PURE__ */ e("div", { className: "inline-flex rounded-md border border-slate-200 p-0.5 dark:border-border", children: [7, 30, 90].map((a) => /* @__PURE__ */ d(
80
114
  "button",
81
115
  {
82
116
  type: "button",
83
- onClick: () => i(a),
117
+ onClick: () => c(a),
118
+ "aria-pressed": s === a,
84
119
  className: p(
85
120
  "rounded px-2.5 py-1 text-[12px] font-medium",
86
121
  s === a ? "bg-slate-900 text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted"
@@ -91,34 +126,70 @@ function L({ className: l }) {
91
126
  ]
92
127
  },
93
128
  a
94
- )) })
129
+ )) }),
130
+ /* @__PURE__ */ d(
131
+ "div",
132
+ {
133
+ className: "inline-flex items-center rounded-md border border-slate-200 p-0.5 dark:border-border",
134
+ "data-tip": "How long after a notification an action still counts as acted",
135
+ children: [
136
+ /* @__PURE__ */ e("span", { className: "px-2 text-[12px] text-slate-500 dark:text-muted-foreground", children: "Acted within" }),
137
+ [4, 24, 72].map((a) => /* @__PURE__ */ d(
138
+ "button",
139
+ {
140
+ type: "button",
141
+ onClick: () => i(a),
142
+ "aria-pressed": t === a,
143
+ "aria-label": `Acted within ${a} hours`,
144
+ className: p(
145
+ "rounded px-2.5 py-1 text-[12px] font-medium",
146
+ t === a ? "bg-slate-900 text-white dark:bg-nvr-cyan dark:text-[#172940]" : "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted"
147
+ ),
148
+ children: [
149
+ a,
150
+ "h"
151
+ ]
152
+ },
153
+ a
154
+ ))
155
+ ]
156
+ }
157
+ )
95
158
  ] }) }),
96
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto bg-slate-50 p-6 dark:bg-background", children: n || !t ? /* @__PURE__ */ e("p", { className: "text-[13px] text-slate-400", children: "Loading…" }) : /* @__PURE__ */ r("div", { className: "space-y-5", children: [
97
- /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
98
- /* @__PURE__ */ e(o, { label: "Sent", value: String(t.total), hint: `last ${t.days} days` }),
99
- /* @__PURE__ */ e(o, { label: "Read rate", value: x(t.read_rate), hint: `${t.read} read` }),
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__ */ d("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-5", children: [
161
+ /* @__PURE__ */ e(m, { label: "Sent", value: String(r.total), hint: `last ${r.days} days` }),
162
+ /* @__PURE__ */ e(m, { label: "Read rate", value: o(r.read_rate), hint: `${r.read} read` }),
100
163
  /* @__PURE__ */ e(
101
- o,
164
+ m,
102
165
  {
103
166
  label: "Median time to read",
104
- value: u(t.median_minutes_to_read),
167
+ value: y(r.median_minutes_to_read),
105
168
  hint: "rows read since read tracking began"
106
169
  }
107
170
  ),
108
171
  /* @__PURE__ */ e(
109
- o,
172
+ m,
173
+ {
174
+ label: `Acted within ${t}h`,
175
+ value: ((g = r.acted) == null ? void 0 : g.acted_rate) == null ? "—" : o(r.acted.acted_rate),
176
+ hint: r.acted ? `${r.acted.acted} of ${r.acted.acted_eligible} record notifications` : void 0
177
+ }
178
+ ),
179
+ /* @__PURE__ */ e(
180
+ m,
110
181
  {
111
182
  label: "Muted records",
112
- value: String(t.mutes.total),
113
- hint: `${t.mutes.muting_users} of ${t.mutes.active_users} active users mute something`
183
+ value: String(r.mutes.total),
184
+ hint: `${r.mutes.muting_users} of ${r.mutes.active_users} active users mute something`
114
185
  }
115
186
  )
116
187
  ] }),
117
- t.truncated && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-400", children: "Window capped at 20,000 rows — figures cover the newest 20,000." }),
118
- /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
119
- /* @__PURE__ */ e("p", { className: "text-[10.5px] font-semibold uppercase tracking-wide text-slate-400", children: "Per day · sent (bar) and read (filled)" }),
120
- /* @__PURE__ */ r("div", { className: "mt-2 flex h-24 items-end gap-px", children: [
121
- h.map((a) => /* @__PURE__ */ r(
188
+ r.truncated && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-amber-700 dark:text-amber-400", children: "Window capped at 20,000 rows — figures cover the newest 20,000." }),
189
+ /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
190
+ /* @__PURE__ */ e("p", { className: "text-[12px] font-medium text-slate-500 dark:text-muted-foreground", children: "Per day · sent (bar) and read (filled)" }),
191
+ /* @__PURE__ */ d("div", { className: "mt-2 flex h-24 items-end gap-px", children: [
192
+ u.map((a) => /* @__PURE__ */ d(
122
193
  "div",
123
194
  {
124
195
  className: "relative flex-1",
@@ -143,28 +214,28 @@ function L({ className: l }) {
143
214
  },
144
215
  a.day
145
216
  )),
146
- h.length === 0 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "No notifications in this window." })
217
+ u.length === 0 && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "No notifications in this window." })
147
218
  ] })
148
219
  ] }),
149
- /* @__PURE__ */ r("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
150
- /* @__PURE__ */ e(c, { title: "By category", rows: t.by_category, keyLabel: "Category" }),
151
- /* @__PURE__ */ e(c, { title: "By sender", rows: t.by_sender, keyLabel: "Sender" }),
152
- /* @__PURE__ */ e(c, { title: "By lane", rows: t.by_lane, keyLabel: "Lane" }),
153
- /* @__PURE__ */ e(c, { title: "By kind", rows: t.by_kind, keyLabel: "Kind" }),
154
- /* @__PURE__ */ e(c, { title: "By collection", rows: t.by_collection, keyLabel: "Collection" }),
155
- /* @__PURE__ */ r("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
156
- /* @__PURE__ */ r("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
220
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-1 gap-4 lg:grid-cols-2", children: [
221
+ /* @__PURE__ */ e(x, { title: "By category", rows: r.by_category, keyLabel: "Category" }),
222
+ /* @__PURE__ */ e(x, { title: "By sender", rows: r.by_sender, keyLabel: "Sender" }),
223
+ /* @__PURE__ */ e(x, { title: "By lane", rows: r.by_lane, keyLabel: "Lane" }),
224
+ /* @__PURE__ */ e(x, { title: "By kind", rows: r.by_kind, keyLabel: "Kind" }),
225
+ /* @__PURE__ */ e(x, { title: "By collection", rows: r.by_collection, keyLabel: "Collection" }),
226
+ /* @__PURE__ */ d("div", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
227
+ /* @__PURE__ */ d("header", { className: "border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
157
228
  /* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: "Most muted sources" }),
158
- /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Records people asked to stop hearing about, against what that collection sent." })
229
+ /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-muted-foreground", children: "Records people asked to stop hearing about, against what that collection sent." })
159
230
  ] }),
160
- t.mutes.top.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-400", children: "Nobody has muted a record." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px] tabular-nums", children: [
161
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "text-left text-[10.5px] uppercase tracking-wide text-slate-400", children: [
231
+ r.mutes.top.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-4 text-[12px] text-slate-500 dark:text-muted-foreground", children: "Nobody has muted a record." }) : /* @__PURE__ */ d("table", { className: "w-full text-[12px] tabular-nums", children: [
232
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ d("tr", { className: "text-left text-[11px] text-slate-500 dark:text-muted-foreground", children: [
162
233
  /* @__PURE__ */ e("th", { className: "px-4 py-1.5 font-semibold", children: "Collection" }),
163
234
  /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Mutes" }),
164
235
  /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Sent" }),
165
236
  /* @__PURE__ */ e("th", { className: "px-2 py-1.5 text-right font-semibold", children: "Mute rate" })
166
237
  ] }) }),
167
- /* @__PURE__ */ e("tbody", { children: t.mutes.top.map((a) => /* @__PURE__ */ r(
238
+ /* @__PURE__ */ e("tbody", { children: r.mutes.top.map((a) => /* @__PURE__ */ d(
168
239
  "tr",
169
240
  {
170
241
  className: "border-t border-slate-100 dark:border-border",
@@ -172,7 +243,7 @@ function L({ className: l }) {
172
243
  /* @__PURE__ */ e("td", { className: "px-4 py-1.5 text-slate-700 dark:text-foreground", children: a.collection.replace(/_/g, " ") }),
173
244
  /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right", children: a.mutes }),
174
245
  /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-slate-500", children: a.sent }),
175
- /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-amber-700 dark:text-amber-400", children: a.sent ? x(a.mute_rate) : "—" })
246
+ /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-right text-amber-700 dark:text-amber-400", children: a.sent ? o(a.mute_rate) : "—" })
176
247
  ]
177
248
  },
178
249
  a.collection
@@ -180,15 +251,15 @@ function L({ className: l }) {
180
251
  ] })
181
252
  ] })
182
253
  ] }),
183
- /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
184
- /* @__PURE__ */ e(m, { title: "In-app", counts: t.channels.inapp }),
185
- /* @__PURE__ */ e(m, { title: "Push", counts: t.channels.push }),
186
- /* @__PURE__ */ e(m, { title: "Email", counts: t.channels.email }),
187
- /* @__PURE__ */ e(m, { title: "SMS", counts: t.channels.sms })
254
+ /* @__PURE__ */ d("div", { className: "grid grid-cols-2 gap-3 md:grid-cols-4", children: [
255
+ /* @__PURE__ */ e(h, { title: "In-app", counts: r.channels.inapp }),
256
+ /* @__PURE__ */ e(h, { title: "Push", counts: r.channels.push }),
257
+ /* @__PURE__ */ e(h, { title: "Email", counts: r.channels.email }),
258
+ /* @__PURE__ */ e(h, { title: "SMS", counts: r.channels.sms })
188
259
  ] })
189
260
  ] }) })
190
261
  ] });
191
262
  }
192
263
  export {
193
- L as NotificationAnalyticsView
264
+ R as NotificationAnalyticsView
194
265
  };
@@ -1,10 +1,11 @@
1
1
  import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
- import { useQueryClient as y, useQuery as N, useMutation as w } from "@tanstack/react-query";
3
- import { CheckCircle2 as v, Clock3 as S, AlertTriangle as C, Loader2 as q, RefreshCw as _, Code2 as R, ChevronDown as D } from "lucide-react";
4
- import { useState as $ } from "react";
2
+ import { useQueryClient as N, useQuery as w, useMutation as v } from "@tanstack/react-query";
3
+ import { CheckCircle2 as S, Clock3 as C, AlertTriangle as q, Loader2 as _, RefreshCw as R, Code2 as D, ChevronDown as $ } from "lucide-react";
4
+ import { useState as Q } from "react";
5
5
  import { toast as u } from "sonner";
6
- import { useNivaroClient as Q } from "../../context.js";
7
- import { get as T, post as E } from "../../lib/commands.js";
6
+ import { useNivaroClient as T } from "../../context.js";
7
+ import { get as E, post as K } from "../../lib/commands.js";
8
+ import { useLiveRefetchInterval as L } from "../../lib/live-queries.js";
8
9
  import { cn as l } from "../../lib/utils.js";
9
10
  function f(e) {
10
11
  if (e == null) return null;
@@ -60,27 +61,27 @@ function k({
60
61
  d === "red" ? "text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
61
62
  ),
62
63
  children: [
63
- /* @__PURE__ */ r(R, { className: "h-3 w-3" }),
64
+ /* @__PURE__ */ r(D, { className: "h-3 w-3" }),
64
65
  "Request & response",
65
- /* @__PURE__ */ r(D, { className: l("h-3 w-3 transition-transform", e && "rotate-180") })
66
+ /* @__PURE__ */ r($, { className: l("h-3 w-3 transition-transform", e && "rotate-180") })
66
67
  ]
67
68
  }
68
69
  );
69
70
  }
70
- function A({
71
+ function U({
71
72
  collection: e,
72
73
  itemId: n
73
74
  }) {
74
- const d = Q(), o = y(), [i, c] = $(!1), { data: h } = N({
75
+ const d = T(), o = N(), [i, c] = Q(!1), y = L(6e4), { data: h } = w({
75
76
  queryKey: ["erp-submissions", e, String(n)],
76
77
  queryFn: () => d.request(
77
- T(`/erp-submissions/${e}/${encodeURIComponent(n)}`)
78
+ E(`/erp-submissions/${e}/${encodeURIComponent(n)}`)
78
79
  ).then((a) => a.data ?? []),
79
80
  enabled: !!e && !!n,
80
81
  staleTime: 15e3,
81
- refetchInterval: 6e4
82
- }), m = w({
83
- mutationFn: (a) => d.request(E(`/erp-submissions/${a}/retry`)),
82
+ refetchInterval: y
83
+ }), m = v({
84
+ mutationFn: (a) => d.request(K(`/erp-submissions/${a}/retry`)),
84
85
  onSuccess: (a) => {
85
86
  var b;
86
87
  const p = (b = a == null ? void 0 : a.data) == null ? void 0 : b.status;
@@ -103,7 +104,7 @@ function A({
103
104
  "data-erp-status-banner": t.status,
104
105
  children: [
105
106
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2.5", children: [
106
- a ? /* @__PURE__ */ r(v, { className: "h-4 w-4 shrink-0 text-emerald-500", strokeWidth: 2 }) : /* @__PURE__ */ r(S, { className: "h-4 w-4 shrink-0 text-sky-500", strokeWidth: 2 }),
107
+ a ? /* @__PURE__ */ r(S, { className: "h-4 w-4 shrink-0 text-emerald-500", strokeWidth: 2 }) : /* @__PURE__ */ r(C, { className: "h-4 w-4 shrink-0 text-sky-500", strokeWidth: 2 }),
107
108
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: [
108
109
  /* @__PURE__ */ r("span", { className: "font-semibold", children: a ? "External submission accepted" : "Submitted to external system — awaiting acknowledgement" }),
109
110
  t.endpoint_path ? ` · ${t.endpoint_path}` : ""
@@ -124,7 +125,7 @@ function A({
124
125
  className: "flex items-start gap-2.5 rounded-lg border border-red-200 bg-red-50 px-3.5 py-2.5 dark:border-red-900/40 dark:bg-red-900/15",
125
126
  "data-erp-failure-banner": !0,
126
127
  children: [
127
- /* @__PURE__ */ r(C, { className: "mt-0.5 h-4 w-4 shrink-0 text-red-500", strokeWidth: 2 }),
128
+ /* @__PURE__ */ r(q, { className: "mt-0.5 h-4 w-4 shrink-0 text-red-500", strokeWidth: 2 }),
128
129
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
129
130
  /* @__PURE__ */ s("p", { className: "text-[12.5px] font-semibold text-red-700 dark:text-red-300", children: [
130
131
  "External submission failed",
@@ -162,7 +163,7 @@ function A({
162
163
  "dark:border-red-800 dark:bg-transparent dark:text-red-300 dark:hover:bg-red-900/30"
163
164
  ),
164
165
  children: [
165
- m.isPending ? /* @__PURE__ */ r(q, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(_, { className: "h-3.5 w-3.5" }),
166
+ m.isPending ? /* @__PURE__ */ r(_, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ r(R, { className: "h-3.5 w-3.5" }),
166
167
  "Retry"
167
168
  ]
168
169
  }
@@ -172,5 +173,5 @@ function A({
172
173
  );
173
174
  }
174
175
  export {
175
- A as ErpFailureBanner
176
+ U as ErpFailureBanner
176
177
  };