@m4l/core 2.0.23-beta.4 → 2.0.23
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,78 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as E, useState as
|
|
3
|
-
import { u as
|
|
4
|
-
import { u as
|
|
1
|
+
import { jsx as $ } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as E, useState as l, useMemo as O, useEffect as y, useCallback as v } from "react";
|
|
3
|
+
import { u as b } from "../../hooks/useEnvironment/index.js";
|
|
4
|
+
import { u as I } from "../../hooks/useFlagsStore/index.js";
|
|
5
5
|
import { u as T } from "../../hooks/useHostTools/index.js";
|
|
6
|
-
import { u as
|
|
7
|
-
import { C as
|
|
6
|
+
import { u as k } from "../../hooks/useNetwork/index.js";
|
|
7
|
+
import { C as w } from "../../types/index.js";
|
|
8
8
|
const G = E(null);
|
|
9
|
-
function
|
|
9
|
+
function B(F) {
|
|
10
10
|
const {
|
|
11
|
-
children:
|
|
11
|
+
children: L,
|
|
12
12
|
componentsDictionary: a,
|
|
13
|
-
moduleId:
|
|
14
|
-
moduleNameField:
|
|
15
|
-
currentLang:
|
|
16
|
-
isAuth:
|
|
17
|
-
moduleDictionaryLoaded:
|
|
18
|
-
} =
|
|
19
|
-
(t,
|
|
13
|
+
moduleId: u,
|
|
14
|
+
moduleNameField: d = "module_name",
|
|
15
|
+
currentLang: C = "en",
|
|
16
|
+
isAuth: c = !0,
|
|
17
|
+
moduleDictionaryLoaded: M
|
|
18
|
+
} = F, m = I((t) => t.flagsActions.addFlag), [n, f] = l(void 0), { domain_token: A } = b(), { startProgress: S, stopProgress: _ } = T(), { networkOperation: x } = k(), [p, N] = l(M), [g, D] = l(!1), h = O(() => a ? a.filter(
|
|
19
|
+
(t, o, e) => e.indexOf(t) === o
|
|
20
20
|
) : [], [a]);
|
|
21
|
-
|
|
21
|
+
y(() => {
|
|
22
22
|
let t = !0;
|
|
23
|
-
return
|
|
24
|
-
...
|
|
25
|
-
}), N(void 0),
|
|
23
|
+
return p ? (f({
|
|
24
|
+
...p
|
|
25
|
+
}), N(void 0), D(!0)) : (S(), x({
|
|
26
26
|
method: "GET",
|
|
27
|
-
endPoint:
|
|
27
|
+
endPoint: c ? `dictionaries/${u}` : `na/dictionaries/${u}`,
|
|
28
28
|
parms: {
|
|
29
|
-
comps:
|
|
29
|
+
comps: h,
|
|
30
30
|
// lang: 'en',
|
|
31
|
-
...
|
|
31
|
+
...c ? {} : { domain_token: A }
|
|
32
32
|
}
|
|
33
33
|
// isRemote: false
|
|
34
|
-
}).then((
|
|
35
|
-
t && (
|
|
36
|
-
...
|
|
37
|
-
}),
|
|
34
|
+
}).then((o) => {
|
|
35
|
+
t && (f({
|
|
36
|
+
...o
|
|
37
|
+
}), D(!0));
|
|
38
38
|
}).finally(() => {
|
|
39
|
-
|
|
39
|
+
_();
|
|
40
40
|
})), function() {
|
|
41
41
|
t = !1;
|
|
42
42
|
};
|
|
43
|
-
}, [
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
}, [C, h]), y(() => {
|
|
44
|
+
g && m(w.FLAG_DICTIONARY_LOADED);
|
|
45
|
+
}, [m, g]);
|
|
46
|
+
const s = v(
|
|
47
|
+
(t, ...o) => {
|
|
46
48
|
if (n === void 0)
|
|
47
49
|
return "";
|
|
48
50
|
if (t === "")
|
|
49
51
|
return "No key";
|
|
50
|
-
let
|
|
52
|
+
let e;
|
|
51
53
|
const i = t.split(".");
|
|
52
54
|
try {
|
|
53
|
-
i.length === 1 && (
|
|
55
|
+
i.length === 1 && (e = n.data[t]), i.length === 2 && (e = n[i[0]][i[1]]);
|
|
54
56
|
} catch {
|
|
55
57
|
}
|
|
56
|
-
if (
|
|
57
|
-
for (let r = 0; r <
|
|
58
|
-
|
|
59
|
-
return
|
|
58
|
+
if (o.length > 0 && e)
|
|
59
|
+
for (let r = 0; r < o.length; r++)
|
|
60
|
+
e = e?.replaceAll(`$${r + 1}`, o[r].toString());
|
|
61
|
+
return e || `N_D:[${t}]`;
|
|
60
62
|
},
|
|
61
63
|
[n]
|
|
62
|
-
),
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
+
), P = v(() => s(d), [d, s]);
|
|
65
|
+
return /* @__PURE__ */ $(
|
|
64
66
|
G.Provider,
|
|
65
67
|
{
|
|
66
68
|
value: {
|
|
67
69
|
moduleDictionary: n,
|
|
68
70
|
getLabel: s,
|
|
69
|
-
getModuleLabel:
|
|
71
|
+
getModuleLabel: P
|
|
70
72
|
},
|
|
71
|
-
children:
|
|
73
|
+
children: L
|
|
72
74
|
}
|
|
73
75
|
);
|
|
74
76
|
}
|
|
75
77
|
export {
|
|
76
78
|
G as M,
|
|
77
|
-
|
|
79
|
+
B as a
|
|
78
80
|
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
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
4
|
import { u as E } from "../../hooks/useFlagsStore/index.js";
|
|
5
|
-
import { u as
|
|
6
|
-
import { u as
|
|
7
|
-
const
|
|
5
|
+
import { u as A } from "../../hooks/useHostTools/index.js";
|
|
6
|
+
import { u as h } from "../../hooks/useNetwork/index.js";
|
|
7
|
+
const F = d(null);
|
|
8
8
|
function S(n) {
|
|
9
|
-
const { children: a, queryPrivileges:
|
|
9
|
+
const { children: a, queryPrivileges: o } = n, s = E((e) => e.flagsActions.addFlag), [r, l] = p({}), { startProgress: u, stopProgress: m } = A(), { networkOperation: f } = h();
|
|
10
10
|
P(() => {
|
|
11
11
|
let e = !0;
|
|
12
|
-
if (
|
|
13
|
-
|
|
12
|
+
if (o.length === 0) {
|
|
13
|
+
s(i.FLAG_PRIVILEGES_LOADED);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
return u(),
|
|
16
|
+
return u(), f({
|
|
17
17
|
method: "GET",
|
|
18
18
|
endPoint: "auth/login",
|
|
19
19
|
parms: {
|
|
20
|
-
privileges:
|
|
20
|
+
privileges: o
|
|
21
21
|
}
|
|
22
22
|
// isRemote: false
|
|
23
|
-
}).then((
|
|
23
|
+
}).then((t) => {
|
|
24
24
|
e && (l({
|
|
25
|
-
...
|
|
26
|
-
}),
|
|
25
|
+
...t.data
|
|
26
|
+
}), s(i.FLAG_PRIVILEGES_LOADED));
|
|
27
27
|
}).finally(() => {
|
|
28
28
|
m();
|
|
29
29
|
}), function() {
|
|
30
30
|
e = !1;
|
|
31
31
|
};
|
|
32
32
|
}, []);
|
|
33
|
-
const
|
|
34
|
-
(e) => e in
|
|
35
|
-
[
|
|
33
|
+
const g = v(
|
|
34
|
+
(e) => Array.isArray(e) ? e.some((t) => t in r) : e in r,
|
|
35
|
+
[r]
|
|
36
36
|
);
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
|
|
37
|
+
return /* @__PURE__ */ c(
|
|
38
|
+
F.Provider,
|
|
39
39
|
{
|
|
40
40
|
value: {
|
|
41
|
-
hasPrivilege:
|
|
42
|
-
privileges:
|
|
41
|
+
hasPrivilege: g,
|
|
42
|
+
privileges: r
|
|
43
43
|
},
|
|
44
44
|
children: a
|
|
45
45
|
}
|
|
46
46
|
);
|
|
47
47
|
}
|
|
48
48
|
export {
|
|
49
|
-
|
|
49
|
+
F as M,
|
|
50
50
|
S as a
|
|
51
51
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "2.0.23
|
|
3
|
+
"version": "2.0.23",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@types/react": "^18.0.0",
|
|
32
32
|
"@types/react-dom": "^18.0.0",
|
|
33
33
|
"react-dom": "^18.0.0",
|
|
34
|
-
"vite": "^
|
|
34
|
+
"vite": "^6.3.5"
|
|
35
35
|
},
|
|
36
36
|
"overrides": {
|
|
37
37
|
"glob": "^10.4.5",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@types/react": "^18.0.0",
|
|
41
41
|
"@types/react-dom": "^18.0.0",
|
|
42
42
|
"react-dom": "^18.0.0",
|
|
43
|
-
"vite": "^
|
|
43
|
+
"vite": "^6.3.5"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"*"
|