@m4l/core 2.0.20-beta.1 → 2.0.21

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.
@@ -11,5 +11,5 @@ declare const FlagsContext: import('react').Context<(Omit<Omit<import('zustand')
11
11
  /**
12
12
  * Proveedor del contexto de banderas.
13
13
  */
14
- declare function FlagsProvider({ children }: FlagsProviderProps): import("react").JSX.Element;
14
+ declare function FlagsProvider({ children, storeId, storeDevtoolsEnabled }: FlagsProviderProps): import("react").JSX.Element;
15
15
  export { FlagsProvider, FlagsContext };
@@ -1,14 +1,15 @@
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 });
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { createContext as a, useRef as n } from "react";
3
+ import { c } from "./store.js";
4
+ const f = a(null);
5
+ function m({ children: e, storeId: t, storeDevtoolsEnabled: o }) {
6
+ const r = n();
7
+ return r.current || (r.current = c({
8
+ flags: [],
9
+ storeId: t
10
+ }, o)), /* @__PURE__ */ s(f.Provider, { value: r.current, children: e });
10
11
  }
11
12
  export {
12
- n as F,
13
- i as a
13
+ f as F,
14
+ m as a
14
15
  };
@@ -2,7 +2,7 @@ import { FlagsStateWithActions, FlagsStoreState } from './types';
2
2
  /**
3
3
  * Crea el store de banderas.
4
4
  */
5
- export declare const createFlagsStore: (initialState: FlagsStoreState) => Omit<Omit<import('zustand').StoreApi<FlagsStateWithActions>, "setState"> & {
5
+ export declare const createFlagsStore: (initialState: FlagsStoreState, storeDevtoolsEnabled?: boolean) => Omit<Omit<import('zustand').StoreApi<FlagsStateWithActions>, "setState"> & {
6
6
  setState<A extends string | {
7
7
  type: unknown;
8
8
  }>(partial: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: FlagsStateWithActions) => FlagsStateWithActions | Partial<FlagsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -1,33 +1,36 @@
1
- import { createStore as t } from "zustand";
1
+ import { createStore as n } from "zustand";
2
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,
3
+ import { immer as c } from "zustand/middleware/immer";
4
+ const d = (e, o) => {
5
+ const { enabled: r = !1 } = o;
6
+ return r && process.env.NODE_ENV === "development" ? f(e, o) : e;
7
+ }, v = (e, o = !1) => n(
8
+ d(
9
+ c((r) => ({
10
+ ...e,
8
11
  flagsActions: {
9
12
  /**
10
13
  * Limpia las banderas.
11
14
  */
12
15
  clearFlags: () => {
13
- r((o) => {
14
- o.flags = [];
16
+ r((s) => {
17
+ s.flags = [];
15
18
  });
16
19
  },
17
20
  /**
18
21
  * Agrega una bandera.
19
22
  */
20
- addFlag: (o) => {
23
+ addFlag: (s) => {
21
24
  r((a) => {
22
- const e = a.flags;
23
- e.findIndex((s) => s === o) < 0 && (a.flags = [...e, o]);
25
+ const t = a.flags;
26
+ t.findIndex((l) => l === s) < 0 && (a.flags = [...t, s]);
24
27
  });
25
28
  }
26
29
  }
27
30
  })),
28
- { name: "FlagsStore" }
31
+ { name: `FlagsStore: ${e.storeId}`, enabled: o }
29
32
  )
30
33
  );
31
34
  export {
32
- d as c
35
+ v as c
33
36
  };
@@ -1,14 +1,41 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface FlagsProviderProps {
3
+ /**
4
+ * "storeId" Id del store
5
+ */
6
+ storeId?: string;
7
+ /**
8
+ * "storeDevtoolsEnabled" Determina si se debe usar devtools para el store
9
+ */
10
+ storeDevtoolsEnabled?: boolean;
11
+ /**
12
+ * "children" Componentes hijos
13
+ */
3
14
  children: ReactNode;
4
15
  }
5
16
  export type Flag = string;
6
17
  export interface FlagsContextProps {
18
+ /**
19
+ * "flags" Banderas
20
+ */
7
21
  flags: Array<Flag>;
22
+ /**
23
+ * "clearFlags" Limpia las banderas
24
+ */
8
25
  clearFlags: () => void;
26
+ /**
27
+ * "addFlag" Agrega una bandera
28
+ */
9
29
  addFlag: (flag: Flag) => void;
10
30
  }
11
31
  export interface FlagsStoreState {
32
+ /**
33
+ * "storeId" Id del store
34
+ */
35
+ storeId?: string;
36
+ /**
37
+ * "flags" Banderas
38
+ */
12
39
  flags: Array<Flag>;
13
40
  }
14
41
  export interface FlagsStateWithActions extends FlagsStoreState {
package/index.d.ts CHANGED
@@ -4,4 +4,3 @@ export { EmmitEvents as EmitEvents, CommonFlags } from './types';
4
4
  export type { Maybe, HostToolsType, NetworkProps, EnvironmentType, AxiosOperation, EventListenerBase, EmmitEventsGuard, ToasterFunctionProps, Toaster, } from './types';
5
5
  export type { GetLabelType, Dictionary, ModuleDictionary, ComponentDictionary, } from './types/dictionary';
6
6
  export * from './utils';
7
- export * from './test';
package/index.js CHANGED
@@ -1,118 +1,84 @@
1
- import { C as s, E as n } from "./types/index.js";
2
- import { l as o } from "./not_recognized/index.js";
3
- import { c as m, s as u, u as x } from "./not_recognized/index.js";
4
- import { B as f, a as l } from "./contexts/BaseContext/BaseContext.js";
5
- import { E as d, a as v } from "./contexts/EnvironmentContext/index.js";
6
- import { H as P, a as F } from "./contexts/HostToolsContext/index.js";
7
- import { N as k, a as D } from "./contexts/NetworkContext/index.js";
8
- import { F as M, a as _ } from "./contexts/FlagsContext/index.js";
9
- import { D as S, a as E } from "./contexts/DomainContext/index.js";
10
- import { M as B, a as H } from "./contexts/ModuleDictionaryContext/index.js";
11
- import { M as A, a as L } from "./contexts/ModulePrivilegesContext/index.js";
12
- import { M as b, a as O } from "./contexts/ModuleSkeletonContext/index.js";
13
- import { D as W, a as j } from "./contexts/DomainCountryContext/index.js";
14
- import { A as z, a as G } from "./contexts/AuthContext/AuthContext.js";
15
- import { u as K } from "./hooks/useEnvironment/index.js";
16
- import { a as R, u as U } from "./hooks/useFlagsStore/index.js";
17
- import { u as X } from "./hooks/useHostTools/index.js";
18
- import { u as Z } from "./hooks/useDomain/index.js";
19
- import { u as oo } from "./hooks/useLocalStorage/index.js";
20
- import { u as ro } from "./hooks/useLocalStorageWithListener/index.js";
21
- import { u as ao } from "./hooks/useModuleDictionary/index.js";
22
- import { u as no } from "./hooks/useModulePrivileges/index.js";
23
- import { u as mo } from "./hooks/useModuleSkeleton/index.js";
24
- import { u as xo } from "./hooks/useNetwork/index.js";
25
- import { u as fo } from "./hooks/usePaginate/index.js";
26
- import { u as go } from "./hooks/usePropageteMF/index.js";
27
- import { u as co } from "./hooks/useDomainCountry/index.js";
28
- import { u as Fo } from "./hooks/useAuth/useAuth.js";
29
- import { i as ko } from "./hooks/usePaginate/types.js";
30
- import { a as To, u as Mo } from "./hooks/useBase/useBase.js";
31
- import { v as yo } from "./utils/voidFunction.js";
32
- import { g as Eo } from "./utils/getPropertyByString/index.js";
33
- import { e as Bo } from "./utils/evaluateWithContext/index.js";
34
- import { g as wo } from "./utils/getLocalStorage/index.js";
35
- import { s as Lo } from "./utils/setLocalStorage/index.js";
36
- import { a as bo } from "./utils/axiosOperation/index.js";
37
- import { h as qo, d as Wo, c as jo, e as Io, b as zo, g as Go, j as Jo, i as Ko, m as Qo, a as Ro, n as Uo, q as Vo, f as Xo, r as Yo } from "./test/constants.js";
38
- import { m as $o, b as oe, d as ee, c as re, a as te, e as ae, f as se } from "./test/mocks.js";
39
- import { c as ie } from "./test/utils.js";
40
- import { act as ue } from "react";
41
- const r = o.renderHook;
1
+ import { C as r, E as t } from "./types/index.js";
2
+ import { B as s, a as u } from "./contexts/BaseContext/BaseContext.js";
3
+ import { E as i, a as m } from "./contexts/EnvironmentContext/index.js";
4
+ import { H as p, a as f } from "./contexts/HostToolsContext/index.js";
5
+ import { N as d, a as v } from "./contexts/NetworkContext/index.js";
6
+ import { F as P, a as C } from "./contexts/FlagsContext/index.js";
7
+ import { D, a as S } from "./contexts/DomainContext/index.js";
8
+ import { M as y, a as F } from "./contexts/ModuleDictionaryContext/index.js";
9
+ import { M as k, a as B } from "./contexts/ModulePrivilegesContext/index.js";
10
+ import { M as L, a as A } from "./contexts/ModuleSkeletonContext/index.js";
11
+ import { D as N, a as w } from "./contexts/DomainCountryContext/index.js";
12
+ import { A as W, a as O } from "./contexts/AuthContext/AuthContext.js";
13
+ import { u as j } from "./hooks/useEnvironment/index.js";
14
+ import { a as z, u as G } from "./hooks/useFlagsStore/index.js";
15
+ import { u as J } from "./hooks/useHostTools/index.js";
16
+ import { u as Q } from "./hooks/useDomain/index.js";
17
+ import { u as U } from "./hooks/useLocalStorage/index.js";
18
+ import { u as X } from "./hooks/useLocalStorageWithListener/index.js";
19
+ import { u as Z } from "./hooks/useModuleDictionary/index.js";
20
+ import { u as $ } from "./hooks/useModulePrivileges/index.js";
21
+ import { u as eo } from "./hooks/useModuleSkeleton/index.js";
22
+ import { u as to } from "./hooks/useNetwork/index.js";
23
+ import { u as so } from "./hooks/usePaginate/index.js";
24
+ import { u as xo } from "./hooks/usePropageteMF/index.js";
25
+ import { u as mo } from "./hooks/useDomainCountry/index.js";
26
+ import { u as po } from "./hooks/useAuth/useAuth.js";
27
+ import { i as lo } from "./hooks/usePaginate/types.js";
28
+ import { a as go, u as Po } from "./hooks/useBase/useBase.js";
29
+ import { v as Mo } from "./utils/voidFunction.js";
30
+ import { g as So } from "./utils/getPropertyByString/index.js";
31
+ import { e as yo } from "./utils/evaluateWithContext/index.js";
32
+ import { g as Eo } from "./utils/getLocalStorage/index.js";
33
+ import { s as Bo } from "./utils/setLocalStorage/index.js";
34
+ import { a as Lo } from "./utils/axiosOperation/index.js";
42
35
  export {
43
- z as AuthContext,
44
- G as AuthProvider,
45
- f as BaseContext,
46
- l as BaseProvider,
47
- s as CommonFlags,
48
- S as DomainContext,
49
- W as DomainCountryContext,
50
- j as DomainCountryProvider,
51
- E as DomainProvider,
52
- n as EmitEvents,
53
- d as EnvironmentContext,
54
- v as EnvironmentProvider,
55
- M as FlagsContext,
56
- _ as FlagsProvider,
57
- P as HostToolsContext,
58
- F as HostToolsProvider,
59
- B as ModuleDictionaryContext,
60
- H as ModuleDictionaryProvider,
61
- A as ModulePrivilegesContext,
62
- L as ModulePrivilegesProvider,
63
- b as ModuleSkeletonContext,
64
- O as ModuleSkeletonProvider,
65
- k as NetworkContext,
66
- D as NetworkProvider,
67
- ue as act,
68
- bo as axiosOperation,
69
- qo as baseDataForTesting,
70
- m as cleanup,
71
- Wo as dictionaryDataForTesting,
72
- jo as domainCountry1DataForTesting,
73
- Io as domainCountry2DataForTesting,
74
- zo as domainDataForTesting,
75
- Go as environmentDataForTesting,
76
- Bo as evaluateWithContext,
77
- wo as getLocalStorage,
78
- Eo as getPropertyByString,
79
- Jo as hostToolsDataForTesting,
80
- ko as initialPagerState,
81
- $o as mock_addFlag,
82
- oe as mock_events_add_listener,
83
- ee as mock_events_emit,
84
- re as mock_events_remove_listener,
85
- te as mock_networkOperation,
86
- ae as mock_startProgress,
87
- se as mock_stopProgress,
88
- Ko as mock_toaster,
89
- Qo as moduleIdForTesting,
90
- Ro as moduleNameForTesting,
91
- Uo as networkPropsForTesting,
92
- Vo as queryPrivilegesForTesting,
93
- ie as render,
94
- r as renderHook,
95
- Xo as resultAxiosOperationForTesting,
96
- Yo as resultpPrivilegesForTesting,
97
- u as screen,
98
- Lo as setLocalStorage,
99
- Fo as useAuth,
100
- To as useBase,
101
- Mo as useBaseStore,
102
- Z as useDomain,
103
- co as useDomainCountry,
104
- K as useEnvironment,
105
- R as useFlagsPresent,
106
- U as useFlagsStore,
107
- X as useHostTools,
108
- oo as useLocalStorage,
109
- ro as useLocalStorageWithListener,
110
- ao as useModuleDictionary,
111
- no as useModulePrivileges,
112
- mo as useModuleSkeleton,
113
- xo as useNetwork,
114
- fo as usePaginate,
115
- go as usePropageteMF,
116
- x as userEvent,
117
- yo as voidFunction
36
+ W as AuthContext,
37
+ O as AuthProvider,
38
+ s as BaseContext,
39
+ u as BaseProvider,
40
+ r as CommonFlags,
41
+ D as DomainContext,
42
+ N as DomainCountryContext,
43
+ w as DomainCountryProvider,
44
+ S as DomainProvider,
45
+ t as EmitEvents,
46
+ i as EnvironmentContext,
47
+ m as EnvironmentProvider,
48
+ P as FlagsContext,
49
+ C as FlagsProvider,
50
+ p as HostToolsContext,
51
+ f as HostToolsProvider,
52
+ y as ModuleDictionaryContext,
53
+ F as ModuleDictionaryProvider,
54
+ k as ModulePrivilegesContext,
55
+ B as ModulePrivilegesProvider,
56
+ L as ModuleSkeletonContext,
57
+ A as ModuleSkeletonProvider,
58
+ d as NetworkContext,
59
+ v as NetworkProvider,
60
+ Lo as axiosOperation,
61
+ yo as evaluateWithContext,
62
+ Eo as getLocalStorage,
63
+ So as getPropertyByString,
64
+ lo as initialPagerState,
65
+ Bo as setLocalStorage,
66
+ po as useAuth,
67
+ go as useBase,
68
+ Po as useBaseStore,
69
+ Q as useDomain,
70
+ mo as useDomainCountry,
71
+ j as useEnvironment,
72
+ z as useFlagsPresent,
73
+ G as useFlagsStore,
74
+ J as useHostTools,
75
+ U as useLocalStorage,
76
+ X as useLocalStorageWithListener,
77
+ Z as useModuleDictionary,
78
+ $ as useModulePrivileges,
79
+ eo as useModuleSkeleton,
80
+ to as useNetwork,
81
+ so as usePaginate,
82
+ xo as usePropageteMF,
83
+ Mo as voidFunction
118
84
  };