@burdenoff/fe-libs 2026.1005.2 → 2026.1005.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.
- package/dist/chrome/ContextSwitcher.d.ts +2 -0
- package/dist/chrome/ContextSwitcher.d.ts.map +1 -1
- package/dist/chrome/ContextSwitcher.js +70 -67
- package/dist/chrome/contextSwitcher/ProjectList.d.ts +1 -0
- package/dist/chrome/contextSwitcher/ProjectList.d.ts.map +1 -1
- package/dist/chrome/contextSwitcher/ProjectList.js +18 -5
- package/dist/node_modules/fflate/esm/browser.js +3 -3
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +51 -51
- package/dist/node_modules/pdfjs-dist/build/pdf.js +2268 -1656
- package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js +8719 -7535
- package/dist/shared/assistant/attachments.js +1 -0
- package/dist/shared/assistant/images.js +1 -1
- package/dist/shared/assistant/runtime.js +1 -0
- package/dist/shared/assistant/speech/createSpeechEngine.js +1 -1
- package/dist/shared/assistant/uiActions/deixis.js +1 -1
- package/dist/shared/assistant/voice/handsfree/micCapture.js +1 -0
- package/dist/shared/assistant/voice/voiceTranscript.js +14 -14
- package/dist/shared/components/SSORedirectGuard.d.ts +15 -0
- package/dist/shared/components/SSORedirectGuard.d.ts.map +1 -1
- package/dist/shared/components/SSORedirectGuard.js +39 -42
- package/dist/shared/config/gatewayUrls.js +2 -2
- package/dist/shared/graphql/workspaceToken.d.ts +1 -0
- package/dist/shared/graphql/workspaceToken.d.ts.map +1 -1
- package/dist/shared/graphql/workspaceToken.js +18 -14
- package/dist/shared/native/platform.d.ts +6 -0
- package/dist/shared/native/platform.d.ts.map +1 -1
- package/dist/shared/native/platform.js +22 -15
- package/dist/shared/plugins/iframe-mount/client/message-bus.js +1 -0
- package/dist/shared/plugins/iframe-mount/client/rpc.js +1 -0
- package/dist/shared/providers/shell/ActiveContextProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/ActiveContextProvider.js +165 -144
- package/dist/shared/providers/shell/AuthTokenProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/AuthTokenProvider.js +51 -46
- package/dist/shared/providers/shell/WorkspaceWideSelection.d.ts +10 -0
- package/dist/shared/providers/shell/WorkspaceWideSelection.d.ts.map +1 -0
- package/dist/shared/providers/shell/WorkspaceWideSelection.js +37 -0
- package/dist/shared/providers/shell/authProvider/ssoRelay.d.ts +3 -3
- package/dist/shared/providers/shell/authProvider/ssoRelay.d.ts.map +1 -1
- package/dist/shared/providers/shell/authProvider/ssoRelay.js +14 -13
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.d.ts.map +1 -1
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +38 -37
- package/dist/shared/providers/shell/authProvider/useSsoDepositBootGuard.d.ts.map +1 -1
- package/dist/shared/providers/shell/authProvider/useSsoDepositBootGuard.js +23 -26
- package/dist/shared/providers/shell/index.d.ts +2 -0
- package/dist/shared/providers/shell/index.d.ts.map +1 -1
- package/dist/shared/tours/TourTooltip.js +8 -8
- package/dist/shared/utils/format.js +1 -1
- package/dist/shared/utils/gatewayFetchRewrite.js +1 -1
- package/dist/shared-providers-shell.js +25 -24
- package/dist/shell-native/capacitor-config.d.ts +2 -0
- package/dist/shell-native/capacitor-config.d.ts.map +1 -1
- package/dist/shell-native/capacitor-config.js +38 -32
- package/dist/shell-native/index.d.ts +1 -1
- package/dist/shell-native/index.d.ts.map +1 -1
- package/dist/shell-native.js +4 -4
- package/package.json +18 -9
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ACTIVE_CONTEXT_STORAGE_KEY as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { getActiveProfileId as e, getProfileContext as t, resolveActiveProfileId as n, setProfileContext as r } from "./ProfileStorageManager.js";
|
|
2
|
+
import { ACTIVE_CONTEXT_STORAGE_KEY as i, DEFAULT_ACTIVE_CONTEXT_URL_PARAMS as a, clearActiveContextStorage as o, getUrlParam as s, readActiveContextStorageValue as c, readAuthStoreContext as l, writeActiveContextFallback as u, writeActiveContextStorageValue as d } from "./ActiveContextStorage.js";
|
|
3
|
+
import { clearWorkspaceWideSelection as f, isWorkspaceWideSelection as p } from "./WorkspaceWideSelection.js";
|
|
4
|
+
import { isSsoNavigationPending as m } from "../../utils/ssoDeposit.js";
|
|
5
|
+
import { createContext as h, use as g, useCallback as _, useEffect as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
6
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
6
7
|
//#region src/shared/providers/shell/ActiveContextProvider.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var C = h(null);
|
|
9
|
+
function w(e) {
|
|
9
10
|
return {
|
|
10
11
|
current: e,
|
|
11
12
|
previous: null,
|
|
@@ -14,7 +15,7 @@ function x(e) {
|
|
|
14
15
|
suppressUntil: 0
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function T() {
|
|
18
19
|
try {
|
|
19
20
|
return !!{
|
|
20
21
|
BASE_URL: "/",
|
|
@@ -22,18 +23,18 @@ function S() {
|
|
|
22
23
|
MODE: "production",
|
|
23
24
|
PROD: !0,
|
|
24
25
|
SSR: !1
|
|
25
|
-
}
|
|
26
|
+
}.DEV;
|
|
26
27
|
} catch {
|
|
27
28
|
return !1;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function E(e, t, n, r) {
|
|
31
32
|
if (t.current === n) return !1;
|
|
32
|
-
if (r < t.suppressUntil) return
|
|
33
|
+
if (r < t.suppressUntil) return T() && console.warn(`[ActiveContext] Suppressing rapid ${e} change to avoid a render loop (BOFF-5395): holding at ${JSON.stringify(t.current)}, refused ${JSON.stringify(n)}.`), !1;
|
|
33
34
|
let i = n === t.previous, a = r - t.windowStart < 500;
|
|
34
|
-
return i && a ? t.flips += 1 : (t.flips = 1, t.windowStart = r), t.flips >= 3 ? (t.suppressUntil = r + 500, t.flips = 0,
|
|
35
|
+
return i && a ? t.flips += 1 : (t.flips = 1, t.windowStart = r), t.flips >= 3 ? (t.suppressUntil = r + 500, t.flips = 0, T() && console.warn(`[ActiveContext] Detected ${e} ping-pong between ${JSON.stringify(t.current)} and ${JSON.stringify(n)} (BOFF-5395) — holding at the current value instead of looping.`), !1) : (t.previous = t.current, t.current = n, !0);
|
|
35
36
|
}
|
|
36
|
-
function
|
|
37
|
+
function D(e, t) {
|
|
37
38
|
let n = e.organizationId ?? t.organizationId, r = n !== null && n === t.organizationId, i = e.workspaceId ?? (r ? t.workspaceId : null), a = i !== null && i === t.workspaceId;
|
|
38
39
|
return {
|
|
39
40
|
organizationId: n,
|
|
@@ -41,28 +42,41 @@ function w(e, t) {
|
|
|
41
42
|
projectId: e.projectId ?? (a ? t.projectId : null)
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function O(e, t, n, r) {
|
|
45
46
|
if (n) {
|
|
46
|
-
let e =
|
|
47
|
+
let e = s(t);
|
|
47
48
|
if (e) return e;
|
|
48
49
|
}
|
|
49
|
-
return
|
|
50
|
+
return c(e, r) || null;
|
|
50
51
|
}
|
|
51
|
-
function
|
|
52
|
+
function k(t) {
|
|
52
53
|
if (typeof window > "u") return {
|
|
53
54
|
organizationId: null,
|
|
54
55
|
workspaceId: null,
|
|
55
56
|
projectId: null
|
|
56
57
|
};
|
|
57
|
-
let { storageKey:
|
|
58
|
-
organizationId:
|
|
59
|
-
workspaceId:
|
|
60
|
-
projectId:
|
|
58
|
+
let { storageKey: n, syncToUrl: r, urlParams: i } = t, o = {
|
|
59
|
+
organizationId: O("organization", i.organization ?? a.organization, r, n),
|
|
60
|
+
workspaceId: O("workspace", i.workspace ?? a.workspace, r, n),
|
|
61
|
+
projectId: O("project", i.project ?? a.project, r, n)
|
|
62
|
+
}, c = r && s(i.project ?? a.project), u = (t) => {
|
|
63
|
+
if (c) try {
|
|
64
|
+
e() && f(t);
|
|
65
|
+
} catch {}
|
|
61
66
|
};
|
|
62
|
-
|
|
67
|
+
if (u(o), !c && p(o)) return {
|
|
68
|
+
...o,
|
|
69
|
+
projectId: null
|
|
70
|
+
};
|
|
71
|
+
if (o.organizationId !== null && o.workspaceId !== null && o.projectId !== null) return o;
|
|
72
|
+
let d = D(o, l());
|
|
73
|
+
return u(d), !c && p(d) ? {
|
|
74
|
+
...d,
|
|
75
|
+
projectId: null
|
|
76
|
+
} : d;
|
|
63
77
|
}
|
|
64
|
-
function
|
|
65
|
-
if (typeof window > "u" ||
|
|
78
|
+
function A(e) {
|
|
79
|
+
if (typeof window > "u" || m() || window.location.pathname.startsWith("/auth/")) return;
|
|
66
80
|
let t = new URL(window.location.href);
|
|
67
81
|
Object.entries(e).forEach(([e, n]) => {
|
|
68
82
|
n ? t.searchParams.set(e, n) : t.searchParams.delete(e);
|
|
@@ -70,178 +84,185 @@ function D(e) {
|
|
|
70
84
|
let n = window.history.state ?? null;
|
|
71
85
|
window.history.replaceState(n, "", t.toString());
|
|
72
86
|
}
|
|
73
|
-
function
|
|
87
|
+
function j(e, t) {
|
|
74
88
|
return e === null || e === "" || e === t ? { apply: !1 } : {
|
|
75
89
|
apply: !0,
|
|
76
90
|
value: e
|
|
77
91
|
};
|
|
78
92
|
}
|
|
79
|
-
function
|
|
80
|
-
let [
|
|
81
|
-
storageKey:
|
|
82
|
-
syncToUrl:
|
|
83
|
-
urlParams:
|
|
84
|
-
})), [
|
|
85
|
-
if (typeof window > "u") return
|
|
86
|
-
let
|
|
87
|
-
if (
|
|
88
|
-
let i =
|
|
93
|
+
function M({ children: e, defaultOrganizationId: l = null, defaultWorkspaceId: m = null, defaultProjectId: h = null, defaultTenantId: g = null, storageKey: T = i, syncToUrl: D = !1, urlParams: O = a }) {
|
|
94
|
+
let [M] = x(() => k({
|
|
95
|
+
storageKey: T,
|
|
96
|
+
syncToUrl: D,
|
|
97
|
+
urlParams: O
|
|
98
|
+
})), [N, P] = x(() => typeof window > "u" ? l : M.organizationId ?? l), [F, I] = x(() => {
|
|
99
|
+
if (typeof window > "u") return m;
|
|
100
|
+
let e = M.workspaceId ?? m;
|
|
101
|
+
if (e) {
|
|
102
|
+
let i = n();
|
|
89
103
|
if (i) {
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
...
|
|
93
|
-
workspaceId:
|
|
104
|
+
let n = t(i);
|
|
105
|
+
n?.workspaceId || r(i, {
|
|
106
|
+
...n,
|
|
107
|
+
workspaceId: e
|
|
94
108
|
});
|
|
95
109
|
}
|
|
96
110
|
}
|
|
97
|
-
return
|
|
98
|
-
}), [
|
|
99
|
-
if (typeof window > "u") return
|
|
100
|
-
if (
|
|
101
|
-
let e =
|
|
111
|
+
return e;
|
|
112
|
+
}), [L, R] = x(() => typeof window > "u" ? h : p(M) && !M.projectId ? null : M.projectId ?? h), [z, B] = x(() => {
|
|
113
|
+
if (typeof window > "u") return g;
|
|
114
|
+
if (D) {
|
|
115
|
+
let e = s(O.tenant);
|
|
102
116
|
if (e) return e;
|
|
103
117
|
}
|
|
104
|
-
return
|
|
105
|
-
}),
|
|
106
|
-
|
|
107
|
-
let
|
|
108
|
-
|
|
109
|
-
let
|
|
110
|
-
|
|
111
|
-
let
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
return c("tenant", T) || g;
|
|
119
|
+
}), V = b(null);
|
|
120
|
+
V.current === null && (V.current = w(N));
|
|
121
|
+
let H = b(null);
|
|
122
|
+
H.current === null && (H.current = w(F));
|
|
123
|
+
let U = b(null);
|
|
124
|
+
U.current === null && (U.current = w(L));
|
|
125
|
+
let W = b(null);
|
|
126
|
+
W.current === null && (W.current = w(z)), v(() => {
|
|
127
|
+
d("organization", N, T), d("workspace", F, T), d("project", L, T), d("tenant", z, T);
|
|
114
128
|
}, [
|
|
115
|
-
j,
|
|
116
129
|
N,
|
|
117
130
|
F,
|
|
118
131
|
L,
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
z,
|
|
133
|
+
T
|
|
134
|
+
]), v(() => {
|
|
135
|
+
let e = n();
|
|
136
|
+
if (!e) return;
|
|
137
|
+
let i = t(e), a = {
|
|
124
138
|
...i,
|
|
125
|
-
organizationId:
|
|
126
|
-
workspaceId:
|
|
127
|
-
projectId:
|
|
128
|
-
tenantId:
|
|
139
|
+
organizationId: N,
|
|
140
|
+
workspaceId: F,
|
|
141
|
+
projectId: L,
|
|
142
|
+
tenantId: z
|
|
129
143
|
};
|
|
130
|
-
i?.organizationId === a.organizationId && i?.workspaceId === a.workspaceId && i?.projectId === a.projectId && i?.tenantId === a.tenantId ||
|
|
144
|
+
i?.organizationId === a.organizationId && i?.workspaceId === a.workspaceId && i?.projectId === a.projectId && i?.tenantId === a.tenantId || r(e, a);
|
|
131
145
|
}, [
|
|
132
|
-
j,
|
|
133
146
|
N,
|
|
134
147
|
F,
|
|
135
|
-
L
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
148
|
+
L,
|
|
149
|
+
z
|
|
150
|
+
]), v(() => {
|
|
151
|
+
D && A({
|
|
152
|
+
[O.organization]: N,
|
|
153
|
+
[O.workspace]: F,
|
|
154
|
+
[O.project]: L,
|
|
155
|
+
[O.tenant]: z
|
|
142
156
|
});
|
|
143
157
|
}, [
|
|
144
|
-
j,
|
|
145
158
|
N,
|
|
146
159
|
F,
|
|
147
160
|
L,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
161
|
+
z,
|
|
162
|
+
D,
|
|
163
|
+
O
|
|
164
|
+
]), v(() => {
|
|
165
|
+
if (!D) return;
|
|
152
166
|
let e = () => {
|
|
153
|
-
let e =
|
|
154
|
-
i.apply && (
|
|
155
|
-
let a =
|
|
156
|
-
a.apply && (
|
|
157
|
-
let
|
|
158
|
-
|
|
159
|
-
let c =
|
|
160
|
-
c.apply && (
|
|
167
|
+
let e = s(O.organization), t = s(O.workspace), n = s(O.project), r = s(O.tenant), i = j(e, N);
|
|
168
|
+
i.apply && (P(i.value), V.current.previous = V.current.current, V.current.current = i.value);
|
|
169
|
+
let a = j(t, F);
|
|
170
|
+
a.apply && (I(a.value), H.current.previous = H.current.current, H.current.current = a.value);
|
|
171
|
+
let o = j(n, L);
|
|
172
|
+
o.apply && (R(o.value), U.current.previous = U.current.current, U.current.current = o.value);
|
|
173
|
+
let c = j(r, z);
|
|
174
|
+
c.apply && (B(c.value), W.current.previous = W.current.current, W.current.current = c.value);
|
|
161
175
|
};
|
|
162
176
|
return window.addEventListener("popstate", e), () => window.removeEventListener("popstate", e);
|
|
163
177
|
}, [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
j,
|
|
178
|
+
D,
|
|
179
|
+
O,
|
|
167
180
|
N,
|
|
168
181
|
F,
|
|
169
|
-
L
|
|
182
|
+
L,
|
|
183
|
+
z
|
|
170
184
|
]);
|
|
171
|
-
let
|
|
172
|
-
|
|
173
|
-
}, [
|
|
174
|
-
if (!
|
|
175
|
-
|
|
176
|
-
let i =
|
|
177
|
-
i &&
|
|
178
|
-
...
|
|
179
|
-
organizationId:
|
|
180
|
-
}), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:organization-changed", { detail: { organizationId:
|
|
181
|
-
}, [
|
|
185
|
+
let G = _((e, t) => {
|
|
186
|
+
D && A({ [O[e] ?? a[e]]: t });
|
|
187
|
+
}, [D, O]), K = _((e) => {
|
|
188
|
+
if (!E("organizationId", V.current, e, Date.now())) return;
|
|
189
|
+
P(e), d("organization", e, T), G("organization", e);
|
|
190
|
+
let i = n();
|
|
191
|
+
i && r(i, {
|
|
192
|
+
...t(i),
|
|
193
|
+
organizationId: e
|
|
194
|
+
}), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:organization-changed", { detail: { organizationId: e } }));
|
|
195
|
+
}, [T, G]), q = _((e, i) => {
|
|
182
196
|
let a = {
|
|
183
197
|
organization: "organizationId",
|
|
184
198
|
workspace: "workspaceId",
|
|
185
199
|
project: "projectId",
|
|
186
200
|
tenant: "tenantId"
|
|
187
201
|
};
|
|
188
|
-
|
|
189
|
-
let o =
|
|
190
|
-
o ?
|
|
191
|
-
...
|
|
192
|
-
[a[
|
|
193
|
-
}) : typeof window < "u" &&
|
|
194
|
-
}, [
|
|
195
|
-
|
|
196
|
-
}, [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
e.organizationId !== void 0 && W(e.organizationId), e.workspaceId !== void 0 && K(e.workspaceId), e.projectId !== void 0 && q(e.projectId), e.tenantId !== void 0 && J(e.tenantId);
|
|
202
|
+
d(e, i, T), G(e, i);
|
|
203
|
+
let o = n();
|
|
204
|
+
o ? r(o, {
|
|
205
|
+
...t(o),
|
|
206
|
+
[a[e]]: i
|
|
207
|
+
}) : typeof window < "u" && u(e, i, T);
|
|
208
|
+
}, [T, G]), J = _((e) => {
|
|
209
|
+
E("workspaceId", H.current, e, Date.now()) && (I(e), q("workspace", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:workspace-changed", { detail: { workspaceId: e } })));
|
|
210
|
+
}, [q]), Y = _((e) => {
|
|
211
|
+
E("projectId", U.current, e, Date.now()) && (e && f({
|
|
212
|
+
organizationId: N,
|
|
213
|
+
workspaceId: F
|
|
214
|
+
}), R(e), q("project", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:project-changed", { detail: { projectId: e } })));
|
|
202
215
|
}, [
|
|
203
|
-
W,
|
|
204
|
-
K,
|
|
205
216
|
q,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
N,
|
|
218
|
+
F
|
|
219
|
+
]), X = _((e) => {
|
|
220
|
+
E("tenantId", W.current, e, Date.now()) && (B(e), q("tenant", e));
|
|
221
|
+
}, [q]), Z = _((e) => {
|
|
222
|
+
e.organizationId !== void 0 && K(e.organizationId), e.workspaceId !== void 0 && J(e.workspaceId), e.projectId !== void 0 && Y(e.projectId), e.tenantId !== void 0 && X(e.tenantId);
|
|
223
|
+
}, [
|
|
224
|
+
K,
|
|
225
|
+
J,
|
|
226
|
+
Y,
|
|
227
|
+
X
|
|
228
|
+
]), Q = _(() => {
|
|
229
|
+
P(null), I(null), R(null), B(null), V.current = w(null), H.current = w(null), U.current = w(null), W.current = w(null), o(T);
|
|
230
|
+
let e = n();
|
|
231
|
+
e && r(e, {});
|
|
232
|
+
}, [T]), $ = y(() => ({
|
|
233
|
+
organizationId: N,
|
|
234
|
+
workspaceId: F,
|
|
235
|
+
projectId: L,
|
|
236
|
+
tenantId: z,
|
|
237
|
+
setOrganization: K,
|
|
238
|
+
setWorkspace: J,
|
|
239
|
+
setProject: Y,
|
|
240
|
+
setTenant: X,
|
|
241
|
+
setContext: Z,
|
|
242
|
+
clearContext: Q,
|
|
243
|
+
urlSyncEnabled: D
|
|
223
244
|
}), [
|
|
224
|
-
j,
|
|
225
245
|
N,
|
|
226
246
|
F,
|
|
227
247
|
L,
|
|
228
|
-
|
|
248
|
+
z,
|
|
229
249
|
K,
|
|
230
|
-
q,
|
|
231
250
|
J,
|
|
232
251
|
Y,
|
|
233
252
|
X,
|
|
234
|
-
|
|
253
|
+
Z,
|
|
254
|
+
Q,
|
|
255
|
+
D
|
|
235
256
|
]);
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
value:
|
|
238
|
-
children:
|
|
257
|
+
return /* @__PURE__ */ S(C.Provider, {
|
|
258
|
+
value: $,
|
|
259
|
+
children: e
|
|
239
260
|
});
|
|
240
261
|
}
|
|
241
|
-
function
|
|
242
|
-
let e =
|
|
262
|
+
function N() {
|
|
263
|
+
let e = g(C);
|
|
243
264
|
if (!e) throw Error("useActiveContext must be used within an ActiveContextProvider");
|
|
244
265
|
return e;
|
|
245
266
|
}
|
|
246
267
|
//#endregion
|
|
247
|
-
export {
|
|
268
|
+
export { M as ActiveContextProvider, N as useActiveContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthTokenProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/AuthTokenProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"AuthTokenProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/AuthTokenProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAKL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAiBf,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACpC,iBAAiB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACvC,qBAAqB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAC3C,iBAAiB,EAAE,MAAM,IAAI,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAID,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpF,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1D;AAkHD,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAa,EACb,aAAa,EACb,iBAAiB,GAClB,EAAE,sBAAsB,2CAoGxB;AAED,wBAAgB,YAAY,IAAI,qBAAqB,CAMpD"}
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { getProfileWorkspaceToken as e, resolveActiveProfileId as t } from "./ProfileStorageManager.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { getUrlParam as n, readActiveContextValueWithUrlPrecedence as r } from "./ActiveContextStorage.js";
|
|
3
|
+
import { isWorkspaceWideSelection as i } from "./WorkspaceWideSelection.js";
|
|
4
|
+
import { isWorkspaceTokenValidForContext as a } from "../../graphql/workspaceToken.js";
|
|
5
|
+
import { createContext as o, use as s, useCallback as c, useEffect as l, useEffectEvent as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
6
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
6
7
|
//#region src/shared/providers/shell/AuthTokenProvider.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var h = "bf-p", g = "bf-active-profile", _ = o(null);
|
|
9
|
+
function v(e) {
|
|
9
10
|
try {
|
|
10
|
-
let t = localStorage.getItem(`${
|
|
11
|
+
let t = localStorage.getItem(`${h}-${e}-tokens`);
|
|
11
12
|
return t ? JSON.parse(t) : null;
|
|
12
13
|
} catch {
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function y(t) {
|
|
17
18
|
return e(t);
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function b(e) {
|
|
20
21
|
try {
|
|
21
|
-
let t = localStorage.getItem(`${
|
|
22
|
+
let t = localStorage.getItem(`${h}-${e}-auth-storage`);
|
|
22
23
|
return t ? JSON.parse(t) : null;
|
|
23
24
|
} catch {
|
|
24
25
|
return null;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function x(e) {
|
|
28
29
|
try {
|
|
29
|
-
let t = localStorage.getItem(`${
|
|
30
|
+
let t = localStorage.getItem(`${h}-${e}-user`);
|
|
30
31
|
return t ? JSON.parse(t) : null;
|
|
31
32
|
} catch {
|
|
32
33
|
return null;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function S(e) {
|
|
36
37
|
try {
|
|
37
|
-
let t = localStorage.getItem(`${
|
|
38
|
+
let t = localStorage.getItem(`${h}-${e}-context`);
|
|
38
39
|
return t ? JSON.parse(t) : null;
|
|
39
40
|
} catch {
|
|
40
41
|
return null;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function C() {
|
|
44
45
|
let e = t();
|
|
45
46
|
if (!e) return {
|
|
46
47
|
accessToken: null,
|
|
@@ -49,83 +50,87 @@ function x() {
|
|
|
49
50
|
userId: null,
|
|
50
51
|
isAuthenticated: !1
|
|
51
52
|
};
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
let o = v(e), s = b(e), c = y(e) ?? s?.state?.workspaceToken ?? null, l = x(e), u = S(e), d = r("workspace") ?? u?.workspaceId ?? s?.state?.currentWorkspaceId ?? null, f = r("organization") ?? u?.organizationId ?? null, p = r("tenant") ?? u?.tenantId ?? null, m = i({
|
|
54
|
+
organizationId: f,
|
|
55
|
+
workspaceId: d
|
|
56
|
+
}) && !n("project"), h = a(c, {
|
|
57
|
+
workspaceId: d,
|
|
58
|
+
organizationId: f,
|
|
59
|
+
tenantId: p,
|
|
60
|
+
projectId: m ? null : r("project") ?? u?.projectId ?? null,
|
|
61
|
+
workspaceWide: m
|
|
62
|
+
}) ? c : null;
|
|
58
63
|
return {
|
|
59
|
-
accessToken:
|
|
60
|
-
workspaceToken:
|
|
61
|
-
workspaceId:
|
|
62
|
-
userId:
|
|
63
|
-
isAuthenticated: !!(
|
|
64
|
+
accessToken: o?.accessToken ?? s?.state?.accessToken ?? null,
|
|
65
|
+
workspaceToken: h,
|
|
66
|
+
workspaceId: d,
|
|
67
|
+
userId: l?.id ?? s?.state?.user?.id ?? null,
|
|
68
|
+
isAuthenticated: !!(o?.accessToken ?? s?.state?.accessToken) && !!(l?.id ?? s?.state?.user?.id)
|
|
64
69
|
};
|
|
65
70
|
}
|
|
66
|
-
function
|
|
67
|
-
let [i, a] =
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
function w({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r }) {
|
|
72
|
+
let [i, a] = p(C), o = f(i.accessToken), s = f(i.workspaceToken);
|
|
73
|
+
l(() => {
|
|
74
|
+
o.current = i.accessToken, s.current = i.workspaceToken;
|
|
70
75
|
}, [i.accessToken, i.workspaceToken]);
|
|
71
|
-
let v =
|
|
72
|
-
let e =
|
|
76
|
+
let v = c(() => {
|
|
77
|
+
let e = C();
|
|
73
78
|
a(e), t && console.log("[AuthTokenProvider] Reloaded from profile storage:", {
|
|
74
79
|
hasAccessToken: !!e.accessToken,
|
|
75
80
|
hasWorkspaceToken: !!e.workspaceToken,
|
|
76
81
|
userId: e.userId
|
|
77
82
|
});
|
|
78
|
-
}, [t]), y =
|
|
83
|
+
}, [t]), y = u(() => {
|
|
79
84
|
t && console.log("[AuthTokenProvider] Detected same-tab profile storage change"), v();
|
|
80
85
|
});
|
|
81
|
-
|
|
86
|
+
l(() => {
|
|
82
87
|
let e = (e) => {
|
|
83
|
-
(e.key?.startsWith(
|
|
88
|
+
(e.key?.startsWith(h) || e.key === g) && v();
|
|
84
89
|
};
|
|
85
90
|
return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
|
|
86
|
-
}, [v]),
|
|
91
|
+
}, [v]), l(() => {
|
|
87
92
|
let e = () => {
|
|
88
93
|
y();
|
|
89
94
|
};
|
|
90
95
|
return window.addEventListener("bf-profile-storage-change", e), window.addEventListener("burdenoff:organization-changed", e), window.addEventListener("burdenoff:workspace-changed", e), window.addEventListener("burdenoff:project-changed", e), () => {
|
|
91
96
|
window.removeEventListener("bf-profile-storage-change", e), window.removeEventListener("burdenoff:organization-changed", e), window.removeEventListener("burdenoff:workspace-changed", e), window.removeEventListener("burdenoff:project-changed", e);
|
|
92
97
|
};
|
|
93
|
-
}, []),
|
|
98
|
+
}, []), l(() => {
|
|
94
99
|
n?.(i.accessToken, i.workspaceToken);
|
|
95
100
|
}, [
|
|
96
101
|
i.accessToken,
|
|
97
102
|
i.workspaceToken,
|
|
98
103
|
n
|
|
99
|
-
]),
|
|
104
|
+
]), l(() => {
|
|
100
105
|
r?.(i.workspaceId);
|
|
101
106
|
}, [i.workspaceId, r]);
|
|
102
|
-
let b =
|
|
107
|
+
let b = c(() => o.current, []), x = c(() => s.current, []), S = c(() => s.current || o.current, []), w = d(() => ({
|
|
103
108
|
accessToken: i.accessToken,
|
|
104
109
|
workspaceToken: i.workspaceToken,
|
|
105
110
|
workspaceId: i.workspaceId,
|
|
106
111
|
userId: i.userId,
|
|
107
112
|
getAccessToken: b,
|
|
108
|
-
getWorkspaceToken:
|
|
109
|
-
getWorkspaceAuthToken:
|
|
113
|
+
getWorkspaceToken: x,
|
|
114
|
+
getWorkspaceAuthToken: S,
|
|
110
115
|
reloadFromStorage: v,
|
|
111
116
|
isAuthenticated: i.isAuthenticated,
|
|
112
117
|
hasWorkspaceToken: !!i.workspaceToken
|
|
113
118
|
}), [
|
|
114
119
|
i,
|
|
115
120
|
b,
|
|
121
|
+
x,
|
|
116
122
|
S,
|
|
117
|
-
C,
|
|
118
123
|
v
|
|
119
124
|
]);
|
|
120
|
-
return /* @__PURE__ */
|
|
125
|
+
return /* @__PURE__ */ m(_.Provider, {
|
|
121
126
|
value: w,
|
|
122
127
|
children: e
|
|
123
128
|
});
|
|
124
129
|
}
|
|
125
|
-
function
|
|
126
|
-
let e =
|
|
130
|
+
function T() {
|
|
131
|
+
let e = s(_);
|
|
127
132
|
if (!e) throw Error("useAuthToken must be used within AuthTokenProvider");
|
|
128
133
|
return e;
|
|
129
134
|
}
|
|
130
135
|
//#endregion
|
|
131
|
-
export {
|
|
136
|
+
export { w as AuthTokenProvider, T as useAuthToken };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface WorkspaceWideScope {
|
|
2
|
+
organizationId: string | null;
|
|
3
|
+
workspaceId: string | null;
|
|
4
|
+
}
|
|
5
|
+
/** A profile-scoped navigation preference, never an authorization assertion. */
|
|
6
|
+
export declare function isWorkspaceWideSelection(scope: WorkspaceWideScope): boolean;
|
|
7
|
+
/** Called by the normal workspace-wide selector, with its current scope. */
|
|
8
|
+
export declare function selectWorkspaceWide(scope: WorkspaceWideScope): boolean;
|
|
9
|
+
export declare function clearWorkspaceWideSelection(scope: WorkspaceWideScope): void;
|
|
10
|
+
//# sourceMappingURL=WorkspaceWideSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkspaceWideSelection.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/WorkspaceWideSelection.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAID,gFAAgF;AAChF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAuB3E;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAUtE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAS3E"}
|