@m4l/core 1.0.0 → 1.1.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/AuthContext/AuthContext.d.ts +5 -0
- package/contexts/AuthContext/index.717a8c86.js +135 -0
- package/contexts/AuthContext/index.d.ts +2 -0
- package/contexts/AuthContext/types.d.ts +52 -0
- package/contexts/DomainContext/{index.fc9c9f7e.js → index.2ed56159.js} +2 -2
- package/contexts/DomainCountryContext/index.3cdf9462.js +46 -0
- package/contexts/FlagsContext/index.5b096265.js +41 -0
- package/contexts/ModuleDictionaryContext/index.44448b0d.js +71 -0
- package/contexts/ModulePrivilegesContext/index.1274092a.js +52 -0
- package/contexts/ModuleSkeletonContext/index.9267d86a.js +20 -0
- package/{packages/m4l_core/contexts → contexts}/index.d.ts +1 -0
- package/{packages/m4l_core/hooks → hooks}/index.d.ts +1 -0
- package/hooks/useAuth/index.5356a5e9.js +11 -0
- package/hooks/useAuth/index.d.ts +1 -0
- package/hooks/useAuth/useAuth.d.ts +2 -0
- package/hooks/useDomain/{index.73578fd1.js → index.dd6909f6.js} +2 -2
- package/hooks/useFlagsStore/{index.fa8dcf62.js → index.f7c613ac.js} +5 -4
- package/hooks/useLocalStorage/{index.48b47dca.js → index.7dbb3411.js} +2 -2
- package/hooks/useModuleDictionary/{index.0b2e51cf.js → index.eec95f41.js} +1 -1
- package/hooks/useModulePrivileges/{index.3c1155fb.js → index.e93abed8.js} +1 -1
- package/hooks/useModuleSkeleton/{index.2b62072e.js → index.a8238d1d.js} +1 -1
- package/index.js +77 -71
- package/node_modules.04fac7e9.js +401 -0
- package/package.json +4 -2
- package/utils/{index.6d56ba04.js → index.f9db04a8.js} +10 -14
- package/vite-env.d.ts +4 -4
- package/contexts/DomainCountryContext/index.2da8b247.js +0 -54
- package/contexts/FlagsContext/index.3f08bff3.js +0 -39
- package/contexts/ModuleDictionaryContext/index.cc2a5fa3.js +0 -76
- package/contexts/ModulePrivilegesContext/index.039085db.js +0 -58
- package/contexts/ModuleSkeletonContext/index.334164fc.js +0 -28
- package/node_modules.7069706f.js +0 -835
- package/packages/m4l_core/vite-env.d.ts +0 -4
- package/vendor.3b4bd7d3.js +0 -32
- /package/{packages/m4l_core/contexts → contexts}/BaseContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/BaseContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/DomainContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/DomainContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/DomainCountryContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/EnvironmentContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/FlagsContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/FlagsContext/store.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/FlagsContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/HostToolsContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModuleDictionaryContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModulePrivilegesContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/ModuleSkeletonContext/types.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/NetworkContext/index.d.ts +0 -0
- /package/{packages/m4l_core/contexts → contexts}/NetworkContext/types.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useBase/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useDomain/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useDomainCountry/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useEnvironment/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useFlagsStore/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useHostTools/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useLocalStorage/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useLocalStorageWithListener/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useModuleDictionary/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useModulePrivileges/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useModuleSkeleton/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/useNetwork/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/usePaginate/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/usePaginate/types.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/index.d.ts +0 -0
- /package/{packages/m4l_core/hooks → hooks}/usePropageteMF/types.d.ts +0 -0
- /package/{packages/m4l_core/index.d.ts → index.d.ts} +0 -0
- /package/{packages/m4l_core/types → types}/dictionary.d.ts +0 -0
- /package/{packages/m4l_core/types → types}/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/axiosOperation/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/axiosOperation/types.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/evaluateWithContext/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/getLocalStorage/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/getPropertyByString/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/setLocalStorage/index.d.ts +0 -0
- /package/{packages/m4l_core/utils → utils}/voidFunction.d.ts +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AuthProviderProps, SessionContextType } from './types';
|
|
3
|
+
declare const AuthContext: React.Context<SessionContextType | null>;
|
|
4
|
+
declare function AuthProvider(props: AuthProviderProps): React.JSX.Element;
|
|
5
|
+
export { AuthContext, AuthProvider };
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { createContext as T, useReducer as y, useEffect as d } from "react";
|
|
2
|
+
import { E } from "../../types/index.42c24946.js";
|
|
3
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
4
|
+
import { u as D } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
5
|
+
import { u as N } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
6
|
+
import { u as O } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
7
|
+
import { u as S } from "../../hooks/useLocalStorage/index.7dbb3411.js";
|
|
8
|
+
import { g as U, s as u } from "../../utils/index.f9db04a8.js";
|
|
9
|
+
var s = /* @__PURE__ */ ((t) => (t.Initial = "INITIALIZE", t.Login = "LOGIN", t.Logout = "LOGOUT", t))(s || {});
|
|
10
|
+
const w = {
|
|
11
|
+
isAuthenticated: !1,
|
|
12
|
+
isInitialized: !1,
|
|
13
|
+
user: null
|
|
14
|
+
}, _ = (t, e) => {
|
|
15
|
+
switch (e.type) {
|
|
16
|
+
case "INITIALIZE":
|
|
17
|
+
return {
|
|
18
|
+
isAuthenticated: e.payload.isAuthenticated,
|
|
19
|
+
isInitialized: !0,
|
|
20
|
+
user: e.payload.user
|
|
21
|
+
};
|
|
22
|
+
case "LOGIN":
|
|
23
|
+
return {
|
|
24
|
+
...t,
|
|
25
|
+
isAuthenticated: !0,
|
|
26
|
+
user: e.payload.user
|
|
27
|
+
};
|
|
28
|
+
case "LOGOUT":
|
|
29
|
+
return {
|
|
30
|
+
...t,
|
|
31
|
+
isAuthenticated: !1,
|
|
32
|
+
user: null
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return t;
|
|
36
|
+
}
|
|
37
|
+
}, P = T(null);
|
|
38
|
+
function x(t) {
|
|
39
|
+
t({
|
|
40
|
+
type: s.Initial,
|
|
41
|
+
payload: {
|
|
42
|
+
isAuthenticated: !1,
|
|
43
|
+
user: null
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function M(t) {
|
|
48
|
+
const {
|
|
49
|
+
children: e
|
|
50
|
+
} = t, [m, n] = y(_, w), {
|
|
51
|
+
events_add_listener: h
|
|
52
|
+
} = D(), {
|
|
53
|
+
networkOperation: r
|
|
54
|
+
} = N(), {
|
|
55
|
+
domain_token: f
|
|
56
|
+
} = O(), [I, l] = S(
|
|
57
|
+
"vSession",
|
|
58
|
+
new Date().getTime() + ""
|
|
59
|
+
);
|
|
60
|
+
d(() => {
|
|
61
|
+
(async () => {
|
|
62
|
+
r({
|
|
63
|
+
method: "GET",
|
|
64
|
+
endPoint: "auth/login",
|
|
65
|
+
parms: {
|
|
66
|
+
user_data: !0
|
|
67
|
+
},
|
|
68
|
+
checkUnAuthorized: !1
|
|
69
|
+
}).then((i) => {
|
|
70
|
+
n({
|
|
71
|
+
type: s.Initial,
|
|
72
|
+
payload: {
|
|
73
|
+
isAuthenticated: !0,
|
|
74
|
+
user: i.user
|
|
75
|
+
}
|
|
76
|
+
}), U("userData", {
|
|
77
|
+
email: i.user.email,
|
|
78
|
+
remember: !0
|
|
79
|
+
})?.email !== i.user.email && u("userData", {
|
|
80
|
+
email: i.user.email
|
|
81
|
+
}, !0);
|
|
82
|
+
}).catch(() => {
|
|
83
|
+
x(n);
|
|
84
|
+
});
|
|
85
|
+
})();
|
|
86
|
+
}, [I]);
|
|
87
|
+
const g = async (a, i, o) => {
|
|
88
|
+
await r({
|
|
89
|
+
endPoint: "auth/login",
|
|
90
|
+
method: "POST",
|
|
91
|
+
data: {
|
|
92
|
+
email: a,
|
|
93
|
+
password: i,
|
|
94
|
+
domain_token: f
|
|
95
|
+
}
|
|
96
|
+
}).then((L) => {
|
|
97
|
+
const A = L.data;
|
|
98
|
+
o ? u("userData", {
|
|
99
|
+
email: a,
|
|
100
|
+
remember: o
|
|
101
|
+
}) : u("userData", {
|
|
102
|
+
email: "",
|
|
103
|
+
remember: o
|
|
104
|
+
}), n({
|
|
105
|
+
type: s.Login,
|
|
106
|
+
payload: {
|
|
107
|
+
user: A
|
|
108
|
+
}
|
|
109
|
+
}), l(new Date().getTime() + "");
|
|
110
|
+
});
|
|
111
|
+
}, c = async (a) => {
|
|
112
|
+
a && await r({
|
|
113
|
+
endPoint: "auth/logout",
|
|
114
|
+
method: "POST"
|
|
115
|
+
}), n({
|
|
116
|
+
type: s.Logout
|
|
117
|
+
}), l(new Date().getTime() + "");
|
|
118
|
+
}, p = () => {
|
|
119
|
+
c(!1);
|
|
120
|
+
};
|
|
121
|
+
return d(function() {
|
|
122
|
+
h(E.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED, p);
|
|
123
|
+
}, []), /* @__PURE__ */ v(P.Provider, {
|
|
124
|
+
value: {
|
|
125
|
+
...m,
|
|
126
|
+
login: g,
|
|
127
|
+
logout: c
|
|
128
|
+
},
|
|
129
|
+
children: e
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
P as A,
|
|
134
|
+
M as a
|
|
135
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { DomainCountry } from '../DomainCountryContext/types';
|
|
3
|
+
import type { Maybe } from '../../types';
|
|
4
|
+
export declare enum EnumTypes {
|
|
5
|
+
Initial = "INITIALIZE",
|
|
6
|
+
Login = "LOGIN",
|
|
7
|
+
Logout = "LOGOUT"
|
|
8
|
+
}
|
|
9
|
+
export declare type AuthProviderProps = {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare type ActionMap<M extends {
|
|
13
|
+
[index: string]: any;
|
|
14
|
+
}> = {
|
|
15
|
+
[Key in keyof M]: M[Key] extends undefined ? {
|
|
16
|
+
type: Key;
|
|
17
|
+
} : {
|
|
18
|
+
type: Key;
|
|
19
|
+
payload: M[Key];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare type SessionAuthPayload = {
|
|
23
|
+
[EnumTypes.Initial]: {
|
|
24
|
+
isAuthenticated: boolean;
|
|
25
|
+
user: AuthUser;
|
|
26
|
+
};
|
|
27
|
+
[EnumTypes.Login]: {
|
|
28
|
+
user: AuthUser;
|
|
29
|
+
};
|
|
30
|
+
[EnumTypes.Logout]: undefined;
|
|
31
|
+
};
|
|
32
|
+
export declare type SessionActions = ActionMap<SessionAuthPayload>[keyof ActionMap<SessionAuthPayload>];
|
|
33
|
+
export interface User {
|
|
34
|
+
email: string;
|
|
35
|
+
id: number;
|
|
36
|
+
first_name: string;
|
|
37
|
+
last_name: string;
|
|
38
|
+
account_id: number;
|
|
39
|
+
domain_country: DomainCountry;
|
|
40
|
+
avatar_url?: Maybe<string>;
|
|
41
|
+
user_type_id?: number;
|
|
42
|
+
}
|
|
43
|
+
export declare type AuthUser = Maybe<User>;
|
|
44
|
+
export declare type AuthState = {
|
|
45
|
+
isAuthenticated: boolean;
|
|
46
|
+
isInitialized: boolean;
|
|
47
|
+
user: AuthUser;
|
|
48
|
+
};
|
|
49
|
+
export interface SessionContextType extends AuthState {
|
|
50
|
+
login: (email: string, password: string, remember: boolean) => object | undefined;
|
|
51
|
+
logout: (isAuthenticated: boolean) => Promise<void>;
|
|
52
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createContext as u, useState as g, useEffect as d } from "react";
|
|
2
|
-
import { u as f } from "../../hooks/useFlagsStore/index.
|
|
2
|
+
import { u as f } from "../../hooks/useFlagsStore/index.f7c613ac.js";
|
|
3
3
|
import { u as p } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
4
4
|
import { u as D } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
5
5
|
import { C as l } from "../../types/index.42c24946.js";
|
|
6
|
-
import { s as v } from "../../node_modules.
|
|
6
|
+
import { s as v } from "../../node_modules.04fac7e9.js";
|
|
7
7
|
import { jsx as y } from "react/jsx-runtime";
|
|
8
8
|
const $ = u(null);
|
|
9
9
|
function C(r) {
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createContext as l, useRef as n } from "react";
|
|
2
|
+
import { createStore as f } from "zustand";
|
|
3
|
+
import { devtools as i } from "zustand/middleware";
|
|
4
|
+
import { i as c } from "../../node_modules.04fac7e9.js";
|
|
5
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
6
|
+
const g = (e) => f(
|
|
7
|
+
i(
|
|
8
|
+
c((r) => ({
|
|
9
|
+
...e,
|
|
10
|
+
flagsActions: {
|
|
11
|
+
clearFlags: () => {
|
|
12
|
+
r((o) => {
|
|
13
|
+
o.flags = [];
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
addFlag: (o) => {
|
|
17
|
+
r((t) => {
|
|
18
|
+
const a = t.flags;
|
|
19
|
+
a.findIndex((s) => s === o) < 0 && (t.flags = [...a, o]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
})),
|
|
24
|
+
{ name: "FlagsStore" }
|
|
25
|
+
)
|
|
26
|
+
), u = l(null);
|
|
27
|
+
function S({
|
|
28
|
+
children: e
|
|
29
|
+
}) {
|
|
30
|
+
const r = n();
|
|
31
|
+
return r.current || (r.current = g({
|
|
32
|
+
flags: []
|
|
33
|
+
})), /* @__PURE__ */ m(u.Provider, {
|
|
34
|
+
value: r.current,
|
|
35
|
+
children: e
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
u as F,
|
|
40
|
+
S as a
|
|
41
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createContext as F, useState as y, useEffect as A, useCallback as u } from "react";
|
|
2
|
+
import { C as L } from "../../types/index.42c24946.js";
|
|
3
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
4
|
+
import { u as N } from "../../hooks/useFlagsStore/index.f7c613ac.js";
|
|
5
|
+
import { u as P } from "../../hooks/useEnvironment/index.25f83176.js";
|
|
6
|
+
import { u as _ } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
7
|
+
import { u as x } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
8
|
+
const E = F(null);
|
|
9
|
+
function S(l) {
|
|
10
|
+
const {
|
|
11
|
+
children: c,
|
|
12
|
+
componentsDictionary: m,
|
|
13
|
+
moduleId: s,
|
|
14
|
+
moduleNameField: i = "module_name",
|
|
15
|
+
currentLang: d = "en",
|
|
16
|
+
isAuth: a = !0
|
|
17
|
+
} = l, f = N((t) => t.flagsActions.addFlag), [e, p] = y(void 0), {
|
|
18
|
+
domain_token: g
|
|
19
|
+
} = P(), {
|
|
20
|
+
startProgress: D,
|
|
21
|
+
stopProgress: h
|
|
22
|
+
} = _(), {
|
|
23
|
+
networkOperation: v
|
|
24
|
+
} = x();
|
|
25
|
+
A(() => {
|
|
26
|
+
let t = !0;
|
|
27
|
+
return D(), v({
|
|
28
|
+
method: "GET",
|
|
29
|
+
endPoint: a ? `dictionaries/${s}` : `na/dictionaries/${s}`,
|
|
30
|
+
parms: {
|
|
31
|
+
comps: m,
|
|
32
|
+
...a ? {} : {
|
|
33
|
+
domain_token: g
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}).then((o) => {
|
|
37
|
+
t && (p({
|
|
38
|
+
...o
|
|
39
|
+
}), f(L.FLAG_DICTIONARY_LOADED));
|
|
40
|
+
}).finally(() => {
|
|
41
|
+
h();
|
|
42
|
+
}), function() {
|
|
43
|
+
t = !1;
|
|
44
|
+
};
|
|
45
|
+
}, [d]);
|
|
46
|
+
const n = u((t) => {
|
|
47
|
+
if (e === void 0)
|
|
48
|
+
return "";
|
|
49
|
+
if (t === "")
|
|
50
|
+
return "No key";
|
|
51
|
+
let o;
|
|
52
|
+
const r = t.split(".");
|
|
53
|
+
try {
|
|
54
|
+
r.length === 1 && (o = e.data[t]), r.length === 2 && (o = e[r[0]][r[1]]);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return o || `N_D:[${t}]`;
|
|
58
|
+
}, [e]), C = u(() => n(i), [i, n]);
|
|
59
|
+
return /* @__PURE__ */ M(E.Provider, {
|
|
60
|
+
value: {
|
|
61
|
+
moduleDictionary: e,
|
|
62
|
+
getLabel: n,
|
|
63
|
+
getModuleLabel: C
|
|
64
|
+
},
|
|
65
|
+
children: c
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
E as M,
|
|
70
|
+
S as a
|
|
71
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createContext as f, useState as d, useEffect as p, useCallback as P } 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/useFlagsStore/index.f7c613ac.js";
|
|
5
|
+
import { u as h } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
|
+
import { u as F } from "../../hooks/useNetwork/index.3d79002b.js";
|
|
7
|
+
const L = f(null);
|
|
8
|
+
function S(n) {
|
|
9
|
+
const {
|
|
10
|
+
children: a,
|
|
11
|
+
queryPrivileges: r
|
|
12
|
+
} = n, o = E((e) => e.flagsActions.addFlag), [t, l] = d({}), {
|
|
13
|
+
startProgress: u,
|
|
14
|
+
stopProgress: m
|
|
15
|
+
} = h(), {
|
|
16
|
+
networkOperation: g
|
|
17
|
+
} = F();
|
|
18
|
+
p(() => {
|
|
19
|
+
let e = !0;
|
|
20
|
+
if (r.length === 0) {
|
|
21
|
+
o(i.FLAG_PRIVILEGES_LOADED);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
return u(), g({
|
|
25
|
+
method: "GET",
|
|
26
|
+
endPoint: "auth/login",
|
|
27
|
+
parms: {
|
|
28
|
+
privileges: r
|
|
29
|
+
}
|
|
30
|
+
}).then((s) => {
|
|
31
|
+
e && (l({
|
|
32
|
+
...s.data
|
|
33
|
+
}), o(i.FLAG_PRIVILEGES_LOADED));
|
|
34
|
+
}).finally(() => {
|
|
35
|
+
m();
|
|
36
|
+
}), function() {
|
|
37
|
+
e = !1;
|
|
38
|
+
};
|
|
39
|
+
}, []);
|
|
40
|
+
const c = P((e) => e in t, [t]);
|
|
41
|
+
return /* @__PURE__ */ v(L.Provider, {
|
|
42
|
+
value: {
|
|
43
|
+
hasPrivilege: c,
|
|
44
|
+
privileges: t
|
|
45
|
+
},
|
|
46
|
+
children: a
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
L as M,
|
|
51
|
+
S as a
|
|
52
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createContext as n } from "react";
|
|
2
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
3
|
+
import { a as l } from "../../hooks/useFlagsStore/index.f7c613ac.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
|
+
};
|
|
@@ -2,6 +2,7 @@ export { BaseContext, BaseProvider } from './BaseContext';
|
|
|
2
2
|
export { EnvironmentContext, EnvironmentProvider } from './EnvironmentContext';
|
|
3
3
|
export { HostToolsContext, HostToolsProvider } from './HostToolsContext';
|
|
4
4
|
export { NetworkContext, NetworkProvider } from './NetworkContext';
|
|
5
|
+
export { AuthContext, AuthProvider } from './AuthContext';
|
|
5
6
|
export { FlagsContext, FlagsProvider } from './FlagsContext';
|
|
6
7
|
export { DomainContext, DomainProvider } from './DomainContext';
|
|
7
8
|
export { ModuleDictionaryContext, ModuleDictionaryProvider } from './ModuleDictionaryContext';
|
|
@@ -12,5 +12,6 @@ export { useNetwork } from './useNetwork';
|
|
|
12
12
|
export { usePaginate } from './usePaginate';
|
|
13
13
|
export { usePropageteMF } from './usePropageteMF';
|
|
14
14
|
export { useDomainCountry } from './useDomainCountry';
|
|
15
|
+
export { useAuth } from './useAuth';
|
|
15
16
|
export type { PagerState } from './usePaginate/types';
|
|
16
17
|
export { initialPagerState } from './usePaginate/types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext as o } from "react";
|
|
2
|
+
import { A as e } from "../../contexts/AuthContext/index.717a8c86.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 @@
|
|
|
1
|
+
export { useAuth } from './useAuth';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
|
-
import { D as n } from "../../contexts/DomainContext/index.
|
|
3
|
-
import { D as e } from "../../contexts/DomainCountryContext/index.
|
|
2
|
+
import { D as n } from "../../contexts/DomainContext/index.2ed56159.js";
|
|
3
|
+
import { D as e } from "../../contexts/DomainCountryContext/index.3cdf9462.js";
|
|
4
4
|
const m = () => {
|
|
5
5
|
const o = t(n);
|
|
6
6
|
if (!o)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useContext as o } from "react";
|
|
2
|
-
import { F as i } from "../../contexts/FlagsContext/index.
|
|
3
|
-
import {
|
|
2
|
+
import { F as i } from "../../contexts/FlagsContext/index.5b096265.js";
|
|
3
|
+
import { useStore as l } from "zustand";
|
|
4
|
+
import { s as a } from "../../node_modules.04fac7e9.js";
|
|
4
5
|
function u(t, s) {
|
|
5
6
|
const e = o(i);
|
|
6
7
|
if (!e)
|
|
@@ -10,8 +11,8 @@ function u(t, s) {
|
|
|
10
11
|
function f(t, s) {
|
|
11
12
|
return t.filter((r) => s.findIndex((n) => n === r) !== -1).length === t.length;
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
+
const x = (t) => u((e) => f(t, e.flags), a);
|
|
14
15
|
export {
|
|
15
|
-
|
|
16
|
+
x as a,
|
|
16
17
|
u
|
|
17
18
|
};
|
|
@@ -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.
|
|
2
|
+
import { M as r } from "../../contexts/ModuleSkeletonContext/index.9267d86a.js";
|
|
3
3
|
const S = () => {
|
|
4
4
|
const [t, o] = n(!0), e = s(r);
|
|
5
5
|
if (!e)
|