@nivaro/react 0.3.114 → 0.3.116
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/components/ScreenShareHost.js +24 -0
- package/dist/full.css +50 -2
- package/dist/hooks/useSessionRecorder.js +61 -60
- package/dist/index.d.ts +1728 -22
- package/dist/index.js +1091 -950
- package/dist/shared/components/ActivityEntry.js +209 -97
- package/dist/shared/components/AgentPresenceChip.js +51 -0
- package/dist/shared/components/AnnouncementBanner.js +56 -41
- package/dist/shared/components/AutolinkedText.js +98 -85
- package/dist/shared/components/BroadcastView.js +149 -141
- package/dist/shared/components/CacheStamp.js +78 -30
- package/dist/shared/components/CollectionBrowserView.js +4909 -4182
- package/dist/shared/components/ConfigChangeStrip.js +63 -0
- package/dist/shared/components/ConfigReachNote.js +107 -0
- package/dist/shared/components/ConformanceView.js +389 -319
- package/dist/shared/components/DataTable.js +612 -551
- package/dist/shared/components/DelegateCoverLine.js +164 -0
- package/dist/shared/components/EnvironmentNotice.js +56 -65
- package/dist/shared/components/FilePreviewLightbox.js +89 -43
- package/dist/shared/components/FindingFixedMark.js +23 -0
- package/dist/shared/components/GridPresenceLine.js +100 -0
- package/dist/shared/components/IdleReloadWatcher.js +82 -43
- package/dist/shared/components/InStep.js +46 -0
- package/dist/shared/components/ItemEditForm.js +5504 -4889
- package/dist/shared/components/LiveAnnouncer.js +62 -0
- package/dist/shared/components/LiveCount.js +54 -0
- package/dist/shared/components/LiveFigure.js +28 -0
- package/dist/shared/components/LiveListControls.js +114 -0
- package/dist/shared/components/LiveNewMatchesPill.js +25 -0
- package/dist/shared/components/LiveOffNote.js +44 -0
- package/dist/shared/components/LivePreferenceHost.js +42 -0
- package/dist/shared/components/LiveRowMark.js +25 -20
- package/dist/shared/components/LiveTraceView.js +257 -0
- package/dist/shared/components/MapView.js +30 -29
- package/dist/shared/components/MatrixEditor.js +497 -462
- package/dist/shared/components/MyWorkView.js +346 -272
- package/dist/shared/components/NotificationBell.js +215 -201
- package/dist/shared/components/OverflowRail.js +326 -0
- package/dist/shared/components/PageRenderer.js +636 -599
- package/dist/shared/components/PresenceDot.js +21 -0
- package/dist/shared/components/ProfileView.js +656 -536
- package/dist/shared/components/RealtimeStatusBanner.js +25 -25
- package/dist/shared/components/RecentRecordsRail.js +51 -48
- package/dist/shared/components/RecordCompare.js +241 -150
- package/dist/shared/components/RecordDrilldownSheet.js +66 -64
- package/dist/shared/components/RecordGridEditor.js +350 -311
- package/dist/shared/components/RecordHoverCard.js +147 -0
- package/dist/shared/components/RecordPeekHost.js +111 -0
- package/dist/shared/components/RecordReadView.js +414 -412
- package/dist/shared/components/RelativeTime.js +16 -0
- package/dist/shared/components/ReportView.js +1396 -1304
- package/dist/shared/components/ScreenRefreshButton.js +77 -0
- package/dist/shared/components/TabCountHost.js +10 -0
- package/dist/shared/components/TickerNumber.js +19 -18
- package/dist/shared/components/TipLayer.js +70 -58
- package/dist/shared/components/WidgetImageMenu.js +59 -0
- package/dist/shared/components/WidgetSlot.js +571 -524
- package/dist/shared/components/activity/RecordActivityStream.js +317 -0
- package/dist/shared/components/bulk/BulkSelectionNotices.js +220 -0
- package/dist/shared/components/cbv/approval-changed.js +20 -0
- package/dist/shared/components/cbv/changed-by-others.js +251 -0
- package/dist/shared/components/change-proposals/ChangeProposalsPanel.js +320 -0
- package/dist/shared/components/change-proposals/ProposalValue.js +28 -0
- package/dist/shared/components/change-proposals/ProposeChangeButton.js +44 -0
- package/dist/shared/components/change-proposals/ProposeChangeDialog.js +359 -0
- package/dist/shared/components/change-proposals/types.js +4 -0
- package/dist/shared/components/chat/ChatPanel.js +1571 -1528
- package/dist/shared/components/chat/Composer.js +276 -298
- package/dist/shared/components/chat/room-due.js +13 -0
- package/dist/shared/components/collections-directory/CollectionRow.js +76 -75
- package/dist/shared/components/collections-directory/CollectionsDirectory.js +415 -395
- package/dist/shared/components/collections-directory/directory-data.js +75 -63
- package/dist/shared/components/imports/ImportConsole.js +159 -155
- package/dist/shared/components/imports/ImportDuplicatesNotice.js +46 -31
- package/dist/shared/components/integrations/SendStatus.js +202 -0
- package/dist/shared/components/integrations/console/IntegrationsConsole.js +45 -36
- package/dist/shared/components/integrations/console/ReadyToSendView.js +453 -0
- package/dist/shared/components/integrations/console/SignalCard.js +84 -77
- package/dist/shared/components/integrations/console/api.js +161 -117
- package/dist/shared/components/integrations/console/tone.js +15 -12
- package/dist/shared/components/item-edit/CatalogPickerField.js +1353 -1245
- package/dist/shared/components/item-edit/ChangedAfterApprovalBadge.js +162 -0
- package/dist/shared/components/item-edit/CloneDialog.js +208 -206
- package/dist/shared/components/item-edit/DerivedCauseNote.js +57 -0
- package/dist/shared/components/item-edit/DraftRecoveryBanner.js +81 -70
- package/dist/shared/components/item-edit/DuplicateNotice.js +169 -101
- package/dist/shared/components/item-edit/FieldAffordances.js +294 -385
- package/dist/shared/components/item-edit/FieldComments.js +159 -116
- package/dist/shared/components/item-edit/FieldPointer.js +132 -0
- package/dist/shared/components/item-edit/FieldRenderer.js +277 -273
- package/dist/shared/components/item-edit/FieldRow.js +519 -439
- package/dist/shared/components/item-edit/FieldSourceBadge.js +88 -0
- package/dist/shared/components/item-edit/FilePickerField.js +454 -369
- package/dist/shared/components/item-edit/GroupSection.js +618 -567
- package/dist/shared/components/item-edit/HeldEditsChip.js +113 -0
- package/dist/shared/components/item-edit/InlineTableField.js +2891 -2723
- package/dist/shared/components/item-edit/ListNeighborNav.js +79 -0
- package/dist/shared/components/item-edit/LiveTraceSheet.js +26 -0
- package/dist/shared/components/item-edit/M2MCombobox.js +284 -273
- package/dist/shared/components/item-edit/OutboxReviewTray.js +313 -0
- package/dist/shared/components/item-edit/PickerBadges.js +52 -0
- package/dist/shared/components/item-edit/PlanGrid.js +434 -439
- package/dist/shared/components/item-edit/RecalcValue.js +55 -0
- package/dist/shared/components/item-edit/RecordChatActions.js +76 -64
- package/dist/shared/components/item-edit/RecordChatMentionsChip.js +103 -0
- package/dist/shared/components/item-edit/RecordGrantTools.js +87 -86
- package/dist/shared/components/item-edit/RecordHelpChip.js +70 -0
- package/dist/shared/components/item-edit/RecordLiveSync.js +230 -217
- package/dist/shared/components/item-edit/RecordOutbox.js +53 -52
- package/dist/shared/components/item-edit/RecordRecapStrip.js +109 -36
- package/dist/shared/components/item-edit/RelationCombobox.js +229 -217
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +105 -100
- package/dist/shared/components/item-edit/RemoteChangeUi.js +454 -0
- package/dist/shared/components/item-edit/RemoteUploads.js +55 -0
- package/dist/shared/components/item-edit/RemovedLineNote.js +92 -0
- package/dist/shared/components/item-edit/RichTextEditorImpl.js +298 -223
- package/dist/shared/components/item-edit/ScheduledChangeChip.js +244 -0
- package/dist/shared/components/item-edit/SectionPresence.js +78 -0
- package/dist/shared/components/item-edit/SplitLinesButton.js +166 -0
- package/dist/shared/components/item-edit/catalog-line-watch.js +94 -0
- package/dist/shared/components/item-edit/coedit/collab.js +84 -0
- package/dist/shared/components/item-edit/coedit/context.js +24 -0
- package/dist/shared/components/item-edit/coedit/cursors.js +103 -0
- package/dist/shared/components/item-edit/coedit/safe-link.js +15 -0
- package/dist/shared/components/item-edit/coedit/session.js +382 -0
- package/dist/shared/components/item-edit/coedit/useCoedit.js +49 -0
- package/dist/shared/components/item-edit/file-live.js +77 -0
- package/dist/shared/components/item-edit/file-processing.js +87 -0
- package/dist/shared/components/item-edit/layout-switch.js +148 -0
- package/dist/shared/components/item-edit/live-related.js +23 -0
- package/dist/shared/components/item-edit/live-title.js +66 -0
- package/dist/shared/components/item-edit/partner-needs.js +142 -0
- package/dist/shared/components/item-edit/removed-line.js +58 -0
- package/dist/shared/components/item-edit/render-stability.js +70 -59
- package/dist/shared/components/layout-editor/ChangeNote.js +36 -34
- package/dist/shared/components/layout-editor/CollabParts.js +72 -70
- package/dist/shared/components/layout-editor/LayoutEditor.js +306 -303
- package/dist/shared/components/list/InlineEdit.js +504 -208
- package/dist/shared/components/list/ListViewers.js +81 -0
- package/dist/shared/components/list/PhonePager.js +50 -0
- package/dist/shared/components/merge/MergeRecordsDialog.js +1227 -0
- package/dist/shared/components/merge/MergeWithFlow.js +290 -0
- package/dist/shared/components/merge/merge-values.js +110 -0
- package/dist/shared/components/monitoring/InactiveUserLinksView.js +285 -258
- package/dist/shared/components/notifications/NotificationCenterView.js +389 -323
- package/dist/shared/components/notifications/NotificationDetailBits.js +205 -130
- package/dist/shared/components/notifications/NotificationRulesEditor.js +72 -52
- package/dist/shared/components/notifications/bundles.js +21 -19
- package/dist/shared/components/notifications/resolved-line.js +25 -0
- package/dist/shared/components/ops/OpsTasksView.js +45 -44
- package/dist/shared/components/panels/AccessGrantedNote.js +85 -0
- package/dist/shared/components/panels/AlertBanners.js +132 -0
- package/dist/shared/components/panels/AsyncUserPicker.js +54 -45
- package/dist/shared/components/panels/BranchLanes.js +82 -54
- package/dist/shared/components/panels/CommentAwareness.js +332 -0
- package/dist/shared/components/panels/CommentImages.js +219 -0
- package/dist/shared/components/panels/CommentPanel.js +649 -530
- package/dist/shared/components/panels/ExternalRequestsChip.js +98 -80
- package/dist/shared/components/panels/NewSinceChip.js +16 -0
- package/dist/shared/components/panels/OwnerOpenedLine.js +85 -0
- package/dist/shared/components/panels/PipelinePanel.js +1644 -1494
- package/dist/shared/components/panels/ResubmissionDiff.js +293 -0
- package/dist/shared/components/panels/SlaBreachBanner.js +30 -29
- package/dist/shared/components/panels/SlaClock.js +130 -99
- package/dist/shared/components/panels/TaskPanel.js +308 -287
- package/dist/shared/components/panels/unseen-move-check.js +101 -0
- package/dist/shared/components/pipeline/OwnerMatrix.js +80 -71
- package/dist/shared/components/pipeline/OwnerMatrixSheet.js +495 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +2050 -1942
- package/dist/shared/components/profile/AgentNameField.js +141 -0
- package/dist/shared/components/profile/AgentsPanel.js +55 -46
- package/dist/shared/components/profile/PersonAccess.js +398 -330
- package/dist/shared/components/profile/PersonAdminTools.js +127 -113
- package/dist/shared/components/profile/PersonProfile.js +81 -73
- package/dist/shared/components/profile/SignInTroubleshooter.js +361 -0
- package/dist/shared/components/queue/OwnerAvatars.js +9 -9
- package/dist/shared/components/queue/QueueBulkBar.js +101 -84
- package/dist/shared/components/queue/QueueItemSheet.js +66 -66
- package/dist/shared/components/queue/QueueTeamStrip.js +279 -0
- package/dist/shared/components/queue/QueueWorklist.js +2407 -1950
- package/dist/shared/components/queue/worklist-helpers.js +10 -6
- package/dist/shared/components/send-view/SendViewButton.js +136 -0
- package/dist/shared/components/send-view/SentViewCards.js +147 -0
- package/dist/shared/components/support/ReportProblem.js +1 -0
- package/dist/shared/components/support/ScreenShare.js +554 -0
- package/dist/shared/components/support/SupportView.js +160 -129
- package/dist/shared/components/support/TicketDetailSheet.js +101 -89
- package/dist/shared/components/ui/popover.js +53 -29
- package/dist/shared/components/watch-list/WatchDock.js +1044 -0
- package/dist/shared/components/watch-list/WatchExtras.js +723 -0
- package/dist/shared/components/watch-list/WatchListButton.js +46 -0
- package/dist/shared/components/watch-list/WatchPinButton.js +67 -0
- package/dist/shared/components/watch-list/WatchRows.js +348 -0
- package/dist/shared/lib/activity-sentence.js +87 -75
- package/dist/shared/lib/agent-presence.js +46 -0
- package/dist/shared/lib/approval-progress.js +49 -0
- package/dist/shared/lib/attention-prefs.js +27 -0
- package/dist/shared/lib/cell-locks.js +56 -0
- package/dist/shared/lib/co-edit.js +166 -0
- package/dist/shared/lib/coedit-registry.js +44 -0
- package/dist/shared/lib/comment-awareness.js +124 -0
- package/dist/shared/lib/comment-images.js +45 -0
- package/dist/shared/lib/config-watch.js +94 -0
- package/dist/shared/lib/copy-rules.js +65 -0
- package/dist/shared/lib/count-step.js +30 -0
- package/dist/shared/lib/deadline-ticker.js +68 -0
- package/dist/shared/lib/derived-causes.js +115 -0
- package/dist/shared/lib/draft-store.js +114 -85
- package/dist/shared/lib/error-hints.js +1 -0
- package/dist/shared/lib/field-merge.js +126 -0
- package/dist/shared/lib/filter-sentence.js +10 -10
- package/dist/shared/lib/focus-mode.js +16 -12
- package/dist/shared/lib/grid-cursors.js +77 -0
- package/dist/shared/lib/grid-presence.js +182 -0
- package/dist/shared/lib/idle-reload.js +100 -73
- package/dist/shared/lib/in-step.js +45 -0
- package/dist/shared/lib/integration-chip.js +19 -18
- package/dist/shared/lib/keep-row-focus.js +43 -0
- package/dist/shared/lib/line-locks.js +141 -0
- package/dist/shared/lib/line-split.js +41 -0
- package/dist/shared/lib/linked-changes.js +150 -0
- package/dist/shared/lib/list-return.js +231 -0
- package/dist/shared/lib/list-viewers.js +52 -0
- package/dist/shared/lib/live-announcer.js +86 -0
- package/dist/shared/lib/live-counts.js +85 -0
- package/dist/shared/lib/live-data-changed.js +108 -0
- package/dist/shared/lib/live-deltas.js +81 -0
- package/dist/shared/lib/live-findings.js +113 -0
- package/dist/shared/lib/live-groups.js +122 -0
- package/dist/shared/lib/live-link-labels.js +162 -0
- package/dist/shared/lib/live-list-flow.js +334 -0
- package/dist/shared/lib/live-list.js +143 -129
- package/dist/shared/lib/live-moves.js +51 -0
- package/dist/shared/lib/live-ops.js +26 -26
- package/dist/shared/lib/live-pickers.js +7 -0
- package/dist/shared/lib/live-preference.js +184 -0
- package/dist/shared/lib/live-queries.js +226 -181
- package/dist/shared/lib/live-screen.js +333 -0
- package/dist/shared/lib/live-search.js +108 -0
- package/dist/shared/lib/live-seen.js +35 -0
- package/dist/shared/lib/live-views.js +100 -0
- package/dist/shared/lib/live.js +159 -133
- package/dist/shared/lib/missed-updates.js +198 -0
- package/dist/shared/lib/newer-file.js +56 -0
- package/dist/shared/lib/notification-sound.js +42 -20
- package/dist/shared/lib/obligation-banner.js +17 -17
- package/dist/shared/lib/own-writes.js +59 -41
- package/dist/shared/lib/picker-badges.js +94 -0
- package/dist/shared/lib/presence-signals.js +131 -84
- package/dist/shared/lib/rail-menu-context.js +9 -0
- package/dist/shared/lib/realtime.js +49 -24
- package/dist/shared/lib/record-gaps.js +85 -0
- package/dist/shared/lib/record-outbox.js +369 -222
- package/dist/shared/lib/record-peek.js +75 -0
- package/dist/shared/lib/record-tabs.js +92 -72
- package/dist/shared/lib/relative-ticker.js +42 -0
- package/dist/shared/lib/request-gate.js +119 -119
- package/dist/shared/lib/rollup-recalc.js +107 -0
- package/dist/shared/lib/room-gaps.js +40 -36
- package/dist/shared/lib/row-surface.js +7 -0
- package/dist/shared/lib/rum.js +137 -87
- package/dist/shared/lib/save-progress.js +20 -0
- package/dist/shared/lib/scheduled-countdown.js +67 -0
- package/dist/shared/lib/screen-refresh.js +160 -0
- package/dist/shared/lib/screen-share.js +234 -0
- package/dist/shared/lib/seen-since.js +74 -0
- package/dist/shared/lib/selection-watch.js +205 -0
- package/dist/shared/lib/send-status.js +132 -0
- package/dist/shared/lib/send-view.js +23 -0
- package/dist/shared/lib/socket-liveness.js +155 -0
- package/dist/shared/lib/socket-realtime.js +168 -140
- package/dist/shared/lib/state-census.js +53 -0
- package/dist/shared/lib/summary-mode.js +61 -39
- package/dist/shared/lib/tab-attention.js +143 -32
- package/dist/shared/lib/table-density.js +64 -0
- package/dist/shared/lib/table-pins.js +20 -18
- package/dist/shared/lib/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +62 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -0
- package/dist/shared/lib/use-below-md.js +29 -0
- package/dist/shared/lib/use-online-users.js +32 -11
- package/dist/shared/lib/user-sync.js +155 -39
- package/dist/shared/lib/waiting-count.js +44 -0
- package/dist/shared/lib/watch-desktop.js +83 -0
- package/dist/shared/lib/watch-list.js +447 -0
- package/dist/shared/lib/widget-image-render.js +64 -0
- package/dist/shared/lib/widget-image.js +111 -0
- package/dist/shared/lib/worker-socket.js +130 -104
- package/dist/shared/lib/write-to-screen.js +133 -0
- package/package.json +1 -1
- package/styles.css +49 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as n, Fragment as s, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useLivePreference as p } from "../../lib/live-preference.js";
|
|
3
|
+
import { cn as t } from "../../lib/utils.js";
|
|
4
|
+
function o(a) {
|
|
5
|
+
if (!a || typeof a != "object") return null;
|
|
6
|
+
const e = a.__recalc;
|
|
7
|
+
return e === "pending" || e === "landed" ? e : null;
|
|
8
|
+
}
|
|
9
|
+
function f({
|
|
10
|
+
state: a,
|
|
11
|
+
children: e,
|
|
12
|
+
className: r,
|
|
13
|
+
inline: l
|
|
14
|
+
}) {
|
|
15
|
+
const { quiet: c } = p();
|
|
16
|
+
return a === "landed" ? /* @__PURE__ */ n("span", { "data-recalc": "landed", className: t("nvr-value-pulse", r), children: e }) : a !== "pending" ? /* @__PURE__ */ n(s, { children: e }) : /* @__PURE__ */ i(
|
|
17
|
+
"span",
|
|
18
|
+
{
|
|
19
|
+
"data-recalc": "pending",
|
|
20
|
+
"aria-busy": "true",
|
|
21
|
+
className: t("inline-flex min-w-0 items-center gap-1.5", r),
|
|
22
|
+
children: [
|
|
23
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 opacity-45 transition-opacity duration-200", children: e }),
|
|
24
|
+
/* @__PURE__ */ i(
|
|
25
|
+
"span",
|
|
26
|
+
{
|
|
27
|
+
className: t(
|
|
28
|
+
"inline-flex shrink-0 items-center gap-1 whitespace-nowrap font-medium text-slate-500 dark:text-slate-400",
|
|
29
|
+
l ? "text-[10px]" : "text-[11px]"
|
|
30
|
+
),
|
|
31
|
+
"data-tip": "The lines changed — this total is being recalculated",
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ n(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
"aria-hidden": !0,
|
|
37
|
+
className: t(
|
|
38
|
+
"h-1.5 w-1.5 rounded-full bg-nvr-cyan",
|
|
39
|
+
// Calm / Off: the state shows, it does not move.
|
|
40
|
+
!c && "motion-safe:animate-pulse"
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
"Updating…"
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
f as RecalcValue,
|
|
54
|
+
o as recalcStateOf
|
|
55
|
+
};
|
|
@@ -1,58 +1,67 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import { useQuery as
|
|
3
|
-
import { MessageSquare as
|
|
4
|
-
import { useState as w, useRef as
|
|
5
|
-
import { toast as
|
|
6
|
-
import { useNivaroClient as
|
|
7
|
-
import { get as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as M, useQuery as q, useMutation as P } from "@tanstack/react-query";
|
|
3
|
+
import { MessageSquare as Q, X as T, Send as H, ChevronDown as I } from "lucide-react";
|
|
4
|
+
import { useState as w, useRef as W, useEffect as z } from "react";
|
|
5
|
+
import { toast as $ } from "sonner";
|
|
6
|
+
import { useNivaroClient as B } from "../../context.js";
|
|
7
|
+
import { get as L, post as X } from "../../lib/commands.js";
|
|
8
|
+
import { useLiveAvailable as _, useLiveRecordEvent as D } from "../../lib/live.js";
|
|
9
|
+
import { useRecordRoomTypes as G, canOpenChatRoom as J, openChatRoom as U } from "../chat/chat-core.js";
|
|
10
|
+
import { HuddleLiveBadge as V } from "../chat/huddle/HuddleLiveBadge.js";
|
|
11
|
+
import { useHuddleLive as Y } from "../chat/huddle/huddle-live.js";
|
|
12
|
+
import { SimpleSelect as Z } from "../ui/SimpleSelect.js";
|
|
13
|
+
function me({
|
|
14
|
+
collection: l,
|
|
15
|
+
itemDraft: f,
|
|
15
16
|
compact: s
|
|
16
17
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const b = B(), [m, d] = w(!1), [p, O] = w(""), [x, y] = w(""), N = W(null), g = G(), a = g == null ? void 0 : g.find((e) => e.collection === l), o = a ? String(f[a.match_field] ?? "").trim() : "", c = f.id == null ? "" : String(f.id), j = M(), E = _();
|
|
19
|
+
D(
|
|
20
|
+
"record:chat",
|
|
21
|
+
l,
|
|
22
|
+
c || null,
|
|
23
|
+
() => void j.invalidateQueries({ queryKey: ["nvr-chat-record-room", l, c] }),
|
|
24
|
+
{ debounceMs: 1e3, includeOwn: !0, enabled: !!a && !!o }
|
|
25
|
+
);
|
|
26
|
+
const { data: n } = q({
|
|
27
|
+
queryKey: ["nvr-chat-record-room", l, c],
|
|
28
|
+
queryFn: async () => (await b.request(
|
|
29
|
+
L(
|
|
21
30
|
"/chat/record-room",
|
|
22
|
-
{ collection:
|
|
31
|
+
{ collection: l, item: c }
|
|
23
32
|
)
|
|
24
33
|
)).data ?? null,
|
|
25
|
-
enabled: !!a && !!
|
|
34
|
+
enabled: !!a && !!o && !!c,
|
|
26
35
|
staleTime: 3e4,
|
|
27
|
-
refetchInterval: 6e4
|
|
28
|
-
}),
|
|
36
|
+
refetchInterval: E ? 5 * 6e4 : 6e4
|
|
37
|
+
}), t = (n == null ? void 0 : n.unread) ?? 0, C = Y(), F = C.countFor(n == null ? void 0 : n.room) || C.countFor(a && o ? `${a.prefix}:${o}` : null), { data: A } = q({
|
|
29
38
|
queryKey: ["nvr-chat-share-rooms"],
|
|
30
|
-
queryFn: async () => ((await
|
|
31
|
-
enabled:
|
|
39
|
+
queryFn: async () => ((await b.request(L("/chat/rooms"))).data ?? []).filter((h) => h.kind !== "entity"),
|
|
40
|
+
enabled: m,
|
|
32
41
|
staleTime: 3e4
|
|
33
42
|
}), v = P({
|
|
34
|
-
mutationFn: () =>
|
|
35
|
-
|
|
36
|
-
room:
|
|
37
|
-
message:
|
|
43
|
+
mutationFn: () => b.request(
|
|
44
|
+
X("/chat/messages", {
|
|
45
|
+
room: p,
|
|
46
|
+
message: x.trim() ? `${x.trim()} ${o}` : o,
|
|
38
47
|
mentions: []
|
|
39
48
|
})
|
|
40
49
|
),
|
|
41
50
|
onSuccess: () => {
|
|
42
|
-
|
|
51
|
+
$.success("Shared to chat"), d(!1), y("");
|
|
43
52
|
},
|
|
44
|
-
onError: () =>
|
|
53
|
+
onError: () => $.error("Could not share to that room")
|
|
45
54
|
});
|
|
46
|
-
if (
|
|
47
|
-
if (!
|
|
48
|
-
const e = (
|
|
49
|
-
var
|
|
50
|
-
const
|
|
51
|
-
(
|
|
55
|
+
if (z(() => {
|
|
56
|
+
if (!m) return;
|
|
57
|
+
const e = (h) => {
|
|
58
|
+
var R, S;
|
|
59
|
+
const u = h.target;
|
|
60
|
+
(R = u == null ? void 0 : u.closest) != null && R.call(u, '[data-radix-popper-content-wrapper], [role="listbox"]') || (S = N.current) != null && S.contains(h.target) || d(!1);
|
|
52
61
|
};
|
|
53
62
|
return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
|
|
54
|
-
}, [
|
|
55
|
-
const
|
|
63
|
+
}, [m]), !a || !o) return null;
|
|
64
|
+
const K = `${a.prefix}:${o}`, k = J();
|
|
56
65
|
return /* @__PURE__ */ i("div", { ref: N, className: "relative", children: [
|
|
57
66
|
/* @__PURE__ */ i(
|
|
58
67
|
"div",
|
|
@@ -64,76 +73,79 @@ function ae({
|
|
|
64
73
|
{
|
|
65
74
|
type: "button",
|
|
66
75
|
onClick: () => {
|
|
67
|
-
|
|
76
|
+
k ? U(K, o) : d((e) => !e);
|
|
68
77
|
},
|
|
69
|
-
title:
|
|
70
|
-
"aria-label":
|
|
78
|
+
title: t ? `${t} unread in this record's chat` : n != null && n.messages ? `Open this record's chat · ${n.messages} messages` : "Open this record's chat room",
|
|
79
|
+
"aria-label": t ? `Open this record's chat room, ${t} unread` : "Open this record's chat room",
|
|
71
80
|
className: s ? "relative inline-flex w-8 items-center justify-center transition-colors hover:bg-accent hover:text-accent-foreground" : "inline-flex items-center gap-1.5 px-3 transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
72
81
|
"data-record-chat": !0,
|
|
73
|
-
"data-record-chat-unread":
|
|
82
|
+
"data-record-chat-unread": t || void 0,
|
|
74
83
|
children: [
|
|
75
|
-
/* @__PURE__ */
|
|
84
|
+
/* @__PURE__ */ i("span", { className: "relative flex", children: [
|
|
85
|
+
/* @__PURE__ */ r(Q, { className: s ? "h-4 w-4" : "h-3.5 w-3.5", strokeWidth: 2 }),
|
|
86
|
+
t > 0 && s && /* @__PURE__ */ r("span", { className: "absolute -right-2 -top-2 flex h-[15px] min-w-[15px] items-center justify-center rounded-full bg-nvr-cyan px-1 text-[9px] font-bold leading-none text-white ring-2 ring-card", children: t > 9 ? "9+" : t })
|
|
87
|
+
] }),
|
|
76
88
|
!s && "Chat",
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
89
|
+
/* @__PURE__ */ r(
|
|
90
|
+
V,
|
|
79
91
|
{
|
|
80
|
-
count:
|
|
92
|
+
count: F,
|
|
81
93
|
className: s ? "absolute -bottom-0.5 -right-0.5 bg-card px-1 py-0" : void 0
|
|
82
94
|
}
|
|
83
95
|
),
|
|
84
|
-
|
|
96
|
+
t > 0 && !s && /* @__PURE__ */ r("span", { className: "flex h-4 min-w-4 items-center justify-center rounded-full bg-nvr-cyan px-1 text-[10px] font-bold text-white", children: t > 99 ? "99+" : t })
|
|
85
97
|
]
|
|
86
98
|
}
|
|
87
99
|
),
|
|
88
|
-
|
|
100
|
+
k && /* @__PURE__ */ r(
|
|
89
101
|
"button",
|
|
90
102
|
{
|
|
91
103
|
type: "button",
|
|
92
|
-
onClick: () =>
|
|
104
|
+
onClick: () => d((e) => !e),
|
|
93
105
|
title: "Send this record to a room",
|
|
94
106
|
"aria-label": "Send this record to a room",
|
|
95
107
|
className: s ? "inline-flex items-center px-1 transition-colors hover:bg-accent hover:text-accent-foreground" : "inline-flex items-center border-l border-input px-1.5 transition-colors hover:bg-accent hover:text-accent-foreground",
|
|
96
108
|
"data-record-chat-more": !0,
|
|
97
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ r(I, { className: "h-3 w-3", strokeWidth: 2 })
|
|
98
110
|
}
|
|
99
111
|
)
|
|
100
112
|
]
|
|
101
113
|
}
|
|
102
114
|
),
|
|
103
|
-
|
|
115
|
+
m && /* @__PURE__ */ i("div", { className: "absolute right-0 top-full z-30 mt-1 w-[260px] rounded-lg border border-slate-200 bg-white p-2.5 shadow-lg dark:border-border dark:bg-card", children: [
|
|
104
116
|
/* @__PURE__ */ i("div", { className: "mb-1.5 flex items-center justify-between", children: [
|
|
105
117
|
/* @__PURE__ */ i("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
106
118
|
"Share ",
|
|
107
|
-
|
|
119
|
+
o
|
|
108
120
|
] }),
|
|
109
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ r(
|
|
110
122
|
"button",
|
|
111
123
|
{
|
|
112
124
|
type: "button",
|
|
113
|
-
onClick: () =>
|
|
125
|
+
onClick: () => d(!1),
|
|
114
126
|
className: "text-slate-400 hover:text-slate-600",
|
|
115
127
|
"aria-label": "Close",
|
|
116
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ r(T, { className: "h-3.5 w-3.5" })
|
|
117
129
|
}
|
|
118
130
|
)
|
|
119
131
|
] }),
|
|
120
|
-
/* @__PURE__ */
|
|
121
|
-
|
|
132
|
+
/* @__PURE__ */ r(
|
|
133
|
+
Z,
|
|
122
134
|
{
|
|
123
|
-
value:
|
|
135
|
+
value: p,
|
|
124
136
|
onChange: O,
|
|
125
137
|
ariaLabel: "Room",
|
|
126
138
|
className: "mb-1.5 w-full",
|
|
127
139
|
options: [
|
|
128
140
|
{ value: "", label: "Pick a room…" },
|
|
129
|
-
...(
|
|
141
|
+
...(A ?? []).map((e) => ({ value: e.room, label: e.label ?? e.room }))
|
|
130
142
|
]
|
|
131
143
|
}
|
|
132
144
|
),
|
|
133
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ r(
|
|
134
146
|
"textarea",
|
|
135
147
|
{
|
|
136
|
-
value:
|
|
148
|
+
value: x,
|
|
137
149
|
onChange: (e) => y(e.target.value),
|
|
138
150
|
placeholder: "Add a note (optional)",
|
|
139
151
|
rows: 2,
|
|
@@ -145,11 +157,11 @@ function ae({
|
|
|
145
157
|
"button",
|
|
146
158
|
{
|
|
147
159
|
type: "button",
|
|
148
|
-
disabled: !
|
|
160
|
+
disabled: !p || v.isPending,
|
|
149
161
|
onClick: () => v.mutate(),
|
|
150
162
|
className: "flex h-8 w-full items-center justify-center gap-1.5 rounded-md bg-nvr-cyan text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-40",
|
|
151
163
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ r(H, { className: "h-3.5 w-3.5" }),
|
|
153
165
|
" ",
|
|
154
166
|
v.isPending ? "Sending…" : "Send"
|
|
155
167
|
]
|
|
@@ -159,5 +171,5 @@ function ae({
|
|
|
159
171
|
] });
|
|
160
172
|
}
|
|
161
173
|
export {
|
|
162
|
-
|
|
174
|
+
me as RecordChatActions
|
|
163
175
|
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs as r, jsx as n, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as k, useQuery as g } from "@tanstack/react-query";
|
|
3
|
+
import { MessagesSquare as y, ChevronRight as w } from "lucide-react";
|
|
4
|
+
import { useState as v } from "react";
|
|
5
|
+
import { useNivaroClient as N } from "../../context.js";
|
|
6
|
+
import { get as _ } from "../../lib/commands.js";
|
|
7
|
+
import { useLiveAvailable as C, useLiveRecordEvent as q } from "../../lib/live.js";
|
|
8
|
+
import { useLivePreference as O } from "../../lib/live-preference.js";
|
|
9
|
+
import { formatRelative as R } from "../../lib/utils.js";
|
|
10
|
+
import { openChatRoom as $, canOpenChatRoom as P } from "../chat/chat-core.js";
|
|
11
|
+
import { Popover as A, PopoverTrigger as F, PopoverContent as L } from "../ui/popover.js";
|
|
12
|
+
function o(t) {
|
|
13
|
+
if (t.rooms.length === 0) return "";
|
|
14
|
+
const s = t.rooms.length === 1 ? t.rooms[0].label : `${t.rooms.length} chats`;
|
|
15
|
+
return `${t.new_total > 0 ? "Being discussed in" : "Discussed in"} ${s}${t.new_total > 0 ? ` (${t.new_total} new)` : ""}`;
|
|
16
|
+
}
|
|
17
|
+
function G({
|
|
18
|
+
collection: t,
|
|
19
|
+
itemId: s
|
|
20
|
+
}) {
|
|
21
|
+
const l = N(), h = k(), x = C(), i = O(), [b, d] = v(!1), c = P(), u = ["nvr-chat-record-room", "mentions", t, s];
|
|
22
|
+
q(
|
|
23
|
+
"record:chat",
|
|
24
|
+
t,
|
|
25
|
+
s,
|
|
26
|
+
() => void h.invalidateQueries({ queryKey: u }),
|
|
27
|
+
{ debounceMs: 1500, includeOwn: !0, enabled: !i.quiet }
|
|
28
|
+
);
|
|
29
|
+
const { data: a } = g({
|
|
30
|
+
queryKey: u,
|
|
31
|
+
queryFn: async () => {
|
|
32
|
+
var p;
|
|
33
|
+
const e = await l.request(
|
|
34
|
+
_("/chat/record-discussion", { collection: t, item: s })
|
|
35
|
+
);
|
|
36
|
+
return Array.isArray((p = e == null ? void 0 : e.data) == null ? void 0 : p.rooms) ? e.data : null;
|
|
37
|
+
},
|
|
38
|
+
enabled: !!s,
|
|
39
|
+
staleTime: 3e4,
|
|
40
|
+
refetchOnWindowFocus: !1,
|
|
41
|
+
// Without a socket (or in Calm/Off) the count is as of load; with one, a slow backstop.
|
|
42
|
+
refetchInterval: x && !i.quiet ? 5 * 6e4 : !1,
|
|
43
|
+
retry: !1
|
|
44
|
+
});
|
|
45
|
+
if (!a || a.rooms.length === 0) return null;
|
|
46
|
+
const m = a.new_total > 0;
|
|
47
|
+
return /* @__PURE__ */ r(A, { open: b, onOpenChange: d, children: [
|
|
48
|
+
/* @__PURE__ */ n(F, { asChild: !0, children: /* @__PURE__ */ r(
|
|
49
|
+
"button",
|
|
50
|
+
{
|
|
51
|
+
type: "button",
|
|
52
|
+
"data-record-chat-mentions": !0,
|
|
53
|
+
"data-new": m ? a.new_total : void 0,
|
|
54
|
+
"data-tip": o(a),
|
|
55
|
+
"aria-label": o(a),
|
|
56
|
+
className: m ? "inline-flex max-w-full items-center gap-1 whitespace-nowrap rounded-full border border-sky-200 bg-sky-50 px-1.5 py-px font-semibold text-[9.5px] text-sky-800 tabular-nums transition-colors hover:bg-sky-100 dark:border-sky-500/30 dark:bg-sky-500/10 dark:text-sky-300 dark:hover:bg-sky-500/20" : "inline-flex max-w-full items-center gap-1 whitespace-nowrap rounded-full border border-slate-200 bg-slate-50 px-1.5 py-px font-medium text-[9.5px] text-slate-500 transition-colors hover:bg-slate-100 dark:border-border dark:bg-muted dark:text-muted-foreground dark:hover:bg-slate-800",
|
|
57
|
+
children: [
|
|
58
|
+
/* @__PURE__ */ n(y, { className: "h-2.5 w-2.5 shrink-0", "aria-hidden": !0 }),
|
|
59
|
+
/* @__PURE__ */ n("span", { className: "min-w-0 truncate", children: o(a) })
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ n(L, { align: "start", className: "w-[280px] p-1", children: /* @__PURE__ */ n("ul", { children: a.rooms.map((e) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ r(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
type: "button",
|
|
67
|
+
disabled: !c,
|
|
68
|
+
onClick: () => {
|
|
69
|
+
$(e.room, e.label), d(!1);
|
|
70
|
+
},
|
|
71
|
+
className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] hover:bg-slate-50 disabled:cursor-default disabled:hover:bg-transparent dark:hover:bg-slate-800",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ r("span", { className: "min-w-0 flex-1", children: [
|
|
74
|
+
/* @__PURE__ */ n("span", { className: "block truncate font-medium text-slate-800 dark:text-slate-100", children: e.label }),
|
|
75
|
+
e.last_at && /* @__PURE__ */ r("span", { className: "block text-[11px] text-slate-500 dark:text-slate-400", children: [
|
|
76
|
+
"latest ",
|
|
77
|
+
R(e.last_at)
|
|
78
|
+
] })
|
|
79
|
+
] }),
|
|
80
|
+
e.new_count > 0 && e.new_count === e.count ? /* @__PURE__ */ r("span", { className: "shrink-0 rounded-full bg-sky-100 px-1.5 text-[10px] font-semibold text-sky-800 tabular-nums dark:bg-sky-500/20 dark:text-sky-300", children: [
|
|
81
|
+
e.new_count,
|
|
82
|
+
" new"
|
|
83
|
+
] }) : /* @__PURE__ */ r(f, { children: [
|
|
84
|
+
/* @__PURE__ */ r("span", { className: "shrink-0 text-[11px] text-slate-500 tabular-nums dark:text-slate-400", children: [
|
|
85
|
+
e.count,
|
|
86
|
+
" ",
|
|
87
|
+
e.count === 1 ? "message" : "messages"
|
|
88
|
+
] }),
|
|
89
|
+
e.new_count > 0 && /* @__PURE__ */ r("span", { className: "shrink-0 rounded-full bg-sky-100 px-1.5 text-[10px] font-semibold text-sky-800 tabular-nums dark:bg-sky-500/20 dark:text-sky-300", children: [
|
|
90
|
+
e.new_count,
|
|
91
|
+
" new"
|
|
92
|
+
] })
|
|
93
|
+
] }),
|
|
94
|
+
c && /* @__PURE__ */ n(w, { className: "h-3.5 w-3.5 shrink-0 text-slate-400", "aria-hidden": !0 })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
) }, e.room)) }) })
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
G as RecordChatMentionsChip,
|
|
102
|
+
o as mentionsText
|
|
103
|
+
};
|