@burdenoff/microfe-bigconsole 2026.1124.1 → 2026.1124.3

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 (38) hide show
  1. package/dist/bigconsole/components/fleet/FleetChildrenPanel.d.ts +12 -0
  2. package/dist/bigconsole/components/fleet/FleetChildrenPanel.js +179 -184
  3. package/dist/bigconsole/components/fleet/FleetCopySection.d.ts +18 -0
  4. package/dist/bigconsole/components/fleet/FleetCopySection.js +263 -0
  5. package/dist/bigconsole/components/fleet/FleetWidgetActions.d.ts +36 -0
  6. package/dist/bigconsole/components/fleet/FleetWidgetActions.js +82 -0
  7. package/dist/bigconsole/components/widgets/WidgetMenu.js +146 -96
  8. package/dist/bigconsole/hooks/useFleetBreadcrumb.d.ts +8 -1
  9. package/dist/bigconsole/hooks/useFleetBreadcrumb.js +4 -1
  10. package/dist/bigconsole/hooks/useFleetChildren.d.ts +2 -0
  11. package/dist/bigconsole/hooks/useFleetChildren.js +10 -6
  12. package/dist/bigconsole/hooks/useFleetConfirm.d.ts +7 -0
  13. package/dist/bigconsole/hooks/useFleetConfirm.js +17 -0
  14. package/dist/bigconsole/hooks/useFleetCopyActions.d.ts +23 -0
  15. package/dist/bigconsole/hooks/useFleetCopyActions.js +74 -0
  16. package/dist/bigconsole/hooks/useFleetFlags.d.ts +16 -0
  17. package/dist/bigconsole/hooks/useFleetFlags.js +79 -0
  18. package/dist/bigconsole/hooks/useFleetWidgetActions.d.ts +10 -0
  19. package/dist/bigconsole/hooks/useFleetWidgetActions.js +41 -0
  20. package/dist/bigconsole/hooks/useOwnerBoundRun.d.ts +28 -0
  21. package/dist/bigconsole/hooks/useOwnerBoundRun.js +56 -0
  22. package/dist/bigconsole/hooks/useWidgetOperations.js +2 -0
  23. package/dist/bigconsole/pages/DashboardViewPage.js +335 -320
  24. package/dist/bigconsole/pages/DashboardsPage.js +13 -13
  25. package/dist/bigconsole/types/index.d.ts +4 -0
  26. package/dist/bigconsole/utils/fleetFlags.d.ts +22 -0
  27. package/dist/bigconsole/utils/fleetFlags.js +40 -0
  28. package/dist/bigconsole/utils/fleetNotices.d.ts +12 -0
  29. package/dist/bigconsole/utils/fleetNotices.js +5 -0
  30. package/dist/bigconsole/utils/fleetTree.d.ts +9 -0
  31. package/dist/bigconsole/utils/fleetTree.js +5 -1
  32. package/dist/bigconsole/utils/fleetWidgetMenu.d.ts +20 -0
  33. package/dist/bigconsole/utils/fleetWidgetMenu.js +13 -0
  34. package/dist/generated/wspace-operations.d.ts +155 -0
  35. package/dist/generated/wspace-operations.js +928 -99
  36. package/dist/generated/wspace-types.d.ts +395 -9
  37. package/dist/generated/wspace-types.js +6 -4
  38. package/package.json +1 -1
@@ -0,0 +1,74 @@
1
+ import { PreviewRestoreDashboardToOriginalDocument as e, ResolveWidgetFlagDocument as t, RestoreDashboardToOriginalDocument as n } from "../../generated/wspace-operations.js";
2
+ import { BigConsoleWidgetFlagAnswer as r } from "../../generated/wspace-types.js";
3
+ import { useCallback as i, useState as a } from "react";
4
+ import { useApolloClient as o } from "@apollo/client/react";
5
+ // src/bigconsole/hooks/useFleetCopyActions.ts
6
+ var s = (e) => {
7
+ switch (e) {
8
+ case "ACCEPTED_MASTER": return r.AcceptedMaster;
9
+ case "REMOVED": return r.Removed;
10
+ default: return r.KeptLocal;
11
+ }
12
+ };
13
+ function c() {
14
+ let r = o(), [c, l] = a(!1), u = i(async (e) => {
15
+ l(!0);
16
+ try {
17
+ return await e();
18
+ } finally {
19
+ l(!1);
20
+ }
21
+ }, []);
22
+ return {
23
+ busy: c,
24
+ resolveFlag: i((e, n) => u(async () => {
25
+ let i = await r.mutate({
26
+ mutation: t,
27
+ variables: {
28
+ flagId: e,
29
+ answer: s(n)
30
+ },
31
+ errorPolicy: "none"
32
+ });
33
+ if (!i.data?.resolveWidgetFlag) throw Error("The flag could not be answered.");
34
+ return i.data.resolveWidgetFlag.notices.map((e) => ({
35
+ code: e.code,
36
+ pageName: e.pageName,
37
+ widgetId: e.widgetId
38
+ }));
39
+ }), [r, u]),
40
+ previewRestore: i((t) => u(async () => {
41
+ let n = (await r.query({
42
+ query: e,
43
+ variables: { dashboardId: t },
44
+ fetchPolicy: "no-cache",
45
+ errorPolicy: "none"
46
+ })).data?.previewRestoreDashboardToOriginal;
47
+ if (!n) throw Error("The preview could not be made.");
48
+ return {
49
+ widgetsRestored: n.widgetsRestored,
50
+ widgetsBroughtBack: n.widgetsBroughtBack,
51
+ localWidgetsKept: n.localWidgetsKept
52
+ };
53
+ }), [r, u]),
54
+ restore: i((e) => u(async () => {
55
+ let t = (await r.mutate({
56
+ mutation: n,
57
+ variables: { dashboardId: e },
58
+ errorPolicy: "none"
59
+ })).data?.restoreDashboardToOriginal;
60
+ if (!t) throw Error("The board could not be restored.");
61
+ return {
62
+ widgetsRestored: t.widgetsRestored,
63
+ widgetsBroughtBack: t.widgetsBroughtBack,
64
+ localWidgetsKept: t.localWidgetsKept,
65
+ notices: t.notices.map((e) => ({
66
+ code: e.code,
67
+ pageName: e.pageName,
68
+ widgetId: e.widgetId
69
+ }))
70
+ };
71
+ }), [r, u])
72
+ };
73
+ }
74
+ export { c as useFleetCopyActions };
@@ -0,0 +1,16 @@
1
+ import { FlagType } from '../utils/fleetFlags';
2
+ export interface FleetFlag {
3
+ id: string;
4
+ widgetId: string;
5
+ widgetTitle: string;
6
+ type: FlagType | string;
7
+ changedFields: string[];
8
+ }
9
+ interface UseFleetFlagsResult {
10
+ loading: boolean;
11
+ error: Error | null;
12
+ flags: FleetFlag[];
13
+ refetch: () => Promise<void>;
14
+ }
15
+ export declare function useFleetFlags(dashboardId: string | undefined, enabled: boolean): UseFleetFlagsResult;
16
+ export {};
@@ -0,0 +1,79 @@
1
+ import "../context/index.js";
2
+ import { useBigConsole as e } from "../context/BigConsoleContext.js";
3
+ import { FleetWidgetFlagsDocument as t } from "../../generated/wspace-operations.js";
4
+ import { openFlags as n } from "../utils/fleetFlags.js";
5
+ import { useCallback as r, useEffect as i, useLayoutEffect as a, useRef as o, useState as s } from "react";
6
+ import { useApolloClient as c } from "@apollo/client/react";
7
+ // src/bigconsole/hooks/useFleetFlags.ts
8
+ var l = [], u = 100, d = 50;
9
+ function f(f, p) {
10
+ let { workspaceId: m, currentUser: h } = e(), g = c(), _ = `${m ?? ""}:${h?.id ?? ""}:${f ?? ""}`, [v, y] = s({
11
+ key: "",
12
+ flags: l,
13
+ error: null
14
+ }), [b, x] = s(p && !!f), S = o(_), C = o(0);
15
+ a(() => (S.current = _, () => {
16
+ S.current = "", C.current += 1;
17
+ }), [_]);
18
+ let w = r(async () => {
19
+ if (!f) return;
20
+ let e = ++C.current, r = () => S.current === _ && C.current === e;
21
+ try {
22
+ x(!0);
23
+ let e = [];
24
+ for (let n = 0; n < d; n += 1) {
25
+ let r = (await g.query({
26
+ query: t,
27
+ variables: {
28
+ dashboardId: f,
29
+ offset: n * u
30
+ },
31
+ fetchPolicy: "no-cache",
32
+ errorPolicy: "none",
33
+ context: {
34
+ requiredWorkspaceAuth: !0,
35
+ requiredWorkspaceId: m,
36
+ queryDeduplication: !1
37
+ }
38
+ })).data?.dashboardWidgetFlags ?? [];
39
+ if (e.push(...r), r.length < u) break;
40
+ }
41
+ let i = n(e).map((e) => ({
42
+ id: e.id,
43
+ widgetId: e.widgetId,
44
+ widgetTitle: e.widgetTitle,
45
+ type: e.type,
46
+ changedFields: e.changedFields
47
+ }));
48
+ r() && y({
49
+ key: _,
50
+ flags: i,
51
+ error: null
52
+ });
53
+ } catch (e) {
54
+ r() && y({
55
+ key: _,
56
+ flags: l,
57
+ error: e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load the flags")
58
+ });
59
+ } finally {
60
+ r() && x(!1);
61
+ }
62
+ }, [
63
+ g,
64
+ f,
65
+ _,
66
+ m
67
+ ]);
68
+ i(() => {
69
+ p && w();
70
+ }, [p, w]);
71
+ let T = v.key === _;
72
+ return {
73
+ loading: b || p && !T,
74
+ error: T ? v.error : null,
75
+ flags: T ? v.flags : l,
76
+ refetch: w
77
+ };
78
+ }
79
+ export { f as useFleetFlags };
@@ -0,0 +1,10 @@
1
+ import { RestoreNotice } from './useFleetCopyActions';
2
+ interface UseFleetWidgetActionsResult {
3
+ busy: boolean;
4
+ /** Puts the widget back to the master's version. Returns what could not be carried over exactly. */
5
+ restoreWidget: (widgetId: string) => Promise<RestoreNotice[]>;
6
+ /** Adds the widget to the master, which the board's widget then follows. Returns what could not be carried over. */
7
+ promoteWidget: (widgetId: string) => Promise<RestoreNotice[]>;
8
+ }
9
+ export declare function useFleetWidgetActions(): UseFleetWidgetActionsResult;
10
+ export {};
@@ -0,0 +1,41 @@
1
+ import { PromoteWidgetToMasterDocument as e, RestoreWidgetToOriginalDocument as t } from "../../generated/wspace-operations.js";
2
+ import { useCallback as n, useState as r } from "react";
3
+ import { useApolloClient as i } from "@apollo/client/react";
4
+ // src/bigconsole/hooks/useFleetWidgetActions.ts
5
+ var a = (e) => e.map((e) => ({
6
+ code: e.code,
7
+ pageName: e.pageName,
8
+ widgetId: e.widgetId
9
+ }));
10
+ function o() {
11
+ let o = i(), [s, c] = r(!1), l = n(async (e) => {
12
+ c(!0);
13
+ try {
14
+ return await e();
15
+ } finally {
16
+ c(!1);
17
+ }
18
+ }, []);
19
+ return {
20
+ busy: s,
21
+ restoreWidget: n((e) => l(async () => {
22
+ let n = (await o.mutate({
23
+ mutation: t,
24
+ variables: { widgetId: e },
25
+ errorPolicy: "none"
26
+ })).data?.restoreWidgetToOriginal;
27
+ if (!n) throw Error("The widget could not be restored.");
28
+ return a(n.notices);
29
+ }), [o, l]),
30
+ promoteWidget: n((t) => l(async () => {
31
+ let n = (await o.mutate({
32
+ mutation: e,
33
+ variables: { widgetId: t },
34
+ errorPolicy: "none"
35
+ })).data?.promoteWidgetToMaster;
36
+ if (!n) throw Error("The widget could not be promoted.");
37
+ return a(n.notices);
38
+ }), [o, l])
39
+ };
40
+ }
41
+ export { o as useFleetWidgetActions };
@@ -0,0 +1,28 @@
1
+ import { Dispatch, SetStateAction } from 'react';
2
+ /**
3
+ * An action lock: which owner has an action running (`owner`, for the buttons to show), and the same fact kept
4
+ * synchronously, which is what decides whether an action may start. The state is only seen after a render; the
5
+ * synchronous side changes the instant an action starts, so two prompts answered together in different sections
6
+ * of one panel cannot both start.
7
+ */
8
+ export interface ActionLock {
9
+ owner: string | null;
10
+ setOwner: Dispatch<SetStateAction<string | null>>;
11
+ /** Takes the lock for the owner; false when an action of that owner already holds it. */
12
+ tryAcquire: (owner: string) => boolean;
13
+ /** Lets go of the lock if the owner still holds it. */
14
+ release: (owner: string) => void;
15
+ }
16
+ /** One lock for the sections of a panel to share. */
17
+ export declare function useActionLock(): ActionLock;
18
+ interface UseOwnerBoundRunResult {
19
+ acting: boolean;
20
+ /**
21
+ * Notes the owner now and returns a check that stays true only while the panel is still on it. Call it before
22
+ * anything that waits (a confirmation prompt), and check after: the person may have left in the meantime.
23
+ */
24
+ begin: () => () => boolean;
25
+ run: <T>(action: () => Promise<T>, onSuccess: (value: T) => void, onError: (err: unknown) => void) => Promise<void>;
26
+ }
27
+ export declare function useOwnerBoundRun(owner: string, afterwards: () => Promise<void>, onOwnerChange: () => void, lock?: ActionLock): UseOwnerBoundRunResult;
28
+ export {};
@@ -0,0 +1,56 @@
1
+ import { useCallback as e, useEffect as t, useLayoutEffect as n, useMemo as r, useRef as i, useState as a } from "react";
2
+ // src/bigconsole/hooks/useOwnerBoundRun.ts
3
+ function o() {
4
+ let [e, t] = a(null), n = i(null);
5
+ return r(() => ({
6
+ owner: e,
7
+ setOwner: t,
8
+ tryAcquire: (e) => n.current !== e && (n.current = e, !0),
9
+ release: (e) => {
10
+ n.current === e && (n.current = null);
11
+ }
12
+ }), [e]);
13
+ }
14
+ function s(r, a, s, c) {
15
+ let l = o(), { owner: u, setOwner: d, tryAcquire: f, release: p } = c ?? l, m = i(!0), h = i(r), g = i(s);
16
+ n(() => {
17
+ g.current = s;
18
+ }, [s]), t(() => (m.current = !0, () => {
19
+ m.current = !1;
20
+ }), []), t(() => {
21
+ h.current !== r && (h.current = r, g.current());
22
+ }, [r]);
23
+ let _ = e(async (e, t, n) => {
24
+ let r = h.current, i = () => !m.current || h.current !== r;
25
+ if (f(r)) {
26
+ d(r);
27
+ try {
28
+ let r;
29
+ try {
30
+ r = await e();
31
+ } catch (e) {
32
+ i() || n(e);
33
+ return;
34
+ }
35
+ if (i()) return;
36
+ t(r), await a();
37
+ } finally {
38
+ p(r), d((e) => e === r ? null : e);
39
+ }
40
+ }
41
+ }, [
42
+ a,
43
+ p,
44
+ d,
45
+ f
46
+ ]), v = e(() => {
47
+ let e = h.current;
48
+ return () => m.current && h.current === e;
49
+ }, []);
50
+ return {
51
+ acting: u === r,
52
+ begin: v,
53
+ run: _
54
+ };
55
+ }
56
+ export { o as useActionLock, s as useOwnerBoundRun };
@@ -54,6 +54,8 @@ function S(e) {
54
54
  translations: e.translations || [],
55
55
  actions: t || [],
56
56
  data: e.data || null,
57
+ isInherited: e.isInherited === !0,
58
+ isOverridden: e.isOverridden === !0,
57
59
  createdAt: e.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
58
60
  updatedAt: e.updatedAt || (/* @__PURE__ */ new Date()).toISOString()
59
61
  };