@nivaro/react 0.3.113 → 0.3.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +1727 -19
- 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 +544 -504
- 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/cbv/column-totals.js +75 -67
- 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 +2076 -1686
- package/dist/shared/components/queue/queue-totals.js +92 -0
- package/dist/shared/components/queue/worklist-helpers.js +18 -14
- 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-link.js +56 -50
- 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,447 @@
|
|
|
1
|
+
import { useQueryClient as ee, useMutation as te, useQuery as ne } from "@tanstack/react-query";
|
|
2
|
+
import { useMemo as L, useCallback as d, useSyncExternalStore as ae } from "react";
|
|
3
|
+
import { useOptionalNivaroClient as z } from "../context.js";
|
|
4
|
+
import { post as w, del as M, patch as D, put as se, get as ie } from "./commands.js";
|
|
5
|
+
import { toastError as $ } from "./error-toast.js";
|
|
6
|
+
const re = {
|
|
7
|
+
state: "open",
|
|
8
|
+
width: 320,
|
|
9
|
+
tab: "watching",
|
|
10
|
+
sort: "mine"
|
|
11
|
+
}, we = 280, pe = 480, Q = 1180, b = {
|
|
12
|
+
all: ["watch-list"],
|
|
13
|
+
prefs: ["watch-list", "prefs"],
|
|
14
|
+
rows: (t) => ["watch-list", "rows", t],
|
|
15
|
+
summary: (t) => ["watch-list", "summary", t],
|
|
16
|
+
waiting: ["watch-list", "waiting"],
|
|
17
|
+
mentions: ["watch-list", "mentions"],
|
|
18
|
+
team: (t, a) => ["watch-list", "team", t, a],
|
|
19
|
+
alertOptions: (t, a) => ["watch-list", "alert-options", t, a]
|
|
20
|
+
}, oe = {
|
|
21
|
+
desktop: !1,
|
|
22
|
+
auto_add: !1,
|
|
23
|
+
auto_remove: !1,
|
|
24
|
+
digest: !1,
|
|
25
|
+
remove_completed: !1
|
|
26
|
+
}, y = (t, a) => `${t}:${a}`;
|
|
27
|
+
function ge(t) {
|
|
28
|
+
return t.map((a) => a.key).join("|");
|
|
29
|
+
}
|
|
30
|
+
let f = {
|
|
31
|
+
sheet: !1,
|
|
32
|
+
localChanged: /* @__PURE__ */ new Set(),
|
|
33
|
+
changed: 0,
|
|
34
|
+
unreadMentions: 0,
|
|
35
|
+
mounted: !1,
|
|
36
|
+
seenLocal: /* @__PURE__ */ new Map(),
|
|
37
|
+
wide: typeof window > "u" ? !0 : window.innerWidth >= Q
|
|
38
|
+
};
|
|
39
|
+
const N = /* @__PURE__ */ new Set();
|
|
40
|
+
function p(t) {
|
|
41
|
+
f = { ...f, ...t };
|
|
42
|
+
for (const a of N) a();
|
|
43
|
+
}
|
|
44
|
+
function ce(t) {
|
|
45
|
+
return N.add(t), N.size === 1 && typeof window < "u" && (window.addEventListener("resize", x), x()), () => {
|
|
46
|
+
N.delete(t), N.size === 0 && typeof window < "u" && window.removeEventListener("resize", x);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function x() {
|
|
50
|
+
const t = window.innerWidth >= Q;
|
|
51
|
+
t !== f.wide && p({ wide: t, ...t ? { sheet: !1 } : {} });
|
|
52
|
+
}
|
|
53
|
+
function ye() {
|
|
54
|
+
return ae(
|
|
55
|
+
ce,
|
|
56
|
+
() => f,
|
|
57
|
+
() => f
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
const W = {
|
|
61
|
+
publish(t) {
|
|
62
|
+
(t.changed !== f.changed || t.unreadMentions !== f.unreadMentions) && p(t);
|
|
63
|
+
},
|
|
64
|
+
setMounted(t) {
|
|
65
|
+
t !== f.mounted && p({ mounted: t });
|
|
66
|
+
},
|
|
67
|
+
openSheet: () => p({ sheet: !0 }),
|
|
68
|
+
closeSheet: () => p({ sheet: !1 }),
|
|
69
|
+
markLocal(t) {
|
|
70
|
+
if (t.length === 0) return;
|
|
71
|
+
const a = new Set(f.localChanged);
|
|
72
|
+
for (const r of t) a.add(r);
|
|
73
|
+
a.size !== f.localChanged.size && p({ localChanged: a });
|
|
74
|
+
},
|
|
75
|
+
noteSeen(t, a) {
|
|
76
|
+
const r = new Map(f.seenLocal), o = Date.now();
|
|
77
|
+
for (const i of t ?? a) r.set(i, o);
|
|
78
|
+
p({ seenLocal: r });
|
|
79
|
+
},
|
|
80
|
+
clearLocal(t) {
|
|
81
|
+
if (!t) {
|
|
82
|
+
f.localChanged.size && p({ localChanged: /* @__PURE__ */ new Set() });
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const a = new Set(f.localChanged);
|
|
86
|
+
for (const r of t) a.delete(r);
|
|
87
|
+
a.size !== f.localChanged.size && p({ localChanged: a });
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function R() {
|
|
91
|
+
return {
|
|
92
|
+
pins: [],
|
|
93
|
+
dock: re,
|
|
94
|
+
replies_seen_at: null,
|
|
95
|
+
max: 50,
|
|
96
|
+
settings: oe,
|
|
97
|
+
alerts: [],
|
|
98
|
+
teams: [],
|
|
99
|
+
removed: []
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function O(t) {
|
|
103
|
+
const a = R();
|
|
104
|
+
return t ? {
|
|
105
|
+
...a,
|
|
106
|
+
...t,
|
|
107
|
+
settings: { ...a.settings, ...t.settings ?? {} },
|
|
108
|
+
alerts: t.alerts ?? [],
|
|
109
|
+
teams: t.teams ?? [],
|
|
110
|
+
removed: t.removed ?? []
|
|
111
|
+
} : a;
|
|
112
|
+
}
|
|
113
|
+
function ue() {
|
|
114
|
+
const t = z(), a = ne({
|
|
115
|
+
queryKey: b.prefs,
|
|
116
|
+
queryFn: () => t.request(ie("/watch-list/prefs")).then((r) => r.data),
|
|
117
|
+
enabled: !!t,
|
|
118
|
+
staleTime: 5 * 6e4,
|
|
119
|
+
gcTime: 30 * 6e4,
|
|
120
|
+
retry: 1
|
|
121
|
+
});
|
|
122
|
+
return { prefs: L(() => O(a.data), [a.data]), ready: a.isSuccess };
|
|
123
|
+
}
|
|
124
|
+
let U = 0, A = 0, K = !1;
|
|
125
|
+
function ve() {
|
|
126
|
+
const t = z(), a = ee(), { prefs: r } = ue(), o = L(() => new Set(r.pins.map((n) => n.key)), [r.pins]), i = d(
|
|
127
|
+
(n) => {
|
|
128
|
+
a.setQueryData(b.prefs, (e) => n(e ?? R()));
|
|
129
|
+
},
|
|
130
|
+
[a]
|
|
131
|
+
), m = d(
|
|
132
|
+
(n) => {
|
|
133
|
+
n != null && n.data && a.setQueryData(
|
|
134
|
+
b.prefs,
|
|
135
|
+
(e) => O({ direct_reports: e == null ? void 0 : e.direct_reports, me: e == null ? void 0 : e.me, ...n.data })
|
|
136
|
+
);
|
|
137
|
+
},
|
|
138
|
+
[a]
|
|
139
|
+
), v = te({
|
|
140
|
+
mutationFn: async (n) => t.request(n)
|
|
141
|
+
}), l = d(
|
|
142
|
+
async (n, e) => {
|
|
143
|
+
if (!t) return;
|
|
144
|
+
const s = ++U;
|
|
145
|
+
A++;
|
|
146
|
+
try {
|
|
147
|
+
const u = await v.mutateAsync(n);
|
|
148
|
+
s === U ? m(u) : K = !0;
|
|
149
|
+
} catch (u) {
|
|
150
|
+
throw a.invalidateQueries({ queryKey: b.prefs }), $(u, e), u;
|
|
151
|
+
} finally {
|
|
152
|
+
A--, A === 0 && (K && (K = !1, a.invalidateQueries({ queryKey: b.prefs })), a.invalidateQueries({ queryKey: ["watch-list", "rows"] }), a.invalidateQueries({ queryKey: ["watch-list", "summary"] }));
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
[t, v, a, m]
|
|
156
|
+
), C = d(
|
|
157
|
+
async (n, e) => {
|
|
158
|
+
const s = y(n, e);
|
|
159
|
+
if (o.has(s)) return;
|
|
160
|
+
const u = (/* @__PURE__ */ new Date()).toISOString();
|
|
161
|
+
i((c) => ({
|
|
162
|
+
...c,
|
|
163
|
+
pins: [{ key: s, collection: n, id: String(e), pinned_at: u }, ...c.pins]
|
|
164
|
+
})), await l(
|
|
165
|
+
w("/watch-list/pins", { collection: n, id: String(e) }),
|
|
166
|
+
"Could not add it to your watch list"
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
[i, o, l]
|
|
170
|
+
), _ = d(
|
|
171
|
+
async (n, e) => {
|
|
172
|
+
const s = y(n, e);
|
|
173
|
+
i((u) => ({ ...u, pins: u.pins.filter((c) => c.key !== s) })), W.clearLocal([s]), await l(
|
|
174
|
+
M(`/watch-list/pins/${encodeURIComponent(n)}/${encodeURIComponent(String(e))}`),
|
|
175
|
+
"Could not remove it from your watch list"
|
|
176
|
+
);
|
|
177
|
+
},
|
|
178
|
+
[i, l]
|
|
179
|
+
), T = d(
|
|
180
|
+
async (n, e) => {
|
|
181
|
+
const s = o.has(y(n, e));
|
|
182
|
+
return s ? await _(n, e) : await C(n, e), !s;
|
|
183
|
+
},
|
|
184
|
+
[o, C, _]
|
|
185
|
+
), k = d(
|
|
186
|
+
(n) => {
|
|
187
|
+
i((e) => ({ ...e, dock: { ...e.dock, ...n } })), l(D("/watch-list/dock", n), "Could not save the watch list layout").catch(
|
|
188
|
+
() => {
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
},
|
|
192
|
+
[i, l]
|
|
193
|
+
), q = d(
|
|
194
|
+
(n) => {
|
|
195
|
+
i((e) => {
|
|
196
|
+
const s = new Map(e.pins.map((c) => [c.key, c])), u = n.map((c) => s.get(c)).filter((c) => !!c);
|
|
197
|
+
for (const c of e.pins) n.includes(c.key) || u.push(c);
|
|
198
|
+
return { ...e, pins: u };
|
|
199
|
+
}), l(se("/watch-list/order", { keys: n }), "Could not save the new order").catch(() => {
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
[i, l]
|
|
203
|
+
), E = d(
|
|
204
|
+
(n) => {
|
|
205
|
+
W.clearLocal(n), W.noteSeen(
|
|
206
|
+
n ?? null,
|
|
207
|
+
r.pins.map((e) => e.key)
|
|
208
|
+
), a.setQueriesData(
|
|
209
|
+
{ queryKey: ["watch-list", "rows"] },
|
|
210
|
+
(e) => {
|
|
211
|
+
var s;
|
|
212
|
+
return e && {
|
|
213
|
+
...e,
|
|
214
|
+
changed: n ? e.changed.filter((u) => !n.includes(u)) : [],
|
|
215
|
+
rows: (s = e.rows) == null ? void 0 : s.map(
|
|
216
|
+
(u) => u.change && (!n || n.includes(u.key)) ? { ...u, change: { ...u.change, changed: !1, unseen: 0 } } : u
|
|
217
|
+
)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
), a.setQueriesData(
|
|
221
|
+
{ queryKey: ["watch-list", "summary"] },
|
|
222
|
+
(e) => e && { ...e, changed: n ? e.changed.filter((s) => !n.includes(s)) : [] }
|
|
223
|
+
), t && t.request(w("/watch-list/seen", n ? { keys: n } : {})).then(m).catch(() => {
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
[t, a, m, r.pins]
|
|
227
|
+
), I = d(
|
|
228
|
+
async (n) => {
|
|
229
|
+
i((e) => {
|
|
230
|
+
const s = { ...e.settings, ...n };
|
|
231
|
+
return s.auto_add || (s.auto_remove = !1), { ...e, settings: s };
|
|
232
|
+
}), await l(D("/watch-list/settings", n), "Could not save the setting");
|
|
233
|
+
},
|
|
234
|
+
[i, l]
|
|
235
|
+
), P = d(
|
|
236
|
+
async (n) => {
|
|
237
|
+
await l(w("/watch-list/alerts", n), "Could not add the alert");
|
|
238
|
+
},
|
|
239
|
+
[l]
|
|
240
|
+
), H = d(
|
|
241
|
+
async (n) => {
|
|
242
|
+
i((e) => ({ ...e, alerts: e.alerts.filter((s) => s.id !== n) })), await l(
|
|
243
|
+
M(`/watch-list/alerts/${encodeURIComponent(n)}`),
|
|
244
|
+
"Could not remove the alert"
|
|
245
|
+
);
|
|
246
|
+
},
|
|
247
|
+
[i, l]
|
|
248
|
+
), F = d(
|
|
249
|
+
async (n) => {
|
|
250
|
+
if (!t) return null;
|
|
251
|
+
try {
|
|
252
|
+
const e = await t.request(
|
|
253
|
+
w("/watch-list/teams", n)
|
|
254
|
+
);
|
|
255
|
+
return m(e), e.data.created ?? null;
|
|
256
|
+
} catch (e) {
|
|
257
|
+
throw $(e, "Could not make the shared list"), e;
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
[t, m]
|
|
261
|
+
), j = d(
|
|
262
|
+
async (n, e) => {
|
|
263
|
+
await l(D(g(n), e), "Could not save the shared list");
|
|
264
|
+
},
|
|
265
|
+
[l]
|
|
266
|
+
), G = d(
|
|
267
|
+
async (n, e, s) => {
|
|
268
|
+
const u = y(n, e);
|
|
269
|
+
i(
|
|
270
|
+
(c) => s ? {
|
|
271
|
+
...c,
|
|
272
|
+
teams: c.teams.map(
|
|
273
|
+
(h) => h.id === s ? { ...h, removed: (h.removed ?? []).filter((S) => S.key !== u) } : h
|
|
274
|
+
)
|
|
275
|
+
} : { ...c, removed: c.removed.filter((h) => h.key !== u) }
|
|
276
|
+
), await l(
|
|
277
|
+
w(s ? `${g(s)}/removed/restore` : "/watch-list/removed/restore", {
|
|
278
|
+
collection: n,
|
|
279
|
+
id: e
|
|
280
|
+
}),
|
|
281
|
+
"Could not put it back"
|
|
282
|
+
);
|
|
283
|
+
},
|
|
284
|
+
[i, l]
|
|
285
|
+
), V = d(
|
|
286
|
+
async (n) => {
|
|
287
|
+
i((e) => ({ ...e, teams: e.teams.filter((s) => s.id !== n) })), await l(M(g(n)), "Could not delete the shared list");
|
|
288
|
+
},
|
|
289
|
+
[i, l]
|
|
290
|
+
), X = d(
|
|
291
|
+
async (n) => {
|
|
292
|
+
i((e) => ({ ...e, teams: e.teams.filter((s) => s.id !== n) })), await l(w(`${g(n)}/leave`, {}), "Could not leave the shared list");
|
|
293
|
+
},
|
|
294
|
+
[i, l]
|
|
295
|
+
), B = d(
|
|
296
|
+
async (n) => {
|
|
297
|
+
if (!t) return null;
|
|
298
|
+
try {
|
|
299
|
+
const e = await t.request(
|
|
300
|
+
w(`${g(n)}/take-over`, {})
|
|
301
|
+
);
|
|
302
|
+
return m(e), e.data.moved ?? null;
|
|
303
|
+
} catch (e) {
|
|
304
|
+
throw $(e, "Could not take over the shared list"), e;
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
[t, m]
|
|
308
|
+
), J = d(
|
|
309
|
+
async (n, e, s) => {
|
|
310
|
+
const u = y(e, s);
|
|
311
|
+
i((c) => ({
|
|
312
|
+
...c,
|
|
313
|
+
teams: c.teams.map(
|
|
314
|
+
(h) => h.id === n && !h.pins.some((S) => S.key === u) ? {
|
|
315
|
+
...h,
|
|
316
|
+
pins: [
|
|
317
|
+
{ key: u, collection: e, id: s, pinned_at: (/* @__PURE__ */ new Date()).toISOString(), by: "" },
|
|
318
|
+
...h.pins
|
|
319
|
+
]
|
|
320
|
+
} : h
|
|
321
|
+
)
|
|
322
|
+
})), await l(
|
|
323
|
+
w(`${g(n)}/pins`, { collection: e, id: s }),
|
|
324
|
+
"Could not add it to the shared list"
|
|
325
|
+
);
|
|
326
|
+
},
|
|
327
|
+
[i, l]
|
|
328
|
+
), Y = d(
|
|
329
|
+
async (n, e, s) => {
|
|
330
|
+
const u = y(e, s);
|
|
331
|
+
i((c) => ({
|
|
332
|
+
...c,
|
|
333
|
+
teams: c.teams.map(
|
|
334
|
+
(h) => h.id === n ? { ...h, pins: h.pins.filter((S) => S.key !== u) } : h
|
|
335
|
+
)
|
|
336
|
+
})), await l(
|
|
337
|
+
M(`${g(n)}/pins/${encodeURIComponent(e)}/${encodeURIComponent(s)}`),
|
|
338
|
+
"Could not remove it from the shared list"
|
|
339
|
+
);
|
|
340
|
+
},
|
|
341
|
+
[i, l]
|
|
342
|
+
), Z = d(
|
|
343
|
+
(n, e) => {
|
|
344
|
+
a.setQueriesData(
|
|
345
|
+
{ queryKey: ["watch-list", "team", n] },
|
|
346
|
+
(s) => {
|
|
347
|
+
var u;
|
|
348
|
+
return s && {
|
|
349
|
+
...s,
|
|
350
|
+
changed: e ? s.changed.filter((c) => !e.includes(c)) : [],
|
|
351
|
+
rows: (u = s.rows) == null ? void 0 : u.map(
|
|
352
|
+
(c) => c.change && (!e || e.includes(c.key)) ? { ...c, change: { ...c.change, changed: !1, unseen: 0 } } : c
|
|
353
|
+
)
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
), t && t.request(w(`${g(n)}/seen`, e ? { keys: e } : {})).catch(() => {
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
[t, a]
|
|
360
|
+
);
|
|
361
|
+
return {
|
|
362
|
+
prefs: r,
|
|
363
|
+
setSettings: I,
|
|
364
|
+
addAlert: P,
|
|
365
|
+
removeAlert: H,
|
|
366
|
+
createTeam: F,
|
|
367
|
+
editTeam: j,
|
|
368
|
+
deleteTeam: V,
|
|
369
|
+
leaveTeam: X,
|
|
370
|
+
takeOverTeam: B,
|
|
371
|
+
restoreRemoved: G,
|
|
372
|
+
teamPin: J,
|
|
373
|
+
teamUnpin: Y,
|
|
374
|
+
teamSeen: Z,
|
|
375
|
+
isPinned: (n, e) => o.has(y(n, e)),
|
|
376
|
+
pin: C,
|
|
377
|
+
unpin: _,
|
|
378
|
+
toggle: T,
|
|
379
|
+
setDock: k,
|
|
380
|
+
reorder: q,
|
|
381
|
+
markSeen: E,
|
|
382
|
+
full: r.pins.length >= r.max
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
const g = (t) => `/watch-list/teams/${encodeURIComponent(t)}`;
|
|
386
|
+
function Ce(t) {
|
|
387
|
+
const a = t;
|
|
388
|
+
return !a || typeof a.closest != "function" ? !1 : !!a.closest(
|
|
389
|
+
'input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="textbox"], [role="combobox"], [role="menu"], [role="listbox"]'
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
function _e(t, a) {
|
|
393
|
+
if (a === "mine") return t;
|
|
394
|
+
const r = (o) => o ? new Date(o).getTime() : Number.NaN;
|
|
395
|
+
return [...t].sort((o, i) => {
|
|
396
|
+
var l, C, _, T;
|
|
397
|
+
if (o.available !== i.available) return o.available ? -1 : 1;
|
|
398
|
+
if (a === "changed") {
|
|
399
|
+
const k = r(((l = o.change) == null ? void 0 : l.at) ?? o.updated_at), q = r(((C = i.change) == null ? void 0 : C.at) ?? i.updated_at);
|
|
400
|
+
return (Number.isNaN(q) ? 0 : q) - (Number.isNaN(k) ? 0 : k);
|
|
401
|
+
}
|
|
402
|
+
const m = r((_ = o.sla) == null ? void 0 : _.due_at), v = r((T = i.sla) == null ? void 0 : T.due_at);
|
|
403
|
+
return Number.isNaN(m) && Number.isNaN(v) ? 0 : Number.isNaN(m) ? 1 : Number.isNaN(v) ? -1 : m - v;
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function Se(t) {
|
|
407
|
+
const a = Math.max(0, Math.round(t));
|
|
408
|
+
return a < 3600 ? `${Math.max(1, Math.round(a / 60))} m` : a < 86400 ? `${Math.round(a / 3600)} h` : `${Math.round(a / 86400)} d`;
|
|
409
|
+
}
|
|
410
|
+
function be(t, a, r) {
|
|
411
|
+
const o = /* @__PURE__ */ new Set();
|
|
412
|
+
for (const i of t ?? []) r.has(i) && o.add(i);
|
|
413
|
+
for (const i of a) r.has(i) && o.add(i);
|
|
414
|
+
return [...o];
|
|
415
|
+
}
|
|
416
|
+
function Ne(t, a) {
|
|
417
|
+
return a.size === 0 ? t : t.map((r) => {
|
|
418
|
+
var i;
|
|
419
|
+
const o = a.get(r.key);
|
|
420
|
+
return !o || !((i = r.change) != null && i.changed) || new Date(r.change.at).getTime() > o ? r : { ...r, change: { ...r.change, changed: !1, unseen: 0 } };
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function Te(t, a) {
|
|
424
|
+
const r = new Map(a.filter((o) => o.done_at).map((o) => [o.key, o.done_at]));
|
|
425
|
+
return r.size === 0 ? t : t.map((o) => r.has(o.key) ? { ...o, completed_at: r.get(o.key) } : o);
|
|
426
|
+
}
|
|
427
|
+
export {
|
|
428
|
+
re as WATCH_DOCK_DEFAULT,
|
|
429
|
+
Q as WATCH_DOCK_MIN_VIEWPORT,
|
|
430
|
+
oe as WATCH_SETTINGS_DEFAULT,
|
|
431
|
+
pe as WATCH_WIDTH_MAX,
|
|
432
|
+
we as WATCH_WIDTH_MIN,
|
|
433
|
+
be as changedKeys,
|
|
434
|
+
y as pinKeyOf,
|
|
435
|
+
ge as pinsSignature,
|
|
436
|
+
_e as sortWatchRows,
|
|
437
|
+
Se as spanText,
|
|
438
|
+
Ce as typingTarget,
|
|
439
|
+
ve as useWatchActions,
|
|
440
|
+
ue as useWatchPrefs,
|
|
441
|
+
ye as useWatchUi,
|
|
442
|
+
b as watchKeys,
|
|
443
|
+
W as watchUi,
|
|
444
|
+
Te as withCompleted,
|
|
445
|
+
Ne as withLocalSeen,
|
|
446
|
+
O as withPrefDefaults
|
|
447
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { widgetImageSubtitleLines as u } from "./widget-image.js";
|
|
2
|
+
const y = "data-widget-image-ignore";
|
|
3
|
+
async function b() {
|
|
4
|
+
const t = await import("html2canvas"), n = t.default ?? t;
|
|
5
|
+
if (typeof n != "function") throw new Error("html2canvas missing");
|
|
6
|
+
return n;
|
|
7
|
+
}
|
|
8
|
+
const w = 'system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
|
|
9
|
+
function x(t, n) {
|
|
10
|
+
const o = t.createElement("div");
|
|
11
|
+
o.setAttribute("data-widget-image-header", "1"), o.style.cssText = `flex:none;margin:0 0 10px;padding:0 0 8px;border-bottom:1px solid #e2e8f0;font-family:${w};text-align:left;`;
|
|
12
|
+
const i = t.createElement("div");
|
|
13
|
+
i.textContent = n.title, i.style.cssText = "font-size:15px;font-weight:600;line-height:1.3;color:#0f172a;word-break:break-word;", o.appendChild(i);
|
|
14
|
+
for (const d of u(n)) {
|
|
15
|
+
const s = t.createElement("div");
|
|
16
|
+
s.textContent = d, s.style.cssText = "margin-top:2px;font-size:11.5px;line-height:1.4;color:#475569;", o.appendChild(s);
|
|
17
|
+
}
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
async function E(t, n, o = {}) {
|
|
21
|
+
const i = await b(), d = t.getBoundingClientRect(), s = Math.max(1, Math.round(d.width)), f = Math.max(1, Math.round(d.height)), h = await i(t, {
|
|
22
|
+
scale: o.scale ?? 2,
|
|
23
|
+
backgroundColor: "#ffffff",
|
|
24
|
+
useCORS: !0,
|
|
25
|
+
logging: !1,
|
|
26
|
+
onclone: (a, r) => {
|
|
27
|
+
const m = a.documentElement;
|
|
28
|
+
m.classList.remove("dark"), a.body.classList.remove("dark"), m.style.colorScheme = "light";
|
|
29
|
+
for (const l of Array.from(r.querySelectorAll(`[${y}]`)))
|
|
30
|
+
l.remove();
|
|
31
|
+
for (const l of Array.from(a.body.children))
|
|
32
|
+
l !== r && !l.contains(r) && (l.style.display = "none");
|
|
33
|
+
a.body.style.margin = "0", a.body.style.background = "#ffffff", r.parentElement !== a.body && a.body.appendChild(r);
|
|
34
|
+
const e = r.style;
|
|
35
|
+
e.gridColumn = "auto", e.gridRow = "auto", e.margin = "0", e.boxShadow = "none", e.background = "#ffffff", e.color = "#0f172a", e.borderColor = "#e2e8f0", e.width = `${s}px`, e.maxWidth = "none", e.height = `${f}px`, e.minHeight = "0", e.maxHeight = "none", e.overflow = "hidden", e.boxSizing = "border-box", e.display || (e.display = "flex"), getComputedStyle(r).display === "flex" && (e.flexDirection = "column");
|
|
36
|
+
const g = x(a, n);
|
|
37
|
+
r.insertBefore(g, r.firstChild);
|
|
38
|
+
const p = g.getBoundingClientRect().height + 10;
|
|
39
|
+
e.height = `${f + Math.ceil(p)}px`;
|
|
40
|
+
}
|
|
41
|
+
}), c = await new Promise((a) => h.toBlob(a, "image/png"));
|
|
42
|
+
if (!c) throw new Error("picture was empty");
|
|
43
|
+
return c;
|
|
44
|
+
}
|
|
45
|
+
function v(t, n) {
|
|
46
|
+
const o = URL.createObjectURL(t), i = document.createElement("a");
|
|
47
|
+
i.href = o, i.download = n, document.body.appendChild(i), i.click(), i.remove(), setTimeout(() => URL.revokeObjectURL(o), 1e4);
|
|
48
|
+
}
|
|
49
|
+
async function R(t, n) {
|
|
50
|
+
var o;
|
|
51
|
+
if (t.catch(() => {
|
|
52
|
+
}), typeof ClipboardItem < "u" && typeof navigator < "u" && ((o = navigator.clipboard) != null && o.write))
|
|
53
|
+
try {
|
|
54
|
+
return await navigator.clipboard.write([new ClipboardItem({ "image/png": t })]), "copied";
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return v(await t, n), "saved";
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
y as WIDGET_IMAGE_IGNORE_ATTR,
|
|
61
|
+
R as copyPngOrSave,
|
|
62
|
+
v as downloadBlob,
|
|
63
|
+
E as renderWidgetImage
|
|
64
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { describeCondition as c, orList as u, describeFilterObject as f } from "./config-sentences.js";
|
|
2
|
+
import { titleCase as d } from "./utils.js";
|
|
3
|
+
function m(t = /* @__PURE__ */ new Date()) {
|
|
4
|
+
const r = t instanceof Date ? t : new Date(t);
|
|
5
|
+
return Number.isNaN(r.getTime()) ? "" : `As of ${new Intl.DateTimeFormat("en-US", {
|
|
6
|
+
month: "short",
|
|
7
|
+
day: "numeric",
|
|
8
|
+
year: "numeric",
|
|
9
|
+
hour: "numeric",
|
|
10
|
+
minute: "2-digit",
|
|
11
|
+
hour12: !0
|
|
12
|
+
}).format(r)}`;
|
|
13
|
+
}
|
|
14
|
+
const h = {
|
|
15
|
+
this_month: "this month",
|
|
16
|
+
last_30_days: "last 30 days",
|
|
17
|
+
last_3_months: "last 3 months",
|
|
18
|
+
last_6_months: "last 6 months",
|
|
19
|
+
last_12_months: "last 12 months",
|
|
20
|
+
ytd: "year to date"
|
|
21
|
+
};
|
|
22
|
+
function b(t) {
|
|
23
|
+
if (!(t != null && t.preset)) return null;
|
|
24
|
+
if (t.preset === "custom")
|
|
25
|
+
return t.start && t.end ? `Dates: ${t.start} to ${t.end}` : t.start ? `Dates: from ${t.start}` : t.end ? `Dates: up to ${t.end}` : null;
|
|
26
|
+
const r = h[t.preset];
|
|
27
|
+
return r ? `Dates: ${r}` : null;
|
|
28
|
+
}
|
|
29
|
+
function g(t, r = {}) {
|
|
30
|
+
const s = [];
|
|
31
|
+
for (const e of t ?? []) {
|
|
32
|
+
if (!(e != null && e.field) || !Array.isArray(e.values) || e.values.length === 0) continue;
|
|
33
|
+
const i = e.values.map((a, l) => {
|
|
34
|
+
var o;
|
|
35
|
+
return String(((o = e.labels) == null ? void 0 : o[l]) ?? a);
|
|
36
|
+
}), n = c(e.field, "in", i, {
|
|
37
|
+
...r,
|
|
38
|
+
choices: void 0,
|
|
39
|
+
records: void 0
|
|
40
|
+
});
|
|
41
|
+
s.push(n ?? `${d(e.field)} is ${u(i)}`);
|
|
42
|
+
}
|
|
43
|
+
return s;
|
|
44
|
+
}
|
|
45
|
+
function p(t, r = {}) {
|
|
46
|
+
const s = [];
|
|
47
|
+
for (const e of t ?? []) {
|
|
48
|
+
if (!(e != null && e.field) || e.value === "" || e.value == null) continue;
|
|
49
|
+
const i = c(e.field, e.op === "contains" ? "contains" : "eq", e.value, r);
|
|
50
|
+
i && s.push(i);
|
|
51
|
+
}
|
|
52
|
+
return s;
|
|
53
|
+
}
|
|
54
|
+
function y(t, r = {}) {
|
|
55
|
+
let s = t;
|
|
56
|
+
if (typeof t == "string") {
|
|
57
|
+
const i = t.trim();
|
|
58
|
+
if (!i) return [];
|
|
59
|
+
try {
|
|
60
|
+
s = JSON.parse(i);
|
|
61
|
+
} catch {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!s || typeof s != "object" || Array.isArray(s)) return [];
|
|
66
|
+
if (Object.keys(s).length === 0) return [];
|
|
67
|
+
const e = f(s, r);
|
|
68
|
+
return e ? [e.charAt(0).toUpperCase() + e.slice(1)] : ["A custom filter on this widget"];
|
|
69
|
+
}
|
|
70
|
+
function D(t, r = {}) {
|
|
71
|
+
const s = [];
|
|
72
|
+
let e = !1;
|
|
73
|
+
for (const i of t ?? []) {
|
|
74
|
+
if (!(i != null && i.field)) continue;
|
|
75
|
+
const n = c(i.field, i.op, i.value, r);
|
|
76
|
+
n ? s.push(n.charAt(0).toUpperCase() + n.slice(1)) : e = !0;
|
|
77
|
+
}
|
|
78
|
+
return e && s.push("A custom filter on this widget"), s;
|
|
79
|
+
}
|
|
80
|
+
function A(t) {
|
|
81
|
+
var n;
|
|
82
|
+
const r = t.labels ?? {}, s = /* @__PURE__ */ new Set(), e = [], i = (a) => {
|
|
83
|
+
for (const l of a) {
|
|
84
|
+
const o = l == null ? void 0 : l.trim();
|
|
85
|
+
o && !s.has(o) && (s.add(o), e.push(o));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
return i([b(t.dateRange)]), i(p(t.dashboardFilters, r)), i(g(t.entityFilters, r)), i(y(t.widgetFilter, r)), i(D(t.widgetRules, r)), i(t.extra ?? []), {
|
|
89
|
+
title: ((n = t.title) == null ? void 0 : n.trim()) || "Figure",
|
|
90
|
+
asOf: m(t.asOf ?? /* @__PURE__ */ new Date()),
|
|
91
|
+
filters: e
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function w(t) {
|
|
95
|
+
return [t.asOf, t.filters.length ? `Filters: ${t.filters.join(" · ")}` : "No filters"];
|
|
96
|
+
}
|
|
97
|
+
function N(t, r = /* @__PURE__ */ new Date()) {
|
|
98
|
+
const s = r instanceof Date ? r : new Date(r), e = (a) => String(a).padStart(2, "0"), i = Number.isNaN(s.getTime()) ? "" : `-${s.getFullYear()}-${e(s.getMonth() + 1)}-${e(s.getDate())}-${e(s.getHours())}${e(s.getMinutes())}`;
|
|
99
|
+
return `${(t || "figure").normalize("NFKD").replace(/[^\w\s-]+/g, "").trim().replace(/\s+/g, "-").slice(0, 60) || "figure"}${i}.png`;
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
A as buildWidgetImageLabel,
|
|
103
|
+
b as describeDateRangeFilter,
|
|
104
|
+
g as describeEntityFilters,
|
|
105
|
+
p as describeGlobalFilters,
|
|
106
|
+
y as describeWidgetOwnFilter,
|
|
107
|
+
D as describeWidgetRules,
|
|
108
|
+
m as formatAsOf,
|
|
109
|
+
N as widgetImageFileName,
|
|
110
|
+
w as widgetImageSubtitleLines
|
|
111
|
+
};
|