@m4l/core 1.0.0 → 1.1.0

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 (82) hide show
  1. package/contexts/AuthContext/AuthContext.d.ts +5 -0
  2. package/contexts/AuthContext/index.717a8c86.js +135 -0
  3. package/contexts/AuthContext/index.d.ts +2 -0
  4. package/contexts/AuthContext/types.d.ts +52 -0
  5. package/contexts/DomainContext/{index.fc9c9f7e.js → index.2ed56159.js} +2 -2
  6. package/contexts/DomainCountryContext/index.3cdf9462.js +46 -0
  7. package/contexts/FlagsContext/index.5b096265.js +41 -0
  8. package/contexts/ModuleDictionaryContext/index.44448b0d.js +71 -0
  9. package/contexts/ModulePrivilegesContext/index.1274092a.js +52 -0
  10. package/contexts/ModuleSkeletonContext/index.9267d86a.js +20 -0
  11. package/{packages/m4l_core/contexts → contexts}/index.d.ts +1 -0
  12. package/{packages/m4l_core/hooks → hooks}/index.d.ts +1 -0
  13. package/hooks/useAuth/index.5356a5e9.js +11 -0
  14. package/hooks/useAuth/index.d.ts +1 -0
  15. package/hooks/useAuth/useAuth.d.ts +2 -0
  16. package/hooks/useDomain/{index.73578fd1.js → index.dd6909f6.js} +2 -2
  17. package/hooks/useFlagsStore/{index.fa8dcf62.js → index.f7c613ac.js} +5 -4
  18. package/hooks/useLocalStorage/{index.48b47dca.js → index.7dbb3411.js} +2 -2
  19. package/hooks/useModuleDictionary/{index.0b2e51cf.js → index.eec95f41.js} +1 -1
  20. package/hooks/useModulePrivileges/{index.3c1155fb.js → index.e93abed8.js} +1 -1
  21. package/hooks/useModuleSkeleton/{index.2b62072e.js → index.a8238d1d.js} +1 -1
  22. package/index.js +77 -71
  23. package/node_modules.04fac7e9.js +401 -0
  24. package/package.json +4 -2
  25. package/utils/{index.6d56ba04.js → index.f9db04a8.js} +10 -14
  26. package/vite-env.d.ts +4 -4
  27. package/contexts/DomainCountryContext/index.2da8b247.js +0 -54
  28. package/contexts/FlagsContext/index.3f08bff3.js +0 -39
  29. package/contexts/ModuleDictionaryContext/index.cc2a5fa3.js +0 -76
  30. package/contexts/ModulePrivilegesContext/index.039085db.js +0 -58
  31. package/contexts/ModuleSkeletonContext/index.334164fc.js +0 -28
  32. package/node_modules.7069706f.js +0 -835
  33. package/packages/m4l_core/vite-env.d.ts +0 -4
  34. package/vendor.3b4bd7d3.js +0 -32
  35. /package/{packages/m4l_core/contexts → contexts}/BaseContext/index.d.ts +0 -0
  36. /package/{packages/m4l_core/contexts → contexts}/BaseContext/types.d.ts +0 -0
  37. /package/{packages/m4l_core/contexts → contexts}/DomainContext/index.d.ts +0 -0
  38. /package/{packages/m4l_core/contexts → contexts}/DomainContext/types.d.ts +0 -0
  39. /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/index.d.ts +0 -0
  40. /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/types.d.ts +0 -0
  41. /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/index.d.ts +0 -0
  42. /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/types.d.ts +0 -0
  43. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/index.d.ts +0 -0
  44. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/store.d.ts +0 -0
  45. /package/{packages/m4l_core/contexts → contexts}/FlagsContext/types.d.ts +0 -0
  46. /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/index.d.ts +0 -0
  47. /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/types.d.ts +0 -0
  48. /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/index.d.ts +0 -0
  49. /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/types.d.ts +0 -0
  50. /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/index.d.ts +0 -0
  51. /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/types.d.ts +0 -0
  52. /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/index.d.ts +0 -0
  53. /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/types.d.ts +0 -0
  54. /package/{packages/m4l_core/contexts → contexts}/NetworkContext/index.d.ts +0 -0
  55. /package/{packages/m4l_core/contexts → contexts}/NetworkContext/types.d.ts +0 -0
  56. /package/{packages/m4l_core/hooks → hooks}/useBase/index.d.ts +0 -0
  57. /package/{packages/m4l_core/hooks → hooks}/useDomain/index.d.ts +0 -0
  58. /package/{packages/m4l_core/hooks → hooks}/useDomainCountry/index.d.ts +0 -0
  59. /package/{packages/m4l_core/hooks → hooks}/useEnvironment/index.d.ts +0 -0
  60. /package/{packages/m4l_core/hooks → hooks}/useFlagsStore/index.d.ts +0 -0
  61. /package/{packages/m4l_core/hooks → hooks}/useHostTools/index.d.ts +0 -0
  62. /package/{packages/m4l_core/hooks → hooks}/useLocalStorage/index.d.ts +0 -0
  63. /package/{packages/m4l_core/hooks → hooks}/useLocalStorageWithListener/index.d.ts +0 -0
  64. /package/{packages/m4l_core/hooks → hooks}/useModuleDictionary/index.d.ts +0 -0
  65. /package/{packages/m4l_core/hooks → hooks}/useModulePrivileges/index.d.ts +0 -0
  66. /package/{packages/m4l_core/hooks → hooks}/useModuleSkeleton/index.d.ts +0 -0
  67. /package/{packages/m4l_core/hooks → hooks}/useNetwork/index.d.ts +0 -0
  68. /package/{packages/m4l_core/hooks → hooks}/usePaginate/index.d.ts +0 -0
  69. /package/{packages/m4l_core/hooks → hooks}/usePaginate/types.d.ts +0 -0
  70. /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/index.d.ts +0 -0
  71. /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/types.d.ts +0 -0
  72. /package/{packages/m4l_core/index.d.ts → index.d.ts} +0 -0
  73. /package/{packages/m4l_core/types → types}/dictionary.d.ts +0 -0
  74. /package/{packages/m4l_core/types → types}/index.d.ts +0 -0
  75. /package/{packages/m4l_core/utils → utils}/axiosOperation/index.d.ts +0 -0
  76. /package/{packages/m4l_core/utils → utils}/axiosOperation/types.d.ts +0 -0
  77. /package/{packages/m4l_core/utils → utils}/evaluateWithContext/index.d.ts +0 -0
  78. /package/{packages/m4l_core/utils → utils}/getLocalStorage/index.d.ts +0 -0
  79. /package/{packages/m4l_core/utils → utils}/getPropertyByString/index.d.ts +0 -0
  80. /package/{packages/m4l_core/utils → utils}/index.d.ts +0 -0
  81. /package/{packages/m4l_core/utils → utils}/setLocalStorage/index.d.ts +0 -0
  82. /package/{packages/m4l_core/utils → utils}/voidFunction.d.ts +0 -0
@@ -1,54 +0,0 @@
1
- import { createContext as E, useState as d, useCallback as y } from "react";
2
- import "../BaseContext/index.f9cdc955.js";
3
- import "../EnvironmentContext/index.b33784cd.js";
4
- import "../FlagsContext/index.3f08bff3.js";
5
- import { u as T } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import "../DomainContext/index.fc9c9f7e.js";
7
- import "../ModuleDictionaryContext/index.cc2a5fa3.js";
8
- import "../ModulePrivilegesContext/index.039085db.js";
9
- import "../ModuleSkeletonContext/index.334164fc.js";
10
- import "../NetworkContext/index.ec7405cd.js";
11
- import { u as f } from "../../hooks/usePropageteMF/index.c440b829.js";
12
- import { E as i } from "../../types/index.42c24946.js";
13
- import { jsx as D } from "react/jsx-runtime";
14
- const M = E(null);
15
- function G(n) {
16
- const {
17
- children: e,
18
- isMicroFrontEnd: t,
19
- id: m,
20
- currency: s,
21
- currency_decimal_digits: a,
22
- decimal_symbol: c,
23
- thousands_symbol: u
24
- } = n, {
25
- events_emit: p
26
- } = T(), [_, l] = d({
27
- id: m,
28
- currency: s,
29
- currency_decimal_digits: a,
30
- decimal_symbol: c,
31
- thousands_symbol: u
32
- }), r = (o) => {
33
- l(o);
34
- };
35
- f({
36
- isMicroFrontEnd: t,
37
- event: i.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE,
38
- setHandler: r
39
- });
40
- const C = y((o) => {
41
- t || (r(o), p(i.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, o));
42
- }, []);
43
- return /* @__PURE__ */ D(M.Provider, {
44
- value: {
45
- ..._,
46
- changeDomainCountry: C
47
- },
48
- children: e
49
- });
50
- }
51
- export {
52
- M as D,
53
- G as a
54
- };
@@ -1,39 +0,0 @@
1
- import { createContext as l, useRef as n } from "react";
2
- import { c, d as f, i } from "../../node_modules.7069706f.js";
3
- import { jsx as g } from "react/jsx-runtime";
4
- const d = (o) => c(
5
- f(
6
- i((r) => ({
7
- ...o,
8
- flagsActions: {
9
- clearFlags: () => {
10
- r((e) => {
11
- e.flags = [];
12
- });
13
- },
14
- addFlag: (e) => {
15
- r((t) => {
16
- const a = t.flags;
17
- a.findIndex((s) => s === e) < 0 && (t.flags = [...a, e]);
18
- });
19
- }
20
- }
21
- })),
22
- { name: "FlagsStore" }
23
- )
24
- ), m = l(null);
25
- function p({
26
- children: o
27
- }) {
28
- const r = n();
29
- return r.current || (r.current = d({
30
- flags: []
31
- })), /* @__PURE__ */ g(m.Provider, {
32
- value: r.current,
33
- children: o
34
- });
35
- }
36
- export {
37
- m as F,
38
- p as a
39
- };
@@ -1,76 +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.fa8dcf62.js";
5
- import { u as N } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import "../DomainContext/index.fc9c9f7e.js";
7
- import "../ModulePrivilegesContext/index.039085db.js";
8
- import "../ModuleSkeletonContext/index.334164fc.js";
9
- import { u as P } from "../../hooks/useNetwork/index.3d79002b.js";
10
- import "../DomainCountryContext/index.2da8b247.js";
11
- import { C as _ } from "../../types/index.42c24946.js";
12
- import { jsx as x } from "react/jsx-runtime";
13
- const E = F(null);
14
- function Y(u) {
15
- const {
16
- children: l,
17
- componentsDictionary: c,
18
- moduleId: i,
19
- moduleNameField: s = "module_name",
20
- currentLang: d = "en",
21
- isAuth: a = !0
22
- } = u, p = M((t) => t.flagsActions.addFlag), [r, f] = y(void 0), {
23
- domain_token: g
24
- } = L(), {
25
- startProgress: D,
26
- stopProgress: h
27
- } = N(), {
28
- networkOperation: v
29
- } = P();
30
- A(() => {
31
- let t = !0;
32
- return D(), v({
33
- method: "GET",
34
- endPoint: a ? `dictionaries/${i}` : `na/dictionaries/${i}`,
35
- parms: {
36
- comps: c,
37
- ...a ? {} : {
38
- domain_token: g
39
- }
40
- }
41
- }).then((o) => {
42
- t && (f({
43
- ...o
44
- }), p(_.FLAG_DICTIONARY_LOADED));
45
- }).finally(() => {
46
- h();
47
- }), function() {
48
- t = !1;
49
- };
50
- }, [d]);
51
- const n = m((t) => {
52
- if (r === void 0)
53
- return "";
54
- if (t === "")
55
- return "No key";
56
- let o;
57
- const e = t.split(".");
58
- try {
59
- e.length === 1 && (o = r.data[t]), e.length === 2 && (o = r[e[0]][e[1]]);
60
- } catch {
61
- }
62
- return o || `N_D:[${t}]`;
63
- }, [r]), C = m(() => n(s), [s, n]);
64
- return /* @__PURE__ */ x(E.Provider, {
65
- value: {
66
- moduleDictionary: r,
67
- getLabel: n,
68
- getModuleLabel: C
69
- },
70
- children: l
71
- });
72
- }
73
- export {
74
- E as M,
75
- Y as a
76
- };
@@ -1,58 +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.fa8dcf62.js";
5
- import { u as E } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import "../DomainContext/index.fc9c9f7e.js";
7
- import "../ModuleDictionaryContext/index.cc2a5fa3.js";
8
- import "../ModuleSkeletonContext/index.334164fc.js";
9
- import { u as h } from "../../hooks/useNetwork/index.3d79002b.js";
10
- import "../DomainCountryContext/index.2da8b247.js";
11
- import { C as i } from "../../types/index.42c24946.js";
12
- import { jsx as F } from "react/jsx-runtime";
13
- const L = c(null);
14
- function y(n) {
15
- const {
16
- children: a,
17
- queryPrivileges: r
18
- } = n, o = v((e) => e.flagsActions.addFlag), [t, l] = f({}), {
19
- startProgress: m,
20
- stopProgress: u
21
- } = E(), {
22
- networkOperation: p
23
- } = h();
24
- d(() => {
25
- let e = !0;
26
- if (r.length === 0) {
27
- o(i.FLAG_PRIVILEGES_LOADED);
28
- return;
29
- }
30
- return m(), p({
31
- method: "GET",
32
- endPoint: "auth/login",
33
- parms: {
34
- privileges: r
35
- }
36
- }).then((s) => {
37
- e && (l({
38
- ...s.data
39
- }), o(i.FLAG_PRIVILEGES_LOADED));
40
- }).finally(() => {
41
- u();
42
- }), function() {
43
- e = !1;
44
- };
45
- }, []);
46
- const g = P((e) => e in t, [t]);
47
- return /* @__PURE__ */ F(L.Provider, {
48
- value: {
49
- hasPrivilege: g,
50
- privileges: t
51
- },
52
- children: a
53
- });
54
- }
55
- export {
56
- L as M,
57
- y as a
58
- };
@@ -1,28 +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.fa8dcf62.js";
5
- import "../HostToolsContext/index.499db832.js";
6
- import "../DomainContext/index.fc9c9f7e.js";
7
- import "../ModuleDictionaryContext/index.cc2a5fa3.js";
8
- import "../ModulePrivilegesContext/index.039085db.js";
9
- import "../NetworkContext/index.ec7405cd.js";
10
- import "../DomainCountryContext/index.2da8b247.js";
11
- import { jsx as n } from "react/jsx-runtime";
12
- const p = i(null);
13
- function P(o) {
14
- const {
15
- children: t,
16
- flags: r
17
- } = o, e = !m(r);
18
- return /* @__PURE__ */ n(p.Provider, {
19
- value: {
20
- isSkeleton: e
21
- },
22
- children: t
23
- });
24
- }
25
- export {
26
- p as M,
27
- P as a
28
- };