@m4l/core 2.0.9-alpha.0 → 2.0.9
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.
- package/contexts/AuthContext/AuthContext.d.ts +9 -2
- package/contexts/AuthContext/AuthContext.test.d.ts +1 -0
- package/contexts/AuthContext/types.d.ts +3 -3
- package/contexts/BaseContext/index.d.ts +8 -1
- package/contexts/BaseContext/index.test.d.ts +1 -0
- package/contexts/DomainContext/index.d.ts +8 -1
- package/contexts/DomainContext/index.test.d.ts +1 -0
- package/contexts/DomainCountryContext/index.d.ts +8 -1
- package/contexts/DomainCountryContext/index.test.d.ts +1 -0
- package/contexts/EnvironmentContext/index.d.ts +8 -1
- package/contexts/EnvironmentContext/index.test.d.ts +1 -0
- package/contexts/FlagsContext/index.d.ts +10 -3
- package/contexts/FlagsContext/index.test.d.ts +1 -0
- package/contexts/FlagsContext/store.d.ts +9 -2
- package/contexts/FlagsContext/store.js +14 -0
- package/contexts/HostToolsContext/index.d.ts +9 -2
- package/contexts/HostToolsContext/index.test.d.ts +1 -0
- package/contexts/ModuleDictionaryContext/index.d.ts +8 -1
- package/contexts/ModuleDictionaryContext/index.test.d.ts +1 -0
- package/contexts/ModuleDictionaryContext/types.d.ts +1 -1
- package/contexts/ModulePrivilegesContext/index.d.ts +8 -1
- package/contexts/ModulePrivilegesContext/index.test.d.ts +1 -0
- package/contexts/ModuleSkeletonContext/index.d.ts +8 -1
- package/contexts/ModuleSkeletonContext/index.test.d.ts +1 -0
- package/contexts/NetworkContext/index.d.ts +9 -2
- package/contexts/NetworkContext/index.test.d.ts +1 -0
- package/hooks/useAuth/useAuth.d.ts +8 -1
- package/hooks/useAuth/useAuth.test.d.ts +1 -0
- package/hooks/useBase/index.d.ts +7 -0
- package/hooks/useBase/index.test.d.ts +1 -0
- package/hooks/useDomain/index.d.ts +8 -1
- package/hooks/useDomain/index.test.d.ts +1 -0
- package/hooks/useDomainCountry/index.d.ts +8 -1
- package/hooks/useDomainCountry/index.test.d.ts +1 -0
- package/hooks/useEnvironment/index.d.ts +7 -0
- package/hooks/useEnvironment/index.test.d.ts +1 -0
- package/hooks/useFlagsStore/index.d.ts +15 -1
- package/hooks/useFlagsStore/index.test.d.ts +1 -0
- package/hooks/useHostTools/index.d.ts +8 -1
- package/hooks/useHostTools/index.test.d.ts +1 -0
- package/hooks/useLocalStorage/index.d.ts +7 -0
- package/hooks/useLocalStorage/index.test.d.ts +1 -0
- package/hooks/useLocalStorageWithListener/index.d.ts +8 -0
- package/hooks/useLocalStorageWithListener/index.test.d.ts +1 -0
- package/hooks/useModuleDictionary/index.d.ts +8 -1
- package/hooks/useModuleDictionary/index.test.d.ts +1 -0
- package/hooks/useModulePrivileges/index.d.ts +8 -1
- package/hooks/useModulePrivileges/index.test.d.ts +1 -0
- package/hooks/useModuleSkeleton/index.d.ts +7 -0
- package/hooks/useModuleSkeleton/index.test.d.ts +1 -0
- package/hooks/useNetwork/index.d.ts +8 -1
- package/hooks/useNetwork/index.test.d.ts +1 -0
- package/hooks/usePaginate/index.d.ts +5 -3
- package/hooks/usePaginate/index.test.d.ts +1 -0
- package/hooks/usePropageteMF/index.d.ts +7 -0
- package/package.json +39 -11
- package/test/constants.d.ts +89 -0
- package/test/mocks.d.ts +7 -0
- package/test/setup.d.ts +0 -0
- package/test/types.d.ts +4 -0
- package/test/utils.d.ts +13 -0
- package/types/index.d.ts +3 -3
- package/utils/axiosOperation/index.d.ts +8 -1
- package/utils/axiosOperation/index.js +7 -0
- package/utils/axiosOperation/index.test.d.ts +1 -0
- package/utils/getLocalStorage/index.d.ts +7 -0
- package/utils/getLocalStorage/index.test.d.ts +1 -0
- package/utils/getPropertyByString/index.d.ts +7 -0
- package/utils/getPropertyByString/index.test.d.ts +1 -0
- package/utils/setLocalStorage/index.d.ts +7 -0
- package/utils/setLocalStorage/index.test.d.ts +1 -0
- package/utils/voidFunction.d.ts +7 -0
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AuthProviderProps, SessionContextType } from './types';
|
|
3
3
|
declare const AuthContext: React.Context<SessionContextType | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Proveedor de autenticación
|
|
6
|
+
* @author Juan Escobar - automatic
|
|
7
|
+
* @createdAt 2024-10-04 18:38:38 - automatic
|
|
8
|
+
* @updatedAt 2024-10-04 18:38:38 - automatic
|
|
9
|
+
* @updatedUser Juan Escobar - automatic
|
|
10
|
+
*/
|
|
4
11
|
declare function AuthProvider(props: AuthProviderProps): React.JSX.Element;
|
|
5
12
|
export { AuthContext, AuthProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DomainCountry } from '../DomainCountryContext/types';
|
|
3
|
+
import { Maybe } from '../../types';
|
|
4
4
|
import { EnumTypes } from './constants';
|
|
5
5
|
export interface UserAuth {
|
|
6
6
|
email: string;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { BaseProviderProps } from './types';
|
|
2
|
-
declare const BaseContext: import(
|
|
2
|
+
declare const BaseContext: import('react').Context<unknown>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor base para los contextos.
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:39:38 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:39:38 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function BaseProvider<T>(props: BaseProviderProps<T>): import("react").JSX.Element;
|
|
4
11
|
export { BaseProvider, BaseContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { DomainProviderProps, Domain } from './types';
|
|
2
|
-
declare const DomainContext: import(
|
|
2
|
+
declare const DomainContext: import('react').Context<Domain | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor del contexto de dominio.
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:41:02 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:41:02 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function DomainProvider(props: DomainProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { DomainProvider, DomainContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { DomainCountryContextType, DomainCountryProviderProps } from './types';
|
|
2
|
-
declare const DomainCountryContext: import(
|
|
2
|
+
declare const DomainCountryContext: import('react').Context<DomainCountryContextType | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor del contexto de país de dominio.
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function DomainCountryProvider(props: DomainCountryProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { DomainCountryProvider, DomainCountryContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mock_useEffect: import('vitest').Mock<(...args: any[]) => any>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { EnvironmentContextType, EnvironmentProviderProps } from './types';
|
|
2
|
-
declare const EnvironmentContext: import(
|
|
2
|
+
declare const EnvironmentContext: import('react').Context<EnvironmentContextType | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor del contexto de entorno.
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function EnvironmentProvider(props: EnvironmentProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { EnvironmentProvider, EnvironmentContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import { FlagsProviderProps } from './types';
|
|
2
|
-
declare const FlagsContext: import(
|
|
2
|
+
declare const FlagsContext: import('react').Context<(Omit<Omit<import('zustand').StoreApi<import('./types').FlagsStateWithActions>, "setState"> & {
|
|
3
3
|
setState<A extends string | {
|
|
4
4
|
type: unknown;
|
|
5
|
-
}>(partial: import(
|
|
5
|
+
}>(partial: import('./types').FlagsStateWithActions | Partial<import('./types').FlagsStateWithActions> | ((state: import('./types').FlagsStateWithActions) => import('./types').FlagsStateWithActions | Partial<import('./types').FlagsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
6
|
}, "setState"> & {
|
|
7
|
-
setState(nextStateOrUpdater: import(
|
|
7
|
+
setState(nextStateOrUpdater: import('./types').FlagsStateWithActions | Partial<import('./types').FlagsStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<import('./types').FlagsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
8
8
|
type: unknown;
|
|
9
9
|
} | undefined): void;
|
|
10
10
|
}) | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Proveedor del contexto de banderas.
|
|
13
|
+
* @author Juan Escobar - automatic
|
|
14
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
15
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
16
|
+
* @updatedUser Juan Escobar - automatic
|
|
17
|
+
*/
|
|
11
18
|
declare function FlagsProvider({ children }: FlagsProviderProps): import("react").JSX.Element;
|
|
12
19
|
export { FlagsProvider, FlagsContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { FlagsStateWithActions, FlagsStoreState } from './types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Crea el store de banderas.
|
|
4
|
+
* @author Juan Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
6
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
7
|
+
* @updatedUser Juan Escobar - automatic
|
|
8
|
+
*/
|
|
9
|
+
export declare const createFlagsStore: (initialState: FlagsStoreState) => Omit<Omit<import('zustand').StoreApi<FlagsStateWithActions>, "setState"> & {
|
|
3
10
|
setState<A extends string | {
|
|
4
11
|
type: unknown;
|
|
5
12
|
}>(partial: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: FlagsStateWithActions) => FlagsStateWithActions | Partial<FlagsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
13
|
}, "setState"> & {
|
|
7
|
-
setState(nextStateOrUpdater: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: import(
|
|
14
|
+
setState(nextStateOrUpdater: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: import('immer/dist/internal').WritableDraft<FlagsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
8
15
|
type: unknown;
|
|
9
16
|
} | undefined): void;
|
|
10
17
|
};
|
|
@@ -6,11 +6,25 @@ const d = (l) => t(
|
|
|
6
6
|
m((r) => ({
|
|
7
7
|
...l,
|
|
8
8
|
flagsActions: {
|
|
9
|
+
/**
|
|
10
|
+
* Limpia las banderas.
|
|
11
|
+
* @author Juan Escobar - automatic
|
|
12
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
13
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
14
|
+
* @updatedUser Juan Escobar - automatic
|
|
15
|
+
*/
|
|
9
16
|
clearFlags: () => {
|
|
10
17
|
r((o) => {
|
|
11
18
|
o.flags = [];
|
|
12
19
|
});
|
|
13
20
|
},
|
|
21
|
+
/**
|
|
22
|
+
* Agrega una bandera.
|
|
23
|
+
* @author Juan Escobar - automatic
|
|
24
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
25
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
26
|
+
* @updatedUser Juan Escobar - automatic
|
|
27
|
+
*/
|
|
14
28
|
addFlag: (o) => {
|
|
15
29
|
r((a) => {
|
|
16
30
|
const e = a.flags;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { HostToolsType } from '../../types';
|
|
2
|
-
import
|
|
3
|
-
declare const HostToolsContext: import(
|
|
2
|
+
import { HostToolsProviderProps } from './types';
|
|
3
|
+
declare const HostToolsContext: import('react').Context<HostToolsType | null>;
|
|
4
|
+
/**
|
|
5
|
+
* Proveedor de contexto de herramientas del host
|
|
6
|
+
* @author Juan Escobar - automatic
|
|
7
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
8
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
9
|
+
* @updatedUser Juan Escobar - automatic
|
|
10
|
+
*/
|
|
4
11
|
declare function HostToolsProvider(props: HostToolsProviderProps): import("react").JSX.Element;
|
|
5
12
|
export { HostToolsProvider, HostToolsContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ModuleDictionaryContextProps, ModuleDictionaryProviderProps } from './types';
|
|
2
|
-
declare const ModuleDictionaryContext: import(
|
|
2
|
+
declare const ModuleDictionaryContext: import('react').Context<ModuleDictionaryContextProps | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor de contexto de diccionario de módulo
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function ModuleDictionaryProvider(props: ModuleDictionaryProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { ModuleDictionaryProvider, ModuleDictionaryContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { GetLabelType, ModuleDictionary } from '../../types/dictionary';
|
|
3
3
|
export interface ModuleDictionaryProviderProps {
|
|
4
4
|
currentLang?: string;
|
|
5
5
|
isAuth?: boolean;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ModulePrivilegesContextProps, ModulePrivilegesProviderProps } from './types';
|
|
2
|
-
declare const ModulePrivilegesContext: import(
|
|
2
|
+
declare const ModulePrivilegesContext: import('react').Context<ModulePrivilegesContextProps | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor de contexto de privilegios
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function ModulePrivilegesProvider(props: ModulePrivilegesProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { ModulePrivilegesProvider, ModulePrivilegesContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { ModuleSkeletonContextProps, ModuleSkeletonProviderProps } from './types';
|
|
2
|
-
declare const ModuleSkeletonContext: import(
|
|
2
|
+
declare const ModuleSkeletonContext: import('react').Context<ModuleSkeletonContextProps | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor de contexto de esqueleto de módulo
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function ModuleSkeletonProvider(props: ModuleSkeletonProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { ModuleSkeletonProvider, ModuleSkeletonContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mockUseFlagsPresent: jest.Mock;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare const NetworkContext: import(
|
|
1
|
+
import { NetworkProviderProps } from './types';
|
|
2
|
+
declare const NetworkContext: import('react').Context<import('./types').NetworkType | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Proveedor de contexto de red
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
declare function NetworkProvider(props: NetworkProviderProps): import("react").JSX.Element;
|
|
4
11
|
export { NetworkProvider, NetworkContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto de autenticación
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useAuth: () => import('../../contexts/AuthContext/types').SessionContextType;
|
|
2
9
|
export default useAuth;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/hooks/useBase/index.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto base
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
1
8
|
export declare function useBase<T>(): T;
|
|
2
9
|
export default useBase;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto del dominio
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useDomain: () => import('../../contexts/DomainContext/types').Domain;
|
|
2
9
|
export default useDomain;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto del pais del dominio
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useDomainCountry: () => import('../..').DomainCountryContextType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { EnvironmentContextType } from '../../contexts/EnvironmentContext/types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para obtener el contexto del ambiente
|
|
4
|
+
* @author Juan Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
6
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
7
|
+
* @updatedUser Juan Escobar - automatic
|
|
8
|
+
*/
|
|
2
9
|
export declare const useEnvironment: () => EnvironmentContextType;
|
|
3
10
|
export default useEnvironment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Flag, FlagsStateWithActions } from '../../contexts/FlagsContext/types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to get the flags store
|
|
4
|
+
* @author Juan Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
6
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
7
|
+
* @updatedUser Juan Escobar - automatic
|
|
8
|
+
*/
|
|
2
9
|
export declare function useFlagsStore<T>(selector: (state: FlagsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
10
|
+
/**
|
|
11
|
+
* Hook to check if the flags are present
|
|
12
|
+
* @author Juan Escobar - automatic
|
|
13
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
14
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
15
|
+
* @updatedUser Juan Escobar - automatic
|
|
16
|
+
*/
|
|
3
17
|
export declare const useFlagsPresent: (compareFlags: Array<Flag>) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener las herramientas del host
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useHostTools: () => import('../..').HostToolsType;
|
|
2
9
|
export default useHostTools;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to use local storage
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
1
8
|
export declare function useLocalStorage<ValueType>(key: string, initialValue: ValueType): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
export type SetStateType<ValueType> = (newValue: ValueType) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Hook to use local storage with listener, vigiala los cambios en el local storage y actualiza el estado con
|
|
4
|
+
* listener de storage
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
2
10
|
export declare function useLocalStorageWithListener<ValueType>(key: string, initialValue: ValueType): [ValueType, SetStateType<ValueType>];
|
|
3
11
|
export default useLocalStorageWithListener;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el diccionario de un modulo
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useModuleDictionary: () => import('../../contexts/ModuleDictionaryContext/types').ModuleDictionaryContextProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto de privilegios de un modulo
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useModulePrivileges: () => import('../../contexts/ModulePrivilegesContext/types').ModulePrivilegesContextProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el estado del esqueleto de un modulo
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
1
8
|
export declare const useModuleSkeleton: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const mockUseFlagsPresent: jest.Mock;
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Hook para obtener el contexto de la red
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
8
|
+
export declare const useNetwork: () => import('../../contexts/NetworkContext/types').NetworkType;
|
|
2
9
|
export default useNetwork;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { UsePaginateProps } from './types';
|
|
2
|
-
|
|
1
|
+
import { UsePaginateProps, PagerState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook para paginar una lista de elementos
|
|
4
|
+
*/
|
|
3
5
|
export declare const usePaginate: <TRow>(props: UsePaginateProps<TRow>) => {
|
|
4
6
|
onPageChange: (newPage: number) => void;
|
|
5
7
|
onRowsPerPageChange: (newRowsPerPage: number) => void;
|
|
@@ -7,5 +9,5 @@ export declare const usePaginate: <TRow>(props: UsePaginateProps<TRow>) => {
|
|
|
7
9
|
rows: TRow[];
|
|
8
10
|
clearRows: () => void;
|
|
9
11
|
Refresh: () => void;
|
|
10
|
-
setRows: import(
|
|
12
|
+
setRows: import('react').Dispatch<import('react').SetStateAction<TRow[]>>;
|
|
11
13
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { EmmitListenerGuard } from '../../types';
|
|
2
2
|
import { usePropagateProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook para propagar eventos entre microfrontends
|
|
5
|
+
* @author Juan Escobar - automatic
|
|
6
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
7
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedUser Juan Escobar - automatic
|
|
9
|
+
*/
|
|
3
10
|
export declare function usePropageteMF<E extends keyof EmmitListenerGuard>(props: usePropagateProps<E>): void;
|
package/package.json
CHANGED
|
@@ -1,14 +1,52 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "2.0.9
|
|
3
|
+
"version": "2.0.9",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"lint-staged": {
|
|
10
|
+
"**/*.{js,jsx,ts,tsx,json}": [
|
|
11
|
+
"eslint . --fix"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
6
14
|
"dependencies": {
|
|
7
15
|
"camelcase-keys": "^9.1.3",
|
|
8
16
|
"immer": "^9.0.21",
|
|
9
17
|
"snakecase-keys": "^8.0.1",
|
|
10
18
|
"zustand": "4.3.6"
|
|
11
19
|
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"axios": "^1.0.0",
|
|
22
|
+
"history": "5.3.0",
|
|
23
|
+
"qs": "^6.0.0",
|
|
24
|
+
"react": "^18.0.0",
|
|
25
|
+
"react-toastify": "10.0.5"
|
|
26
|
+
},
|
|
27
|
+
"peerDependenciesMeta": {
|
|
28
|
+
"@types/nprogress": {
|
|
29
|
+
"optional": true
|
|
30
|
+
},
|
|
31
|
+
"@types/react": {
|
|
32
|
+
"optional": true
|
|
33
|
+
},
|
|
34
|
+
"axios": {
|
|
35
|
+
"optional": true
|
|
36
|
+
},
|
|
37
|
+
"history": {
|
|
38
|
+
"optional": true
|
|
39
|
+
},
|
|
40
|
+
"qs": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"react": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"react-toastify": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
49
|
+
},
|
|
12
50
|
"resolutions": {
|
|
13
51
|
"glob": "^10.4.5",
|
|
14
52
|
"react": "^18.0.0",
|
|
@@ -26,13 +64,6 @@
|
|
|
26
64
|
"react-dom": "^18.0.0",
|
|
27
65
|
"vite": "^5.4.7"
|
|
28
66
|
},
|
|
29
|
-
"peerDependencies": {
|
|
30
|
-
"axios": "^1.0.0",
|
|
31
|
-
"history": "5.3.0",
|
|
32
|
-
"qs": "^6.0.0",
|
|
33
|
-
"react": "^18.0.0",
|
|
34
|
-
"react-toastify": "10.0.5"
|
|
35
|
-
},
|
|
36
67
|
"files": [
|
|
37
68
|
"*"
|
|
38
69
|
],
|
|
@@ -42,9 +73,6 @@
|
|
|
42
73
|
"type": "module",
|
|
43
74
|
"types": "./index.d.ts",
|
|
44
75
|
"sideEffects": false,
|
|
45
|
-
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
47
|
-
},
|
|
48
76
|
"engines": {
|
|
49
77
|
"node": ">=12.0.0"
|
|
50
78
|
},
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { HostToolsType, Toaster } from '../types';
|
|
2
|
+
import { BaseDataForTesting } from './types';
|
|
3
|
+
export declare const moduleIdForTesting = "testing";
|
|
4
|
+
export declare const moduleNameForTesting = "label_for_module_name";
|
|
5
|
+
export declare const dictionaryDataForTesting: {
|
|
6
|
+
data: {
|
|
7
|
+
module_name: string;
|
|
8
|
+
label1: string;
|
|
9
|
+
};
|
|
10
|
+
comp1: {
|
|
11
|
+
key1: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const queryPrivilegesForTesting: string[];
|
|
15
|
+
export declare const resultpPrivilegesForTesting: {
|
|
16
|
+
data: {
|
|
17
|
+
priv1: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const domainDataForTesting: {
|
|
21
|
+
data: {
|
|
22
|
+
name: string;
|
|
23
|
+
company_logo_small_url: string;
|
|
24
|
+
company_logo_normal_url: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare const domainCountry1DataForTesting: {
|
|
28
|
+
id: number;
|
|
29
|
+
currency: string;
|
|
30
|
+
currency_decimal_digits: number;
|
|
31
|
+
decimal_symbol: string;
|
|
32
|
+
thousands_symbol: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const domainCountry2DataForTesting: {
|
|
35
|
+
id: number;
|
|
36
|
+
currency: string;
|
|
37
|
+
currency_decimal_digits: number;
|
|
38
|
+
decimal_symbol: string;
|
|
39
|
+
thousands_symbol: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const resultAxiosOperationForTesting: {
|
|
42
|
+
data: {
|
|
43
|
+
a: number;
|
|
44
|
+
b: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const networkPropsForTesting: {
|
|
48
|
+
method: string;
|
|
49
|
+
endPoint: string;
|
|
50
|
+
parms: {};
|
|
51
|
+
};
|
|
52
|
+
export declare const environmentDataForTesting: {
|
|
53
|
+
isLocalhost: boolean;
|
|
54
|
+
host: string;
|
|
55
|
+
domain_token: string;
|
|
56
|
+
host_api_local: string;
|
|
57
|
+
host_api_remote: string;
|
|
58
|
+
host_static_assets: string;
|
|
59
|
+
environment_assets: string;
|
|
60
|
+
isMicroFrontend: boolean;
|
|
61
|
+
isIsolatation: boolean;
|
|
62
|
+
database: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const baseDataForTesting: BaseDataForTesting;
|
|
65
|
+
/**
|
|
66
|
+
* Mock toaster
|
|
67
|
+
* @updatedUser Juan Escobar - automatic
|
|
68
|
+
* @updatedUser Juan Escobar - automatic
|
|
69
|
+
* @updatedUser Juan Escobar - automatic
|
|
70
|
+
* @updatedUser Juan Escobar - automatic
|
|
71
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
72
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
73
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
74
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
75
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
76
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
77
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
78
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
79
|
+
* @author Juan Escobar - automatic
|
|
80
|
+
* @author Juan Escobar - automatic
|
|
81
|
+
* @author Juan Escobar - automatic
|
|
82
|
+
* @author Juan Escobar - automatic
|
|
83
|
+
* @author Juan Escobar - automatic
|
|
84
|
+
* @createdAt 2024-10-04 18:42:00 - automatic
|
|
85
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
86
|
+
* @updatedUser Juan Escobar - automatic
|
|
87
|
+
*/
|
|
88
|
+
export declare const mock_toaster: Toaster;
|
|
89
|
+
export declare const hostToolsDataForTesting: HostToolsType;
|
package/test/mocks.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const mock_addFlag: import('vitest').Mock<(...args: any[]) => any>;
|
|
2
|
+
export declare const mock_networkOperation: import('vitest').Mock<(...args: any[]) => any>;
|
|
3
|
+
export declare const mock_events_add_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
4
|
+
export declare const mock_events_remove_listener: import('vitest').Mock<(...args: any[]) => any>;
|
|
5
|
+
export declare const mock_events_emit: import('vitest').Mock<(...args: any[]) => any>;
|
|
6
|
+
export declare const mock_startProgress: import('vitest').Mock<(...args: any[]) => any>;
|
|
7
|
+
export declare const mock_stopProgress: import('vitest').Mock<(...args: any[]) => any>;
|
package/test/setup.d.ts
ADDED
|
File without changes
|
package/test/types.d.ts
ADDED
package/test/utils.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cleanup, screen } from '@testing-library/react';
|
|
2
|
+
import { renderHook } from '@testing-library/react-hooks';
|
|
3
|
+
import { default as React, act } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* customRender
|
|
6
|
+
* @author Juan Escobar - automatic
|
|
7
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
8
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
9
|
+
* @updatedUser Juan Escobar - automatic
|
|
10
|
+
*/
|
|
11
|
+
declare const customRender: (ui: React.ReactElement, options?: {}) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
|
|
12
|
+
export { default as userEvent } from '@testing-library/user-event';
|
|
13
|
+
export { customRender as render, renderHook, screen, cleanup, act };
|
package/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Id, ToastOptions } from 'react-toastify';
|
|
3
|
+
import { BrowserHistory } from 'history';
|
|
4
4
|
import { AxiosProgressEvent, ResponseType } from 'axios';
|
|
5
5
|
import { DomainCountry } from '../contexts';
|
|
6
6
|
import { AxiosOptions } from '../utils/axiosOperation/types';
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EnvironmentType, HostToolsType, NetworkProps } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Esta función se encarga de realizar las operaciones de red.
|
|
4
|
+
* @author Juan Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
7
|
+
* @updatedUser Juan Escobar - automatic
|
|
8
|
+
*/
|
|
2
9
|
export declare const axiosOperation: (props: NetworkProps, enviroment: EnvironmentType, hostTools: HostToolsType) => Promise<any>;
|
|
@@ -53,6 +53,13 @@ const L = async (e, t, a) => {
|
|
|
53
53
|
url: c ? o : `/${o}`,
|
|
54
54
|
data: $ ? v(m, { deep: !0 }) : m,
|
|
55
55
|
params: {},
|
|
56
|
+
/**
|
|
57
|
+
* paramsSerializer: es una función opcional que permite serializar los parámetros de la URL.
|
|
58
|
+
* @author Juan Escobar - automatic
|
|
59
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
60
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
61
|
+
* @updatedUser Juan Escobar - automatic
|
|
62
|
+
*/
|
|
56
63
|
paramsSerializer: () => b.stringify(g, { encode: !0 }),
|
|
57
64
|
headers: p,
|
|
58
65
|
timeout: r,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get value from local storage
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
1
8
|
export declare function getLocalStorage<ValueType>(key: string, initialValue: ValueType): ValueType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
type PropertyType = string | undefined | any[] | Record<any, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Devuelve una parte de un objeto, que puede estar anidado.
|
|
4
|
+
* @author Juan Escobar - automatic
|
|
5
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
7
|
+
* @updatedUser Juan Escobar - automatic
|
|
8
|
+
*/
|
|
2
9
|
export declare function getPropertyByString<T extends PropertyType = PropertyType>(object: any, key: string, defaultValue?: T): T;
|
|
3
10
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graba en el localStorage un objeto con la key especificada. Si ya existe, lo mezcla con el objeto actual.
|
|
3
|
+
* @author Juan Escobar - automatic
|
|
4
|
+
* @createdAt 2024-10-04 18:42:01 - automatic
|
|
5
|
+
* @updatedAt 2024-10-04 18:42:01 - automatic
|
|
6
|
+
* @updatedUser Juan Escobar - automatic
|
|
7
|
+
*/
|
|
1
8
|
export declare function setLocalStorage<ValueType>(key: string, newValue: ValueType, mixCurrentLocalStorage?: boolean): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/utils/voidFunction.d.ts
CHANGED