@burdenoff/fe-libs 2026.1023.6 → 2026.1023.8
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/shared/assistant/gatewayClient.js +23 -19
- package/dist/shared/assistant/index.d.ts +1 -0
- package/dist/shared/assistant/productContext.d.ts +16 -0
- package/dist/shared/assistant/productContext.js +16 -0
- package/dist/shared/graphql/client.d.ts +9 -0
- package/dist/shared/graphql/client.js +241 -201
- package/dist/shared/graphql/fetch.js +135 -123
- package/dist/shared/graphql/index.d.ts +1 -0
- package/dist/shared/graphql/workspaceOperationGuard.d.ts +70 -0
- package/dist/shared/graphql/workspaceOperationGuard.js +62 -0
- package/dist/shared/providers/AppShellProvider.d.ts +16 -0
- package/dist/shared/providers/AppShellProvider.js +258 -251
- package/dist/shared/providers/shell/AuthProvider.d.ts +14 -1
- package/dist/shared/providers/shell/AuthProvider.js +105 -94
- package/dist/shared/providers/shell/MultiGatewayProvider.d.ts +8 -1
- package/dist/shared/providers/shell/MultiGatewayProvider.js +115 -119
- package/dist/shared/providers/shell/ProfileStorageManager.js +1 -1
- package/dist/shared/providers/shell/WorkspaceWriteRefusedToastListener.d.ts +4 -0
- package/dist/shared/providers/shell/WorkspaceWriteRefusedToastListener.js +23 -0
- package/dist/shared/providers/shell/authProvider/identityChange.d.ts +26 -0
- package/dist/shared/providers/shell/authProvider/identityChange.js +11 -0
- package/dist/shared/providers/shell/authProvider/useAuthActions.d.ts +4 -1
- package/dist/shared/providers/shell/authProvider/useAuthActions.js +105 -92
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.d.ts +27 -1
- package/dist/shared/providers/shell/authProvider/useBridgeInitialization.js +82 -62
- package/dist/shared/providers/shell/authProvider/useRemoteSLO.d.ts +4 -1
- package/dist/shared/providers/shell/authProvider/useRemoteSLO.js +16 -14
- package/dist/shared/providers/shell/authProvider/useStorageSync.d.ts +4 -1
- package/dist/shared/providers/shell/authProvider/useStorageSync.js +19 -14
- package/dist/shared/providers/shell/contextSwitchCache.d.ts +4 -0
- package/dist/shared/providers/shell/contextSwitchCache.js +17 -0
- package/dist/shared/providers/shell/identityQueryReset.d.ts +17 -0
- package/dist/shared/providers/shell/identityQueryReset.js +21 -0
- package/dist/shared/providers/shell/identityScopedQueryReset.d.ts +16 -0
- package/dist/shared/providers/shell/identityScopedQueryReset.js +30 -0
- package/dist/shared/providers/shell/index.d.ts +1 -1
- package/dist/shared-assistant.js +306 -305
- package/dist/shared-graphql.js +11 -10
- package/dist/shared.js +129 -128
- package/package.json +2 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ProfileUser, AuthTokens, ProfileMeta } from './ProfileStorageManager';
|
|
3
3
|
import { AuthActions } from './authProvider/useAuthActions';
|
|
4
|
+
import { IdentityChangeReason } from './authProvider/identityChange';
|
|
4
5
|
export type { ProfileUser as User, AuthTokens, ProfileMeta };
|
|
6
|
+
export type { IdentityChangeReason };
|
|
5
7
|
export interface Account {
|
|
6
8
|
id: string;
|
|
7
9
|
email: string;
|
|
@@ -57,6 +59,17 @@ export interface AuthProviderProps {
|
|
|
57
59
|
bridgeDebug?: boolean;
|
|
58
60
|
/** Called when the auth bridge has finished initializing (responded or timed out) */
|
|
59
61
|
onBridgeReady?: () => void;
|
|
62
|
+
/**
|
|
63
|
+
* BOFF-9384: called synchronously BEFORE React state moves to another
|
|
64
|
+
* account, by every path that changes it (sign-in, sign-out, account switch,
|
|
65
|
+
* sign-out of every account, remote single-logout, auth-bridge sync,
|
|
66
|
+
* cross-tab storage sync), and only when the account really changes. The
|
|
67
|
+
* first four also call it before they write storage; the background three
|
|
68
|
+
* call it once storage already names the next account. AppShellProvider
|
|
69
|
+
* empties its React Query cache here so the next account never reads the
|
|
70
|
+
* previous account's data.
|
|
71
|
+
*/
|
|
72
|
+
onBeforeIdentityChange?: (reason: IdentityChangeReason) => void;
|
|
60
73
|
}
|
|
61
|
-
export declare function AuthProvider({ children, onTokenExpired, onSessionExpiringSoon, onRefreshToken, bridgeUrl, bridgeAllowedOrigins, bridgeDebug, onBridgeReady, }: AuthProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
74
|
+
export declare function AuthProvider({ children, onTokenExpired, onSessionExpiringSoon, onRefreshToken, bridgeUrl, bridgeAllowedOrigins, bridgeDebug, onBridgeReady, onBeforeIdentityChange, }: AuthProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
62
75
|
export declare function useAuth(): AuthContextValue;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { getActiveProfileId as e, getProfileTokens as t, getProfileUser as n, getProfileWorkspaceToken as ee, getSwitchableProfiles as r, resolveActiveProfileId as te } from "./ProfileStorageManager.js";
|
|
2
2
|
import { readShellSsoCookie as i } from "../../utils/authCookie.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
3
|
+
import { identityKeyOf as a } from "./authProvider/identityChange.js";
|
|
4
|
+
import { useBridgeInitialization as o } from "./authProvider/useBridgeInitialization.js";
|
|
5
|
+
import { useTokenExpiryTimer as ne } from "./authProvider/useTokenExpiryTimer.js";
|
|
6
|
+
import { useStorageSync as re } from "./authProvider/useStorageSync.js";
|
|
7
|
+
import { useRemoteSLO as ie } from "./authProvider/useRemoteSLO.js";
|
|
8
|
+
import { useAuthActions as ae } from "./authProvider/useAuthActions.js";
|
|
9
|
+
import { useSsoDepositBootGuard as oe } from "./authProvider/useSsoDepositBootGuard.js";
|
|
10
|
+
import { createContext as s, use as c, useCallback as l, useLayoutEffect as se, useMemo as u, useRef as d, useState as f } from "react";
|
|
11
|
+
import { jsx as ce } from "react/jsx-runtime";
|
|
11
12
|
//#region src/shared/providers/shell/AuthProvider.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
13
|
+
var p = s(null);
|
|
14
|
+
function m(e) {
|
|
14
15
|
return r(e).map((t) => ({
|
|
15
16
|
id: t.id,
|
|
16
17
|
email: t.email,
|
|
@@ -20,130 +21,140 @@ function v(e) {
|
|
|
20
21
|
lastLogin: t.lastLogin
|
|
21
22
|
}));
|
|
22
23
|
}
|
|
23
|
-
function
|
|
24
|
-
let
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
24
|
+
function h({ children: r, onTokenExpired: s, onSessionExpiringSoon: c, onRefreshToken: h, bridgeUrl: g, bridgeAllowedOrigins: _, bridgeDebug: v, onBridgeReady: le, onBeforeIdentityChange: y }) {
|
|
25
|
+
let b = d(!1), [x, S] = f(() => te()), [C, w] = f(() => x ? n(x) : null), [T, E] = f(() => x ? t(x) : null), [D, O] = f(() => x ? ee(x) : null), [k, A] = f(() => {
|
|
26
|
+
if (x && n(x)) return !1;
|
|
27
|
+
if (g) try {
|
|
27
28
|
let e = i()?.id ?? null;
|
|
28
29
|
if (e && localStorage.getItem(`bf-p-${e}-tokens`)) return !1;
|
|
29
30
|
} catch {}
|
|
30
|
-
return !!
|
|
31
|
-
}), [
|
|
32
|
-
|
|
33
|
-
}, []),
|
|
34
|
-
|
|
31
|
+
return !!g;
|
|
32
|
+
}), [j, ue] = f(!1), [M, de] = f(null), [N, P] = f(() => m(x)), F = l(() => {
|
|
33
|
+
P([]);
|
|
34
|
+
}, []), I = l(() => {
|
|
35
|
+
P(m(e()));
|
|
36
|
+
}, []), L = a(x, C?.id), R = d(L), z = d(!1), B = d(y);
|
|
37
|
+
se(() => {
|
|
38
|
+
R.current = L, z.current = !1, B.current = y;
|
|
39
|
+
});
|
|
40
|
+
let V = l((e, t) => {
|
|
41
|
+
z.current || a(t.profileId, t.userId) !== R.current && (z.current = !0, B.current?.(e));
|
|
35
42
|
}, []);
|
|
36
|
-
|
|
37
|
-
bridgeUrl:
|
|
38
|
-
bridgeAllowedOrigins:
|
|
39
|
-
bridgeDebug:
|
|
40
|
-
onBridgeReady:
|
|
41
|
-
bridgeSyncInProgress:
|
|
42
|
-
setIsLoading:
|
|
43
|
-
setActiveId:
|
|
44
|
-
setUser:
|
|
45
|
-
setTokens:
|
|
46
|
-
setWorkspaceTokenLocal:
|
|
47
|
-
clearAccounts:
|
|
48
|
-
refreshAccounts:
|
|
43
|
+
o({
|
|
44
|
+
bridgeUrl: g,
|
|
45
|
+
bridgeAllowedOrigins: _,
|
|
46
|
+
bridgeDebug: v,
|
|
47
|
+
onBridgeReady: le,
|
|
48
|
+
bridgeSyncInProgress: b,
|
|
49
|
+
setIsLoading: A,
|
|
50
|
+
setActiveId: S,
|
|
51
|
+
setUser: w,
|
|
52
|
+
setTokens: E,
|
|
53
|
+
setWorkspaceTokenLocal: O,
|
|
54
|
+
clearAccounts: F,
|
|
55
|
+
refreshAccounts: I,
|
|
56
|
+
announceIdentityChange: V
|
|
49
57
|
});
|
|
50
|
-
let { login: H, logout: U, logoutAll: W, updateUser: G, refreshAccessToken: K, hasPermission: q, setWorkspaceToken: J, setMfaState: Y, switchAccount: X, addAccount: Z, removeAccount: Q } =
|
|
51
|
-
user:
|
|
52
|
-
tokens:
|
|
53
|
-
activeId:
|
|
54
|
-
bridgeSyncInProgress:
|
|
55
|
-
onRefreshToken:
|
|
56
|
-
onTokenExpired:
|
|
57
|
-
setActiveId:
|
|
58
|
-
setUser:
|
|
59
|
-
setTokens:
|
|
60
|
-
setWorkspaceTokenLocal:
|
|
61
|
-
setMfaRequiredState:
|
|
62
|
-
setMfaChallengeIdState:
|
|
63
|
-
setIsLoading:
|
|
64
|
-
clearAccounts:
|
|
65
|
-
refreshAccounts:
|
|
58
|
+
let { login: H, logout: U, logoutAll: W, updateUser: G, refreshAccessToken: K, hasPermission: q, setWorkspaceToken: J, setMfaState: Y, switchAccount: X, addAccount: Z, removeAccount: Q } = ae({
|
|
59
|
+
user: C,
|
|
60
|
+
tokens: T,
|
|
61
|
+
activeId: x,
|
|
62
|
+
bridgeSyncInProgress: b,
|
|
63
|
+
onRefreshToken: h,
|
|
64
|
+
onTokenExpired: s,
|
|
65
|
+
setActiveId: S,
|
|
66
|
+
setUser: w,
|
|
67
|
+
setTokens: E,
|
|
68
|
+
setWorkspaceTokenLocal: O,
|
|
69
|
+
setMfaRequiredState: ue,
|
|
70
|
+
setMfaChallengeIdState: de,
|
|
71
|
+
setIsLoading: A,
|
|
72
|
+
clearAccounts: F,
|
|
73
|
+
refreshAccounts: I,
|
|
74
|
+
announceIdentityChange: V
|
|
66
75
|
});
|
|
67
|
-
|
|
68
|
-
tokens:
|
|
69
|
-
onRefreshToken:
|
|
70
|
-
onTokenExpired:
|
|
71
|
-
onSessionExpiringSoon:
|
|
76
|
+
ne({
|
|
77
|
+
tokens: T,
|
|
78
|
+
onRefreshToken: h,
|
|
79
|
+
onTokenExpired: s,
|
|
80
|
+
onSessionExpiringSoon: c,
|
|
72
81
|
refreshAccessToken: K
|
|
73
|
-
}),
|
|
74
|
-
user:
|
|
75
|
-
tokens:
|
|
76
|
-
workspaceToken:
|
|
77
|
-
activeId:
|
|
78
|
-
setUser:
|
|
79
|
-
setTokens:
|
|
80
|
-
setWorkspaceTokenLocal:
|
|
81
|
-
setActiveId:
|
|
82
|
-
clearAccounts:
|
|
83
|
-
refreshAccounts:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
}), re({
|
|
83
|
+
user: C,
|
|
84
|
+
tokens: T,
|
|
85
|
+
workspaceToken: D,
|
|
86
|
+
activeId: x,
|
|
87
|
+
setUser: w,
|
|
88
|
+
setTokens: E,
|
|
89
|
+
setWorkspaceTokenLocal: O,
|
|
90
|
+
setActiveId: S,
|
|
91
|
+
clearAccounts: F,
|
|
92
|
+
refreshAccounts: I,
|
|
93
|
+
announceIdentityChange: V
|
|
94
|
+
}), oe(), ie({
|
|
95
|
+
tokens: T,
|
|
96
|
+
bridgeUrl: g,
|
|
87
97
|
logout: U,
|
|
88
|
-
setActiveId:
|
|
89
|
-
setUser:
|
|
90
|
-
setTokens:
|
|
91
|
-
setWorkspaceTokenLocal:
|
|
92
|
-
clearAccounts:
|
|
98
|
+
setActiveId: S,
|
|
99
|
+
setUser: w,
|
|
100
|
+
setTokens: E,
|
|
101
|
+
setWorkspaceTokenLocal: O,
|
|
102
|
+
clearAccounts: F,
|
|
103
|
+
announceIdentityChange: V
|
|
93
104
|
});
|
|
94
|
-
let $ =
|
|
95
|
-
user:
|
|
96
|
-
tokens:
|
|
105
|
+
let $ = u(() => !!C && !!T, [C, T]), fe = u(() => ({
|
|
106
|
+
user: C,
|
|
107
|
+
tokens: T,
|
|
97
108
|
isAuthenticated: $,
|
|
98
|
-
isLoading:
|
|
109
|
+
isLoading: k,
|
|
99
110
|
login: H,
|
|
100
111
|
logout: U,
|
|
101
112
|
updateUser: G,
|
|
102
113
|
refreshAccessToken: K,
|
|
103
114
|
hasPermission: q,
|
|
104
115
|
setWorkspaceToken: J,
|
|
105
|
-
workspaceToken:
|
|
106
|
-
mfaRequired:
|
|
107
|
-
mfaChallengeId:
|
|
116
|
+
workspaceToken: D,
|
|
117
|
+
mfaRequired: j,
|
|
118
|
+
mfaChallengeId: M,
|
|
108
119
|
setMfaState: Y,
|
|
109
|
-
activeProfileId:
|
|
110
|
-
accounts:
|
|
120
|
+
activeProfileId: x,
|
|
121
|
+
accounts: N,
|
|
111
122
|
switchAccount: X,
|
|
112
123
|
addAccount: Z,
|
|
113
124
|
removeAccount: Q,
|
|
114
125
|
logoutAll: W,
|
|
115
|
-
currentUser:
|
|
126
|
+
currentUser: C
|
|
116
127
|
}), [
|
|
117
|
-
|
|
118
|
-
|
|
128
|
+
C,
|
|
129
|
+
T,
|
|
119
130
|
$,
|
|
120
|
-
|
|
131
|
+
k,
|
|
121
132
|
H,
|
|
122
133
|
U,
|
|
123
134
|
G,
|
|
124
135
|
K,
|
|
125
136
|
q,
|
|
126
137
|
J,
|
|
138
|
+
D,
|
|
127
139
|
j,
|
|
128
|
-
|
|
129
|
-
L,
|
|
140
|
+
M,
|
|
130
141
|
Y,
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
x,
|
|
143
|
+
N,
|
|
133
144
|
X,
|
|
134
145
|
Z,
|
|
135
146
|
Q,
|
|
136
147
|
W
|
|
137
148
|
]);
|
|
138
|
-
return /* @__PURE__ */
|
|
139
|
-
value:
|
|
149
|
+
return /* @__PURE__ */ ce(p.Provider, {
|
|
150
|
+
value: fe,
|
|
140
151
|
children: r
|
|
141
152
|
});
|
|
142
153
|
}
|
|
143
|
-
function
|
|
144
|
-
let e =
|
|
154
|
+
function g() {
|
|
155
|
+
let e = c(p);
|
|
145
156
|
if (!e) throw Error("useAuth must be used within an AuthProvider");
|
|
146
157
|
return e;
|
|
147
158
|
}
|
|
148
159
|
//#endregion
|
|
149
|
-
export {
|
|
160
|
+
export { h as AuthProvider, g as useAuth };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Gateway } from '../../graphql/client';
|
|
3
|
+
import { WorkspaceOperationGuardMode } from '../../graphql/workspaceOperationGuard';
|
|
3
4
|
export interface MultiGatewayProviderProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
/** Base URL for workspace gateway */
|
|
@@ -22,5 +23,11 @@ export interface MultiGatewayProviderProps {
|
|
|
22
23
|
onNetworkError?: (error: Error) => void;
|
|
23
24
|
/** Callback to attempt token refresh on 401 */
|
|
24
25
|
onRefreshToken?: () => Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* BOFF-8106: `'enforce'` refuses workspace operations built for a workspace
|
|
28
|
+
* that is no longer active, and a switch no longer re-sends them. Default
|
|
29
|
+
* `'off'`. See `CreateClientOptions.workspaceOperationGuard`.
|
|
30
|
+
*/
|
|
31
|
+
workspaceOperationGuard?: WorkspaceOperationGuardMode;
|
|
25
32
|
}
|
|
26
|
-
export declare function MultiGatewayProvider({ children, workspaceBaseUrl, globalBaseUrl, organizationId, productSlug, defaultGateway, debug, enableSubscriptions, onAuthError, onNetworkError, onRefreshToken, }: MultiGatewayProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
33
|
+
export declare function MultiGatewayProvider({ children, workspaceBaseUrl, globalBaseUrl, organizationId, productSlug, defaultGateway, debug, enableSubscriptions, onAuthError, onNetworkError, onRefreshToken, workspaceOperationGuard: workspaceOperationGuardProp, }: MultiGatewayProviderProps): import('react/jsx-runtime').JSX.Element;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
import { isCapacitorNative as e } from "../../native/capacitor.js";
|
|
2
2
|
import { readActiveContextValueWithUrlPrecedence as t } from "./ActiveContextStorage.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { normalizeWorkspaceOperationGuardMode as n, refetchActiveQueries as r } from "../../graphql/workspaceOperationGuard.js";
|
|
4
|
+
import { createGraphQLClient as i } from "../../graphql/client.js";
|
|
5
|
+
import { GatewayProvider as a } from "../../graphql/GatewayContext.js";
|
|
6
|
+
import { useAuthToken as o } from "./AuthTokenProvider.js";
|
|
7
|
+
import { evictForContextChange as s, refetchForContextChange as c } from "./contextSwitchCache.js";
|
|
8
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f } from "react";
|
|
9
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
10
|
+
import { ApolloProvider as m } from "@apollo/client/react";
|
|
9
11
|
//#region src/shared/providers/shell/MultiGatewayProvider.tsx
|
|
10
|
-
function
|
|
11
|
-
let { getAccessToken:
|
|
12
|
+
function h({ children: h, workspaceBaseUrl: g, globalBaseUrl: _, organizationId: v, productSlug: y, defaultGateway: b = "workspace", debug: x = !1, enableSubscriptions: S = !1, onAuthError: C, onNetworkError: w, onRefreshToken: T, workspaceOperationGuard: E }) {
|
|
13
|
+
let D = n(E), { getAccessToken: O, getWorkspaceToken: k, accessToken: A, workspaceToken: j } = o(), M = f({
|
|
12
14
|
workspaceClient: null,
|
|
13
15
|
globalClient: null
|
|
14
|
-
}),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let e =
|
|
18
|
-
e.workspaceClient &&
|
|
19
|
-
if (!
|
|
16
|
+
}), N = f(null), P = l(() => {
|
|
17
|
+
N.current ||= setTimeout(() => {
|
|
18
|
+
N.current = null;
|
|
19
|
+
let e = M.current, n = [], i = () => t("workspace");
|
|
20
|
+
e.workspaceClient && n.push(r(e.workspaceClient, D, i)), e.globalClient && n.push(r(e.globalClient, D, i)), n.length !== 0 && Promise.allSettled(n).then((e) => {
|
|
21
|
+
if (!x) return;
|
|
20
22
|
let t = e.filter((e) => e.status === "rejected");
|
|
21
23
|
t.length > 0 && console.warn("[MultiGatewayProvider] Active query refresh failed after mutation", t);
|
|
22
24
|
});
|
|
23
25
|
}, 0);
|
|
24
|
-
}, [
|
|
26
|
+
}, [x, D]), F = l(() => {
|
|
25
27
|
let e = sessionStorage.getItem("bf-active-profile");
|
|
26
28
|
if (e) {
|
|
27
29
|
let t = localStorage.getItem(`bf-p-${e}-locale`);
|
|
28
30
|
if (t) return t;
|
|
29
31
|
}
|
|
30
32
|
return localStorage.getItem("burdenoff-locale") || "en";
|
|
31
|
-
}, []),
|
|
33
|
+
}, []), I = l(() => {
|
|
32
34
|
let e = sessionStorage.getItem("bf-active-profile");
|
|
33
35
|
if (e) {
|
|
34
36
|
let t = localStorage.getItem(`bf-p-${e}-geography`);
|
|
@@ -41,122 +43,116 @@ function d({ children: d, workspaceBaseUrl: f, globalBaseUrl: p, organizationId:
|
|
|
41
43
|
return JSON.parse(t);
|
|
42
44
|
} catch {}
|
|
43
45
|
return null;
|
|
44
|
-
}, []),
|
|
46
|
+
}, []), L = l(() => t("workspace"), []), R = l(() => t("project"), []), z = d(() => i({
|
|
45
47
|
gateway: "workspace",
|
|
46
|
-
baseUrl:
|
|
47
|
-
authToken:
|
|
48
|
-
workspaceToken:
|
|
49
|
-
workspaceId:
|
|
50
|
-
projectId:
|
|
51
|
-
organizationId:
|
|
52
|
-
productSlug:
|
|
53
|
-
locale:
|
|
54
|
-
geography:
|
|
55
|
-
enableSubscriptions:
|
|
56
|
-
debug:
|
|
57
|
-
onAuthError:
|
|
58
|
-
onRefreshToken:
|
|
59
|
-
onNetworkError:
|
|
60
|
-
onMutationSuccess:
|
|
48
|
+
baseUrl: g,
|
|
49
|
+
authToken: O,
|
|
50
|
+
workspaceToken: k,
|
|
51
|
+
workspaceId: L,
|
|
52
|
+
projectId: R,
|
|
53
|
+
organizationId: v,
|
|
54
|
+
productSlug: y,
|
|
55
|
+
locale: F,
|
|
56
|
+
geography: I,
|
|
57
|
+
enableSubscriptions: S,
|
|
58
|
+
debug: x,
|
|
59
|
+
onAuthError: C,
|
|
60
|
+
onRefreshToken: T,
|
|
61
|
+
onNetworkError: w,
|
|
62
|
+
onMutationSuccess: P,
|
|
63
|
+
workspaceOperationGuard: D
|
|
61
64
|
}), [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
C,
|
|
65
|
-
j,
|
|
66
|
-
M,
|
|
67
|
-
m,
|
|
68
|
-
h,
|
|
65
|
+
g,
|
|
66
|
+
O,
|
|
69
67
|
k,
|
|
70
|
-
|
|
68
|
+
L,
|
|
69
|
+
R,
|
|
71
70
|
v,
|
|
72
|
-
_,
|
|
73
71
|
y,
|
|
72
|
+
F,
|
|
73
|
+
I,
|
|
74
|
+
S,
|
|
74
75
|
x,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
C,
|
|
77
|
+
T,
|
|
78
|
+
w,
|
|
79
|
+
P,
|
|
80
|
+
D
|
|
81
|
+
]), B = d(() => i({
|
|
78
82
|
gateway: "global",
|
|
79
|
-
baseUrl:
|
|
80
|
-
authToken:
|
|
81
|
-
workspaceToken:
|
|
82
|
-
workspaceId:
|
|
83
|
-
projectId:
|
|
84
|
-
organizationId:
|
|
85
|
-
productSlug:
|
|
86
|
-
locale:
|
|
87
|
-
geography:
|
|
88
|
-
enableSubscriptions:
|
|
89
|
-
debug:
|
|
90
|
-
onAuthError:
|
|
91
|
-
onRefreshToken:
|
|
92
|
-
onNetworkError:
|
|
93
|
-
onMutationSuccess:
|
|
83
|
+
baseUrl: _,
|
|
84
|
+
authToken: O,
|
|
85
|
+
workspaceToken: k,
|
|
86
|
+
workspaceId: L,
|
|
87
|
+
projectId: R,
|
|
88
|
+
organizationId: v,
|
|
89
|
+
productSlug: y,
|
|
90
|
+
locale: F,
|
|
91
|
+
geography: I,
|
|
92
|
+
enableSubscriptions: S,
|
|
93
|
+
debug: x,
|
|
94
|
+
onAuthError: C,
|
|
95
|
+
onRefreshToken: T,
|
|
96
|
+
onNetworkError: w,
|
|
97
|
+
onMutationSuccess: P,
|
|
98
|
+
workspaceOperationGuard: D
|
|
94
99
|
}), [
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
C,
|
|
98
|
-
j,
|
|
99
|
-
M,
|
|
100
|
-
m,
|
|
101
|
-
h,
|
|
100
|
+
_,
|
|
101
|
+
O,
|
|
102
102
|
k,
|
|
103
|
-
|
|
103
|
+
L,
|
|
104
|
+
R,
|
|
104
105
|
v,
|
|
105
|
-
_,
|
|
106
106
|
y,
|
|
107
|
+
F,
|
|
108
|
+
I,
|
|
109
|
+
S,
|
|
107
110
|
x,
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
C,
|
|
112
|
+
T,
|
|
113
|
+
w,
|
|
114
|
+
P,
|
|
115
|
+
D
|
|
110
116
|
]);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
workspaceClient:
|
|
114
|
-
globalClient:
|
|
117
|
+
u(() => {
|
|
118
|
+
M.current = {
|
|
119
|
+
workspaceClient: z,
|
|
120
|
+
globalClient: B
|
|
115
121
|
};
|
|
116
|
-
}, [
|
|
117
|
-
let e =
|
|
122
|
+
}, [z, B]), u(() => {
|
|
123
|
+
let e = N;
|
|
118
124
|
return () => {
|
|
119
125
|
e.current &&= (clearTimeout(e.current), null);
|
|
120
126
|
};
|
|
121
127
|
}, []);
|
|
122
|
-
let
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
hasAccessToken: !!
|
|
126
|
-
hasWorkspaceToken: !!
|
|
128
|
+
let V = l((e) => e === "workspace" ? M.current.workspaceClient ?? z : M.current.globalClient ?? B, [z, B]);
|
|
129
|
+
return u(() => {
|
|
130
|
+
x && console.log("[MultiGatewayProvider] Tokens updated:", {
|
|
131
|
+
hasAccessToken: !!A,
|
|
132
|
+
hasWorkspaceToken: !!j
|
|
127
133
|
});
|
|
128
134
|
}, [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
]),
|
|
135
|
+
A,
|
|
136
|
+
j,
|
|
137
|
+
x
|
|
138
|
+
]), u(() => {
|
|
133
139
|
if (typeof window > "u") return;
|
|
134
140
|
let e = async (e) => {
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
N.cache.evict({ id: "ROOT_QUERY" }), N.cache.gc();
|
|
138
|
-
} catch {}
|
|
139
|
-
try {
|
|
140
|
-
P.cache.evict({ id: "ROOT_QUERY" }), P.cache.gc();
|
|
141
|
-
} catch {}
|
|
142
|
-
try {
|
|
143
|
-
await N.refetchQueries({ include: "active" });
|
|
144
|
-
} catch {}
|
|
145
|
-
try {
|
|
146
|
-
await P.refetchQueries({ include: "active" });
|
|
147
|
-
} catch {}
|
|
141
|
+
x && console.log("[MultiGatewayProvider] Context changed; evicting cache + refetching", e), s(z, D), s(B, D), await c(z, D, L), await c(B, D, L);
|
|
148
142
|
};
|
|
149
143
|
return window.addEventListener("burdenoff:workspace-changed", e), window.addEventListener("burdenoff:organization-changed", e), window.addEventListener("burdenoff:project-changed", e), () => {
|
|
150
144
|
window.removeEventListener("burdenoff:workspace-changed", e), window.removeEventListener("burdenoff:organization-changed", e), window.removeEventListener("burdenoff:project-changed", e);
|
|
151
145
|
};
|
|
152
146
|
}, [
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
z,
|
|
148
|
+
B,
|
|
149
|
+
x,
|
|
150
|
+
D,
|
|
151
|
+
L
|
|
152
|
+
]), u(() => {
|
|
153
|
+
let t = z, n = B;
|
|
158
154
|
return () => {
|
|
159
|
-
if (
|
|
155
|
+
if (x && console.log("[MultiGatewayProvider] Cleaning up Apollo clients"), !(typeof window < "u" && !e() && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.endsWith(".local.burdenoff.com")))) {
|
|
160
156
|
try {
|
|
161
157
|
t.stop();
|
|
162
158
|
} catch {}
|
|
@@ -166,24 +162,24 @@ function d({ children: d, workspaceBaseUrl: f, globalBaseUrl: p, organizationId:
|
|
|
166
162
|
}
|
|
167
163
|
};
|
|
168
164
|
}, [
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
]), /* @__PURE__ */
|
|
173
|
-
value:
|
|
174
|
-
workspaceClient:
|
|
175
|
-
globalClient:
|
|
176
|
-
getClient:
|
|
165
|
+
z,
|
|
166
|
+
B,
|
|
167
|
+
x
|
|
168
|
+
]), /* @__PURE__ */ p(a, {
|
|
169
|
+
value: d(() => ({
|
|
170
|
+
workspaceClient: z,
|
|
171
|
+
globalClient: B,
|
|
172
|
+
getClient: V
|
|
177
173
|
}), [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
174
|
+
z,
|
|
175
|
+
B,
|
|
176
|
+
V
|
|
181
177
|
]),
|
|
182
|
-
children: /* @__PURE__ */
|
|
183
|
-
client:
|
|
184
|
-
children:
|
|
178
|
+
children: /* @__PURE__ */ p(m, {
|
|
179
|
+
client: b === "workspace" ? z : B,
|
|
180
|
+
children: h
|
|
185
181
|
})
|
|
186
182
|
});
|
|
187
183
|
}
|
|
188
184
|
//#endregion
|
|
189
|
-
export {
|
|
185
|
+
export { h as MultiGatewayProvider };
|
|
@@ -206,4 +206,4 @@ function U(e) {
|
|
|
206
206
|
return g().some((t) => t.id === e) ? (C(e), !0) : !1;
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
|
-
export { s as PROFILE_STORAGE_CHANGE_EVENT, t as ProfileStorageManager_exports, y as addProfile, w as clearActiveProfileId, z as getActiveContext, S as getActiveProfileId, L as getActiveTokens, I as getActiveUser, R as getActiveWorkspaceToken, M as getProfileContext, P as getProfileLocale, O as getProfileTokens, E as getProfileUser, A as getProfileWorkspaceToken, p as getProfiles, _ as getSwitchableProfiles, B as loginProfile, V as logoutActiveProfile, H as logoutAllProfiles, x as removeAllProfiles, b as removeProfile, T as resolveActiveProfileId, C as setActiveProfileId, N as setProfileContext, F as setProfileLocale, k as setProfileTokens, D as setProfileUser, j as setProfileWorkspaceToken, v as setProfiles, U as switchProfile };
|
|
209
|
+
export { s as PROFILE_STORAGE_CHANGE_EVENT, t as ProfileStorageManager_exports, y as addProfile, w as clearActiveProfileId, z as getActiveContext, S as getActiveProfileId, L as getActiveTokens, I as getActiveUser, R as getActiveWorkspaceToken, M as getProfileContext, P as getProfileLocale, O as getProfileTokens, E as getProfileUser, A as getProfileWorkspaceToken, p as getProfiles, g as getSelectableProfiles, _ as getSwitchableProfiles, B as loginProfile, V as logoutActiveProfile, H as logoutAllProfiles, x as removeAllProfiles, b as removeProfile, T as resolveActiveProfileId, C as setActiveProfileId, N as setProfileContext, F as setProfileLocale, k as setProfileTokens, D as setProfileUser, j as setProfileWorkspaceToken, v as setProfiles, U as switchProfile };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const WORKSPACE_WRITE_REFUSED_TOAST_ID = "burdenoff-workspace-write-refused";
|
|
2
|
+
export declare const WORKSPACE_WRITE_REFUSED_TOAST_DEDUPE_MS = 3000;
|
|
3
|
+
export declare const WORKSPACE_WRITE_REFUSED_I18N_KEY = "shell.workspaceChanged.notSaved";
|
|
4
|
+
export declare function WorkspaceWriteRefusedToastListener(): null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { WORKSPACE_WRITE_REFUSED_EVENT as e, WORKSPACE_WRITE_REFUSED_MESSAGE as t } from "../../graphql/workspaceOperationGuard.js";
|
|
2
|
+
import { useOptionalI18n as n } from "./I18nProvider.js";
|
|
3
|
+
import { useEffect as r, useRef as i } from "react";
|
|
4
|
+
import { toast as a } from "sonner";
|
|
5
|
+
//#region src/shared/providers/shell/WorkspaceWriteRefusedToastListener.tsx
|
|
6
|
+
var o = "burdenoff-workspace-write-refused", s = "shell.workspaceChanged.notSaved";
|
|
7
|
+
function c() {
|
|
8
|
+
let c = n(), l = c ? c.t(s, t) : t, u = i(l), d = i(null);
|
|
9
|
+
return r(() => {
|
|
10
|
+
u.current = l;
|
|
11
|
+
}, [l]), r(() => {
|
|
12
|
+
let t = () => {
|
|
13
|
+
let e = Date.now(), t = d.current;
|
|
14
|
+
t !== null && e - t < 3e3 || (d.current = e, a.warning(u.current, {
|
|
15
|
+
id: o,
|
|
16
|
+
duration: 7e3
|
|
17
|
+
}));
|
|
18
|
+
};
|
|
19
|
+
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
20
|
+
}, []), null;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { c as WorkspaceWriteRefusedToastListener };
|