@m4l/core 2.0.16-beta.0 → 2.0.17

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,55 +1,51 @@
1
- import { jsx as P } from "react/jsx-runtime";
2
- import { createContext as v, useState as a, useEffect as E, useCallback as h } from "react";
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { createContext as d, useState as p, useEffect as P, useCallback as v } from "react";
3
3
  import { C as i } from "../../types/index.js";
4
- import { u as D } from "../../hooks/useFlagsStore/index.js";
5
- import { u as F } from "../../hooks/useHostTools/index.js";
6
- import { u as L } from "../../hooks/useNetwork/index.js";
7
- const A = v(null);
8
- function k(n) {
9
- const { children: l, queryPrivileges: s } = n, o = D((e) => e.flagsActions.addFlag), [t, u] = a({}), [m, c] = a({}), { startProgress: g, stopProgress: f } = F(), { networkOperation: d } = L();
10
- E(() => {
4
+ import { u as E } from "../../hooks/useFlagsStore/index.js";
5
+ import { u as h } from "../../hooks/useHostTools/index.js";
6
+ import { u as F } from "../../hooks/useNetwork/index.js";
7
+ const L = d(null);
8
+ function S(n) {
9
+ const { children: a, queryPrivileges: r } = n, o = E((e) => e.flagsActions.addFlag), [t, l] = p({}), { startProgress: u, stopProgress: m } = h(), { networkOperation: g } = F();
10
+ P(() => {
11
11
  let e = !0;
12
- if (s.length === 0) {
12
+ if (r.length === 0) {
13
13
  o(i.FLAG_PRIVILEGES_LOADED);
14
14
  return;
15
15
  }
16
- return g(), d({
16
+ return u(), g({
17
17
  method: "GET",
18
18
  endPoint: "auth/login",
19
19
  parms: {
20
- privileges: s,
21
- user_data: !0
20
+ privileges: r
22
21
  }
23
22
  // isRemote: false
24
- }).then((r) => {
25
- e && (u({
26
- ...r.data
27
- }), c({
28
- ...r.user
23
+ }).then((s) => {
24
+ e && (l({
25
+ ...s.data
29
26
  }), o(i.FLAG_PRIVILEGES_LOADED));
30
27
  }).finally(() => {
31
- f();
28
+ m();
32
29
  }), function() {
33
30
  e = !1;
34
31
  };
35
32
  }, []);
36
- const p = h(
33
+ const c = v(
37
34
  (e) => e in t,
38
35
  [t]
39
36
  );
40
- return /* @__PURE__ */ P(
41
- A.Provider,
37
+ return /* @__PURE__ */ f(
38
+ L.Provider,
42
39
  {
43
40
  value: {
44
- hasPrivilege: p,
45
- privileges: t,
46
- userData: m
41
+ hasPrivilege: c,
42
+ privileges: t
47
43
  },
48
- children: l
44
+ children: a
49
45
  }
50
46
  );
51
47
  }
52
48
  export {
53
- A as M,
54
- k as a
49
+ L as M,
50
+ S as a
55
51
  };
@@ -6,5 +6,4 @@ export interface ModulePrivilegesProviderProps {
6
6
  export interface ModulePrivilegesContextProps {
7
7
  privileges: Record<string, boolean>;
8
8
  hasPrivilege: (id: string) => boolean;
9
- userData: Record<string, any>;
10
9
  }
@@ -1,13 +1,11 @@
1
- import { useState as n, useContext as s, useEffect as u } from "react";
2
- import { M as r } from "../../contexts/ModuleSkeletonContext/index.js";
3
- const S = () => {
4
- const [t, o] = n(!0), e = s(r);
1
+ import { useContext as o } from "react";
2
+ import { M as t } from "../../contexts/ModuleSkeletonContext/index.js";
3
+ const s = () => {
4
+ const e = o(t);
5
5
  if (!e)
6
6
  throw new Error("useModuleSkeleton context must be use inside ModuleSkeletonContext");
7
- return u(() => {
8
- t !== e.isSkeleton && o(e.isSkeleton);
9
- }, [e.isSkeleton]), t;
7
+ return e.isSkeleton;
10
8
  };
11
9
  export {
12
- S as u
10
+ s as u
13
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/core",
3
- "version": "2.0.16-beta.0",
3
+ "version": "2.0.17",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team",
6
6
  "publishConfig": {