@burdenoff/fe-libs 2026.529.2 → 2026.529.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.
@@ -1,48 +1,45 @@
1
1
  import { isShellLessRoute as e } from "../config/shellRoutes.js";
2
2
  import { readActiveContextValueWithUrlPrecedence as t } from "./shell/ActiveContextStorage.js";
3
- import { graphqlFetch as n } from "../graphql/fetch.js";
4
- import "../../shared-graphql.js";
5
- import { attemptTokenRefresh as r, clearAuthSessionStorage as i, isAuthNetworkError as a } from "../utils/authErrorHandling.js";
6
- import { AuthProvider as o } from "./shell/AuthProvider.js";
7
- import { ActiveContextProvider as s } from "./shell/ActiveContextProvider.js";
8
- import { LogManager as c } from "../logger/LogManager.js";
9
- import { ConsoleTransport as l } from "../logger/ConsoleTransport.js";
10
- import { ThemeProvider as u } from "./shell/ThemeProvider.js";
11
- import { ErrorFallback as d } from "../components/ErrorFallback.js";
12
- import { m as f } from "../../node_modules/react-error-boundary/dist/react-error-boundary.js";
13
- import { PWAInstallBanner as p } from "../components/PWAInstallBanner.js";
14
- import { I18nProvider as m } from "./shell/I18nProvider.js";
15
- import { FeatureFlagsProvider as h } from "./shell/FeatureFlagsProvider.js";
16
- import { FeatureFlagProvider as g } from "../feature-flags/FeatureFlagProvider.js";
17
- import "../../shared-feature-flags.js";
18
- import { GlobalUiProvider as _ } from "./shell/GlobalUiProvider.js";
19
- import { ShellUiProvider as v } from "./shell/ShellUiProvider.js";
20
- import { ContextManagerProvider as ee } from "./shell/ContextManagerProvider.js";
21
- import { AuthTokenProvider as y } from "./shell/AuthTokenProvider.js";
22
- import { MultiGatewayProvider as b } from "./shell/MultiGatewayProvider.js";
23
- import { G as x, j as S, w as C } from "../../node_modules/web-vitals/dist/web-vitals.js";
24
- import { ProfileI18nBridge as w } from "./shell/ProfileI18nBridge.js";
25
- import { ProfileGeographyBridge as T } from "./shell/ProfileGeographyBridge.js";
26
- import { AppShellContextProvider as te } from "./shell/AppShellContext.js";
27
- import { DevtoolsSink as E } from "../events/sinks/DevtoolsSink.js";
28
- import { BroadcastChannelSink as D } from "../events/sinks/BroadcastChannelSink.js";
29
- import { BackendAuditSink as O } from "../events/sinks/BackendAuditSink.js";
30
- import { RybbitSink as k } from "../events/sinks/RybbitSink.js";
31
- import { OtelBrowserSink as A } from "../events/sinks/OtelBrowserSink.js";
32
- import { EventBusProvider as ne, useEventBus as j } from "../../shared-events.js";
33
- import "../../shared-logger.js";
34
- import { useReferralAttribution as M } from "../hooks/useReferralAttribution.js";
35
- import { TourPlayerProvider as N } from "../tours/TourPlayerProvider.js";
36
- import { ToursProvider as P, useToursContext as F } from "../tours/ToursContext.js";
37
- import { TourInitializer as I } from "../tours/TourInitializer.js";
38
- import "../../shared-tours.js";
39
- import { Suspense as L, useCallback as R, useEffect as z, useMemo as B, useRef as V } from "react";
40
- import { Fragment as H, jsx as U, jsxs as W } from "react/jsx-runtime";
41
- import { BrowserRouter as re, useLocation as G } from "react-router-dom";
42
- import { Toaster as K } from "sonner";
43
- import { QueryClient as ie, QueryClientProvider as q } from "@tanstack/react-query";
3
+ import { BACKEND_ERROR_EVENT as n, dispatchBackendErrorEvent as r, isBackendErrorDisplay as i, shouldToastBackendError as a } from "../utils/backendErrors.js";
4
+ import { graphqlFetch as o } from "../graphql/fetch.js";
5
+ import { attemptTokenRefresh as s, clearAuthSessionStorage as c, isAuthNetworkError as l } from "../utils/authErrorHandling.js";
6
+ import { AuthProvider as u } from "./shell/AuthProvider.js";
7
+ import { ActiveContextProvider as d } from "./shell/ActiveContextProvider.js";
8
+ import { LogManager as ee } from "../logger/LogManager.js";
9
+ import { ConsoleTransport as te } from "../logger/ConsoleTransport.js";
10
+ import { ThemeProvider as f } from "./shell/ThemeProvider.js";
11
+ import { ErrorFallback as ne } from "../components/ErrorFallback.js";
12
+ import { m as p } from "../../node_modules/react-error-boundary/dist/react-error-boundary.js";
13
+ import { PWAInstallBanner as m } from "../components/PWAInstallBanner.js";
14
+ import { I18nProvider as h } from "./shell/I18nProvider.js";
15
+ import { FeatureFlagsProvider as g } from "./shell/FeatureFlagsProvider.js";
16
+ import { FeatureFlagProvider as _ } from "../feature-flags/FeatureFlagProvider.js";
17
+ import { GlobalUiProvider as v } from "./shell/GlobalUiProvider.js";
18
+ import { ShellUiProvider as y } from "./shell/ShellUiProvider.js";
19
+ import { ContextManagerProvider as b } from "./shell/ContextManagerProvider.js";
20
+ import { AuthTokenProvider as x } from "./shell/AuthTokenProvider.js";
21
+ import { MultiGatewayProvider as re } from "./shell/MultiGatewayProvider.js";
22
+ import { G as S, j as C, w } from "../../node_modules/web-vitals/dist/web-vitals.js";
23
+ import { ProfileI18nBridge as T } from "./shell/ProfileI18nBridge.js";
24
+ import { ProfileGeographyBridge as E } from "./shell/ProfileGeographyBridge.js";
25
+ import { AppShellContextProvider as ie } from "./shell/AppShellContext.js";
26
+ import { DevtoolsSink as D } from "../events/sinks/DevtoolsSink.js";
27
+ import { BroadcastChannelSink as O } from "../events/sinks/BroadcastChannelSink.js";
28
+ import { BackendAuditSink as k } from "../events/sinks/BackendAuditSink.js";
29
+ import { RybbitSink as A } from "../events/sinks/RybbitSink.js";
30
+ import { OtelBrowserSink as j } from "../events/sinks/OtelBrowserSink.js";
31
+ import { EventBusProvider as ae, useEventBus as M } from "../../shared-events.js";
32
+ import { useReferralAttribution as N } from "../hooks/useReferralAttribution.js";
33
+ import { TourPlayerProvider as P } from "../tours/TourPlayerProvider.js";
34
+ import { ToursProvider as F, useToursContext as I } from "../tours/ToursContext.js";
35
+ import { TourInitializer as L } from "../tours/TourInitializer.js";
36
+ import { Suspense as R, useCallback as z, useEffect as B, useMemo as V, useRef as H } from "react";
37
+ import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
38
+ import { BrowserRouter as K, useLocation as q } from "react-router-dom";
39
+ import { Toaster as J, toast as Y } from "sonner";
40
+ import { MutationCache as oe, QueryCache as se, QueryClient as ce, QueryClientProvider as le } from "@tanstack/react-query";
44
41
  //#region src/shared/providers/AppShellProvider.tsx
45
- var J = {
42
+ var X = {
46
43
  bigconsole: {
47
44
  prod: "292459a3e86c",
48
45
  nonProd: "a7e7362b0de3"
@@ -61,7 +58,7 @@ var J = {
61
58
  },
62
59
  vibecontrols: { prod: "8a46449d9c07" },
63
60
  workspaces: { prod: "da0c142f4b2e" }
64
- }, Y = [
61
+ }, Z = [
65
62
  "nav.route.changed",
66
63
  "auth.signed_in",
67
64
  "auth.signed_out",
@@ -76,14 +73,26 @@ var J = {
76
73
  "notification.admin.sent",
77
74
  "notification.template.saved",
78
75
  "notification.schedule.updated"
79
- ];
80
- function X(e) {
76
+ ], ue = 4e3;
77
+ function de(e) {
78
+ let t = e.technicalMessage ?? e.extensions?.technicalMessage, n = {
79
+ code: e.code,
80
+ operationName: e.operationName,
81
+ serviceName: e.serviceName,
82
+ path: e.path,
83
+ requestId: e.requestId,
84
+ technicalMessage: t,
85
+ extensions: e.extensions
86
+ };
87
+ console.error("[Burdenoff backend error]", e.message, n);
88
+ }
89
+ function Q(e) {
81
90
  return e === "prod" || e === "production" ? "prod" : e === "alpha" || e === "staging" ? "alpha" : "dev";
82
91
  }
83
- function Z(e, t) {
92
+ function fe(e, t) {
84
93
  return e.VITE_DISABLE_ANALYTICS === "true" ? !1 : e.VITE_ENABLE_ANALYTICS === "true" || e.PROD || t !== "dev" ? !0 : e.VITE_ENABLE_ANALYTICS !== "false";
85
94
  }
86
- function ae() {
95
+ function pe() {
87
96
  return {
88
97
  BASE_URL: "/",
89
98
  DEV: !1,
@@ -92,8 +101,8 @@ function ae() {
92
101
  SSR: !1
93
102
  };
94
103
  }
95
- function Q(e, t) {
96
- let n = X(t.VITE_DEPLOY_ENV ?? t.MODE), r = Z(t, n), i = J[e], a = n === "prod" ? i?.prod : i?.nonProd, o = t.VITE_RYBBIT_SITE_ID || a, s = t.VITE_BACKEND_AUDIT_ENDPOINT || (t.PROD ? "/api/fe-events" : void 0);
104
+ function $(e, t) {
105
+ let n = Q(t.VITE_DEPLOY_ENV ?? t.MODE), r = fe(t, n), i = X[e], a = n === "prod" ? i?.prod : i?.nonProd, o = t.VITE_RYBBIT_SITE_ID || a, s = t.VITE_BACKEND_AUDIT_ENDPOINT || (t.PROD ? "/api/fe-events" : void 0);
97
106
  return {
98
107
  enabled: r,
99
108
  appVersion: t.VITE_APP_VERSION || "0.0.0",
@@ -104,7 +113,7 @@ function Q(e, t) {
104
113
  enabled: r && !!o,
105
114
  siteId: o,
106
115
  scriptUrl: t.VITE_RYBBIT_SCRIPT_URL,
107
- allowlist: Y,
116
+ allowlist: Z,
108
117
  identifyOn: "auth.signed_in",
109
118
  rename: { "nav.route.changed": "pageview" }
110
119
  },
@@ -119,16 +128,16 @@ function Q(e, t) {
119
128
  }
120
129
  };
121
130
  }
122
- function $({ children: e, enablePWA: t, toasterPosition: n, productName: r, brandInitial: i }) {
123
- let { trackProgress: a, recordStepCompletion: o, trackEvent: s } = F(), c = R((e, t) => e.steps?.[t], []);
124
- return /* @__PURE__ */ W(N, {
125
- onTourStart: R((e) => {
131
+ function me({ children: e, enablePWA: t, toasterPosition: n, productName: r, brandInitial: i }) {
132
+ let { trackProgress: a, recordStepCompletion: o, trackEvent: s } = I(), c = z((e, t) => e.steps?.[t], []);
133
+ return /* @__PURE__ */ G(P, {
134
+ onTourStart: z((e) => {
126
135
  a(e.id, "started"), s("TOUR_STARTED", e.id);
127
136
  }, [s, a]),
128
- onTourComplete: R((e) => {
137
+ onTourComplete: z((e) => {
129
138
  a(e.id, "completed"), s("TOUR_COMPLETED", e.id);
130
139
  }, [s, a]),
131
- onTourSkip: R((e, t) => {
140
+ onTourSkip: z((e, t) => {
132
141
  let n = c(e, t);
133
142
  a(e.id, "skipped"), s("TOUR_SKIPPED", e.id, {
134
143
  stepId: n?.id,
@@ -139,14 +148,14 @@ function $({ children: e, enablePWA: t, toasterPosition: n, productName: r, bran
139
148
  s,
140
149
  a
141
150
  ]),
142
- onStepChange: R((e, t) => {
151
+ onStepChange: z((e, t) => {
143
152
  let n = c(e, t);
144
153
  n && s("STEP_VIEWED", e.id, {
145
154
  stepId: n.id,
146
155
  stepOrder: n.stepOrder
147
156
  });
148
157
  }, [c, s]),
149
- onStepComplete: R((e, t) => {
158
+ onStepComplete: z((e, t) => {
150
159
  let n = c(e, t);
151
160
  n && (o(e.id, n.id), s("STEP_COMPLETED", e.id, {
152
161
  stepId: n.id,
@@ -158,16 +167,17 @@ function $({ children: e, enablePWA: t, toasterPosition: n, productName: r, bran
158
167
  s
159
168
  ]),
160
169
  children: [
161
- /* @__PURE__ */ U(I, {}),
170
+ /* @__PURE__ */ W(L, {}),
162
171
  e,
163
- /* @__PURE__ */ U(K, {
172
+ /* @__PURE__ */ W(he, {}),
173
+ /* @__PURE__ */ W(J, {
164
174
  position: n,
165
175
  richColors: !0,
166
176
  closeButton: !0
167
177
  }),
168
- t && /* @__PURE__ */ U(L, {
178
+ t && /* @__PURE__ */ W(R, {
169
179
  fallback: null,
170
- children: /* @__PURE__ */ U(p, {
180
+ children: /* @__PURE__ */ W(m, {
171
181
  productName: r,
172
182
  brandInitial: i
173
183
  })
@@ -175,18 +185,34 @@ function $({ children: e, enablePWA: t, toasterPosition: n, productName: r, bran
175
185
  ]
176
186
  });
177
187
  }
178
- function oe({ children: e, i18nProductId: t, fallbackTranslations: n, defaultBrand: r, productName: i, brandInitial: a, enablePWA: o, toasterPosition: s }) {
179
- let c = G();
180
- M();
181
- let l = c.pathname.startsWith("/auth/") || c.pathname.startsWith("/devportal") || c.pathname.startsWith("/organizations") || c.pathname.startsWith("/workspaces"), d = /* @__PURE__ */ U(T, { children: /* @__PURE__ */ U(h, { children: /* @__PURE__ */ U(g, {
188
+ function he() {
189
+ let e = H(null);
190
+ return B(() => {
191
+ let t = (t) => {
192
+ let n = t instanceof CustomEvent && i(t.detail) ? t.detail : null;
193
+ if (!a(n)) return;
194
+ de(n);
195
+ let r = `${n.code ?? ""}|${n.message}`, o = Date.now(), s = e.current;
196
+ s?.key === r && o - s.shownAt < ue || (e.current = {
197
+ key: r,
198
+ shownAt: o
199
+ }, Y.error(n.message, { duration: 7e3 }));
200
+ };
201
+ return window.addEventListener(n, t), () => window.removeEventListener(n, t);
202
+ }, []), null;
203
+ }
204
+ function ge({ children: e, i18nProductId: t, fallbackTranslations: n, defaultBrand: r, productName: i, brandInitial: a, enablePWA: o, toasterPosition: s }) {
205
+ let c = q();
206
+ N();
207
+ let l = c.pathname.startsWith("/auth/") || c.pathname.startsWith("/devportal") || c.pathname.startsWith("/organizations") || c.pathname.startsWith("/workspaces"), u = /* @__PURE__ */ W(E, { children: /* @__PURE__ */ W(g, { children: /* @__PURE__ */ W(_, {
182
208
  workspaceId: null,
183
209
  gateway: "global",
184
210
  defaultEnabled: !0,
185
- children: /* @__PURE__ */ U(_, { children: /* @__PURE__ */ U(v, { children: /* @__PURE__ */ U(f, {
211
+ children: /* @__PURE__ */ W(v, { children: /* @__PURE__ */ W(y, { children: /* @__PURE__ */ W(p, {
186
212
  fallback: null,
187
- children: /* @__PURE__ */ U(P, {
213
+ children: /* @__PURE__ */ W(F, {
188
214
  disabled: l,
189
- children: /* @__PURE__ */ U($, {
215
+ children: /* @__PURE__ */ W(me, {
190
216
  enablePWA: o,
191
217
  toasterPosition: s,
192
218
  productName: i,
@@ -196,9 +222,9 @@ function oe({ children: e, i18nProductId: t, fallbackTranslations: n, defaultBra
196
222
  })
197
223
  }) }) })
198
224
  }) }) });
199
- return /* @__PURE__ */ W(u, {
225
+ return /* @__PURE__ */ G(f, {
200
226
  defaultBrand: r,
201
- children: [/* @__PURE__ */ U(se, {}), l ? /* @__PURE__ */ U(m, {
227
+ children: [/* @__PURE__ */ W(_e, {}), l ? /* @__PURE__ */ W(h, {
202
228
  defaultLocale: "en",
203
229
  translations: n ?? {
204
230
  en: {},
@@ -211,17 +237,17 @@ function oe({ children: e, i18nProductId: t, fallbackTranslations: n, defaultBra
211
237
  hi: {}
212
238
  },
213
239
  showChildrenWhileLoading: !0,
214
- children: d
215
- }) : /* @__PURE__ */ U(w, {
240
+ children: u
241
+ }) : /* @__PURE__ */ W(T, {
216
242
  i18nProductId: t,
217
243
  fallbackTranslations: n,
218
- children: d
244
+ children: u
219
245
  })]
220
246
  });
221
247
  }
222
- function se() {
223
- let e = G();
224
- return z(() => {
248
+ function _e() {
249
+ let e = q();
250
+ return B(() => {
225
251
  e.hash || requestAnimationFrame(() => {
226
252
  window.scrollTo({
227
253
  top: 0,
@@ -239,7 +265,7 @@ function se() {
239
265
  e.hash
240
266
  ]), null;
241
267
  }
242
- function ce(e) {
268
+ function ve(e) {
243
269
  if (e instanceof Error) return e.message;
244
270
  if (typeof e == "string") return e;
245
271
  try {
@@ -248,9 +274,9 @@ function ce(e) {
248
274
  return String(e);
249
275
  }
250
276
  }
251
- function le() {
252
- let e = j(), t = G(), n = V(void 0), r = V(void 0);
253
- return z(() => {
277
+ function ye() {
278
+ let e = M(), t = q(), n = H(void 0), r = H(void 0);
279
+ return B(() => {
254
280
  let i = `${t.pathname}${t.search}${t.hash}`;
255
281
  r.current !== i && (e.emit("nav.route.changed", {
256
282
  pathname: t.pathname,
@@ -264,7 +290,7 @@ function le() {
264
290
  t.hash,
265
291
  t.pathname,
266
292
  t.search
267
- ]), z(() => {
293
+ ]), B(() => {
268
294
  let t = (t) => {
269
295
  e.emit("error.runtime.caught", {
270
296
  message: t.message || "Runtime error",
@@ -274,27 +300,27 @@ function le() {
274
300
  errorName: t.error instanceof Error ? t.error.name : void 0
275
301
  });
276
302
  }, n = (t) => {
277
- e.emit("error.unhandledrejection", { reason: ce(t.reason) });
303
+ e.emit("error.unhandledrejection", { reason: ve(t.reason) });
278
304
  };
279
305
  return window.addEventListener("error", t), window.addEventListener("unhandledrejection", n), () => {
280
306
  window.removeEventListener("error", t), window.removeEventListener("unhandledrejection", n);
281
307
  };
282
- }, [e]), z(() => {
283
- x((t) => {
308
+ }, [e]), B(() => {
309
+ S((t) => {
284
310
  e.emit("perf.lcp.measured", {
285
311
  metric: "LCP",
286
312
  value: t.value,
287
313
  id: t.id,
288
314
  rating: t.rating
289
315
  });
290
- }), C((t) => {
316
+ }), w((t) => {
291
317
  e.emit("perf.cls.measured", {
292
318
  metric: "CLS",
293
319
  value: t.value,
294
320
  id: t.id,
295
321
  rating: t.rating
296
322
  });
297
- }), S((t) => {
323
+ }), C((t) => {
298
324
  e.emit("perf.inp.measured", {
299
325
  metric: "INP",
300
326
  value: t.value,
@@ -304,39 +330,39 @@ function le() {
304
330
  });
305
331
  }, [e]), null;
306
332
  }
307
- function ue({ config: e, productSlug: t }) {
308
- return /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(le, {}), e.enabled === !1 ? null : /* @__PURE__ */ W(H, { children: [
309
- e.devtools ? /* @__PURE__ */ U(E, { enabled: !0 }) : null,
310
- e.broadcast === !1 ? null : /* @__PURE__ */ U(D, {}),
311
- e.backendAudit?.enabled && e.backendAudit.endpoint ? /* @__PURE__ */ U(O, { endpoint: e.backendAudit.endpoint }) : null,
312
- e.rybbit?.enabled && e.rybbit.siteId ? /* @__PURE__ */ U(k, {
333
+ function be({ config: e, productSlug: t }) {
334
+ return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(ye, {}), e.enabled === !1 ? null : /* @__PURE__ */ G(U, { children: [
335
+ e.devtools ? /* @__PURE__ */ W(D, { enabled: !0 }) : null,
336
+ e.broadcast === !1 ? null : /* @__PURE__ */ W(O, {}),
337
+ e.backendAudit?.enabled && e.backendAudit.endpoint ? /* @__PURE__ */ W(k, { endpoint: e.backendAudit.endpoint }) : null,
338
+ e.rybbit?.enabled && e.rybbit.siteId ? /* @__PURE__ */ W(A, {
313
339
  siteId: e.rybbit.siteId,
314
340
  scriptUrl: e.rybbit.scriptUrl,
315
341
  allowlist: e.rybbit.allowlist,
316
342
  identifyOn: e.rybbit.identifyOn,
317
343
  rename: e.rybbit.rename
318
344
  }) : null,
319
- e.otel?.enabled && e.otel.endpoint ? /* @__PURE__ */ U(A, {
345
+ e.otel?.enabled && e.otel.endpoint ? /* @__PURE__ */ W(j, {
320
346
  endpoint: e.otel.endpoint,
321
347
  serviceName: e.otel.serviceName ?? `${t}-app`,
322
348
  flushInterval: e.otel.flushInterval
323
349
  }) : null
324
350
  ] })] });
325
351
  }
326
- function de({ config: u, children: p, clearAuthStore: m }) {
327
- let { productName: h, productSlug: g = h.toLowerCase().replace(/\s+/g, ""), tagline: _ = "", domain: v, i18nProductId: x, gatewayUrls: S, authBridge: C, defaultBrand: w = "default", enablePWA: T = !0, brandInitial: E = h.charAt(0), defaultGateway: D = "workspace", enableSubscriptions: O = !0, fallbackTranslations: k, queryClientOptions: A, toasterPosition: j = "bottom-right", observability: M } = u, N = M ?? Q(g, ae()), P = B(() => ({
328
- productName: h,
329
- productSlug: g,
330
- brandInitial: E,
331
- tagline: _,
332
- domain: v
352
+ function xe({ config: n, children: i, clearAuthStore: a }) {
353
+ let { productName: f, productSlug: m = f.toLowerCase().replace(/\s+/g, ""), tagline: h = "", domain: g, i18nProductId: _, gatewayUrls: v, authBridge: y, defaultBrand: S = "default", enablePWA: C = !0, brandInitial: w = f.charAt(0), defaultGateway: T = "workspace", enableSubscriptions: E = !0, fallbackTranslations: D, queryClientOptions: O, toasterPosition: k = "bottom-right", observability: A } = n, j = A ?? $(m, pe()), M = V(() => ({
354
+ productName: f,
355
+ productSlug: m,
356
+ brandInitial: w,
357
+ tagline: h,
358
+ domain: g
333
359
  }), [
360
+ f,
361
+ m,
362
+ w,
334
363
  h,
335
- g,
336
- E,
337
- _,
338
- v
339
- ]), F = V(!1), I = V(!1), L = V(null), H = V(!!C?.url), G = R(() => {
364
+ g
365
+ ]), N = H(!1), P = H(!1), F = H(null), I = H(!!y?.url), L = z(() => {
340
366
  if ((() => {
341
367
  try {
342
368
  let e = sessionStorage.getItem("bf-active-profile");
@@ -346,93 +372,101 @@ function de({ config: u, children: p, clearAuthStore: m }) {
346
372
  } catch {
347
373
  return !1;
348
374
  }
349
- })() || H.current || F.current) return;
350
- F.current = !0, i(m);
375
+ })() || I.current || N.current) return;
376
+ N.current = !0, c(a);
351
377
  let t = `${window.location.pathname}${window.location.search}`, n = `/auth/login?reason=session-expired&returnTo=${encodeURIComponent(t)}`, r = /^\/vibecontrols\/(share|deck)\//.test(window.location.pathname);
352
378
  if (window.location.pathname.startsWith("/auth/") || e(window.location.pathname) || r) {
353
- F.current = !1;
379
+ N.current = !1;
354
380
  return;
355
381
  }
356
382
  window.location.replace(n);
357
- }, [m]), K = B(() => ({
358
- globalBaseUrl: S.globalBaseUrl,
359
- isRefreshing: I,
360
- refreshPromise: L
361
- }), [S.globalBaseUrl]), J = R(async () => r(K), [K]), Y = R(async () => {
362
- window.location.pathname.startsWith("/auth/") || await J() || G();
363
- }, [J, G]), X = R(async (e) => {
364
- a(e) ? await J() || G() : console.error("[Network] Backend unreachable:", e.message);
365
- }, [J, G]), Z = R(() => t("organization"), []), $ = B(() => new ie({ defaultOptions: { queries: {
366
- staleTime: A?.staleTime ?? 300 * 1e3,
367
- retry: A?.retry ?? 1,
368
- refetchOnWindowFocus: A?.refetchOnWindowFocus ?? !1
369
- } } }), [A]);
370
- return z(() => {
371
- let e = c.getInstance();
372
- e.getLogger("shell") || e.getLogger("shell").addTransport(new l());
373
- }, []), /* @__PURE__ */ U(te, {
374
- value: P,
375
- children: /* @__PURE__ */ U(ne, {
376
- appName: g,
377
- appVersion: N.appVersion,
378
- appEnv: N.appEnv,
379
- sourceMfe: g,
380
- children: /* @__PURE__ */ U(f, {
381
- FallbackComponent: d,
382
- children: /* @__PURE__ */ W(re, { children: [/* @__PURE__ */ U(ue, {
383
- config: N,
384
- productSlug: g
385
- }), /* @__PURE__ */ U(q, {
386
- client: $,
387
- children: /* @__PURE__ */ U(y, { children: /* @__PURE__ */ U(b, {
388
- workspaceBaseUrl: S.workspaceBaseUrl,
389
- globalBaseUrl: S.globalBaseUrl,
390
- organizationId: Z,
391
- defaultGateway: D,
392
- enableSubscriptions: O,
393
- onAuthError: Y,
394
- onNetworkError: X,
395
- onRefreshToken: J,
396
- children: /* @__PURE__ */ U(o, {
397
- bridgeUrl: C?.url,
398
- bridgeAllowedOrigins: C?.allowedOrigins,
399
- bridgeDebug: C?.debug,
400
- onRefreshToken: async (e) => {
401
- let t = await n({
402
- gateway: "global",
403
- baseUrl: S.globalBaseUrl,
404
- authToken: "",
405
- query: "mutation RefreshToken($token: String!) {\n refreshToken(token: $token) {\n accessToken\n refreshToken\n expiresIn\n }\n }",
406
- variables: { token: e }
407
- });
408
- if (t.errors?.length) throw Error(t.errors[0].message ?? "Token refresh failed");
409
- let r = t.data.refreshToken;
410
- return {
411
- accessToken: r.accessToken,
412
- refreshToken: r.refreshToken,
413
- expiresAt: r.expiresIn ? Date.now() + r.expiresIn * 1e3 : void 0
414
- };
415
- },
383
+ }, [a]), R = V(() => ({
384
+ globalBaseUrl: v.globalBaseUrl,
385
+ isRefreshing: P,
386
+ refreshPromise: F
387
+ }), [v.globalBaseUrl]), U = z(async () => s(R), [R]), q = z(async () => {
388
+ window.location.pathname.startsWith("/auth/") || await U() || L();
389
+ }, [U, L]), J = z(async (e) => {
390
+ l(e) ? await U() || L() : console.error("[Network] Backend unreachable:", e.message);
391
+ }, [U, L]), Y = z(async (e) => {
392
+ let t = await o({
393
+ gateway: "global",
394
+ baseUrl: v.globalBaseUrl,
395
+ authToken: "",
396
+ query: "mutation RefreshToken($token: String!) {\n refreshToken(token: $token) {\n accessToken\n refreshToken\n expiresIn\n }\n }",
397
+ variables: { token: e }
398
+ });
399
+ if (t.errors?.length) throw Error(t.errors[0].message ?? "Token refresh failed");
400
+ let n = t.data.refreshToken;
401
+ return {
402
+ accessToken: n.accessToken,
403
+ refreshToken: n.refreshToken,
404
+ expiresAt: n.expiresIn ? Date.now() + n.expiresIn * 1e3 : void 0
405
+ };
406
+ }, [v.globalBaseUrl]), X = z(() => t("organization"), []), Z = V(() => new ce({
407
+ queryCache: new se({ onError: (e) => {
408
+ r(e);
409
+ } }),
410
+ mutationCache: new oe({ onError: (e) => {
411
+ r(e);
412
+ } }),
413
+ defaultOptions: { queries: {
414
+ staleTime: O?.staleTime ?? 300 * 1e3,
415
+ retry: O?.retry ?? 1,
416
+ refetchOnWindowFocus: O?.refetchOnWindowFocus ?? !1
417
+ } }
418
+ }), [O]);
419
+ return B(() => {
420
+ let e = ee.getInstance();
421
+ e.getLogger("shell") || e.getLogger("shell").addTransport(new te());
422
+ }, []), /* @__PURE__ */ W(ie, {
423
+ value: M,
424
+ children: /* @__PURE__ */ W(ae, {
425
+ appName: m,
426
+ appVersion: j.appVersion,
427
+ appEnv: j.appEnv,
428
+ sourceMfe: m,
429
+ children: /* @__PURE__ */ W(p, {
430
+ FallbackComponent: ne,
431
+ children: /* @__PURE__ */ G(K, { children: [/* @__PURE__ */ W(be, {
432
+ config: j,
433
+ productSlug: m
434
+ }), /* @__PURE__ */ W(le, {
435
+ client: Z,
436
+ children: /* @__PURE__ */ W(x, { children: /* @__PURE__ */ W(re, {
437
+ workspaceBaseUrl: v.workspaceBaseUrl,
438
+ globalBaseUrl: v.globalBaseUrl,
439
+ organizationId: X,
440
+ defaultGateway: T,
441
+ enableSubscriptions: E,
442
+ onAuthError: q,
443
+ onNetworkError: J,
444
+ onRefreshToken: U,
445
+ children: /* @__PURE__ */ W(u, {
446
+ bridgeUrl: y?.url,
447
+ bridgeAllowedOrigins: y?.allowedOrigins,
448
+ bridgeDebug: y?.debug,
449
+ onRefreshToken: Y,
416
450
  onBridgeReady: () => {
417
- H.current = !1;
451
+ I.current = !1;
418
452
  },
419
453
  onSessionExpiringSoon: () => {
420
454
  console.warn("[Auth] Session will expire in 5 minutes");
421
455
  },
422
456
  onTokenExpired: () => {
423
- G();
457
+ L();
424
458
  },
425
- children: /* @__PURE__ */ U(s, {
459
+ children: /* @__PURE__ */ W(d, {
426
460
  syncToUrl: !0,
427
- children: /* @__PURE__ */ U(ee, { children: /* @__PURE__ */ U(oe, {
428
- i18nProductId: x,
429
- fallbackTranslations: k,
430
- defaultBrand: w,
431
- productName: h,
432
- brandInitial: E,
433
- enablePWA: T,
434
- toasterPosition: j,
435
- children: p
461
+ children: /* @__PURE__ */ W(b, { children: /* @__PURE__ */ W(ge, {
462
+ i18nProductId: _,
463
+ fallbackTranslations: D,
464
+ defaultBrand: S,
465
+ productName: f,
466
+ brandInitial: w,
467
+ enablePWA: C,
468
+ toasterPosition: k,
469
+ children: i
436
470
  }) })
437
471
  })
438
472
  })
@@ -443,4 +477,4 @@ function de({ config: u, children: p, clearAuthStore: m }) {
443
477
  });
444
478
  }
445
479
  //#endregion
446
- export { de as AppShellProvider, Q as resolveAppShellObservabilityConfig };
480
+ export { xe as AppShellProvider, $ as resolveAppShellObservabilityConfig };