@nivaro/react 0.3.114 → 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.
- 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 +1717 -21
- 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 +4088 -3592
- 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 +1 -0
- 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/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/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/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 +388 -321
- 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 +1855 -1771
- 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/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 +1927 -1635
- 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/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/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/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/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/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/track-travel.js +40 -0
- package/dist/shared/lib/unseen-changes.js +68 -0
- package/dist/shared/lib/upload-file.js +33 -0
- package/dist/shared/lib/upload-presence.js +127 -0
- package/dist/shared/lib/urgent-chime.js +65 -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,166 @@
|
|
|
1
|
+
import { useSyncExternalStore as U } from "react";
|
|
2
|
+
import { useLivePreference as V } from "./live-preference.js";
|
|
3
|
+
const h = { viewers: [], editing: {}, pointer: null, result: null }, v = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
|
|
4
|
+
let p = 0;
|
|
5
|
+
const C = (e, n) => `${e}${String(n)}`;
|
|
6
|
+
function b() {
|
|
7
|
+
for (const e of O) e();
|
|
8
|
+
}
|
|
9
|
+
function w(e, n, r) {
|
|
10
|
+
const o = C(e, n), t = v.get(o) ?? h, f = r(t);
|
|
11
|
+
f !== t && (v.set(o, f), b());
|
|
12
|
+
}
|
|
13
|
+
function q(e) {
|
|
14
|
+
return O.add(e), () => {
|
|
15
|
+
O.delete(e);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function S(e, n) {
|
|
19
|
+
return !!e && !!n && String(e).toUpperCase() === String(n).toUpperCase();
|
|
20
|
+
}
|
|
21
|
+
function _(e, n, r) {
|
|
22
|
+
return (e == null ? void 0 : e.collection) == null || (e == null ? void 0 : e.item) == null ? !0 : e.collection === n && String(e.item) === r;
|
|
23
|
+
}
|
|
24
|
+
function L(e, n, r) {
|
|
25
|
+
const o = typeof (n == null ? void 0 : n.field) == "string" ? n.field : "";
|
|
26
|
+
if (!o) return e;
|
|
27
|
+
const t = n.user;
|
|
28
|
+
if ((t == null ? void 0 : t.id) != null && !S(String(t.id), r)) {
|
|
29
|
+
const c = e[o], l = String(t.name || "Someone");
|
|
30
|
+
return c && S(c.id, String(t.id)) && c.name === l ? e : { ...e, [o]: { id: String(t.id), name: l } };
|
|
31
|
+
}
|
|
32
|
+
if (!(o in e)) return e;
|
|
33
|
+
const f = { ...e };
|
|
34
|
+
return delete f[o], f;
|
|
35
|
+
}
|
|
36
|
+
function B(e, n, r = /* @__PURE__ */ new Set()) {
|
|
37
|
+
const o = [];
|
|
38
|
+
for (const [t, f] of Object.entries(e)) {
|
|
39
|
+
let c = !1;
|
|
40
|
+
if (t.startsWith("row:") || t.startsWith("cell:")) {
|
|
41
|
+
const l = t.slice(t.indexOf(":") + 1).split(":")[0];
|
|
42
|
+
c = !!l && r.has(l);
|
|
43
|
+
} else c = n.has(t);
|
|
44
|
+
c && !o.some((l) => S(l.id, f.id)) && o.push(f);
|
|
45
|
+
}
|
|
46
|
+
return o.sort((t, f) => t.name.localeCompare(f.name));
|
|
47
|
+
}
|
|
48
|
+
function H(e, n) {
|
|
49
|
+
if (e.length === 0) return null;
|
|
50
|
+
const r = e.map((t) => t.name);
|
|
51
|
+
return `${r.length === 1 ? r[0] : r.length === 2 ? `${r[0]} and ${r[1]}` : `${r[0]}, ${r[1]} and ${r.length - 2} other${r.length === 3 ? "" : "s"}`} ${r.length === 1 ? "is" : "are"} in ${n}`;
|
|
52
|
+
}
|
|
53
|
+
const M = 8e3;
|
|
54
|
+
function J(e) {
|
|
55
|
+
return e.quiet || !e.visible || e.editingSomething || e.popoverOpen ? !1 : e.now - e.lastInputAt >= M;
|
|
56
|
+
}
|
|
57
|
+
function K(e, n) {
|
|
58
|
+
switch (e) {
|
|
59
|
+
case "rate":
|
|
60
|
+
return `You pointed ${n} a moment ago — give it a few seconds`;
|
|
61
|
+
case "gone":
|
|
62
|
+
return `${n} is no longer on this record`;
|
|
63
|
+
case "field":
|
|
64
|
+
return `${n} can't see this field`;
|
|
65
|
+
case "self":
|
|
66
|
+
return "That is you";
|
|
67
|
+
default:
|
|
68
|
+
return `Could not point ${n} there`;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const $ = "nvr:field-point-out", j = "nvr:open-section";
|
|
72
|
+
function Q(e) {
|
|
73
|
+
typeof window < "u" && window.dispatchEvent(new CustomEvent(j, { detail: { field: e } }));
|
|
74
|
+
}
|
|
75
|
+
function X(e, n, r, o) {
|
|
76
|
+
const t = String(r), f = o ? String(o) : null, c = (i) => {
|
|
77
|
+
if (!_(i, n, t) || !Array.isArray(i == null ? void 0 : i.viewers)) return;
|
|
78
|
+
const s = /* @__PURE__ */ new Set(), d = [];
|
|
79
|
+
for (const u of i.viewers) {
|
|
80
|
+
if ((u == null ? void 0 : u.id) == null || S(String(u.id), f)) continue;
|
|
81
|
+
const m = String(u.id).toUpperCase();
|
|
82
|
+
s.has(m) || (s.add(m), d.push({ id: String(u.id), name: String(u.name || "Someone") }));
|
|
83
|
+
}
|
|
84
|
+
w(n, t, (u) => {
|
|
85
|
+
const m = new Set(d.map((a) => a.id.toUpperCase())), x = Object.entries(u.editing).filter(([, a]) => m.has(a.id.toUpperCase())), I = x.length === Object.keys(u.editing).length ? u.editing : Object.fromEntries(x), N = d.length === u.viewers.length && d.every((a, R) => a.id === u.viewers[R].id && a.name === u.viewers[R].name);
|
|
86
|
+
return N && I === u.editing ? u : { ...u, viewers: N ? u.viewers : d, editing: I };
|
|
87
|
+
});
|
|
88
|
+
}, l = (i) => {
|
|
89
|
+
_(i, n, t) && w(n, t, (s) => {
|
|
90
|
+
const d = L(s.editing, i, f);
|
|
91
|
+
return d === s.editing ? s : { ...s, editing: d };
|
|
92
|
+
});
|
|
93
|
+
}, y = (i) => {
|
|
94
|
+
var d;
|
|
95
|
+
if ((i == null ? void 0 : i.collection) !== n || String(i == null ? void 0 : i.item) !== t || typeof i.field != "string" || !((d = i.user) != null && d.id) || S(String(i.user.id), f)) return;
|
|
96
|
+
const s = {
|
|
97
|
+
collection: n,
|
|
98
|
+
item: t,
|
|
99
|
+
field: i.field,
|
|
100
|
+
user: { id: String(i.user.id), name: String(i.user.name || "Someone") },
|
|
101
|
+
at: Date.now()
|
|
102
|
+
};
|
|
103
|
+
w(n, t, (u) => ({ ...u, pointer: s }));
|
|
104
|
+
}, P = (i) => {
|
|
105
|
+
if ((i == null ? void 0 : i.collection) !== n || String(i == null ? void 0 : i.item) !== t || typeof i.ref != "string" || !g.has(i.ref)) return;
|
|
106
|
+
g.delete(i.ref);
|
|
107
|
+
const s = { ...i, seq: ++p };
|
|
108
|
+
w(n, t, (d) => ({ ...d, result: s }));
|
|
109
|
+
}, T = (i) => {
|
|
110
|
+
const s = i.detail;
|
|
111
|
+
(s == null ? void 0 : s.collection) !== n || String(s.item) !== t || !s.field || !s.to || e.emit("field:point", { collection: n, item: t, field: s.field, to: s.to, ref: s.ref });
|
|
112
|
+
};
|
|
113
|
+
return e.on("record:viewers", c), e.on("field:editing", l), e.on("field:pointed", y), e.on("field:point-result", P), typeof window < "u" && window.addEventListener($, T), () => {
|
|
114
|
+
e.off("record:viewers", c), e.off("field:editing", l), e.off("field:pointed", y), e.off("field:point-result", P), typeof window < "u" && window.removeEventListener($, T), v.delete(C(n, t)) && b();
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function Z(e, n, r, o) {
|
|
118
|
+
if (typeof window > "u") return;
|
|
119
|
+
const t = Math.random().toString(36).slice(2, 12);
|
|
120
|
+
g.add(t), g.size > 50 && g.delete(g.values().next().value), window.dispatchEvent(
|
|
121
|
+
new CustomEvent($, { detail: { collection: e, item: String(n), field: r, to: o, ref: t } })
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
function E(e, n, r) {
|
|
125
|
+
const o = e && n != null ? C(e, String(n)) : "";
|
|
126
|
+
return U(
|
|
127
|
+
q,
|
|
128
|
+
() => r(o ? v.get(o) ?? h : h),
|
|
129
|
+
() => r(h)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
const D = [], F = {}, A = (e) => e.viewers, W = (e) => e.editing, k = (e) => e.pointer, Y = (e) => e.result;
|
|
133
|
+
function ee(e, n) {
|
|
134
|
+
const r = E(e, n, A), { quiet: o } = V();
|
|
135
|
+
return o ? D : r;
|
|
136
|
+
}
|
|
137
|
+
function ne(e, n) {
|
|
138
|
+
const r = E(e, n, W), { quiet: o } = V();
|
|
139
|
+
return o ? F : r;
|
|
140
|
+
}
|
|
141
|
+
function te(e, n) {
|
|
142
|
+
const r = E(e, n, k), o = E(e, n, Y);
|
|
143
|
+
return {
|
|
144
|
+
pointer: r,
|
|
145
|
+
result: o,
|
|
146
|
+
dismiss: () => {
|
|
147
|
+
e && n != null && w(e, String(n), (t) => t.pointer ? { ...t, pointer: null } : t);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export {
|
|
152
|
+
$ as FIELD_POINT_OUT,
|
|
153
|
+
j as OPEN_SECTION_EVENT,
|
|
154
|
+
M as POINT_IDLE_MS,
|
|
155
|
+
L as applyFieldEditing,
|
|
156
|
+
X as bindRecordCoEdit,
|
|
157
|
+
Q as openSectionOf,
|
|
158
|
+
Z as pointCoViewer,
|
|
159
|
+
J as pointMayScroll,
|
|
160
|
+
K as pointRefusalText,
|
|
161
|
+
B as sectionPresence,
|
|
162
|
+
H as sectionPresenceText,
|
|
163
|
+
ee as useCoViewers,
|
|
164
|
+
ne as useFieldEditors,
|
|
165
|
+
te as useFieldPointer
|
|
166
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const r = /* @__PURE__ */ new Map(), l = (t, n, o) => `${t}${String(n)}${o}`;
|
|
2
|
+
function f(t) {
|
|
3
|
+
let n = 2166136261, o = 16777619 ^ t.length;
|
|
4
|
+
for (let s = 0; s < t.length; s++) {
|
|
5
|
+
const e = t.charCodeAt(s);
|
|
6
|
+
n = Math.imul(n ^ e, 16777619) >>> 0, o = Math.imul(o ^ e, 1540483477) >>> 0;
|
|
7
|
+
}
|
|
8
|
+
return `${n.toString(36)}.${o.toString(36)}.${t.length}`;
|
|
9
|
+
}
|
|
10
|
+
function d(t, n, o) {
|
|
11
|
+
const s = l(t, n, o);
|
|
12
|
+
let e = r.get(s);
|
|
13
|
+
if (!e) {
|
|
14
|
+
if (r.size >= 200) {
|
|
15
|
+
const i = r.keys().next().value;
|
|
16
|
+
i !== void 0 && r.delete(i);
|
|
17
|
+
}
|
|
18
|
+
e = { seen: /* @__PURE__ */ new Set(), order: [], live: !1 }, r.set(s, e);
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
21
|
+
}
|
|
22
|
+
function h(t, n, o, s) {
|
|
23
|
+
const e = d(t, n, o);
|
|
24
|
+
e.live = s;
|
|
25
|
+
}
|
|
26
|
+
function u(t, n, o, s) {
|
|
27
|
+
const e = d(t, n, o), i = f(s);
|
|
28
|
+
if (!e.seen.has(i))
|
|
29
|
+
for (e.seen.add(i), e.order.push(i); e.order.length > 400; ) {
|
|
30
|
+
const c = e.order.shift();
|
|
31
|
+
c && e.seen.delete(c);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function a(t, n, o, s) {
|
|
35
|
+
if (typeof s != "string") return !1;
|
|
36
|
+
const e = r.get(l(t, n, o));
|
|
37
|
+
return !!e && e.seen.has(f(s));
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
a as coeditCovers,
|
|
41
|
+
f as coeditHash,
|
|
42
|
+
h as noteCoeditLive,
|
|
43
|
+
u as noteCoeditState
|
|
44
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { useState as h, useRef as $, useEffect as g, useMemo as w, useCallback as y } from "react";
|
|
2
|
+
import { whoText as b } from "./presence-signals.js";
|
|
3
|
+
import { formatDateTime as p, getDisplayTimezone as S } from "./utils.js";
|
|
4
|
+
const x = (e, n) => e != null && n != null && String(e).toUpperCase() === String(n).toUpperCase();
|
|
5
|
+
function _(e, n, t) {
|
|
6
|
+
return !e || !n ? [] : n.filter((r) => {
|
|
7
|
+
var i;
|
|
8
|
+
return !r.deleted && !e.has(String(r.id)) && !x((i = r.user) == null ? void 0 : i.id, t);
|
|
9
|
+
}).sort((r, i) => String(r.created_at ?? "").localeCompare(String(i.created_at ?? "")));
|
|
10
|
+
}
|
|
11
|
+
function R(e) {
|
|
12
|
+
return `${e} new ${e === 1 ? "reply" : "replies"} since you started typing`;
|
|
13
|
+
}
|
|
14
|
+
function C(e, n, t) {
|
|
15
|
+
const r = e.trim() !== "", [i, a] = h(null), s = $(n);
|
|
16
|
+
s.current = n;
|
|
17
|
+
const u = n != null;
|
|
18
|
+
g(() => {
|
|
19
|
+
if (!r) {
|
|
20
|
+
a(null);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
a((l) => {
|
|
24
|
+
if (l) return l;
|
|
25
|
+
const o = s.current;
|
|
26
|
+
return o ? new Set(o.map((d) => String(d.id))) : null;
|
|
27
|
+
});
|
|
28
|
+
}, [r, u]);
|
|
29
|
+
const c = w(() => _(i, n, t), [i, n, t]), m = y(() => {
|
|
30
|
+
a((l) => {
|
|
31
|
+
const o = new Set(l ?? []);
|
|
32
|
+
for (const d of s.current ?? []) o.add(String(d.id));
|
|
33
|
+
return o;
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
return { replies: c, dismiss: m };
|
|
37
|
+
}
|
|
38
|
+
function I(e, n = "Seen by") {
|
|
39
|
+
const t = e.map((r) => r.name);
|
|
40
|
+
return t.length === 0 ? null : t.length > 3 ? `${n} ${t[0]}, ${t[1]} +${t.length - 2}` : t.length === 3 ? `${n} ${t[0]}, ${t[1]} and ${t[2]}` : `${n} ${b(t)}`;
|
|
41
|
+
}
|
|
42
|
+
function T(e) {
|
|
43
|
+
return [e.first_name, e.last_name].filter(Boolean).join(" ") || e.email || "Someone";
|
|
44
|
+
}
|
|
45
|
+
function N(e, n) {
|
|
46
|
+
const t = T(e);
|
|
47
|
+
return e.seen_at || e.status === "seen" ? { text: `${t} saw this${e.seen_at ? ` ${n(e.seen_at)}` : ""}`, tone: "ok" } : e.status === "muted" ? { text: `${t}: muted — ${e.reason || "won’t be told"}`, tone: "warn" } : e.status === "not_told" ? { text: `${t} won’t be told`, tone: "warn" } : e.status === "in_inbox" ? { text: `${t} has not seen this yet`, tone: "neutral" } : { text: `${t} · not seen yet`, tone: "neutral" };
|
|
48
|
+
}
|
|
49
|
+
function U(e) {
|
|
50
|
+
const n = e.filter((i) => i.seen_at || i.status === "seen").length, t = e.filter((i) => i.status === "not_told" || i.status === "muted").length, r = [`${e.length} mentioned`, `${n} seen`];
|
|
51
|
+
return t && r.push(`${t} won’t be told`), {
|
|
52
|
+
text: r.join(" · "),
|
|
53
|
+
tone: t ? "warn" : n === e.length ? "ok" : "neutral"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function f(e, n = /* @__PURE__ */ new Date()) {
|
|
57
|
+
if (!e) return "";
|
|
58
|
+
const t = new Date(e);
|
|
59
|
+
if (Number.isNaN(t.getTime())) return "";
|
|
60
|
+
const r = S(), i = (a) => new Intl.DateTimeFormat("en-US", {
|
|
61
|
+
...r ? { timeZone: r } : {},
|
|
62
|
+
year: "numeric",
|
|
63
|
+
month: "2-digit",
|
|
64
|
+
day: "2-digit"
|
|
65
|
+
}).format(a);
|
|
66
|
+
return i(t) !== i(n) ? p(t) : new Intl.DateTimeFormat("en-US", {
|
|
67
|
+
...r ? { timeZone: r } : {},
|
|
68
|
+
hour: "numeric",
|
|
69
|
+
minute: "2-digit"
|
|
70
|
+
}).format(t);
|
|
71
|
+
}
|
|
72
|
+
function W(e, n) {
|
|
73
|
+
switch (e.headline) {
|
|
74
|
+
case "seen":
|
|
75
|
+
return { text: `Seen in app ${f(e.seen_at, n)}`.trim(), tone: "ok" };
|
|
76
|
+
case "in_inbox":
|
|
77
|
+
return { text: "In their notifications, not seen yet", tone: "pending" };
|
|
78
|
+
case "muted":
|
|
79
|
+
return { text: `Muted — ${e.reason || "won’t be told"}`, tone: "warn" };
|
|
80
|
+
default:
|
|
81
|
+
return { text: "Won’t be told", tone: "warn" };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function j(e, n) {
|
|
85
|
+
const t = e.at ? ` ${f(e.at, n)}` : "";
|
|
86
|
+
if (e.key === "push")
|
|
87
|
+
return e.status === "sent" ? `Phone or browser alert sent${t}` : "Alert failed";
|
|
88
|
+
if (e.key === "teams") return e.status === "sent" ? `Teams message sent${t}` : "Teams failed";
|
|
89
|
+
switch (e.status) {
|
|
90
|
+
case "sent":
|
|
91
|
+
return `Emailed${t}`;
|
|
92
|
+
case "deferred":
|
|
93
|
+
return "Email waits for their daily summary";
|
|
94
|
+
case "bounced":
|
|
95
|
+
return "Email bounced";
|
|
96
|
+
case "failed":
|
|
97
|
+
return "Email failed";
|
|
98
|
+
default:
|
|
99
|
+
return "Email not sent";
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function B(e) {
|
|
103
|
+
return e.status === "bounced" || e.status === "failed" ? "warn" : e.status === "deferred" || e.status === "not_sent" ? "muted" : "ok";
|
|
104
|
+
}
|
|
105
|
+
function z(e) {
|
|
106
|
+
const n = e.filter((s) => s.headline === "seen").length, t = e.filter((s) => s.headline === "in_inbox").length, r = e.filter((s) => s.headline === "muted" || s.headline === "not_told").length, i = e.filter(
|
|
107
|
+
(s) => s.channels.some((u) => u.key === "email" && u.status === "bounced")
|
|
108
|
+
).length, a = [];
|
|
109
|
+
return r && a.push(`${r} won’t be told`), i && a.push(`${i} bounced`), n && a.push(`${n} seen`), t && a.push(`${t} not seen yet`), a.join(" · ");
|
|
110
|
+
}
|
|
111
|
+
export {
|
|
112
|
+
B as channelTone,
|
|
113
|
+
z as deliverySummary,
|
|
114
|
+
f as deliveryWhen,
|
|
115
|
+
j as mentionChannelText,
|
|
116
|
+
W as mentionHeadline,
|
|
117
|
+
N as mentionReceiptLine,
|
|
118
|
+
U as mentionReceiptSummary,
|
|
119
|
+
_ as newRepliesSince,
|
|
120
|
+
T as receiptName,
|
|
121
|
+
R as repliesWhileTypingText,
|
|
122
|
+
I as seenByText,
|
|
123
|
+
C as useRepliesWhileTyping
|
|
124
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const r = 6, o = /!\[([^\]\n]*)\]\(\/api\/files\/([0-9a-fA-F-]{36})\)/g;
|
|
2
|
+
function a(n, t) {
|
|
3
|
+
return `![${t.replace(/[[\]()\n\r]/g, " ").replace(/\s+/g, " ").trim() || "image"}](/api/files/${n})`;
|
|
4
|
+
}
|
|
5
|
+
function m(n, t) {
|
|
6
|
+
const e = t.map((i) => a(i.id, i.name));
|
|
7
|
+
return [n.trim(), ...e].filter(Boolean).join(`
|
|
8
|
+
`);
|
|
9
|
+
}
|
|
10
|
+
function c(n) {
|
|
11
|
+
const t = [];
|
|
12
|
+
let e = 0;
|
|
13
|
+
for (const i of n.matchAll(o)) {
|
|
14
|
+
const s = i.index ?? 0;
|
|
15
|
+
s > e && t.push({ kind: "text", text: n.slice(e, s) }), t.push({ kind: "image", id: i[2], name: i[1] || "image" }), e = s + i[0].length;
|
|
16
|
+
}
|
|
17
|
+
return e < n.length && t.push({ kind: "text", text: n.slice(e) }), t;
|
|
18
|
+
}
|
|
19
|
+
function l(n) {
|
|
20
|
+
return n.replace(o, "[image]");
|
|
21
|
+
}
|
|
22
|
+
function p(n) {
|
|
23
|
+
if (!n) return [];
|
|
24
|
+
const t = [];
|
|
25
|
+
for (const e of Array.from(n.files ?? [])) {
|
|
26
|
+
if (!e.type.startsWith("image/")) continue;
|
|
27
|
+
if (e.name && e.name !== "image.png") {
|
|
28
|
+
t.push(e);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
const i = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[:T]/g, "-");
|
|
32
|
+
t.push(
|
|
33
|
+
new File([e], `screenshot-${i}.${e.type.split("/")[1] || "png"}`, { type: e.type })
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
r as MAX_COMMENT_IMAGES,
|
|
40
|
+
a as commentImageToken,
|
|
41
|
+
p as imageFilesFrom,
|
|
42
|
+
c as splitCommentImages,
|
|
43
|
+
l as stripCommentImages,
|
|
44
|
+
m as withCommentImages
|
|
45
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useState as p, useRef as m, useCallback as w } from "react";
|
|
2
|
+
import { useLiveOps as b } from "./live-ops.js";
|
|
3
|
+
function y(n, t) {
|
|
4
|
+
return `cfg-${n}:${t}`;
|
|
5
|
+
}
|
|
6
|
+
const l = (n, t) => n != null && t != null && String(n).toLowerCase() === String(t).toLowerCase();
|
|
7
|
+
function S(n, t, o) {
|
|
8
|
+
var i;
|
|
9
|
+
const r = typeof t.part == "string" && t.part ? t.part : "several", e = t.by, a = e && e.id != null ? { id: String(e.id), name: typeof e.name == "string" ? e.name : "Someone" } : null;
|
|
10
|
+
return n ? {
|
|
11
|
+
by: l((i = n.by) == null ? void 0 : i.id, a == null ? void 0 : a.id) || !n.by && !a ? a : null,
|
|
12
|
+
part: n.part === r ? r : "several",
|
|
13
|
+
at: o,
|
|
14
|
+
count: n.count + 1
|
|
15
|
+
} : { by: a, part: r, at: o, count: 1 };
|
|
16
|
+
}
|
|
17
|
+
function $(n, t, o = {}) {
|
|
18
|
+
const [r, e] = p(null), a = m(null), s = t != null && t !== "" ? y(n, t) : null, { meId: i, onChange: u } = o;
|
|
19
|
+
b(
|
|
20
|
+
s,
|
|
21
|
+
(c) => {
|
|
22
|
+
if (c != null && c.by && l(c.by.id, i)) return;
|
|
23
|
+
const g = S(a.current, c ?? {}, Date.now());
|
|
24
|
+
a.current = g, e(g), u == null || u(g);
|
|
25
|
+
},
|
|
26
|
+
{ enabled: o.enabled !== !1, debounceMs: 250 }
|
|
27
|
+
);
|
|
28
|
+
const f = w(() => {
|
|
29
|
+
a.current = null, e(null);
|
|
30
|
+
}, []);
|
|
31
|
+
return { change: r, clear: f };
|
|
32
|
+
}
|
|
33
|
+
const h = {
|
|
34
|
+
state: "changed a state",
|
|
35
|
+
transition: "changed a transition",
|
|
36
|
+
owners: "changed the owners",
|
|
37
|
+
binding: "changed a collection binding",
|
|
38
|
+
step: "changed a step",
|
|
39
|
+
settings: "changed the settings",
|
|
40
|
+
endpoint: "changed an endpoint",
|
|
41
|
+
version: "restored an earlier version",
|
|
42
|
+
draft: "changed the draft",
|
|
43
|
+
published: "published a new version",
|
|
44
|
+
widget: "changed a widget",
|
|
45
|
+
several: "made changes"
|
|
46
|
+
};
|
|
47
|
+
function v(n, t) {
|
|
48
|
+
const o = Math.max(0, Math.round((t - n) / 1e3));
|
|
49
|
+
if (o < 45) return "just now";
|
|
50
|
+
const r = Math.round(o / 60);
|
|
51
|
+
return r < 60 ? `${r} min ago` : `${Math.round(r / 60)} h ago`;
|
|
52
|
+
}
|
|
53
|
+
function x(n, t) {
|
|
54
|
+
var e;
|
|
55
|
+
const o = ((e = n.by) == null ? void 0 : e.name) || "Someone", r = n.count > 1 && n.part !== "several" ? h.several : h[n.part] ?? h.several;
|
|
56
|
+
return `${o} ${r} ${v(n.at, t)}`;
|
|
57
|
+
}
|
|
58
|
+
const C = /* @__PURE__ */ new Set([
|
|
59
|
+
"x",
|
|
60
|
+
"y",
|
|
61
|
+
"w",
|
|
62
|
+
"h",
|
|
63
|
+
"col",
|
|
64
|
+
"row",
|
|
65
|
+
"width",
|
|
66
|
+
"height",
|
|
67
|
+
"sort",
|
|
68
|
+
"updated_at"
|
|
69
|
+
]);
|
|
70
|
+
function d(n) {
|
|
71
|
+
const t = {};
|
|
72
|
+
for (const o of Object.keys(n).sort()) C.has(o) || (t[o] = n[o]);
|
|
73
|
+
try {
|
|
74
|
+
return JSON.stringify(t);
|
|
75
|
+
} catch {
|
|
76
|
+
return String(Math.random());
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function W(n, t) {
|
|
80
|
+
const o = new Map((n ?? []).map((e) => [String(e.id), d(e)])), r = [];
|
|
81
|
+
for (const e of t ?? []) {
|
|
82
|
+
const a = String(e.id), s = o.get(a);
|
|
83
|
+
s != null && s !== d(e) && r.push(a);
|
|
84
|
+
}
|
|
85
|
+
return r;
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
W as changedWidgetIds,
|
|
89
|
+
v as configAgoText,
|
|
90
|
+
x as configChangeText,
|
|
91
|
+
y as configWatchTopic,
|
|
92
|
+
S as foldConfigChange,
|
|
93
|
+
$ as useConfigWatch
|
|
94
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { get as f } from "./commands.js";
|
|
2
|
+
const u = [
|
|
3
|
+
["pipeline-state", "Workflow step"],
|
|
4
|
+
["never-copy", "On this collection’s list"],
|
|
5
|
+
["do-not-duplicate", "Marked “do not duplicate”"],
|
|
6
|
+
["read-only", "Read-only"],
|
|
7
|
+
["generated", "Generated ids"],
|
|
8
|
+
["calculated", "Calculated"],
|
|
9
|
+
["rollup", "Totals from lines"],
|
|
10
|
+
["rollup-switch", "Totals from lines"],
|
|
11
|
+
["hidden", "Hidden"],
|
|
12
|
+
["audit", "Stamps"]
|
|
13
|
+
];
|
|
14
|
+
function y(t) {
|
|
15
|
+
return t.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/_/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (e) => e.toUpperCase());
|
|
16
|
+
}
|
|
17
|
+
function g(t, e) {
|
|
18
|
+
var o, a, s;
|
|
19
|
+
const l = new Map(e.map((n) => [n.field, n])), i = /* @__PURE__ */ new Map();
|
|
20
|
+
for (const [n, r] of u)
|
|
21
|
+
i.has(r) || i.set(r, { reason: n, label: r, fields: [] });
|
|
22
|
+
for (const [n, r] of Object.entries(t ?? {})) {
|
|
23
|
+
const c = l.get(n);
|
|
24
|
+
if (!c || r === "list" || r === "audit") continue;
|
|
25
|
+
const p = (o = u.find(([d]) => d === r)) == null ? void 0 : o[1];
|
|
26
|
+
p && ((s = i.get(p)) == null || s.fields.push({ field: n, label: ((a = c.label) == null ? void 0 : a.trim()) || y(n) }));
|
|
27
|
+
}
|
|
28
|
+
return [...i.values()].filter((n) => n.fields.length > 0);
|
|
29
|
+
}
|
|
30
|
+
function b(t) {
|
|
31
|
+
return new Set(
|
|
32
|
+
Object.entries(t ?? {}).filter(([, e]) => e !== "hidden" && e !== "list").map(([e]) => e)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function w(t) {
|
|
36
|
+
return new Set(
|
|
37
|
+
Object.entries(t ?? {}).filter(([, e]) => e !== "rollup").map(([e]) => e)
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
async function S(t, e, l) {
|
|
41
|
+
try {
|
|
42
|
+
return await e.fetchQuery(h(t, l));
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function h(t, e) {
|
|
48
|
+
return {
|
|
49
|
+
queryKey: ["copy-rules", e],
|
|
50
|
+
queryFn: () => t.request(f(`/copy-rules/${e}`)).then((l) => {
|
|
51
|
+
var i;
|
|
52
|
+
return ((i = l == null ? void 0 : l.data) == null ? void 0 : i.skip) ?? {};
|
|
53
|
+
}),
|
|
54
|
+
staleTime: 6e4
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
u as COPY_REASON_WORDS,
|
|
59
|
+
b as childCopySkip,
|
|
60
|
+
h as copyRulesQuery,
|
|
61
|
+
S as fetchCopySkip,
|
|
62
|
+
y as fieldTitle,
|
|
63
|
+
g as groupNeverCopied,
|
|
64
|
+
w as headerCopySkip
|
|
65
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useRef as c, useState as s, useEffect as f } from "react";
|
|
2
|
+
import { getLiveMode as m } from "./live-preference.js";
|
|
3
|
+
const p = 6e3;
|
|
4
|
+
function S(t, n, u) {
|
|
5
|
+
return u !== "normal" || t == null || n == null || t === n ? null : { from: t, to: n };
|
|
6
|
+
}
|
|
7
|
+
function v(t, n = 200) {
|
|
8
|
+
return t >= n ? `${n}+` : String(t);
|
|
9
|
+
}
|
|
10
|
+
function x(t, n = !0) {
|
|
11
|
+
const u = c(void 0), [i, r] = s(null);
|
|
12
|
+
return f(() => {
|
|
13
|
+
const e = u.current;
|
|
14
|
+
if (u.current = t, !n || e === void 0) return;
|
|
15
|
+
const o = S(e, t, m());
|
|
16
|
+
if (!o) {
|
|
17
|
+
r(null);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
r(o);
|
|
21
|
+
const l = setTimeout(() => r(null), p);
|
|
22
|
+
return () => clearTimeout(l);
|
|
23
|
+
}, [t, n]), n ? i : null;
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
p as COUNT_STEP_MS,
|
|
27
|
+
v as countLabel,
|
|
28
|
+
S as countStepOf,
|
|
29
|
+
x as useCountStep
|
|
30
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useSyncExternalStore as b } from "react";
|
|
2
|
+
import { serverNow as l } from "./server-clock.js";
|
|
3
|
+
const h = 3e4, r = /* @__PURE__ */ new Set();
|
|
4
|
+
let s = l(), i = null;
|
|
5
|
+
function c() {
|
|
6
|
+
s = l();
|
|
7
|
+
for (const n of r) n();
|
|
8
|
+
}
|
|
9
|
+
function d() {
|
|
10
|
+
typeof document > "u" || (document.visibilityState === "visible" ? (c(), i || (i = setInterval(c, h))) : i && (clearInterval(i), i = null));
|
|
11
|
+
}
|
|
12
|
+
function v(n) {
|
|
13
|
+
return r.add(n), r.size === 1 && (s = l(), typeof document < "u" && document.visibilityState === "hidden" || (i = setInterval(c, h)), typeof document < "u" && document.addEventListener("visibilitychange", d)), () => {
|
|
14
|
+
r.delete(n), r.size === 0 && (i && clearInterval(i), i = null, typeof document < "u" && document.removeEventListener("visibilitychange", d));
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const a = () => s;
|
|
18
|
+
function $(n = !0) {
|
|
19
|
+
const e = b(n ? v : y, a, a);
|
|
20
|
+
return n ? e : l();
|
|
21
|
+
}
|
|
22
|
+
function y() {
|
|
23
|
+
return () => {
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function o(n) {
|
|
27
|
+
if (n == null || n === "") return null;
|
|
28
|
+
const e = typeof n == "number" ? n : new Date(n).getTime();
|
|
29
|
+
return Number.isFinite(e) ? e : null;
|
|
30
|
+
}
|
|
31
|
+
function p(n, e) {
|
|
32
|
+
const t = o(n.due_at);
|
|
33
|
+
if (t == null) return null;
|
|
34
|
+
if (e >= t) return "breached";
|
|
35
|
+
const u = o(n.warning_at);
|
|
36
|
+
return u != null && e >= u ? "warning" : "on_track";
|
|
37
|
+
}
|
|
38
|
+
function m(n) {
|
|
39
|
+
const e = Math.floor(Math.abs(n) / 6e4);
|
|
40
|
+
if (e < 1) return "under a minute";
|
|
41
|
+
const t = Math.floor(e / 1440), u = Math.floor(e % 1440 / 60), f = e % 60;
|
|
42
|
+
return t > 0 ? u > 0 ? `${t} d ${u} h` : `${t} d` : u > 0 ? f > 0 ? `${u} h ${f} m` : `${u} h` : `${f} m`;
|
|
43
|
+
}
|
|
44
|
+
function g(n, e) {
|
|
45
|
+
const t = o(n.due_at);
|
|
46
|
+
return t == null ? null : e >= t ? `overdue by ${m(e - t)}` : `due in ${m(t - e)}`;
|
|
47
|
+
}
|
|
48
|
+
function w(n, e) {
|
|
49
|
+
const t = o(n.due_at);
|
|
50
|
+
return t == null ? null : (t - e) / 36e5;
|
|
51
|
+
}
|
|
52
|
+
function I(n, e) {
|
|
53
|
+
const t = p(n, e);
|
|
54
|
+
return t ? {
|
|
55
|
+
...n,
|
|
56
|
+
status: t === "on_track" ? "ok" : t,
|
|
57
|
+
remaining_hours: w(n, e)
|
|
58
|
+
} : n;
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
h as DEADLINE_TICK_MS,
|
|
62
|
+
m as countdownText,
|
|
63
|
+
g as dueInText,
|
|
64
|
+
w as hoursLeft,
|
|
65
|
+
p as liveDeadlineStatus,
|
|
66
|
+
I as liveSlaReading,
|
|
67
|
+
$ as useDeadlineNow
|
|
68
|
+
};
|