@plumile/backoffice-react 0.1.101 → 0.1.102

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