@plumile/backoffice-react 0.1.102 → 0.1.104

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 (41) hide show
  1. package/lib/esm/BackofficeDashboardPage-CZAcZwRc.js +344 -0
  2. package/lib/esm/BackofficeDashboardPage-CZAcZwRc.js.map +1 -0
  3. package/lib/esm/{BackofficeEntityDetailPage-ByioPO5K.js → BackofficeEntityDetailPage-ChxBrqz8.js} +3 -3
  4. package/lib/esm/{BackofficeEntityDetailPage-ByioPO5K.js.map → BackofficeEntityDetailPage-ChxBrqz8.js.map} +1 -1
  5. package/lib/esm/{BackofficeEntityListPage-dyE4er_s.js → BackofficeEntityListPage-BACvfX6c.js} +3 -3
  6. package/lib/esm/{BackofficeEntityListPage-dyE4er_s.js.map → BackofficeEntityListPage-BACvfX6c.js.map} +1 -1
  7. package/lib/esm/{BackofficeHubPage-D2k0ZO6c.js → BackofficeHubPage-BsUXulN0.js} +2 -2
  8. package/lib/esm/BackofficeHubPage-BsUXulN0.js.map +1 -0
  9. package/lib/esm/{BackofficeLayoutPage-BiSUwAi9.js → BackofficeLayoutPage-r6dXo9SI.js} +242 -168
  10. package/lib/esm/BackofficeLayoutPage-r6dXo9SI.js.map +1 -0
  11. package/lib/esm/{LazyBackofficeEntityActionFormDialog-DwPGe2Qv.js → LazyBackofficeEntityActionFormDialog-uyYFFJGM.js} +92 -44
  12. package/lib/esm/LazyBackofficeEntityActionFormDialog-uyYFFJGM.js.map +1 -0
  13. package/lib/esm/backoffice-react.js +4 -6
  14. package/lib/esm/backoffice-react.js.map +1 -1
  15. package/lib/esm/{buildDataTableColumns-D95yRO2W.js → buildDataTableColumns-DGPjPK4N.js} +2 -1
  16. package/lib/esm/buildDataTableColumns-DGPjPK4N.js.map +1 -0
  17. package/lib/esm/style.css +1 -1
  18. package/lib/types/components/backoffice/columns/buildDataTableColumns.d.ts.map +1 -1
  19. package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
  20. package/lib/types/hooks/useBackofficeInfiniteScrollSentinel.d.ts +14 -0
  21. package/lib/types/hooks/useBackofficeInfiniteScrollSentinel.d.ts.map +1 -0
  22. package/lib/types/hooks/useBackofficeSidebarPins.d.ts +1 -0
  23. package/lib/types/hooks/useBackofficeSidebarPins.d.ts.map +1 -1
  24. package/lib/types/hooks/useSidebarGroupCollapse.d.ts +2 -0
  25. package/lib/types/hooks/useSidebarGroupCollapse.d.ts.map +1 -1
  26. package/lib/types/i18n/resources.d.ts +0 -2
  27. package/lib/types/i18n/resources.d.ts.map +1 -1
  28. package/lib/types/pages/BackofficeDashboardPage.d.ts.map +1 -1
  29. package/lib/types/pages/BackofficeDashboardPage.helpers.d.ts.map +1 -1
  30. package/lib/types/pages/BackofficeLayoutPage.d.ts.map +1 -1
  31. package/lib/types/pages/backofficeDashboardPage.css.d.ts +12 -0
  32. package/lib/types/pages/backofficeDashboardPage.css.d.ts.map +1 -1
  33. package/lib/types/provider/types.d.ts +5 -0
  34. package/lib/types/provider/types.d.ts.map +1 -1
  35. package/package.json +5 -5
  36. package/lib/esm/BackofficeDashboardPage-COKOYq4D.js +0 -197
  37. package/lib/esm/BackofficeDashboardPage-COKOYq4D.js.map +0 -1
  38. package/lib/esm/BackofficeHubPage-D2k0ZO6c.js.map +0 -1
  39. package/lib/esm/BackofficeLayoutPage-BiSUwAi9.js.map +0 -1
  40. package/lib/esm/LazyBackofficeEntityActionFormDialog-DwPGe2Qv.js.map +0 -1
  41. package/lib/esm/buildDataTableColumns-D95yRO2W.js.map +0 -1
@@ -9,11 +9,11 @@ import { t as g } from "./BackofficePermissionsContext-CmWwudBU.js";
9
9
  import { Suspense as _, useCallback as v, useContext as y, useEffect as b, useMemo as x, useState as S } from "react";
10
10
  import { useTranslation as C } from "react-i18next";
11
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";
12
+ import { AdminShellLayout as ne, BackofficeSidebarProfileMenu as re, 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 ie } from "@plumile/ui";
13
+ import { commitMutation as P, usePreloadedQuery as F } from "react-relay";
14
14
  import { jsx as I, jsxs as L } from "react/jsx-runtime";
15
15
  //#region src/hooks/useBackofficeSidebarPins.ts
16
- var R = "backoffice.sidebar.pins.v1", z = (e) => {
16
+ var ae = "backoffice.sidebar.pins.v1", R = (e) => {
17
17
  if (typeof window > "u") return [];
18
18
  try {
19
19
  let t = window.localStorage.getItem(e);
@@ -23,16 +23,20 @@ var R = "backoffice.sidebar.pins.v1", z = (e) => {
23
23
  } catch {
24
24
  return [];
25
25
  }
26
- }, B = (e, t) => {
26
+ }, z = (e, t) => {
27
27
  let n = [], r = /* @__PURE__ */ new Set();
28
28
  return e.forEach((e) => {
29
29
  t.has(e) && (r.has(e) || (r.add(e), n.push(e)));
30
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));
31
+ }, oe = (e) => {
32
+ let { enabled: t = !0, storageKey: n = ae, visibleEntityIds: r } = e, i = x(() => new Set(r), [r]), [a, o] = S(() => t ? z(R(n), i) : []);
33
33
  b(() => {
34
- a((e) => {
35
- let t = B(e, r);
34
+ if (!t) {
35
+ o([]);
36
+ return;
37
+ }
38
+ o((e) => {
39
+ let t = z(e, i);
36
40
  if (t.length === e.length) {
37
41
  let n = !0;
38
42
  for (let r = 0; r < t.length; r += 1) if (t[r] !== e[r]) {
@@ -43,66 +47,109 @@ var R = "backoffice.sidebar.pins.v1", z = (e) => {
43
47
  }
44
48
  return t;
45
49
  });
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));
50
+ }, [t, i]), b(() => {
51
+ if (!t) {
52
+ o([]);
53
+ return;
54
+ }
55
+ o(z(R(n), i));
56
+ }, [
57
+ t,
58
+ n,
59
+ i
60
+ ]), b(() => {
61
+ if (!(!t || typeof window > "u")) try {
62
+ window.localStorage.setItem(n, JSON.stringify(a));
51
63
  } 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
64
  }, [
65
+ t,
66
+ a,
67
+ n
68
+ ]);
69
+ let s = x(() => new Set(a), [a]), c = v((e) => {
70
+ t && i.has(e) && o((t) => t.includes(e) ? t : [...t, e]);
71
+ }, [t, i]), l = v((e) => {
72
+ t && o((t) => t.filter((t) => t !== e));
73
+ }, [t]), u = v((e) => {
74
+ s.has(e) ? l(e) : c(e);
75
+ }, [
76
+ c,
60
77
  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];
78
+ l
79
+ ]), d = v((e, n) => {
80
+ t && e !== n && o((t) => {
81
+ let r = t.indexOf(e), i = t.indexOf(n);
82
+ if (r === -1 || i === -1 || r === i) return t;
83
+ let a = [...t];
68
84
  return a.splice(r, 1), a.splice(i, 0, e), a;
69
85
  });
70
- }, []);
86
+ }, [t]);
71
87
  return {
72
- pins: i,
73
- isPinned: v((e) => o.has(e), [o]),
74
- pin: s,
75
- unpin: c,
76
- toggle: l,
77
- reorder: u
88
+ pins: a,
89
+ isPinned: v((e) => s.has(e), [s]),
90
+ pin: c,
91
+ unpin: l,
92
+ toggle: u,
93
+ reorder: d
78
94
  };
95
+ }, B = (e) => {
96
+ if (e == null || typeof window > "u") return null;
97
+ try {
98
+ let t = window.localStorage.getItem(e);
99
+ if (t == null) return null;
100
+ let n = JSON.parse(t);
101
+ if (typeof n != "object" || !n) return null;
102
+ let r = {};
103
+ return Object.entries(n).forEach(([e, t]) => {
104
+ typeof t == "boolean" && (r[e] = t);
105
+ }), r;
106
+ } catch {
107
+ return null;
108
+ }
79
109
  }, V = (e, t, n) => {
80
110
  let r = {};
81
111
  return e.forEach((e) => {
82
112
  r[e] = n?.[e] ?? !0;
83
113
  }), 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));
114
+ }, se = (e) => {
115
+ let { activeGroupId: t, defaultCollapsedByGroupId: n, groupIds: r, persist: i = !1, storageKey: a } = e, o = x(() => [...r], [r]), [s, c] = S(() => {
116
+ if (i) {
117
+ let e = B(a);
118
+ if (e != null) return {
119
+ ...V(o, t, n),
120
+ ...e
121
+ };
122
+ }
123
+ return V(o, t, n);
124
+ });
86
125
  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;
126
+ c((e) => {
127
+ let r = {};
128
+ return o.forEach((t) => {
129
+ r[t] = e[t] ?? n?.[t] ?? !0;
130
+ }), t != null && o.includes(t) && (r[t] = !1), r;
92
131
  });
93
132
  }, [
133
+ t,
94
134
  n,
95
- r,
96
- i
135
+ o
136
+ ]), b(() => {
137
+ if (!(!i || a == null || typeof window > "u")) try {
138
+ window.localStorage.setItem(a, JSON.stringify(s));
139
+ } catch {}
140
+ }, [
141
+ s,
142
+ i,
143
+ a
97
144
  ]), b(() => {
98
- n != null && o((e) => e[n] === !1 ? e : {
145
+ t != null && c((e) => e[t] === !1 ? e : {
99
146
  ...e,
100
- [n]: !1
147
+ [t]: !1
101
148
  });
102
- }, [n]), {
103
- collapsedByGroupId: a,
149
+ }, [t]), {
150
+ collapsedByGroupId: s,
104
151
  setCollapsed: v((e, t) => {
105
- o((n) => n[e] === t ? n : {
152
+ c((n) => n[e] === t ? n : {
106
153
  ...n,
107
154
  [e]: t
108
155
  });
@@ -113,11 +160,11 @@ var R = "backoffice.sidebar.pins.v1", z = (e) => {
113
160
  height: 18,
114
161
  "aria-hidden": "true"
115
162
  });
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) => {
163
+ function ce(e) {
164
+ 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"), re = h("sidebar.actions.reorder"), w = d(S, l), T = p?.trim().toLowerCase() ?? "", E = (e) => T === "" || e.toLowerCase().includes(T), O = (e) => {
118
165
  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", {
166
+ let t = ee.has(e), n = te, r = A;
167
+ return t && (n = ne, r = k), /* @__PURE__ */ I("button", {
121
168
  type: "button",
122
169
  className: H,
123
170
  "aria-pressed": t,
@@ -132,7 +179,7 @@ function se(e) {
132
179
  "aria-hidden": "true"
133
180
  })
134
181
  });
135
- }, P = (e) => {
182
+ }, N = (e) => {
136
183
  let { entityId: t, groupId: i, groupIcon: a, itemIcon: o, itemLabel: u, enableReorder: d } = e, p = r[t];
137
184
  if (p == null) return null;
138
185
  let h = {
@@ -145,7 +192,7 @@ function se(e) {
145
192
  }), l?.isItemVisible?.(h, f) === !1) return null;
146
193
  if (p.kind === "tool") {
147
194
  let e = u ?? c(p.label, m);
148
- return E !== "" && !e.toLowerCase().includes(E) ? null : {
195
+ return T !== "" && !e.toLowerCase().includes(T) ? null : {
149
196
  id: `tool-${t}`,
150
197
  data: {
151
198
  kind: "tool",
@@ -154,21 +201,21 @@ function se(e) {
154
201
  },
155
202
  label: e,
156
203
  href: p.routes.list,
157
- icon: U(o ?? a, /* @__PURE__ */ I(N, {
204
+ icon: U(o ?? a, /* @__PURE__ */ I(M, {
158
205
  width: 18,
159
206
  height: 18,
160
207
  "aria-hidden": "true"
161
208
  })),
162
209
  isActive: s(n, p.routes.list),
163
210
  ariaLabel: e,
164
- actionSlot: k(t)
211
+ actionSlot: O(t)
165
212
  };
166
213
  }
167
214
  if (!p.hasList) return null;
168
215
  let g = u ?? c(p.label, m);
169
- if (E !== "" && !g.toLowerCase().includes(E)) return null;
216
+ if (T !== "" && !g.toLowerCase().includes(T)) return null;
170
217
  let _, v, b, x, S = !1;
171
- d === !0 && y != null && (S = !0, _ = /* @__PURE__ */ I(O, {
218
+ d === !0 && y != null && (S = !0, _ = /* @__PURE__ */ I(D, {
172
219
  width: 14,
173
220
  height: 14,
174
221
  "aria-hidden": "true"
@@ -185,7 +232,7 @@ function se(e) {
185
232
  n === "" || n === t || y(n, t);
186
233
  });
187
234
  let C;
188
- return _ != null && (C = w), {
235
+ return _ != null && (C = re), {
189
236
  id: t,
190
237
  data: {
191
238
  kind: "entity",
@@ -194,14 +241,14 @@ function se(e) {
194
241
  },
195
242
  label: g,
196
243
  href: p.routes.list,
197
- icon: U(o ?? a, /* @__PURE__ */ I(N, {
244
+ icon: U(o ?? a, /* @__PURE__ */ I(M, {
198
245
  width: 18,
199
246
  height: 18,
200
247
  "aria-hidden": "true"
201
248
  })),
202
249
  isActive: s(n, p.routes.list),
203
250
  ariaLabel: g,
204
- actionSlot: k(t),
251
+ actionSlot: O(t),
205
252
  dragHandleSlot: _,
206
253
  dragHandleLabel: C,
207
254
  draggable: S,
@@ -209,7 +256,7 @@ function se(e) {
209
256
  onDragOver: b,
210
257
  onDrop: x
211
258
  };
212
- }, re = (e) => {
259
+ }, ie = (e) => {
213
260
  let { hub: t, groupId: a, icon: o } = e, u = {
214
261
  kind: "hub",
215
262
  id: t.id
@@ -226,7 +273,7 @@ function se(e) {
226
273
  return !(l?.isItemVisible?.(n, f) === !1 || e.kind !== "tool" && !e.hasList);
227
274
  });
228
275
  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)));
276
+ let h = c(t.title, m), g = E(h), _ = p.some((e) => E(c(e.label, m)));
230
277
  if (!g && !_) return null;
231
278
  let v = s(n, t.href) || p.some((e) => s(n, e.routes.list));
232
279
  return {
@@ -238,7 +285,7 @@ function se(e) {
238
285
  },
239
286
  label: h,
240
287
  href: t.href,
241
- icon: U(o, /* @__PURE__ */ I(N, {
288
+ icon: U(o, /* @__PURE__ */ I(M, {
242
289
  width: 18,
243
290
  height: 18,
244
291
  "aria-hidden": "true"
@@ -246,18 +293,18 @@ function se(e) {
246
293
  isActive: v,
247
294
  ariaLabel: h
248
295
  };
249
- }, F = [];
296
+ }, P = [];
250
297
  if (g.length > 0) {
251
298
  let e = g.map((e) => {
252
- let t = T.get(e);
253
- return P({
299
+ let t = w.get(e);
300
+ return N({
254
301
  entityId: e,
255
302
  groupId: t?.groupId,
256
303
  groupIcon: t?.icon,
257
304
  enableReorder: !0
258
305
  });
259
306
  }).filter((e) => e != null);
260
- e.length > 0 && F.push({
307
+ e.length > 0 && P.push({
261
308
  id: "pinned",
262
309
  title: h("sidebar.sections.pinned"),
263
310
  items: e,
@@ -271,8 +318,8 @@ function se(e) {
271
318
  kind: e.kind,
272
319
  id: e.id
273
320
  };
274
- if (l?.isItemVisible?.(t, f) === !1 || E !== "" && !e.label.toLowerCase().includes(E)) return null;
275
- let i = T.get(e.id);
321
+ if (l?.isItemVisible?.(t, f) === !1 || T !== "" && !e.label.toLowerCase().includes(T)) return null;
322
+ let i = w.get(e.id);
276
323
  return {
277
324
  id: `recent-${e.kind}-${e.id}`,
278
325
  data: {
@@ -282,7 +329,7 @@ function se(e) {
282
329
  },
283
330
  label: e.label,
284
331
  href: e.href,
285
- icon: U(i?.icon, /* @__PURE__ */ I(N, {
332
+ icon: U(i?.icon, /* @__PURE__ */ I(M, {
286
333
  width: 18,
287
334
  height: 18,
288
335
  "aria-hidden": "true"
@@ -291,7 +338,7 @@ function se(e) {
291
338
  ariaLabel: e.label
292
339
  };
293
340
  }).filter((e) => e != null);
294
- e.length > 0 && F.push({
341
+ e.length > 0 && P.push({
295
342
  id: "recent",
296
343
  title: h("sidebar.sections.recent"),
297
344
  items: e,
@@ -306,7 +353,7 @@ function se(e) {
306
353
  id: "dashboard"
307
354
  }, f) !== !1) {
308
355
  let r = h("sidebar.items.dashboard");
309
- E !== "" && !r.toLowerCase().includes(E) || u.push({
356
+ T !== "" && !r.toLowerCase().includes(T) || u.push({
310
357
  id: "dashboard",
311
358
  data: {
312
359
  kind: "dashboard",
@@ -315,7 +362,7 @@ function se(e) {
315
362
  },
316
363
  label: r,
317
364
  href: t,
318
- icon: U(void 0, /* @__PURE__ */ I(M, {
365
+ icon: U(void 0, /* @__PURE__ */ I(j, {
319
366
  width: 18,
320
367
  height: 18,
321
368
  "aria-hidden": "true"
@@ -328,7 +375,7 @@ function se(e) {
328
375
  if (d.length > 0 && d.forEach((t) => {
329
376
  if (t.kind === "dashboard") return;
330
377
  if (t.kind === "hub") {
331
- let n = re({
378
+ let n = ie({
332
379
  hub: a(t, l),
333
380
  groupId: e,
334
381
  icon: t.icon ?? r.icon
@@ -338,7 +385,7 @@ function se(e) {
338
385
  }
339
386
  let n;
340
387
  t.label != null && (n = c(t.label, m));
341
- let i = P({
388
+ let i = N({
342
389
  entityId: t.id,
343
390
  groupId: e,
344
391
  groupIcon: r.icon,
@@ -352,7 +399,7 @@ function se(e) {
352
399
  let g = b?.[e], _;
353
400
  x != null && (_ = (t) => {
354
401
  x(e, t);
355
- }), F.push({
402
+ }), P.push({
356
403
  id: e,
357
404
  title: p,
358
405
  items: u,
@@ -361,11 +408,11 @@ function se(e) {
361
408
  isCollapsed: g,
362
409
  onCollapsedChange: _
363
410
  });
364
- }), F;
411
+ }), P;
365
412
  }
366
413
  //#endregion
367
414
  //#region src/components/backoffice/routing/backofficeContentError.css.ts
368
- var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
415
+ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", K = (e) => {
369
416
  if (e instanceof Error) {
370
417
  let t = e.message.trim();
371
418
  return t.length > 0 ? t : null;
@@ -375,15 +422,15 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
375
422
  return t.length > 0 ? t : null;
376
423
  }
377
424
  return null;
378
- }, K = ({ error: e, onRetry: t }) => {
379
- let { t: n } = r(), i = ce(e);
425
+ }, le = ({ error: e, onRetry: t }) => {
426
+ let { t: n } = r(), i = K(e);
380
427
  return /* @__PURE__ */ I("div", {
381
428
  className: W,
382
429
  role: "alert",
383
- children: /* @__PURE__ */ I(k, {
430
+ children: /* @__PURE__ */ I(O, {
384
431
  tone: "danger",
385
432
  className: G,
386
- actions: /* @__PURE__ */ I(T, {
433
+ actions: /* @__PURE__ */ I(w, {
387
434
  type: "button",
388
435
  variant: "secondary",
389
436
  size: "small",
@@ -393,36 +440,36 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
393
440
  children: i
394
441
  })
395
442
  });
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,
443
+ }, q = "txvbqb9ip txvbqbai7 txvbqbaop txvbqbu7g txvbqbjs7", ue = "txvbqbjfg", de = "txvbqb9iy txvbqbaop txvbqbc17", fe = "txvbqb9ip txvbqbai7 txvbqbaog txvbqblbg txvbqbjny txvbqb1ry txvbqb1cp txvbqb1qg txvbqbwp txvbqbv45", J = () => /* @__PURE__ */ L("div", {
444
+ className: q,
398
445
  role: "status",
399
446
  "aria-live": "polite",
400
447
  "aria-busy": "true",
401
448
  children: [
402
- /* @__PURE__ */ I(P, {
449
+ /* @__PURE__ */ I(N, {
403
450
  variant: "text",
404
451
  width: "38%",
405
452
  className: ue
406
453
  }),
407
- /* @__PURE__ */ I(P, {
454
+ /* @__PURE__ */ I(N, {
408
455
  variant: "text",
409
456
  width: "62%"
410
457
  }),
411
458
  /* @__PURE__ */ I("div", {
412
459
  className: de,
413
460
  children: Array.from({ length: 4 }, (e, t) => /* @__PURE__ */ L("div", {
414
- className: q,
461
+ className: fe,
415
462
  children: [
416
- /* @__PURE__ */ I(P, {
463
+ /* @__PURE__ */ I(N, {
417
464
  variant: "text",
418
465
  width: "46%"
419
466
  }),
420
- /* @__PURE__ */ I(P, {
467
+ /* @__PURE__ */ I(N, {
421
468
  variant: "text",
422
469
  width: "82%",
423
470
  lines: 2
424
471
  }),
425
- /* @__PURE__ */ I(P, {
472
+ /* @__PURE__ */ I(N, {
426
473
  variant: "block",
427
474
  width: "100%",
428
475
  height: 120
@@ -431,10 +478,10 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
431
478
  }, `content-skeleton-${t}`))
432
479
  })
433
480
  ]
434
- }), Y = "txvbqb9ip txvbqbai7 txvbqbjs7 txvbqbu7g txvbqbk5y", fe = ({ children: e }) => /* @__PURE__ */ I("div", {
481
+ }), Y = "txvbqb9ip txvbqbai7 txvbqbjs7 txvbqbu7g txvbqbk5y", pe = ({ children: e }) => /* @__PURE__ */ I("div", {
435
482
  className: Y,
436
483
  children: /* @__PURE__ */ I(p, {
437
- fallback: ({ error: e, reset: t }) => /* @__PURE__ */ I(K, {
484
+ fallback: ({ error: e, reset: t }) => /* @__PURE__ */ I(le, {
438
485
  error: e,
439
486
  onRetry: t
440
487
  }),
@@ -443,7 +490,7 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
443
490
  children: e
444
491
  })
445
492
  })
446
- }), X = (e) => e?.trim() ?? "", pe = ({ viewer: e, unknownUserLabel: t }) => {
493
+ }), X = (e) => e?.trim() ?? "", me = ({ viewer: e, unknownUserLabel: t }) => {
447
494
  let n = [X(e?.firstName), X(e?.lastName)].filter((e) => e !== "").join(" ").trim();
448
495
  n === "" && (n = t);
449
496
  let r = X(e?.email), i = X(e?.initials);
@@ -455,7 +502,7 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
455
502
  initials: i,
456
503
  ariaLabel: a.join(" - ")
457
504
  };
458
- }, me = "plumile:backoffice:recent-items", he = (e) => {
505
+ }, he = "plumile:backoffice:recent-items", ge = "plumile:backoffice:sidebar", _e = (e) => {
459
506
  if (typeof window > "u") return [];
460
507
  try {
461
508
  let t = window.localStorage.getItem(e);
@@ -469,82 +516,107 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
469
516
  } catch {
470
517
  return [];
471
518
  }
472
- }, ge = (e, t) => {
519
+ }, ve = (e, t) => {
473
520
  if (!(typeof window > "u")) try {
474
521
  window.localStorage.setItem(e, JSON.stringify(t));
475
522
  } catch {}
476
523
  }, 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,
524
+ let { t: c } = C(), { t: d } = r(), { pathname: p } = te(), _ = y(ee), w = t(), { auth: D, basePath: O, entities: k, sidebar: A } = n(), [j, M] = S(""), N = A?.preferences?.storageKey ?? ge, F = A?.preferences?.persistCollapsed === !0, [L, ae] = S(() => {
525
+ if (!F || typeof window > "u") return !1;
526
+ try {
527
+ return window.localStorage.getItem(`${N}:collapsed`) === "true";
528
+ } catch {
529
+ return !1;
530
+ }
531
+ }), [R, z] = S(!1), [B, V] = S(null), H = A?.recentItems, U = H?.enabled === !0, W = H?.storageKey ?? he, G = H?.maxItems ?? 8, [K, le] = S(() => U ? _e(W) : []);
532
+ b(() => {
533
+ if (!(!F || typeof window > "u")) try {
534
+ window.localStorage.setItem(`${N}:collapsed`, String(L));
535
+ } catch {}
536
+ }, [
537
+ L,
538
+ F,
539
+ N
540
+ ]);
541
+ let q = x(() => u(k, A), [k, A]), ue = x(() => Object.keys(q), [q]), de = x(() => Object.fromEntries(Object.entries(q).map(([e, t]) => [e, t.behavior?.defaultCollapsed ?? !0])), [q]), fe = x(() => f(q, k, A, a), [
542
+ k,
543
+ q,
480
544
  a,
481
- j
482
- ]), q = x(() => l(p, A), [A, p]);
545
+ A
546
+ ]), J = x(() => l(p, k), [k, p]);
483
547
  b(() => {
484
- if (!H || q == null) return;
485
- let e = A[q];
548
+ if (!U || J == null) return;
549
+ let e = k[J];
486
550
  if (e == null || e.kind !== "tool" && !e.hasList) return;
487
551
  let t = e.routes.list, n = "entity";
488
552
  e.kind === "tool" && (n = "tool");
489
553
  let r = {
490
554
  kind: n,
491
- id: q,
555
+ id: J,
492
556
  label: e.label(c),
493
557
  href: t,
494
558
  visitedAt: Date.now()
495
559
  };
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;
560
+ le((e) => {
561
+ let t = [r, ...e.filter((e) => e.id !== r.id || e.kind !== r.kind)].slice(0, G);
562
+ return ve(W, t), t;
499
563
  });
500
564
  }, [
501
- q,
502
- A,
503
- H,
504
- W,
565
+ J,
566
+ k,
505
567
  U,
568
+ G,
569
+ W,
506
570
  c
507
571
  ]);
508
- let { pins: J, toggle: Y, reorder: X } = ae({ visibleEntityIds: de }), { collapsedByGroupId: Z, setCollapsed: Q } = oe({
509
- groupIds: le,
572
+ let { pins: Y, toggle: X, reorder: Z } = oe({
573
+ enabled: A?.pinnedItems?.enabled === !0,
574
+ storageKey: A?.pinnedItems?.storageKey,
575
+ visibleEntityIds: fe
576
+ }), Q;
577
+ A?.preferences?.storageKey != null && (Q = `${A.preferences.storageKey}:groups`);
578
+ let { collapsedByGroupId: $, setCollapsed: ye } = se({
579
+ groupIds: ue,
510
580
  activeGroupId: s,
511
- defaultCollapsedByGroupId: ue
512
- }), $ = x(() => se({
513
- basePath: k,
581
+ defaultCollapsedByGroupId: de,
582
+ persist: A?.preferences?.persistGroups === !0,
583
+ storageKey: Q
584
+ }), be = x(() => ce({
585
+ basePath: O,
514
586
  pathname: p,
515
- entities: A,
516
- sidebar: j,
587
+ entities: k,
588
+ sidebar: A,
517
589
  permissions: a,
518
- searchQuery: M,
590
+ searchQuery: j,
519
591
  tApp: c,
520
592
  t: d,
521
- pinnedEntityIds: J,
522
- recentItems: G,
523
- onTogglePin: Y,
524
- onReorderPin: X,
525
- collapsedByGroupId: Z,
526
- onGroupCollapsedChange: Q
593
+ pinnedEntityIds: Y,
594
+ recentItems: K,
595
+ onTogglePin: X,
596
+ onReorderPin: Z,
597
+ collapsedByGroupId: $,
598
+ onGroupCollapsedChange: ye
527
599
  }), [
600
+ O,
601
+ $,
528
602
  k,
529
- Z,
530
- A,
531
603
  p,
532
604
  a,
533
- J,
534
- G,
535
- X,
536
- Q,
605
+ Y,
606
+ K,
607
+ Z,
608
+ ye,
609
+ A,
537
610
  j,
538
- M,
539
611
  d,
540
612
  c,
541
- Y
542
- ]), _e = x(() => import.meta.env?.DEV === !0 ? "dev" : "prod", []), ve = v(() => {
543
- L || (R(!0), (async () => {
613
+ X
614
+ ]), xe = x(() => import.meta.env?.DEV === !0 ? "dev" : "prod", []), Se = v(() => {
615
+ R || (z(!0), (async () => {
544
616
  try {
545
- let t = await O.logout.load();
617
+ let t = await D.logout.load();
546
618
  await new Promise((e, n) => {
547
- F(T, {
619
+ P(w, {
548
620
  mutation: t.logoutMutation,
549
621
  variables: {},
550
622
  onCompleted: () => {
@@ -554,56 +626,58 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
554
626
  n(e);
555
627
  }
556
628
  });
557
- }), localStorage.removeItem("auth_token"), localStorage.removeItem("remember_me"), e(), _?.history.push({ pathname: h(k) });
629
+ }), localStorage.removeItem("auth_token"), localStorage.removeItem("remember_me"), e(), _?.history.push({ pathname: h(O) });
558
630
  } finally {
559
- R(!1);
631
+ z(!1);
560
632
  }
561
633
  })().catch(() => {}));
562
634
  }, [
563
- O.logout,
564
- k,
565
- L,
566
- T,
635
+ D.logout,
636
+ O,
637
+ R,
638
+ w,
567
639
  _
568
- ]), ye = o?.me ?? null, be = /* @__PURE__ */ I(w, {
569
- collapsed: P,
570
- viewer: x(() => pe({
571
- viewer: ye,
640
+ ]), Ce = o?.me ?? null, we = /* @__PURE__ */ I(re, {
641
+ collapsed: L,
642
+ viewer: x(() => me({
643
+ viewer: Ce,
572
644
  unknownUserLabel: d("sidebar.profile.unknownUser")
573
- }), [d, ye]),
645
+ }), [d, Ce]),
574
646
  labels: {
575
647
  sectionTitle: d("sidebar.profile.title"),
576
648
  menuAriaLabel: d("sidebar.profile.menuAriaLabel"),
577
649
  signOut: d("sidebar.profile.actions.signOut")
578
650
  },
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, {
651
+ onSignOut: Se,
652
+ isSigningOut: R
653
+ }), Te = null;
654
+ B != null && (Te = /* @__PURE__ */ I(pe, { children: i }));
655
+ let Ee = null;
656
+ return L || (Ee = /* @__PURE__ */ I(E, {
657
+ value: j,
658
+ onChange: M,
659
+ placeholder: d("sidebar.search.placeholder"),
660
+ ariaLabel: d("sidebar.search.placeholder")
661
+ })), /* @__PURE__ */ I(ie, { children: /* @__PURE__ */ I(ne, {
583
662
  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
663
+ sections: be,
664
+ header: /* @__PURE__ */ I(T, { environment: xe }),
665
+ search: Ee,
666
+ footer: we,
667
+ isCollapsed: L,
668
+ onCollapsedChange: ae
595
669
  },
596
- topbar: { breadcrumb: /* @__PURE__ */ I("div", { ref: B }) },
670
+ topbar: { breadcrumb: /* @__PURE__ */ I("div", { ref: V }) },
597
671
  children: /* @__PURE__ */ I(g, {
598
672
  permissions: a,
599
673
  children: /* @__PURE__ */ I(m, {
600
- value: { target: z },
601
- children: xe
674
+ value: { target: B },
675
+ children: Te
602
676
  })
603
677
  })
604
678
  }) });
605
679
  }, Q = ({ children: e, permissionsQuery: t, prepared: n, authStatus: r, activeGroupId: i }) => /* @__PURE__ */ I(Z, {
606
- permissions: ie(t, n),
680
+ permissions: F(t, n),
607
681
  authStatus: r,
608
682
  activeGroupId: i,
609
683
  children: e
@@ -622,4 +696,4 @@ var W = "txvbqb9ip txvbqbai7 txvbqbu7g", G = "txvbqbwy", ce = (e) => {
622
696
  //#endregion
623
697
  export { $ as BackofficeLayoutPage, $ as default };
624
698
 
625
- //# sourceMappingURL=BackofficeLayoutPage-BiSUwAi9.js.map
699
+ //# sourceMappingURL=BackofficeLayoutPage-r6dXo9SI.js.map