@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,29 @@
|
|
|
1
|
+
import { useSyncExternalStore as o } from "react";
|
|
2
|
+
const c = "(max-width: 767px)";
|
|
3
|
+
function i() {
|
|
4
|
+
try {
|
|
5
|
+
return typeof window > "u" || !window.matchMedia ? null : window.matchMedia(c);
|
|
6
|
+
} catch {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function s(n) {
|
|
11
|
+
var t;
|
|
12
|
+
const e = i();
|
|
13
|
+
return e ? ((t = e.addEventListener) == null || t.call(e, "change", n), () => {
|
|
14
|
+
var r;
|
|
15
|
+
return (r = e.removeEventListener) == null ? void 0 : r.call(e, "change", n);
|
|
16
|
+
}) : () => {
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const u = () => {
|
|
20
|
+
var n;
|
|
21
|
+
return ((n = i()) == null ? void 0 : n.matches) ?? !1;
|
|
22
|
+
};
|
|
23
|
+
function d() {
|
|
24
|
+
return o(s, u, () => !1);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
c as BELOW_MD_QUERY,
|
|
28
|
+
d as useBelowMd
|
|
29
|
+
};
|
|
@@ -1,19 +1,40 @@
|
|
|
1
|
-
import { readOnlinePresence as
|
|
2
|
-
import { useQuery as
|
|
1
|
+
import { readOnlinePresence as a } from "@nivaro/sdk";
|
|
2
|
+
import { useQuery as c } from "@tanstack/react-query";
|
|
3
3
|
import { useNivaroClient as u } from "../context.js";
|
|
4
|
-
import { usePresenceOnlinePoll as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
4
|
+
import { usePresenceOnlinePoll as p } from "./presence-live.js";
|
|
5
|
+
function P(t = !0) {
|
|
6
|
+
const r = u(), o = p(3e4, t), { data: s } = c({
|
|
7
7
|
queryKey: ["presence-online"],
|
|
8
|
-
queryFn: () =>
|
|
9
|
-
select: (e) => ((e == null ? void 0 : e.data) ?? []).map((
|
|
10
|
-
enabled:
|
|
11
|
-
refetchInterval:
|
|
8
|
+
queryFn: () => r.request(a()),
|
|
9
|
+
select: (e) => ((e == null ? void 0 : e.data) ?? []).map((n) => String(n.user_id ?? "").toUpperCase()).filter(Boolean),
|
|
10
|
+
enabled: t,
|
|
11
|
+
refetchInterval: o,
|
|
12
12
|
staleTime: 25e3,
|
|
13
13
|
retry: !1
|
|
14
14
|
});
|
|
15
|
-
return new Set(
|
|
15
|
+
return new Set(s ?? []);
|
|
16
16
|
}
|
|
17
|
+
function w(t = !0) {
|
|
18
|
+
const r = u(), o = p(3e4, t), { data: s } = c({
|
|
19
|
+
queryKey: ["presence-online"],
|
|
20
|
+
queryFn: () => r.request(a()),
|
|
21
|
+
select: (e) => {
|
|
22
|
+
const n = /* @__PURE__ */ new Map();
|
|
23
|
+
for (const i of (e == null ? void 0 : e.data) ?? []) {
|
|
24
|
+
const l = String(i.user_id ?? "").toUpperCase();
|
|
25
|
+
l && n.set(l, i.is_idle || i.away ? "idle" : "online");
|
|
26
|
+
}
|
|
27
|
+
return n;
|
|
28
|
+
},
|
|
29
|
+
enabled: t,
|
|
30
|
+
refetchInterval: o,
|
|
31
|
+
staleTime: 25e3,
|
|
32
|
+
retry: !1
|
|
33
|
+
});
|
|
34
|
+
return s ?? f;
|
|
35
|
+
}
|
|
36
|
+
const f = /* @__PURE__ */ new Map();
|
|
17
37
|
export {
|
|
18
|
-
|
|
38
|
+
P as useOnlineUsers,
|
|
39
|
+
w as usePresenceStates
|
|
19
40
|
};
|
|
@@ -1,66 +1,182 @@
|
|
|
1
|
-
import { useQueryClient as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useLiveEvent as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useQueryClient as g } from "@tanstack/react-query";
|
|
2
|
+
import { useRef as f, useEffect as y } from "react";
|
|
3
|
+
import { useLiveEvent as u } from "./live.js";
|
|
4
|
+
import { forgetSettledReads as w } from "./request-gate.js";
|
|
5
|
+
const S = "nvr-prefs";
|
|
6
|
+
let c = null;
|
|
7
|
+
function p(n) {
|
|
7
8
|
if (typeof BroadcastChannel > "u") return null;
|
|
8
|
-
if (!
|
|
9
|
+
if (!c)
|
|
9
10
|
try {
|
|
10
|
-
|
|
11
|
+
c = new BroadcastChannel(`${S}:${n}`);
|
|
11
12
|
} catch {
|
|
12
|
-
|
|
13
|
+
c = null;
|
|
13
14
|
}
|
|
14
|
-
return
|
|
15
|
+
return c;
|
|
15
16
|
}
|
|
16
|
-
let
|
|
17
|
-
function
|
|
18
|
-
if (n !==
|
|
19
|
-
|
|
17
|
+
let d = "";
|
|
18
|
+
function k(n) {
|
|
19
|
+
if (n !== d) {
|
|
20
|
+
d = n;
|
|
20
21
|
try {
|
|
21
|
-
|
|
22
|
+
c == null || c.close();
|
|
22
23
|
} catch {
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
c = null;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
28
|
+
function q() {
|
|
29
|
+
return d.endsWith(":as");
|
|
30
|
+
}
|
|
31
|
+
function L(n = []) {
|
|
32
|
+
var t;
|
|
29
33
|
try {
|
|
30
|
-
(
|
|
34
|
+
(t = p(d)) == null || t.postMessage({ keys: n });
|
|
31
35
|
} catch {
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
const E = /* @__PURE__ */ new Set([
|
|
39
|
+
"users",
|
|
40
|
+
"people-search",
|
|
41
|
+
"people-cards",
|
|
42
|
+
"task-people",
|
|
43
|
+
"task-people-search",
|
|
44
|
+
"sla-users",
|
|
45
|
+
"sla-user-search",
|
|
46
|
+
"role-users",
|
|
47
|
+
"record-chat-mentions",
|
|
48
|
+
"nvr-chat-directory",
|
|
49
|
+
"nvr-chat-members",
|
|
50
|
+
"nvr-chat-members-page",
|
|
51
|
+
"users-list-for-issues",
|
|
52
|
+
"users-list-for-approvals",
|
|
53
|
+
"presence-visible-people",
|
|
54
|
+
"team-members"
|
|
55
|
+
]), b = /* @__PURE__ */ new Set([
|
|
56
|
+
"user-card",
|
|
57
|
+
"user-avatar",
|
|
58
|
+
"user-name",
|
|
59
|
+
"user-chip",
|
|
60
|
+
"user",
|
|
61
|
+
"activity-chip-user",
|
|
62
|
+
"nvr-directory-entry",
|
|
63
|
+
"nvr-profile-card"
|
|
64
|
+
]);
|
|
65
|
+
function C(n, t) {
|
|
66
|
+
const i = n[0];
|
|
67
|
+
if (typeof i != "string") return !1;
|
|
68
|
+
if (E.has(i)) return !0;
|
|
69
|
+
if (!b.has(i)) return !1;
|
|
70
|
+
if (!t) return !0;
|
|
71
|
+
const o = n[1];
|
|
72
|
+
return (typeof o == "string" || typeof o == "number") && t.has(String(o).toUpperCase());
|
|
73
|
+
}
|
|
74
|
+
function m(n, t = 1200) {
|
|
75
|
+
setTimeout(n, Math.floor(Math.random() * t));
|
|
76
|
+
}
|
|
77
|
+
const M = [["notification-count"], ["notifications"], ["my-work"]], T = [["nvr-chat-rooms"], ["nvr-chat-record-room"]], K = {
|
|
78
|
+
"saved-views": [["cbv-views"], ["cbv-view-count"]],
|
|
79
|
+
"saved-searches": [["global-search-saved"]],
|
|
80
|
+
overview: [
|
|
81
|
+
["overview", "prefs"],
|
|
82
|
+
["overview", "pinned-widgets"]
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
function P(n = {}) {
|
|
86
|
+
const t = g(), i = f(n.onPrefsChanged);
|
|
87
|
+
i.current = n.onPrefsChanged, u(
|
|
38
88
|
"read:changed",
|
|
39
89
|
(e) => {
|
|
40
|
-
const
|
|
41
|
-
for (const
|
|
90
|
+
const r = (e == null ? void 0 : e.kind) === "chat" ? T : M;
|
|
91
|
+
for (const s of r) t.invalidateQueries({ queryKey: s });
|
|
42
92
|
},
|
|
43
|
-
|
|
93
|
+
// Counts: a burst of reads (mark-all) is one re-read, not one per event.
|
|
94
|
+
{ includeOwn: !0, debounceMs: 2e3 }
|
|
44
95
|
);
|
|
45
|
-
const
|
|
96
|
+
const o = f(() => {
|
|
46
97
|
});
|
|
47
|
-
|
|
98
|
+
o.current = () => {
|
|
48
99
|
var e;
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
|
|
100
|
+
t.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), t.invalidateQueries({ queryKey: ["presence-online"] }), t.invalidateQueries({ queryKey: ["nvr-nav-favorites"] }), (e = i.current) == null || e.call(i);
|
|
101
|
+
}, u(
|
|
102
|
+
"prefs:changed",
|
|
103
|
+
(e) => {
|
|
104
|
+
const r = Array.isArray(e == null ? void 0 : e.keys) ? e.keys : null;
|
|
105
|
+
r && r.length > 0 && r.every((s) => s === "watch_list") || o.current();
|
|
106
|
+
},
|
|
107
|
+
{ includeOwn: !0, debounceMs: 250 }
|
|
108
|
+
), u(
|
|
109
|
+
"mine:changed",
|
|
110
|
+
(e) => {
|
|
111
|
+
for (const r of K[String(e == null ? void 0 : e.kind)] ?? [])
|
|
112
|
+
t.invalidateQueries({ queryKey: r, refetchType: "active" });
|
|
113
|
+
},
|
|
114
|
+
{ includeOwn: !0, debounceMs: 300 }
|
|
115
|
+
), u(
|
|
116
|
+
"pins:changed",
|
|
117
|
+
() => m(() => void t.invalidateQueries({ queryKey: ["collection-pins"] })),
|
|
118
|
+
{ includeOwn: !0, debounceMs: 500 }
|
|
119
|
+
);
|
|
120
|
+
const v = f(n.onAccessChanged);
|
|
121
|
+
v.current = n.onAccessChanged, u(
|
|
122
|
+
"access:changed",
|
|
123
|
+
(e) => {
|
|
124
|
+
e != null && e.perms && m(() => {
|
|
125
|
+
var r;
|
|
126
|
+
w(), (r = v.current ?? i.current) == null || r(), t.invalidateQueries({ refetchType: "active" });
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
{ includeOwn: !0, debounceMs: 400 }
|
|
130
|
+
);
|
|
131
|
+
const a = f(null);
|
|
132
|
+
u(
|
|
133
|
+
"people:changed",
|
|
134
|
+
(e) => {
|
|
135
|
+
const r = Array.isArray(e == null ? void 0 : e.user_ids) ? e.user_ids.map((l) => String(l).toUpperCase()) : null, s = a.current;
|
|
136
|
+
if (s) {
|
|
137
|
+
if (!r) s.ids = null;
|
|
138
|
+
else if (s.ids) for (const l of r) s.ids.add(l);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const h = {
|
|
142
|
+
ids: r ? new Set(r) : null,
|
|
143
|
+
timer: setTimeout(
|
|
144
|
+
() => {
|
|
145
|
+
a.current = null, t.invalidateQueries({
|
|
146
|
+
refetchType: "active",
|
|
147
|
+
predicate: (l) => C(l.queryKey, h.ids)
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
300 + Math.floor(Math.random() * 800)
|
|
151
|
+
)
|
|
152
|
+
};
|
|
153
|
+
a.current = h;
|
|
154
|
+
},
|
|
155
|
+
{ includeOwn: !0 }
|
|
156
|
+
), y(
|
|
157
|
+
() => () => {
|
|
158
|
+
a.current && clearTimeout(a.current.timer);
|
|
159
|
+
},
|
|
160
|
+
[]
|
|
161
|
+
), y(() => {
|
|
162
|
+
const e = p(d);
|
|
52
163
|
if (!e) return;
|
|
53
|
-
let
|
|
54
|
-
const
|
|
55
|
-
|
|
164
|
+
let r = null;
|
|
165
|
+
const s = () => {
|
|
166
|
+
r && clearTimeout(r), r = setTimeout(() => o.current(), 100);
|
|
56
167
|
};
|
|
57
|
-
return e.addEventListener("message",
|
|
58
|
-
e.removeEventListener("message",
|
|
168
|
+
return e.addEventListener("message", s), () => {
|
|
169
|
+
e.removeEventListener("message", s), r && clearTimeout(r);
|
|
59
170
|
};
|
|
60
171
|
}, []);
|
|
61
172
|
}
|
|
62
173
|
export {
|
|
63
|
-
|
|
64
|
-
E as
|
|
65
|
-
|
|
174
|
+
K as MINE_KEYS,
|
|
175
|
+
E as PEOPLE_LIST_KEYS,
|
|
176
|
+
b as PERSON_KEYS,
|
|
177
|
+
L as announceLocalPrefs,
|
|
178
|
+
k as configureUserSync,
|
|
179
|
+
C as peopleQueryMatches,
|
|
180
|
+
P as useUserSync,
|
|
181
|
+
q as userSyncScoped
|
|
66
182
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useQueryClient as a, useQuery as l } from "@tanstack/react-query";
|
|
2
|
+
import { useRef as c, useEffect as p } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as y } from "../context.js";
|
|
4
|
+
import { get as v } from "./commands.js";
|
|
5
|
+
import { useLiveEvent as w } from "./live.js";
|
|
6
|
+
import { useLiveOps as I } from "./live-ops.js";
|
|
7
|
+
import { useLiveRefetchInterval as k } from "./live-queries.js";
|
|
8
|
+
function q(e) {
|
|
9
|
+
if (!e) return 0;
|
|
10
|
+
let o = 0;
|
|
11
|
+
for (const r of [e.owned, e.approvals, e.questions])
|
|
12
|
+
typeof r == "number" && Number.isFinite(r) && r > 0 && (o += Math.floor(r));
|
|
13
|
+
return o;
|
|
14
|
+
}
|
|
15
|
+
const h = 3e4;
|
|
16
|
+
function Q(e = !0) {
|
|
17
|
+
const o = y(), r = a(), f = k(18e4, { safetyMs: 18e4, enabled: e }), { data: m } = l({
|
|
18
|
+
queryKey: ["my-work"],
|
|
19
|
+
queryFn: () => o.request(v("/my-work")).then((t) => t.data),
|
|
20
|
+
enabled: e && !!o,
|
|
21
|
+
staleTime: 6e4,
|
|
22
|
+
refetchInterval: f,
|
|
23
|
+
refetchIntervalInBackground: !0,
|
|
24
|
+
retry: !1,
|
|
25
|
+
select: (t) => q(t == null ? void 0 : t.counts)
|
|
26
|
+
}), i = c(0), n = c(null), u = () => {
|
|
27
|
+
if (n.current) return;
|
|
28
|
+
const t = () => {
|
|
29
|
+
n.current = null, i.current = Date.now(), r.invalidateQueries({ queryKey: ["my-work"] });
|
|
30
|
+
}, s = i.current + h - Date.now();
|
|
31
|
+
s <= 0 ? t() : n.current = setTimeout(t, s);
|
|
32
|
+
};
|
|
33
|
+
return I("my-work", u, { debounceMs: 1500, enabled: e }), w("notification:new", u, { debounceMs: 1500, enabled: e }), p(
|
|
34
|
+
() => () => {
|
|
35
|
+
n.current && clearTimeout(n.current);
|
|
36
|
+
},
|
|
37
|
+
[]
|
|
38
|
+
), e ? m ?? 0 : 0;
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
h as WAITING_LIVE_GAP_MS,
|
|
42
|
+
Q as useWaitingCount,
|
|
43
|
+
q as waitingCount
|
|
44
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
const d = "nivaro-watch-list", w = 12e4, f = "nvr:watch-desktop:claim";
|
|
2
|
+
function s() {
|
|
3
|
+
return typeof window > "u" || typeof window.Notification > "u" ? "unsupported" : window.Notification.permission;
|
|
4
|
+
}
|
|
5
|
+
async function h() {
|
|
6
|
+
if (s() === "unsupported") return "unsupported";
|
|
7
|
+
try {
|
|
8
|
+
return await window.Notification.requestPermission();
|
|
9
|
+
} catch {
|
|
10
|
+
return s();
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function l() {
|
|
14
|
+
return typeof document > "u" ? !1 : document.visibilityState === "hidden" || !document.hasFocus();
|
|
15
|
+
}
|
|
16
|
+
function p(t, n, e, o) {
|
|
17
|
+
const i = [];
|
|
18
|
+
for (const r of new Set(t)) {
|
|
19
|
+
const c = n[r];
|
|
20
|
+
if (!c) continue;
|
|
21
|
+
const a = new Date(c).getTime();
|
|
22
|
+
if (!Number.isFinite(a) || o - a > 12e4) continue;
|
|
23
|
+
const u = e.get(r);
|
|
24
|
+
u && u >= c || i.push(r);
|
|
25
|
+
}
|
|
26
|
+
return i;
|
|
27
|
+
}
|
|
28
|
+
function g(t, n) {
|
|
29
|
+
if (t.length === 1) {
|
|
30
|
+
const o = n[t[0]];
|
|
31
|
+
return {
|
|
32
|
+
title: "Watch list",
|
|
33
|
+
body: o ? `${o} changed` : "A record you watch changed"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const e = t.map((o) => n[o]).filter(Boolean);
|
|
37
|
+
return {
|
|
38
|
+
title: "Watch list",
|
|
39
|
+
body: e.length > 0 ? `${t.length} records you watch changed: ${e.slice(0, 2).join(", ")}${t.length > 2 ? "…" : ""}` : `${t.length} records you watch changed`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function m(t, n = Date.now()) {
|
|
43
|
+
const e = [...t].sort().join("|");
|
|
44
|
+
try {
|
|
45
|
+
const o = window.localStorage.getItem(f);
|
|
46
|
+
if (o) {
|
|
47
|
+
const i = JSON.parse(o);
|
|
48
|
+
if (i.sig === e && typeof i.at == "number" && n - i.at < 8e3) return !1;
|
|
49
|
+
}
|
|
50
|
+
window.localStorage.setItem(f, JSON.stringify({ sig: e, at: n }));
|
|
51
|
+
} catch {
|
|
52
|
+
}
|
|
53
|
+
return !0;
|
|
54
|
+
}
|
|
55
|
+
function S(t, n) {
|
|
56
|
+
if (s() === "granted")
|
|
57
|
+
try {
|
|
58
|
+
const e = new window.Notification(t.title, {
|
|
59
|
+
body: t.body,
|
|
60
|
+
tag: d,
|
|
61
|
+
silent: !1
|
|
62
|
+
});
|
|
63
|
+
e.onclick = () => {
|
|
64
|
+
try {
|
|
65
|
+
window.focus();
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
n == null || n(), e.close();
|
|
69
|
+
};
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
w as DESKTOP_FRESH_MS,
|
|
75
|
+
d as DESKTOP_TAG,
|
|
76
|
+
m as claimBurst,
|
|
77
|
+
s as desktopPermission,
|
|
78
|
+
g as desktopText,
|
|
79
|
+
p as keysToNotify,
|
|
80
|
+
l as pageOutOfSight,
|
|
81
|
+
h as requestDesktopPermission,
|
|
82
|
+
S as showDesktop
|
|
83
|
+
};
|