@hortiview/shared-components 2.12.1 → 2.12.2

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [2.12.2](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.12.1...v2.12.2) (2026-02-03)
2
+
3
+ ### Code Refactoring
4
+
5
+ * return permissions instead of roles ([2e41e46](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/2e41e4668b3cf24cd4c5c2481f0d1871d753b236))
6
+
1
7
  ## [2.12.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.12.0...v2.12.1) (2026-02-03)
2
8
 
3
9
  ### Code Refactoring
@@ -1,17 +1,17 @@
1
- import { j as u } from "../../index-CuHybtft.js";
1
+ import { j as l } from "../../index-CuHybtft.js";
2
2
  import { useCallback as a } from "react";
3
3
  import { usePermissionContext as c } from "../SharedComponentsPermissionProvider/PermissionContext.js";
4
- const p = () => {
4
+ const y = () => {
5
5
  const { userPermissions: s, activeOrganizationId: e } = c();
6
6
  return a(
7
- (t, o, l = !1, m) => {
7
+ (t, o, m = !1, u) => {
8
8
  if (t.length === 0) return !0;
9
- const r = m ?? s, n = [
9
+ const r = u ?? s, n = [
10
10
  ...r?.[o ?? e ?? ""] ?? [],
11
11
  ...r?.General ?? [],
12
12
  ...r?.Plattform ?? []
13
13
  ];
14
- return n ? l ? t.every((i) => n.includes(i)) : t.some((i) => n.includes(i)) : !1;
14
+ return n ? m ? t.every((i) => n.includes(i)) : t.some((i) => n.includes(i)) : !1;
15
15
  },
16
16
  [e, s]
17
17
  );
@@ -19,10 +19,10 @@ const p = () => {
19
19
  permissionToken: s
20
20
  }) => {
21
21
  if (!s || s === "") return;
22
- const e = u(s), t = e.ModuleRolesAndPermissions.FarmOrganizationId, o = e.ModuleRolesAndPermissions.RoleNames;
22
+ const e = l(s), t = e.ModuleRolesAndPermissions.FarmOrganizationId, o = e.ModuleRolesAndPermissions.ExecuteEndpointPermissionNames;
23
23
  return { [t]: [...o] };
24
24
  };
25
25
  export {
26
26
  I as getPermissionsFromModulePermissionToken,
27
- p as useIsAllowed
27
+ y as useIsAllowed
28
28
  };
@@ -66,7 +66,7 @@ eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJNb2R1bGVSb2xlc0FuZFBlcm1pc3Npb25zIjp7IkZ
66
66
  permissionToken: n
67
67
  });
68
68
  o(e).toEqual({
69
- "2fd2c0b0-5061-4d45-ac25-d1ca4acd7338": ["Farm Manager", "Farm Worker"]
69
+ "2fd2c0b0-5061-4d45-ac25-d1ca4acd7338": ["blocks-read", "blocks-update", "farms-read"]
70
70
  });
71
71
  }), t("should return undefined when permission token is empty", () => {
72
72
  const e = a({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hortiview/shared-components",
3
3
  "description": "This is a shared component library. It should used in the HortiView platform and its modules.",
4
- "version": "2.12.1",
4
+ "version": "2.12.2",
5
5
  "type": "module",
6
6
  "repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
7
7
  "author": "Falk Menge <falk.menge.ext@bayer.com>",