@burdenoff/fe-libs 2026.527.3 → 2026.527.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.
Files changed (94) hide show
  1. package/dist/chrome/ContextSwitcher.js +90 -339
  2. package/dist/chrome/GlobalSearch.js +72 -456
  3. package/dist/chrome/NotificationCenter.js +69 -703
  4. package/dist/chrome/SideNavigation.js +73 -241
  5. package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
  6. package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
  7. package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
  8. package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
  9. package/dist/chrome/contextSwitcher/TabButton.js +9 -0
  10. package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
  11. package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
  12. package/dist/chrome/contextSwitcher/icons.js +58 -0
  13. package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
  14. package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
  15. package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
  16. package/dist/chrome/globalSearch/ResultsList.js +58 -0
  17. package/dist/chrome/globalSearch/SearchInput.js +28 -0
  18. package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
  19. package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
  20. package/dist/chrome/globalSearch/utils.js +22 -0
  21. package/dist/chrome/notificationCenter/BellButton.js +27 -0
  22. package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
  23. package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
  24. package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
  25. package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
  26. package/dist/chrome/notificationCenter/NotificationList.js +75 -0
  27. package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
  28. package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
  29. package/dist/chrome/notificationCenter/constants.js +93 -0
  30. package/dist/chrome/notificationCenter/gql.js +58 -0
  31. package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
  32. package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
  33. package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
  34. package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
  35. package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
  36. package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
  37. package/dist/chrome/sideNavigation/helpers.js +19 -0
  38. package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
  39. package/dist/shared/components/ContextConversationWidget.js +173 -767
  40. package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
  41. package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
  42. package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
  43. package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
  44. package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
  45. package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
  46. package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
  47. package/dist/shared/components/contextConversationWidget/queries.js +197 -0
  48. package/dist/shared/components/contextConversationWidget/types.js +10 -0
  49. package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
  50. package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
  51. package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
  52. package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
  53. package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
  54. package/dist/shared/components/contextConversationWidget/utils.js +56 -0
  55. package/dist/shared/pages/SearchPage.js +293 -1076
  56. package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
  57. package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
  58. package/dist/shared/pages/searchPage/ResultsList.js +119 -0
  59. package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
  60. package/dist/shared/pages/searchPage/SearchInput.js +31 -0
  61. package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
  62. package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
  63. package/dist/shared/pages/searchPage/constants.js +155 -0
  64. package/dist/shared/pages/searchPage/utils.js +24 -0
  65. package/dist/shared/providers/shell/AuthProvider.js +130 -384
  66. package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
  67. package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
  68. package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
  69. package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
  70. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
  71. package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
  72. package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
  73. package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
  74. package/dist/shared/tours/TourTrigger.js +86 -262
  75. package/dist/shared/tours/ToursContext.js +108 -398
  76. package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
  77. package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
  78. package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
  79. package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
  80. package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
  81. package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
  82. package/dist/shared/tours/toursContext/errors.js +18 -0
  83. package/dist/shared/tours/toursContext/gql.js +152 -0
  84. package/dist/shared/tours/toursContext/route.js +20 -0
  85. package/dist/shared/tours/toursContext/session.js +19 -0
  86. package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
  87. package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
  88. package/dist/tag/TagsWidget.js +81 -226
  89. package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
  90. package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
  91. package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
  92. package/dist/tag/tagsWidget/operations.js +64 -0
  93. package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
  94. package/package.json +1 -1
@@ -1,407 +1,153 @@
1
- import { resolveGatewayUrls as e } from "../../config/gatewayUrls.js";
2
- import { resolveAuthBridgeConfig as t } from "../../config/authBridgeUrls.js";
3
- import { PROFILE_STORAGE_CHANGE_EVENT as n, addProfile as r, getActiveProfileId as i, getProfileTokens as a, getProfileUser as o, getProfileWorkspaceToken as s, getProfiles as c, loginProfile as ee, logoutAllProfiles as te, removeProfile as l, resolveActiveProfileId as u, setActiveProfileId as d, setProfileTokens as f, setProfileUser as p, setProfileWorkspaceToken as m, setProfiles as h, switchProfile as ne } from "./ProfileStorageManager.js";
4
- import { clearShellSsoCookies as g, isSharedSsoCookieDomain as re, isTrustedSsoOrigin as _, readShellSsoCookie as v, setShellSsoCookies as ie } from "../../utils/authCookie.js";
5
- import { getAuthBridge as y, initAuthBridge as ae, isAuthBridgeInitialized as oe } from "./AuthBridgeClient.js";
6
- import { checkRemoteSLO as se, checkSLO as ce, clearLocalAuthState as b, hasRecentSSORedirectAttempt as x, markSSORedirectAttempt as S, shouldSkipSSORedirect as C } from "../../components/SSORedirectGuard.js";
7
- import { createContext as w, use as T, useCallback as E, useEffect as D, useMemo as le, useRef as ue, useState as O } from "react";
8
- import { jsx as de } from "react/jsx-runtime";
1
+ import { getActiveProfileId as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as r, getProfiles as i, resolveActiveProfileId as ee } from "./ProfileStorageManager.js";
2
+ import { readShellSsoCookie as a } from "../../utils/authCookie.js";
3
+ import { useBridgeInitialization as o } from "./authProvider/useBridgeInitialization.js";
4
+ import { useTokenExpiryTimer as s } from "./authProvider/useTokenExpiryTimer.js";
5
+ import { useStorageSync as c } from "./authProvider/useStorageSync.js";
6
+ import { useRemoteSLO as l } from "./authProvider/useRemoteSLO.js";
7
+ import { useAuthActions as te } from "./authProvider/useAuthActions.js";
8
+ import { createContext as u, use as d, useCallback as f, useMemo as p, useRef as m, useState as h } from "react";
9
+ import { jsx as g } from "react/jsx-runtime";
9
10
  //#region src/shared/providers/shell/AuthProvider.tsx
10
- var k = w(null);
11
- function A(e) {
12
- try {
13
- let t = e.split(".");
14
- if (t.length !== 3) return null;
15
- let n = JSON.parse(atob(t[1].replace(/-/g, "+").replace(/_/g, "/")));
16
- return typeof n.exp == "number" ? n.exp * 1e3 : null;
17
- } catch {
18
- return null;
19
- }
20
- }
21
- function j(e) {
22
- return e.trigger;
23
- }
24
- function M(e, t, n) {
25
- let r = (Array.isArray(e.profiles) ? e.profiles : []).map((e) => {
26
- let t = typeof e.id == "string" ? e.id : null, n = typeof e.email == "string" ? e.email : null;
27
- return !t || !n ? null : {
28
- id: t,
29
- email: n,
30
- name: typeof e.name == "string" && e.name.trim().length > 0 ? e.name : n,
31
- avatar: typeof e.avatar == "string" ? e.avatar : void 0,
32
- lastLogin: typeof e.lastLogin == "string" ? e.lastLogin : (/* @__PURE__ */ new Date()).toISOString()
33
- };
34
- }).filter((e) => e !== null);
35
- return r.some((e) => e.id === t) ? r : [...r, {
36
- id: t,
37
- email: n.email,
38
- name: n.name ?? `${n.firstName ?? ""} ${n.lastName ?? ""}`.trim(),
39
- avatar: n.avatar,
40
- lastLogin: (/* @__PURE__ */ new Date()).toISOString()
41
- }];
42
- }
43
- function fe(e) {
44
- let t = j(e);
45
- if (t === "logout" || t === "logout_all") return b(), !0;
46
- if (!e.activeProfileId || !e.user || !e.tokens) return !1;
47
- let r = e.activeProfileId, i = e.user, { workspaceToken: a, ...o } = e.tokens;
48
- return h(M(e, r, i)), p(r, i), f(r, o), m(r, a ?? null), d(r), window.dispatchEvent(new Event(n)), !0;
49
- }
50
- function N() {
51
- if (typeof window > "u") return null;
52
- try {
53
- let e = t(), n = new URL(e.url).origin;
54
- if (n === window.location.origin) return null;
55
- let r = `${window.location.origin}/auth/login?reason=logout`;
56
- return `${n}/auth/sso-clear?returnTo=${encodeURIComponent(r)}`;
57
- } catch {
58
- return null;
59
- }
60
- }
61
- function P(e) {
62
- if (!e) return !1;
63
- try {
64
- return !!(localStorage.getItem(`bf-p-${e}-tokens`) && localStorage.getItem(`bf-p-${e}-user`));
65
- } catch {
66
- return !1;
67
- }
68
- }
69
- function F(e) {
70
- try {
71
- if (C()) return null;
72
- let t = v();
73
- if (!t?.origin || !_(t.origin)) return null;
74
- let n = new URL(t.origin).origin, r = new URL(e).origin;
75
- if (n === window.location.origin || n === r || P(t.id)) return null;
76
- let i = window.location.href;
77
- return x(n, i) ? null : (S(n, i), `${n}/auth/sso-relay?returnTo=${encodeURIComponent(i)}`);
78
- } catch {
79
- return null;
80
- }
81
- }
82
- function I({ children: t, onTokenExpired: h, onSessionExpiringSoon: _, onRefreshToken: b, bridgeUrl: w, bridgeAllowedOrigins: T, bridgeDebug: j, onBridgeReady: M }) {
83
- let P = ue(!1), [I, L] = O(() => u()), [R, z] = O(() => I ? o(I) : null), [B, V] = O(() => I ? a(I) : null), [H, U] = O(() => I ? s(I) : null), [W, G] = O(() => {
84
- if (I && o(I)) return !1;
85
- if (w) try {
86
- let e = v()?.id ?? null;
11
+ var _ = u(null);
12
+ function v({ children: u, onTokenExpired: d, onSessionExpiringSoon: v, onRefreshToken: y, bridgeUrl: b, bridgeAllowedOrigins: x, bridgeDebug: S, onBridgeReady: C }) {
13
+ let w = m(!1), [T, E] = h(() => ee()), [D, O] = h(() => T ? n(T) : null), [k, A] = h(() => T ? t(T) : null), [j, M] = h(() => T ? r(T) : null), [N, P] = h(() => {
14
+ if (T && n(T)) return !1;
15
+ if (b) try {
16
+ let e = a()?.id ?? null;
87
17
  if (e && localStorage.getItem(`bf-p-${e}-tokens`)) return !1;
88
18
  } catch {}
89
- return !!w;
90
- }), [pe, K] = O(!1), [me, q] = O(null), [he, J] = O(() => c().map((e) => ({
19
+ return !!b;
20
+ }), [F, I] = h(!1), [L, ne] = h(null), [R, z] = h(() => i().map((e) => ({
91
21
  id: e.id,
92
22
  email: e.email,
93
23
  name: e.name,
94
24
  avatar: e.avatar,
95
- isActive: e.id === I,
25
+ isActive: e.id === T,
96
26
  lastLogin: e.lastLogin
97
- }))), Y = E(() => {
98
- let e = i();
99
- J(c().map((t) => ({
100
- id: t.id,
101
- email: t.email,
102
- name: t.name,
103
- avatar: t.avatar,
104
- isActive: t.id === e,
105
- lastLogin: t.lastLogin
27
+ }))), B = f(() => {
28
+ z([]);
29
+ }, []), V = f(() => {
30
+ let t = e();
31
+ z(i().map((e) => ({
32
+ id: e.id,
33
+ email: e.email,
34
+ name: e.name,
35
+ avatar: e.avatar,
36
+ isActive: e.id === t,
37
+ lastLogin: e.lastLogin
106
38
  })));
107
39
  }, []);
108
- D(() => {
109
- if (!w) return;
110
- try {
111
- let e = new URL(w).pathname;
112
- if (window.location.pathname === e) {
113
- G(!1), M?.();
114
- return;
115
- }
116
- } catch {
117
- G(!1), M?.();
118
- return;
119
- }
120
- if (oe()) {
121
- G(!1), M?.();
122
- return;
123
- }
124
- let e = () => {
125
- G(!1), M?.();
126
- }, t = (t) => {
127
- P.current = !0;
128
- try {
129
- if (w) {
130
- let e = F(w);
131
- if (e) {
132
- window.location.replace(e);
133
- return;
134
- }
135
- }
136
- fe(t);
137
- let e = u();
138
- if (e) L(e), z(o(e)), V(a(e)), U(s(e)), Y();
139
- else {
140
- if (w && !t.user && !t.tokens) try {
141
- let e = new URL(w).origin, t = window.location.origin, n = F(w);
142
- if (n) {
143
- window.location.replace(n);
144
- return;
145
- }
146
- if (e !== t && !C()) {
147
- let t = window.location.href;
148
- if (x(e, t)) return;
149
- S(e, t), window.location.replace(`${e}/auth/sso-relay?returnTo=${encodeURIComponent(t)}`);
150
- return;
151
- }
152
- } catch {}
153
- L(null), z(null), V(null), U(null), J([]);
154
- }
155
- } finally {
156
- P.current = !1, e();
157
- }
158
- }, n = setTimeout(() => {
159
- e();
160
- }, 5e3);
161
- return ae({
162
- bridgeUrl: w,
163
- allowedOrigins: T,
164
- onStateChanged: t,
165
- debug: j ?? !1
166
- }), () => {
167
- clearTimeout(n);
168
- };
169
- }, [
170
- w,
171
- T,
172
- j,
173
- M,
174
- Y
175
- ]);
176
- let ge = E((e, t, n) => {
177
- let r = A(t) ?? Date.now() + 3600 * 1e3, i = {
178
- accessToken: t,
179
- refreshToken: n,
180
- expiresAt: r
181
- }, a = ee(e, i);
182
- L(a), z(e), V(i), U(null), K(!1), q(null), Y();
183
- try {
184
- ie(a, window.location.origin);
185
- } catch {}
186
- P.current || y()?.notifyLogin({
187
- user: e,
188
- tokens: {
189
- accessToken: t,
190
- refreshToken: n,
191
- expiresAt: r
192
- },
193
- activeAccountId: a,
194
- activeProfileId: a,
195
- profiles: c()
196
- });
197
- }, [Y]), X = E(() => {
198
- I && l(I);
199
- let e = u();
200
- e ? (L(e), z(o(e)), V(a(e)), U(s(e))) : (L(null), z(null), V(null), U(null)), K(!1), q(null), Y();
201
- try {
202
- g();
203
- } catch {}
204
- P.current || y()?.notifyLogout();
205
- let t = N();
206
- t && !P.current && window.location.replace(t);
207
- }, [I, Y]), _e = E((e) => {
208
- if (!R || !I) return;
209
- let t = {
210
- ...R,
211
- ...e
212
- };
213
- z(t), p(I, t), r({
214
- id: I,
215
- email: t.email,
216
- name: t.name ?? `${t.firstName ?? ""} ${t.lastName ?? ""}`.trim(),
217
- avatar: t.avatar,
218
- lastLogin: (/* @__PURE__ */ new Date()).toISOString()
219
- }), Y();
220
- }, [
221
- R,
222
- I,
223
- Y
224
- ]), Z = E(async () => {
225
- if (!(!B?.refreshToken || !b || !I)) {
226
- G(!0);
227
- try {
228
- let e = await b(B.refreshToken), t = A(e.accessToken), n = e.expiresAt ?? t ?? Date.now() + 3600 * 1e3, r = {
229
- accessToken: e.accessToken,
230
- refreshToken: e.refreshToken ?? B.refreshToken,
231
- expiresAt: n
232
- };
233
- V(r), f(I, r), P.current || y()?.notifyTokenRefresh({
234
- accessToken: r.accessToken,
235
- refreshToken: r.refreshToken,
236
- expiresAt: r.expiresAt
237
- });
238
- } catch (e) {
239
- console.error("Failed to refresh token:", e), X(), h?.();
240
- } finally {
241
- G(!1);
242
- }
243
- }
244
- }, [
245
- B,
246
- b,
247
- I,
248
- X,
249
- h
250
- ]), Q = E((e) => R?.permissions ? R.permissions.includes(e) || R.permissions.includes("*") : !1, [R]), ve = E((e) => {
251
- U(e), I && m(I, e);
252
- }, [I]), ye = E((e, t) => {
253
- K(e), q(t ?? null);
254
- }, []), be = E((e) => {
255
- if (!ne(e)) {
256
- console.error(`Profile ${e} not found`);
257
- return;
258
- }
259
- L(e), z(o(e)), V(a(e)), U(s(e)), K(!1), q(null), Y(), P.current || y()?.notifyAccountSwitch(e);
260
- }, [Y]), xe = E((e, t, n) => {
261
- ee(e, {
262
- accessToken: t,
263
- refreshToken: n,
264
- expiresAt: A(t) ?? Date.now() + 3600 * 1e3
265
- }), I && d(I), Y();
266
- }, [I, Y]), Se = E((e) => {
267
- if (e === I) {
268
- console.error("Cannot remove active account — logout first");
269
- return;
270
- }
271
- l(e), Y();
272
- }, [I, Y]), Ce = E(() => {
273
- te(), L(null), z(null), V(null), U(null), K(!1), q(null), J([]);
274
- try {
275
- g();
276
- } catch {}
277
- P.current || y()?.notifyLogoutAll();
278
- let e = N();
279
- e && !P.current && window.location.replace(e);
280
- }, []);
281
- D(() => {
282
- if (!B?.expiresAt) return;
283
- let e = B.expiresAt - Date.now();
284
- if (e <= 0) {
285
- b && B?.refreshToken ? Z() : h?.();
286
- return;
287
- }
288
- let t = [];
289
- if (b && B?.refreshToken) {
290
- let n = Math.max(0, e - 300 * 1e3);
291
- t.push(setTimeout(() => {
292
- Z();
293
- }, n));
294
- }
295
- if (_) {
296
- let n = Math.max(0, e - 300 * 1e3);
297
- t.push(setTimeout(() => {
298
- _();
299
- }, n));
300
- }
301
- return (!b || !B?.refreshToken) && t.push(setTimeout(() => {
302
- h?.();
303
- }, e)), () => t.forEach(clearTimeout);
304
- }, [
305
- B?.expiresAt,
306
- B?.refreshToken,
307
- Z,
308
- b,
309
- h,
310
- _
311
- ]);
312
- let we = E(() => {
313
- let e = u();
314
- if (!e) {
315
- (R || B) && (z(null), V(null), U(null), L(null), J([]));
316
- return;
317
- }
318
- let t = a(e), n = s(e), r = o(e);
319
- e !== I && L(e), t?.accessToken !== B?.accessToken && V(t), n !== H && U(n), r && r.id !== R?.id && z(r), Y();
320
- }, [
321
- B,
322
- R,
323
- H,
324
- I,
325
- Y
326
- ]);
327
- D(() => {
328
- let e = () => we();
329
- window.addEventListener(n, e), window.addEventListener("storage", e);
330
- let t = setInterval(e, 1e4);
331
- return () => {
332
- window.removeEventListener(n, e), window.removeEventListener("storage", e), clearInterval(t);
333
- };
334
- }, [we]), D(() => {
335
- if (!B?.accessToken || !w) return;
336
- let t = async () => {
337
- if (document.visibilityState === "visible") try {
338
- if (ce()) {
339
- L(null), z(null), V(null), U(null), J([]);
340
- return;
341
- }
342
- if (re()) return;
343
- await se(`${e().globalBaseUrl}/global/graphql`, B.accessToken) && X();
344
- } catch {}
345
- };
346
- return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
347
- }, [
348
- B?.accessToken,
349
- w,
350
- X
351
- ]);
352
- let $ = le(() => !!R && !!B, [R, B]), Te = le(() => ({
353
- user: R,
354
- tokens: B,
40
+ o({
41
+ bridgeUrl: b,
42
+ bridgeAllowedOrigins: x,
43
+ bridgeDebug: S,
44
+ onBridgeReady: C,
45
+ bridgeSyncInProgress: w,
46
+ setIsLoading: P,
47
+ setActiveId: E,
48
+ setUser: O,
49
+ setTokens: A,
50
+ setWorkspaceTokenLocal: M,
51
+ clearAccounts: B,
52
+ refreshAccounts: V
53
+ });
54
+ let { login: H, logout: U, logoutAll: W, updateUser: G, refreshAccessToken: K, hasPermission: q, setWorkspaceToken: J, setMfaState: Y, switchAccount: X, addAccount: Z, removeAccount: Q } = te({
55
+ user: D,
56
+ tokens: k,
57
+ activeId: T,
58
+ bridgeSyncInProgress: w,
59
+ onRefreshToken: y,
60
+ onTokenExpired: d,
61
+ setActiveId: E,
62
+ setUser: O,
63
+ setTokens: A,
64
+ setWorkspaceTokenLocal: M,
65
+ setMfaRequiredState: I,
66
+ setMfaChallengeIdState: ne,
67
+ setIsLoading: P,
68
+ clearAccounts: B,
69
+ refreshAccounts: V
70
+ });
71
+ s({
72
+ tokens: k,
73
+ onRefreshToken: y,
74
+ onTokenExpired: d,
75
+ onSessionExpiringSoon: v,
76
+ refreshAccessToken: K
77
+ }), c({
78
+ user: D,
79
+ tokens: k,
80
+ workspaceToken: j,
81
+ activeId: T,
82
+ setUser: O,
83
+ setTokens: A,
84
+ setWorkspaceTokenLocal: M,
85
+ setActiveId: E,
86
+ clearAccounts: B,
87
+ refreshAccounts: V
88
+ }), l({
89
+ tokens: k,
90
+ bridgeUrl: b,
91
+ logout: U,
92
+ setActiveId: E,
93
+ setUser: O,
94
+ setTokens: A,
95
+ setWorkspaceTokenLocal: M,
96
+ clearAccounts: B
97
+ });
98
+ let $ = p(() => !!D && !!k, [D, k]), re = p(() => ({
99
+ user: D,
100
+ tokens: k,
355
101
  isAuthenticated: $,
356
- isLoading: W,
357
- login: ge,
358
- logout: X,
359
- updateUser: _e,
360
- refreshAccessToken: Z,
361
- hasPermission: Q,
362
- setWorkspaceToken: ve,
363
- workspaceToken: H,
364
- mfaRequired: pe,
365
- mfaChallengeId: me,
366
- setMfaState: ye,
367
- activeProfileId: I,
368
- accounts: he,
369
- switchAccount: be,
370
- addAccount: xe,
371
- removeAccount: Se,
372
- logoutAll: Ce,
373
- currentUser: R
102
+ isLoading: N,
103
+ login: H,
104
+ logout: U,
105
+ updateUser: G,
106
+ refreshAccessToken: K,
107
+ hasPermission: q,
108
+ setWorkspaceToken: J,
109
+ workspaceToken: j,
110
+ mfaRequired: F,
111
+ mfaChallengeId: L,
112
+ setMfaState: Y,
113
+ activeProfileId: T,
114
+ accounts: R,
115
+ switchAccount: X,
116
+ addAccount: Z,
117
+ removeAccount: Q,
118
+ logoutAll: W,
119
+ currentUser: D
374
120
  }), [
375
- R,
376
- B,
121
+ D,
122
+ k,
377
123
  $,
378
- W,
379
- ge,
124
+ N,
125
+ H,
126
+ U,
127
+ G,
128
+ K,
129
+ q,
130
+ J,
131
+ j,
132
+ F,
133
+ L,
134
+ Y,
135
+ T,
136
+ R,
380
137
  X,
381
- _e,
382
138
  Z,
383
139
  Q,
384
- ve,
385
- H,
386
- pe,
387
- me,
388
- ye,
389
- I,
390
- he,
391
- be,
392
- xe,
393
- Se,
394
- Ce
140
+ W
395
141
  ]);
396
- return /* @__PURE__ */ de(k.Provider, {
397
- value: Te,
398
- children: t
142
+ return /* @__PURE__ */ g(_.Provider, {
143
+ value: re,
144
+ children: u
399
145
  });
400
146
  }
401
- function L() {
402
- let e = T(k);
147
+ function y() {
148
+ let e = d(_);
403
149
  if (!e) throw Error("useAuth must be used within an AuthProvider");
404
150
  return e;
405
151
  }
406
152
  //#endregion
407
- export { I as AuthProvider, L as useAuth };
153
+ export { v as AuthProvider, y as useAuth };
@@ -0,0 +1,34 @@
1
+ import { PROFILE_STORAGE_CHANGE_EVENT as e, setActiveProfileId as t, setProfileTokens as n, setProfileUser as r, setProfileWorkspaceToken as i, setProfiles as a } from "../ProfileStorageManager.js";
2
+ import { clearLocalAuthState as o } from "../../../components/SSORedirectGuard.js";
3
+ //#region src/shared/providers/shell/authProvider/bridgeStateSync.ts
4
+ function s(e) {
5
+ return e.trigger;
6
+ }
7
+ function c(e, t, n) {
8
+ let r = (Array.isArray(e.profiles) ? e.profiles : []).map((e) => {
9
+ let t = typeof e.id == "string" ? e.id : null, n = typeof e.email == "string" ? e.email : null;
10
+ return !t || !n ? null : {
11
+ id: t,
12
+ email: n,
13
+ name: typeof e.name == "string" && e.name.trim().length > 0 ? e.name : n,
14
+ avatar: typeof e.avatar == "string" ? e.avatar : void 0,
15
+ lastLogin: typeof e.lastLogin == "string" ? e.lastLogin : (/* @__PURE__ */ new Date()).toISOString()
16
+ };
17
+ }).filter((e) => e !== null);
18
+ return r.some((e) => e.id === t) ? r : [...r, {
19
+ id: t,
20
+ email: n.email,
21
+ name: n.name ?? `${n.firstName ?? ""} ${n.lastName ?? ""}`.trim(),
22
+ avatar: n.avatar,
23
+ lastLogin: (/* @__PURE__ */ new Date()).toISOString()
24
+ }];
25
+ }
26
+ function l(l) {
27
+ let u = s(l);
28
+ if (u === "logout" || u === "logout_all") return o(), !0;
29
+ if (!l.activeProfileId || !l.user || !l.tokens) return !1;
30
+ let d = l.activeProfileId, f = l.user, { workspaceToken: p, ...m } = l.tokens;
31
+ return a(c(l, d, f)), r(d, f), n(d, m), i(d, p ?? null), t(d), window.dispatchEvent(new Event(e)), !0;
32
+ }
33
+ //#endregion
34
+ export { l as syncBridgeStateToProfileStorage };
@@ -0,0 +1,13 @@
1
+ //#region src/shared/providers/shell/authProvider/jwt.ts
2
+ function e(e) {
3
+ try {
4
+ let t = e.split(".");
5
+ if (t.length !== 3) return null;
6
+ let n = JSON.parse(atob(t[1].replace(/-/g, "+").replace(/_/g, "/")));
7
+ return typeof n.exp == "number" ? n.exp * 1e3 : null;
8
+ } catch {
9
+ return null;
10
+ }
11
+ }
12
+ //#endregion
13
+ export { e as getJwtExpiry };
@@ -0,0 +1,38 @@
1
+ import { resolveAuthBridgeConfig as e } from "../../../config/authBridgeUrls.js";
2
+ import { isTrustedSsoOrigin as t, readShellSsoCookie as n } from "../../../utils/authCookie.js";
3
+ import { hasRecentSSORedirectAttempt as r, markSSORedirectAttempt as i, shouldSkipSSORedirect as a } from "../../../components/SSORedirectGuard.js";
4
+ //#region src/shared/providers/shell/authProvider/ssoRelay.ts
5
+ function o() {
6
+ if (typeof window > "u") return null;
7
+ try {
8
+ let t = e(), n = new URL(t.url).origin;
9
+ if (n === window.location.origin) return null;
10
+ let r = `${window.location.origin}/auth/login?reason=logout`;
11
+ return `${n}/auth/sso-clear?returnTo=${encodeURIComponent(r)}`;
12
+ } catch {
13
+ return null;
14
+ }
15
+ }
16
+ function s(e) {
17
+ if (!e) return !1;
18
+ try {
19
+ return !!(localStorage.getItem(`bf-p-${e}-tokens`) && localStorage.getItem(`bf-p-${e}-user`));
20
+ } catch {
21
+ return !1;
22
+ }
23
+ }
24
+ function c(e) {
25
+ try {
26
+ if (a()) return null;
27
+ let o = n();
28
+ if (!o?.origin || !t(o.origin)) return null;
29
+ let c = new URL(o.origin).origin, l = new URL(e).origin;
30
+ if (c === window.location.origin || c === l || s(o.id)) return null;
31
+ let u = window.location.href;
32
+ return r(c, u) ? null : (i(c, u), `${c}/auth/sso-relay?returnTo=${encodeURIComponent(u)}`);
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ //#endregion
38
+ export { c as getCookieSsoRelayUrl, o as getCrossOriginLogoutUrl };