@plumile/backoffice-react 0.1.99 → 0.1.101

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 (76) hide show
  1. package/lib/esm/AcceptInvitationScreen-B1IPafwD.js.map +1 -1
  2. package/lib/esm/BackofficeAcceptInvitationPage-CEtApVwL.js.map +1 -1
  3. package/lib/esm/{BackofficeDashboardPage-YWvoQODn.js → BackofficeDashboardPage-r8vK_JA6.js} +4 -2
  4. package/lib/esm/BackofficeDashboardPage-r8vK_JA6.js.map +1 -0
  5. package/lib/esm/BackofficeDetailPayload-P61MDRLE.js.map +1 -1
  6. package/lib/esm/BackofficeEntityActionFormDialog-BgRTJ_JS.js.map +1 -1
  7. package/lib/esm/BackofficeEntityDetailLayoutContext-C_tBqkVq.js.map +1 -1
  8. package/lib/esm/BackofficeEntityDetailLayoutPage-DXjRqvcZ.js.map +1 -1
  9. package/lib/esm/{BackofficeEntityDetailPage-DPFXbJxC.js → BackofficeEntityDetailPage-CwzKp_Yw.js} +25 -17
  10. package/lib/esm/BackofficeEntityDetailPage-CwzKp_Yw.js.map +1 -0
  11. package/lib/esm/BackofficeEntityDetailUnknownPageRedirect-DRWTeox-.js.map +1 -1
  12. package/lib/esm/{BackofficeEntityListPage-C8Ucmc_E.js → BackofficeEntityListPage-DVT3rrfa.js} +5 -3
  13. package/lib/esm/BackofficeEntityListPage-DVT3rrfa.js.map +1 -0
  14. package/lib/esm/BackofficeErrorBoundary-BwRVSDHU.js.map +1 -1
  15. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js +609 -0
  16. package/lib/esm/BackofficeLayoutPage-DQ0sVv24.js.map +1 -0
  17. package/lib/esm/BackofficeLoginPage-Cc3kcOQV.js.map +1 -1
  18. package/lib/esm/BackofficePasswordResetCompletePage-CF_0t3Nq.js.map +1 -1
  19. package/lib/esm/BackofficePasswordResetRequestPage-BJOrQXcy.js.map +1 -1
  20. package/lib/esm/{BackofficeRightPageLayout-DZQvIHnj.js → BackofficeRightPageLayout-hexJmpam.js} +36 -30
  21. package/lib/esm/BackofficeRightPageLayout-hexJmpam.js.map +1 -0
  22. package/lib/esm/BackofficeTopbarPortalContext-iD7dm4_h.js.map +1 -1
  23. package/lib/esm/BackofficeVerifyEmailPage-C81LlsNM.js.map +1 -1
  24. package/lib/esm/EntityFilterValue-BWUdPBwp.js.map +1 -1
  25. package/lib/esm/EntityIdPickerDialog-Yhmr-WsV.js.map +1 -1
  26. package/lib/esm/{LazyBackofficeEntityActionFormDialog-DVPQyWlr.js → LazyBackofficeEntityActionFormDialog-L8xwaGqH.js} +110 -123
  27. package/lib/esm/LazyBackofficeEntityActionFormDialog-L8xwaGqH.js.map +1 -0
  28. package/lib/esm/PasswordResetCompleteScreen-Cgg96DPo.js.map +1 -1
  29. package/lib/esm/PasswordResetRequestScreen-I1nFvGLd.js.map +1 -1
  30. package/lib/esm/VerifyEmailScreen-Br5KyHjg.js.map +1 -1
  31. package/lib/esm/backoffice-react.js +11 -5
  32. package/lib/esm/backoffice-react.js.map +1 -1
  33. package/lib/esm/backofficeAuthPaths-BiJvoI5Q.js.map +1 -1
  34. package/lib/esm/buildBreadcrumbs-CqF9Nh6x.js.map +1 -1
  35. package/lib/esm/environment-DQfVyWHJ.js.map +1 -1
  36. package/lib/esm/mutationResult-CcQMY13J.js.map +1 -1
  37. package/lib/esm/pageResolution-hAQA5C6S.js.map +1 -1
  38. package/lib/esm/sidebarUtils-DVkLmFbS.js +52 -0
  39. package/lib/esm/sidebarUtils-DVkLmFbS.js.map +1 -0
  40. package/lib/esm/synchronizeAuthStatusQuery-BoPKMrP1.js.map +1 -1
  41. package/lib/esm/toastViewAction-BGTS7vqm.js.map +1 -1
  42. package/lib/esm/useAuth-CheTnq60.js.map +1 -1
  43. package/lib/esm/useBackofficeAuth-ers1FUGe.js.map +1 -1
  44. package/lib/esm/useBackofficeLazyValue-Bh_13h8A.js.map +1 -1
  45. package/lib/esm/useBackofficeListUrlState-D4fx5O7u.js.map +1 -1
  46. package/lib/esm/useBackofficeReactTranslation-Btt58EIo.js.map +1 -1
  47. package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts.map +1 -1
  48. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts +2 -1
  49. package/lib/types/components/backoffice/layout/buildSidebarSections.d.ts.map +1 -1
  50. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts +4 -1
  51. package/lib/types/components/backoffice/layout/sidebarUtils.d.ts.map +1 -1
  52. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
  53. package/lib/types/hooks/useSidebarGroupCollapse.d.ts +1 -0
  54. package/lib/types/hooks/useSidebarGroupCollapse.d.ts.map +1 -1
  55. package/lib/types/i18n/resources.d.ts +2 -0
  56. package/lib/types/i18n/resources.d.ts.map +1 -1
  57. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  58. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
  59. package/lib/types/pages/BackofficeEntityDetailPage.d.ts.map +1 -1
  60. package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts +1 -0
  61. package/lib/types/pages/BackofficeEntityDetailPage.view-helpers.d.ts.map +1 -1
  62. package/lib/types/pages/BackofficeEntityListPage.d.ts.map +1 -1
  63. package/lib/types/pages/BackofficeEntityListPage.helpers.d.ts.map +1 -1
  64. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  65. package/lib/types/provider/types.d.ts +64 -1
  66. package/lib/types/provider/types.d.ts.map +1 -1
  67. package/package.json +14 -14
  68. package/lib/esm/BackofficeDashboardPage-YWvoQODn.js.map +0 -1
  69. package/lib/esm/BackofficeEntityDetailPage-DPFXbJxC.js.map +0 -1
  70. package/lib/esm/BackofficeEntityListPage-C8Ucmc_E.js.map +0 -1
  71. package/lib/esm/BackofficeLayoutPage-CKXS0nDO.js +0 -485
  72. package/lib/esm/BackofficeLayoutPage-CKXS0nDO.js.map +0 -1
  73. package/lib/esm/BackofficeRightPageLayout-DZQvIHnj.js.map +0 -1
  74. package/lib/esm/LazyBackofficeEntityActionFormDialog-DVPQyWlr.js.map +0 -1
  75. package/lib/esm/sidebarUtils-CuwJ_3mD.js +0 -34
  76. package/lib/esm/sidebarUtils-CuwJ_3mD.js.map +0 -1
@@ -0,0 +1,609 @@
1
+ import { o as e } from "./environment-DQfVyWHJ.js";
2
+ import { t } from "./useRelayEnvironment-vQ86aW-n.js";
3
+ import { r as n, t as r } from "./useBackofficeReactTranslation-Btt58EIo.js";
4
+ import { a as i, i as a, n as o, o as s, r as c, s as l, t as u } from "./sidebarUtils-DVkLmFbS.js";
5
+ import { t as d } from "./BackofficeErrorBoundary-BwRVSDHU.js";
6
+ import { t as f } from "./BackofficeTopbarPortalContext-iD7dm4_h.js";
7
+ import { t as p } from "./backofficeAuthPaths-BiJvoI5Q.js";
8
+ import { Suspense as m, useCallback as h, useContext as g, useEffect as _, useMemo as v, useState as y } from "react";
9
+ import { useTranslation as b } from "react-i18next";
10
+ import { RoutingContext as x, useLocation as S } from "@plumile/router";
11
+ import { AdminShellLayout as C, BackofficeSidebarProfileMenu as ee, Button as w, EnvironmentBadge as T, GlobalSearchInput as E, GripDotsSvg as D, InlineBanner as O, PinFilledSvg as k, PinSvg as A, SidebarHomeSvg as j, SidebarTasksSvg as M, Skeleton as N, ToastProvider as te } from "@plumile/ui";
12
+ import { commitMutation as P, usePreloadedQuery as ne } from "react-relay";
13
+ import { jsx as F, jsxs as I } from "react/jsx-runtime";
14
+ //#region src/hooks/useBackofficeSidebarPins.ts
15
+ var L = "backoffice.sidebar.pins.v1", R = (e) => {
16
+ if (typeof window > "u") return [];
17
+ try {
18
+ let t = window.localStorage.getItem(e);
19
+ if (t == null) return [];
20
+ let n = JSON.parse(t);
21
+ return Array.isArray(n) ? n.filter((e) => typeof e == "string") : [];
22
+ } catch {
23
+ return [];
24
+ }
25
+ }, z = (e, t) => {
26
+ let n = [], r = /* @__PURE__ */ new Set();
27
+ return e.forEach((e) => {
28
+ t.has(e) && (r.has(e) || (r.add(e), n.push(e)));
29
+ }), n;
30
+ }, re = (e) => {
31
+ let { storageKey: t = L, visibleEntityIds: n } = e, r = v(() => new Set(n), [n]), [i, a] = y(() => z(R(t), r));
32
+ _(() => {
33
+ a((e) => {
34
+ let t = z(e, r);
35
+ if (t.length === e.length) {
36
+ let n = !0;
37
+ for (let r = 0; r < t.length; r += 1) if (t[r] !== e[r]) {
38
+ n = !1;
39
+ break;
40
+ }
41
+ if (n) return e;
42
+ }
43
+ return t;
44
+ });
45
+ }, [r]), _(() => {
46
+ a(z(R(t), r));
47
+ }, [t, r]), _(() => {
48
+ if (!(typeof window > "u")) try {
49
+ window.localStorage.setItem(t, JSON.stringify(i));
50
+ } catch {}
51
+ }, [i, t]);
52
+ let o = v(() => new Set(i), [i]), s = h((e) => {
53
+ r.has(e) && a((t) => t.includes(e) ? t : [...t, e]);
54
+ }, [r]), c = h((e) => {
55
+ a((t) => t.filter((t) => t !== e));
56
+ }, []), l = h((e) => {
57
+ o.has(e) ? c(e) : s(e);
58
+ }, [
59
+ s,
60
+ o,
61
+ c
62
+ ]), u = h((e, t) => {
63
+ e !== t && a((n) => {
64
+ let r = n.indexOf(e), i = n.indexOf(t);
65
+ if (r === -1 || i === -1 || r === i) return n;
66
+ let a = [...n];
67
+ return a.splice(r, 1), a.splice(i, 0, e), a;
68
+ });
69
+ }, []);
70
+ return {
71
+ pins: i,
72
+ isPinned: h((e) => o.has(e), [o]),
73
+ pin: s,
74
+ unpin: c,
75
+ toggle: l,
76
+ reorder: u
77
+ };
78
+ }, B = (e, t, n) => {
79
+ let r = {};
80
+ return e.forEach((e) => {
81
+ r[e] = n?.[e] ?? !0;
82
+ }), t != null && e.includes(t) && (r[t] = !1), r;
83
+ }, ie = (e) => {
84
+ let { groupIds: t, activeGroupId: n, defaultCollapsedByGroupId: r } = e, i = v(() => [...t], [t]), [a, o] = y(() => B(i, n, r));
85
+ return _(() => {
86
+ o((e) => {
87
+ let t = {};
88
+ return i.forEach((n) => {
89
+ t[n] = e[n] ?? r?.[n] ?? !0;
90
+ }), n != null && i.includes(n) && (t[n] = !1), t;
91
+ });
92
+ }, [
93
+ n,
94
+ r,
95
+ i
96
+ ]), _(() => {
97
+ n != null && o((e) => e[n] === !1 ? e : {
98
+ ...e,
99
+ [n]: !1
100
+ });
101
+ }, [n]), {
102
+ collapsedByGroupId: a,
103
+ setCollapsed: h((e, t) => {
104
+ o((n) => n[e] === t ? n : {
105
+ ...n,
106
+ [e]: t
107
+ });
108
+ }, [])
109
+ };
110
+ }, V = "_1xws1b00 txvbqb9jg txvbqbcp txvbqbdoy txvbqbtxp txvbqbc6p txvbqb1rg txvbqb12g txvbqb1py txvbqblag txvbqbv0t txvbqbva1 txvbqbv txvbqb78 txvbqb6x txvbqb7k", H = (e, t) => e == null ? t ?? null : /* @__PURE__ */ F(e, {
111
+ width: 18,
112
+ height: 18,
113
+ "aria-hidden": "true"
114
+ });
115
+ function ae(e) {
116
+ let { basePath: t, pathname: n, entities: r, sidebar: c, permissions: l, searchQuery: d, tApp: f, t: p, pinnedEntityIds: m = [], recentItems: h = [], onTogglePin: g, onReorderPin: _, collapsedByGroupId: v, onGroupCollapsedChange: y } = e, b = s(r, c), x = Object.entries(b), S = new Set(m), C = p("sidebar.actions.pin"), ee = p("sidebar.actions.unpin"), w = p("sidebar.actions.reorder"), T = u(b), E = d?.trim().toLowerCase() ?? "", O = (e) => {
117
+ if (g == null) return null;
118
+ let t = S.has(e), n = C, r = A;
119
+ return t && (n = ee, r = k), /* @__PURE__ */ F("button", {
120
+ type: "button",
121
+ className: V,
122
+ "aria-pressed": t,
123
+ "aria-label": n,
124
+ title: n,
125
+ onClick: (t) => {
126
+ t.preventDefault(), t.stopPropagation(), g(e);
127
+ },
128
+ children: /* @__PURE__ */ F(r, {
129
+ width: 14,
130
+ height: 14,
131
+ "aria-hidden": "true"
132
+ })
133
+ });
134
+ }, N = (e) => {
135
+ let { entityId: t, groupId: a, groupIcon: s, itemIcon: u, itemLabel: d, enableReorder: p } = e, m = r[t];
136
+ if (m == null) return null;
137
+ let h = {
138
+ kind: "entity",
139
+ id: t
140
+ };
141
+ if (m.kind === "tool" && (h = {
142
+ kind: "tool",
143
+ id: t
144
+ }), c?.isItemVisible?.(h, l) === !1) return null;
145
+ if (m.kind === "tool") {
146
+ let e = d ?? i(m.label, f);
147
+ return E !== "" && !e.toLowerCase().includes(E) ? null : {
148
+ id: `tool-${t}`,
149
+ data: {
150
+ kind: "tool",
151
+ id: t,
152
+ groupId: a
153
+ },
154
+ label: e,
155
+ href: m.routes.list,
156
+ icon: H(u ?? s, /* @__PURE__ */ F(M, {
157
+ width: 18,
158
+ height: 18,
159
+ "aria-hidden": "true"
160
+ })),
161
+ isActive: o(n, m.routes.list),
162
+ ariaLabel: e,
163
+ actionSlot: O(t)
164
+ };
165
+ }
166
+ if (!m.hasList) return null;
167
+ let g = d ?? i(m.label, f);
168
+ if (E !== "" && !g.toLowerCase().includes(E)) return null;
169
+ let v, y, b, x, S = !1;
170
+ p === !0 && _ != null && (S = !0, v = /* @__PURE__ */ F(D, {
171
+ width: 14,
172
+ height: 14,
173
+ "aria-hidden": "true"
174
+ }), y = (e) => {
175
+ let { dataTransfer: n } = e;
176
+ n.effectAllowed = "move", n.setData("text/plain", t);
177
+ }, b = (e) => {
178
+ e.preventDefault();
179
+ let { dataTransfer: t } = e;
180
+ t.dropEffect = "move";
181
+ }, x = (e) => {
182
+ e.preventDefault();
183
+ let n = e.dataTransfer.getData("text/plain");
184
+ n === "" || n === t || _(n, t);
185
+ });
186
+ let C;
187
+ return v != null && (C = w), {
188
+ id: t,
189
+ data: {
190
+ kind: "entity",
191
+ id: t,
192
+ groupId: a
193
+ },
194
+ label: g,
195
+ href: m.routes.list,
196
+ icon: H(u ?? s, /* @__PURE__ */ F(M, {
197
+ width: 18,
198
+ height: 18,
199
+ "aria-hidden": "true"
200
+ })),
201
+ isActive: o(n, m.routes.list),
202
+ ariaLabel: g,
203
+ actionSlot: O(t),
204
+ dragHandleSlot: v,
205
+ dragHandleLabel: C,
206
+ draggable: S,
207
+ onDragStart: y,
208
+ onDragOver: b,
209
+ onDrop: x
210
+ };
211
+ }, te = (e) => {
212
+ let { hubId: t, label: r, href: i, groupId: a, icon: s } = e, u = {
213
+ kind: "hub",
214
+ id: t
215
+ };
216
+ return c?.isItemVisible?.(u, l) === !1 || E !== "" && !r.toLowerCase().includes(E) ? null : {
217
+ id: `hub-${t}`,
218
+ data: {
219
+ kind: "hub",
220
+ id: t,
221
+ groupId: a
222
+ },
223
+ label: r,
224
+ href: i,
225
+ icon: H(s, /* @__PURE__ */ F(M, {
226
+ width: 18,
227
+ height: 18,
228
+ "aria-hidden": "true"
229
+ })),
230
+ isActive: o(n, i),
231
+ ariaLabel: r
232
+ };
233
+ }, P = [];
234
+ if (m.length > 0) {
235
+ let e = m.map((e) => {
236
+ let t = T.get(e);
237
+ return N({
238
+ entityId: e,
239
+ groupId: t?.groupId,
240
+ groupIcon: t?.icon,
241
+ enableReorder: !0
242
+ });
243
+ }).filter((e) => e != null);
244
+ e.length > 0 && P.push({
245
+ id: "pinned",
246
+ title: p("sidebar.sections.pinned"),
247
+ items: e,
248
+ collapsible: !1
249
+ });
250
+ }
251
+ if (h.length > 0) {
252
+ let e = h.map((e) => {
253
+ if (r[e.id] == null) return null;
254
+ let t = {
255
+ kind: e.kind,
256
+ id: e.id
257
+ };
258
+ if (c?.isItemVisible?.(t, l) === !1 || E !== "" && !e.label.toLowerCase().includes(E)) return null;
259
+ let i = T.get(e.id);
260
+ return {
261
+ id: `recent-${e.kind}-${e.id}`,
262
+ data: {
263
+ kind: e.kind,
264
+ id: e.id,
265
+ groupId: i?.groupId
266
+ },
267
+ label: e.label,
268
+ href: e.href,
269
+ icon: H(i?.icon, /* @__PURE__ */ F(M, {
270
+ width: 18,
271
+ height: 18,
272
+ "aria-hidden": "true"
273
+ })),
274
+ isActive: o(n, e.href),
275
+ ariaLabel: e.label
276
+ };
277
+ }).filter((e) => e != null);
278
+ e.length > 0 && P.push({
279
+ id: "recent",
280
+ title: p("sidebar.sections.recent"),
281
+ items: e,
282
+ collapsible: !1
283
+ });
284
+ }
285
+ return x.forEach(([e, r], s) => {
286
+ if (r.isVisible != null && !r.isVisible(l)) return;
287
+ let u = [];
288
+ if (s === 0 && c?.isItemVisible?.({
289
+ kind: "dashboard",
290
+ id: "dashboard"
291
+ }, l) !== !1) {
292
+ let r = p("sidebar.items.dashboard");
293
+ if (E !== "" && !r.toLowerCase().includes(E)) return;
294
+ u.push({
295
+ id: "dashboard",
296
+ data: {
297
+ kind: "dashboard",
298
+ id: "dashboard",
299
+ groupId: e
300
+ },
301
+ label: r,
302
+ href: t,
303
+ icon: H(void 0, /* @__PURE__ */ F(j, {
304
+ width: 18,
305
+ height: 18,
306
+ "aria-hidden": "true"
307
+ })),
308
+ isActive: o(n, t),
309
+ ariaLabel: p("sidebar.items.dashboard")
310
+ });
311
+ }
312
+ let d = a(r);
313
+ if (d.length > 0 && d.forEach((t) => {
314
+ if (t.kind === "dashboard") return;
315
+ if (t.kind === "hub") {
316
+ let n = te({
317
+ hubId: t.id,
318
+ label: i(t.title, f),
319
+ href: t.href,
320
+ groupId: e,
321
+ icon: t.icon ?? r.icon
322
+ });
323
+ n != null && u.push(n);
324
+ return;
325
+ }
326
+ let n;
327
+ t.label != null && (n = i(t.label, f));
328
+ let a = N({
329
+ entityId: t.id,
330
+ groupId: e,
331
+ groupIcon: r.icon,
332
+ itemIcon: t.icon,
333
+ itemLabel: n
334
+ });
335
+ a != null && u.push(a);
336
+ }), u.length === 0) return;
337
+ let m;
338
+ r.title != null && (m = i(r.title, f));
339
+ let h = v?.[e], g;
340
+ y != null && (g = (t) => {
341
+ y(e, t);
342
+ }), P.push({
343
+ id: e,
344
+ title: m,
345
+ items: u,
346
+ collapsible: r.behavior?.collapsible ?? !0,
347
+ defaultCollapsed: r.behavior?.defaultCollapsed ?? !0,
348
+ isCollapsed: h,
349
+ onCollapsedChange: g
350
+ });
351
+ }), P;
352
+ }
353
+ //#endregion
354
+ //#region src/components/backoffice/routing/backofficeContentError.css.ts
355
+ var U = "txvbqb9ip txvbqbai7 txvbqbu7g", W = "txvbqbwy", G = (e) => {
356
+ if (e instanceof Error) {
357
+ let t = e.message.trim();
358
+ return t.length > 0 ? t : null;
359
+ }
360
+ if (typeof e == "string") {
361
+ let t = e.trim();
362
+ return t.length > 0 ? t : null;
363
+ }
364
+ return null;
365
+ }, K = ({ error: e, onRetry: t }) => {
366
+ let { t: n } = r(), i = G(e);
367
+ return /* @__PURE__ */ F("div", {
368
+ className: U,
369
+ role: "alert",
370
+ children: /* @__PURE__ */ F(O, {
371
+ tone: "danger",
372
+ className: W,
373
+ actions: /* @__PURE__ */ F(w, {
374
+ type: "button",
375
+ variant: "secondary",
376
+ size: "small",
377
+ onClick: t,
378
+ children: n("common.actions.retry")
379
+ }),
380
+ children: i
381
+ })
382
+ });
383
+ }, q = "txvbqb9ip txvbqbai7 txvbqbaop txvbqbu7g txvbqbjs7", J = "txvbqbjfg", oe = "txvbqb9iy txvbqbaop txvbqbc17", se = "txvbqb9ip txvbqbai7 txvbqbaog txvbqblbg txvbqbjny txvbqb1ry txvbqb1cp txvbqb1qg txvbqbwp txvbqbv45", ce = () => /* @__PURE__ */ I("div", {
384
+ className: q,
385
+ role: "status",
386
+ "aria-live": "polite",
387
+ "aria-busy": "true",
388
+ children: [
389
+ /* @__PURE__ */ F(N, {
390
+ variant: "text",
391
+ width: "38%",
392
+ className: J
393
+ }),
394
+ /* @__PURE__ */ F(N, {
395
+ variant: "text",
396
+ width: "62%"
397
+ }),
398
+ /* @__PURE__ */ F("div", {
399
+ className: oe,
400
+ children: Array.from({ length: 4 }, (e, t) => /* @__PURE__ */ I("div", {
401
+ className: se,
402
+ children: [
403
+ /* @__PURE__ */ F(N, {
404
+ variant: "text",
405
+ width: "46%"
406
+ }),
407
+ /* @__PURE__ */ F(N, {
408
+ variant: "text",
409
+ width: "82%",
410
+ lines: 2
411
+ }),
412
+ /* @__PURE__ */ F(N, {
413
+ variant: "block",
414
+ width: "100%",
415
+ height: 120
416
+ })
417
+ ]
418
+ }, `content-skeleton-${t}`))
419
+ })
420
+ ]
421
+ }), Y = "txvbqb9ip txvbqbai7 txvbqbjs7 txvbqbu7g txvbqbk5y", le = ({ children: e }) => /* @__PURE__ */ F("div", {
422
+ className: Y,
423
+ children: /* @__PURE__ */ F(d, {
424
+ fallback: ({ error: e, reset: t }) => /* @__PURE__ */ F(K, {
425
+ error: e,
426
+ onRetry: t
427
+ }),
428
+ children: /* @__PURE__ */ F(m, {
429
+ fallback: /* @__PURE__ */ F(ce, {}),
430
+ children: e
431
+ })
432
+ })
433
+ }), X = (e) => e?.trim() ?? "", ue = ({ viewer: e, unknownUserLabel: t }) => {
434
+ let n = [X(e?.firstName), X(e?.lastName)].filter((e) => e !== "").join(" ").trim();
435
+ n === "" && (n = t);
436
+ let r = X(e?.email), i = X(e?.initials);
437
+ i === "" && (i = "?");
438
+ let a = [n];
439
+ return r !== "" && a.push(r), {
440
+ displayName: n,
441
+ email: r,
442
+ initials: i,
443
+ ariaLabel: a.join(" - ")
444
+ };
445
+ }, de = "plumile:backoffice:recent-items", fe = (e) => {
446
+ if (typeof window > "u") return [];
447
+ try {
448
+ let t = window.localStorage.getItem(e);
449
+ if (t == null) return [];
450
+ let n = JSON.parse(t);
451
+ return Array.isArray(n) ? n.filter((e) => {
452
+ if (typeof e != "object" || !e) return !1;
453
+ let t = e;
454
+ return (t.kind === "entity" || t.kind === "tool") && typeof t.id == "string" && typeof t.label == "string" && typeof t.href == "string" && typeof t.visitedAt == "number";
455
+ }) : [];
456
+ } catch {
457
+ return [];
458
+ }
459
+ }, pe = (e, t) => {
460
+ if (!(typeof window > "u")) try {
461
+ window.localStorage.setItem(e, JSON.stringify(t));
462
+ } catch {}
463
+ }, Z = ({ children: i, permissions: a, authStatus: o, activeGroupId: u }) => {
464
+ let { t: d } = b(), { t: m } = r(), { pathname: w } = S(), D = g(x), O = t(), { auth: k, basePath: A, entities: j, sidebar: M } = n(), [N, ne] = y(""), [I, L] = y(!1), [R, z] = y(!1), [B, V] = y(null), H = M?.recentItems, U = H?.enabled === !0, W = H?.storageKey ?? de, G = H?.maxItems ?? 8, [K, q] = y(() => U ? fe(W) : []), J = v(() => s(j, M), [j, M]), oe = v(() => Object.keys(J), [J]), se = v(() => Object.fromEntries(Object.entries(J).map(([e, t]) => [e, t.behavior?.defaultCollapsed ?? !0])), [J]), ce = v(() => l(J, j, M, a), [
465
+ j,
466
+ J,
467
+ a,
468
+ M
469
+ ]), Y = v(() => c(w, j), [j, w]);
470
+ _(() => {
471
+ if (!U || Y == null) return;
472
+ let e = j[Y];
473
+ if (e == null || e.kind !== "tool" && !e.hasList) return;
474
+ let t = e.routes.list, n = "entity";
475
+ e.kind === "tool" && (n = "tool");
476
+ let r = {
477
+ kind: n,
478
+ id: Y,
479
+ label: e.label(d),
480
+ href: t,
481
+ visitedAt: Date.now()
482
+ };
483
+ q((e) => {
484
+ let t = [r, ...e.filter((e) => e.id !== r.id || e.kind !== r.kind)].slice(0, G);
485
+ return pe(W, t), t;
486
+ });
487
+ }, [
488
+ Y,
489
+ j,
490
+ U,
491
+ G,
492
+ W,
493
+ d
494
+ ]);
495
+ let { pins: X, toggle: Z, reorder: Q } = re({ visibleEntityIds: ce }), { collapsedByGroupId: $, setCollapsed: me } = ie({
496
+ groupIds: oe,
497
+ activeGroupId: u,
498
+ defaultCollapsedByGroupId: se
499
+ }), he = v(() => ae({
500
+ basePath: A,
501
+ pathname: w,
502
+ entities: j,
503
+ sidebar: M,
504
+ permissions: a,
505
+ searchQuery: N,
506
+ tApp: d,
507
+ t: m,
508
+ pinnedEntityIds: X,
509
+ recentItems: K,
510
+ onTogglePin: Z,
511
+ onReorderPin: Q,
512
+ collapsedByGroupId: $,
513
+ onGroupCollapsedChange: me
514
+ }), [
515
+ A,
516
+ $,
517
+ j,
518
+ w,
519
+ a,
520
+ X,
521
+ K,
522
+ Q,
523
+ me,
524
+ M,
525
+ N,
526
+ m,
527
+ d,
528
+ Z
529
+ ]), ge = v(() => import.meta.env?.DEV === !0 ? "dev" : "prod", []), _e = h(() => {
530
+ R || (z(!0), (async () => {
531
+ try {
532
+ let t = await k.logout.load();
533
+ await new Promise((e, n) => {
534
+ P(O, {
535
+ mutation: t.logoutMutation,
536
+ variables: {},
537
+ onCompleted: () => {
538
+ e();
539
+ },
540
+ onError: (e) => {
541
+ n(e);
542
+ }
543
+ });
544
+ }), localStorage.removeItem("auth_token"), localStorage.removeItem("remember_me"), e(), D?.history.push({ pathname: p(A) });
545
+ } finally {
546
+ z(!1);
547
+ }
548
+ })().catch(() => {}));
549
+ }, [
550
+ k.logout,
551
+ A,
552
+ R,
553
+ O,
554
+ D
555
+ ]), ve = o?.me ?? null, ye = /* @__PURE__ */ F(ee, {
556
+ collapsed: I,
557
+ viewer: v(() => ue({
558
+ viewer: ve,
559
+ unknownUserLabel: m("sidebar.profile.unknownUser")
560
+ }), [m, ve]),
561
+ labels: {
562
+ sectionTitle: m("sidebar.profile.title"),
563
+ menuAriaLabel: m("sidebar.profile.menuAriaLabel"),
564
+ signOut: m("sidebar.profile.actions.signOut")
565
+ },
566
+ onSignOut: _e,
567
+ isSigningOut: R
568
+ }), be = null;
569
+ return B != null && (be = /* @__PURE__ */ F(le, { children: i })), /* @__PURE__ */ F(te, { children: /* @__PURE__ */ F(C, {
570
+ sidebar: {
571
+ sections: he,
572
+ header: /* @__PURE__ */ F(T, { environment: ge }),
573
+ search: /* @__PURE__ */ F(E, {
574
+ value: N,
575
+ onChange: ne,
576
+ placeholder: m("sidebar.search.placeholder"),
577
+ ariaLabel: m("sidebar.search.placeholder")
578
+ }),
579
+ footer: ye,
580
+ isCollapsed: I,
581
+ onCollapsedChange: L
582
+ },
583
+ topbar: { breadcrumb: /* @__PURE__ */ F("div", { ref: V }) },
584
+ children: /* @__PURE__ */ F(f, {
585
+ value: { target: B },
586
+ children: be
587
+ })
588
+ }) });
589
+ }, Q = ({ children: e, permissionsQuery: t, prepared: n, authStatus: r, activeGroupId: i }) => /* @__PURE__ */ F(Z, {
590
+ permissions: ne(t, n),
591
+ authStatus: r,
592
+ activeGroupId: i,
593
+ children: e
594
+ }), $ = ({ children: e, permissionsQuery: t, prepared: n, authStatus: r, activeGroupId: i }) => t != null && n != null ? /* @__PURE__ */ F(Q, {
595
+ permissionsQuery: t,
596
+ prepared: n,
597
+ authStatus: r,
598
+ activeGroupId: i,
599
+ children: e
600
+ }) : /* @__PURE__ */ F(Z, {
601
+ permissions: null,
602
+ authStatus: r,
603
+ activeGroupId: i,
604
+ children: e
605
+ });
606
+ //#endregion
607
+ export { $ as BackofficeLayoutPage, $ as default };
608
+
609
+ //# sourceMappingURL=BackofficeLayoutPage-DQ0sVv24.js.map