@feedmepos/mf-hrm-portal 2.0.8-dev.3 → 2.0.8-dev.5

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 (26) hide show
  1. package/dist/{AuditLogList-DU9bvapH.js → AuditLogList-ChmO_lsf.js} +29 -29
  2. package/dist/{EmployeeList-C0Kt6J2s.js → EmployeeList-B43c3tSt.js} +5 -5
  3. package/dist/{Main-wneSr3Yj.js → Main--wV8uMFW.js} +4 -4
  4. package/dist/{Main-CGoSOSHf.js → Main-DKJWXUF1.js} +9 -9
  5. package/dist/{Main-YgAJrDXR.js → Main-eEQq0uiP.js} +6 -6
  6. package/dist/{PermissionSetList-BG5FcHDo.js → PermissionSetList-CA7dsUY5.js} +5 -5
  7. package/dist/{PortalPermissionEditor.vue_vue_type_script_setup_true_lang-Dfey316Z.js → PortalPermissionEditor.vue_vue_type_script_setup_true_lang-DLZyVi00.js} +921 -916
  8. package/dist/{RoleList-D6aapDtQ.js → RoleList-Nm7T5wl8.js} +7 -7
  9. package/dist/{TeamMemberList-BQ3xq4Q2.js → TeamMemberList-BOcKTiHH.js} +8 -8
  10. package/dist/{TimesheetList-DqEtBC_2.js → TimesheetList-CoaX44py.js} +7 -7
  11. package/dist/{app-efNRBiJB.js → app-CgPpZ0md.js} +1147 -1044
  12. package/dist/app.js +2 -2
  13. package/dist/{dayjs.min-O2mY8Dsx.js → dayjs.min-DLZqYqC8.js} +1 -1
  14. package/dist/{employee-Cr5TX4u1.js → employee-DQIeO3Ta.js} +4 -4
  15. package/dist/{index-CMFJQ1p8.js → index-CxEFSIGE.js} +1 -1
  16. package/dist/{index-DPcm9B8U.js → index-D5bUBGCO.js} +255 -248
  17. package/dist/{iteration-BzPWNf3I.js → iteration-Ceh9Zaed.js} +1 -1
  18. package/dist/{lodash-rnloBy2O.js → lodash-MQv9R8bY.js} +1 -1
  19. package/dist/src/helpers/permission-set.d.ts +8 -1
  20. package/dist/{team-CJ3xjFT7.js → team-DTdEqDL-.js} +1 -1
  21. package/dist/{timesheet-BABSsqqp.js → timesheet-Co0CE_kB.js} +3 -3
  22. package/dist/tsconfig.app.tsbuildinfo +1 -1
  23. package/dist/{useAppStore-DxEeYbWz.js → useAppStore-CNGyVfbo.js} +1 -1
  24. package/dist/{useLoading-zLCQaKfz.js → useLoading-GdaFiYX1.js} +1 -1
  25. package/dist/{useReportPermissions-BB-vWjkE.js → useReportPermissions-Cm6b6zJE.js} +3 -3
  26. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
- import { g as b, b as g, d as X, e as j, s as L, q as M } from "./iteration-BzPWNf3I.js";
2
- import { d as J, f as R, a as F, h as D, y as S, N as Q } from "./app-efNRBiJB.js";
1
+ import { g as b, b as g, d as X, e as j, s as L, q as M } from "./iteration-Ceh9Zaed.js";
2
+ import { f as J, b as R, U as F, d as D, a as S, H } from "./app-CgPpZ0md.js";
3
3
  import { defineStore as x, storeToRefs as k } from "pinia";
4
4
  import { ref as h, computed as N } from "vue";
5
5
  import { useCoreStore as q } from "@feedmepos/mf-common";
@@ -344,193 +344,193 @@ const T = [
344
344
  async create(e) {
345
345
  return b(await g().post(A, e));
346
346
  },
347
- async update(e, n) {
348
- return b(await g().put(`${A}/${e}`, n));
347
+ async update(e, t) {
348
+ return b(await g().put(`${A}/${e}`, t));
349
349
  },
350
350
  async delete(e) {
351
351
  return b(await g().delete(`${A}/${e}`));
352
352
  }
353
- }, Z = x("permissionSet", () => {
353
+ }, Q = x("permissionSet", () => {
354
354
  const e = h([]);
355
- async function n() {
356
- const r = await I.read();
357
- e.value = s(r);
355
+ async function t() {
356
+ const a = await I.read();
357
+ e.value = n(a);
358
358
  }
359
- async function o(r) {
360
- const i = await I.create(r);
361
- e.value = s([...e.value, i]);
359
+ async function s(a) {
360
+ const i = await I.create(a);
361
+ e.value = n([...e.value, i]);
362
362
  }
363
- async function t(r, i) {
364
- const c = await I.update(r, i);
365
- e.value = s(e.value.map((u) => u.id === r ? c : u));
363
+ async function o(a, i) {
364
+ const c = await I.update(a, i);
365
+ e.value = n(e.value.map((u) => u.id === a ? c : u));
366
366
  }
367
- async function a(r) {
368
- await I.delete(r), e.value = s(e.value.filter((i) => i.id !== r));
367
+ async function r(a) {
368
+ await I.delete(a), e.value = n(e.value.filter((i) => i.id !== a));
369
369
  }
370
- function s(r) {
371
- return r.sort((i, c) => i.name.localeCompare(c.name));
370
+ function n(a) {
371
+ return a.sort((i, c) => i.name.localeCompare(c.name));
372
372
  }
373
373
  return {
374
374
  permissionSets: e,
375
- readPermissionSets: n,
376
- createPermissionSet: o,
377
- updatePermissionSet: t,
378
- deletePermissionSet: a
375
+ readPermissionSets: t,
376
+ createPermissionSet: s,
377
+ updatePermissionSet: o,
378
+ deletePermissionSet: r
379
379
  };
380
- }), G = () => {
381
- const e = Z();
380
+ }), Z = () => {
381
+ const e = Q();
382
382
  return {
383
383
  ...e,
384
384
  ...k(e)
385
385
  };
386
386
  };
387
387
  function Se(e) {
388
- let n = e.substring(e.indexOf("_") + 1);
389
- return n.includes("_") && (n = n.substring(0, n.lastIndexOf("_"))), Number.isNaN(Date.parse(n)) ? null : new Date(n).toISOString();
388
+ let t = e.substring(e.indexOf("_") + 1);
389
+ return t.includes("_") && (t = t.substring(0, t.lastIndexOf("_"))), Number.isNaN(Date.parse(t)) ? null : new Date(t).toISOString();
390
390
  }
391
391
  function je(e) {
392
- const n = Math.floor(e / 60), o = e % 60;
393
- return `${n}h ${o.toString().padStart(2, "0")}m`;
392
+ const t = Math.floor(e / 60), s = e % 60;
393
+ return `${t}h ${s.toString().padStart(2, "0")}m`;
394
394
  }
395
- function H(e) {
396
- const n = e.replace(/([A-Z])/g, " $1");
397
- return n.charAt(0).toUpperCase() + n.slice(1);
395
+ function G(e) {
396
+ const t = e.replace(/([A-Z])/g, " $1");
397
+ return t.charAt(0).toUpperCase() + t.slice(1);
398
398
  }
399
- function ye(e, n, o) {
400
- if (e.some((r) => r.subject === "all")) return "All";
401
- const t = (o ?? T).filter(
402
- (r) => r.subject === n
403
- ), a = new Set(t.map((r) => E(r).value)), s = e.filter((r) => r.subject === n).filter((r) => a.has(E(r).value));
404
- return s.length === t.length ? "All" : s.length === 0 ? "-" : `${s.length} permission allow`;
399
+ function ye(e, t, s) {
400
+ if (e.some((a) => a.subject === "all")) return "All";
401
+ const o = (s ?? T).filter(
402
+ (a) => a.subject === t
403
+ ), r = new Set(o.map((a) => E(a).value)), n = e.filter((a) => a.subject === t).filter((a) => r.has(E(a).value));
404
+ return n.length === o.length ? "All" : n.length === 0 ? "-" : `${n.length} permission allow`;
405
405
  }
406
406
  function E(e) {
407
- const n = X(e), o = n.subject;
407
+ const t = X(e), s = t.subject;
408
408
  return {
409
- ...n,
409
+ ...t,
410
410
  get conditions() {
411
- return typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
411
+ return typeof t.conditions == "string" ? JSON.parse(t.conditions) : t.conditions;
412
412
  },
413
413
  get isDiscountOperation() {
414
- var t;
415
- return o === j.F_RULE_SUBJECT.enum.order && ((t = this.conditions) == null ? void 0 : t.operation) === j.F_RULE_ORDER_OPERATION.enum.discount;
414
+ var o;
415
+ return s === j.F_RULE_SUBJECT.enum.order && ((o = this.conditions) == null ? void 0 : o.operation) === j.F_RULE_ORDER_OPERATION.enum.discount;
416
416
  },
417
417
  get isOrderOperation() {
418
- return o === j.F_RULE_SUBJECT.enum.order;
418
+ return s === j.F_RULE_SUBJECT.enum.order;
419
419
  },
420
420
  get isReportPermission() {
421
- return o === j.F_RULE_SUBJECT.enum.report;
421
+ return s === j.F_RULE_SUBJECT.enum.report;
422
422
  },
423
423
  get formatted() {
424
- const t = (a) => a.endsWith("_") ? a.slice(0, a.length - 1) : a;
425
- return this.isOrderOperation ? t(this.conditions.operation) : this.isReportPermission ? t(this.conditions.name) : o.toString();
424
+ const o = (r) => r.endsWith("_") ? r.slice(0, r.length - 1) : r;
425
+ return this.isOrderOperation ? o(this.conditions.operation) : this.isReportPermission ? o(this.conditions.name) : s.toString();
426
426
  },
427
427
  get label() {
428
- return n.label || H(this.formatted);
428
+ return t.label || G(this.formatted);
429
429
  },
430
430
  get value() {
431
- return this.isOrderOperation ? `${o}:${this.conditions.operation}` : this.isReportPermission ? `${o}:${this.conditions.name}` : o.toString();
431
+ return this.isOrderOperation ? `${s}:${this.conditions.operation}` : this.isReportPermission ? `${s}:${this.conditions.name}` : s.toString();
432
432
  }
433
433
  };
434
434
  }
435
435
  function he(e) {
436
- const n = e.map((o) => E(o)).find((o) => o.isDiscountOperation);
437
- return n ? parseInt((n.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
436
+ const t = e.map((s) => E(s)).find((s) => s.isDiscountOperation);
437
+ return t ? parseInt((t.conditions.adjustment.$lte * 100).toFixed(0)) : 100;
438
438
  }
439
439
  function Y(e) {
440
- const n = e.find(
441
- (o) => o.subject === J.Subject.Restaurant.restaurant
440
+ const t = e.find(
441
+ (s) => s.subject === J.Subject.Restaurant.restaurant
442
442
  );
443
- return n ? n.conditions ? JSON.parse(n.conditions).restaurantId.$in : null : [];
443
+ return t ? t.conditions ? JSON.parse(t.conditions).restaurantId.$in : null : [];
444
444
  }
445
445
  function Pe(e) {
446
- return (e == null ? void 0 : e.some((n) => n.subject === "all")) ?? !1;
446
+ return (e == null ? void 0 : e.some((t) => t.subject === "all")) ?? !1;
447
447
  }
448
448
  function we(e) {
449
- const n = e.find((o) => o.subject === J.Subject.Business.role);
450
- return n ? n.conditions ? JSON.parse(n.conditions).roleId.$in : null : [];
449
+ const t = e.find((s) => s.subject === J.Subject.Business.role);
450
+ return t ? t.conditions ? JSON.parse(t.conditions).roleId.$in : null : [];
451
451
  }
452
- function $e(e, n) {
453
- return e.map((o) => {
454
- const t = ee(o);
452
+ function $e(e, t) {
453
+ return e.map((s) => {
454
+ const o = ee(s);
455
455
  return {
456
- subject: t.subject,
457
- actions: t.actions,
456
+ subject: o.subject,
457
+ actions: o.actions,
458
458
  conditions: {
459
- ...t.conditions,
460
- adjustment: t.isDiscountOperation ? { $lte: parseFloat((n / 100).toFixed(2)) } : void 0
459
+ ...o.conditions,
460
+ adjustment: o.isDiscountOperation ? { $lte: parseFloat((t / 100).toFixed(2)) } : void 0
461
461
  }
462
462
  };
463
463
  });
464
464
  }
465
465
  function ee(e) {
466
- const [n, o] = e.split(":");
467
- let t;
468
- return o ? (t = T.find(
469
- (a) => a.subject === n && [
470
- (typeof a.conditions == "object" ? a.conditions : JSON.parse(a.conditions)).operation,
471
- a.conditions.name
472
- ].includes(o)
473
- ), !t && n === j.F_RULE_SUBJECT.enum.report && (t = {
466
+ const [t, s] = e.split(":");
467
+ let o;
468
+ return s ? (o = T.find(
469
+ (r) => r.subject === t && [
470
+ (typeof r.conditions == "object" ? r.conditions : JSON.parse(r.conditions)).operation,
471
+ r.conditions.name
472
+ ].includes(s)
473
+ ), !o && t === j.F_RULE_SUBJECT.enum.report && (o = {
474
474
  label: "",
475
475
  subject: j.F_RULE_SUBJECT.enum.report,
476
476
  actions: ["read"],
477
- conditions: { name: o },
477
+ conditions: { name: s },
478
478
  inverted: !1,
479
479
  reason: ""
480
- })) : t = T.find((a) => a.subject === n), E(t || { subject: j.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
480
+ })) : o = T.find((r) => r.subject === t), E(o || { subject: j.F_RULE_SUBJECT.enum.order, actions: [], label: "" });
481
481
  }
482
- function ne(e, n = []) {
482
+ function ne(e, t = []) {
483
483
  return L(
484
- e.reduce((o, t) => {
485
- const a = me.find((s) => s.subject === t.subject) || n.find((s) => s.subject === t.subject);
486
- if (a) {
487
- const s = a.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : a.label;
488
- o.push(s);
484
+ e.reduce((s, o) => {
485
+ const r = me.find((n) => n.subject === o.subject) || t.find((n) => n.subject === o.subject);
486
+ if (r) {
487
+ const n = r.subject === J.Subject.Business.inventory_stock ? "Warehouse Management" : r.label;
488
+ s.push(n);
489
489
  }
490
- return o;
490
+ return s;
491
491
  }, [])
492
492
  );
493
493
  }
494
494
  function W(e) {
495
- const n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), t = (a, s, r) => {
495
+ const t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), o = (r, n, a) => {
496
496
  var i, c;
497
- const u = `${s.subject}::${JSON.stringify([...s.actions].sort())}`, l = a.get(u);
497
+ const u = `${n.subject}::${JSON.stringify([...n.actions].sort())}`, l = r.get(u);
498
498
  if (!l) {
499
- a.set(u, { ...s, setNames: [r.name], setId: r._id });
499
+ r.set(u, { ...n, setNames: [a.name], setId: a._id });
500
500
  return;
501
501
  }
502
- if (l.setNames.push(r.name), l.conditions && s.conditions) {
503
- const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof s.conditions == "string" ? JSON.parse(s.conditions) : s.conditions;
502
+ if (l.setNames.push(a.name), l.conditions && n.conditions) {
503
+ const d = typeof l.conditions == "string" ? JSON.parse(l.conditions) : l.conditions, p = typeof n.conditions == "string" ? JSON.parse(n.conditions) : n.conditions;
504
504
  for (const m in p)
505
505
  (i = d[m]) != null && i.$in && (c = p[m]) != null && c.$in ? d[m].$in = Array.from(/* @__PURE__ */ new Set([...d[m].$in, ...p[m].$in])) : d[m] || (d[m] = p[m]);
506
506
  l.conditions = JSON.stringify(d);
507
507
  }
508
508
  };
509
- for (const a of e)
510
- for (const s of a.permissions)
511
- t(s.inverted ? o : n, s, a);
512
- return [...Array.from(n.values()), ...Array.from(o.values())];
509
+ for (const r of e)
510
+ for (const n of r.permissions)
511
+ o(n.inverted ? s : t, n, r);
512
+ return [...Array.from(t.values()), ...Array.from(s.values())];
513
513
  }
514
- function C(e, n) {
515
- return `${e}::${[...n].sort().join(",")}`;
514
+ function U(e, t) {
515
+ return `${e}::${[...t].sort().join(",")}`;
516
516
  }
517
- function z(e, n) {
518
- const o = [...e], t = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
517
+ function z(e, t) {
518
+ const s = [...e], o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
519
519
  for (const i of e) {
520
520
  const c = R(i.subject);
521
- t.add(C(c, i.actions)), i.inverted && i.actions.includes("manage") && a.add(`set_${c}`), !i.inverted && i.actions.includes("manage") && s.add(c);
521
+ o.add(U(c, i.actions)), i.inverted && i.actions.includes("manage") && r.add(`set_${c}`), !i.inverted && i.actions.includes("manage") && n.add(c);
522
522
  }
523
- const r = [...e];
524
- for (; r.length > 0; ) {
525
- const i = r.shift(), c = `set_${R(i.subject)}`, u = n[c];
526
- if (!u || a.has(c) || !i.actions.includes("manage") || i.inverted) continue;
527
- a.add(c);
523
+ const a = [...e];
524
+ for (; a.length > 0; ) {
525
+ const i = a.shift(), c = `set_${R(i.subject)}`, u = t[c];
526
+ if (!u || r.has(c) || !i.actions.includes("manage") || i.inverted) continue;
527
+ r.add(c);
528
528
  const l = te(i);
529
529
  i.source && !i.source.trace && (i.source = { ...i.source, trace: l });
530
530
  const d = [...l, `${u.name} (system)`];
531
531
  for (const p of u.permissions ?? []) {
532
- const m = R(p.subject), f = C(m, p.actions);
533
- t.has(f) || s.has(m) || (t.add(f), o.push({
532
+ const m = R(p.subject), f = U(m, p.actions);
533
+ o.has(f) || n.has(m) || (o.add(f), s.push({
534
534
  ...p,
535
535
  // FdoPermissionRule.fields is string[] | null; RawRule expects string[] | undefined
536
536
  fields: p.fields ?? void 0,
@@ -543,7 +543,7 @@ function z(e, n) {
543
543
  }));
544
544
  }
545
545
  for (const p of u.permissionSets ?? []) {
546
- const m = R(p), f = C(m, ["manage"]), v = {
546
+ const m = R(p), f = U(m, ["manage"]), v = {
547
547
  subject: m,
548
548
  actions: ["manage"],
549
549
  source: {
@@ -553,60 +553,60 @@ function z(e, n) {
553
553
  trace: d
554
554
  }
555
555
  };
556
- t.has(f) || (t.add(f), o.push(v)), r.push(v);
556
+ o.has(f) || (o.add(f), s.push(v)), a.push(v);
557
557
  }
558
558
  }
559
- return [...o.filter((i) => !i.inverted), ...o.filter((i) => i.inverted)];
559
+ return [...s.filter((i) => !i.inverted), ...s.filter((i) => i.inverted)];
560
560
  }
561
561
  function te(e) {
562
562
  if (!e.source) return [];
563
- const { type: n, trace: o, permissionSetName: t } = e.source;
564
- if (o && o.length > 0) return o;
565
- switch (n) {
563
+ const { type: t, trace: s, permissionSetName: o } = e.source;
564
+ if (s && s.length > 0) return s;
565
+ switch (t) {
566
566
  case "permissionSet":
567
- return t ? [t] : [];
567
+ return o ? [o] : [];
568
568
  case "custom":
569
569
  return ["custom"];
570
570
  default:
571
571
  return [];
572
572
  }
573
573
  }
574
- function V(e, n, o = /* @__PURE__ */ new Set()) {
575
- var a;
576
- const t = [];
577
- for (const s of e) {
578
- if (o.has(s)) continue;
579
- o.add(s);
580
- const r = n.find((i) => i.id === s);
581
- r && (t.push(r), (a = r.permissionSetIds) != null && a.length && t.push(...V(r.permissionSetIds, n, o)));
574
+ function V(e, t, s = /* @__PURE__ */ new Set()) {
575
+ var r;
576
+ const o = [];
577
+ for (const n of e) {
578
+ if (s.has(n)) continue;
579
+ s.add(n);
580
+ const a = t.find((i) => i.id === n);
581
+ a && (o.push(a), (r = a.permissionSetIds) != null && r.length && o.push(...V(a.permissionSetIds, t, s)));
582
582
  }
583
- return t;
583
+ return o;
584
584
  }
585
585
  function Re(e) {
586
- const n = W(e).map(
587
- ({ setNames: a, setId: s, ...r }) => r
588
- ), o = n.filter((a) => !a.inverted), t = n.filter((a) => a.inverted);
589
- return B(o, t);
586
+ const t = W(e).map(
587
+ ({ setNames: r, setId: n, ...a }) => a
588
+ ), s = t.filter((r) => !r.inverted), o = t.filter((r) => r.inverted);
589
+ return B(s, o);
590
590
  }
591
- function Ae(e, n, o) {
592
- const t = /* @__PURE__ */ new Map();
591
+ function Ae(e, t, s) {
592
+ const o = /* @__PURE__ */ new Map();
593
593
  return e.forEach(
594
- ({ name: a, permissions: s }) => s.forEach(({ conditions: r, actions: i }) => {
594
+ ({ name: r, permissions: n }) => n.forEach(({ conditions: a, actions: i }) => {
595
595
  var u, l;
596
- const c = JSON.parse(r || "{}");
597
- (u = c[n]) != null && u.$in ? (l = c[n]) == null || l.$in.forEach(
598
- (d) => (t.get(d) ?? t.set(d, /* @__PURE__ */ new Set()).get(d)).add(a)
599
- ) : i[0] === "manage" && o.forEach((d) => {
600
- (t.get(d) ?? t.set(d, /* @__PURE__ */ new Set()).get(d)).add(a);
596
+ const c = JSON.parse(a || "{}");
597
+ (u = c[t]) != null && u.$in ? (l = c[t]) == null || l.$in.forEach(
598
+ (d) => (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(r)
599
+ ) : i[0] === "manage" && s.forEach((d) => {
600
+ (o.get(d) ?? o.set(d, /* @__PURE__ */ new Set()).get(d)).add(r);
601
601
  });
602
602
  })
603
- ), [...t].map(([a, s]) => ({
604
- id: a,
605
- setNames: [...s]
603
+ ), [...o].map(([r, n]) => ({
604
+ id: r,
605
+ setNames: [...n]
606
606
  }));
607
607
  }
608
- function Ie(e, n) {
609
- const o = (i, c) => {
608
+ function Ie(e, t) {
609
+ const s = (i, c) => {
610
610
  const u = { ...i }, l = JSON.parse(u.conditions || "{}");
611
611
  if (c)
612
612
  if (c.length > 0) {
@@ -619,29 +619,29 @@ function Ie(e, n) {
619
619
  inverted: !0,
620
620
  ...u.conditions && { conditions: JSON.stringify(l) }
621
621
  };
622
- }, t = new Map(e.map((i) => [i.subject, i])), a = new Map(n.map((i) => [i.subject, i])), s = [], r = /* @__PURE__ */ new Set([...t.keys(), ...a.keys()]);
623
- for (const i of r) {
624
- const c = t.get(i), u = a.get(i);
622
+ }, o = new Map(e.map((i) => [i.subject, i])), r = new Map(t.map((i) => [i.subject, i])), n = [], a = /* @__PURE__ */ new Set([...o.keys(), ...r.keys()]);
623
+ for (const i of a) {
624
+ const c = o.get(i), u = r.get(i);
625
625
  if (c && u) {
626
626
  if (c.conditions && u.conditions) {
627
627
  const l = JSON.parse(c.conditions), d = JSON.parse(u.conditions), p = Object.keys(l)[0], m = l[p].$in.filter(
628
628
  (v) => !d[p].$in.includes(v)
629
629
  );
630
- m.length > 0 && s.push(o(c, m)), d[p].$in.filter(
630
+ m.length > 0 && n.push(s(c, m)), d[p].$in.filter(
631
631
  (v) => !l[p].$in.includes(v)
632
- ).length > 0 && s.push(u);
632
+ ).length > 0 && n.push(u);
633
633
  } else if (!c.conditions && u.conditions)
634
- s.push(u);
634
+ n.push(u);
635
635
  else if (!c.conditions && !u.conditions) {
636
636
  const l = new Set(c.actions), d = new Set(u.actions), p = u.actions.some((f) => !l.has(f)), m = c.actions.filter((f) => !d.has(f));
637
637
  if (p) {
638
638
  const f = u.actions.filter((v) => !l.has(v));
639
- s.push({
639
+ n.push({
640
640
  ...u,
641
641
  actions: f
642
642
  });
643
643
  }
644
- m.length > 0 && s.push({
644
+ m.length > 0 && n.push({
645
645
  ...c,
646
646
  actions: m,
647
647
  inverted: !0
@@ -650,8 +650,8 @@ function Ie(e, n) {
650
650
  continue;
651
651
  }
652
652
  if (c) {
653
- s.push(
654
- o(
653
+ n.push(
654
+ s(
655
655
  c,
656
656
  // If base has conditions, set diffIds to empty array, disallow all access to collection
657
657
  // otherwise, invert directly
@@ -660,103 +660,110 @@ function Ie(e, n) {
660
660
  );
661
661
  continue;
662
662
  }
663
- u && s.push(u);
663
+ u && n.push(u);
664
664
  }
665
- return s;
665
+ return n;
666
666
  }
667
667
  function Oe(e) {
668
- const n = z(
668
+ const t = z(
669
669
  e,
670
670
  F
671
+ ), s = new Set(
672
+ t.filter((r) => {
673
+ var n;
674
+ return ((n = r.source) == null ? void 0 : n.type) === "systemPermissionSet" && !r.inverted;
675
+ }).map((r) => r.subject)
671
676
  ), o = new Set(
672
- n.filter((t) => {
673
- var a;
674
- return ((a = t.source) == null ? void 0 : a.type) === "systemPermissionSet" && !t.inverted;
675
- }).map((t) => t.subject)
677
+ t.filter(
678
+ (r) => {
679
+ var n;
680
+ return ((n = r.source) == null ? void 0 : n.type) === "systemPermissionSet" && !r.inverted && r.actions.includes("manage");
681
+ }
682
+ ).map((r) => r.subject)
676
683
  );
677
- return e.filter((t) => t.inverted || !o.has(t.subject));
684
+ return e.filter((r) => r.inverted ? !(s.has(r.subject) && !o.has(r.subject)) : !s.has(r.subject));
678
685
  }
679
686
  const se = "business::report::";
680
- function _e(e, n) {
681
- const o = [], t = e.filter((a) => {
682
- const s = a.subject;
683
- return !s.startsWith(se) || n.has(s) ? !0 : (o.push(s), !1);
687
+ function _e(e, t) {
688
+ const s = [], o = e.filter((r) => {
689
+ const n = r.subject;
690
+ return !n.startsWith(se) || t.has(n) ? !0 : (s.push(n), !1);
684
691
  });
685
- return o.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", o), t;
692
+ return s.length > 0 && console.warn("[filterStalePermissions] dropped stale report permissions:", s), o;
686
693
  }
687
694
  const oe = "business::report::reports::", ie = "business::report::allDefaultReports", re = "business::report::allCustomReports";
688
- function Ee(e, n) {
689
- const o = e.find(
690
- (r) => !r.inverted && r.subject === ie
691
- ), t = e.find(
692
- (r) => !r.inverted && r.subject === re
695
+ function Ee(e, t) {
696
+ const s = e.find(
697
+ (a) => !a.inverted && a.subject === ie
698
+ ), o = e.find(
699
+ (a) => !a.inverted && a.subject === re
693
700
  );
694
- if (!o && !t) return e;
695
- const a = o ? new Set(o.actions) : null, s = t ? new Set(t.actions) : null;
696
- return e.reduce((r, i) => {
701
+ if (!s && !o) return e;
702
+ const r = s ? new Set(s.actions) : null, n = o ? new Set(o.actions) : null;
703
+ return e.reduce((a, i) => {
697
704
  if (i.inverted)
698
- return r.push(i), r;
705
+ return a.push(i), a;
699
706
  const c = i.subject;
700
707
  if (!c.startsWith(oe))
701
- return r.push(i), r;
702
- const l = n.has(c) ? a : s;
708
+ return a.push(i), a;
709
+ const l = t.has(c) ? r : n;
703
710
  if (!l)
704
- return r.push(i), r;
705
- if (l.has("manage")) return r;
711
+ return a.push(i), a;
712
+ if (l.has("manage")) return a;
706
713
  const d = new Set(i.actions), p = d.has("manage");
707
714
  let m = !1;
708
715
  for (const f of l)
709
716
  f !== "manage" && d.delete(f) && (m = !0);
710
- return p && m && d.delete("manage"), d.size === 0 || r.push({ ...i, actions: Array.from(d) }), r;
717
+ return p && m && d.delete("manage"), d.size === 0 || a.push({ ...i, actions: Array.from(d) }), a;
711
718
  }, []);
712
719
  }
713
- function B(e, n) {
714
- var t, a;
715
- const o = new Map(e.map((s) => [s.subject, s]));
716
- for (const s of n) {
717
- if (s.inverted) {
718
- const i = o.get(s.subject);
719
- if (s.conditions) {
720
+ function B(e, t) {
721
+ var o, r;
722
+ const s = new Map(e.map((n) => [n.subject, n]));
723
+ for (const n of t) {
724
+ if (n.inverted) {
725
+ const i = s.get(n.subject);
726
+ if (n.conditions) {
720
727
  if (i != null && i.conditions) {
721
- const c = JSON.parse(i.conditions), u = JSON.parse(s.conditions), l = Object.keys(u)[0], d = ((t = u[l]) == null ? void 0 : t.$in) ?? [], m = (((a = c[l]) == null ? void 0 : a.$in) ?? []).filter((f) => !d.includes(f));
722
- m.length > 0 ? o.set(s.subject, {
728
+ const c = JSON.parse(i.conditions), u = JSON.parse(n.conditions), l = Object.keys(u)[0], d = ((o = u[l]) == null ? void 0 : o.$in) ?? [], m = (((r = c[l]) == null ? void 0 : r.$in) ?? []).filter((f) => !d.includes(f));
729
+ m.length > 0 ? s.set(n.subject, {
723
730
  ...i,
724
731
  conditions: JSON.stringify({ [l]: { $in: m } })
725
- }) : o.delete(s.subject);
732
+ }) : s.delete(n.subject);
726
733
  } else
727
- o.delete(s.subject);
734
+ s.delete(n.subject);
728
735
  continue;
729
736
  }
730
737
  if (i) {
731
- const c = new Set(s.actions), u = i.actions.filter((l) => !c.has(l));
732
- u.length > 0 ? o.set(s.subject, { ...i, actions: u }) : o.delete(s.subject);
738
+ const c = new Set(n.actions), u = i.actions.filter((l) => !c.has(l));
739
+ u.length > 0 ? s.set(n.subject, { ...i, actions: u }) : s.delete(n.subject);
733
740
  continue;
734
741
  }
735
742
  continue;
736
743
  }
737
- if (s.conditions) {
738
- o.set(s.subject, s);
744
+ if (n.conditions) {
745
+ s.set(n.subject, n);
739
746
  continue;
740
747
  }
741
- const r = o.get(s.subject);
742
- if (r) {
748
+ const a = s.get(n.subject);
749
+ if (a) {
743
750
  const i = [
744
751
  .../* @__PURE__ */ new Set([
745
- ...r.actions,
746
- ...s.actions
752
+ ...a.actions,
753
+ ...n.actions
747
754
  ])
748
755
  ];
749
- o.set(s.subject, { ...r, actions: i });
756
+ s.set(n.subject, { ...a, actions: i });
750
757
  } else
751
- o.set(s.subject, s);
758
+ s.set(n.subject, n);
752
759
  }
753
- return Array.from(o.values());
760
+ return Array.from(s.values());
754
761
  }
755
- function ae(e, n) {
756
- const o = B(e, n), t = new Set(e.map((s) => s.subject)), a = n.filter(
757
- (s) => s.inverted && !t.has(s.subject)
762
+ function ae(e, t) {
763
+ const s = B(e, t), o = new Set(e.map((n) => n.subject)), r = t.filter(
764
+ (n) => n.inverted && !o.has(n.subject)
758
765
  );
759
- return [...o, ...a];
766
+ return [...s, ...r];
760
767
  }
761
768
  const y = "/permission-assignments", P = {
762
769
  async readAll() {
@@ -771,48 +778,48 @@ const y = "/permission-assignments", P = {
771
778
  async create(e) {
772
779
  return b(await g().post(y, e));
773
780
  },
774
- async update(e, n) {
775
- return b(await g().put(`${y}/${e}`, n));
781
+ async update(e, t) {
782
+ return b(await g().put(`${y}/${e}`, t));
776
783
  },
777
784
  async delete(e) {
778
785
  return b(await g().delete(`${y}/${e}`));
779
786
  },
780
- async addReportManagePermission(e, n) {
787
+ async addReportManagePermission(e, t) {
781
788
  return b(
782
- await g().post("/my-permissions/report-manage", { permissionKey: e, label: n })
789
+ await g().post("/my-permissions/report-manage", { permissionKey: e, label: t })
783
790
  );
784
791
  }
785
792
  }, ce = x("permissionAssignment", () => {
786
793
  const e = h([]);
787
- async function n() {
794
+ async function t() {
788
795
  const i = await P.readAll();
789
796
  e.value = i;
790
797
  }
791
- async function o(i) {
798
+ async function s(i) {
792
799
  return await P.readByUserId(i);
793
800
  }
794
- async function t(i) {
801
+ async function o(i) {
795
802
  const c = await P.create(i);
796
803
  e.value = [...e.value, c];
797
804
  }
798
- async function a(i, c) {
805
+ async function r(i, c) {
799
806
  const u = await P.update(i, c);
800
807
  e.value = e.value.map((l) => l.id === i ? u : l);
801
808
  }
802
- async function s(i) {
809
+ async function n(i) {
803
810
  await P.delete(i), e.value = e.value.filter((c) => c.id !== i);
804
811
  }
805
- function r(i) {
812
+ function a(i) {
806
813
  return e.value.find((c) => c.userId === i);
807
814
  }
808
815
  return {
809
816
  permissionAssignments: e,
810
- readPermissionAssignments: n,
811
- readPermissionAssignmentByUserId: o,
812
- createPermissionAssignment: t,
813
- updatePermissionAssignment: a,
814
- deletePermissionAssignment: s,
815
- getPermissionAssignmentByUserId: r
817
+ readPermissionAssignments: t,
818
+ readPermissionAssignmentByUserId: s,
819
+ createPermissionAssignment: o,
820
+ updatePermissionAssignment: r,
821
+ deletePermissionAssignment: n,
822
+ getPermissionAssignmentByUserId: a
816
823
  };
817
824
  }), ue = () => {
818
825
  const e = ce();
@@ -836,32 +843,32 @@ const y = "/permission-assignments", P = {
836
843
  }, O = h([]), _ = h(!1), w = h(!1), $ = h(null);
837
844
  function de() {
838
845
  const e = q();
839
- async function n() {
840
- var a;
841
- const t = (a = e.currentBusiness.value) == null ? void 0 : a.id;
842
- if (t && ($.value !== t && (O.value = [], _.value = !1, w.value = !1, $.value = t), !(_.value || w.value))) {
846
+ async function t() {
847
+ var r;
848
+ const o = (r = e.currentBusiness.value) == null ? void 0 : r.id;
849
+ if (o && ($.value !== o && (O.value = [], _.value = !1, w.value = !1, $.value = o), !(_.value || w.value))) {
843
850
  w.value = !0;
844
851
  try {
845
- const s = await le.fetchReportPermissionsForPortal(t);
846
- if ($.value !== t) return;
847
- O.value = s, _.value = !0;
848
- } catch (s) {
849
- if ($.value !== t) return;
850
- console.warn("Failed to fetch custom report permissions:", s), O.value = [];
852
+ const n = await le.fetchReportPermissionsForPortal(o);
853
+ if ($.value !== o) return;
854
+ O.value = n, _.value = !0;
855
+ } catch (n) {
856
+ if ($.value !== o) return;
857
+ console.warn("Failed to fetch custom report permissions:", n), O.value = [];
851
858
  } finally {
852
- $.value === t && (w.value = !1);
859
+ $.value === o && (w.value = !1);
853
860
  }
854
861
  }
855
862
  }
856
- const o = N(() => O.value.map(
857
- (t) => t.isDefault ? {
858
- label: t.name,
859
- subject: `business::report::reports::${t.permissionKey}`,
863
+ const s = N(() => O.value.map(
864
+ (o) => o.isDefault ? {
865
+ label: o.name,
866
+ subject: `business::report::reports::${o.permissionKey}`,
860
867
  actions: [S.manage, S.read, S.create],
861
868
  category: D.reports
862
869
  } : {
863
- label: t.name,
864
- subject: `business::report::reports::${t.permissionKey}`,
870
+ label: o.name,
871
+ subject: `business::report::reports::${o.permissionKey}`,
865
872
  actions: [
866
873
  S.manage,
867
874
  S.read,
@@ -873,25 +880,25 @@ function de() {
873
880
  }
874
881
  ));
875
882
  return {
876
- fetchCustomReportPermissions: n,
877
- customReportPermissions: o,
883
+ fetchCustomReportPermissions: t,
884
+ customReportPermissions: s,
878
885
  isLoading: N(() => w.value),
879
886
  isLoaded: N(() => _.value)
880
887
  };
881
888
  }
882
- function U(e) {
883
- const n = q(), o = G(), t = ue(), a = n.restaurants, { customReportPermissions: s } = de(), r = t.getPermissionAssignmentByUserId(e.id), i = V(
884
- (r == null ? void 0 : r.permissionSetIds) ?? [],
885
- o.permissionSets.value
889
+ function C(e) {
890
+ const t = q(), s = Z(), o = ue(), r = t.restaurants, { customReportPermissions: n } = de(), a = o.getPermissionAssignmentByUserId(e.id), i = V(
891
+ (a == null ? void 0 : a.permissionSetIds) ?? [],
892
+ s.permissionSets.value
886
893
  ), c = W(i).map(
887
894
  ({ setNames: f, ...v }) => v
888
- ), u = r == null ? void 0 : r.customPermissions, l = u ?? e.permissions.map((f) => ({
895
+ ), u = a == null ? void 0 : a.customPermissions, l = u ?? e.permissions.map((f) => ({
889
896
  ...f,
890
897
  subject: R(f.subject)
891
898
  })), d = B(c, l), p = z(
892
899
  ae(c, l),
893
900
  F
894
- ).filter((f) => !f.inverted), m = Y(p) || a.value.map((f) => f._id);
901
+ ).filter((f) => !f.inverted), m = Y(p) || r.value.map((f) => f._id);
895
902
  return {
896
903
  doc: e,
897
904
  id: e.id,
@@ -902,38 +909,38 @@ function U(e) {
902
909
  m.map(
903
910
  (f) => {
904
911
  var v;
905
- return ((v = a.value.find((K) => K._id === f)) == null ? void 0 : v.profile.name) ?? "";
912
+ return ((v = r.value.find((K) => K._id === f)) == null ? void 0 : v.profile.name) ?? "";
906
913
  }
907
914
  )
908
915
  ),
909
916
  managableRestaurantIds: m,
910
- permissionLabels: ne(p, s.value),
917
+ permissionLabels: ne(p, n.value),
911
918
  permissions: d
912
919
  };
913
920
  }
914
921
  const me = Object.freeze(
915
- Object.values(Q)
922
+ Object.values(H)
916
923
  ), Ne = {
917
924
  async readTeamMembers() {
918
925
  return b(
919
926
  await g().get("/portal-users")
920
- ).map(U);
927
+ ).map(C);
921
928
  },
922
929
  async createTeamMember(e) {
923
- return U(
930
+ return C(
924
931
  b(await g().post("/portal-users", e))
925
932
  );
926
933
  },
927
- async updateTeamMember(e, n) {
928
- return U(
929
- b(await g().put(`/portal-users/${e}`, n))
934
+ async updateTeamMember(e, t) {
935
+ return C(
936
+ b(await g().put(`/portal-users/${e}`, t))
930
937
  );
931
938
  },
932
939
  async deleteTeamMember(e) {
933
940
  return b(await g().delete(`/portal-users/${e}`));
934
941
  },
935
942
  async readTeamMemberPosUserIds() {
936
- return b(await g().get("/portal-users")).map((n) => n.posUserId);
943
+ return b(await g().get("/portal-users")).map((t) => t.posUserId);
937
944
  }
938
945
  };
939
946
  export {
@@ -959,7 +966,7 @@ export {
959
966
  E as r,
960
967
  Oe as s,
961
968
  Ne as t,
962
- G as u,
969
+ Z as u,
963
970
  ue as v,
964
971
  ne as w,
965
972
  W as x,