@feedmepos/mf-hrm-portal 2.3.3 → 2.4.0

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 (46) hide show
  1. package/dist/{ApprovalCodeList-BvS5dgU3.js → ApprovalCodeList-D62tXKEd.js} +7 -7
  2. package/dist/{AuditLogList-CpX_suVp.js → AuditLogList-DQOdhFJm.js} +825 -835
  3. package/dist/{ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BT4DaSaO.js → ConditionBuilderForm.vue_vue_type_script_setup_true_lang-BDT1AfXa.js} +2 -2
  4. package/dist/{EmployeeList-CVsnidNV.js → EmployeeList-Bd211chl.js} +8 -8
  5. package/dist/{FormItem.vue_vue_type_script_setup_true_lang-h8toO2k-.js → FormItem.vue_vue_type_script_setup_true_lang-CUBQnkkY.js} +1 -1
  6. package/dist/{GrantUserList-Dyh5kllB.js → GrantUserList-DaUUILOT.js} +8 -8
  7. package/dist/{Main-aoY6s0QA.js → Main-B95BdgQd.js} +5 -5
  8. package/dist/{Main-CRU4YEdj.js → Main-CvGjvEQL.js} +28 -28
  9. package/dist/{Main-OmCnufx6.js → Main-Dh3E2cEf.js} +11 -11
  10. package/dist/{PermissionSetList-B7B3vnRf.js → PermissionSetList-BIzlo_EV.js} +90 -90
  11. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BYYiW77c.js +4181 -0
  12. package/dist/{PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-EwU7gHP7.js → PortalUserSearcher.vue_vue_type_style_index_0_scoped_827dfd60_lang-CSYNrTGr.js} +1 -1
  13. package/dist/{RoleList-B7jLSn2l.js → RoleList-QJV3cGvV.js} +33 -33
  14. package/dist/{ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-BG5gE0iX.js → ScheduleAddPositionModal.vue_vue_type_script_setup_true_lang-DsKfRa5Z.js} +1 -1
  15. package/dist/{ScheduleGeneralPage-DK2hKCWE.js → ScheduleGeneralPage-D6NPsdrU.js} +2 -2
  16. package/dist/{ScheduleModal.vue_vue_type_script_setup_true_lang-mMjDR4Nz.js → ScheduleModal.vue_vue_type_script_setup_true_lang-kYGNELLb.js} +3 -3
  17. package/dist/{SchedulePage-Dn4joe9m.js → SchedulePage-CO_ZP2QD.js} +13 -13
  18. package/dist/{SchedulePositionPage-D7u4QBug.js → SchedulePositionPage-DFjWfRwI.js} +3 -3
  19. package/dist/{SelectFilter-BbTj7kMh.js → SelectFilter-B94Z_Fat.js} +1 -1
  20. package/dist/TeamMemberList-BbGMw0jg.js +1150 -0
  21. package/dist/{TimesheetList-B6TIgZba.js → TimesheetList-DiTCj2H7.js} +8 -8
  22. package/dist/{TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-CF1cWXsG.js → TimesheetList.vue_vue_type_style_index_0_scoped_63294af2_lang-B97k3KNz.js} +3 -3
  23. package/dist/{app-Cfzysb_Z.js → app-BRlNuQIz.js} +2465 -2387
  24. package/dist/app.js +1 -1
  25. package/dist/{approval-code-CWq2ce3u.js → approval-code-D6eLRwC7.js} +1 -1
  26. package/dist/{dayjs.min-NoTESZyy.js → dayjs.min-BaLuYA95.js} +1 -1
  27. package/dist/{employee-BzUt7_wz.js → employee-DF_QGtpu.js} +4 -4
  28. package/dist/{grant-user-q_mkj3Vh.js → grant-user-CdkuTYlZ.js} +1 -1
  29. package/dist/{iteration-DmbHO_Rl.js → iteration-t4kb_i13.js} +1 -1
  30. package/dist/{lodash-DqvpfdBt.js → lodash-Dv0NUeUP.js} +1 -1
  31. package/dist/{restaurant-DJBQY9N5.js → restaurant-D2q9eNtu.js} +578 -581
  32. package/dist/{role-Crd3XL59.js → role-y253W1Ep.js} +19 -20
  33. package/dist/{rule-B1ck-XG6.js → rule-DaFOMP6z.js} +150 -153
  34. package/dist/src/composables/useTenant.d.ts +11 -0
  35. package/dist/src/router/courtGuard.d.ts +4 -0
  36. package/dist/src/stores/team.d.ts +1 -1
  37. package/dist/src/views/audit-log/useTraceIdDeepLink.d.ts +1 -1
  38. package/dist/style.css +1 -1
  39. package/dist/tsconfig.app.tsbuildinfo +1 -1
  40. package/dist/{useAppStore-TRX-PQD4.js → useAppStore-CIPpnfP7.js} +1 -1
  41. package/dist/{useLoading-W3YSF8OB.js → useLoading-BRCeBVXP.js} +1 -1
  42. package/dist/useReportPermissions-Bveud3kc.js +80 -0
  43. package/package.json +3 -3
  44. package/dist/PortalPermissionEditor.vue_vue_type_script_setup_true_lang-BVOwDcXo.js +0 -4167
  45. package/dist/TeamMemberList-C0nZBhqp.js +0 -1154
  46. package/dist/useReportPermissions-DmMlLiQP.js +0 -82
@@ -1,47 +1,45 @@
1
- import { s as W, c as q, e as y } from "./iteration-DmbHO_Rl.js";
2
- import { i as A, d as V, e as _, c as F, n as S, O as ee, D as M } from "./app-Cfzysb_Z.js";
3
- import { s as se } from "./utils-BZkjJbju.js";
4
- import { g, b, q as x, u as te } from "./restaurant-DJBQY9N5.js";
5
- import { defineStore as z, storeToRefs as K } from "pinia";
1
+ import { s as W, c as q, e as y } from "./iteration-t4kb_i13.js";
2
+ import { u as K, f as _, I as V, p as E, w as ee, d as F, n as S, X as se, L as M } from "./app-BRlNuQIz.js";
3
+ import { s as te } from "./utils-BZkjJbju.js";
4
+ import { g, b as v, q as x, u as ne } from "./restaurant-D2q9eNtu.js";
5
+ import { defineStore as X, storeToRefs as z } from "pinia";
6
6
  import { ref as h, computed as T } from "vue";
7
- import { useCoreStore as X } from "@feedmepos/mf-common";
8
- const E = "/permission-sets", N = {
7
+ const N = "/permission-sets", U = {
9
8
  async read() {
10
- return g(await b().get(E));
9
+ return g(await v().get(N));
11
10
  },
12
11
  async create(e) {
13
- return g(await b().post(E, e));
12
+ return g(await v().post(N, e));
14
13
  },
15
14
  async update(e, s) {
16
- return g(await b().put(`${E}/${e}`, s));
15
+ return g(await v().put(`${N}/${e}`, s));
17
16
  },
18
17
  async delete(e) {
19
- return g(await b().delete(`${E}/${e}`));
18
+ return g(await v().delete(`${N}/${e}`));
20
19
  }
21
- }, ne = z("hrm-permission-set", () => {
22
- const { currentBusiness: e } = X(), s = h([]), r = h(!1), n = h(null);
20
+ }, re = X("hrm-permission-set", () => {
21
+ const e = K(), s = h([]), r = h(!1), n = h(null);
23
22
  async function i() {
24
- var l;
25
- const c = ((l = e.value) == null ? void 0 : l._id) ?? null;
23
+ const c = e.id.value ?? null;
26
24
  if (n.value !== c)
27
25
  try {
28
26
  r.value = !0;
29
- const d = await N.read();
30
- s.value = u(d), n.value = c;
27
+ const l = await U.read();
28
+ s.value = u(l), n.value = c;
31
29
  } finally {
32
30
  r.value = !1;
33
31
  }
34
32
  }
35
33
  async function t(c) {
36
- const l = await N.create(c);
34
+ const l = await U.create(c);
37
35
  s.value = u([...s.value, l]);
38
36
  }
39
37
  async function a(c, l) {
40
- const d = await N.update(c, l);
41
- s.value = u(s.value.map((m) => m.id === c ? d : m));
38
+ const d = await U.update(c, l);
39
+ s.value = u(s.value.map((f) => f.id === c ? d : f));
42
40
  }
43
41
  async function o(c) {
44
- await N.delete(c), s.value = u(s.value.filter((l) => l.id !== c));
42
+ await U.delete(c), s.value = u(s.value.filter((l) => l.id !== c));
45
43
  }
46
44
  function u(c) {
47
45
  return c.sort((l, d) => l.name.localeCompare(d.name));
@@ -54,11 +52,11 @@ const E = "/permission-sets", N = {
54
52
  updatePermissionSet: a,
55
53
  deletePermissionSet: o
56
54
  };
57
- }), re = () => {
58
- const e = ne();
55
+ }), ie = () => {
56
+ const e = re();
59
57
  return {
60
58
  ...e,
61
- ...K(e)
59
+ ...z(e)
62
60
  };
63
61
  };
64
62
  function D(e) {
@@ -92,45 +90,45 @@ function Q(e) {
92
90
  return;
93
91
  }
94
92
  d.setNames.push(a.name);
95
- const m = D(d.conditions);
96
- if (!m || !c) {
93
+ const f = D(d.conditions);
94
+ if (!f || !c) {
97
95
  d.conditions = void 0;
98
96
  return;
99
97
  }
100
- for (const f in c)
101
- (o = m[f]) != null && o.$in && (u = c[f]) != null && u.$in ? m[f].$in = Array.from(
102
- /* @__PURE__ */ new Set([...m[f].$in, ...c[f].$in])
103
- ) : m[f] || (m[f] = c[f]);
104
- d.conditions = JSON.stringify(m);
98
+ for (const m in c)
99
+ (o = f[m]) != null && o.$in && (u = c[m]) != null && u.$in ? f[m].$in = Array.from(
100
+ /* @__PURE__ */ new Set([...f[m].$in, ...c[m].$in])
101
+ ) : f[m] || (f[m] = c[m]);
102
+ d.conditions = JSON.stringify(f);
105
103
  };
106
104
  for (const i of e)
107
105
  for (const t of i.permissions)
108
106
  n(t.inverted ? r : s, t, i);
109
107
  return [...Array.from(s.values()), ...Array.from(r.values())];
110
108
  }
111
- function B(e, s) {
109
+ function L(e, s) {
112
110
  return `${e}::${[...s].sort().join(",")}`;
113
111
  }
114
112
  function G(e, s) {
115
113
  const r = [...e], n = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
116
114
  for (const o of e) {
117
- const u = A(o.subject);
118
- n.add(B(u, o.actions)), o.inverted && o.actions.includes("manage") && i.add(`set_${u}`), !o.inverted && o.actions.includes("manage") && t.add(u);
115
+ const u = _(o.subject);
116
+ n.add(L(u, o.actions)), o.inverted && o.actions.includes("manage") && i.add(`set_${u}`), !o.inverted && o.actions.includes("manage") && t.add(u);
119
117
  }
120
118
  const a = [...e];
121
119
  for (; a.length > 0; ) {
122
- const o = a.shift(), u = `set_${A(o.subject)}`, c = s[u];
120
+ const o = a.shift(), u = `set_${_(o.subject)}`, c = s[u];
123
121
  if (!c || i.has(u) || !o.actions.includes("manage") || o.inverted) continue;
124
122
  i.add(u);
125
- const l = ie(o);
123
+ const l = oe(o);
126
124
  o.source && !o.source.trace && (o.source = { ...o.source, trace: l });
127
125
  const d = [...l, `${c.name} (system)`];
128
- for (const m of c.permissions ?? []) {
129
- const f = A(m.subject), p = B(f, m.actions);
130
- n.has(p) || t.has(f) || (n.add(p), r.push({
131
- ...m,
126
+ for (const f of c.permissions ?? []) {
127
+ const m = _(f.subject), p = L(m, f.actions);
128
+ n.has(p) || t.has(m) || (n.add(p), r.push({
129
+ ...f,
132
130
  // FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
133
- fields: m.fields ?? void 0,
131
+ fields: f.fields ?? void 0,
134
132
  source: {
135
133
  type: "systemPermissionSet",
136
134
  permissionSetId: c.key,
@@ -139,9 +137,9 @@ function G(e, s) {
139
137
  }
140
138
  }));
141
139
  }
142
- for (const m of c.permissionSets ?? []) {
143
- const f = A(m), p = B(f, ["manage"]), v = {
144
- subject: f,
140
+ for (const f of c.permissionSets ?? []) {
141
+ const m = _(f), p = L(m, ["manage"]), b = {
142
+ subject: m,
145
143
  actions: ["manage"],
146
144
  source: {
147
145
  type: "systemPermissionSet",
@@ -150,12 +148,12 @@ function G(e, s) {
150
148
  trace: d
151
149
  }
152
150
  };
153
- n.has(p) || (n.add(p), r.push(v)), a.push(v);
151
+ n.has(p) || (n.add(p), r.push(b)), a.push(b);
154
152
  }
155
153
  }
156
154
  return [...r.filter((o) => !o.inverted), ...r.filter((o) => o.inverted)];
157
155
  }
158
- function ie(e) {
156
+ function oe(e) {
159
157
  if (!e.source) return [];
160
158
  const { type: s, trace: r, permissionSetName: n } = e.source;
161
159
  if (r && r.length > 0) return r;
@@ -179,13 +177,13 @@ function H(e, s, r = /* @__PURE__ */ new Set()) {
179
177
  }
180
178
  return n;
181
179
  }
182
- function Oe(e) {
180
+ function Ae(e) {
183
181
  const s = Q(e).map(
184
182
  ({ setNames: i, setId: t, ...a }) => a
185
183
  ), r = s.filter((i) => !i.inverted), n = s.filter((i) => i.inverted);
186
- return L(r, n);
184
+ return B(r, n);
187
185
  }
188
- function Ae(e, s, r) {
186
+ function Oe(e, s, r) {
189
187
  const n = /* @__PURE__ */ new Map();
190
188
  return e.forEach(
191
189
  ({ name: i, permissions: t }) => t.forEach(({ conditions: a, actions: o }) => {
@@ -226,28 +224,28 @@ function _e(e, s) {
226
224
  JSON.stringify(l) !== JSON.stringify(d) && t.push(c);
227
225
  continue;
228
226
  }
229
- const m = Object.keys(l)[0], f = l[m].$in.filter(
230
- (v) => !d[m].$in.includes(v)
227
+ const f = Object.keys(l)[0], m = l[f].$in.filter(
228
+ (b) => !d[f].$in.includes(b)
231
229
  );
232
- f.length > 0 && t.push(r(u, f)), d[m].$in.filter(
233
- (v) => !l[m].$in.includes(v)
230
+ m.length > 0 && t.push(r(u, m)), d[f].$in.filter(
231
+ (b) => !l[f].$in.includes(b)
234
232
  ).length > 0 && t.push(c);
235
233
  } else if (!u.conditions && c.conditions)
236
234
  t.push(c);
237
235
  else if (u.conditions && !c.conditions)
238
236
  j(JSON.parse(u.conditions)) || t.push(c);
239
237
  else if (!u.conditions && !c.conditions) {
240
- const l = new Set(u.actions), d = new Set(c.actions), m = c.actions.some((p) => !l.has(p)), f = u.actions.filter((p) => !d.has(p));
241
- if (m) {
242
- const p = c.actions.filter((v) => !l.has(v));
238
+ const l = new Set(u.actions), d = new Set(c.actions), f = c.actions.some((p) => !l.has(p)), m = u.actions.filter((p) => !d.has(p));
239
+ if (f) {
240
+ const p = c.actions.filter((b) => !l.has(b));
243
241
  t.push({
244
242
  ...c,
245
243
  actions: p
246
244
  });
247
245
  }
248
- f.length > 0 && t.push({
246
+ m.length > 0 && t.push({
249
247
  ...u,
250
- actions: f,
248
+ actions: m,
251
249
  inverted: !0
252
250
  });
253
251
  }
@@ -287,23 +285,23 @@ function Ee(e) {
287
285
  );
288
286
  return e.filter((i) => i.inverted ? !(r.has(i.subject) && !n.has(i.subject)) : !r.has(i.subject));
289
287
  }
290
- const oe = "business::report::";
288
+ const ae = "business::report::";
291
289
  function Ne(e, s) {
292
290
  const r = [], n = e.filter((i) => {
293
291
  const t = i.subject;
294
- return !t.startsWith(oe) || s.has(t) ? !0 : (r.push(t), !1);
292
+ return !t.startsWith(ae) || s.has(t) ? !0 : (r.push(t), !1);
295
293
  });
296
294
  return r.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", r), n;
297
295
  }
298
- const ae = "business::report::reports::", ce = _.Subject.Business.report_reports_allDefaultReports, ue = _.Subject.Business.report_reports_allCustomReports;
299
- function le(e, s) {
296
+ const ce = "business::report::reports::", ue = E.Subject.Business.report_reports_allDefaultReports, le = E.Subject.Business.report_reports_allCustomReports;
297
+ function de(e, s) {
300
298
  return e.conditions ? !!s.conditions && e.conditions === s.conditions : !s.conditions;
301
299
  }
302
300
  function Ue(e, s) {
303
301
  const r = e.find(
304
- (a) => !a.inverted && a.subject === ce
305
- ), n = e.find(
306
302
  (a) => !a.inverted && a.subject === ue
303
+ ), n = e.find(
304
+ (a) => !a.inverted && a.subject === le
307
305
  );
308
306
  if (!r && !n) return e;
309
307
  const i = r ? new Set(r.actions) : null, t = n ? new Set(n.actions) : null;
@@ -311,22 +309,22 @@ function Ue(e, s) {
311
309
  if (o.inverted)
312
310
  return a.push(o), a;
313
311
  const u = o.subject;
314
- if (!u.startsWith(ae))
312
+ if (!u.startsWith(ce))
315
313
  return a.push(o), a;
316
314
  const c = s.has(u), l = c ? i : t, d = c ? r : n;
317
- if (!l || !d || !le(d, o))
315
+ if (!l || !d || !de(d, o))
318
316
  return a.push(o), a;
319
317
  if (l.has("manage")) return a;
320
- const m = o.actions;
321
- if (m.includes("manage"))
318
+ const f = o.actions;
319
+ if (f.includes("manage"))
322
320
  return a.push(o), a;
323
- const f = new Set(m);
321
+ const m = new Set(f);
324
322
  for (const p of l)
325
- f.delete(p);
326
- return f.size === 0 || a.push({ ...o, actions: Array.from(f) }), a;
323
+ m.delete(p);
324
+ return m.size === 0 || a.push({ ...o, actions: Array.from(m) }), a;
327
325
  }, []);
328
326
  }
329
- function L(e, s) {
327
+ function B(e, s) {
330
328
  var n, i;
331
329
  const r = new Map(e.map((t) => [t.subject, t]));
332
330
  for (const t of s) {
@@ -339,10 +337,10 @@ function L(e, s) {
339
337
  r.delete(t.subject);
340
338
  continue;
341
339
  }
342
- const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], f = (((i = u[l]) == null ? void 0 : i.$in) ?? []).filter((p) => !d.includes(p));
343
- f.length > 0 ? r.set(t.subject, {
340
+ const l = Object.keys(c)[0], d = ((n = c[l]) == null ? void 0 : n.$in) ?? [], m = (((i = u[l]) == null ? void 0 : i.$in) ?? []).filter((p) => !d.includes(p));
341
+ m.length > 0 ? r.set(t.subject, {
344
342
  ...o,
345
- conditions: JSON.stringify({ [l]: { $in: f } })
343
+ conditions: JSON.stringify({ [l]: { $in: m } })
346
344
  }) : r.delete(t.subject);
347
345
  } else
348
346
  r.delete(t.subject);
@@ -377,37 +375,37 @@ function L(e, s) {
377
375
  }
378
376
  return Array.from(r.values());
379
377
  }
380
- function de(e, s) {
381
- const r = L(e, s), n = new Set(e.map((t) => t.subject)), i = s.filter(
378
+ function fe(e, s) {
379
+ const r = B(e, s), n = new Set(e.map((t) => t.subject)), i = s.filter(
382
380
  (t) => t.inverted && !n.has(t.subject)
383
381
  );
384
382
  return [...r, ...i];
385
383
  }
386
384
  const P = "/permission-assignments", I = {
387
385
  async readAll() {
388
- return g(await b().get(P));
386
+ return g(await v().get(P));
389
387
  },
390
388
  async readByUserId(e) {
391
- return g(await b().get(`${P}/user/${e}`));
389
+ return g(await v().get(`${P}/user/${e}`));
392
390
  },
393
391
  async readById(e) {
394
- return g(await b().get(`${P}/${e}`));
392
+ return g(await v().get(`${P}/${e}`));
395
393
  },
396
394
  async create(e) {
397
- return g(await b().post(P, e));
395
+ return g(await v().post(P, e));
398
396
  },
399
397
  async update(e, s) {
400
- return g(await b().put(`${P}/${e}`, s));
398
+ return g(await v().put(`${P}/${e}`, s));
401
399
  },
402
400
  async delete(e) {
403
- return g(await b().delete(`${P}/${e}`));
401
+ return g(await v().delete(`${P}/${e}`));
404
402
  },
405
403
  async addReportManagePermission(e, s) {
406
404
  return g(
407
- await b().post("/my-permissions/report-manage", { permissionKey: e, label: s })
405
+ await v().post("/my-permissions/report-manage", { permissionKey: e, label: s })
408
406
  );
409
407
  }
410
- }, me = z("hrm-permission-assignment", () => {
408
+ }, me = X("hrm-permission-assignment", () => {
411
409
  const e = h([]);
412
410
  async function s() {
413
411
  const o = await I.readAll();
@@ -439,13 +437,13 @@ const P = "/permission-assignments", I = {
439
437
  deletePermissionAssignment: t,
440
438
  getPermissionAssignmentByUserId: a
441
439
  };
442
- }), fe = () => {
440
+ }), pe = () => {
443
441
  const e = me();
444
442
  return {
445
443
  ...e,
446
- ...K(e)
444
+ ...z(e)
447
445
  };
448
- }, pe = {
446
+ }, ge = {
449
447
  async fetchReportPermissions(e, s) {
450
448
  const r = s ? { lang: s } : {};
451
449
  return g(
@@ -458,41 +456,40 @@ const P = "/permission-assignments", I = {
458
456
  await x().get(`/report-query/hrm/${e}/reports`, { params: r })
459
457
  );
460
458
  }
461
- }, U = h([]), C = h(!1), R = h(!1), $ = h(null), k = h(null), J = h(!1);
462
- function ge() {
463
- const e = X();
459
+ }, R = h([]), C = h(!1), $ = h(!1), A = h(null), k = h(null), J = h(!1);
460
+ function ve() {
461
+ const e = K();
464
462
  async function s() {
465
- var t;
466
- const n = (t = e.currentBusiness.value) == null ? void 0 : t.id;
463
+ const n = e.id.value;
467
464
  if (!n) return;
468
465
  const i = localStorage.getItem("locale");
469
- if ($.value !== n && (U.value = [], C.value = !1, R.value = !1, $.value = n, J.value = !1), !(C.value && k.value === i)) {
470
- if (R.value) {
466
+ if (A.value !== n && (R.value = [], C.value = !1, $.value = !1, A.value = n, J.value = !1), !(C.value && k.value === i)) {
467
+ if ($.value) {
471
468
  J.value = !0;
472
469
  return;
473
470
  }
474
- R.value = !0;
471
+ $.value = !0;
475
472
  try {
476
- const a = await pe.fetchReportPermissionsForPortal(n, i);
477
- if ($.value !== n) return;
478
- U.value = a, C.value = !0, k.value = i;
479
- } catch (a) {
480
- if ($.value !== n) return;
481
- console.warn("Failed to fetch custom report permissions:", a), U.value = [];
473
+ const t = await ge.fetchReportPermissionsForPortal(n, i);
474
+ if (A.value !== n) return;
475
+ R.value = t, C.value = !0, k.value = i;
476
+ } catch (t) {
477
+ if (A.value !== n) return;
478
+ console.warn("Failed to fetch custom report permissions:", t), R.value = [];
482
479
  } finally {
483
- $.value === n && (R.value = !1, J.value && (J.value = !1, await s()));
480
+ A.value === n && ($.value = !1, J.value && (J.value = !1, await s()));
484
481
  }
485
482
  }
486
483
  }
487
- const r = T(() => U.value.map(
488
- (n) => n.isDefault ? {
489
- label: n.name,
490
- subject: `business::report::reports::${n.permissionKey}`,
484
+ const r = T(() => (e.isFoodCourt.value ? R.value.filter((i) => !i.isDefault || ee.has(i.permissionKey)) : R.value).map(
485
+ (i) => i.isDefault ? {
486
+ label: i.name,
487
+ subject: `business::report::reports::${i.permissionKey}`,
491
488
  actions: [S.manage, S.read, S.create],
492
489
  category: F.reports
493
490
  } : {
494
- label: n.name,
495
- subject: `business::report::reports::${n.permissionKey}`,
491
+ label: i.name,
492
+ subject: `business::report::reports::${i.permissionKey}`,
496
493
  actions: [
497
494
  S.manage,
498
495
  S.read,
@@ -506,23 +503,23 @@ function ge() {
506
503
  return {
507
504
  fetchCustomReportPermissions: s,
508
505
  customReportPermissions: r,
509
- isLoading: T(() => R.value),
506
+ isLoading: T(() => $.value),
510
507
  isLoaded: T(() => C.value)
511
508
  };
512
509
  }
513
510
  function O(e) {
514
- const s = re(), r = fe(), n = te().restaurants, { customReportPermissions: i } = ge(), t = r.getPermissionAssignmentByUserId(e.id), a = H(
511
+ const s = ie(), r = pe(), n = ne().restaurants, { customReportPermissions: i } = ve(), t = r.getPermissionAssignmentByUserId(e.id), a = H(
515
512
  (t == null ? void 0 : t.permissionSetIds) ?? [],
516
513
  s.permissionSets.value
517
514
  ), o = Q(a).map(
518
- ({ setNames: p, ...v }) => v
515
+ ({ setNames: p, ...b }) => b
519
516
  ), u = t == null ? void 0 : t.customPermissions, c = u ?? e.permissions.map((p) => ({
520
517
  ...p,
521
- subject: A(p.subject)
522
- })), l = L(o, c), d = G(
523
- de(o, c),
518
+ subject: _(p.subject)
519
+ })), l = B(o, c), d = G(
520
+ fe(o, c),
524
521
  V
525
- ).filter((p) => !p.inverted), m = Y(d), f = m ?? n.value.map((p) => p._id);
522
+ ).filter((p) => !p.inverted), f = Y(d), m = f ?? n.value.map((p) => p._id);
526
523
  return {
527
524
  doc: e,
528
525
  id: e.id,
@@ -530,28 +527,28 @@ function O(e) {
530
527
  phoneNumber: e.phoneNumber,
531
528
  email: e.email,
532
529
  restaurants: W(
533
- f.map((p) => {
534
- var v;
535
- return ((v = n.value.find((Z) => Z._id === p)) == null ? void 0 : v.profile.name) ?? "";
530
+ m.map((p) => {
531
+ var b;
532
+ return ((b = n.value.find((Z) => Z._id === p)) == null ? void 0 : b.profile.name) ?? "";
536
533
  })
537
534
  ),
538
- managableRestaurantIds: m,
539
- permissionLabels: Se(d, i.value),
535
+ managableRestaurantIds: f,
536
+ permissionLabels: ye(d, i.value),
540
537
  permissions: l
541
538
  };
542
539
  }
543
540
  const be = Object.freeze(
544
- Object.values(ee)
541
+ Object.values(se)
545
542
  ), Ce = {
546
543
  async readTeamMembers() {
547
544
  return g(
548
- await b().get("/portal-users")
545
+ await v().get("/portal-users")
549
546
  ).map(O);
550
547
  },
551
548
  async readTeamMembersPage(e) {
552
549
  var r, n, i;
553
550
  const s = g(
554
- await b().get("/portal-users/paged", {
551
+ await v().get("/portal-users/paged", {
555
552
  params: {
556
553
  limit: e.limit,
557
554
  offset: e.offset,
@@ -569,28 +566,28 @@ const be = Object.freeze(
569
566
  },
570
567
  async readTeamMember(e) {
571
568
  return O(
572
- g(await b().get(`/portal-users/${e}`))
569
+ g(await v().get(`/portal-users/${e}`))
573
570
  );
574
571
  },
575
572
  async createTeamMember(e) {
576
573
  return O(
577
- g(await b().post("/portal-users", e))
574
+ g(await v().post("/portal-users", e))
578
575
  );
579
576
  },
580
577
  async updateTeamMember(e, s) {
581
578
  return O(
582
- g(await b().put(`/portal-users/${e}`, s))
579
+ g(await v().put(`/portal-users/${e}`, s))
583
580
  );
584
581
  },
585
582
  async deleteTeamMember(e) {
586
- return g(await b().delete(`/portal-users/${e}`));
583
+ return g(await v().delete(`/portal-users/${e}`));
587
584
  },
588
585
  async readTeamMemberPosUserIds() {
589
- return g(await b().get("/portal-users")).map((s) => s.posUserId);
586
+ return g(await v().get("/portal-users")).map((s) => s.posUserId);
590
587
  },
591
588
  async generateMasterUserPasscode(e) {
592
589
  return `${g(
593
- await b().post("/portal-users/generate-passcode", {
590
+ await v().post("/portal-users/generate-passcode", {
594
591
  restaurantIds: e.restaurantIds,
595
592
  excludePosUserId: e.excludePosUserId
596
593
  })
@@ -652,7 +649,7 @@ function w(e) {
652
649
  return n === void 0 ? r.toString() : n.endsWith("_") ? n.slice(0, n.length - 1) : n;
653
650
  },
654
651
  get label() {
655
- return s.label || se(this.formatted);
652
+ return s.label || te(this.formatted);
656
653
  },
657
654
  get value() {
658
655
  const n = this.discriminator;
@@ -669,21 +666,21 @@ function Te(e) {
669
666
  }
670
667
  function Y(e) {
671
668
  const s = e.find(
672
- (r) => r.subject === _.Subject.Restaurant.restaurant
669
+ (r) => r.subject === E.Subject.Restaurant.restaurant
673
670
  );
674
671
  return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
675
672
  }
676
- function Be(e, s) {
677
- return s.isOwner ? { restaurantIds: null, roleIds: null } : { restaurantIds: Y(e), roleIds: ve(e) };
673
+ function Le(e, s) {
674
+ return s.isOwner ? { restaurantIds: null, roleIds: null } : { restaurantIds: Y(e), roleIds: he(e) };
678
675
  }
679
676
  function Me(e) {
680
677
  return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
681
678
  }
682
- function ve(e) {
683
- const s = e.find((r) => r.subject === _.Subject.Business.role);
679
+ function he(e) {
680
+ const s = e.find((r) => r.subject === E.Subject.Business.role);
684
681
  return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
685
682
  }
686
- function Le(e) {
683
+ function Be(e) {
687
684
  const s = w(e);
688
685
  if (!s.isReportPermission) return;
689
686
  const { name: r, ...n } = s.conditions ?? {};
@@ -691,7 +688,7 @@ function Le(e) {
691
688
  }
692
689
  function Fe(e, s, r) {
693
690
  return e.flatMap((n) => {
694
- const i = he(n);
691
+ const i = Se(n);
695
692
  if (!i) return [];
696
693
  const t = i.isReportPermission ? r == null ? void 0 : r.get(n) : void 0;
697
694
  return [
@@ -707,7 +704,7 @@ function Fe(e, s, r) {
707
704
  ];
708
705
  });
709
706
  }
710
- function he(e) {
707
+ function Se(e) {
711
708
  const s = e.indexOf(":"), r = s === -1 ? e : e.slice(0, s), n = s === -1 ? void 0 : e.slice(s + 1);
712
709
  if (s !== -1 && !n) return;
713
710
  let i;
@@ -737,14 +734,14 @@ function xe(e, s) {
737
734
  }
738
735
  return r;
739
736
  }
740
- function Se(e, s = []) {
737
+ function ye(e, s = []) {
741
738
  return W(
742
739
  e.reduce((r, n) => {
743
740
  const i = be.find(
744
741
  (t) => t.subject === n.subject && n.actions.includes("manage")
745
742
  ) || s.find((t) => t.subject === n.subject);
746
743
  if (i) {
747
- const t = i.subject === _.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
744
+ const t = i.subject === E.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
748
745
  r.push(t);
749
746
  }
750
747
  return r;
@@ -754,30 +751,30 @@ function Se(e, s = []) {
754
751
  export {
755
752
  G as N,
756
753
  Q as P,
757
- pe as R,
754
+ ge as R,
758
755
  Je as a,
759
- de as b,
756
+ fe as b,
760
757
  H as c,
761
- ge as d,
762
- Le as e,
758
+ ve as d,
759
+ Be as e,
763
760
  Fe as f,
764
761
  Te as g,
765
762
  Me as h,
766
- oe as i,
767
- Be as j,
763
+ ae as i,
764
+ Le as j,
768
765
  Ee as k,
769
766
  _e as l,
770
- Oe as m,
767
+ Ae as m,
771
768
  Ne as n,
772
769
  Ue as o,
773
770
  be as p,
774
- fe as q,
771
+ pe as q,
775
772
  w as r,
776
773
  xe as s,
777
774
  Ce as t,
778
- re as u,
779
- Se as v,
780
- Ae as w,
775
+ ie as u,
776
+ ye as v,
777
+ Oe as w,
781
778
  Y as x,
782
- ve as y
779
+ he as y
783
780
  };
@@ -0,0 +1,11 @@
1
+ import { type ComputedRef } from 'vue';
2
+ import { type PortalTenantType as TenantType } from '@feedmepos/hrm-permission';
3
+ export type { PortalTenantType as TenantType } from '@feedmepos/hrm-permission';
4
+ export interface Tenant {
5
+ type: ComputedRef<TenantType>;
6
+ isFoodCourt: ComputedRef<boolean>;
7
+ id: ComputedRef<string | undefined>;
8
+ name: ComputedRef<string>;
9
+ }
10
+ /** The business or food court the portal is currently in. */
11
+ export declare function useTenant(): Tenant;
@@ -0,0 +1,4 @@
1
+ import { RouteName } from './shared';
2
+ export declare function courtRedirect(path: string, isFoodCourt: boolean): {
3
+ name: RouteName;
4
+ } | undefined;
@@ -101,7 +101,7 @@ declare const useTeamStore: import("pinia").StoreDefinition<"hrm-team", Pick<{
101
101
  readTeamMembers: ({ force }?: {
102
102
  force?: boolean | undefined;
103
103
  }) => Promise<void>;
104
- }, "isLoading" | "members" | "hasLoaded">, Pick<{
104
+ }, "members" | "isLoading" | "hasLoaded">, Pick<{
105
105
  members: import("vue").Ref<{
106
106
  id: string;
107
107
  name: string;