@burdenoff/fe-libs 2026.928.2 → 2026.928.3
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/graphql/fetch.d.ts +12 -1
- package/dist/shared/graphql/fetch.d.ts.map +1 -1
- package/dist/shared/graphql/fetch.js +101 -80
- package/dist/shared/providers/shell/ActiveContextProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/ActiveContextProvider.js +28 -26
- package/dist/shared/providers/shell/PersonaSurfaceProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/PersonaSurfaceProvider.js +165 -193
- package/dist/shared/providers/shell/personaSurfaceRemote.d.ts +8 -2
- package/dist/shared/providers/shell/personaSurfaceRemote.d.ts.map +1 -1
- package/dist/shared/providers/shell/personaSurfaceRemote.js +37 -15
- package/dist/shared/providers/shell/useRemoteNavPreferences.d.ts +30 -0
- package/dist/shared/providers/shell/useRemoteNavPreferences.d.ts.map +1 -0
- package/dist/shared/providers/shell/useRemoteNavPreferences.js +43 -0
- package/package.json +2 -2
|
@@ -44,7 +44,13 @@ export interface GraphQLFetchOptions {
|
|
|
44
44
|
baseUrl?: string;
|
|
45
45
|
/** Additional headers to merge (overrides auto-detected values) */
|
|
46
46
|
extraHeaders?: Record<string, string>;
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* AbortSignal for cancellation. An aborted request is never sent: it is
|
|
49
|
+
* refused before a workspace token is minted, and dropped from the batching
|
|
50
|
+
* queue if it is still waiting there (BOFF-8094). React Query passes one to
|
|
51
|
+
* every `queryFn` and aborts it when the query key changes, so a request
|
|
52
|
+
* built for the previous workspace cannot leave after a workspace switch.
|
|
53
|
+
*/
|
|
48
54
|
signal?: AbortSignal;
|
|
49
55
|
/**
|
|
50
56
|
* Send with fetch `keepalive`, so the request outlives the page — for a
|
|
@@ -135,6 +141,11 @@ export declare function ensureWorkspaceToken(options: {
|
|
|
135
141
|
organizationId?: string;
|
|
136
142
|
projectId?: string;
|
|
137
143
|
locale?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Stops THIS caller waiting (it gets `null`). The mint itself is shared by
|
|
146
|
+
* every caller asking for the same context, so one caller's abort never
|
|
147
|
+
* cancels it for the others (BOFF-8094).
|
|
148
|
+
*/
|
|
138
149
|
signal?: AbortSignal;
|
|
139
150
|
currentQuery: string;
|
|
140
151
|
}): Promise<string | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../src/shared/graphql/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAY,KAAK,OAAO,EAAsB,MAAM,WAAW,CAAC;AAuBvE,MAAM,WAAW,mBAAmB;IAClC,wBAAwB;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,sDAAsD;IACtD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAA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;;;;;;;;;;;;GAsCG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAkQ7B"}
|
|
@@ -35,7 +35,7 @@ function x() {
|
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function ee() {
|
|
39
39
|
try {
|
|
40
40
|
let e = sessionStorage.getItem("bf-active-profile");
|
|
41
41
|
if (!e) return !1;
|
|
@@ -45,7 +45,7 @@ function S() {
|
|
|
45
45
|
return !1;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function S(e) {
|
|
49
49
|
try {
|
|
50
50
|
let [, t] = e.split(".");
|
|
51
51
|
if (!t || typeof globalThis.atob != "function") return null;
|
|
@@ -55,8 +55,8 @@ function C(e) {
|
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
let t =
|
|
58
|
+
function C(e) {
|
|
59
|
+
let t = S(e)?.exp;
|
|
60
60
|
return typeof t == "number" ? t * 1e3 <= Date.now() + 3e4 : !1;
|
|
61
61
|
}
|
|
62
62
|
function w() {
|
|
@@ -103,7 +103,7 @@ function A() {
|
|
|
103
103
|
return null;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function j(e) {
|
|
107
107
|
return {
|
|
108
108
|
workspaceId: typeof e.workspaceId == "string" ? e.workspaceId : E() || void 0,
|
|
109
109
|
organizationId: typeof e.organizationId == "string" ? e.organizationId : D() || A() || void 0,
|
|
@@ -111,14 +111,22 @@ function te(e) {
|
|
|
111
111
|
projectId: typeof e.projectId == "string" ? e.projectId : k() || void 0
|
|
112
112
|
};
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function M(e, t, n) {
|
|
115
115
|
try {
|
|
116
116
|
let r = a() ?? x();
|
|
117
117
|
if (!r) return;
|
|
118
118
|
o(r, t), sessionStorage.setItem("burdenoff-active-context-workspace", e), n && sessionStorage.setItem("burdenoff-active-context-organization", n);
|
|
119
119
|
} catch {}
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
function N(e, t, n) {
|
|
122
|
+
return t ? t.aborted ? Promise.resolve(n) : new Promise((r) => {
|
|
123
|
+
let i = () => r(n);
|
|
124
|
+
t.addEventListener("abort", i, { once: !0 }), e.then(r, () => r(n)).finally(() => {
|
|
125
|
+
t.removeEventListener("abort", i);
|
|
126
|
+
});
|
|
127
|
+
}) : e;
|
|
128
|
+
}
|
|
129
|
+
async function P(e) {
|
|
122
130
|
let { url: t, authToken: n, workspaceId: r, organizationId: i, projectId: a, locale: o, signal: s, currentQuery: c } = e;
|
|
123
131
|
if (!n || c.includes("issueWorkspaceToken")) return null;
|
|
124
132
|
let l = r || E();
|
|
@@ -130,7 +138,7 @@ async function M(e) {
|
|
|
130
138
|
projectId: a
|
|
131
139
|
})) return u;
|
|
132
140
|
let m = `${p ?? ""}:${l}:${a ?? ""}`, h = v.get(m);
|
|
133
|
-
if (h) return h;
|
|
141
|
+
if (h) return N(h, s, null);
|
|
134
142
|
let g = fetch(t, {
|
|
135
143
|
method: "POST",
|
|
136
144
|
headers: {
|
|
@@ -146,62 +154,67 @@ async function M(e) {
|
|
|
146
154
|
...p ? { organizationId: p } : {},
|
|
147
155
|
...a ? { projectId: a } : {}
|
|
148
156
|
} }
|
|
149
|
-
})
|
|
150
|
-
signal: s
|
|
157
|
+
})
|
|
151
158
|
}).then(async (e) => {
|
|
152
159
|
let t = (await e.json()).data?.issueWorkspaceToken;
|
|
153
|
-
return t?.success && t.token ? (
|
|
160
|
+
return t?.success && t.token ? (M(t.workspaceId || l, t.token, p ?? void 0), t.token) : null;
|
|
154
161
|
}).catch(() => null).finally(() => {
|
|
155
162
|
v.delete(m);
|
|
156
163
|
});
|
|
157
|
-
return v.set(m, g), g;
|
|
164
|
+
return v.set(m, g), N(g, s, null);
|
|
158
165
|
}
|
|
159
|
-
function
|
|
166
|
+
function F(e, n) {
|
|
160
167
|
let i = r[e], a = t(), o = e === "global" ? a.globalBaseUrl : a.workspaceBaseUrl, s = n || o;
|
|
161
168
|
return `${s.endsWith("/") ? s.slice(0, -1) : s}${i.graphql}`;
|
|
162
169
|
}
|
|
163
|
-
function
|
|
170
|
+
function I(e) {
|
|
171
|
+
return e.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
172
|
+
}
|
|
173
|
+
function L(e) {
|
|
174
|
+
if (e?.aborted) throw I(e);
|
|
175
|
+
}
|
|
176
|
+
function R() {
|
|
164
177
|
return globalThis;
|
|
165
178
|
}
|
|
166
|
-
function
|
|
167
|
-
let e =
|
|
179
|
+
function z() {
|
|
180
|
+
let e = R();
|
|
168
181
|
return e.__graphqlFetchQueues ||= /* @__PURE__ */ new Map(), e.__graphqlFetchQueues;
|
|
169
182
|
}
|
|
170
|
-
function
|
|
171
|
-
let e =
|
|
183
|
+
function B() {
|
|
184
|
+
let e = R();
|
|
172
185
|
return e.__graphqlFetchResponseCache ||= /* @__PURE__ */ new Map(), e.__graphqlFetchResponseCache;
|
|
173
186
|
}
|
|
174
|
-
function
|
|
175
|
-
let e =
|
|
187
|
+
function V() {
|
|
188
|
+
let e = R();
|
|
176
189
|
return e.__graphqlFetchPendingResponses ||= /* @__PURE__ */ new Map(), e.__graphqlFetchPendingResponses;
|
|
177
190
|
}
|
|
178
|
-
function
|
|
179
|
-
|
|
191
|
+
function H() {
|
|
192
|
+
B().clear(), V().clear(), n();
|
|
180
193
|
}
|
|
181
|
-
var
|
|
194
|
+
var te = 10, ne = 600, U = 100, re = 1e4, W = 15e3, ie = new Set([
|
|
182
195
|
"traceparent",
|
|
183
196
|
"tracestate",
|
|
184
197
|
"baggage"
|
|
185
198
|
]), G = "Apollo-Require-Preflight";
|
|
186
|
-
function
|
|
187
|
-
if (typeof performance > "u") return
|
|
188
|
-
let e =
|
|
189
|
-
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt <
|
|
199
|
+
function ae() {
|
|
200
|
+
if (typeof performance > "u") return U;
|
|
201
|
+
let e = R();
|
|
202
|
+
return e.__graphqlFetchBurstStartedAt ??= performance.now(), performance.now() - e.__graphqlFetchBurstStartedAt < re ? ne : U;
|
|
190
203
|
}
|
|
191
|
-
function
|
|
204
|
+
function oe(e) {
|
|
192
205
|
return typeof e.query == "string" ? /^\s*query\b/.test(e.query) : !1;
|
|
193
206
|
}
|
|
194
|
-
function
|
|
207
|
+
function se(e) {
|
|
195
208
|
return typeof e.operationName == "string" && e.operationName.length > 0 ? {
|
|
196
209
|
operationName: e.operationName,
|
|
197
210
|
variables: e.variables ?? null
|
|
198
211
|
} : e;
|
|
199
212
|
}
|
|
200
|
-
function
|
|
213
|
+
function ce(e) {
|
|
201
214
|
let t = /* @__PURE__ */ new Map();
|
|
202
215
|
for (let [n, r] of Object.entries(e)) {
|
|
203
216
|
let e = n.toLowerCase();
|
|
204
|
-
|
|
217
|
+
ie.has(e) || t.set(e, r);
|
|
205
218
|
}
|
|
206
219
|
return Object.fromEntries(Array.from(t.entries()).sort(([e], [t]) => e.localeCompare(t)));
|
|
207
220
|
}
|
|
@@ -214,13 +227,13 @@ function K(t) {
|
|
|
214
227
|
};
|
|
215
228
|
}
|
|
216
229
|
function q(e) {
|
|
217
|
-
return
|
|
230
|
+
return le(e) && Array.isArray(e.errors);
|
|
218
231
|
}
|
|
219
232
|
function J(e) {
|
|
220
233
|
let t = e.status;
|
|
221
234
|
return t === 401 ? "Invalid email or password." : t === 403 ? "You do not have permission to do that." : t === 404 ? "We could not find what you were looking for." : t === 408 || t === 504 ? "The server took too long to respond. Please try again." : t === 429 ? "Too many requests. Please wait a moment and try again." : t >= 500 && t < 600 ? "The server is having trouble right now. Please try again in a moment." : t >= 400 && t < 500 ? "The request could not be processed. Please refresh and try again." : "We could not reach the server. Please check your connection and try again.";
|
|
222
235
|
}
|
|
223
|
-
function
|
|
236
|
+
function le(e) {
|
|
224
237
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
225
238
|
}
|
|
226
239
|
async function Y(e) {
|
|
@@ -245,9 +258,9 @@ async function X(e, t, n) {
|
|
|
245
258
|
...r.keepalive ? { keepalive: !0 } : {}
|
|
246
259
|
}), i = await Y(n);
|
|
247
260
|
if (!n.ok && !q(i)) throw Error(J(n));
|
|
248
|
-
r.cacheKey && !q(i) &&
|
|
261
|
+
r.cacheKey && !q(i) && B().set(r.cacheKey, {
|
|
249
262
|
value: i,
|
|
250
|
-
expiresAt: Date.now() +
|
|
263
|
+
expiresAt: Date.now() + W
|
|
251
264
|
}), r.resolve(i);
|
|
252
265
|
} catch (e) {
|
|
253
266
|
r.reject(e);
|
|
@@ -265,9 +278,9 @@ async function X(e, t, n) {
|
|
|
265
278
|
if (!i.ok && !q(a)) throw Error(J(i));
|
|
266
279
|
if (Array.isArray(a)) a.forEach((e, t) => {
|
|
267
280
|
let r = n[t];
|
|
268
|
-
r && (r.cacheKey && !q(e) &&
|
|
281
|
+
r && (r.cacheKey && !q(e) && B().set(r.cacheKey, {
|
|
269
282
|
value: e,
|
|
270
|
-
expiresAt: Date.now() +
|
|
283
|
+
expiresAt: Date.now() + W
|
|
271
284
|
}), r.resolve(e));
|
|
272
285
|
});
|
|
273
286
|
else {
|
|
@@ -279,14 +292,15 @@ async function X(e, t, n) {
|
|
|
279
292
|
}
|
|
280
293
|
}
|
|
281
294
|
function Z(e, t, n, r, i) {
|
|
282
|
-
let a =
|
|
295
|
+
let a = ce(t), o = i?.keepalive === !0, s = o ? 1 : Math.max(1, i?.batchMax ?? te), c = Math.max(0, i?.batchInterval ?? ae()), l = `${e}|${JSON.stringify(a)}`, u = oe(n) ? `${l}|${JSON.stringify(se(n))}` : void 0;
|
|
296
|
+
if (r?.aborted) return Promise.reject(I(r));
|
|
283
297
|
if (u) {
|
|
284
|
-
let e =
|
|
298
|
+
let e = B(), t = e.get(u);
|
|
285
299
|
if (t) {
|
|
286
300
|
if (t.expiresAt > Date.now()) return Promise.resolve(t.value);
|
|
287
301
|
e.delete(u);
|
|
288
302
|
}
|
|
289
|
-
let n =
|
|
303
|
+
let n = V().get(u);
|
|
290
304
|
if (n) return n;
|
|
291
305
|
}
|
|
292
306
|
let d = new Promise((t, i) => {
|
|
@@ -301,90 +315,97 @@ function Z(e, t, n, r, i) {
|
|
|
301
315
|
}]);
|
|
302
316
|
return;
|
|
303
317
|
}
|
|
304
|
-
let d =
|
|
305
|
-
|
|
318
|
+
let d = z(), f = d.get(l);
|
|
319
|
+
f || (f = {
|
|
306
320
|
requests: [],
|
|
307
321
|
timer: null,
|
|
308
322
|
batchMax: s,
|
|
309
323
|
batchInterval: c
|
|
310
|
-
}, d.set(l, f))
|
|
324
|
+
}, d.set(l, f));
|
|
325
|
+
let p = {
|
|
311
326
|
body: n,
|
|
312
327
|
resolve: t,
|
|
313
328
|
reject: i,
|
|
314
329
|
signal: r,
|
|
315
330
|
cacheKey: u
|
|
316
|
-
}
|
|
331
|
+
};
|
|
332
|
+
if (f.requests.push(p), r && r.addEventListener("abort", () => {
|
|
333
|
+
let e = z().get(l), t = e ? e.requests.indexOf(p) : -1;
|
|
334
|
+
e && t >= 0 && (e.requests.splice(t, 1), e.requests.length === 0 && (e.timer && clearTimeout(e.timer), z().delete(l))), i(I(r));
|
|
335
|
+
}, { once: !0 }), f.requests.length >= f.batchMax) {
|
|
317
336
|
Q(e, a, l);
|
|
318
337
|
return;
|
|
319
338
|
}
|
|
320
339
|
f.timer ||= setTimeout(() => Q(e, a, l), f.batchInterval);
|
|
321
340
|
});
|
|
322
|
-
return u && (
|
|
323
|
-
|
|
341
|
+
return u && !r && (V().set(u, d), d.finally(() => {
|
|
342
|
+
V().delete(u);
|
|
324
343
|
}).catch(() => {})), d;
|
|
325
344
|
}
|
|
326
345
|
function Q(e, t, n) {
|
|
327
|
-
let r =
|
|
346
|
+
let r = z(), i = r.get(n);
|
|
328
347
|
i && (r.delete(n), i.timer &&= (clearTimeout(i.timer), null), X(e, t, i.requests));
|
|
329
348
|
}
|
|
330
349
|
async function $(e) {
|
|
331
|
-
let { gateway: n, query: r, variables: i, operationName: a, authToken: o, workspaceToken: s, workspaceId: c, organizationId: u, tenantId: h, projectId: _, locale: v, baseUrl: x, extraHeaders:
|
|
332
|
-
|
|
350
|
+
let { gateway: n, query: r, variables: i, operationName: a, authToken: o, workspaceToken: s, workspaceId: c, organizationId: u, tenantId: h, projectId: _, locale: v, baseUrl: x, extraHeaders: S, signal: E, suppressGlobalErrorEvent: D, keepalive: k } = e;
|
|
351
|
+
L(E);
|
|
352
|
+
let A = d(F(n, x)), M = o && !C(o) ? o : y();
|
|
353
|
+
if (!M && !e.skipAuthRetry && typeof window < "u" && !window.location.pathname.startsWith("/auth/") && ee()) {
|
|
333
354
|
let e = await import("../utils/authErrorHandling.js");
|
|
334
355
|
await e.attemptTokenRefresh({
|
|
335
356
|
globalBaseUrl: n === "global" && x ? x : t().globalBaseUrl,
|
|
336
357
|
...e.getSharedTokenRefreshRefs()
|
|
337
|
-
}) ?
|
|
358
|
+
}) ? M = y() : g({
|
|
338
359
|
operationName: a,
|
|
339
360
|
gateway: n
|
|
340
|
-
});
|
|
361
|
+
}), L(E);
|
|
341
362
|
}
|
|
342
|
-
let
|
|
363
|
+
let N = v ?? T(), I = j({
|
|
343
364
|
workspaceId: c,
|
|
344
365
|
organizationId: u,
|
|
345
366
|
tenantId: h,
|
|
346
367
|
projectId: _
|
|
347
|
-
}),
|
|
368
|
+
}), R = {
|
|
348
369
|
"Content-Type": "application/json",
|
|
349
370
|
[G]: "true"
|
|
350
371
|
};
|
|
351
|
-
|
|
352
|
-
let
|
|
353
|
-
if (
|
|
372
|
+
M && (R.Authorization = `Bearer ${M}`), N && (R["Accept-Language"] = N);
|
|
373
|
+
let z = w();
|
|
374
|
+
if (z?.country && (R["X-Geo-Country"] = z.country), z?.currency && (R["X-Geo-Currency"] = z.currency), z?.timezone && (R["X-Geo-Timezone"] = z.timezone), n === "workspace" ? s !== !1 : s) {
|
|
354
375
|
let e = typeof s == "string" ? s : b();
|
|
355
|
-
e && !f(e,
|
|
376
|
+
e && !f(e, I) && (e = null), !e && (s === !0 || n === "workspace" && s === void 0 || typeof s == "string") && (e = await P({
|
|
356
377
|
url: A,
|
|
357
|
-
authToken:
|
|
358
|
-
workspaceId:
|
|
359
|
-
organizationId:
|
|
360
|
-
projectId:
|
|
361
|
-
locale:
|
|
378
|
+
authToken: M,
|
|
379
|
+
workspaceId: I.workspaceId,
|
|
380
|
+
organizationId: I.organizationId,
|
|
381
|
+
projectId: I.projectId,
|
|
382
|
+
locale: N,
|
|
362
383
|
signal: E,
|
|
363
384
|
currentQuery: r
|
|
364
|
-
})), e && (
|
|
385
|
+
}), L(E)), e && (R["X-Workspace-Authorization"] = `Bearer ${e}`);
|
|
365
386
|
}
|
|
366
387
|
if (n === "workspace" || c) {
|
|
367
|
-
let e =
|
|
368
|
-
e && (
|
|
388
|
+
let e = I.workspaceId;
|
|
389
|
+
e && (R["x-workspace-id"] = e);
|
|
369
390
|
}
|
|
370
391
|
if (n === "global" || u) {
|
|
371
|
-
let e =
|
|
372
|
-
e && (
|
|
392
|
+
let e = I.organizationId;
|
|
393
|
+
e && (R["x-org-id"] = e);
|
|
373
394
|
}
|
|
374
395
|
if (h) {
|
|
375
396
|
let e = typeof h == "string" ? h : O();
|
|
376
|
-
e && (
|
|
397
|
+
e && (R["x-tenant-id"] = e);
|
|
377
398
|
}
|
|
378
399
|
if (n === "workspace" || _) {
|
|
379
|
-
let e =
|
|
380
|
-
e && (
|
|
400
|
+
let e = I.projectId;
|
|
401
|
+
e && (R["x-project-id"] = e);
|
|
381
402
|
}
|
|
382
|
-
let
|
|
383
|
-
|
|
384
|
-
let
|
|
385
|
-
i && (
|
|
386
|
-
let
|
|
387
|
-
if (e.skipAuthRetry || !
|
|
403
|
+
let B = l(S);
|
|
404
|
+
B && Object.assign(R, B);
|
|
405
|
+
let V = { query: r };
|
|
406
|
+
i && (V.variables = i), a && (V.operationName = a);
|
|
407
|
+
let H = async (r) => {
|
|
408
|
+
if (e.skipAuthRetry || !M || typeof window > "u" || !r?.length) return null;
|
|
388
409
|
let i = await import("../utils/authErrorHandling.js");
|
|
389
410
|
return i.hasAuthGraphQLErrors(r) ? await i.attemptTokenRefresh({
|
|
390
411
|
globalBaseUrl: n === "global" && x ? x : t().globalBaseUrl,
|
|
@@ -400,9 +421,9 @@ async function $(e) {
|
|
|
400
421
|
}), null) : null;
|
|
401
422
|
};
|
|
402
423
|
try {
|
|
403
|
-
let e = await Z(A,
|
|
424
|
+
let e = await Z(A, R, V, E, k ? { keepalive: !0 } : void 0);
|
|
404
425
|
if (m(), e.errors?.length) {
|
|
405
|
-
let t = await
|
|
426
|
+
let t = await H(e.errors);
|
|
406
427
|
if (t) return t;
|
|
407
428
|
D || p({ errors: e.errors }, { operationName: a });
|
|
408
429
|
}
|
|
@@ -410,7 +431,7 @@ async function $(e) {
|
|
|
410
431
|
} catch (e) {
|
|
411
432
|
let t = e.errors;
|
|
412
433
|
if (t?.length) {
|
|
413
|
-
let e = await
|
|
434
|
+
let e = await H(t);
|
|
414
435
|
if (e) return e;
|
|
415
436
|
}
|
|
416
437
|
throw D || p(e, {
|
|
@@ -420,4 +441,4 @@ async function $(e) {
|
|
|
420
441
|
}
|
|
421
442
|
}
|
|
422
443
|
//#endregion
|
|
423
|
-
export { h as SESSION_EXPIRED_EVENT,
|
|
444
|
+
export { h as SESSION_EXPIRED_EVENT, H as clearGraphqlFetchResponseCache, Z as enqueueGraphQLFetch, P as ensureWorkspaceToken, y as getStoredAuthToken, T as getStoredLocale, D as getStoredOrganizationId, k as getStoredProjectId, E as getStoredWorkspaceId, b as getStoredWorkspaceToken, $ as graphqlFetch, F as resolveGatewayUrl };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveContextProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/ActiveContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,
|
|
1
|
+
{"version":3,"file":"ActiveContextProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/ActiveContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAUL,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAGhC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,sCAAsC;IACtC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,oCAAoC;IACpC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,mCAAmC;IACnC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,kCAAkC;IAClC,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAChD,+BAA+B;IAC/B,YAAY,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACnD,6BAA6B;IAC7B,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC/C,4BAA4B;IAC5B,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAE7C,qCAAqC;IACrC,UAAU,EAAE,CACV,OAAO,EAAE,OAAO,CAAC;QACf,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC,KACC,IAAI,CAAC;IAEV,+BAA+B;IAC/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O,CAsCT;AAsBD,MAAM,WAAW,4BAA4B;IAC3C,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,4BAA4B,EACtC,SAAS,EAAE,wBAAwB,GAClC,4BAA4B,CAY9B;AAgBD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,sBAAsB,CAAC;CACnC,GAAG,4BAA4B,CAsC/B;AAwCD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAInD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,qBAA4B,EAC5B,kBAAyB,EACzB,gBAAuB,EACvB,eAAsB,EACtB,UAAuC,EACvC,SAAiB,EACjB,SAA6C,GAC9C,EAAE,0BAA0B,2CAqZ5B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,uBAM/B"}
|
|
@@ -168,71 +168,73 @@ function k({ children: c, defaultOrganizationId: d = null, defaultWorkspaceId: f
|
|
|
168
168
|
F,
|
|
169
169
|
L
|
|
170
170
|
]);
|
|
171
|
-
let U = m((
|
|
171
|
+
let U = m((e, t) => {
|
|
172
|
+
T && D({ [k[e] ?? i[e]]: t });
|
|
173
|
+
}, [T, k]), W = m((r) => {
|
|
172
174
|
if (!C("organizationId", z.current, r, Date.now())) return;
|
|
173
|
-
M(r);
|
|
175
|
+
M(r), u("organization", r, w), U("organization", r);
|
|
174
176
|
let i = t();
|
|
175
177
|
i && n(i, {
|
|
176
178
|
...e(i),
|
|
177
179
|
organizationId: r
|
|
178
180
|
}), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:organization-changed", { detail: { organizationId: r } }));
|
|
179
|
-
}, []),
|
|
181
|
+
}, [w, U]), G = m((r, i) => {
|
|
180
182
|
let a = {
|
|
181
183
|
organization: "organizationId",
|
|
182
184
|
workspace: "workspaceId",
|
|
183
185
|
project: "projectId",
|
|
184
186
|
tenant: "tenantId"
|
|
185
187
|
};
|
|
186
|
-
u(r, i, w);
|
|
188
|
+
u(r, i, w), U(r, i);
|
|
187
189
|
let o = t();
|
|
188
190
|
o ? n(o, {
|
|
189
191
|
...e(o),
|
|
190
192
|
[a[r]]: i
|
|
191
193
|
}) : typeof window < "u" && l(r, i, w);
|
|
192
|
-
}, [w]),
|
|
193
|
-
C("workspaceId", B.current, e, Date.now()) && (P(e),
|
|
194
|
-
}, [
|
|
195
|
-
C("projectId", V.current, e, Date.now()) && (I(e),
|
|
196
|
-
}, [
|
|
197
|
-
C("tenantId", H.current, e, Date.now()) && (R(e),
|
|
198
|
-
}, [
|
|
199
|
-
e.organizationId !== void 0 &&
|
|
194
|
+
}, [w, U]), K = m((e) => {
|
|
195
|
+
C("workspaceId", B.current, e, Date.now()) && (P(e), G("workspace", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:workspace-changed", { detail: { workspaceId: e } })));
|
|
196
|
+
}, [G]), q = m((e) => {
|
|
197
|
+
C("projectId", V.current, e, Date.now()) && (I(e), G("project", e), typeof window < "u" && window.dispatchEvent(new CustomEvent("burdenoff:project-changed", { detail: { projectId: e } })));
|
|
198
|
+
}, [G]), J = m((e) => {
|
|
199
|
+
C("tenantId", H.current, e, Date.now()) && (R(e), G("tenant", e));
|
|
200
|
+
}, [G]), Y = m((e) => {
|
|
201
|
+
e.organizationId !== void 0 && W(e.organizationId), e.workspaceId !== void 0 && K(e.workspaceId), e.projectId !== void 0 && q(e.projectId), e.tenantId !== void 0 && J(e.tenantId);
|
|
200
202
|
}, [
|
|
201
|
-
|
|
202
|
-
G,
|
|
203
|
+
W,
|
|
203
204
|
K,
|
|
204
|
-
q
|
|
205
|
-
|
|
205
|
+
q,
|
|
206
|
+
J
|
|
207
|
+
]), X = m(() => {
|
|
206
208
|
M(null), P(null), I(null), R(null), z.current = x(null), B.current = x(null), V.current = x(null), H.current = x(null), a(w);
|
|
207
209
|
let e = t();
|
|
208
210
|
e && n(e, {});
|
|
209
|
-
}, [w]),
|
|
211
|
+
}, [w]), Z = g(() => ({
|
|
210
212
|
organizationId: j,
|
|
211
213
|
workspaceId: N,
|
|
212
214
|
projectId: F,
|
|
213
215
|
tenantId: L,
|
|
214
|
-
setOrganization:
|
|
215
|
-
setWorkspace:
|
|
216
|
-
setProject:
|
|
217
|
-
setTenant:
|
|
218
|
-
setContext:
|
|
219
|
-
clearContext:
|
|
216
|
+
setOrganization: W,
|
|
217
|
+
setWorkspace: K,
|
|
218
|
+
setProject: q,
|
|
219
|
+
setTenant: J,
|
|
220
|
+
setContext: Y,
|
|
221
|
+
clearContext: X,
|
|
220
222
|
urlSyncEnabled: T
|
|
221
223
|
}), [
|
|
222
224
|
j,
|
|
223
225
|
N,
|
|
224
226
|
F,
|
|
225
227
|
L,
|
|
226
|
-
|
|
227
|
-
G,
|
|
228
|
+
W,
|
|
228
229
|
K,
|
|
229
230
|
q,
|
|
230
231
|
J,
|
|
231
232
|
Y,
|
|
233
|
+
X,
|
|
232
234
|
T
|
|
233
235
|
]);
|
|
234
236
|
return /* @__PURE__ */ y(b.Provider, {
|
|
235
|
-
value:
|
|
237
|
+
value: Z,
|
|
236
238
|
children: c
|
|
237
239
|
});
|
|
238
240
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonaSurfaceProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/PersonaSurfaceProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"PersonaSurfaceProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/PersonaSurfaceProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiBf,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MA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gB,iBAAiB,IAAI,0BAA0B,CAM9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,0BAA0B,GAAG,IAAI,CAEzE"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { createContext as a, use as o, useCallback as s, useEffect as c, useMemo as l,
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useQuery as
|
|
1
|
+
import { useHasAuthToken as e } from "../../graphql/useHasAuthToken.js";
|
|
2
|
+
import { useSafePermissions as t } from "./PermissionProvider.js";
|
|
3
|
+
import { createNavView as n, deleteNavView as r, fetchSimulatableRoles as i, updateNavView as ee } from "./personaSurfaceRemote.js";
|
|
4
|
+
import { useRemoteNavPreferences as te } from "./useRemoteNavPreferences.js";
|
|
5
|
+
import { createContext as a, use as o, useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
6
|
+
import { jsx as ne } from "react/jsx-runtime";
|
|
7
|
+
import { useQuery as re } from "@tanstack/react-query";
|
|
8
8
|
//#region src/shared/providers/shell/PersonaSurfaceProvider.tsx
|
|
9
|
-
var
|
|
9
|
+
var d = "everything", f = a(null), p = [
|
|
10
10
|
"read",
|
|
11
11
|
"list",
|
|
12
12
|
"download",
|
|
13
13
|
"join",
|
|
14
14
|
"leave",
|
|
15
15
|
"vote"
|
|
16
|
-
],
|
|
17
|
-
...
|
|
16
|
+
], m = [
|
|
17
|
+
...p,
|
|
18
18
|
"create",
|
|
19
19
|
"update",
|
|
20
20
|
"share",
|
|
@@ -28,7 +28,7 @@ var f = "everything", p = a(null), m = [
|
|
|
28
28
|
"upload",
|
|
29
29
|
"sync"
|
|
30
30
|
];
|
|
31
|
-
function
|
|
31
|
+
function h(e) {
|
|
32
32
|
let t = [];
|
|
33
33
|
for (let n of e.defaultPermissions) {
|
|
34
34
|
if (n.level === "NONE") continue;
|
|
@@ -36,27 +36,27 @@ function g(e) {
|
|
|
36
36
|
t.push(`${n.resourceType}:*`);
|
|
37
37
|
continue;
|
|
38
38
|
}
|
|
39
|
-
let e = n.level === "EDITOR" ?
|
|
39
|
+
let e = n.level === "EDITOR" ? m : p;
|
|
40
40
|
for (let r of e) t.push(`${n.resourceType}:${r}`);
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
if (t.length === 0) return
|
|
44
|
+
function g(e, t) {
|
|
45
|
+
if (t.length === 0) return d;
|
|
46
46
|
let n = new Set(t);
|
|
47
47
|
for (let t of e) if (t.roleNames.some((e) => n.has(e))) return t.id;
|
|
48
|
-
return
|
|
48
|
+
return d;
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function ie(e, t) {
|
|
51
51
|
if (t.templateKey) {
|
|
52
52
|
for (let n of e) if (n.templateKeys?.includes(t.templateKey)) return n.id;
|
|
53
53
|
}
|
|
54
|
-
return
|
|
54
|
+
return g(e, [t.roleName]);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function ae(e, t) {
|
|
57
57
|
return `boff-persona:${e}:${t ?? "no-scope"}`;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function _(e) {
|
|
60
60
|
if (typeof window > "u") return {};
|
|
61
61
|
try {
|
|
62
62
|
let t = window.localStorage.getItem(e);
|
|
@@ -67,120 +67,92 @@ function v(e) {
|
|
|
67
67
|
return {};
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function v(e, t) {
|
|
71
71
|
if (!(typeof window > "u")) try {
|
|
72
72
|
let n = Object.values(t.overridesBySurface ?? {}).some((e) => Object.keys(e).length > 0);
|
|
73
73
|
!t.surfaceId && !n ? window.localStorage.removeItem(e) : window.localStorage.setItem(e, JSON.stringify(t));
|
|
74
74
|
} catch {}
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
let x = n(), S = x?.scopeId ?? null, C = oe(m, S), w = b === "remote", [T, E] = u(() => v(C));
|
|
79
|
-
c(() => {
|
|
80
|
-
E(v(C));
|
|
81
|
-
}, [C]);
|
|
82
|
-
let [D, O] = u([]);
|
|
76
|
+
function y({ children: a, surfaces: o, productKey: p, gateway: m = "workspace", persistence: y = "local" }) {
|
|
77
|
+
let b = t(), x = b?.scopeId ?? null, S = ae(p, x), C = y === "remote", [w, T] = u(() => _(S));
|
|
83
78
|
c(() => {
|
|
84
|
-
|
|
79
|
+
T(_(S));
|
|
85
80
|
}, [S]);
|
|
86
|
-
let
|
|
87
|
-
queryKey: [
|
|
88
|
-
"persona-nav-preferences",
|
|
89
|
-
h,
|
|
90
|
-
S,
|
|
91
|
-
m
|
|
92
|
-
],
|
|
93
|
-
queryFn: () => ee(h, S, m),
|
|
94
|
-
enabled: w && !!S && !!x && ce,
|
|
95
|
-
staleTime: 60 * 1e3,
|
|
96
|
-
retry: 2
|
|
97
|
-
}), { data: A } = k;
|
|
81
|
+
let [E, D] = u([]);
|
|
98
82
|
c(() => {
|
|
99
|
-
|
|
83
|
+
D([]);
|
|
84
|
+
}, [x]);
|
|
85
|
+
let oe = e(), { data: O, schedulePush: k } = te({
|
|
86
|
+
gateway: m,
|
|
87
|
+
scopeId: x,
|
|
88
|
+
productKey: p,
|
|
89
|
+
enabled: C && !!x && !!b && oe
|
|
90
|
+
});
|
|
91
|
+
c(() => {
|
|
92
|
+
if (!O) return;
|
|
100
93
|
let e = {
|
|
101
|
-
surfaceId:
|
|
102
|
-
overridesBySurface:
|
|
94
|
+
surfaceId: O.activeViewId ?? void 0,
|
|
95
|
+
overridesBySurface: O.overridesByView
|
|
103
96
|
};
|
|
104
|
-
|
|
105
|
-
}, [
|
|
106
|
-
let
|
|
107
|
-
!
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
activeViewId: e.surfaceId ?? null,
|
|
112
|
-
overridesByView: e.overridesBySurface ?? {}
|
|
113
|
-
}).catch(() => {});
|
|
114
|
-
}, 700));
|
|
97
|
+
T(e), v(S, e), D(O.customViews);
|
|
98
|
+
}, [O, S]);
|
|
99
|
+
let A = s((e) => {
|
|
100
|
+
!C || !x || k({
|
|
101
|
+
activeViewId: e.surfaceId ?? null,
|
|
102
|
+
overridesByView: e.overridesBySurface ?? {}
|
|
103
|
+
});
|
|
115
104
|
}, [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
c(() => () => {
|
|
122
|
-
j.current && clearTimeout(j.current);
|
|
123
|
-
}, []);
|
|
124
|
-
let N = s((e) => {
|
|
125
|
-
E((t) => {
|
|
105
|
+
C,
|
|
106
|
+
x,
|
|
107
|
+
k
|
|
108
|
+
]), j = s((e) => {
|
|
109
|
+
T((t) => {
|
|
126
110
|
let n = e(t);
|
|
127
|
-
return
|
|
111
|
+
return v(S, n), A(n), n;
|
|
128
112
|
});
|
|
129
|
-
}, [
|
|
113
|
+
}, [S, A]), [M, N] = u(null), [P, F] = u(!1);
|
|
130
114
|
c(() => {
|
|
131
|
-
|
|
132
|
-
}, [
|
|
133
|
-
let
|
|
115
|
+
N(null), F(!1);
|
|
116
|
+
}, [x]);
|
|
117
|
+
let I = b?.isSuperAdmin ?? !1, L = !!b && (I || b.hasPermission("rbac:read")), R = re({
|
|
134
118
|
queryKey: [
|
|
135
119
|
"persona-simulatable-roles",
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
120
|
+
m,
|
|
121
|
+
x,
|
|
122
|
+
p
|
|
139
123
|
],
|
|
140
|
-
queryFn:
|
|
141
|
-
|
|
142
|
-
query: se,
|
|
143
|
-
variables: {
|
|
144
|
-
scopeId: S,
|
|
145
|
-
filter: { product: m },
|
|
146
|
-
pagination: { limit: 100 }
|
|
147
|
-
},
|
|
148
|
-
gateway: h
|
|
149
|
-
});
|
|
150
|
-
if (t.errors?.length) throw Error(t.errors[0].message);
|
|
151
|
-
return [...t.data?.roles ?? []].sort((e, t) => t.priority - e.priority);
|
|
152
|
-
},
|
|
153
|
-
enabled: I && z && !!S,
|
|
124
|
+
queryFn: ({ signal: e }) => i(m, x, p, e),
|
|
125
|
+
enabled: P && L && !!x,
|
|
154
126
|
staleTime: 300 * 1e3
|
|
155
|
-
}),
|
|
156
|
-
|
|
157
|
-
}, []),
|
|
158
|
-
|
|
127
|
+
}), z = s(() => {
|
|
128
|
+
F(!0);
|
|
129
|
+
}, []), B = s((e) => {
|
|
130
|
+
N({
|
|
159
131
|
roleId: e.id,
|
|
160
132
|
roleName: e.name,
|
|
161
133
|
templateKey: e.templateKey,
|
|
162
|
-
permissionStrings:
|
|
134
|
+
permissionStrings: h(e)
|
|
163
135
|
});
|
|
164
|
-
}, []),
|
|
165
|
-
|
|
166
|
-
}, []),
|
|
136
|
+
}, []), V = s(() => {
|
|
137
|
+
N(null);
|
|
138
|
+
}, []), H = l(() => b?.permissions?.roles ?? [], [b?.permissions?.roles]), U = l(() => M ? ie(o, M) : g(o, H), [
|
|
167
139
|
o,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
]),
|
|
171
|
-
if (
|
|
172
|
-
let e =
|
|
173
|
-
return e && (e === "everything" || o.some((t) => t.id === e) ||
|
|
140
|
+
M,
|
|
141
|
+
H
|
|
142
|
+
]), W = l(() => {
|
|
143
|
+
if (M) return U;
|
|
144
|
+
let e = w.surfaceId;
|
|
145
|
+
return e && (e === "everything" || o.some((t) => t.id === e) || E.some((t) => t.id === e)) ? e : U;
|
|
174
146
|
}, [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
147
|
+
M,
|
|
148
|
+
U,
|
|
149
|
+
w.surfaceId,
|
|
178
150
|
o,
|
|
179
|
-
|
|
180
|
-
]),
|
|
181
|
-
let e = o.find((e) => e.id ===
|
|
151
|
+
E
|
|
152
|
+
]), G = l(() => {
|
|
153
|
+
let e = o.find((e) => e.id === W);
|
|
182
154
|
if (e) return e;
|
|
183
|
-
let t =
|
|
155
|
+
let t = E.find((e) => e.id === W);
|
|
184
156
|
return t ? {
|
|
185
157
|
id: t.id,
|
|
186
158
|
label: t.name,
|
|
@@ -190,47 +162,47 @@ function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace",
|
|
|
190
162
|
} : null;
|
|
191
163
|
}, [
|
|
192
164
|
o,
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
]),
|
|
196
|
-
let e = new Set(
|
|
197
|
-
return [...o.filter((t) =>
|
|
165
|
+
E,
|
|
166
|
+
W
|
|
167
|
+
]), K = l(() => {
|
|
168
|
+
let e = new Set(H);
|
|
169
|
+
return [...o.filter((t) => I || t.roleNames.some((t) => e.has(t))).map((e) => e.id), d];
|
|
198
170
|
}, [
|
|
199
171
|
o,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
]),
|
|
203
|
-
|
|
172
|
+
I,
|
|
173
|
+
H
|
|
174
|
+
]), q = s((e) => {
|
|
175
|
+
j((t) => ({
|
|
204
176
|
...t,
|
|
205
177
|
surfaceId: e ?? void 0
|
|
206
178
|
}));
|
|
207
|
-
}, [
|
|
208
|
-
|
|
209
|
-
let r = { ...n.overridesBySurface ?? {} }, i = { ...r[
|
|
210
|
-
return t === null ? delete i[e] : i[e] = t, Object.keys(i).length === 0 ? delete r[
|
|
179
|
+
}, [j]), J = l(() => w.overridesBySurface?.[W] ?? {}, [w.overridesBySurface, W]), Y = s((e, t) => {
|
|
180
|
+
j((n) => {
|
|
181
|
+
let r = { ...n.overridesBySurface ?? {} }, i = { ...r[W] ?? {} };
|
|
182
|
+
return t === null ? delete i[e] : i[e] = t, Object.keys(i).length === 0 ? delete r[W] : r[W] = i, {
|
|
211
183
|
...n,
|
|
212
184
|
overridesBySurface: r
|
|
213
185
|
};
|
|
214
186
|
});
|
|
215
|
-
}, [
|
|
216
|
-
|
|
187
|
+
}, [j, W]), X = s(() => {
|
|
188
|
+
j((e) => {
|
|
217
189
|
let t = { ...e.overridesBySurface ?? {} };
|
|
218
|
-
return delete t[
|
|
190
|
+
return delete t[W], {
|
|
219
191
|
...e,
|
|
220
192
|
overridesBySurface: t
|
|
221
193
|
};
|
|
222
194
|
});
|
|
223
|
-
}, [
|
|
224
|
-
if (!
|
|
195
|
+
}, [j, W]), [Z, se] = u(!1), Q = C && !!x && !!O, $ = s(async (e, t, r) => {
|
|
196
|
+
if (!C || !x) return null;
|
|
225
197
|
try {
|
|
226
|
-
let i = await
|
|
227
|
-
workspaceId:
|
|
228
|
-
productSlug:
|
|
198
|
+
let i = await n(m, {
|
|
199
|
+
workspaceId: x,
|
|
200
|
+
productSlug: p,
|
|
229
201
|
name: e,
|
|
230
202
|
visibleItems: t,
|
|
231
|
-
homePath:
|
|
203
|
+
homePath: r ?? null
|
|
232
204
|
});
|
|
233
|
-
return
|
|
205
|
+
return D((e) => [...e, i]), j((e) => ({
|
|
234
206
|
...e,
|
|
235
207
|
surfaceId: i.id
|
|
236
208
|
})), i;
|
|
@@ -238,19 +210,19 @@ function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace",
|
|
|
238
210
|
return null;
|
|
239
211
|
}
|
|
240
212
|
}, [
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
h,
|
|
213
|
+
C,
|
|
214
|
+
x,
|
|
244
215
|
m,
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
216
|
+
p,
|
|
217
|
+
j
|
|
218
|
+
]), ce = s(async (e, t) => {
|
|
219
|
+
if (!C || !x) return !1;
|
|
248
220
|
try {
|
|
249
|
-
let n = await
|
|
250
|
-
workspaceId:
|
|
221
|
+
let n = await ee(m, e, {
|
|
222
|
+
workspaceId: x,
|
|
251
223
|
name: t
|
|
252
224
|
});
|
|
253
|
-
return
|
|
225
|
+
return D((t) => t.map((t) => t.id === e ? {
|
|
254
226
|
...t,
|
|
255
227
|
name: n.name
|
|
256
228
|
} : t)), !0;
|
|
@@ -258,13 +230,13 @@ function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace",
|
|
|
258
230
|
return !1;
|
|
259
231
|
}
|
|
260
232
|
}, [
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
]),
|
|
265
|
-
if (!
|
|
233
|
+
C,
|
|
234
|
+
x,
|
|
235
|
+
m
|
|
236
|
+
]), le = s(async (e) => {
|
|
237
|
+
if (!C || !x) return !1;
|
|
266
238
|
try {
|
|
267
|
-
return await
|
|
239
|
+
return await r(m, e, x), D((t) => t.filter((t) => t.id !== e)), j((t) => {
|
|
268
240
|
let n = { ...t.overridesBySurface ?? {} };
|
|
269
241
|
return delete n[e], {
|
|
270
242
|
surfaceId: t.surfaceId === e ? void 0 : t.surfaceId,
|
|
@@ -275,71 +247,71 @@ function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace",
|
|
|
275
247
|
return !1;
|
|
276
248
|
}
|
|
277
249
|
}, [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
]),
|
|
250
|
+
C,
|
|
251
|
+
x,
|
|
252
|
+
m,
|
|
253
|
+
j
|
|
254
|
+
]), ue = l(() => ({
|
|
283
255
|
surfaces: o,
|
|
284
|
-
activeSurfaceId:
|
|
285
|
-
activeSurface:
|
|
286
|
-
resolvedSurfaceId:
|
|
287
|
-
availableSurfaceIds:
|
|
288
|
-
setSurfaceId:
|
|
289
|
-
overrides:
|
|
290
|
-
setItemOverride:
|
|
291
|
-
resetOverrides:
|
|
292
|
-
customizeOpen:
|
|
293
|
-
setCustomizeOpen:
|
|
294
|
-
canSimulate:
|
|
295
|
-
simulation:
|
|
296
|
-
startSimulation:
|
|
297
|
-
stopSimulation:
|
|
298
|
-
simulatableRoles:
|
|
299
|
-
simulatableRolesLoading:
|
|
300
|
-
loadSimulatableRoles:
|
|
301
|
-
customViews:
|
|
302
|
-
canManageViews:
|
|
303
|
-
createCustomView:
|
|
304
|
-
renameCustomView:
|
|
305
|
-
deleteCustomView:
|
|
256
|
+
activeSurfaceId: W,
|
|
257
|
+
activeSurface: G,
|
|
258
|
+
resolvedSurfaceId: U,
|
|
259
|
+
availableSurfaceIds: K,
|
|
260
|
+
setSurfaceId: q,
|
|
261
|
+
overrides: J,
|
|
262
|
+
setItemOverride: Y,
|
|
263
|
+
resetOverrides: X,
|
|
264
|
+
customizeOpen: Z,
|
|
265
|
+
setCustomizeOpen: se,
|
|
266
|
+
canSimulate: L,
|
|
267
|
+
simulation: M,
|
|
268
|
+
startSimulation: B,
|
|
269
|
+
stopSimulation: V,
|
|
270
|
+
simulatableRoles: R.data ?? [],
|
|
271
|
+
simulatableRolesLoading: R.isLoading && P,
|
|
272
|
+
loadSimulatableRoles: z,
|
|
273
|
+
customViews: E,
|
|
274
|
+
canManageViews: Q,
|
|
275
|
+
createCustomView: $,
|
|
276
|
+
renameCustomView: ce,
|
|
277
|
+
deleteCustomView: le
|
|
306
278
|
}), [
|
|
307
279
|
o,
|
|
280
|
+
W,
|
|
308
281
|
G,
|
|
282
|
+
U,
|
|
309
283
|
K,
|
|
310
|
-
W,
|
|
311
284
|
q,
|
|
312
285
|
J,
|
|
313
286
|
Y,
|
|
314
287
|
X,
|
|
315
288
|
Z,
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
H,
|
|
320
|
-
le,
|
|
321
|
-
B.data,
|
|
322
|
-
B.isLoading,
|
|
323
|
-
I,
|
|
289
|
+
L,
|
|
290
|
+
M,
|
|
291
|
+
B,
|
|
324
292
|
V,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
293
|
+
R.data,
|
|
294
|
+
R.isLoading,
|
|
295
|
+
P,
|
|
296
|
+
z,
|
|
297
|
+
E,
|
|
298
|
+
Q,
|
|
299
|
+
$,
|
|
300
|
+
ce,
|
|
301
|
+
le
|
|
330
302
|
]);
|
|
331
|
-
return /* @__PURE__ */
|
|
332
|
-
value:
|
|
303
|
+
return /* @__PURE__ */ ne(f.Provider, {
|
|
304
|
+
value: ue,
|
|
333
305
|
children: a
|
|
334
306
|
});
|
|
335
307
|
}
|
|
336
|
-
function
|
|
337
|
-
let e = o(
|
|
308
|
+
function b() {
|
|
309
|
+
let e = o(f);
|
|
338
310
|
if (!e) throw Error("usePersonaSurface must be used within a PersonaSurfaceProvider");
|
|
339
311
|
return e;
|
|
340
312
|
}
|
|
341
|
-
function
|
|
342
|
-
return o(
|
|
313
|
+
function x() {
|
|
314
|
+
return o(f);
|
|
343
315
|
}
|
|
344
316
|
//#endregion
|
|
345
|
-
export {
|
|
317
|
+
export { d as EVERYTHING_SURFACE_ID, y as PersonaSurfaceProvider, g as resolveSurfaceForRoles, h as synthesizeSimulatedPermissionStrings, b as usePersonaSurface, x as useSafePersonaSurface };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NavItemOverrideState } from './PersonaSurfaceProvider';
|
|
1
|
+
import { NavItemOverrideState, SimulatableRole } from './PersonaSurfaceProvider';
|
|
2
2
|
export interface RemoteCustomView {
|
|
3
3
|
id: string;
|
|
4
4
|
productSlug: string;
|
|
@@ -12,7 +12,7 @@ export interface RemoteNavPreferences {
|
|
|
12
12
|
customViews: RemoteCustomView[];
|
|
13
13
|
}
|
|
14
14
|
type Gateway = 'workspace' | 'global';
|
|
15
|
-
export declare function fetchNavPreferences(gateway: Gateway, workspaceId: string, productSlug: string): Promise<RemoteNavPreferences>;
|
|
15
|
+
export declare function fetchNavPreferences(gateway: Gateway, workspaceId: string, productSlug: string, signal?: AbortSignal): Promise<RemoteNavPreferences>;
|
|
16
16
|
export declare function saveNavPreferences(gateway: Gateway, input: {
|
|
17
17
|
workspaceId: string;
|
|
18
18
|
productSlug: string;
|
|
@@ -33,5 +33,11 @@ export declare function updateNavView(gateway: Gateway, id: string, input: {
|
|
|
33
33
|
homePath?: string | null;
|
|
34
34
|
}): Promise<RemoteCustomView>;
|
|
35
35
|
export declare function deleteNavView(gateway: Gateway, id: string, workspaceId: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* The workspace role catalog for the role-simulation picker, most privileged
|
|
38
|
+
* first. On the workspace gateway the scope IS the workspace, so it is also the
|
|
39
|
+
* request's workspace context (see the header of this file).
|
|
40
|
+
*/
|
|
41
|
+
export declare function fetchSimulatableRoles(gateway: Gateway, scopeId: string, productSlug: string, signal?: AbortSignal): Promise<SimulatableRole[]>;
|
|
36
42
|
export {};
|
|
37
43
|
//# sourceMappingURL=personaSurfaceRemote.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personaSurfaceRemote.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/personaSurfaceRemote.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"personaSurfaceRemote.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/personaSurfaceRemote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEtF,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACtE,WAAW,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAED,KAAK,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;AA8EtC,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAwB/B;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,KAAK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
|
16
|
-
async function c(n, r, i) {
|
|
17
|
-
let
|
|
16
|
+
async function c(n, r, i, a) {
|
|
17
|
+
let c = await e({
|
|
18
18
|
query: t,
|
|
19
19
|
variables: {
|
|
20
20
|
workspaceId: r,
|
|
21
21
|
productSlug: i
|
|
22
22
|
},
|
|
23
|
-
gateway: n
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (
|
|
23
|
+
gateway: n,
|
|
24
|
+
workspaceId: r,
|
|
25
|
+
signal: a
|
|
26
|
+
}), l = s(c.errors);
|
|
27
|
+
if (l) throw l;
|
|
28
|
+
let u = c.data?.myNavPreferences;
|
|
29
|
+
if (!u) throw Error("No nav preferences returned");
|
|
28
30
|
return {
|
|
29
|
-
activeViewId:
|
|
30
|
-
overridesByView: o(
|
|
31
|
-
customViews:
|
|
31
|
+
activeViewId: u.activeViewId,
|
|
32
|
+
overridesByView: o(u.overridesJson),
|
|
33
|
+
customViews: u.customViews ?? []
|
|
32
34
|
};
|
|
33
35
|
}
|
|
34
36
|
async function l(t, r) {
|
|
@@ -40,7 +42,8 @@ async function l(t, r) {
|
|
|
40
42
|
activeViewId: r.activeViewId,
|
|
41
43
|
overridesJson: JSON.stringify(r.overridesByView)
|
|
42
44
|
} },
|
|
43
|
-
gateway: t
|
|
45
|
+
gateway: t,
|
|
46
|
+
workspaceId: r.workspaceId
|
|
44
47
|
})).errors);
|
|
45
48
|
if (i) throw i;
|
|
46
49
|
}
|
|
@@ -48,7 +51,8 @@ async function u(t, n) {
|
|
|
48
51
|
let i = await e({
|
|
49
52
|
query: r,
|
|
50
53
|
variables: { input: n },
|
|
51
|
-
gateway: t
|
|
54
|
+
gateway: t,
|
|
55
|
+
workspaceId: n.workspaceId
|
|
52
56
|
}), a = s(i.errors);
|
|
53
57
|
if (a) throw a;
|
|
54
58
|
let o = i.data?.createMyNavView;
|
|
@@ -62,7 +66,8 @@ async function d(t, n, r) {
|
|
|
62
66
|
id: n,
|
|
63
67
|
input: r
|
|
64
68
|
},
|
|
65
|
-
gateway: t
|
|
69
|
+
gateway: t,
|
|
70
|
+
workspaceId: r.workspaceId
|
|
66
71
|
}), o = s(a.errors);
|
|
67
72
|
if (o) throw o;
|
|
68
73
|
let c = a.data?.updateMyNavView;
|
|
@@ -76,9 +81,26 @@ async function f(t, n, r) {
|
|
|
76
81
|
id: n,
|
|
77
82
|
workspaceId: r
|
|
78
83
|
},
|
|
79
|
-
gateway: t
|
|
84
|
+
gateway: t,
|
|
85
|
+
workspaceId: r
|
|
80
86
|
})).errors);
|
|
81
87
|
if (i) throw i;
|
|
82
88
|
}
|
|
89
|
+
var p = "\n query NavSimulatableRoles($scopeId: String!, $filter: RoleFilterInput, $pagination: PaginationInput) {\n roles(scopeId: $scopeId, filter: $filter, pagination: $pagination) {\n id\n name\n templateKey\n priority\n defaultPermissions {\n resourceType\n level\n }\n }\n }\n";
|
|
90
|
+
async function m(t, n, r, i) {
|
|
91
|
+
let a = await e({
|
|
92
|
+
query: p,
|
|
93
|
+
variables: {
|
|
94
|
+
scopeId: n,
|
|
95
|
+
filter: { product: r },
|
|
96
|
+
pagination: { limit: 100 }
|
|
97
|
+
},
|
|
98
|
+
gateway: t,
|
|
99
|
+
...t === "workspace" ? { workspaceId: n } : {},
|
|
100
|
+
signal: i
|
|
101
|
+
}), o = s(a.errors);
|
|
102
|
+
if (o) throw o;
|
|
103
|
+
return [...a.data?.roles ?? []].sort((e, t) => t.priority - e.priority);
|
|
104
|
+
}
|
|
83
105
|
//#endregion
|
|
84
|
-
export { u as createNavView, f as deleteNavView, c as fetchNavPreferences, l as saveNavPreferences, d as updateNavView };
|
|
106
|
+
export { u as createNavView, f as deleteNavView, c as fetchNavPreferences, m as fetchSimulatableRoles, l as saveNavPreferences, d as updateNavView };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NavItemOverrideState } from './PersonaSurfaceProvider';
|
|
2
|
+
import { RemoteNavPreferences } from './personaSurfaceRemote';
|
|
3
|
+
/** How long a burst of nav edits is coalesced before one save. */
|
|
4
|
+
export declare const NAV_PREFERENCES_PUSH_DELAY_MS = 700;
|
|
5
|
+
export interface NavPreferencesPush {
|
|
6
|
+
activeViewId: string | null;
|
|
7
|
+
overridesByView: Record<string, Record<string, NavItemOverrideState>>;
|
|
8
|
+
}
|
|
9
|
+
export interface UseRemoteNavPreferencesOptions {
|
|
10
|
+
gateway: 'workspace' | 'global';
|
|
11
|
+
/** The workspace whose preferences are read and written; null disables both. */
|
|
12
|
+
scopeId: string | null;
|
|
13
|
+
productKey: string;
|
|
14
|
+
/** Whether the read may run (remote mode, a permission scope, a token). */
|
|
15
|
+
enabled: boolean;
|
|
16
|
+
/** Debounce for pushes. Tests shorten it; the shell uses the default. */
|
|
17
|
+
pushDelayMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface UseRemoteNavPreferencesResult {
|
|
20
|
+
/** The server's preferences for `scopeId`, once loaded. */
|
|
21
|
+
data: RemoteNavPreferences | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Save `state` for `scopeId` after the debounce, replacing any push still
|
|
24
|
+
* waiting. Best-effort: a failed save leaves the local cache authoritative
|
|
25
|
+
* for this device, and the next change retries.
|
|
26
|
+
*/
|
|
27
|
+
schedulePush: (state: NavPreferencesPush) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function useRemoteNavPreferences({ gateway, scopeId, productKey, enabled, pushDelayMs, }: UseRemoteNavPreferencesOptions): UseRemoteNavPreferencesResult;
|
|
30
|
+
//# sourceMappingURL=useRemoteNavPreferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRemoteNavPreferences.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/useRemoteNavPreferences.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,wBAAwB,CAAC;AAEhC,kEAAkE;AAClE,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACvE;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,WAAW,GAAG,QAAQ,CAAC;IAChC,gFAAgF;IAChF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,OAAO,EAAE,OAAO,CAAC;IACjB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,6BAA6B;IAC5C,2DAA2D;IAC3D,IAAI,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACvC;;;;OAIG;IACH,YAAY,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,uBAAuB,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,OAAO,EACP,WAA2C,GAC5C,EAAE,8BAA8B,GAAG,6BAA6B,CA0ChE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { fetchNavPreferences as e, saveNavPreferences as t } from "./personaSurfaceRemote.js";
|
|
2
|
+
import { useCallback as n, useEffect as r, useRef as i } from "react";
|
|
3
|
+
import { useQuery as a } from "@tanstack/react-query";
|
|
4
|
+
function o({ gateway: o, scopeId: s, productKey: c, enabled: l, pushDelayMs: u = 700 }) {
|
|
5
|
+
let { data: d } = a({
|
|
6
|
+
queryKey: [
|
|
7
|
+
"persona-nav-preferences",
|
|
8
|
+
o,
|
|
9
|
+
s,
|
|
10
|
+
c
|
|
11
|
+
],
|
|
12
|
+
queryFn: ({ signal: t }) => e(o, s, c, t),
|
|
13
|
+
enabled: l && !!s,
|
|
14
|
+
staleTime: 60 * 1e3,
|
|
15
|
+
retry: 2
|
|
16
|
+
}), f = i(null);
|
|
17
|
+
return r(() => () => {
|
|
18
|
+
f.current &&= (clearTimeout(f.current), null);
|
|
19
|
+
}, [
|
|
20
|
+
o,
|
|
21
|
+
s,
|
|
22
|
+
c
|
|
23
|
+
]), {
|
|
24
|
+
data: d,
|
|
25
|
+
schedulePush: n((e) => {
|
|
26
|
+
s && (f.current && clearTimeout(f.current), f.current = setTimeout(() => {
|
|
27
|
+
f.current = null, t(o, {
|
|
28
|
+
workspaceId: s,
|
|
29
|
+
productSlug: c,
|
|
30
|
+
activeViewId: e.activeViewId,
|
|
31
|
+
overridesByView: e.overridesByView
|
|
32
|
+
}).catch(() => {});
|
|
33
|
+
}, u));
|
|
34
|
+
}, [
|
|
35
|
+
o,
|
|
36
|
+
s,
|
|
37
|
+
c,
|
|
38
|
+
u
|
|
39
|
+
])
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { o as useRemoteNavPreferences };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/fe-libs",
|
|
3
|
-
"version": "2026.928.
|
|
3
|
+
"version": "2026.928.3",
|
|
4
4
|
"description": "Burdenoff frontend primitives and domain libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"format": "prettier --config shared/config/prettier.config.mjs --write \"src/**/*.{ts,tsx}\" \"!src/config/*.config.ts\"",
|
|
308
308
|
"type:check": "bash scripts/build-limits.sh tsc --noEmit",
|
|
309
309
|
"test:package-css-exports": "node scripts/validate-package-css-exports.mjs",
|
|
310
|
-
"test": "bun test scripts/graphql-schema-drift/__tests__ scripts/a11y-audit/__tests__ src/credentials src/storage src/shared/assistant src/shared/components src/shared/graphql/links/sse-link.test.ts src/shared/graphql/fetch.test.ts src/shared/config/gatewayUrls.test.ts src/shared/config/authBridgeUrls.test.ts src/shared/config/gatewayFallback.test.ts src/shared/config/products.test.ts src/shared/config/productSlug.test.ts src/shared/hooks/shell/useProducts.test.ts src/shared/providers/shell/brandAttribute.test.ts src/chrome/ProductSwitcher.test.ts src/shared/utils/gatewayFetchRewrite.test.ts src/shared/utils/authCookie.test.ts src/shared/providers/AppShellProvider.test.ts src/shared/providers/shell/interpolate.test.ts src/shared/providers/shell/resolveTranslation.test.ts src/shared/providers/shell/I18nProvider.render.test.tsx src/shared/events/sinks/RybbitSink.test.ts src/shell-native src/shared/native src/chrome/__tests__ src/ui/__tests__",
|
|
310
|
+
"test": "bun test scripts/graphql-schema-drift/__tests__ scripts/a11y-audit/__tests__ src/credentials src/storage src/shared/assistant src/shared/components src/shared/graphql/links/sse-link.test.ts src/shared/graphql/fetch.test.ts src/shared/config/gatewayUrls.test.ts src/shared/config/authBridgeUrls.test.ts src/shared/config/gatewayFallback.test.ts src/shared/config/products.test.ts src/shared/config/productSlug.test.ts src/shared/hooks/shell/useProducts.test.ts src/shared/providers/shell/brandAttribute.test.ts src/chrome/ProductSwitcher.test.ts src/shared/utils/gatewayFetchRewrite.test.ts src/shared/utils/authCookie.test.ts src/shared/providers/AppShellProvider.test.ts src/shared/providers/shell/interpolate.test.ts src/shared/providers/shell/resolveTranslation.test.ts src/shared/providers/shell/I18nProvider.render.test.tsx src/shared/providers/shell/personaSurfaceRemote.test.ts src/shared/providers/shell/workspaceSwitch.client.test.tsx src/shared/events/sinks/RybbitSink.test.ts src/shell-native src/shared/native src/chrome/__tests__ src/ui/__tests__",
|
|
311
311
|
"sanity": "bash scripts/build-limits.sh --gate bash -c 'bun run lint:sanity && bun run format && bun run type:check && bun run test && bun run build'",
|
|
312
312
|
"switch:status": "bun scripts/deps-mode.ts status",
|
|
313
313
|
"switch:remote": "bun scripts/deps-mode.ts remote",
|