@burdenoff/fe-libs 2026.627.1 → 2026.627.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,18 +1,25 @@
1
1
  import { clearShellSsoCookies as e, setShellSsoCookies as t } from "../../utils/authCookie.js";
2
2
  //#region src/shared/providers/shell/AuthBridgeClient.ts
3
- var n = "burdenoff-auth-bridge", r = "burdenoff-auth-client", i = class {
3
+ var n = "burdenoff-auth-bridge", r = "burdenoff-auth-client";
4
+ function i() {
5
+ let e = globalThis.crypto;
6
+ if (typeof e.randomUUID == "function") return e.randomUUID();
7
+ let t = new Uint8Array(32);
8
+ return e.getRandomValues(t), Array.from(t, (e) => e.toString(16).padStart(2, "0")).join("");
9
+ }
10
+ var a = class {
4
11
  iframe = null;
5
12
  bridgeUrl;
6
- allowedOrigins;
7
13
  onStateChanged;
8
14
  debug;
15
+ nonce;
9
16
  ready = !1;
10
17
  readyReceived = !1;
11
18
  pendingMessages = [];
12
19
  messageHandler = null;
13
20
  destroyed = !1;
14
21
  constructor(e) {
15
- this.bridgeUrl = e.bridgeUrl, this.debug = e.debug ?? !1, this.onStateChanged = e.onStateChanged, this.destroyed = !1, typeof e.allowedOrigins == "string" ? this.allowedOrigins = e.allowedOrigins.split(",").map((e) => e.trim()).filter(Boolean) : Array.isArray(e.allowedOrigins) ? this.allowedOrigins = e.allowedOrigins : this.allowedOrigins = [window.location.origin], this.log("AuthBridgeClient created", { bridgeUrl: this.bridgeUrl });
22
+ this.bridgeUrl = e.bridgeUrl, this.debug = e.debug ?? !1, this.onStateChanged = e.onStateChanged, this.destroyed = !1, this.nonce = i(), this.log("AuthBridgeClient created", { bridgeUrl: this.bridgeUrl });
16
23
  }
17
24
  async init() {
18
25
  if (this.iframe) {
@@ -126,9 +133,9 @@ var n = "burdenoff-auth-bridge", r = "burdenoff-auth-client", i = class {
126
133
  handleMessage(e) {
127
134
  if (this.destroyed) return;
128
135
  let t = new URL(this.bridgeUrl).origin;
129
- if (e.origin !== t && !this.allowedOrigins.includes(e.origin)) return;
136
+ if (e.origin !== t || e.source !== this.iframe?.contentWindow) return;
130
137
  let r = e.data;
131
- if (!(!r || !r.type || r.source !== n)) switch (this.log("Received bridge message:", r.type), r.type) {
138
+ if (!(!r || !r.type || r.source !== n) && !((r.type === "AUTH_STATE" || r.type === "AUTH_STATE_CHANGED" || r.type === "AUTH_BRIDGE_READY") && r.nonce !== this.nonce)) switch (this.log("Received bridge message:", r.type), r.type) {
132
139
  case "AUTH_BRIDGE_READY":
133
140
  if (this.readyReceived) {
134
141
  this.log("AUTH_BRIDGE_READY already received, ignoring duplicate");
@@ -154,7 +161,11 @@ var n = "burdenoff-auth-bridge", r = "burdenoff-auth-client", i = class {
154
161
  return;
155
162
  }
156
163
  let t = new URL(this.bridgeUrl).origin;
157
- this.iframe.contentWindow.postMessage(e, t), this.log("Sent message to bridge:", e.type);
164
+ this.iframe.contentWindow.postMessage({
165
+ ...e,
166
+ source: e.source ?? r,
167
+ nonce: this.nonce
168
+ }, t), this.log("Sent message to bridge:", e.type);
158
169
  }
159
170
  flushPendingMessages() {
160
171
  for (; this.pendingMessages.length > 0;) {
@@ -165,18 +176,18 @@ var n = "burdenoff-auth-bridge", r = "burdenoff-auth-client", i = class {
165
176
  log(...e) {
166
177
  this.debug && console.log("[AuthBridgeClient]", ...e);
167
178
  }
168
- }, a = null, o = !1, s = !1;
169
- function c(e) {
170
- return s && a ? (e.debug && console.log("[AuthBridgeClient] Returning existing instance"), a) : o && a ? (e.debug && console.log("[AuthBridgeClient] Initialization in progress, returning pending instance"), a) : (o && e.debug && console.log("[AuthBridgeClient] Concurrent init detected, waiting..."), o = !0, a = new i(e), a.init(), s = !0, o = !1, a);
171
- }
172
- function l() {
173
- return a;
179
+ }, o = null, s = !1, c = !1;
180
+ function l(e) {
181
+ return c && o ? (e.debug && console.log("[AuthBridgeClient] Returning existing instance"), o) : s && o ? (e.debug && console.log("[AuthBridgeClient] Initialization in progress, returning pending instance"), o) : (s && e.debug && console.log("[AuthBridgeClient] Concurrent init detected, waiting..."), s = !0, o = new a(e), o.init(), c = !0, s = !1, o);
174
182
  }
175
183
  function u() {
176
- return s && a !== null;
184
+ return o;
185
+ }
186
+ function d() {
187
+ return c && o !== null;
177
188
  }
178
- function d(e = !1) {
179
- e && a && (a.destroy(!0), a = null, s = !1);
189
+ function f(e = !1) {
190
+ e && o && (o.destroy(!0), o = null, c = !1);
180
191
  }
181
192
  //#endregion
182
- export { i as AuthBridgeClient, d as destroyAuthBridge, l as getAuthBridge, c as initAuthBridge, u as isAuthBridgeInitialized };
193
+ export { a as AuthBridgeClient, f as destroyAuthBridge, u as getAuthBridge, l as initAuthBridge, d as isAuthBridgeInitialized };
@@ -8,6 +8,8 @@ export interface MultiGatewayProviderProps {
8
8
  globalBaseUrl?: string;
9
9
  /** Organization ID getter for x-org-id header (global gateway) */
10
10
  organizationId?: () => string | null;
11
+ /** Product slug for x-product-slug propagation */
12
+ productSlug?: string;
11
13
  /** Default gateway for the app (used by top-level ApolloProvider) */
12
14
  defaultGateway?: Gateway;
13
15
  /** Enable debug logging */
@@ -21,5 +23,5 @@ export interface MultiGatewayProviderProps {
21
23
  /** Callback to attempt token refresh on 401 */
22
24
  onRefreshToken?: () => Promise<boolean>;
23
25
  }
24
- export declare function MultiGatewayProvider({ children, workspaceBaseUrl, globalBaseUrl, organizationId, defaultGateway, debug, enableSubscriptions, onAuthError, onNetworkError, onRefreshToken, }: MultiGatewayProviderProps): import("react/jsx-runtime").JSX.Element;
26
+ export declare function MultiGatewayProvider({ children, workspaceBaseUrl, globalBaseUrl, organizationId, productSlug, defaultGateway, debug, enableSubscriptions, onAuthError, onNetworkError, onRefreshToken, }: MultiGatewayProviderProps): import("react/jsx-runtime").JSX.Element;
25
27
  //# sourceMappingURL=MultiGatewayProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiGatewayProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/MultiGatewayProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAKzE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACrC,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,yCAAyC;IACzC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,cAA4B,EAC5B,KAAa,EACb,mBAA2B,EAC3B,WAAW,EACX,cAAc,EACd,cAAc,GACf,EAAE,yBAAyB,2CAoR3B"}
1
+ {"version":3,"file":"MultiGatewayProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/MultiGatewayProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhF,OAAO,EAAuB,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAKzE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,qCAAqC;IACrC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACrC,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,2BAA2B;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,yCAAyC;IACzC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAA4B,EAC5B,KAAa,EACb,mBAA2B,EAC3B,WAAW,EACX,cAAc,EACd,cAAc,GACf,EAAE,yBAAyB,2CAwR3B"}
@@ -6,28 +6,28 @@ import { useCallback as i, useEffect as a, useMemo as o, useRef as s } from "rea
6
6
  import { jsx as c } from "react/jsx-runtime";
7
7
  import { ApolloProvider as l } from "@apollo/client/react";
8
8
  //#region src/shared/providers/shell/MultiGatewayProvider.tsx
9
- function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId: p, defaultGateway: m = "workspace", debug: h = !1, enableSubscriptions: g = !1, onAuthError: _, onNetworkError: v, onRefreshToken: y }) {
10
- let { getAccessToken: b, getWorkspaceToken: x, accessToken: S, workspaceToken: C } = r(), w = s({
9
+ function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId: p, productSlug: m, defaultGateway: h = "workspace", debug: g = !1, enableSubscriptions: _ = !1, onAuthError: v, onNetworkError: y, onRefreshToken: b }) {
10
+ let { getAccessToken: x, getWorkspaceToken: S, accessToken: C, workspaceToken: w } = r(), T = s({
11
11
  workspaceClient: null,
12
12
  globalClient: null
13
- }), T = s(null), E = i(() => {
14
- T.current ||= setTimeout(() => {
15
- T.current = null;
16
- let e = w.current, t = [];
13
+ }), E = s(null), D = i(() => {
14
+ E.current ||= setTimeout(() => {
15
+ E.current = null;
16
+ let e = T.current, t = [];
17
17
  e.workspaceClient && t.push(e.workspaceClient.refetchQueries({ include: "active" })), e.globalClient && t.push(e.globalClient.refetchQueries({ include: "active" })), t.length !== 0 && Promise.allSettled(t).then((e) => {
18
- if (!h) return;
18
+ if (!g) return;
19
19
  let t = e.filter((e) => e.status === "rejected");
20
20
  t.length > 0 && console.warn("[MultiGatewayProvider] Active query refresh failed after mutation", t);
21
21
  });
22
22
  }, 0);
23
- }, [h]), D = i(() => {
23
+ }, [g]), O = i(() => {
24
24
  let e = sessionStorage.getItem("bf-active-profile");
25
25
  if (e) {
26
26
  let t = localStorage.getItem(`bf-p-${e}-locale`);
27
27
  if (t) return t;
28
28
  }
29
29
  return localStorage.getItem("burdenoff-locale") || "en";
30
- }, []), O = i(() => {
30
+ }, []), k = i(() => {
31
31
  let e = sessionStorage.getItem("bf-active-profile");
32
32
  if (e) {
33
33
  let t = localStorage.getItem(`bf-p-${e}-geography`);
@@ -40,110 +40,114 @@ function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId:
40
40
  return JSON.parse(t);
41
41
  } catch {}
42
42
  return null;
43
- }, []), k = i(() => e("workspace"), []), A = i(() => e("project"), []), j = o(() => t({
43
+ }, []), A = i(() => e("workspace"), []), j = i(() => e("project"), []), M = o(() => t({
44
44
  gateway: "workspace",
45
45
  baseUrl: d,
46
- authToken: b,
47
- workspaceToken: x,
48
- workspaceId: k,
49
- projectId: A,
46
+ authToken: x,
47
+ workspaceToken: S,
48
+ workspaceId: A,
49
+ projectId: j,
50
50
  organizationId: p,
51
- locale: D,
52
- geography: O,
53
- enableSubscriptions: g,
54
- debug: h,
55
- onAuthError: _,
56
- onRefreshToken: y,
57
- onNetworkError: v,
58
- onMutationSuccess: E
51
+ productSlug: m,
52
+ locale: O,
53
+ geography: k,
54
+ enableSubscriptions: _,
55
+ debug: g,
56
+ onAuthError: v,
57
+ onRefreshToken: b,
58
+ onNetworkError: y,
59
+ onMutationSuccess: D
59
60
  }), [
60
61
  d,
61
- b,
62
62
  x,
63
- k,
63
+ S,
64
64
  A,
65
+ j,
65
66
  p,
66
- D,
67
+ m,
67
68
  O,
68
- g,
69
- h,
69
+ k,
70
70
  _,
71
- y,
71
+ g,
72
72
  v,
73
- E
74
- ]), M = o(() => t({
73
+ b,
74
+ y,
75
+ D
76
+ ]), N = o(() => t({
75
77
  gateway: "global",
76
78
  baseUrl: f,
77
- authToken: b,
79
+ authToken: x,
78
80
  organizationId: p,
79
- locale: D,
80
- geography: O,
81
- debug: h,
82
- onAuthError: _,
83
- onRefreshToken: y,
84
- onNetworkError: v,
85
- onMutationSuccess: E
81
+ productSlug: m,
82
+ locale: O,
83
+ geography: k,
84
+ debug: g,
85
+ onAuthError: v,
86
+ onRefreshToken: b,
87
+ onNetworkError: y,
88
+ onMutationSuccess: D
86
89
  }), [
87
90
  f,
88
- b,
91
+ x,
89
92
  p,
90
- D,
93
+ m,
91
94
  O,
92
- h,
93
- _,
94
- y,
95
+ k,
96
+ g,
95
97
  v,
96
- E
98
+ b,
99
+ y,
100
+ D
97
101
  ]);
98
102
  a(() => {
99
- w.current = {
100
- workspaceClient: j,
101
- globalClient: M
103
+ T.current = {
104
+ workspaceClient: M,
105
+ globalClient: N
102
106
  };
103
- }, [j, M]), a(() => {
104
- let e = T;
107
+ }, [M, N]), a(() => {
108
+ let e = E;
105
109
  return () => {
106
110
  e.current &&= (clearTimeout(e.current), null);
107
111
  };
108
112
  }, []);
109
- let N = i((e) => e === "workspace" ? w.current.workspaceClient ?? j : w.current.globalClient ?? M, [j, M]);
113
+ let P = i((e) => e === "workspace" ? T.current.workspaceClient ?? M : T.current.globalClient ?? N, [M, N]);
110
114
  return a(() => {
111
- h && console.log("[MultiGatewayProvider] Tokens updated:", {
112
- hasAccessToken: !!S,
113
- hasWorkspaceToken: !!C
115
+ g && console.log("[MultiGatewayProvider] Tokens updated:", {
116
+ hasAccessToken: !!C,
117
+ hasWorkspaceToken: !!w
114
118
  });
115
119
  }, [
116
- S,
117
120
  C,
118
- h
121
+ w,
122
+ g
119
123
  ]), a(() => {
120
124
  if (typeof window > "u") return;
121
125
  let e = async (e) => {
122
- h && console.log("[MultiGatewayProvider] Context changed; evicting cache + refetching", e);
123
- try {
124
- j.cache.evict({ id: "ROOT_QUERY" }), j.cache.gc();
125
- } catch {}
126
+ g && console.log("[MultiGatewayProvider] Context changed; evicting cache + refetching", e);
126
127
  try {
127
128
  M.cache.evict({ id: "ROOT_QUERY" }), M.cache.gc();
128
129
  } catch {}
129
130
  try {
130
- await j.refetchQueries({ include: "active" });
131
+ N.cache.evict({ id: "ROOT_QUERY" }), N.cache.gc();
131
132
  } catch {}
132
133
  try {
133
134
  await M.refetchQueries({ include: "active" });
134
135
  } catch {}
136
+ try {
137
+ await N.refetchQueries({ include: "active" });
138
+ } catch {}
135
139
  };
136
140
  return window.addEventListener("burdenoff:workspace-changed", e), window.addEventListener("burdenoff:organization-changed", e), window.addEventListener("burdenoff:project-changed", e), () => {
137
141
  window.removeEventListener("burdenoff:workspace-changed", e), window.removeEventListener("burdenoff:organization-changed", e), window.removeEventListener("burdenoff:project-changed", e);
138
142
  };
139
143
  }, [
140
- j,
141
144
  M,
142
- h
145
+ N,
146
+ g
143
147
  ]), a(() => {
144
- let e = j, t = M;
148
+ let e = M, t = N;
145
149
  return () => {
146
- if (h && console.log("[MultiGatewayProvider] Cleaning up Apollo clients"), !(typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.endsWith(".local.burdenoff.com")))) {
150
+ if (g && console.log("[MultiGatewayProvider] Cleaning up Apollo clients"), !(typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.endsWith(".local.burdenoff.com")))) {
147
151
  try {
148
152
  e.stop();
149
153
  } catch {}
@@ -153,21 +157,21 @@ function u({ children: u, workspaceBaseUrl: d, globalBaseUrl: f, organizationId:
153
157
  }
154
158
  };
155
159
  }, [
156
- j,
157
160
  M,
158
- h
161
+ N,
162
+ g
159
163
  ]), /* @__PURE__ */ c(n, {
160
164
  value: o(() => ({
161
- workspaceClient: j,
162
- globalClient: M,
163
- getClient: N
165
+ workspaceClient: M,
166
+ globalClient: N,
167
+ getClient: P
164
168
  }), [
165
- j,
166
169
  M,
167
- N
170
+ N,
171
+ P
168
172
  ]),
169
173
  children: /* @__PURE__ */ c(l, {
170
- client: m === "workspace" ? j : M,
174
+ client: h === "workspace" ? M : N,
171
175
  children: u
172
176
  })
173
177
  });
@@ -27,6 +27,7 @@ export interface GatewayBaseMapping {
27
27
  /** Gateway bases for this hostname */
28
28
  bases: GatewayBases;
29
29
  }
30
+ export declare function clearGatewayGraphQLResponseCache(): void;
30
31
  /**
31
32
  * Resolve gateway base URLs from the current hostname.
32
33
  *
@@ -35,22 +36,17 @@ export interface GatewayBaseMapping {
35
36
  */
36
37
  export declare function resolveGatewayBases(extraMappings?: GatewayBaseMapping[], localDefaults?: GatewayBases): GatewayBases;
37
38
  /**
38
- * Attach Cloudflare Access service-token headers to a request iff a token is
39
- * provided AND the request targets one of the CF-protected gateway origins.
40
- * Pure + exported so it can be unit-tested without mocking `import.meta.env`.
39
+ * @deprecated Browser service-token headers are intentionally unsupported.
40
+ * Cloudflare Access client secrets must never be attached from app code.
41
41
  */
42
- export declare function maybeAttachCfAccessHeaders(request: Request, gatewayOrigins: ReadonlySet<string>, clientId?: string, clientSecret?: string): Request;
42
+ export declare function maybeAttachCfAccessHeaders(request: Request, _gatewayOrigins: ReadonlySet<string>, _clientId?: string, _clientSecret?: string): Request;
43
43
  /**
44
44
  * Options for installGatewayFetchRewrite.
45
45
  */
46
46
  export interface GatewayFetchRewriteOptions {
47
47
  /**
48
- * Cloudflare Access service-token. Vite only statically inlines custom VITE_
49
- * env vars in APP source, not inside this bundled library, so the app reads
50
- * `import.meta.env.VITE_CF_ACCESS_CLIENT_ID/_SECRET` in its own source and
51
- * forwards them here. When both are present, CF-Access-Client-Id/Secret headers
52
- * are attached to requests targeting a configured gateway origin. Omit on
53
- * prod/local (gateways are not CF-gated).
48
+ * @deprecated Browser Cloudflare Access service-token forwarding is disabled.
49
+ * Client secrets must stay out of browser request headers.
54
50
  */
55
51
  cfAccess?: {
56
52
  clientId?: string;
@@ -65,9 +61,9 @@ export interface GatewayFetchRewriteOptions {
65
61
  * - `/workspaces/graphql` → workspaceBase
66
62
  *
67
63
  * @param bases - Gateway base URLs to rewrite to
68
- * @param options - Optional CF Access service-token for header injection
64
+ * @param options - Deprecated options retained for source compatibility; ignored
69
65
  */
70
- export declare function installGatewayFetchRewrite(bases: GatewayBases, options?: GatewayFetchRewriteOptions): void;
66
+ export declare function installGatewayFetchRewrite(bases: GatewayBases, _options?: GatewayFetchRewriteOptions): void;
71
67
  /**
72
68
  * Suppress verbose console output in production/non-debug environments.
73
69
  *
@@ -1 +1 @@
1
- {"version":3,"file":"gatewayFetchRewrite.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/gatewayFetchRewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;CACrB;AAmID;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,kBAAkB,EAAE,EACpC,aAAa,CAAC,EAAE,YAAY,GAC3B,YAAY,CAad;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,EACnC,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAaT;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,0BAA0B,GACnC,IAAI,CA6IN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAyB,GAAG,IAAI,CAQtE"}
1
+ {"version":3,"file":"gatewayFetchRewrite.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/gatewayFetchRewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,KAAK,EAAE,YAAY,CAAC;CACrB;AAmED,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAkED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,kBAAkB,EAAE,EACpC,aAAa,CAAC,EAAE,YAAY,GAC3B,YAAY,CAad;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,EACpC,SAAS,CAAC,EAAE,MAAM,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAET;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,QAAQ,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,YAAY,EACnB,QAAQ,CAAC,EAAE,0BAA0B,GACpC,IAAI,CAqHN;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,SAAyB,GAAG,IAAI,CAQtE"}
@@ -36,25 +36,28 @@ function l() {
36
36
  let e = globalThis;
37
37
  return e.__boffGraphQLResponseCache ||= /* @__PURE__ */ new Map(), e.__boffGraphQLResponseCache;
38
38
  }
39
- function u(e) {
40
- return typeof e.query == "string" ? /\bquery\b/.test(e.query) && !/\bmutation\b|\bsubscription\b/.test(e.query) : !1;
39
+ function u() {
40
+ l().clear();
41
41
  }
42
42
  function d(e) {
43
- return typeof e.operationName == "string" && e.operationName ? e.operationName : typeof e.query == "string" ? e.query.match(/(?:query|mutation|subscription)\s+([A-Za-z0-9_]+)/)?.[1] ?? null : null;
43
+ return typeof e.query == "string" ? /\bquery\b/.test(e.query) && !/\bmutation\b|\bsubscription\b/.test(e.query) : !1;
44
44
  }
45
45
  function f(e) {
46
+ return typeof e.operationName == "string" && e.operationName ? e.operationName : typeof e.query == "string" ? e.query.match(/(?:query|mutation|subscription)\s+([A-Za-z0-9_]+)/)?.[1] ?? null : null;
47
+ }
48
+ function p(e) {
46
49
  return Object.fromEntries(c.map((t) => [t, e.get(t) ?? ""]));
47
50
  }
48
- function p(e, t) {
49
- let n = d(t);
50
- return !n || !u(t) ? null : JSON.stringify({
51
+ function m(e, t) {
52
+ let n = f(t);
53
+ return !n || !d(t) ? null : JSON.stringify({
51
54
  url: e.url,
52
- headers: f(e.headers),
55
+ headers: p(e.headers),
53
56
  operationName: n,
54
57
  variables: t.variables ?? null
55
58
  });
56
59
  }
57
- function m(e) {
60
+ function h(e) {
58
61
  try {
59
62
  let t = JSON.parse(e);
60
63
  return Array.isArray(t) ? t : t && typeof t == "object" ? [t] : null;
@@ -62,58 +65,42 @@ function m(e) {
62
65
  return null;
63
66
  }
64
67
  }
65
- function h(e, t) {
68
+ function g(e, t) {
66
69
  return new Response(JSON.stringify(t ? e : e[0]), {
67
70
  status: 200,
68
71
  headers: { "content-type": "application/json" }
69
72
  });
70
73
  }
71
- function g() {
74
+ function _() {
72
75
  return typeof performance < "u" && performance.now() < o;
73
76
  }
74
- function _(e) {
77
+ function v(e) {
75
78
  let t = new Headers(e.headers), n = !1;
76
79
  for (let e of s) t.has(e) && (t.delete(e), n = !0);
77
80
  return n ? new Request(e, { headers: t }) : e;
78
81
  }
79
- function v(e, t) {
82
+ function y(e, t) {
80
83
  let n = window.location.hostname.toLowerCase(), a = [...r, ...e ?? []];
81
84
  for (let e of a) if (n === e.hostname) return e.bases;
82
85
  return t ?? i;
83
86
  }
84
- function y(e, t, n, r) {
85
- if (!n || !r) return e;
86
- let i;
87
- try {
88
- i = new URL(e.url).origin;
89
- } catch {
90
- return e;
91
- }
92
- if (!t.has(i)) return e;
93
- let a = new Headers(e.headers);
94
- return a.set("CF-Access-Client-Id", n), a.set("CF-Access-Client-Secret", r), new Request(e, { headers: a });
95
- }
96
87
  function b(e, t) {
97
88
  let { globalBase: n, workspaceBase: r } = e;
98
89
  if (!n || !r) return;
99
- let i = globalThis.fetch.bind(globalThis), o = window.location.origin, s = t?.cfAccess?.clientId, c = t?.cfAccess?.clientSecret, u = !!(s && c), d = /* @__PURE__ */ new Set();
100
- if (u) for (let e of [n, r]) try {
101
- d.add(new URL(e).origin);
102
- } catch {}
103
- let f = (e) => u ? y(e, d, s, c) : e, v = new Set([o, "https://gw-global.local.burdenoff.com"]), b = new Set([o, "https://gw-wspace.local.burdenoff.com"]), x = (e) => /(?:^|\/)global\/graphql$/.test(e) ? "/global/graphql" : /(?:^|\/)workspaces\/graphql$/.test(e) ? "/workspaces/graphql" : "", S = (e) => {
104
- let t = new URL(e, window.location.origin), i = x(t.pathname);
105
- return i === "/global/graphql" && v.has(t.origin) ? `${n}${i}${t.search}${t.hash}` : i === "/workspaces/graphql" && b.has(t.origin) ? `${r}${i}${t.search}${t.hash}` : e;
106
- }, C = async (e) => {
90
+ let i = globalThis.fetch.bind(globalThis), o = window.location.origin, s = new Set([o, "https://gw-global.local.burdenoff.com"]), c = new Set([o, "https://gw-wspace.local.burdenoff.com"]), u = (e) => /(?:^|\/)global\/graphql$/.test(e) ? "/global/graphql" : /(?:^|\/)workspaces\/graphql$/.test(e) ? "/workspaces/graphql" : "", d = (e) => {
91
+ let t = new URL(e, window.location.origin), i = u(t.pathname);
92
+ return i === "/global/graphql" && s.has(t.origin) ? `${n}${i}${t.search}${t.hash}` : i === "/workspaces/graphql" && c.has(t.origin) ? `${r}${i}${t.search}${t.hash}` : e;
93
+ }, f = async (e) => {
107
94
  if (!(e.method.toUpperCase() === "POST" && /(?:^|\/)graphql$/.test(new URL(e.url).pathname))) return i(e);
108
- let t = await e.clone().text(), n = _(e.clone()), r = m(t);
95
+ let t = await e.clone().text(), n = v(e.clone()), r = h(t);
109
96
  if (!r?.length) return i(e);
110
- let o = t.trimStart().startsWith("["), s = r.map((e) => p(n, e));
111
- if (g() && s.every(Boolean)) {
97
+ let o = t.trimStart().startsWith("["), s = r.map((e) => m(n, e));
98
+ if (_() && s.every(Boolean)) {
112
99
  let e = l(), t = s.map((t) => e.get(t)), n = Date.now();
113
- if (t.every((e) => e && e.expiresAt > n)) return h(t.map((e) => e.value), o);
100
+ if (t.every((e) => e && e.expiresAt > n)) return g(t.map((e) => e.value), o);
114
101
  }
115
102
  let c = await i(e);
116
- if (!c.ok || !s.some(Boolean) || !g()) return c;
103
+ if (!c.ok || !s.some(Boolean) || !_()) return c;
117
104
  try {
118
105
  let e = await c.clone().json(), t = Array.isArray(e) ? e : [e], n = l();
119
106
  t.forEach((e, t) => {
@@ -125,16 +112,16 @@ function b(e, t) {
125
112
  });
126
113
  } catch {}
127
114
  return c;
128
- }, w = i, T = ((e, t) => {
115
+ }, p = i, y = ((e, t) => {
129
116
  if (e == null) return i(e, t);
130
117
  if (e instanceof Request) {
131
- let n = S(e.url), r = new Request(n, e);
132
- return C(f(t ? new Request(r, t) : r));
118
+ let n = d(e.url), r = new Request(n, e);
119
+ return f(t ? new Request(r, t) : r);
133
120
  }
134
121
  let n = typeof e == "string" ? e : e.toString();
135
- return C(f(new Request(S(n), t)));
122
+ return f(new Request(d(n), t));
136
123
  });
137
- w.preconnect && (T.preconnect = w.preconnect), globalThis.fetch = T;
124
+ p.preconnect && (y.preconnect = p.preconnect), globalThis.fetch = y;
138
125
  }
139
126
  function x(e = "VITE_VERBOSE_CONSOLE") {
140
127
  ({
@@ -146,4 +133,4 @@ function x(e = "VITE_VERBOSE_CONSOLE") {
146
133
  })?.[e] !== "true" && (console.log = () => {}, console.info = () => {}, console.debug = () => {});
147
134
  }
148
135
  //#endregion
149
- export { b as installGatewayFetchRewrite, v as resolveGatewayBases, x as suppressConsole };
136
+ export { u as clearGatewayGraphQLResponseCache, b as installGatewayFetchRewrite, y as resolveGatewayBases, x as suppressConsole };
@@ -9,7 +9,8 @@ import { useGlobalUi as s } from "./shared/providers/shell/GlobalUiProvider.js";
9
9
  import { useShellUi as c } from "./shared/providers/shell/ShellUiProvider.js";
10
10
  import { useContextManager as l } from "./shared/providers/shell/ContextManagerProvider.js";
11
11
  import { useGeography as u } from "./shared/geography/GeographyProvider.js";
12
- import { useGlobalSearch as d } from "./shared/hooks/shell/useGlobalSearch.js";
13
- import { useProducts as f } from "./shared/hooks/shell/useProducts.js";
14
- import { useLanguages as p } from "./shared/hooks/shell/useLanguages.js";
15
- export { t as useActiveContext, e as useAuth, l as useContextManager, o as useFeatureFlags, r as useFooterRegistryStore, u as useGeography, d as useGlobalSearch, s as useGlobalUi, a as useI18n, p as useLanguages, n as useNavRegistryStore, f as useProducts, c as useShellUi, i as useTheme };
12
+ import { useEffectiveContext as d, useEffectiveWorkspaceId as f } from "./shared/hooks/shell/useEffectiveContext.js";
13
+ import { useGlobalSearch as p } from "./shared/hooks/shell/useGlobalSearch.js";
14
+ import { useProducts as m } from "./shared/hooks/shell/useProducts.js";
15
+ import { useLanguages as h } from "./shared/hooks/shell/useLanguages.js";
16
+ export { t as useActiveContext, e as useAuth, l as useContextManager, d as useEffectiveContext, f as useEffectiveWorkspaceId, o as useFeatureFlags, r as useFooterRegistryStore, u as useGeography, p as useGlobalSearch, s as useGlobalUi, a as useI18n, h as useLanguages, n as useNavRegistryStore, m as useProducts, c as useShellUi, i as useTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.627.1",
3
+ "version": "2026.627.3",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "imports": {