@burdenoff/fe-libs 2026.528.3 → 2026.528.5

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.
@@ -13,6 +13,15 @@ export interface ActorInput {
13
13
  actorType: string;
14
14
  }
15
15
  export interface UseActorProfilesOptions {
16
+ /**
17
+ * Override the global gateway base URL. Most callers should leave this
18
+ * unset — the hook resolves the correct global gateway URL from the
19
+ * current hostname (LOCAL/ALPHA/PROD).
20
+ *
21
+ * Note: many microfes are handed a *workspace* gateway URL as their
22
+ * `apiGatewayUrl` prop, which is NOT compatible with this user query.
23
+ * Don't forward such a prop here unless you know it's a global URL.
24
+ */
16
25
  apiGatewayUrl?: string;
17
26
  authToken?: string;
18
27
  orgId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useActorProfiles.d.ts","sourceRoot":"","sources":["../../../src/shared/actors/useActorProfiles.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmDD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAWlE;AAsBD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,uBAA4B,GACpC,eAAe,CAwGjB"}
1
+ {"version":3,"file":"useActorProfiles.d.ts","sourceRoot":"","sources":["../../../src/shared/actors/useActorProfiles.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAE3D,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAmDD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAWlE;AAsBD;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,uBAA4B,GACpC,eAAe,CAsHjB"}
@@ -1,11 +1,12 @@
1
- import { graphqlFetch as e } from "../graphql/fetch.js";
2
- import { useEffect as t, useMemo as n, useRef as r, useState as i } from "react";
1
+ import { resolveGatewayUrls as e } from "../config/gatewayUrls.js";
2
+ import { graphqlFetch as t } from "../graphql/fetch.js";
3
+ import { useEffect as n, useMemo as r, useRef as i, useState as a } from "react";
3
4
  //#region src/shared/actors/useActorProfiles.ts
4
- var a = "\n query ActorProfileUser($id: ID!) {\n user(id: $id) {\n id\n email\n firstName\n lastName\n name\n username\n avatar\n }\n }\n";
5
- function o(e) {
5
+ var o = "\n query ActorProfileUser($id: ID!) {\n user(id: $id) {\n id\n email\n firstName\n lastName\n name\n username\n avatar\n }\n }\n";
6
+ function s(e) {
6
7
  return e.length <= 12 ? e : `${e.slice(0, 8)}…${e.slice(-4)}`;
7
8
  }
8
- function s(e) {
9
+ function c(e) {
9
10
  switch (e.toLowerCase()) {
10
11
  case "user": return "User";
11
12
  case "app": return "App";
@@ -14,97 +15,104 @@ function s(e) {
14
15
  default: return e.split("_").map((e) => e.charAt(0) + e.slice(1).toLowerCase()).join(" ");
15
16
  }
16
17
  }
17
- function c(e) {
18
+ function l(e) {
18
19
  return {
19
20
  actorId: e.actorId,
20
21
  actorType: e.actorType,
21
- displayName: e.actorType.toLowerCase() === "user" ? `User ${o(e.actorId)}` : s(e.actorType),
22
- secondaryLabel: o(e.actorId),
22
+ displayName: e.actorType.toLowerCase() === "user" ? `User ${s(e.actorId)}` : c(e.actorType),
23
+ secondaryLabel: s(e.actorId),
23
24
  resolved: !1
24
25
  };
25
26
  }
26
- var l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = 300 * 1e3, f = /* @__PURE__ */ new Map();
27
- function p(e) {
28
- let t = f.get(e);
27
+ var u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = 300 * 1e3, p = /* @__PURE__ */ new Map();
28
+ function m(e) {
29
+ let t = p.get(e);
29
30
  if (!t || t < Date.now()) {
30
- l.delete(e), f.delete(e);
31
+ u.delete(e), p.delete(e);
31
32
  return;
32
33
  }
33
- return l.get(e);
34
+ return u.get(e);
34
35
  }
35
- function m(e) {
36
- l.set(e.actorId, e), f.set(e.actorId, Date.now() + d);
36
+ function h(e) {
37
+ u.set(e.actorId, e), p.set(e.actorId, Date.now() + f);
37
38
  }
38
- function h(s, l = {}) {
39
- let { apiGatewayUrl: d, authToken: f, orgId: h } = l, [g, _] = i(() => {
39
+ function g(c, u = {}) {
40
+ let { apiGatewayUrl: f, authToken: p, orgId: g } = u, _ = r(() => {
41
+ if (f && !f.includes("workspaces")) return f;
42
+ try {
43
+ return e().globalBaseUrl;
44
+ } catch {
45
+ return;
46
+ }
47
+ }, [f]), [v, y] = a(() => {
40
48
  let e = {};
41
- for (let t of s) {
42
- let n = p(t.actorId);
43
- e[t.actorId] = n ?? c(t);
49
+ for (let t of c) {
50
+ let n = m(t.actorId);
51
+ e[t.actorId] = n ?? l(t);
44
52
  }
45
53
  return e;
46
- }), v = n(() => s.map((e) => `${e.actorId}|${e.actorType}`).sort().join(","), [s]), y = r(void 0);
47
- return t(() => {
48
- let t = !1;
49
- y.current = f;
50
- async function n(t) {
51
- let n = p(t.actorId);
54
+ }), b = r(() => c.map((e) => `${e.actorId}|${e.actorType}`).sort().join(","), [c]), x = i(void 0);
55
+ return n(() => {
56
+ let e = !1;
57
+ x.current = p;
58
+ async function n(e) {
59
+ let n = m(e.actorId);
52
60
  if (n?.resolved) return n;
53
- if (t.actorType.toLowerCase() !== "user") {
54
- let e = c(t);
55
- return m(e), e;
61
+ if (e.actorType.toLowerCase() !== "user") {
62
+ let t = l(e);
63
+ return h(t), t;
56
64
  }
57
- let r = t.actorId, i = u.get(r);
65
+ let r = e.actorId, i = d.get(r);
58
66
  if (i) return i;
59
- let s = (async () => {
67
+ let a = (async () => {
60
68
  try {
61
- let n = await e({
69
+ let n = await t({
62
70
  gateway: "global",
63
- baseUrl: d,
64
- authToken: f,
65
- organizationId: h,
66
- query: a,
67
- variables: { id: t.actorId }
71
+ baseUrl: _,
72
+ authToken: p,
73
+ organizationId: g,
74
+ query: o,
75
+ variables: { id: e.actorId }
68
76
  });
69
77
  if (n.errors?.length || !n.data?.user) {
70
- let e = c(t);
71
- return m(e), e;
78
+ let t = l(e);
79
+ return h(t), t;
72
80
  }
73
- let r = n.data.user, i = r.name?.trim() || [r.firstName, r.lastName].filter(Boolean).join(" ").trim() || r.username?.trim() || r.email?.trim() || `User ${o(t.actorId)}`, s = {
74
- actorId: t.actorId,
75
- actorType: t.actorType,
81
+ let r = n.data.user, i = r.name?.trim() || [r.firstName, r.lastName].filter(Boolean).join(" ").trim() || r.username?.trim() || r.email?.trim() || `User ${s(e.actorId)}`, a = {
82
+ actorId: e.actorId,
83
+ actorType: e.actorType,
76
84
  displayName: i,
77
- secondaryLabel: r.email ?? o(t.actorId),
85
+ secondaryLabel: r.email ?? s(e.actorId),
78
86
  email: r.email ?? void 0,
79
87
  avatarUrl: r.avatar ?? void 0,
80
88
  resolved: !0
81
89
  };
82
- return m(s), s;
90
+ return h(a), a;
83
91
  } catch {
84
- return c(t);
92
+ return l(e);
85
93
  } finally {
86
- u.delete(r);
94
+ d.delete(r);
87
95
  }
88
96
  })();
89
- return u.set(r, s), s;
97
+ return d.set(r, a), a;
90
98
  }
91
99
  async function r() {
92
- let e = await Promise.all(s.map(n));
93
- t || _((t) => {
94
- let n = { ...t };
95
- for (let t of e) n[t.actorId] = t;
100
+ let t = await Promise.all(c.map(n));
101
+ e || y((e) => {
102
+ let n = { ...e };
103
+ for (let e of t) n[e.actorId] = e;
96
104
  return n;
97
105
  });
98
106
  }
99
107
  return r(), () => {
100
- t = !0;
108
+ e = !0;
101
109
  };
102
110
  }, [
103
- v,
104
- f,
105
- d,
106
- h
107
- ]), g;
111
+ b,
112
+ p,
113
+ _,
114
+ g
115
+ ]), v;
108
116
  }
109
117
  //#endregion
110
- export { c as buildActorFallback, h as useActorProfiles };
118
+ export { l as buildActorFallback, g as useActorProfiles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.528.3",
3
+ "version": "2026.528.5",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "type": "module",
6
6
  "imports": {