@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +339 -2
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -6,42 +6,43 @@ import { useNivaroClient as z, useApiFetchConfig as be } from "../../context.js"
|
|
|
6
6
|
import { get as A } from "../../lib/commands.js";
|
|
7
7
|
import { cn as v, formatDateTime as f, formatRelative as V } from "../../lib/utils.js";
|
|
8
8
|
import { TipLayer as ue } from "../TipLayer.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ChannelsAdminTab as ge } from "./ChannelArchive.js";
|
|
10
|
+
import { useUserSearch as ke } from "./chat-core.js";
|
|
10
11
|
const U = {
|
|
11
12
|
dm: "Direct message",
|
|
12
13
|
group: "Group conversation",
|
|
13
14
|
channel: "Channel",
|
|
14
15
|
general: "General",
|
|
15
16
|
record: "Record room"
|
|
16
|
-
},
|
|
17
|
+
}, Ne = {
|
|
17
18
|
dm: "DM",
|
|
18
19
|
group: "Group",
|
|
19
20
|
channel: "Channel",
|
|
20
21
|
general: "General",
|
|
21
22
|
record: "Record"
|
|
22
23
|
};
|
|
23
|
-
function X(
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
27
|
-
const i =
|
|
24
|
+
function X(s) {
|
|
25
|
+
if (s == null) return "—";
|
|
26
|
+
if (s < 1) return "under a minute";
|
|
27
|
+
if (s < 60) return `${Math.round(s)} min`;
|
|
28
|
+
const i = s / 60;
|
|
28
29
|
return i < 24 ? `${i.toFixed(i < 10 ? 1 : 0)} h` : `${(i / 24).toFixed(1)} days`;
|
|
29
30
|
}
|
|
30
|
-
function C({ label:
|
|
31
|
+
function C({ label: s, value: i, sub: o }) {
|
|
31
32
|
return /* @__PURE__ */ t("div", { className: "rounded-lg border border-slate-200 bg-white px-4 py-3 dark:border-border dark:bg-card", children: [
|
|
32
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] font-medium uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children:
|
|
33
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] font-medium uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: s }),
|
|
33
34
|
/* @__PURE__ */ e("p", { className: "mt-1 text-[22px] font-semibold tabular-nums text-slate-900 dark:text-slate-50", children: i }),
|
|
34
35
|
o && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11.5px] text-slate-500 dark:text-slate-400", children: o })
|
|
35
36
|
] });
|
|
36
37
|
}
|
|
37
38
|
function J({
|
|
38
|
-
values:
|
|
39
|
+
values: s,
|
|
39
40
|
labels: i,
|
|
40
41
|
tips: o,
|
|
41
42
|
height: h = 120,
|
|
42
|
-
axis:
|
|
43
|
+
axis: r
|
|
43
44
|
}) {
|
|
44
|
-
const a = Math.max(1, ...
|
|
45
|
+
const a = Math.max(1, ...s);
|
|
45
46
|
return /* @__PURE__ */ t("div", { children: [
|
|
46
47
|
/* @__PURE__ */ e(
|
|
47
48
|
"div",
|
|
@@ -50,7 +51,7 @@ function J({
|
|
|
50
51
|
style: { height: h },
|
|
51
52
|
role: "img",
|
|
52
53
|
"aria-label": o.join("; "),
|
|
53
|
-
children:
|
|
54
|
+
children: s.map((p, u) => /* @__PURE__ */ e(
|
|
54
55
|
"div",
|
|
55
56
|
{
|
|
56
57
|
className: "group flex h-full min-w-0 flex-1 items-end",
|
|
@@ -70,11 +71,11 @@ function J({
|
|
|
70
71
|
))
|
|
71
72
|
}
|
|
72
73
|
),
|
|
73
|
-
/* @__PURE__ */ e("div", { className: "relative mt-1 h-4 border-t border-slate-200 dark:border-border", children:
|
|
74
|
+
/* @__PURE__ */ e("div", { className: "relative mt-1 h-4 border-t border-slate-200 dark:border-border", children: r.map((p) => /* @__PURE__ */ e(
|
|
74
75
|
"span",
|
|
75
76
|
{
|
|
76
77
|
className: "absolute top-0.5 -translate-x-1/2 whitespace-nowrap text-[10.5px] tabular-nums text-slate-500 dark:text-slate-400",
|
|
77
|
-
style: { left: `${(p.index + 0.5) /
|
|
78
|
+
style: { left: `${(p.index + 0.5) / s.length * 100}%` },
|
|
78
79
|
children: p.text
|
|
79
80
|
},
|
|
80
81
|
p.index
|
|
@@ -83,63 +84,63 @@ function J({
|
|
|
83
84
|
] });
|
|
84
85
|
}
|
|
85
86
|
function S({
|
|
86
|
-
title:
|
|
87
|
+
title: s,
|
|
87
88
|
children: i,
|
|
88
89
|
note: o
|
|
89
90
|
}) {
|
|
90
91
|
return /* @__PURE__ */ t("section", { className: "rounded-lg border border-slate-200 bg-white p-4 dark:border-border dark:bg-card", children: [
|
|
91
92
|
/* @__PURE__ */ t("div", { className: "mb-3 flex items-baseline justify-between gap-3", children: [
|
|
92
|
-
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children:
|
|
93
|
+
/* @__PURE__ */ e("h3", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: s }),
|
|
93
94
|
o && /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: o })
|
|
94
95
|
] }),
|
|
95
96
|
i
|
|
96
97
|
] });
|
|
97
98
|
}
|
|
98
99
|
function Y({
|
|
99
|
-
rows:
|
|
100
|
+
rows: s,
|
|
100
101
|
empty: i,
|
|
101
102
|
onOpen: o
|
|
102
103
|
}) {
|
|
103
|
-
if (
|
|
104
|
+
if (s.length === 0)
|
|
104
105
|
return /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: i });
|
|
105
|
-
const h = Math.max(1, ...
|
|
106
|
+
const h = Math.max(1, ...s.map((r) => r.messages));
|
|
106
107
|
return /* @__PURE__ */ t("table", { className: "w-full text-[12.5px]", children: [
|
|
107
108
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { className: "text-left text-[10.5px] uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: [
|
|
108
109
|
/* @__PURE__ */ e("th", { className: "pb-1.5 font-medium", children: "Room" }),
|
|
109
110
|
/* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Messages" }),
|
|
110
111
|
/* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "People" })
|
|
111
112
|
] }) }),
|
|
112
|
-
/* @__PURE__ */ e("tbody", { className: "tabular-nums", children:
|
|
113
|
+
/* @__PURE__ */ e("tbody", { className: "tabular-nums", children: s.map((r) => /* @__PURE__ */ t("tr", { className: "border-t border-slate-100 dark:border-border/60", children: [
|
|
113
114
|
/* @__PURE__ */ t("td", { className: "py-1.5 pr-3", children: [
|
|
114
115
|
/* @__PURE__ */ e(
|
|
115
116
|
"button",
|
|
116
117
|
{
|
|
117
118
|
type: "button",
|
|
118
|
-
onClick: () => o(
|
|
119
|
+
onClick: () => o(r.room, r.label),
|
|
119
120
|
className: "block max-w-full truncate text-left font-medium text-slate-800 hover:underline dark:text-slate-100",
|
|
120
121
|
title: "Read the messages in this room",
|
|
121
|
-
children:
|
|
122
|
+
children: r.label
|
|
122
123
|
}
|
|
123
124
|
),
|
|
124
125
|
/* @__PURE__ */ e("span", { className: "mt-1 block h-1 rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
|
|
125
126
|
"span",
|
|
126
127
|
{
|
|
127
128
|
className: "block h-1 rounded-full bg-nvr-cyan",
|
|
128
|
-
style: { width: `${
|
|
129
|
+
style: { width: `${r.messages / h * 100}%` }
|
|
129
130
|
}
|
|
130
131
|
) })
|
|
131
132
|
] }),
|
|
132
|
-
/* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children:
|
|
133
|
-
/* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children:
|
|
134
|
-
] },
|
|
133
|
+
/* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: r.messages }),
|
|
134
|
+
/* @__PURE__ */ e("td", { className: "py-1.5 text-right text-slate-700 dark:text-slate-200", children: r.senders })
|
|
135
|
+
] }, r.room)) })
|
|
135
136
|
] });
|
|
136
137
|
}
|
|
137
|
-
function
|
|
138
|
-
const i = z(), [o, h] = b(30), { data:
|
|
138
|
+
function fe({ onOpenRoom: s }) {
|
|
139
|
+
const i = z(), [o, h] = b(30), { data: r, isLoading: a, isError: p, refetch: u, isFetching: c } = K({
|
|
139
140
|
queryKey: ["nvr-chat-analytics", o],
|
|
140
141
|
queryFn: () => i.request(A("/chat/admin/analytics", { days: o })).then((d) => d.data),
|
|
141
142
|
staleTime: 6e4
|
|
142
|
-
}), m = (
|
|
143
|
+
}), m = (r == null ? void 0 : r.per_day) ?? [], n = m.map(
|
|
143
144
|
(d) => `${(/* @__PURE__ */ new Date(`${d.day}T12:00:00`)).toLocaleDateString("en-US", { month: "short", day: "numeric" })}: ${d.messages} message${d.messages === 1 ? "" : "s"} from ${d.senders} ${d.senders === 1 ? "person" : "people"}`
|
|
144
145
|
), x = xe(() => {
|
|
145
146
|
const d = m.length;
|
|
@@ -187,9 +188,9 @@ function Ne({ onOpenRoom: r }) {
|
|
|
187
188
|
]
|
|
188
189
|
}
|
|
189
190
|
),
|
|
190
|
-
|
|
191
|
+
r && /* @__PURE__ */ t("p", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
191
192
|
"Times in ",
|
|
192
|
-
|
|
193
|
+
r.window.time_zone.replace(/_/g, " "),
|
|
193
194
|
". Counts only — no message text on this tab."
|
|
194
195
|
] })
|
|
195
196
|
] }),
|
|
@@ -205,43 +206,43 @@ function Ne({ onOpenRoom: r }) {
|
|
|
205
206
|
},
|
|
206
207
|
d
|
|
207
208
|
)) }),
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
r && /* @__PURE__ */ t(de, { children: [
|
|
210
|
+
r.window.truncated && /* @__PURE__ */ e("p", { className: "text-[12px] text-amber-700 dark:text-amber-400", children: "Only the newest 50,000 messages in this window were counted." }),
|
|
210
211
|
/* @__PURE__ */ t(
|
|
211
212
|
"div",
|
|
212
213
|
{
|
|
213
214
|
className: "grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",
|
|
214
215
|
"data-chat-analytics-totals": !0,
|
|
215
216
|
children: [
|
|
216
|
-
/* @__PURE__ */ e(C, { label: "Messages", value:
|
|
217
|
-
/* @__PURE__ */ e(C, { label: "People who wrote", value:
|
|
218
|
-
/* @__PURE__ */ e(C, { label: "Active rooms", value:
|
|
217
|
+
/* @__PURE__ */ e(C, { label: "Messages", value: r.totals.messages.toLocaleString() }),
|
|
218
|
+
/* @__PURE__ */ e(C, { label: "People who wrote", value: r.totals.senders.toLocaleString() }),
|
|
219
|
+
/* @__PURE__ */ e(C, { label: "Active rooms", value: r.totals.active_rooms.toLocaleString() }),
|
|
219
220
|
/* @__PURE__ */ e(
|
|
220
221
|
C,
|
|
221
222
|
{
|
|
222
223
|
label: "DM reply time",
|
|
223
|
-
value: X(
|
|
224
|
-
sub:
|
|
224
|
+
value: X(r.dm_response.median_minutes),
|
|
225
|
+
sub: r.dm_response.samples ? `median of ${r.dm_response.samples} replies · 90% within ${X(r.dm_response.p90_minutes)}` : "no replies in this window"
|
|
225
226
|
}
|
|
226
227
|
),
|
|
227
228
|
/* @__PURE__ */ e(
|
|
228
229
|
C,
|
|
229
230
|
{
|
|
230
231
|
label: "DMs answered within an hour",
|
|
231
|
-
value:
|
|
232
|
+
value: r.dm_response.within_hour_pct == null ? "—" : `${r.dm_response.within_hour_pct}%`
|
|
232
233
|
}
|
|
233
234
|
),
|
|
234
235
|
/* @__PURE__ */ e(
|
|
235
236
|
C,
|
|
236
237
|
{
|
|
237
238
|
label: "Files · reactions",
|
|
238
|
-
value: `${
|
|
239
|
+
value: `${r.totals.attachments} · ${r.totals.reactions}`
|
|
239
240
|
}
|
|
240
241
|
)
|
|
241
242
|
]
|
|
242
243
|
}
|
|
243
244
|
),
|
|
244
|
-
/* @__PURE__ */ e(S, { title: "Messages per day", note: `Last ${
|
|
245
|
+
/* @__PURE__ */ e(S, { title: "Messages per day", note: `Last ${r.window.days} days`, children: /* @__PURE__ */ e(
|
|
245
246
|
J,
|
|
246
247
|
{
|
|
247
248
|
values: m.map((d) => d.messages),
|
|
@@ -254,24 +255,24 @@ function Ne({ onOpenRoom: r }) {
|
|
|
254
255
|
/* @__PURE__ */ e(S, { title: "When people write", note: "Messages by hour of day", children: /* @__PURE__ */ e(
|
|
255
256
|
J,
|
|
256
257
|
{
|
|
257
|
-
values:
|
|
258
|
-
labels:
|
|
259
|
-
tips:
|
|
258
|
+
values: r.by_hour,
|
|
259
|
+
labels: r.by_hour.map((d, k) => `${y(k)} ${d}`),
|
|
260
|
+
tips: r.by_hour.map(
|
|
260
261
|
(d, k) => `${y(k)}m–${y((k + 1) % 24)}m: ${d} message${d === 1 ? "" : "s"}`
|
|
261
262
|
),
|
|
262
263
|
height: 96,
|
|
263
264
|
axis: [0, 6, 12, 18].map((d) => ({ index: d, text: y(d) }))
|
|
264
265
|
}
|
|
265
266
|
) }),
|
|
266
|
-
/* @__PURE__ */ e(S, { title: "Where people write", children:
|
|
267
|
+
/* @__PURE__ */ e(S, { title: "Where people write", children: r.by_kind.length === 0 ? /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "No messages in this window." }) : /* @__PURE__ */ t("table", { className: "w-full text-[12.5px] tabular-nums", children: [
|
|
267
268
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { className: "text-left text-[10.5px] uppercase tracking-[0.06em] text-slate-500 dark:text-slate-400", children: [
|
|
268
269
|
/* @__PURE__ */ e("th", { className: "pb-1.5 font-medium", children: "Kind" }),
|
|
269
270
|
/* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Rooms" }),
|
|
270
271
|
/* @__PURE__ */ e("th", { className: "pb-1.5 text-right font-medium", children: "Messages" }),
|
|
271
272
|
/* @__PURE__ */ e("th", { className: "pb-1.5 pl-3 font-medium", children: "Share" })
|
|
272
273
|
] }) }),
|
|
273
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
274
|
-
const k =
|
|
274
|
+
/* @__PURE__ */ e("tbody", { children: r.by_kind.map((d) => {
|
|
275
|
+
const k = r.totals.messages ? d.messages / r.totals.messages * 100 : 0;
|
|
275
276
|
return /* @__PURE__ */ t(
|
|
276
277
|
"tr",
|
|
277
278
|
{
|
|
@@ -304,17 +305,17 @@ function Ne({ onOpenRoom: r }) {
|
|
|
304
305
|
/* @__PURE__ */ e(S, { title: "Busiest channels", children: /* @__PURE__ */ e(
|
|
305
306
|
Y,
|
|
306
307
|
{
|
|
307
|
-
rows:
|
|
308
|
+
rows: r.busiest_channels,
|
|
308
309
|
empty: "No channel messages in this window.",
|
|
309
|
-
onOpen:
|
|
310
|
+
onOpen: s
|
|
310
311
|
}
|
|
311
312
|
) }),
|
|
312
313
|
/* @__PURE__ */ e(S, { title: "Busiest record conversations", children: /* @__PURE__ */ e(
|
|
313
314
|
Y,
|
|
314
315
|
{
|
|
315
|
-
rows:
|
|
316
|
+
rows: r.busiest_records,
|
|
316
317
|
empty: "No record conversations in this window.",
|
|
317
|
-
onOpen:
|
|
318
|
+
onOpen: s
|
|
318
319
|
}
|
|
319
320
|
) })
|
|
320
321
|
] })
|
|
@@ -322,20 +323,20 @@ function Ne({ onOpenRoom: r }) {
|
|
|
322
323
|
] });
|
|
323
324
|
}
|
|
324
325
|
function Z({
|
|
325
|
-
label:
|
|
326
|
+
label: s,
|
|
326
327
|
value: i,
|
|
327
328
|
onChange: o
|
|
328
329
|
}) {
|
|
329
|
-
const [h,
|
|
330
|
+
const [h, r] = b(!1), [a, p] = b(""), { users: u } = ke(a, h);
|
|
330
331
|
return i ? /* @__PURE__ */ t("span", { className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-2 text-[12px] dark:border-border dark:bg-card", children: [
|
|
331
|
-
/* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children:
|
|
332
|
+
/* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children: s }),
|
|
332
333
|
/* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: i.name }),
|
|
333
334
|
/* @__PURE__ */ e(
|
|
334
335
|
"button",
|
|
335
336
|
{
|
|
336
337
|
type: "button",
|
|
337
338
|
onClick: () => o(null),
|
|
338
|
-
"aria-label": `Clear ${
|
|
339
|
+
"aria-label": `Clear ${s}`,
|
|
339
340
|
className: "rounded p-0.5 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-100",
|
|
340
341
|
children: /* @__PURE__ */ e(P, { className: "h-3 w-3" })
|
|
341
342
|
}
|
|
@@ -345,12 +346,12 @@ function Z({
|
|
|
345
346
|
"input",
|
|
346
347
|
{
|
|
347
348
|
value: a,
|
|
348
|
-
onFocus: () =>
|
|
349
|
-
onBlur: () => setTimeout(() =>
|
|
349
|
+
onFocus: () => r(!0),
|
|
350
|
+
onBlur: () => setTimeout(() => r(!1), 150),
|
|
350
351
|
onChange: (c) => p(c.target.value),
|
|
351
|
-
placeholder: `${
|
|
352
|
+
placeholder: `${s}: anyone`,
|
|
352
353
|
className: "h-8 w-44 rounded-md border border-slate-200 bg-white px-2 text-[12px] outline-none focus:border-slate-400 dark:border-border dark:bg-card",
|
|
353
|
-
"aria-label": `${
|
|
354
|
+
"aria-label": `${s} person`
|
|
354
355
|
}
|
|
355
356
|
),
|
|
356
357
|
h && u.length > 0 && /* @__PURE__ */ e("div", { className: "absolute left-0 top-9 z-20 max-h-64 w-64 overflow-y-auto rounded-md border border-slate-200 bg-white py-1 shadow-lg dark:border-border dark:bg-card", children: u.map((c) => {
|
|
@@ -361,7 +362,7 @@ function Z({
|
|
|
361
362
|
type: "button",
|
|
362
363
|
onMouseDown: (n) => n.preventDefault(),
|
|
363
364
|
onClick: () => {
|
|
364
|
-
o({ id: c.id, name: m }), p(""),
|
|
365
|
+
o({ id: c.id, name: m }), p(""), r(!1);
|
|
365
366
|
},
|
|
366
367
|
className: "block w-full truncate px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
|
|
367
368
|
children: [
|
|
@@ -374,20 +375,20 @@ function Z({
|
|
|
374
375
|
}) })
|
|
375
376
|
] });
|
|
376
377
|
}
|
|
377
|
-
function ee(
|
|
378
|
-
return
|
|
378
|
+
function ee(s) {
|
|
379
|
+
return s.kind === "group" && s.participant_count ? `${s.room_label} · ${s.participant_count} people` : s.room_label;
|
|
379
380
|
}
|
|
380
|
-
function te({ kind:
|
|
381
|
-
return /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 rounded border border-slate-200 px-1.5 text-[10.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300", children:
|
|
381
|
+
function te({ kind: s }) {
|
|
382
|
+
return /* @__PURE__ */ e("span", { className: "inline-flex shrink-0 rounded border border-slate-200 px-1.5 text-[10.5px] font-medium text-slate-600 dark:border-border dark:text-slate-300", children: Ne[s] });
|
|
382
383
|
}
|
|
383
|
-
function
|
|
384
|
-
room:
|
|
384
|
+
function ve({
|
|
385
|
+
room: s,
|
|
385
386
|
onRoomChange: i
|
|
386
387
|
}) {
|
|
387
|
-
const o = z(), [h,
|
|
388
|
+
const o = z(), [h, r] = b(null), [a, p] = b(null), [u, c] = b([]), [m, n] = b(""), [x, y] = b(""), [d, k] = b(""), [w, _] = b(""), [E, ae] = b(!1), [W, se] = b(!1), [M, F] = b(1), [D, R] = b(null), I = 50, G = {
|
|
388
389
|
...h ? { sender: h.id } : {},
|
|
389
390
|
...a ? { participant: a.id } : {},
|
|
390
|
-
...
|
|
391
|
+
...s ? { room: s.room } : {},
|
|
391
392
|
...u.length ? { kind: u.join(",") } : {},
|
|
392
393
|
...x.trim().length >= 2 ? { q: x.trim() } : {},
|
|
393
394
|
...d ? { since: (/* @__PURE__ */ new Date(`${d}T00:00:00`)).toISOString() } : {},
|
|
@@ -400,7 +401,7 @@ function fe({
|
|
|
400
401
|
queryKey: ["nvr-chat-admin-messages", G],
|
|
401
402
|
queryFn: () => o.request(A("/chat/admin/messages", G)),
|
|
402
403
|
placeholderData: (l) => l
|
|
403
|
-
}), H = ($ == null ? void 0 : $.data) ?? [],
|
|
404
|
+
}), H = ($ == null ? void 0 : $.data) ?? [], T = ($ == null ? void 0 : $.total) ?? 0, L = Math.max(1, Math.ceil(T / I)), N = () => F(1);
|
|
404
405
|
return /* @__PURE__ */ t("div", { className: "space-y-3", children: [
|
|
405
406
|
/* @__PURE__ */ t(
|
|
406
407
|
"p",
|
|
@@ -420,7 +421,7 @@ function fe({
|
|
|
420
421
|
label: "From",
|
|
421
422
|
value: h,
|
|
422
423
|
onChange: (l) => {
|
|
423
|
-
|
|
424
|
+
r(l), N();
|
|
424
425
|
}
|
|
425
426
|
}
|
|
426
427
|
),
|
|
@@ -434,9 +435,9 @@ function fe({
|
|
|
434
435
|
}
|
|
435
436
|
}
|
|
436
437
|
),
|
|
437
|
-
|
|
438
|
+
s && /* @__PURE__ */ t("span", { className: "inline-flex h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-2 text-[12px] dark:border-border dark:bg-card", children: [
|
|
438
439
|
/* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-slate-400", children: "Room" }),
|
|
439
|
-
/* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-800 dark:text-slate-100", children:
|
|
440
|
+
/* @__PURE__ */ e("span", { className: "max-w-[220px] truncate font-medium text-slate-800 dark:text-slate-100", children: s.label }),
|
|
440
441
|
/* @__PURE__ */ e(
|
|
441
442
|
"button",
|
|
442
443
|
{
|
|
@@ -563,8 +564,8 @@ function fe({
|
|
|
563
564
|
children: [
|
|
564
565
|
/* @__PURE__ */ t("div", { className: "min-w-0 overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
|
|
565
566
|
/* @__PURE__ */ t("div", { className: "flex items-center justify-between border-b border-slate-100 px-3 py-2 text-[12px] text-slate-500 dark:border-border/60 dark:text-slate-400", children: [
|
|
566
|
-
/* @__PURE__ */ t("span", { "data-chat-admin-total":
|
|
567
|
-
j ? "Loading…" : `${
|
|
567
|
+
/* @__PURE__ */ t("span", { "data-chat-admin-total": T, children: [
|
|
568
|
+
j ? "Loading…" : `${T.toLocaleString()} message${T === 1 ? "" : "s"}`,
|
|
568
569
|
le && !j && " · updating…"
|
|
569
570
|
] }),
|
|
570
571
|
L > 1 && /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
|
|
@@ -573,7 +574,7 @@ function fe({
|
|
|
573
574
|
{
|
|
574
575
|
type: "button",
|
|
575
576
|
disabled: M <= 1,
|
|
576
|
-
onClick: () =>
|
|
577
|
+
onClick: () => F((l) => l - 1),
|
|
577
578
|
className: "rounded p-1 hover:bg-slate-100 disabled:opacity-40 dark:hover:bg-muted",
|
|
578
579
|
"aria-label": "Previous page",
|
|
579
580
|
children: /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5" })
|
|
@@ -589,7 +590,7 @@ function fe({
|
|
|
589
590
|
{
|
|
590
591
|
type: "button",
|
|
591
592
|
disabled: M >= L,
|
|
592
|
-
onClick: () =>
|
|
593
|
+
onClick: () => F((l) => l + 1),
|
|
593
594
|
className: "rounded p-1 hover:bg-slate-100 disabled:opacity-40 dark:hover:bg-muted",
|
|
594
595
|
"aria-label": "Next page",
|
|
595
596
|
children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
|
|
@@ -658,7 +659,7 @@ function fe({
|
|
|
658
659
|
] })
|
|
659
660
|
] }),
|
|
660
661
|
D != null && /* @__PURE__ */ e(
|
|
661
|
-
|
|
662
|
+
ye,
|
|
662
663
|
{
|
|
663
664
|
id: D,
|
|
664
665
|
onClose: () => R(null),
|
|
@@ -672,13 +673,13 @@ function fe({
|
|
|
672
673
|
)
|
|
673
674
|
] });
|
|
674
675
|
}
|
|
675
|
-
function g({ label:
|
|
676
|
+
function g({ label: s, children: i }) {
|
|
676
677
|
return /* @__PURE__ */ t("div", { className: "grid grid-cols-[104px_minmax(0,1fr)] gap-2 py-1 text-[12.5px]", children: [
|
|
677
|
-
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-slate-400", children:
|
|
678
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-slate-400", children: s }),
|
|
678
679
|
/* @__PURE__ */ e("dd", { className: "min-w-0 text-slate-800 dark:text-slate-100", children: i })
|
|
679
680
|
] });
|
|
680
681
|
}
|
|
681
|
-
function B({ m:
|
|
682
|
+
function B({ m: s, target: i }) {
|
|
682
683
|
return /* @__PURE__ */ t(
|
|
683
684
|
"div",
|
|
684
685
|
{
|
|
@@ -686,26 +687,26 @@ function B({ m: r, target: i }) {
|
|
|
686
687
|
"rounded-md px-2.5 py-1.5",
|
|
687
688
|
i ? "bg-[#f2fdff] ring-1 ring-nvr-cyan/50 dark:bg-[#20303a]" : ""
|
|
688
689
|
),
|
|
689
|
-
"data-chat-admin-context":
|
|
690
|
+
"data-chat-admin-context": s.id,
|
|
690
691
|
children: [
|
|
691
692
|
/* @__PURE__ */ t("p", { className: "flex items-baseline gap-2 text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
692
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-slate-200", children:
|
|
693
|
-
/* @__PURE__ */ e("span", { className: "tabular-nums", children: f(
|
|
694
|
-
|
|
693
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-700 dark:text-slate-200", children: s.sender_name ?? "Unknown" }),
|
|
694
|
+
/* @__PURE__ */ e("span", { className: "tabular-nums", children: f(s.date_created) }),
|
|
695
|
+
s.edited_at && /* @__PURE__ */ e("span", { children: "edited" })
|
|
695
696
|
] }),
|
|
696
|
-
/* @__PURE__ */ e("p", { className: "whitespace-pre-wrap break-words text-[12.5px] text-slate-800 dark:text-slate-100", children:
|
|
697
|
+
/* @__PURE__ */ e("p", { className: "whitespace-pre-wrap break-words text-[12.5px] text-slate-800 dark:text-slate-100", children: s.deleted_at ? /* @__PURE__ */ e("em", { className: "text-slate-500 dark:text-slate-400", children: "Deleted" }) : s.message || "—" })
|
|
697
698
|
]
|
|
698
699
|
}
|
|
699
700
|
);
|
|
700
701
|
}
|
|
701
|
-
function
|
|
702
|
-
id:
|
|
702
|
+
function ye({
|
|
703
|
+
id: s,
|
|
703
704
|
onClose: i,
|
|
704
705
|
onRoom: o
|
|
705
706
|
}) {
|
|
706
|
-
const h = z(), { apiBase:
|
|
707
|
-
queryKey: ["nvr-chat-admin-message",
|
|
708
|
-
queryFn: () => h.request(A(`/chat/admin/messages/${
|
|
707
|
+
const h = z(), { apiBase: r } = be(), { data: a, isLoading: p, isError: u } = K({
|
|
708
|
+
queryKey: ["nvr-chat-admin-message", s],
|
|
709
|
+
queryFn: () => h.request(A(`/chat/admin/messages/${s}`)).then((n) => n.data)
|
|
709
710
|
}), c = (a == null ? void 0 : a.reads.filter(
|
|
710
711
|
(n) => !n.read && n.user.toUpperCase() !== String(a.message.sender ?? "").toUpperCase()
|
|
711
712
|
)) ?? [], m = (a == null ? void 0 : a.reads.filter(
|
|
@@ -715,12 +716,12 @@ function ve({
|
|
|
715
716
|
"aside",
|
|
716
717
|
{
|
|
717
718
|
className: "min-w-0 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card xl:sticky xl:top-0 xl:max-h-[calc(100vh-180px)] xl:overflow-y-auto",
|
|
718
|
-
"data-chat-admin-detail":
|
|
719
|
+
"data-chat-admin-detail": s,
|
|
719
720
|
children: [
|
|
720
721
|
/* @__PURE__ */ t("div", { className: "flex items-center justify-between border-b border-slate-100 px-4 py-2.5 dark:border-border/60", children: [
|
|
721
722
|
/* @__PURE__ */ t("p", { className: "text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: [
|
|
722
723
|
"Message #",
|
|
723
|
-
|
|
724
|
+
s
|
|
724
725
|
] }),
|
|
725
726
|
/* @__PURE__ */ e(
|
|
726
727
|
"button",
|
|
@@ -787,7 +788,7 @@ function ve({
|
|
|
787
788
|
/* @__PURE__ */ t(
|
|
788
789
|
"a",
|
|
789
790
|
{
|
|
790
|
-
href: `${
|
|
791
|
+
href: `${r}/files/${n.id}?download=1`,
|
|
791
792
|
className: "inline-flex items-center gap-1 hover:underline",
|
|
792
793
|
target: "_blank",
|
|
793
794
|
rel: "noreferrer",
|
|
@@ -862,7 +863,7 @@ function ve({
|
|
|
862
863
|
/* @__PURE__ */ t(
|
|
863
864
|
"a",
|
|
864
865
|
{
|
|
865
|
-
href: `${
|
|
866
|
+
href: `${r}/files/${x.id}?download=1`,
|
|
866
867
|
className: "inline-flex items-center gap-1 hover:underline",
|
|
867
868
|
target: "_blank",
|
|
868
869
|
rel: "noreferrer",
|
|
@@ -914,39 +915,40 @@ function ve({
|
|
|
914
915
|
}
|
|
915
916
|
);
|
|
916
917
|
}
|
|
917
|
-
function
|
|
918
|
-
const [
|
|
918
|
+
function je() {
|
|
919
|
+
const [s, i] = b("overview"), [o, h] = b(null);
|
|
919
920
|
return /* @__PURE__ */ t("div", { className: "space-y-4", "data-chat-analytics": !0, children: [
|
|
920
921
|
/* @__PURE__ */ e(ue, {}),
|
|
921
922
|
/* @__PURE__ */ e("div", { className: "flex gap-1 border-b border-slate-200 dark:border-border", role: "tablist", children: [
|
|
922
923
|
["overview", "Overview"],
|
|
923
|
-
["messages", "Messages"]
|
|
924
|
-
|
|
924
|
+
["messages", "Messages"],
|
|
925
|
+
["channels", "Channels"]
|
|
926
|
+
].map(([r, a]) => /* @__PURE__ */ e(
|
|
925
927
|
"button",
|
|
926
928
|
{
|
|
927
929
|
type: "button",
|
|
928
930
|
role: "tab",
|
|
929
|
-
"aria-selected":
|
|
930
|
-
onClick: () => i(
|
|
931
|
+
"aria-selected": s === r,
|
|
932
|
+
onClick: () => i(r),
|
|
931
933
|
className: v(
|
|
932
934
|
"-mb-px border-b-2 px-3 py-2 text-[13px] font-medium",
|
|
933
|
-
|
|
935
|
+
s === r ? "border-nvr-cyan text-slate-900 dark:text-slate-50" : "border-transparent text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-100"
|
|
934
936
|
),
|
|
935
|
-
"data-chat-analytics-tab":
|
|
937
|
+
"data-chat-analytics-tab": r,
|
|
936
938
|
children: a
|
|
937
939
|
},
|
|
938
|
-
|
|
940
|
+
r
|
|
939
941
|
)) }),
|
|
940
|
-
|
|
941
|
-
|
|
942
|
+
s === "overview" ? /* @__PURE__ */ e(
|
|
943
|
+
fe,
|
|
942
944
|
{
|
|
943
|
-
onOpenRoom: (
|
|
944
|
-
h({ room:
|
|
945
|
+
onOpenRoom: (r, a) => {
|
|
946
|
+
h({ room: r, label: a }), i("messages");
|
|
945
947
|
}
|
|
946
948
|
}
|
|
947
|
-
) : /* @__PURE__ */ e(
|
|
949
|
+
) : s === "channels" ? /* @__PURE__ */ e(ge, {}) : /* @__PURE__ */ e(ve, { room: o, onRoomChange: h })
|
|
948
950
|
] });
|
|
949
951
|
}
|
|
950
952
|
export {
|
|
951
|
-
|
|
953
|
+
je as ChatAnalyticsView
|
|
952
954
|
};
|