@feedmepos/mf-hrm-portal 2.0.15-dev.3 → 2.0.15-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/{AuditLogList-eyzJecZc.js → AuditLogList-DnmeTc37.js} +4 -4
  2. package/dist/{EmployeeList-QibdsTN-.js → EmployeeList-DxlllTty.js} +43 -43
  3. package/dist/{Main-B_QCpWOx.js → Main-COZvNyhk.js} +4 -4
  4. package/dist/{Main-DX1aet8y.js → Main-CeFkxIhA.js} +765 -770
  5. package/dist/{Main-Bjfm9a6M.js → Main-D1yqf9Yq.js} +13 -14
  6. package/dist/{PermissionSetList-fE9Zfrl6.js → PermissionSetList-Ckc-VGme.js} +5 -5
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-JpCfRxA9.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-n4_wNZbg.js} +658 -661
  8. package/dist/{RoleList-ByXZemFz.js → RoleList-BDbQX9of.js} +7 -7
  9. package/dist/{TeamMemberList-D-_icv19.js → TeamMemberList-DJYxuPyN.js} +324 -323
  10. package/dist/{TimesheetList-DVvz6id4.js → TimesheetList-CxehedOx.js} +6 -6
  11. package/dist/{app-DJG3HGqG.js → app-DEA0Bhzy.js} +2206 -1378
  12. package/dist/app.js +1 -1
  13. package/dist/{dayjs.min-CN6o-ax9.js → dayjs.min-D-rfdWhu.js} +1 -1
  14. package/dist/{employee-CU-G-rAZ.js → employee-CFnP1VvM.js} +3 -3
  15. package/dist/{iteration-C6Km_Rno.js → iteration-S7YxnyNB.js} +1 -1
  16. package/dist/{lodash-DZvG4gEx.js → lodash-BdeQh1LM.js} +1 -1
  17. package/dist/{rule-X41LxaES.js → rule-DbvJ1q_w.js} +277 -278
  18. package/dist/style.css +1 -1
  19. package/dist/{timesheet-DUtxTIA4.js → timesheet-CPZSm4Qs.js} +2 -2
  20. package/dist/tsconfig.app.tsbuildinfo +1 -1
  21. package/dist/{useAppStore-CrUYEAtX.js → useAppStore-CJ6tnELc.js} +1 -1
  22. package/dist/{useLoading-hGUqfW4U.js → useLoading-BuN7YL-v.js} +1 -1
  23. package/dist/{useReportPermissions-BgTdISQy.js → useReportPermissions-D-GJuNg3.js} +3 -3
  24. package/package.json +1 -1
  25. package/dist/index-ynxje0mm.js +0 -827
@@ -1,10 +1,10 @@
1
- import { g as b, b as v, q as L, s as D, d as Q, e as h } from "./iteration-C6Km_Rno.js";
2
- import { b as I, A as x, p as F, e as S, C as G, u as J } from "./app-DJG3HGqG.js";
1
+ import { g as b, b as g, q as L, s as D, d as Q, e as j } from "./iteration-S7YxnyNB.js";
2
+ import { e as I, A as x, p as F, h as S, C as G, d as B } from "./app-DEA0Bhzy.js";
3
3
  import { s as H } from "./utils-BZkjJbju.js";
4
4
  import { defineStore as k, storeToRefs as W } from "pinia";
5
- import { ref as j, computed as T } from "vue";
6
- import { useCoreStore as N } from "@feedmepos/mf-common";
7
- const B = [
5
+ import { ref as h, computed as N } from "vue";
6
+ import { useCoreStore as J } from "@feedmepos/mf-common";
7
+ const U = [
8
8
  {
9
9
  label: "",
10
10
  subject: "order",
@@ -338,47 +338,47 @@ const B = [
338
338
  inverted: !1,
339
339
  reason: ""
340
340
  }
341
- ], A = "/permission-sets", _ = {
341
+ ], A = "/permission-sets", O = {
342
342
  async read() {
343
- return b(await v().get(A));
343
+ return b(await g().get(A));
344
344
  },
345
345
  async create(e) {
346
- return b(await v().post(A, e));
346
+ return b(await g().post(A, e));
347
347
  },
348
- async update(e, s) {
349
- return b(await v().put(`${A}/${e}`, s));
348
+ async update(e, n) {
349
+ return b(await g().put(`${A}/${e}`, n));
350
350
  },
351
351
  async delete(e) {
352
- return b(await v().delete(`${A}/${e}`));
352
+ return b(await g().delete(`${A}/${e}`));
353
353
  }
354
354
  }, Y = k("permissionSet", () => {
355
- const { currentBusiness: e } = N(), s = j([]), t = j(null);
355
+ const { currentBusiness: e } = J(), n = h([]), t = h(null);
356
356
  async function o() {
357
357
  var l;
358
- const u = ((l = e.value) == null ? void 0 : l._id) ?? null;
359
- if (t.value === u) return;
360
- const r = await _.read();
361
- s.value = a(r), t.value = u;
358
+ const a = ((l = e.value) == null ? void 0 : l._id) ?? null;
359
+ if (t.value === a) return;
360
+ const u = await O.read();
361
+ n.value = r(u), t.value = a;
362
362
  }
363
- async function i(u) {
364
- const r = await _.create(u);
365
- s.value = a([...s.value, r]);
363
+ async function i(a) {
364
+ const u = await O.create(a);
365
+ n.value = r([...n.value, u]);
366
366
  }
367
- async function n(u, r) {
368
- const l = await _.update(u, r);
369
- s.value = a(s.value.map((d) => d.id === u ? l : d));
367
+ async function s(a, u) {
368
+ const l = await O.update(a, u);
369
+ n.value = r(n.value.map((d) => d.id === a ? l : d));
370
370
  }
371
- async function c(u) {
372
- await _.delete(u), s.value = a(s.value.filter((r) => r.id !== u));
371
+ async function c(a) {
372
+ await O.delete(a), n.value = r(n.value.filter((u) => u.id !== a));
373
373
  }
374
- function a(u) {
375
- return u.sort((r, l) => r.name.localeCompare(l.name));
374
+ function r(a) {
375
+ return a.sort((u, l) => u.name.localeCompare(l.name));
376
376
  }
377
377
  return {
378
- permissionSets: s,
378
+ permissionSets: n,
379
379
  readPermissionSets: o,
380
380
  createPermissionSet: i,
381
- updatePermissionSet: n,
381
+ updatePermissionSet: s,
382
382
  deletePermissionSet: c
383
383
  };
384
384
  }), Z = () => {
@@ -389,77 +389,77 @@ const B = [
389
389
  };
390
390
  };
391
391
  function V(e) {
392
- const s = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), o = (i, n, c) => {
393
- var a, u;
394
- const r = `${n.subject}::${JSON.stringify([...n.actions].sort())}`, l = i.get(r);
392
+ const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), o = (i, s, c) => {
393
+ var r, a;
394
+ const u = `${s.subject}::${JSON.stringify([...s.actions].sort())}`, l = i.get(u);
395
395
  if (!l) {
396
- i.set(r, { ...n, setNames: [c.name], setId: c._id });
396
+ i.set(u, { ...s, setNames: [c.name], setId: c._id });
397
397
  return;
398
398
  }
399
- if (l.setNames.push(c.name), l.conditions && n.conditions) {
400
- const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, f = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
401
- for (const m in f)
402
- (a = d[m]) != null && a.$in && (u = f[m]) != null && u.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...f[m].$in])) : d[m] || (d[m] = f[m]);
399
+ if (l.setNames.push(c.name), l.conditions && s.conditions) {
400
+ const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
401
+ for (const m in p)
402
+ (r = d[m]) != null && r.$in && (a = p[m]) != null && a.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
403
403
  l.conditions = JSON.stringify(d);
404
404
  }
405
405
  };
406
406
  for (const i of e)
407
- for (const n of i.permissions)
408
- o(n.inverted ? t : s, n, i);
409
- return [...Array.from(s.values()), ...Array.from(t.values())];
407
+ for (const s of i.permissions)
408
+ o(s.inverted ? t : n, s, i);
409
+ return [...Array.from(n.values()), ...Array.from(t.values())];
410
410
  }
411
- function U(e, s) {
412
- return `${e}::${[...s].sort().join(",")}`;
411
+ function T(e, n) {
412
+ return `${e}::${[...n].sort().join(",")}`;
413
413
  }
414
- function z(e, s) {
415
- const t = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
416
- for (const a of e) {
417
- const u = I(a.subject);
418
- o.add(U(u, a.actions)), a.inverted && a.actions.includes("manage") && i.add(`set_${u}`), !a.inverted && a.actions.includes("manage") && n.add(u);
414
+ function z(e, n) {
415
+ const t = [...e], o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
416
+ for (const r of e) {
417
+ const a = I(r.subject);
418
+ o.add(T(a, r.actions)), r.inverted && r.actions.includes("manage") && i.add(`set_${a}`), !r.inverted && r.actions.includes("manage") && s.add(a);
419
419
  }
420
420
  const c = [...e];
421
421
  for (; c.length > 0; ) {
422
- const a = c.shift(), u = `set_${I(a.subject)}`, r = s[u];
423
- if (!r || i.has(u) || !a.actions.includes("manage") || a.inverted) continue;
424
- i.add(u);
425
- const l = q(a);
426
- a.source && !a.source.trace && (a.source = { ...a.source, trace: l });
427
- const d = [...l, `${r.name} (system)`];
428
- for (const f of r.permissions ?? []) {
429
- const m = I(f.subject), p = U(m, f.actions);
430
- o.has(p) || n.has(m) || (o.add(p), t.push({
431
- ...f,
422
+ const r = c.shift(), a = `set_${I(r.subject)}`, u = n[a];
423
+ if (!u || i.has(a) || !r.actions.includes("manage") || r.inverted) continue;
424
+ i.add(a);
425
+ const l = q(r);
426
+ r.source && !r.source.trace && (r.source = { ...r.source, trace: l });
427
+ const d = [...l, `${u.name} (system)`];
428
+ for (const p of u.permissions ?? []) {
429
+ const m = I(p.subject), f = T(m, p.actions);
430
+ o.has(f) || s.has(m) || (o.add(f), t.push({
431
+ ...p,
432
432
  // FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
433
- fields: f.fields ?? void 0,
433
+ fields: p.fields ?? void 0,
434
434
  source: {
435
435
  type: "systemPermissionSet",
436
- permissionSetId: r.key,
437
- permissionSetName: r.name,
436
+ permissionSetId: u.key,
437
+ permissionSetName: u.name,
438
438
  trace: d
439
439
  }
440
440
  }));
441
441
  }
442
- for (const f of r.permissionSets ?? []) {
443
- const m = I(f), p = U(m, ["manage"]), g = {
442
+ for (const p of u.permissionSets ?? []) {
443
+ const m = I(p), f = T(m, ["manage"]), v = {
444
444
  subject: m,
445
445
  actions: ["manage"],
446
446
  source: {
447
447
  type: "systemPermissionSet",
448
- permissionSetId: r.key,
449
- permissionSetName: r.name,
448
+ permissionSetId: u.key,
449
+ permissionSetName: u.name,
450
450
  trace: d
451
451
  }
452
452
  };
453
- o.has(p) || (o.add(p), t.push(g)), c.push(g);
453
+ o.has(f) || (o.add(f), t.push(v)), c.push(v);
454
454
  }
455
455
  }
456
- return [...t.filter((a) => !a.inverted), ...t.filter((a) => a.inverted)];
456
+ return [...t.filter((r) => !r.inverted), ...t.filter((r) => r.inverted)];
457
457
  }
458
458
  function q(e) {
459
459
  if (!e.source) return [];
460
- const { type: s, trace: t, permissionSetName: o } = e.source;
460
+ const { type: n, trace: t, permissionSetName: o } = e.source;
461
461
  if (t && t.length > 0) return t;
462
- switch (s) {
462
+ switch (n) {
463
463
  case "permissionSet":
464
464
  return o ? [o] : [];
465
465
  case "custom":
@@ -468,258 +468,255 @@ function q(e) {
468
468
  return [];
469
469
  }
470
470
  }
471
- function K(e, s, t = /* @__PURE__ */ new Set()) {
471
+ function K(e, n, t = /* @__PURE__ */ new Set()) {
472
472
  var i;
473
473
  const o = [];
474
- for (const n of e) {
475
- if (t.has(n)) continue;
476
- t.add(n);
477
- const c = s.find((a) => a.id === n);
478
- c && (o.push(c), (i = c.permissionSetIds) != null && i.length && o.push(...K(c.permissionSetIds, s, t)));
474
+ for (const s of e) {
475
+ if (t.has(s)) continue;
476
+ t.add(s);
477
+ const c = n.find((r) => r.id === s);
478
+ c && (o.push(c), (i = c.permissionSetIds) != null && i.length && o.push(...K(c.permissionSetIds, n, t)));
479
479
  }
480
480
  return o;
481
481
  }
482
482
  function je(e) {
483
- const s = V(e).map(
484
- ({ setNames: i, setId: n, ...c }) => c
485
- ), t = s.filter((i) => !i.inverted), o = s.filter((i) => i.inverted);
483
+ const n = V(e).map(
484
+ ({ setNames: i, setId: s, ...c }) => c
485
+ ), t = n.filter((i) => !i.inverted), o = n.filter((i) => i.inverted);
486
486
  return M(t, o);
487
487
  }
488
- function he(e, s, t) {
488
+ function he(e, n, t) {
489
489
  const o = /* @__PURE__ */ new Map();
490
490
  return e.forEach(
491
- ({ name: i, permissions: n }) => n.forEach(({ conditions: c, actions: a }) => {
492
- var r, l;
493
- const u = JSON.parse(c || "{}");
494
- (r = u[s]) != null && r.$in ? (l = u[s]) == null || l.$in.forEach(
491
+ ({ name: i, permissions: s }) => s.forEach(({ conditions: c, actions: r }) => {
492
+ var u, l;
493
+ const a = JSON.parse(c || "{}");
494
+ (u = a[n]) != null && u.$in ? (l = a[n]) == null || l.$in.forEach(
495
495
  (d) => (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i)
496
- ) : a[0] === "manage" && t.forEach((d) => {
496
+ ) : r[0] === "manage" && t.forEach((d) => {
497
497
  (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(i);
498
498
  });
499
499
  })
500
- ), [...o].map(([i, n]) => ({
500
+ ), [...o].map(([i, s]) => ({
501
501
  id: i,
502
- setNames: [...n]
502
+ setNames: [...s]
503
503
  }));
504
504
  }
505
- function ye(e, s) {
506
- const t = (a, u) => {
507
- const r = { ...a }, l = JSON.parse(r.conditions || "{}");
508
- if (u)
509
- if (u.length > 0) {
505
+ function ye(e, n) {
506
+ const t = (r, a) => {
507
+ const u = { ...r }, l = JSON.parse(u.conditions || "{}");
508
+ if (a)
509
+ if (a.length > 0) {
510
510
  const d = Object.keys(l)[0];
511
- l[d].$in = u;
511
+ l[d].$in = a;
512
512
  } else
513
- delete r.conditions;
513
+ delete u.conditions;
514
514
  return {
515
- ...r,
515
+ ...u,
516
516
  inverted: !0,
517
- ...r.conditions && { conditions: JSON.stringify(l) }
517
+ ...u.conditions && { conditions: JSON.stringify(l) }
518
518
  };
519
- }, o = new Map(e.map((a) => [a.subject, a])), i = new Map(s.map((a) => [a.subject, a])), n = [], c = /* @__PURE__ */ new Set([...o.keys(), ...i.keys()]);
520
- for (const a of c) {
521
- const u = o.get(a), r = i.get(a);
522
- if (u && r) {
523
- if (u.conditions && r.conditions) {
524
- const l = JSON.parse(u.conditions), d = JSON.parse(r.conditions), f = Object.keys(l)[0], m = l[f].$in.filter(
525
- (g) => !d[f].$in.includes(g)
519
+ }, o = new Map(e.map((r) => [r.subject, r])), i = new Map(n.map((r) => [r.subject, r])), s = [], c = /* @__PURE__ */ new Set([...o.keys(), ...i.keys()]);
520
+ for (const r of c) {
521
+ const a = o.get(r), u = i.get(r);
522
+ if (a && u) {
523
+ if (a.conditions && u.conditions) {
524
+ const l = JSON.parse(a.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
525
+ (v) => !d[p].$in.includes(v)
526
526
  );
527
- m.length > 0 && n.push(t(u, m)), d[f].$in.filter(
528
- (g) => !l[f].$in.includes(g)
529
- ).length > 0 && n.push(r);
530
- } else if (!u.conditions && r.conditions)
531
- n.push(r);
532
- else if (!u.conditions && !r.conditions) {
533
- const l = new Set(u.actions), d = new Set(r.actions), f = r.actions.some((p) => !l.has(p)), m = u.actions.filter((p) => !d.has(p));
534
- if (f) {
535
- const p = r.actions.filter((g) => !l.has(g));
536
- n.push({
537
- ...r,
538
- actions: p
527
+ m.length > 0 && s.push(t(a, m)), d[p].$in.filter(
528
+ (v) => !l[p].$in.includes(v)
529
+ ).length > 0 && s.push(u);
530
+ } else if (!a.conditions && u.conditions)
531
+ s.push(u);
532
+ else if (!a.conditions && !u.conditions) {
533
+ const l = new Set(a.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = a.actions.filter((f) => !d.has(f));
534
+ if (p) {
535
+ const f = u.actions.filter((v) => !l.has(v));
536
+ s.push({
537
+ ...u,
538
+ actions: f
539
539
  });
540
540
  }
541
- m.length > 0 && n.push({
542
- ...u,
541
+ m.length > 0 && s.push({
542
+ ...a,
543
543
  actions: m,
544
544
  inverted: !0
545
545
  });
546
546
  }
547
547
  continue;
548
548
  }
549
- if (u) {
550
- n.push(
549
+ if (a) {
550
+ s.push(
551
551
  t(
552
- u,
552
+ a,
553
553
  // If base has conditions, set diffIds to empty array, disallow all access to collection
554
554
  // otherwise, invert directly
555
- u.conditions && []
555
+ a.conditions && []
556
556
  )
557
557
  );
558
558
  continue;
559
559
  }
560
- r && n.push(r);
560
+ u && s.push(u);
561
561
  }
562
- return n;
562
+ return s;
563
563
  }
564
564
  function Pe(e) {
565
- const s = z(
565
+ const n = z(
566
566
  e,
567
567
  x
568
568
  ), t = new Set(
569
- s.filter((i) => {
570
- var n;
571
- return ((n = i.source) == null ? void 0 : n.type) === "systemPermissionSet" && !i.inverted;
569
+ n.filter((i) => {
570
+ var s;
571
+ return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted;
572
572
  }).map((i) => i.subject)
573
573
  ), o = new Set(
574
- s.filter(
574
+ n.filter(
575
575
  (i) => {
576
- var n;
577
- return ((n = i.source) == null ? void 0 : n.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
576
+ var s;
577
+ return ((s = i.source) == null ? void 0 : s.type) === "systemPermissionSet" && !i.inverted && i.actions.includes("manage");
578
578
  }
579
579
  ).map((i) => i.subject)
580
580
  );
581
581
  return e.filter((i) => i.inverted ? !(t.has(i.subject) && !o.has(i.subject)) : !t.has(i.subject));
582
582
  }
583
583
  const ee = "business::report::";
584
- function we(e, s) {
584
+ function we(e, n) {
585
585
  const t = [], o = e.filter((i) => {
586
- const n = i.subject;
587
- return !n.startsWith(ee) || s.has(n) ? !0 : (t.push(n), !1);
586
+ const s = i.subject;
587
+ return !s.startsWith(ee) || n.has(s) ? !0 : (t.push(s), !1);
588
588
  });
589
589
  return t.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", t), o;
590
590
  }
591
- const se = "business::report::reports::", ne = "business::report::allDefaultReports", te = "business::report::allCustomReports";
592
- function $e(e, s) {
591
+ const ne = "business::report::reports::", se = "business::report::allDefaultReports", te = "business::report::allCustomReports";
592
+ function $e(e, n) {
593
593
  const t = e.find(
594
- (c) => !c.inverted && c.subject === ne
594
+ (c) => !c.inverted && c.subject === se
595
595
  ), o = e.find(
596
596
  (c) => !c.inverted && c.subject === te
597
597
  );
598
598
  if (!t && !o) return e;
599
- const i = t ? new Set(t.actions) : null, n = o ? new Set(o.actions) : null;
600
- return e.reduce((c, a) => {
601
- if (a.inverted)
602
- return c.push(a), c;
603
- const u = a.subject;
604
- if (!u.startsWith(se))
605
- return c.push(a), c;
606
- const l = s.has(u) ? i : n;
599
+ const i = t ? new Set(t.actions) : null, s = o ? new Set(o.actions) : null;
600
+ return e.reduce((c, r) => {
601
+ if (r.inverted)
602
+ return c.push(r), c;
603
+ const a = r.subject;
604
+ if (!a.startsWith(ne))
605
+ return c.push(r), c;
606
+ const l = n.has(a) ? i : s;
607
607
  if (!l)
608
- return c.push(a), c;
608
+ return c.push(r), c;
609
609
  if (l.has("manage")) return c;
610
- const d = new Set(a.actions), f = d.has("manage");
610
+ const d = new Set(r.actions), p = d.has("manage");
611
611
  let m = !1;
612
- for (const p of l)
613
- p !== "manage" && d.delete(p) && (m = !0);
614
- return f && m && d.delete("manage"), d.size === 0 || c.push({ ...a, actions: Array.from(d) }), c;
612
+ for (const f of l)
613
+ f !== "manage" && d.delete(f) && (m = !0);
614
+ return p && m && d.delete("manage"), d.size === 0 || c.push({ ...r, actions: Array.from(d) }), c;
615
615
  }, []);
616
616
  }
617
- function M(e, s) {
617
+ function M(e, n) {
618
618
  var o, i;
619
- const t = new Map(e.map((n) => [n.subject, n]));
620
- for (const n of s) {
621
- if (n.inverted) {
622
- const a = t.get(n.subject);
623
- if (n.conditions) {
624
- if (a != null && a.conditions) {
625
- const u = JSON.parse(a.conditions), r = JSON.parse(n.conditions), l = Object.keys(r)[0], d = ((o = r[l]) == null ? void 0 : o.$in) ?? [], m = (((i = u[l]) == null ? void 0 : i.$in) ?? []).filter((p) => !d.includes(p));
626
- m.length > 0 ? t.set(n.subject, {
627
- ...a,
619
+ const t = new Map(e.map((s) => [s.subject, s]));
620
+ for (const s of n) {
621
+ if (s.inverted) {
622
+ const r = t.get(s.subject);
623
+ if (s.conditions) {
624
+ if (r != null && r.conditions) {
625
+ const a = JSON.parse(r.conditions), u = JSON.parse(s.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((i = a[l]) == null ? void 0 : i.$in) ?? []).filter((f) => !d.includes(f));
626
+ m.length > 0 ? t.set(s.subject, {
627
+ ...r,
628
628
  conditions: JSON.stringify({ [l]: { $in: m } })
629
- }) : t.delete(n.subject);
629
+ }) : t.delete(s.subject);
630
630
  } else
631
- t.delete(n.subject);
631
+ t.delete(s.subject);
632
632
  continue;
633
633
  }
634
- if (a) {
635
- const u = new Set(n.actions), r = a.actions.filter((l) => !u.has(l));
636
- r.length > 0 ? t.set(n.subject, { ...a, actions: r }) : t.delete(n.subject);
634
+ if (r) {
635
+ const a = new Set(s.actions), u = r.actions.filter((l) => !a.has(l));
636
+ u.length > 0 ? t.set(s.subject, { ...r, actions: u }) : t.delete(s.subject);
637
637
  continue;
638
638
  }
639
639
  continue;
640
640
  }
641
- if (n.conditions) {
642
- t.set(n.subject, n);
641
+ if (s.conditions) {
642
+ t.set(s.subject, s);
643
643
  continue;
644
644
  }
645
- const c = t.get(n.subject);
645
+ const c = t.get(s.subject);
646
646
  if (c) {
647
- const a = [
647
+ const r = [
648
648
  .../* @__PURE__ */ new Set([
649
649
  ...c.actions,
650
- ...n.actions
650
+ ...s.actions
651
651
  ])
652
652
  ];
653
- t.set(n.subject, { ...c, actions: a });
653
+ t.set(s.subject, { ...c, actions: r });
654
654
  } else
655
- t.set(n.subject, n);
655
+ t.set(s.subject, s);
656
656
  }
657
657
  return Array.from(t.values());
658
658
  }
659
- function oe(e, s) {
660
- const t = M(e, s), o = new Set(e.map((n) => n.subject)), i = s.filter(
661
- (n) => n.inverted && !o.has(n.subject)
659
+ function oe(e, n) {
660
+ const t = M(e, n), o = new Set(e.map((s) => s.subject)), i = n.filter(
661
+ (s) => s.inverted && !o.has(s.subject)
662
662
  );
663
663
  return [...t, ...i];
664
664
  }
665
665
  const y = "/permission-assignments", P = {
666
666
  async readAll() {
667
- return b(await v().get(y));
667
+ return b(await g().get(y));
668
668
  },
669
669
  async readByUserId(e) {
670
- return b(await v().get(`${y}/user/${e}`));
670
+ return b(await g().get(`${y}/user/${e}`));
671
671
  },
672
672
  async readById(e) {
673
- return b(await v().get(`${y}/${e}`));
673
+ return b(await g().get(`${y}/${e}`));
674
674
  },
675
675
  async create(e) {
676
- return b(await v().post(y, e));
676
+ return b(await g().post(y, e));
677
677
  },
678
- async update(e, s) {
679
- return b(await v().put(`${y}/${e}`, s));
678
+ async update(e, n) {
679
+ return b(await g().put(`${y}/${e}`, n));
680
680
  },
681
681
  async delete(e) {
682
- return b(await v().delete(`${y}/${e}`));
682
+ return b(await g().delete(`${y}/${e}`));
683
683
  },
684
- async addReportManagePermission(e, s) {
684
+ async addReportManagePermission(e, n) {
685
685
  return b(
686
- await v().post("/my-permissions/report-manage", { permissionKey: e, label: s })
686
+ await g().post("/my-permissions/report-manage", { permissionKey: e, label: n })
687
687
  );
688
688
  }
689
689
  }, ie = k("permissionAssignment", () => {
690
- const { currentBusiness: e } = N(), s = j([]), t = j(null);
691
- async function o() {
692
- var d;
693
- const r = ((d = e.value) == null ? void 0 : d._id) ?? null;
694
- if (t.value === r) return;
695
- const l = await P.readAll();
696
- s.value = l, t.value = r;
690
+ const e = h([]);
691
+ async function n() {
692
+ const r = await P.readAll();
693
+ e.value = r;
697
694
  }
698
- async function i(r) {
695
+ async function t(r) {
699
696
  return await P.readByUserId(r);
700
697
  }
701
- async function n(r) {
702
- const l = await P.create(r);
703
- s.value = [...s.value, l];
698
+ async function o(r) {
699
+ const a = await P.create(r);
700
+ e.value = [...e.value, a];
704
701
  }
705
- async function c(r, l) {
706
- const d = await P.update(r, l);
707
- s.value = s.value.map((f) => f.id === r ? d : f);
702
+ async function i(r, a) {
703
+ const u = await P.update(r, a);
704
+ e.value = e.value.map((l) => l.id === r ? u : l);
708
705
  }
709
- async function a(r) {
710
- await P.delete(r), s.value = s.value.filter((l) => l.id !== r);
706
+ async function s(r) {
707
+ await P.delete(r), e.value = e.value.filter((a) => a.id !== r);
711
708
  }
712
- function u(r) {
713
- return s.value.find((l) => l.userId === r);
709
+ function c(r) {
710
+ return e.value.find((a) => a.userId === r);
714
711
  }
715
712
  return {
716
- permissionAssignments: s,
717
- readPermissionAssignments: o,
718
- readPermissionAssignmentByUserId: i,
719
- createPermissionAssignment: n,
720
- updatePermissionAssignment: c,
721
- deletePermissionAssignment: a,
722
- getPermissionAssignmentByUserId: u
713
+ permissionAssignments: e,
714
+ readPermissionAssignments: n,
715
+ readPermissionAssignmentByUserId: t,
716
+ createPermissionAssignment: o,
717
+ updatePermissionAssignment: i,
718
+ deletePermissionAssignment: s,
719
+ getPermissionAssignmentByUserId: c
723
720
  };
724
721
  }), re = () => {
725
722
  const e = ie();
@@ -740,27 +737,27 @@ const y = "/permission-assignments", P = {
740
737
  )
741
738
  );
742
739
  }
743
- }, O = j([]), E = j(!1), w = j(!1), $ = j(null);
740
+ }, _ = h([]), E = h(!1), w = h(!1), $ = h(null);
744
741
  function ce() {
745
- const e = N();
746
- async function s() {
742
+ const e = J();
743
+ async function n() {
747
744
  var i;
748
745
  const o = (i = e.currentBusiness.value) == null ? void 0 : i.id;
749
- if (o && ($.value !== o && (O.value = [], E.value = !1, w.value = !1, $.value = o), !(E.value || w.value))) {
746
+ if (o && ($.value !== o && (_.value = [], E.value = !1, w.value = !1, $.value = o), !(E.value || w.value))) {
750
747
  w.value = !0;
751
748
  try {
752
- const n = await ae.fetchReportPermissionsForPortal(o);
749
+ const s = await ae.fetchReportPermissionsForPortal(o);
753
750
  if ($.value !== o) return;
754
- O.value = n, E.value = !0;
755
- } catch (n) {
751
+ _.value = s, E.value = !0;
752
+ } catch (s) {
756
753
  if ($.value !== o) return;
757
- console.warn("Failed to fetch custom report permissions:", n), O.value = [];
754
+ console.warn("Failed to fetch custom report permissions:", s), _.value = [];
758
755
  } finally {
759
756
  $.value === o && (w.value = !1);
760
757
  }
761
758
  }
762
759
  }
763
- const t = T(() => O.value.map(
760
+ const t = N(() => _.value.map(
764
761
  (o) => o.isDefault ? {
765
762
  label: o.name,
766
763
  subject: `business::report::reports::${o.permissionKey}`,
@@ -780,25 +777,25 @@ function ce() {
780
777
  }
781
778
  ));
782
779
  return {
783
- fetchCustomReportPermissions: s,
780
+ fetchCustomReportPermissions: n,
784
781
  customReportPermissions: t,
785
- isLoading: T(() => w.value),
786
- isLoaded: T(() => E.value)
782
+ isLoading: N(() => w.value),
783
+ isLoaded: N(() => E.value)
787
784
  };
788
785
  }
789
786
  function R(e) {
790
- const s = N(), t = Z(), o = re(), i = s.restaurants, { customReportPermissions: n } = ce(), c = o.getPermissionAssignmentByUserId(e.id), a = K(
787
+ const n = J(), t = Z(), o = re(), i = n.restaurants, { customReportPermissions: s } = ce(), c = o.getPermissionAssignmentByUserId(e.id), r = K(
791
788
  (c == null ? void 0 : c.permissionSetIds) ?? [],
792
789
  t.permissionSets.value
793
- ), u = V(a).map(
794
- ({ setNames: p, ...g }) => g
795
- ), r = c == null ? void 0 : c.customPermissions, l = r ?? e.permissions.map((p) => ({
796
- ...p,
797
- subject: I(p.subject)
798
- })), d = M(u, l), f = z(
799
- oe(u, l),
790
+ ), a = V(r).map(
791
+ ({ setNames: f, ...v }) => v
792
+ ), u = c == null ? void 0 : c.customPermissions, l = u ?? e.permissions.map((f) => ({
793
+ ...f,
794
+ subject: I(f.subject)
795
+ })), d = M(a, l), p = z(
796
+ oe(a, l),
800
797
  x
801
- ).filter((p) => !p.inverted), m = le(f) || i.value.map((p) => p._id);
798
+ ).filter((f) => !f.inverted), m = le(p) || i.value.map((f) => f._id);
802
799
  return {
803
800
  doc: e,
804
801
  id: e.id,
@@ -807,14 +804,14 @@ function R(e) {
807
804
  email: e.email,
808
805
  restaurants: D(
809
806
  m.map(
810
- (p) => {
811
- var g;
812
- return ((g = i.value.find((X) => X._id === p)) == null ? void 0 : g.profile.name) ?? "";
807
+ (f) => {
808
+ var v;
809
+ return ((v = i.value.find((X) => X._id === f)) == null ? void 0 : v.profile.name) ?? "";
813
810
  }
814
811
  )
815
812
  ),
816
813
  managableRestaurantIds: m,
817
- permissionLabels: me(f, n.value),
814
+ permissionLabels: me(p, s.value),
818
815
  permissions: d
819
816
  };
820
817
  }
@@ -823,13 +820,13 @@ const ue = Object.freeze(
823
820
  ), Re = {
824
821
  async readTeamMembers() {
825
822
  return b(
826
- await v().get("/portal-users")
823
+ await g().get("/portal-users")
827
824
  ).map(R);
828
825
  },
829
826
  async readTeamMembersPage(e) {
830
827
  var t, o;
831
- const s = b(
832
- await v().get("/portal-users/paged", {
828
+ const n = b(
829
+ await g().get("/portal-users/paged", {
833
830
  params: {
834
831
  limit: e.limit,
835
832
  offset: e.offset,
@@ -840,62 +837,62 @@ const ue = Object.freeze(
840
837
  })
841
838
  );
842
839
  return {
843
- items: s.items.map(R),
844
- total: s.total
840
+ items: n.items.map(R),
841
+ total: n.total
845
842
  };
846
843
  },
847
844
  async readTeamMember(e) {
848
845
  return R(
849
- b(await v().get(`/portal-users/${e}`))
846
+ b(await g().get(`/portal-users/${e}`))
850
847
  );
851
848
  },
852
849
  async createTeamMember(e) {
853
850
  return R(
854
- b(await v().post("/portal-users", e))
851
+ b(await g().post("/portal-users", e))
855
852
  );
856
853
  },
857
- async updateTeamMember(e, s) {
854
+ async updateTeamMember(e, n) {
858
855
  return R(
859
- b(await v().put(`/portal-users/${e}`, s))
856
+ b(await g().put(`/portal-users/${e}`, n))
860
857
  );
861
858
  },
862
859
  async deleteTeamMember(e) {
863
- return b(await v().delete(`/portal-users/${e}`));
860
+ return b(await g().delete(`/portal-users/${e}`));
864
861
  },
865
862
  async readTeamMemberPosUserIds() {
866
- return b(await v().get("/portal-users")).map((s) => s.posUserId);
863
+ return b(await g().get("/portal-users")).map((n) => n.posUserId);
867
864
  }
868
865
  };
869
- function Ie(e, s, t) {
866
+ function Ie(e, n, t) {
870
867
  if (e.some((c) => c.subject === "all")) return "All";
871
- const o = (t ?? B).filter(
872
- (c) => c.subject === s
873
- ), i = new Set(o.map((c) => C(c).value)), n = e.filter((c) => c.subject === s).filter((c) => i.has(C(c).value));
874
- return n.length === o.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
868
+ const o = (t ?? U).filter(
869
+ (c) => c.subject === n
870
+ ), i = new Set(o.map((c) => C(c).value)), s = e.filter((c) => c.subject === n).filter((c) => i.has(C(c).value));
871
+ return s.length === o.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
875
872
  }
876
873
  function C(e) {
877
- const s = Q(e), t = s.subject;
874
+ const n = Q(e), t = n.subject;
878
875
  return {
879
- ...s,
876
+ ...n,
880
877
  get conditions() {
881
- return typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
878
+ return typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
882
879
  },
883
880
  get isDiscountOperation() {
884
881
  var o;
885
- return t === h.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === h.F_RULE_ORDER_OPERATION.enum.discount;
882
+ return t === j.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === j.F_RULE_ORDER_OPERATION.enum.discount;
886
883
  },
887
884
  get isOrderOperation() {
888
- return t === h.F_RULE_SUBJECT.enum.order;
885
+ return t === j.F_RULE_SUBJECT.enum.order;
889
886
  },
890
887
  get isReportPermission() {
891
- return t === h.F_RULE_SUBJECT.enum.report;
888
+ return t === j.F_RULE_SUBJECT.enum.report;
892
889
  },
893
890
  get formatted() {
894
891
  const o = (i) => i.endsWith("_") ? i.slice(0, i.length - 1) : i;
895
892
  return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : t.toString();
896
893
  },
897
894
  get label() {
898
- return s.label || H(this.formatted);
895
+ return n.label || H(this.formatted);
899
896
  },
900
897
  get value() {
901
898
  return this.isOrderOperation ? `${t}:${this.conditions.operation}` : this.isReportPermission ? `${t}:${this.conditions.name}` : t.toString();
@@ -903,23 +900,23 @@ function C(e) {
903
900
  };
904
901
  }
905
902
  function Ae(e) {
906
- const s = e.map((t) => C(t)).find((t) => t.isDiscountOperation);
907
- return s ? parseInt((s.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
903
+ const n = e.map((t) => C(t)).find((t) => t.isDiscountOperation);
904
+ return n ? parseInt((n.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
908
905
  }
909
906
  function le(e) {
910
- const s = e.find(
911
- (t) => t.subject === J.Subject.Restaurant.restaurant
907
+ const n = e.find(
908
+ (t) => t.subject === B.Subject.Restaurant.restaurant
912
909
  );
913
- return s ? s.conditions ? JSON.parse(s.conditions).restaurantId.$in : null : [];
914
- }
915
- function _e(e) {
916
- return (e == null ? void 0 : e.some((s) => s.subject === "all")) ?? !1;
910
+ return n ? n.conditions ? JSON.parse(n.conditions).restaurantId.$in : null : [];
917
911
  }
918
912
  function Oe(e) {
919
- const s = e.find((t) => t.subject === J.Subject.Business.role);
920
- return s ? s.conditions ? JSON.parse(s.conditions).roleId.$in : null : [];
913
+ return (e == null ? void 0 : e.some((n) => n.subject === "all")) ?? !1;
914
+ }
915
+ function _e(e) {
916
+ const n = e.find((t) => t.subject === B.Subject.Business.role);
917
+ return n ? n.conditions ? JSON.parse(n.conditions).roleId.$in : null : [];
921
918
  }
922
- function Ee(e, s) {
919
+ function Ee(e, n) {
923
920
  return e.map((t) => {
924
921
  const o = de(t);
925
922
  return {
@@ -927,35 +924,37 @@ function Ee(e, s) {
927
924
  actions: o.actions,
928
925
  conditions: {
929
926
  ...o.conditions,
930
- adjustment: o.isDiscountOperation ? { $lte: parseFloat((s / 100).toFixed(2)) } : void 0
927
+ adjustment: o.isDiscountOperation ? { $lte: parseFloat((n / 100).toFixed(2)) } : void 0
931
928
  }
932
929
  };
933
930
  });
934
931
  }
935
932
  function de(e) {
936
- const [s, t] = e.split(":");
933
+ const [n, t] = e.split(":");
937
934
  let o;
938
- return t ? (o = B.find(
939
- (i) => i.subject === s && [
935
+ return t ? (o = U.find(
936
+ (i) => i.subject === n && [
940
937
  (typeof i.conditions == "object" ? i.conditions : JSON.parse(i.conditions)).operation,
941
938
  i.conditions.name
942
939
  ].includes(t)
943
- ), !o && s === h.F_RULE_SUBJECT.enum.report && (o = {
940
+ ), !o && n === j.F_RULE_SUBJECT.enum.report && (o = {
944
941
  label: "",
945
- subject: h.F_RULE_SUBJECT.enum.report,
942
+ subject: j.F_RULE_SUBJECT.enum.report,
946
943
  actions: ["read"],
947
944
  conditions: { name: t },
948
945
  inverted: !1,
949
946
  reason: ""
950
- })) : o = B.find((i) => i.subject === s), C(o || { subject: h.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
947
+ })) : o = U.find((i) => i.subject === n), C(o || { subject: j.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
951
948
  }
952
- function me(e, s = []) {
949
+ function me(e, n = []) {
953
950
  return D(
954
951
  e.reduce((t, o) => {
955
- const i = ue.find((n) => n.subject === o.subject) || s.find((n) => n.subject === o.subject);
952
+ const i = ue.find(
953
+ (s) => s.subject === o.subject && o.actions.includes("manage")
954
+ ) || n.find((s) => s.subject === o.subject);
956
955
  if (i) {
957
- const n = i.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
958
- t.push(n);
956
+ const s = i.subject === B.Subject.Business.inventory_stock ? "Warehouse Management" : i.label;
957
+ t.push(s);
959
958
  }
960
959
  return t;
961
960
  }, [])
@@ -968,12 +967,12 @@ export {
968
967
  oe as b,
969
968
  K as c,
970
969
  ce as d,
971
- B as e,
970
+ U as e,
972
971
  Ee as f,
973
972
  Ae as g,
974
- _e as h,
973
+ Oe as h,
975
974
  ee as i,
976
- Oe as j,
975
+ _e as j,
977
976
  we as k,
978
977
  $e as l,
979
978
  je as m,