@m4l/core 0.1.57 → 1.0.1

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 (29) hide show
  1. package/contexts/DomainContext/index.2ed56159.js +56 -0
  2. package/contexts/DomainCountryContext/index.e7a82641.js +55 -0
  3. package/contexts/FlagsContext/index.5b096265.js +41 -0
  4. package/contexts/FlagsContext/index.d.ts +10 -2
  5. package/contexts/FlagsContext/store.d.ts +11 -0
  6. package/contexts/FlagsContext/types.d.ts +9 -0
  7. package/contexts/ModuleDictionaryContext/index.011db031.js +76 -0
  8. package/contexts/ModulePrivilegesContext/index.a45d4cf7.js +58 -0
  9. package/contexts/ModuleSkeletonContext/index.2cd78f14.js +28 -0
  10. package/hooks/index.d.ts +1 -1
  11. package/hooks/useDomain/{index.38a2a89e.js → index.b743be01.js} +2 -2
  12. package/hooks/useFlagsStore/index.d.ts +3 -0
  13. package/hooks/useFlagsStore/index.f7c613ac.js +18 -0
  14. package/hooks/useModuleDictionary/{index.3305a123.js → index.0a0998b6.js} +1 -1
  15. package/hooks/useModulePrivileges/{index.cbe0c72f.js → index.24c10523.js} +1 -1
  16. package/hooks/useModuleSkeleton/{index.739fd422.js → index.12ff3650.js} +1 -1
  17. package/index.js +52 -49
  18. package/node_modules.04fac7e9.js +401 -0
  19. package/package.json +4 -2
  20. package/utils/{index.c7370abf.js → index.6d56ba04.js} +14 -10
  21. package/vite-env.d.ts +4 -4
  22. package/contexts/DomainContext/index.b9fd4c7f.js +0 -57
  23. package/contexts/DomainCountryContext/index.3cdf9462.js +0 -46
  24. package/contexts/FlagsContext/index.5f795859.js +0 -24
  25. package/contexts/ModuleDictionaryContext/index.848a0393.js +0 -73
  26. package/contexts/ModulePrivilegesContext/index.f1988b13.js +0 -54
  27. package/contexts/ModuleSkeletonContext/index.45963775.js +0 -20
  28. package/hooks/useFlags/index.a986729d.js +0 -21
  29. package/hooks/useFlags/index.d.ts +0 -3
@@ -1,54 +0,0 @@
1
- import { createContext as g, useState as p, useEffect as P, useCallback as d } from "react";
2
- import { C as i } from "../../types/index.42c24946.js";
3
- import { jsx as v } from "react/jsx-runtime";
4
- import { u as E } from "../../hooks/useFlags/index.a986729d.js";
5
- import { u as h } from "../../hooks/useHostTools/index.66d9a667.js";
6
- import { u as L } from "../../hooks/useNetwork/index.3d79002b.js";
7
- const C = g(null);
8
- function _(n) {
9
- const {
10
- children: a,
11
- queryPrivileges: t
12
- } = n, {
13
- addFlag: o
14
- } = E(), [r, l] = p({}), {
15
- startProgress: u,
16
- stopProgress: m
17
- } = h(), {
18
- networkOperation: c
19
- } = L();
20
- P(() => {
21
- let e = !0;
22
- if (t.length === 0) {
23
- o(i.FLAG_PRIVILEGES_LOADED);
24
- return;
25
- }
26
- return u(), c({
27
- method: "GET",
28
- endPoint: "auth/login",
29
- parms: {
30
- privileges: t
31
- }
32
- }).then((s) => {
33
- e && (l({
34
- ...s.data
35
- }), o(i.FLAG_PRIVILEGES_LOADED));
36
- }).finally(() => {
37
- m();
38
- }), function() {
39
- e = !1;
40
- };
41
- }, []);
42
- const f = d((e) => e in r, [r]);
43
- return /* @__PURE__ */ v(C.Provider, {
44
- value: {
45
- hasPrivilege: f,
46
- privileges: r
47
- },
48
- children: a
49
- });
50
- }
51
- export {
52
- C as M,
53
- _ as a
54
- };
@@ -1,20 +0,0 @@
1
- import { createContext as n } from "react";
2
- import { jsx as s } from "react/jsx-runtime";
3
- import { a as l } from "../../hooks/useFlags/index.a986729d.js";
4
- const a = n(null);
5
- function m(e) {
6
- const {
7
- children: o,
8
- flags: t
9
- } = e, r = !l(t);
10
- return /* @__PURE__ */ s(a.Provider, {
11
- value: {
12
- isSkeleton: r
13
- },
14
- children: o
15
- });
16
- }
17
- export {
18
- a as M,
19
- m as a
20
- };
@@ -1,21 +0,0 @@
1
- import { useContext as f, useState as i, useEffect as u } from "react";
2
- import { F as l } from "../../contexts/FlagsContext/index.5f795859.js";
3
- const a = () => {
4
- const t = f(l);
5
- if (!t)
6
- throw new Error("useFlags context must be use inside FlagsProvider");
7
- return t;
8
- };
9
- function r(t, e) {
10
- return t.filter((s) => e.findIndex((o) => o === s) !== -1).length === t.length;
11
- }
12
- const x = (t) => {
13
- const e = a(), [n, s] = i(r(t, e.flags));
14
- return u(() => {
15
- r(t, e.flags) && s(!0);
16
- }, [e.flags, t]), n;
17
- };
18
- export {
19
- x as a,
20
- a as u
21
- };
@@ -1,3 +0,0 @@
1
- import type { Flag, FlagsContextProps } from '../../contexts/FlagsContext/types';
2
- export declare const useFlags: () => FlagsContextProps;
3
- export declare const useFlagsPresent: (compareFlags: Array<Flag>) => boolean;