@burdenoff/fe-libs 2026.1005.2 → 2026.1005.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 (37) hide show
  1. package/dist/chrome/ContextSwitcher.d.ts +2 -0
  2. package/dist/chrome/ContextSwitcher.d.ts.map +1 -1
  3. package/dist/chrome/ContextSwitcher.js +70 -67
  4. package/dist/chrome/contextSwitcher/ProjectList.d.ts +1 -0
  5. package/dist/chrome/contextSwitcher/ProjectList.d.ts.map +1 -1
  6. package/dist/chrome/contextSwitcher/ProjectList.js +18 -5
  7. package/dist/node_modules/fflate/esm/browser.js +3 -3
  8. package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +51 -51
  9. package/dist/node_modules/pdfjs-dist/build/pdf.js +2268 -1656
  10. package/dist/node_modules/pdfjs-dist/build/pdf.worker.min.js +8719 -7535
  11. package/dist/shared/assistant/attachments.js +1 -0
  12. package/dist/shared/assistant/images.js +1 -1
  13. package/dist/shared/assistant/runtime.js +1 -0
  14. package/dist/shared/assistant/speech/createSpeechEngine.js +1 -1
  15. package/dist/shared/assistant/uiActions/deixis.js +1 -1
  16. package/dist/shared/assistant/voice/handsfree/micCapture.js +1 -0
  17. package/dist/shared/assistant/voice/voiceTranscript.js +14 -14
  18. package/dist/shared/config/gatewayUrls.js +2 -2
  19. package/dist/shared/graphql/workspaceToken.d.ts +1 -0
  20. package/dist/shared/graphql/workspaceToken.d.ts.map +1 -1
  21. package/dist/shared/graphql/workspaceToken.js +18 -14
  22. package/dist/shared/plugins/iframe-mount/client/message-bus.js +1 -0
  23. package/dist/shared/plugins/iframe-mount/client/rpc.js +1 -0
  24. package/dist/shared/providers/shell/ActiveContextProvider.d.ts.map +1 -1
  25. package/dist/shared/providers/shell/ActiveContextProvider.js +165 -144
  26. package/dist/shared/providers/shell/AuthTokenProvider.d.ts.map +1 -1
  27. package/dist/shared/providers/shell/AuthTokenProvider.js +51 -46
  28. package/dist/shared/providers/shell/WorkspaceWideSelection.d.ts +10 -0
  29. package/dist/shared/providers/shell/WorkspaceWideSelection.d.ts.map +1 -0
  30. package/dist/shared/providers/shell/WorkspaceWideSelection.js +37 -0
  31. package/dist/shared/providers/shell/index.d.ts +2 -0
  32. package/dist/shared/providers/shell/index.d.ts.map +1 -1
  33. package/dist/shared/tours/TourTooltip.js +8 -8
  34. package/dist/shared/utils/format.js +1 -1
  35. package/dist/shared/utils/gatewayFetchRewrite.js +1 -1
  36. package/dist/shared-providers-shell.js +25 -24
  37. package/package.json +17 -8
@@ -1,11 +1,12 @@
1
- import { getProfileContext as e, resolveActiveProfileId as t, setProfileContext as n } from "./ProfileStorageManager.js";
2
- import { ACTIVE_CONTEXT_STORAGE_KEY as r, DEFAULT_ACTIVE_CONTEXT_URL_PARAMS as i, clearActiveContextStorage as a, getUrlParam as o, readActiveContextStorageValue as s, readAuthStoreContext as c, writeActiveContextFallback as l, writeActiveContextStorageValue as u } from "./ActiveContextStorage.js";
3
- import { isSsoNavigationPending as d } from "../../utils/ssoDeposit.js";
4
- import { createContext as f, use as p, useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
5
- import { jsx as y } from "react/jsx-runtime";
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 b = f(null);
8
- function x(e) {
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 S() {
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
- }?.DEV;
26
+ }.DEV;
26
27
  } catch {
27
28
  return !1;
28
29
  }
29
30
  }
30
- function C(e, t, n, r) {
31
+ function E(e, t, n, r) {
31
32
  if (t.current === n) return !1;
32
- if (r < t.suppressUntil) return S() && 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
+ 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, S() && 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
+ 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 w(e, t) {
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 T(e, t, n, r) {
45
+ function O(e, t, n, r) {
45
46
  if (n) {
46
- let e = o(t);
47
+ let e = s(t);
47
48
  if (e) return e;
48
49
  }
49
- return s(e, r) || null;
50
+ return c(e, r) || null;
50
51
  }
51
- function E(e) {
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: t, syncToUrl: n, urlParams: r } = e, a = {
58
- organizationId: T("organization", r.organization ?? i.organization, n, t),
59
- workspaceId: T("workspace", r.workspace ?? i.workspace, n, t),
60
- projectId: T("project", r.project ?? i.project, n, t)
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
- return a.organizationId !== null && a.workspaceId !== null && a.projectId !== null ? a : w(a, c());
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 D(e) {
65
- if (typeof window > "u" || d() || window.location.pathname.startsWith("/auth/")) return;
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 O(e, t) {
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 k({ children: c, defaultOrganizationId: d = null, defaultWorkspaceId: f = null, defaultProjectId: p = null, defaultTenantId: S = null, storageKey: w = r, syncToUrl: T = !1, urlParams: k = i }) {
80
- let [A] = v(() => E({
81
- storageKey: w,
82
- syncToUrl: T,
83
- urlParams: k
84
- })), [j, M] = v(() => typeof window > "u" ? d : A.organizationId ?? d), [N, P] = v(() => {
85
- if (typeof window > "u") return f;
86
- let r = A.workspaceId ?? f;
87
- if (r) {
88
- let i = t();
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 t = e(i);
91
- t?.workspaceId || n(i, {
92
- ...t,
93
- workspaceId: r
104
+ let n = t(i);
105
+ n?.workspaceId || r(i, {
106
+ ...n,
107
+ workspaceId: e
94
108
  });
95
109
  }
96
110
  }
97
- return r;
98
- }), [F, I] = v(() => typeof window > "u" ? p : A.projectId ?? p), [L, R] = v(() => {
99
- if (typeof window > "u") return S;
100
- if (T) {
101
- let e = o(k.tenant);
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 s("tenant", w) || S;
105
- }), z = _(null);
106
- z.current === null && (z.current = x(j));
107
- let B = _(null);
108
- B.current === null && (B.current = x(N));
109
- let V = _(null);
110
- V.current === null && (V.current = x(F));
111
- let H = _(null);
112
- H.current === null && (H.current = x(L)), h(() => {
113
- u("organization", j, w), u("workspace", N, w), u("project", F, w), u("tenant", L, w);
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
- w
120
- ]), h(() => {
121
- let r = t();
122
- if (!r) return;
123
- let i = e(r), a = {
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: j,
126
- workspaceId: N,
127
- projectId: F,
128
- tenantId: L
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 || n(r, a);
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
- ]), h(() => {
137
- T && D({
138
- [k.organization]: j,
139
- [k.workspace]: N,
140
- [k.project]: F,
141
- [k.tenant]: L
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
- T,
149
- k
150
- ]), h(() => {
151
- if (!T) return;
161
+ z,
162
+ D,
163
+ O
164
+ ]), v(() => {
165
+ if (!D) return;
152
166
  let e = () => {
153
- let e = o(k.organization), t = o(k.workspace), n = o(k.project), r = o(k.tenant), i = O(e, j);
154
- i.apply && (M(i.value), z.current.previous = z.current.current, z.current.current = i.value);
155
- let a = O(t, N);
156
- a.apply && (P(a.value), B.current.previous = B.current.current, B.current.current = a.value);
157
- let s = O(n, F);
158
- s.apply && (I(s.value), V.current.previous = V.current.current, V.current.current = s.value);
159
- let c = O(r, L);
160
- c.apply && (R(c.value), H.current.previous = H.current.current, H.current.current = c.value);
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
- T,
165
- k,
166
- j,
178
+ D,
179
+ O,
167
180
  N,
168
181
  F,
169
- L
182
+ L,
183
+ z
170
184
  ]);
171
- let U = m((e, t) => {
172
- T && D({ [k[e] ?? i[e]]: t });
173
- }, [T, k]), W = m((r) => {
174
- if (!C("organizationId", z.current, r, Date.now())) return;
175
- M(r), u("organization", r, w), U("organization", r);
176
- let i = t();
177
- i && n(i, {
178
- ...e(i),
179
- organizationId: r
180
- }), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:organization-changed", { detail: { organizationId: r } }));
181
- }, [w, U]), G = m((r, i) => {
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
- u(r, i, w), U(r, i);
189
- let o = t();
190
- o ? n(o, {
191
- ...e(o),
192
- [a[r]]: i
193
- }) : typeof window < "u" && l(r, i, w);
194
- }, [w, U]), K = m((e) => {
195
- C("workspaceId", B.current, e, Date.now()) && (P(e), G("workspace", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:workspace-changed", { detail: { workspaceId: e } })));
196
- }, [G]), q = m((e) => {
197
- C("projectId", V.current, e, Date.now()) && (I(e), G("project", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:project-changed", { detail: { projectId: e } })));
198
- }, [G]), J = m((e) => {
199
- C("tenantId", H.current, e, Date.now()) && (R(e), G("tenant", e));
200
- }, [G]), Y = m((e) => {
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
- J
207
- ]), X = m(() => {
208
- M(null), P(null), I(null), R(null), z.current = x(null), B.current = x(null), V.current = x(null), H.current = x(null), a(w);
209
- let e = t();
210
- e && n(e, {});
211
- }, [w]), Z = g(() => ({
212
- organizationId: j,
213
- workspaceId: N,
214
- projectId: F,
215
- tenantId: L,
216
- setOrganization: W,
217
- setWorkspace: K,
218
- setProject: q,
219
- setTenant: J,
220
- setContext: Y,
221
- clearContext: X,
222
- urlSyncEnabled: T
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
- W,
248
+ z,
229
249
  K,
230
- q,
231
250
  J,
232
251
  Y,
233
252
  X,
234
- T
253
+ Z,
254
+ Q,
255
+ D
235
256
  ]);
236
- return /* @__PURE__ */ y(b.Provider, {
237
- value: Z,
238
- children: c
257
+ return /* @__PURE__ */ S(C.Provider, {
258
+ value: $,
259
+ children: e
239
260
  });
240
261
  }
241
- function A() {
242
- let e = p(b);
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 { k as ActiveContextProvider, A as useActiveContext };
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;AAef,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;AA6GD,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,KAAa,EACb,aAAa,EACb,iBAAiB,GAClB,EAAE,sBAAsB,2CAoGxB;AAED,wBAAgB,YAAY,IAAI,qBAAqB,CAMpD"}
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 { readActiveContextValueWithUrlPrecedence as n } from "./ActiveContextStorage.js";
3
- import { isWorkspaceTokenValidForContext as r } from "../../graphql/workspaceToken.js";
4
- import { createContext as i, use as a, useCallback as o, useEffect as s, useEffectEvent as c, useMemo as l, useRef as u, useState as d } from "react";
5
- import { jsx as f } from "react/jsx-runtime";
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 p = "bf-p", m = "bf-active-profile", h = i(null);
8
- function g(e) {
8
+ var h = "bf-p", g = "bf-active-profile", _ = o(null);
9
+ function v(e) {
9
10
  try {
10
- let t = localStorage.getItem(`${p}-${e}-tokens`);
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 _(t) {
17
+ function y(t) {
17
18
  return e(t);
18
19
  }
19
- function v(e) {
20
+ function b(e) {
20
21
  try {
21
- let t = localStorage.getItem(`${p}-${e}-auth-storage`);
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 y(e) {
28
+ function x(e) {
28
29
  try {
29
- let t = localStorage.getItem(`${p}-${e}-user`);
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 b(e) {
36
+ function S(e) {
36
37
  try {
37
- let t = localStorage.getItem(`${p}-${e}-context`);
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 x() {
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 i = g(e), a = v(e), o = _(e) ?? a?.state?.workspaceToken ?? null, s = y(e), c = b(e), l = n("workspace") ?? c?.workspaceId ?? a?.state?.currentWorkspaceId ?? null, u = r(o, {
53
- workspaceId: l,
54
- organizationId: n("organization") ?? c?.organizationId ?? null,
55
- tenantId: n("tenant") ?? c?.tenantId ?? null,
56
- projectId: n("project") ?? c?.projectId ?? null
57
- }) ? o : null;
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: i?.accessToken ?? a?.state?.accessToken ?? null,
60
- workspaceToken: u,
61
- workspaceId: l,
62
- userId: s?.id ?? a?.state?.user?.id ?? null,
63
- isAuthenticated: !!(i?.accessToken ?? a?.state?.accessToken) && !!(s?.id ?? a?.state?.user?.id)
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 S({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r }) {
67
- let [i, a] = d(x), g = u(i.accessToken), _ = u(i.workspaceToken);
68
- s(() => {
69
- g.current = i.accessToken, _.current = i.workspaceToken;
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 = o(() => {
72
- let e = x();
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 = c(() => {
83
+ }, [t]), y = u(() => {
79
84
  t && console.log("[AuthTokenProvider] Detected same-tab profile storage change"), v();
80
85
  });
81
- s(() => {
86
+ l(() => {
82
87
  let e = (e) => {
83
- (e.key?.startsWith(p) || e.key === m) && v();
88
+ (e.key?.startsWith(h) || e.key === g) && v();
84
89
  };
85
90
  return window.addEventListener("storage", e), () => window.removeEventListener("storage", e);
86
- }, [v]), s(() => {
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
- }, []), s(() => {
98
+ }, []), l(() => {
94
99
  n?.(i.accessToken, i.workspaceToken);
95
100
  }, [
96
101
  i.accessToken,
97
102
  i.workspaceToken,
98
103
  n
99
- ]), s(() => {
104
+ ]), l(() => {
100
105
  r?.(i.workspaceId);
101
106
  }, [i.workspaceId, r]);
102
- let b = o(() => g.current, []), S = o(() => _.current, []), C = o(() => _.current || g.current, []), w = l(() => ({
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: S,
109
- getWorkspaceAuthToken: C,
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__ */ f(h.Provider, {
125
+ return /* @__PURE__ */ m(_.Provider, {
121
126
  value: w,
122
127
  children: e
123
128
  });
124
129
  }
125
- function C() {
126
- let e = a(h);
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 { S as AuthTokenProvider, C as useAuthToken };
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"}