@nivaro/react 0.3.113 → 0.3.115

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 (285) hide show
  1. package/dist/components/ScreenShareHost.js +24 -0
  2. package/dist/full.css +50 -2
  3. package/dist/hooks/useSessionRecorder.js +61 -60
  4. package/dist/index.d.ts +1727 -19
  5. package/dist/index.js +1091 -950
  6. package/dist/shared/components/ActivityEntry.js +209 -97
  7. package/dist/shared/components/AgentPresenceChip.js +51 -0
  8. package/dist/shared/components/AnnouncementBanner.js +56 -41
  9. package/dist/shared/components/AutolinkedText.js +98 -85
  10. package/dist/shared/components/BroadcastView.js +149 -141
  11. package/dist/shared/components/CacheStamp.js +78 -30
  12. package/dist/shared/components/CollectionBrowserView.js +4088 -3592
  13. package/dist/shared/components/ConfigChangeStrip.js +63 -0
  14. package/dist/shared/components/ConfigReachNote.js +107 -0
  15. package/dist/shared/components/ConformanceView.js +389 -319
  16. package/dist/shared/components/DataTable.js +544 -504
  17. package/dist/shared/components/DelegateCoverLine.js +164 -0
  18. package/dist/shared/components/EnvironmentNotice.js +56 -65
  19. package/dist/shared/components/FilePreviewLightbox.js +89 -43
  20. package/dist/shared/components/FindingFixedMark.js +23 -0
  21. package/dist/shared/components/GridPresenceLine.js +100 -0
  22. package/dist/shared/components/IdleReloadWatcher.js +82 -43
  23. package/dist/shared/components/InStep.js +46 -0
  24. package/dist/shared/components/ItemEditForm.js +5504 -4889
  25. package/dist/shared/components/LiveAnnouncer.js +62 -0
  26. package/dist/shared/components/LiveCount.js +54 -0
  27. package/dist/shared/components/LiveFigure.js +28 -0
  28. package/dist/shared/components/LiveListControls.js +114 -0
  29. package/dist/shared/components/LiveNewMatchesPill.js +25 -0
  30. package/dist/shared/components/LiveOffNote.js +44 -0
  31. package/dist/shared/components/LivePreferenceHost.js +42 -0
  32. package/dist/shared/components/LiveRowMark.js +25 -20
  33. package/dist/shared/components/LiveTraceView.js +257 -0
  34. package/dist/shared/components/MapView.js +30 -29
  35. package/dist/shared/components/MatrixEditor.js +497 -462
  36. package/dist/shared/components/MyWorkView.js +346 -272
  37. package/dist/shared/components/NotificationBell.js +215 -201
  38. package/dist/shared/components/PageRenderer.js +636 -599
  39. package/dist/shared/components/PresenceDot.js +21 -0
  40. package/dist/shared/components/ProfileView.js +656 -536
  41. package/dist/shared/components/RealtimeStatusBanner.js +25 -25
  42. package/dist/shared/components/RecentRecordsRail.js +51 -48
  43. package/dist/shared/components/RecordCompare.js +241 -150
  44. package/dist/shared/components/RecordDrilldownSheet.js +66 -64
  45. package/dist/shared/components/RecordGridEditor.js +350 -311
  46. package/dist/shared/components/RecordHoverCard.js +147 -0
  47. package/dist/shared/components/RecordPeekHost.js +111 -0
  48. package/dist/shared/components/RecordReadView.js +414 -412
  49. package/dist/shared/components/RelativeTime.js +16 -0
  50. package/dist/shared/components/ReportView.js +1396 -1304
  51. package/dist/shared/components/ScreenRefreshButton.js +77 -0
  52. package/dist/shared/components/TabCountHost.js +10 -0
  53. package/dist/shared/components/TickerNumber.js +19 -18
  54. package/dist/shared/components/TipLayer.js +70 -58
  55. package/dist/shared/components/WidgetImageMenu.js +59 -0
  56. package/dist/shared/components/WidgetSlot.js +571 -524
  57. package/dist/shared/components/activity/RecordActivityStream.js +317 -0
  58. package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
  59. package/dist/shared/components/cbv/approval-changed.js +20 -0
  60. package/dist/shared/components/cbv/changed-by-others.js +251 -0
  61. package/dist/shared/components/cbv/column-totals.js +75 -67
  62. package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
  63. package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
  64. package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
  65. package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
  66. package/dist/shared/components/change-proposals/types.js +4 -0
  67. package/dist/shared/components/chat/ChatPanel.js +1571 -1528
  68. package/dist/shared/components/chat/Composer.js +276 -298
  69. package/dist/shared/components/chat/room-due.js +13 -0
  70. package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
  71. package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
  72. package/dist/shared/components/collections-directory/directory-data.js +75 -63
  73. package/dist/shared/components/imports/ImportConsole.js +159 -155
  74. package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
  75. package/dist/shared/components/integrations/SendStatus.js +202 -0
  76. package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
  77. package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
  78. package/dist/shared/components/integrations/console/api.js +161 -117
  79. package/dist/shared/components/integrations/console/tone.js +15 -12
  80. package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
  81. package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
  82. package/dist/shared/components/item-edit/CloneDialog.js +208 -206
  83. package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
  84. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
  85. package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
  86. package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
  87. package/dist/shared/components/item-edit/FieldComments.js +159 -116
  88. package/dist/shared/components/item-edit/FieldPointer.js +132 -0
  89. package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
  90. package/dist/shared/components/item-edit/FieldRow.js +519 -439
  91. package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
  92. package/dist/shared/components/item-edit/FilePickerField.js +454 -369
  93. package/dist/shared/components/item-edit/GroupSection.js +618 -567
  94. package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
  95. package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
  96. package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
  97. package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
  98. package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
  99. package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
  100. package/dist/shared/components/item-edit/PickerBadges.js +52 -0
  101. package/dist/shared/components/item-edit/PlanGrid.js +434 -439
  102. package/dist/shared/components/item-edit/RecalcValue.js +55 -0
  103. package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
  104. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
  105. package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
  106. package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
  107. package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
  108. package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
  109. package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
  110. package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
  111. package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
  112. package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
  113. package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
  114. package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
  115. package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
  116. package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
  117. package/dist/shared/components/item-edit/SectionPresence.js +78 -0
  118. package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
  119. package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
  120. package/dist/shared/components/item-edit/coedit/collab.js +84 -0
  121. package/dist/shared/components/item-edit/coedit/context.js +24 -0
  122. package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
  123. package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
  124. package/dist/shared/components/item-edit/coedit/session.js +382 -0
  125. package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
  126. package/dist/shared/components/item-edit/file-live.js +77 -0
  127. package/dist/shared/components/item-edit/file-processing.js +87 -0
  128. package/dist/shared/components/item-edit/layout-switch.js +148 -0
  129. package/dist/shared/components/item-edit/live-related.js +23 -0
  130. package/dist/shared/components/item-edit/live-title.js +66 -0
  131. package/dist/shared/components/item-edit/partner-needs.js +142 -0
  132. package/dist/shared/components/item-edit/removed-line.js +58 -0
  133. package/dist/shared/components/item-edit/render-stability.js +70 -59
  134. package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
  135. package/dist/shared/components/layout-editor/CollabParts.js +72 -70
  136. package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
  137. package/dist/shared/components/list/InlineEdit.js +504 -208
  138. package/dist/shared/components/list/ListViewers.js +81 -0
  139. package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
  140. package/dist/shared/components/merge/MergeWithFlow.js +290 -0
  141. package/dist/shared/components/merge/merge-values.js +110 -0
  142. package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
  143. package/dist/shared/components/notifications/NotificationCenterView.js +388 -321
  144. package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
  145. package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
  146. package/dist/shared/components/notifications/bundles.js +21 -19
  147. package/dist/shared/components/notifications/resolved-line.js +25 -0
  148. package/dist/shared/components/ops/OpsTasksView.js +45 -44
  149. package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
  150. package/dist/shared/components/panels/AlertBanners.js +132 -0
  151. package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
  152. package/dist/shared/components/panels/BranchLanes.js +82 -54
  153. package/dist/shared/components/panels/CommentAwareness.js +332 -0
  154. package/dist/shared/components/panels/CommentImages.js +219 -0
  155. package/dist/shared/components/panels/CommentPanel.js +649 -530
  156. package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
  157. package/dist/shared/components/panels/NewSinceChip.js +16 -0
  158. package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
  159. package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
  160. package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
  161. package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
  162. package/dist/shared/components/panels/SlaClock.js +130 -99
  163. package/dist/shared/components/panels/TaskPanel.js +308 -287
  164. package/dist/shared/components/panels/unseen-move-check.js +101 -0
  165. package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
  166. package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
  167. package/dist/shared/components/pipeline/PipelineEditorView.js +1855 -1771
  168. package/dist/shared/components/profile/AgentNameField.js +141 -0
  169. package/dist/shared/components/profile/AgentsPanel.js +55 -46
  170. package/dist/shared/components/profile/PersonAccess.js +398 -330
  171. package/dist/shared/components/profile/PersonAdminTools.js +127 -113
  172. package/dist/shared/components/profile/PersonProfile.js +81 -73
  173. package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
  174. package/dist/shared/components/queue/QueueBulkBar.js +101 -84
  175. package/dist/shared/components/queue/QueueItemSheet.js +66 -66
  176. package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
  177. package/dist/shared/components/queue/QueueWorklist.js +2076 -1686
  178. package/dist/shared/components/queue/queue-totals.js +92 -0
  179. package/dist/shared/components/queue/worklist-helpers.js +18 -14
  180. package/dist/shared/components/send-view/SendViewButton.js +136 -0
  181. package/dist/shared/components/send-view/SentViewCards.js +147 -0
  182. package/dist/shared/components/support/ReportProblem.js +1 -0
  183. package/dist/shared/components/support/ScreenShare.js +554 -0
  184. package/dist/shared/components/support/SupportView.js +160 -129
  185. package/dist/shared/components/support/TicketDetailSheet.js +101 -89
  186. package/dist/shared/components/watch-list/WatchDock.js +1044 -0
  187. package/dist/shared/components/watch-list/WatchExtras.js +723 -0
  188. package/dist/shared/components/watch-list/WatchListButton.js +46 -0
  189. package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
  190. package/dist/shared/components/watch-list/WatchRows.js +348 -0
  191. package/dist/shared/lib/activity-sentence.js +87 -75
  192. package/dist/shared/lib/agent-presence.js +46 -0
  193. package/dist/shared/lib/approval-progress.js +49 -0
  194. package/dist/shared/lib/attention-prefs.js +27 -0
  195. package/dist/shared/lib/cell-locks.js +56 -0
  196. package/dist/shared/lib/co-edit.js +166 -0
  197. package/dist/shared/lib/coedit-registry.js +44 -0
  198. package/dist/shared/lib/comment-awareness.js +124 -0
  199. package/dist/shared/lib/comment-images.js +45 -0
  200. package/dist/shared/lib/config-watch.js +94 -0
  201. package/dist/shared/lib/copy-rules.js +65 -0
  202. package/dist/shared/lib/count-step.js +30 -0
  203. package/dist/shared/lib/deadline-ticker.js +68 -0
  204. package/dist/shared/lib/derived-causes.js +115 -0
  205. package/dist/shared/lib/draft-store.js +114 -85
  206. package/dist/shared/lib/error-hints.js +1 -0
  207. package/dist/shared/lib/field-merge.js +126 -0
  208. package/dist/shared/lib/filter-sentence.js +10 -10
  209. package/dist/shared/lib/focus-mode.js +16 -12
  210. package/dist/shared/lib/grid-cursors.js +77 -0
  211. package/dist/shared/lib/grid-presence.js +182 -0
  212. package/dist/shared/lib/idle-reload.js +100 -73
  213. package/dist/shared/lib/in-step.js +45 -0
  214. package/dist/shared/lib/integration-chip.js +19 -18
  215. package/dist/shared/lib/line-locks.js +141 -0
  216. package/dist/shared/lib/line-split.js +41 -0
  217. package/dist/shared/lib/linked-changes.js +150 -0
  218. package/dist/shared/lib/list-link.js +56 -50
  219. package/dist/shared/lib/list-return.js +231 -0
  220. package/dist/shared/lib/list-viewers.js +52 -0
  221. package/dist/shared/lib/live-announcer.js +86 -0
  222. package/dist/shared/lib/live-counts.js +85 -0
  223. package/dist/shared/lib/live-data-changed.js +108 -0
  224. package/dist/shared/lib/live-deltas.js +81 -0
  225. package/dist/shared/lib/live-findings.js +113 -0
  226. package/dist/shared/lib/live-groups.js +122 -0
  227. package/dist/shared/lib/live-link-labels.js +162 -0
  228. package/dist/shared/lib/live-list-flow.js +334 -0
  229. package/dist/shared/lib/live-list.js +143 -129
  230. package/dist/shared/lib/live-moves.js +51 -0
  231. package/dist/shared/lib/live-ops.js +26 -26
  232. package/dist/shared/lib/live-pickers.js +7 -0
  233. package/dist/shared/lib/live-preference.js +184 -0
  234. package/dist/shared/lib/live-queries.js +226 -181
  235. package/dist/shared/lib/live-screen.js +333 -0
  236. package/dist/shared/lib/live-search.js +108 -0
  237. package/dist/shared/lib/live-seen.js +35 -0
  238. package/dist/shared/lib/live-views.js +100 -0
  239. package/dist/shared/lib/live.js +159 -133
  240. package/dist/shared/lib/missed-updates.js +198 -0
  241. package/dist/shared/lib/newer-file.js +56 -0
  242. package/dist/shared/lib/notification-sound.js +42 -20
  243. package/dist/shared/lib/own-writes.js +59 -41
  244. package/dist/shared/lib/picker-badges.js +94 -0
  245. package/dist/shared/lib/presence-signals.js +131 -84
  246. package/dist/shared/lib/realtime.js +49 -24
  247. package/dist/shared/lib/record-gaps.js +85 -0
  248. package/dist/shared/lib/record-outbox.js +369 -222
  249. package/dist/shared/lib/record-peek.js +75 -0
  250. package/dist/shared/lib/record-tabs.js +92 -72
  251. package/dist/shared/lib/relative-ticker.js +42 -0
  252. package/dist/shared/lib/request-gate.js +119 -119
  253. package/dist/shared/lib/rollup-recalc.js +107 -0
  254. package/dist/shared/lib/room-gaps.js +40 -36
  255. package/dist/shared/lib/rum.js +137 -87
  256. package/dist/shared/lib/save-progress.js +20 -0
  257. package/dist/shared/lib/scheduled-countdown.js +67 -0
  258. package/dist/shared/lib/screen-refresh.js +160 -0
  259. package/dist/shared/lib/screen-share.js +234 -0
  260. package/dist/shared/lib/seen-since.js +74 -0
  261. package/dist/shared/lib/selection-watch.js +205 -0
  262. package/dist/shared/lib/send-status.js +132 -0
  263. package/dist/shared/lib/send-view.js +23 -0
  264. package/dist/shared/lib/socket-liveness.js +155 -0
  265. package/dist/shared/lib/socket-realtime.js +168 -140
  266. package/dist/shared/lib/state-census.js +53 -0
  267. package/dist/shared/lib/summary-mode.js +61 -39
  268. package/dist/shared/lib/tab-attention.js +143 -32
  269. package/dist/shared/lib/table-density.js +64 -0
  270. package/dist/shared/lib/track-travel.js +40 -0
  271. package/dist/shared/lib/unseen-changes.js +68 -0
  272. package/dist/shared/lib/upload-file.js +33 -0
  273. package/dist/shared/lib/upload-presence.js +127 -0
  274. package/dist/shared/lib/urgent-chime.js +65 -0
  275. package/dist/shared/lib/use-online-users.js +32 -11
  276. package/dist/shared/lib/user-sync.js +155 -39
  277. package/dist/shared/lib/waiting-count.js +44 -0
  278. package/dist/shared/lib/watch-desktop.js +83 -0
  279. package/dist/shared/lib/watch-list.js +447 -0
  280. package/dist/shared/lib/widget-image-render.js +64 -0
  281. package/dist/shared/lib/widget-image.js +111 -0
  282. package/dist/shared/lib/worker-socket.js +130 -104
  283. package/dist/shared/lib/write-to-screen.js +133 -0
  284. package/package.json +1 -1
  285. package/styles.css +49 -1
@@ -0,0 +1,257 @@
1
+ import { jsxs as r, jsx as e, Fragment as u } from "react/jsx-runtime";
2
+ import { useQuery as T } from "@tanstack/react-query";
3
+ import { Loader2 as y, RefreshCw as $, CheckCircle2 as v, TriangleAlert as j, CircleDashed as q } from "lucide-react";
4
+ import { useState as C, useMemo as k } from "react";
5
+ import { useNivaroClient as R } from "../context.js";
6
+ import { get as A } from "../lib/commands.js";
7
+ import { cn as W } from "../lib/utils.js";
8
+ import { ErrorNotice as E } from "./ErrorNotice.js";
9
+ import { SimpleSelectXs as D } from "./ui/SimpleSelect.js";
10
+ const F = [
11
+ { value: "15", label: "Last 15 minutes", minutes: 15 },
12
+ { value: "60", label: "Last hour", minutes: 60 },
13
+ { value: "360", label: "Last 6 hours", minutes: 360 },
14
+ { value: "1440", label: "Last 24 hours", minutes: 1440 }
15
+ ], O = {
16
+ activity: "Saved through the app",
17
+ "raw-pending": "Waiting to be announced",
18
+ "row-timestamp": "Row changed, no activity entry"
19
+ };
20
+ function b(s) {
21
+ const l = new Date(s);
22
+ return Number.isNaN(l.getTime()) ? s : l.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit", second: "2-digit" });
23
+ }
24
+ function n({ children: s }) {
25
+ return /* @__PURE__ */ e("th", { className: "px-2 py-1 text-left text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: s });
26
+ }
27
+ function o({
28
+ title: s,
29
+ count: l,
30
+ children: c
31
+ }) {
32
+ return /* @__PURE__ */ r("section", { className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
33
+ /* @__PURE__ */ r("header", { className: "flex items-center gap-2 border-b border-slate-100 px-3 py-2 dark:border-border/60", children: [
34
+ /* @__PURE__ */ e("h4", { className: "text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: s }),
35
+ l != null && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 text-[10.5px] tabular-nums text-slate-600 dark:bg-slate-800 dark:text-slate-300", children: l })
36
+ ] }),
37
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: c })
38
+ ] });
39
+ }
40
+ function X({
41
+ collection: s,
42
+ item: l,
43
+ userId: c,
44
+ className: f
45
+ }) {
46
+ var g;
47
+ const w = R(), [m, S] = C("60"), N = !!s && l != null && String(l) !== "", _ = [
48
+ "nvr-live-trace",
49
+ s ?? null,
50
+ l == null ? null : String(l),
51
+ c ?? null,
52
+ m
53
+ ], i = T({
54
+ queryKey: _,
55
+ queryFn: () => {
56
+ const t = /* @__PURE__ */ new Date(), d = new Date(t.getTime() - Number(m) * 6e4), h = new URLSearchParams({ from: d.toISOString(), to: t.toISOString() });
57
+ return N ? (h.set("collection", String(s)), h.set("item", String(l))) : c && h.set("user", c), w.request(A(`/realtime/trace?${h.toString()}`)).then((L) => L.data);
58
+ },
59
+ enabled: N || !!c,
60
+ staleTime: 0,
61
+ retry: !1
62
+ }), a = i.data, p = k(
63
+ () => [...(a == null ? void 0 : a.writes) ?? []].sort((t, d) => d.at.localeCompare(t.at)),
64
+ [a == null ? void 0 : a.writes]
65
+ ), x = k(() => [...(a == null ? void 0 : a.events) ?? []].sort((t, d) => d.seq - t.seq), [a == null ? void 0 : a.events]);
66
+ return /* @__PURE__ */ r("div", { className: W("space-y-3", f), "data-live-trace": !0, children: [
67
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
68
+ /* @__PURE__ */ e(
69
+ D,
70
+ {
71
+ value: m,
72
+ onChange: S,
73
+ ariaLabel: "Time window",
74
+ options: F.map((t) => ({ value: t.value, label: t.label }))
75
+ }
76
+ ),
77
+ /* @__PURE__ */ r(
78
+ "button",
79
+ {
80
+ type: "button",
81
+ onClick: () => void i.refetch(),
82
+ disabled: i.isFetching,
83
+ className: "inline-flex h-6 items-center gap-1 rounded border border-slate-200 bg-white px-2 text-[11px] text-slate-600 hover:bg-muted disabled:opacity-60 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-200",
84
+ children: [
85
+ i.isFetching ? /* @__PURE__ */ e(y, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ e($, { className: "h-3 w-3" }),
86
+ "Run again"
87
+ ]
88
+ }
89
+ ),
90
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "Read-only. Shows ids, field names and times, never values." })
91
+ ] }),
92
+ i.isError && /* @__PURE__ */ e(E, { error: i.error, what: "the trace", onRetry: () => void i.refetch() }),
93
+ i.isLoading && /* @__PURE__ */ r("div", { className: "flex items-center gap-2 text-[12px] text-slate-500", "aria-busy": "true", children: [
94
+ /* @__PURE__ */ e(y, { className: "h-3.5 w-3.5 animate-spin" }),
95
+ " Tracing…"
96
+ ] }),
97
+ a && /* @__PURE__ */ r(u, { children: [
98
+ /* @__PURE__ */ r(
99
+ "section",
100
+ {
101
+ "data-live-trace-findings": !0,
102
+ className: "rounded-lg border border-slate-200 bg-slate-50 p-3 dark:border-border dark:bg-slate-900/40",
103
+ children: [
104
+ /* @__PURE__ */ e("h4", { className: "mb-1.5 text-[12.5px] font-semibold text-slate-800 dark:text-slate-100", children: "What this says" }),
105
+ a.findings.length === 0 ? /* @__PURE__ */ r("p", { className: "flex items-center gap-1.5 text-[12px] text-emerald-700 dark:text-emerald-400", children: [
106
+ /* @__PURE__ */ e(v, { className: "h-3.5 w-3.5" }),
107
+ " Every write in this window has a live event and nothing is waiting."
108
+ ] }) : /* @__PURE__ */ e("ul", { className: "space-y-1", children: a.findings.map((t) => /* @__PURE__ */ r(
109
+ "li",
110
+ {
111
+ className: "flex gap-1.5 text-[12px] text-slate-700 dark:text-slate-200",
112
+ children: [
113
+ /* @__PURE__ */ e(j, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400" }),
114
+ /* @__PURE__ */ e("span", { children: t })
115
+ ]
116
+ },
117
+ t
118
+ )) })
119
+ ]
120
+ }
121
+ ),
122
+ a.mode === "record" ? /* @__PURE__ */ r(u, { children: [
123
+ /* @__PURE__ */ e(o, { title: "Writes", count: p.length, children: p.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: "No writes in this window." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px]", "data-live-trace-writes": !0, children: [
124
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
125
+ /* @__PURE__ */ e(n, { children: "Time" }),
126
+ /* @__PURE__ */ e(n, { children: "How" }),
127
+ /* @__PURE__ */ e(n, { children: "Action" }),
128
+ /* @__PURE__ */ e(n, { children: "Live event" })
129
+ ] }) }),
130
+ /* @__PURE__ */ e("tbody", { children: p.map((t) => /* @__PURE__ */ r(
131
+ "tr",
132
+ {
133
+ className: "border-t border-slate-100 dark:border-border/60",
134
+ children: [
135
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 tabular-nums", children: b(t.at) }),
136
+ /* @__PURE__ */ r("td", { className: "px-2 py-1", children: [
137
+ O[t.kind],
138
+ t.kind === "raw-pending" && t.by ? ` (${t.by})` : ""
139
+ ] }),
140
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.action ?? "—" }),
141
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.kind === "raw-pending" ? /* @__PURE__ */ e("span", { className: "text-amber-700 dark:text-amber-400", children: "not sent yet" }) : t.announced ? /* @__PURE__ */ r("span", { className: "text-emerald-700 dark:text-emerald-400", children: [
142
+ "sent (#",
143
+ t.matched_seq,
144
+ ")"
145
+ ] }) : /* @__PURE__ */ e("span", { className: "font-medium text-red-700 dark:text-red-400", children: "never announced" }) })
146
+ ]
147
+ },
148
+ `${t.kind}-${t.at}-${t.matched_seq ?? ""}-${t.by ?? ""}`
149
+ )) })
150
+ ] }) }),
151
+ /* @__PURE__ */ e(o, { title: "Who is subscribed now", count: a.subscribers.length, children: a.subscribers.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: "Nobody is in this record's live room right now." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px]", "data-live-trace-subscribers": !0, children: [
152
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
153
+ /* @__PURE__ */ e(n, { children: "Person" }),
154
+ /* @__PURE__ */ e(n, { children: "Connections" }),
155
+ /* @__PURE__ */ e(n, { children: "Listening to" }),
156
+ /* @__PURE__ */ e(n, { children: "Acknowledged" })
157
+ ] }) }),
158
+ /* @__PURE__ */ e("tbody", { children: a.subscribers.map((t) => /* @__PURE__ */ r(
159
+ "tr",
160
+ {
161
+ className: "border-t border-slate-100 dark:border-border/60",
162
+ children: [
163
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.name }),
164
+ /* @__PURE__ */ r("td", { className: "px-2 py-1 tabular-nums", children: [
165
+ t.sockets,
166
+ t.apps.length ? ` (${t.apps.join(", ")})` : ""
167
+ ] }),
168
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.via.map((d) => d === "record" ? "this record" : "the whole list").join(" + ") }),
169
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.acked ? /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 text-emerald-700 dark:text-emerald-400", children: [
170
+ /* @__PURE__ */ e(v, { className: "h-3 w-3" }),
171
+ " ",
172
+ t.acked_events,
173
+ " event",
174
+ t.acked_events === 1 ? "" : "s"
175
+ ] }) : /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 text-slate-500", children: [
176
+ /* @__PURE__ */ e(q, { className: "h-3 w-3" }),
177
+ " none"
178
+ ] }) })
179
+ ]
180
+ },
181
+ t.user_id ?? t.name
182
+ )) })
183
+ ] }) })
184
+ ] }) : /* @__PURE__ */ r(u, { children: [
185
+ /* @__PURE__ */ e(o, { title: "Live connections", count: ((g = a.person) == null ? void 0 : g.sockets.length) ?? 0, children: !a.person || a.person.sockets.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: "No live connection from this person right now." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px]", "data-live-trace-sockets": !0, children: [
186
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
187
+ /* @__PURE__ */ e(n, { children: "Connection" }),
188
+ /* @__PURE__ */ e(n, { children: "App" }),
189
+ /* @__PURE__ */ e(n, { children: "Transport" }),
190
+ /* @__PURE__ */ e(n, { children: "Since" }),
191
+ /* @__PURE__ */ e(n, { children: "Rooms" })
192
+ ] }) }),
193
+ /* @__PURE__ */ e("tbody", { children: a.person.sockets.map((t) => /* @__PURE__ */ r("tr", { className: "border-t border-slate-100 dark:border-border/60", children: [
194
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 font-mono", children: t.id }),
195
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.app ?? "—" }),
196
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.transport ?? "—" }),
197
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 tabular-nums", children: t.connected_at ? b(t.connected_at) : "—" }),
198
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.rooms_total })
199
+ ] }, t.id)) })
200
+ ] }) }),
201
+ /* @__PURE__ */ e(o, { title: "Events sent to their rooms", count: a.rooms.length, children: a.rooms.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: "Nothing was emitted to the rooms they are in during this window." }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px]", children: [
202
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
203
+ /* @__PURE__ */ e(n, { children: "Room" }),
204
+ /* @__PURE__ */ e(n, { children: "Events" })
205
+ ] }) }),
206
+ /* @__PURE__ */ e("tbody", { children: a.rooms.slice(0, 40).map((t) => /* @__PURE__ */ r(
207
+ "tr",
208
+ {
209
+ className: "border-t border-slate-100 dark:border-border/60",
210
+ children: [
211
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 font-mono", children: t.room }),
212
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 tabular-nums", children: t.events })
213
+ ]
214
+ },
215
+ t.room
216
+ )) })
217
+ ] }) })
218
+ ] }),
219
+ /* @__PURE__ */ e(o, { title: "Live events sent", count: x.length, children: a.journal.available ? x.length === 0 ? /* @__PURE__ */ r("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: [
220
+ "No event in this window (the journal keeps ",
221
+ a.journal.retention_hours,
222
+ " hours)."
223
+ ] }) : /* @__PURE__ */ r("table", { className: "w-full text-[12px]", "data-live-trace-events": !0, children: [
224
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { children: [
225
+ /* @__PURE__ */ e(n, { children: "#" }),
226
+ /* @__PURE__ */ e(n, { children: "Time" }),
227
+ /* @__PURE__ */ e(n, { children: "Action" }),
228
+ /* @__PURE__ */ e(n, { children: "Fields" }),
229
+ /* @__PURE__ */ e(n, { children: "Acknowledged by" })
230
+ ] }) }),
231
+ /* @__PURE__ */ e("tbody", { children: x.slice(0, 100).map((t) => /* @__PURE__ */ r("tr", { className: "border-t border-slate-100 dark:border-border/60", children: [
232
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 tabular-nums text-slate-500", children: t.seq }),
233
+ /* @__PURE__ */ e("td", { className: "px-2 py-1 tabular-nums", children: b(t.at) }),
234
+ /* @__PURE__ */ r("td", { className: "px-2 py-1", children: [
235
+ t.action ?? t.event,
236
+ t.item === "*" ? ` (${t.bulk ?? "many"} records)` : "",
237
+ t.source ? ` · ${t.source}` : ""
238
+ ] }),
239
+ /* @__PURE__ */ e("td", { className: "max-w-[260px] truncate px-2 py-1", title: t.fields.join(", "), children: t.fields.length ? t.fields.join(", ") : "—" }),
240
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: t.acked_by.length > 0 ? `${t.acked_by.length} ${t.acked_by.length === 1 ? "person" : "people"}` : /* @__PURE__ */ e("span", { className: "text-slate-400", children: "not sampled / none" }) })
241
+ ] }, t.seq)) })
242
+ ] }) : /* @__PURE__ */ e("p", { className: "px-3 py-3 text-[12px] text-slate-500", children: "The event journal is not on this instance." }) }),
243
+ /* @__PURE__ */ r("p", { className: "text-[11px] leading-relaxed text-slate-400", children: [
244
+ a.subscription_note,
245
+ " Acknowledged events: ",
246
+ a.ack.acked_events,
247
+ "; about 1 in",
248
+ " ",
249
+ a.ack.sampled_about_one_in || "—",
250
+ " events is sampled."
251
+ ] })
252
+ ] })
253
+ ] });
254
+ }
255
+ export {
256
+ X as LiveTraceView
257
+ };
@@ -1,52 +1,53 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import { useQuery as y } from "@tanstack/react-query";
3
- import { useMemo as N } from "react";
4
- import { useNivaroClient as $ } from "../context.js";
5
- import { get as v } from "../lib/commands.js";
1
+ import { jsx as $ } from "react/jsx-runtime";
2
+ import { useQuery as v } from "@tanstack/react-query";
3
+ import { useMemo as y } from "react";
4
+ import { useNivaroClient as L } from "../context.js";
5
+ import { get as N } from "../lib/commands.js";
6
6
  import { useLiveQueryRefresh as w } from "../lib/live-list.js";
7
- import { BaseMap as L } from "./BaseMap.js";
8
- function Q({
7
+ import { useListPaused as M } from "../lib/live-list-flow.js";
8
+ import { BaseMap as q } from "./BaseMap.js";
9
+ function k({
9
10
  collection: e,
10
- latField: i,
11
- lngField: m,
11
+ latField: m,
12
+ lngField: i,
12
13
  labelField: r,
13
- conditions: n,
14
- search: s,
14
+ conditions: s,
15
+ search: n,
15
16
  onOpen: p
16
17
  }) {
17
- const f = $(), { data: o = [], isLoading: a } = y({
18
- queryKey: ["map-view", e, i, m, n, s],
18
+ const f = L(), { data: u = [], isLoading: a } = v({
19
+ queryKey: ["map-view", e, m, i, s, n],
19
20
  queryFn: () => f.request(
20
- v(`/items/${e}`, {
21
+ N(`/items/${e}`, {
21
22
  limit: 1e3,
22
- fields: ["id", i, m, ...r ? [r] : []].join(","),
23
- ...n ? { conditions: n } : {},
24
- ...s ? { search: s } : {}
23
+ fields: ["id", m, i, ...r ? [r] : []].join(","),
24
+ ...s ? { conditions: s } : {},
25
+ ...n ? { search: n } : {}
25
26
  })
26
27
  ).then((t) => t.data ?? []),
27
28
  staleTime: 3e4
28
- });
29
- w(e, [["map-view", e]]);
30
- const u = N(
31
- () => o.map((t) => ({
29
+ }), g = M(`cbv:${e}`);
30
+ w(e, [["map-view", e]], { paused: g });
31
+ const o = y(
32
+ () => u.map((t) => ({
32
33
  id: String(t.id),
33
- lat: Number(t[i]),
34
- lng: Number(t[m]),
34
+ lat: Number(t[m]),
35
+ lng: Number(t[i]),
35
36
  label: r && t[r] != null ? String(t[r]) : `#${t.id}`
36
37
  })).filter(
37
38
  (t) => Number.isFinite(t.lat) && Number.isFinite(t.lng) && (t.lat !== 0 || t.lng !== 0)
38
39
  ),
39
- [o, i, m, r]
40
+ [u, m, i, r]
40
41
  );
41
- return /* @__PURE__ */ g(
42
- L,
42
+ return /* @__PURE__ */ $(
43
+ q,
43
44
  {
44
- pins: u,
45
+ pins: o,
45
46
  onPinClick: p,
46
- statusLine: `${a ? "Loading records…" : `${u.length} pinned${o.length >= 1e3 ? " (first 1,000)" : ""}`} · © OpenStreetMap`
47
+ statusLine: `${a ? "Loading records…" : `${o.length} pinned${u.length >= 1e3 ? " (first 1,000)" : ""}`} · © OpenStreetMap`
47
48
  }
48
49
  );
49
50
  }
50
51
  export {
51
- Q as MapView
52
+ k as MapView
52
53
  };