@m4l/core 2.0.16-beta.0 → 2.0.18
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.
|
@@ -1,55 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as d, useState as p, useEffect as P, useCallback as v } from "react";
|
|
3
3
|
import { C as i } from "../../types/index.js";
|
|
4
|
-
import { u as
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
const { children:
|
|
10
|
-
|
|
4
|
+
import { u as E } from "../../hooks/useFlagsStore/index.js";
|
|
5
|
+
import { u as h } from "../../hooks/useHostTools/index.js";
|
|
6
|
+
import { u as F } from "../../hooks/useNetwork/index.js";
|
|
7
|
+
const L = d(null);
|
|
8
|
+
function S(n) {
|
|
9
|
+
const { children: a, queryPrivileges: r } = n, o = E((e) => e.flagsActions.addFlag), [t, l] = p({}), { startProgress: u, stopProgress: m } = h(), { networkOperation: g } = F();
|
|
10
|
+
P(() => {
|
|
11
11
|
let e = !0;
|
|
12
|
-
if (
|
|
12
|
+
if (r.length === 0) {
|
|
13
13
|
o(i.FLAG_PRIVILEGES_LOADED);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return u(), g({
|
|
17
17
|
method: "GET",
|
|
18
18
|
endPoint: "auth/login",
|
|
19
19
|
parms: {
|
|
20
|
-
privileges:
|
|
21
|
-
user_data: !0
|
|
20
|
+
privileges: r
|
|
22
21
|
}
|
|
23
22
|
// isRemote: false
|
|
24
|
-
}).then((
|
|
25
|
-
e && (
|
|
26
|
-
...
|
|
27
|
-
}), c({
|
|
28
|
-
...r.user
|
|
23
|
+
}).then((s) => {
|
|
24
|
+
e && (l({
|
|
25
|
+
...s.data
|
|
29
26
|
}), o(i.FLAG_PRIVILEGES_LOADED));
|
|
30
27
|
}).finally(() => {
|
|
31
|
-
|
|
28
|
+
m();
|
|
32
29
|
}), function() {
|
|
33
30
|
e = !1;
|
|
34
31
|
};
|
|
35
32
|
}, []);
|
|
36
|
-
const
|
|
33
|
+
const c = v(
|
|
37
34
|
(e) => e in t,
|
|
38
35
|
[t]
|
|
39
36
|
);
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
|
|
37
|
+
return /* @__PURE__ */ f(
|
|
38
|
+
L.Provider,
|
|
42
39
|
{
|
|
43
40
|
value: {
|
|
44
|
-
hasPrivilege:
|
|
45
|
-
privileges: t
|
|
46
|
-
userData: m
|
|
41
|
+
hasPrivilege: c,
|
|
42
|
+
privileges: t
|
|
47
43
|
},
|
|
48
|
-
children:
|
|
44
|
+
children: a
|
|
49
45
|
}
|
|
50
46
|
);
|
|
51
47
|
}
|
|
52
48
|
export {
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
L as M,
|
|
50
|
+
S as a
|
|
55
51
|
};
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { M as
|
|
3
|
-
const
|
|
4
|
-
const
|
|
1
|
+
import { useContext as o } from "react";
|
|
2
|
+
import { M as t } from "../../contexts/ModuleSkeletonContext/index.js";
|
|
3
|
+
const s = () => {
|
|
4
|
+
const e = o(t);
|
|
5
5
|
if (!e)
|
|
6
6
|
throw new Error("useModuleSkeleton context must be use inside ModuleSkeletonContext");
|
|
7
|
-
return
|
|
8
|
-
t !== e.isSkeleton && o(e.isSkeleton);
|
|
9
|
-
}, [e.isSkeleton]), t;
|
|
7
|
+
return e.isSkeleton;
|
|
10
8
|
};
|
|
11
9
|
export {
|
|
12
|
-
|
|
10
|
+
s as u
|
|
13
11
|
};
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -110,7 +110,8 @@ export declare enum CommonFlags {
|
|
|
110
110
|
FLAG_PRIVILEGES_LOADED = "privileges_loaded",
|
|
111
111
|
FLAG_DICTIONARY_LOADED = "dictionary_loaded",
|
|
112
112
|
FLAG_DOMAIN_LOADED = "domain_loaded",
|
|
113
|
-
FLAG_FORM_LOADED = "form_loaded"
|
|
113
|
+
FLAG_FORM_LOADED = "form_loaded",
|
|
114
|
+
FLAG_AREAS_LOADED = "areas_loaded"
|
|
114
115
|
}
|
|
115
116
|
export declare type AxiosOperation = (props: NetworkProps, enviroment: EnvironmentType, hostTools: HostToolsType) => Promise<any>;
|
|
116
117
|
export {};
|
package/types/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var E = /* @__PURE__ */ ((_) => (_.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED = "netsevice_unauthorized", _.EMMIT_EVENT_HOST_LOCALE_CHANGE = "host_locale_change", _.EMMIT_EVENT_HOST_THEME_CHANGE = "host_theme_change", _.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE = "domain_country_change", _.EMMIT_EVENT_HOST_FORMATTER_CHANGE = "formatter_change", _.EMMIT_EVENT_HOST_EMERGE_WINDOW = "host_emerge_window", _))(E || {}), T = /* @__PURE__ */ ((_) => (_.FLAG_PRIVILEGES_LOADED = "privileges_loaded", _.FLAG_DICTIONARY_LOADED = "dictionary_loaded", _.FLAG_DOMAIN_LOADED = "domain_loaded", _.FLAG_FORM_LOADED = "form_loaded", _))(T || {});
|
|
1
|
+
var E = /* @__PURE__ */ ((_) => (_.EMMIT_EVENT_NET_SERVICE_UNAUTHORIZED = "netsevice_unauthorized", _.EMMIT_EVENT_HOST_LOCALE_CHANGE = "host_locale_change", _.EMMIT_EVENT_HOST_THEME_CHANGE = "host_theme_change", _.EMMIT_EVENT_HOST_DOMAIN_COUNTRY_CHANGE = "domain_country_change", _.EMMIT_EVENT_HOST_FORMATTER_CHANGE = "formatter_change", _.EMMIT_EVENT_HOST_EMERGE_WINDOW = "host_emerge_window", _))(E || {}), T = /* @__PURE__ */ ((_) => (_.FLAG_PRIVILEGES_LOADED = "privileges_loaded", _.FLAG_DICTIONARY_LOADED = "dictionary_loaded", _.FLAG_DOMAIN_LOADED = "domain_loaded", _.FLAG_FORM_LOADED = "form_loaded", _.FLAG_AREAS_LOADED = "areas_loaded", _))(T || {});
|
|
2
2
|
export {
|
|
3
3
|
T as C,
|
|
4
4
|
E
|