@m4l/core 2.0.2 → 2.0.3

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 (42) hide show
  1. package/contexts/AuthContext/index-cvUlEja1.js +136 -0
  2. package/contexts/DomainContext/{index.2ed56159.js → index-D24R5afH.js} +7 -5
  3. package/contexts/DomainCountryContext/index-Gjy6Za6i.js +46 -0
  4. package/contexts/FlagsContext/{index.5b096265.js → index-DcIX8FKd.js} +1 -1
  5. package/contexts/ModuleDictionaryContext/index-kBzBlTUI.js +71 -0
  6. package/contexts/ModulePrivilegesContext/index-DsoWo0kK.js +53 -0
  7. package/contexts/ModuleSkeletonContext/index-CkhzuYKp.js +20 -0
  8. package/contexts/NetworkContext/{index.ec7405cd.js → index-C8wX3ESG.js} +2 -2
  9. package/hooks/useAuth/index-BmbX0ftD.js +10 -0
  10. package/hooks/useBase/index-gThCdRe-.js +10 -0
  11. package/hooks/useDomain/{index.be2722d9.js → index-Bct5KNcv.js} +3 -4
  12. package/hooks/useEnvironment/index-D1xRKaoe.js +10 -0
  13. package/hooks/useFlagsStore/{index.f7c613ac.js → index-EagkUnqK.js} +3 -4
  14. package/hooks/useHostTools/index-CL3d7qFm.js +10 -0
  15. package/hooks/useModuleDictionary/{index.9004a259.js → index-C1BKVxpe.js} +1 -1
  16. package/hooks/useModulePrivileges/{index.6ebd7c42.js → index-D14YH0TD.js} +1 -1
  17. package/hooks/useModuleSkeleton/{index.1cdf5081.js → index-CBPHGKDR.js} +1 -1
  18. package/hooks/useNetwork/index--IzMsMJ2.js +10 -0
  19. package/hooks/usePaginate/index-DOOXkJPW.js +77 -0
  20. package/hooks/usePaginate/types.d.ts +2 -0
  21. package/hooks/usePropageteMF/{index.c440b829.js → index-DEVKsg4w.js} +1 -1
  22. package/index.js +66 -75
  23. package/{node_modules.04fac7e9.js → node_modules-C59GSzS1.js} +36 -60
  24. package/package.json +1 -1
  25. package/utils/{axiosOperation.ac6c8eef.js → axiosOperation-CEky_K0E.js} +1 -1
  26. package/utils/{index.2f5ce5aa.js → index-BNOjc4WT.js} +10 -14
  27. package/contexts/AuthContext/index.db46edbc.js +0 -150
  28. package/contexts/DomainCountryContext/index.506456a3.js +0 -57
  29. package/contexts/ModuleDictionaryContext/index.a64207d4.js +0 -81
  30. package/contexts/ModulePrivilegesContext/index.79c3cc04.js +0 -62
  31. package/contexts/ModuleSkeletonContext/index.f6150fb9.js +0 -30
  32. package/hooks/useAuth/index.4154d394.js +0 -21
  33. package/hooks/useBase/index.4375dcef.js +0 -11
  34. package/hooks/useEnvironment/index.25f83176.js +0 -11
  35. package/hooks/useHostTools/index.66d9a667.js +0 -11
  36. package/hooks/useNetwork/index.3d79002b.js +0 -11
  37. package/hooks/usePaginate/index.1306b0de.js +0 -70
  38. /package/contexts/BaseContext/{index.f9cdc955.js → index-BZehLjuv.js} +0 -0
  39. /package/contexts/EnvironmentContext/{index.b33784cd.js → index-CQz-FvKh.js} +0 -0
  40. /package/contexts/HostToolsContext/{index.499db832.js → index-DikGcxz8.js} +0 -0
  41. /package/hooks/useLocalStorage/{index.91bc0791.js → index-CsLmjbAr.js} +0 -0
  42. /package/types/{index.42c24946.js → index-TbOJOhBX.js} +0 -0
@@ -1,81 +0,0 @@
1
- import { createContext as F, useState as y, useEffect as A, useCallback as m } from "react";
2
- import "../BaseContext/index.f9cdc955.js";
3
- import { u as L } from "../../hooks/useEnvironment/index.25f83176.js";
4
- import { u as M } from "../../hooks/useFlagsStore/index.f7c613ac.js";
5
- import { u as N } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import "../DomainContext/index.2ed56159.js";
7
- import "../ModulePrivilegesContext/index.79c3cc04.js";
8
- import "../ModuleSkeletonContext/index.f6150fb9.js";
9
- import { u as P } from "../../hooks/useNetwork/index.3d79002b.js";
10
- import "../DomainCountryContext/index.506456a3.js";
11
- import "../EnvironmentContext/index.b33784cd.js";
12
- import "../HostToolsContext/index.499db832.js";
13
- import "../NetworkContext/index.ec7405cd.js";
14
- import "../AuthContext/index.db46edbc.js";
15
- import "../FlagsContext/index.5b096265.js";
16
- import { C as _ } from "../../types/index.42c24946.js";
17
- import { jsx as x } from "react/jsx-runtime";
18
- const E = F(null);
19
- function K(u) {
20
- const {
21
- children: l,
22
- componentsDictionary: c,
23
- moduleId: n,
24
- moduleNameField: s = "module_name",
25
- currentLang: d = "en",
26
- isAuth: a = !0
27
- } = u, p = M((t) => t.flagsActions.addFlag), [r, f] = y(void 0), {
28
- domain_token: g
29
- } = L(), {
30
- startProgress: D,
31
- stopProgress: h
32
- } = N(), {
33
- networkOperation: v
34
- } = P();
35
- A(() => {
36
- let t = !0;
37
- return D(), v({
38
- method: "GET",
39
- endPoint: a ? `dictionaries/${n}` : `na/dictionaries/${n}`,
40
- parms: {
41
- comps: c,
42
- ...a ? {} : {
43
- domain_token: g
44
- }
45
- }
46
- }).then((o) => {
47
- t && (f({
48
- ...o
49
- }), p(_.FLAG_DICTIONARY_LOADED));
50
- }).finally(() => {
51
- h();
52
- }), function() {
53
- t = !1;
54
- };
55
- }, [d]);
56
- const i = m((t) => {
57
- if (r === void 0)
58
- return "";
59
- if (t === "")
60
- return "No key";
61
- let o;
62
- const e = t.split(".");
63
- try {
64
- e.length === 1 && (o = r.data[t]), e.length === 2 && (o = r[e[0]][e[1]]);
65
- } catch {
66
- }
67
- return o || `N_D:[${t}]`;
68
- }, [r]), C = m(() => i(s), [s, i]);
69
- return /* @__PURE__ */ x(E.Provider, {
70
- value: {
71
- moduleDictionary: r,
72
- getLabel: i,
73
- getModuleLabel: C
74
- },
75
- children: l
76
- });
77
- }
78
- export {
79
- E as M,
80
- K as a
81
- };
@@ -1,62 +0,0 @@
1
- import { createContext as c, useState as f, useEffect as d, useCallback as P } from "react";
2
- import "../BaseContext/index.f9cdc955.js";
3
- import "../EnvironmentContext/index.b33784cd.js";
4
- import { u as v } from "../../hooks/useFlagsStore/index.f7c613ac.js";
5
- import { u as E } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import "../DomainContext/index.2ed56159.js";
7
- import "../ModuleDictionaryContext/index.a64207d4.js";
8
- import "../ModuleSkeletonContext/index.f6150fb9.js";
9
- import { u as h } from "../../hooks/useNetwork/index.3d79002b.js";
10
- import "../DomainCountryContext/index.506456a3.js";
11
- import "../HostToolsContext/index.499db832.js";
12
- import "../NetworkContext/index.ec7405cd.js";
13
- import "../AuthContext/index.db46edbc.js";
14
- import "../FlagsContext/index.5b096265.js";
15
- import { C as s } from "../../types/index.42c24946.js";
16
- import { jsx as F } from "react/jsx-runtime";
17
- const L = c(null);
18
- function b(n) {
19
- const {
20
- children: a,
21
- queryPrivileges: o
22
- } = n, e = v((t) => t.flagsActions.addFlag), [r, l] = f({}), {
23
- startProgress: m,
24
- stopProgress: p
25
- } = E(), {
26
- networkOperation: u
27
- } = h();
28
- d(() => {
29
- let t = !0;
30
- if (o.length === 0) {
31
- e(s.FLAG_PRIVILEGES_LOADED);
32
- return;
33
- }
34
- return m(), u({
35
- method: "GET",
36
- endPoint: "auth/login",
37
- parms: {
38
- privileges: o
39
- }
40
- }).then((i) => {
41
- t && (l({
42
- ...i.data
43
- }), e(s.FLAG_PRIVILEGES_LOADED));
44
- }).finally(() => {
45
- p();
46
- }), function() {
47
- t = !1;
48
- };
49
- }, []);
50
- const g = P((t) => t in r, [r]);
51
- return /* @__PURE__ */ F(L.Provider, {
52
- value: {
53
- hasPrivilege: g,
54
- privileges: r
55
- },
56
- children: a
57
- });
58
- }
59
- export {
60
- L as M,
61
- b as a
62
- };
@@ -1,30 +0,0 @@
1
- import { createContext as i } from "react";
2
- import "../BaseContext/index.f9cdc955.js";
3
- import "../EnvironmentContext/index.b33784cd.js";
4
- import { a as m } from "../../hooks/useFlagsStore/index.f7c613ac.js";
5
- import "../HostToolsContext/index.499db832.js";
6
- import "../DomainContext/index.2ed56159.js";
7
- import "../ModuleDictionaryContext/index.a64207d4.js";
8
- import "../ModulePrivilegesContext/index.79c3cc04.js";
9
- import "../NetworkContext/index.ec7405cd.js";
10
- import "../DomainCountryContext/index.506456a3.js";
11
- import "../AuthContext/index.db46edbc.js";
12
- import "../FlagsContext/index.5b096265.js";
13
- import { jsx as n } from "react/jsx-runtime";
14
- const p = i(null);
15
- function g(o) {
16
- const {
17
- children: t,
18
- flags: r
19
- } = o, e = !m(r);
20
- return /* @__PURE__ */ n(p.Provider, {
21
- value: {
22
- isSkeleton: e
23
- },
24
- children: t
25
- });
26
- }
27
- export {
28
- p as M,
29
- g as a
30
- };
@@ -1,21 +0,0 @@
1
- import { useContext as o } from "react";
2
- import "../../contexts/BaseContext/index.f9cdc955.js";
3
- import "../../contexts/EnvironmentContext/index.b33784cd.js";
4
- import "../../contexts/HostToolsContext/index.499db832.js";
5
- import "../../contexts/NetworkContext/index.ec7405cd.js";
6
- import { A as r } from "../../contexts/AuthContext/index.db46edbc.js";
7
- import "../../contexts/FlagsContext/index.5b096265.js";
8
- import "../../contexts/DomainContext/index.2ed56159.js";
9
- import "../../contexts/ModuleDictionaryContext/index.a64207d4.js";
10
- import "../../contexts/ModulePrivilegesContext/index.79c3cc04.js";
11
- import "../../contexts/ModuleSkeletonContext/index.f6150fb9.js";
12
- import "../../contexts/DomainCountryContext/index.506456a3.js";
13
- const a = () => {
14
- const t = o(r);
15
- if (!t)
16
- throw new Error("Auth context must be use inside AuthProvider");
17
- return t;
18
- };
19
- export {
20
- a as u
21
- };
@@ -1,11 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { B as o } from "../../contexts/BaseContext/index.f9cdc955.js";
3
- function r() {
4
- const e = t(o);
5
- if (!e)
6
- throw new Error("useBase context must be use inside BaseContext");
7
- return e;
8
- }
9
- export {
10
- r as u
11
- };
@@ -1,11 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { E as e } from "../../contexts/EnvironmentContext/index.b33784cd.js";
3
- const s = () => {
4
- const n = t(e);
5
- if (!n)
6
- throw new Error("useEnvironment context must be use inside EnvironmentContext");
7
- return n;
8
- };
9
- export {
10
- s as u
11
- };
@@ -1,11 +0,0 @@
1
- import { useContext as t } from "react";
2
- import { H as s } from "../../contexts/HostToolsContext/index.499db832.js";
3
- const n = () => {
4
- const o = t(s);
5
- if (!o)
6
- throw new Error("useHostTools context must be use inside HostToolsContext");
7
- return o;
8
- };
9
- export {
10
- n as u
11
- };
@@ -1,11 +0,0 @@
1
- import { useContext as e } from "react";
2
- import { N as o } from "../../contexts/NetworkContext/index.ec7405cd.js";
3
- const s = () => {
4
- const t = e(o);
5
- if (!t)
6
- throw new Error("useNetwork context must be use inside NetworkContext");
7
- return t;
8
- };
9
- export {
10
- s as u
11
- };
@@ -1,70 +0,0 @@
1
- import { useState as s, useRef as G, useCallback as H, useEffect as p } from "react";
2
- import { u as L } from "../useHostTools/index.66d9a667.js";
3
- import { u as N } from "../useNetwork/index.3d79002b.js";
4
- const a = {
5
- page: 0,
6
- rowsPerPage: 25,
7
- totalRecords: 0
8
- }, D = (l) => {
9
- const {
10
- endPoint: m,
11
- timeout: w = 5e3,
12
- queryParams: P,
13
- fireOnChangeParms: i,
14
- fireOnFirstLoad: h = !0,
15
- rowsPerPage: u = a.rowsPerPage,
16
- startProgress: R,
17
- stopProgress: C,
18
- isRemote: d = !0,
19
- bodyToSnakeCase: S = !1,
20
- responseToCamelCase: k = !1,
21
- initialRows: y = []
22
- } = l, [c, o] = s(i ? 1 : 0), [T, n] = s(y), [O, g] = s({ ...a, rowsPerPage: u }), t = G({ ...a, rowsPerPage: u }), [b, E] = s(h), { startProgress: F, stopProgress: Q } = L(), { networkOperation: q } = N(), f = H(() => {
23
- o((r) => r + 1);
24
- }, []);
25
- return p(() => {
26
- if (b) {
27
- E(!1);
28
- return;
29
- }
30
- i && f();
31
- }, [P]), p(() => {
32
- let r = !0;
33
- if (c !== 0)
34
- return q({
35
- method: "GET",
36
- endPoint: m,
37
- timeout: w,
38
- parms: {
39
- ...P,
40
- page: t.current.page,
41
- limit: t.current.rowsPerPage
42
- },
43
- bodyToSnakeCase: S,
44
- responseToCamelCase: k,
45
- options: {
46
- startProgress: R || F,
47
- stopProgress: C || Q
48
- },
49
- isRemote: d
50
- }).then((e) => {
51
- r && (n(e.data), t.current.page = e.pager.page, g((x) => ({
52
- ...x,
53
- page: e.pager.page,
54
- totalRecords: e.pager.total
55
- })));
56
- }), function() {
57
- r = !1;
58
- };
59
- }, [c]), { onPageChange: (r) => {
60
- t.current.page = r, o((e) => e + 1);
61
- }, onRowsPerPageChange: (r) => {
62
- t.current.rowsPerPage = r, g((e) => ({ ...e, rowsPerPage: r })), o((e) => e + 1);
63
- }, pagerState: O, rows: T, clearRows: () => {
64
- n([]), g(a);
65
- }, Refresh: f, setRows: n };
66
- };
67
- export {
68
- a as i,
69
- D as u
70
- };
File without changes