@burdenoff/fe-libs 2026.527.2 → 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 (161) hide show
  1. package/dist/button/Button.js +18 -16
  2. package/dist/chrome/AccountSwitcher.js +10 -7
  3. package/dist/chrome/AutoBreadcrumbs.js +2 -0
  4. package/dist/chrome/Breadcrumbs.js +2 -0
  5. package/dist/chrome/CommandPalette.js +5 -3
  6. package/dist/chrome/ContextSwitcher.js +90 -338
  7. package/dist/chrome/DynamicFooter.js +7 -7
  8. package/dist/chrome/Footer.js +5 -5
  9. package/dist/chrome/GeographySwitcher.js +3 -3
  10. package/dist/chrome/GlobalSearch.js +73 -448
  11. package/dist/chrome/HeaderBar.js +6 -1
  12. package/dist/chrome/LanguagePickerSheet.js +1 -1
  13. package/dist/chrome/LanguageSwitcher.js +2 -2
  14. package/dist/chrome/NotificationCenter.js +69 -694
  15. package/dist/chrome/PanelTabs.js +7 -4
  16. package/dist/chrome/PluginContextMenuTarget.js +1 -1
  17. package/dist/chrome/ProductPickerSheet.js +4 -4
  18. package/dist/chrome/ProductSideNav.js +1 -1
  19. package/dist/chrome/ProductSwitcher.js +3 -3
  20. package/dist/chrome/ProfileSwitcher.js +13 -8
  21. package/dist/chrome/ShortcutHelpDialog.js +2 -1
  22. package/dist/chrome/SideNavigation.js +75 -239
  23. package/dist/chrome/Sidebar.js +1 -0
  24. package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
  25. package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
  26. package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
  27. package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
  28. package/dist/chrome/contextSwitcher/TabButton.js +9 -0
  29. package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
  30. package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
  31. package/dist/chrome/contextSwitcher/icons.js +58 -0
  32. package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
  33. package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
  34. package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
  35. package/dist/chrome/globalSearch/ResultsList.js +58 -0
  36. package/dist/chrome/globalSearch/SearchInput.js +28 -0
  37. package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
  38. package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
  39. package/dist/chrome/globalSearch/utils.js +22 -0
  40. package/dist/chrome/notificationCenter/BellButton.js +27 -0
  41. package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
  42. package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
  43. package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
  44. package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
  45. package/dist/chrome/notificationCenter/NotificationList.js +75 -0
  46. package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
  47. package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
  48. package/dist/chrome/notificationCenter/constants.js +93 -0
  49. package/dist/chrome/notificationCenter/gql.js +58 -0
  50. package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
  51. package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
  52. package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
  53. package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
  54. package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
  55. package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
  56. package/dist/chrome/sideNavigation/helpers.js +19 -0
  57. package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
  58. package/dist/form/Checkbox.js +17 -15
  59. package/dist/form/FormDescription.js +9 -10
  60. package/dist/form/FormField.js +11 -12
  61. package/dist/form/FormLabel.js +13 -13
  62. package/dist/form/FormMessage.js +10 -11
  63. package/dist/form/Input.js +11 -10
  64. package/dist/form/Radio.js +25 -21
  65. package/dist/form/Select.js +81 -66
  66. package/dist/form/Textarea.js +10 -9
  67. package/dist/shared/components/AccessDenied.js +8 -4
  68. package/dist/shared/components/AppErrorBoundary.js +2 -0
  69. package/dist/shared/components/ContextConversationWidget.js +173 -767
  70. package/dist/shared/components/ErrorFallback.js +3 -0
  71. package/dist/shared/components/PWAInstallBanner.js +8 -4
  72. package/dist/shared/components/RequireAuth.js +4 -4
  73. package/dist/shared/components/SSORedirectGuard.js +1 -1
  74. package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
  75. package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
  76. package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
  77. package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
  78. package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
  79. package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
  80. package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
  81. package/dist/shared/components/contextConversationWidget/queries.js +197 -0
  82. package/dist/shared/components/contextConversationWidget/types.js +10 -0
  83. package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
  84. package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
  85. package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
  86. package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
  87. package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
  88. package/dist/shared/components/contextConversationWidget/utils.js +56 -0
  89. package/dist/shared/feature-flags/FeatureFlagProvider.js +21 -21
  90. package/dist/shared/geography/GeographyProvider.js +20 -20
  91. package/dist/shared/graphql/GatewayContext.js +1 -1
  92. package/dist/shared/motion/MotionList.js +1 -1
  93. package/dist/shared/pages/AiPage.js +3 -3
  94. package/dist/shared/pages/SearchPage.js +293 -1071
  95. package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
  96. package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
  97. package/dist/shared/pages/searchPage/ResultsList.js +119 -0
  98. package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
  99. package/dist/shared/pages/searchPage/SearchInput.js +31 -0
  100. package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
  101. package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
  102. package/dist/shared/pages/searchPage/constants.js +155 -0
  103. package/dist/shared/pages/searchPage/utils.js +24 -0
  104. package/dist/shared/plugins/PluginRuntimeProvider.js +1 -1
  105. package/dist/shared/providers/shell/ActiveContextProvider.js +12 -12
  106. package/dist/shared/providers/shell/AppShellContext.js +1 -1
  107. package/dist/shared/providers/shell/AuthProvider.js +130 -384
  108. package/dist/shared/providers/shell/AuthTokenProvider.js +6 -6
  109. package/dist/shared/providers/shell/ContextManagerProvider.js +1 -1
  110. package/dist/shared/providers/shell/FeatureFlagsProvider.js +5 -5
  111. package/dist/shared/providers/shell/GlobalUiProvider.js +17 -17
  112. package/dist/shared/providers/shell/I18nProvider.js +15 -15
  113. package/dist/shared/providers/shell/PageConversationContextProvider.js +14 -14
  114. package/dist/shared/providers/shell/PermissionProvider.js +16 -16
  115. package/dist/shared/providers/shell/ShellUiProvider.js +13 -13
  116. package/dist/shared/providers/shell/ThemeProvider.js +9 -9
  117. package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
  118. package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
  119. package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
  120. package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
  121. package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
  122. package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
  123. package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
  124. package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
  125. package/dist/shared/tours/TourPlayer.js +1 -0
  126. package/dist/shared/tours/TourPlayerProvider.js +1 -1
  127. package/dist/shared/tours/TourTooltip.js +3 -0
  128. package/dist/shared/tours/TourTrigger.js +86 -259
  129. package/dist/shared/tours/ToursContext.js +108 -398
  130. package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
  131. package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
  132. package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
  133. package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
  134. package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
  135. package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
  136. package/dist/shared/tours/toursContext/errors.js +18 -0
  137. package/dist/shared/tours/toursContext/gql.js +152 -0
  138. package/dist/shared/tours/toursContext/route.js +20 -0
  139. package/dist/shared/tours/toursContext/session.js +19 -0
  140. package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
  141. package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
  142. package/dist/shared-events.js +3 -3
  143. package/dist/shared-hooks.js +1 -1
  144. package/dist/storage/SaveToFilesButton.js +3 -3
  145. package/dist/storage/SaveToFilesDialog.js +1 -1
  146. package/dist/tag/TagBadge.js +1 -1
  147. package/dist/tag/TagsWidget.js +81 -226
  148. package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
  149. package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
  150. package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
  151. package/dist/tag/tagsWidget/operations.js +64 -0
  152. package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
  153. package/dist/ui/card.js +44 -39
  154. package/dist/ui/dropdown-menu.js +82 -66
  155. package/dist/ui/input.js +10 -10
  156. package/dist/ui/label.js +13 -11
  157. package/dist/ui/select.js +80 -66
  158. package/dist/ui/table.js +61 -54
  159. package/dist/ui/textarea.js +9 -9
  160. package/dist/ui/tooltip.js +13 -11
  161. 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, useCallback as T, useContext 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: E, 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 = T(() => {
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: E,
164
- onStateChanged: t,
165
- debug: j ?? !1
166
- }), () => {
167
- clearTimeout(n);
168
- };
169
- }, [
170
- w,
171
- E,
172
- j,
173
- M,
174
- Y
175
- ]);
176
- let ge = T((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 = T(() => {
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 = T((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 = T(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 = T((e) => R?.permissions ? R.permissions.includes(e) || R.permissions.includes("*") : !1, [R]), ve = T((e) => {
251
- U(e), I && m(I, e);
252
- }, [I]), ye = T((e, t) => {
253
- K(e), q(t ?? null);
254
- }, []), be = T((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 = T((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 = T((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 = T(() => {
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 = T(() => {
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 = E(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 };
@@ -1,7 +1,7 @@
1
1
  import { getProfileWorkspaceToken as e, resolveActiveProfileId as t } from "./ProfileStorageManager.js";
2
2
  import { readActiveContextValueWithUrlPrecedence as n } from "./ActiveContextStorage.js";
3
3
  import { isWorkspaceTokenValidForContext as r } from "../../graphql/workspaceToken.js";
4
- import { createContext as i, useCallback as a, useContext as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
4
+ import { createContext as i, use as a, useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
5
5
  import { jsx as d } from "react/jsx-runtime";
6
6
  //#region src/shared/providers/shell/AuthTokenProvider.tsx
7
7
  var f = "bf-p", p = "bf-active-profile", m = i(null);
@@ -62,13 +62,13 @@ function b() {
62
62
  };
63
63
  }
64
64
  function x({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r }) {
65
- let [i, o] = u(b), h = l(i.accessToken), g = l(i.workspaceToken);
65
+ let [i, a] = u(b), h = l(i.accessToken), g = l(i.workspaceToken);
66
66
  s(() => {
67
67
  h.current = i.accessToken, g.current = i.workspaceToken;
68
68
  }, [i.accessToken, i.workspaceToken]);
69
- let _ = a(() => {
69
+ let _ = o(() => {
70
70
  let e = b();
71
- o(e), t && console.log("[AuthTokenProvider] Reloaded from profile storage:", {
71
+ a(e), t && console.log("[AuthTokenProvider] Reloaded from profile storage:", {
72
72
  hasAccessToken: !!e.accessToken,
73
73
  hasWorkspaceToken: !!e.workspaceToken,
74
74
  userId: e.userId
@@ -93,7 +93,7 @@ function x({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r
93
93
  ]), s(() => {
94
94
  r?.(i.workspaceId);
95
95
  }, [i.workspaceId, r]);
96
- let v = a(() => h.current, []), y = a(() => g.current, []), x = a(() => g.current || h.current, []), S = c(() => ({
96
+ let v = o(() => h.current, []), y = o(() => g.current, []), x = o(() => g.current || h.current, []), S = c(() => ({
97
97
  accessToken: i.accessToken,
98
98
  workspaceToken: i.workspaceToken,
99
99
  workspaceId: i.workspaceId,
@@ -117,7 +117,7 @@ function x({ children: e, debug: t = !1, onTokenChange: n, onWorkspaceChange: r
117
117
  });
118
118
  }
119
119
  function S() {
120
- let e = o(m);
120
+ let e = a(m);
121
121
  if (!e) throw Error("useAuthToken must be used within AuthTokenProvider");
122
122
  return e;
123
123
  }
@@ -1,6 +1,6 @@
1
1
  import { useAuth as e } from "./AuthProvider.js";
2
2
  import { useActiveContext as t } from "./ActiveContextProvider.js";
3
- import { createContext as n, useContext as r, useMemo as i } from "react";
3
+ import { createContext as n, use as r, useMemo as i } from "react";
4
4
  import { jsx as a } from "react/jsx-runtime";
5
5
  //#region src/shared/providers/shell/ContextManagerProvider.tsx
6
6
  var o = n(null);
@@ -1,9 +1,9 @@
1
- import { createContext as e, useCallback as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
1
+ import { createContext as e, use as t, useCallback as n, useEffect as r, useMemo as i, useState as a } from "react";
2
2
  import { jsx as o } from "react/jsx-runtime";
3
3
  //#region src/shared/providers/shell/FeatureFlagsProvider.tsx
4
4
  var s = e(null);
5
- function c({ children: e, initialFlags: n = {}, fetchFlags: c, refreshInterval: l }) {
6
- let [u, d] = a(n), [f, p] = a(!1), m = t(async () => {
5
+ function c({ children: e, initialFlags: t = {}, fetchFlags: c, refreshInterval: l }) {
6
+ let [u, d] = a(t), [f, p] = a(!1), m = n(async () => {
7
7
  if (c) {
8
8
  p(!0);
9
9
  try {
@@ -14,7 +14,7 @@ function c({ children: e, initialFlags: n = {}, fetchFlags: c, refreshInterval:
14
14
  p(!1);
15
15
  }
16
16
  }
17
- }, [c]), h = t((e) => !!u[e], [u]), g = t((e, t) => {
17
+ }, [c]), h = n((e) => !!u[e], [u]), g = n((e, t) => {
18
18
  let n = u[e];
19
19
  return n === void 0 && t !== void 0 ? t : n;
20
20
  }, [u]);
@@ -50,7 +50,7 @@ function c({ children: e, initialFlags: n = {}, fetchFlags: c, refreshInterval:
50
50
  });
51
51
  }
52
52
  function l() {
53
- let e = n(s);
53
+ let e = t(s);
54
54
  if (!e) throw Error("useFeatureFlags must be used within a FeatureFlagsProvider");
55
55
  return e;
56
56
  }