@orbe-agro/client-core 5.3.31 → 5.3.32

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.
@@ -1,10 +1,15 @@
1
- import { useMemo as s } from "react";
2
- import f from "lodash/isEmpty";
3
- function c(n = [], e = [], m = !1) {
4
- const o = s(() => e.some((r) => n.includes(r)), [e, n]);
5
- return f(e) || f(n) || typeof e > "u" ? !m : o;
1
+ import { useMemo as f } from "react";
2
+ import o from "lodash/isEmpty";
3
+ function d(e = [], n = [], t = !1) {
4
+ const c = f(() => {
5
+ if (n.some((a) => e.includes(a)))
6
+ return !0;
7
+ const s = window.location.pathname;
8
+ return e.includes(s);
9
+ }, [n, e]);
10
+ return o(n) && o(e) && typeof n > "u" ? !t : c;
6
11
  }
7
12
  export {
8
- c as default
13
+ d as default
9
14
  };
10
15
  //# sourceMappingURL=useAuthority.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthority.js","sources":["../../../../lib/@ecme/utils/hooks/useAuthority.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport isEmpty from 'lodash/isEmpty'\n\nfunction useAuthority(\n userAuthority: string[] = [],\n authority: string[] = [],\n emptyCheck = false,\n) {\n const roleMatched = useMemo(() => {\n return authority.some((role) => userAuthority.includes(role))\n }, [authority, userAuthority])\n\n if (\n isEmpty(authority) ||\n isEmpty(userAuthority) ||\n typeof authority === 'undefined'\n ) {\n return !emptyCheck\n }\n\n return roleMatched\n}\n\nexport default useAuthority\n"],"names":["useAuthority","userAuthority","authority","emptyCheck","roleMatched","useMemo","role","isEmpty"],"mappings":";;AAGA,SAASA,EACLC,IAA0B,CAAA,GAC1BC,IAAsB,CAAA,GACtBC,IAAa,IACf;AACE,QAAMC,IAAcC,EAAQ,MACjBH,EAAU,KAAK,CAACI,MAASL,EAAc,SAASK,CAAI,CAAC,GAC7D,CAACJ,GAAWD,CAAa,CAAC;AAE7B,SACIM,EAAQL,CAAS,KACjBK,EAAQN,CAAa,KACrB,OAAOC,IAAc,MAEd,CAACC,IAGLC;AACX;"}
1
+ {"version":3,"file":"useAuthority.js","sources":["../../../../lib/@ecme/utils/hooks/useAuthority.ts"],"sourcesContent":["import { useMemo } from 'react'\nimport isEmpty from 'lodash/isEmpty'\n\nfunction useAuthority(\n userAuthority: string[] = [],\n authority: string[] = [],\n emptyCheck = false\n) {\n const roleMatched = useMemo(() => {\n const hasRoleMatch = authority.some((role) => userAuthority.includes(role));\n if (hasRoleMatch) {\n return true;\n }\n\n const currentPath = window.location.pathname;\n return userAuthority.includes(currentPath);\n }, [authority, userAuthority]);\n\n if (\n isEmpty(authority) &&\n isEmpty(userAuthority) &&\n typeof authority === 'undefined'\n ) {\n return !emptyCheck;\n }\n\n return roleMatched;\n}\n\nexport default useAuthority\n"],"names":["useAuthority","userAuthority","authority","emptyCheck","roleMatched","useMemo","role","currentPath","isEmpty"],"mappings":";;AAGA,SAASA,EACLC,IAA0B,CAAA,GAC1BC,IAAsB,CAAA,GACtBC,IAAa,IACf;AACE,QAAMC,IAAcC,EAAQ,MAAM;AAE9B,QADqBH,EAAU,KAAK,CAACI,MAASL,EAAc,SAASK,CAAI,CAAC;AAEtE,aAAO;AAGX,UAAMC,IAAc,OAAO,SAAS;AACpC,WAAON,EAAc,SAASM,CAAW;AAAA,EAC7C,GAAG,CAACL,GAAWD,CAAa,CAAC;AAE7B,SACIO,EAAQN,CAAS,KACjBM,EAAQP,CAAa,KACrB,OAAOC,IAAc,MAEd,CAACC,IAGLC;AACX;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthority.d.ts","sourceRoot":"","sources":["../../../../../lib/@ecme/utils/hooks/useAuthority.ts"],"names":[],"mappings":"AAGA,iBAAS,YAAY,CACjB,aAAa,GAAE,MAAM,EAAO,EAC5B,SAAS,GAAE,MAAM,EAAO,EACxB,UAAU,UAAQ,WAerB;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"useAuthority.d.ts","sourceRoot":"","sources":["../../../../../lib/@ecme/utils/hooks/useAuthority.ts"],"names":[],"mappings":"AAGA,iBAAS,YAAY,CACjB,aAAa,GAAE,MAAM,EAAO,EAC5B,SAAS,GAAE,MAAM,EAAO,EACxB,UAAU,UAAQ,WAqBrB;AAED,eAAe,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbe-agro/client-core",
3
- "version": "5.3.31",
3
+ "version": "5.3.32",
4
4
  "description": "Biblioteca principal de componentes e utilidades para os microfrontends do Orbe Agro.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",