@fctc/interface-logic 1.7.4 → 1.7.5

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/hooks.mjs CHANGED
@@ -31,634 +31,6 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
31
31
  return UriConstants2;
32
32
  })(UriConstants || {});
33
33
 
34
- // src/store/index.ts
35
- import { useDispatch, useSelector } from "react-redux";
36
-
37
- // src/store/reducers/breadcrums-slice/index.ts
38
- import { createSlice } from "@reduxjs/toolkit";
39
- var initialState = {
40
- breadCrumbs: []
41
- };
42
- var breadcrumbsSlice = createSlice({
43
- name: "breadcrumbs",
44
- initialState,
45
- reducers: {
46
- setBreadCrumbs: (state, action) => {
47
- state.breadCrumbs = [...state.breadCrumbs, action.payload];
48
- }
49
- }
50
- });
51
- var { setBreadCrumbs } = breadcrumbsSlice.actions;
52
- var breadcrums_slice_default = breadcrumbsSlice.reducer;
53
-
54
- // src/store/reducers/env-slice/index.ts
55
- import { createSlice as createSlice2 } from "@reduxjs/toolkit";
56
- var initialState2 = {
57
- baseUrl: "",
58
- companies: [],
59
- user: {},
60
- db: "",
61
- refreshTokenEndpoint: "",
62
- config: {
63
- grantType: "",
64
- clientId: "",
65
- clientSecret: "",
66
- redirectUri: ""
67
- },
68
- envFile: null,
69
- requests: {
70
- get: async (url, headers) => ({}),
71
- post: async (url, body, headers) => ({}),
72
- post_excel: async (url, body, headers) => ({}),
73
- put: async (url, body, headers) => ({}),
74
- patch: async (url, body) => ({}),
75
- delete: async (url, body) => ({})
76
- },
77
- defaultCompany: {
78
- id: null,
79
- logo: "",
80
- secondary_color: "",
81
- primary_color: ""
82
- },
83
- context: {
84
- uid: null,
85
- allowed_company_ids: [],
86
- lang: "vi_VN",
87
- tz: "Asia/Saigon"
88
- }
89
- };
90
- var envSlice = createSlice2({
91
- name: "env",
92
- initialState: initialState2,
93
- reducers: {
94
- setEnv: (state, action) => {
95
- Object.assign(state, action.payload);
96
- },
97
- setUid: (state, action) => {
98
- state.context.uid = action.payload;
99
- },
100
- setAllowCompanies: (state, action) => {
101
- state.context.allowed_company_ids = action.payload;
102
- },
103
- setCompanies: (state, action) => {
104
- state.companies = action.payload;
105
- },
106
- setDefaultCompany: (state, action) => {
107
- state.defaultCompany = action.payload;
108
- },
109
- setLang: (state, action) => {
110
- state.context.lang = action.payload;
111
- },
112
- setUser: (state, action) => {
113
- state.user = action.payload;
114
- },
115
- setConfig: (state, action) => {
116
- state.config = action.payload;
117
- },
118
- setEnvFile: (state, action) => {
119
- state.envFile = action.payload;
120
- }
121
- }
122
- });
123
- var {
124
- setEnv,
125
- setUid,
126
- setLang,
127
- setAllowCompanies,
128
- setCompanies,
129
- setDefaultCompany,
130
- setUser,
131
- setConfig,
132
- setEnvFile
133
- } = envSlice.actions;
134
- var env_slice_default = envSlice.reducer;
135
-
136
- // src/store/reducers/excel-slice/index.ts
137
- import { createSlice as createSlice3 } from "@reduxjs/toolkit";
138
- var initialState3 = {
139
- dataParse: null,
140
- idFile: null,
141
- isFileLoaded: false,
142
- loadingImport: false,
143
- selectedFile: null,
144
- errorData: null
145
- };
146
- var excelSlice = createSlice3({
147
- name: "excel",
148
- initialState: initialState3,
149
- reducers: {
150
- setDataParse: (state, action) => {
151
- state.dataParse = action.payload;
152
- },
153
- setIdFile: (state, action) => {
154
- state.idFile = action.payload;
155
- },
156
- setIsFileLoaded: (state, action) => {
157
- state.isFileLoaded = action.payload;
158
- },
159
- setLoadingImport: (state, action) => {
160
- state.loadingImport = action.payload;
161
- },
162
- setSelectedFile: (state, action) => {
163
- state.selectedFile = action.payload;
164
- },
165
- setErrorData: (state, action) => {
166
- state.errorData = action.payload;
167
- }
168
- }
169
- });
170
- var {
171
- setDataParse,
172
- setIdFile,
173
- setIsFileLoaded,
174
- setLoadingImport,
175
- setSelectedFile,
176
- setErrorData
177
- } = excelSlice.actions;
178
- var excel_slice_default = excelSlice.reducer;
179
-
180
- // src/store/reducers/form-slice/index.ts
181
- import { createSlice as createSlice4 } from "@reduxjs/toolkit";
182
- var initialState4 = {
183
- viewDataStore: {},
184
- isShowingModalDetail: false,
185
- isShowModalTranslate: false,
186
- formSubmitComponent: {},
187
- fieldTranslation: null,
188
- listSubject: {},
189
- dataUser: {}
190
- };
191
- var formSlice = createSlice4({
192
- name: "form",
193
- initialState: initialState4,
194
- reducers: {
195
- setViewDataStore: (state, action) => {
196
- state.viewDataStore = action.payload;
197
- },
198
- setIsShowingModalDetail: (state, action) => {
199
- state.isShowingModalDetail = action.payload;
200
- },
201
- setIsShowModalTranslate: (state, action) => {
202
- state.isShowModalTranslate = action.payload;
203
- },
204
- setFormSubmitComponent: (state, action) => {
205
- state.formSubmitComponent[action.payload.key] = action.payload.component;
206
- },
207
- setFieldTranslate: (state, action) => {
208
- state.fieldTranslation = action.payload;
209
- },
210
- setListSubject: (state, action) => {
211
- state.listSubject = action.payload;
212
- },
213
- setDataUser: (state, action) => {
214
- state.dataUser = action.payload;
215
- }
216
- }
217
- });
218
- var {
219
- setViewDataStore,
220
- setIsShowingModalDetail,
221
- setIsShowModalTranslate,
222
- setFormSubmitComponent,
223
- setFieldTranslate,
224
- setListSubject,
225
- setDataUser
226
- } = formSlice.actions;
227
- var form_slice_default = formSlice.reducer;
228
-
229
- // src/store/reducers/header-slice/index.ts
230
- import { createSlice as createSlice5 } from "@reduxjs/toolkit";
231
- var headerSlice = createSlice5({
232
- name: "header",
233
- initialState: {
234
- value: { allowedCompanyIds: [] }
235
- },
236
- reducers: {
237
- setHeader: (state, action) => {
238
- state.value = { ...state.value, ...action.payload };
239
- },
240
- setAllowedCompanyIds: (state, action) => {
241
- state.value.allowedCompanyIds = action.payload;
242
- }
243
- }
244
- });
245
- var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
246
- var header_slice_default = headerSlice.reducer;
247
-
248
- // src/store/reducers/list-slice/index.ts
249
- import { createSlice as createSlice6 } from "@reduxjs/toolkit";
250
- var initialState5 = {
251
- pageLimit: 10,
252
- fields: {},
253
- order: "",
254
- selectedRowKeys: [],
255
- selectedRadioKey: 0,
256
- indexRowTableModal: -2,
257
- isUpdateTableModal: false,
258
- footerGroupTable: {},
259
- transferDetail: null,
260
- page: 0,
261
- domainTable: []
262
- };
263
- var listSlice = createSlice6({
264
- name: "list",
265
- initialState: initialState5,
266
- reducers: {
267
- setPageLimit: (state, action) => {
268
- state.pageLimit = action.payload;
269
- },
270
- setFields: (state, action) => {
271
- state.fields = action.payload;
272
- },
273
- setOrder: (state, action) => {
274
- state.order = action.payload;
275
- },
276
- setSelectedRowKeys: (state, action) => {
277
- state.selectedRowKeys = action.payload;
278
- },
279
- setSelectedRadioKey: (state, action) => {
280
- state.selectedRadioKey = action.payload;
281
- },
282
- setIndexRowTableModal: (state, action) => {
283
- state.indexRowTableModal = action.payload;
284
- },
285
- setTransferDetail: (state, action) => {
286
- state.transferDetail = action.payload;
287
- },
288
- setIsUpdateTableModal: (state, action) => {
289
- state.isUpdateTableModal = action.payload;
290
- },
291
- setPage: (state, action) => {
292
- state.page = action.payload;
293
- },
294
- setDomainTable: (state, action) => {
295
- state.domainTable = action.payload;
296
- }
297
- }
298
- });
299
- var {
300
- setPageLimit,
301
- setFields,
302
- setOrder,
303
- setSelectedRowKeys,
304
- setIndexRowTableModal,
305
- setIsUpdateTableModal,
306
- setPage,
307
- setSelectedRadioKey,
308
- setTransferDetail,
309
- setDomainTable
310
- } = listSlice.actions;
311
- var list_slice_default = listSlice.reducer;
312
-
313
- // src/store/reducers/login-slice/index.ts
314
- import { createSlice as createSlice7 } from "@reduxjs/toolkit";
315
- var initialState6 = {
316
- db: "",
317
- redirectTo: "/",
318
- forgotPasswordUrl: "/"
319
- };
320
- var loginSlice = createSlice7({
321
- name: "login",
322
- initialState: initialState6,
323
- reducers: {
324
- setDb: (state, action) => {
325
- state.db = action.payload;
326
- },
327
- setRedirectTo: (state, action) => {
328
- state.redirectTo = action.payload;
329
- },
330
- setForgotPasswordUrl: (state, action) => {
331
- state.forgotPasswordUrl = action.payload;
332
- }
333
- }
334
- });
335
- var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
336
- var login_slice_default = loginSlice.reducer;
337
-
338
- // src/store/reducers/navbar-slice/index.ts
339
- import { createSlice as createSlice8 } from "@reduxjs/toolkit";
340
- var initialState7 = {
341
- menuFocus: {},
342
- menuAction: {},
343
- navbarWidth: 250,
344
- menuList: []
345
- };
346
- var navbarSlice = createSlice8({
347
- name: "navbar",
348
- initialState: initialState7,
349
- reducers: {
350
- setMenuFocus: (state, action) => {
351
- state.menuFocus = action.payload;
352
- },
353
- setMenuFocusAction: (state, action) => {
354
- state.menuAction = action.payload;
355
- },
356
- setNavbarWidth: (state, action) => {
357
- state.navbarWidth = action.payload;
358
- },
359
- setMenuList: (state, action) => {
360
- state.menuList = action.payload;
361
- }
362
- }
363
- });
364
- var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
365
- var navbar_slice_default = navbarSlice.reducer;
366
-
367
- // src/store/reducers/profile-slice/index.ts
368
- import { createSlice as createSlice9 } from "@reduxjs/toolkit";
369
- var initialState8 = {
370
- profile: {}
371
- };
372
- var profileSlice = createSlice9({
373
- name: "profile",
374
- initialState: initialState8,
375
- reducers: {
376
- setProfile: (state, action) => {
377
- state.profile = action.payload;
378
- }
379
- }
380
- });
381
- var { setProfile } = profileSlice.actions;
382
- var profile_slice_default = profileSlice.reducer;
383
-
384
- // src/store/reducers/search-slice/index.ts
385
- import { createSlice as createSlice10 } from "@reduxjs/toolkit";
386
- var initialState9 = {
387
- groupByDomain: null,
388
- searchBy: [],
389
- searchString: "",
390
- hoveredIndexSearchList: null,
391
- selectedTags: [],
392
- firstDomain: null,
393
- searchMap: {},
394
- filterBy: [],
395
- groupBy: []
396
- };
397
- var searchSlice = createSlice10({
398
- name: "search",
399
- initialState: initialState9,
400
- reducers: {
401
- setGroupByDomain: (state, action) => {
402
- state.groupByDomain = action.payload;
403
- },
404
- setSearchBy: (state, action) => {
405
- state.searchBy = action.payload;
406
- },
407
- setSearchString: (state, action) => {
408
- state.searchString = action.payload;
409
- },
410
- setHoveredIndexSearchList: (state, action) => {
411
- state.hoveredIndexSearchList = action.payload;
412
- },
413
- setSelectedTags: (state, action) => {
414
- state.selectedTags = action.payload;
415
- },
416
- setFirstDomain: (state, action) => {
417
- state.firstDomain = action.payload;
418
- },
419
- setFilterBy: (state, action) => {
420
- state.filterBy = action.payload;
421
- },
422
- setGroupBy: (state, action) => {
423
- state.groupBy = action.payload;
424
- },
425
- setSearchMap: (state, action) => {
426
- state.searchMap = action.payload;
427
- },
428
- updateSearchMap: (state, action) => {
429
- if (!state.searchMap[action.payload.key]) {
430
- state.searchMap[action.payload.key] = [];
431
- }
432
- state.searchMap[action.payload.key].push(action.payload.value);
433
- },
434
- removeKeyFromSearchMap: (state, action) => {
435
- const { key, item } = action.payload;
436
- const values = state.searchMap[key];
437
- if (!values) return;
438
- if (item) {
439
- const filtered = values.filter((value) => value.name !== item.name);
440
- if (filtered.length > 0) {
441
- state.searchMap[key] = filtered;
442
- } else {
443
- delete state.searchMap[key];
444
- }
445
- } else {
446
- delete state.searchMap[key];
447
- }
448
- },
449
- clearSearchMap: (state) => {
450
- state.searchMap = {};
451
- }
452
- }
453
- });
454
- var {
455
- setGroupByDomain,
456
- setSelectedTags,
457
- setSearchString,
458
- setHoveredIndexSearchList,
459
- setFirstDomain,
460
- setSearchBy,
461
- setFilterBy,
462
- setSearchMap,
463
- updateSearchMap,
464
- removeKeyFromSearchMap,
465
- setGroupBy,
466
- clearSearchMap
467
- } = searchSlice.actions;
468
- var search_slice_default = searchSlice.reducer;
469
-
470
- // src/store/store.ts
471
- import { configureStore } from "@reduxjs/toolkit";
472
-
473
- // node_modules/redux/dist/redux.mjs
474
- function formatProdErrorMessage(code) {
475
- 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. `;
476
- }
477
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
478
- var ActionTypes = {
479
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
480
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
481
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
482
- };
483
- var actionTypes_default = ActionTypes;
484
- function isPlainObject(obj) {
485
- if (typeof obj !== "object" || obj === null)
486
- return false;
487
- let proto = obj;
488
- while (Object.getPrototypeOf(proto) !== null) {
489
- proto = Object.getPrototypeOf(proto);
490
- }
491
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
492
- }
493
- function miniKindOf(val) {
494
- if (val === void 0)
495
- return "undefined";
496
- if (val === null)
497
- return "null";
498
- const type = typeof val;
499
- switch (type) {
500
- case "boolean":
501
- case "string":
502
- case "number":
503
- case "symbol":
504
- case "function": {
505
- return type;
506
- }
507
- }
508
- if (Array.isArray(val))
509
- return "array";
510
- if (isDate(val))
511
- return "date";
512
- if (isError(val))
513
- return "error";
514
- const constructorName = ctorName(val);
515
- switch (constructorName) {
516
- case "Symbol":
517
- case "Promise":
518
- case "WeakMap":
519
- case "WeakSet":
520
- case "Map":
521
- case "Set":
522
- return constructorName;
523
- }
524
- return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
525
- }
526
- function ctorName(val) {
527
- return typeof val.constructor === "function" ? val.constructor.name : null;
528
- }
529
- function isError(val) {
530
- return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
531
- }
532
- function isDate(val) {
533
- if (val instanceof Date)
534
- return true;
535
- return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
536
- }
537
- function kindOf(val) {
538
- let typeOfVal = typeof val;
539
- if (process.env.NODE_ENV !== "production") {
540
- typeOfVal = miniKindOf(val);
541
- }
542
- return typeOfVal;
543
- }
544
- function warning(message) {
545
- if (typeof console !== "undefined" && typeof console.error === "function") {
546
- console.error(message);
547
- }
548
- try {
549
- throw new Error(message);
550
- } catch (e) {
551
- }
552
- }
553
- function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
554
- const reducerKeys = Object.keys(reducers);
555
- const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
556
- if (reducerKeys.length === 0) {
557
- return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
558
- }
559
- if (!isPlainObject(inputState)) {
560
- return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
561
- }
562
- const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
563
- unexpectedKeys.forEach((key) => {
564
- unexpectedKeyCache[key] = true;
565
- });
566
- if (action && action.type === actionTypes_default.REPLACE)
567
- return;
568
- if (unexpectedKeys.length > 0) {
569
- 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.`;
570
- }
571
- }
572
- function assertReducerShape(reducers) {
573
- Object.keys(reducers).forEach((key) => {
574
- const reducer = reducers[key];
575
- const initialState10 = reducer(void 0, {
576
- type: actionTypes_default.INIT
577
- });
578
- if (typeof initialState10 === "undefined") {
579
- 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.`);
580
- }
581
- if (typeof reducer(void 0, {
582
- type: actionTypes_default.PROBE_UNKNOWN_ACTION()
583
- }) === "undefined") {
584
- 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.`);
585
- }
586
- });
587
- }
588
- function combineReducers(reducers) {
589
- const reducerKeys = Object.keys(reducers);
590
- const finalReducers = {};
591
- for (let i = 0; i < reducerKeys.length; i++) {
592
- const key = reducerKeys[i];
593
- if (process.env.NODE_ENV !== "production") {
594
- if (typeof reducers[key] === "undefined") {
595
- warning(`No reducer provided for key "${key}"`);
596
- }
597
- }
598
- if (typeof reducers[key] === "function") {
599
- finalReducers[key] = reducers[key];
600
- }
601
- }
602
- const finalReducerKeys = Object.keys(finalReducers);
603
- let unexpectedKeyCache;
604
- if (process.env.NODE_ENV !== "production") {
605
- unexpectedKeyCache = {};
606
- }
607
- let shapeAssertionError;
608
- try {
609
- assertReducerShape(finalReducers);
610
- } catch (e) {
611
- shapeAssertionError = e;
612
- }
613
- return function combination(state = {}, action) {
614
- if (shapeAssertionError) {
615
- throw shapeAssertionError;
616
- }
617
- if (process.env.NODE_ENV !== "production") {
618
- const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
619
- if (warningMessage) {
620
- warning(warningMessage);
621
- }
622
- }
623
- let hasChanged = false;
624
- const nextState = {};
625
- for (let i = 0; i < finalReducerKeys.length; i++) {
626
- const key = finalReducerKeys[i];
627
- const reducer = finalReducers[key];
628
- const previousStateForKey = state[key];
629
- const nextStateForKey = reducer(previousStateForKey, action);
630
- if (typeof nextStateForKey === "undefined") {
631
- const actionType = action && action.type;
632
- 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.`);
633
- }
634
- nextState[key] = nextStateForKey;
635
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
636
- }
637
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
638
- return hasChanged ? nextState : state;
639
- };
640
- }
641
-
642
- // src/store/store.ts
643
- var rootReducer = combineReducers({
644
- env: env_slice_default,
645
- header: header_slice_default,
646
- navbar: navbar_slice_default,
647
- list: list_slice_default,
648
- search: search_slice_default,
649
- form: form_slice_default,
650
- breadcrumbs: breadcrums_slice_default,
651
- login: login_slice_default,
652
- excel: excel_slice_default,
653
- profile: profile_slice_default
654
- });
655
- var envStore = configureStore({
656
- reducer: rootReducer,
657
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
658
- serializableCheck: false
659
- })
660
- });
661
-
662
34
  // src/configs/axios-client.ts
663
35
  import axios from "axios";
664
36
 
@@ -2800,11 +2172,331 @@ var isBase64File = (str) => {
2800
2172
  return false;
2801
2173
  }
2802
2174
  };
2175
+ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2176
+ if (!originalRequest.data) return originalRequest.data;
2177
+ if (typeof originalRequest.data === "string") {
2178
+ try {
2179
+ const parsedData = JSON.parse(originalRequest.data);
2180
+ if (parsedData.with_context && typeof parsedData.with_context === "object") {
2181
+ parsedData.with_context.token = newAccessToken;
2182
+ }
2183
+ return JSON.stringify(parsedData);
2184
+ } catch (e) {
2185
+ console.warn("Failed to parse originalRequest.data", e);
2186
+ return originalRequest.data;
2187
+ }
2188
+ }
2189
+ if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
2190
+ originalRequest.data.with_context.token = newAccessToken;
2191
+ }
2192
+ return originalRequest.data;
2193
+ };
2194
+
2195
+ // src/utils/storage/local-storage.ts
2196
+ var localStorageUtils = () => {
2197
+ const setToken = async (access_token) => {
2198
+ localStorage.setItem("accessToken", access_token);
2199
+ };
2200
+ const setRefreshToken = async (refresh_token) => {
2201
+ localStorage.setItem("refreshToken", refresh_token);
2202
+ };
2203
+ const getAccessToken = async () => {
2204
+ return localStorage.getItem("accessToken");
2205
+ };
2206
+ const getRefreshToken = async () => {
2207
+ return localStorage.getItem("refreshToken");
2208
+ };
2209
+ const clearToken = async () => {
2210
+ localStorage.removeItem("accessToken");
2211
+ localStorage.removeItem("refreshToken");
2212
+ };
2213
+ return {
2214
+ setToken,
2215
+ setRefreshToken,
2216
+ getAccessToken,
2217
+ getRefreshToken,
2218
+ clearToken
2219
+ };
2220
+ };
2221
+
2222
+ // src/utils/storage/session-storage.ts
2223
+ var sessionStorageUtils = () => {
2224
+ const getBrowserSession = async () => {
2225
+ return sessionStorage.getItem("browserSession");
2226
+ };
2227
+ return {
2228
+ getBrowserSession
2229
+ };
2230
+ };
2231
+
2232
+ // src/configs/axios-client.ts
2233
+ var axiosClient = {
2234
+ init(config) {
2235
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2236
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2237
+ const db = config.db;
2238
+ let isRefreshing = false;
2239
+ let failedQueue = [];
2240
+ const processQueue = (error, token = null) => {
2241
+ failedQueue?.forEach((prom) => {
2242
+ if (error) {
2243
+ prom.reject(error);
2244
+ } else {
2245
+ prom.resolve(token);
2246
+ }
2247
+ });
2248
+ failedQueue = [];
2249
+ };
2250
+ const instance = axios.create({
2251
+ adapter: axios.defaults.adapter,
2252
+ baseURL: config.baseUrl,
2253
+ timeout: 5e4,
2254
+ paramsSerializer: (params) => new URLSearchParams(params).toString()
2255
+ });
2256
+ instance.interceptors.request.use(
2257
+ async (config2) => {
2258
+ const useRefreshToken = config2.useRefreshToken;
2259
+ const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
2260
+ if (token) {
2261
+ config2.headers["Authorization"] = "Bearer " + token;
2262
+ }
2263
+ return config2;
2264
+ },
2265
+ (error) => {
2266
+ Promise.reject(error);
2267
+ }
2268
+ );
2269
+ instance.interceptors.response.use(
2270
+ (response) => {
2271
+ return handleResponse(response);
2272
+ },
2273
+ async (error) => {
2274
+ const handleError3 = async (error2) => {
2275
+ if (!error2.response) {
2276
+ return error2;
2277
+ }
2278
+ const { data } = error2.response;
2279
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
2280
+ await clearAuthToken();
2281
+ }
2282
+ return data;
2283
+ };
2284
+ const originalRequest = error.config;
2285
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2286
+ error.response.data.code
2287
+ )) {
2288
+ if (isRefreshing) {
2289
+ return new Promise(function(resolve, reject) {
2290
+ failedQueue.push({ resolve, reject });
2291
+ }).then((token) => {
2292
+ originalRequest.headers["Authorization"] = "Bearer " + token;
2293
+ originalRequest.data = updateTokenParamInOriginalRequest(
2294
+ originalRequest,
2295
+ token
2296
+ );
2297
+ return instance.request(originalRequest);
2298
+ }).catch(async (err) => {
2299
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2300
+ await clearAuthToken();
2301
+ }
2302
+ });
2303
+ }
2304
+ const browserSession = await sessionStorage2.getBrowserSession();
2305
+ const refreshToken = await localStorage2.getRefreshToken();
2306
+ const accessTokenExp = await localStorage2.getAccessToken();
2307
+ isRefreshing = true;
2308
+ if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2309
+ await clearAuthToken();
2310
+ } else {
2311
+ const payload = Object.fromEntries(
2312
+ Object.entries({
2313
+ refresh_token: refreshToken,
2314
+ grant_type: "refresh_token",
2315
+ client_id: config.config.clientId,
2316
+ client_secret: config.config.clientSecret
2317
+ }).filter(([_, value]) => !!value)
2318
+ );
2319
+ return new Promise(function(resolve) {
2320
+ axios.post(
2321
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2322
+ payload,
2323
+ {
2324
+ headers: {
2325
+ "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2326
+ Authorization: `Bearer ${accessTokenExp}`
2327
+ }
2328
+ }
2329
+ ).then(async (res) => {
2330
+ const data = res.data;
2331
+ await localStorage2.setToken(data.access_token);
2332
+ await localStorage2.setRefreshToken(data.refresh_token);
2333
+ axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2334
+ originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2335
+ originalRequest.data = updateTokenParamInOriginalRequest(
2336
+ originalRequest,
2337
+ data.access_token
2338
+ );
2339
+ processQueue(null, data.access_token);
2340
+ resolve(instance.request(originalRequest));
2341
+ }).catch(async (err) => {
2342
+ 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") {
2343
+ await clearAuthToken();
2344
+ }
2345
+ if (err && err.response) {
2346
+ const { error_code } = err.response?.data || {};
2347
+ if (error_code === "AUTHEN_FAIL") {
2348
+ await clearAuthToken();
2349
+ }
2350
+ }
2351
+ processQueue(err, null);
2352
+ }).finally(() => {
2353
+ isRefreshing = false;
2354
+ });
2355
+ });
2356
+ }
2357
+ }
2358
+ return Promise.reject(await handleError3(error));
2359
+ }
2360
+ );
2361
+ const handleResponse = (res) => {
2362
+ if (res && res.data) {
2363
+ return res.data;
2364
+ }
2365
+ return res;
2366
+ };
2367
+ const handleError2 = (error) => {
2368
+ if (error.isAxiosError && error.code === "ECONNABORTED") {
2369
+ console.error("Request Timeout Error:", error);
2370
+ return "Request Timeout Error";
2371
+ } else if (error.isAxiosError && !error.response) {
2372
+ console.error("Network Error:", error);
2373
+ return "Network Error";
2374
+ } else {
2375
+ console.error("Other Error:", error?.response);
2376
+ const errorMessage = error?.response?.data?.message || "An error occurred";
2377
+ return { message: errorMessage, status: error?.response?.status };
2378
+ }
2379
+ };
2380
+ const clearAuthToken = async () => {
2381
+ await localStorage2.clearToken();
2382
+ if (typeof window !== "undefined") {
2383
+ window.location.href = `/login`;
2384
+ }
2385
+ };
2386
+ function formatUrl(url, db2) {
2387
+ return url + (db2 ? "?db=" + db2 : "");
2388
+ }
2389
+ const responseBody = (response) => response;
2390
+ const requests = {
2391
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
2392
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
2393
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
2394
+ responseType: "arraybuffer",
2395
+ headers: {
2396
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
2397
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2398
+ }
2399
+ }).then(responseBody),
2400
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
2401
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
2402
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
2403
+ };
2404
+ return requests;
2405
+ }
2406
+ };
2803
2407
 
2804
2408
  // src/environment/EnvStore.ts
2409
+ var EnvStore = class _EnvStore {
2410
+ static instance = null;
2411
+ state = {};
2412
+ localStorageUtils;
2413
+ sessionStorageUtils;
2414
+ constructor(localStorageUtils2, sessionStorageUtils2) {
2415
+ this.localStorageUtils = localStorageUtils2;
2416
+ this.sessionStorageUtils = sessionStorageUtils2;
2417
+ }
2418
+ static getInstance(localStorageUtils2, sessionStorageUtils2) {
2419
+ if (!_EnvStore.instance) {
2420
+ console.log("Creating new EnvStore instance");
2421
+ _EnvStore.instance = new _EnvStore(localStorageUtils2, sessionStorageUtils2);
2422
+ } else {
2423
+ console.log("Returning existing EnvStore instance");
2424
+ }
2425
+ return _EnvStore.instance;
2426
+ }
2427
+ setupEnv(envConfig) {
2428
+ this.state = {
2429
+ ...this.state,
2430
+ ...envConfig,
2431
+ localStorageUtils: this.localStorageUtils,
2432
+ sessionStorageUtils: this.sessionStorageUtils
2433
+ };
2434
+ console.log("Setting up env with config:", envConfig);
2435
+ this.state.requests = axiosClient.init(this.state);
2436
+ console.log("axiosClient.init result:", this.state.requests);
2437
+ }
2438
+ setUid(uid) {
2439
+ this.state.uid = uid;
2440
+ }
2441
+ setLang(lang) {
2442
+ this.state.lang = lang;
2443
+ }
2444
+ setAllowCompanies(allowCompanies) {
2445
+ this.state.allowCompanies = allowCompanies;
2446
+ }
2447
+ setCompanies(companies) {
2448
+ this.state.companies = companies;
2449
+ }
2450
+ setDefaultCompany(company) {
2451
+ this.state.defaultCompany = company;
2452
+ }
2453
+ setUserInfo(userInfo) {
2454
+ this.state.user = userInfo;
2455
+ }
2456
+ // Getters để truy cập trạng thái
2457
+ get baseUrl() {
2458
+ return this.state.baseUrl;
2459
+ }
2460
+ get requests() {
2461
+ return this.state.requests;
2462
+ }
2463
+ get context() {
2464
+ return this.state.context;
2465
+ }
2466
+ get defaultCompany() {
2467
+ return this.state.defaultCompany;
2468
+ }
2469
+ get config() {
2470
+ return this.state.config;
2471
+ }
2472
+ get companies() {
2473
+ return this.state.companies;
2474
+ }
2475
+ get user() {
2476
+ return this.state.user;
2477
+ }
2478
+ get db() {
2479
+ return this.state.db;
2480
+ }
2481
+ get refreshTokenEndpoint() {
2482
+ return this.state.refreshTokenEndpoint;
2483
+ }
2484
+ get uid() {
2485
+ return this.state.uid;
2486
+ }
2487
+ get lang() {
2488
+ return this.state.lang;
2489
+ }
2490
+ get allowCompanies() {
2491
+ return this.state.allowCompanies;
2492
+ }
2493
+ };
2805
2494
  function getEnv() {
2806
- console.log("getEnv", envStore.getState().env);
2807
- return envStore.getState().env;
2495
+ const instance = EnvStore.getInstance();
2496
+ if (!instance) {
2497
+ throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
2498
+ }
2499
+ return instance;
2808
2500
  }
2809
2501
 
2810
2502
  // src/services/action-service/index.ts
@@ -2972,7 +2664,7 @@ var AuthService = {
2972
2664
  }).filter(([_, value]) => !!value)
2973
2665
  );
2974
2666
  const encodedData = new URLSearchParams(payload).toString();
2975
- return env?.requests?.post(body?.path ?? "", encodedData, {
2667
+ return env?.requests?.post(body.path, encodedData, {
2976
2668
  headers: {
2977
2669
  "Content-Type": "application/x-www-form-urlencoded"
2978
2670
  }
@@ -3069,20 +2761,6 @@ var AuthService = {
3069
2761
  }
3070
2762
  });
3071
2763
  },
3072
- async isValidActionToken(actionToken, path) {
3073
- const env = getEnv();
3074
- return env?.requests?.post(
3075
- path,
3076
- {},
3077
- {
3078
- headers: {
3079
- "Content-Type": "application/json"
3080
- },
3081
- useActionToken: true,
3082
- actionToken
3083
- }
3084
- );
3085
- },
3086
2764
  async loginSocial({
3087
2765
  db,
3088
2766
  state,
@@ -3847,7 +3525,7 @@ var model_service_default = ModelService;
3847
3525
  var UserService = {
3848
3526
  async getProfile(path) {
3849
3527
  const env = getEnv();
3850
- return env?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
3528
+ return env.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
3851
3529
  headers: {
3852
3530
  "Content-Type": "application/x-www-form-urlencoded"
3853
3531
  }
@@ -4166,7 +3844,8 @@ var ViewService = {
4166
3844
  },
4167
3845
  async getVersion() {
4168
3846
  const env = getEnv();
4169
- return env?.requests.get("", {
3847
+ console.log("env?.requests", env, env?.requests);
3848
+ return env?.requests?.get("", {
4170
3849
  headers: {
4171
3850
  "Content-Type": "application/json"
4172
3851
  }
@@ -4483,33 +4162,19 @@ var useGetAccessByCode = () => {
4483
4162
  };
4484
4163
  var use_get_access_by_code_default = useGetAccessByCode;
4485
4164
 
4486
- // src/hooks/auth/use-validate-action-token.ts
4487
- import { useMutation as useMutation12 } from "@tanstack/react-query";
4488
- var useValidateActionToken = () => {
4489
- return useMutation12({
4490
- mutationFn: ({
4491
- actionToken,
4492
- path
4493
- }) => {
4494
- return auth_service_default.isValidActionToken(actionToken, path);
4495
- }
4496
- });
4497
- };
4498
- var use_validate_action_token_default = useValidateActionToken;
4499
-
4500
4165
  // src/hooks/company/use-get-company-info.ts
4501
- import { useMutation as useMutation13 } from "@tanstack/react-query";
4166
+ import { useMutation as useMutation12 } from "@tanstack/react-query";
4502
4167
  var useGetCompanyInfo = () => {
4503
- return useMutation13({
4168
+ return useMutation12({
4504
4169
  mutationFn: (id) => company_service_default.getInfoCompany(id)
4505
4170
  });
4506
4171
  };
4507
4172
  var use_get_company_info_default = useGetCompanyInfo;
4508
4173
 
4509
4174
  // src/hooks/company/use-get-current-company.ts
4510
- import { useMutation as useMutation14 } from "@tanstack/react-query";
4175
+ import { useMutation as useMutation13 } from "@tanstack/react-query";
4511
4176
  var useGetCurrentCompany = () => {
4512
- return useMutation14({
4177
+ return useMutation13({
4513
4178
  mutationFn: () => company_service_default.getCurrentCompany()
4514
4179
  });
4515
4180
  };
@@ -4536,9 +4201,9 @@ var useGetListCompany = (companyIDs = []) => {
4536
4201
  var use_get_list_company_default = useGetListCompany;
4537
4202
 
4538
4203
  // src/hooks/excel/use-export-excel.ts
4539
- import { useMutation as useMutation15 } from "@tanstack/react-query";
4204
+ import { useMutation as useMutation14 } from "@tanstack/react-query";
4540
4205
  var useExportExcel = () => {
4541
- return useMutation15({
4206
+ return useMutation14({
4542
4207
  mutationFn: ({
4543
4208
  model,
4544
4209
  domain,
@@ -4563,9 +4228,9 @@ var useExportExcel = () => {
4563
4228
  var use_export_excel_default = useExportExcel;
4564
4229
 
4565
4230
  // src/hooks/excel/use-get-field-export.ts
4566
- import { useMutation as useMutation16 } from "@tanstack/react-query";
4231
+ import { useMutation as useMutation15 } from "@tanstack/react-query";
4567
4232
  var useGetFieldExport = () => {
4568
- return useMutation16({
4233
+ return useMutation15({
4569
4234
  mutationFn: ({
4570
4235
  ids,
4571
4236
  model,
@@ -4612,9 +4277,9 @@ var useGetFileExcel = ({ model }) => {
4612
4277
  var use_get_file_excel_default = useGetFileExcel;
4613
4278
 
4614
4279
  // src/hooks/excel/use-parse-preview.ts
4615
- import { useMutation as useMutation17 } from "@tanstack/react-query";
4280
+ import { useMutation as useMutation16 } from "@tanstack/react-query";
4616
4281
  var useParsePreview = () => {
4617
- return useMutation17({
4282
+ return useMutation16({
4618
4283
  mutationFn: ({
4619
4284
  id,
4620
4285
  selectedSheet,
@@ -4631,9 +4296,9 @@ var useParsePreview = () => {
4631
4296
  var use_parse_preview_default = useParsePreview;
4632
4297
 
4633
4298
  // src/hooks/excel/use-upload-file.ts
4634
- import { useMutation as useMutation18 } from "@tanstack/react-query";
4299
+ import { useMutation as useMutation17 } from "@tanstack/react-query";
4635
4300
  var useUploadFile = () => {
4636
- return useMutation18({
4301
+ return useMutation17({
4637
4302
  mutationFn: ({ formData }) => excel_service_default.uploadFile({
4638
4303
  formData
4639
4304
  })
@@ -4642,9 +4307,9 @@ var useUploadFile = () => {
4642
4307
  var use_upload_file_default = useUploadFile;
4643
4308
 
4644
4309
  // src/hooks/excel/use-upload-id-file.ts
4645
- import { useMutation as useMutation19 } from "@tanstack/react-query";
4310
+ import { useMutation as useMutation18 } from "@tanstack/react-query";
4646
4311
  var useUploadIdFile = () => {
4647
- return useMutation19({
4312
+ return useMutation18({
4648
4313
  mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
4649
4314
  formData
4650
4315
  })
@@ -4653,9 +4318,9 @@ var useUploadIdFile = () => {
4653
4318
  var use_upload_id_file_default = useUploadIdFile;
4654
4319
 
4655
4320
  // src/hooks/excel/uss-execute-import.ts
4656
- import { useMutation as useMutation20 } from "@tanstack/react-query";
4321
+ import { useMutation as useMutation19 } from "@tanstack/react-query";
4657
4322
  var useExecuteImport = () => {
4658
- return useMutation20({
4323
+ return useMutation19({
4659
4324
  mutationFn: ({
4660
4325
  fields,
4661
4326
  columns,
@@ -4676,9 +4341,9 @@ var useExecuteImport = () => {
4676
4341
  var uss_execute_import_default = useExecuteImport;
4677
4342
 
4678
4343
  // src/hooks/form/use-change-status.ts
4679
- import { useMutation as useMutation21 } from "@tanstack/react-query";
4344
+ import { useMutation as useMutation20 } from "@tanstack/react-query";
4680
4345
  var useChangeStatus = () => {
4681
- return useMutation21({
4346
+ return useMutation20({
4682
4347
  mutationFn: ({ data }) => {
4683
4348
  return form_service_default.changeStatus({
4684
4349
  data
@@ -4689,9 +4354,9 @@ var useChangeStatus = () => {
4689
4354
  var use_change_status_default = useChangeStatus;
4690
4355
 
4691
4356
  // src/hooks/form/use-delete-comment.ts
4692
- import { useMutation as useMutation22 } from "@tanstack/react-query";
4357
+ import { useMutation as useMutation21 } from "@tanstack/react-query";
4693
4358
  var useDeleteComment = () => {
4694
- return useMutation22({
4359
+ return useMutation21({
4695
4360
  mutationFn: ({ data }) => form_service_default.deleteComment({
4696
4361
  data
4697
4362
  })
@@ -4756,9 +4421,9 @@ var useGetImage = ({
4756
4421
  var use_get_image_default = useGetImage;
4757
4422
 
4758
4423
  // src/hooks/form/use-send-comment.ts
4759
- import { useMutation as useMutation23 } from "@tanstack/react-query";
4424
+ import { useMutation as useMutation22 } from "@tanstack/react-query";
4760
4425
  var useSendComment = () => {
4761
- return useMutation23({
4426
+ return useMutation22({
4762
4427
  mutationFn: ({ data }) => form_service_default.sentComment({
4763
4428
  data
4764
4429
  })
@@ -4767,9 +4432,9 @@ var useSendComment = () => {
4767
4432
  var use_send_comment_default = useSendComment;
4768
4433
 
4769
4434
  // src/hooks/form/use-upload-image.ts
4770
- import { useMutation as useMutation24 } from "@tanstack/react-query";
4435
+ import { useMutation as useMutation23 } from "@tanstack/react-query";
4771
4436
  var useUploadImage = () => {
4772
- return useMutation24({
4437
+ return useMutation23({
4773
4438
  mutationFn: ({ data }) => form_service_default.uploadImage({
4774
4439
  data
4775
4440
  })
@@ -4778,9 +4443,9 @@ var useUploadImage = () => {
4778
4443
  var use_upload_image_default = useUploadImage;
4779
4444
 
4780
4445
  // src/hooks/model/use-delete.ts
4781
- import { useMutation as useMutation25 } from "@tanstack/react-query";
4446
+ import { useMutation as useMutation24 } from "@tanstack/react-query";
4782
4447
  var useDelete = () => {
4783
- return useMutation25({
4448
+ return useMutation24({
4784
4449
  mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
4785
4450
  });
4786
4451
  };
@@ -4834,9 +4499,9 @@ var useGetCurrency = () => {
4834
4499
  var use_get_currency_default = useGetCurrency;
4835
4500
 
4836
4501
  // src/hooks/model/use-get-detail.ts
4837
- import { useMutation as useMutation26 } from "@tanstack/react-query";
4502
+ import { useMutation as useMutation25 } from "@tanstack/react-query";
4838
4503
  var useGetDetail = () => {
4839
- return useMutation26({
4504
+ return useMutation25({
4840
4505
  mutationFn: ({
4841
4506
  model,
4842
4507
  ids,
@@ -5029,9 +4694,9 @@ var useOdooDataTransform = () => {
5029
4694
  var use_odoo_data_transform_default = useOdooDataTransform;
5030
4695
 
5031
4696
  // src/hooks/model/use-onchange-form.ts
5032
- import { useMutation as useMutation27 } from "@tanstack/react-query";
4697
+ import { useMutation as useMutation26 } from "@tanstack/react-query";
5033
4698
  var useOnChangeForm = () => {
5034
- return useMutation27({
4699
+ return useMutation26({
5035
4700
  mutationFn: ({
5036
4701
  ids,
5037
4702
  model,
@@ -5052,9 +4717,9 @@ var useOnChangeForm = () => {
5052
4717
  var use_onchange_form_default = useOnChangeForm;
5053
4718
 
5054
4719
  // src/hooks/model/use-save.ts
5055
- import { useMutation as useMutation28 } from "@tanstack/react-query";
4720
+ import { useMutation as useMutation27 } from "@tanstack/react-query";
5056
4721
  var useSave = () => {
5057
- return useMutation28({
4722
+ return useMutation27({
5058
4723
  mutationFn: ({
5059
4724
  ids,
5060
4725
  model,
@@ -5068,18 +4733,18 @@ var useSave = () => {
5068
4733
  var use_save_default = useSave;
5069
4734
 
5070
4735
  // src/hooks/user/use-get-profile.ts
5071
- import { useMutation as useMutation29 } from "@tanstack/react-query";
4736
+ import { useMutation as useMutation28 } from "@tanstack/react-query";
5072
4737
  var useGetProfile = (path) => {
5073
- return useMutation29({
4738
+ return useMutation28({
5074
4739
  mutationFn: () => user_service_default.getProfile(path)
5075
4740
  });
5076
4741
  };
5077
4742
  var use_get_profile_default = useGetProfile;
5078
4743
 
5079
4744
  // src/hooks/user/use-get-user.ts
5080
- import { useMutation as useMutation30 } from "@tanstack/react-query";
4745
+ import { useMutation as useMutation29 } from "@tanstack/react-query";
5081
4746
  var useGetUser = () => {
5082
- return useMutation30({
4747
+ return useMutation29({
5083
4748
  mutationFn: ({ id, context }) => user_service_default.getUser({
5084
4749
  id,
5085
4750
  context
@@ -5089,9 +4754,9 @@ var useGetUser = () => {
5089
4754
  var use_get_user_default = useGetUser;
5090
4755
 
5091
4756
  // src/hooks/user/use-switch-locale.ts
5092
- import { useMutation as useMutation31 } from "@tanstack/react-query";
4757
+ import { useMutation as useMutation30 } from "@tanstack/react-query";
5093
4758
  var useSwitchLocale = () => {
5094
- return useMutation31({
4759
+ return useMutation30({
5095
4760
  mutationFn: ({ data }) => {
5096
4761
  return user_service_default.switchUserLocale({
5097
4762
  id: data.id,
@@ -5103,9 +4768,9 @@ var useSwitchLocale = () => {
5103
4768
  var use_switch_locale_default = useSwitchLocale;
5104
4769
 
5105
4770
  // src/hooks/view/use-button.ts
5106
- import { useMutation as useMutation32 } from "@tanstack/react-query";
4771
+ import { useMutation as useMutation31 } from "@tanstack/react-query";
5107
4772
  var useButton = () => {
5108
- return useMutation32({
4773
+ return useMutation31({
5109
4774
  mutationFn: ({
5110
4775
  model,
5111
4776
  ids,
@@ -5125,9 +4790,9 @@ var useButton = () => {
5125
4790
  var use_button_default = useButton;
5126
4791
 
5127
4792
  // src/hooks/view/use-duplicate-record.ts
5128
- import { useMutation as useMutation33 } from "@tanstack/react-query";
4793
+ import { useMutation as useMutation32 } from "@tanstack/react-query";
5129
4794
  var useDuplicateRecord = () => {
5130
- return useMutation33({
4795
+ return useMutation32({
5131
4796
  mutationFn: ({
5132
4797
  id,
5133
4798
  model,
@@ -5253,9 +4918,9 @@ var useGetMenu = (context, enabled) => {
5253
4918
  var use_get_menu_default = useGetMenu;
5254
4919
 
5255
4920
  // src/hooks/view/use-get-print-report.ts
5256
- import { useMutation as useMutation34 } from "@tanstack/react-query";
4921
+ import { useMutation as useMutation33 } from "@tanstack/react-query";
5257
4922
  var useGetPrintReport = () => {
5258
- return useMutation34({
4923
+ return useMutation33({
5259
4924
  mutationFn: ({ id }) => action_service_default.getPrintReportName({
5260
4925
  id
5261
4926
  })
@@ -5319,9 +4984,9 @@ var useGetView = (viewParams, actData) => {
5319
4984
  var use_get_view_default = useGetView;
5320
4985
 
5321
4986
  // src/hooks/view/use-load-action.ts
5322
- import { useMutation as useMutation35 } from "@tanstack/react-query";
4987
+ import { useMutation as useMutation34 } from "@tanstack/react-query";
5323
4988
  var useLoadAction = () => {
5324
- return useMutation35({
4989
+ return useMutation34({
5325
4990
  mutationFn: ({
5326
4991
  idAction,
5327
4992
  context
@@ -5347,9 +5012,9 @@ var useLoadMessage = () => {
5347
5012
  var use_load_message_default = useLoadMessage;
5348
5013
 
5349
5014
  // src/hooks/view/use-print.ts
5350
- import { useMutation as useMutation36 } from "@tanstack/react-query";
5015
+ import { useMutation as useMutation35 } from "@tanstack/react-query";
5351
5016
  var usePrint = () => {
5352
- return useMutation36({
5017
+ return useMutation35({
5353
5018
  mutationFn: ({ id, report, db }) => action_service_default.print({
5354
5019
  id,
5355
5020
  report,
@@ -5360,9 +5025,9 @@ var usePrint = () => {
5360
5025
  var use_print_default = usePrint;
5361
5026
 
5362
5027
  // src/hooks/view/use-remove-row.ts
5363
- import { useMutation as useMutation37 } from "@tanstack/react-query";
5028
+ import { useMutation as useMutation36 } from "@tanstack/react-query";
5364
5029
  var useRemoveRow = () => {
5365
- return useMutation37({
5030
+ return useMutation36({
5366
5031
  mutationFn: ({
5367
5032
  model,
5368
5033
  ids,
@@ -5394,9 +5059,9 @@ var useGetResequence = (model, resIds, context, offset) => {
5394
5059
  var use_resequence_default = useGetResequence;
5395
5060
 
5396
5061
  // src/hooks/view/use-run-action.ts
5397
- import { useMutation as useMutation38 } from "@tanstack/react-query";
5062
+ import { useMutation as useMutation37 } from "@tanstack/react-query";
5398
5063
  var useRunAction = () => {
5399
- return useMutation38({
5064
+ return useMutation37({
5400
5065
  mutationFn: ({
5401
5066
  idAction,
5402
5067
  context
@@ -5409,9 +5074,9 @@ var useRunAction = () => {
5409
5074
  var use_run_action_default = useRunAction;
5410
5075
 
5411
5076
  // src/hooks/view/use-signin-sso.ts
5412
- import { useMutation as useMutation39 } from "@tanstack/react-query";
5077
+ import { useMutation as useMutation38 } from "@tanstack/react-query";
5413
5078
  var useSignInSSO = () => {
5414
- return useMutation39({
5079
+ return useMutation38({
5415
5080
  mutationFn: ({
5416
5081
  redirect_uri,
5417
5082
  state,
@@ -5432,9 +5097,9 @@ var useSignInSSO = () => {
5432
5097
  var use_signin_sso_default = useSignInSSO;
5433
5098
 
5434
5099
  // src/hooks/view/use-verify-2FA.ts
5435
- import { useMutation as useMutation40 } from "@tanstack/react-query";
5100
+ import { useMutation as useMutation39 } from "@tanstack/react-query";
5436
5101
  var useVerify2FA = () => {
5437
- return useMutation40({
5102
+ return useMutation39({
5438
5103
  mutationFn: ({
5439
5104
  method,
5440
5105
  with_context,
@@ -5455,9 +5120,9 @@ var useVerify2FA = () => {
5455
5120
  var use_verify_2FA_default = useVerify2FA;
5456
5121
 
5457
5122
  // src/hooks/view/uset-get-2FA-method.ts
5458
- import { useMutation as useMutation41 } from "@tanstack/react-query";
5123
+ import { useMutation as useMutation40 } from "@tanstack/react-query";
5459
5124
  var useGet2FAMethods = () => {
5460
- return useMutation41({
5125
+ return useMutation40({
5461
5126
  mutationFn: ({
5462
5127
  method,
5463
5128
  with_context
@@ -5472,9 +5137,9 @@ var useGet2FAMethods = () => {
5472
5137
  var uset_get_2FA_method_default = useGet2FAMethods;
5473
5138
 
5474
5139
  // src/hooks/view/use-get-fields-view-security.ts
5475
- import { useMutation as useMutation42 } from "@tanstack/react-query";
5140
+ import { useMutation as useMutation41 } from "@tanstack/react-query";
5476
5141
  var useGetFieldsViewSecurity = () => {
5477
- return useMutation42({
5142
+ return useMutation41({
5478
5143
  mutationFn: ({
5479
5144
  method,
5480
5145
  token,
@@ -5491,9 +5156,9 @@ var useGetFieldsViewSecurity = () => {
5491
5156
  var use_get_fields_view_security_default = useGetFieldsViewSecurity;
5492
5157
 
5493
5158
  // src/hooks/view/use-grant-access.ts
5494
- import { useMutation as useMutation43 } from "@tanstack/react-query";
5159
+ import { useMutation as useMutation42 } from "@tanstack/react-query";
5495
5160
  var useGrantAccess = () => {
5496
- return useMutation43({
5161
+ return useMutation42({
5497
5162
  mutationFn: ({
5498
5163
  redirect_uri,
5499
5164
  state,
@@ -5512,9 +5177,9 @@ var useGrantAccess = () => {
5512
5177
  var use_grant_access_default = useGrantAccess;
5513
5178
 
5514
5179
  // src/hooks/view/use-remove-totp-setup.ts
5515
- import { useMutation as useMutation44 } from "@tanstack/react-query";
5180
+ import { useMutation as useMutation43 } from "@tanstack/react-query";
5516
5181
  var useRemoveTotpSetup = () => {
5517
- return useMutation44({
5182
+ return useMutation43({
5518
5183
  mutationFn: ({ method, token }) => {
5519
5184
  return view_service_default.removeTotpSetUp({
5520
5185
  method,
@@ -5526,9 +5191,9 @@ var useRemoveTotpSetup = () => {
5526
5191
  var use_remove_totp_setup_default = useRemoveTotpSetup;
5527
5192
 
5528
5193
  // src/hooks/view/use-request-setup-totp.ts
5529
- import { useMutation as useMutation45 } from "@tanstack/react-query";
5194
+ import { useMutation as useMutation44 } from "@tanstack/react-query";
5530
5195
  var useRequestSetupTotp = () => {
5531
- return useMutation45({
5196
+ return useMutation44({
5532
5197
  mutationFn: ({ method, token }) => {
5533
5198
  return view_service_default.requestSetupTotp({
5534
5199
  method,
@@ -5540,9 +5205,9 @@ var useRequestSetupTotp = () => {
5540
5205
  var use_request_setup_totp_default = useRequestSetupTotp;
5541
5206
 
5542
5207
  // src/hooks/view/use-settings-web-read-2fa.ts
5543
- import { useMutation as useMutation46 } from "@tanstack/react-query";
5208
+ import { useMutation as useMutation45 } from "@tanstack/react-query";
5544
5209
  var useSettingsWebRead2fa = () => {
5545
- return useMutation46({
5210
+ return useMutation45({
5546
5211
  mutationFn: ({
5547
5212
  method,
5548
5213
  token,
@@ -5561,9 +5226,9 @@ var useSettingsWebRead2fa = () => {
5561
5226
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
5562
5227
 
5563
5228
  // src/hooks/view/use-verify-totp.ts
5564
- import { useMutation as useMutation47 } from "@tanstack/react-query";
5229
+ import { useMutation as useMutation46 } from "@tanstack/react-query";
5565
5230
  var useVerifyTotp = () => {
5566
- return useMutation47({
5231
+ return useMutation46({
5567
5232
  mutationFn: ({
5568
5233
  method,
5569
5234
  action_token,
@@ -5645,7 +5310,6 @@ export {
5645
5310
  use_upload_file_default as useUploadFile,
5646
5311
  use_upload_id_file_default as useUploadIdFile,
5647
5312
  use_upload_image_default as useUploadImage,
5648
- use_validate_action_token_default as useValidateActionToken,
5649
5313
  use_verify_2FA_default as useVerify2FA,
5650
5314
  use_verify_totp_default as useVerifyTotp
5651
5315
  };