@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.
- package/dist/button/Button.js +18 -16
- package/dist/chrome/AccountSwitcher.js +10 -7
- package/dist/chrome/AutoBreadcrumbs.js +2 -0
- package/dist/chrome/Breadcrumbs.js +2 -0
- package/dist/chrome/CommandPalette.js +5 -3
- package/dist/chrome/ContextSwitcher.js +90 -338
- package/dist/chrome/DynamicFooter.js +7 -7
- package/dist/chrome/Footer.js +5 -5
- package/dist/chrome/GeographySwitcher.js +3 -3
- package/dist/chrome/GlobalSearch.js +73 -448
- package/dist/chrome/HeaderBar.js +6 -1
- package/dist/chrome/LanguagePickerSheet.js +1 -1
- package/dist/chrome/LanguageSwitcher.js +2 -2
- package/dist/chrome/NotificationCenter.js +69 -694
- package/dist/chrome/PanelTabs.js +7 -4
- package/dist/chrome/PluginContextMenuTarget.js +1 -1
- package/dist/chrome/ProductPickerSheet.js +4 -4
- package/dist/chrome/ProductSideNav.js +1 -1
- package/dist/chrome/ProductSwitcher.js +3 -3
- package/dist/chrome/ProfileSwitcher.js +13 -8
- package/dist/chrome/ShortcutHelpDialog.js +2 -1
- package/dist/chrome/SideNavigation.js +75 -239
- package/dist/chrome/Sidebar.js +1 -0
- package/dist/chrome/contextSwitcher/EmptyState.js +32 -0
- package/dist/chrome/contextSwitcher/OrganizationList.js +34 -0
- package/dist/chrome/contextSwitcher/ProjectList.js +34 -0
- package/dist/chrome/contextSwitcher/SearchInput.js +50 -0
- package/dist/chrome/contextSwitcher/TabButton.js +9 -0
- package/dist/chrome/contextSwitcher/TriggerButton.js +38 -0
- package/dist/chrome/contextSwitcher/WorkspaceList.js +34 -0
- package/dist/chrome/contextSwitcher/icons.js +58 -0
- package/dist/chrome/contextSwitcher/useIsMobile.js +11 -0
- package/dist/chrome/globalSearch/AdvancedFiltersPanel.js +253 -0
- package/dist/chrome/globalSearch/CategoryTabs.js +28 -0
- package/dist/chrome/globalSearch/ResultsList.js +58 -0
- package/dist/chrome/globalSearch/SearchInput.js +28 -0
- package/dist/chrome/globalSearch/SearchModeBar.js +36 -0
- package/dist/chrome/globalSearch/useAdvancedFilters.js +78 -0
- package/dist/chrome/globalSearch/utils.js +22 -0
- package/dist/chrome/notificationCenter/BellButton.js +27 -0
- package/dist/chrome/notificationCenter/NotificationCardItem.js +129 -0
- package/dist/chrome/notificationCenter/NotificationFilters.js +67 -0
- package/dist/chrome/notificationCenter/NotificationFooter.js +23 -0
- package/dist/chrome/notificationCenter/NotificationHeader.js +75 -0
- package/dist/chrome/notificationCenter/NotificationList.js +75 -0
- package/dist/chrome/notificationCenter/NotificationPanel.js +19 -0
- package/dist/chrome/notificationCenter/SkeletonCard.js +18 -0
- package/dist/chrome/notificationCenter/constants.js +93 -0
- package/dist/chrome/notificationCenter/gql.js +58 -0
- package/dist/chrome/notificationCenter/useNotificationCenter.js +149 -0
- package/dist/chrome/notificationCenter/usePanelChrome.js +36 -0
- package/dist/chrome/sideNavigation/CollapseToggle.js +29 -0
- package/dist/chrome/sideNavigation/MobileActionsBar.js +25 -0
- package/dist/chrome/sideNavigation/NavItemRenderer.js +79 -0
- package/dist/chrome/sideNavigation/SidebarHeader.js +29 -0
- package/dist/chrome/sideNavigation/helpers.js +19 -0
- package/dist/chrome/sideNavigation/useSideNavigationState.js +45 -0
- package/dist/form/Checkbox.js +17 -15
- package/dist/form/FormDescription.js +9 -10
- package/dist/form/FormField.js +11 -12
- package/dist/form/FormLabel.js +13 -13
- package/dist/form/FormMessage.js +10 -11
- package/dist/form/Input.js +11 -10
- package/dist/form/Radio.js +25 -21
- package/dist/form/Select.js +81 -66
- package/dist/form/Textarea.js +10 -9
- package/dist/shared/components/AccessDenied.js +8 -4
- package/dist/shared/components/AppErrorBoundary.js +2 -0
- package/dist/shared/components/ContextConversationWidget.js +173 -767
- package/dist/shared/components/ErrorFallback.js +3 -0
- package/dist/shared/components/PWAInstallBanner.js +8 -4
- package/dist/shared/components/RequireAuth.js +4 -4
- package/dist/shared/components/SSORedirectGuard.js +1 -1
- package/dist/shared/components/contextConversationWidget/Composer.js +66 -0
- package/dist/shared/components/contextConversationWidget/MessageItem.js +124 -0
- package/dist/shared/components/contextConversationWidget/MessageList.js +32 -0
- package/dist/shared/components/contextConversationWidget/NoWorkspaceCard.js +19 -0
- package/dist/shared/components/contextConversationWidget/PendingAttachmentsBar.js +28 -0
- package/dist/shared/components/contextConversationWidget/ReplyBanner.js +32 -0
- package/dist/shared/components/contextConversationWidget/WidgetHeader.js +70 -0
- package/dist/shared/components/contextConversationWidget/queries.js +197 -0
- package/dist/shared/components/contextConversationWidget/types.js +10 -0
- package/dist/shared/components/contextConversationWidget/useAttachmentUpload.js +57 -0
- package/dist/shared/components/contextConversationWidget/useConversationSubscriptions.js +26 -0
- package/dist/shared/components/contextConversationWidget/useMessageActions.js +34 -0
- package/dist/shared/components/contextConversationWidget/useSendMessage.js +45 -0
- package/dist/shared/components/contextConversationWidget/useWidgetMessages.js +44 -0
- package/dist/shared/components/contextConversationWidget/utils.js +56 -0
- package/dist/shared/feature-flags/FeatureFlagProvider.js +21 -21
- package/dist/shared/geography/GeographyProvider.js +20 -20
- package/dist/shared/graphql/GatewayContext.js +1 -1
- package/dist/shared/motion/MotionList.js +1 -1
- package/dist/shared/pages/AiPage.js +3 -3
- package/dist/shared/pages/SearchPage.js +293 -1071
- package/dist/shared/pages/searchPage/ActiveFilterChips.js +176 -0
- package/dist/shared/pages/searchPage/FiltersPanel.js +329 -0
- package/dist/shared/pages/searchPage/ResultsList.js +119 -0
- package/dist/shared/pages/searchPage/ResultsStatus.js +32 -0
- package/dist/shared/pages/searchPage/SearchInput.js +31 -0
- package/dist/shared/pages/searchPage/SearchPagination.js +37 -0
- package/dist/shared/pages/searchPage/SearchToolbar.js +58 -0
- package/dist/shared/pages/searchPage/constants.js +155 -0
- package/dist/shared/pages/searchPage/utils.js +24 -0
- package/dist/shared/plugins/PluginRuntimeProvider.js +1 -1
- package/dist/shared/providers/shell/ActiveContextProvider.js +12 -12
- package/dist/shared/providers/shell/AppShellContext.js +1 -1
- package/dist/shared/providers/shell/AuthProvider.js +130 -384
- package/dist/shared/providers/shell/AuthTokenProvider.js +6 -6
- package/dist/shared/providers/shell/ContextManagerProvider.js +1 -1
- package/dist/shared/providers/shell/FeatureFlagsProvider.js +5 -5
- package/dist/shared/providers/shell/GlobalUiProvider.js +17 -17
- package/dist/shared/providers/shell/I18nProvider.js +15 -15
- package/dist/shared/providers/shell/PageConversationContextProvider.js +14 -14
- package/dist/shared/providers/shell/PermissionProvider.js +16 -16
- package/dist/shared/providers/shell/ShellUiProvider.js +13 -13
- package/dist/shared/providers/shell/ThemeProvider.js +9 -9
- package/dist/shared/providers/shell/authProvider/bridgeStateSync.js +34 -0
- package/dist/shared/providers/shell/authProvider/jwt.js +13 -0
- package/dist/shared/providers/shell/authProvider/ssoRelay.js +38 -0
- package/dist/shared/providers/shell/authProvider/useAuthActions.js +170 -0
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +86 -0
- package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +32 -0
- package/dist/shared/providers/shell/authProvider/useStorageSync.js +35 -0
- package/dist/shared/providers/shell/authProvider/useTokenExpiryTimer.js +37 -0
- package/dist/shared/tours/TourPlayer.js +1 -0
- package/dist/shared/tours/TourPlayerProvider.js +1 -1
- package/dist/shared/tours/TourTooltip.js +3 -0
- package/dist/shared/tours/TourTrigger.js +86 -259
- package/dist/shared/tours/ToursContext.js +108 -398
- package/dist/shared/tours/tourTrigger/DesktopTourDropdown.js +48 -0
- package/dist/shared/tours/tourTrigger/MobileTourSheet.js +68 -0
- package/dist/shared/tours/tourTrigger/TourListItemDesktop.js +36 -0
- package/dist/shared/tours/tourTrigger/TourListItemMobile.js +47 -0
- package/dist/shared/tours/tourTrigger/TourStatusChip.js +30 -0
- package/dist/shared/tours/tourTrigger/TourTriggerButton.js +22 -0
- package/dist/shared/tours/toursContext/errors.js +18 -0
- package/dist/shared/tours/toursContext/gql.js +152 -0
- package/dist/shared/tours/toursContext/route.js +20 -0
- package/dist/shared/tours/toursContext/session.js +19 -0
- package/dist/shared/tours/toursContext/useIdleReady.js +18 -0
- package/dist/shared/tours/toursContext/useTourMutations.js +118 -0
- package/dist/shared-events.js +3 -3
- package/dist/shared-hooks.js +1 -1
- package/dist/storage/SaveToFilesButton.js +3 -3
- package/dist/storage/SaveToFilesDialog.js +1 -1
- package/dist/tag/TagBadge.js +1 -1
- package/dist/tag/TagsWidget.js +81 -226
- package/dist/tag/tagsWidget/AddTagTrigger.js +14 -0
- package/dist/tag/tagsWidget/TagBadgeList.js +17 -0
- package/dist/tag/tagsWidget/TagSearchPopover.js +80 -0
- package/dist/tag/tagsWidget/operations.js +64 -0
- package/dist/tag/tagsWidget/useVocabResolver.js +30 -0
- package/dist/ui/card.js +44 -39
- package/dist/ui/dropdown-menu.js +82 -66
- package/dist/ui/input.js +10 -10
- package/dist/ui/label.js +13 -11
- package/dist/ui/select.js +80 -66
- package/dist/ui/table.js +61 -54
- package/dist/ui/textarea.js +9 -9
- package/dist/ui/tooltip.js +13 -11
- package/package.json +1 -1
|
@@ -1,407 +1,153 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
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 !!
|
|
90
|
-
}), [
|
|
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 ===
|
|
25
|
+
isActive: e.id === T,
|
|
96
26
|
lastLogin: e.lastLogin
|
|
97
|
-
}))),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
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:
|
|
357
|
-
login:
|
|
358
|
-
logout:
|
|
359
|
-
updateUser:
|
|
360
|
-
refreshAccessToken:
|
|
361
|
-
hasPermission:
|
|
362
|
-
setWorkspaceToken:
|
|
363
|
-
workspaceToken:
|
|
364
|
-
mfaRequired:
|
|
365
|
-
mfaChallengeId:
|
|
366
|
-
setMfaState:
|
|
367
|
-
activeProfileId:
|
|
368
|
-
accounts:
|
|
369
|
-
switchAccount:
|
|
370
|
-
addAccount:
|
|
371
|
-
removeAccount:
|
|
372
|
-
logoutAll:
|
|
373
|
-
currentUser:
|
|
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
|
-
|
|
376
|
-
|
|
121
|
+
D,
|
|
122
|
+
k,
|
|
377
123
|
$,
|
|
378
|
-
|
|
379
|
-
|
|
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
|
-
|
|
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__ */
|
|
397
|
-
value:
|
|
398
|
-
children:
|
|
142
|
+
return /* @__PURE__ */ g(_.Provider, {
|
|
143
|
+
value: re,
|
|
144
|
+
children: u
|
|
399
145
|
});
|
|
400
146
|
}
|
|
401
|
-
function
|
|
402
|
-
let e =
|
|
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 {
|
|
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,
|
|
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,
|
|
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 _ =
|
|
69
|
+
let _ = o(() => {
|
|
70
70
|
let e = b();
|
|
71
|
-
|
|
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 =
|
|
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 =
|
|
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,
|
|
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,
|
|
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:
|
|
6
|
-
let [u, d] = a(
|
|
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 =
|
|
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 =
|
|
53
|
+
let e = t(s);
|
|
54
54
|
if (!e) throw Error("useFeatureFlags must be used within a FeatureFlagsProvider");
|
|
55
55
|
return e;
|
|
56
56
|
}
|