@realtek/core-theme 0.0.107 → 0.0.109

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.
package/dist-lib/index.js CHANGED
@@ -26518,17 +26518,29 @@ function Mx({ onLogout: e }) {
26518
26518
  w([]);
26519
26519
  return;
26520
26520
  }
26521
- u(!0), Qv(x).then((e) => {
26521
+ u(!0), console.log("DEBUG requesting role permissions for selectedUserTypeId=", x, "localStorage scope=", {
26522
+ tenantId: localStorage.getItem("tenantId"),
26523
+ businessId: localStorage.getItem("businessId"),
26524
+ businessUnitId: localStorage.getItem("businessUnitId")
26525
+ }), Qv(x).then((e) => {
26526
+ console.log("DEBUG raw groups from /get-role-details", e);
26522
26527
  let t = Ox(e ?? []);
26523
- w(t.length > 0 ? t : _.flatMap((e) => y.map((t) => ({
26524
- key: `${e.menu_key ?? e.menu_name ?? e.menu_id}:${t.permissionId ?? t.permissionKey}`,
26525
- menuId: e.menu_id,
26526
- menuName: e.menu_name,
26527
- menuKey: e.menu_key,
26528
- permissionId: t.permissionId,
26529
- permissionKey: t.permissionKey,
26530
- accessValue: 0
26531
- }))));
26528
+ console.log("DEBUG savedRows (jobs only)", t.filter((e) => kx(e) === "jobs" || kx(e) === "job"));
26529
+ let n = new Map(t.map((e) => [`${kx(e)}:${String(e.permissionKey).toLowerCase()}`, e.accessValue]));
26530
+ console.log("DEBUG savedAccess keys", [...n.keys()]), console.log("DEBUG menus (jobs only)", _.filter((e) => String(e.menu_key ?? e.menu_name ?? e.menu_id).trim().toLowerCase() === "jobs"));
26531
+ let r = _.flatMap((e) => y.map((t) => {
26532
+ let r = String(e.menu_key ?? e.menu_name ?? e.menu_id).trim().toLowerCase(), i = String(t.permissionKey).toLowerCase();
26533
+ return {
26534
+ key: `${e.menu_key ?? e.menu_name ?? e.menu_id}:${t.permissionId ?? t.permissionKey}`,
26535
+ menuId: e.menu_id,
26536
+ menuName: e.menu_name,
26537
+ menuKey: e.menu_key,
26538
+ permissionId: t.permissionId,
26539
+ permissionKey: t.permissionKey,
26540
+ accessValue: n.get(`${r}:${i}`) ?? 0
26541
+ };
26542
+ }));
26543
+ console.log("DEBUG final rows (jobs only)", r.filter((e) => kx(e) === "jobs" || kx(e) === "job")), w(r);
26532
26544
  }).catch((e) => Y.error(e.message || "Unable to load role permissions")).finally(() => u(!1));
26533
26545
  });
26534
26546
  }, [
@@ -26620,15 +26632,22 @@ function Mx({ onLogout: e }) {
26620
26632
  }
26621
26633
  ];
26622
26634
  function ye(e, t) {
26623
- w((n) => n.map((n) => n.key === e ? {
26624
- ...n,
26625
- accessValue: t
26626
- } : n));
26635
+ w((n) => {
26636
+ let r = n.filter((t) => t.key === e).length;
26637
+ return console.log("DEBUG updateRolePermission", {
26638
+ key: e,
26639
+ value: t,
26640
+ matchCount: r
26641
+ }), n.map((n) => n.key === e ? {
26642
+ ...n,
26643
+ accessValue: t
26644
+ } : n);
26645
+ });
26627
26646
  }
26628
26647
  async function xe() {
26629
26648
  f(!0);
26630
26649
  try {
26631
- await $v(x, C.map((e) => ({
26650
+ console.log("DEBUG saveRolePermissions jobs rows", C.filter((e) => kx(e) === "jobs" || kx(e) === "job")), await $v(x, C.map((e) => ({
26632
26651
  menu_id: e.menuId,
26633
26652
  menu_name: e.menuName,
26634
26653
  menu_key: e.menuKey,