@m4l/core 0.1.24 → 0.1.25

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 (46) hide show
  1. package/contexts/DomainContext/index.d09ee435.js +45 -0
  2. package/contexts/DomainCountryContext/index.38c27388.js +42 -0
  3. package/contexts/EnvironmentContext/index.7045c64f.js +17 -0
  4. package/contexts/FlagsContext/index.5f795859.js +24 -0
  5. package/contexts/HostToolsContext/index.499db832.js +17 -0
  6. package/contexts/ModuleDictionaryContext/index.c7e01648.js +78 -0
  7. package/contexts/ModulePrivilegesContext/index.91ed5843.js +59 -0
  8. package/contexts/ModuleSkeletonContext/index.73a5f745.js +27 -0
  9. package/contexts/NetworkContext/index.d1dfbc3a.js +21 -0
  10. package/hooks/useDomain/index.7117ac32.js +18 -0
  11. package/hooks/useEnvironment/index.04dca988.js +11 -0
  12. package/hooks/useFlags/index.a986729d.js +21 -0
  13. package/hooks/useHostTools/index.66d9a667.js +11 -0
  14. package/hooks/useLocalStorage/index.281b7ae8.js +48 -0
  15. package/hooks/useModuleDictionary/index.5cabf2a3.js +11 -0
  16. package/hooks/useModulePrivileges/index.93343e3e.js +11 -0
  17. package/hooks/useModuleSkeleton/index.7df262f4.js +13 -0
  18. package/hooks/useNetwork/index.acbf28d5.js +11 -0
  19. package/hooks/usePaginate/index.7cb17527.js +58 -0
  20. package/index.js +63 -22
  21. package/package.json +1 -1
  22. package/types/index.5f1b0c45.js +5 -0
  23. package/utils/axiosOperation.6118a64a.js +49 -0
  24. package/utils/index.4b6999c8.js +34 -0
  25. package/contexts/DomainContext/index.js +0 -51
  26. package/contexts/DomainCountryContext/index.js +0 -52
  27. package/contexts/EnvironmentContext/index.js +0 -15
  28. package/contexts/FlagsContext/index.js +0 -28
  29. package/contexts/HostToolsContext/index.js +0 -15
  30. package/contexts/ModuleDictionaryContext/index.js +0 -94
  31. package/contexts/ModulePrivilegesContext/index.js +0 -67
  32. package/contexts/ModuleSkeletonContext/index.js +0 -25
  33. package/contexts/NetworkContext/index.js +0 -23
  34. package/hooks/useDomain/index.js +0 -16
  35. package/hooks/useEnvironment/index.js +0 -9
  36. package/hooks/useFlags/index.js +0 -23
  37. package/hooks/useHostTools/index.js +0 -9
  38. package/hooks/useLocalStorage/index.js +0 -54
  39. package/hooks/useModuleDictionary/index.js +0 -9
  40. package/hooks/useModulePrivileges/index.js +0 -9
  41. package/hooks/useModuleSkeleton/index.js +0 -9
  42. package/hooks/useNetwork/index.js +0 -9
  43. package/hooks/usePaginate/index.js +0 -85
  44. package/types/index.js +0 -13
  45. package/utils/axiosOperation.js +0 -95
  46. package/utils/index.js +0 -35
@@ -0,0 +1,49 @@
1
+ import f from "axios";
2
+ import p from "qs";
3
+ import { E } from "../types/index.5f1b0c45.js";
4
+ function l(e, s, a) {
5
+ const { toast: d } = a;
6
+ return s && s.data && typeof s.data == "object" ? s.data.error && s.data.error?.code && s.data.error?.msg !== void 0 ? Promise.reject({ ...s.data.error, status: s.status }) : (s.data.message && d(s.data.message, { type: "success", autoClose: 1e4 }), s.data) : Promise.reject({
7
+ code: 1,
8
+ msg: `Incorrect endpoint: ${e}`,
9
+ status: s.status
10
+ });
11
+ }
12
+ function _(e, s, a = !0) {
13
+ const { toast: d } = s;
14
+ let t = {
15
+ message: "",
16
+ status: 1,
17
+ code: 0
18
+ };
19
+ return e?.code !== void 0 && t.status !== void 0 && e.message !== void 0 && (t = { ...t, ...e }), e?.response ? e.response.data && typeof e.response.data == "object" && e.response.data.error && e.response.data.error?.code && e.response.data.error?.message !== void 0 ? t = { ...e.response.data.error, status: e.response.status } : (t.message = e.message, t.status = e.response.status, t.code = 0) : e?.request ? (t.message = `${e?.code} ${e.message}`, t.code = -1) : (t.message = `${e?.code} ${e.message}`, t.status = 0, t.code = -2), a && e?.response?.status === 401 && s.events_emit(E.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {}), e?.response?.data?.error?.message && (t.message = e?.response?.data?.error.message), a && d(`${t.message} - status: ${t.status} - code: ${t.code}`, { type: "error" }), t;
20
+ }
21
+ const P = async (e, s, a) => {
22
+ const {
23
+ method: d,
24
+ endPoint: t,
25
+ timeout: c = 5e3,
26
+ parms: u = {},
27
+ data: n = {},
28
+ isRemote: m = !0,
29
+ checkUnAuthorized: r = !0,
30
+ headers: g
31
+ } = e;
32
+ let i;
33
+ return m ? i = s.host_api_remote : i = s.host_api_local, a.startProgress(), f({
34
+ baseURL: i,
35
+ withCredentials: m,
36
+ method: d,
37
+ url: `/${t}`,
38
+ data: n,
39
+ params: {},
40
+ paramsSerializer: () => p.stringify(u, { encode: !0 }),
41
+ headers: g,
42
+ timeout: c
43
+ }).then((o) => l(t, o, a)).catch((o) => Promise.reject(_(o, a, r))).finally(() => {
44
+ a.stopProgress();
45
+ });
46
+ };
47
+ export {
48
+ P as a
49
+ };
@@ -0,0 +1,34 @@
1
+ import "axios";
2
+ import "qs";
3
+ function i() {
4
+ }
5
+ function c(r, n) {
6
+ let t = r;
7
+ const e = n.split(".");
8
+ for (let o = 0; o < e.length && t[e[o]] !== void 0; o += 1)
9
+ t = t[e[o]];
10
+ return t;
11
+ }
12
+ function s(r, n) {
13
+ try {
14
+ const t = window.localStorage.getItem(r);
15
+ return t !== null ? JSON.parse(t) : n;
16
+ } catch {
17
+ return n;
18
+ }
19
+ }
20
+ function g(r, n, t = !1) {
21
+ try {
22
+ let e = null;
23
+ t && (e = window.localStorage.getItem(r));
24
+ let o = e !== null ? JSON.parse(e) : {};
25
+ o = { ...o, ...n }, window.localStorage.setItem(r, JSON.stringify(o));
26
+ } catch {
27
+ }
28
+ }
29
+ export {
30
+ s as a,
31
+ c as g,
32
+ g as s,
33
+ i as v
34
+ };
@@ -1,51 +0,0 @@
1
- import { createContext, useState, useEffect } from "react";
2
- import { u as useFlags } from "../../hooks/useFlags/index.js";
3
- import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
4
- import { u as useNetwork } from "../../hooks/useNetwork/index.js";
5
- import { C as CommonFlags } from "../../types/index.js";
6
- import { jsx } from "react/jsx-runtime";
7
- const DomainContext = createContext(null);
8
- function DomainProvider(props) {
9
- const {
10
- children
11
- } = props;
12
- const {
13
- domain_token
14
- } = useEnvironment();
15
- const {
16
- addFlag
17
- } = useFlags();
18
- const [domain, setDomain] = useState({
19
- company_logo_small_url: "",
20
- company_logo_normal_url: "",
21
- name: ""
22
- });
23
- const {
24
- networkOperation
25
- } = useNetwork();
26
- useEffect(() => {
27
- let mounted = true;
28
- networkOperation({
29
- method: "GET",
30
- endPoint: `na/info/${domain_token}`
31
- }).then((response) => {
32
- if (mounted) {
33
- setDomain({
34
- ...response.data
35
- });
36
- addFlag(CommonFlags.FLAG_DOMAIN_LOADED);
37
- }
38
- }).finally(() => {
39
- });
40
- return function cleanUp() {
41
- mounted = false;
42
- };
43
- }, []);
44
- return /* @__PURE__ */ jsx(DomainContext.Provider, {
45
- value: {
46
- ...domain
47
- },
48
- children
49
- });
50
- }
51
- export { DomainContext as D, DomainProvider as a };
@@ -1,52 +0,0 @@
1
- import { createContext, useState, useCallback, useEffect } from "react";
2
- import "../EnvironmentContext/index.js";
3
- import "../FlagsContext/index.js";
4
- import { u as useHostTools } from "../../hooks/useHostTools/index.js";
5
- import "../DomainContext/index.js";
6
- import "../ModuleDictionaryContext/index.js";
7
- import "../ModulePrivilegesContext/index.js";
8
- import "../ModuleSkeletonContext/index.js";
9
- import "../NetworkContext/index.js";
10
- import { E as EmitEvents } from "../../types/index.js";
11
- import { jsx } from "react/jsx-runtime";
12
- const DomainCountryContext = createContext(null);
13
- function DomainCountryProvider(props) {
14
- const {
15
- children,
16
- isMicroFrontEnd,
17
- domainCountryId
18
- } = props;
19
- const {
20
- events_add_listener,
21
- events_remove_listener,
22
- events_emit
23
- } = useHostTools();
24
- const [finaDomainCountryId, setFinalDomainCountry] = useState(domainCountryId);
25
- const onUpdateDomainCountry = useCallback((newDomainCountryId) => {
26
- setFinalDomainCountry(newDomainCountryId);
27
- }, []);
28
- useEffect(() => {
29
- if (isMicroFrontEnd) {
30
- events_add_listener(EmitEvents.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, onUpdateDomainCountry);
31
- }
32
- return () => {
33
- if (isMicroFrontEnd) {
34
- events_remove_listener(EmitEvents.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, onUpdateDomainCountry);
35
- }
36
- };
37
- }, []);
38
- const changeDomainCountryId = useCallback((newDomainCountryId) => {
39
- if (!isMicroFrontEnd) {
40
- setFinalDomainCountry(newDomainCountryId);
41
- events_emit(EmitEvents.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, newDomainCountryId);
42
- }
43
- }, []);
44
- return /* @__PURE__ */ jsx(DomainCountryContext.Provider, {
45
- value: {
46
- domainCountryId: finaDomainCountryId,
47
- changeDomainCountryId
48
- },
49
- children
50
- });
51
- }
52
- export { DomainCountryContext as D, DomainCountryProvider as a };
@@ -1,15 +0,0 @@
1
- import { createContext, useState } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- const EnvironmentContext = createContext(null);
4
- function EnvironmentProvider(props) {
5
- const {
6
- children,
7
- ...other
8
- } = props;
9
- const [finalEnvironment] = useState(other);
10
- return /* @__PURE__ */ jsx(EnvironmentContext.Provider, {
11
- value: finalEnvironment,
12
- children
13
- });
14
- }
15
- export { EnvironmentContext as E, EnvironmentProvider as a };
@@ -1,28 +0,0 @@
1
- import { createContext, useState, useCallback } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- const FlagsContext = createContext(null);
4
- function FlagsProvider({
5
- children
6
- }) {
7
- const [flags, setFlags] = useState([]);
8
- const clearFlags = useCallback(() => {
9
- setFlags([]);
10
- }, []);
11
- const addFlag = useCallback((newFlag) => {
12
- setFlags((oldFlags) => {
13
- if (oldFlags.findIndex((f) => f === newFlag) < 0) {
14
- return [...oldFlags, newFlag];
15
- }
16
- return [...oldFlags];
17
- });
18
- }, []);
19
- return /* @__PURE__ */ jsx(FlagsContext.Provider, {
20
- value: {
21
- flags,
22
- addFlag,
23
- clearFlags
24
- },
25
- children
26
- });
27
- }
28
- export { FlagsContext as F, FlagsProvider as a };
@@ -1,15 +0,0 @@
1
- import { createContext, useState } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- const HostToolsContext = createContext(null);
4
- function HostToolsProvider(props) {
5
- const {
6
- children,
7
- ...hostTools
8
- } = props;
9
- const [finalTools] = useState(hostTools);
10
- return /* @__PURE__ */ jsx(HostToolsContext.Provider, {
11
- value: finalTools,
12
- children
13
- });
14
- }
15
- export { HostToolsContext as H, HostToolsProvider as a };
@@ -1,94 +0,0 @@
1
- import { createContext, useState, useEffect, useCallback } from "react";
2
- import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
3
- import { u as useFlags } from "../../hooks/useFlags/index.js";
4
- import { u as useHostTools } from "../../hooks/useHostTools/index.js";
5
- import "../DomainContext/index.js";
6
- import "../ModulePrivilegesContext/index.js";
7
- import "../ModuleSkeletonContext/index.js";
8
- import { u as useNetwork } from "../../hooks/useNetwork/index.js";
9
- import "../DomainCountryContext/index.js";
10
- import { C as CommonFlags } from "../../types/index.js";
11
- import { jsx } from "react/jsx-runtime";
12
- const ModuleDictionaryContext = createContext(null);
13
- function ModuleDictionaryProvider(props) {
14
- const {
15
- children,
16
- componentsDictionary,
17
- moduleId,
18
- moduleName = "module_name",
19
- currentLang = "en",
20
- isAuth = true
21
- } = props;
22
- const {
23
- addFlag
24
- } = useFlags();
25
- const [moduleDictionary, setModuleDictionary] = useState(void 0);
26
- const {
27
- domain_token
28
- } = useEnvironment();
29
- const {
30
- startProgress,
31
- stopProgress
32
- } = useHostTools();
33
- const {
34
- networkOperation
35
- } = useNetwork();
36
- useEffect(() => {
37
- let mounted = true;
38
- startProgress();
39
- networkOperation({
40
- method: "GET",
41
- endPoint: isAuth ? `dictionaries/${moduleId}` : `na/dictionaries/${moduleId}`,
42
- parms: {
43
- comps: componentsDictionary,
44
- ...isAuth ? {} : {
45
- domain_token,
46
- lang: currentLang
47
- }
48
- }
49
- }).then((response) => {
50
- if (mounted) {
51
- setModuleDictionary({
52
- ...response
53
- });
54
- addFlag(CommonFlags.FLAG_DICTIONARY_LOADED);
55
- }
56
- }).finally(() => {
57
- stopProgress();
58
- });
59
- return function cleanUp() {
60
- mounted = false;
61
- };
62
- }, [currentLang]);
63
- const getLabel = useCallback((key) => {
64
- if (moduleDictionary === void 0)
65
- return "";
66
- if (key === "")
67
- return "No key";
68
- let ret = void 0;
69
- const parts = key.split(".");
70
- try {
71
- if (parts.length === 1) {
72
- ret = moduleDictionary.data[key];
73
- }
74
- if (parts.length === 2) {
75
- ret = moduleDictionary[parts[0]][parts[1]];
76
- }
77
- } catch (error) {
78
- }
79
- if (ret) {
80
- return ret;
81
- }
82
- return `N_D:[${key}]`;
83
- }, [moduleDictionary]);
84
- const getModuleLabel = useCallback(() => getLabel(moduleName), [moduleName, getLabel]);
85
- return /* @__PURE__ */ jsx(ModuleDictionaryContext.Provider, {
86
- value: {
87
- moduleDictionary,
88
- getLabel,
89
- getModuleLabel
90
- },
91
- children
92
- });
93
- }
94
- export { ModuleDictionaryContext as M, ModuleDictionaryProvider as a };
@@ -1,67 +0,0 @@
1
- import { createContext, useState, useEffect, useCallback } from "react";
2
- import "../EnvironmentContext/index.js";
3
- import { u as useFlags } from "../../hooks/useFlags/index.js";
4
- import { u as useHostTools } from "../../hooks/useHostTools/index.js";
5
- import "../DomainContext/index.js";
6
- import "../ModuleDictionaryContext/index.js";
7
- import "../ModuleSkeletonContext/index.js";
8
- import { u as useNetwork } from "../../hooks/useNetwork/index.js";
9
- import "../DomainCountryContext/index.js";
10
- import { C as CommonFlags } from "../../types/index.js";
11
- import { jsx } from "react/jsx-runtime";
12
- const ModulePrivilegesContext = createContext(null);
13
- function ModulePrivilegesProvider(props) {
14
- const {
15
- children,
16
- queryPrivileges
17
- } = props;
18
- const {
19
- addFlag
20
- } = useFlags();
21
- const [privileges, setPrivileges] = useState({});
22
- const {
23
- startProgress,
24
- stopProgress
25
- } = useHostTools();
26
- const {
27
- networkOperation
28
- } = useNetwork();
29
- useEffect(() => {
30
- let mounted = true;
31
- if (queryPrivileges.length === 0) {
32
- addFlag(CommonFlags.FLAG_PRIVILEGES_LOADED);
33
- return;
34
- }
35
- startProgress();
36
- networkOperation({
37
- method: "GET",
38
- endPoint: `auth/login`,
39
- parms: {
40
- privileges: queryPrivileges
41
- }
42
- }).then((response) => {
43
- if (mounted) {
44
- setPrivileges({
45
- ...response.data
46
- });
47
- addFlag(CommonFlags.FLAG_PRIVILEGES_LOADED);
48
- }
49
- }).finally(() => {
50
- stopProgress();
51
- });
52
- return function cleanUp() {
53
- mounted = false;
54
- };
55
- }, []);
56
- const hasPrivilege = useCallback((key) => {
57
- return key in privileges;
58
- }, [privileges]);
59
- return /* @__PURE__ */ jsx(ModulePrivilegesContext.Provider, {
60
- value: {
61
- hasPrivilege,
62
- privileges
63
- },
64
- children
65
- });
66
- }
67
- export { ModulePrivilegesContext as M, ModulePrivilegesProvider as a };
@@ -1,25 +0,0 @@
1
- import { createContext } from "react";
2
- import "../EnvironmentContext/index.js";
3
- import { a as useFlagsPresent } from "../../hooks/useFlags/index.js";
4
- import "../HostToolsContext/index.js";
5
- import "../DomainContext/index.js";
6
- import "../ModuleDictionaryContext/index.js";
7
- import "../ModulePrivilegesContext/index.js";
8
- import "../NetworkContext/index.js";
9
- import "../DomainCountryContext/index.js";
10
- import { jsx } from "react/jsx-runtime";
11
- const ModuleSkeletonContext = createContext(null);
12
- function ModuleSkeletonProvider(props) {
13
- const {
14
- children,
15
- flags
16
- } = props;
17
- const isSkeleton = !useFlagsPresent(flags);
18
- return /* @__PURE__ */ jsx(ModuleSkeletonContext.Provider, {
19
- value: {
20
- isSkeleton
21
- },
22
- children
23
- });
24
- }
25
- export { ModuleSkeletonContext as M, ModuleSkeletonProvider as a };
@@ -1,23 +0,0 @@
1
- import { createContext, useCallback } from "react";
2
- import { u as useEnvironment } from "../../hooks/useEnvironment/index.js";
3
- import { u as useHostTools } from "../../hooks/useHostTools/index.js";
4
- import { jsx } from "react/jsx-runtime";
5
- const NetworkContext = createContext(null);
6
- function NetworkProvider(props) {
7
- const {
8
- children,
9
- axiosOperation
10
- } = props;
11
- const environment = useEnvironment();
12
- const hostTools = useHostTools();
13
- const networkOperation = useCallback(async (networkProps) => {
14
- return axiosOperation(networkProps, environment, hostTools);
15
- }, [axiosOperation]);
16
- return /* @__PURE__ */ jsx(NetworkContext.Provider, {
17
- value: {
18
- networkOperation
19
- },
20
- children
21
- });
22
- }
23
- export { NetworkContext as N, NetworkProvider as a };
@@ -1,16 +0,0 @@
1
- import { useContext } from "react";
2
- import { D as DomainContext } from "../../contexts/DomainContext/index.js";
3
- import { D as DomainCountryContext } from "../../contexts/DomainCountryContext/index.js";
4
- const useDomain = () => {
5
- const context = useContext(DomainContext);
6
- if (!context)
7
- throw new Error("useDomain context must be use inside DomainContext");
8
- return context;
9
- };
10
- const useDomainCountry = () => {
11
- const context = useContext(DomainCountryContext);
12
- if (!context)
13
- throw new Error("useDomainCountry context must be use inside DomainCountryContext");
14
- return context;
15
- };
16
- export { useDomainCountry as a, useDomain as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { E as EnvironmentContext } from "../../contexts/EnvironmentContext/index.js";
3
- const useEnvironment = () => {
4
- const context = useContext(EnvironmentContext);
5
- if (!context)
6
- throw new Error("useEnvironment context must be use inside EnvironmentContext");
7
- return context;
8
- };
9
- export { useEnvironment as u };
@@ -1,23 +0,0 @@
1
- import { useContext, useState, useEffect } from "react";
2
- import { F as FlagsContext } from "../../contexts/FlagsContext/index.js";
3
- const useFlags = () => {
4
- const context = useContext(FlagsContext);
5
- if (!context)
6
- throw new Error("useFlags context must be use inside FlagsProvider");
7
- return context;
8
- };
9
- function isFlagsPresent(compareFlags, flags) {
10
- const filterFlags = compareFlags.filter((findFlag) => flags.findIndex((sFlag) => sFlag === findFlag) !== -1);
11
- return filterFlags.length === compareFlags.length;
12
- }
13
- const useFlagsPresent = (compareFlags) => {
14
- const context = useFlags();
15
- const [isPresent, setIsPresent] = useState(isFlagsPresent(compareFlags, context.flags));
16
- useEffect(() => {
17
- if (isFlagsPresent(compareFlags, context.flags)) {
18
- setIsPresent(true);
19
- }
20
- }, [context.flags, compareFlags]);
21
- return isPresent;
22
- };
23
- export { useFlagsPresent as a, useFlags as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { H as HostToolsContext } from "../../contexts/HostToolsContext/index.js";
3
- const useHostTools = () => {
4
- const context = useContext(HostToolsContext);
5
- if (!context)
6
- throw new Error("useHostTools context must be use inside HostToolsContext");
7
- return context;
8
- };
9
- export { useHostTools as u };
@@ -1,54 +0,0 @@
1
- import { useState, useEffect } from "react";
2
- function useLocalStorage(key, initialValue) {
3
- const [value, setValue] = useState(() => {
4
- try {
5
- const item = window.localStorage.getItem(key);
6
- return item !== null ? JSON.parse(item) : initialValue;
7
- } catch (e) {
8
- return initialValue;
9
- }
10
- });
11
- const setValueInLocalStorage = (newValue) => {
12
- try {
13
- window.localStorage.setItem(key, JSON.stringify(newValue));
14
- setValue(newValue);
15
- } catch (e) {
16
- }
17
- };
18
- return [value, setValueInLocalStorage];
19
- }
20
- function useLocalStorageWithListener(key, defaultValue) {
21
- const [value, setValue] = useState(() => {
22
- try {
23
- const storedValue = localStorage.getItem(key);
24
- return storedValue === null ? defaultValue : JSON.parse(storedValue);
25
- } catch (e) {
26
- return defaultValue;
27
- }
28
- });
29
- useEffect(() => {
30
- const listener = (e) => {
31
- if (e.storageArea === localStorage && e.key === key) {
32
- try {
33
- if (e.newValue) {
34
- setValue(JSON.parse(e.newValue));
35
- }
36
- } catch (_e) {
37
- }
38
- }
39
- };
40
- window.addEventListener("storage", listener);
41
- return () => {
42
- window.removeEventListener("storage", listener);
43
- };
44
- }, [key, defaultValue]);
45
- const setValueInLocalStorage = (newValue) => {
46
- setValue((currentValue) => {
47
- const result = typeof newValue === "function" ? newValue(currentValue) : newValue;
48
- localStorage.setItem(key, JSON.stringify(result));
49
- return result;
50
- });
51
- };
52
- return [value, setValueInLocalStorage];
53
- }
54
- export { useLocalStorageWithListener as a, useLocalStorage as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { M as ModuleDictionaryContext } from "../../contexts/ModuleDictionaryContext/index.js";
3
- const useModuleDictionary = () => {
4
- const context = useContext(ModuleDictionaryContext);
5
- if (!context)
6
- throw new Error("useModuleDictionary context must be use inside ModuleDictionaryProvider");
7
- return context;
8
- };
9
- export { useModuleDictionary as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { M as ModulePrivilegesContext } from "../../contexts/ModulePrivilegesContext/index.js";
3
- const useModulePrivileges = () => {
4
- const context = useContext(ModulePrivilegesContext);
5
- if (!context)
6
- throw new Error("useModulePrivileges context must be use inside ModulePrivilegesContext");
7
- return context;
8
- };
9
- export { useModulePrivileges as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { M as ModuleSkeletonContext } from "../../contexts/ModuleSkeletonContext/index.js";
3
- const useModuleSkeleton = () => {
4
- const context = useContext(ModuleSkeletonContext);
5
- if (!context)
6
- throw new Error("useModuleSkeleton context must be use inside ModuleSkeletonContext");
7
- return context.isSkeleton;
8
- };
9
- export { useModuleSkeleton as u };
@@ -1,9 +0,0 @@
1
- import { useContext } from "react";
2
- import { N as NetworkContext } from "../../contexts/NetworkContext/index.js";
3
- const useNetwork = () => {
4
- const context = useContext(NetworkContext);
5
- if (!context)
6
- throw new Error("useNetwork context must be use inside NetworkContext");
7
- return context;
8
- };
9
- export { useNetwork as u };