@burdenoff/fe-libs 2026.1029.5 → 2026.1029.6
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.
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { useSafeAuth as e } from "../providers/shell/AuthProvider.js";
|
|
2
|
+
import { isSuperAdminBypass as t, useSafePermissions as n } from "../providers/shell/PermissionProvider.js";
|
|
3
|
+
import { useAssistantStorageFolders as r } from "./product.js";
|
|
4
|
+
import { FilesPortError as i, createApolloFilesPort as a } from "../../storage/filesPort.js";
|
|
5
|
+
import { createAttachmentCommitter as o } from "./attachmentCommit.js";
|
|
6
|
+
import { getActorId as s, getWorkspaceId as c } from "./context.js";
|
|
7
|
+
import { probeAttachmentAccess as l } from "./attachmentAccess.js";
|
|
8
|
+
import { createContext as u, useCallback as d, useContext as f, useEffect as p, useMemo as m, useRef as h } from "react";
|
|
9
|
+
import { getApolloContext as g } from "@apollo/client/react";
|
|
9
10
|
//#region src/shared/assistant/useAttachmentCommitter.ts
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let e =
|
|
13
|
-
return
|
|
11
|
+
var _ = u(null);
|
|
12
|
+
function v() {
|
|
13
|
+
let e = f(_), { client: t } = f(g());
|
|
14
|
+
return m(() => e ?? (t ? a(t, { getWorkspaceId: c }) : null), [e, t]);
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
let e =
|
|
17
|
-
return
|
|
16
|
+
function y() {
|
|
17
|
+
let e = v();
|
|
18
|
+
return d(async (t) => e ? e.getDownloadUrl(t) : null, [e]);
|
|
18
19
|
}
|
|
19
|
-
var
|
|
20
|
-
ensureFolder:
|
|
21
|
-
initiate:
|
|
22
|
-
put:
|
|
23
|
-
complete:
|
|
24
|
-
getSession:
|
|
25
|
-
listSessions:
|
|
26
|
-
abort:
|
|
27
|
-
getDownloadUrl:
|
|
28
|
-
deleteFile:
|
|
20
|
+
var b = (e) => () => Promise.reject(new i(e, "File storage is not available here.", void 0)), x = {
|
|
21
|
+
ensureFolder: b("ensureFolder"),
|
|
22
|
+
initiate: b("initiate"),
|
|
23
|
+
put: b("put"),
|
|
24
|
+
complete: b("complete"),
|
|
25
|
+
getSession: b("getSession"),
|
|
26
|
+
listSessions: b("listSessions"),
|
|
27
|
+
abort: b("abort"),
|
|
28
|
+
getDownloadUrl: b("getDownloadUrl"),
|
|
29
|
+
deleteFile: b("deleteFile")
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
+
function S() {
|
|
31
32
|
return {
|
|
32
|
-
workspaceId: typeof window < "u" && window.location ?
|
|
33
|
-
actorId:
|
|
33
|
+
workspaceId: typeof window < "u" && window.location ? c() : "",
|
|
34
|
+
actorId: s()
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
-
let
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}, [
|
|
41
|
-
let
|
|
42
|
-
|
|
43
|
-
let
|
|
44
|
-
return
|
|
45
|
-
port:
|
|
37
|
+
function C(i) {
|
|
38
|
+
let a = v(), s = n(), c = e(), u = typeof c?.user?.actorType == "string" ? c.user.actorType : typeof c?.user?.actor_type == "string" ? c.user.actor_type : void 0, d = s?.isSuperAdmin ?? t(c?.isAuthenticated ?? !1, c?.user?.role, u), f = h(d);
|
|
39
|
+
p(() => {
|
|
40
|
+
f.current = d;
|
|
41
|
+
}, [d]);
|
|
42
|
+
let g = r(), _ = h(i);
|
|
43
|
+
_.current = i;
|
|
44
|
+
let y = h(g.attachments);
|
|
45
|
+
return y.current = g.attachments, m(() => o({
|
|
46
|
+
port: a ?? x,
|
|
46
47
|
preflightAccess: () => {
|
|
47
|
-
let { workspaceId: e, actorId: t } =
|
|
48
|
-
return
|
|
48
|
+
let { workspaceId: e, actorId: t } = S();
|
|
49
|
+
return l(e, t, f.current);
|
|
49
50
|
},
|
|
50
|
-
getScopeKey: () => JSON.stringify(
|
|
51
|
+
getScopeKey: () => JSON.stringify(S()),
|
|
51
52
|
get folderPath() {
|
|
52
|
-
return
|
|
53
|
+
return y.current;
|
|
53
54
|
},
|
|
54
|
-
onChange: (e, t) =>
|
|
55
|
-
}), [
|
|
55
|
+
onChange: (e, t) => _.current(e, t)
|
|
56
|
+
}), [a]);
|
|
56
57
|
}
|
|
57
58
|
//#endregion
|
|
58
|
-
export {
|
|
59
|
+
export { _ as AttachmentFilesPortContext, C as useAttachmentCommitter, v as useAttachmentFilesPort, y as useAttachmentUrlResolver };
|
|
@@ -73,3 +73,5 @@ export interface AuthProviderProps {
|
|
|
73
73
|
}
|
|
74
74
|
export declare function AuthProvider({ children, onTokenExpired, onSessionExpiringSoon, onRefreshToken, bridgeUrl, bridgeAllowedOrigins, bridgeDebug, onBridgeReady, onBeforeIdentityChange, }: AuthProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
75
75
|
export declare function useAuth(): AuthContextValue;
|
|
76
|
+
/** Optional shell integration: the same session as useAuth, or no provider. */
|
|
77
|
+
export declare function useSafeAuth(): AuthContextValue | null;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { getActiveProfileId as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as ee, getSwitchableProfiles as r, resolveActiveProfileId as te } from "./ProfileStorageManager.js";
|
|
2
|
-
import { readShellSsoCookie as
|
|
3
|
-
import { identityKeyOf as
|
|
4
|
-
import { useBridgeInitialization as
|
|
5
|
-
import { useTokenExpiryTimer as
|
|
6
|
-
import { useStorageSync as
|
|
7
|
-
import { useRemoteSLO as
|
|
2
|
+
import { readShellSsoCookie as ne } from "../../utils/authCookie.js";
|
|
3
|
+
import { identityKeyOf as i } from "./authProvider/identityChange.js";
|
|
4
|
+
import { useBridgeInitialization as a } from "./authProvider/useBridgeInitialization.js";
|
|
5
|
+
import { useTokenExpiryTimer as re } from "./authProvider/useTokenExpiryTimer.js";
|
|
6
|
+
import { useStorageSync as ie } from "./authProvider/useStorageSync.js";
|
|
7
|
+
import { useRemoteSLO as o } from "./authProvider/useRemoteSLO.js";
|
|
8
8
|
import { useAuthActions as ae } from "./authProvider/useAuthActions.js";
|
|
9
9
|
import { useSsoDepositBootGuard as oe } from "./authProvider/useSsoDepositBootGuard.js";
|
|
10
10
|
import { createContext as s, use as c, useCallback as l, useLayoutEffect as se, useMemo as u, useRef as d, useState as f } from "react";
|
|
11
|
-
import { jsx as
|
|
11
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
12
12
|
//#region src/shared/providers/shell/AuthProvider.tsx
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var m = s(null);
|
|
14
|
+
function h(e) {
|
|
15
15
|
return r(e).map((t) => ({
|
|
16
16
|
id: t.id,
|
|
17
17
|
email: t.email,
|
|
@@ -21,29 +21,29 @@ function m(e) {
|
|
|
21
21
|
lastLogin: t.lastLogin
|
|
22
22
|
}));
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function g({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefreshToken: g, bridgeUrl: _, bridgeAllowedOrigins: v, bridgeDebug: ce, onBridgeReady: le, onBeforeIdentityChange: y }) {
|
|
25
25
|
let b = d(!1), [x, S] = f(() => te()), [C, w] = f(() => x ? n(x) : null), [T, E] = f(() => x ? t(x) : null), [D, O] = f(() => x ? ee(x) : null), [k, A] = f(() => {
|
|
26
26
|
if (x && n(x)) return !1;
|
|
27
|
-
if (
|
|
28
|
-
let e =
|
|
27
|
+
if (_) try {
|
|
28
|
+
let e = ne()?.id ?? null;
|
|
29
29
|
if (e && localStorage.getItem(`bf-p-${e}-tokens`)) return !1;
|
|
30
30
|
} catch {}
|
|
31
|
-
return !!
|
|
32
|
-
}), [j, ue] = f(!1), [M, de] = f(null), [N, P] = f(() =>
|
|
31
|
+
return !!_;
|
|
32
|
+
}), [j, ue] = f(!1), [M, de] = f(null), [N, P] = f(() => h(x)), F = l(() => {
|
|
33
33
|
P([]);
|
|
34
34
|
}, []), I = l(() => {
|
|
35
|
-
P(
|
|
36
|
-
}, []), L =
|
|
35
|
+
P(h(e()));
|
|
36
|
+
}, []), L = i(x, C?.id), R = d(L), z = d(!1), B = d(y);
|
|
37
37
|
se(() => {
|
|
38
38
|
R.current = L, z.current = !1, B.current = y;
|
|
39
39
|
});
|
|
40
40
|
let V = l((e, t) => {
|
|
41
|
-
z.current ||
|
|
41
|
+
z.current || i(t.profileId, t.userId) !== R.current && (z.current = !0, B.current?.(e));
|
|
42
42
|
}, []);
|
|
43
|
-
|
|
44
|
-
bridgeUrl:
|
|
45
|
-
bridgeAllowedOrigins:
|
|
46
|
-
bridgeDebug:
|
|
43
|
+
a({
|
|
44
|
+
bridgeUrl: _,
|
|
45
|
+
bridgeAllowedOrigins: v,
|
|
46
|
+
bridgeDebug: ce,
|
|
47
47
|
onBridgeReady: le,
|
|
48
48
|
bridgeSyncInProgress: b,
|
|
49
49
|
setIsLoading: A,
|
|
@@ -60,7 +60,7 @@ function h({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefresh
|
|
|
60
60
|
tokens: T,
|
|
61
61
|
activeId: x,
|
|
62
62
|
bridgeSyncInProgress: b,
|
|
63
|
-
onRefreshToken:
|
|
63
|
+
onRefreshToken: g,
|
|
64
64
|
onTokenExpired: s,
|
|
65
65
|
setActiveId: S,
|
|
66
66
|
setUser: w,
|
|
@@ -73,13 +73,13 @@ function h({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefresh
|
|
|
73
73
|
refreshAccounts: I,
|
|
74
74
|
announceIdentityChange: V
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
re({
|
|
77
77
|
tokens: T,
|
|
78
|
-
onRefreshToken:
|
|
78
|
+
onRefreshToken: g,
|
|
79
79
|
onTokenExpired: s,
|
|
80
80
|
onSessionExpiringSoon: c,
|
|
81
81
|
refreshAccessToken: K
|
|
82
|
-
}),
|
|
82
|
+
}), ie({
|
|
83
83
|
user: C,
|
|
84
84
|
tokens: T,
|
|
85
85
|
workspaceToken: D,
|
|
@@ -91,9 +91,9 @@ function h({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefresh
|
|
|
91
91
|
clearAccounts: F,
|
|
92
92
|
refreshAccounts: I,
|
|
93
93
|
announceIdentityChange: V
|
|
94
|
-
}), oe(),
|
|
94
|
+
}), oe(), o({
|
|
95
95
|
tokens: T,
|
|
96
|
-
bridgeUrl:
|
|
96
|
+
bridgeUrl: _,
|
|
97
97
|
logout: U,
|
|
98
98
|
setActiveId: S,
|
|
99
99
|
setUser: w,
|
|
@@ -146,15 +146,18 @@ function h({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefresh
|
|
|
146
146
|
Q,
|
|
147
147
|
W
|
|
148
148
|
]);
|
|
149
|
-
return /* @__PURE__ */
|
|
149
|
+
return /* @__PURE__ */ p(m.Provider, {
|
|
150
150
|
value: fe,
|
|
151
151
|
children: r
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
let e = c(
|
|
154
|
+
function _() {
|
|
155
|
+
let e = c(m);
|
|
156
156
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
157
157
|
return e;
|
|
158
158
|
}
|
|
159
|
+
function v() {
|
|
160
|
+
return c(m);
|
|
161
|
+
}
|
|
159
162
|
//#endregion
|
|
160
|
-
export {
|
|
163
|
+
export { g as AuthProvider, _ as useAuth, v as useSafeAuth };
|