@fctc/interface-logic 1.5.5 → 1.5.7
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/dist/{configs.mjs → configs.cjs} +152 -105
- package/dist/{configs.d.mts → configs.d.cts} +1 -1
- package/dist/configs.js +115 -140
- package/dist/{constants.mjs → constants.cjs} +40 -2
- package/dist/constants.js +2 -41
- package/dist/{environment.mjs → environment.cjs} +208 -154
- package/dist/environment.js +167 -189
- package/dist/{hooks.mjs → hooks.cjs} +1893 -1627
- package/dist/{hooks.d.mts → hooks.d.cts} +1 -1
- package/dist/hooks.js +1788 -1726
- package/dist/{provider.mjs → provider.cjs} +648 -557
- package/dist/{provider.d.mts → provider.d.cts} +4 -3
- package/dist/provider.d.ts +4 -3
- package/dist/provider.js +608 -591
- package/dist/{services.mjs → services.cjs} +1607 -1398
- package/dist/{services.d.mts → services.d.cts} +1 -1
- package/dist/services.js +1560 -1437
- package/dist/{store.mjs → store.cjs} +148 -30
- package/dist/{store.d.mts → store.d.cts} +127 -127
- package/dist/store.d.ts +127 -127
- package/dist/store.js +43 -131
- package/dist/types.cjs +17 -0
- package/dist/{types.d.mts → types.d.cts} +1 -1
- package/dist/types.js +0 -18
- package/dist/{utils.mjs → utils.cjs} +202 -115
- package/dist/{utils.d.mts → utils.d.cts} +2 -2
- package/dist/utils.d.ts +2 -2
- package/dist/utils.js +135 -176
- package/package.json +23 -11
- package/dist/types.mjs +0 -0
- /package/dist/{constants.d.mts → constants.d.cts} +0 -0
- /package/dist/{environment.d.mts → environment.d.cts} +0 -0
- /package/dist/{view-type-BGJfDe73.d.mts → view-type-BGJfDe73.d.cts} +0 -0
|
@@ -1,8 +1,84 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __pow = Math.pow;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __export = (target, all) => {
|
|
26
|
+
for (var name in all)
|
|
27
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
28
|
+
};
|
|
29
|
+
var __copyProps = (to, from, except, desc) => {
|
|
30
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
31
|
+
for (let key of __getOwnPropNames(from))
|
|
32
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
33
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
36
|
+
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
38
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
39
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
40
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
41
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
42
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
43
|
+
mod
|
|
44
|
+
));
|
|
45
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
46
|
+
var __async = (__this, __arguments, generator) => {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
var fulfilled = (value) => {
|
|
49
|
+
try {
|
|
50
|
+
step(generator.next(value));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
reject(e);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var rejected = (value) => {
|
|
56
|
+
try {
|
|
57
|
+
step(generator.throw(value));
|
|
58
|
+
} catch (e) {
|
|
59
|
+
reject(e);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
63
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/environment.ts
|
|
68
|
+
var environment_exports = {};
|
|
69
|
+
__export(environment_exports, {
|
|
70
|
+
EnvStore: () => EnvStore,
|
|
71
|
+
env: () => env,
|
|
72
|
+
getEnv: () => getEnv,
|
|
73
|
+
initEnv: () => initEnv
|
|
74
|
+
});
|
|
75
|
+
module.exports = __toCommonJS(environment_exports);
|
|
76
|
+
|
|
1
77
|
// src/configs/axios-client.ts
|
|
2
|
-
|
|
78
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
3
79
|
|
|
4
80
|
// src/utils/format.ts
|
|
5
|
-
|
|
81
|
+
var import_moment = __toESM(require("moment"), 1);
|
|
6
82
|
|
|
7
83
|
// src/utils/domain/py_tokenizer.ts
|
|
8
84
|
var TokenizerError = class extends Error {
|
|
@@ -1082,22 +1158,6 @@ var PyRelativeDelta = class _PyRelativeDelta {
|
|
|
1082
1158
|
this.microsecond = params.microsecond;
|
|
1083
1159
|
this.weekday = params.weekday;
|
|
1084
1160
|
}
|
|
1085
|
-
years;
|
|
1086
|
-
months;
|
|
1087
|
-
days;
|
|
1088
|
-
hours;
|
|
1089
|
-
minutes;
|
|
1090
|
-
seconds;
|
|
1091
|
-
microseconds;
|
|
1092
|
-
leapDays;
|
|
1093
|
-
year;
|
|
1094
|
-
month;
|
|
1095
|
-
day;
|
|
1096
|
-
hour;
|
|
1097
|
-
minute;
|
|
1098
|
-
second;
|
|
1099
|
-
microsecond;
|
|
1100
|
-
weekday;
|
|
1101
1161
|
negate() {
|
|
1102
1162
|
return new _PyRelativeDelta(this, -1);
|
|
1103
1163
|
}
|
|
@@ -1212,7 +1272,7 @@ function execOnIterable(iterable, func) {
|
|
|
1212
1272
|
if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
|
|
1213
1273
|
iterable = Object.keys(iterable);
|
|
1214
1274
|
}
|
|
1215
|
-
if (typeof iterable
|
|
1275
|
+
if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
|
|
1216
1276
|
throw new EvaluationError("value not iterable");
|
|
1217
1277
|
}
|
|
1218
1278
|
return func(iterable);
|
|
@@ -1535,7 +1595,7 @@ function applyBinaryOp(ast, context) {
|
|
|
1535
1595
|
}
|
|
1536
1596
|
return Math.floor(left / right);
|
|
1537
1597
|
case "**":
|
|
1538
|
-
return left
|
|
1598
|
+
return __pow(left, right);
|
|
1539
1599
|
case "==":
|
|
1540
1600
|
return isEqual(left, right);
|
|
1541
1601
|
case "<>":
|
|
@@ -1657,7 +1717,7 @@ function evaluate(ast, context = {}) {
|
|
|
1657
1717
|
const dicts = /* @__PURE__ */ new Set();
|
|
1658
1718
|
let pyContext;
|
|
1659
1719
|
const evalContext = Object.create(context);
|
|
1660
|
-
if (!evalContext
|
|
1720
|
+
if (!(evalContext == null ? void 0 : evalContext.context)) {
|
|
1661
1721
|
Object.defineProperty(evalContext, "context", {
|
|
1662
1722
|
get() {
|
|
1663
1723
|
if (!pyContext) {
|
|
@@ -1668,17 +1728,18 @@ function evaluate(ast, context = {}) {
|
|
|
1668
1728
|
});
|
|
1669
1729
|
}
|
|
1670
1730
|
function _innerEvaluate(ast2) {
|
|
1671
|
-
|
|
1731
|
+
var _a, _b, _c;
|
|
1732
|
+
switch (ast2 == null ? void 0 : ast2.type) {
|
|
1672
1733
|
case 0:
|
|
1673
1734
|
// Number
|
|
1674
1735
|
case 1:
|
|
1675
1736
|
return ast2.value;
|
|
1676
1737
|
case 5:
|
|
1677
1738
|
if (ast2.value in evalContext) {
|
|
1678
|
-
if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]
|
|
1679
|
-
return evalContext[ast2.value]
|
|
1739
|
+
if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
|
|
1740
|
+
return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
|
|
1680
1741
|
}
|
|
1681
|
-
return evalContext[ast2.value]
|
|
1742
|
+
return (_c = evalContext[ast2.value]) != null ? _c : false;
|
|
1682
1743
|
} else if (ast2.value in BUILTINS) {
|
|
1683
1744
|
return BUILTINS[ast2.value];
|
|
1684
1745
|
} else {
|
|
@@ -1715,7 +1776,7 @@ function evaluate(ast, context = {}) {
|
|
|
1715
1776
|
const args = ast2.args.map(_evaluate);
|
|
1716
1777
|
const kwargs = {};
|
|
1717
1778
|
for (const kwarg in ast2.kwargs) {
|
|
1718
|
-
kwargs[kwarg] = _evaluate(ast2
|
|
1779
|
+
kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
|
|
1719
1780
|
}
|
|
1720
1781
|
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1721
1782
|
return fnValue.create(...args, kwargs);
|
|
@@ -1794,9 +1855,25 @@ function escapeRegExp(str) {
|
|
|
1794
1855
|
var InvalidDomainError = class extends Error {
|
|
1795
1856
|
};
|
|
1796
1857
|
var Domain = class _Domain {
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1858
|
+
constructor(descr = []) {
|
|
1859
|
+
this.ast = { type: -1, value: null };
|
|
1860
|
+
if (descr instanceof _Domain) {
|
|
1861
|
+
return new _Domain(descr.toString());
|
|
1862
|
+
} else {
|
|
1863
|
+
let rawAST;
|
|
1864
|
+
try {
|
|
1865
|
+
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
1866
|
+
} catch (error) {
|
|
1867
|
+
throw new InvalidDomainError(
|
|
1868
|
+
`Invalid domain representation: ${descr}`,
|
|
1869
|
+
{
|
|
1870
|
+
cause: error
|
|
1871
|
+
}
|
|
1872
|
+
);
|
|
1873
|
+
}
|
|
1874
|
+
this.ast = normalizeDomainAST(rawAST);
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1800
1877
|
static combine(domains, operator) {
|
|
1801
1878
|
if (domains.length === 0) {
|
|
1802
1879
|
return new _Domain([]);
|
|
@@ -1875,24 +1952,6 @@ var Domain = class _Domain {
|
|
|
1875
1952
|
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
1876
1953
|
return newDomain;
|
|
1877
1954
|
}
|
|
1878
|
-
constructor(descr = []) {
|
|
1879
|
-
if (descr instanceof _Domain) {
|
|
1880
|
-
return new _Domain(descr.toString());
|
|
1881
|
-
} else {
|
|
1882
|
-
let rawAST;
|
|
1883
|
-
try {
|
|
1884
|
-
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
1885
|
-
} catch (error) {
|
|
1886
|
-
throw new InvalidDomainError(
|
|
1887
|
-
`Invalid domain representation: ${descr}`,
|
|
1888
|
-
{
|
|
1889
|
-
cause: error
|
|
1890
|
-
}
|
|
1891
|
-
);
|
|
1892
|
-
}
|
|
1893
|
-
this.ast = normalizeDomainAST(rawAST);
|
|
1894
|
-
}
|
|
1895
|
-
}
|
|
1896
1955
|
contains(record) {
|
|
1897
1956
|
const expr = evaluate(this.ast, record);
|
|
1898
1957
|
return matchDomain(record, expr);
|
|
@@ -1911,7 +1970,7 @@ var Domain = class _Domain {
|
|
|
1911
1970
|
return evaluatedAsList;
|
|
1912
1971
|
}
|
|
1913
1972
|
return this.toString();
|
|
1914
|
-
} catch {
|
|
1973
|
+
} catch (e) {
|
|
1915
1974
|
return this.toString();
|
|
1916
1975
|
}
|
|
1917
1976
|
}
|
|
@@ -2111,7 +2170,7 @@ function matchDomain(record, domain) {
|
|
|
2111
2170
|
}
|
|
2112
2171
|
|
|
2113
2172
|
// src/utils/function.ts
|
|
2114
|
-
|
|
2173
|
+
var import_react = require("react");
|
|
2115
2174
|
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2116
2175
|
if (!originalRequest.data) return originalRequest.data;
|
|
2117
2176
|
if (typeof originalRequest.data === "string") {
|
|
@@ -2134,22 +2193,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
|
2134
2193
|
|
|
2135
2194
|
// src/utils/storage/local-storage.ts
|
|
2136
2195
|
var localStorageUtils = () => {
|
|
2137
|
-
const setToken =
|
|
2196
|
+
const setToken = (access_token) => __async(null, null, function* () {
|
|
2138
2197
|
localStorage.setItem("accessToken", access_token);
|
|
2139
|
-
};
|
|
2140
|
-
const setRefreshToken =
|
|
2198
|
+
});
|
|
2199
|
+
const setRefreshToken = (refresh_token) => __async(null, null, function* () {
|
|
2141
2200
|
localStorage.setItem("refreshToken", refresh_token);
|
|
2142
|
-
};
|
|
2143
|
-
const getAccessToken =
|
|
2201
|
+
});
|
|
2202
|
+
const getAccessToken = () => __async(null, null, function* () {
|
|
2144
2203
|
return localStorage.getItem("accessToken");
|
|
2145
|
-
};
|
|
2146
|
-
const getRefreshToken =
|
|
2204
|
+
});
|
|
2205
|
+
const getRefreshToken = () => __async(null, null, function* () {
|
|
2147
2206
|
return localStorage.getItem("refreshToken");
|
|
2148
|
-
};
|
|
2149
|
-
const clearToken =
|
|
2207
|
+
});
|
|
2208
|
+
const clearToken = () => __async(null, null, function* () {
|
|
2150
2209
|
localStorage.removeItem("accessToken");
|
|
2151
2210
|
localStorage.removeItem("refreshToken");
|
|
2152
|
-
};
|
|
2211
|
+
});
|
|
2153
2212
|
return {
|
|
2154
2213
|
setToken,
|
|
2155
2214
|
setRefreshToken,
|
|
@@ -2161,9 +2220,9 @@ var localStorageUtils = () => {
|
|
|
2161
2220
|
|
|
2162
2221
|
// src/utils/storage/session-storage.ts
|
|
2163
2222
|
var sessionStorageUtils = () => {
|
|
2164
|
-
const getBrowserSession =
|
|
2223
|
+
const getBrowserSession = () => __async(null, null, function* () {
|
|
2165
2224
|
return sessionStorage.getItem("browserSession");
|
|
2166
|
-
};
|
|
2225
|
+
});
|
|
2167
2226
|
return {
|
|
2168
2227
|
getBrowserSession
|
|
2169
2228
|
};
|
|
@@ -2172,13 +2231,14 @@ var sessionStorageUtils = () => {
|
|
|
2172
2231
|
// src/configs/axios-client.ts
|
|
2173
2232
|
var axiosClient = {
|
|
2174
2233
|
init(config) {
|
|
2175
|
-
|
|
2176
|
-
const
|
|
2234
|
+
var _a, _b;
|
|
2235
|
+
const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
|
|
2236
|
+
const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
|
|
2177
2237
|
const db = config.db;
|
|
2178
2238
|
let isRefreshing = false;
|
|
2179
2239
|
let failedQueue = [];
|
|
2180
2240
|
const processQueue = (error, token = null) => {
|
|
2181
|
-
failedQueue
|
|
2241
|
+
failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
|
|
2182
2242
|
if (error) {
|
|
2183
2243
|
prom.reject(error);
|
|
2184
2244
|
} else {
|
|
@@ -2187,21 +2247,21 @@ var axiosClient = {
|
|
|
2187
2247
|
});
|
|
2188
2248
|
failedQueue = [];
|
|
2189
2249
|
};
|
|
2190
|
-
const instance =
|
|
2191
|
-
adapter:
|
|
2250
|
+
const instance = import_axios.default.create({
|
|
2251
|
+
adapter: import_axios.default.defaults.adapter,
|
|
2192
2252
|
baseURL: config.baseUrl,
|
|
2193
2253
|
timeout: 5e4,
|
|
2194
2254
|
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
2255
|
});
|
|
2196
2256
|
instance.interceptors.request.use(
|
|
2197
|
-
|
|
2257
|
+
(config2) => __async(null, null, function* () {
|
|
2198
2258
|
const useRefreshToken = config2.useRefreshToken;
|
|
2199
|
-
const token = useRefreshToken ?
|
|
2259
|
+
const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
|
|
2200
2260
|
if (token) {
|
|
2201
2261
|
config2.headers["Authorization"] = "Bearer " + token;
|
|
2202
2262
|
}
|
|
2203
2263
|
return config2;
|
|
2204
|
-
},
|
|
2264
|
+
}),
|
|
2205
2265
|
(error) => {
|
|
2206
2266
|
Promise.reject(error);
|
|
2207
2267
|
}
|
|
@@ -2210,19 +2270,21 @@ var axiosClient = {
|
|
|
2210
2270
|
(response) => {
|
|
2211
2271
|
return handleResponse(response);
|
|
2212
2272
|
},
|
|
2213
|
-
|
|
2214
|
-
|
|
2273
|
+
(error) => __async(null, null, function* () {
|
|
2274
|
+
var _a2, _b2, _c;
|
|
2275
|
+
const handleError3 = (error2) => __async(null, null, function* () {
|
|
2276
|
+
var _a3;
|
|
2215
2277
|
if (!error2.response) {
|
|
2216
2278
|
return error2;
|
|
2217
2279
|
}
|
|
2218
2280
|
const { data } = error2.response;
|
|
2219
|
-
if (data && data.code === 400 && ["invalid_grant"].includes(data.data
|
|
2220
|
-
|
|
2281
|
+
if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
|
|
2282
|
+
yield clearAuthToken();
|
|
2221
2283
|
}
|
|
2222
2284
|
return data;
|
|
2223
|
-
};
|
|
2285
|
+
});
|
|
2224
2286
|
const originalRequest = error.config;
|
|
2225
|
-
if ((error.response
|
|
2287
|
+
if ((((_a2 = error.response) == null ? void 0 : _a2.status) === 403 || ((_b2 = error.response) == null ? void 0 : _b2.status) === 401 || ((_c = error.response) == null ? void 0 : _c.status) === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2226
2288
|
error.response.data.code
|
|
2227
2289
|
)) {
|
|
2228
2290
|
if (isRefreshing) {
|
|
@@ -2235,18 +2297,19 @@ var axiosClient = {
|
|
|
2235
2297
|
token
|
|
2236
2298
|
);
|
|
2237
2299
|
return instance.request(originalRequest);
|
|
2238
|
-
}).catch(
|
|
2239
|
-
|
|
2240
|
-
|
|
2300
|
+
}).catch((err) => __async(null, null, function* () {
|
|
2301
|
+
var _a3, _b3;
|
|
2302
|
+
if ((((_a3 = err.response) == null ? void 0 : _a3.status) === 400 || ((_b3 = err.response) == null ? void 0 : _b3.status) === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2303
|
+
yield clearAuthToken();
|
|
2241
2304
|
}
|
|
2242
|
-
});
|
|
2305
|
+
}));
|
|
2243
2306
|
}
|
|
2244
|
-
const browserSession =
|
|
2245
|
-
const refreshToken =
|
|
2246
|
-
const accessTokenExp =
|
|
2307
|
+
const browserSession = yield sessionStorage2.getBrowserSession();
|
|
2308
|
+
const refreshToken = yield localStorage2.getRefreshToken();
|
|
2309
|
+
const accessTokenExp = yield localStorage2.getAccessToken();
|
|
2247
2310
|
isRefreshing = true;
|
|
2248
2311
|
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2249
|
-
|
|
2312
|
+
yield clearAuthToken();
|
|
2250
2313
|
} else {
|
|
2251
2314
|
const payload = Object.fromEntries(
|
|
2252
2315
|
Object.entries({
|
|
@@ -2257,8 +2320,9 @@ var axiosClient = {
|
|
|
2257
2320
|
}).filter(([_, value]) => !!value)
|
|
2258
2321
|
);
|
|
2259
2322
|
return new Promise(function(resolve) {
|
|
2260
|
-
|
|
2261
|
-
|
|
2323
|
+
var _a3;
|
|
2324
|
+
import_axios.default.post(
|
|
2325
|
+
`${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2262
2326
|
payload,
|
|
2263
2327
|
{
|
|
2264
2328
|
headers: {
|
|
@@ -2266,11 +2330,11 @@ var axiosClient = {
|
|
|
2266
2330
|
Authorization: `Bearer ${accessTokenExp}`
|
|
2267
2331
|
}
|
|
2268
2332
|
}
|
|
2269
|
-
).then(
|
|
2333
|
+
).then((res) => __async(null, null, function* () {
|
|
2270
2334
|
const data = res.data;
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2335
|
+
yield localStorage2.setToken(data.access_token);
|
|
2336
|
+
yield localStorage2.setRefreshToken(data.refresh_token);
|
|
2337
|
+
import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2274
2338
|
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2275
2339
|
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2276
2340
|
originalRequest,
|
|
@@ -2278,25 +2342,26 @@ var axiosClient = {
|
|
|
2278
2342
|
);
|
|
2279
2343
|
processQueue(null, data.access_token);
|
|
2280
2344
|
resolve(instance.request(originalRequest));
|
|
2281
|
-
}).catch(
|
|
2282
|
-
|
|
2283
|
-
|
|
2345
|
+
})).catch((err) => __async(null, null, function* () {
|
|
2346
|
+
var _a4;
|
|
2347
|
+
if (err && ((err == null ? void 0 : err.error_code) === "AUTHEN_FAIL" || (err == null ? void 0 : err.error_code) === "TOKEN_EXPIRED" || (err == null ? void 0 : err.error_code) === "TOKEN_INCORRECT" || (err == null ? void 0 : err.code) === "ERR_BAD_REQUEST") || (err == null ? void 0 : err.error_code) === "ERR_2FA_006") {
|
|
2348
|
+
yield clearAuthToken();
|
|
2284
2349
|
}
|
|
2285
2350
|
if (err && err.response) {
|
|
2286
|
-
const { error_code } = err.response
|
|
2351
|
+
const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
|
|
2287
2352
|
if (error_code === "AUTHEN_FAIL") {
|
|
2288
|
-
|
|
2353
|
+
yield clearAuthToken();
|
|
2289
2354
|
}
|
|
2290
2355
|
}
|
|
2291
2356
|
processQueue(err, null);
|
|
2292
|
-
}).finally(() => {
|
|
2357
|
+
})).finally(() => {
|
|
2293
2358
|
isRefreshing = false;
|
|
2294
2359
|
});
|
|
2295
2360
|
});
|
|
2296
2361
|
}
|
|
2297
2362
|
}
|
|
2298
|
-
return Promise.reject(
|
|
2299
|
-
}
|
|
2363
|
+
return Promise.reject(yield handleError3(error));
|
|
2364
|
+
})
|
|
2300
2365
|
);
|
|
2301
2366
|
const handleResponse = (res) => {
|
|
2302
2367
|
if (res && res.data) {
|
|
@@ -2305,6 +2370,7 @@ var axiosClient = {
|
|
|
2305
2370
|
return res;
|
|
2306
2371
|
};
|
|
2307
2372
|
const handleError2 = (error) => {
|
|
2373
|
+
var _a2, _b2, _c;
|
|
2308
2374
|
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2309
2375
|
console.error("Request Timeout Error:", error);
|
|
2310
2376
|
return "Request Timeout Error";
|
|
@@ -2312,17 +2378,17 @@ var axiosClient = {
|
|
|
2312
2378
|
console.error("Network Error:", error);
|
|
2313
2379
|
return "Network Error";
|
|
2314
2380
|
} else {
|
|
2315
|
-
console.error("Other Error:", error
|
|
2316
|
-
const errorMessage = error
|
|
2317
|
-
return { message: errorMessage, status: error
|
|
2381
|
+
console.error("Other Error:", error == null ? void 0 : error.response);
|
|
2382
|
+
const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
|
|
2383
|
+
return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
|
|
2318
2384
|
}
|
|
2319
2385
|
};
|
|
2320
|
-
const clearAuthToken =
|
|
2321
|
-
|
|
2386
|
+
const clearAuthToken = () => __async(null, null, function* () {
|
|
2387
|
+
yield localStorage2.clearToken();
|
|
2322
2388
|
if (typeof window !== "undefined") {
|
|
2323
2389
|
window.location.href = `/login`;
|
|
2324
2390
|
}
|
|
2325
|
-
};
|
|
2391
|
+
});
|
|
2326
2392
|
function formatUrl(url, db2) {
|
|
2327
2393
|
return url + (db2 ? "?db=" + db2 : "");
|
|
2328
2394
|
}
|
|
@@ -2346,14 +2412,14 @@ var axiosClient = {
|
|
|
2346
2412
|
};
|
|
2347
2413
|
|
|
2348
2414
|
// src/store/index.ts
|
|
2349
|
-
|
|
2415
|
+
var import_react_redux = require("react-redux");
|
|
2350
2416
|
|
|
2351
2417
|
// src/store/reducers/breadcrums-slice/index.ts
|
|
2352
|
-
|
|
2418
|
+
var import_toolkit = require("@reduxjs/toolkit");
|
|
2353
2419
|
var initialState = {
|
|
2354
2420
|
breadCrumbs: []
|
|
2355
2421
|
};
|
|
2356
|
-
var breadcrumbsSlice = createSlice({
|
|
2422
|
+
var breadcrumbsSlice = (0, import_toolkit.createSlice)({
|
|
2357
2423
|
name: "breadcrumbs",
|
|
2358
2424
|
initialState,
|
|
2359
2425
|
reducers: {
|
|
@@ -2366,7 +2432,7 @@ var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
|
2366
2432
|
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2367
2433
|
|
|
2368
2434
|
// src/store/reducers/env-slice/index.ts
|
|
2369
|
-
|
|
2435
|
+
var import_toolkit2 = require("@reduxjs/toolkit");
|
|
2370
2436
|
var initialState2 = {
|
|
2371
2437
|
baseUrl: "",
|
|
2372
2438
|
requests: null,
|
|
@@ -2387,7 +2453,7 @@ var initialState2 = {
|
|
|
2387
2453
|
tz: "Asia/Saigon"
|
|
2388
2454
|
}
|
|
2389
2455
|
};
|
|
2390
|
-
var envSlice =
|
|
2456
|
+
var envSlice = (0, import_toolkit2.createSlice)({
|
|
2391
2457
|
name: "env",
|
|
2392
2458
|
initialState: initialState2,
|
|
2393
2459
|
reducers: {
|
|
@@ -2434,7 +2500,7 @@ var {
|
|
|
2434
2500
|
var env_slice_default = envSlice.reducer;
|
|
2435
2501
|
|
|
2436
2502
|
// src/store/reducers/excel-slice/index.ts
|
|
2437
|
-
|
|
2503
|
+
var import_toolkit3 = require("@reduxjs/toolkit");
|
|
2438
2504
|
var initialState3 = {
|
|
2439
2505
|
dataParse: null,
|
|
2440
2506
|
idFile: null,
|
|
@@ -2443,7 +2509,7 @@ var initialState3 = {
|
|
|
2443
2509
|
selectedFile: null,
|
|
2444
2510
|
errorData: null
|
|
2445
2511
|
};
|
|
2446
|
-
var excelSlice =
|
|
2512
|
+
var excelSlice = (0, import_toolkit3.createSlice)({
|
|
2447
2513
|
name: "excel",
|
|
2448
2514
|
initialState: initialState3,
|
|
2449
2515
|
reducers: {
|
|
@@ -2478,7 +2544,7 @@ var {
|
|
|
2478
2544
|
var excel_slice_default = excelSlice.reducer;
|
|
2479
2545
|
|
|
2480
2546
|
// src/store/reducers/form-slice/index.ts
|
|
2481
|
-
|
|
2547
|
+
var import_toolkit4 = require("@reduxjs/toolkit");
|
|
2482
2548
|
var initialState4 = {
|
|
2483
2549
|
viewDataStore: {},
|
|
2484
2550
|
isShowingModalDetail: false,
|
|
@@ -2488,7 +2554,7 @@ var initialState4 = {
|
|
|
2488
2554
|
listSubject: {},
|
|
2489
2555
|
dataUser: {}
|
|
2490
2556
|
};
|
|
2491
|
-
var formSlice =
|
|
2557
|
+
var formSlice = (0, import_toolkit4.createSlice)({
|
|
2492
2558
|
name: "form",
|
|
2493
2559
|
initialState: initialState4,
|
|
2494
2560
|
reducers: {
|
|
@@ -2527,15 +2593,15 @@ var {
|
|
|
2527
2593
|
var form_slice_default = formSlice.reducer;
|
|
2528
2594
|
|
|
2529
2595
|
// src/store/reducers/header-slice/index.ts
|
|
2530
|
-
|
|
2531
|
-
var headerSlice =
|
|
2596
|
+
var import_toolkit5 = require("@reduxjs/toolkit");
|
|
2597
|
+
var headerSlice = (0, import_toolkit5.createSlice)({
|
|
2532
2598
|
name: "header",
|
|
2533
2599
|
initialState: {
|
|
2534
2600
|
value: { allowedCompanyIds: [] }
|
|
2535
2601
|
},
|
|
2536
2602
|
reducers: {
|
|
2537
2603
|
setHeader: (state, action) => {
|
|
2538
|
-
state.value = {
|
|
2604
|
+
state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
|
|
2539
2605
|
},
|
|
2540
2606
|
setAllowedCompanyIds: (state, action) => {
|
|
2541
2607
|
state.value.allowedCompanyIds = action.payload;
|
|
@@ -2546,7 +2612,7 @@ var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
|
2546
2612
|
var header_slice_default = headerSlice.reducer;
|
|
2547
2613
|
|
|
2548
2614
|
// src/store/reducers/list-slice/index.ts
|
|
2549
|
-
|
|
2615
|
+
var import_toolkit6 = require("@reduxjs/toolkit");
|
|
2550
2616
|
var initialState5 = {
|
|
2551
2617
|
pageLimit: 10,
|
|
2552
2618
|
fields: {},
|
|
@@ -2560,7 +2626,7 @@ var initialState5 = {
|
|
|
2560
2626
|
page: 0,
|
|
2561
2627
|
domainTable: []
|
|
2562
2628
|
};
|
|
2563
|
-
var listSlice =
|
|
2629
|
+
var listSlice = (0, import_toolkit6.createSlice)({
|
|
2564
2630
|
name: "list",
|
|
2565
2631
|
initialState: initialState5,
|
|
2566
2632
|
reducers: {
|
|
@@ -2611,13 +2677,13 @@ var {
|
|
|
2611
2677
|
var list_slice_default = listSlice.reducer;
|
|
2612
2678
|
|
|
2613
2679
|
// src/store/reducers/login-slice/index.ts
|
|
2614
|
-
|
|
2680
|
+
var import_toolkit7 = require("@reduxjs/toolkit");
|
|
2615
2681
|
var initialState6 = {
|
|
2616
2682
|
db: "",
|
|
2617
2683
|
redirectTo: "/",
|
|
2618
2684
|
forgotPasswordUrl: "/"
|
|
2619
2685
|
};
|
|
2620
|
-
var loginSlice =
|
|
2686
|
+
var loginSlice = (0, import_toolkit7.createSlice)({
|
|
2621
2687
|
name: "login",
|
|
2622
2688
|
initialState: initialState6,
|
|
2623
2689
|
reducers: {
|
|
@@ -2636,14 +2702,14 @@ var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
|
2636
2702
|
var login_slice_default = loginSlice.reducer;
|
|
2637
2703
|
|
|
2638
2704
|
// src/store/reducers/navbar-slice/index.ts
|
|
2639
|
-
|
|
2705
|
+
var import_toolkit8 = require("@reduxjs/toolkit");
|
|
2640
2706
|
var initialState7 = {
|
|
2641
2707
|
menuFocus: {},
|
|
2642
2708
|
menuAction: {},
|
|
2643
2709
|
navbarWidth: 250,
|
|
2644
2710
|
menuList: []
|
|
2645
2711
|
};
|
|
2646
|
-
var navbarSlice =
|
|
2712
|
+
var navbarSlice = (0, import_toolkit8.createSlice)({
|
|
2647
2713
|
name: "navbar",
|
|
2648
2714
|
initialState: initialState7,
|
|
2649
2715
|
reducers: {
|
|
@@ -2665,11 +2731,11 @@ var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSl
|
|
|
2665
2731
|
var navbar_slice_default = navbarSlice.reducer;
|
|
2666
2732
|
|
|
2667
2733
|
// src/store/reducers/profile-slice/index.ts
|
|
2668
|
-
|
|
2734
|
+
var import_toolkit9 = require("@reduxjs/toolkit");
|
|
2669
2735
|
var initialState8 = {
|
|
2670
2736
|
profile: {}
|
|
2671
2737
|
};
|
|
2672
|
-
var profileSlice =
|
|
2738
|
+
var profileSlice = (0, import_toolkit9.createSlice)({
|
|
2673
2739
|
name: "profile",
|
|
2674
2740
|
initialState: initialState8,
|
|
2675
2741
|
reducers: {
|
|
@@ -2682,7 +2748,7 @@ var { setProfile } = profileSlice.actions;
|
|
|
2682
2748
|
var profile_slice_default = profileSlice.reducer;
|
|
2683
2749
|
|
|
2684
2750
|
// src/store/reducers/search-slice/index.ts
|
|
2685
|
-
|
|
2751
|
+
var import_toolkit10 = require("@reduxjs/toolkit");
|
|
2686
2752
|
var initialState9 = {
|
|
2687
2753
|
groupByDomain: null,
|
|
2688
2754
|
searchBy: [],
|
|
@@ -2694,7 +2760,7 @@ var initialState9 = {
|
|
|
2694
2760
|
filterBy: [],
|
|
2695
2761
|
groupBy: []
|
|
2696
2762
|
};
|
|
2697
|
-
var searchSlice =
|
|
2763
|
+
var searchSlice = (0, import_toolkit10.createSlice)({
|
|
2698
2764
|
name: "search",
|
|
2699
2765
|
initialState: initialState9,
|
|
2700
2766
|
reducers: {
|
|
@@ -2768,7 +2834,7 @@ var {
|
|
|
2768
2834
|
var search_slice_default = searchSlice.reducer;
|
|
2769
2835
|
|
|
2770
2836
|
// src/store/store.ts
|
|
2771
|
-
|
|
2837
|
+
var import_toolkit11 = require("@reduxjs/toolkit");
|
|
2772
2838
|
|
|
2773
2839
|
// node_modules/redux/dist/redux.mjs
|
|
2774
2840
|
function formatProdErrorMessage(code) {
|
|
@@ -2952,7 +3018,7 @@ var rootReducer = combineReducers({
|
|
|
2952
3018
|
excel: excel_slice_default,
|
|
2953
3019
|
profile: profile_slice_default
|
|
2954
3020
|
});
|
|
2955
|
-
var envStore = configureStore({
|
|
3021
|
+
var envStore = (0, import_toolkit11.configureStore)({
|
|
2956
3022
|
reducer: rootReducer,
|
|
2957
3023
|
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
2958
3024
|
serializableCheck: false
|
|
@@ -2961,18 +3027,6 @@ var envStore = configureStore({
|
|
|
2961
3027
|
|
|
2962
3028
|
// src/environment/EnvStore.ts
|
|
2963
3029
|
var EnvStore = class {
|
|
2964
|
-
envStore;
|
|
2965
|
-
baseUrl;
|
|
2966
|
-
requests;
|
|
2967
|
-
context;
|
|
2968
|
-
defaultCompany;
|
|
2969
|
-
config;
|
|
2970
|
-
companies;
|
|
2971
|
-
user;
|
|
2972
|
-
db;
|
|
2973
|
-
localStorageUtils;
|
|
2974
|
-
sessionStorageUtils;
|
|
2975
|
-
refreshTokenEndpoint;
|
|
2976
3030
|
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2977
3031
|
this.envStore = envStore2;
|
|
2978
3032
|
this.localStorageUtils = localStorageUtils2;
|
|
@@ -2981,25 +3035,24 @@ var EnvStore = class {
|
|
|
2981
3035
|
}
|
|
2982
3036
|
setup() {
|
|
2983
3037
|
const env2 = this.envStore.getState().env;
|
|
2984
|
-
this.baseUrl = env2
|
|
2985
|
-
this.requests = env2
|
|
2986
|
-
this.context = env2
|
|
2987
|
-
this.defaultCompany = env2
|
|
2988
|
-
this.config = env2
|
|
2989
|
-
this.companies = env2
|
|
2990
|
-
this.user = env2
|
|
2991
|
-
this.db = env2
|
|
2992
|
-
this.refreshTokenEndpoint = env2
|
|
3038
|
+
this.baseUrl = env2 == null ? void 0 : env2.baseUrl;
|
|
3039
|
+
this.requests = env2 == null ? void 0 : env2.requests;
|
|
3040
|
+
this.context = env2 == null ? void 0 : env2.context;
|
|
3041
|
+
this.defaultCompany = env2 == null ? void 0 : env2.defaultCompany;
|
|
3042
|
+
this.config = env2 == null ? void 0 : env2.config;
|
|
3043
|
+
this.companies = (env2 == null ? void 0 : env2.companies) || [];
|
|
3044
|
+
this.user = env2 == null ? void 0 : env2.user;
|
|
3045
|
+
this.db = env2 == null ? void 0 : env2.db;
|
|
3046
|
+
this.refreshTokenEndpoint = env2 == null ? void 0 : env2.refreshTokenEndpoint;
|
|
2993
3047
|
}
|
|
2994
3048
|
setupEnv(envConfig) {
|
|
2995
3049
|
const dispatch = this.envStore.dispatch;
|
|
2996
|
-
const env2 = {
|
|
2997
|
-
...envConfig,
|
|
3050
|
+
const env2 = __spreadProps(__spreadValues({}, envConfig), {
|
|
2998
3051
|
localStorageUtils: this.localStorageUtils,
|
|
2999
3052
|
sessionStorageUtils: this.sessionStorageUtils
|
|
3000
|
-
};
|
|
3053
|
+
});
|
|
3001
3054
|
const requests = axiosClient.init(env2);
|
|
3002
|
-
dispatch(setEnv({
|
|
3055
|
+
dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
|
|
3003
3056
|
this.setup();
|
|
3004
3057
|
}
|
|
3005
3058
|
setUid(uid) {
|
|
@@ -3046,9 +3099,10 @@ function getEnv() {
|
|
|
3046
3099
|
env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
|
|
3047
3100
|
return env;
|
|
3048
3101
|
}
|
|
3049
|
-
export
|
|
3102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
3103
|
+
0 && (module.exports = {
|
|
3050
3104
|
EnvStore,
|
|
3051
3105
|
env,
|
|
3052
3106
|
getEnv,
|
|
3053
3107
|
initEnv
|
|
3054
|
-
};
|
|
3108
|
+
});
|