@burdenoff/microfe-bigconsole 2026.1122.2 → 2026.1122.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/bigconsole/asof/AsOfProvider.d.ts +7 -0
  2. package/dist/bigconsole/asof/AsOfProvider.js +5 -2
  3. package/dist/bigconsole/asof/asOfParam.d.ts +5 -0
  4. package/dist/bigconsole/asof/asOfParam.js +7 -4
  5. package/dist/bigconsole/asof/index.d.ts +2 -2
  6. package/dist/bigconsole/asof/index.js +6 -6
  7. package/dist/bigconsole/asof/liveOnlySurfaces.d.ts +43 -0
  8. package/dist/bigconsole/components/dashboard/DashboardCanvas.js +133 -127
  9. package/dist/bigconsole/components/dashboard/DashboardCommentsDrawer.d.ts +16 -0
  10. package/dist/bigconsole/components/dashboard/DashboardCommentsDrawer.js +308 -0
  11. package/dist/bigconsole/components/dashboard/DashboardPresenceBar.d.ts +8 -0
  12. package/dist/bigconsole/components/dashboard/DashboardPresenceBar.js +138 -0
  13. package/dist/bigconsole/components/dashboard/DashboardToolbar.js +51 -51
  14. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.d.ts +3 -1
  15. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/FilterChip.js +34 -34
  16. package/dist/bigconsole/components/dashboard/GlobalFiltersBar/GlobalFiltersBar.js +154 -145
  17. package/dist/bigconsole/components/dashboard/ShareDialog/ShareDialog.js +302 -294
  18. package/dist/bigconsole/components/dashboard/index.d.ts +2 -0
  19. package/dist/bigconsole/components/dashboard/index.js +3 -1
  20. package/dist/bigconsole/components/widgets/WidgetWrapper.js +165 -163
  21. package/dist/bigconsole/components/widgets/comments/WidgetComments.d.ts +13 -0
  22. package/dist/bigconsole/components/widgets/comments/WidgetComments.js +213 -117
  23. package/dist/bigconsole/components/widgets/comments/commentMentions.d.ts +58 -0
  24. package/dist/bigconsole/components/widgets/comments/commentMentions.js +66 -0
  25. package/dist/bigconsole/hooks/index.d.ts +2 -1
  26. package/dist/bigconsole/hooks/index.js +1 -0
  27. package/dist/bigconsole/hooks/useDashboardPresence.d.ts +44 -0
  28. package/dist/bigconsole/hooks/useDashboardPresence.js +147 -0
  29. package/dist/bigconsole/hooks/useWidgetComments.d.ts +12 -1
  30. package/dist/bigconsole/hooks/useWidgetComments.js +25 -13
  31. package/dist/bigconsole/pages/DashboardBuilderPage.js +88 -64
  32. package/dist/bigconsole/pages/DashboardViewPage.js +255 -221
  33. package/dist/generated/wspace-operations.d.ts +35 -0
  34. package/dist/generated/wspace-operations.js +353 -54
  35. package/package.json +1 -1
@@ -0,0 +1,44 @@
1
+ /**
2
+ * useDashboardPresence Hook (BOFF-4144)
3
+ *
4
+ * Wires the live active-viewer roster to `wspace-bigconsole-svc`'s
5
+ * DashboardPresenceProvider (`dashboardPresence`, `heartbeatDashboardPresence`,
6
+ * `leaveDashboardPresence`).
7
+ *
8
+ * Lifecycle:
9
+ * - Generates a stable per-mount `connectionId` matching `^[A-Za-z0-9_.:-]{1,128}$`.
10
+ * - Sends an immediate heartbeat on mount, then every 15s while the tab is visible,
11
+ * and immediately on returning to visible.
12
+ * - Polls `dashboardPresence` every 15s (network-only) so arriving and expiring
13
+ * viewers (server active cutoff: 45s) stay fresh.
14
+ * - Sends a best-effort `leaveDashboardPresence` on unmount and `pagehide`.
15
+ * - Resolves viewer display names strictly within the current workspace via
16
+ * `workspaceMemberIdentities`, falling back cleanly to a short handle.
17
+ */
18
+ /** Heartbeat cadence matching backend presence.gql (every ~15s; server expires at 45s). */
19
+ export declare const PRESENCE_HEARTBEAT_INTERVAL_MS = 15000;
20
+ /** Roster poll cadence so newly joined or expired viewers appear promptly. */
21
+ export declare const PRESENCE_POLL_INTERVAL_MS = 15000;
22
+ /** Backend active cutoff (45s) exposed for UI copy and tests. */
23
+ export declare const PRESENCE_ACTIVE_WINDOW_MS = 45000;
24
+ export interface DashboardPresenceViewerInfo {
25
+ actorId: string;
26
+ displayName: string;
27
+ email?: string;
28
+ connectionCount: number;
29
+ lastSeenAt: string;
30
+ isCurrentUser: boolean;
31
+ }
32
+ export interface UseDashboardPresenceResult {
33
+ viewers: DashboardPresenceViewerInfo[];
34
+ activeCount: number;
35
+ unavailable: boolean;
36
+ loading: boolean;
37
+ error?: Error;
38
+ connectionId: string;
39
+ refetch: () => void;
40
+ }
41
+ /** Generate a valid presence connectionId (`^[A-Za-z0-9_.:-]{1,128}$`). */
42
+ export declare function buildPresenceConnectionId(): string;
43
+ export declare function useDashboardPresence(dashboardId: string | undefined, enabled?: boolean): UseDashboardPresenceResult;
44
+ export default useDashboardPresence;
@@ -0,0 +1,147 @@
1
+ import "../context/index.js";
2
+ import { useBigConsole as e } from "../context/BigConsoleContext.js";
3
+ import { BigConsoleDashboardPresenceDocument as t, BigConsoleShareMemberIdentitiesDocument as n, HeartbeatBigConsoleDashboardPresenceDocument as r, LeaveBigConsoleDashboardPresenceDocument as i } from "../../generated/wspace-operations.js";
4
+ import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
5
+ import { useApolloClient as u, useMutation as d, useQuery as f } from "@apollo/client/react";
6
+ // src/bigconsole/hooks/useDashboardPresence.ts
7
+ var p = 15e3, m = 15e3;
8
+ function h() {
9
+ if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return `bc-${crypto.randomUUID()}`;
10
+ let e = Math.random().toString(36).slice(2, 12);
11
+ return `bc-${Date.now().toString(36)}-${e}`;
12
+ }
13
+ function g(e) {
14
+ return `User ${e.slice(0, 6)}`;
15
+ }
16
+ function _(_, v = !0) {
17
+ let y = u(), { workspaceId: b, currentUser: x } = e(), S = !!(v && _), C = c(null);
18
+ C.current ||= h();
19
+ let w = C.current, [T] = d(r), [E] = d(i), { data: D, loading: O, error: k, refetch: A } = f(t, {
20
+ variables: { dashboardId: _ ?? "" },
21
+ skip: !S,
22
+ fetchPolicy: "network-only",
23
+ nextFetchPolicy: "network-only",
24
+ pollInterval: S ? m : 0,
25
+ notifyOnNetworkStatusChange: !1
26
+ }), [j, M] = l(!1), [N, P] = l({}), F = c(/* @__PURE__ */ new Set()), I = a(async () => {
27
+ if (_) try {
28
+ let e = (await T({ variables: {
29
+ dashboardId: _,
30
+ connectionId: w
31
+ } })).data?.heartbeatDashboardPresence;
32
+ M(e === !1);
33
+ } catch {
34
+ M(!0);
35
+ }
36
+ }, [
37
+ w,
38
+ _,
39
+ T
40
+ ]), L = a(() => {
41
+ _ && E({ variables: {
42
+ dashboardId: _,
43
+ connectionId: w
44
+ } }).catch(() => {});
45
+ }, [
46
+ w,
47
+ _,
48
+ E
49
+ ]);
50
+ o(() => {
51
+ if (!S || !_) return;
52
+ let e = !1, t = async (t) => {
53
+ (typeof document > "u" || document.visibilityState !== "hidden") && (await I(), !e && t && A().catch(() => {}));
54
+ };
55
+ t(!0);
56
+ let n = window.setInterval(() => {
57
+ t(!1);
58
+ }, p), r = () => {
59
+ document.visibilityState === "visible" && t(!0);
60
+ }, i = () => {
61
+ L();
62
+ };
63
+ return typeof document < "u" && document.addEventListener("visibilitychange", r), typeof window < "u" && window.addEventListener("pagehide", i), () => {
64
+ e = !0, window.clearInterval(n), typeof document < "u" && document.removeEventListener("visibilitychange", r), typeof window < "u" && window.removeEventListener("pagehide", i), L();
65
+ };
66
+ }, [
67
+ S,
68
+ _,
69
+ A,
70
+ I,
71
+ L
72
+ ]), o(() => {
73
+ F.current = /* @__PURE__ */ new Set(), P({});
74
+ }, [b]);
75
+ let R = D?.dashboardPresence.viewers;
76
+ o(() => {
77
+ if (!S || !b || !R || R.length === 0) return;
78
+ let e = R.map((e) => e.actorId).filter((e) => e !== x?.id && !F.current.has(e));
79
+ if (e.length === 0) return;
80
+ for (let t of e) F.current.add(t);
81
+ let t = !1;
82
+ return y.query({
83
+ query: n,
84
+ variables: {
85
+ workspaceId: b,
86
+ userIds: e.slice(0, 50)
87
+ },
88
+ fetchPolicy: "no-cache",
89
+ errorPolicy: "none",
90
+ context: {
91
+ requiredWorkspaceAuth: !0,
92
+ requiredWorkspaceId: b,
93
+ queryDeduplication: !1
94
+ }
95
+ }).then((e) => {
96
+ if (t) return;
97
+ let n = e.data?.workspaceMemberIdentities ?? [];
98
+ n.length !== 0 && P((e) => {
99
+ let t = { ...e };
100
+ for (let e of n) t[e.userId] = {
101
+ displayName: e.displayName,
102
+ ...e.email ? { email: e.email } : {}
103
+ };
104
+ return t;
105
+ });
106
+ }).catch(() => {
107
+ for (let t of e) F.current.delete(t);
108
+ }), () => {
109
+ t = !0;
110
+ };
111
+ }, [
112
+ S,
113
+ y,
114
+ x?.id,
115
+ R,
116
+ b
117
+ ]);
118
+ let z = s(() => R ? R.map((e) => {
119
+ let t = !!(x?.id && e.actorId === x.id), n = N[e.actorId], r = t ? x?.name || x?.email || n?.displayName || g(e.actorId) : n?.displayName || g(e.actorId), i = t ? x?.email ?? n?.email : n?.email;
120
+ return {
121
+ actorId: e.actorId,
122
+ displayName: r,
123
+ ...i ? { email: i } : {},
124
+ connectionCount: e.connectionCount,
125
+ lastSeenAt: String(e.lastSeenAt),
126
+ isCurrentUser: t
127
+ };
128
+ }).sort((e, t) => e.isCurrentUser === t.isCurrentUser ? e.displayName.localeCompare(t.displayName) : e.isCurrentUser ? -1 : 1) : [], [
129
+ x?.email,
130
+ x?.id,
131
+ x?.name,
132
+ N,
133
+ R
134
+ ]), B = !!(D?.dashboardPresence.unavailable || j && z.length === 0);
135
+ return {
136
+ viewers: z,
137
+ activeCount: z.length,
138
+ unavailable: B,
139
+ loading: O,
140
+ error: k,
141
+ connectionId: w,
142
+ refetch: a(() => {
143
+ S && A().catch(() => {});
144
+ }, [S, A])
145
+ };
146
+ }
147
+ export { p as PRESENCE_HEARTBEAT_INTERVAL_MS, m as PRESENCE_POLL_INTERVAL_MS, h as buildPresenceConnectionId, _ as default, _ as useDashboardPresence };
@@ -1,11 +1,20 @@
1
1
  import { EntityCommentFieldsFragment } from '../../generated/wspace-operations';
2
+ import { CommentAnchor } from '../components/widgets/comments/commentMentions';
2
3
  /** Entity type used to scope comments to a BigConsole widget. */
3
4
  export declare const WIDGET_COMMENT_ENTITY_TYPE = "bigconsole-widget";
5
+ /** Entity type used to scope comments (including region/widget-anchored notes) to a BigConsole dashboard. */
6
+ export declare const DASHBOARD_COMMENT_ENTITY_TYPE = "bigconsole-dashboard";
4
7
  /** A top-level comment with its (one level of) replies attached. */
5
8
  export interface WidgetCommentThread {
6
9
  comment: EntityCommentFieldsFragment;
7
10
  replies: EntityCommentFieldsFragment[];
8
11
  }
12
+ export interface AddCommentOptions {
13
+ parentCommentId?: string;
14
+ mentionUserIds?: string[];
15
+ mentionNames?: string[];
16
+ anchor?: CommentAnchor;
17
+ }
9
18
  export interface UseWidgetCommentsResult {
10
19
  threads: WidgetCommentThread[];
11
20
  /** Total comment count (top-level + replies), excluding deleted. */
@@ -13,10 +22,12 @@ export interface UseWidgetCommentsResult {
13
22
  loading: boolean;
14
23
  error?: Error;
15
24
  mutating: boolean;
16
- addComment: (text: string, parentCommentId?: string) => Promise<boolean>;
25
+ addComment: (text: string, parentOrOptions?: string | AddCommentOptions) => Promise<boolean>;
17
26
  resolveComment: (id: string, resolved: boolean) => Promise<boolean>;
18
27
  deleteComment: (id: string) => Promise<boolean>;
19
28
  refetch: () => void;
20
29
  }
30
+ export declare function useEntityComments(entityId: string | undefined, entityType: string, enabled?: boolean): UseWidgetCommentsResult;
21
31
  export declare function useWidgetComments(widgetId: string | undefined, enabled?: boolean): UseWidgetCommentsResult;
32
+ export declare function useDashboardComments(dashboardId: string | undefined, enabled?: boolean): UseWidgetCommentsResult;
22
33
  export default useWidgetComments;
@@ -3,28 +3,29 @@ import { ContentType as i } from "../../generated/wspace-types.js";
3
3
  import { useCallback as a, useMemo as o, useState as s } from "react";
4
4
  import { useMutation as c, useQuery as l } from "@apollo/client/react";
5
5
  // src/bigconsole/hooks/useWidgetComments.ts
6
- var u = "bigconsole-widget";
7
- function d(d, f = !0) {
6
+ var u = "bigconsole-widget", d = "bigconsole-dashboard";
7
+ function f(u, d, f = !0) {
8
8
  let { data: p, dataState: m, loading: h, error: g, refetch: _ } = l(n, {
9
9
  returnPartialData: !1,
10
10
  variables: { input: {
11
- entityId: d ?? "",
12
- entityType: u,
11
+ entityId: u ?? "",
12
+ entityType: d,
13
13
  take: 100,
14
14
  sortBy: "createdAt",
15
15
  sortOrder: "asc"
16
16
  } },
17
- skip: !f || !d,
17
+ skip: !f || !u,
18
18
  fetchPolicy: "cache-and-network",
19
19
  notifyOnNetworkStatusChange: !0
20
20
  }), v = m === "complete" ? p : void 0, [y, b] = c(e), [x, S] = c(r), [C, w] = c(t), [T, E] = s([]), D = o(() => {
21
21
  let e = /* @__PURE__ */ new Map();
22
22
  for (let t of v?.getEntityComments.items ?? []) e.set(t.id, t);
23
- for (let t of T) t.entityId === d && e.set(t.id, t);
23
+ for (let t of T) t.entityId === u && t.entityType === d && e.set(t.id, t);
24
24
  return [...e.values()].sort((e, t) => e.createdAt.localeCompare(t.createdAt));
25
25
  }, [
26
26
  T,
27
27
  v,
28
+ u,
28
29
  d
29
30
  ]), O = v?.getEntityComments.total ?? D.length, k = o(() => {
30
31
  let e = D.filter((e) => !e.parentCommentId), t = /* @__PURE__ */ new Map();
@@ -38,14 +39,18 @@ function d(d, f = !0) {
38
39
  }));
39
40
  }, [D]), A = a(async (e, t) => {
40
41
  let n = e.trim();
41
- if (!n || !d) return !1;
42
+ if (!n || !u) return !1;
43
+ let r = typeof t == "string" ? { parentCommentId: t } : t ?? {}, a = r.mentionUserIds ? [...new Set(r.mentionUserIds.map((e) => e.trim()).filter(Boolean))] : [], o = {};
44
+ r.anchor && (o.anchor = r.anchor), r.mentionNames && r.mentionNames.length > 0 && (o.mentionNames = [...new Set(r.mentionNames.map((e) => e.trim()).filter(Boolean))]);
42
45
  try {
43
46
  let e = (await y({ variables: { input: {
44
- entityId: d,
45
- entityType: u,
47
+ entityId: u,
48
+ entityType: d,
46
49
  content: { text: n },
47
50
  contentType: i.Text,
48
- ...t ? { parentCommentId: t } : {}
51
+ ...r.parentCommentId ? { parentCommentId: r.parentCommentId } : {},
52
+ ...a.length > 0 ? { mentionUserIds: a } : {},
53
+ ...Object.keys(o).length > 0 ? { metadata: o } : {}
49
54
  } } })).data?.createEntityComment;
50
55
  return e ? (E((t) => t.some((t) => t.id === e.id) ? t : [...t, e]), await _(), !0) : !1;
51
56
  } catch {
@@ -53,8 +58,9 @@ function d(d, f = !0) {
53
58
  }
54
59
  }, [
55
60
  y,
56
- _,
57
- d
61
+ u,
62
+ d,
63
+ _
58
64
  ]), j = a(async (e, t) => {
59
65
  try {
60
66
  let n = (await x({ variables: { input: {
@@ -89,4 +95,10 @@ function d(d, f = !0) {
89
95
  }, [_])
90
96
  };
91
97
  }
92
- export { u as WIDGET_COMMENT_ENTITY_TYPE, d as default, d as useWidgetComments };
98
+ function p(e, t = !0) {
99
+ return f(e, u, t);
100
+ }
101
+ function m(e, t = !0) {
102
+ return f(e, d, t);
103
+ }
104
+ export { d as DASHBOARD_COMMENT_ENTITY_TYPE, u as WIDGET_COMMENT_ENTITY_TYPE, p as default, p as useWidgetComments, m as useDashboardComments, f as useEntityComments };
@@ -20,27 +20,29 @@ import { useDashboardLayoutBaseline as re } from "../hooks/useDashboardLayoutBas
20
20
  import "../customWidget/index.js";
21
21
  import { DashboardCanvas as ie } from "../components/dashboard/DashboardCanvas.js";
22
22
  import { ExportDashboardDialog as ae } from "../components/dashboard/ExportDashboardDialog.js";
23
+ import { DashboardPresenceBar as oe } from "../components/dashboard/DashboardPresenceBar.js";
24
+ import { DashboardCommentsDrawer as se } from "../components/dashboard/DashboardCommentsDrawer.js";
23
25
  import "../components/common/index.js";
24
- import { findNextAvailablePosition as oe } from "../utils/widgetPositioning.js";
25
- import { layoutItemsFromPositionUpdates as se } from "../utils/layoutBaseline.js";
26
- import { CustomWidgetBuilderSheet as ce } from "../customWidget/CustomWidgetBuilderSheet.js";
27
- import { loadBigConsoleSettings as le } from "../hooks/useBigConsoleSettings.js";
28
- import { registerBreadcrumbName as ue, unregisterBreadcrumbName as de } from "../utils/breadcrumbRegistry.js";
26
+ import { findNextAvailablePosition as ce } from "../utils/widgetPositioning.js";
27
+ import { layoutItemsFromPositionUpdates as le } from "../utils/layoutBaseline.js";
28
+ import { CustomWidgetBuilderSheet as ue } from "../customWidget/CustomWidgetBuilderSheet.js";
29
+ import { loadBigConsoleSettings as de } from "../hooks/useBigConsoleSettings.js";
30
+ import { registerBreadcrumbName as fe, unregisterBreadcrumbName as pe } from "../utils/breadcrumbRegistry.js";
29
31
  import { memo as u, useCallback as d, useEffect as f, useState as p } from "react";
30
- import { useParams as fe } from "react-router";
31
- import { AccessDenied as pe } from "@burdenoff/fe-libs/shared/components";
32
- import { usePermissions as me } from "@burdenoff/fe-libs/shared/providers/shell";
33
- import { Button as he } from "@burdenoff/fe-libs/ui";
34
- import { useUnsavedChanges as ge } from "@burdenoff/fe-libs/shared/hooks";
35
- import { useI18n as _e } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
32
+ import { useParams as me } from "react-router";
33
+ import { AccessDenied as he } from "@burdenoff/fe-libs/shared/components";
34
+ import { usePermissions as ge } from "@burdenoff/fe-libs/shared/providers/shell";
35
+ import { Button as _e } from "@burdenoff/fe-libs/ui";
36
+ import { useUnsavedChanges as ve } from "@burdenoff/fe-libs/shared/hooks";
37
+ import { useI18n as ye } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
36
38
  import { jsx as m, jsxs as h } from "react/jsx-runtime";
37
39
  // src/bigconsole/pages/DashboardBuilderPage.tsx
38
40
  var g = u(function() {
39
- let { dashboardId: u } = fe(), g = r(), { t: _ } = _e(), { hasPermission: v, isLoading: ve } = me(), ye = v(n.DASHBOARD_READ), y = v(n.DASHBOARD_UPDATE), b = v(n.DASHBOARD_EXPORT), x = v(n.WIDGET_CREATE), [be, S] = p(!1), [C, w] = p(null), [xe, T] = p(!1), [Se, E] = p(!1), { fetchDashboard: D, updateDashboard: O, loading: Ce, error: k } = s(), { createWidget: A, updateWidget: j, deleteWidget: M, duplicateWidget: N, batchUpdatePositions: P, loadPageWidgets: F } = o(void 0, u), { createPage: I, updatePage: L, deletePage: R, duplicatePage: z, reorderPages: B } = c(), V = t((e) => e.setCurrentDashboard), H = t((e) => e.currentDashboard), { activePageId: U, setActivePage: W } = l(H?.id === u ? H?.pages : void 0), G = t((e) => e.setViewMode), K = e((e) => e.selectWidget), q = e((e) => e.widgets), J = e((e) => e.clipboardWidgetId), Y = e((e) => e.clipboardAction), X = e((e) => e.clearClipboard), { dirty: we, markSaved: Z } = re(u);
40
- ge({
41
+ let { dashboardId: u } = me(), g = r(), { t: _ } = ye(), { hasPermission: v, isLoading: be } = ge(), xe = v(n.DASHBOARD_READ), y = v(n.DASHBOARD_UPDATE), Se = v(n.DASHBOARD_EXPORT), Ce = v(n.WIDGET_CREATE), [we, b] = p(!1), [x, S] = p(null), [Te, C] = p(!1), [Ee, w] = p(!1), [T, E] = p(!1), { fetchDashboard: D, updateDashboard: O, loading: De, error: k } = s(), { createWidget: A, updateWidget: j, deleteWidget: M, duplicateWidget: N, batchUpdatePositions: P, loadPageWidgets: F } = o(void 0, u), { createPage: I, updatePage: L, deletePage: R, duplicatePage: z, reorderPages: B } = c(), V = t((e) => e.setCurrentDashboard), H = t((e) => e.currentDashboard), { activePageId: U, setActivePage: W } = l(H?.id === u ? H?.pages : void 0), G = t((e) => e.setViewMode), K = e((e) => e.selectWidget), q = e((e) => e.widgets), J = e((e) => e.clipboardWidgetId), Y = e((e) => e.clipboardAction), X = e((e) => e.clearClipboard), { dirty: Oe, markSaved: Z } = re(u);
42
+ ve({
41
43
  id: "dashboard-editor",
42
44
  label: _("bigconsole.assistant.unsaved.dashboardEditor", "the dashboard editor"),
43
- dirty: y && we
45
+ dirty: y && Oe
44
46
  }), f(() => (G("edit"), () => G("view")), [G]), f(() => {
45
47
  if (!u) g("/dashboards");
46
48
  else return D(u).then((e) => {
@@ -57,10 +59,10 @@ var g = u(function() {
57
59
  layoutConfig: e.layoutConfig ?? {}
58
60
  }))
59
61
  };
60
- V(t), e.name && ue(u, e.name);
62
+ V(t), e.name && fe(u, e.name);
61
63
  } else g("/dashboards");
62
64
  }), () => {
63
- u && de(u);
65
+ u && pe(u);
64
66
  };
65
67
  }, [
66
68
  u,
@@ -79,7 +81,7 @@ var g = u(function() {
79
81
  let n = Array.from(q.values()).filter((t) => t.pageId === e), r = H?.pages.find((t) => t.id === e)?.gridColumns ?? 12, i = {
80
82
  width: Math.min(t.positionWidth ?? 4, r),
81
83
  height: t.positionHeight ?? 4
82
- }, { x: a, y: o } = oe(n, i, { cols: r }), s = {
84
+ }, { x: a, y: o } = ce(n, i, { cols: r }), s = {
83
85
  x: a,
84
86
  y: o,
85
87
  width: i.width,
@@ -122,11 +124,11 @@ var g = u(function() {
122
124
  };
123
125
  return document.addEventListener("keydown", n, !0), () => document.removeEventListener("keydown", n, !0);
124
126
  }, [M, Q]);
125
- let Te = d(() => {
127
+ let ke = d(() => {
126
128
  g("/dashboards");
127
- }, [g]), Ee = d(async () => {
129
+ }, [g]), $ = d(async () => {
128
130
  if (u) {
129
- S(!0), w(null);
131
+ b(!0), S(null);
130
132
  try {
131
133
  let t = e.getState(), n = Array.from(t.widgets.values()), r = t.dirtyWidgetIds, i = t.layoutEditRevision, a = n.length === 0 ? [] : null, o = n.filter((e) => r.has(e.id));
132
134
  if (o.length > 0) {
@@ -155,7 +157,7 @@ var g = u(function() {
155
157
  height: e.positionHeight ?? 4
156
158
  }
157
159
  }));
158
- await P(e) && (a = se(e));
160
+ await P(e) && (a = le(e));
159
161
  }
160
162
  H && await O({
161
163
  id: u,
@@ -163,9 +165,9 @@ var g = u(function() {
163
165
  description: H.description
164
166
  }), a && Z(a, i);
165
167
  } catch (e) {
166
- w(e instanceof Error ? e.message : _("bigconsole.dashboards.builder.errors.saveFailed", "Failed to save dashboard"));
168
+ S(e instanceof Error ? e.message : _("bigconsole.dashboards.builder.errors.saveFailed", "Failed to save dashboard"));
167
169
  } finally {
168
- S(!1);
170
+ b(!1);
169
171
  }
170
172
  }
171
173
  }, [
@@ -176,18 +178,18 @@ var g = u(function() {
176
178
  O,
177
179
  Z,
178
180
  _
179
- ]), $ = d(() => {
180
- T(!0);
181
- }, []), De = d(() => {
182
- T(!1);
183
- }, []), Oe = d((e) => {
181
+ ]), Ae = d(() => {
182
+ C(!0);
183
+ }, []), je = d(() => {
184
+ C(!1);
185
+ }, []), Me = d((e) => {
184
186
  W(e);
185
- }, [W]), ke = d(async () => {
187
+ }, [W]), Ne = d(async () => {
186
188
  if (!H || !u) return;
187
189
  let e = H.pages.length + 1, t = _("bigconsole.dashboards.builder.actions.newPageName", "Page {{count}}", { count: e }), n = await I({
188
190
  dashboardId: u,
189
191
  name: t,
190
- gridColumns: le().defaultGridColumns
192
+ gridColumns: de().defaultGridColumns
191
193
  });
192
194
  n && (V({
193
195
  ...H,
@@ -206,7 +208,7 @@ var g = u(function() {
206
208
  I,
207
209
  W,
208
210
  _
209
- ]), Ae = d(async (e, t) => {
211
+ ]), Pe = d(async (e, t) => {
210
212
  H && await L({
211
213
  id: e,
212
214
  name: t
@@ -221,7 +223,7 @@ var g = u(function() {
221
223
  H,
222
224
  V,
223
225
  L
224
- ]), je = d(async (e) => {
226
+ ]), Fe = d(async (e) => {
225
227
  if (!H || !u) return;
226
228
  let t = H.pages.find((t) => t.id === e);
227
229
  if (!t) return;
@@ -244,7 +246,7 @@ var g = u(function() {
244
246
  F,
245
247
  W,
246
248
  _
247
- ]), Me = d(async (e) => {
249
+ ]), Ie = d(async (e) => {
248
250
  if (!(!H || H.pages.length <= 1) && await R(e)) {
249
251
  let t = H.pages.filter((t) => t.id !== e).map((e, t) => ({
250
252
  ...e,
@@ -263,7 +265,7 @@ var g = u(function() {
263
265
  U,
264
266
  R,
265
267
  W
266
- ]), Ne = d(async (e) => {
268
+ ]), Le = d(async (e) => {
267
269
  if (!H || !u) return;
268
270
  V({
269
271
  ...H,
@@ -280,10 +282,10 @@ var g = u(function() {
280
282
  V,
281
283
  B
282
284
  ]);
283
- return ve ? /* @__PURE__ */ m("div", {
285
+ return be ? /* @__PURE__ */ m("div", {
284
286
  className: "flex items-center justify-center h-full",
285
287
  children: /* @__PURE__ */ m("div", { className: "animate-spin w-8 h-8 border-4 border-action-primary-bg border-t-transparent rounded-full" })
286
- }) : ye ? k ? /* @__PURE__ */ m("div", {
288
+ }) : xe ? k ? /* @__PURE__ */ m("div", {
287
289
  className: "flex h-full flex-col items-center justify-center p-6",
288
290
  children: /* @__PURE__ */ m(a, {
289
291
  headingLevel: 2,
@@ -295,13 +297,13 @@ var g = u(function() {
295
297
  }),
296
298
  className: "w-full max-w-md",
297
299
  "data-testid": "dashboard-builder-error",
298
- actions: /* @__PURE__ */ m(he, {
300
+ actions: /* @__PURE__ */ m(_e, {
299
301
  size: "sm",
300
302
  onClick: () => g("/dashboards"),
301
303
  children: _("bigconsole.dashboards.builder.actions.backToDashboards", "Back to Dashboards")
302
304
  })
303
305
  })
304
- }) : Ce || !H ? /* @__PURE__ */ h("div", {
306
+ }) : De || !H ? /* @__PURE__ */ h("div", {
305
307
  className: "flex items-center justify-center h-full",
306
308
  role: "status",
307
309
  "aria-live": "polite",
@@ -312,20 +314,32 @@ var g = u(function() {
312
314
  }) : /* @__PURE__ */ h(ne, {
313
315
  topbar: /* @__PURE__ */ m(te, {
314
316
  title: H.title || _("bigconsole.dashboards.builder.header.untitledDashboard", "Untitled dashboard"),
315
- onBack: Te,
317
+ onBack: ke,
316
318
  actions: /* @__PURE__ */ h("div", {
317
319
  className: "flex items-center gap-2",
318
- children: [C ? /* @__PURE__ */ m("span", {
319
- className: "text-xs font-medium text-status-error-text",
320
- role: "alert",
321
- children: C
322
- }) : null, x ? /* @__PURE__ */ m("button", {
323
- type: "button",
324
- "data-testid": "open-custom-widget-builder",
325
- onClick: () => E(!0),
326
- className: `inline-flex min-h-control-md items-center rounded-button border border-[var(--color-border-subtle)] px-2 py-1 text-xs font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-sunken ${i}`,
327
- children: _("bigconsole.dashboards.builder.toolbar.aiWidget", "AI widget")
328
- }) : null]
320
+ children: [
321
+ /* @__PURE__ */ m(oe, { dashboardId: H.id }),
322
+ /* @__PURE__ */ m("button", {
323
+ type: "button",
324
+ "data-testid": "dashboard-comments-button",
325
+ onClick: () => E((e) => !e),
326
+ "aria-pressed": T,
327
+ className: `inline-flex min-h-control-md items-center rounded-button border border-[var(--color-border-subtle)] px-2 py-1 text-xs font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-sunken ${i}`,
328
+ children: _("bigconsole.dashboard.comments.buttonLabel", "Comments")
329
+ }),
330
+ x ? /* @__PURE__ */ m("span", {
331
+ className: "text-xs font-medium text-status-error-text",
332
+ role: "alert",
333
+ children: x
334
+ }) : null,
335
+ Ce ? /* @__PURE__ */ m("button", {
336
+ type: "button",
337
+ "data-testid": "open-custom-widget-builder",
338
+ onClick: () => w(!0),
339
+ className: `inline-flex min-h-control-md items-center rounded-button border border-[var(--color-border-subtle)] px-2 py-1 text-xs font-medium text-text-primary motion-safe:transition-colors hover:bg-bg-sunken ${i}`,
340
+ children: _("bigconsole.dashboards.builder.toolbar.aiWidget", "AI widget")
341
+ }) : null
342
+ ]
329
343
  })
330
344
  }),
331
345
  children: [
@@ -334,37 +348,47 @@ var g = u(function() {
334
348
  pageId: U || H.pages?.[0]?.id,
335
349
  title: H.title,
336
350
  onPaste: Q,
337
- onSave: y ? Ee : void 0,
338
- isSaving: be,
339
- onExport: b ? $ : void 0,
351
+ onSave: y ? $ : void 0,
352
+ isSaving: we,
353
+ onExport: Se ? Ae : void 0,
340
354
  pages: H.pages.map((e) => ({
341
355
  id: e.id,
342
356
  name: e.title || _("bigconsole.dashboards.builder.actions.newPageName", "Page {{count}}", { count: (e.index ?? 0) + 1 }),
343
357
  order: e.index ?? 0
344
358
  })),
345
359
  activePageId: U || H.pages?.[0]?.id,
346
- onPageChange: Oe,
347
- onPageAdd: ke,
348
- onPageRename: Ae,
349
- onPageDuplicate: je,
350
- onPageDelete: Me,
351
- onPagesReorder: Ne,
360
+ onPageChange: Me,
361
+ onPageAdd: Ne,
362
+ onPageRename: Pe,
363
+ onPageDuplicate: Fe,
364
+ onPageDelete: Ie,
365
+ onPagesReorder: Le,
352
366
  showPageTabs: !0
353
367
  }) }),
354
368
  /* @__PURE__ */ m(ae, {
355
- isOpen: xe,
369
+ isOpen: Te,
356
370
  dashboardId: H.id,
357
371
  dashboardName: H.title,
358
- onClose: De
372
+ onClose: je
359
373
  }),
360
- /* @__PURE__ */ m(ce, {
361
- isOpen: Se,
374
+ /* @__PURE__ */ m(se, {
375
+ dashboardId: H.id,
376
+ isOpen: T,
362
377
  onClose: () => E(!1),
378
+ widgets: Array.from(q.values()).map((e) => ({
379
+ id: e.id,
380
+ title: e.title || e.type
381
+ })),
382
+ onSelectWidget: (e) => K(e)
383
+ }),
384
+ /* @__PURE__ */ m(ue, {
385
+ isOpen: Ee,
386
+ onClose: () => w(!1),
363
387
  dashboardId: H.id,
364
388
  pageId: U || H.pages?.[0]?.id || ""
365
389
  })
366
390
  ]
367
- }) : /* @__PURE__ */ m(pe, {
391
+ }) : /* @__PURE__ */ m(he, {
368
392
  title: _("bigconsole.dashboards.builder.errors.accessDeniedTitle", "Access Denied"),
369
393
  description: _("bigconsole.dashboards.builder.errors.accessDeniedDescription", "You don't have permission to view this dashboard.")
370
394
  });