@fctc/interface-logic 1.7.2 → 1.7.4

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.
Files changed (40) hide show
  1. package/dist/{configs.d.cts → configs.d.mts} +1 -4
  2. package/dist/configs.d.ts +1 -4
  3. package/dist/configs.js +146 -124
  4. package/dist/{configs.cjs → configs.mjs} +111 -161
  5. package/dist/constants.js +41 -2
  6. package/dist/{constants.cjs → constants.mjs} +2 -40
  7. package/dist/environment.d.mts +37 -0
  8. package/dist/environment.d.ts +35 -54
  9. package/dist/environment.js +2850 -2906
  10. package/dist/{environment.cjs → environment.mjs} +2816 -2945
  11. package/dist/{hooks.d.cts → hooks.d.mts} +7 -2
  12. package/dist/hooks.d.ts +7 -2
  13. package/dist/hooks.js +4181 -4520
  14. package/dist/{hooks.cjs → hooks.mjs} +4081 -4625
  15. package/dist/{provider.d.cts → provider.d.mts} +1 -1
  16. package/dist/provider.d.ts +1 -1
  17. package/dist/provider.js +530 -854
  18. package/dist/{provider.cjs → provider.mjs} +496 -894
  19. package/dist/{services.d.cts → services.d.mts} +2 -1
  20. package/dist/services.d.ts +2 -1
  21. package/dist/services.js +3866 -4282
  22. package/dist/{services.cjs → services.mjs} +3826 -4328
  23. package/dist/{store.d.cts → store.d.mts} +323 -127
  24. package/dist/store.d.ts +323 -127
  25. package/dist/store.js +147 -45
  26. package/dist/{store.cjs → store.mjs} +46 -150
  27. package/dist/{types.d.cts → types.d.mts} +1 -1
  28. package/dist/types.d.ts +1 -1
  29. package/dist/types.js +18 -0
  30. package/dist/types.mjs +0 -0
  31. package/dist/{utils.d.cts → utils.d.mts} +2 -2
  32. package/dist/utils.d.ts +2 -2
  33. package/dist/utils.js +176 -135
  34. package/dist/{utils.cjs → utils.mjs} +115 -202
  35. package/dist/{view-type-BGJfDe73.d.ts → view-type-D8ukwj_2.d.mts} +1 -1
  36. package/dist/{view-type-BGJfDe73.d.cts → view-type-D8ukwj_2.d.ts} +1 -1
  37. package/package.json +81 -82
  38. package/dist/environment.d.cts +0 -56
  39. package/dist/types.cjs +0 -17
  40. /package/dist/{constants.d.cts → constants.d.mts} +0 -0
@@ -1,83 +1,8 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __pow = Math.pow;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __export = (target, all) => {
26
- for (var name in all)
27
- __defProp(target, name, { get: all[name], enumerable: true });
28
- };
29
- var __copyProps = (to, from, except, desc) => {
30
- if (from && typeof from === "object" || typeof from === "function") {
31
- for (let key of __getOwnPropNames(from))
32
- if (!__hasOwnProp.call(to, key) && key !== except)
33
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
- }
35
- return to;
36
- };
37
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
- // If the importer is in node compatibility mode or this is not an ESM
39
- // file that has been converted to a CommonJS file using a Babel-
40
- // compatible transform (i.e. "__esModule" has not been set), then set
41
- // "default" to the CommonJS "module.exports" for node compatibility.
42
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
- mod
44
- ));
45
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
- var __async = (__this, __arguments, generator) => {
47
- return new Promise((resolve, reject) => {
48
- var fulfilled = (value) => {
49
- try {
50
- step(generator.next(value));
51
- } catch (e) {
52
- reject(e);
53
- }
54
- };
55
- var rejected = (value) => {
56
- try {
57
- step(generator.throw(value));
58
- } catch (e) {
59
- reject(e);
60
- }
61
- };
62
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
- step((generator = generator.apply(__this, __arguments)).next());
64
- });
65
- };
66
-
67
- // src/provider.ts
68
- var provider_exports = {};
69
- __export(provider_exports, {
70
- MainProvider: () => MainProvider,
71
- ReactQueryProvider: () => ReactQueryProvider,
72
- VersionGate: () => VersionGate
73
- });
74
- module.exports = __toCommonJS(provider_exports);
75
-
76
1
  // src/provider/react-query-provider.tsx
77
- var import_react_query = require("@tanstack/react-query");
78
- var import_jsx_runtime = require("react/jsx-runtime");
2
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
+ import { jsx } from "react/jsx-runtime";
79
4
  var ReactQueryProvider = ({ children }) => {
80
- const queryClient = new import_react_query.QueryClient({
5
+ const queryClient = new QueryClient({
81
6
  defaultOptions: {
82
7
  queries: {
83
8
  // placeholderData: keepPreviousData,
@@ -88,21 +13,21 @@ var ReactQueryProvider = ({ children }) => {
88
13
  }
89
14
  }
90
15
  });
91
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children });
16
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
92
17
  };
93
18
 
94
19
  // src/provider/redux-provider.tsx
95
- var import_react_redux2 = require("react-redux");
20
+ import { Provider } from "react-redux";
96
21
 
97
22
  // src/store/index.ts
98
- var import_react_redux = require("react-redux");
23
+ import { useDispatch, useSelector } from "react-redux";
99
24
 
100
25
  // src/store/reducers/breadcrums-slice/index.ts
101
- var import_toolkit = require("@reduxjs/toolkit");
26
+ import { createSlice } from "@reduxjs/toolkit";
102
27
  var initialState = {
103
28
  breadCrumbs: []
104
29
  };
105
- var breadcrumbsSlice = (0, import_toolkit.createSlice)({
30
+ var breadcrumbsSlice = createSlice({
106
31
  name: "breadcrumbs",
107
32
  initialState,
108
33
  reducers: {
@@ -115,14 +40,28 @@ var { setBreadCrumbs } = breadcrumbsSlice.actions;
115
40
  var breadcrums_slice_default = breadcrumbsSlice.reducer;
116
41
 
117
42
  // src/store/reducers/env-slice/index.ts
118
- var import_toolkit2 = require("@reduxjs/toolkit");
43
+ import { createSlice as createSlice2 } from "@reduxjs/toolkit";
119
44
  var initialState2 = {
120
45
  baseUrl: "",
121
- requests: null,
122
46
  companies: [],
123
47
  user: {},
124
- config: null,
48
+ db: "",
49
+ refreshTokenEndpoint: "",
50
+ config: {
51
+ grantType: "",
52
+ clientId: "",
53
+ clientSecret: "",
54
+ redirectUri: ""
55
+ },
125
56
  envFile: null,
57
+ requests: {
58
+ get: async (url, headers) => ({}),
59
+ post: async (url, body, headers) => ({}),
60
+ post_excel: async (url, body, headers) => ({}),
61
+ put: async (url, body, headers) => ({}),
62
+ patch: async (url, body) => ({}),
63
+ delete: async (url, body) => ({})
64
+ },
126
65
  defaultCompany: {
127
66
  id: null,
128
67
  logo: "",
@@ -136,7 +75,7 @@ var initialState2 = {
136
75
  tz: "Asia/Saigon"
137
76
  }
138
77
  };
139
- var envSlice = (0, import_toolkit2.createSlice)({
78
+ var envSlice = createSlice2({
140
79
  name: "env",
141
80
  initialState: initialState2,
142
81
  reducers: {
@@ -183,7 +122,7 @@ var {
183
122
  var env_slice_default = envSlice.reducer;
184
123
 
185
124
  // src/store/reducers/excel-slice/index.ts
186
- var import_toolkit3 = require("@reduxjs/toolkit");
125
+ import { createSlice as createSlice3 } from "@reduxjs/toolkit";
187
126
  var initialState3 = {
188
127
  dataParse: null,
189
128
  idFile: null,
@@ -192,7 +131,7 @@ var initialState3 = {
192
131
  selectedFile: null,
193
132
  errorData: null
194
133
  };
195
- var excelSlice = (0, import_toolkit3.createSlice)({
134
+ var excelSlice = createSlice3({
196
135
  name: "excel",
197
136
  initialState: initialState3,
198
137
  reducers: {
@@ -227,7 +166,7 @@ var {
227
166
  var excel_slice_default = excelSlice.reducer;
228
167
 
229
168
  // src/store/reducers/form-slice/index.ts
230
- var import_toolkit4 = require("@reduxjs/toolkit");
169
+ import { createSlice as createSlice4 } from "@reduxjs/toolkit";
231
170
  var initialState4 = {
232
171
  viewDataStore: {},
233
172
  isShowingModalDetail: false,
@@ -237,7 +176,7 @@ var initialState4 = {
237
176
  listSubject: {},
238
177
  dataUser: {}
239
178
  };
240
- var formSlice = (0, import_toolkit4.createSlice)({
179
+ var formSlice = createSlice4({
241
180
  name: "form",
242
181
  initialState: initialState4,
243
182
  reducers: {
@@ -276,15 +215,15 @@ var {
276
215
  var form_slice_default = formSlice.reducer;
277
216
 
278
217
  // src/store/reducers/header-slice/index.ts
279
- var import_toolkit5 = require("@reduxjs/toolkit");
280
- var headerSlice = (0, import_toolkit5.createSlice)({
218
+ import { createSlice as createSlice5 } from "@reduxjs/toolkit";
219
+ var headerSlice = createSlice5({
281
220
  name: "header",
282
221
  initialState: {
283
222
  value: { allowedCompanyIds: [] }
284
223
  },
285
224
  reducers: {
286
225
  setHeader: (state, action) => {
287
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
226
+ state.value = { ...state.value, ...action.payload };
288
227
  },
289
228
  setAllowedCompanyIds: (state, action) => {
290
229
  state.value.allowedCompanyIds = action.payload;
@@ -295,7 +234,7 @@ var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
295
234
  var header_slice_default = headerSlice.reducer;
296
235
 
297
236
  // src/store/reducers/list-slice/index.ts
298
- var import_toolkit6 = require("@reduxjs/toolkit");
237
+ import { createSlice as createSlice6 } from "@reduxjs/toolkit";
299
238
  var initialState5 = {
300
239
  pageLimit: 10,
301
240
  fields: {},
@@ -309,7 +248,7 @@ var initialState5 = {
309
248
  page: 0,
310
249
  domainTable: []
311
250
  };
312
- var listSlice = (0, import_toolkit6.createSlice)({
251
+ var listSlice = createSlice6({
313
252
  name: "list",
314
253
  initialState: initialState5,
315
254
  reducers: {
@@ -360,13 +299,13 @@ var {
360
299
  var list_slice_default = listSlice.reducer;
361
300
 
362
301
  // src/store/reducers/login-slice/index.ts
363
- var import_toolkit7 = require("@reduxjs/toolkit");
302
+ import { createSlice as createSlice7 } from "@reduxjs/toolkit";
364
303
  var initialState6 = {
365
304
  db: "",
366
305
  redirectTo: "/",
367
306
  forgotPasswordUrl: "/"
368
307
  };
369
- var loginSlice = (0, import_toolkit7.createSlice)({
308
+ var loginSlice = createSlice7({
370
309
  name: "login",
371
310
  initialState: initialState6,
372
311
  reducers: {
@@ -385,14 +324,14 @@ var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
385
324
  var login_slice_default = loginSlice.reducer;
386
325
 
387
326
  // src/store/reducers/navbar-slice/index.ts
388
- var import_toolkit8 = require("@reduxjs/toolkit");
327
+ import { createSlice as createSlice8 } from "@reduxjs/toolkit";
389
328
  var initialState7 = {
390
329
  menuFocus: {},
391
330
  menuAction: {},
392
331
  navbarWidth: 250,
393
332
  menuList: []
394
333
  };
395
- var navbarSlice = (0, import_toolkit8.createSlice)({
334
+ var navbarSlice = createSlice8({
396
335
  name: "navbar",
397
336
  initialState: initialState7,
398
337
  reducers: {
@@ -414,11 +353,11 @@ var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSl
414
353
  var navbar_slice_default = navbarSlice.reducer;
415
354
 
416
355
  // src/store/reducers/profile-slice/index.ts
417
- var import_toolkit9 = require("@reduxjs/toolkit");
356
+ import { createSlice as createSlice9 } from "@reduxjs/toolkit";
418
357
  var initialState8 = {
419
358
  profile: {}
420
359
  };
421
- var profileSlice = (0, import_toolkit9.createSlice)({
360
+ var profileSlice = createSlice9({
422
361
  name: "profile",
423
362
  initialState: initialState8,
424
363
  reducers: {
@@ -431,7 +370,7 @@ var { setProfile } = profileSlice.actions;
431
370
  var profile_slice_default = profileSlice.reducer;
432
371
 
433
372
  // src/store/reducers/search-slice/index.ts
434
- var import_toolkit10 = require("@reduxjs/toolkit");
373
+ import { createSlice as createSlice10 } from "@reduxjs/toolkit";
435
374
  var initialState9 = {
436
375
  groupByDomain: null,
437
376
  searchBy: [],
@@ -443,7 +382,7 @@ var initialState9 = {
443
382
  filterBy: [],
444
383
  groupBy: []
445
384
  };
446
- var searchSlice = (0, import_toolkit10.createSlice)({
385
+ var searchSlice = createSlice10({
447
386
  name: "search",
448
387
  initialState: initialState9,
449
388
  reducers: {
@@ -517,7 +456,7 @@ var {
517
456
  var search_slice_default = searchSlice.reducer;
518
457
 
519
458
  // src/store/store.ts
520
- var import_toolkit11 = require("@reduxjs/toolkit");
459
+ import { configureStore } from "@reduxjs/toolkit";
521
460
 
522
461
  // node_modules/redux/dist/redux.mjs
523
462
  function formatProdErrorMessage(code) {
@@ -701,7 +640,7 @@ var rootReducer = combineReducers({
701
640
  excel: excel_slice_default,
702
641
  profile: profile_slice_default
703
642
  });
704
- var envStore = (0, import_toolkit11.configureStore)({
643
+ var envStore = configureStore({
705
644
  reducer: rootReducer,
706
645
  middleware: (getDefaultMiddleware) => getDefaultMiddleware({
707
646
  serializableCheck: false
@@ -709,26 +648,26 @@ var envStore = (0, import_toolkit11.configureStore)({
709
648
  });
710
649
 
711
650
  // src/provider/redux-provider.tsx
712
- var import_jsx_runtime2 = require("react/jsx-runtime");
651
+ import { jsx as jsx2 } from "react/jsx-runtime";
713
652
  var ReduxProvider = ({ children }) => {
714
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_redux2.Provider, { store: envStore, children });
653
+ return /* @__PURE__ */ jsx2(Provider, { store: envStore, children });
715
654
  };
716
655
 
717
656
  // src/provider/main-provider.tsx
718
- var import_jsx_runtime3 = require("react/jsx-runtime");
657
+ import { jsx as jsx3 } from "react/jsx-runtime";
719
658
  var MainProvider = ({ children }) => {
720
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReduxProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReactQueryProvider, { children }) });
659
+ return /* @__PURE__ */ jsx3(ReduxProvider, { children: /* @__PURE__ */ jsx3(ReactQueryProvider, { children }) });
721
660
  };
722
661
 
723
662
  // src/provider/version-gate-provider.tsx
724
- var import_react2 = require("react");
725
- var import_react_query2 = require("@tanstack/react-query");
663
+ import { useEffect as useEffect2, useState as useState2 } from "react";
664
+ import { useQueryClient } from "@tanstack/react-query";
726
665
 
727
666
  // src/configs/axios-client.ts
728
- var import_axios = __toESM(require("axios"), 1);
667
+ import axios from "axios";
729
668
 
730
669
  // src/utils/format.ts
731
- var import_moment = __toESM(require("moment"), 1);
670
+ import moment from "moment";
732
671
 
733
672
  // src/utils/domain/py_tokenizer.ts
734
673
  var TokenizerError = class extends Error {
@@ -1808,6 +1747,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1808
1747
  this.microsecond = params.microsecond;
1809
1748
  this.weekday = params.weekday;
1810
1749
  }
1750
+ years;
1751
+ months;
1752
+ days;
1753
+ hours;
1754
+ minutes;
1755
+ seconds;
1756
+ microseconds;
1757
+ leapDays;
1758
+ year;
1759
+ month;
1760
+ day;
1761
+ hour;
1762
+ minute;
1763
+ second;
1764
+ microsecond;
1765
+ weekday;
1811
1766
  negate() {
1812
1767
  return new _PyRelativeDelta(this, -1);
1813
1768
  }
@@ -1922,7 +1877,7 @@ function execOnIterable(iterable, func) {
1922
1877
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1923
1878
  iterable = Object.keys(iterable);
1924
1879
  }
1925
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1880
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1926
1881
  throw new EvaluationError("value not iterable");
1927
1882
  }
1928
1883
  return func(iterable);
@@ -2245,7 +2200,7 @@ function applyBinaryOp(ast, context) {
2245
2200
  }
2246
2201
  return Math.floor(left / right);
2247
2202
  case "**":
2248
- return __pow(left, right);
2203
+ return left ** right;
2249
2204
  case "==":
2250
2205
  return isEqual(left, right);
2251
2206
  case "<>":
@@ -2367,7 +2322,7 @@ function evaluate(ast, context = {}) {
2367
2322
  const dicts = /* @__PURE__ */ new Set();
2368
2323
  let pyContext;
2369
2324
  const evalContext = Object.create(context);
2370
- if (!(evalContext == null ? void 0 : evalContext.context)) {
2325
+ if (!evalContext?.context) {
2371
2326
  Object.defineProperty(evalContext, "context", {
2372
2327
  get() {
2373
2328
  if (!pyContext) {
@@ -2378,18 +2333,17 @@ function evaluate(ast, context = {}) {
2378
2333
  });
2379
2334
  }
2380
2335
  function _innerEvaluate(ast2) {
2381
- var _a, _b, _c;
2382
- switch (ast2 == null ? void 0 : ast2.type) {
2336
+ switch (ast2?.type) {
2383
2337
  case 0:
2384
2338
  // Number
2385
2339
  case 1:
2386
2340
  return ast2.value;
2387
2341
  case 5:
2388
2342
  if (ast2.value in evalContext) {
2389
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
2390
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
2343
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
2344
+ return evalContext[ast2.value]?.id;
2391
2345
  }
2392
- return (_c = evalContext[ast2.value]) != null ? _c : false;
2346
+ return evalContext[ast2.value] ?? false;
2393
2347
  } else if (ast2.value in BUILTINS) {
2394
2348
  return BUILTINS[ast2.value];
2395
2349
  } else {
@@ -2426,7 +2380,7 @@ function evaluate(ast, context = {}) {
2426
2380
  const args = ast2.args.map(_evaluate);
2427
2381
  const kwargs = {};
2428
2382
  for (const kwarg in ast2.kwargs) {
2429
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
2383
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
2430
2384
  }
2431
2385
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
2432
2386
  return fnValue.create(...args, kwargs);
@@ -2505,25 +2459,9 @@ function escapeRegExp(str) {
2505
2459
  var InvalidDomainError = class extends Error {
2506
2460
  };
2507
2461
  var Domain = class _Domain {
2508
- constructor(descr = []) {
2509
- this.ast = { type: -1, value: null };
2510
- if (descr instanceof _Domain) {
2511
- return new _Domain(descr.toString());
2512
- } else {
2513
- let rawAST;
2514
- try {
2515
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2516
- } catch (error) {
2517
- throw new InvalidDomainError(
2518
- `Invalid domain representation: ${descr}`,
2519
- {
2520
- cause: error
2521
- }
2522
- );
2523
- }
2524
- this.ast = normalizeDomainAST(rawAST);
2525
- }
2526
- }
2462
+ ast = { type: -1, value: null };
2463
+ static TRUE;
2464
+ static FALSE;
2527
2465
  static combine(domains, operator) {
2528
2466
  if (domains.length === 0) {
2529
2467
  return new _Domain([]);
@@ -2602,6 +2540,24 @@ var Domain = class _Domain {
2602
2540
  processLeaf(d.ast.value, 0, "&", newDomain);
2603
2541
  return newDomain;
2604
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
2555
+ }
2556
+ );
2557
+ }
2558
+ this.ast = normalizeDomainAST(rawAST);
2559
+ }
2560
+ }
2605
2561
  contains(record) {
2606
2562
  const expr = evaluate(this.ast, record);
2607
2563
  return matchDomain(record, expr);
@@ -2620,7 +2576,7 @@ var Domain = class _Domain {
2620
2576
  return evaluatedAsList;
2621
2577
  }
2622
2578
  return this.toString();
2623
- } catch (e) {
2579
+ } catch {
2624
2580
  return this.toString();
2625
2581
  }
2626
2582
  }
@@ -2820,834 +2776,481 @@ function matchDomain(record, domain) {
2820
2776
  }
2821
2777
 
2822
2778
  // src/utils/function.ts
2823
- var import_react = require("react");
2824
- var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2825
- if (!originalRequest.data) return originalRequest.data;
2826
- if (typeof originalRequest.data === "string") {
2827
- try {
2828
- const parsedData = JSON.parse(originalRequest.data);
2829
- if (parsedData.with_context && typeof parsedData.with_context === "object") {
2830
- parsedData.with_context.token = newAccessToken;
2831
- }
2832
- return JSON.stringify(parsedData);
2833
- } catch (e) {
2834
- console.warn("Failed to parse originalRequest.data", e);
2835
- return originalRequest.data;
2836
- }
2837
- }
2838
- if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
2839
- originalRequest.data.with_context.token = newAccessToken;
2840
- }
2841
- return originalRequest.data;
2842
- };
2843
-
2844
- // src/utils/storage/local-storage.ts
2845
- var localStorageUtils = () => {
2846
- const setToken = (access_token) => __async(null, null, function* () {
2847
- localStorage.setItem("accessToken", access_token);
2848
- });
2849
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2850
- localStorage.setItem("refreshToken", refresh_token);
2851
- });
2852
- const getAccessToken = () => __async(null, null, function* () {
2853
- return localStorage.getItem("accessToken");
2854
- });
2855
- const getRefreshToken = () => __async(null, null, function* () {
2856
- return localStorage.getItem("refreshToken");
2857
- });
2858
- const clearToken = () => __async(null, null, function* () {
2859
- localStorage.removeItem("accessToken");
2860
- localStorage.removeItem("refreshToken");
2861
- });
2862
- return {
2863
- setToken,
2864
- setRefreshToken,
2865
- getAccessToken,
2866
- getRefreshToken,
2867
- clearToken
2868
- };
2869
- };
2870
-
2871
- // src/utils/storage/session-storage.ts
2872
- var sessionStorageUtils = () => {
2873
- const getBrowserSession = () => __async(null, null, function* () {
2874
- return sessionStorage.getItem("browserSession");
2875
- });
2876
- return {
2877
- getBrowserSession
2878
- };
2879
- };
2880
-
2881
- // src/configs/axios-client.ts
2882
- var axiosClient = {
2883
- init(config) {
2884
- var _a, _b;
2885
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2886
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2887
- const db = config.db;
2888
- let isRefreshing = false;
2889
- let failedQueue = [];
2890
- const processQueue = (error, token = null) => {
2891
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2892
- if (error) {
2893
- prom.reject(error);
2894
- } else {
2895
- prom.resolve(token);
2896
- }
2897
- });
2898
- failedQueue = [];
2899
- };
2900
- const instance = import_axios.default.create({
2901
- adapter: import_axios.default.defaults.adapter,
2902
- baseURL: config.baseUrl,
2903
- timeout: 5e4,
2904
- paramsSerializer: (params) => new URLSearchParams(params).toString()
2905
- });
2906
- instance.interceptors.request.use(
2907
- (config2) => __async(null, null, function* () {
2908
- const useRefreshToken = config2.useRefreshToken;
2909
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2910
- if (token) {
2911
- config2.headers["Authorization"] = "Bearer " + token;
2912
- }
2913
- return config2;
2914
- }),
2915
- (error) => {
2916
- Promise.reject(error);
2917
- }
2918
- );
2919
- instance.interceptors.response.use(
2920
- (response) => {
2921
- return handleResponse(response);
2922
- },
2923
- (error) => __async(null, null, function* () {
2924
- var _a2, _b2, _c;
2925
- const handleError3 = (error2) => __async(null, null, function* () {
2926
- var _a3;
2927
- if (!error2.response) {
2928
- return error2;
2929
- }
2930
- const { data } = error2.response;
2931
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2932
- yield clearAuthToken();
2933
- }
2934
- return data;
2935
- });
2936
- const originalRequest = error.config;
2937
- if ((((_a2 = error.response) == null ? void 0 : _a2.status) === 403 || ((_b2 = error.response) == null ? void 0 : _b2.status) === 401 || ((_c = error.response) == null ? void 0 : _c.status) === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2938
- error.response.data.code
2939
- )) {
2940
- if (isRefreshing) {
2941
- return new Promise(function(resolve, reject) {
2942
- failedQueue.push({ resolve, reject });
2943
- }).then((token) => {
2944
- originalRequest.headers["Authorization"] = "Bearer " + token;
2945
- originalRequest.data = updateTokenParamInOriginalRequest(
2946
- originalRequest,
2947
- token
2948
- );
2949
- return instance.request(originalRequest);
2950
- }).catch((err) => __async(null, null, function* () {
2951
- var _a3, _b3;
2952
- if ((((_a3 = err.response) == null ? void 0 : _a3.status) === 400 || ((_b3 = err.response) == null ? void 0 : _b3.status) === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2953
- yield clearAuthToken();
2954
- }
2955
- }));
2956
- }
2957
- const browserSession = yield sessionStorage2.getBrowserSession();
2958
- const refreshToken = yield localStorage2.getRefreshToken();
2959
- const accessTokenExp = yield localStorage2.getAccessToken();
2960
- isRefreshing = true;
2961
- if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2962
- yield clearAuthToken();
2963
- } else {
2964
- const payload = Object.fromEntries(
2965
- Object.entries({
2966
- refresh_token: refreshToken,
2967
- grant_type: "refresh_token",
2968
- client_id: config.config.clientId,
2969
- client_secret: config.config.clientSecret
2970
- }).filter(([_, value]) => !!value)
2971
- );
2972
- return new Promise(function(resolve) {
2973
- var _a3;
2974
- import_axios.default.post(
2975
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2976
- payload,
2977
- {
2978
- headers: {
2979
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2980
- Authorization: `Bearer ${accessTokenExp}`
2981
- }
2982
- }
2983
- ).then((res) => __async(null, null, function* () {
2984
- const data = res.data;
2985
- yield localStorage2.setToken(data.access_token);
2986
- yield localStorage2.setRefreshToken(data.refresh_token);
2987
- import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2988
- originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2989
- originalRequest.data = updateTokenParamInOriginalRequest(
2990
- originalRequest,
2991
- data.access_token
2992
- );
2993
- processQueue(null, data.access_token);
2994
- resolve(instance.request(originalRequest));
2995
- })).catch((err) => __async(null, null, function* () {
2996
- var _a4;
2997
- if (err && ((err == null ? void 0 : err.error_code) === "AUTHEN_FAIL" || (err == null ? void 0 : err.error_code) === "TOKEN_EXPIRED" || (err == null ? void 0 : err.error_code) === "TOKEN_INCORRECT" || (err == null ? void 0 : err.code) === "ERR_BAD_REQUEST") || (err == null ? void 0 : err.error_code) === "ERR_2FA_006") {
2998
- yield clearAuthToken();
2999
- }
3000
- if (err && err.response) {
3001
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
3002
- if (error_code === "AUTHEN_FAIL") {
3003
- yield clearAuthToken();
3004
- }
3005
- }
3006
- processQueue(err, null);
3007
- })).finally(() => {
3008
- isRefreshing = false;
3009
- });
3010
- });
3011
- }
3012
- }
3013
- return Promise.reject(yield handleError3(error));
3014
- })
3015
- );
3016
- const handleResponse = (res) => {
3017
- if (res && res.data) {
3018
- return res.data;
3019
- }
3020
- return res;
3021
- };
3022
- const handleError2 = (error) => {
3023
- var _a2, _b2, _c;
3024
- if (error.isAxiosError && error.code === "ECONNABORTED") {
3025
- console.error("Request Timeout Error:", error);
3026
- return "Request Timeout Error";
3027
- } else if (error.isAxiosError && !error.response) {
3028
- console.error("Network Error:", error);
3029
- return "Network Error";
3030
- } else {
3031
- console.error("Other Error:", error == null ? void 0 : error.response);
3032
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
3033
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
3034
- }
3035
- };
3036
- const clearAuthToken = () => __async(null, null, function* () {
3037
- yield localStorage2.clearToken();
3038
- if (typeof window !== "undefined") {
3039
- window.location.href = `/login`;
3040
- }
3041
- });
3042
- function formatUrl(url, db2) {
3043
- return url + (db2 ? "?db=" + db2 : "");
3044
- }
3045
- const responseBody = (response) => response;
3046
- const requests = {
3047
- get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
3048
- post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
3049
- post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
3050
- responseType: "arraybuffer",
3051
- headers: {
3052
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
3053
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
3054
- }
3055
- }).then(responseBody),
3056
- put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
3057
- patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
3058
- delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
3059
- };
3060
- return requests;
3061
- }
3062
- };
2779
+ import { useEffect, useState } from "react";
3063
2780
 
3064
2781
  // src/environment/EnvStore.ts
3065
- var _EnvStore = class _EnvStore {
3066
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3067
- this.envStore = envStore2;
3068
- this.localStorageUtils = localStorageUtils2;
3069
- this.sessionStorageUtils = sessionStorageUtils2;
3070
- this.setup();
3071
- }
3072
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3073
- if (!_EnvStore.instance) {
3074
- _EnvStore.instance = new _EnvStore(
3075
- envStore2,
3076
- localStorageUtils2,
3077
- sessionStorageUtils2
3078
- );
3079
- }
3080
- return _EnvStore.instance;
3081
- }
3082
- setup() {
3083
- const env = this.envStore.getState().env;
3084
- this.baseUrl = env == null ? void 0 : env.baseUrl;
3085
- this.requests = env == null ? void 0 : env.requests;
3086
- this.context = env == null ? void 0 : env.context;
3087
- this.defaultCompany = env == null ? void 0 : env.defaultCompany;
3088
- this.config = env == null ? void 0 : env.config;
3089
- this.companies = (env == null ? void 0 : env.companies) || [];
3090
- this.user = env == null ? void 0 : env.user;
3091
- this.db = env == null ? void 0 : env.db;
3092
- this.refreshTokenEndpoint = env == null ? void 0 : env.refreshTokenEndpoint;
3093
- console.log("Env setup:", this);
3094
- }
3095
- setupEnv(envConfig) {
3096
- const dispatch = this.envStore.dispatch;
3097
- const env = __spreadProps(__spreadValues({}, envConfig), {
3098
- localStorageUtils: this.localStorageUtils,
3099
- sessionStorageUtils: this.sessionStorageUtils
3100
- });
3101
- const requests = axiosClient.init(env);
3102
- dispatch(setEnv(__spreadProps(__spreadValues({}, env), { requests })));
3103
- this.setup();
3104
- }
3105
- setUid(uid) {
3106
- const dispatch = this.envStore.dispatch;
3107
- dispatch(setUid(uid));
3108
- this.setup();
3109
- }
3110
- setLang(lang) {
3111
- const dispatch = this.envStore.dispatch;
3112
- dispatch(setLang(lang));
3113
- this.setup();
3114
- }
3115
- setAllowCompanies(allowCompanies) {
3116
- const dispatch = this.envStore.dispatch;
3117
- dispatch(setAllowCompanies(allowCompanies));
3118
- this.setup();
3119
- }
3120
- setCompanies(companies) {
3121
- const dispatch = this.envStore.dispatch;
3122
- dispatch(setCompanies(companies));
3123
- this.setup();
3124
- }
3125
- setDefaultCompany(company) {
3126
- const dispatch = this.envStore.dispatch;
3127
- dispatch(setDefaultCompany(company));
3128
- this.setup();
3129
- }
3130
- setUserInfo(userInfo) {
3131
- const dispatch = this.envStore.dispatch;
3132
- dispatch(setUser(userInfo));
3133
- this.setup();
3134
- }
3135
- };
3136
- _EnvStore.instance = null;
3137
- var EnvStore = _EnvStore;
3138
2782
  function getEnv() {
3139
- const instance = EnvStore.getInstance(envStore);
3140
- if (!instance) {
3141
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3142
- }
3143
- return instance;
2783
+ console.log("getEnv", envStore.getState().env);
2784
+ return envStore.getState().env;
3144
2785
  }
3145
2786
 
3146
2787
  // src/services/view-service/index.ts
3147
2788
  var ViewService = {
3148
- getView(_0) {
3149
- return __async(this, arguments, function* ({
2789
+ async getView({
2790
+ model,
2791
+ views,
2792
+ context = {},
2793
+ options = {},
2794
+ aid
2795
+ }) {
2796
+ const env = getEnv();
2797
+ const defaultOptions = {
2798
+ load_filters: true,
2799
+ toolbar: true,
2800
+ action_id: aid
2801
+ };
2802
+ const jsonDataView = {
3150
2803
  model,
3151
- views,
3152
- context = {},
3153
- options = {},
3154
- aid
3155
- }) {
3156
- var _a;
3157
- const env = getEnv();
3158
- const defaultOptions = {
3159
- load_filters: true,
3160
- toolbar: true,
3161
- action_id: aid
3162
- };
3163
- const jsonDataView = {
3164
- model,
3165
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
3166
- kwargs: {
3167
- views,
3168
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
3169
- },
3170
- with_context: context
3171
- };
3172
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
3173
- headers: {
3174
- "Content-Type": "application/json"
3175
- }
3176
- });
2804
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
2805
+ kwargs: {
2806
+ views,
2807
+ options: { ...options, ...defaultOptions }
2808
+ },
2809
+ with_context: context
2810
+ };
2811
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
2812
+ headers: {
2813
+ "Content-Type": "application/json"
2814
+ }
3177
2815
  });
3178
2816
  },
3179
- getMenu(context) {
3180
- return __async(this, null, function* () {
3181
- var _a;
3182
- const env = getEnv();
3183
- const jsonData = {
3184
- model: "ir.ui.menu" /* MENU */,
3185
- method: "web_search_read" /* WEB_SEARCH_READ */,
3186
- ids: [],
3187
- with_context: context,
3188
- kwargs: {
3189
- specification: {
3190
- active: {},
3191
- name: {},
3192
- is_display: {},
3193
- sequence: {},
3194
- complete_name: {},
3195
- action: {
3196
- fields: {
3197
- display_name: {},
3198
- type: {},
3199
- binding_view_types: {}
3200
- // res_model: {},
3201
- }
2817
+ async getMenu(context) {
2818
+ const env = getEnv();
2819
+ const jsonData = {
2820
+ model: "ir.ui.menu" /* MENU */,
2821
+ method: "web_search_read" /* WEB_SEARCH_READ */,
2822
+ ids: [],
2823
+ with_context: context,
2824
+ kwargs: {
2825
+ specification: {
2826
+ active: {},
2827
+ name: {},
2828
+ is_display: {},
2829
+ sequence: {},
2830
+ complete_name: {},
2831
+ action: {
2832
+ fields: {
2833
+ display_name: {},
2834
+ type: {},
2835
+ binding_view_types: {}
2836
+ // res_model: {},
2837
+ }
2838
+ },
2839
+ url_icon: {},
2840
+ web_icon: {},
2841
+ web_icon_data: {},
2842
+ groups_id: {
2843
+ fields: {
2844
+ full_name: {}
3202
2845
  },
3203
- url_icon: {},
3204
- web_icon: {},
3205
- web_icon_data: {},
3206
- groups_id: {
3207
- fields: {
3208
- full_name: {}
2846
+ limit: 40,
2847
+ order: ""
2848
+ },
2849
+ display_name: {},
2850
+ child_id: {
2851
+ fields: {
2852
+ active: {},
2853
+ name: {},
2854
+ is_display: {},
2855
+ sequence: {},
2856
+ complete_name: {},
2857
+ action: {
2858
+ fields: {
2859
+ display_name: {},
2860
+ type: {},
2861
+ binding_view_types: {}
2862
+ // res_model: {},
2863
+ }
3209
2864
  },
3210
- limit: 40,
3211
- order: ""
3212
- },
3213
- display_name: {},
3214
- child_id: {
3215
- fields: {
3216
- active: {},
3217
- name: {},
3218
- is_display: {},
3219
- sequence: {},
3220
- complete_name: {},
3221
- action: {
3222
- fields: {
3223
- display_name: {},
3224
- type: {},
3225
- binding_view_types: {}
3226
- // res_model: {},
3227
- }
2865
+ url_icon: {},
2866
+ web_icon: {},
2867
+ web_icon_data: {},
2868
+ groups_id: {
2869
+ fields: {
2870
+ full_name: {}
3228
2871
  },
3229
- url_icon: {},
3230
- web_icon: {},
3231
- web_icon_data: {},
3232
- groups_id: {
3233
- fields: {
3234
- full_name: {}
2872
+ limit: 40,
2873
+ order: ""
2874
+ },
2875
+ display_name: {},
2876
+ child_id: {
2877
+ fields: {
2878
+ active: {},
2879
+ name: {},
2880
+ is_display: {},
2881
+ sequence: {},
2882
+ complete_name: {},
2883
+ action: {
2884
+ fields: {
2885
+ display_name: {},
2886
+ type: {},
2887
+ binding_view_types: {}
2888
+ // res_model: {},
2889
+ }
3235
2890
  },
3236
- limit: 40,
3237
- order: ""
3238
- },
3239
- display_name: {},
3240
- child_id: {
3241
- fields: {
3242
- active: {},
3243
- name: {},
3244
- is_display: {},
3245
- sequence: {},
3246
- complete_name: {},
3247
- action: {
3248
- fields: {
3249
- display_name: {},
3250
- type: {},
3251
- binding_view_types: {}
3252
- // res_model: {},
3253
- }
2891
+ url_icon: {},
2892
+ web_icon: {},
2893
+ web_icon_data: {},
2894
+ groups_id: {
2895
+ fields: {
2896
+ full_name: {}
3254
2897
  },
3255
- url_icon: {},
3256
- web_icon: {},
3257
- web_icon_data: {},
3258
- groups_id: {
3259
- fields: {
3260
- full_name: {}
2898
+ limit: 40,
2899
+ order: ""
2900
+ },
2901
+ display_name: {},
2902
+ child_id: {
2903
+ fields: {
2904
+ active: {},
2905
+ name: {},
2906
+ is_display: {},
2907
+ sequence: {},
2908
+ complete_name: {},
2909
+ action: {
2910
+ fields: {
2911
+ display_name: {},
2912
+ type: {},
2913
+ binding_view_types: {}
2914
+ // res_model: {},
2915
+ }
3261
2916
  },
3262
- limit: 40,
3263
- order: ""
3264
- },
3265
- display_name: {},
3266
- child_id: {
3267
- fields: {
3268
- active: {},
3269
- name: {},
3270
- is_display: {},
3271
- sequence: {},
3272
- complete_name: {},
3273
- action: {
3274
- fields: {
3275
- display_name: {},
3276
- type: {},
3277
- binding_view_types: {}
3278
- // res_model: {},
3279
- }
3280
- },
3281
- url_icon: {},
3282
- web_icon: {},
3283
- web_icon_data: {},
3284
- groups_id: {
3285
- fields: {
3286
- full_name: {}
3287
- },
3288
- limit: 40,
3289
- order: ""
2917
+ url_icon: {},
2918
+ web_icon: {},
2919
+ web_icon_data: {},
2920
+ groups_id: {
2921
+ fields: {
2922
+ full_name: {}
3290
2923
  },
3291
- display_name: {},
3292
- child_id: {
3293
- fields: {},
3294
- limit: 40,
3295
- order: ""
3296
- }
2924
+ limit: 40,
2925
+ order: ""
3297
2926
  },
3298
- limit: 40,
3299
- order: ""
3300
- }
3301
- },
3302
- limit: 40,
3303
- order: ""
3304
- }
3305
- },
3306
- limit: 40,
3307
- order: ""
3308
- }
3309
- },
3310
- domain: [
3311
- "&",
3312
- ["is_display", "=", true],
3313
- "&",
3314
- ["active", "=", true],
3315
- ["parent_id", "=", false]
3316
- ]
3317
- }
3318
- };
3319
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3320
- headers: {
3321
- "Content-Type": "application/json"
3322
- }
3323
- });
2927
+ display_name: {},
2928
+ child_id: {
2929
+ fields: {},
2930
+ limit: 40,
2931
+ order: ""
2932
+ }
2933
+ },
2934
+ limit: 40,
2935
+ order: ""
2936
+ }
2937
+ },
2938
+ limit: 40,
2939
+ order: ""
2940
+ }
2941
+ },
2942
+ limit: 40,
2943
+ order: ""
2944
+ }
2945
+ },
2946
+ domain: [
2947
+ "&",
2948
+ ["is_display", "=", true],
2949
+ "&",
2950
+ ["active", "=", true],
2951
+ ["parent_id", "=", false]
2952
+ ]
2953
+ }
2954
+ };
2955
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
2956
+ headers: {
2957
+ "Content-Type": "application/json"
2958
+ }
3324
2959
  });
3325
2960
  },
3326
- getActionDetail(aid, context) {
3327
- return __async(this, null, function* () {
3328
- var _a;
3329
- const env = getEnv();
3330
- const jsonData = {
3331
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
3332
- method: "web_read" /* WEB_READ */,
3333
- ids: [aid],
3334
- with_context: context,
3335
- kwargs: {
3336
- specification: {
3337
- id: {},
3338
- name: {},
3339
- res_model: {},
3340
- views: {},
3341
- view_mode: {},
3342
- mobile_view_mode: {},
3343
- domain: {},
3344
- context: {},
3345
- groups_id: {},
3346
- search_view_id: {}
3347
- }
2961
+ async getActionDetail(aid, context) {
2962
+ const env = getEnv();
2963
+ const jsonData = {
2964
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
2965
+ method: "web_read" /* WEB_READ */,
2966
+ ids: [aid],
2967
+ with_context: context,
2968
+ kwargs: {
2969
+ specification: {
2970
+ id: {},
2971
+ name: {},
2972
+ res_model: {},
2973
+ views: {},
2974
+ view_mode: {},
2975
+ mobile_view_mode: {},
2976
+ domain: {},
2977
+ context: {},
2978
+ groups_id: {},
2979
+ search_view_id: {}
3348
2980
  }
3349
- };
3350
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3351
- headers: {
3352
- "Content-Type": "application/json"
3353
- }
3354
- });
2981
+ }
2982
+ };
2983
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
2984
+ headers: {
2985
+ "Content-Type": "application/json"
2986
+ }
3355
2987
  });
3356
2988
  },
3357
- getResequence(_0) {
3358
- return __async(this, arguments, function* ({
2989
+ async getResequence({
2990
+ model,
2991
+ ids,
2992
+ context,
2993
+ offset
2994
+ }) {
2995
+ const env = getEnv();
2996
+ const jsonData = {
3359
2997
  model,
2998
+ with_context: context,
3360
2999
  ids,
3361
- context,
3362
- offset
3363
- }) {
3364
- const env = getEnv();
3365
- const jsonData = __spreadValues({
3366
- model,
3367
- with_context: context,
3368
- ids,
3369
- field: "sequence"
3370
- }, offset > 0 ? { offset } : {});
3371
- return env == null ? void 0 : env.requests.post("/web/dataset/resequence", jsonData, {
3372
- headers: {
3373
- "Content-Type": "application/json"
3374
- }
3375
- });
3376
- });
3377
- },
3378
- getSelectionItem(_0) {
3379
- return __async(this, arguments, function* ({ data }) {
3380
- var _a;
3381
- const env = getEnv();
3382
- const jsonData = {
3383
- model: data.model,
3384
- ids: [],
3385
- method: "get_data_select",
3386
- with_context: data.context,
3387
- kwargs: {
3388
- count_limit: 10001,
3389
- domain: data.domain ? data.domain : [],
3390
- offset: 0,
3391
- order: "",
3392
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
3393
- id: {},
3394
- name: {},
3395
- display_name: {}
3396
- }
3397
- }
3398
- };
3399
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3400
- headers: {
3401
- "Content-Type": "application/json"
3402
- }
3403
- });
3000
+ field: "sequence",
3001
+ ...offset > 0 ? { offset } : {}
3002
+ };
3003
+ return env?.requests.post("/web/dataset/resequence", jsonData, {
3004
+ headers: {
3005
+ "Content-Type": "application/json"
3006
+ }
3404
3007
  });
3405
3008
  },
3406
- loadMessages() {
3407
- return __async(this, null, function* () {
3408
- const env = getEnv();
3409
- return env.requests.post(
3410
- "/load_message_failures" /* LOAD_MESSAGE */,
3411
- {},
3412
- {
3413
- headers: {
3414
- "Content-Type": "application/json"
3415
- }
3009
+ async getSelectionItem({ data }) {
3010
+ const env = getEnv();
3011
+ const jsonData = {
3012
+ model: data.model,
3013
+ ids: [],
3014
+ method: "get_data_select",
3015
+ with_context: data.context,
3016
+ kwargs: {
3017
+ count_limit: 10001,
3018
+ domain: data.domain ? data.domain : [],
3019
+ offset: 0,
3020
+ order: "",
3021
+ specification: data?.specification ?? {
3022
+ id: {},
3023
+ name: {},
3024
+ display_name: {}
3416
3025
  }
3417
- );
3026
+ }
3027
+ };
3028
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3029
+ headers: {
3030
+ "Content-Type": "application/json"
3031
+ }
3418
3032
  });
3419
3033
  },
3420
- getVersion() {
3421
- return __async(this, null, function* () {
3422
- var _a;
3423
- const env = getEnv();
3424
- console.log("env?.requests", env, env == null ? void 0 : env.requests);
3425
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.get("", {
3034
+ async loadMessages() {
3035
+ const env = getEnv();
3036
+ return env.requests.post(
3037
+ "/load_message_failures" /* LOAD_MESSAGE */,
3038
+ {},
3039
+ {
3426
3040
  headers: {
3427
3041
  "Content-Type": "application/json"
3428
3042
  }
3429
- });
3043
+ }
3044
+ );
3045
+ },
3046
+ async getVersion() {
3047
+ const env = getEnv();
3048
+ return env?.requests.get("", {
3049
+ headers: {
3050
+ "Content-Type": "application/json"
3051
+ }
3430
3052
  });
3431
3053
  },
3432
- get2FAMethods(_0) {
3433
- return __async(this, arguments, function* ({
3054
+ async get2FAMethods({
3055
+ method,
3056
+ with_context
3057
+ }) {
3058
+ const env = getEnv();
3059
+ const jsonData = {
3434
3060
  method,
3435
3061
  with_context
3436
- }) {
3437
- const env = getEnv();
3438
- const jsonData = {
3439
- method,
3440
- with_context
3441
- };
3442
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3443
- headers: {
3444
- "Content-Type": "application/json"
3445
- }
3446
- });
3062
+ };
3063
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3064
+ headers: {
3065
+ "Content-Type": "application/json"
3066
+ }
3447
3067
  });
3448
3068
  },
3449
- verify2FA(_0) {
3450
- return __async(this, arguments, function* ({
3069
+ async verify2FA({
3070
+ method,
3071
+ with_context,
3072
+ code,
3073
+ device,
3074
+ location
3075
+ }) {
3076
+ const env = getEnv();
3077
+ const jsonData = {
3451
3078
  method,
3452
- with_context,
3453
- code,
3454
- device,
3455
- location
3456
- }) {
3457
- const env = getEnv();
3458
- const jsonData = {
3459
- method,
3460
- kwargs: {
3461
- vals: {
3462
- code,
3463
- device,
3464
- location
3465
- }
3466
- },
3467
- with_context
3468
- };
3469
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3470
- headers: {
3471
- "Content-Type": "application/json"
3472
- },
3473
- withCredentials: true
3474
- });
3079
+ kwargs: {
3080
+ vals: {
3081
+ code,
3082
+ device,
3083
+ location
3084
+ }
3085
+ },
3086
+ with_context
3087
+ };
3088
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3089
+ headers: {
3090
+ "Content-Type": "application/json"
3091
+ },
3092
+ withCredentials: true
3475
3093
  });
3476
3094
  },
3477
- signInSSO(_0) {
3478
- return __async(this, arguments, function* ({
3479
- redirect_uri,
3480
- state,
3481
- client_id,
3095
+ async signInSSO({
3096
+ redirect_uri,
3097
+ state,
3098
+ client_id,
3099
+ response_type,
3100
+ path
3101
+ }) {
3102
+ const env = getEnv();
3103
+ const params = new URLSearchParams({
3482
3104
  response_type,
3483
- path
3484
- }) {
3485
- const env = getEnv();
3486
- const params = new URLSearchParams({
3487
- response_type,
3488
- client_id,
3489
- redirect_uri,
3490
- state
3491
- });
3492
- const url = `${path}?${params.toString()}`;
3493
- return env == null ? void 0 : env.requests.get(url, {
3494
- headers: {
3495
- "Content-Type": "application/json"
3496
- },
3497
- withCredentials: true
3498
- });
3105
+ client_id,
3106
+ redirect_uri,
3107
+ state
3108
+ });
3109
+ const url = `${path}?${params.toString()}`;
3110
+ return env?.requests.get(url, {
3111
+ headers: {
3112
+ "Content-Type": "application/json"
3113
+ },
3114
+ withCredentials: true
3499
3115
  });
3500
3116
  },
3501
- grantAccess(_0) {
3502
- return __async(this, arguments, function* ({
3117
+ async grantAccess({
3118
+ redirect_uri,
3119
+ state,
3120
+ client_id,
3121
+ scopes
3122
+ }) {
3123
+ const env = getEnv();
3124
+ const jsonData = {
3503
3125
  redirect_uri,
3504
3126
  state,
3505
3127
  client_id,
3506
3128
  scopes
3507
- }) {
3508
- const env = getEnv();
3509
- const jsonData = {
3510
- redirect_uri,
3511
- state,
3512
- client_id,
3513
- scopes
3514
- };
3515
- return env == null ? void 0 : env.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3516
- headers: {
3517
- "Content-Type": "application/json"
3518
- },
3519
- withCredentials: true
3520
- });
3129
+ };
3130
+ return env?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3131
+ headers: {
3132
+ "Content-Type": "application/json"
3133
+ },
3134
+ withCredentials: true
3521
3135
  });
3522
3136
  },
3523
- getFieldsViewSecurity(_0) {
3524
- return __async(this, arguments, function* ({
3137
+ async getFieldsViewSecurity({
3138
+ method,
3139
+ token,
3140
+ views
3141
+ }) {
3142
+ const env = getEnv();
3143
+ const jsonData = {
3525
3144
  method,
3526
- token,
3527
- views
3528
- }) {
3529
- const env = getEnv();
3530
- const jsonData = {
3531
- method,
3532
- kwargs: {
3533
- views
3534
- },
3535
- with_context: {
3536
- token
3537
- }
3538
- };
3539
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3540
- headers: {
3541
- "Content-Type": "application/json"
3542
- }
3543
- });
3145
+ kwargs: {
3146
+ views
3147
+ },
3148
+ with_context: {
3149
+ token
3150
+ }
3151
+ };
3152
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3153
+ headers: {
3154
+ "Content-Type": "application/json"
3155
+ }
3544
3156
  });
3545
3157
  },
3546
- settingsWebRead2fa(_0) {
3547
- return __async(this, arguments, function* ({
3158
+ async settingsWebRead2fa({
3159
+ method,
3160
+ model,
3161
+ kwargs,
3162
+ token
3163
+ }) {
3164
+ const env = getEnv();
3165
+ const jsonData = {
3548
3166
  method,
3549
3167
  model,
3550
3168
  kwargs,
3551
- token
3552
- }) {
3553
- const env = getEnv();
3554
- const jsonData = {
3555
- method,
3556
- model,
3557
- kwargs,
3558
- with_context: {
3559
- token
3560
- }
3561
- };
3562
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3563
- headers: {
3564
- "Content-Type": "application/json"
3565
- }
3566
- });
3169
+ with_context: {
3170
+ token
3171
+ }
3172
+ };
3173
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3174
+ headers: {
3175
+ "Content-Type": "application/json"
3176
+ }
3567
3177
  });
3568
3178
  },
3569
- requestSetupTotp(_0) {
3570
- return __async(this, arguments, function* ({ method, token }) {
3571
- const env = getEnv();
3572
- const jsonData = {
3573
- method,
3574
- with_context: {
3575
- token
3576
- }
3577
- };
3578
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3579
- headers: {
3580
- "Content-Type": "application/json"
3581
- }
3582
- });
3179
+ async requestSetupTotp({ method, token }) {
3180
+ const env = getEnv();
3181
+ const jsonData = {
3182
+ method,
3183
+ with_context: {
3184
+ token
3185
+ }
3186
+ };
3187
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3188
+ headers: {
3189
+ "Content-Type": "application/json"
3190
+ }
3583
3191
  });
3584
3192
  },
3585
- verifyTotp(_0) {
3586
- return __async(this, arguments, function* ({
3193
+ async verifyTotp({
3194
+ method,
3195
+ action_token,
3196
+ code
3197
+ }) {
3198
+ const env = getEnv();
3199
+ const jsonData = {
3587
3200
  method,
3588
- action_token,
3589
- code
3590
- }) {
3591
- const env = getEnv();
3592
- const jsonData = {
3593
- method,
3594
- kwargs: {
3595
- vals: {
3596
- code
3597
- }
3598
- },
3599
- with_context: {
3600
- action_token
3201
+ kwargs: {
3202
+ vals: {
3203
+ code
3601
3204
  }
3602
- };
3603
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3604
- headers: {
3605
- "Content-Type": "application/json"
3606
- }
3607
- });
3205
+ },
3206
+ with_context: {
3207
+ action_token
3208
+ }
3209
+ };
3210
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3211
+ headers: {
3212
+ "Content-Type": "application/json"
3213
+ }
3608
3214
  });
3609
3215
  },
3610
- removeTotpSetUp(_0) {
3611
- return __async(this, arguments, function* ({ method, token }) {
3612
- const env = getEnv();
3613
- const jsonData = {
3614
- method,
3615
- with_context: {
3616
- token
3617
- }
3618
- };
3619
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3620
- headers: {
3621
- "Content-Type": "application/json"
3622
- }
3623
- });
3216
+ async removeTotpSetUp({ method, token }) {
3217
+ const env = getEnv();
3218
+ const jsonData = {
3219
+ method,
3220
+ with_context: {
3221
+ token
3222
+ }
3223
+ };
3224
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3225
+ headers: {
3226
+ "Content-Type": "application/json"
3227
+ }
3624
3228
  });
3625
3229
  }
3626
3230
  };
3627
3231
  var view_service_default = ViewService;
3628
3232
 
3629
3233
  // src/provider/version-gate-provider.tsx
3630
- var import_jsx_runtime4 = require("react/jsx-runtime");
3234
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
3631
3235
  var VersionGate = ({ children }) => {
3632
- const queryClient = (0, import_react_query2.useQueryClient)();
3633
- const [ready, setReady] = (0, import_react2.useState)(false);
3634
- (0, import_react2.useEffect)(() => {
3236
+ const queryClient = useQueryClient();
3237
+ const [ready, setReady] = useState2(false);
3238
+ useEffect2(() => {
3635
3239
  const clearVersion = () => {
3636
3240
  queryClient.clear();
3637
3241
  localStorage.removeItem("__api_version__");
3638
3242
  };
3639
- const validateVersion = () => __async(null, null, function* () {
3640
- const serverVersion = yield view_service_default.getVersion();
3641
- console.log("serverVersion", serverVersion);
3243
+ const validateVersion = async () => {
3244
+ const serverVersion = await view_service_default.getVersion();
3642
3245
  const cached = localStorage.getItem("__api_version__");
3643
- if (cached !== (serverVersion == null ? void 0 : serverVersion.api_version)) {
3246
+ if (cached !== serverVersion?.api_version) {
3644
3247
  clearVersion();
3645
- localStorage.setItem("__api_version__", serverVersion == null ? void 0 : serverVersion.api_version);
3248
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
3646
3249
  } else {
3647
- console.log("Api version:", serverVersion == null ? void 0 : serverVersion.api_version);
3250
+ console.log("Api version:", serverVersion?.api_version);
3648
3251
  }
3649
3252
  setReady(true);
3650
- });
3253
+ };
3651
3254
  validateVersion();
3652
3255
  if (typeof window !== "undefined") {
3653
3256
  const onKey = (e) => {
@@ -3659,11 +3262,10 @@ var VersionGate = ({ children }) => {
3659
3262
  return () => window.removeEventListener("keydown", onKey);
3660
3263
  }
3661
3264
  }, [queryClient]);
3662
- return ready ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children }) : null;
3265
+ return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
3663
3266
  };
3664
- // Annotate the CommonJS export names for ESM import in node:
3665
- 0 && (module.exports = {
3267
+ export {
3666
3268
  MainProvider,
3667
3269
  ReactQueryProvider,
3668
3270
  VersionGate
3669
- });
3271
+ };