@burdenoff/fe-libs 2026.723.3 → 2026.723.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chrome/NavCustomizeDialog.d.ts.map +1 -1
- package/dist/chrome/NavCustomizeDialog.js +197 -70
- package/dist/chrome/PersonaSurfaceControls.d.ts.map +1 -1
- package/dist/chrome/PersonaSurfaceControls.js +69 -38
- package/dist/shared/providers/shell/PersonaSurfaceProvider.d.ts +34 -1
- package/dist/shared/providers/shell/PersonaSurfaceProvider.d.ts.map +1 -1
- package/dist/shared/providers/shell/PersonaSurfaceProvider.js +234 -106
- package/dist/shared/providers/shell/index.d.ts +1 -1
- package/dist/shared/providers/shell/index.d.ts.map +1 -1
- package/dist/shared/providers/shell/personaSurfaceRemote.d.ts +37 -0
- package/dist/shared/providers/shell/personaSurfaceRemote.d.ts.map +1 -0
- package/dist/shared/providers/shell/personaSurfaceRemote.js +84 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavCustomizeDialog.d.ts","sourceRoot":"","sources":["../../src/chrome/NavCustomizeDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"NavCustomizeDialog.d.ts","sourceRoot":"","sources":["../../src/chrome/NavCustomizeDialog.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,MAAM,WAAW,uBAAuB;IACtC,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAyFD,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,UAAU,EACV,eAA8B,GAC/B,EAAE,uBAAuB,kDA6RzB"}
|
|
@@ -4,24 +4,24 @@ import { Switch as o } from "../ui/switch.js";
|
|
|
4
4
|
import { useSafePermissions as s } from "../shared/providers/shell/PermissionProvider.js";
|
|
5
5
|
import { useSafePersonaSurface as c } from "../shared/providers/shell/PersonaSurfaceProvider.js";
|
|
6
6
|
import { applyPermissionFilter as l, isItemEffectivelyShown as u } from "./sideNavigation/navVisibility.js";
|
|
7
|
-
import {
|
|
8
|
-
import { Fragment as
|
|
7
|
+
import { useEffect as d, useMemo as f, useState as p } from "react";
|
|
8
|
+
import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
9
|
//#region src/chrome/NavCustomizeDialog.tsx
|
|
10
|
-
function
|
|
10
|
+
function _({ item: e, depth: t, parentShown: n, surfaceVisibleItems: r, overrides: i, onToggle: a }) {
|
|
11
11
|
let s = u(e, n, r, i), c = s && (!r || r.includes(e.id) || i[e.id] === "shown");
|
|
12
|
-
return /* @__PURE__ */ m
|
|
12
|
+
return /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ g("div", {
|
|
13
13
|
className: "flex items-center justify-between gap-3 py-1.5",
|
|
14
14
|
style: { paddingLeft: t * 16 },
|
|
15
|
-
children: [/* @__PURE__ */
|
|
15
|
+
children: [/* @__PURE__ */ h("span", {
|
|
16
16
|
className: `truncate text-body-sm ${s ? "text-text-primary" : "text-text-muted"}`,
|
|
17
17
|
children: e.label
|
|
18
|
-
}), /* @__PURE__ */
|
|
18
|
+
}), /* @__PURE__ */ h(o, {
|
|
19
19
|
checked: s,
|
|
20
20
|
onCheckedChange: (t) => a(e, n, t === !0),
|
|
21
21
|
"aria-label": `Show ${e.label} in the menu`,
|
|
22
22
|
"data-testid": `persona-toggle-${e.id}`
|
|
23
23
|
})]
|
|
24
|
-
}), e.children?.map((e) => /* @__PURE__ */
|
|
24
|
+
}), e.children?.map((e) => /* @__PURE__ */ h(_, {
|
|
25
25
|
item: e,
|
|
26
26
|
depth: t + 1,
|
|
27
27
|
parentShown: c,
|
|
@@ -30,94 +30,221 @@ function h({ item: e, depth: t, parentShown: n, surfaceVisibleItems: r, override
|
|
|
30
30
|
onToggle: a
|
|
31
31
|
}, e.id))] });
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
let
|
|
35
|
-
let
|
|
36
|
-
|
|
33
|
+
function v(e, t, n) {
|
|
34
|
+
let r = [], i = (e, a) => {
|
|
35
|
+
for (let o of e) {
|
|
36
|
+
let e = u(o, a, t, n);
|
|
37
|
+
e && r.push(o.id);
|
|
38
|
+
let s = e && (!t || t.includes(o.id) || n[o.id] === "shown");
|
|
39
|
+
o.children && i(o.children, s);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return i(e, !1), r;
|
|
43
|
+
}
|
|
44
|
+
function y({ groupLabels: o, groupOrder: m, everythingLabel: y = "Everything" }) {
|
|
45
|
+
let b = c(), x = s(), S = a((e) => e.items), [C, w] = p(""), [T, E] = p(null), [D, O] = p(!1), [k, A] = p(null), j = x?.hasPermission, M = x?.isLoading ?? !1, N = f(() => {
|
|
46
|
+
let e = S.filter((e) => e.visible !== !1);
|
|
47
|
+
return !j || M ? e : l(e, j);
|
|
37
48
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
])
|
|
49
|
+
S,
|
|
50
|
+
j,
|
|
51
|
+
M
|
|
52
|
+
]);
|
|
53
|
+
d(() => {
|
|
54
|
+
w(""), E(null), A(null);
|
|
55
|
+
}, [b?.customizeOpen ?? !1]);
|
|
56
|
+
let ee = f(() => {
|
|
42
57
|
let e = /* @__PURE__ */ new Map();
|
|
43
|
-
for (let t of
|
|
58
|
+
for (let t of N) {
|
|
44
59
|
let n = t.group ?? "__default__", r = e.get(n);
|
|
45
60
|
r ? r.push(t) : e.set(n, [t]);
|
|
46
61
|
}
|
|
47
|
-
return [...
|
|
62
|
+
return [...m ?? [], ...Array.from(e.keys()).filter((e) => !(m ?? []).includes(e))].filter((t) => (e.get(t)?.length ?? 0) > 0).map((t) => ({
|
|
48
63
|
key: t,
|
|
49
64
|
label: t === "__default__" ? null : o?.[t] ?? t,
|
|
50
65
|
items: e.get(t) ?? []
|
|
51
66
|
}));
|
|
52
67
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
68
|
+
N,
|
|
69
|
+
m,
|
|
55
70
|
o
|
|
56
71
|
]);
|
|
57
|
-
if (!
|
|
58
|
-
let { activeSurfaceId:
|
|
59
|
-
let r = u(e, t,
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
72
|
+
if (!b) return null;
|
|
73
|
+
let { activeSurfaceId: P, activeSurface: F, overrides: I, setItemOverride: L, resetOverrides: R, customizeOpen: z, setCustomizeOpen: te, simulation: B, customViews: ne, canManageViews: V, createCustomView: H, renameCustomView: U, deleteCustomView: W } = b, G = F ? F.visibleItems : null, K = (e, t, n) => {
|
|
74
|
+
let r = u(e, t, G, {});
|
|
75
|
+
L(e.id, n === r ? null : n ? "shown" : "hidden");
|
|
76
|
+
}, q = Object.keys(I).length, J = P === "everything" ? y : F?.label ?? P, Y = ne.find((e) => e.id === P) ?? null, X = async () => {
|
|
77
|
+
let e = C.trim();
|
|
78
|
+
if (!e || D) return;
|
|
79
|
+
O(!0), A(null);
|
|
80
|
+
let t = await H(e, v(N, G, I));
|
|
81
|
+
O(!1), t ? w("") : A("Could not save the view — try a different name.");
|
|
82
|
+
}, Z = async () => {
|
|
83
|
+
if (!Y || T === null || D) return;
|
|
84
|
+
let e = T.trim();
|
|
85
|
+
if (!e || e === Y.name) {
|
|
86
|
+
E(null);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
O(!0), A(null);
|
|
90
|
+
let t = await U(Y.id, e);
|
|
91
|
+
O(!1), t ? E(null) : A("Could not rename the view — try a different name.");
|
|
92
|
+
}, re = async () => {
|
|
93
|
+
if (!Y || D) return;
|
|
94
|
+
O(!0), A(null);
|
|
95
|
+
let e = await W(Y.id);
|
|
96
|
+
O(!1), e || A("Could not delete the view.");
|
|
97
|
+
}, Q = "w-full rounded-button border border-border-subtle bg-bg-canvas px-3 py-2 text-body-sm text-text-primary placeholder:text-text-muted", $ = "rounded-button border border-border-subtle px-3 py-2 text-body-sm font-medium text-text-primary hover:bg-bg-sunken transition-colors disabled:opacity-50";
|
|
98
|
+
return /* @__PURE__ */ h(e, {
|
|
99
|
+
open: z,
|
|
100
|
+
onOpenChange: te,
|
|
101
|
+
children: /* @__PURE__ */ g(t, {
|
|
66
102
|
className: "max-h-[85vh] overflow-y-auto sm:max-w-lg",
|
|
67
|
-
children: [/* @__PURE__ */
|
|
103
|
+
children: [/* @__PURE__ */ g(r, { children: [/* @__PURE__ */ h(i, { children: "Customize menu" }), /* @__PURE__ */ g(n, { children: [
|
|
68
104
|
"Choose which pages appear in the",
|
|
69
105
|
" ",
|
|
70
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ h("span", {
|
|
71
107
|
className: "font-medium text-text-primary",
|
|
72
|
-
children:
|
|
108
|
+
children: J
|
|
73
109
|
}),
|
|
74
110
|
" view. Hidden pages stay one click away under “more” and in search — nothing is removed."
|
|
75
|
-
] })] }), /* @__PURE__ */
|
|
111
|
+
] })] }), /* @__PURE__ */ g("div", {
|
|
76
112
|
className: "space-y-5",
|
|
77
|
-
children:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
children: [/* @__PURE__ */ p("h3", {
|
|
113
|
+
children: [
|
|
114
|
+
Y && !B && /* @__PURE__ */ g("section", {
|
|
115
|
+
className: "space-y-2",
|
|
116
|
+
"data-testid": "persona-dialog-manage-view",
|
|
117
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
83
118
|
className: "text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
84
|
-
children: "
|
|
85
|
-
}),
|
|
86
|
-
|
|
87
|
-
onClick: O,
|
|
88
|
-
className: "text-body-sm text-text-secondary underline-offset-2 hover:text-text-primary hover:underline",
|
|
89
|
-
"data-testid": "persona-dialog-reset-overrides",
|
|
119
|
+
children: "This view"
|
|
120
|
+
}), T === null ? /* @__PURE__ */ g("div", {
|
|
121
|
+
className: "flex items-center gap-2",
|
|
90
122
|
children: [
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
123
|
+
/* @__PURE__ */ h("span", {
|
|
124
|
+
className: "min-w-0 flex-1 truncate text-body-sm text-text-primary",
|
|
125
|
+
children: Y.name
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ h("button", {
|
|
128
|
+
type: "button",
|
|
129
|
+
onClick: () => E(Y.name),
|
|
130
|
+
className: $,
|
|
131
|
+
"data-testid": "persona-dialog-rename-view",
|
|
132
|
+
children: "Rename"
|
|
133
|
+
}),
|
|
134
|
+
/* @__PURE__ */ h("button", {
|
|
135
|
+
type: "button",
|
|
136
|
+
onClick: re,
|
|
137
|
+
disabled: D,
|
|
138
|
+
className: `${$} text-status-error-text`,
|
|
139
|
+
"data-testid": "persona-dialog-delete-view",
|
|
140
|
+
children: "Delete"
|
|
141
|
+
})
|
|
95
142
|
]
|
|
143
|
+
}) : /* @__PURE__ */ g("div", {
|
|
144
|
+
className: "flex items-center gap-2",
|
|
145
|
+
children: [/* @__PURE__ */ h("input", {
|
|
146
|
+
value: T,
|
|
147
|
+
onChange: (e) => E(e.target.value),
|
|
148
|
+
onKeyDown: (e) => {
|
|
149
|
+
e.key === "Enter" && Z();
|
|
150
|
+
},
|
|
151
|
+
maxLength: 60,
|
|
152
|
+
className: Q,
|
|
153
|
+
"data-testid": "persona-dialog-rename-input"
|
|
154
|
+
}), /* @__PURE__ */ h("button", {
|
|
155
|
+
type: "button",
|
|
156
|
+
onClick: () => void Z(),
|
|
157
|
+
disabled: D,
|
|
158
|
+
className: $,
|
|
159
|
+
"data-testid": "persona-dialog-rename-save",
|
|
160
|
+
children: "Save"
|
|
161
|
+
})]
|
|
96
162
|
})]
|
|
97
|
-
}),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
163
|
+
}),
|
|
164
|
+
/* @__PURE__ */ g("section", {
|
|
165
|
+
className: "space-y-1",
|
|
166
|
+
"data-testid": "persona-dialog-items",
|
|
167
|
+
children: [/* @__PURE__ */ g("div", {
|
|
168
|
+
className: "flex items-center justify-between",
|
|
169
|
+
children: [/* @__PURE__ */ h("h3", {
|
|
170
|
+
className: "text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
171
|
+
children: "Menu items"
|
|
172
|
+
}), q > 0 && /* @__PURE__ */ g("button", {
|
|
173
|
+
type: "button",
|
|
174
|
+
onClick: R,
|
|
175
|
+
className: "text-body-sm text-text-secondary underline-offset-2 hover:text-text-primary hover:underline",
|
|
176
|
+
"data-testid": "persona-dialog-reset-overrides",
|
|
177
|
+
children: [
|
|
178
|
+
"Reset ",
|
|
179
|
+
q,
|
|
180
|
+
" change",
|
|
181
|
+
q === 1 ? "" : "s"
|
|
182
|
+
]
|
|
183
|
+
})]
|
|
184
|
+
}), B ? /* @__PURE__ */ h("p", {
|
|
185
|
+
className: "py-2 text-body-sm text-text-muted",
|
|
186
|
+
children: "Exit role simulation to customize your own menu."
|
|
187
|
+
}) : ee.map((e) => /* @__PURE__ */ g("div", {
|
|
188
|
+
className: "pt-2",
|
|
189
|
+
children: [e.label && /* @__PURE__ */ h("p", {
|
|
190
|
+
className: "pb-1 text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
191
|
+
children: e.label
|
|
192
|
+
}), /* @__PURE__ */ h("div", {
|
|
193
|
+
className: "divide-y divide-border-subtle",
|
|
194
|
+
children: e.items.map((e) => /* @__PURE__ */ h(_, {
|
|
195
|
+
item: e,
|
|
196
|
+
depth: 0,
|
|
197
|
+
parentShown: !1,
|
|
198
|
+
surfaceVisibleItems: G,
|
|
199
|
+
overrides: I,
|
|
200
|
+
onToggle: K
|
|
201
|
+
}, e.id))
|
|
202
|
+
})]
|
|
203
|
+
}, e.key))]
|
|
204
|
+
}),
|
|
205
|
+
V && !B && /* @__PURE__ */ g("section", {
|
|
206
|
+
className: "space-y-2",
|
|
207
|
+
"data-testid": "persona-dialog-save-view",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ h("h3", {
|
|
210
|
+
className: "text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
211
|
+
children: "Save as new view"
|
|
212
|
+
}),
|
|
213
|
+
/* @__PURE__ */ h("p", {
|
|
214
|
+
className: "text-body-sm text-text-muted",
|
|
215
|
+
children: "Saves the menu exactly as configured above as your own view, available on all your devices."
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ g("div", {
|
|
218
|
+
className: "flex items-center gap-2",
|
|
219
|
+
children: [/* @__PURE__ */ h("input", {
|
|
220
|
+
value: C,
|
|
221
|
+
onChange: (e) => w(e.target.value),
|
|
222
|
+
onKeyDown: (e) => {
|
|
223
|
+
e.key === "Enter" && X();
|
|
224
|
+
},
|
|
225
|
+
placeholder: "View name (e.g. Harvest season)",
|
|
226
|
+
maxLength: 60,
|
|
227
|
+
className: Q,
|
|
228
|
+
"data-testid": "persona-dialog-new-view-name"
|
|
229
|
+
}), /* @__PURE__ */ h("button", {
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: () => void X(),
|
|
232
|
+
disabled: D || !C.trim(),
|
|
233
|
+
className: $,
|
|
234
|
+
"data-testid": "persona-dialog-new-view-save",
|
|
235
|
+
children: "Save"
|
|
236
|
+
})]
|
|
237
|
+
}),
|
|
238
|
+
k && /* @__PURE__ */ h("p", {
|
|
239
|
+
className: "text-body-sm text-status-error-text",
|
|
240
|
+
children: k
|
|
241
|
+
})
|
|
242
|
+
]
|
|
243
|
+
})
|
|
244
|
+
]
|
|
118
245
|
})]
|
|
119
246
|
})
|
|
120
247
|
});
|
|
121
248
|
}
|
|
122
249
|
//#endregion
|
|
123
|
-
export {
|
|
250
|
+
export { y as NavCustomizeDialog };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonaSurfaceControls.d.ts","sourceRoot":"","sources":["../../src/chrome/PersonaSurfaceControls.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkBH,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;
|
|
1
|
+
{"version":3,"file":"PersonaSurfaceControls.d.ts","sourceRoot":"","sources":["../../src/chrome/PersonaSurfaceControls.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAkBH,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAqWD,wBAAgB,sBAAsB,CAAC,EACrC,eAA8B,EAC9B,cAAiC,GAClC,EAAE,2BAA2B,kDA6C7B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,mDAyBpC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useShellUi as e } from "../shared/providers/shell/ShellUiProvider.js";
|
|
2
2
|
import { useSafePersonaSurface as t } from "../shared/providers/shell/PersonaSurfaceProvider.js";
|
|
3
3
|
import { useCallback as n, useEffect as r, useRef as i, useState as a } from "react";
|
|
4
|
-
import { Check as o, ChevronsUpDown as s, Eye as c,
|
|
4
|
+
import { Check as o, ChevronsUpDown as s, Eye as c, Plus as l, Search as u, SlidersHorizontal as d, X as ee } from "lucide-react";
|
|
5
5
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
6
6
|
import { createPortal as h } from "react-dom";
|
|
7
7
|
//#region src/chrome/PersonaSurfaceControls.tsx
|
|
8
|
-
function
|
|
8
|
+
function te(e, t) {
|
|
9
9
|
let { surfaces: n, availableSurfaceIds: r, resolvedSurfaceId: i } = e, a = (e) => e === "everything" ? t : n.find((t) => t.id === e)?.label ?? e, o = [...r];
|
|
10
10
|
return o.sort((e, t) => {
|
|
11
11
|
let n = (e) => e === i ? 0 : e === "everything" ? 2 : 1;
|
|
@@ -16,14 +16,14 @@ function g(e, t) {
|
|
|
16
16
|
isResolved: e === i
|
|
17
17
|
}));
|
|
18
18
|
}
|
|
19
|
-
var
|
|
20
|
-
function
|
|
21
|
-
let
|
|
19
|
+
var g = 300;
|
|
20
|
+
function _({ everythingLabel: e, onOpenCustomize: d }) {
|
|
21
|
+
let _ = t(), [v, y] = a(!1), [b, x] = a(""), [S, C] = a(null), w = i(null), T = i(null), E = i(null), D = i(null), O = n(() => {
|
|
22
22
|
y(!1), x("");
|
|
23
23
|
}, []), k = n(() => {
|
|
24
24
|
let e = T.current?.getBoundingClientRect();
|
|
25
25
|
if (!e) return;
|
|
26
|
-
let t = window.innerWidth, n = Math.min(Math.max(e.width,
|
|
26
|
+
let t = window.innerWidth, n = Math.min(Math.max(e.width, g), t - 16), r = Math.min(Math.max(8, e.left), t - n - 8);
|
|
27
27
|
C((t) => {
|
|
28
28
|
let i = window.innerHeight - e.top + 8;
|
|
29
29
|
return t && t.left === r && t.bottom === i && t.width === n ? t : {
|
|
@@ -54,22 +54,22 @@ function v({ everythingLabel: e }) {
|
|
|
54
54
|
};
|
|
55
55
|
}, [v, O]), r(() => {
|
|
56
56
|
v && D.current?.focus();
|
|
57
|
-
}, [v]), !
|
|
58
|
-
let { activeSurfaceId: A, surfaces: j, resolvedSurfaceId: M, setSurfaceId: N, canSimulate: P, simulation: F, startSimulation: I, stopSimulation: L, simulatableRoles: R, simulatableRolesLoading: z, loadSimulatableRoles: B } =
|
|
57
|
+
}, [v]), !_) return null;
|
|
58
|
+
let { activeSurfaceId: A, surfaces: j, resolvedSurfaceId: M, setSurfaceId: N, canSimulate: P, simulation: F, startSimulation: I, stopSimulation: L, simulatableRoles: R, simulatableRolesLoading: z, loadSimulatableRoles: B, customViews: V, canManageViews: H } = _, U = te(_, e), W = b.trim().toLowerCase(), G = W ? U.filter((e) => e.label.toLowerCase().includes(W)) : U, K = W ? V.filter((e) => e.name.toLowerCase().includes(W)) : V, q = W ? R.filter((e) => e.name.toLowerCase().includes(W)) : R, J = F ? F.roleName : U.find((e) => e.id === A)?.label ?? j.find((e) => e.id === A)?.label ?? V.find((e) => e.id === A)?.name ?? e, Y = () => {
|
|
59
59
|
if (v) {
|
|
60
60
|
O();
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
P && B(), y(!0);
|
|
64
|
-
},
|
|
64
|
+
}, X = (e) => {
|
|
65
65
|
e.key === "Escape" && v && (e.preventDefault(), e.stopPropagation(), O());
|
|
66
|
-
},
|
|
66
|
+
}, Z = (e) => {
|
|
67
67
|
F && L(), N(e === M ? null : e), O();
|
|
68
|
-
},
|
|
68
|
+
}, Q = "flex w-full min-h-9 items-center gap-2 rounded-button px-2.5 py-1.5 text-left text-body-sm text-text-primary hover:bg-bg-sunken transition-colors", $ = "px-2.5 pb-1 pt-2.5 text-[11px] font-medium uppercase tracking-wider text-text-muted";
|
|
69
69
|
return /* @__PURE__ */ m("div", {
|
|
70
70
|
ref: w,
|
|
71
71
|
className: "relative min-w-0 flex-1",
|
|
72
|
-
onKeyDown:
|
|
72
|
+
onKeyDown: X,
|
|
73
73
|
children: [v && S && typeof document < "u" && h(/* @__PURE__ */ m("div", {
|
|
74
74
|
ref: E,
|
|
75
75
|
style: {
|
|
@@ -80,10 +80,10 @@ function v({ everythingLabel: e }) {
|
|
|
80
80
|
className: "fixed z-[130] flex max-h-80 flex-col overflow-hidden rounded-card border border-border-subtle bg-bg-canvas shadow-lg",
|
|
81
81
|
role: "listbox",
|
|
82
82
|
"data-testid": "persona-view-panel",
|
|
83
|
-
onKeyDown:
|
|
83
|
+
onKeyDown: X,
|
|
84
84
|
children: [/* @__PURE__ */ m("div", {
|
|
85
85
|
className: "flex items-center gap-2 border-b border-border-subtle px-2.5 py-2",
|
|
86
|
-
children: [/* @__PURE__ */ p(
|
|
86
|
+
children: [/* @__PURE__ */ p(u, { className: "size-4 flex-shrink-0 text-text-muted" }), /* @__PURE__ */ p("input", {
|
|
87
87
|
ref: D,
|
|
88
88
|
value: b,
|
|
89
89
|
onChange: (e) => x(e.target.value),
|
|
@@ -94,16 +94,16 @@ function v({ everythingLabel: e }) {
|
|
|
94
94
|
}), /* @__PURE__ */ m("div", {
|
|
95
95
|
className: "overflow-y-auto py-1",
|
|
96
96
|
children: [
|
|
97
|
-
|
|
98
|
-
className:
|
|
97
|
+
G.length > 0 && /* @__PURE__ */ p("p", {
|
|
98
|
+
className: $,
|
|
99
99
|
children: "Views"
|
|
100
100
|
}),
|
|
101
|
-
|
|
101
|
+
G.map((e) => {
|
|
102
102
|
let t = !F && e.id === A;
|
|
103
103
|
return /* @__PURE__ */ m("button", {
|
|
104
104
|
type: "button",
|
|
105
|
-
onClick: () =>
|
|
106
|
-
className:
|
|
105
|
+
onClick: () => Z(e.id),
|
|
106
|
+
className: Q,
|
|
107
107
|
"data-testid": `persona-view-${e.id}`,
|
|
108
108
|
children: [
|
|
109
109
|
/* @__PURE__ */ p(o, { className: `size-4 flex-shrink-0 ${t ? "text-text-primary" : "invisible"}` }),
|
|
@@ -118,9 +118,37 @@ function v({ everythingLabel: e }) {
|
|
|
118
118
|
]
|
|
119
119
|
}, e.id);
|
|
120
120
|
}),
|
|
121
|
+
(K.length > 0 || H && !W) && /* @__PURE__ */ m(f, { children: [
|
|
122
|
+
/* @__PURE__ */ p("p", {
|
|
123
|
+
className: $,
|
|
124
|
+
children: "My views"
|
|
125
|
+
}),
|
|
126
|
+
K.map((e) => {
|
|
127
|
+
let t = !F && e.id === A;
|
|
128
|
+
return /* @__PURE__ */ m("button", {
|
|
129
|
+
type: "button",
|
|
130
|
+
onClick: () => Z(e.id),
|
|
131
|
+
className: Q,
|
|
132
|
+
"data-testid": `persona-view-${e.id}`,
|
|
133
|
+
children: [/* @__PURE__ */ p(o, { className: `size-4 flex-shrink-0 ${t ? "text-text-primary" : "invisible"}` }), /* @__PURE__ */ p("span", {
|
|
134
|
+
className: "truncate",
|
|
135
|
+
children: e.name
|
|
136
|
+
})]
|
|
137
|
+
}, e.id);
|
|
138
|
+
}),
|
|
139
|
+
H && !W && /* @__PURE__ */ m("button", {
|
|
140
|
+
type: "button",
|
|
141
|
+
onClick: () => {
|
|
142
|
+
O(), d();
|
|
143
|
+
},
|
|
144
|
+
className: `${Q} text-text-secondary`,
|
|
145
|
+
"data-testid": "persona-view-create",
|
|
146
|
+
children: [/* @__PURE__ */ p(l, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ p("span", { children: "New view from current…" })]
|
|
147
|
+
})
|
|
148
|
+
] }),
|
|
121
149
|
P && /* @__PURE__ */ m(f, { children: [
|
|
122
150
|
/* @__PURE__ */ p("p", {
|
|
123
|
-
className:
|
|
151
|
+
className: $,
|
|
124
152
|
children: "Preview a role"
|
|
125
153
|
}),
|
|
126
154
|
F && /* @__PURE__ */ m("button", {
|
|
@@ -128,22 +156,22 @@ function v({ everythingLabel: e }) {
|
|
|
128
156
|
onClick: () => {
|
|
129
157
|
L(), O();
|
|
130
158
|
},
|
|
131
|
-
className: `${
|
|
159
|
+
className: `${Q} text-status-warning-text`,
|
|
132
160
|
"data-testid": "persona-view-exit-preview",
|
|
133
|
-
children: [/* @__PURE__ */ p(
|
|
161
|
+
children: [/* @__PURE__ */ p(ee, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ p("span", { children: "Exit preview" })]
|
|
134
162
|
}),
|
|
135
163
|
z && /* @__PURE__ */ p("p", {
|
|
136
164
|
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
137
165
|
children: "Loading roles…"
|
|
138
166
|
}),
|
|
139
|
-
|
|
167
|
+
q.map((e) => {
|
|
140
168
|
let t = F?.roleId === e.id;
|
|
141
169
|
return /* @__PURE__ */ m("button", {
|
|
142
170
|
type: "button",
|
|
143
171
|
onClick: () => {
|
|
144
172
|
I(e), O();
|
|
145
173
|
},
|
|
146
|
-
className:
|
|
174
|
+
className: Q,
|
|
147
175
|
"data-testid": `persona-preview-${e.id}`,
|
|
148
176
|
children: [
|
|
149
177
|
/* @__PURE__ */ p(c, { className: `size-4 flex-shrink-0 ${t ? "text-status-warning-text" : "text-text-muted"}` }),
|
|
@@ -155,12 +183,12 @@ function v({ everythingLabel: e }) {
|
|
|
155
183
|
]
|
|
156
184
|
}, e.id);
|
|
157
185
|
}),
|
|
158
|
-
!z &&
|
|
186
|
+
!z && q.length === 0 && W && /* @__PURE__ */ p("p", {
|
|
159
187
|
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
160
188
|
children: "No matching roles"
|
|
161
189
|
})
|
|
162
190
|
] }),
|
|
163
|
-
|
|
191
|
+
G.length === 0 && (!P || q.length === 0) && W && /* @__PURE__ */ p("p", {
|
|
164
192
|
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
165
193
|
children: "No matches"
|
|
166
194
|
})
|
|
@@ -169,7 +197,7 @@ function v({ everythingLabel: e }) {
|
|
|
169
197
|
}), document.body), /* @__PURE__ */ m("button", {
|
|
170
198
|
ref: T,
|
|
171
199
|
type: "button",
|
|
172
|
-
onClick:
|
|
200
|
+
onClick: Y,
|
|
173
201
|
"aria-expanded": v,
|
|
174
202
|
"aria-haspopup": "listbox",
|
|
175
203
|
className: `flex w-full min-h-9 items-center gap-2 rounded-button border px-2.5 py-1.5 text-body-sm transition-colors ${F ? "border-status-warning-text/40 bg-status-warning-bg-subtle text-text-primary" : "border-border-subtle bg-bg-canvas text-text-primary hover:bg-bg-sunken"}`,
|
|
@@ -178,38 +206,41 @@ function v({ everythingLabel: e }) {
|
|
|
178
206
|
F ? /* @__PURE__ */ p(c, { className: "size-4 flex-shrink-0 text-status-warning-text" }) : /* @__PURE__ */ p(o, { className: "size-4 flex-shrink-0 text-text-muted" }),
|
|
179
207
|
/* @__PURE__ */ p("span", {
|
|
180
208
|
className: "min-w-0 flex-1 truncate text-left",
|
|
181
|
-
children: F ? `Preview: ${
|
|
209
|
+
children: F ? `Preview: ${J}` : J
|
|
182
210
|
}),
|
|
183
211
|
/* @__PURE__ */ p(s, { className: "size-4 flex-shrink-0 text-text-muted" })
|
|
184
212
|
]
|
|
185
213
|
})]
|
|
186
214
|
});
|
|
187
215
|
}
|
|
188
|
-
function
|
|
216
|
+
function v({ everythingLabel: n = "Everything", customizeLabel: r = "Customize menu" }) {
|
|
189
217
|
let i = t(), { sidebarCollapsed: a, toggleSidebar: o } = e();
|
|
190
218
|
if (!i) return null;
|
|
191
|
-
let { setCustomizeOpen: s } = i, c =
|
|
219
|
+
let { setCustomizeOpen: s } = i, c = () => {
|
|
220
|
+
typeof window < "u" && window.innerWidth < 768 && !a && o(), s(!0);
|
|
221
|
+
}, l = /* @__PURE__ */ p("button", {
|
|
192
222
|
type: "button",
|
|
193
|
-
onClick:
|
|
194
|
-
typeof window < "u" && window.innerWidth < 768 && !a && o(), s(!0);
|
|
195
|
-
},
|
|
223
|
+
onClick: c,
|
|
196
224
|
className: "p-2 rounded-button text-text-secondary hover:bg-bg-sunken hover:text-text-primary transition-colors flex-shrink-0",
|
|
197
225
|
"aria-label": r,
|
|
198
226
|
title: r,
|
|
199
227
|
"data-testid": "persona-customize-trigger",
|
|
200
|
-
children: /* @__PURE__ */ p(
|
|
228
|
+
children: /* @__PURE__ */ p(d, { className: "size-4" })
|
|
201
229
|
});
|
|
202
230
|
return a ? /* @__PURE__ */ p("div", {
|
|
203
231
|
className: "hidden md:flex justify-center",
|
|
204
232
|
"data-testid": "persona-controls-collapsed",
|
|
205
|
-
children:
|
|
233
|
+
children: l
|
|
206
234
|
}) : /* @__PURE__ */ m("div", {
|
|
207
235
|
className: "flex items-center gap-1",
|
|
208
236
|
"data-testid": "persona-controls",
|
|
209
|
-
children: [/* @__PURE__ */ p(
|
|
237
|
+
children: [/* @__PURE__ */ p(_, {
|
|
238
|
+
everythingLabel: n,
|
|
239
|
+
onOpenCustomize: c
|
|
240
|
+
}), l]
|
|
210
241
|
});
|
|
211
242
|
}
|
|
212
|
-
function
|
|
243
|
+
function y() {
|
|
213
244
|
let e = t();
|
|
214
245
|
return e?.simulation ? /* @__PURE__ */ m("div", {
|
|
215
246
|
className: "fixed bottom-4 left-1/2 z-[120] -translate-x-1/2 flex max-w-[calc(100vw-2rem)] items-center gap-2 rounded-full border border-border-subtle bg-bg-canvas px-4 py-2 shadow-lg",
|
|
@@ -240,4 +271,4 @@ function b() {
|
|
|
240
271
|
}) : null;
|
|
241
272
|
}
|
|
242
273
|
//#endregion
|
|
243
|
-
export {
|
|
274
|
+
export { y as PersonaSimulationPill, v as PersonaSurfaceControls };
|
|
@@ -35,6 +35,18 @@ export interface PersonaSurfaceDefinition {
|
|
|
35
35
|
/** Reserved surface id meaning "no curation — show everything permitted". */
|
|
36
36
|
export declare const EVERYTHING_SURFACE_ID = "everything";
|
|
37
37
|
export type NavItemOverrideState = 'shown' | 'hidden';
|
|
38
|
+
/**
|
|
39
|
+
* A USER-CREATED view: same visibility semantics as a product-defined
|
|
40
|
+
* surface, but owned by one user, named by them, and (in remote-persistence
|
|
41
|
+
* mode) stored server-side so it follows them across devices. Custom views
|
|
42
|
+
* have no role mapping — they are picked explicitly.
|
|
43
|
+
*/
|
|
44
|
+
export interface PersonaCustomView {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
visibleItems: string[];
|
|
48
|
+
homePath: string | null;
|
|
49
|
+
}
|
|
38
50
|
export interface SimulatableRole {
|
|
39
51
|
id: string;
|
|
40
52
|
name: string;
|
|
@@ -85,6 +97,17 @@ export interface PersonaSurfaceContextValue {
|
|
|
85
97
|
simulatableRolesLoading: boolean;
|
|
86
98
|
/** Lazily fetch the workspace role catalog for the simulation picker. */
|
|
87
99
|
loadSimulatableRoles: () => void;
|
|
100
|
+
/** User-created custom views (server-persisted in remote mode). */
|
|
101
|
+
customViews: PersonaCustomView[];
|
|
102
|
+
/**
|
|
103
|
+
* True when custom-view management is available: remote persistence is
|
|
104
|
+
* enabled and the server preferences have loaded.
|
|
105
|
+
*/
|
|
106
|
+
canManageViews: boolean;
|
|
107
|
+
/** Create a view from an explicit visible-item set; activates it. */
|
|
108
|
+
createCustomView: (name: string, visibleItems: string[], homePath?: string | null) => Promise<PersonaCustomView | null>;
|
|
109
|
+
renameCustomView: (id: string, name: string) => Promise<boolean>;
|
|
110
|
+
deleteCustomView: (id: string) => Promise<boolean>;
|
|
88
111
|
}
|
|
89
112
|
export declare function synthesizeSimulatedPermissionStrings(role: SimulatableRole): string[];
|
|
90
113
|
/**
|
|
@@ -107,8 +130,18 @@ export interface PersonaSurfaceProviderProps {
|
|
|
107
130
|
* @default 'workspace'
|
|
108
131
|
*/
|
|
109
132
|
gateway?: 'workspace' | 'global';
|
|
133
|
+
/**
|
|
134
|
+
* Where user choices (active view, per-view item overrides, custom views)
|
|
135
|
+
* live. 'remote' stores them in the backend (wspace-workspace-svc
|
|
136
|
+
* `nav-view` module) keyed by actor+workspace+product, so they follow the
|
|
137
|
+
* user across devices; localStorage stays as a warm cache so the sidebar
|
|
138
|
+
* renders the last-known state instantly while the server responds.
|
|
139
|
+
* 'local' (default, for shells whose backend hasn't onboarded yet) keeps
|
|
140
|
+
* everything device-local.
|
|
141
|
+
*/
|
|
142
|
+
persistence?: 'local' | 'remote';
|
|
110
143
|
}
|
|
111
|
-
export declare function PersonaSurfaceProvider({ children, surfaces, productKey, gateway, }: PersonaSurfaceProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
144
|
+
export declare function PersonaSurfaceProvider({ children, surfaces, productKey, gateway, persistence, }: PersonaSurfaceProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
112
145
|
/** Access the persona surface context; throws outside the provider. */
|
|
113
146
|
export declare function usePersonaSurface(): PersonaSurfaceContextValue;
|
|
114
147
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonaSurfaceProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/PersonaSurfaceProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"PersonaSurfaceProvider.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/PersonaSurfaceProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAiBf,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,gFAAgF;IAChF,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,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UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;IACjC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAClC;AAED,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,OAAqB,EACrB,WAAqB,GACtB,EAAE,2BAA2B,2CAiW7B;AAMD,uEAAuE;AACvE,wBAAgB,iBAAiB,IAAI,0BAA0B,CAM9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,0BAA0B,GAAG,IAAI,CAEzE"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { graphqlFetch as e } from "../../graphql/fetch.js";
|
|
2
2
|
import { useSafePermissions as t } from "./PermissionProvider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { createNavView as n, deleteNavView as r, fetchNavPreferences as i, saveNavPreferences as ee, updateNavView as te } from "./personaSurfaceRemote.js";
|
|
4
|
+
import { createContext as a, use as o, useCallback as s, useEffect as c, useMemo as l, useRef as ne, useState as u } from "react";
|
|
5
|
+
import { jsx as re } from "react/jsx-runtime";
|
|
6
|
+
import { useQuery as d } from "@tanstack/react-query";
|
|
6
7
|
//#region src/shared/providers/shell/PersonaSurfaceProvider.tsx
|
|
7
|
-
var
|
|
8
|
+
var f = "everything", p = a(null), m = [
|
|
8
9
|
"read",
|
|
9
10
|
"list",
|
|
10
11
|
"download",
|
|
11
12
|
"join",
|
|
12
13
|
"leave",
|
|
13
14
|
"vote"
|
|
14
|
-
],
|
|
15
|
-
...
|
|
15
|
+
], h = [
|
|
16
|
+
...m,
|
|
16
17
|
"create",
|
|
17
18
|
"update",
|
|
18
19
|
"share",
|
|
@@ -26,7 +27,7 @@ var u = "everything", d = n(null), f = [
|
|
|
26
27
|
"upload",
|
|
27
28
|
"sync"
|
|
28
29
|
];
|
|
29
|
-
function
|
|
30
|
+
function g(e) {
|
|
30
31
|
let t = [];
|
|
31
32
|
for (let n of e.defaultPermissions) {
|
|
32
33
|
if (n.level === "NONE") continue;
|
|
@@ -34,24 +35,24 @@ function m(e) {
|
|
|
34
35
|
t.push(`${n.resourceType}:*`);
|
|
35
36
|
continue;
|
|
36
37
|
}
|
|
37
|
-
let e = n.level === "EDITOR" ?
|
|
38
|
+
let e = n.level === "EDITOR" ? h : m;
|
|
38
39
|
for (let r of e) t.push(`${n.resourceType}:${r}`);
|
|
39
40
|
}
|
|
40
41
|
return t;
|
|
41
42
|
}
|
|
42
|
-
function
|
|
43
|
-
if (t.length === 0) return
|
|
43
|
+
function _(e, t) {
|
|
44
|
+
if (t.length === 0) return f;
|
|
44
45
|
let n = new Set(t);
|
|
45
46
|
for (let t of e) if (t.roleNames.some((e) => n.has(e))) return t.id;
|
|
46
|
-
return
|
|
47
|
+
return f;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function ie(e, t) {
|
|
49
50
|
if (t.templateKey) {
|
|
50
51
|
for (let n of e) if (n.templateKeys?.includes(t.templateKey)) return n.id;
|
|
51
52
|
}
|
|
52
|
-
return
|
|
53
|
+
return _(e, [t.roleName]);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function ae(e, t) {
|
|
55
56
|
return `boff-persona:${e}:${t ?? "no-scope"}`;
|
|
56
57
|
}
|
|
57
58
|
function v(e) {
|
|
@@ -71,146 +72,273 @@ function y(e, t) {
|
|
|
71
72
|
!t.surfaceId && !n ? window.localStorage.removeItem(e) : window.localStorage.setItem(e, JSON.stringify(t));
|
|
72
73
|
} catch {}
|
|
73
74
|
}
|
|
74
|
-
var
|
|
75
|
-
function
|
|
76
|
-
let x = t(), S = x?.scopeId ?? null, C =
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
var oe = "\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";
|
|
76
|
+
function b({ children: a, surfaces: o, productKey: m, gateway: h = "workspace", persistence: b = "local" }) {
|
|
77
|
+
let x = t(), S = x?.scopeId ?? null, C = ae(m, S), w = b === "remote", [T, E] = u(() => v(C));
|
|
78
|
+
c(() => {
|
|
79
|
+
E(v(C));
|
|
79
80
|
}, [C]);
|
|
80
|
-
let
|
|
81
|
-
|
|
81
|
+
let [D, O] = u([]);
|
|
82
|
+
c(() => {
|
|
83
|
+
O([]);
|
|
84
|
+
}, [S]);
|
|
85
|
+
let k = d({
|
|
86
|
+
queryKey: [
|
|
87
|
+
"persona-nav-preferences",
|
|
88
|
+
h,
|
|
89
|
+
S,
|
|
90
|
+
m
|
|
91
|
+
],
|
|
92
|
+
queryFn: () => i(h, S, m),
|
|
93
|
+
enabled: w && !!S && !!x,
|
|
94
|
+
staleTime: 60 * 1e3,
|
|
95
|
+
retry: 2
|
|
96
|
+
}), { data: A } = k;
|
|
97
|
+
c(() => {
|
|
98
|
+
if (!A) return;
|
|
99
|
+
let e = {
|
|
100
|
+
surfaceId: A.activeViewId ?? void 0,
|
|
101
|
+
overridesBySurface: A.overridesByView
|
|
102
|
+
};
|
|
103
|
+
E(e), y(C, e), O(A.customViews);
|
|
104
|
+
}, [A, C]);
|
|
105
|
+
let j = ne(null), M = s((e) => {
|
|
106
|
+
!w || !S || (j.current && clearTimeout(j.current), j.current = setTimeout(() => {
|
|
107
|
+
ee(h, {
|
|
108
|
+
workspaceId: S,
|
|
109
|
+
productSlug: m,
|
|
110
|
+
activeViewId: e.surfaceId ?? null,
|
|
111
|
+
overridesByView: e.overridesBySurface ?? {}
|
|
112
|
+
}).catch(() => {});
|
|
113
|
+
}, 700));
|
|
114
|
+
}, [
|
|
115
|
+
w,
|
|
116
|
+
S,
|
|
117
|
+
h,
|
|
118
|
+
m
|
|
119
|
+
]);
|
|
120
|
+
c(() => () => {
|
|
121
|
+
j.current && clearTimeout(j.current);
|
|
122
|
+
}, []);
|
|
123
|
+
let N = s((e) => {
|
|
124
|
+
E((t) => {
|
|
82
125
|
let n = e(t);
|
|
83
|
-
return y(C, n), n;
|
|
126
|
+
return y(C, n), M(n), n;
|
|
84
127
|
});
|
|
85
|
-
}, [C]), [
|
|
86
|
-
|
|
87
|
-
|
|
128
|
+
}, [C, M]), [P, F] = u(null), [I, L] = u(!1);
|
|
129
|
+
c(() => {
|
|
130
|
+
F(null), L(!1);
|
|
88
131
|
}, [S]);
|
|
89
|
-
let
|
|
132
|
+
let R = x?.isSuperAdmin ?? !1, z = !!x && (R || x.hasPermission("rbac:read")), B = d({
|
|
90
133
|
queryKey: [
|
|
91
134
|
"persona-simulatable-roles",
|
|
92
|
-
|
|
135
|
+
h,
|
|
93
136
|
S,
|
|
94
|
-
|
|
137
|
+
m
|
|
95
138
|
],
|
|
96
139
|
queryFn: async () => {
|
|
97
140
|
let t = await e({
|
|
98
|
-
query:
|
|
141
|
+
query: oe,
|
|
99
142
|
variables: {
|
|
100
143
|
scopeId: S,
|
|
101
|
-
filter: { product:
|
|
144
|
+
filter: { product: m },
|
|
102
145
|
pagination: { limit: 100 }
|
|
103
146
|
},
|
|
104
|
-
gateway:
|
|
147
|
+
gateway: h
|
|
105
148
|
});
|
|
106
149
|
if (t.errors?.length) throw Error(t.errors[0].message);
|
|
107
150
|
return [...t.data?.roles ?? []].sort((e, t) => t.priority - e.priority);
|
|
108
151
|
},
|
|
109
|
-
enabled:
|
|
152
|
+
enabled: I && z && !!S,
|
|
110
153
|
staleTime: 300 * 1e3
|
|
111
|
-
}),
|
|
112
|
-
|
|
113
|
-
}, []),
|
|
114
|
-
|
|
154
|
+
}), V = s(() => {
|
|
155
|
+
L(!0);
|
|
156
|
+
}, []), H = s((e) => {
|
|
157
|
+
F({
|
|
115
158
|
roleId: e.id,
|
|
116
159
|
roleName: e.name,
|
|
117
160
|
templateKey: e.templateKey,
|
|
118
|
-
permissionStrings:
|
|
161
|
+
permissionStrings: g(e)
|
|
119
162
|
});
|
|
120
|
-
}, []),
|
|
121
|
-
|
|
122
|
-
}, []),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]),
|
|
127
|
-
if (
|
|
128
|
-
let e =
|
|
129
|
-
return e && (e === "everything" ||
|
|
163
|
+
}, []), U = s(() => {
|
|
164
|
+
F(null);
|
|
165
|
+
}, []), W = l(() => x?.permissions?.roles ?? [], [x?.permissions?.roles]), G = l(() => P ? ie(o, P) : _(o, W), [
|
|
166
|
+
o,
|
|
167
|
+
P,
|
|
168
|
+
W
|
|
169
|
+
]), K = l(() => {
|
|
170
|
+
if (P) return G;
|
|
171
|
+
let e = T.surfaceId;
|
|
172
|
+
return e && (e === "everything" || o.some((t) => t.id === e) || D.some((t) => t.id === e)) ? e : G;
|
|
130
173
|
}, [
|
|
174
|
+
P,
|
|
175
|
+
G,
|
|
176
|
+
T.surfaceId,
|
|
177
|
+
o,
|
|
178
|
+
D
|
|
179
|
+
]), q = l(() => {
|
|
180
|
+
let e = o.find((e) => e.id === K);
|
|
181
|
+
if (e) return e;
|
|
182
|
+
let t = D.find((e) => e.id === K);
|
|
183
|
+
return t ? {
|
|
184
|
+
id: t.id,
|
|
185
|
+
label: t.name,
|
|
186
|
+
roleNames: [],
|
|
187
|
+
visibleItems: t.visibleItems,
|
|
188
|
+
homePath: t.homePath ?? void 0
|
|
189
|
+
} : null;
|
|
190
|
+
}, [
|
|
191
|
+
o,
|
|
131
192
|
D,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
let e = new Set(L);
|
|
137
|
-
return [...r.filter((t) => j || t.roleNames.some((t) => e.has(t))).map((e) => e.id), u];
|
|
193
|
+
K
|
|
194
|
+
]), J = l(() => {
|
|
195
|
+
let e = new Set(W);
|
|
196
|
+
return [...o.filter((t) => R || t.roleNames.some((t) => e.has(t))).map((e) => e.id), f];
|
|
138
197
|
}, [
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
]),
|
|
143
|
-
|
|
198
|
+
o,
|
|
199
|
+
R,
|
|
200
|
+
W
|
|
201
|
+
]), Y = s((e) => {
|
|
202
|
+
N((t) => ({
|
|
144
203
|
...t,
|
|
145
204
|
surfaceId: e ?? void 0
|
|
146
205
|
}));
|
|
147
|
-
}, [
|
|
148
|
-
|
|
149
|
-
let r = { ...n.overridesBySurface ?? {} }, i = { ...r[
|
|
150
|
-
return t === null ? delete i[e] : i[e] = t, Object.keys(i).length === 0 ? delete r[
|
|
206
|
+
}, [N]), X = l(() => T.overridesBySurface?.[K] ?? {}, [T.overridesBySurface, K]), Z = s((e, t) => {
|
|
207
|
+
N((n) => {
|
|
208
|
+
let r = { ...n.overridesBySurface ?? {} }, i = { ...r[K] ?? {} };
|
|
209
|
+
return t === null ? delete i[e] : i[e] = t, Object.keys(i).length === 0 ? delete r[K] : r[K] = i, {
|
|
151
210
|
...n,
|
|
152
211
|
overridesBySurface: r
|
|
153
212
|
};
|
|
154
213
|
});
|
|
155
|
-
}, [
|
|
156
|
-
|
|
214
|
+
}, [N, K]), Q = s(() => {
|
|
215
|
+
N((e) => {
|
|
157
216
|
let t = { ...e.overridesBySurface ?? {} };
|
|
158
|
-
return delete t[
|
|
217
|
+
return delete t[K], {
|
|
159
218
|
...e,
|
|
160
219
|
overridesBySurface: t
|
|
161
220
|
};
|
|
162
221
|
});
|
|
163
|
-
}, [
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
222
|
+
}, [N, K]), [$, se] = u(!1), ce = w && !!S && !!k.data, le = s(async (e, t, r) => {
|
|
223
|
+
if (!w || !S) return null;
|
|
224
|
+
try {
|
|
225
|
+
let i = await n(h, {
|
|
226
|
+
workspaceId: S,
|
|
227
|
+
productSlug: m,
|
|
228
|
+
name: e,
|
|
229
|
+
visibleItems: t,
|
|
230
|
+
homePath: r ?? null
|
|
231
|
+
});
|
|
232
|
+
return O((e) => [...e, i]), N((e) => ({
|
|
233
|
+
...e,
|
|
234
|
+
surfaceId: i.id
|
|
235
|
+
})), i;
|
|
236
|
+
} catch {
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
}, [
|
|
240
|
+
w,
|
|
241
|
+
S,
|
|
242
|
+
h,
|
|
243
|
+
m,
|
|
244
|
+
N
|
|
245
|
+
]), ue = s(async (e, t) => {
|
|
246
|
+
if (!w || !S) return !1;
|
|
247
|
+
try {
|
|
248
|
+
let n = await te(h, e, {
|
|
249
|
+
workspaceId: S,
|
|
250
|
+
name: t
|
|
251
|
+
});
|
|
252
|
+
return O((t) => t.map((t) => t.id === e ? {
|
|
253
|
+
...t,
|
|
254
|
+
name: n.name
|
|
255
|
+
} : t)), !0;
|
|
256
|
+
} catch {
|
|
257
|
+
return !1;
|
|
258
|
+
}
|
|
259
|
+
}, [
|
|
260
|
+
w,
|
|
261
|
+
S,
|
|
262
|
+
h
|
|
263
|
+
]), de = s(async (e) => {
|
|
264
|
+
if (!w || !S) return !1;
|
|
265
|
+
try {
|
|
266
|
+
return await r(h, e, S), O((t) => t.filter((t) => t.id !== e)), N((t) => {
|
|
267
|
+
let n = { ...t.overridesBySurface ?? {} };
|
|
268
|
+
return delete n[e], {
|
|
269
|
+
surfaceId: t.surfaceId === e ? void 0 : t.surfaceId,
|
|
270
|
+
overridesBySurface: n
|
|
271
|
+
};
|
|
272
|
+
}), !0;
|
|
273
|
+
} catch {
|
|
274
|
+
return !1;
|
|
275
|
+
}
|
|
276
|
+
}, [
|
|
277
|
+
w,
|
|
278
|
+
S,
|
|
279
|
+
h,
|
|
280
|
+
N
|
|
281
|
+
]), fe = l(() => ({
|
|
282
|
+
surfaces: o,
|
|
283
|
+
activeSurfaceId: K,
|
|
284
|
+
activeSurface: q,
|
|
285
|
+
resolvedSurfaceId: G,
|
|
286
|
+
availableSurfaceIds: J,
|
|
287
|
+
setSurfaceId: Y,
|
|
288
|
+
overrides: X,
|
|
289
|
+
setItemOverride: Z,
|
|
290
|
+
resetOverrides: Q,
|
|
291
|
+
customizeOpen: $,
|
|
292
|
+
setCustomizeOpen: se,
|
|
293
|
+
canSimulate: z,
|
|
294
|
+
simulation: P,
|
|
295
|
+
startSimulation: H,
|
|
296
|
+
stopSimulation: U,
|
|
297
|
+
simulatableRoles: B.data ?? [],
|
|
298
|
+
simulatableRolesLoading: B.isLoading && I,
|
|
299
|
+
loadSimulatableRoles: V,
|
|
300
|
+
customViews: D,
|
|
301
|
+
canManageViews: ce,
|
|
302
|
+
createCustomView: le,
|
|
303
|
+
renameCustomView: ue,
|
|
304
|
+
deleteCustomView: de
|
|
182
305
|
}), [
|
|
183
|
-
|
|
306
|
+
o,
|
|
307
|
+
K,
|
|
308
|
+
q,
|
|
309
|
+
G,
|
|
310
|
+
J,
|
|
311
|
+
Y,
|
|
312
|
+
X,
|
|
313
|
+
Z,
|
|
314
|
+
Q,
|
|
315
|
+
$,
|
|
184
316
|
z,
|
|
185
|
-
|
|
186
|
-
R,
|
|
187
|
-
V,
|
|
317
|
+
P,
|
|
188
318
|
H,
|
|
189
319
|
U,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
K,
|
|
193
|
-
M,
|
|
194
|
-
D,
|
|
195
|
-
F,
|
|
320
|
+
B.data,
|
|
321
|
+
B.isLoading,
|
|
196
322
|
I,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
323
|
+
V,
|
|
324
|
+
D,
|
|
325
|
+
ce,
|
|
326
|
+
le,
|
|
327
|
+
ue,
|
|
328
|
+
de
|
|
201
329
|
]);
|
|
202
|
-
return /* @__PURE__ */
|
|
203
|
-
value:
|
|
204
|
-
children:
|
|
330
|
+
return /* @__PURE__ */ re(p.Provider, {
|
|
331
|
+
value: fe,
|
|
332
|
+
children: a
|
|
205
333
|
});
|
|
206
334
|
}
|
|
207
|
-
function
|
|
208
|
-
let e =
|
|
335
|
+
function x() {
|
|
336
|
+
let e = o(p);
|
|
209
337
|
if (!e) throw Error("usePersonaSurface must be used within a PersonaSurfaceProvider");
|
|
210
338
|
return e;
|
|
211
339
|
}
|
|
212
|
-
function
|
|
213
|
-
return
|
|
340
|
+
function S() {
|
|
341
|
+
return o(p);
|
|
214
342
|
}
|
|
215
343
|
//#endregion
|
|
216
|
-
export {
|
|
344
|
+
export { f as EVERYTHING_SURFACE_ID, b as PersonaSurfaceProvider, _ as resolveSurfaceForRoles, g as synthesizeSimulatedPermissionStrings, x as usePersonaSurface, S as useSafePersonaSurface };
|
|
@@ -26,7 +26,7 @@ export type { GeographyContextValue, GeographyProviderProps, } from '../../geogr
|
|
|
26
26
|
export { PermissionProvider, usePermissions, useSafePermissions, usePermission, useRole, usePermissionLoading, matchPermission, hasMatchingPermission, isSuperAdminBypass, SUPER_ADMIN_ROLE, SUPER_ADMIN_ACTOR_TYPE, } from './PermissionProvider';
|
|
27
27
|
export type { EffectivePermissions, EffectiveResourcePermission, MyRolesResult, RoleInfo, PermissionCheckOptions, PermissionContextValue, PermissionProviderProps, } from './PermissionProvider';
|
|
28
28
|
export { PersonaSurfaceProvider, usePersonaSurface, useSafePersonaSurface, resolveSurfaceForRoles, synthesizeSimulatedPermissionStrings, EVERYTHING_SURFACE_ID, } from './PersonaSurfaceProvider';
|
|
29
|
-
export type { PersonaSurfaceDefinition, PersonaSurfaceContextValue, PersonaSurfaceProviderProps, NavItemOverrideState, SimulatableRole, SimulationState, } from './PersonaSurfaceProvider';
|
|
29
|
+
export type { PersonaSurfaceDefinition, PersonaSurfaceContextValue, PersonaSurfaceProviderProps, PersonaCustomView, NavItemOverrideState, SimulatableRole, SimulationState, } from './PersonaSurfaceProvider';
|
|
30
30
|
export { AuthTokenProvider, useAuthToken } from './AuthTokenProvider';
|
|
31
31
|
export type { AuthTokenContextValue, AuthTokenProviderProps } from './AuthTokenProvider';
|
|
32
32
|
export { MultiGatewayProvider } from './MultiGatewayProvider';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,MAAM,EACN,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,IAAI,EACJ,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAM1D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAExF,OAAO,EA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OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,uBAAuB,EACvB,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAG3C,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/providers/shell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,MAAM,EACN,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,IAAI,EACJ,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAC;AAM1D,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,oBAAoB,GACrB,MA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E,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACzE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,EAC1B,kCAAkC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACV,uBAAuB,EACvB,oCAAoC,GACrC,MAAM,mCAAmC,CAAC;AAG3C,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { NavItemOverrideState } from './PersonaSurfaceProvider';
|
|
2
|
+
export interface RemoteCustomView {
|
|
3
|
+
id: string;
|
|
4
|
+
productSlug: string;
|
|
5
|
+
name: string;
|
|
6
|
+
visibleItems: string[];
|
|
7
|
+
homePath: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface RemoteNavPreferences {
|
|
10
|
+
activeViewId: string | null;
|
|
11
|
+
overridesByView: Record<string, Record<string, NavItemOverrideState>>;
|
|
12
|
+
customViews: RemoteCustomView[];
|
|
13
|
+
}
|
|
14
|
+
type Gateway = 'workspace' | 'global';
|
|
15
|
+
export declare function fetchNavPreferences(gateway: Gateway, workspaceId: string, productSlug: string): Promise<RemoteNavPreferences>;
|
|
16
|
+
export declare function saveNavPreferences(gateway: Gateway, input: {
|
|
17
|
+
workspaceId: string;
|
|
18
|
+
productSlug: string;
|
|
19
|
+
activeViewId: string | null;
|
|
20
|
+
overridesByView: Record<string, Record<string, NavItemOverrideState>>;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
export declare function createNavView(gateway: Gateway, input: {
|
|
23
|
+
workspaceId: string;
|
|
24
|
+
productSlug: string;
|
|
25
|
+
name: string;
|
|
26
|
+
visibleItems: string[];
|
|
27
|
+
homePath?: string | null;
|
|
28
|
+
}): Promise<RemoteCustomView>;
|
|
29
|
+
export declare function updateNavView(gateway: Gateway, id: string, input: {
|
|
30
|
+
workspaceId: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
visibleItems?: string[];
|
|
33
|
+
homePath?: string | null;
|
|
34
|
+
}): Promise<RemoteCustomView>;
|
|
35
|
+
export declare function deleteNavView(gateway: Gateway, id: string, workspaceId: string): Promise<void>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=personaSurfaceRemote.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { graphqlFetch as e } from "../../graphql/fetch.js";
|
|
2
|
+
//#region src/shared/providers/shell/personaSurfaceRemote.ts
|
|
3
|
+
var t = "\n query MyNavPreferences($workspaceId: String!, $productSlug: String!) {\n myNavPreferences(workspaceId: $workspaceId, productSlug: $productSlug) {\n \n activeViewId\n overridesJson\n customViews {\n id\n productSlug\n name\n visibleItems\n homePath\n }\n\n }\n }\n", n = "\n mutation SaveMyNavPreferences($input: SaveNavPreferencesInput!) {\n saveMyNavPreferences(input: $input) {\n activeViewId\n overridesJson\n }\n }\n", r = "\n mutation CreateMyNavView($input: CreateNavViewInput!) {\n createMyNavView(input: $input) {\n id\n productSlug\n name\n visibleItems\n homePath\n }\n }\n", i = "\n mutation UpdateMyNavView($id: ID!, $input: UpdateNavViewInput!) {\n updateMyNavView(id: $id, input: $input) {\n id\n productSlug\n name\n visibleItems\n homePath\n }\n }\n", a = "\n mutation DeleteMyNavView($id: ID!, $workspaceId: String!) {\n deleteMyNavView(id: $id, workspaceId: $workspaceId)\n }\n";
|
|
4
|
+
function o(e) {
|
|
5
|
+
if (!e) return {};
|
|
6
|
+
try {
|
|
7
|
+
let t = JSON.parse(e);
|
|
8
|
+
return !t || typeof t != "object" ? {} : t;
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function s(e) {
|
|
14
|
+
return e?.length ? Error(e[0].message) : null;
|
|
15
|
+
}
|
|
16
|
+
async function c(n, r, i) {
|
|
17
|
+
let a = await e({
|
|
18
|
+
query: t,
|
|
19
|
+
variables: {
|
|
20
|
+
workspaceId: r,
|
|
21
|
+
productSlug: i
|
|
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");
|
|
28
|
+
return {
|
|
29
|
+
activeViewId: l.activeViewId,
|
|
30
|
+
overridesByView: o(l.overridesJson),
|
|
31
|
+
customViews: l.customViews ?? []
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async function l(t, r) {
|
|
35
|
+
let i = s((await e({
|
|
36
|
+
query: n,
|
|
37
|
+
variables: { input: {
|
|
38
|
+
workspaceId: r.workspaceId,
|
|
39
|
+
productSlug: r.productSlug,
|
|
40
|
+
activeViewId: r.activeViewId,
|
|
41
|
+
overridesJson: JSON.stringify(r.overridesByView)
|
|
42
|
+
} },
|
|
43
|
+
gateway: t
|
|
44
|
+
})).errors);
|
|
45
|
+
if (i) throw i;
|
|
46
|
+
}
|
|
47
|
+
async function u(t, n) {
|
|
48
|
+
let i = await e({
|
|
49
|
+
query: r,
|
|
50
|
+
variables: { input: n },
|
|
51
|
+
gateway: t
|
|
52
|
+
}), a = s(i.errors);
|
|
53
|
+
if (a) throw a;
|
|
54
|
+
let o = i.data?.createMyNavView;
|
|
55
|
+
if (!o) throw Error("View was not created");
|
|
56
|
+
return o;
|
|
57
|
+
}
|
|
58
|
+
async function d(t, n, r) {
|
|
59
|
+
let a = await e({
|
|
60
|
+
query: i,
|
|
61
|
+
variables: {
|
|
62
|
+
id: n,
|
|
63
|
+
input: r
|
|
64
|
+
},
|
|
65
|
+
gateway: t
|
|
66
|
+
}), o = s(a.errors);
|
|
67
|
+
if (o) throw o;
|
|
68
|
+
let c = a.data?.updateMyNavView;
|
|
69
|
+
if (!c) throw Error("View was not updated");
|
|
70
|
+
return c;
|
|
71
|
+
}
|
|
72
|
+
async function f(t, n, r) {
|
|
73
|
+
let i = s((await e({
|
|
74
|
+
query: a,
|
|
75
|
+
variables: {
|
|
76
|
+
id: n,
|
|
77
|
+
workspaceId: r
|
|
78
|
+
},
|
|
79
|
+
gateway: t
|
|
80
|
+
})).errors);
|
|
81
|
+
if (i) throw i;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { u as createNavView, f as deleteNavView, c as fetchNavPreferences, l as saveNavPreferences, d as updateNavView };
|