@m4l/core 2.0.7 → 2.0.9-alpha.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 (68) hide show
  1. package/contexts/AuthContext/{index-Dmmn1GmI.js → AuthContext.js} +38 -37
  2. package/contexts/AuthContext/constants.js +4 -0
  3. package/contexts/AuthContext/index.js +1 -0
  4. package/contexts/AuthContext/types.d.ts +6 -6
  5. package/contexts/BaseContext/types.d.ts +1 -1
  6. package/contexts/DomainContext/{index-GtnXeXqv.js → index.js} +5 -5
  7. package/contexts/DomainContext/types.d.ts +1 -1
  8. package/contexts/DomainCountryContext/{index-i1cLdKpa.js → index.js} +3 -3
  9. package/contexts/EnvironmentContext/types.d.ts +1 -1
  10. package/contexts/FlagsContext/index.js +14 -0
  11. package/contexts/FlagsContext/store.d.ts +1 -1
  12. package/contexts/FlagsContext/store.js +27 -0
  13. package/contexts/FlagsContext/types.d.ts +1 -1
  14. package/contexts/HostToolsContext/types.d.ts +1 -1
  15. package/contexts/ModuleDictionaryContext/{index-B_ZNLNhp.js → index.js} +16 -14
  16. package/contexts/ModulePrivilegesContext/{index-Ccm23KLv.js → index.js} +4 -4
  17. package/contexts/ModuleSkeletonContext/{index-op94InUL.js → index.js} +1 -1
  18. package/contexts/NetworkContext/{index-BdJ5VM1I.js → index.js} +7 -7
  19. package/contexts/NetworkContext/types.d.ts +2 -2
  20. package/contexts/index.js +1 -0
  21. package/hooks/index.js +1 -0
  22. package/hooks/useAuth/index.js +1 -0
  23. package/hooks/useAuth/useAuth.js +11 -0
  24. package/hooks/useBase/index.js +11 -0
  25. package/hooks/useDomain/index.js +11 -0
  26. package/hooks/useDomainCountry/index.js +11 -0
  27. package/hooks/useEnvironment/index.js +11 -0
  28. package/hooks/useFlagsStore/index.js +20 -0
  29. package/hooks/useHostTools/index.js +11 -0
  30. package/hooks/useLocalStorage/index.js +23 -0
  31. package/hooks/useLocalStorageWithListener/index.d.ts +1 -1
  32. package/hooks/useLocalStorageWithListener/index.js +33 -0
  33. package/hooks/useModuleDictionary/{index-BUUV7OWG.js → index.js} +1 -1
  34. package/hooks/useModulePrivileges/{index-DCvSiJ_1.js → index.js} +1 -1
  35. package/hooks/useModuleSkeleton/{index-CGP_hVSJ.js → index.js} +1 -1
  36. package/hooks/useNetwork/index.js +11 -0
  37. package/hooks/usePaginate/{index-BTDulhEo.js → index.js} +23 -27
  38. package/hooks/usePaginate/types.js +8 -0
  39. package/hooks/usePropageteMF/{index-BqiRJLJL.js → index.js} +1 -1
  40. package/index.js +50 -43
  41. package/package.json +28 -13
  42. package/types/dictionary.d.ts +1 -1
  43. package/types/index.d.ts +12 -11
  44. package/utils/{axiosOperation-CEky_K0E.js → axiosOperation/index.js} +1 -1
  45. package/utils/axiosOperation/types.d.ts +2 -2
  46. package/utils/evaluateWithContext/index.js +11 -0
  47. package/utils/getLocalStorage/index.js +11 -0
  48. package/utils/getPropertyByString/index.d.ts +1 -1
  49. package/utils/getPropertyByString/index.js +26 -0
  50. package/utils/index.js +1 -0
  51. package/utils/setLocalStorage/index.js +16 -0
  52. package/utils/voidFunction.js +5 -0
  53. package/vite-env.d.ts +4 -4
  54. package/contexts/FlagsContext/index-B-2B4Igz.js +0 -36
  55. package/hooks/useAuth/index-nEcvoYpH.js +0 -10
  56. package/hooks/useBase/index-D-4p1Xgw.js +0 -10
  57. package/hooks/useDomain/index-KteEl45C.js +0 -17
  58. package/hooks/useEnvironment/index-AJ50P5z7.js +0 -10
  59. package/hooks/useFlagsStore/index-C0OfnwSn.js +0 -19
  60. package/hooks/useHostTools/index-B20cHM5K.js +0 -10
  61. package/hooks/useLocalStorage/index-CsLmjbAr.js +0 -53
  62. package/hooks/useNetwork/index-Dr3i8fXz.js +0 -10
  63. package/node_modules-C59GSzS1.js +0 -377
  64. package/utils/index-C67J5HEa.js +0 -61
  65. /package/contexts/BaseContext/{index-DNyrnDVT.js → index.js} +0 -0
  66. /package/contexts/EnvironmentContext/{index-Ba_eINub.js → index.js} +0 -0
  67. /package/contexts/HostToolsContext/{index-Djz-c1-2.js → index.js} +0 -0
  68. /package/types/{index-TbOJOhBX.js → index.js} +0 -0
@@ -1,17 +1,18 @@
1
- import { jsx as A } from "react/jsx-runtime";
2
- import { createContext as y, useReducer as E, useEffect as d } from "react";
3
- import { E as v } from "../../types/index-TbOJOhBX.js";
4
- import { u as D } from "../../hooks/useHostTools/index-B20cHM5K.js";
5
- import { u as N } from "../../hooks/useNetwork/index-Dr3i8fXz.js";
6
- import { u as O } from "../../hooks/useEnvironment/index-AJ50P5z7.js";
7
- import { u as S } from "../../hooks/useLocalStorage/index-CsLmjbAr.js";
8
- import { g as U, s as u } from "../../utils/index-C67J5HEa.js";
9
- var i = /* @__PURE__ */ ((e) => (e.Initial = "INITIALIZE", e.Login = "LOGIN", e.Logout = "LOGOUT", e))(i || {});
10
- const w = {
1
+ import { jsx as I } from "react/jsx-runtime";
2
+ import { createContext as A, useReducer as D, useEffect as d } from "react";
3
+ import { E as r } from "./constants.js";
4
+ import { E as L } from "../../types/index.js";
5
+ import { u as S } from "../../hooks/useHostTools/index.js";
6
+ import { u as v } from "../../hooks/useNetwork/index.js";
7
+ import { u as w } from "../../hooks/useEnvironment/index.js";
8
+ import { u as N } from "../../hooks/useLocalStorageWithListener/index.js";
9
+ import { g as U } from "../../utils/getLocalStorage/index.js";
10
+ import { s as u } from "../../utils/setLocalStorage/index.js";
11
+ const _ = {
11
12
  isAuthenticated: !1,
12
13
  isInitialized: !1,
13
14
  user: null
14
- }, _ = (e, t) => {
15
+ }, C = (e, t) => {
15
16
  switch (t.type) {
16
17
  case "INITIALIZE":
17
18
  return {
@@ -34,33 +35,33 @@ const w = {
34
35
  default:
35
36
  return e;
36
37
  }
37
- }, C = y(null);
38
+ }, O = A(null);
38
39
  function P(e) {
39
40
  e({
40
- type: i.Initial,
41
+ type: r.Initial,
41
42
  payload: {
42
43
  isAuthenticated: !1,
43
44
  user: null
44
45
  }
45
46
  });
46
47
  }
47
- function M(e) {
48
- const { children: t } = e, [m, o] = E(_, w), { events_add_listener: h } = D(), { networkOperation: r } = N(), { domain_token: f } = O(), [p, l] = S(
48
+ function j(e) {
49
+ const { children: t } = e, [m, i] = D(C, _), { events_add_listener: f } = S(), { networkOperation: o } = v(), { domain_token: p } = w(), [h, l] = N(
49
50
  // Variable para saber si ha cambiado la session en otro navegador
50
51
  "vSession",
51
52
  (/* @__PURE__ */ new Date()).getTime() + ""
52
53
  );
53
54
  d(() => {
54
55
  (async () => {
55
- r({
56
+ o({
56
57
  method: "GET",
57
58
  endPoint: "auth/login",
58
59
  parms: { user_data: !0 },
59
60
  checkUnAuthorized: !1,
60
61
  responseToCamelCase: !0
61
62
  }).then((s) => {
62
- o({
63
- type: i.Initial,
63
+ i({
64
+ type: r.Initial,
64
65
  payload: {
65
66
  isAuthenticated: !0,
66
67
  user: s.user
@@ -70,45 +71,45 @@ function M(e) {
70
71
  remember: !0
71
72
  })?.email !== s.user.email && u("userData", { email: s.user.email }, !0);
72
73
  }).catch(() => {
73
- P(o);
74
+ P(i);
74
75
  });
75
76
  })();
76
- }, [p]);
77
- const I = async (a, s, n) => {
78
- await r({
77
+ }, [o, h]);
78
+ const g = async (a, s, n) => {
79
+ await o({
79
80
  endPoint: "auth/login",
80
81
  method: "POST",
81
82
  data: {
82
83
  email: a,
83
84
  password: s,
84
- domain_token: f
85
+ domain_token: p
85
86
  },
86
87
  responseToCamelCase: !0
87
- }).then((T) => {
88
- const L = T.data;
89
- n ? u("userData", { email: a, remember: n }) : u("userData", { email: "", remember: n }), o({
90
- type: i.Login,
88
+ }).then((y) => {
89
+ const E = y.data;
90
+ n ? u("userData", { email: a, remember: n }) : u("userData", { email: "", remember: n }), i({
91
+ type: r.Login,
91
92
  payload: {
92
- user: L
93
+ user: E
93
94
  }
94
95
  }), l((/* @__PURE__ */ new Date()).getTime() + "");
95
96
  });
96
97
  }, c = async (a) => {
97
- a && await r({
98
+ a && await o({
98
99
  endPoint: "auth/logout",
99
100
  method: "POST"
100
- }), o({ type: i.Logout }), l((/* @__PURE__ */ new Date()).getTime() + "");
101
- }, g = () => {
101
+ }), i({ type: r.Logout }), l((/* @__PURE__ */ new Date()).getTime() + "");
102
+ }, T = () => {
102
103
  c(!1);
103
104
  };
104
105
  return d(function() {
105
- h(v.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, g);
106
- }, []), /* @__PURE__ */ A(
107
- C.Provider,
106
+ f(L.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, T);
107
+ }, []), /* @__PURE__ */ I(
108
+ O.Provider,
108
109
  {
109
110
  value: {
110
111
  ...m,
111
- login: I,
112
+ login: g,
112
113
  logout: c
113
114
  },
114
115
  children: t
@@ -116,6 +117,6 @@ function M(e) {
116
117
  );
117
118
  }
118
119
  export {
119
- C as A,
120
- M as a
120
+ O as A,
121
+ j as a
121
122
  };
@@ -0,0 +1,4 @@
1
+ var L = /* @__PURE__ */ ((I) => (I.Initial = "INITIALIZE", I.Login = "LOGIN", I.Logout = "LOGOUT", I))(L || {});
2
+ export {
3
+ L as E
4
+ };
@@ -0,0 +1 @@
1
+
@@ -15,11 +15,11 @@ export interface UserAuth {
15
15
  deviceLabel?: string;
16
16
  };
17
17
  }
18
- export declare type AuthUserType = Maybe<UserAuth>;
19
- export declare type AuthProviderProps = {
18
+ export type AuthUserType = Maybe<UserAuth>;
19
+ export type AuthProviderProps = {
20
20
  children: ReactNode;
21
21
  };
22
- export declare type ActionMap<M extends {
22
+ export type ActionMap<M extends {
23
23
  [index: string]: any;
24
24
  }> = {
25
25
  [Key in keyof M]: M[Key] extends undefined ? {
@@ -29,7 +29,7 @@ export declare type ActionMap<M extends {
29
29
  payload: M[Key];
30
30
  };
31
31
  };
32
- export declare type SessionAuthPayload = {
32
+ export type SessionAuthPayload = {
33
33
  [EnumTypes.Initial]: {
34
34
  isAuthenticated: boolean;
35
35
  user: AuthUserType;
@@ -39,8 +39,8 @@ export declare type SessionAuthPayload = {
39
39
  };
40
40
  [EnumTypes.Logout]: undefined;
41
41
  };
42
- export declare type SessionActions = ActionMap<SessionAuthPayload>[keyof ActionMap<SessionAuthPayload>];
43
- export declare type AuthState = {
42
+ export type SessionActions = ActionMap<SessionAuthPayload>[keyof ActionMap<SessionAuthPayload>];
43
+ export type AuthState = {
44
44
  isAuthenticated: boolean;
45
45
  isInitialized: boolean;
46
46
  user: Maybe<UserAuth>;
@@ -3,4 +3,4 @@ export interface BaseProviderProps<T> {
3
3
  value: T;
4
4
  children: ReactNode;
5
5
  }
6
- export declare type BaseContextProps<P> = Omit<BaseProviderProps<P>, 'children'>;
6
+ export type BaseContextProps<P> = Omit<BaseProviderProps<P>, 'children'>;
@@ -1,10 +1,10 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
2
  import { createContext as g, useState as d, useEffect as f } from "react";
3
- import { u as p } from "../../hooks/useFlagsStore/index-C0OfnwSn.js";
4
- import { u as D } from "../../hooks/useEnvironment/index-AJ50P5z7.js";
5
- import { u as v } from "../../hooks/useNetwork/index-Dr3i8fXz.js";
6
- import { C as l } from "../../types/index-TbOJOhBX.js";
7
- import { s as y } from "../../node_modules-C59GSzS1.js";
3
+ import { u as p } from "../../hooks/useFlagsStore/index.js";
4
+ import { u as D } from "../../hooks/useEnvironment/index.js";
5
+ import { u as v } from "../../hooks/useNetwork/index.js";
6
+ import { C as l } from "../../types/index.js";
7
+ import { shallow as y } from "zustand/shallow";
8
8
  const $ = g(null);
9
9
  function C(r) {
10
10
  const { children: e } = r, { domain_token: i, host_static_assets: o, environment_assets: n } = D(), t = p((s) => s.flagsActions.addFlag, y), [_, m] = d({
@@ -8,4 +8,4 @@ export interface Domain {
8
8
  export interface DomainProviderProps {
9
9
  children: ReactNode;
10
10
  }
11
- export declare type DomainContextProps = Domain;
11
+ export type DomainContextProps = Domain;
@@ -1,8 +1,8 @@
1
1
  import { jsx as d } from "react/jsx-runtime";
2
2
  import { createContext as y, useState as T, useCallback as f } from "react";
3
- import { E as r } from "../../types/index-TbOJOhBX.js";
4
- import { u as D } from "../../hooks/useHostTools/index-B20cHM5K.js";
5
- import { u as M } from "../../hooks/usePropageteMF/index-BqiRJLJL.js";
3
+ import { E as r } from "../../types/index.js";
4
+ import { u as D } from "../../hooks/useHostTools/index.js";
5
+ import { u as M } from "../../hooks/usePropageteMF/index.js";
6
6
  const N = y(null);
7
7
  function A(e) {
8
8
  const {
@@ -3,7 +3,7 @@ import { EnvironmentType } from '../../types';
3
3
  export interface EnvironmentProviderProps extends Omit<EnvironmentType, 'getMfUrlIconAsset'> {
4
4
  children: ReactNode;
5
5
  }
6
- export declare type EnvironmentContextType = EnvironmentType & {
6
+ export type EnvironmentContextType = EnvironmentType & {
7
7
  /**
8
8
  * "getModuleUrlIconAsset" función encargada de obtener la url de un recurso de un microfrontend
9
9
  * basado
@@ -0,0 +1,14 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { createContext as o, useRef as s } from "react";
3
+ import { c as a } from "./store.js";
4
+ const n = o(null);
5
+ function i({ children: e }) {
6
+ const r = s();
7
+ return r.current || (r.current = a({
8
+ flags: []
9
+ })), /* @__PURE__ */ t(n.Provider, { value: r.current, children: e });
10
+ }
11
+ export {
12
+ n as F,
13
+ i as a
14
+ };
@@ -8,4 +8,4 @@ export declare const createFlagsStore: (initialState: FlagsStoreState) => Omit<O
8
8
  type: unknown;
9
9
  } | undefined): void;
10
10
  };
11
- export declare type FlagsStore = ReturnType<typeof createFlagsStore>;
11
+ export type FlagsStore = ReturnType<typeof createFlagsStore>;
@@ -0,0 +1,27 @@
1
+ import { createStore as t } from "zustand";
2
+ import { devtools as f } from "zustand/middleware";
3
+ import { immer as m } from "zustand/middleware/immer";
4
+ const d = (l) => t(
5
+ f(
6
+ m((r) => ({
7
+ ...l,
8
+ flagsActions: {
9
+ clearFlags: () => {
10
+ r((o) => {
11
+ o.flags = [];
12
+ });
13
+ },
14
+ addFlag: (o) => {
15
+ r((a) => {
16
+ const e = a.flags;
17
+ e.findIndex((s) => s === o) < 0 && (a.flags = [...e, o]);
18
+ });
19
+ }
20
+ }
21
+ })),
22
+ { name: "FlagsStore" }
23
+ )
24
+ );
25
+ export {
26
+ d as c
27
+ };
@@ -2,7 +2,7 @@ import { ReactNode } from 'react';
2
2
  export interface FlagsProviderProps {
3
3
  children: ReactNode;
4
4
  }
5
- export declare type Flag = string;
5
+ export type Flag = string;
6
6
  export interface FlagsContextProps {
7
7
  flags: Array<Flag>;
8
8
  clearFlags: () => void;
@@ -3,4 +3,4 @@ import { HostToolsType } from '../../types';
3
3
  export interface HostToolsProviderProps extends HostToolsType {
4
4
  children: ReactNode;
5
5
  }
6
- export declare type HostToolsContextType = HostToolsType;
6
+ export type HostToolsContextType = HostToolsType;
@@ -1,11 +1,11 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import { createContext as L, useState as M, useEffect as N, useCallback as c } from "react";
3
- import { C as P } from "../../types/index-TbOJOhBX.js";
4
- import { u as _ } from "../../hooks/useFlagsStore/index-C0OfnwSn.js";
5
- import { u as $ } from "../../hooks/useEnvironment/index-AJ50P5z7.js";
6
- import { u as x } from "../../hooks/useHostTools/index-B20cHM5K.js";
7
- import { u as E } from "../../hooks/useNetwork/index-Dr3i8fXz.js";
8
- const b = L(null);
1
+ import { jsx as _ } from "react/jsx-runtime";
2
+ import { createContext as y, useState as L, useEffect as M, useCallback as c } from "react";
3
+ import { C as N } from "../../types/index.js";
4
+ import { u as P } from "../../hooks/useFlagsStore/index.js";
5
+ import { u as $ } from "../../hooks/useEnvironment/index.js";
6
+ import { u as x } from "../../hooks/useHostTools/index.js";
7
+ import { u as E } from "../../hooks/useNetwork/index.js";
8
+ const b = y(null);
9
9
  function j(m) {
10
10
  const {
11
11
  children: d,
@@ -14,8 +14,8 @@ function j(m) {
14
14
  moduleNameField: l = "module_name",
15
15
  currentLang: p = "en",
16
16
  isAuth: u = !0
17
- } = m, g = _((t) => t.flagsActions.addFlag), [r, h] = M(void 0), { domain_token: D } = $(), { startProgress: v, stopProgress: A } = x(), { networkOperation: C } = E();
18
- N(() => {
17
+ } = m, g = P((t) => t.flagsActions.addFlag), [r, h] = L(void 0), { domain_token: D } = $(), { startProgress: v, stopProgress: A } = x(), { networkOperation: C } = E();
18
+ M(() => {
19
19
  let t = !0;
20
20
  return v(), C({
21
21
  method: "GET",
@@ -29,7 +29,7 @@ function j(m) {
29
29
  }).then((e) => {
30
30
  t && (h({
31
31
  ...e
32
- }), g(P.FLAG_DICTIONARY_LOADED));
32
+ }), g(N.FLAG_DICTIONARY_LOADED));
33
33
  }).finally(() => {
34
34
  A();
35
35
  }), function() {
@@ -38,8 +38,10 @@ function j(m) {
38
38
  }, [p]);
39
39
  const s = c(
40
40
  (t, ...e) => {
41
- if (r === void 0) return "";
42
- if (t === "") return "No key";
41
+ if (r === void 0)
42
+ return "";
43
+ if (t === "")
44
+ return "No key";
43
45
  let o;
44
46
  const i = t.split(".");
45
47
  try {
@@ -53,7 +55,7 @@ function j(m) {
53
55
  },
54
56
  [r]
55
57
  ), F = c(() => s(l), [l, s]);
56
- return /* @__PURE__ */ y(
58
+ return /* @__PURE__ */ _(
57
59
  b.Provider,
58
60
  {
59
61
  value: {
@@ -1,9 +1,9 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
2
  import { createContext as d, useState as p, useEffect as P, useCallback as v } from "react";
3
- import { C as i } from "../../types/index-TbOJOhBX.js";
4
- import { u as E } from "../../hooks/useFlagsStore/index-C0OfnwSn.js";
5
- import { u as h } from "../../hooks/useHostTools/index-B20cHM5K.js";
6
- import { u as F } from "../../hooks/useNetwork/index-Dr3i8fXz.js";
3
+ import { C as i } from "../../types/index.js";
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
7
  const L = d(null);
8
8
  function S(n) {
9
9
  const { children: a, queryPrivileges: r } = n, o = E((e) => e.flagsActions.addFlag), [t, l] = p({}), { startProgress: u, stopProgress: m } = h(), { networkOperation: g } = F();
@@ -1,6 +1,6 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { createContext as s } from "react";
3
- import { a as l } from "../../hooks/useFlagsStore/index-C0OfnwSn.js";
3
+ import { a as l } from "../../hooks/useFlagsStore/index.js";
4
4
  const a = s(null);
5
5
  function m(e) {
6
6
  const { children: o, flags: t } = e, r = !l(t);
@@ -1,12 +1,12 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
2
  import { createContext as c, useCallback as m } from "react";
3
- import { u } from "../../hooks/useEnvironment/index-AJ50P5z7.js";
4
- import { u as l } from "../../hooks/useHostTools/index-B20cHM5K.js";
3
+ import { u } from "../../hooks/useEnvironment/index.js";
4
+ import { u as l } from "../../hooks/useHostTools/index.js";
5
5
  const p = c(null);
6
- function d(t) {
7
- const { children: r, axiosOperation: o } = t, n = u(), e = l(), s = m(
8
- async (a) => o(a, n, e),
9
- [o]
6
+ function d(n) {
7
+ const { children: e, axiosOperation: o } = n, t = u(), r = l(), s = m(
8
+ async (a) => o(a, t, r),
9
+ [t, o, r]
10
10
  );
11
11
  return /* @__PURE__ */ i(
12
12
  p.Provider,
@@ -14,7 +14,7 @@ function d(t) {
14
14
  value: {
15
15
  networkOperation: s
16
16
  },
17
- children: r
17
+ children: e
18
18
  }
19
19
  );
20
20
  }
@@ -1,6 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { AxiosOperation, NetworkProps } from '../../types';
3
- export declare type EventFunListener = (...args: any[]) => void;
3
+ export type EventFunListener = (...args: any[]) => void;
4
4
  export interface NetworkType {
5
5
  networkOperation: (props: NetworkProps) => Promise<any>;
6
6
  }
@@ -8,4 +8,4 @@ export interface NetworkProviderProps {
8
8
  axiosOperation: AxiosOperation;
9
9
  children: ReactNode;
10
10
  }
11
- export declare type NetworkContextType = NetworkType;
11
+ export type NetworkContextType = NetworkType;
@@ -0,0 +1 @@
1
+
package/hooks/index.js ADDED
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,11 @@
1
+ import { useContext as o } from "react";
2
+ import { A as e } from "../../contexts/AuthContext/AuthContext.js";
3
+ const n = () => {
4
+ const t = o(e);
5
+ if (!t)
6
+ throw new Error("Auth context must be use inside AuthProvider");
7
+ return t;
8
+ };
9
+ export {
10
+ n as u
11
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { B as o } from "../../contexts/BaseContext/index.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
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { D as e } from "../../contexts/DomainContext/index.js";
3
+ const s = () => {
4
+ const o = t(e);
5
+ if (!o)
6
+ throw new Error("useDomain context must be use inside DomainContext");
7
+ return o;
8
+ };
9
+ export {
10
+ s as u
11
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { D as n } from "../../contexts/DomainCountryContext/index.js";
3
+ const u = () => {
4
+ const o = t(n);
5
+ if (!o)
6
+ throw new Error("useDomainCountry context must be use inside DomainCountryContext");
7
+ return o;
8
+ };
9
+ export {
10
+ u
11
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { E as e } from "../../contexts/EnvironmentContext/index.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
+ };
@@ -0,0 +1,20 @@
1
+ import { useContext as o } from "react";
2
+ import { F as i } from "../../contexts/FlagsContext/index.js";
3
+ import { useStore as l } from "zustand";
4
+ import { shallow as u } from "zustand/shallow";
5
+ function a(t, s) {
6
+ const e = o(i);
7
+ if (!e)
8
+ throw new Error("useFlagsStore context must be use inside FlagsProvider");
9
+ return l(e, t, s);
10
+ }
11
+ function f(t, s) {
12
+ return t.filter(
13
+ (r) => s.findIndex((n) => n === r) !== -1
14
+ ).length === t.length;
15
+ }
16
+ const x = (t) => a((e) => f(t, e.flags), u);
17
+ export {
18
+ x as a,
19
+ a as u
20
+ };
@@ -0,0 +1,11 @@
1
+ import { useContext as t } from "react";
2
+ import { H as s } from "../../contexts/HostToolsContext/index.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
+ };
@@ -0,0 +1,23 @@
1
+ import { useState as c } from "react";
2
+ function S(o, e) {
3
+ const [r, s] = c(() => {
4
+ try {
5
+ const t = window.localStorage.getItem(o);
6
+ return t !== null ? typeof e == "string" ? t : JSON.parse(t) : e;
7
+ } catch {
8
+ return e;
9
+ }
10
+ });
11
+ return [r, (t) => {
12
+ try {
13
+ window.localStorage.setItem(
14
+ o,
15
+ typeof e == "string" ? String(t) : JSON.stringify(t)
16
+ ), s(t);
17
+ } catch {
18
+ }
19
+ }];
20
+ }
21
+ export {
22
+ S as u
23
+ };
@@ -1,3 +1,3 @@
1
- export declare type SetStateType<ValueType> = (newValue: ValueType) => void;
1
+ export type SetStateType<ValueType> = (newValue: ValueType) => void;
2
2
  export declare function useLocalStorageWithListener<ValueType>(key: string, initialValue: ValueType): [ValueType, SetStateType<ValueType>];
3
3
  export default useLocalStorageWithListener;
@@ -0,0 +1,33 @@
1
+ import { useState as a, useEffect as c } from "react";
2
+ function i(o, r) {
3
+ const [n, s] = a(() => {
4
+ try {
5
+ const t = localStorage.getItem(o);
6
+ return t !== null ? typeof r == "string" ? t : JSON.parse(t) : r;
7
+ } catch {
8
+ return r;
9
+ }
10
+ });
11
+ return c(() => {
12
+ const t = (e) => {
13
+ if (e.storageArea === localStorage && e.key === o)
14
+ try {
15
+ e.newValue && s(typeof r == "string" ? e.newValue : JSON.parse(e.newValue));
16
+ } catch {
17
+ }
18
+ };
19
+ return window.addEventListener("storage", t), () => {
20
+ window.removeEventListener("storage", t);
21
+ };
22
+ }, [o, r]), [n, (t) => {
23
+ let e;
24
+ if (typeof t == "function")
25
+ throw Error("Funcions are not allowed in useLocalStorageWithListener");
26
+ if (typeof t != typeof r)
27
+ throw Error("Not allowed change type from initial value");
28
+ typeof t == "string" ? e = t : e = JSON.stringify(t), localStorage.setItem(o, e), s(t);
29
+ }];
30
+ }
31
+ export {
32
+ i as u
33
+ };
@@ -1,5 +1,5 @@
1
1
  import { useContext as t } from "react";
2
- import { M as e } from "../../contexts/ModuleDictionaryContext/index-B_ZNLNhp.js";
2
+ import { M as e } from "../../contexts/ModuleDictionaryContext/index.js";
3
3
  const n = () => {
4
4
  const o = t(e);
5
5
  if (!o)
@@ -1,5 +1,5 @@
1
1
  import { useContext as o } from "react";
2
- import { M as t } from "../../contexts/ModulePrivilegesContext/index-Ccm23KLv.js";
2
+ import { M as t } from "../../contexts/ModulePrivilegesContext/index.js";
3
3
  const i = () => {
4
4
  const e = o(t);
5
5
  if (!e)
@@ -1,5 +1,5 @@
1
1
  import { useState as n, useContext as s, useEffect as u } from "react";
2
- import { M as r } from "../../contexts/ModuleSkeletonContext/index-op94InUL.js";
2
+ import { M as r } from "../../contexts/ModuleSkeletonContext/index.js";
3
3
  const S = () => {
4
4
  const [t, o] = n(!0), e = s(r);
5
5
  if (!e)
@@ -0,0 +1,11 @@
1
+ import { useContext as e } from "react";
2
+ import { N as o } from "../../contexts/NetworkContext/index.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
+ };