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