@m4l/core 0.1.45 → 0.1.48
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/DomainCountryContext/{index.5bc030dc.js → index.85791bcb.js} +3 -3
- package/contexts/ModuleDictionaryContext/{index.9ddf623f.js → index.b7c026b1.js} +22 -22
- package/contexts/ModulePrivilegesContext/{index.00d6c33d.js → index.7abed4dc.js} +3 -3
- package/contexts/ModuleSkeletonContext/{index.7504b2e4.js → index.18801a35.js} +3 -3
- package/hooks/useDomain/{index.61164dd5.js → index.9e5dc4a4.js} +1 -1
- package/hooks/useModuleDictionary/{index.c4454f46.js → index.93177cf8.js} +1 -1
- package/hooks/useModulePrivileges/{index.7a9da551.js → index.4b22874b.js} +1 -1
- package/hooks/useModuleSkeleton/{index.07843a4f.js → index.0429108c.js} +1 -1
- package/hooks/usePaginate/{index.9ed61e68.js → index.030f3b27.js} +24 -23
- package/hooks/usePaginate/index.d.ts +1 -1
- package/hooks/usePaginate/types.d.ts +2 -1
- package/index.js +11 -11
- package/package.json +3 -3
- package/utils/{axiosOperation.d83903ee.js → axiosOperation.30c7cc9d.js} +22 -22
- package/utils/index.6d56ba04.js +65 -0
- package/utils/index.78881d49.js +0 -45
|
@@ -4,9 +4,9 @@ import "../EnvironmentContext/index.7045c64f.js";
|
|
|
4
4
|
import "../FlagsContext/index.5f795859.js";
|
|
5
5
|
import { u as T } from "../../hooks/useHostTools/index.66d9a667.js";
|
|
6
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
9
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.b7c026b1.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.7abed4dc.js";
|
|
9
|
+
import "../ModuleSkeletonContext/index.18801a35.js";
|
|
10
10
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
11
11
|
import { u as f } from "../../hooks/usePropageteMF/index.c440b829.js";
|
|
12
12
|
import { E as i } from "../../types/index.42c24946.js";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { createContext as y, useState as F, useEffect as L, useCallback as
|
|
1
|
+
import { createContext as y, useState as F, useEffect as L, useCallback as m } from "react";
|
|
2
2
|
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
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModulePrivilegesContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModulePrivilegesContext/index.7abed4dc.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.18801a35.js";
|
|
9
9
|
import { u as _ } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.85791bcb.js";
|
|
11
11
|
import { C as x } from "../../types/index.42c24946.js";
|
|
12
12
|
import { jsx as A } from "react/jsx-runtime";
|
|
13
13
|
const E = y(null);
|
|
14
|
-
function
|
|
14
|
+
function Y(u) {
|
|
15
15
|
const {
|
|
16
|
-
children:
|
|
16
|
+
children: l,
|
|
17
17
|
componentsDictionary: c,
|
|
18
18
|
moduleId: i,
|
|
19
19
|
moduleNameField: s = "module_name",
|
|
20
20
|
currentLang: d = "en",
|
|
21
21
|
isAuth: a = !0
|
|
22
|
-
} =
|
|
22
|
+
} = u, {
|
|
23
23
|
addFlag: p
|
|
24
24
|
} = N(), [r, f] = F(void 0), {
|
|
25
25
|
domain_token: g
|
|
@@ -30,7 +30,7 @@ function U(l) {
|
|
|
30
30
|
networkOperation: v
|
|
31
31
|
} = _();
|
|
32
32
|
L(() => {
|
|
33
|
-
let
|
|
33
|
+
let t = !0;
|
|
34
34
|
return D(), v({
|
|
35
35
|
method: "GET",
|
|
36
36
|
endPoint: a ? `dictionaries/${i}` : `na/dictionaries/${i}`,
|
|
@@ -40,39 +40,39 @@ function U(l) {
|
|
|
40
40
|
domain_token: g
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
}).then((
|
|
44
|
-
|
|
45
|
-
...
|
|
46
|
-
}),
|
|
43
|
+
}).then((o) => {
|
|
44
|
+
t && (f({
|
|
45
|
+
...o
|
|
46
|
+
}), p(x.FLAG_DICTIONARY_LOADED));
|
|
47
47
|
}).finally(() => {
|
|
48
48
|
h();
|
|
49
49
|
}), function() {
|
|
50
|
-
|
|
50
|
+
t = !1;
|
|
51
51
|
};
|
|
52
52
|
}, [d]);
|
|
53
|
-
const n =
|
|
53
|
+
const n = m((t) => {
|
|
54
54
|
if (r === void 0)
|
|
55
55
|
return "";
|
|
56
|
-
if (
|
|
56
|
+
if (t === "")
|
|
57
57
|
return "No key";
|
|
58
|
-
let
|
|
59
|
-
const e =
|
|
58
|
+
let o;
|
|
59
|
+
const e = t.split(".");
|
|
60
60
|
try {
|
|
61
|
-
e.length === 1 && (
|
|
61
|
+
e.length === 1 && (o = r.data[t]), e.length === 2 && (o = r[e[0]][e[1]]);
|
|
62
62
|
} catch {
|
|
63
63
|
}
|
|
64
|
-
return
|
|
65
|
-
}, [r]), C =
|
|
64
|
+
return o || `N_D:[${t}]`;
|
|
65
|
+
}, [r]), C = m(() => n(s), [s, n]);
|
|
66
66
|
return /* @__PURE__ */ A(E.Provider, {
|
|
67
67
|
value: {
|
|
68
68
|
moduleDictionary: r,
|
|
69
69
|
getLabel: n,
|
|
70
70
|
getModuleLabel: C
|
|
71
71
|
},
|
|
72
|
-
children:
|
|
72
|
+
children: l
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
export {
|
|
76
76
|
E as M,
|
|
77
|
-
|
|
77
|
+
Y as a
|
|
78
78
|
};
|
|
@@ -4,10 +4,10 @@ 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
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModuleSkeletonContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.b7c026b1.js";
|
|
8
|
+
import "../ModuleSkeletonContext/index.18801a35.js";
|
|
9
9
|
import { u as h } from "../../hooks/useNetwork/index.acbf28d5.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.85791bcb.js";
|
|
11
11
|
import { C as i } from "../../types/index.42c24946.js";
|
|
12
12
|
import { jsx as L } from "react/jsx-runtime";
|
|
13
13
|
const C = f(null);
|
|
@@ -4,10 +4,10 @@ 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
6
|
import "../DomainContext/index.8d81b39c.js";
|
|
7
|
-
import "../ModuleDictionaryContext/index.
|
|
8
|
-
import "../ModulePrivilegesContext/index.
|
|
7
|
+
import "../ModuleDictionaryContext/index.b7c026b1.js";
|
|
8
|
+
import "../ModulePrivilegesContext/index.7abed4dc.js";
|
|
9
9
|
import "../NetworkContext/index.d1dfbc3a.js";
|
|
10
|
-
import "../DomainCountryContext/index.
|
|
10
|
+
import "../DomainCountryContext/index.85791bcb.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
2
|
import { D as n } from "../../contexts/DomainContext/index.8d81b39c.js";
|
|
3
|
-
import { D as e } from "../../contexts/DomainCountryContext/index.
|
|
3
|
+
import { D as e } from "../../contexts/DomainCountryContext/index.85791bcb.js";
|
|
4
4
|
const m = () => {
|
|
5
5
|
const o = t(n);
|
|
6
6
|
if (!o)
|
|
@@ -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.18801a35.js";
|
|
3
3
|
const S = () => {
|
|
4
4
|
const [t, o] = n(!0), e = s(r);
|
|
5
5
|
if (!e)
|
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import { useState as s, useRef as
|
|
2
|
-
import { u as
|
|
3
|
-
import { u as
|
|
1
|
+
import { useState as s, useRef as G, useCallback as H, useEffect as p } from "react";
|
|
2
|
+
import { u as L } from "../useHostTools/index.66d9a667.js";
|
|
3
|
+
import { u as N } from "../useNetwork/index.acbf28d5.js";
|
|
4
4
|
const a = {
|
|
5
5
|
page: 0,
|
|
6
6
|
rowsPerPage: 25,
|
|
7
7
|
totalRecords: 0
|
|
8
|
-
},
|
|
8
|
+
}, D = (l) => {
|
|
9
9
|
const {
|
|
10
10
|
endPoint: m,
|
|
11
|
-
timeout:
|
|
11
|
+
timeout: w = 5e3,
|
|
12
12
|
queryParams: P,
|
|
13
|
-
fireOnChangeParms:
|
|
14
|
-
fireOnFirstLoad:
|
|
15
|
-
rowsPerPage:
|
|
13
|
+
fireOnChangeParms: i,
|
|
14
|
+
fireOnFirstLoad: h = !0,
|
|
15
|
+
rowsPerPage: u = a.rowsPerPage,
|
|
16
16
|
startProgress: R,
|
|
17
17
|
stopProgress: C,
|
|
18
18
|
isRemote: d = !0,
|
|
19
19
|
bodyToSnakeCase: S = !1,
|
|
20
|
-
responseToCamelCase: k = !1
|
|
21
|
-
|
|
20
|
+
responseToCamelCase: k = !1,
|
|
21
|
+
initialRows: y = []
|
|
22
|
+
} = l, [c, o] = s(i ? 1 : 0), [T, n] = s(y), [O, g] = s({ ...a, rowsPerPage: u }), t = G({ ...a, rowsPerPage: u }), [b, E] = s(h), { startProgress: F, stopProgress: Q } = L(), { networkOperation: q } = N(), f = H(() => {
|
|
22
23
|
o((r) => r + 1);
|
|
23
24
|
}, []);
|
|
24
25
|
return p(() => {
|
|
25
|
-
if (
|
|
26
|
-
|
|
26
|
+
if (b) {
|
|
27
|
+
E(!1);
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
+
i && f();
|
|
30
31
|
}, [P]), p(() => {
|
|
31
32
|
let r = !0;
|
|
32
|
-
if (
|
|
33
|
-
return
|
|
33
|
+
if (c !== 0)
|
|
34
|
+
return q({
|
|
34
35
|
method: "GET",
|
|
35
36
|
endPoint: m,
|
|
36
|
-
timeout:
|
|
37
|
+
timeout: w,
|
|
37
38
|
parms: {
|
|
38
39
|
...P,
|
|
39
40
|
page: t.current.page,
|
|
@@ -42,28 +43,28 @@ const a = {
|
|
|
42
43
|
bodyToSnakeCase: S,
|
|
43
44
|
responseToCamelCase: k,
|
|
44
45
|
options: {
|
|
45
|
-
startProgress: R ||
|
|
46
|
-
stopProgress: C ||
|
|
46
|
+
startProgress: R || F,
|
|
47
|
+
stopProgress: C || Q
|
|
47
48
|
},
|
|
48
49
|
isRemote: d
|
|
49
50
|
}).then((e) => {
|
|
50
|
-
r && (n(e.data), t.current.page = e.pager.page, g((
|
|
51
|
-
...
|
|
51
|
+
r && (n(e.data), t.current.page = e.pager.page, g((x) => ({
|
|
52
|
+
...x,
|
|
52
53
|
page: e.pager.page,
|
|
53
54
|
totalRecords: e.pager.total
|
|
54
55
|
})));
|
|
55
56
|
}), function() {
|
|
56
57
|
r = !1;
|
|
57
58
|
};
|
|
58
|
-
}, [
|
|
59
|
+
}, [c]), { onPageChange: (r) => {
|
|
59
60
|
t.current.page = r, o((e) => e + 1);
|
|
60
61
|
}, onRowsPerPageChange: (r) => {
|
|
61
62
|
t.current.rowsPerPage = r, g((e) => ({ ...e, rowsPerPage: r })), o((e) => e + 1);
|
|
62
|
-
}, pagerState:
|
|
63
|
+
}, pagerState: O, rows: T, clearRows: () => {
|
|
63
64
|
n([]), g(a);
|
|
64
65
|
}, Refresh: f, setRows: n };
|
|
65
66
|
};
|
|
66
67
|
export {
|
|
67
68
|
a as i,
|
|
68
|
-
|
|
69
|
+
D as u
|
|
69
70
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { UsePaginateProps } from './types';
|
|
3
3
|
import type { PagerState } from './types';
|
|
4
|
-
export declare const usePaginate: <TRow>(props: UsePaginateProps) => {
|
|
4
|
+
export declare const usePaginate: <TRow>(props: UsePaginateProps<TRow>) => {
|
|
5
5
|
onPageChange: (newPage: number) => void;
|
|
6
6
|
onRowsPerPageChange: (newRowsPerPage: number) => void;
|
|
7
7
|
pagerState: PagerState;
|
|
@@ -6,9 +6,10 @@ export declare interface PagerState {
|
|
|
6
6
|
totalRecords: number;
|
|
7
7
|
}
|
|
8
8
|
export declare const initialPagerState: PagerState;
|
|
9
|
-
export interface UsePaginateProps extends Pick<NetworkProps, 'endPoint' | 'timeout' | 'isRemote' | 'bodyToSnakeCase' | 'responseToCamelCase'>, AxiosOptions {
|
|
9
|
+
export interface UsePaginateProps<TRow> extends Pick<NetworkProps, 'endPoint' | 'timeout' | 'isRemote' | 'bodyToSnakeCase' | 'responseToCamelCase'>, AxiosOptions {
|
|
10
10
|
fireOnChangeParms?: boolean;
|
|
11
11
|
fireOnFirstLoad?: boolean;
|
|
12
12
|
queryParams: Record<string, unknown>;
|
|
13
13
|
rowsPerPage?: number;
|
|
14
|
+
initialRows?: TRow[];
|
|
14
15
|
}
|
package/index.js
CHANGED
|
@@ -4,26 +4,26 @@ import { E as p, a as l } from "./contexts/EnvironmentContext/index.7045c64f.js"
|
|
|
4
4
|
import { F as d, a as v } from "./contexts/FlagsContext/index.5f795859.js";
|
|
5
5
|
import { H as P, a as C } from "./contexts/HostToolsContext/index.499db832.js";
|
|
6
6
|
import { D, a as S } from "./contexts/DomainContext/index.8d81b39c.js";
|
|
7
|
-
import { M as y, a as F } from "./contexts/ModuleDictionaryContext/index.
|
|
8
|
-
import { M as k, a as B } from "./contexts/ModulePrivilegesContext/index.
|
|
9
|
-
import { M as H, a as N } from "./contexts/ModuleSkeletonContext/index.
|
|
7
|
+
import { M as y, a as F } from "./contexts/ModuleDictionaryContext/index.b7c026b1.js";
|
|
8
|
+
import { M as k, a as B } from "./contexts/ModulePrivilegesContext/index.7abed4dc.js";
|
|
9
|
+
import { M as H, a as N } from "./contexts/ModuleSkeletonContext/index.18801a35.js";
|
|
10
10
|
import { N as T, a as h } from "./contexts/NetworkContext/index.d1dfbc3a.js";
|
|
11
|
-
import { D as O, a as b } from "./contexts/DomainCountryContext/index.
|
|
11
|
+
import { D as O, a as b } from "./contexts/DomainCountryContext/index.85791bcb.js";
|
|
12
12
|
import { u as q } from "./hooks/useBase/index.4375dcef.js";
|
|
13
13
|
import { u as A } from "./hooks/useEnvironment/index.04dca988.js";
|
|
14
14
|
import { u as I, a as J } from "./hooks/useFlags/index.a986729d.js";
|
|
15
15
|
import { u as Q } from "./hooks/useHostTools/index.66d9a667.js";
|
|
16
|
-
import { u as U, a as V } from "./hooks/useDomain/index.
|
|
16
|
+
import { u as U, a as V } from "./hooks/useDomain/index.9e5dc4a4.js";
|
|
17
17
|
import { u as Y, a as Z } from "./hooks/useLocalStorage/index.48b47dca.js";
|
|
18
|
-
import { u as $ } from "./hooks/useModuleDictionary/index.
|
|
19
|
-
import { u as eo } from "./hooks/useModulePrivileges/index.
|
|
20
|
-
import { u as ao } from "./hooks/useModuleSkeleton/index.
|
|
18
|
+
import { u as $ } from "./hooks/useModuleDictionary/index.93177cf8.js";
|
|
19
|
+
import { u as eo } from "./hooks/useModulePrivileges/index.4b22874b.js";
|
|
20
|
+
import { u as ao } from "./hooks/useModuleSkeleton/index.0429108c.js";
|
|
21
21
|
import { u as so } from "./hooks/useNetwork/index.acbf28d5.js";
|
|
22
|
-
import { i as no, u as mo } from "./hooks/usePaginate/index.
|
|
22
|
+
import { i as no, u as mo } from "./hooks/usePaginate/index.030f3b27.js";
|
|
23
23
|
import { u as xo } from "./hooks/usePropageteMF/index.c440b829.js";
|
|
24
24
|
import { C as lo, E as fo } from "./types/index.42c24946.js";
|
|
25
|
-
import { e as go, a as Po, g as Co, s as Mo, v as Do } from "./utils/index.
|
|
26
|
-
import { a as co } from "./utils/axiosOperation.
|
|
25
|
+
import { e as go, a as Po, g as Co, s as Mo, v as Do } from "./utils/index.6d56ba04.js";
|
|
26
|
+
import { a as co } from "./utils/axiosOperation.30c7cc9d.js";
|
|
27
27
|
import "react/jsx-runtime";
|
|
28
28
|
import "axios";
|
|
29
29
|
import "qs";
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.48",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "M4L Team",
|
|
6
|
+
"private": false,
|
|
6
7
|
"peerDependencies": {
|
|
7
8
|
"@types/nprogress": "^0.2.0",
|
|
8
9
|
"@types/qs": "^6.9.7",
|
|
@@ -31,6 +32,5 @@
|
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"camelcase-keys": "^7.0.1",
|
|
33
34
|
"snakecase-keys": "5.1.2"
|
|
34
|
-
}
|
|
35
|
-
"private": false
|
|
35
|
+
}
|
|
36
36
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import $ from "axios";
|
|
2
|
+
import j from "qs";
|
|
3
|
+
import C from "camelcase-keys";
|
|
4
4
|
import v from "snakecase-keys";
|
|
5
5
|
import { E as b } from "../types/index.42c24946.js";
|
|
6
6
|
function h(e, t, a, i, o, s) {
|
|
7
7
|
const { toast: d } = 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 && d(t.data.message, { type: "success", autoClose: 1e4 }), s ?
|
|
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 && d(t.data.message, { type: "success", autoClose: 1e4 }), s ? C(t.data, { deep: !0 }) : t.data) : Promise.reject({
|
|
9
9
|
code: 1,
|
|
10
10
|
msg: `Incorrect endpoint: ${e}`,
|
|
11
11
|
status: t.status
|
|
@@ -18,38 +18,38 @@ function x(e, t, a = !0, i = !0) {
|
|
|
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), a && e?.response?.status === 401 && t.events_emit(b.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}`, {
|
|
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(b.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 S = async (e, t, a) => {
|
|
26
26
|
const {
|
|
27
27
|
method: i,
|
|
28
28
|
endPoint: o,
|
|
29
29
|
timeout: s = 6e4,
|
|
30
30
|
parms: d = {},
|
|
31
31
|
data: m = {},
|
|
32
|
-
isRemote:
|
|
32
|
+
isRemote: c = !0,
|
|
33
33
|
checkUnAuthorized: g = !0,
|
|
34
34
|
headers: l,
|
|
35
35
|
onDownloadProgress: p,
|
|
36
|
-
isExternalUrl:
|
|
36
|
+
isExternalUrl: u,
|
|
37
37
|
responseType: f = "json",
|
|
38
38
|
signal: E,
|
|
39
|
-
toastSuccess:
|
|
40
|
-
toastError:
|
|
41
|
-
bodyToSnakeCase:
|
|
42
|
-
responseToCamelCase:
|
|
39
|
+
toastSuccess: R = !0,
|
|
40
|
+
toastError: y = !0,
|
|
41
|
+
bodyToSnakeCase: _ = !1,
|
|
42
|
+
responseToCamelCase: P = !1
|
|
43
43
|
} = e;
|
|
44
44
|
let r;
|
|
45
|
-
return
|
|
46
|
-
baseURL:
|
|
47
|
-
withCredentials:
|
|
45
|
+
return c ? r = t.host_api_remote : r = t.host_api_local, e?.options?.startProgress && e?.options?.startProgress(), $({
|
|
46
|
+
baseURL: u ? void 0 : r,
|
|
47
|
+
withCredentials: c,
|
|
48
48
|
method: i,
|
|
49
|
-
url:
|
|
50
|
-
data:
|
|
49
|
+
url: u ? o : `/${o}`,
|
|
50
|
+
data: _ ? v(m, { deep: !0 }) : m,
|
|
51
51
|
params: {},
|
|
52
|
-
paramsSerializer: () =>
|
|
52
|
+
paramsSerializer: () => j.stringify(d, { encode: !0 }),
|
|
53
53
|
headers: l,
|
|
54
54
|
timeout: s,
|
|
55
55
|
onDownloadProgress: p,
|
|
@@ -60,14 +60,14 @@ const D = async (e, t, a) => {
|
|
|
60
60
|
n,
|
|
61
61
|
a,
|
|
62
62
|
f,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
R,
|
|
64
|
+
P
|
|
65
65
|
)).catch(
|
|
66
|
-
(n) => Promise.reject(x(n, a, g,
|
|
66
|
+
(n) => (console.log("Reject de la promesa"), Promise.reject(x(n, a, g, y)))
|
|
67
67
|
).finally(() => {
|
|
68
68
|
e?.options?.stopProgress && e?.options?.stopProgress();
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
export {
|
|
72
|
-
|
|
72
|
+
S as a
|
|
73
73
|
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import "axios";
|
|
2
|
+
import "qs";
|
|
3
|
+
import "camelcase-keys";
|
|
4
|
+
import "snakecase-keys";
|
|
5
|
+
function y() {
|
|
6
|
+
}
|
|
7
|
+
function p(n, e) {
|
|
8
|
+
const r = e.split(".");
|
|
9
|
+
let t = n;
|
|
10
|
+
for (const o of r) {
|
|
11
|
+
const a = o.match(/^(\w+)\[(\w+)\]$/);
|
|
12
|
+
if (a) {
|
|
13
|
+
const s = a[1], c = a[2];
|
|
14
|
+
if (t[s] && Array.isArray(t[s])) {
|
|
15
|
+
if (c === "lastIndex")
|
|
16
|
+
return t[s][t[s].length - 1];
|
|
17
|
+
{
|
|
18
|
+
const i = parseInt(c);
|
|
19
|
+
return t[s][i];
|
|
20
|
+
}
|
|
21
|
+
} else
|
|
22
|
+
return;
|
|
23
|
+
} else if (t[o] !== void 0)
|
|
24
|
+
t = t[o];
|
|
25
|
+
else
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
return t;
|
|
29
|
+
}
|
|
30
|
+
function d(n, e) {
|
|
31
|
+
try {
|
|
32
|
+
const t = new Function(...Object.keys(n), `return \`${e}\``)(...Object.values(n));
|
|
33
|
+
return String(t).replace(/`/g, "");
|
|
34
|
+
} catch (r) {
|
|
35
|
+
return console.error(`Error evaluating expression: ${r}`), "";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function m(n, e) {
|
|
39
|
+
try {
|
|
40
|
+
const r = window.localStorage.getItem(n);
|
|
41
|
+
return r !== null ? typeof e == "string" ? r : JSON.parse(r) : e;
|
|
42
|
+
} catch {
|
|
43
|
+
return e;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function v(n, e, r = !1) {
|
|
47
|
+
try {
|
|
48
|
+
let t = null;
|
|
49
|
+
if (typeof e == "string") {
|
|
50
|
+
window.localStorage.setItem(n, e);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
r && (t = window.localStorage.getItem(n));
|
|
54
|
+
let o = t !== null ? JSON.parse(t) : {};
|
|
55
|
+
o = { ...o, ...e }, window.localStorage.setItem(n, JSON.stringify(o));
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
m as a,
|
|
61
|
+
d as e,
|
|
62
|
+
p as g,
|
|
63
|
+
v as s,
|
|
64
|
+
y as v
|
|
65
|
+
};
|
package/utils/index.78881d49.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import "axios";
|
|
2
|
-
import "qs";
|
|
3
|
-
import "camelcase-keys";
|
|
4
|
-
import "snakecase-keys";
|
|
5
|
-
function l() {
|
|
6
|
-
}
|
|
7
|
-
function u(r, t) {
|
|
8
|
-
return t.split(".").reduce((e, o) => (e || {})[o], r);
|
|
9
|
-
}
|
|
10
|
-
function g(r, t) {
|
|
11
|
-
try {
|
|
12
|
-
const o = new Function(...Object.keys(r), `return \`${t}\``)(...Object.values(r));
|
|
13
|
-
return String(o).replace(/`/g, "");
|
|
14
|
-
} catch (e) {
|
|
15
|
-
return console.error(`Error evaluating expression: ${e}`), "";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function p(r, t) {
|
|
19
|
-
try {
|
|
20
|
-
const e = window.localStorage.getItem(r);
|
|
21
|
-
return e !== null ? typeof t == "string" ? e : JSON.parse(e) : t;
|
|
22
|
-
} catch {
|
|
23
|
-
return t;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
function f(r, t, e = !1) {
|
|
27
|
-
try {
|
|
28
|
-
let o = null;
|
|
29
|
-
if (typeof t == "string") {
|
|
30
|
-
window.localStorage.setItem(r, t);
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
e && (o = window.localStorage.getItem(r));
|
|
34
|
-
let n = o !== null ? JSON.parse(o) : {};
|
|
35
|
-
n = { ...n, ...t }, window.localStorage.setItem(r, JSON.stringify(n));
|
|
36
|
-
} catch {
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
p as a,
|
|
41
|
-
g as e,
|
|
42
|
-
u as g,
|
|
43
|
-
f as s,
|
|
44
|
-
l as v
|
|
45
|
-
};
|