@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.
- package/dist/chrome/ContextSwitcher.js +90 -339
- package/dist/chrome/GlobalSearch.js +72 -456
- package/dist/chrome/NotificationCenter.js +69 -703
- package/dist/chrome/SideNavigation.js +73 -241
- 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/shared/components/ContextConversationWidget.js +173 -767
- 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/pages/SearchPage.js +293 -1076
- 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/providers/shell/AuthProvider.js +130 -384
- 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/TourTrigger.js +86 -262
- 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/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/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { addProfile as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as r, getProfiles as i, loginProfile as a, logoutAllProfiles as o, removeProfile as s, resolveActiveProfileId as c, setActiveProfileId as l, setProfileTokens as u, setProfileUser as d, setProfileWorkspaceToken as f, switchProfile as p } from "../ProfileStorageManager.js";
|
|
2
|
+
import { clearShellSsoCookies as m, setShellSsoCookies as h } from "../../../utils/authCookie.js";
|
|
3
|
+
import { getAuthBridge as g } from "../AuthBridgeClient.js";
|
|
4
|
+
import { getCrossOriginLogoutUrl as _ } from "./ssoRelay.js";
|
|
5
|
+
import { getJwtExpiry as v } from "./jwt.js";
|
|
6
|
+
import { useCallback as y } from "react";
|
|
7
|
+
//#region src/shared/providers/shell/authProvider/useAuthActions.ts
|
|
8
|
+
function b({ user: b, tokens: x, activeId: S, bridgeSyncInProgress: C, onRefreshToken: w, onTokenExpired: T, setActiveId: E, setUser: D, setTokens: O, setWorkspaceTokenLocal: k, setMfaRequiredState: A, setMfaChallengeIdState: j, setIsLoading: M, clearAccounts: N, refreshAccounts: P }) {
|
|
9
|
+
let F = y((e, t, n) => {
|
|
10
|
+
let r = v(t) ?? Date.now() + 3600 * 1e3, o = {
|
|
11
|
+
accessToken: t,
|
|
12
|
+
refreshToken: n,
|
|
13
|
+
expiresAt: r
|
|
14
|
+
}, s = a(e, o);
|
|
15
|
+
E(s), D(e), O(o), k(null), A(!1), j(null), P();
|
|
16
|
+
try {
|
|
17
|
+
h(s, window.location.origin);
|
|
18
|
+
} catch {}
|
|
19
|
+
C.current || g()?.notifyLogin({
|
|
20
|
+
user: e,
|
|
21
|
+
tokens: {
|
|
22
|
+
accessToken: t,
|
|
23
|
+
refreshToken: n,
|
|
24
|
+
expiresAt: r
|
|
25
|
+
},
|
|
26
|
+
activeAccountId: s,
|
|
27
|
+
activeProfileId: s,
|
|
28
|
+
profiles: i()
|
|
29
|
+
});
|
|
30
|
+
}, [
|
|
31
|
+
P,
|
|
32
|
+
C,
|
|
33
|
+
E,
|
|
34
|
+
D,
|
|
35
|
+
O,
|
|
36
|
+
k,
|
|
37
|
+
A,
|
|
38
|
+
j
|
|
39
|
+
]), I = y(() => {
|
|
40
|
+
S && s(S);
|
|
41
|
+
let e = c();
|
|
42
|
+
e ? (E(e), D(n(e)), O(t(e)), k(r(e))) : (E(null), D(null), O(null), k(null)), A(!1), j(null), P();
|
|
43
|
+
try {
|
|
44
|
+
m();
|
|
45
|
+
} catch {}
|
|
46
|
+
C.current || g()?.notifyLogout();
|
|
47
|
+
let i = _();
|
|
48
|
+
i && !C.current && window.location.replace(i);
|
|
49
|
+
}, [
|
|
50
|
+
S,
|
|
51
|
+
P,
|
|
52
|
+
C,
|
|
53
|
+
E,
|
|
54
|
+
D,
|
|
55
|
+
O,
|
|
56
|
+
k,
|
|
57
|
+
A,
|
|
58
|
+
j
|
|
59
|
+
]), L = y((t) => {
|
|
60
|
+
if (!b || !S) return;
|
|
61
|
+
let n = {
|
|
62
|
+
...b,
|
|
63
|
+
...t
|
|
64
|
+
};
|
|
65
|
+
D(n), d(S, n), e({
|
|
66
|
+
id: S,
|
|
67
|
+
email: n.email,
|
|
68
|
+
name: n.name ?? `${n.firstName ?? ""} ${n.lastName ?? ""}`.trim(),
|
|
69
|
+
avatar: n.avatar,
|
|
70
|
+
lastLogin: (/* @__PURE__ */ new Date()).toISOString()
|
|
71
|
+
}), P();
|
|
72
|
+
}, [
|
|
73
|
+
b,
|
|
74
|
+
S,
|
|
75
|
+
P,
|
|
76
|
+
D
|
|
77
|
+
]), R = y(async () => {
|
|
78
|
+
if (!(!x?.refreshToken || !w || !S)) {
|
|
79
|
+
M(!0);
|
|
80
|
+
try {
|
|
81
|
+
let e = await w(x.refreshToken), t = v(e.accessToken), n = e.expiresAt ?? t ?? Date.now() + 3600 * 1e3, r = {
|
|
82
|
+
accessToken: e.accessToken,
|
|
83
|
+
refreshToken: e.refreshToken ?? x.refreshToken,
|
|
84
|
+
expiresAt: n
|
|
85
|
+
};
|
|
86
|
+
O(r), u(S, r), C.current || g()?.notifyTokenRefresh({
|
|
87
|
+
accessToken: r.accessToken,
|
|
88
|
+
refreshToken: r.refreshToken,
|
|
89
|
+
expiresAt: r.expiresAt
|
|
90
|
+
});
|
|
91
|
+
} catch (e) {
|
|
92
|
+
console.error("Failed to refresh token:", e), I(), T?.();
|
|
93
|
+
} finally {
|
|
94
|
+
M(!1);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}, [
|
|
98
|
+
x,
|
|
99
|
+
w,
|
|
100
|
+
S,
|
|
101
|
+
I,
|
|
102
|
+
T,
|
|
103
|
+
C,
|
|
104
|
+
O,
|
|
105
|
+
M
|
|
106
|
+
]), z = y((e) => b?.permissions ? b.permissions.includes(e) || b.permissions.includes("*") : !1, [b]), B = y((e) => {
|
|
107
|
+
k(e), S && f(S, e);
|
|
108
|
+
}, [S, k]), V = y((e, t) => {
|
|
109
|
+
A(e), j(t ?? null);
|
|
110
|
+
}, [A, j]), H = y((e) => {
|
|
111
|
+
if (!p(e)) {
|
|
112
|
+
console.error(`Profile ${e} not found`);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
E(e), D(n(e)), O(t(e)), k(r(e)), A(!1), j(null), P(), C.current || g()?.notifyAccountSwitch(e);
|
|
116
|
+
}, [
|
|
117
|
+
P,
|
|
118
|
+
C,
|
|
119
|
+
E,
|
|
120
|
+
D,
|
|
121
|
+
O,
|
|
122
|
+
k,
|
|
123
|
+
A,
|
|
124
|
+
j
|
|
125
|
+
]), U = y((e, t, n) => {
|
|
126
|
+
a(e, {
|
|
127
|
+
accessToken: t,
|
|
128
|
+
refreshToken: n,
|
|
129
|
+
expiresAt: v(t) ?? Date.now() + 3600 * 1e3
|
|
130
|
+
}), S && l(S), P();
|
|
131
|
+
}, [S, P]), W = y((e) => {
|
|
132
|
+
if (e === S) {
|
|
133
|
+
console.error("Cannot remove active account — logout first");
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
s(e), P();
|
|
137
|
+
}, [S, P]);
|
|
138
|
+
return {
|
|
139
|
+
login: F,
|
|
140
|
+
logout: I,
|
|
141
|
+
logoutAll: y(() => {
|
|
142
|
+
o(), E(null), D(null), O(null), k(null), A(!1), j(null), N();
|
|
143
|
+
try {
|
|
144
|
+
m();
|
|
145
|
+
} catch {}
|
|
146
|
+
C.current || g()?.notifyLogoutAll();
|
|
147
|
+
let e = _();
|
|
148
|
+
e && !C.current && window.location.replace(e);
|
|
149
|
+
}, [
|
|
150
|
+
C,
|
|
151
|
+
E,
|
|
152
|
+
D,
|
|
153
|
+
O,
|
|
154
|
+
k,
|
|
155
|
+
A,
|
|
156
|
+
j,
|
|
157
|
+
N
|
|
158
|
+
]),
|
|
159
|
+
updateUser: L,
|
|
160
|
+
refreshAccessToken: R,
|
|
161
|
+
hasPermission: z,
|
|
162
|
+
setWorkspaceToken: B,
|
|
163
|
+
setMfaState: V,
|
|
164
|
+
switchAccount: H,
|
|
165
|
+
addAccount: U,
|
|
166
|
+
removeAccount: W
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//#endregion
|
|
170
|
+
export { b as useAuthActions };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { getProfileTokens as e, getProfileUser as t, getProfileWorkspaceToken as n, resolveActiveProfileId as r } from "../ProfileStorageManager.js";
|
|
2
|
+
import { initAuthBridge as i, isAuthBridgeInitialized as a } from "../AuthBridgeClient.js";
|
|
3
|
+
import { hasRecentSSORedirectAttempt as o, markSSORedirectAttempt as s, shouldSkipSSORedirect as c } from "../../../components/SSORedirectGuard.js";
|
|
4
|
+
import { getCookieSsoRelayUrl as l } from "./ssoRelay.js";
|
|
5
|
+
import { syncBridgeStateToProfileStorage as u } from "./bridgeStateSync.js";
|
|
6
|
+
import { useEffect as d } from "react";
|
|
7
|
+
//#region src/shared/providers/shell/authProvider/useBridgeInitialization.ts
|
|
8
|
+
function f({ bridgeUrl: f, bridgeAllowedOrigins: p, bridgeDebug: m, onBridgeReady: h, bridgeSyncInProgress: g, setIsLoading: _, setActiveId: v, setUser: y, setTokens: b, setWorkspaceTokenLocal: x, clearAccounts: S, refreshAccounts: C }) {
|
|
9
|
+
d(() => {
|
|
10
|
+
if (!f) return;
|
|
11
|
+
try {
|
|
12
|
+
let e = new URL(f).pathname;
|
|
13
|
+
if (window.location.pathname === e) {
|
|
14
|
+
_(!1), h?.();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
} catch {
|
|
18
|
+
_(!1), h?.();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (a()) {
|
|
22
|
+
_(!1), h?.();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
let d = () => {
|
|
26
|
+
_(!1), h?.();
|
|
27
|
+
}, w = (i) => {
|
|
28
|
+
g.current = !0;
|
|
29
|
+
try {
|
|
30
|
+
if (f) {
|
|
31
|
+
let e = l(f);
|
|
32
|
+
if (e) {
|
|
33
|
+
window.location.replace(e);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
u(i);
|
|
38
|
+
let a = r();
|
|
39
|
+
if (a) v(a), y(t(a)), b(e(a)), x(n(a)), C();
|
|
40
|
+
else {
|
|
41
|
+
if (f && !i.user && !i.tokens) try {
|
|
42
|
+
let e = new URL(f).origin, t = window.location.origin, n = l(f);
|
|
43
|
+
if (n) {
|
|
44
|
+
window.location.replace(n);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (e !== t && !c()) {
|
|
48
|
+
let t = window.location.href;
|
|
49
|
+
if (o(e, t)) return;
|
|
50
|
+
s(e, t), window.location.replace(`${e}/auth/sso-relay?returnTo=${encodeURIComponent(t)}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
} catch {}
|
|
54
|
+
v(null), y(null), b(null), x(null), S();
|
|
55
|
+
}
|
|
56
|
+
} finally {
|
|
57
|
+
g.current = !1, d();
|
|
58
|
+
}
|
|
59
|
+
}, T = setTimeout(() => {
|
|
60
|
+
d();
|
|
61
|
+
}, 5e3);
|
|
62
|
+
return i({
|
|
63
|
+
bridgeUrl: f,
|
|
64
|
+
allowedOrigins: p,
|
|
65
|
+
onStateChanged: w,
|
|
66
|
+
debug: m ?? !1
|
|
67
|
+
}), () => {
|
|
68
|
+
clearTimeout(T);
|
|
69
|
+
};
|
|
70
|
+
}, [
|
|
71
|
+
f,
|
|
72
|
+
p,
|
|
73
|
+
m,
|
|
74
|
+
h,
|
|
75
|
+
C,
|
|
76
|
+
g,
|
|
77
|
+
_,
|
|
78
|
+
v,
|
|
79
|
+
y,
|
|
80
|
+
b,
|
|
81
|
+
x,
|
|
82
|
+
S
|
|
83
|
+
]);
|
|
84
|
+
}
|
|
85
|
+
//#endregion
|
|
86
|
+
export { f as useBridgeInitialization };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { resolveGatewayUrls as e } from "../../../config/gatewayUrls.js";
|
|
2
|
+
import { isSharedSsoCookieDomain as t } from "../../../utils/authCookie.js";
|
|
3
|
+
import { checkRemoteSLO as n, checkSLO as r } from "../../../components/SSORedirectGuard.js";
|
|
4
|
+
import { useEffect as i } from "react";
|
|
5
|
+
//#region src/shared/providers/shell/authProvider/useRemoteSLO.ts
|
|
6
|
+
function a({ tokens: a, bridgeUrl: o, logout: s, setActiveId: c, setUser: l, setTokens: u, setWorkspaceTokenLocal: d, clearAccounts: f }) {
|
|
7
|
+
i(() => {
|
|
8
|
+
if (!a?.accessToken || !o) return;
|
|
9
|
+
let i = async () => {
|
|
10
|
+
if (document.visibilityState === "visible") try {
|
|
11
|
+
if (r()) {
|
|
12
|
+
c(null), l(null), u(null), d(null), f();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (t()) return;
|
|
16
|
+
await n(`${e().globalBaseUrl}/global/graphql`, a.accessToken) && s();
|
|
17
|
+
} catch {}
|
|
18
|
+
};
|
|
19
|
+
return document.addEventListener("visibilitychange", i), () => document.removeEventListener("visibilitychange", i);
|
|
20
|
+
}, [
|
|
21
|
+
a?.accessToken,
|
|
22
|
+
o,
|
|
23
|
+
s,
|
|
24
|
+
c,
|
|
25
|
+
l,
|
|
26
|
+
u,
|
|
27
|
+
d,
|
|
28
|
+
f
|
|
29
|
+
]);
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { a as useRemoteSLO };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PROFILE_STORAGE_CHANGE_EVENT as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as r, resolveActiveProfileId as i } from "../ProfileStorageManager.js";
|
|
2
|
+
import { useCallback as a, useEffect as o } from "react";
|
|
3
|
+
//#region src/shared/providers/shell/authProvider/useStorageSync.ts
|
|
4
|
+
function s({ user: s, tokens: c, workspaceToken: l, activeId: u, setUser: d, setTokens: f, setWorkspaceTokenLocal: p, setActiveId: m, clearAccounts: h, refreshAccounts: g }) {
|
|
5
|
+
let _ = a(() => {
|
|
6
|
+
let e = i();
|
|
7
|
+
if (!e) {
|
|
8
|
+
(s || c) && (d(null), f(null), p(null), m(null), h());
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let a = t(e), o = r(e), _ = n(e);
|
|
12
|
+
e !== u && m(e), a?.accessToken !== c?.accessToken && f(a), o !== l && p(o), _ && _.id !== s?.id && d(_), g();
|
|
13
|
+
}, [
|
|
14
|
+
c,
|
|
15
|
+
s,
|
|
16
|
+
l,
|
|
17
|
+
u,
|
|
18
|
+
g,
|
|
19
|
+
d,
|
|
20
|
+
f,
|
|
21
|
+
p,
|
|
22
|
+
m,
|
|
23
|
+
h
|
|
24
|
+
]);
|
|
25
|
+
o(() => {
|
|
26
|
+
let t = () => _();
|
|
27
|
+
window.addEventListener(e, t), window.addEventListener("storage", t);
|
|
28
|
+
let n = setInterval(t, 1e4);
|
|
29
|
+
return () => {
|
|
30
|
+
window.removeEventListener(e, t), window.removeEventListener("storage", t), clearInterval(n);
|
|
31
|
+
};
|
|
32
|
+
}, [_]);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { s as useStorageSync };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect as e } from "react";
|
|
2
|
+
//#region src/shared/providers/shell/authProvider/useTokenExpiryTimer.ts
|
|
3
|
+
function t({ tokens: t, onRefreshToken: n, onTokenExpired: r, onSessionExpiringSoon: i, refreshAccessToken: a }) {
|
|
4
|
+
e(() => {
|
|
5
|
+
if (!t?.expiresAt) return;
|
|
6
|
+
let e = t.expiresAt - Date.now();
|
|
7
|
+
if (e <= 0) {
|
|
8
|
+
n && t?.refreshToken ? a() : r?.();
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
let o = [];
|
|
12
|
+
if (n && t?.refreshToken) {
|
|
13
|
+
let t = Math.max(0, e - 300 * 1e3);
|
|
14
|
+
o.push(setTimeout(() => {
|
|
15
|
+
a();
|
|
16
|
+
}, t));
|
|
17
|
+
}
|
|
18
|
+
if (i) {
|
|
19
|
+
let t = Math.max(0, e - 300 * 1e3);
|
|
20
|
+
o.push(setTimeout(() => {
|
|
21
|
+
i();
|
|
22
|
+
}, t));
|
|
23
|
+
}
|
|
24
|
+
return (!n || !t?.refreshToken) && o.push(setTimeout(() => {
|
|
25
|
+
r?.();
|
|
26
|
+
}, e)), () => o.forEach(clearTimeout);
|
|
27
|
+
}, [
|
|
28
|
+
t?.expiresAt,
|
|
29
|
+
t?.refreshToken,
|
|
30
|
+
a,
|
|
31
|
+
n,
|
|
32
|
+
r,
|
|
33
|
+
i
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { t as useTokenExpiryTimer };
|