@fctc/interface-logic 1.7.1 → 1.7.3
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.d.mts +1 -0
- package/dist/configs.d.ts +1 -0
- package/dist/configs.js +12 -9
- package/dist/configs.mjs +12 -9
- package/dist/environment.d.mts +24 -6
- package/dist/environment.d.ts +24 -6
- package/dist/environment.js +1251 -1244
- package/dist/environment.mjs +1251 -1243
- package/dist/hooks.d.mts +1 -6
- package/dist/hooks.d.ts +1 -6
- package/dist/hooks.js +2138 -2157
- package/dist/hooks.mjs +1508 -1526
- package/dist/provider.js +89 -77
- package/dist/provider.mjs +89 -77
- package/dist/services.d.mts +0 -1
- package/dist/services.d.ts +0 -1
- package/dist/services.js +1345 -1348
- package/dist/services.mjs +1345 -1348
- package/dist/store.d.mts +14 -42
- package/dist/store.d.ts +14 -42
- package/dist/store.js +5 -7
- package/dist/store.mjs +5 -7
- package/package.json +81 -81
package/dist/environment.mjs
CHANGED
|
@@ -1,616 +1,3 @@
|
|
|
1
|
-
// src/store/store.ts
|
|
2
|
-
import { configureStore } from "@reduxjs/toolkit";
|
|
3
|
-
|
|
4
|
-
// node_modules/redux/dist/redux.mjs
|
|
5
|
-
function formatProdErrorMessage(code) {
|
|
6
|
-
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
7
|
-
}
|
|
8
|
-
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
9
|
-
var ActionTypes = {
|
|
10
|
-
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
11
|
-
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
12
|
-
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
13
|
-
};
|
|
14
|
-
var actionTypes_default = ActionTypes;
|
|
15
|
-
function isPlainObject(obj) {
|
|
16
|
-
if (typeof obj !== "object" || obj === null)
|
|
17
|
-
return false;
|
|
18
|
-
let proto = obj;
|
|
19
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
20
|
-
proto = Object.getPrototypeOf(proto);
|
|
21
|
-
}
|
|
22
|
-
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
23
|
-
}
|
|
24
|
-
function miniKindOf(val) {
|
|
25
|
-
if (val === void 0)
|
|
26
|
-
return "undefined";
|
|
27
|
-
if (val === null)
|
|
28
|
-
return "null";
|
|
29
|
-
const type = typeof val;
|
|
30
|
-
switch (type) {
|
|
31
|
-
case "boolean":
|
|
32
|
-
case "string":
|
|
33
|
-
case "number":
|
|
34
|
-
case "symbol":
|
|
35
|
-
case "function": {
|
|
36
|
-
return type;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (Array.isArray(val))
|
|
40
|
-
return "array";
|
|
41
|
-
if (isDate(val))
|
|
42
|
-
return "date";
|
|
43
|
-
if (isError(val))
|
|
44
|
-
return "error";
|
|
45
|
-
const constructorName = ctorName(val);
|
|
46
|
-
switch (constructorName) {
|
|
47
|
-
case "Symbol":
|
|
48
|
-
case "Promise":
|
|
49
|
-
case "WeakMap":
|
|
50
|
-
case "WeakSet":
|
|
51
|
-
case "Map":
|
|
52
|
-
case "Set":
|
|
53
|
-
return constructorName;
|
|
54
|
-
}
|
|
55
|
-
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
56
|
-
}
|
|
57
|
-
function ctorName(val) {
|
|
58
|
-
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
59
|
-
}
|
|
60
|
-
function isError(val) {
|
|
61
|
-
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
62
|
-
}
|
|
63
|
-
function isDate(val) {
|
|
64
|
-
if (val instanceof Date)
|
|
65
|
-
return true;
|
|
66
|
-
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
67
|
-
}
|
|
68
|
-
function kindOf(val) {
|
|
69
|
-
let typeOfVal = typeof val;
|
|
70
|
-
if (process.env.NODE_ENV !== "production") {
|
|
71
|
-
typeOfVal = miniKindOf(val);
|
|
72
|
-
}
|
|
73
|
-
return typeOfVal;
|
|
74
|
-
}
|
|
75
|
-
function warning(message) {
|
|
76
|
-
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
77
|
-
console.error(message);
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
throw new Error(message);
|
|
81
|
-
} catch (e) {
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
85
|
-
const reducerKeys = Object.keys(reducers);
|
|
86
|
-
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
87
|
-
if (reducerKeys.length === 0) {
|
|
88
|
-
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
89
|
-
}
|
|
90
|
-
if (!isPlainObject(inputState)) {
|
|
91
|
-
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
92
|
-
}
|
|
93
|
-
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
94
|
-
unexpectedKeys.forEach((key) => {
|
|
95
|
-
unexpectedKeyCache[key] = true;
|
|
96
|
-
});
|
|
97
|
-
if (action && action.type === actionTypes_default.REPLACE)
|
|
98
|
-
return;
|
|
99
|
-
if (unexpectedKeys.length > 0) {
|
|
100
|
-
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function assertReducerShape(reducers) {
|
|
104
|
-
Object.keys(reducers).forEach((key) => {
|
|
105
|
-
const reducer = reducers[key];
|
|
106
|
-
const initialState10 = reducer(void 0, {
|
|
107
|
-
type: actionTypes_default.INIT
|
|
108
|
-
});
|
|
109
|
-
if (typeof initialState10 === "undefined") {
|
|
110
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
111
|
-
}
|
|
112
|
-
if (typeof reducer(void 0, {
|
|
113
|
-
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
114
|
-
}) === "undefined") {
|
|
115
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
function combineReducers(reducers) {
|
|
120
|
-
const reducerKeys = Object.keys(reducers);
|
|
121
|
-
const finalReducers = {};
|
|
122
|
-
for (let i = 0; i < reducerKeys.length; i++) {
|
|
123
|
-
const key = reducerKeys[i];
|
|
124
|
-
if (process.env.NODE_ENV !== "production") {
|
|
125
|
-
if (typeof reducers[key] === "undefined") {
|
|
126
|
-
warning(`No reducer provided for key "${key}"`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
if (typeof reducers[key] === "function") {
|
|
130
|
-
finalReducers[key] = reducers[key];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
const finalReducerKeys = Object.keys(finalReducers);
|
|
134
|
-
let unexpectedKeyCache;
|
|
135
|
-
if (process.env.NODE_ENV !== "production") {
|
|
136
|
-
unexpectedKeyCache = {};
|
|
137
|
-
}
|
|
138
|
-
let shapeAssertionError;
|
|
139
|
-
try {
|
|
140
|
-
assertReducerShape(finalReducers);
|
|
141
|
-
} catch (e) {
|
|
142
|
-
shapeAssertionError = e;
|
|
143
|
-
}
|
|
144
|
-
return function combination(state = {}, action) {
|
|
145
|
-
if (shapeAssertionError) {
|
|
146
|
-
throw shapeAssertionError;
|
|
147
|
-
}
|
|
148
|
-
if (process.env.NODE_ENV !== "production") {
|
|
149
|
-
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
150
|
-
if (warningMessage) {
|
|
151
|
-
warning(warningMessage);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
let hasChanged = false;
|
|
155
|
-
const nextState = {};
|
|
156
|
-
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
157
|
-
const key = finalReducerKeys[i];
|
|
158
|
-
const reducer = finalReducers[key];
|
|
159
|
-
const previousStateForKey = state[key];
|
|
160
|
-
const nextStateForKey = reducer(previousStateForKey, action);
|
|
161
|
-
if (typeof nextStateForKey === "undefined") {
|
|
162
|
-
const actionType = action && action.type;
|
|
163
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
164
|
-
}
|
|
165
|
-
nextState[key] = nextStateForKey;
|
|
166
|
-
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
167
|
-
}
|
|
168
|
-
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
169
|
-
return hasChanged ? nextState : state;
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// src/store/reducers/breadcrums-slice/index.ts
|
|
174
|
-
import { createSlice } from "@reduxjs/toolkit";
|
|
175
|
-
var initialState = {
|
|
176
|
-
breadCrumbs: []
|
|
177
|
-
};
|
|
178
|
-
var breadcrumbsSlice = createSlice({
|
|
179
|
-
name: "breadcrumbs",
|
|
180
|
-
initialState,
|
|
181
|
-
reducers: {
|
|
182
|
-
setBreadCrumbs: (state, action) => {
|
|
183
|
-
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
188
|
-
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
189
|
-
|
|
190
|
-
// src/store/reducers/env-slice/index.ts
|
|
191
|
-
import { createSlice as createSlice2 } from "@reduxjs/toolkit";
|
|
192
|
-
var initialState2 = {
|
|
193
|
-
baseUrl: "",
|
|
194
|
-
companies: [],
|
|
195
|
-
user: {},
|
|
196
|
-
db: "",
|
|
197
|
-
refreshTokenEndpoint: "",
|
|
198
|
-
config: null,
|
|
199
|
-
envFile: null,
|
|
200
|
-
requests: null,
|
|
201
|
-
defaultCompany: {
|
|
202
|
-
id: null,
|
|
203
|
-
logo: "",
|
|
204
|
-
secondary_color: "",
|
|
205
|
-
primary_color: ""
|
|
206
|
-
},
|
|
207
|
-
context: {
|
|
208
|
-
uid: null,
|
|
209
|
-
allowed_company_ids: [],
|
|
210
|
-
lang: "vi_VN",
|
|
211
|
-
tz: "Asia/Saigon"
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
var envSlice = createSlice2({
|
|
215
|
-
name: "env",
|
|
216
|
-
initialState: initialState2,
|
|
217
|
-
reducers: {
|
|
218
|
-
setEnv: (state, action) => {
|
|
219
|
-
Object.assign(state, action.payload);
|
|
220
|
-
},
|
|
221
|
-
setUid: (state, action) => {
|
|
222
|
-
state.context.uid = action.payload;
|
|
223
|
-
},
|
|
224
|
-
setAllowCompanies: (state, action) => {
|
|
225
|
-
state.context.allowed_company_ids = action.payload;
|
|
226
|
-
},
|
|
227
|
-
setCompanies: (state, action) => {
|
|
228
|
-
state.companies = action.payload;
|
|
229
|
-
},
|
|
230
|
-
setDefaultCompany: (state, action) => {
|
|
231
|
-
state.defaultCompany = action.payload;
|
|
232
|
-
},
|
|
233
|
-
setLang: (state, action) => {
|
|
234
|
-
state.context.lang = action.payload;
|
|
235
|
-
},
|
|
236
|
-
setUser: (state, action) => {
|
|
237
|
-
state.user = action.payload;
|
|
238
|
-
},
|
|
239
|
-
setConfig: (state, action) => {
|
|
240
|
-
state.config = action.payload;
|
|
241
|
-
},
|
|
242
|
-
setEnvFile: (state, action) => {
|
|
243
|
-
state.envFile = action.payload;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
var {
|
|
248
|
-
setEnv,
|
|
249
|
-
setUid,
|
|
250
|
-
setLang,
|
|
251
|
-
setAllowCompanies,
|
|
252
|
-
setCompanies,
|
|
253
|
-
setDefaultCompany,
|
|
254
|
-
setUser,
|
|
255
|
-
setConfig,
|
|
256
|
-
setEnvFile
|
|
257
|
-
} = envSlice.actions;
|
|
258
|
-
var env_slice_default = envSlice.reducer;
|
|
259
|
-
|
|
260
|
-
// src/store/reducers/excel-slice/index.ts
|
|
261
|
-
import { createSlice as createSlice3 } from "@reduxjs/toolkit";
|
|
262
|
-
var initialState3 = {
|
|
263
|
-
dataParse: null,
|
|
264
|
-
idFile: null,
|
|
265
|
-
isFileLoaded: false,
|
|
266
|
-
loadingImport: false,
|
|
267
|
-
selectedFile: null,
|
|
268
|
-
errorData: null
|
|
269
|
-
};
|
|
270
|
-
var excelSlice = createSlice3({
|
|
271
|
-
name: "excel",
|
|
272
|
-
initialState: initialState3,
|
|
273
|
-
reducers: {
|
|
274
|
-
setDataParse: (state, action) => {
|
|
275
|
-
state.dataParse = action.payload;
|
|
276
|
-
},
|
|
277
|
-
setIdFile: (state, action) => {
|
|
278
|
-
state.idFile = action.payload;
|
|
279
|
-
},
|
|
280
|
-
setIsFileLoaded: (state, action) => {
|
|
281
|
-
state.isFileLoaded = action.payload;
|
|
282
|
-
},
|
|
283
|
-
setLoadingImport: (state, action) => {
|
|
284
|
-
state.loadingImport = action.payload;
|
|
285
|
-
},
|
|
286
|
-
setSelectedFile: (state, action) => {
|
|
287
|
-
state.selectedFile = action.payload;
|
|
288
|
-
},
|
|
289
|
-
setErrorData: (state, action) => {
|
|
290
|
-
state.errorData = action.payload;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
var {
|
|
295
|
-
setDataParse,
|
|
296
|
-
setIdFile,
|
|
297
|
-
setIsFileLoaded,
|
|
298
|
-
setLoadingImport,
|
|
299
|
-
setSelectedFile,
|
|
300
|
-
setErrorData
|
|
301
|
-
} = excelSlice.actions;
|
|
302
|
-
var excel_slice_default = excelSlice.reducer;
|
|
303
|
-
|
|
304
|
-
// src/store/reducers/form-slice/index.ts
|
|
305
|
-
import { createSlice as createSlice4 } from "@reduxjs/toolkit";
|
|
306
|
-
var initialState4 = {
|
|
307
|
-
viewDataStore: {},
|
|
308
|
-
isShowingModalDetail: false,
|
|
309
|
-
isShowModalTranslate: false,
|
|
310
|
-
formSubmitComponent: {},
|
|
311
|
-
fieldTranslation: null,
|
|
312
|
-
listSubject: {},
|
|
313
|
-
dataUser: {}
|
|
314
|
-
};
|
|
315
|
-
var formSlice = createSlice4({
|
|
316
|
-
name: "form",
|
|
317
|
-
initialState: initialState4,
|
|
318
|
-
reducers: {
|
|
319
|
-
setViewDataStore: (state, action) => {
|
|
320
|
-
state.viewDataStore = action.payload;
|
|
321
|
-
},
|
|
322
|
-
setIsShowingModalDetail: (state, action) => {
|
|
323
|
-
state.isShowingModalDetail = action.payload;
|
|
324
|
-
},
|
|
325
|
-
setIsShowModalTranslate: (state, action) => {
|
|
326
|
-
state.isShowModalTranslate = action.payload;
|
|
327
|
-
},
|
|
328
|
-
setFormSubmitComponent: (state, action) => {
|
|
329
|
-
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
330
|
-
},
|
|
331
|
-
setFieldTranslate: (state, action) => {
|
|
332
|
-
state.fieldTranslation = action.payload;
|
|
333
|
-
},
|
|
334
|
-
setListSubject: (state, action) => {
|
|
335
|
-
state.listSubject = action.payload;
|
|
336
|
-
},
|
|
337
|
-
setDataUser: (state, action) => {
|
|
338
|
-
state.dataUser = action.payload;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
var {
|
|
343
|
-
setViewDataStore,
|
|
344
|
-
setIsShowingModalDetail,
|
|
345
|
-
setIsShowModalTranslate,
|
|
346
|
-
setFormSubmitComponent,
|
|
347
|
-
setFieldTranslate,
|
|
348
|
-
setListSubject,
|
|
349
|
-
setDataUser
|
|
350
|
-
} = formSlice.actions;
|
|
351
|
-
var form_slice_default = formSlice.reducer;
|
|
352
|
-
|
|
353
|
-
// src/store/reducers/header-slice/index.ts
|
|
354
|
-
import { createSlice as createSlice5 } from "@reduxjs/toolkit";
|
|
355
|
-
var headerSlice = createSlice5({
|
|
356
|
-
name: "header",
|
|
357
|
-
initialState: {
|
|
358
|
-
value: { allowedCompanyIds: [] }
|
|
359
|
-
},
|
|
360
|
-
reducers: {
|
|
361
|
-
setHeader: (state, action) => {
|
|
362
|
-
state.value = { ...state.value, ...action.payload };
|
|
363
|
-
},
|
|
364
|
-
setAllowedCompanyIds: (state, action) => {
|
|
365
|
-
state.value.allowedCompanyIds = action.payload;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
370
|
-
var header_slice_default = headerSlice.reducer;
|
|
371
|
-
|
|
372
|
-
// src/store/reducers/list-slice/index.ts
|
|
373
|
-
import { createSlice as createSlice6 } from "@reduxjs/toolkit";
|
|
374
|
-
var initialState5 = {
|
|
375
|
-
pageLimit: 10,
|
|
376
|
-
fields: {},
|
|
377
|
-
order: "",
|
|
378
|
-
selectedRowKeys: [],
|
|
379
|
-
selectedRadioKey: 0,
|
|
380
|
-
indexRowTableModal: -2,
|
|
381
|
-
isUpdateTableModal: false,
|
|
382
|
-
footerGroupTable: {},
|
|
383
|
-
transferDetail: null,
|
|
384
|
-
page: 0,
|
|
385
|
-
domainTable: []
|
|
386
|
-
};
|
|
387
|
-
var listSlice = createSlice6({
|
|
388
|
-
name: "list",
|
|
389
|
-
initialState: initialState5,
|
|
390
|
-
reducers: {
|
|
391
|
-
setPageLimit: (state, action) => {
|
|
392
|
-
state.pageLimit = action.payload;
|
|
393
|
-
},
|
|
394
|
-
setFields: (state, action) => {
|
|
395
|
-
state.fields = action.payload;
|
|
396
|
-
},
|
|
397
|
-
setOrder: (state, action) => {
|
|
398
|
-
state.order = action.payload;
|
|
399
|
-
},
|
|
400
|
-
setSelectedRowKeys: (state, action) => {
|
|
401
|
-
state.selectedRowKeys = action.payload;
|
|
402
|
-
},
|
|
403
|
-
setSelectedRadioKey: (state, action) => {
|
|
404
|
-
state.selectedRadioKey = action.payload;
|
|
405
|
-
},
|
|
406
|
-
setIndexRowTableModal: (state, action) => {
|
|
407
|
-
state.indexRowTableModal = action.payload;
|
|
408
|
-
},
|
|
409
|
-
setTransferDetail: (state, action) => {
|
|
410
|
-
state.transferDetail = action.payload;
|
|
411
|
-
},
|
|
412
|
-
setIsUpdateTableModal: (state, action) => {
|
|
413
|
-
state.isUpdateTableModal = action.payload;
|
|
414
|
-
},
|
|
415
|
-
setPage: (state, action) => {
|
|
416
|
-
state.page = action.payload;
|
|
417
|
-
},
|
|
418
|
-
setDomainTable: (state, action) => {
|
|
419
|
-
state.domainTable = action.payload;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
});
|
|
423
|
-
var {
|
|
424
|
-
setPageLimit,
|
|
425
|
-
setFields,
|
|
426
|
-
setOrder,
|
|
427
|
-
setSelectedRowKeys,
|
|
428
|
-
setIndexRowTableModal,
|
|
429
|
-
setIsUpdateTableModal,
|
|
430
|
-
setPage,
|
|
431
|
-
setSelectedRadioKey,
|
|
432
|
-
setTransferDetail,
|
|
433
|
-
setDomainTable
|
|
434
|
-
} = listSlice.actions;
|
|
435
|
-
var list_slice_default = listSlice.reducer;
|
|
436
|
-
|
|
437
|
-
// src/store/reducers/login-slice/index.ts
|
|
438
|
-
import { createSlice as createSlice7 } from "@reduxjs/toolkit";
|
|
439
|
-
var initialState6 = {
|
|
440
|
-
db: "",
|
|
441
|
-
redirectTo: "/",
|
|
442
|
-
forgotPasswordUrl: "/"
|
|
443
|
-
};
|
|
444
|
-
var loginSlice = createSlice7({
|
|
445
|
-
name: "login",
|
|
446
|
-
initialState: initialState6,
|
|
447
|
-
reducers: {
|
|
448
|
-
setDb: (state, action) => {
|
|
449
|
-
state.db = action.payload;
|
|
450
|
-
},
|
|
451
|
-
setRedirectTo: (state, action) => {
|
|
452
|
-
state.redirectTo = action.payload;
|
|
453
|
-
},
|
|
454
|
-
setForgotPasswordUrl: (state, action) => {
|
|
455
|
-
state.forgotPasswordUrl = action.payload;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
460
|
-
var login_slice_default = loginSlice.reducer;
|
|
461
|
-
|
|
462
|
-
// src/store/reducers/navbar-slice/index.ts
|
|
463
|
-
import { createSlice as createSlice8 } from "@reduxjs/toolkit";
|
|
464
|
-
var initialState7 = {
|
|
465
|
-
menuFocus: {},
|
|
466
|
-
menuAction: {},
|
|
467
|
-
navbarWidth: 250,
|
|
468
|
-
menuList: []
|
|
469
|
-
};
|
|
470
|
-
var navbarSlice = createSlice8({
|
|
471
|
-
name: "navbar",
|
|
472
|
-
initialState: initialState7,
|
|
473
|
-
reducers: {
|
|
474
|
-
setMenuFocus: (state, action) => {
|
|
475
|
-
state.menuFocus = action.payload;
|
|
476
|
-
},
|
|
477
|
-
setMenuFocusAction: (state, action) => {
|
|
478
|
-
state.menuAction = action.payload;
|
|
479
|
-
},
|
|
480
|
-
setNavbarWidth: (state, action) => {
|
|
481
|
-
state.navbarWidth = action.payload;
|
|
482
|
-
},
|
|
483
|
-
setMenuList: (state, action) => {
|
|
484
|
-
state.menuList = action.payload;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
489
|
-
var navbar_slice_default = navbarSlice.reducer;
|
|
490
|
-
|
|
491
|
-
// src/store/reducers/profile-slice/index.ts
|
|
492
|
-
import { createSlice as createSlice9 } from "@reduxjs/toolkit";
|
|
493
|
-
var initialState8 = {
|
|
494
|
-
profile: {}
|
|
495
|
-
};
|
|
496
|
-
var profileSlice = createSlice9({
|
|
497
|
-
name: "profile",
|
|
498
|
-
initialState: initialState8,
|
|
499
|
-
reducers: {
|
|
500
|
-
setProfile: (state, action) => {
|
|
501
|
-
state.profile = action.payload;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
});
|
|
505
|
-
var { setProfile } = profileSlice.actions;
|
|
506
|
-
var profile_slice_default = profileSlice.reducer;
|
|
507
|
-
|
|
508
|
-
// src/store/reducers/search-slice/index.ts
|
|
509
|
-
import { createSlice as createSlice10 } from "@reduxjs/toolkit";
|
|
510
|
-
var initialState9 = {
|
|
511
|
-
groupByDomain: null,
|
|
512
|
-
searchBy: [],
|
|
513
|
-
searchString: "",
|
|
514
|
-
hoveredIndexSearchList: null,
|
|
515
|
-
selectedTags: [],
|
|
516
|
-
firstDomain: null,
|
|
517
|
-
searchMap: {},
|
|
518
|
-
filterBy: [],
|
|
519
|
-
groupBy: []
|
|
520
|
-
};
|
|
521
|
-
var searchSlice = createSlice10({
|
|
522
|
-
name: "search",
|
|
523
|
-
initialState: initialState9,
|
|
524
|
-
reducers: {
|
|
525
|
-
setGroupByDomain: (state, action) => {
|
|
526
|
-
state.groupByDomain = action.payload;
|
|
527
|
-
},
|
|
528
|
-
setSearchBy: (state, action) => {
|
|
529
|
-
state.searchBy = action.payload;
|
|
530
|
-
},
|
|
531
|
-
setSearchString: (state, action) => {
|
|
532
|
-
state.searchString = action.payload;
|
|
533
|
-
},
|
|
534
|
-
setHoveredIndexSearchList: (state, action) => {
|
|
535
|
-
state.hoveredIndexSearchList = action.payload;
|
|
536
|
-
},
|
|
537
|
-
setSelectedTags: (state, action) => {
|
|
538
|
-
state.selectedTags = action.payload;
|
|
539
|
-
},
|
|
540
|
-
setFirstDomain: (state, action) => {
|
|
541
|
-
state.firstDomain = action.payload;
|
|
542
|
-
},
|
|
543
|
-
setFilterBy: (state, action) => {
|
|
544
|
-
state.filterBy = action.payload;
|
|
545
|
-
},
|
|
546
|
-
setGroupBy: (state, action) => {
|
|
547
|
-
state.groupBy = action.payload;
|
|
548
|
-
},
|
|
549
|
-
setSearchMap: (state, action) => {
|
|
550
|
-
state.searchMap = action.payload;
|
|
551
|
-
},
|
|
552
|
-
updateSearchMap: (state, action) => {
|
|
553
|
-
if (!state.searchMap[action.payload.key]) {
|
|
554
|
-
state.searchMap[action.payload.key] = [];
|
|
555
|
-
}
|
|
556
|
-
state.searchMap[action.payload.key].push(action.payload.value);
|
|
557
|
-
},
|
|
558
|
-
removeKeyFromSearchMap: (state, action) => {
|
|
559
|
-
const { key, item } = action.payload;
|
|
560
|
-
const values = state.searchMap[key];
|
|
561
|
-
if (!values) return;
|
|
562
|
-
if (item) {
|
|
563
|
-
const filtered = values.filter((value) => value.name !== item.name);
|
|
564
|
-
if (filtered.length > 0) {
|
|
565
|
-
state.searchMap[key] = filtered;
|
|
566
|
-
} else {
|
|
567
|
-
delete state.searchMap[key];
|
|
568
|
-
}
|
|
569
|
-
} else {
|
|
570
|
-
delete state.searchMap[key];
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
clearSearchMap: (state) => {
|
|
574
|
-
state.searchMap = {};
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
var {
|
|
579
|
-
setGroupByDomain,
|
|
580
|
-
setSelectedTags,
|
|
581
|
-
setSearchString,
|
|
582
|
-
setHoveredIndexSearchList,
|
|
583
|
-
setFirstDomain,
|
|
584
|
-
setSearchBy,
|
|
585
|
-
setFilterBy,
|
|
586
|
-
setSearchMap,
|
|
587
|
-
updateSearchMap,
|
|
588
|
-
removeKeyFromSearchMap,
|
|
589
|
-
setGroupBy,
|
|
590
|
-
clearSearchMap
|
|
591
|
-
} = searchSlice.actions;
|
|
592
|
-
var search_slice_default = searchSlice.reducer;
|
|
593
|
-
|
|
594
|
-
// src/store/store.ts
|
|
595
|
-
var rootReducer = combineReducers({
|
|
596
|
-
env: env_slice_default,
|
|
597
|
-
header: header_slice_default,
|
|
598
|
-
navbar: navbar_slice_default,
|
|
599
|
-
list: list_slice_default,
|
|
600
|
-
search: search_slice_default,
|
|
601
|
-
form: form_slice_default,
|
|
602
|
-
breadcrumbs: breadcrums_slice_default,
|
|
603
|
-
login: login_slice_default,
|
|
604
|
-
excel: excel_slice_default,
|
|
605
|
-
profile: profile_slice_default
|
|
606
|
-
});
|
|
607
|
-
var envStore = configureStore({
|
|
608
|
-
reducer: rootReducer,
|
|
609
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
610
|
-
serializableCheck: false
|
|
611
|
-
})
|
|
612
|
-
});
|
|
613
|
-
|
|
614
1
|
// src/configs/axios-client.ts
|
|
615
2
|
import axios from "axios";
|
|
616
3
|
|
|
@@ -2313,653 +1700,1269 @@ function evaluate(ast, context = {}) {
|
|
|
2313
1700
|
return isTrue(left) ? left : _evaluate(ast2.right);
|
|
2314
1701
|
}
|
|
2315
1702
|
case 4:
|
|
2316
|
-
// List
|
|
1703
|
+
// List
|
|
1704
|
+
case 10:
|
|
1705
|
+
return ast2.value.map(_evaluate);
|
|
1706
|
+
case 11:
|
|
1707
|
+
const dict = {};
|
|
1708
|
+
for (const key2 in ast2.value) {
|
|
1709
|
+
dict[key2] = _evaluate(ast2.value[key2]);
|
|
1710
|
+
}
|
|
1711
|
+
dicts.add(dict);
|
|
1712
|
+
return dict;
|
|
1713
|
+
case 8:
|
|
1714
|
+
const fnValue = _evaluate(ast2.fn);
|
|
1715
|
+
const args = ast2.args.map(_evaluate);
|
|
1716
|
+
const kwargs = {};
|
|
1717
|
+
for (const kwarg in ast2.kwargs) {
|
|
1718
|
+
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
1719
|
+
}
|
|
1720
|
+
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
1721
|
+
return fnValue.create(...args, kwargs);
|
|
1722
|
+
}
|
|
1723
|
+
return fnValue(...args, kwargs);
|
|
1724
|
+
case 12:
|
|
1725
|
+
const dictVal = _evaluate(ast2.target);
|
|
1726
|
+
const key = _evaluate(ast2.key);
|
|
1727
|
+
return dictVal[key];
|
|
1728
|
+
case 13:
|
|
1729
|
+
if (isTrue(_evaluate(ast2.condition))) {
|
|
1730
|
+
return _evaluate(ast2.ifTrue);
|
|
1731
|
+
} else {
|
|
1732
|
+
return _evaluate(ast2.ifFalse);
|
|
1733
|
+
}
|
|
1734
|
+
case 15:
|
|
1735
|
+
let leftVal = _evaluate(ast2.obj);
|
|
1736
|
+
let result;
|
|
1737
|
+
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
1738
|
+
result = DICT[ast2.key];
|
|
1739
|
+
} else if (typeof leftVal === "string") {
|
|
1740
|
+
result = STRING[ast2.key];
|
|
1741
|
+
} else if (leftVal instanceof Set) {
|
|
1742
|
+
result = SET[ast2.key];
|
|
1743
|
+
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
1744
|
+
result = DICT[ast2.key];
|
|
1745
|
+
leftVal = toPyDict(leftVal);
|
|
1746
|
+
} else {
|
|
1747
|
+
result = leftVal[ast2.key];
|
|
1748
|
+
}
|
|
1749
|
+
if (typeof result === "function") {
|
|
1750
|
+
const bound = result.bind(leftVal);
|
|
1751
|
+
bound[unboundFn] = result;
|
|
1752
|
+
return bound;
|
|
1753
|
+
}
|
|
1754
|
+
return result;
|
|
1755
|
+
default:
|
|
1756
|
+
throw new EvaluationError(`AST of type ${ast2.type} cannot be evaluated`);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
function _evaluate(ast2) {
|
|
1760
|
+
const val = _innerEvaluate(ast2);
|
|
1761
|
+
if (typeof val === "function" && !allowedFns.has(val) && !allowedFns.has(val[unboundFn])) {
|
|
1762
|
+
throw new Error("Invalid Function Call");
|
|
1763
|
+
}
|
|
1764
|
+
return val;
|
|
1765
|
+
}
|
|
1766
|
+
return _evaluate(ast);
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
// src/utils/domain/py.ts
|
|
1770
|
+
function parseExpr(expr) {
|
|
1771
|
+
const tokens = tokenize(expr);
|
|
1772
|
+
return parse(tokens);
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
// src/utils/domain/objects.ts
|
|
1776
|
+
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
1777
|
+
if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") {
|
|
1778
|
+
return obj1 === obj2;
|
|
1779
|
+
}
|
|
1780
|
+
const obj1Keys = Object.keys(obj1);
|
|
1781
|
+
return obj1Keys.length === Object.keys(obj2).length && obj1Keys.every((key) => comparisonFn(obj1[key], obj2[key]));
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
// src/utils/domain/arrays.ts
|
|
1785
|
+
var shallowEqual2 = shallowEqual;
|
|
1786
|
+
|
|
1787
|
+
// src/utils/domain/strings.ts
|
|
1788
|
+
var escapeMethod = Symbol("html");
|
|
1789
|
+
function escapeRegExp(str) {
|
|
1790
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
// src/utils/domain/domain.ts
|
|
1794
|
+
var InvalidDomainError = class extends Error {
|
|
1795
|
+
};
|
|
1796
|
+
var Domain = class _Domain {
|
|
1797
|
+
ast = { type: -1, value: null };
|
|
1798
|
+
static TRUE;
|
|
1799
|
+
static FALSE;
|
|
1800
|
+
static combine(domains, operator) {
|
|
1801
|
+
if (domains.length === 0) {
|
|
1802
|
+
return new _Domain([]);
|
|
1803
|
+
}
|
|
1804
|
+
const domain1 = domains[0] instanceof _Domain ? domains[0] : new _Domain(domains[0]);
|
|
1805
|
+
if (domains.length === 1) {
|
|
1806
|
+
return domain1;
|
|
1807
|
+
}
|
|
1808
|
+
const domain2 = _Domain.combine(domains.slice(1), operator);
|
|
1809
|
+
const result = new _Domain([]);
|
|
1810
|
+
const astValues1 = domain1.ast.value;
|
|
1811
|
+
const astValues2 = domain2.ast.value;
|
|
1812
|
+
const op = operator === "AND" ? "&" : "|";
|
|
1813
|
+
const combinedAST = {
|
|
1814
|
+
type: 4,
|
|
1815
|
+
value: astValues1.concat(astValues2)
|
|
1816
|
+
};
|
|
1817
|
+
result.ast = normalizeDomainAST(combinedAST, op);
|
|
1818
|
+
return result;
|
|
1819
|
+
}
|
|
1820
|
+
static and(domains) {
|
|
1821
|
+
return _Domain.combine(domains, "AND");
|
|
1822
|
+
}
|
|
1823
|
+
static or(domains) {
|
|
1824
|
+
return _Domain.combine(domains, "OR");
|
|
1825
|
+
}
|
|
1826
|
+
static not(domain) {
|
|
1827
|
+
const result = new _Domain(domain);
|
|
1828
|
+
result.ast.value.unshift({ type: 1, value: "!" });
|
|
1829
|
+
return result;
|
|
1830
|
+
}
|
|
1831
|
+
static removeDomainLeaves(domain, keysToRemove) {
|
|
1832
|
+
function processLeaf(elements, idx, operatorCtx, newDomain2) {
|
|
1833
|
+
const leaf = elements[idx];
|
|
1834
|
+
if (leaf.type === 10) {
|
|
1835
|
+
if (keysToRemove.includes(leaf.value[0].value)) {
|
|
1836
|
+
if (operatorCtx === "&") {
|
|
1837
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1838
|
+
} else if (operatorCtx === "|") {
|
|
1839
|
+
newDomain2.ast.value.push(..._Domain.FALSE.ast.value);
|
|
1840
|
+
}
|
|
1841
|
+
} else {
|
|
1842
|
+
newDomain2.ast.value.push(leaf);
|
|
1843
|
+
}
|
|
1844
|
+
return 1;
|
|
1845
|
+
} else if (leaf.type === 1) {
|
|
1846
|
+
if (leaf.value === "|" && elements[idx + 1].type === 10 && elements[idx + 2].type === 10 && keysToRemove.includes(elements[idx + 1].value[0].value) && keysToRemove.includes(elements[idx + 2].value[0].value)) {
|
|
1847
|
+
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
1848
|
+
return 3;
|
|
1849
|
+
}
|
|
1850
|
+
newDomain2.ast.value.push(leaf);
|
|
1851
|
+
if (leaf.value === "!") {
|
|
1852
|
+
return 1 + processLeaf(elements, idx + 1, "&", newDomain2);
|
|
1853
|
+
}
|
|
1854
|
+
const firstLeafSkip = processLeaf(
|
|
1855
|
+
elements,
|
|
1856
|
+
idx + 1,
|
|
1857
|
+
leaf.value,
|
|
1858
|
+
newDomain2
|
|
1859
|
+
);
|
|
1860
|
+
const secondLeafSkip = processLeaf(
|
|
1861
|
+
elements,
|
|
1862
|
+
idx + 1 + firstLeafSkip,
|
|
1863
|
+
leaf.value,
|
|
1864
|
+
newDomain2
|
|
1865
|
+
);
|
|
1866
|
+
return 1 + firstLeafSkip + secondLeafSkip;
|
|
1867
|
+
}
|
|
1868
|
+
return 0;
|
|
1869
|
+
}
|
|
1870
|
+
const d = new _Domain(domain);
|
|
1871
|
+
if (d.ast.value.length === 0) {
|
|
1872
|
+
return d;
|
|
1873
|
+
}
|
|
1874
|
+
const newDomain = new _Domain([]);
|
|
1875
|
+
processLeaf(d.ast.value, 0, "&", newDomain);
|
|
1876
|
+
return newDomain;
|
|
1877
|
+
}
|
|
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
|
+
contains(record) {
|
|
1897
|
+
const expr = evaluate(this.ast, record);
|
|
1898
|
+
return matchDomain(record, expr);
|
|
1899
|
+
}
|
|
1900
|
+
toString() {
|
|
1901
|
+
return formatAST(this.ast);
|
|
1902
|
+
}
|
|
1903
|
+
toList(context) {
|
|
1904
|
+
return evaluate(this.ast, context);
|
|
1905
|
+
}
|
|
1906
|
+
toJson() {
|
|
1907
|
+
try {
|
|
1908
|
+
const evaluatedAsList = this.toList({});
|
|
1909
|
+
const evaluatedDomain = new _Domain(evaluatedAsList);
|
|
1910
|
+
if (evaluatedDomain.toString() === this.toString()) {
|
|
1911
|
+
return evaluatedAsList;
|
|
1912
|
+
}
|
|
1913
|
+
return this.toString();
|
|
1914
|
+
} catch {
|
|
1915
|
+
return this.toString();
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
};
|
|
1919
|
+
var TRUE_LEAF = [1, "=", 1];
|
|
1920
|
+
var FALSE_LEAF = [0, "=", 1];
|
|
1921
|
+
var TRUE_DOMAIN = new Domain([TRUE_LEAF]);
|
|
1922
|
+
var FALSE_DOMAIN = new Domain([FALSE_LEAF]);
|
|
1923
|
+
Domain.TRUE = TRUE_DOMAIN;
|
|
1924
|
+
Domain.FALSE = FALSE_DOMAIN;
|
|
1925
|
+
function toAST(domain) {
|
|
1926
|
+
const elems = domain.map((elem) => {
|
|
1927
|
+
switch (elem) {
|
|
1928
|
+
case "!":
|
|
1929
|
+
case "&":
|
|
1930
|
+
case "|":
|
|
1931
|
+
return { type: 1, value: elem };
|
|
1932
|
+
default:
|
|
1933
|
+
return {
|
|
1934
|
+
type: 10,
|
|
1935
|
+
value: elem.map(toPyValue)
|
|
1936
|
+
};
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
return { type: 4, value: elems };
|
|
1940
|
+
}
|
|
1941
|
+
function normalizeDomainAST(domain, op = "&") {
|
|
1942
|
+
if (domain.type !== 4) {
|
|
1943
|
+
if (domain.type === 10) {
|
|
1944
|
+
const value = domain.value;
|
|
1945
|
+
if (value.findIndex((e) => e.type === 10) === -1 || !value.every((e) => e.type === 10 || e.type === 1)) {
|
|
1946
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
1947
|
+
}
|
|
1948
|
+
} else {
|
|
1949
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
if (domain.value.length === 0) {
|
|
1953
|
+
return domain;
|
|
1954
|
+
}
|
|
1955
|
+
let expected = 1;
|
|
1956
|
+
for (const child of domain.value) {
|
|
1957
|
+
switch (child.type) {
|
|
1958
|
+
case 1:
|
|
1959
|
+
if (child.value === "&" || child.value === "|") {
|
|
1960
|
+
expected++;
|
|
1961
|
+
} else if (child.value !== "!") {
|
|
1962
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
1963
|
+
}
|
|
1964
|
+
break;
|
|
1965
|
+
case 4:
|
|
1966
|
+
/* list */
|
|
2317
1967
|
case 10:
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
for (const key2 in ast2.value) {
|
|
2322
|
-
dict[key2] = _evaluate(ast2.value[key2]);
|
|
2323
|
-
}
|
|
2324
|
-
dicts.add(dict);
|
|
2325
|
-
return dict;
|
|
2326
|
-
case 8:
|
|
2327
|
-
const fnValue = _evaluate(ast2.fn);
|
|
2328
|
-
const args = ast2.args.map(_evaluate);
|
|
2329
|
-
const kwargs = {};
|
|
2330
|
-
for (const kwarg in ast2.kwargs) {
|
|
2331
|
-
kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
|
|
2332
|
-
}
|
|
2333
|
-
if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
|
|
2334
|
-
return fnValue.create(...args, kwargs);
|
|
2335
|
-
}
|
|
2336
|
-
return fnValue(...args, kwargs);
|
|
2337
|
-
case 12:
|
|
2338
|
-
const dictVal = _evaluate(ast2.target);
|
|
2339
|
-
const key = _evaluate(ast2.key);
|
|
2340
|
-
return dictVal[key];
|
|
2341
|
-
case 13:
|
|
2342
|
-
if (isTrue(_evaluate(ast2.condition))) {
|
|
2343
|
-
return _evaluate(ast2.ifTrue);
|
|
2344
|
-
} else {
|
|
2345
|
-
return _evaluate(ast2.ifFalse);
|
|
2346
|
-
}
|
|
2347
|
-
case 15:
|
|
2348
|
-
let leftVal = _evaluate(ast2.obj);
|
|
2349
|
-
let result;
|
|
2350
|
-
if (dicts.has(leftVal) || Object.isPrototypeOf.call(PY_DICT, leftVal)) {
|
|
2351
|
-
result = DICT[ast2.key];
|
|
2352
|
-
} else if (typeof leftVal === "string") {
|
|
2353
|
-
result = STRING[ast2.key];
|
|
2354
|
-
} else if (leftVal instanceof Set) {
|
|
2355
|
-
result = SET[ast2.key];
|
|
2356
|
-
} else if (ast2.key === "get" && typeof leftVal === "object") {
|
|
2357
|
-
result = DICT[ast2.key];
|
|
2358
|
-
leftVal = toPyDict(leftVal);
|
|
2359
|
-
} else {
|
|
2360
|
-
result = leftVal[ast2.key];
|
|
2361
|
-
}
|
|
2362
|
-
if (typeof result === "function") {
|
|
2363
|
-
const bound = result.bind(leftVal);
|
|
2364
|
-
bound[unboundFn] = result;
|
|
2365
|
-
return bound;
|
|
1968
|
+
if (child.value.length === 3) {
|
|
1969
|
+
expected--;
|
|
1970
|
+
break;
|
|
2366
1971
|
}
|
|
2367
|
-
|
|
1972
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2368
1973
|
default:
|
|
2369
|
-
throw new
|
|
1974
|
+
throw new InvalidDomainError("Invalid domain AST");
|
|
2370
1975
|
}
|
|
2371
1976
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
}
|
|
2377
|
-
return val;
|
|
1977
|
+
const values = domain.value.slice();
|
|
1978
|
+
while (expected < 0) {
|
|
1979
|
+
expected++;
|
|
1980
|
+
values.unshift({ type: 1, value: op });
|
|
2378
1981
|
}
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
function parseExpr(expr) {
|
|
2384
|
-
const tokens = tokenize(expr);
|
|
2385
|
-
return parse(tokens);
|
|
2386
|
-
}
|
|
2387
|
-
|
|
2388
|
-
// src/utils/domain/objects.ts
|
|
2389
|
-
function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
|
|
2390
|
-
if (!obj1 || !obj2 || typeof obj1 !== "object" || typeof obj2 !== "object") {
|
|
2391
|
-
return obj1 === obj2;
|
|
1982
|
+
if (expected > 0) {
|
|
1983
|
+
throw new InvalidDomainError(
|
|
1984
|
+
`invalid domain ${formatAST(domain)} (missing ${expected} segment(s))`
|
|
1985
|
+
);
|
|
2392
1986
|
}
|
|
2393
|
-
|
|
2394
|
-
return obj1Keys.length === Object.keys(obj2).length && obj1Keys.every((key) => comparisonFn(obj1[key], obj2[key]));
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
|
-
// src/utils/domain/arrays.ts
|
|
2398
|
-
var shallowEqual2 = shallowEqual;
|
|
2399
|
-
|
|
2400
|
-
// src/utils/domain/strings.ts
|
|
2401
|
-
var escapeMethod = Symbol("html");
|
|
2402
|
-
function escapeRegExp(str) {
|
|
2403
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1987
|
+
return { type: 4, value: values };
|
|
2404
1988
|
}
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
1989
|
+
function matchCondition(record, condition) {
|
|
1990
|
+
if (typeof condition === "boolean") {
|
|
1991
|
+
return condition;
|
|
1992
|
+
}
|
|
1993
|
+
const [field, operator, value] = condition;
|
|
1994
|
+
if (typeof field === "string") {
|
|
1995
|
+
const names = field.split(".");
|
|
1996
|
+
if (names.length >= 2) {
|
|
1997
|
+
return matchCondition(record[names[0]], [
|
|
1998
|
+
names.slice(1).join("."),
|
|
1999
|
+
operator,
|
|
2000
|
+
value
|
|
2001
|
+
]);
|
|
2416
2002
|
}
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2003
|
+
}
|
|
2004
|
+
let likeRegexp, ilikeRegexp;
|
|
2005
|
+
if (["like", "not like", "ilike", "not ilike"].includes(operator)) {
|
|
2006
|
+
likeRegexp = new RegExp(
|
|
2007
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2008
|
+
"g"
|
|
2009
|
+
);
|
|
2010
|
+
ilikeRegexp = new RegExp(
|
|
2011
|
+
`(.*)${escapeRegExp(value).replaceAll("%", "(.*)")}(.*)`,
|
|
2012
|
+
"gi"
|
|
2013
|
+
);
|
|
2014
|
+
}
|
|
2015
|
+
const fieldValue = typeof field === "number" ? field : record[field];
|
|
2016
|
+
switch (operator) {
|
|
2017
|
+
case "=?":
|
|
2018
|
+
if ([false, null].includes(value)) {
|
|
2019
|
+
return true;
|
|
2020
|
+
}
|
|
2021
|
+
// eslint-disable-next-line no-fallthrough
|
|
2022
|
+
case "=":
|
|
2023
|
+
case "==":
|
|
2024
|
+
if (Array.isArray(fieldValue) && Array.isArray(value)) {
|
|
2025
|
+
return shallowEqual2(fieldValue, value);
|
|
2026
|
+
}
|
|
2027
|
+
return fieldValue === value;
|
|
2028
|
+
case "!=":
|
|
2029
|
+
case "<>":
|
|
2030
|
+
return !matchCondition(record, [field, "==", value]);
|
|
2031
|
+
case "<":
|
|
2032
|
+
return fieldValue < value;
|
|
2033
|
+
case "<=":
|
|
2034
|
+
return fieldValue <= value;
|
|
2035
|
+
case ">":
|
|
2036
|
+
return fieldValue > value;
|
|
2037
|
+
case ">=":
|
|
2038
|
+
return fieldValue >= value;
|
|
2039
|
+
case "in": {
|
|
2040
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2041
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2042
|
+
return fieldVal.some((fv) => val.includes(fv));
|
|
2420
2043
|
}
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2044
|
+
case "not in": {
|
|
2045
|
+
const val = Array.isArray(value) ? value : [value];
|
|
2046
|
+
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2047
|
+
return !fieldVal.some((fv) => val.includes(fv));
|
|
2048
|
+
}
|
|
2049
|
+
case "like":
|
|
2050
|
+
if (fieldValue === false) {
|
|
2051
|
+
return false;
|
|
2052
|
+
}
|
|
2053
|
+
return Boolean(fieldValue.match(likeRegexp));
|
|
2054
|
+
case "not like":
|
|
2055
|
+
if (fieldValue === false) {
|
|
2056
|
+
return false;
|
|
2057
|
+
}
|
|
2058
|
+
return Boolean(!fieldValue.match(likeRegexp));
|
|
2059
|
+
case "=like":
|
|
2060
|
+
if (fieldValue === false) {
|
|
2061
|
+
return false;
|
|
2062
|
+
}
|
|
2063
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2064
|
+
fieldValue
|
|
2065
|
+
);
|
|
2066
|
+
case "ilike":
|
|
2067
|
+
if (fieldValue === false) {
|
|
2068
|
+
return false;
|
|
2069
|
+
}
|
|
2070
|
+
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2071
|
+
case "not ilike":
|
|
2072
|
+
if (fieldValue === false) {
|
|
2073
|
+
return false;
|
|
2074
|
+
}
|
|
2075
|
+
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2076
|
+
case "=ilike":
|
|
2077
|
+
if (fieldValue === false) {
|
|
2078
|
+
return false;
|
|
2079
|
+
}
|
|
2080
|
+
return new RegExp(escapeRegExp(value).replace(/%/g, ".*"), "i").test(
|
|
2081
|
+
fieldValue
|
|
2082
|
+
);
|
|
2432
2083
|
}
|
|
2433
|
-
|
|
2434
|
-
|
|
2084
|
+
throw new InvalidDomainError("could not match domain");
|
|
2085
|
+
}
|
|
2086
|
+
function makeOperators(record) {
|
|
2087
|
+
const match = matchCondition.bind(null, record);
|
|
2088
|
+
return {
|
|
2089
|
+
"!": (x) => !match(x),
|
|
2090
|
+
"&": (a, b) => match(a) && match(b),
|
|
2091
|
+
"|": (a, b) => match(a) || match(b)
|
|
2092
|
+
};
|
|
2093
|
+
}
|
|
2094
|
+
function matchDomain(record, domain) {
|
|
2095
|
+
if (domain.length === 0) {
|
|
2096
|
+
return true;
|
|
2435
2097
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2098
|
+
const operators = makeOperators(record);
|
|
2099
|
+
const reversedDomain = Array.from(domain).reverse();
|
|
2100
|
+
const condStack = [];
|
|
2101
|
+
for (const item of reversedDomain) {
|
|
2102
|
+
const operator = typeof item === "string" && operators[item];
|
|
2103
|
+
if (operator) {
|
|
2104
|
+
const operands = condStack.splice(-operator.length);
|
|
2105
|
+
condStack.push(operator(...operands));
|
|
2106
|
+
} else {
|
|
2107
|
+
condStack.push(item);
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
return matchCondition(record, condStack.pop());
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
// src/utils/function.ts
|
|
2114
|
+
import { useEffect, useState } from "react";
|
|
2115
|
+
var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
|
|
2116
|
+
if (!originalRequest.data) return originalRequest.data;
|
|
2117
|
+
if (typeof originalRequest.data === "string") {
|
|
2118
|
+
try {
|
|
2119
|
+
const parsedData = JSON.parse(originalRequest.data);
|
|
2120
|
+
if (parsedData.with_context && typeof parsedData.with_context === "object") {
|
|
2121
|
+
parsedData.with_context.token = newAccessToken;
|
|
2122
|
+
}
|
|
2123
|
+
return JSON.stringify(parsedData);
|
|
2124
|
+
} catch (e) {
|
|
2125
|
+
console.warn("Failed to parse originalRequest.data", e);
|
|
2126
|
+
return originalRequest.data;
|
|
2127
|
+
}
|
|
2438
2128
|
}
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
result.ast.value.unshift({ type: 1, value: "!" });
|
|
2442
|
-
return result;
|
|
2129
|
+
if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
|
|
2130
|
+
originalRequest.data.with_context.token = newAccessToken;
|
|
2443
2131
|
}
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2132
|
+
return originalRequest.data;
|
|
2133
|
+
};
|
|
2134
|
+
|
|
2135
|
+
// src/utils/storage/local-storage.ts
|
|
2136
|
+
var localStorageUtils = () => {
|
|
2137
|
+
const setToken = async (access_token) => {
|
|
2138
|
+
localStorage.setItem("accessToken", access_token);
|
|
2139
|
+
};
|
|
2140
|
+
const setRefreshToken = async (refresh_token) => {
|
|
2141
|
+
localStorage.setItem("refreshToken", refresh_token);
|
|
2142
|
+
};
|
|
2143
|
+
const getAccessToken = async () => {
|
|
2144
|
+
return localStorage.getItem("accessToken");
|
|
2145
|
+
};
|
|
2146
|
+
const getRefreshToken = async () => {
|
|
2147
|
+
return localStorage.getItem("refreshToken");
|
|
2148
|
+
};
|
|
2149
|
+
const clearToken = async () => {
|
|
2150
|
+
localStorage.removeItem("accessToken");
|
|
2151
|
+
localStorage.removeItem("refreshToken");
|
|
2152
|
+
};
|
|
2153
|
+
return {
|
|
2154
|
+
setToken,
|
|
2155
|
+
setRefreshToken,
|
|
2156
|
+
getAccessToken,
|
|
2157
|
+
getRefreshToken,
|
|
2158
|
+
clearToken
|
|
2159
|
+
};
|
|
2160
|
+
};
|
|
2161
|
+
|
|
2162
|
+
// src/utils/storage/session-storage.ts
|
|
2163
|
+
var sessionStorageUtils = () => {
|
|
2164
|
+
const getBrowserSession = async () => {
|
|
2165
|
+
return sessionStorage.getItem("browserSession");
|
|
2166
|
+
};
|
|
2167
|
+
return {
|
|
2168
|
+
getBrowserSession
|
|
2169
|
+
};
|
|
2170
|
+
};
|
|
2171
|
+
|
|
2172
|
+
// src/configs/axios-client.ts
|
|
2173
|
+
var axiosClient = {
|
|
2174
|
+
init(config) {
|
|
2175
|
+
const localStorage2 = config.localStorageUtils ?? localStorageUtils();
|
|
2176
|
+
const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
|
|
2177
|
+
const db = config.db;
|
|
2178
|
+
let isRefreshing = false;
|
|
2179
|
+
let failedQueue = [];
|
|
2180
|
+
const processQueue = (error, token = null) => {
|
|
2181
|
+
failedQueue?.forEach((prom) => {
|
|
2182
|
+
if (error) {
|
|
2183
|
+
prom.reject(error);
|
|
2454
2184
|
} else {
|
|
2455
|
-
|
|
2456
|
-
}
|
|
2457
|
-
return 1;
|
|
2458
|
-
} else if (leaf.type === 1) {
|
|
2459
|
-
if (leaf.value === "|" && elements[idx + 1].type === 10 && elements[idx + 2].type === 10 && keysToRemove.includes(elements[idx + 1].value[0].value) && keysToRemove.includes(elements[idx + 2].value[0].value)) {
|
|
2460
|
-
newDomain2.ast.value.push(..._Domain.TRUE.ast.value);
|
|
2461
|
-
return 3;
|
|
2185
|
+
prom.resolve(token);
|
|
2462
2186
|
}
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2187
|
+
});
|
|
2188
|
+
failedQueue = [];
|
|
2189
|
+
};
|
|
2190
|
+
const instance = axios.create({
|
|
2191
|
+
adapter: axios.defaults.adapter,
|
|
2192
|
+
baseURL: config.baseUrl,
|
|
2193
|
+
timeout: 5e4,
|
|
2194
|
+
paramsSerializer: (params) => new URLSearchParams(params).toString()
|
|
2195
|
+
});
|
|
2196
|
+
instance.interceptors.request.use(
|
|
2197
|
+
async (config2) => {
|
|
2198
|
+
const useRefreshToken = config2.useRefreshToken;
|
|
2199
|
+
const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
|
|
2200
|
+
if (token) {
|
|
2201
|
+
config2.headers["Authorization"] = "Bearer " + token;
|
|
2466
2202
|
}
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
newDomain2
|
|
2472
|
-
);
|
|
2473
|
-
const secondLeafSkip = processLeaf(
|
|
2474
|
-
elements,
|
|
2475
|
-
idx + 1 + firstLeafSkip,
|
|
2476
|
-
leaf.value,
|
|
2477
|
-
newDomain2
|
|
2478
|
-
);
|
|
2479
|
-
return 1 + firstLeafSkip + secondLeafSkip;
|
|
2203
|
+
return config2;
|
|
2204
|
+
},
|
|
2205
|
+
(error) => {
|
|
2206
|
+
Promise.reject(error);
|
|
2480
2207
|
}
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
}
|
|
2491
|
-
constructor(descr = []) {
|
|
2492
|
-
if (descr instanceof _Domain) {
|
|
2493
|
-
return new _Domain(descr.toString());
|
|
2494
|
-
} else {
|
|
2495
|
-
let rawAST;
|
|
2496
|
-
try {
|
|
2497
|
-
rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
|
|
2498
|
-
} catch (error) {
|
|
2499
|
-
throw new InvalidDomainError(
|
|
2500
|
-
`Invalid domain representation: ${descr}`,
|
|
2501
|
-
{
|
|
2502
|
-
cause: error
|
|
2208
|
+
);
|
|
2209
|
+
instance.interceptors.response.use(
|
|
2210
|
+
(response) => {
|
|
2211
|
+
return handleResponse(response);
|
|
2212
|
+
},
|
|
2213
|
+
async (error) => {
|
|
2214
|
+
const handleError3 = async (error2) => {
|
|
2215
|
+
if (!error2.response) {
|
|
2216
|
+
return error2;
|
|
2503
2217
|
}
|
|
2504
|
-
|
|
2218
|
+
const { data } = error2.response;
|
|
2219
|
+
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2220
|
+
await clearAuthToken();
|
|
2221
|
+
}
|
|
2222
|
+
return data;
|
|
2223
|
+
};
|
|
2224
|
+
const originalRequest = error.config;
|
|
2225
|
+
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2226
|
+
error.response.data.code
|
|
2227
|
+
)) {
|
|
2228
|
+
if (isRefreshing) {
|
|
2229
|
+
return new Promise(function(resolve, reject) {
|
|
2230
|
+
failedQueue.push({ resolve, reject });
|
|
2231
|
+
}).then((token) => {
|
|
2232
|
+
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
2233
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2234
|
+
originalRequest,
|
|
2235
|
+
token
|
|
2236
|
+
);
|
|
2237
|
+
return instance.request(originalRequest);
|
|
2238
|
+
}).catch(async (err) => {
|
|
2239
|
+
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2240
|
+
await clearAuthToken();
|
|
2241
|
+
}
|
|
2242
|
+
});
|
|
2243
|
+
}
|
|
2244
|
+
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2245
|
+
const refreshToken = await localStorage2.getRefreshToken();
|
|
2246
|
+
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2247
|
+
isRefreshing = true;
|
|
2248
|
+
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2249
|
+
await clearAuthToken();
|
|
2250
|
+
} else {
|
|
2251
|
+
const payload = Object.fromEntries(
|
|
2252
|
+
Object.entries({
|
|
2253
|
+
refresh_token: refreshToken,
|
|
2254
|
+
grant_type: "refresh_token",
|
|
2255
|
+
client_id: config.config.clientId,
|
|
2256
|
+
client_secret: config.config.clientSecret
|
|
2257
|
+
}).filter(([_, value]) => !!value)
|
|
2258
|
+
);
|
|
2259
|
+
return new Promise(function(resolve) {
|
|
2260
|
+
axios.post(
|
|
2261
|
+
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2262
|
+
payload,
|
|
2263
|
+
{
|
|
2264
|
+
headers: {
|
|
2265
|
+
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
2266
|
+
Authorization: `Bearer ${accessTokenExp}`
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
).then(async (res) => {
|
|
2270
|
+
const data = res.data;
|
|
2271
|
+
await localStorage2.setToken(data.access_token);
|
|
2272
|
+
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2273
|
+
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2274
|
+
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2275
|
+
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2276
|
+
originalRequest,
|
|
2277
|
+
data.access_token
|
|
2278
|
+
);
|
|
2279
|
+
processQueue(null, data.access_token);
|
|
2280
|
+
resolve(instance.request(originalRequest));
|
|
2281
|
+
}).catch(async (err) => {
|
|
2282
|
+
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
2283
|
+
await clearAuthToken();
|
|
2284
|
+
}
|
|
2285
|
+
if (err && err.response) {
|
|
2286
|
+
const { error_code } = err.response?.data || {};
|
|
2287
|
+
if (error_code === "AUTHEN_FAIL") {
|
|
2288
|
+
await clearAuthToken();
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
processQueue(err, null);
|
|
2292
|
+
}).finally(() => {
|
|
2293
|
+
isRefreshing = false;
|
|
2294
|
+
});
|
|
2295
|
+
});
|
|
2296
|
+
}
|
|
2297
|
+
}
|
|
2298
|
+
return Promise.reject(await handleError3(error));
|
|
2505
2299
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
return evaluatedAsList;
|
|
2300
|
+
);
|
|
2301
|
+
const handleResponse = (res) => {
|
|
2302
|
+
if (res && res.data) {
|
|
2303
|
+
return res.data;
|
|
2304
|
+
}
|
|
2305
|
+
return res;
|
|
2306
|
+
};
|
|
2307
|
+
const handleError2 = (error) => {
|
|
2308
|
+
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2309
|
+
console.error("Request Timeout Error:", error);
|
|
2310
|
+
return "Request Timeout Error";
|
|
2311
|
+
} else if (error.isAxiosError && !error.response) {
|
|
2312
|
+
console.error("Network Error:", error);
|
|
2313
|
+
return "Network Error";
|
|
2314
|
+
} else {
|
|
2315
|
+
console.error("Other Error:", error?.response);
|
|
2316
|
+
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2317
|
+
return { message: errorMessage, status: error?.response?.status };
|
|
2525
2318
|
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2319
|
+
};
|
|
2320
|
+
const clearAuthToken = async () => {
|
|
2321
|
+
await localStorage2.clearToken();
|
|
2322
|
+
if (typeof window !== "undefined") {
|
|
2323
|
+
window.location.href = `/login`;
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
function formatUrl(url, db2) {
|
|
2327
|
+
return url + (db2 ? "?db=" + db2 : "");
|
|
2529
2328
|
}
|
|
2329
|
+
const responseBody = (response) => response;
|
|
2330
|
+
const requests = {
|
|
2331
|
+
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
2332
|
+
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
2333
|
+
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
2334
|
+
responseType: "arraybuffer",
|
|
2335
|
+
headers: {
|
|
2336
|
+
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2337
|
+
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2338
|
+
}
|
|
2339
|
+
}).then(responseBody),
|
|
2340
|
+
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
2341
|
+
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
2342
|
+
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
2343
|
+
};
|
|
2344
|
+
return requests;
|
|
2530
2345
|
}
|
|
2531
2346
|
};
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
type: 10,
|
|
2548
|
-
value: elem.map(toPyValue)
|
|
2549
|
-
};
|
|
2550
|
-
}
|
|
2551
|
-
});
|
|
2552
|
-
return { type: 4, value: elems };
|
|
2553
|
-
}
|
|
2554
|
-
function normalizeDomainAST(domain, op = "&") {
|
|
2555
|
-
if (domain.type !== 4) {
|
|
2556
|
-
if (domain.type === 10) {
|
|
2557
|
-
const value = domain.value;
|
|
2558
|
-
if (value.findIndex((e) => e.type === 10) === -1 || !value.every((e) => e.type === 10 || e.type === 1)) {
|
|
2559
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2560
|
-
}
|
|
2561
|
-
} else {
|
|
2562
|
-
throw new InvalidDomainError("Invalid domain AST");
|
|
2347
|
+
|
|
2348
|
+
// src/store/index.ts
|
|
2349
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
2350
|
+
|
|
2351
|
+
// src/store/reducers/breadcrums-slice/index.ts
|
|
2352
|
+
import { createSlice } from "@reduxjs/toolkit";
|
|
2353
|
+
var initialState = {
|
|
2354
|
+
breadCrumbs: []
|
|
2355
|
+
};
|
|
2356
|
+
var breadcrumbsSlice = createSlice({
|
|
2357
|
+
name: "breadcrumbs",
|
|
2358
|
+
initialState,
|
|
2359
|
+
reducers: {
|
|
2360
|
+
setBreadCrumbs: (state, action) => {
|
|
2361
|
+
state.breadCrumbs = [...state.breadCrumbs, action.payload];
|
|
2563
2362
|
}
|
|
2564
2363
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2364
|
+
});
|
|
2365
|
+
var { setBreadCrumbs } = breadcrumbsSlice.actions;
|
|
2366
|
+
var breadcrums_slice_default = breadcrumbsSlice.reducer;
|
|
2367
|
+
|
|
2368
|
+
// src/store/reducers/env-slice/index.ts
|
|
2369
|
+
import { createSlice as createSlice2 } from "@reduxjs/toolkit";
|
|
2370
|
+
var initialState2 = {
|
|
2371
|
+
baseUrl: "",
|
|
2372
|
+
requests: null,
|
|
2373
|
+
companies: [],
|
|
2374
|
+
user: {},
|
|
2375
|
+
config: null,
|
|
2376
|
+
envFile: null,
|
|
2377
|
+
defaultCompany: {
|
|
2378
|
+
id: null,
|
|
2379
|
+
logo: "",
|
|
2380
|
+
secondary_color: "",
|
|
2381
|
+
primary_color: ""
|
|
2382
|
+
},
|
|
2383
|
+
context: {
|
|
2384
|
+
uid: null,
|
|
2385
|
+
allowed_company_ids: [],
|
|
2386
|
+
lang: "vi_VN",
|
|
2387
|
+
tz: "Asia/Saigon"
|
|
2567
2388
|
}
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2389
|
+
};
|
|
2390
|
+
var envSlice = createSlice2({
|
|
2391
|
+
name: "env",
|
|
2392
|
+
initialState: initialState2,
|
|
2393
|
+
reducers: {
|
|
2394
|
+
setEnv: (state, action) => {
|
|
2395
|
+
Object.assign(state, action.payload);
|
|
2396
|
+
},
|
|
2397
|
+
setUid: (state, action) => {
|
|
2398
|
+
state.context.uid = action.payload;
|
|
2399
|
+
},
|
|
2400
|
+
setAllowCompanies: (state, action) => {
|
|
2401
|
+
state.context.allowed_company_ids = action.payload;
|
|
2402
|
+
},
|
|
2403
|
+
setCompanies: (state, action) => {
|
|
2404
|
+
state.companies = action.payload;
|
|
2405
|
+
},
|
|
2406
|
+
setDefaultCompany: (state, action) => {
|
|
2407
|
+
state.defaultCompany = action.payload;
|
|
2408
|
+
},
|
|
2409
|
+
setLang: (state, action) => {
|
|
2410
|
+
state.context.lang = action.payload;
|
|
2411
|
+
},
|
|
2412
|
+
setUser: (state, action) => {
|
|
2413
|
+
state.user = action.payload;
|
|
2414
|
+
},
|
|
2415
|
+
setConfig: (state, action) => {
|
|
2416
|
+
state.config = action.payload;
|
|
2417
|
+
},
|
|
2418
|
+
setEnvFile: (state, action) => {
|
|
2419
|
+
state.envFile = action.payload;
|
|
2588
2420
|
}
|
|
2589
2421
|
}
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
}
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2422
|
+
});
|
|
2423
|
+
var {
|
|
2424
|
+
setEnv,
|
|
2425
|
+
setUid,
|
|
2426
|
+
setLang,
|
|
2427
|
+
setAllowCompanies,
|
|
2428
|
+
setCompanies,
|
|
2429
|
+
setDefaultCompany,
|
|
2430
|
+
setUser,
|
|
2431
|
+
setConfig,
|
|
2432
|
+
setEnvFile
|
|
2433
|
+
} = envSlice.actions;
|
|
2434
|
+
var env_slice_default = envSlice.reducer;
|
|
2435
|
+
|
|
2436
|
+
// src/store/reducers/excel-slice/index.ts
|
|
2437
|
+
import { createSlice as createSlice3 } from "@reduxjs/toolkit";
|
|
2438
|
+
var initialState3 = {
|
|
2439
|
+
dataParse: null,
|
|
2440
|
+
idFile: null,
|
|
2441
|
+
isFileLoaded: false,
|
|
2442
|
+
loadingImport: false,
|
|
2443
|
+
selectedFile: null,
|
|
2444
|
+
errorData: null
|
|
2445
|
+
};
|
|
2446
|
+
var excelSlice = createSlice3({
|
|
2447
|
+
name: "excel",
|
|
2448
|
+
initialState: initialState3,
|
|
2449
|
+
reducers: {
|
|
2450
|
+
setDataParse: (state, action) => {
|
|
2451
|
+
state.dataParse = action.payload;
|
|
2452
|
+
},
|
|
2453
|
+
setIdFile: (state, action) => {
|
|
2454
|
+
state.idFile = action.payload;
|
|
2455
|
+
},
|
|
2456
|
+
setIsFileLoaded: (state, action) => {
|
|
2457
|
+
state.isFileLoaded = action.payload;
|
|
2458
|
+
},
|
|
2459
|
+
setLoadingImport: (state, action) => {
|
|
2460
|
+
state.loadingImport = action.payload;
|
|
2461
|
+
},
|
|
2462
|
+
setSelectedFile: (state, action) => {
|
|
2463
|
+
state.selectedFile = action.payload;
|
|
2464
|
+
},
|
|
2465
|
+
setErrorData: (state, action) => {
|
|
2466
|
+
state.errorData = action.payload;
|
|
2467
|
+
}
|
|
2605
2468
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2469
|
+
});
|
|
2470
|
+
var {
|
|
2471
|
+
setDataParse,
|
|
2472
|
+
setIdFile,
|
|
2473
|
+
setIsFileLoaded,
|
|
2474
|
+
setLoadingImport,
|
|
2475
|
+
setSelectedFile,
|
|
2476
|
+
setErrorData
|
|
2477
|
+
} = excelSlice.actions;
|
|
2478
|
+
var excel_slice_default = excelSlice.reducer;
|
|
2479
|
+
|
|
2480
|
+
// src/store/reducers/form-slice/index.ts
|
|
2481
|
+
import { createSlice as createSlice4 } from "@reduxjs/toolkit";
|
|
2482
|
+
var initialState4 = {
|
|
2483
|
+
viewDataStore: {},
|
|
2484
|
+
isShowingModalDetail: false,
|
|
2485
|
+
isShowModalTranslate: false,
|
|
2486
|
+
formSubmitComponent: {},
|
|
2487
|
+
fieldTranslation: null,
|
|
2488
|
+
listSubject: {},
|
|
2489
|
+
dataUser: {}
|
|
2490
|
+
};
|
|
2491
|
+
var formSlice = createSlice4({
|
|
2492
|
+
name: "form",
|
|
2493
|
+
initialState: initialState4,
|
|
2494
|
+
reducers: {
|
|
2495
|
+
setViewDataStore: (state, action) => {
|
|
2496
|
+
state.viewDataStore = action.payload;
|
|
2497
|
+
},
|
|
2498
|
+
setIsShowingModalDetail: (state, action) => {
|
|
2499
|
+
state.isShowingModalDetail = action.payload;
|
|
2500
|
+
},
|
|
2501
|
+
setIsShowModalTranslate: (state, action) => {
|
|
2502
|
+
state.isShowModalTranslate = action.payload;
|
|
2503
|
+
},
|
|
2504
|
+
setFormSubmitComponent: (state, action) => {
|
|
2505
|
+
state.formSubmitComponent[action.payload.key] = action.payload.component;
|
|
2506
|
+
},
|
|
2507
|
+
setFieldTranslate: (state, action) => {
|
|
2508
|
+
state.fieldTranslation = action.payload;
|
|
2509
|
+
},
|
|
2510
|
+
setListSubject: (state, action) => {
|
|
2511
|
+
state.listSubject = action.payload;
|
|
2512
|
+
},
|
|
2513
|
+
setDataUser: (state, action) => {
|
|
2514
|
+
state.dataUser = action.payload;
|
|
2615
2515
|
}
|
|
2616
2516
|
}
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
case "<>":
|
|
2643
|
-
return !matchCondition(record, [field, "==", value]);
|
|
2644
|
-
case "<":
|
|
2645
|
-
return fieldValue < value;
|
|
2646
|
-
case "<=":
|
|
2647
|
-
return fieldValue <= value;
|
|
2648
|
-
case ">":
|
|
2649
|
-
return fieldValue > value;
|
|
2650
|
-
case ">=":
|
|
2651
|
-
return fieldValue >= value;
|
|
2652
|
-
case "in": {
|
|
2653
|
-
const val = Array.isArray(value) ? value : [value];
|
|
2654
|
-
const fieldVal = Array.isArray(fieldValue) ? fieldValue : [fieldValue];
|
|
2655
|
-
return fieldVal.some((fv) => val.includes(fv));
|
|
2517
|
+
});
|
|
2518
|
+
var {
|
|
2519
|
+
setViewDataStore,
|
|
2520
|
+
setIsShowingModalDetail,
|
|
2521
|
+
setIsShowModalTranslate,
|
|
2522
|
+
setFormSubmitComponent,
|
|
2523
|
+
setFieldTranslate,
|
|
2524
|
+
setListSubject,
|
|
2525
|
+
setDataUser
|
|
2526
|
+
} = formSlice.actions;
|
|
2527
|
+
var form_slice_default = formSlice.reducer;
|
|
2528
|
+
|
|
2529
|
+
// src/store/reducers/header-slice/index.ts
|
|
2530
|
+
import { createSlice as createSlice5 } from "@reduxjs/toolkit";
|
|
2531
|
+
var headerSlice = createSlice5({
|
|
2532
|
+
name: "header",
|
|
2533
|
+
initialState: {
|
|
2534
|
+
value: { allowedCompanyIds: [] }
|
|
2535
|
+
},
|
|
2536
|
+
reducers: {
|
|
2537
|
+
setHeader: (state, action) => {
|
|
2538
|
+
state.value = { ...state.value, ...action.payload };
|
|
2539
|
+
},
|
|
2540
|
+
setAllowedCompanyIds: (state, action) => {
|
|
2541
|
+
state.value.allowedCompanyIds = action.payload;
|
|
2656
2542
|
}
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2543
|
+
}
|
|
2544
|
+
});
|
|
2545
|
+
var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
|
|
2546
|
+
var header_slice_default = headerSlice.reducer;
|
|
2547
|
+
|
|
2548
|
+
// src/store/reducers/list-slice/index.ts
|
|
2549
|
+
import { createSlice as createSlice6 } from "@reduxjs/toolkit";
|
|
2550
|
+
var initialState5 = {
|
|
2551
|
+
pageLimit: 10,
|
|
2552
|
+
fields: {},
|
|
2553
|
+
order: "",
|
|
2554
|
+
selectedRowKeys: [],
|
|
2555
|
+
selectedRadioKey: 0,
|
|
2556
|
+
indexRowTableModal: -2,
|
|
2557
|
+
isUpdateTableModal: false,
|
|
2558
|
+
footerGroupTable: {},
|
|
2559
|
+
transferDetail: null,
|
|
2560
|
+
page: 0,
|
|
2561
|
+
domainTable: []
|
|
2562
|
+
};
|
|
2563
|
+
var listSlice = createSlice6({
|
|
2564
|
+
name: "list",
|
|
2565
|
+
initialState: initialState5,
|
|
2566
|
+
reducers: {
|
|
2567
|
+
setPageLimit: (state, action) => {
|
|
2568
|
+
state.pageLimit = action.payload;
|
|
2569
|
+
},
|
|
2570
|
+
setFields: (state, action) => {
|
|
2571
|
+
state.fields = action.payload;
|
|
2572
|
+
},
|
|
2573
|
+
setOrder: (state, action) => {
|
|
2574
|
+
state.order = action.payload;
|
|
2575
|
+
},
|
|
2576
|
+
setSelectedRowKeys: (state, action) => {
|
|
2577
|
+
state.selectedRowKeys = action.payload;
|
|
2578
|
+
},
|
|
2579
|
+
setSelectedRadioKey: (state, action) => {
|
|
2580
|
+
state.selectedRadioKey = action.payload;
|
|
2581
|
+
},
|
|
2582
|
+
setIndexRowTableModal: (state, action) => {
|
|
2583
|
+
state.indexRowTableModal = action.payload;
|
|
2584
|
+
},
|
|
2585
|
+
setTransferDetail: (state, action) => {
|
|
2586
|
+
state.transferDetail = action.payload;
|
|
2587
|
+
},
|
|
2588
|
+
setIsUpdateTableModal: (state, action) => {
|
|
2589
|
+
state.isUpdateTableModal = action.payload;
|
|
2590
|
+
},
|
|
2591
|
+
setPage: (state, action) => {
|
|
2592
|
+
state.page = action.payload;
|
|
2593
|
+
},
|
|
2594
|
+
setDomainTable: (state, action) => {
|
|
2595
|
+
state.domainTable = action.payload;
|
|
2661
2596
|
}
|
|
2662
|
-
case "like":
|
|
2663
|
-
if (fieldValue === false) {
|
|
2664
|
-
return false;
|
|
2665
|
-
}
|
|
2666
|
-
return Boolean(fieldValue.match(likeRegexp));
|
|
2667
|
-
case "not like":
|
|
2668
|
-
if (fieldValue === false) {
|
|
2669
|
-
return false;
|
|
2670
|
-
}
|
|
2671
|
-
return Boolean(!fieldValue.match(likeRegexp));
|
|
2672
|
-
case "=like":
|
|
2673
|
-
if (fieldValue === false) {
|
|
2674
|
-
return false;
|
|
2675
|
-
}
|
|
2676
|
-
return new RegExp(escapeRegExp(value).replace(/%/g, ".*")).test(
|
|
2677
|
-
fieldValue
|
|
2678
|
-
);
|
|
2679
|
-
case "ilike":
|
|
2680
|
-
if (fieldValue === false) {
|
|
2681
|
-
return false;
|
|
2682
|
-
}
|
|
2683
|
-
return Boolean(fieldValue.match(ilikeRegexp));
|
|
2684
|
-
case "not ilike":
|
|
2685
|
-
if (fieldValue === false) {
|
|
2686
|
-
return false;
|
|
2687
|
-
}
|
|
2688
|
-
return Boolean(!fieldValue.match(ilikeRegexp));
|
|
2689
|
-
case "=ilike":
|
|
2690
|
-
if (fieldValue === false) {
|
|
2691
|
-
return false;
|
|
2692
|
-
}
|
|
2693
|
-
return new RegExp(escapeRegExp(value).replace(/%/g, ".*"), "i").test(
|
|
2694
|
-
fieldValue
|
|
2695
|
-
);
|
|
2696
2597
|
}
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2598
|
+
});
|
|
2599
|
+
var {
|
|
2600
|
+
setPageLimit,
|
|
2601
|
+
setFields,
|
|
2602
|
+
setOrder,
|
|
2603
|
+
setSelectedRowKeys,
|
|
2604
|
+
setIndexRowTableModal,
|
|
2605
|
+
setIsUpdateTableModal,
|
|
2606
|
+
setPage,
|
|
2607
|
+
setSelectedRadioKey,
|
|
2608
|
+
setTransferDetail,
|
|
2609
|
+
setDomainTable
|
|
2610
|
+
} = listSlice.actions;
|
|
2611
|
+
var list_slice_default = listSlice.reducer;
|
|
2612
|
+
|
|
2613
|
+
// src/store/reducers/login-slice/index.ts
|
|
2614
|
+
import { createSlice as createSlice7 } from "@reduxjs/toolkit";
|
|
2615
|
+
var initialState6 = {
|
|
2616
|
+
db: "",
|
|
2617
|
+
redirectTo: "/",
|
|
2618
|
+
forgotPasswordUrl: "/"
|
|
2619
|
+
};
|
|
2620
|
+
var loginSlice = createSlice7({
|
|
2621
|
+
name: "login",
|
|
2622
|
+
initialState: initialState6,
|
|
2623
|
+
reducers: {
|
|
2624
|
+
setDb: (state, action) => {
|
|
2625
|
+
state.db = action.payload;
|
|
2626
|
+
},
|
|
2627
|
+
setRedirectTo: (state, action) => {
|
|
2628
|
+
state.redirectTo = action.payload;
|
|
2629
|
+
},
|
|
2630
|
+
setForgotPasswordUrl: (state, action) => {
|
|
2631
|
+
state.forgotPasswordUrl = action.payload;
|
|
2632
|
+
}
|
|
2710
2633
|
}
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2634
|
+
});
|
|
2635
|
+
var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
|
|
2636
|
+
var login_slice_default = loginSlice.reducer;
|
|
2637
|
+
|
|
2638
|
+
// src/store/reducers/navbar-slice/index.ts
|
|
2639
|
+
import { createSlice as createSlice8 } from "@reduxjs/toolkit";
|
|
2640
|
+
var initialState7 = {
|
|
2641
|
+
menuFocus: {},
|
|
2642
|
+
menuAction: {},
|
|
2643
|
+
navbarWidth: 250,
|
|
2644
|
+
menuList: []
|
|
2645
|
+
};
|
|
2646
|
+
var navbarSlice = createSlice8({
|
|
2647
|
+
name: "navbar",
|
|
2648
|
+
initialState: initialState7,
|
|
2649
|
+
reducers: {
|
|
2650
|
+
setMenuFocus: (state, action) => {
|
|
2651
|
+
state.menuFocus = action.payload;
|
|
2652
|
+
},
|
|
2653
|
+
setMenuFocusAction: (state, action) => {
|
|
2654
|
+
state.menuAction = action.payload;
|
|
2655
|
+
},
|
|
2656
|
+
setNavbarWidth: (state, action) => {
|
|
2657
|
+
state.navbarWidth = action.payload;
|
|
2658
|
+
},
|
|
2659
|
+
setMenuList: (state, action) => {
|
|
2660
|
+
state.menuList = action.payload;
|
|
2721
2661
|
}
|
|
2722
2662
|
}
|
|
2723
|
-
|
|
2724
|
-
}
|
|
2663
|
+
});
|
|
2664
|
+
var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
|
|
2665
|
+
var navbar_slice_default = navbarSlice.reducer;
|
|
2725
2666
|
|
|
2726
|
-
// src/
|
|
2727
|
-
import {
|
|
2728
|
-
var
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
} catch (e) {
|
|
2738
|
-
console.warn("Failed to parse originalRequest.data", e);
|
|
2739
|
-
return originalRequest.data;
|
|
2667
|
+
// src/store/reducers/profile-slice/index.ts
|
|
2668
|
+
import { createSlice as createSlice9 } from "@reduxjs/toolkit";
|
|
2669
|
+
var initialState8 = {
|
|
2670
|
+
profile: {}
|
|
2671
|
+
};
|
|
2672
|
+
var profileSlice = createSlice9({
|
|
2673
|
+
name: "profile",
|
|
2674
|
+
initialState: initialState8,
|
|
2675
|
+
reducers: {
|
|
2676
|
+
setProfile: (state, action) => {
|
|
2677
|
+
state.profile = action.payload;
|
|
2740
2678
|
}
|
|
2741
2679
|
}
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
return originalRequest.data;
|
|
2746
|
-
};
|
|
2747
|
-
|
|
2748
|
-
// src/utils/storage/local-storage.ts
|
|
2749
|
-
var localStorageUtils = () => {
|
|
2750
|
-
const setToken = async (access_token) => {
|
|
2751
|
-
localStorage.setItem("accessToken", access_token);
|
|
2752
|
-
};
|
|
2753
|
-
const setRefreshToken = async (refresh_token) => {
|
|
2754
|
-
localStorage.setItem("refreshToken", refresh_token);
|
|
2755
|
-
};
|
|
2756
|
-
const getAccessToken = async () => {
|
|
2757
|
-
return localStorage.getItem("accessToken");
|
|
2758
|
-
};
|
|
2759
|
-
const getRefreshToken = async () => {
|
|
2760
|
-
return localStorage.getItem("refreshToken");
|
|
2761
|
-
};
|
|
2762
|
-
const clearToken = async () => {
|
|
2763
|
-
localStorage.removeItem("accessToken");
|
|
2764
|
-
localStorage.removeItem("refreshToken");
|
|
2765
|
-
};
|
|
2766
|
-
return {
|
|
2767
|
-
setToken,
|
|
2768
|
-
setRefreshToken,
|
|
2769
|
-
getAccessToken,
|
|
2770
|
-
getRefreshToken,
|
|
2771
|
-
clearToken
|
|
2772
|
-
};
|
|
2773
|
-
};
|
|
2680
|
+
});
|
|
2681
|
+
var { setProfile } = profileSlice.actions;
|
|
2682
|
+
var profile_slice_default = profileSlice.reducer;
|
|
2774
2683
|
|
|
2775
|
-
// src/
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2684
|
+
// src/store/reducers/search-slice/index.ts
|
|
2685
|
+
import { createSlice as createSlice10 } from "@reduxjs/toolkit";
|
|
2686
|
+
var initialState9 = {
|
|
2687
|
+
groupByDomain: null,
|
|
2688
|
+
searchBy: [],
|
|
2689
|
+
searchString: "",
|
|
2690
|
+
hoveredIndexSearchList: null,
|
|
2691
|
+
selectedTags: [],
|
|
2692
|
+
firstDomain: null,
|
|
2693
|
+
searchMap: {},
|
|
2694
|
+
filterBy: [],
|
|
2695
|
+
groupBy: []
|
|
2783
2696
|
};
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
}
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
if (
|
|
2817
|
-
|
|
2818
|
-
}, Promise.reject);
|
|
2819
|
-
instance.interceptors.response.use(
|
|
2820
|
-
(response) => {
|
|
2821
|
-
return handleResponse(response);
|
|
2822
|
-
},
|
|
2823
|
-
async (error) => {
|
|
2824
|
-
const handleError3 = async (error2) => {
|
|
2825
|
-
if (!error2.response) {
|
|
2826
|
-
return error2;
|
|
2827
|
-
}
|
|
2828
|
-
const { data } = error2.response;
|
|
2829
|
-
if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
|
|
2830
|
-
await clearAuthToken();
|
|
2831
|
-
}
|
|
2832
|
-
return data;
|
|
2833
|
-
};
|
|
2834
|
-
const originalRequest = error.config;
|
|
2835
|
-
if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
|
|
2836
|
-
error.response.data.code
|
|
2837
|
-
)) {
|
|
2838
|
-
if (isRefreshing) {
|
|
2839
|
-
return new Promise(function(resolve, reject) {
|
|
2840
|
-
failedQueue.push({ resolve, reject });
|
|
2841
|
-
}).then((token) => {
|
|
2842
|
-
originalRequest.headers["Authorization"] = "Bearer " + token;
|
|
2843
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2844
|
-
originalRequest,
|
|
2845
|
-
token
|
|
2846
|
-
);
|
|
2847
|
-
return instance.request(originalRequest);
|
|
2848
|
-
}).catch(async (err) => {
|
|
2849
|
-
if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
|
|
2850
|
-
await clearAuthToken();
|
|
2851
|
-
}
|
|
2852
|
-
});
|
|
2853
|
-
}
|
|
2854
|
-
const browserSession = await sessionStorage2.getBrowserSession();
|
|
2855
|
-
const refreshToken = await localStorage2.getRefreshToken();
|
|
2856
|
-
const accessTokenExp = await localStorage2.getAccessToken();
|
|
2857
|
-
isRefreshing = true;
|
|
2858
|
-
if (!refreshToken && (!browserSession || browserSession == "unActive")) {
|
|
2859
|
-
await clearAuthToken();
|
|
2860
|
-
} else {
|
|
2861
|
-
const payload = Object.fromEntries(
|
|
2862
|
-
Object.entries({
|
|
2863
|
-
refresh_token: refreshToken,
|
|
2864
|
-
grant_type: "refresh_token",
|
|
2865
|
-
client_id: config.config.clientId,
|
|
2866
|
-
client_secret: config.config.clientSecret
|
|
2867
|
-
}).filter(([_, value]) => !!value)
|
|
2868
|
-
);
|
|
2869
|
-
return new Promise(function(resolve) {
|
|
2870
|
-
axios.post(
|
|
2871
|
-
`${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
|
|
2872
|
-
payload,
|
|
2873
|
-
{
|
|
2874
|
-
headers: {
|
|
2875
|
-
"Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
|
|
2876
|
-
Authorization: `Bearer ${accessTokenExp}`
|
|
2877
|
-
}
|
|
2878
|
-
}
|
|
2879
|
-
).then(async (res) => {
|
|
2880
|
-
const data = res.data;
|
|
2881
|
-
await localStorage2.setToken(data.access_token);
|
|
2882
|
-
await localStorage2.setRefreshToken(data.refresh_token);
|
|
2883
|
-
axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
|
|
2884
|
-
originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
|
|
2885
|
-
originalRequest.data = updateTokenParamInOriginalRequest(
|
|
2886
|
-
originalRequest,
|
|
2887
|
-
data.access_token
|
|
2888
|
-
);
|
|
2889
|
-
processQueue(null, data.access_token);
|
|
2890
|
-
resolve(instance.request(originalRequest));
|
|
2891
|
-
}).catch(async (err) => {
|
|
2892
|
-
if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
|
|
2893
|
-
await clearAuthToken();
|
|
2894
|
-
}
|
|
2895
|
-
if (err && err.response) {
|
|
2896
|
-
const { error_code } = err.response?.data || {};
|
|
2897
|
-
if (error_code === "AUTHEN_FAIL") {
|
|
2898
|
-
await clearAuthToken();
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
processQueue(err, null);
|
|
2902
|
-
}).finally(() => {
|
|
2903
|
-
isRefreshing = false;
|
|
2904
|
-
});
|
|
2905
|
-
});
|
|
2906
|
-
}
|
|
2907
|
-
}
|
|
2908
|
-
return Promise.reject(await handleError3(error));
|
|
2909
|
-
}
|
|
2910
|
-
);
|
|
2911
|
-
const handleResponse = (res) => {
|
|
2912
|
-
if (res && res.data) {
|
|
2913
|
-
return res.data;
|
|
2914
|
-
}
|
|
2915
|
-
return res;
|
|
2916
|
-
};
|
|
2917
|
-
const handleError2 = (error) => {
|
|
2918
|
-
if (error.isAxiosError && error.code === "ECONNABORTED") {
|
|
2919
|
-
console.error("Request Timeout Error:", error);
|
|
2920
|
-
return "Request Timeout Error";
|
|
2921
|
-
} else if (error.isAxiosError && !error.response) {
|
|
2922
|
-
console.error("Network Error:", error);
|
|
2923
|
-
return "Network Error";
|
|
2924
|
-
} else {
|
|
2925
|
-
console.error("Other Error:", error?.response);
|
|
2926
|
-
const errorMessage = error?.response?.data?.message || "An error occurred";
|
|
2927
|
-
return { message: errorMessage, status: error?.response?.status };
|
|
2697
|
+
var searchSlice = createSlice10({
|
|
2698
|
+
name: "search",
|
|
2699
|
+
initialState: initialState9,
|
|
2700
|
+
reducers: {
|
|
2701
|
+
setGroupByDomain: (state, action) => {
|
|
2702
|
+
state.groupByDomain = action.payload;
|
|
2703
|
+
},
|
|
2704
|
+
setSearchBy: (state, action) => {
|
|
2705
|
+
state.searchBy = action.payload;
|
|
2706
|
+
},
|
|
2707
|
+
setSearchString: (state, action) => {
|
|
2708
|
+
state.searchString = action.payload;
|
|
2709
|
+
},
|
|
2710
|
+
setHoveredIndexSearchList: (state, action) => {
|
|
2711
|
+
state.hoveredIndexSearchList = action.payload;
|
|
2712
|
+
},
|
|
2713
|
+
setSelectedTags: (state, action) => {
|
|
2714
|
+
state.selectedTags = action.payload;
|
|
2715
|
+
},
|
|
2716
|
+
setFirstDomain: (state, action) => {
|
|
2717
|
+
state.firstDomain = action.payload;
|
|
2718
|
+
},
|
|
2719
|
+
setFilterBy: (state, action) => {
|
|
2720
|
+
state.filterBy = action.payload;
|
|
2721
|
+
},
|
|
2722
|
+
setGroupBy: (state, action) => {
|
|
2723
|
+
state.groupBy = action.payload;
|
|
2724
|
+
},
|
|
2725
|
+
setSearchMap: (state, action) => {
|
|
2726
|
+
state.searchMap = action.payload;
|
|
2727
|
+
},
|
|
2728
|
+
updateSearchMap: (state, action) => {
|
|
2729
|
+
if (!state.searchMap[action.payload.key]) {
|
|
2730
|
+
state.searchMap[action.payload.key] = [];
|
|
2928
2731
|
}
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2732
|
+
state.searchMap[action.payload.key].push(action.payload.value);
|
|
2733
|
+
},
|
|
2734
|
+
removeKeyFromSearchMap: (state, action) => {
|
|
2735
|
+
const { key, item } = action.payload;
|
|
2736
|
+
const values = state.searchMap[key];
|
|
2737
|
+
if (!values) return;
|
|
2738
|
+
if (item) {
|
|
2739
|
+
const filtered = values.filter((value) => value.name !== item.name);
|
|
2740
|
+
if (filtered.length > 0) {
|
|
2741
|
+
state.searchMap[key] = filtered;
|
|
2742
|
+
} else {
|
|
2743
|
+
delete state.searchMap[key];
|
|
2744
|
+
}
|
|
2745
|
+
} else {
|
|
2746
|
+
delete state.searchMap[key];
|
|
2934
2747
|
}
|
|
2935
|
-
}
|
|
2936
|
-
|
|
2937
|
-
|
|
2748
|
+
},
|
|
2749
|
+
clearSearchMap: (state) => {
|
|
2750
|
+
state.searchMap = {};
|
|
2938
2751
|
}
|
|
2939
|
-
const responseBody = (response) => response;
|
|
2940
|
-
const requests = {
|
|
2941
|
-
get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
|
|
2942
|
-
post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
|
|
2943
|
-
post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
|
|
2944
|
-
responseType: "arraybuffer",
|
|
2945
|
-
headers: {
|
|
2946
|
-
"Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
|
|
2947
|
-
Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
2948
|
-
}
|
|
2949
|
-
}).then(responseBody),
|
|
2950
|
-
put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
|
|
2951
|
-
patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
|
|
2952
|
-
delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
|
|
2953
|
-
};
|
|
2954
|
-
return requests;
|
|
2955
2752
|
}
|
|
2753
|
+
});
|
|
2754
|
+
var {
|
|
2755
|
+
setGroupByDomain,
|
|
2756
|
+
setSelectedTags,
|
|
2757
|
+
setSearchString,
|
|
2758
|
+
setHoveredIndexSearchList,
|
|
2759
|
+
setFirstDomain,
|
|
2760
|
+
setSearchBy,
|
|
2761
|
+
setFilterBy,
|
|
2762
|
+
setSearchMap,
|
|
2763
|
+
updateSearchMap,
|
|
2764
|
+
removeKeyFromSearchMap,
|
|
2765
|
+
setGroupBy,
|
|
2766
|
+
clearSearchMap
|
|
2767
|
+
} = searchSlice.actions;
|
|
2768
|
+
var search_slice_default = searchSlice.reducer;
|
|
2769
|
+
|
|
2770
|
+
// src/store/store.ts
|
|
2771
|
+
import { configureStore } from "@reduxjs/toolkit";
|
|
2772
|
+
|
|
2773
|
+
// node_modules/redux/dist/redux.mjs
|
|
2774
|
+
function formatProdErrorMessage(code) {
|
|
2775
|
+
return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2776
|
+
}
|
|
2777
|
+
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
2778
|
+
var ActionTypes = {
|
|
2779
|
+
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
2780
|
+
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
2781
|
+
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
2956
2782
|
};
|
|
2783
|
+
var actionTypes_default = ActionTypes;
|
|
2784
|
+
function isPlainObject(obj) {
|
|
2785
|
+
if (typeof obj !== "object" || obj === null)
|
|
2786
|
+
return false;
|
|
2787
|
+
let proto = obj;
|
|
2788
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
2789
|
+
proto = Object.getPrototypeOf(proto);
|
|
2790
|
+
}
|
|
2791
|
+
return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
|
|
2792
|
+
}
|
|
2793
|
+
function miniKindOf(val) {
|
|
2794
|
+
if (val === void 0)
|
|
2795
|
+
return "undefined";
|
|
2796
|
+
if (val === null)
|
|
2797
|
+
return "null";
|
|
2798
|
+
const type = typeof val;
|
|
2799
|
+
switch (type) {
|
|
2800
|
+
case "boolean":
|
|
2801
|
+
case "string":
|
|
2802
|
+
case "number":
|
|
2803
|
+
case "symbol":
|
|
2804
|
+
case "function": {
|
|
2805
|
+
return type;
|
|
2806
|
+
}
|
|
2807
|
+
}
|
|
2808
|
+
if (Array.isArray(val))
|
|
2809
|
+
return "array";
|
|
2810
|
+
if (isDate(val))
|
|
2811
|
+
return "date";
|
|
2812
|
+
if (isError(val))
|
|
2813
|
+
return "error";
|
|
2814
|
+
const constructorName = ctorName(val);
|
|
2815
|
+
switch (constructorName) {
|
|
2816
|
+
case "Symbol":
|
|
2817
|
+
case "Promise":
|
|
2818
|
+
case "WeakMap":
|
|
2819
|
+
case "WeakSet":
|
|
2820
|
+
case "Map":
|
|
2821
|
+
case "Set":
|
|
2822
|
+
return constructorName;
|
|
2823
|
+
}
|
|
2824
|
+
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
2825
|
+
}
|
|
2826
|
+
function ctorName(val) {
|
|
2827
|
+
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
2828
|
+
}
|
|
2829
|
+
function isError(val) {
|
|
2830
|
+
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
2831
|
+
}
|
|
2832
|
+
function isDate(val) {
|
|
2833
|
+
if (val instanceof Date)
|
|
2834
|
+
return true;
|
|
2835
|
+
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
2836
|
+
}
|
|
2837
|
+
function kindOf(val) {
|
|
2838
|
+
let typeOfVal = typeof val;
|
|
2839
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2840
|
+
typeOfVal = miniKindOf(val);
|
|
2841
|
+
}
|
|
2842
|
+
return typeOfVal;
|
|
2843
|
+
}
|
|
2844
|
+
function warning(message) {
|
|
2845
|
+
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
2846
|
+
console.error(message);
|
|
2847
|
+
}
|
|
2848
|
+
try {
|
|
2849
|
+
throw new Error(message);
|
|
2850
|
+
} catch (e) {
|
|
2851
|
+
}
|
|
2852
|
+
}
|
|
2853
|
+
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
2854
|
+
const reducerKeys = Object.keys(reducers);
|
|
2855
|
+
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
2856
|
+
if (reducerKeys.length === 0) {
|
|
2857
|
+
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
2858
|
+
}
|
|
2859
|
+
if (!isPlainObject(inputState)) {
|
|
2860
|
+
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
2861
|
+
}
|
|
2862
|
+
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
2863
|
+
unexpectedKeys.forEach((key) => {
|
|
2864
|
+
unexpectedKeyCache[key] = true;
|
|
2865
|
+
});
|
|
2866
|
+
if (action && action.type === actionTypes_default.REPLACE)
|
|
2867
|
+
return;
|
|
2868
|
+
if (unexpectedKeys.length > 0) {
|
|
2869
|
+
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
function assertReducerShape(reducers) {
|
|
2873
|
+
Object.keys(reducers).forEach((key) => {
|
|
2874
|
+
const reducer = reducers[key];
|
|
2875
|
+
const initialState10 = reducer(void 0, {
|
|
2876
|
+
type: actionTypes_default.INIT
|
|
2877
|
+
});
|
|
2878
|
+
if (typeof initialState10 === "undefined") {
|
|
2879
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
2880
|
+
}
|
|
2881
|
+
if (typeof reducer(void 0, {
|
|
2882
|
+
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
2883
|
+
}) === "undefined") {
|
|
2884
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
2885
|
+
}
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2888
|
+
function combineReducers(reducers) {
|
|
2889
|
+
const reducerKeys = Object.keys(reducers);
|
|
2890
|
+
const finalReducers = {};
|
|
2891
|
+
for (let i = 0; i < reducerKeys.length; i++) {
|
|
2892
|
+
const key = reducerKeys[i];
|
|
2893
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2894
|
+
if (typeof reducers[key] === "undefined") {
|
|
2895
|
+
warning(`No reducer provided for key "${key}"`);
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
if (typeof reducers[key] === "function") {
|
|
2899
|
+
finalReducers[key] = reducers[key];
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
const finalReducerKeys = Object.keys(finalReducers);
|
|
2903
|
+
let unexpectedKeyCache;
|
|
2904
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2905
|
+
unexpectedKeyCache = {};
|
|
2906
|
+
}
|
|
2907
|
+
let shapeAssertionError;
|
|
2908
|
+
try {
|
|
2909
|
+
assertReducerShape(finalReducers);
|
|
2910
|
+
} catch (e) {
|
|
2911
|
+
shapeAssertionError = e;
|
|
2912
|
+
}
|
|
2913
|
+
return function combination(state = {}, action) {
|
|
2914
|
+
if (shapeAssertionError) {
|
|
2915
|
+
throw shapeAssertionError;
|
|
2916
|
+
}
|
|
2917
|
+
if (process.env.NODE_ENV !== "production") {
|
|
2918
|
+
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
2919
|
+
if (warningMessage) {
|
|
2920
|
+
warning(warningMessage);
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
let hasChanged = false;
|
|
2924
|
+
const nextState = {};
|
|
2925
|
+
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
2926
|
+
const key = finalReducerKeys[i];
|
|
2927
|
+
const reducer = finalReducers[key];
|
|
2928
|
+
const previousStateForKey = state[key];
|
|
2929
|
+
const nextStateForKey = reducer(previousStateForKey, action);
|
|
2930
|
+
if (typeof nextStateForKey === "undefined") {
|
|
2931
|
+
const actionType = action && action.type;
|
|
2932
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
2933
|
+
}
|
|
2934
|
+
nextState[key] = nextStateForKey;
|
|
2935
|
+
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
2936
|
+
}
|
|
2937
|
+
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
2938
|
+
return hasChanged ? nextState : state;
|
|
2939
|
+
};
|
|
2940
|
+
}
|
|
2957
2941
|
|
|
2958
|
-
// src/store/
|
|
2959
|
-
|
|
2942
|
+
// src/store/store.ts
|
|
2943
|
+
var rootReducer = combineReducers({
|
|
2944
|
+
env: env_slice_default,
|
|
2945
|
+
header: header_slice_default,
|
|
2946
|
+
navbar: navbar_slice_default,
|
|
2947
|
+
list: list_slice_default,
|
|
2948
|
+
search: search_slice_default,
|
|
2949
|
+
form: form_slice_default,
|
|
2950
|
+
breadcrumbs: breadcrums_slice_default,
|
|
2951
|
+
login: login_slice_default,
|
|
2952
|
+
excel: excel_slice_default,
|
|
2953
|
+
profile: profile_slice_default
|
|
2954
|
+
});
|
|
2955
|
+
var envStore = configureStore({
|
|
2956
|
+
reducer: rootReducer,
|
|
2957
|
+
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
2958
|
+
serializableCheck: false
|
|
2959
|
+
})
|
|
2960
|
+
});
|
|
2960
2961
|
|
|
2961
2962
|
// src/environment/EnvStore.ts
|
|
2962
|
-
var EnvStore = class {
|
|
2963
|
+
var EnvStore = class _EnvStore {
|
|
2964
|
+
static instance = null;
|
|
2965
|
+
envStore;
|
|
2963
2966
|
baseUrl;
|
|
2964
2967
|
requests;
|
|
2965
2968
|
context;
|
|
@@ -2971,87 +2974,92 @@ var EnvStore = class {
|
|
|
2971
2974
|
localStorageUtils;
|
|
2972
2975
|
sessionStorageUtils;
|
|
2973
2976
|
refreshTokenEndpoint;
|
|
2974
|
-
constructor(localStorageUtils2, sessionStorageUtils2) {
|
|
2977
|
+
constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2978
|
+
this.envStore = envStore2;
|
|
2975
2979
|
this.localStorageUtils = localStorageUtils2;
|
|
2976
2980
|
this.sessionStorageUtils = sessionStorageUtils2;
|
|
2977
2981
|
this.setup();
|
|
2978
2982
|
}
|
|
2983
|
+
static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
|
|
2984
|
+
if (!_EnvStore.instance) {
|
|
2985
|
+
_EnvStore.instance = new _EnvStore(
|
|
2986
|
+
envStore2,
|
|
2987
|
+
localStorageUtils2,
|
|
2988
|
+
sessionStorageUtils2
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
return _EnvStore.instance;
|
|
2992
|
+
}
|
|
2979
2993
|
setup() {
|
|
2980
|
-
const
|
|
2981
|
-
this.baseUrl =
|
|
2982
|
-
this.
|
|
2983
|
-
this.
|
|
2984
|
-
this.
|
|
2985
|
-
this.
|
|
2986
|
-
this.
|
|
2987
|
-
this.
|
|
2988
|
-
this.
|
|
2989
|
-
this.refreshTokenEndpoint =
|
|
2994
|
+
const env = this.envStore.getState().env;
|
|
2995
|
+
this.baseUrl = env?.baseUrl;
|
|
2996
|
+
this.requests = env?.requests;
|
|
2997
|
+
this.context = env?.context;
|
|
2998
|
+
this.defaultCompany = env?.defaultCompany;
|
|
2999
|
+
this.config = env?.config;
|
|
3000
|
+
this.companies = env?.companies || [];
|
|
3001
|
+
this.user = env?.user;
|
|
3002
|
+
this.db = env?.db;
|
|
3003
|
+
this.refreshTokenEndpoint = env?.refreshTokenEndpoint;
|
|
3004
|
+
console.log("Env setup:", this);
|
|
2990
3005
|
}
|
|
2991
3006
|
setupEnv(envConfig) {
|
|
2992
|
-
|
|
3007
|
+
const dispatch = this.envStore.dispatch;
|
|
3008
|
+
const env = {
|
|
2993
3009
|
...envConfig,
|
|
2994
3010
|
localStorageUtils: this.localStorageUtils,
|
|
2995
3011
|
sessionStorageUtils: this.sessionStorageUtils
|
|
2996
3012
|
};
|
|
2997
|
-
const requests = axiosClient.init(
|
|
2998
|
-
|
|
2999
|
-
const dispatch = envStore.dispatch;
|
|
3000
|
-
dispatch(
|
|
3001
|
-
setEnv({
|
|
3002
|
-
...env2,
|
|
3003
|
-
requests
|
|
3004
|
-
})
|
|
3005
|
-
);
|
|
3013
|
+
const requests = axiosClient.init(env);
|
|
3014
|
+
dispatch(setEnv({ ...env, requests }));
|
|
3006
3015
|
this.setup();
|
|
3007
|
-
return { ...env2, requests };
|
|
3008
3016
|
}
|
|
3009
3017
|
setUid(uid) {
|
|
3010
|
-
const dispatch = envStore.dispatch;
|
|
3018
|
+
const dispatch = this.envStore.dispatch;
|
|
3011
3019
|
dispatch(setUid(uid));
|
|
3012
3020
|
this.setup();
|
|
3013
3021
|
}
|
|
3014
3022
|
setLang(lang) {
|
|
3015
|
-
const dispatch = envStore.dispatch;
|
|
3023
|
+
const dispatch = this.envStore.dispatch;
|
|
3016
3024
|
dispatch(setLang(lang));
|
|
3017
3025
|
this.setup();
|
|
3018
3026
|
}
|
|
3019
3027
|
setAllowCompanies(allowCompanies) {
|
|
3020
|
-
const dispatch = envStore.dispatch;
|
|
3028
|
+
const dispatch = this.envStore.dispatch;
|
|
3021
3029
|
dispatch(setAllowCompanies(allowCompanies));
|
|
3022
3030
|
this.setup();
|
|
3023
3031
|
}
|
|
3024
3032
|
setCompanies(companies) {
|
|
3025
|
-
const dispatch = envStore.dispatch;
|
|
3033
|
+
const dispatch = this.envStore.dispatch;
|
|
3026
3034
|
dispatch(setCompanies(companies));
|
|
3027
3035
|
this.setup();
|
|
3028
3036
|
}
|
|
3029
3037
|
setDefaultCompany(company) {
|
|
3030
|
-
const dispatch = envStore.dispatch;
|
|
3038
|
+
const dispatch = this.envStore.dispatch;
|
|
3031
3039
|
dispatch(setDefaultCompany(company));
|
|
3032
3040
|
this.setup();
|
|
3033
3041
|
}
|
|
3034
3042
|
setUserInfo(userInfo) {
|
|
3035
|
-
const dispatch = envStore.dispatch;
|
|
3043
|
+
const dispatch = this.envStore.dispatch;
|
|
3036
3044
|
dispatch(setUser(userInfo));
|
|
3037
3045
|
this.setup();
|
|
3038
3046
|
}
|
|
3039
3047
|
};
|
|
3040
|
-
var env = null;
|
|
3041
3048
|
function initEnv({
|
|
3042
3049
|
localStorageUtils: localStorageUtils2,
|
|
3043
3050
|
sessionStorageUtils: sessionStorageUtils2
|
|
3044
3051
|
}) {
|
|
3045
|
-
|
|
3046
|
-
return env;
|
|
3052
|
+
return EnvStore.getInstance(envStore, localStorageUtils2, sessionStorageUtils2);
|
|
3047
3053
|
}
|
|
3048
3054
|
function getEnv() {
|
|
3049
|
-
|
|
3050
|
-
|
|
3055
|
+
const instance = EnvStore.getInstance(envStore);
|
|
3056
|
+
if (!instance) {
|
|
3057
|
+
throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
|
|
3058
|
+
}
|
|
3059
|
+
return instance;
|
|
3051
3060
|
}
|
|
3052
3061
|
export {
|
|
3053
3062
|
EnvStore,
|
|
3054
|
-
env,
|
|
3055
3063
|
getEnv,
|
|
3056
3064
|
initEnv
|
|
3057
3065
|
};
|