@burdenoff/microfe-workspaces 2026.1029.2 → 2026.1108.1
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/hooks/useMemberMutations.js +163 -152
- package/dist/hooks/useProjectMemberMutations.js +44 -42
- package/dist/hooks/useProjectMutations.js +113 -108
- package/dist/hooks/useWorkspaceMutations.js +89 -82
- package/dist/pages/dashboard/DashboardPage.js +2 -0
- package/dist/pages/dashboard/hooks/useDashboardPreferences.js +14 -15
- package/dist/pages/dashboard/widgets/GroupsWidget.js +5 -1
- package/dist/pages/dashboard/widgets/MembersWidget.js +5 -1
- package/dist/pages/dashboard/widgets/TagCloudWidget.js +5 -1
- package/dist/utils/pinnedRequest.d.ts +35 -0
- package/dist/utils/pinnedRequest.js +53 -0
- package/package.json +3 -2
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
import { UpdateDashboardPreferencesDocument as e } from "../../../generated/global-operations.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { captureRequestActor as t, pinnedFetch as n } from "../../../utils/pinnedRequest.js";
|
|
3
|
+
import { useMutation as r, useQueryClient as i } from "@tanstack/react-query";
|
|
4
|
+
import { print as a } from "graphql";
|
|
5
5
|
//#region src/pages/dashboard/hooks/useDashboardPreferences.ts
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
return
|
|
9
|
-
mutationFn: async (
|
|
10
|
-
let
|
|
6
|
+
function o(o) {
|
|
7
|
+
let s = i();
|
|
8
|
+
return r({
|
|
9
|
+
mutationFn: async (r) => {
|
|
10
|
+
let i = await n(t({ authToken: o }), {
|
|
11
11
|
gateway: "global",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
variables: { input: { widgets: t.map((e) => ({
|
|
12
|
+
query: a(e),
|
|
13
|
+
variables: { input: { widgets: r.map((e) => ({
|
|
15
14
|
widgetId: e.widgetId,
|
|
16
15
|
enabled: e.enabled,
|
|
17
16
|
order: e.order,
|
|
18
17
|
size: e.size
|
|
19
18
|
})) } }
|
|
20
19
|
});
|
|
21
|
-
if (
|
|
22
|
-
return
|
|
20
|
+
if (i.errors?.length) throw Error(i.errors[0]?.message || "Failed to save preferences");
|
|
21
|
+
return i.data.updateMyDashboardPreferences;
|
|
23
22
|
},
|
|
24
23
|
onSuccess: () => {
|
|
25
|
-
|
|
24
|
+
s.invalidateQueries({ queryKey: ["dashboard", "global"] });
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
//#endregion
|
|
30
|
-
export {
|
|
29
|
+
export { o as useUpdateDashboardPreferences };
|
|
@@ -17,8 +17,12 @@ function l({ workspaceData: l, isLoading: u, navigate: d }) {
|
|
|
17
17
|
variant: "ghost",
|
|
18
18
|
size: "sm",
|
|
19
19
|
className: "text-xs",
|
|
20
|
+
"aria-label": e(f, "dashboard.groups.open", "Open groups"),
|
|
20
21
|
onClick: () => d("/groups"),
|
|
21
|
-
children: /* @__PURE__ */ i(n, {
|
|
22
|
+
children: /* @__PURE__ */ i(n, {
|
|
23
|
+
className: "size-3",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
})
|
|
22
26
|
}),
|
|
23
27
|
children: p.length === 0 ? /* @__PURE__ */ i(s, {
|
|
24
28
|
illustration: "empty-people",
|
|
@@ -17,8 +17,12 @@ function l({ workspaceData: l, globalData: u, isLoading: d, navigate: f }) {
|
|
|
17
17
|
variant: "ghost",
|
|
18
18
|
size: "sm",
|
|
19
19
|
className: "text-xs",
|
|
20
|
+
"aria-label": e(p, "dashboard.members.open", "Open members"),
|
|
20
21
|
onClick: () => f("/workspaces/members"),
|
|
21
|
-
children: /* @__PURE__ */ a(n, {
|
|
22
|
+
children: /* @__PURE__ */ a(n, {
|
|
23
|
+
className: "size-3",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
})
|
|
22
26
|
}),
|
|
23
27
|
children: /* @__PURE__ */ o("div", {
|
|
24
28
|
className: "space-y-3",
|
|
@@ -27,8 +27,12 @@ function d({ workspaceData: d, isLoading: f, navigate: p }) {
|
|
|
27
27
|
variant: "ghost",
|
|
28
28
|
size: "sm",
|
|
29
29
|
className: "text-xs",
|
|
30
|
+
"aria-label": e(m, "dashboard.tagCloud.open", "Open tags"),
|
|
30
31
|
onClick: () => p("/tags"),
|
|
31
|
-
children: /* @__PURE__ */ i(n, {
|
|
32
|
+
children: /* @__PURE__ */ i(n, {
|
|
33
|
+
className: "size-3",
|
|
34
|
+
"aria-hidden": "true"
|
|
35
|
+
})
|
|
32
36
|
}),
|
|
33
37
|
children: h.length === 0 ? /* @__PURE__ */ i(c, {
|
|
34
38
|
illustration: "empty-generic",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GraphQLResponse } from '@burdenoff/fe-libs/shared/graphql';
|
|
2
|
+
export declare const SIGN_IN_REQUIRED_MESSAGE = "Your session has ended. Sign in again, then retry this action.";
|
|
3
|
+
export declare const ACTOR_CHANGED_MESSAGE = "The active account changed before this action was sent. Review it and try again.";
|
|
4
|
+
/** The parts of the MFE root props that identify the acting user. */
|
|
5
|
+
export interface RequestActorSource {
|
|
6
|
+
authToken?: string | null;
|
|
7
|
+
currentUser?: {
|
|
8
|
+
id?: string | null;
|
|
9
|
+
} | null;
|
|
10
|
+
}
|
|
11
|
+
/** The account and bearer an action was started with. */
|
|
12
|
+
export interface CapturedRequestActor {
|
|
13
|
+
readonly actorId: string;
|
|
14
|
+
readonly authToken: string;
|
|
15
|
+
}
|
|
16
|
+
export interface PinnedFetchOptions {
|
|
17
|
+
gateway: 'workspace' | 'global';
|
|
18
|
+
query: string;
|
|
19
|
+
variables?: Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Workspace whose context (x-workspace-id and workspace token) the operation
|
|
22
|
+
* runs in. Defaults to the active workspace, as `graphqlFetch` does.
|
|
23
|
+
*/
|
|
24
|
+
workspaceId?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Record the acting user when an action starts. Call it synchronously at the
|
|
28
|
+
* top of a mutation so the capture reflects the account the user acted as.
|
|
29
|
+
*/
|
|
30
|
+
export declare function captureRequestActor(source: RequestActorSource): CapturedRequestActor;
|
|
31
|
+
/**
|
|
32
|
+
* Send one operation of an action bound to the captured actor. Returns the raw
|
|
33
|
+
* GraphQL response so call sites keep their own error and empty-data handling.
|
|
34
|
+
*/
|
|
35
|
+
export declare function pinnedFetch<T>(actor: CapturedRequestActor, options: PinnedFetchOptions): Promise<GraphQLResponse<T>>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { getActiveUser as e } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
2
|
+
import { clearGraphqlFetchResponseCache as t, getStoredAuthToken as n, getStoredWorkspaceId as r, graphqlFetchPinned as i, prepareWorkspaceRequest as a, resolveGatewayUrl as o } from "@burdenoff/fe-libs/shared/graphql";
|
|
3
|
+
import { getStoredTenantId as s } from "@burdenoff/fe-libs/shared/graphql/fetch";
|
|
4
|
+
//#region src/utils/pinnedRequest.ts
|
|
5
|
+
var c = "Your session has ended. Sign in again, then retry this action.", l = "The active account changed before this action was sent. Review it and try again.";
|
|
6
|
+
function u(t) {
|
|
7
|
+
let r = e()?.id || null, i = t.currentUser?.id || r;
|
|
8
|
+
if (!i || !r) throw Error(c);
|
|
9
|
+
if (r !== i) throw Error(l);
|
|
10
|
+
let a = n() || t.authToken || "";
|
|
11
|
+
if (!a) throw Error(c);
|
|
12
|
+
return {
|
|
13
|
+
actorId: i,
|
|
14
|
+
authToken: a
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function d(t) {
|
|
18
|
+
if (e()?.id !== t.actorId) throw Error(l);
|
|
19
|
+
}
|
|
20
|
+
function f(e) {
|
|
21
|
+
return /^\s*mutation\b/.test(e);
|
|
22
|
+
}
|
|
23
|
+
async function p(e, n) {
|
|
24
|
+
let { gateway: c, query: l, variables: u, workspaceId: p } = n;
|
|
25
|
+
d(e);
|
|
26
|
+
let m;
|
|
27
|
+
if (c === "workspace") {
|
|
28
|
+
let t = r(), n = p || t;
|
|
29
|
+
if (n && n === t) {
|
|
30
|
+
let t = await a({
|
|
31
|
+
url: o("workspace"),
|
|
32
|
+
authToken: e.authToken,
|
|
33
|
+
actorId: e.actorId,
|
|
34
|
+
workspaceId: n,
|
|
35
|
+
tenantId: s() ?? void 0,
|
|
36
|
+
currentQuery: l
|
|
37
|
+
});
|
|
38
|
+
t.assertCurrent(), m = t.workspaceToken;
|
|
39
|
+
} else m = !0;
|
|
40
|
+
}
|
|
41
|
+
d(e);
|
|
42
|
+
let h = await i({
|
|
43
|
+
gateway: c,
|
|
44
|
+
query: l,
|
|
45
|
+
variables: u,
|
|
46
|
+
authToken: e.authToken,
|
|
47
|
+
...p ? { workspaceId: p } : {},
|
|
48
|
+
...m === void 0 ? {} : { workspaceToken: m }
|
|
49
|
+
});
|
|
50
|
+
return f(l) && !h.errors?.length && t(), h;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { u as captureRequestActor, p as pinnedFetch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-workspaces",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.1108.1",
|
|
4
4
|
"description": "Workspaces microfrontend for Burdenoff products",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@apollo/client": "^4.0.11",
|
|
51
|
-
"@burdenoff/fe-libs": "2026.
|
|
51
|
+
"@burdenoff/fe-libs": "2026.1102.4",
|
|
52
52
|
"@radix-ui/react-icons": "^1.3.2",
|
|
53
53
|
"@tanstack/react-query": "^5.62.13",
|
|
54
54
|
"axios": "^1.20.0",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
},
|
|
95
95
|
"peerDependencies": {
|
|
96
96
|
"@apollo/client": "^4.0.11",
|
|
97
|
+
"@burdenoff/fe-libs": "^2026.1102.4",
|
|
97
98
|
"react": "^19.0.0",
|
|
98
99
|
"react-dom": "^19.0.0",
|
|
99
100
|
"zustand": "^5.0.0"
|