@m4l/core 0.1.56 → 1.0.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.
- package/contexts/DomainContext/index.fc9c9f7e.js +56 -0
- package/contexts/DomainCountryContext/index.2da8b247.js +54 -0
- package/contexts/FlagsContext/index.3f08bff3.js +39 -0
- package/contexts/ModuleDictionaryContext/index.cc2a5fa3.js +76 -0
- package/contexts/ModulePrivilegesContext/index.039085db.js +58 -0
- package/contexts/ModuleSkeletonContext/index.334164fc.js +28 -0
- package/hooks/useDomain/{index.6ab40615.js → index.73578fd1.js} +2 -2
- package/hooks/useFlagsStore/index.fa8dcf62.js +17 -0
- package/hooks/useModuleDictionary/{index.3305a123.js → index.0b2e51cf.js} +1 -1
- package/hooks/useModulePrivileges/{index.cbe0c72f.js → index.3c1155fb.js} +1 -1
- package/hooks/useModuleSkeleton/{index.739fd422.js → index.2b62072e.js} +1 -1
- package/index.js +68 -66
- package/node_modules.7069706f.js +835 -0
- package/package.json +1 -1
- package/packages/m4l_core/contexts/FlagsContext/index.d.ts +13 -0
- package/packages/m4l_core/contexts/FlagsContext/store.d.ts +11 -0
- package/{contexts → packages/m4l_core/contexts}/FlagsContext/types.d.ts +9 -0
- package/{hooks → packages/m4l_core/hooks}/index.d.ts +1 -1
- package/packages/m4l_core/hooks/useFlagsStore/index.d.ts +3 -0
- package/{types → packages/m4l_core/types}/index.d.ts +10 -0
- package/packages/m4l_core/vite-env.d.ts +4 -0
- package/utils/{axiosOperation.30c7cc9d.js → axiosOperation.ce4250d4.js} +35 -34
- package/utils/{index.c7370abf.js → index.6d56ba04.js} +14 -10
- package/vendor.3b4bd7d3.js +32 -0
- package/vite-env.d.ts +4 -4
- package/contexts/DomainContext/index.2339e0b7.js +0 -50
- package/contexts/DomainCountryContext/index.3cdf9462.js +0 -46
- package/contexts/FlagsContext/index.5f795859.js +0 -24
- package/contexts/FlagsContext/index.d.ts +0 -5
- package/contexts/ModuleDictionaryContext/index.848a0393.js +0 -73
- package/contexts/ModulePrivilegesContext/index.f1988b13.js +0 -54
- package/contexts/ModuleSkeletonContext/index.45963775.js +0 -20
- package/hooks/useFlags/index.a986729d.js +0 -21
- package/hooks/useFlags/index.d.ts +0 -3
- /package/{contexts → packages/m4l_core/contexts}/BaseContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/BaseContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/DomainContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/DomainContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/DomainCountryContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/DomainCountryContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/EnvironmentContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/EnvironmentContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/HostToolsContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/HostToolsContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModuleDictionaryContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModuleDictionaryContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModulePrivilegesContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModulePrivilegesContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModuleSkeletonContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/ModuleSkeletonContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/NetworkContext/index.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/NetworkContext/types.d.ts +0 -0
- /package/{contexts → packages/m4l_core/contexts}/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useBase/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useDomain/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useDomainCountry/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useEnvironment/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useHostTools/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useLocalStorage/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useLocalStorageWithListener/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useModuleDictionary/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useModulePrivileges/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useModuleSkeleton/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/useNetwork/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/usePaginate/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/usePaginate/types.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/usePropageteMF/index.d.ts +0 -0
- /package/{hooks → packages/m4l_core/hooks}/usePropageteMF/types.d.ts +0 -0
- /package/{index.d.ts → packages/m4l_core/index.d.ts} +0 -0
- /package/{types → packages/m4l_core/types}/dictionary.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/axiosOperation/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/axiosOperation/types.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/evaluateWithContext/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/getLocalStorage/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/getPropertyByString/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/setLocalStorage/index.d.ts +0 -0
- /package/{utils → packages/m4l_core/utils}/voidFunction.d.ts +0 -0
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlagsProviderProps } from './types';
|
|
3
|
+
declare const FlagsContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").FlagsStateWithActions>, "setState"> & {
|
|
4
|
+
setState<A extends string | {
|
|
5
|
+
type: unknown;
|
|
6
|
+
}>(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;
|
|
7
|
+
}, "setState"> & {
|
|
8
|
+
setState(nextStateOrUpdater: import("./types").FlagsStateWithActions | Partial<import("./types").FlagsStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<import("./types").FlagsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
9
|
+
type: unknown;
|
|
10
|
+
} | undefined): void;
|
|
11
|
+
}) | null>;
|
|
12
|
+
declare function FlagsProvider({ children }: FlagsProviderProps): import("react").JSX.Element;
|
|
13
|
+
export { FlagsProvider, FlagsContext };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FlagsStateWithActions, FlagsStoreState } from './types';
|
|
2
|
+
export declare const createFlagsStore: (initialState: FlagsStoreState) => Omit<Omit<import("zustand").StoreApi<FlagsStateWithActions>, "setState"> & {
|
|
3
|
+
setState<A extends string | {
|
|
4
|
+
type: unknown;
|
|
5
|
+
}>(partial: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: FlagsStateWithActions) => FlagsStateWithActions | Partial<FlagsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
6
|
+
}, "setState"> & {
|
|
7
|
+
setState(nextStateOrUpdater: FlagsStateWithActions | Partial<FlagsStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<FlagsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
|
|
8
|
+
type: unknown;
|
|
9
|
+
} | undefined): void;
|
|
10
|
+
};
|
|
11
|
+
export declare type FlagsStore = ReturnType<typeof createFlagsStore>;
|
|
@@ -8,3 +8,12 @@ export interface FlagsContextProps {
|
|
|
8
8
|
clearFlags: () => void;
|
|
9
9
|
addFlag: (flag: Flag) => void;
|
|
10
10
|
}
|
|
11
|
+
export interface FlagsStoreState {
|
|
12
|
+
flags: Array<Flag>;
|
|
13
|
+
}
|
|
14
|
+
export interface FlagsStateWithActions extends FlagsStoreState {
|
|
15
|
+
flagsActions: {
|
|
16
|
+
clearFlags: () => void;
|
|
17
|
+
addFlag: (flag: Flag) => void;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { useBase } from './useBase';
|
|
2
2
|
export { useEnvironment } from './useEnvironment';
|
|
3
|
-
export {
|
|
3
|
+
export { useFlagsStore, useFlagsPresent } from './useFlagsStore';
|
|
4
4
|
export { useHostTools } from './useHostTools';
|
|
5
5
|
export { useDomain } from './useDomain';
|
|
6
6
|
export { useLocalStorage } from './useLocalStorage';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Flag, FlagsStateWithActions } from '../../contexts/FlagsContext/types';
|
|
2
|
+
export declare function useFlagsStore<T>(selector: (state: FlagsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
3
|
+
export declare const useFlagsPresent: (compareFlags: Array<Flag>) => boolean;
|
|
@@ -24,6 +24,10 @@ export declare type EnvironmentType = {
|
|
|
24
24
|
isLocalhost: boolean;
|
|
25
25
|
host: string;
|
|
26
26
|
domain_token: string;
|
|
27
|
+
/**
|
|
28
|
+
* Base de datos a la que la plataforma se conectará
|
|
29
|
+
*/
|
|
30
|
+
database: string;
|
|
27
31
|
host_api_remote: string;
|
|
28
32
|
host_api_local: string;
|
|
29
33
|
host_static_assets: string;
|
|
@@ -32,6 +36,12 @@ export declare type EnvironmentType = {
|
|
|
32
36
|
export declare type NetworkProps = {
|
|
33
37
|
method: any;
|
|
34
38
|
endPoint: string;
|
|
39
|
+
/**
|
|
40
|
+
* "database" Indica la base de datos a la que se conectara. Cuando se instancia axiosOperation se pone el valor por defecto.
|
|
41
|
+
* Para made4Labs es domain
|
|
42
|
+
* Para guardian es operative
|
|
43
|
+
*/
|
|
44
|
+
database?: string;
|
|
35
45
|
timeout?: number;
|
|
36
46
|
parms?: object;
|
|
37
47
|
data?: Record<string, any>;
|
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import j from "axios";
|
|
2
|
+
import C from "qs";
|
|
3
|
+
import b from "camelcase-keys";
|
|
4
4
|
import v from "snakecase-keys";
|
|
5
|
-
import { E as
|
|
6
|
-
function
|
|
7
|
-
const { toast:
|
|
8
|
-
return i === "json" ? t && t.data && typeof t.data == "object" ? t.data.error && t.data.error?.code && t.data.error?.msg !== void 0 ? Promise.reject({ ...t.data.error, status: t.status }) : (t.data.messagen && o &&
|
|
5
|
+
import { E as h } from "../types/index.42c24946.js";
|
|
6
|
+
function x(e, t, a, i, o, s) {
|
|
7
|
+
const { toast: r } = a;
|
|
8
|
+
return i === "json" ? t && t.data && typeof t.data == "object" ? t.data.error && t.data.error?.code && t.data.error?.msg !== void 0 ? Promise.reject({ ...t.data.error, status: t.status }) : (t.data.messagen && o && r(t.data.message, { type: "success", autoClose: 1e4 }), s ? b(t.data, { deep: !0 }) : t.data) : Promise.reject({
|
|
9
9
|
code: 1,
|
|
10
10
|
msg: `Incorrect endpoint: ${e}`,
|
|
11
11
|
status: t.status
|
|
12
12
|
}) : t.data;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function T(e, t, a = !0, i = !0) {
|
|
15
15
|
const { toast: o } = t;
|
|
16
16
|
let s = {
|
|
17
17
|
message: "",
|
|
18
18
|
status: 1,
|
|
19
19
|
code: 0
|
|
20
20
|
};
|
|
21
|
-
return e?.code !== void 0 && s.status !== void 0 && e.message !== void 0 && (s = { ...s, ...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 ? s = { ...e.response.data.error, status: e.response.status } : (s.message = e.message, s.status = e.response.status, s.code = 0) : e?.request ? (s.message = `${e?.code} ${e.message}`, s.code = -1) : (s.message = `${e?.code} ${e.message}`, s.status = 0, s.code = -2), console.log("ERROR", e), console.log("err", s), a && e?.response?.status === 401 && t.events_emit(
|
|
21
|
+
return e?.code !== void 0 && s.status !== void 0 && e.message !== void 0 && (s = { ...s, ...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 ? s = { ...e.response.data.error, status: e.response.status } : (s.message = e.message, s.status = e.response.status, s.code = 0) : e?.request ? (s.message = `${e?.code} ${e.message}`, s.code = -1) : (s.message = `${e?.code} ${e.message}`, s.status = 0, s.code = -2), console.log("ERROR", e), console.log("err", s), a && e?.response?.status === 401 && t.events_emit(h.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, {}), e?.response?.data?.error?.message && (s.message = e?.response?.data?.error.message), a && (s.message.indexOf("ERR_CANCELED") > -1 || i && o(`${s.message} - status: ${s.status} - code: ${s.code}`, {
|
|
22
22
|
type: "error"
|
|
23
23
|
})), s;
|
|
24
24
|
}
|
|
25
|
-
const
|
|
25
|
+
const D = async (e, t, a) => {
|
|
26
26
|
const {
|
|
27
27
|
method: i,
|
|
28
28
|
endPoint: o,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
database: s = t.database,
|
|
30
|
+
timeout: r = 6e4,
|
|
31
|
+
parms: g = {},
|
|
31
32
|
data: m = {},
|
|
32
33
|
isRemote: c = !0,
|
|
33
|
-
checkUnAuthorized:
|
|
34
|
-
headers:
|
|
35
|
-
onDownloadProgress:
|
|
34
|
+
checkUnAuthorized: l = !0,
|
|
35
|
+
headers: p,
|
|
36
|
+
onDownloadProgress: E,
|
|
36
37
|
isExternalUrl: u,
|
|
37
38
|
responseType: f = "json",
|
|
38
|
-
signal:
|
|
39
|
-
toastSuccess:
|
|
40
|
-
toastError:
|
|
41
|
-
bodyToSnakeCase:
|
|
42
|
-
responseToCamelCase:
|
|
39
|
+
signal: R,
|
|
40
|
+
toastSuccess: y = !0,
|
|
41
|
+
toastError: _ = !0,
|
|
42
|
+
bodyToSnakeCase: P = !1,
|
|
43
|
+
responseToCamelCase: $ = !1
|
|
43
44
|
} = e;
|
|
44
|
-
let
|
|
45
|
-
return c ?
|
|
46
|
-
baseURL: u ? void 0 :
|
|
45
|
+
let d;
|
|
46
|
+
return c ? d = t.host_api_remote : d = t.host_api_local, d = d + "/" + s, e?.options?.startProgress && e?.options?.startProgress(), j({
|
|
47
|
+
baseURL: u ? void 0 : d,
|
|
47
48
|
withCredentials: c,
|
|
48
49
|
method: i,
|
|
49
50
|
url: u ? o : `/${o}`,
|
|
50
|
-
data:
|
|
51
|
+
data: P ? v(m, { deep: !0 }) : m,
|
|
51
52
|
params: {},
|
|
52
|
-
paramsSerializer: () =>
|
|
53
|
-
headers:
|
|
54
|
-
timeout:
|
|
55
|
-
onDownloadProgress:
|
|
53
|
+
paramsSerializer: () => C.stringify(g, { encode: !0 }),
|
|
54
|
+
headers: p,
|
|
55
|
+
timeout: r,
|
|
56
|
+
onDownloadProgress: E,
|
|
56
57
|
responseType: f,
|
|
57
|
-
signal:
|
|
58
|
-
}).then((n) =>
|
|
58
|
+
signal: R
|
|
59
|
+
}).then((n) => x(
|
|
59
60
|
o,
|
|
60
61
|
n,
|
|
61
62
|
a,
|
|
62
63
|
f,
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
y,
|
|
65
|
+
$
|
|
65
66
|
)).catch(
|
|
66
|
-
(n) => (console.log("Reject de la promesa"), Promise.reject(
|
|
67
|
+
(n) => (console.log("Reject de la promesa"), Promise.reject(T(n, a, l, _)))
|
|
67
68
|
).finally(() => {
|
|
68
69
|
e?.options?.stopProgress && e?.options?.stopProgress();
|
|
69
70
|
});
|
|
70
71
|
};
|
|
71
72
|
export {
|
|
72
|
-
|
|
73
|
+
D as a
|
|
73
74
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import "axios";
|
|
2
|
+
import "qs";
|
|
3
|
+
import "camelcase-keys";
|
|
4
|
+
import "snakecase-keys";
|
|
5
|
+
function y() {
|
|
2
6
|
}
|
|
3
|
-
function
|
|
7
|
+
function p(n, e) {
|
|
4
8
|
const r = e.split(".");
|
|
5
9
|
let t = n;
|
|
6
10
|
for (const o of r) {
|
|
@@ -23,7 +27,7 @@ function u(n, e) {
|
|
|
23
27
|
}
|
|
24
28
|
return t;
|
|
25
29
|
}
|
|
26
|
-
function
|
|
30
|
+
function d(n, e) {
|
|
27
31
|
try {
|
|
28
32
|
const t = new Function(...Object.keys(n), `return \`${e}\``)(...Object.values(n));
|
|
29
33
|
return String(t).replace(/`/g, "");
|
|
@@ -31,7 +35,7 @@ function g(n, e) {
|
|
|
31
35
|
return console.error(`Error evaluating expression: ${r}`), "";
|
|
32
36
|
}
|
|
33
37
|
}
|
|
34
|
-
function
|
|
38
|
+
function m(n, e) {
|
|
35
39
|
try {
|
|
36
40
|
const r = window.localStorage.getItem(n);
|
|
37
41
|
return r !== null ? typeof e == "string" ? r : JSON.parse(r) : e;
|
|
@@ -39,7 +43,7 @@ function f(n, e) {
|
|
|
39
43
|
return e;
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
function
|
|
46
|
+
function v(n, e, r = !1) {
|
|
43
47
|
try {
|
|
44
48
|
let t = null;
|
|
45
49
|
if (typeof e == "string") {
|
|
@@ -53,9 +57,9 @@ function y(n, e, r = !1) {
|
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
m as a,
|
|
61
|
+
d as e,
|
|
62
|
+
p as g,
|
|
63
|
+
v as s,
|
|
64
|
+
y as v
|
|
61
65
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import "./contexts/BaseContext/index.f9cdc955.js";
|
|
3
|
+
import "./contexts/EnvironmentContext/index.b33784cd.js";
|
|
4
|
+
import "./contexts/FlagsContext/index.3f08bff3.js";
|
|
5
|
+
import "./contexts/HostToolsContext/index.499db832.js";
|
|
6
|
+
import "./contexts/DomainContext/index.fc9c9f7e.js";
|
|
7
|
+
import "./contexts/ModuleDictionaryContext/index.cc2a5fa3.js";
|
|
8
|
+
import "./contexts/ModulePrivilegesContext/index.039085db.js";
|
|
9
|
+
import "./contexts/ModuleSkeletonContext/index.334164fc.js";
|
|
10
|
+
import "./contexts/NetworkContext/index.ec7405cd.js";
|
|
11
|
+
import "./contexts/DomainCountryContext/index.2da8b247.js";
|
|
12
|
+
import "./hooks/useBase/index.4375dcef.js";
|
|
13
|
+
import "./hooks/useEnvironment/index.25f83176.js";
|
|
14
|
+
import "./hooks/useFlagsStore/index.fa8dcf62.js";
|
|
15
|
+
import "./hooks/useHostTools/index.66d9a667.js";
|
|
16
|
+
import "./hooks/useDomain/index.73578fd1.js";
|
|
17
|
+
import "./hooks/useLocalStorage/index.48b47dca.js";
|
|
18
|
+
import "./hooks/useModuleDictionary/index.0b2e51cf.js";
|
|
19
|
+
import "./hooks/useModulePrivileges/index.3c1155fb.js";
|
|
20
|
+
import "./hooks/useModuleSkeleton/index.2b62072e.js";
|
|
21
|
+
import "./hooks/useNetwork/index.3d79002b.js";
|
|
22
|
+
import "./hooks/usePaginate/index.1306b0de.js";
|
|
23
|
+
import "./hooks/usePropageteMF/index.c440b829.js";
|
|
24
|
+
import "./types/index.42c24946.js";
|
|
25
|
+
import "./utils/index.6d56ba04.js";
|
|
26
|
+
import "./utils/axiosOperation.ce4250d4.js";
|
|
27
|
+
function M(t) {
|
|
28
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
M as g
|
|
32
|
+
};
|
package/vite-env.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
2
|
-
/// <reference types="vitest" />
|
|
3
|
-
/// <reference types="vitest/globals" />
|
|
4
|
-
/// <reference types="vitest/importMeta" />
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
/// <reference types="vitest" />
|
|
3
|
+
/// <reference types="vitest/globals" />
|
|
4
|
+
/// <reference types="vitest/importMeta" />
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { createContext as f, useState as s, useEffect as p } from "react";
|
|
2
|
-
import { u as g } from "../../hooks/useFlags/index.a986729d.js";
|
|
3
|
-
import { u as D } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
4
|
-
import { u as v } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
5
|
-
import { C as y } from "../../types/index.42c24946.js";
|
|
6
|
-
import { jsx as h } from "react/jsx-runtime";
|
|
7
|
-
const $ = f(null);
|
|
8
|
-
function A(e) {
|
|
9
|
-
const {
|
|
10
|
-
children: m
|
|
11
|
-
} = e, {
|
|
12
|
-
domain_token: r,
|
|
13
|
-
host_static_assets: n,
|
|
14
|
-
environment_assets: a
|
|
15
|
-
} = D(), {
|
|
16
|
-
addFlag: l
|
|
17
|
-
} = g(), [i, c] = s(!1), [_, u] = s({
|
|
18
|
-
company_logo_small_url: "",
|
|
19
|
-
company_logo_normal_url: "",
|
|
20
|
-
name: "",
|
|
21
|
-
slogan: ""
|
|
22
|
-
}), {
|
|
23
|
-
networkOperation: d
|
|
24
|
-
} = v();
|
|
25
|
-
return p(() => {
|
|
26
|
-
let t = !0;
|
|
27
|
-
return d({
|
|
28
|
-
method: "GET",
|
|
29
|
-
endPoint: `na/info/${r}`
|
|
30
|
-
}).then((o) => {
|
|
31
|
-
t && (u({
|
|
32
|
-
...o.data,
|
|
33
|
-
company_logo_normal_url: o.data.company_logo_normal_url ?? `${n}/${a}/frontend/commons/assets/icons/isologo.svg`,
|
|
34
|
-
company_logo_small_url: o.data.company_logo_small_url ?? `${n}/${a}/frontend/commons/assets/icons/isotipo_m4l.svg`
|
|
35
|
-
}), l(y.FLAG_DOMAIN_LOADED), c(!0));
|
|
36
|
-
}).finally(() => {
|
|
37
|
-
}), function() {
|
|
38
|
-
t = !1;
|
|
39
|
-
};
|
|
40
|
-
}, []), /* @__PURE__ */ h($.Provider, {
|
|
41
|
-
value: {
|
|
42
|
-
..._
|
|
43
|
-
},
|
|
44
|
-
children: i && m
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
$ as D,
|
|
49
|
-
A as a
|
|
50
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { createContext as d, useState as y, useCallback as T } from "react";
|
|
2
|
-
import { E as r } from "../../types/index.42c24946.js";
|
|
3
|
-
import { jsx as f } from "react/jsx-runtime";
|
|
4
|
-
import { u as D } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
5
|
-
import { u as M } from "../../hooks/usePropageteMF/index.c440b829.js";
|
|
6
|
-
const N = d(null);
|
|
7
|
-
function A(e) {
|
|
8
|
-
const {
|
|
9
|
-
children: s,
|
|
10
|
-
isMicroFrontEnd: t,
|
|
11
|
-
id: i,
|
|
12
|
-
currency: a,
|
|
13
|
-
currency_decimal_digits: m,
|
|
14
|
-
decimal_symbol: c,
|
|
15
|
-
thousands_symbol: u
|
|
16
|
-
} = e, {
|
|
17
|
-
events_emit: _
|
|
18
|
-
} = D(), [l, C] = y({
|
|
19
|
-
id: i,
|
|
20
|
-
currency: a,
|
|
21
|
-
currency_decimal_digits: m,
|
|
22
|
-
decimal_symbol: c,
|
|
23
|
-
thousands_symbol: u
|
|
24
|
-
}), n = (o) => {
|
|
25
|
-
C(o);
|
|
26
|
-
};
|
|
27
|
-
M({
|
|
28
|
-
isMicroFrontEnd: t,
|
|
29
|
-
event: r.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE,
|
|
30
|
-
setHandler: n
|
|
31
|
-
});
|
|
32
|
-
const E = T((o) => {
|
|
33
|
-
t || (n(o), _(r.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE, o));
|
|
34
|
-
}, []);
|
|
35
|
-
return /* @__PURE__ */ f(N.Provider, {
|
|
36
|
-
value: {
|
|
37
|
-
...l,
|
|
38
|
-
changeDomainCountry: E
|
|
39
|
-
},
|
|
40
|
-
children: s
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
export {
|
|
44
|
-
N as D,
|
|
45
|
-
A as a
|
|
46
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createContext as i, useState as l, useCallback as a } from "react";
|
|
2
|
-
import { jsx as f } from "react/jsx-runtime";
|
|
3
|
-
const x = i(null);
|
|
4
|
-
function g({
|
|
5
|
-
children: n
|
|
6
|
-
}) {
|
|
7
|
-
const [s, r] = l([]), o = a(() => {
|
|
8
|
-
r([]);
|
|
9
|
-
}, []), c = a((e) => {
|
|
10
|
-
r((t) => t.findIndex((u) => u === e) < 0 ? [...t, e] : [...t]);
|
|
11
|
-
}, []);
|
|
12
|
-
return /* @__PURE__ */ f(x.Provider, {
|
|
13
|
-
value: {
|
|
14
|
-
flags: s,
|
|
15
|
-
addFlag: c,
|
|
16
|
-
clearFlags: o
|
|
17
|
-
},
|
|
18
|
-
children: n
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
x as F,
|
|
23
|
-
g as a
|
|
24
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { FlagsContextProps, FlagsProviderProps } from './types';
|
|
3
|
-
declare const FlagsContext: import("react").Context<FlagsContextProps | null>;
|
|
4
|
-
declare function FlagsProvider({ children }: FlagsProviderProps): import("react").JSX.Element;
|
|
5
|
-
export { FlagsProvider, FlagsContext };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { createContext as y, useState as F, useEffect as L, useCallback as u } from "react";
|
|
2
|
-
import { C as M } from "../../types/index.42c24946.js";
|
|
3
|
-
import { jsx as N } from "react/jsx-runtime";
|
|
4
|
-
import { u as P } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
|
-
import { u as _ } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
6
|
-
import { u as x } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
7
|
-
import { u as A } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
8
|
-
const E = y(null);
|
|
9
|
-
function j(l) {
|
|
10
|
-
const {
|
|
11
|
-
children: c,
|
|
12
|
-
componentsDictionary: m,
|
|
13
|
-
moduleId: i,
|
|
14
|
-
moduleNameField: s = "module_name",
|
|
15
|
-
currentLang: d = "en",
|
|
16
|
-
isAuth: a = !0
|
|
17
|
-
} = l, {
|
|
18
|
-
addFlag: f
|
|
19
|
-
} = P(), [e, p] = F(void 0), {
|
|
20
|
-
domain_token: g
|
|
21
|
-
} = _(), {
|
|
22
|
-
startProgress: D,
|
|
23
|
-
stopProgress: h
|
|
24
|
-
} = x(), {
|
|
25
|
-
networkOperation: v
|
|
26
|
-
} = A();
|
|
27
|
-
L(() => {
|
|
28
|
-
let t = !0;
|
|
29
|
-
return D(), v({
|
|
30
|
-
method: "GET",
|
|
31
|
-
endPoint: a ? `dictionaries/${i}` : `na/dictionaries/${i}`,
|
|
32
|
-
parms: {
|
|
33
|
-
comps: m,
|
|
34
|
-
...a ? {} : {
|
|
35
|
-
domain_token: g
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}).then((o) => {
|
|
39
|
-
t && (p({
|
|
40
|
-
...o
|
|
41
|
-
}), f(M.FLAG_DICTIONARY_LOADED));
|
|
42
|
-
}).finally(() => {
|
|
43
|
-
h();
|
|
44
|
-
}), function() {
|
|
45
|
-
t = !1;
|
|
46
|
-
};
|
|
47
|
-
}, [d]);
|
|
48
|
-
const n = u((t) => {
|
|
49
|
-
if (e === void 0)
|
|
50
|
-
return "";
|
|
51
|
-
if (t === "")
|
|
52
|
-
return "No key";
|
|
53
|
-
let o;
|
|
54
|
-
const r = t.split(".");
|
|
55
|
-
try {
|
|
56
|
-
r.length === 1 && (o = e.data[t]), r.length === 2 && (o = e[r[0]][r[1]]);
|
|
57
|
-
} catch {
|
|
58
|
-
}
|
|
59
|
-
return o || `N_D:[${t}]`;
|
|
60
|
-
}, [e]), C = u(() => n(s), [s, n]);
|
|
61
|
-
return /* @__PURE__ */ N(E.Provider, {
|
|
62
|
-
value: {
|
|
63
|
-
moduleDictionary: e,
|
|
64
|
-
getLabel: n,
|
|
65
|
-
getModuleLabel: C
|
|
66
|
-
},
|
|
67
|
-
children: c
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
export {
|
|
71
|
-
E as M,
|
|
72
|
-
j as a
|
|
73
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { createContext as g, useState as p, useEffect as P, useCallback as d } from "react";
|
|
2
|
-
import { C as i } from "../../types/index.42c24946.js";
|
|
3
|
-
import { jsx as v } from "react/jsx-runtime";
|
|
4
|
-
import { u as E } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
|
-
import { u as h } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
|
-
import { u as L } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
7
|
-
const C = g(null);
|
|
8
|
-
function _(n) {
|
|
9
|
-
const {
|
|
10
|
-
children: a,
|
|
11
|
-
queryPrivileges: t
|
|
12
|
-
} = n, {
|
|
13
|
-
addFlag: o
|
|
14
|
-
} = E(), [r, l] = p({}), {
|
|
15
|
-
startProgress: u,
|
|
16
|
-
stopProgress: m
|
|
17
|
-
} = h(), {
|
|
18
|
-
networkOperation: c
|
|
19
|
-
} = L();
|
|
20
|
-
P(() => {
|
|
21
|
-
let e = !0;
|
|
22
|
-
if (t.length === 0) {
|
|
23
|
-
o(i.FLAG_PRIVILEGES_LOADED);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
return u(), c({
|
|
27
|
-
method: "GET",
|
|
28
|
-
endPoint: "auth/login",
|
|
29
|
-
parms: {
|
|
30
|
-
privileges: t
|
|
31
|
-
}
|
|
32
|
-
}).then((s) => {
|
|
33
|
-
e && (l({
|
|
34
|
-
...s.data
|
|
35
|
-
}), o(i.FLAG_PRIVILEGES_LOADED));
|
|
36
|
-
}).finally(() => {
|
|
37
|
-
m();
|
|
38
|
-
}), function() {
|
|
39
|
-
e = !1;
|
|
40
|
-
};
|
|
41
|
-
}, []);
|
|
42
|
-
const f = d((e) => e in r, [r]);
|
|
43
|
-
return /* @__PURE__ */ v(C.Provider, {
|
|
44
|
-
value: {
|
|
45
|
-
hasPrivilege: f,
|
|
46
|
-
privileges: r
|
|
47
|
-
},
|
|
48
|
-
children: a
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
C as M,
|
|
53
|
-
_ as a
|
|
54
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createContext as n } from "react";
|
|
2
|
-
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
-
import { a as l } from "../../hooks/useFlags/index.a986729d.js";
|
|
4
|
-
const a = n(null);
|
|
5
|
-
function m(e) {
|
|
6
|
-
const {
|
|
7
|
-
children: o,
|
|
8
|
-
flags: t
|
|
9
|
-
} = e, r = !l(t);
|
|
10
|
-
return /* @__PURE__ */ s(a.Provider, {
|
|
11
|
-
value: {
|
|
12
|
-
isSkeleton: r
|
|
13
|
-
},
|
|
14
|
-
children: o
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
a as M,
|
|
19
|
-
m as a
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useContext as f, useState as i, useEffect as u } from "react";
|
|
2
|
-
import { F as l } from "../../contexts/FlagsContext/index.5f795859.js";
|
|
3
|
-
const a = () => {
|
|
4
|
-
const t = f(l);
|
|
5
|
-
if (!t)
|
|
6
|
-
throw new Error("useFlags context must be use inside FlagsProvider");
|
|
7
|
-
return t;
|
|
8
|
-
};
|
|
9
|
-
function r(t, e) {
|
|
10
|
-
return t.filter((s) => e.findIndex((o) => o === s) !== -1).length === t.length;
|
|
11
|
-
}
|
|
12
|
-
const x = (t) => {
|
|
13
|
-
const e = a(), [n, s] = i(r(t, e.flags));
|
|
14
|
-
return u(() => {
|
|
15
|
-
r(t, e.flags) && s(!0);
|
|
16
|
-
}, [e.flags, t]), n;
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
x as a,
|
|
20
|
-
a as u
|
|
21
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|