@burdenoff/fe-libs 2026.928.2 → 2026.929.1

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.
Files changed (142) hide show
  1. package/dist/shared/assistant/adminModeSendGate.d.ts +6 -5
  2. package/dist/shared/assistant/adminModeSendGate.d.ts.map +1 -1
  3. package/dist/shared/assistant/adminModeSendGate.js +11 -11
  4. package/dist/shared/assistant/api.d.ts +291 -28
  5. package/dist/shared/assistant/api.d.ts.map +1 -1
  6. package/dist/shared/assistant/api.js +351 -147
  7. package/dist/shared/assistant/autoRouting.d.ts +11 -3
  8. package/dist/shared/assistant/autoRouting.d.ts.map +1 -1
  9. package/dist/shared/assistant/autoRouting.js +7 -7
  10. package/dist/shared/assistant/capabilities.d.ts +28 -0
  11. package/dist/shared/assistant/capabilities.d.ts.map +1 -1
  12. package/dist/shared/assistant/capabilities.js +19 -10
  13. package/dist/shared/assistant/conversation.d.ts +24 -2
  14. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  15. package/dist/shared/assistant/createSandboxAssistantTransport.d.ts.map +1 -1
  16. package/dist/shared/assistant/createSandboxAssistantTransport.js +67 -54
  17. package/dist/shared/assistant/history/historyList.js +1 -1
  18. package/dist/shared/assistant/history/historyMapping.d.ts.map +1 -1
  19. package/dist/shared/assistant/history/historyMapping.js +5 -1
  20. package/dist/shared/assistant/history/historyResume.js +7 -7
  21. package/dist/shared/assistant/i18nManifest.d.ts +53 -0
  22. package/dist/shared/assistant/i18nManifest.d.ts.map +1 -1
  23. package/dist/shared/assistant/i18nManifest.js +75 -16
  24. package/dist/shared/assistant/index.d.ts +15 -0
  25. package/dist/shared/assistant/index.d.ts.map +1 -1
  26. package/dist/shared/assistant/modeCapabilities.js +1 -1
  27. package/dist/shared/assistant/operations.d.ts +22 -0
  28. package/dist/shared/assistant/operations.d.ts.map +1 -1
  29. package/dist/shared/assistant/operations.js +2 -2
  30. package/dist/shared/assistant/prewarm.d.ts +7 -0
  31. package/dist/shared/assistant/prewarm.d.ts.map +1 -1
  32. package/dist/shared/assistant/prewarm.js +1 -1
  33. package/dist/shared/assistant/product.d.ts +80 -2
  34. package/dist/shared/assistant/product.d.ts.map +1 -1
  35. package/dist/shared/assistant/product.js +10 -6
  36. package/dist/shared/assistant/proposalWriteRules.d.ts +40 -0
  37. package/dist/shared/assistant/proposalWriteRules.d.ts.map +1 -0
  38. package/dist/shared/assistant/proposalWriteRules.js +14 -0
  39. package/dist/shared/assistant/store.d.ts +17 -0
  40. package/dist/shared/assistant/store.d.ts.map +1 -1
  41. package/dist/shared/assistant/store.js +50 -43
  42. package/dist/shared/assistant/turnOutcome.d.ts +34 -2
  43. package/dist/shared/assistant/turnOutcome.d.ts.map +1 -1
  44. package/dist/shared/assistant/turnOutcome.js +28 -17
  45. package/dist/shared/assistant/turnOutcomeCopy.d.ts +29 -7
  46. package/dist/shared/assistant/turnOutcomeCopy.d.ts.map +1 -1
  47. package/dist/shared/assistant/turnOutcomeCopy.js +18 -6
  48. package/dist/shared/assistant/types.d.ts +5 -1
  49. package/dist/shared/assistant/types.d.ts.map +1 -1
  50. package/dist/shared/assistant/ui/AssistantApiCallsConsentDialog.js +4 -4
  51. package/dist/shared/assistant/ui/AssistantChatArea.d.ts.map +1 -1
  52. package/dist/shared/assistant/ui/AssistantChatArea.js +989 -718
  53. package/dist/shared/assistant/ui/AssistantConversationList.js +6 -6
  54. package/dist/shared/assistant/ui/AssistantLanguageMenu.js +6 -6
  55. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts +8 -1
  56. package/dist/shared/assistant/ui/AssistantMessageItem.d.ts.map +1 -1
  57. package/dist/shared/assistant/ui/AssistantMessageItem.js +77 -76
  58. package/dist/shared/assistant/ui/AssistantMessageList.d.ts +13 -1
  59. package/dist/shared/assistant/ui/AssistantMessageList.d.ts.map +1 -1
  60. package/dist/shared/assistant/ui/AssistantMessageList.js +15 -13
  61. package/dist/shared/assistant/ui/AssistantReplyLanguageSelector.js +5 -5
  62. package/dist/shared/assistant/ui/AssistantSpeechProvider.js +209 -209
  63. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts +62 -0
  64. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.d.ts.map +1 -0
  65. package/dist/shared/assistant/ui/AssistantWriteConfirmDialog.js +253 -0
  66. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts +72 -0
  67. package/dist/shared/assistant/ui/AssistantWriteProposalCard.d.ts.map +1 -0
  68. package/dist/shared/assistant/ui/AssistantWriteProposalCard.js +439 -0
  69. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts +40 -0
  70. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.d.ts.map +1 -0
  71. package/dist/shared/assistant/ui/AssistantWriteProposalSlot.js +35 -0
  72. package/dist/shared/assistant/ui/composer/AssistantComposer.js +8 -8
  73. package/dist/shared/assistant/ui/useVoiceSession.d.ts +28 -0
  74. package/dist/shared/assistant/ui/useVoiceSession.d.ts.map +1 -1
  75. package/dist/shared/assistant/ui/useVoiceSession.js +159 -110
  76. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts +61 -0
  77. package/dist/shared/assistant/ui/useWriteProposalConfirm.d.ts.map +1 -0
  78. package/dist/shared/assistant/ui/useWriteProposalConfirm.js +109 -0
  79. package/dist/shared/assistant/ui/useWriteProposals.d.ts +102 -0
  80. package/dist/shared/assistant/ui/useWriteProposals.d.ts.map +1 -0
  81. package/dist/shared/assistant/ui/useWriteProposals.js +230 -0
  82. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts +17 -1
  83. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.d.ts.map +1 -1
  84. package/dist/shared/assistant/ui/voice/AssistantVoiceSession.js +141 -109
  85. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts +76 -0
  86. package/dist/shared/assistant/ui/writeProposalPresentation.d.ts.map +1 -0
  87. package/dist/shared/assistant/ui/writeProposalPresentation.js +110 -0
  88. package/dist/shared/assistant/usageReporting.d.ts +108 -0
  89. package/dist/shared/assistant/usageReporting.d.ts.map +1 -0
  90. package/dist/shared/assistant/usageReporting.js +155 -0
  91. package/dist/shared/assistant/useAssistantApiAccess.d.ts +49 -14
  92. package/dist/shared/assistant/useAssistantApiAccess.d.ts.map +1 -1
  93. package/dist/shared/assistant/useAssistantApiAccess.js +43 -25
  94. package/dist/shared/assistant/useAssistantHeartbeat.d.ts.map +1 -1
  95. package/dist/shared/assistant/useAssistantHeartbeat.js +5 -5
  96. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts +5 -6
  97. package/dist/shared/assistant/useWorkspaceWriteAccess.d.ts.map +1 -1
  98. package/dist/shared/assistant/voice/voiceSession.d.ts +46 -0
  99. package/dist/shared/assistant/voice/voiceSession.d.ts.map +1 -1
  100. package/dist/shared/assistant/voice/voiceSession.js +35 -2
  101. package/dist/shared/assistant/writeConfirmSeam.d.ts +32 -0
  102. package/dist/shared/assistant/writeConfirmSeam.d.ts.map +1 -0
  103. package/dist/shared/assistant/writeConfirmSeam.js +23 -0
  104. package/dist/shared/assistant/writeModeConsent.d.ts +16 -8
  105. package/dist/shared/assistant/writeModeConsent.d.ts.map +1 -1
  106. package/dist/shared/assistant/writeModeConsent.js +2 -2
  107. package/dist/shared/assistant/writeProposalDiscovery.d.ts +123 -0
  108. package/dist/shared/assistant/writeProposalDiscovery.d.ts.map +1 -0
  109. package/dist/shared/assistant/writeProposalDiscovery.js +210 -0
  110. package/dist/shared/assistant/writeProposalErrorCopy.d.ts +135 -0
  111. package/dist/shared/assistant/writeProposalErrorCopy.d.ts.map +1 -0
  112. package/dist/shared/assistant/writeProposalErrorCopy.js +135 -0
  113. package/dist/shared/assistant/writeProposalVoice.d.ts +133 -0
  114. package/dist/shared/assistant/writeProposalVoice.d.ts.map +1 -0
  115. package/dist/shared/assistant/writeProposalVoice.js +66 -0
  116. package/dist/shared/assistant/writeProposals.d.ts +268 -0
  117. package/dist/shared/assistant/writeProposals.d.ts.map +1 -0
  118. package/dist/shared/assistant/writeProposals.js +445 -0
  119. package/dist/shared/assistant/writeReplyBinder.d.ts +166 -0
  120. package/dist/shared/assistant/writeReplyBinder.d.ts.map +1 -0
  121. package/dist/shared/assistant/writeReplyBinder.js +233 -0
  122. package/dist/shared/assistant/writeReplySend.d.ts +110 -0
  123. package/dist/shared/assistant/writeReplySend.d.ts.map +1 -0
  124. package/dist/shared/assistant/writeReplySend.js +93 -0
  125. package/dist/shared/graphql/fetch.d.ts +12 -1
  126. package/dist/shared/graphql/fetch.d.ts.map +1 -1
  127. package/dist/shared/graphql/fetch.js +101 -80
  128. package/dist/shared/providers/shell/ActiveContextProvider.d.ts.map +1 -1
  129. package/dist/shared/providers/shell/ActiveContextProvider.js +28 -26
  130. package/dist/shared/providers/shell/PersonaSurfaceProvider.d.ts.map +1 -1
  131. package/dist/shared/providers/shell/PersonaSurfaceProvider.js +165 -193
  132. package/dist/shared/providers/shell/personaSurfaceRemote.d.ts +8 -2
  133. package/dist/shared/providers/shell/personaSurfaceRemote.d.ts.map +1 -1
  134. package/dist/shared/providers/shell/personaSurfaceRemote.js +37 -15
  135. package/dist/shared/providers/shell/useRemoteNavPreferences.d.ts +30 -0
  136. package/dist/shared/providers/shell/useRemoteNavPreferences.d.ts.map +1 -0
  137. package/dist/shared/providers/shell/useRemoteNavPreferences.js +43 -0
  138. package/dist/shared-assistant.js +167 -152
  139. package/dist/ui/modal-shell.d.ts +14 -1
  140. package/dist/ui/modal-shell.d.ts.map +1 -1
  141. package/dist/ui/modal-shell.js +8 -6
  142. package/package.json +2 -2
@@ -1,20 +1,20 @@
1
- import { graphqlFetch as e } from "../../graphql/fetch.js";
2
- import { useHasAuthToken as t } from "../../graphql/useHasAuthToken.js";
3
- import { useSafePermissions as n } from "./PermissionProvider.js";
4
- import { createNavView as r, deleteNavView as i, fetchNavPreferences as ee, saveNavPreferences as te, updateNavView as ne } from "./personaSurfaceRemote.js";
5
- import { createContext as a, use as o, useCallback as s, useEffect as c, useMemo as l, useRef as re, useState as u } from "react";
6
- import { jsx as ie } from "react/jsx-runtime";
7
- import { useQuery as d } from "@tanstack/react-query";
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 f = "everything", p = a(null), m = [
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
- ], h = [
17
- ...m,
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 g(e) {
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" ? h : m;
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 _(e, t) {
45
- if (t.length === 0) return f;
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 f;
48
+ return d;
49
49
  }
50
- function ae(e, t) {
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 _(e, [t.roleName]);
54
+ return g(e, [t.roleName]);
55
55
  }
56
- function oe(e, t) {
56
+ function ae(e, t) {
57
57
  return `boff-persona:${e}:${t ?? "no-scope"}`;
58
58
  }
59
- function v(e) {
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 y(e, t) {
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
- var se = "\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";
77
- function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace", persistence: b = "local" }) {
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
- O([]);
79
+ T(_(S));
85
80
  }, [S]);
86
- let ce = t(), k = d({
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
- if (!A) return;
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: A.activeViewId ?? void 0,
102
- overridesBySurface: A.overridesByView
94
+ surfaceId: O.activeViewId ?? void 0,
95
+ overridesBySurface: O.overridesByView
103
96
  };
104
- E(e), y(C, e), O(A.customViews);
105
- }, [A, C]);
106
- let j = re(null), M = s((e) => {
107
- !w || !S || (j.current && clearTimeout(j.current), j.current = setTimeout(() => {
108
- te(h, {
109
- workspaceId: S,
110
- productSlug: m,
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
- w,
117
- S,
118
- h,
119
- m
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 y(C, n), M(n), n;
111
+ return v(S, n), A(n), n;
128
112
  });
129
- }, [C, M]), [P, F] = u(null), [I, L] = u(!1);
113
+ }, [S, A]), [M, N] = u(null), [P, F] = u(!1);
130
114
  c(() => {
131
- F(null), L(!1);
132
- }, [S]);
133
- let R = x?.isSuperAdmin ?? !1, z = !!x && (R || x.hasPermission("rbac:read")), B = d({
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
- h,
137
- S,
138
- m
120
+ m,
121
+ x,
122
+ p
139
123
  ],
140
- queryFn: async () => {
141
- let t = await e({
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
- }), V = s(() => {
156
- L(!0);
157
- }, []), H = s((e) => {
158
- F({
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: g(e)
134
+ permissionStrings: h(e)
163
135
  });
164
- }, []), le = s(() => {
165
- F(null);
166
- }, []), U = l(() => x?.permissions?.roles ?? [], [x?.permissions?.roles]), W = l(() => P ? ae(o, P) : _(o, U), [
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
- P,
169
- U
170
- ]), G = l(() => {
171
- if (P) return W;
172
- let e = T.surfaceId;
173
- return e && (e === "everything" || o.some((t) => t.id === e) || D.some((t) => t.id === e)) ? e : W;
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
- P,
176
- W,
177
- T.surfaceId,
147
+ M,
148
+ U,
149
+ w.surfaceId,
178
150
  o,
179
- D
180
- ]), K = l(() => {
181
- let e = o.find((e) => e.id === G);
151
+ E
152
+ ]), G = l(() => {
153
+ let e = o.find((e) => e.id === W);
182
154
  if (e) return e;
183
- let t = D.find((e) => e.id === G);
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
- D,
194
- G
195
- ]), q = l(() => {
196
- let e = new Set(U);
197
- return [...o.filter((t) => R || t.roleNames.some((t) => e.has(t))).map((e) => e.id), f];
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
- R,
201
- U
202
- ]), J = s((e) => {
203
- N((t) => ({
172
+ I,
173
+ H
174
+ ]), q = s((e) => {
175
+ j((t) => ({
204
176
  ...t,
205
177
  surfaceId: e ?? void 0
206
178
  }));
207
- }, [N]), Y = l(() => T.overridesBySurface?.[G] ?? {}, [T.overridesBySurface, G]), X = s((e, t) => {
208
- N((n) => {
209
- let r = { ...n.overridesBySurface ?? {} }, i = { ...r[G] ?? {} };
210
- return t === null ? delete i[e] : i[e] = t, Object.keys(i).length === 0 ? delete r[G] : r[G] = i, {
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
- }, [N, G]), Z = s(() => {
216
- N((e) => {
187
+ }, [j, W]), X = s(() => {
188
+ j((e) => {
217
189
  let t = { ...e.overridesBySurface ?? {} };
218
- return delete t[G], {
190
+ return delete t[W], {
219
191
  ...e,
220
192
  overridesBySurface: t
221
193
  };
222
194
  });
223
- }, [N, G]), [Q, ue] = u(!1), de = w && !!S && !!k.data, fe = s(async (e, t, n) => {
224
- if (!w || !S) return null;
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 r(h, {
227
- workspaceId: S,
228
- productSlug: m,
198
+ let i = await n(m, {
199
+ workspaceId: x,
200
+ productSlug: p,
229
201
  name: e,
230
202
  visibleItems: t,
231
- homePath: n ?? null
203
+ homePath: r ?? null
232
204
  });
233
- return O((e) => [...e, i]), N((e) => ({
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
- w,
242
- S,
243
- h,
213
+ C,
214
+ x,
244
215
  m,
245
- N
246
- ]), pe = s(async (e, t) => {
247
- if (!w || !S) return !1;
216
+ p,
217
+ j
218
+ ]), ce = s(async (e, t) => {
219
+ if (!C || !x) return !1;
248
220
  try {
249
- let n = await ne(h, e, {
250
- workspaceId: S,
221
+ let n = await ee(m, e, {
222
+ workspaceId: x,
251
223
  name: t
252
224
  });
253
- return O((t) => t.map((t) => t.id === e ? {
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
- w,
262
- S,
263
- h
264
- ]), $ = s(async (e) => {
265
- if (!w || !S) return !1;
233
+ C,
234
+ x,
235
+ m
236
+ ]), le = s(async (e) => {
237
+ if (!C || !x) return !1;
266
238
  try {
267
- return await i(h, e, S), O((t) => t.filter((t) => t.id !== e)), N((t) => {
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
- w,
279
- S,
280
- h,
281
- N
282
- ]), me = l(() => ({
250
+ C,
251
+ x,
252
+ m,
253
+ j
254
+ ]), ue = l(() => ({
283
255
  surfaces: o,
284
- activeSurfaceId: G,
285
- activeSurface: K,
286
- resolvedSurfaceId: W,
287
- availableSurfaceIds: q,
288
- setSurfaceId: J,
289
- overrides: Y,
290
- setItemOverride: X,
291
- resetOverrides: Z,
292
- customizeOpen: Q,
293
- setCustomizeOpen: ue,
294
- canSimulate: z,
295
- simulation: P,
296
- startSimulation: H,
297
- stopSimulation: le,
298
- simulatableRoles: B.data ?? [],
299
- simulatableRolesLoading: B.isLoading && I,
300
- loadSimulatableRoles: V,
301
- customViews: D,
302
- canManageViews: de,
303
- createCustomView: fe,
304
- renameCustomView: pe,
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
- Q,
317
- z,
318
- P,
319
- H,
320
- le,
321
- B.data,
322
- B.isLoading,
323
- I,
289
+ L,
290
+ M,
291
+ B,
324
292
  V,
325
- D,
326
- de,
327
- fe,
328
- pe,
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__ */ ie(p.Provider, {
332
- value: me,
303
+ return /* @__PURE__ */ ne(f.Provider, {
304
+ value: ue,
333
305
  children: a
334
306
  });
335
307
  }
336
- function x() {
337
- let e = o(p);
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 S() {
342
- return o(p);
313
+ function x() {
314
+ return o(f);
343
315
  }
344
316
  //#endregion
345
- export { f as EVERYTHING_SURFACE_ID, b as PersonaSurfaceProvider, _ as resolveSurfaceForRoles, g as synthesizeSimulatedPermissionStrings, x as usePersonaSurface, S as useSafePersonaSurface };
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;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE,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,GAClB,OAAO,CAAC,oBAAoB,CAAC,CAsB/B;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IACL,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACvE,GACA,OAAO,CAAC,IAAI,CAAC,CAef;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IACL,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GACA,OAAO,CAAC,gBAAgB,CAAC,CAW3B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/F,OAAO,CAAC,gBAAgB,CAAC,CAW3B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CAQf"}
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,EAAE;IACL,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CACvE,GACA,OAAO,CAAC,IAAI,CAAC,CAgBf;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;IACL,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GACA,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC/F,OAAO,CAAC,gBAAgB,CAAC,CAY3B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,MAAM,EACV,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC,CASf;AAqBD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,eAAe,EAAE,CAAC,CAgB5B"}
@@ -13,22 +13,24 @@ function o(e) {
13
13
  function s(e) {
14
14
  return e?.length ? Error(e[0].message) : null;
15
15
  }
16
- async function c(n, r, i) {
17
- let a = await e({
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
- }), c = s(a.errors);
25
- if (c) throw c;
26
- let l = a.data?.myNavPreferences;
27
- if (!l) throw Error("No nav preferences returned");
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: l.activeViewId,
30
- overridesByView: o(l.overridesJson),
31
- customViews: l.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"}