@m4l/core 0.1.30 → 0.1.31
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.1d8ec226.js +49 -0
- package/contexts/DomainCountryContext/{index.cfd81c74.js → index.e195de3c.js} +4 -4
- package/contexts/ModuleDictionaryContext/{index.0247f396.js → index.a705fc17.js} +4 -4
- package/contexts/ModulePrivilegesContext/{index.c5aacd43.js → index.b5ea3bc2.js} +4 -4
- package/contexts/ModuleSkeletonContext/{index.3a180789.js → index.02a06776.js} +4 -4
- package/hooks/useDomain/{index.5bccbdc3.js → index.e567d819.js} +2 -2
- package/hooks/useLocalStorage/index.c9f47e01.js +57 -0
- package/hooks/useLocalStorageWithListener/index.d.ts +1 -1
- package/hooks/useModuleDictionary/{index.af27f447.js → index.4aaa524e.js} +1 -1
- package/hooks/useModulePrivileges/{index.8b7c3831.js → index.34087161.js} +1 -1
- package/hooks/useModuleSkeleton/{index.fd0dcf82.js → index.b333ef86.js} +1 -1
- package/index.js +10 -10
- package/package.json +1 -1
- package/contexts/DomainContext/index.f9025d3b.js +0 -51
- package/hooks/useLocalStorage/index.fa31b0d1.js +0 -51
|
@@ -0,0 +1,49 @@
|
|
|
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.04dca988.js";
|
|
4
|
+
import { u as v } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
5
|
+
import { C as y } from "../../types/index.38eca705.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: t
|
|
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
|
+
}), {
|
|
22
|
+
networkOperation: d
|
|
23
|
+
} = v();
|
|
24
|
+
return p(() => {
|
|
25
|
+
let a = !0;
|
|
26
|
+
return d({
|
|
27
|
+
method: "GET",
|
|
28
|
+
endPoint: `na/info/${r}`
|
|
29
|
+
}).then((o) => {
|
|
30
|
+
a && (u({
|
|
31
|
+
...o.data,
|
|
32
|
+
company_logo_normal_url: o.data.company_logo_normal_url ?? `${n}/${t}/frontend/commons/assets/icons/isologo.svg`,
|
|
33
|
+
company_logo_small_url: o.data.company_logo_small_url ?? `${n}/${t}/frontend/commons/assets/icons/isotipo_m4l.svg`
|
|
34
|
+
}), l(y.FLAG_DOMAIN_LOADED), c(!0));
|
|
35
|
+
}).finally(() => {
|
|
36
|
+
}), function() {
|
|
37
|
+
a = !1;
|
|
38
|
+
};
|
|
39
|
+
}, []), /* @__PURE__ */ h($.Provider, {
|
|
40
|
+
value: {
|
|
41
|
+
..._
|
|
42
|
+
},
|
|
43
|
+
children: i && m
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
$ as D,
|
|
48
|
+
A as a
|
|
49
|
+
};
|
|
@@ -3,10 +3,10 @@ import "../BaseContext/index.f9cdc955.js";
|
|
|
3
3
|
import "../EnvironmentContext/index.7045c64f.js";
|
|
4
4
|
import "../FlagsContext/index.5f795859.js";
|
|
5
5
|
import { u as N } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
|
-
import "../DomainContext/index.
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
9
|
-
import "../ModuleSkeletonContext/index.
|
|
6
|
+
import "../DomainContext/index.1d8ec226.js";
|
|
7
|
+
import "../ModuleDictionaryContext/index.a705fc17.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.b5ea3bc2.js";
|
|
9
|
+
import "../ModuleSkeletonContext/index.02a06776.js";
|
|
10
10
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
11
11
|
import { E as n } from "../../types/index.38eca705.js";
|
|
12
12
|
import { jsx as f } from "react/jsx-runtime";
|
|
@@ -3,11 +3,11 @@ import "../BaseContext/index.f9cdc955.js";
|
|
|
3
3
|
import { u as M } from "../../hooks/useEnvironment/index.04dca988.js";
|
|
4
4
|
import { u as N } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import { u as P } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
|
-
import "../DomainContext/index.
|
|
7
|
-
import "../ModulePrivilegesContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
6
|
+
import "../DomainContext/index.1d8ec226.js";
|
|
7
|
+
import "../ModulePrivilegesContext/index.b5ea3bc2.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.02a06776.js";
|
|
9
9
|
import { u as _ } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.e195de3c.js";
|
|
11
11
|
import { C as x } from "../../types/index.38eca705.js";
|
|
12
12
|
import { jsx as A } from "react/jsx-runtime";
|
|
13
13
|
const E = y(null);
|
|
@@ -3,11 +3,11 @@ import "../BaseContext/index.f9cdc955.js";
|
|
|
3
3
|
import "../EnvironmentContext/index.7045c64f.js";
|
|
4
4
|
import { u as v } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import { u as E } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
|
-
import "../DomainContext/index.
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
6
|
+
import "../DomainContext/index.1d8ec226.js";
|
|
7
|
+
import "../ModuleDictionaryContext/index.a705fc17.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.02a06776.js";
|
|
9
9
|
import { u as h } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.e195de3c.js";
|
|
11
11
|
import { C as i } from "../../types/index.38eca705.js";
|
|
12
12
|
import { jsx as L } from "react/jsx-runtime";
|
|
13
13
|
const C = f(null);
|
|
@@ -3,11 +3,11 @@ import "../BaseContext/index.f9cdc955.js";
|
|
|
3
3
|
import "../EnvironmentContext/index.7045c64f.js";
|
|
4
4
|
import { a as m } from "../../hooks/useFlags/index.a986729d.js";
|
|
5
5
|
import "../HostToolsContext/index.499db832.js";
|
|
6
|
-
import "../DomainContext/index.
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
6
|
+
import "../DomainContext/index.1d8ec226.js";
|
|
7
|
+
import "../ModuleDictionaryContext/index.a705fc17.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.b5ea3bc2.js";
|
|
9
9
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.e195de3c.js";
|
|
11
11
|
import { jsx as n } from "react/jsx-runtime";
|
|
12
12
|
const p = i(null);
|
|
13
13
|
function P(o) {
|
|
@@ -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.1d8ec226.js";
|
|
3
|
+
import { D as e } from "../../contexts/DomainCountryContext/index.e195de3c.js";
|
|
4
4
|
const m = () => {
|
|
5
5
|
const o = t(n);
|
|
6
6
|
if (!o)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { useState as a, useEffect as g } from "react";
|
|
2
|
+
function S(r, e) {
|
|
3
|
+
const [n, s] = a(() => {
|
|
4
|
+
try {
|
|
5
|
+
const t = window.localStorage.getItem(r);
|
|
6
|
+
return t !== null ? typeof e == "string" ? t : JSON.parse(t) : e;
|
|
7
|
+
} catch {
|
|
8
|
+
return e;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
return [n, (t) => {
|
|
12
|
+
try {
|
|
13
|
+
window.localStorage.setItem(
|
|
14
|
+
r,
|
|
15
|
+
typeof e == "string" ? String(t) : JSON.stringify(t)
|
|
16
|
+
), s(t);
|
|
17
|
+
} catch {
|
|
18
|
+
}
|
|
19
|
+
}];
|
|
20
|
+
}
|
|
21
|
+
function u(r, e) {
|
|
22
|
+
const [n, s] = a(() => {
|
|
23
|
+
try {
|
|
24
|
+
const t = localStorage.getItem(r);
|
|
25
|
+
return console.log("useLocalStorageWithListener", e), t !== null ? typeof e == "string" ? t : JSON.parse(t) : e;
|
|
26
|
+
} catch {
|
|
27
|
+
return e;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return g(() => {
|
|
31
|
+
const t = (o) => {
|
|
32
|
+
if (o.storageArea === localStorage && o.key === r) {
|
|
33
|
+
console.log("Se actualiza el storage", o);
|
|
34
|
+
try {
|
|
35
|
+
o.newValue && s(
|
|
36
|
+
typeof e == "string" ? o.newValue : JSON.parse(o.newValue)
|
|
37
|
+
);
|
|
38
|
+
} catch {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return window.addEventListener("storage", t), () => {
|
|
43
|
+
window.removeEventListener("storage", t);
|
|
44
|
+
};
|
|
45
|
+
}, [r, e]), [n, (t) => {
|
|
46
|
+
let o;
|
|
47
|
+
if (typeof t == "function")
|
|
48
|
+
throw Error("Funcions are not allowed in useLocalStorageWithListener");
|
|
49
|
+
if (typeof t != typeof e)
|
|
50
|
+
throw Error("Not allowed change type from initial value");
|
|
51
|
+
typeof t == "string" ? o = t : o = JSON.stringify(t), localStorage.setItem(r, o), s(t);
|
|
52
|
+
}];
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
u as a,
|
|
56
|
+
S as u
|
|
57
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useLocalStorageWithListener<ValueType>(key: string,
|
|
1
|
+
export declare function useLocalStorageWithListener<ValueType>(key: string, initialValue: ValueType): any[];
|
|
2
2
|
export default useLocalStorageWithListener;
|
|
@@ -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.02a06776.js";
|
|
3
3
|
const S = () => {
|
|
4
4
|
const [t, o] = n(!0), e = s(r);
|
|
5
5
|
if (!e)
|
package/index.js
CHANGED
|
@@ -3,21 +3,21 @@ import { B as i, a as n } from "./contexts/BaseContext/index.f9cdc955.js";
|
|
|
3
3
|
import { E as u, a as x } from "./contexts/EnvironmentContext/index.7045c64f.js";
|
|
4
4
|
import { F as l, a as f } from "./contexts/FlagsContext/index.5f795859.js";
|
|
5
5
|
import { H as v, a as g } from "./contexts/HostToolsContext/index.499db832.js";
|
|
6
|
-
import { D as C, a as M } from "./contexts/DomainContext/index.
|
|
7
|
-
import { M as S, a as c } from "./contexts/ModuleDictionaryContext/index.
|
|
8
|
-
import { M as E, a as F } from "./contexts/ModulePrivilegesContext/index.
|
|
9
|
-
import { M as B, a as L } from "./contexts/ModuleSkeletonContext/index.
|
|
6
|
+
import { D as C, a as M } from "./contexts/DomainContext/index.1d8ec226.js";
|
|
7
|
+
import { M as S, a as c } from "./contexts/ModuleDictionaryContext/index.a705fc17.js";
|
|
8
|
+
import { M as E, a as F } from "./contexts/ModulePrivilegesContext/index.b5ea3bc2.js";
|
|
9
|
+
import { M as B, a as L } from "./contexts/ModuleSkeletonContext/index.02a06776.js";
|
|
10
10
|
import { N, a as w } from "./contexts/NetworkContext/index.d1dfbc3a.js";
|
|
11
|
-
import { D as h, a as O } from "./contexts/DomainCountryContext/index.
|
|
11
|
+
import { D as h, a as O } from "./contexts/DomainCountryContext/index.e195de3c.js";
|
|
12
12
|
import { u as b } from "./hooks/useBase/index.4375dcef.js";
|
|
13
13
|
import { u as q } from "./hooks/useEnvironment/index.04dca988.js";
|
|
14
14
|
import { u as A, a as G } from "./hooks/useFlags/index.a986729d.js";
|
|
15
15
|
import { u as J } from "./hooks/useHostTools/index.66d9a667.js";
|
|
16
|
-
import { u as Q, a as R } from "./hooks/useDomain/index.
|
|
17
|
-
import { u as V, a as X } from "./hooks/useLocalStorage/index.
|
|
18
|
-
import { u as Z } from "./hooks/useModuleDictionary/index.
|
|
19
|
-
import { u as $ } from "./hooks/useModulePrivileges/index.
|
|
20
|
-
import { u as eo } from "./hooks/useModuleSkeleton/index.
|
|
16
|
+
import { u as Q, a as R } from "./hooks/useDomain/index.e567d819.js";
|
|
17
|
+
import { u as V, a as X } from "./hooks/useLocalStorage/index.c9f47e01.js";
|
|
18
|
+
import { u as Z } from "./hooks/useModuleDictionary/index.4aaa524e.js";
|
|
19
|
+
import { u as $ } from "./hooks/useModulePrivileges/index.34087161.js";
|
|
20
|
+
import { u as eo } from "./hooks/useModuleSkeleton/index.b333ef86.js";
|
|
21
21
|
import { u as ao } from "./hooks/useNetwork/index.acbf28d5.js";
|
|
22
22
|
import { i as so, u as io } from "./hooks/usePaginate/index.7cb17527.js";
|
|
23
23
|
import { C as mo, E as uo } from "./types/index.38eca705.js";
|
package/package.json
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createContext as u, useState as m, useEffect as g } from "react";
|
|
2
|
-
import { u as p } from "../../hooks/useFlags/index.a986729d.js";
|
|
3
|
-
import { u as v } from "../../hooks/useEnvironment/index.04dca988.js";
|
|
4
|
-
import { u as D } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
5
|
-
import { C as y } from "../../types/index.38eca705.js";
|
|
6
|
-
import { jsxs as h, jsx as x } from "react/jsx-runtime";
|
|
7
|
-
const $ = u(null);
|
|
8
|
-
function O(r) {
|
|
9
|
-
const {
|
|
10
|
-
children: l
|
|
11
|
-
} = r, {
|
|
12
|
-
domain_token: i,
|
|
13
|
-
host_static_assets: n,
|
|
14
|
-
environment_assets: a
|
|
15
|
-
} = v(), {
|
|
16
|
-
addFlag: d
|
|
17
|
-
} = p(), [s, c] = m(!1), [t, f] = m({
|
|
18
|
-
company_logo_small_url: "",
|
|
19
|
-
company_logo_normal_url: "",
|
|
20
|
-
name: ""
|
|
21
|
-
}), {
|
|
22
|
-
networkOperation: _
|
|
23
|
-
} = D();
|
|
24
|
-
return console.log("domain values", t), g(() => {
|
|
25
|
-
let e = !0;
|
|
26
|
-
return _({
|
|
27
|
-
method: "GET",
|
|
28
|
-
endPoint: `na/info/${i}`
|
|
29
|
-
}).then((o) => {
|
|
30
|
-
e && (f({
|
|
31
|
-
...o.data,
|
|
32
|
-
company_logo_normal_url: o.data.company_logo_normal_url ?? `${n}/${a}/frontend/commons/assets/icons/isologo.svg`,
|
|
33
|
-
company_logo_small_url: o.data.company_logo_small_url ?? `${n}/${a}/frontend/commons/assets/icons/isotipo_m4l.svg`
|
|
34
|
-
}), d(y.FLAG_DOMAIN_LOADED), c(!0));
|
|
35
|
-
}).finally(() => {
|
|
36
|
-
}), function() {
|
|
37
|
-
e = !1;
|
|
38
|
-
};
|
|
39
|
-
}, []), /* @__PURE__ */ h($.Provider, {
|
|
40
|
-
value: {
|
|
41
|
-
...t
|
|
42
|
-
},
|
|
43
|
-
children: [s && l, !s && /* @__PURE__ */ x("div", {
|
|
44
|
-
children: "cargansdfasfsafsdfsafsdafdsfsfasdo"
|
|
45
|
-
})]
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
$ as D,
|
|
50
|
-
O as a
|
|
51
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { useState as c, useEffect as l } from "react";
|
|
2
|
-
function S(r, e) {
|
|
3
|
-
const [s, n] = c(() => {
|
|
4
|
-
try {
|
|
5
|
-
const t = window.localStorage.getItem(r);
|
|
6
|
-
return t !== null ? typeof e == "string" ? t : JSON.parse(t) : e;
|
|
7
|
-
} catch {
|
|
8
|
-
return e;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
return [s, (t) => {
|
|
12
|
-
try {
|
|
13
|
-
window.localStorage.setItem(
|
|
14
|
-
r,
|
|
15
|
-
typeof e == "string" ? String(t) : JSON.stringify(t)
|
|
16
|
-
), n(t);
|
|
17
|
-
} catch {
|
|
18
|
-
}
|
|
19
|
-
}];
|
|
20
|
-
}
|
|
21
|
-
function i(r, e) {
|
|
22
|
-
const [s, n] = c(() => {
|
|
23
|
-
try {
|
|
24
|
-
const t = localStorage.getItem(r);
|
|
25
|
-
return t === null ? e : JSON.parse(t);
|
|
26
|
-
} catch {
|
|
27
|
-
return e;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return l(() => {
|
|
31
|
-
const t = (o) => {
|
|
32
|
-
if (o.storageArea === localStorage && o.key === r)
|
|
33
|
-
try {
|
|
34
|
-
o.newValue && n(JSON.parse(o.newValue));
|
|
35
|
-
} catch {
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return window.addEventListener("storage", t), () => {
|
|
39
|
-
window.removeEventListener("storage", t);
|
|
40
|
-
};
|
|
41
|
-
}, [r, e]), [s, (t) => {
|
|
42
|
-
n((o) => {
|
|
43
|
-
const a = typeof t == "function" ? t(o) : t;
|
|
44
|
-
return localStorage.setItem(r, JSON.stringify(a)), a;
|
|
45
|
-
});
|
|
46
|
-
}];
|
|
47
|
-
}
|
|
48
|
-
export {
|
|
49
|
-
i as a,
|
|
50
|
-
S as u
|
|
51
|
-
};
|