@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
package/dist/provider.js CHANGED
@@ -1,49 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
1
3
  var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __pow = Math.pow;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
19
11
  };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __async = (__this, __arguments, generator) => {
22
- return new Promise((resolve, reject) => {
23
- var fulfilled = (value) => {
24
- try {
25
- step(generator.next(value));
26
- } catch (e) {
27
- reject(e);
28
- }
29
- };
30
- var rejected = (value) => {
31
- try {
32
- step(generator.throw(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
38
- step((generator = generator.apply(__this, __arguments)).next());
39
- });
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
40
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/provider.ts
31
+ var provider_exports = {};
32
+ __export(provider_exports, {
33
+ MainProvider: () => MainProvider,
34
+ ReactQueryProvider: () => ReactQueryProvider,
35
+ VersionGate: () => VersionGate
36
+ });
37
+ module.exports = __toCommonJS(provider_exports);
41
38
 
42
39
  // src/provider/react-query-provider.tsx
43
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
44
- import { jsx } from "react/jsx-runtime";
40
+ var import_react_query = require("@tanstack/react-query");
41
+ var import_jsx_runtime = require("react/jsx-runtime");
45
42
  var ReactQueryProvider = ({ children }) => {
46
- const queryClient = new QueryClient({
43
+ const queryClient = new import_react_query.QueryClient({
47
44
  defaultOptions: {
48
45
  queries: {
49
46
  // placeholderData: keepPreviousData,
@@ -54,21 +51,21 @@ var ReactQueryProvider = ({ children }) => {
54
51
  }
55
52
  }
56
53
  });
57
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children });
58
55
  };
59
56
 
60
57
  // src/provider/redux-provider.tsx
61
- import { Provider } from "react-redux";
58
+ var import_react_redux2 = require("react-redux");
62
59
 
63
60
  // src/store/index.ts
64
- import { useDispatch, useSelector } from "react-redux";
61
+ var import_react_redux = require("react-redux");
65
62
 
66
63
  // src/store/reducers/breadcrums-slice/index.ts
67
- import { createSlice } from "@reduxjs/toolkit";
64
+ var import_toolkit = require("@reduxjs/toolkit");
68
65
  var initialState = {
69
66
  breadCrumbs: []
70
67
  };
71
- var breadcrumbsSlice = createSlice({
68
+ var breadcrumbsSlice = (0, import_toolkit.createSlice)({
72
69
  name: "breadcrumbs",
73
70
  initialState,
74
71
  reducers: {
@@ -81,14 +78,28 @@ var { setBreadCrumbs } = breadcrumbsSlice.actions;
81
78
  var breadcrums_slice_default = breadcrumbsSlice.reducer;
82
79
 
83
80
  // src/store/reducers/env-slice/index.ts
84
- import { createSlice as createSlice2 } from "@reduxjs/toolkit";
81
+ var import_toolkit2 = require("@reduxjs/toolkit");
85
82
  var initialState2 = {
86
83
  baseUrl: "",
87
- requests: null,
88
84
  companies: [],
89
85
  user: {},
90
- config: null,
86
+ db: "",
87
+ refreshTokenEndpoint: "",
88
+ config: {
89
+ grantType: "",
90
+ clientId: "",
91
+ clientSecret: "",
92
+ redirectUri: ""
93
+ },
91
94
  envFile: null,
95
+ requests: {
96
+ get: async (url, headers) => ({}),
97
+ post: async (url, body, headers) => ({}),
98
+ post_excel: async (url, body, headers) => ({}),
99
+ put: async (url, body, headers) => ({}),
100
+ patch: async (url, body) => ({}),
101
+ delete: async (url, body) => ({})
102
+ },
92
103
  defaultCompany: {
93
104
  id: null,
94
105
  logo: "",
@@ -102,7 +113,7 @@ var initialState2 = {
102
113
  tz: "Asia/Saigon"
103
114
  }
104
115
  };
105
- var envSlice = createSlice2({
116
+ var envSlice = (0, import_toolkit2.createSlice)({
106
117
  name: "env",
107
118
  initialState: initialState2,
108
119
  reducers: {
@@ -149,7 +160,7 @@ var {
149
160
  var env_slice_default = envSlice.reducer;
150
161
 
151
162
  // src/store/reducers/excel-slice/index.ts
152
- import { createSlice as createSlice3 } from "@reduxjs/toolkit";
163
+ var import_toolkit3 = require("@reduxjs/toolkit");
153
164
  var initialState3 = {
154
165
  dataParse: null,
155
166
  idFile: null,
@@ -158,7 +169,7 @@ var initialState3 = {
158
169
  selectedFile: null,
159
170
  errorData: null
160
171
  };
161
- var excelSlice = createSlice3({
172
+ var excelSlice = (0, import_toolkit3.createSlice)({
162
173
  name: "excel",
163
174
  initialState: initialState3,
164
175
  reducers: {
@@ -193,7 +204,7 @@ var {
193
204
  var excel_slice_default = excelSlice.reducer;
194
205
 
195
206
  // src/store/reducers/form-slice/index.ts
196
- import { createSlice as createSlice4 } from "@reduxjs/toolkit";
207
+ var import_toolkit4 = require("@reduxjs/toolkit");
197
208
  var initialState4 = {
198
209
  viewDataStore: {},
199
210
  isShowingModalDetail: false,
@@ -203,7 +214,7 @@ var initialState4 = {
203
214
  listSubject: {},
204
215
  dataUser: {}
205
216
  };
206
- var formSlice = createSlice4({
217
+ var formSlice = (0, import_toolkit4.createSlice)({
207
218
  name: "form",
208
219
  initialState: initialState4,
209
220
  reducers: {
@@ -242,15 +253,15 @@ var {
242
253
  var form_slice_default = formSlice.reducer;
243
254
 
244
255
  // src/store/reducers/header-slice/index.ts
245
- import { createSlice as createSlice5 } from "@reduxjs/toolkit";
246
- var headerSlice = createSlice5({
256
+ var import_toolkit5 = require("@reduxjs/toolkit");
257
+ var headerSlice = (0, import_toolkit5.createSlice)({
247
258
  name: "header",
248
259
  initialState: {
249
260
  value: { allowedCompanyIds: [] }
250
261
  },
251
262
  reducers: {
252
263
  setHeader: (state, action) => {
253
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
264
+ state.value = { ...state.value, ...action.payload };
254
265
  },
255
266
  setAllowedCompanyIds: (state, action) => {
256
267
  state.value.allowedCompanyIds = action.payload;
@@ -261,7 +272,7 @@ var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
261
272
  var header_slice_default = headerSlice.reducer;
262
273
 
263
274
  // src/store/reducers/list-slice/index.ts
264
- import { createSlice as createSlice6 } from "@reduxjs/toolkit";
275
+ var import_toolkit6 = require("@reduxjs/toolkit");
265
276
  var initialState5 = {
266
277
  pageLimit: 10,
267
278
  fields: {},
@@ -275,7 +286,7 @@ var initialState5 = {
275
286
  page: 0,
276
287
  domainTable: []
277
288
  };
278
- var listSlice = createSlice6({
289
+ var listSlice = (0, import_toolkit6.createSlice)({
279
290
  name: "list",
280
291
  initialState: initialState5,
281
292
  reducers: {
@@ -326,13 +337,13 @@ var {
326
337
  var list_slice_default = listSlice.reducer;
327
338
 
328
339
  // src/store/reducers/login-slice/index.ts
329
- import { createSlice as createSlice7 } from "@reduxjs/toolkit";
340
+ var import_toolkit7 = require("@reduxjs/toolkit");
330
341
  var initialState6 = {
331
342
  db: "",
332
343
  redirectTo: "/",
333
344
  forgotPasswordUrl: "/"
334
345
  };
335
- var loginSlice = createSlice7({
346
+ var loginSlice = (0, import_toolkit7.createSlice)({
336
347
  name: "login",
337
348
  initialState: initialState6,
338
349
  reducers: {
@@ -351,14 +362,14 @@ var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
351
362
  var login_slice_default = loginSlice.reducer;
352
363
 
353
364
  // src/store/reducers/navbar-slice/index.ts
354
- import { createSlice as createSlice8 } from "@reduxjs/toolkit";
365
+ var import_toolkit8 = require("@reduxjs/toolkit");
355
366
  var initialState7 = {
356
367
  menuFocus: {},
357
368
  menuAction: {},
358
369
  navbarWidth: 250,
359
370
  menuList: []
360
371
  };
361
- var navbarSlice = createSlice8({
372
+ var navbarSlice = (0, import_toolkit8.createSlice)({
362
373
  name: "navbar",
363
374
  initialState: initialState7,
364
375
  reducers: {
@@ -380,11 +391,11 @@ var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSl
380
391
  var navbar_slice_default = navbarSlice.reducer;
381
392
 
382
393
  // src/store/reducers/profile-slice/index.ts
383
- import { createSlice as createSlice9 } from "@reduxjs/toolkit";
394
+ var import_toolkit9 = require("@reduxjs/toolkit");
384
395
  var initialState8 = {
385
396
  profile: {}
386
397
  };
387
- var profileSlice = createSlice9({
398
+ var profileSlice = (0, import_toolkit9.createSlice)({
388
399
  name: "profile",
389
400
  initialState: initialState8,
390
401
  reducers: {
@@ -397,7 +408,7 @@ var { setProfile } = profileSlice.actions;
397
408
  var profile_slice_default = profileSlice.reducer;
398
409
 
399
410
  // src/store/reducers/search-slice/index.ts
400
- import { createSlice as createSlice10 } from "@reduxjs/toolkit";
411
+ var import_toolkit10 = require("@reduxjs/toolkit");
401
412
  var initialState9 = {
402
413
  groupByDomain: null,
403
414
  searchBy: [],
@@ -409,7 +420,7 @@ var initialState9 = {
409
420
  filterBy: [],
410
421
  groupBy: []
411
422
  };
412
- var searchSlice = createSlice10({
423
+ var searchSlice = (0, import_toolkit10.createSlice)({
413
424
  name: "search",
414
425
  initialState: initialState9,
415
426
  reducers: {
@@ -483,7 +494,7 @@ var {
483
494
  var search_slice_default = searchSlice.reducer;
484
495
 
485
496
  // src/store/store.ts
486
- import { configureStore } from "@reduxjs/toolkit";
497
+ var import_toolkit11 = require("@reduxjs/toolkit");
487
498
 
488
499
  // node_modules/redux/dist/redux.mjs
489
500
  function formatProdErrorMessage(code) {
@@ -667,7 +678,7 @@ var rootReducer = combineReducers({
667
678
  excel: excel_slice_default,
668
679
  profile: profile_slice_default
669
680
  });
670
- var envStore = configureStore({
681
+ var envStore = (0, import_toolkit11.configureStore)({
671
682
  reducer: rootReducer,
672
683
  middleware: (getDefaultMiddleware) => getDefaultMiddleware({
673
684
  serializableCheck: false
@@ -675,26 +686,26 @@ var envStore = configureStore({
675
686
  });
676
687
 
677
688
  // src/provider/redux-provider.tsx
678
- import { jsx as jsx2 } from "react/jsx-runtime";
689
+ var import_jsx_runtime2 = require("react/jsx-runtime");
679
690
  var ReduxProvider = ({ children }) => {
680
- return /* @__PURE__ */ jsx2(Provider, { store: envStore, children });
691
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react_redux2.Provider, { store: envStore, children });
681
692
  };
682
693
 
683
694
  // src/provider/main-provider.tsx
684
- import { jsx as jsx3 } from "react/jsx-runtime";
695
+ var import_jsx_runtime3 = require("react/jsx-runtime");
685
696
  var MainProvider = ({ children }) => {
686
- return /* @__PURE__ */ jsx3(ReduxProvider, { children: /* @__PURE__ */ jsx3(ReactQueryProvider, { children }) });
697
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReduxProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReactQueryProvider, { children }) });
687
698
  };
688
699
 
689
700
  // src/provider/version-gate-provider.tsx
690
- import { useEffect as useEffect2, useState as useState2 } from "react";
691
- import { useQueryClient } from "@tanstack/react-query";
701
+ var import_react2 = require("react");
702
+ var import_react_query2 = require("@tanstack/react-query");
692
703
 
693
704
  // src/configs/axios-client.ts
694
- import axios from "axios";
705
+ var import_axios = __toESM(require("axios"));
695
706
 
696
707
  // src/utils/format.ts
697
- import moment from "moment";
708
+ var import_moment = __toESM(require("moment"));
698
709
 
699
710
  // src/utils/domain/py_tokenizer.ts
700
711
  var TokenizerError = class extends Error {
@@ -1774,6 +1785,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1774
1785
  this.microsecond = params.microsecond;
1775
1786
  this.weekday = params.weekday;
1776
1787
  }
1788
+ years;
1789
+ months;
1790
+ days;
1791
+ hours;
1792
+ minutes;
1793
+ seconds;
1794
+ microseconds;
1795
+ leapDays;
1796
+ year;
1797
+ month;
1798
+ day;
1799
+ hour;
1800
+ minute;
1801
+ second;
1802
+ microsecond;
1803
+ weekday;
1777
1804
  negate() {
1778
1805
  return new _PyRelativeDelta(this, -1);
1779
1806
  }
@@ -1888,7 +1915,7 @@ function execOnIterable(iterable, func) {
1888
1915
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1889
1916
  iterable = Object.keys(iterable);
1890
1917
  }
1891
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1918
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1892
1919
  throw new EvaluationError("value not iterable");
1893
1920
  }
1894
1921
  return func(iterable);
@@ -2211,7 +2238,7 @@ function applyBinaryOp(ast, context) {
2211
2238
  }
2212
2239
  return Math.floor(left / right);
2213
2240
  case "**":
2214
- return __pow(left, right);
2241
+ return left ** right;
2215
2242
  case "==":
2216
2243
  return isEqual(left, right);
2217
2244
  case "<>":
@@ -2333,7 +2360,7 @@ function evaluate(ast, context = {}) {
2333
2360
  const dicts = /* @__PURE__ */ new Set();
2334
2361
  let pyContext;
2335
2362
  const evalContext = Object.create(context);
2336
- if (!(evalContext == null ? void 0 : evalContext.context)) {
2363
+ if (!evalContext?.context) {
2337
2364
  Object.defineProperty(evalContext, "context", {
2338
2365
  get() {
2339
2366
  if (!pyContext) {
@@ -2344,18 +2371,17 @@ function evaluate(ast, context = {}) {
2344
2371
  });
2345
2372
  }
2346
2373
  function _innerEvaluate(ast2) {
2347
- var _a, _b, _c;
2348
- switch (ast2 == null ? void 0 : ast2.type) {
2374
+ switch (ast2?.type) {
2349
2375
  case 0:
2350
2376
  // Number
2351
2377
  case 1:
2352
2378
  return ast2.value;
2353
2379
  case 5:
2354
2380
  if (ast2.value in evalContext) {
2355
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
2356
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
2381
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
2382
+ return evalContext[ast2.value]?.id;
2357
2383
  }
2358
- return (_c = evalContext[ast2.value]) != null ? _c : false;
2384
+ return evalContext[ast2.value] ?? false;
2359
2385
  } else if (ast2.value in BUILTINS) {
2360
2386
  return BUILTINS[ast2.value];
2361
2387
  } else {
@@ -2392,7 +2418,7 @@ function evaluate(ast, context = {}) {
2392
2418
  const args = ast2.args.map(_evaluate);
2393
2419
  const kwargs = {};
2394
2420
  for (const kwarg in ast2.kwargs) {
2395
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
2421
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
2396
2422
  }
2397
2423
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
2398
2424
  return fnValue.create(...args, kwargs);
@@ -2471,25 +2497,9 @@ function escapeRegExp(str) {
2471
2497
  var InvalidDomainError = class extends Error {
2472
2498
  };
2473
2499
  var Domain = class _Domain {
2474
- constructor(descr = []) {
2475
- this.ast = { type: -1, value: null };
2476
- if (descr instanceof _Domain) {
2477
- return new _Domain(descr.toString());
2478
- } else {
2479
- let rawAST;
2480
- try {
2481
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2482
- } catch (error) {
2483
- throw new InvalidDomainError(
2484
- `Invalid domain representation: ${descr}`,
2485
- {
2486
- cause: error
2487
- }
2488
- );
2489
- }
2490
- this.ast = normalizeDomainAST(rawAST);
2491
- }
2492
- }
2500
+ ast = { type: -1, value: null };
2501
+ static TRUE;
2502
+ static FALSE;
2493
2503
  static combine(domains, operator) {
2494
2504
  if (domains.length === 0) {
2495
2505
  return new _Domain([]);
@@ -2568,6 +2578,24 @@ var Domain = class _Domain {
2568
2578
  processLeaf(d.ast.value, 0, "&", newDomain);
2569
2579
  return newDomain;
2570
2580
  }
2581
+ constructor(descr = []) {
2582
+ if (descr instanceof _Domain) {
2583
+ return new _Domain(descr.toString());
2584
+ } else {
2585
+ let rawAST;
2586
+ try {
2587
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2588
+ } catch (error) {
2589
+ throw new InvalidDomainError(
2590
+ `Invalid domain representation: ${descr}`,
2591
+ {
2592
+ cause: error
2593
+ }
2594
+ );
2595
+ }
2596
+ this.ast = normalizeDomainAST(rawAST);
2597
+ }
2598
+ }
2571
2599
  contains(record) {
2572
2600
  const expr = evaluate(this.ast, record);
2573
2601
  return matchDomain(record, expr);
@@ -2586,7 +2614,7 @@ var Domain = class _Domain {
2586
2614
  return evaluatedAsList;
2587
2615
  }
2588
2616
  return this.toString();
2589
- } catch (e) {
2617
+ } catch {
2590
2618
  return this.toString();
2591
2619
  }
2592
2620
  }
@@ -2786,834 +2814,481 @@ function matchDomain(record, domain) {
2786
2814
  }
2787
2815
 
2788
2816
  // src/utils/function.ts
2789
- import { useEffect, useState } from "react";
2790
- var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2791
- if (!originalRequest.data) return originalRequest.data;
2792
- if (typeof originalRequest.data === "string") {
2793
- try {
2794
- const parsedData = JSON.parse(originalRequest.data);
2795
- if (parsedData.with_context && typeof parsedData.with_context === "object") {
2796
- parsedData.with_context.token = newAccessToken;
2797
- }
2798
- return JSON.stringify(parsedData);
2799
- } catch (e) {
2800
- console.warn("Failed to parse originalRequest.data", e);
2801
- return originalRequest.data;
2802
- }
2803
- }
2804
- if (typeof originalRequest.data === "object" && originalRequest.data.with_context) {
2805
- originalRequest.data.with_context.token = newAccessToken;
2806
- }
2807
- return originalRequest.data;
2808
- };
2809
-
2810
- // src/utils/storage/local-storage.ts
2811
- var localStorageUtils = () => {
2812
- const setToken = (access_token) => __async(null, null, function* () {
2813
- localStorage.setItem("accessToken", access_token);
2814
- });
2815
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2816
- localStorage.setItem("refreshToken", refresh_token);
2817
- });
2818
- const getAccessToken = () => __async(null, null, function* () {
2819
- return localStorage.getItem("accessToken");
2820
- });
2821
- const getRefreshToken = () => __async(null, null, function* () {
2822
- return localStorage.getItem("refreshToken");
2823
- });
2824
- const clearToken = () => __async(null, null, function* () {
2825
- localStorage.removeItem("accessToken");
2826
- localStorage.removeItem("refreshToken");
2827
- });
2828
- return {
2829
- setToken,
2830
- setRefreshToken,
2831
- getAccessToken,
2832
- getRefreshToken,
2833
- clearToken
2834
- };
2835
- };
2836
-
2837
- // src/utils/storage/session-storage.ts
2838
- var sessionStorageUtils = () => {
2839
- const getBrowserSession = () => __async(null, null, function* () {
2840
- return sessionStorage.getItem("browserSession");
2841
- });
2842
- return {
2843
- getBrowserSession
2844
- };
2845
- };
2846
-
2847
- // src/configs/axios-client.ts
2848
- var axiosClient = {
2849
- init(config) {
2850
- var _a, _b;
2851
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2852
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2853
- const db = config.db;
2854
- let isRefreshing = false;
2855
- let failedQueue = [];
2856
- const processQueue = (error, token = null) => {
2857
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2858
- if (error) {
2859
- prom.reject(error);
2860
- } else {
2861
- prom.resolve(token);
2862
- }
2863
- });
2864
- failedQueue = [];
2865
- };
2866
- const instance = axios.create({
2867
- adapter: axios.defaults.adapter,
2868
- baseURL: config.baseUrl,
2869
- timeout: 5e4,
2870
- paramsSerializer: (params) => new URLSearchParams(params).toString()
2871
- });
2872
- instance.interceptors.request.use(
2873
- (config2) => __async(null, null, function* () {
2874
- const useRefreshToken = config2.useRefreshToken;
2875
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2876
- if (token) {
2877
- config2.headers["Authorization"] = "Bearer " + token;
2878
- }
2879
- return config2;
2880
- }),
2881
- (error) => {
2882
- Promise.reject(error);
2883
- }
2884
- );
2885
- instance.interceptors.response.use(
2886
- (response) => {
2887
- return handleResponse(response);
2888
- },
2889
- (error) => __async(null, null, function* () {
2890
- var _a2, _b2, _c;
2891
- const handleError3 = (error2) => __async(null, null, function* () {
2892
- var _a3;
2893
- if (!error2.response) {
2894
- return error2;
2895
- }
2896
- const { data } = error2.response;
2897
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2898
- yield clearAuthToken();
2899
- }
2900
- return data;
2901
- });
2902
- const originalRequest = error.config;
2903
- 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(
2904
- error.response.data.code
2905
- )) {
2906
- if (isRefreshing) {
2907
- return new Promise(function(resolve, reject) {
2908
- failedQueue.push({ resolve, reject });
2909
- }).then((token) => {
2910
- originalRequest.headers["Authorization"] = "Bearer " + token;
2911
- originalRequest.data = updateTokenParamInOriginalRequest(
2912
- originalRequest,
2913
- token
2914
- );
2915
- return instance.request(originalRequest);
2916
- }).catch((err) => __async(null, null, function* () {
2917
- var _a3, _b3;
2918
- 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)) {
2919
- yield clearAuthToken();
2920
- }
2921
- }));
2922
- }
2923
- const browserSession = yield sessionStorage2.getBrowserSession();
2924
- const refreshToken = yield localStorage2.getRefreshToken();
2925
- const accessTokenExp = yield localStorage2.getAccessToken();
2926
- isRefreshing = true;
2927
- if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2928
- yield clearAuthToken();
2929
- } else {
2930
- const payload = Object.fromEntries(
2931
- Object.entries({
2932
- refresh_token: refreshToken,
2933
- grant_type: "refresh_token",
2934
- client_id: config.config.clientId,
2935
- client_secret: config.config.clientSecret
2936
- }).filter(([_, value]) => !!value)
2937
- );
2938
- return new Promise(function(resolve) {
2939
- var _a3;
2940
- axios.post(
2941
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2942
- payload,
2943
- {
2944
- headers: {
2945
- "Content-Type": config.refreshTokenEndpoint ? "application/x-www-form-urlencoded" : "multipart/form-data",
2946
- Authorization: `Bearer ${accessTokenExp}`
2947
- }
2948
- }
2949
- ).then((res) => __async(null, null, function* () {
2950
- const data = res.data;
2951
- yield localStorage2.setToken(data.access_token);
2952
- yield localStorage2.setRefreshToken(data.refresh_token);
2953
- axios.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2954
- originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2955
- originalRequest.data = updateTokenParamInOriginalRequest(
2956
- originalRequest,
2957
- data.access_token
2958
- );
2959
- processQueue(null, data.access_token);
2960
- resolve(instance.request(originalRequest));
2961
- })).catch((err) => __async(null, null, function* () {
2962
- var _a4;
2963
- 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") {
2964
- yield clearAuthToken();
2965
- }
2966
- if (err && err.response) {
2967
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
2968
- if (error_code === "AUTHEN_FAIL") {
2969
- yield clearAuthToken();
2970
- }
2971
- }
2972
- processQueue(err, null);
2973
- })).finally(() => {
2974
- isRefreshing = false;
2975
- });
2976
- });
2977
- }
2978
- }
2979
- return Promise.reject(yield handleError3(error));
2980
- })
2981
- );
2982
- const handleResponse = (res) => {
2983
- if (res && res.data) {
2984
- return res.data;
2985
- }
2986
- return res;
2987
- };
2988
- const handleError2 = (error) => {
2989
- var _a2, _b2, _c;
2990
- if (error.isAxiosError && error.code === "ECONNABORTED") {
2991
- console.error("Request Timeout Error:", error);
2992
- return "Request Timeout Error";
2993
- } else if (error.isAxiosError && !error.response) {
2994
- console.error("Network Error:", error);
2995
- return "Network Error";
2996
- } else {
2997
- console.error("Other Error:", error == null ? void 0 : error.response);
2998
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
2999
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
3000
- }
3001
- };
3002
- const clearAuthToken = () => __async(null, null, function* () {
3003
- yield localStorage2.clearToken();
3004
- if (typeof window !== "undefined") {
3005
- window.location.href = `/login`;
3006
- }
3007
- });
3008
- function formatUrl(url, db2) {
3009
- return url + (db2 ? "?db=" + db2 : "");
3010
- }
3011
- const responseBody = (response) => response;
3012
- const requests = {
3013
- get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
3014
- post: (url, body, headers) => instance.post(formatUrl(url, db), body, headers).then(responseBody),
3015
- post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
3016
- responseType: "arraybuffer",
3017
- headers: {
3018
- "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
3019
- Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
3020
- }
3021
- }).then(responseBody),
3022
- put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
3023
- patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
3024
- delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
3025
- };
3026
- return requests;
3027
- }
3028
- };
2817
+ var import_react = require("react");
3029
2818
 
3030
2819
  // src/environment/EnvStore.ts
3031
- var _EnvStore = class _EnvStore {
3032
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3033
- this.envStore = envStore2;
3034
- this.localStorageUtils = localStorageUtils2;
3035
- this.sessionStorageUtils = sessionStorageUtils2;
3036
- this.setup();
3037
- }
3038
- static getInstance(envStore2, localStorageUtils2, sessionStorageUtils2) {
3039
- if (!_EnvStore.instance) {
3040
- _EnvStore.instance = new _EnvStore(
3041
- envStore2,
3042
- localStorageUtils2,
3043
- sessionStorageUtils2
3044
- );
3045
- }
3046
- return _EnvStore.instance;
3047
- }
3048
- setup() {
3049
- const env = this.envStore.getState().env;
3050
- this.baseUrl = env == null ? void 0 : env.baseUrl;
3051
- this.requests = env == null ? void 0 : env.requests;
3052
- this.context = env == null ? void 0 : env.context;
3053
- this.defaultCompany = env == null ? void 0 : env.defaultCompany;
3054
- this.config = env == null ? void 0 : env.config;
3055
- this.companies = (env == null ? void 0 : env.companies) || [];
3056
- this.user = env == null ? void 0 : env.user;
3057
- this.db = env == null ? void 0 : env.db;
3058
- this.refreshTokenEndpoint = env == null ? void 0 : env.refreshTokenEndpoint;
3059
- console.log("Env setup:", this);
3060
- }
3061
- setupEnv(envConfig) {
3062
- const dispatch = this.envStore.dispatch;
3063
- const env = __spreadProps(__spreadValues({}, envConfig), {
3064
- localStorageUtils: this.localStorageUtils,
3065
- sessionStorageUtils: this.sessionStorageUtils
3066
- });
3067
- const requests = axiosClient.init(env);
3068
- dispatch(setEnv(__spreadProps(__spreadValues({}, env), { requests })));
3069
- this.setup();
3070
- }
3071
- setUid(uid) {
3072
- const dispatch = this.envStore.dispatch;
3073
- dispatch(setUid(uid));
3074
- this.setup();
3075
- }
3076
- setLang(lang) {
3077
- const dispatch = this.envStore.dispatch;
3078
- dispatch(setLang(lang));
3079
- this.setup();
3080
- }
3081
- setAllowCompanies(allowCompanies) {
3082
- const dispatch = this.envStore.dispatch;
3083
- dispatch(setAllowCompanies(allowCompanies));
3084
- this.setup();
3085
- }
3086
- setCompanies(companies) {
3087
- const dispatch = this.envStore.dispatch;
3088
- dispatch(setCompanies(companies));
3089
- this.setup();
3090
- }
3091
- setDefaultCompany(company) {
3092
- const dispatch = this.envStore.dispatch;
3093
- dispatch(setDefaultCompany(company));
3094
- this.setup();
3095
- }
3096
- setUserInfo(userInfo) {
3097
- const dispatch = this.envStore.dispatch;
3098
- dispatch(setUser(userInfo));
3099
- this.setup();
3100
- }
3101
- };
3102
- _EnvStore.instance = null;
3103
- var EnvStore = _EnvStore;
3104
2820
  function getEnv() {
3105
- const instance = EnvStore.getInstance(envStore);
3106
- if (!instance) {
3107
- throw new Error("EnvStore has not been initialized \u2014 call initEnv() first");
3108
- }
3109
- return instance;
2821
+ console.log("getEnv", envStore.getState().env);
2822
+ return envStore.getState().env;
3110
2823
  }
3111
2824
 
3112
2825
  // src/services/view-service/index.ts
3113
2826
  var ViewService = {
3114
- getView(_0) {
3115
- return __async(this, arguments, function* ({
2827
+ async getView({
2828
+ model,
2829
+ views,
2830
+ context = {},
2831
+ options = {},
2832
+ aid
2833
+ }) {
2834
+ const env = getEnv();
2835
+ const defaultOptions = {
2836
+ load_filters: true,
2837
+ toolbar: true,
2838
+ action_id: aid
2839
+ };
2840
+ const jsonDataView = {
3116
2841
  model,
3117
- views,
3118
- context = {},
3119
- options = {},
3120
- aid
3121
- }) {
3122
- var _a;
3123
- const env = getEnv();
3124
- const defaultOptions = {
3125
- load_filters: true,
3126
- toolbar: true,
3127
- action_id: aid
3128
- };
3129
- const jsonDataView = {
3130
- model,
3131
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
3132
- kwargs: {
3133
- views,
3134
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
3135
- },
3136
- with_context: context
3137
- };
3138
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
3139
- headers: {
3140
- "Content-Type": "application/json"
3141
- }
3142
- });
2842
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
2843
+ kwargs: {
2844
+ views,
2845
+ options: { ...options, ...defaultOptions }
2846
+ },
2847
+ with_context: context
2848
+ };
2849
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
2850
+ headers: {
2851
+ "Content-Type": "application/json"
2852
+ }
3143
2853
  });
3144
2854
  },
3145
- getMenu(context) {
3146
- return __async(this, null, function* () {
3147
- var _a;
3148
- const env = getEnv();
3149
- const jsonData = {
3150
- model: "ir.ui.menu" /* MENU */,
3151
- method: "web_search_read" /* WEB_SEARCH_READ */,
3152
- ids: [],
3153
- with_context: context,
3154
- kwargs: {
3155
- specification: {
3156
- active: {},
3157
- name: {},
3158
- is_display: {},
3159
- sequence: {},
3160
- complete_name: {},
3161
- action: {
3162
- fields: {
3163
- display_name: {},
3164
- type: {},
3165
- binding_view_types: {}
3166
- // res_model: {},
3167
- }
2855
+ async getMenu(context) {
2856
+ const env = getEnv();
2857
+ const jsonData = {
2858
+ model: "ir.ui.menu" /* MENU */,
2859
+ method: "web_search_read" /* WEB_SEARCH_READ */,
2860
+ ids: [],
2861
+ with_context: context,
2862
+ kwargs: {
2863
+ specification: {
2864
+ active: {},
2865
+ name: {},
2866
+ is_display: {},
2867
+ sequence: {},
2868
+ complete_name: {},
2869
+ action: {
2870
+ fields: {
2871
+ display_name: {},
2872
+ type: {},
2873
+ binding_view_types: {}
2874
+ // res_model: {},
2875
+ }
2876
+ },
2877
+ url_icon: {},
2878
+ web_icon: {},
2879
+ web_icon_data: {},
2880
+ groups_id: {
2881
+ fields: {
2882
+ full_name: {}
3168
2883
  },
3169
- url_icon: {},
3170
- web_icon: {},
3171
- web_icon_data: {},
3172
- groups_id: {
3173
- fields: {
3174
- full_name: {}
2884
+ limit: 40,
2885
+ order: ""
2886
+ },
2887
+ display_name: {},
2888
+ child_id: {
2889
+ fields: {
2890
+ active: {},
2891
+ name: {},
2892
+ is_display: {},
2893
+ sequence: {},
2894
+ complete_name: {},
2895
+ action: {
2896
+ fields: {
2897
+ display_name: {},
2898
+ type: {},
2899
+ binding_view_types: {}
2900
+ // res_model: {},
2901
+ }
3175
2902
  },
3176
- limit: 40,
3177
- order: ""
3178
- },
3179
- display_name: {},
3180
- child_id: {
3181
- fields: {
3182
- active: {},
3183
- name: {},
3184
- is_display: {},
3185
- sequence: {},
3186
- complete_name: {},
3187
- action: {
3188
- fields: {
3189
- display_name: {},
3190
- type: {},
3191
- binding_view_types: {}
3192
- // res_model: {},
3193
- }
2903
+ url_icon: {},
2904
+ web_icon: {},
2905
+ web_icon_data: {},
2906
+ groups_id: {
2907
+ fields: {
2908
+ full_name: {}
3194
2909
  },
3195
- url_icon: {},
3196
- web_icon: {},
3197
- web_icon_data: {},
3198
- groups_id: {
3199
- fields: {
3200
- full_name: {}
2910
+ limit: 40,
2911
+ order: ""
2912
+ },
2913
+ display_name: {},
2914
+ child_id: {
2915
+ fields: {
2916
+ active: {},
2917
+ name: {},
2918
+ is_display: {},
2919
+ sequence: {},
2920
+ complete_name: {},
2921
+ action: {
2922
+ fields: {
2923
+ display_name: {},
2924
+ type: {},
2925
+ binding_view_types: {}
2926
+ // res_model: {},
2927
+ }
3201
2928
  },
3202
- limit: 40,
3203
- order: ""
3204
- },
3205
- display_name: {},
3206
- child_id: {
3207
- fields: {
3208
- active: {},
3209
- name: {},
3210
- is_display: {},
3211
- sequence: {},
3212
- complete_name: {},
3213
- action: {
3214
- fields: {
3215
- display_name: {},
3216
- type: {},
3217
- binding_view_types: {}
3218
- // res_model: {},
3219
- }
2929
+ url_icon: {},
2930
+ web_icon: {},
2931
+ web_icon_data: {},
2932
+ groups_id: {
2933
+ fields: {
2934
+ full_name: {}
3220
2935
  },
3221
- url_icon: {},
3222
- web_icon: {},
3223
- web_icon_data: {},
3224
- groups_id: {
3225
- fields: {
3226
- full_name: {}
2936
+ limit: 40,
2937
+ order: ""
2938
+ },
2939
+ display_name: {},
2940
+ child_id: {
2941
+ fields: {
2942
+ active: {},
2943
+ name: {},
2944
+ is_display: {},
2945
+ sequence: {},
2946
+ complete_name: {},
2947
+ action: {
2948
+ fields: {
2949
+ display_name: {},
2950
+ type: {},
2951
+ binding_view_types: {}
2952
+ // res_model: {},
2953
+ }
3227
2954
  },
3228
- limit: 40,
3229
- order: ""
3230
- },
3231
- display_name: {},
3232
- child_id: {
3233
- fields: {
3234
- active: {},
3235
- name: {},
3236
- is_display: {},
3237
- sequence: {},
3238
- complete_name: {},
3239
- action: {
3240
- fields: {
3241
- display_name: {},
3242
- type: {},
3243
- binding_view_types: {}
3244
- // res_model: {},
3245
- }
3246
- },
3247
- url_icon: {},
3248
- web_icon: {},
3249
- web_icon_data: {},
3250
- groups_id: {
3251
- fields: {
3252
- full_name: {}
3253
- },
3254
- limit: 40,
3255
- order: ""
2955
+ url_icon: {},
2956
+ web_icon: {},
2957
+ web_icon_data: {},
2958
+ groups_id: {
2959
+ fields: {
2960
+ full_name: {}
3256
2961
  },
3257
- display_name: {},
3258
- child_id: {
3259
- fields: {},
3260
- limit: 40,
3261
- order: ""
3262
- }
2962
+ limit: 40,
2963
+ order: ""
3263
2964
  },
3264
- limit: 40,
3265
- order: ""
3266
- }
3267
- },
3268
- limit: 40,
3269
- order: ""
3270
- }
3271
- },
3272
- limit: 40,
3273
- order: ""
3274
- }
3275
- },
3276
- domain: [
3277
- "&",
3278
- ["is_display", "=", true],
3279
- "&",
3280
- ["active", "=", true],
3281
- ["parent_id", "=", false]
3282
- ]
3283
- }
3284
- };
3285
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3286
- headers: {
3287
- "Content-Type": "application/json"
3288
- }
3289
- });
2965
+ display_name: {},
2966
+ child_id: {
2967
+ fields: {},
2968
+ limit: 40,
2969
+ order: ""
2970
+ }
2971
+ },
2972
+ limit: 40,
2973
+ order: ""
2974
+ }
2975
+ },
2976
+ limit: 40,
2977
+ order: ""
2978
+ }
2979
+ },
2980
+ limit: 40,
2981
+ order: ""
2982
+ }
2983
+ },
2984
+ domain: [
2985
+ "&",
2986
+ ["is_display", "=", true],
2987
+ "&",
2988
+ ["active", "=", true],
2989
+ ["parent_id", "=", false]
2990
+ ]
2991
+ }
2992
+ };
2993
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
2994
+ headers: {
2995
+ "Content-Type": "application/json"
2996
+ }
3290
2997
  });
3291
2998
  },
3292
- getActionDetail(aid, context) {
3293
- return __async(this, null, function* () {
3294
- var _a;
3295
- const env = getEnv();
3296
- const jsonData = {
3297
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
3298
- method: "web_read" /* WEB_READ */,
3299
- ids: [aid],
3300
- with_context: context,
3301
- kwargs: {
3302
- specification: {
3303
- id: {},
3304
- name: {},
3305
- res_model: {},
3306
- views: {},
3307
- view_mode: {},
3308
- mobile_view_mode: {},
3309
- domain: {},
3310
- context: {},
3311
- groups_id: {},
3312
- search_view_id: {}
3313
- }
2999
+ async getActionDetail(aid, context) {
3000
+ const env = getEnv();
3001
+ const jsonData = {
3002
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
3003
+ method: "web_read" /* WEB_READ */,
3004
+ ids: [aid],
3005
+ with_context: context,
3006
+ kwargs: {
3007
+ specification: {
3008
+ id: {},
3009
+ name: {},
3010
+ res_model: {},
3011
+ views: {},
3012
+ view_mode: {},
3013
+ mobile_view_mode: {},
3014
+ domain: {},
3015
+ context: {},
3016
+ groups_id: {},
3017
+ search_view_id: {}
3314
3018
  }
3315
- };
3316
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3317
- headers: {
3318
- "Content-Type": "application/json"
3319
- }
3320
- });
3019
+ }
3020
+ };
3021
+ return env?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3022
+ headers: {
3023
+ "Content-Type": "application/json"
3024
+ }
3321
3025
  });
3322
3026
  },
3323
- getResequence(_0) {
3324
- return __async(this, arguments, function* ({
3027
+ async getResequence({
3028
+ model,
3029
+ ids,
3030
+ context,
3031
+ offset
3032
+ }) {
3033
+ const env = getEnv();
3034
+ const jsonData = {
3325
3035
  model,
3036
+ with_context: context,
3326
3037
  ids,
3327
- context,
3328
- offset
3329
- }) {
3330
- const env = getEnv();
3331
- const jsonData = __spreadValues({
3332
- model,
3333
- with_context: context,
3334
- ids,
3335
- field: "sequence"
3336
- }, offset > 0 ? { offset } : {});
3337
- return env == null ? void 0 : env.requests.post("/web/dataset/resequence", jsonData, {
3338
- headers: {
3339
- "Content-Type": "application/json"
3340
- }
3341
- });
3342
- });
3343
- },
3344
- getSelectionItem(_0) {
3345
- return __async(this, arguments, function* ({ data }) {
3346
- var _a;
3347
- const env = getEnv();
3348
- const jsonData = {
3349
- model: data.model,
3350
- ids: [],
3351
- method: "get_data_select",
3352
- with_context: data.context,
3353
- kwargs: {
3354
- count_limit: 10001,
3355
- domain: data.domain ? data.domain : [],
3356
- offset: 0,
3357
- order: "",
3358
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
3359
- id: {},
3360
- name: {},
3361
- display_name: {}
3362
- }
3363
- }
3364
- };
3365
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3366
- headers: {
3367
- "Content-Type": "application/json"
3368
- }
3369
- });
3038
+ field: "sequence",
3039
+ ...offset > 0 ? { offset } : {}
3040
+ };
3041
+ return env?.requests.post("/web/dataset/resequence", jsonData, {
3042
+ headers: {
3043
+ "Content-Type": "application/json"
3044
+ }
3370
3045
  });
3371
3046
  },
3372
- loadMessages() {
3373
- return __async(this, null, function* () {
3374
- const env = getEnv();
3375
- return env.requests.post(
3376
- "/load_message_failures" /* LOAD_MESSAGE */,
3377
- {},
3378
- {
3379
- headers: {
3380
- "Content-Type": "application/json"
3381
- }
3047
+ async getSelectionItem({ data }) {
3048
+ const env = getEnv();
3049
+ const jsonData = {
3050
+ model: data.model,
3051
+ ids: [],
3052
+ method: "get_data_select",
3053
+ with_context: data.context,
3054
+ kwargs: {
3055
+ count_limit: 10001,
3056
+ domain: data.domain ? data.domain : [],
3057
+ offset: 0,
3058
+ order: "",
3059
+ specification: data?.specification ?? {
3060
+ id: {},
3061
+ name: {},
3062
+ display_name: {}
3382
3063
  }
3383
- );
3064
+ }
3065
+ };
3066
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3067
+ headers: {
3068
+ "Content-Type": "application/json"
3069
+ }
3384
3070
  });
3385
3071
  },
3386
- getVersion() {
3387
- return __async(this, null, function* () {
3388
- var _a;
3389
- const env = getEnv();
3390
- console.log("env?.requests", env, env == null ? void 0 : env.requests);
3391
- return (_a = env == null ? void 0 : env.requests) == null ? void 0 : _a.get("", {
3072
+ async loadMessages() {
3073
+ const env = getEnv();
3074
+ return env.requests.post(
3075
+ "/load_message_failures" /* LOAD_MESSAGE */,
3076
+ {},
3077
+ {
3392
3078
  headers: {
3393
3079
  "Content-Type": "application/json"
3394
3080
  }
3395
- });
3081
+ }
3082
+ );
3083
+ },
3084
+ async getVersion() {
3085
+ const env = getEnv();
3086
+ return env?.requests.get("", {
3087
+ headers: {
3088
+ "Content-Type": "application/json"
3089
+ }
3396
3090
  });
3397
3091
  },
3398
- get2FAMethods(_0) {
3399
- return __async(this, arguments, function* ({
3092
+ async get2FAMethods({
3093
+ method,
3094
+ with_context
3095
+ }) {
3096
+ const env = getEnv();
3097
+ const jsonData = {
3400
3098
  method,
3401
3099
  with_context
3402
- }) {
3403
- const env = getEnv();
3404
- const jsonData = {
3405
- method,
3406
- with_context
3407
- };
3408
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3409
- headers: {
3410
- "Content-Type": "application/json"
3411
- }
3412
- });
3100
+ };
3101
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3102
+ headers: {
3103
+ "Content-Type": "application/json"
3104
+ }
3413
3105
  });
3414
3106
  },
3415
- verify2FA(_0) {
3416
- return __async(this, arguments, function* ({
3107
+ async verify2FA({
3108
+ method,
3109
+ with_context,
3110
+ code,
3111
+ device,
3112
+ location
3113
+ }) {
3114
+ const env = getEnv();
3115
+ const jsonData = {
3417
3116
  method,
3418
- with_context,
3419
- code,
3420
- device,
3421
- location
3422
- }) {
3423
- const env = getEnv();
3424
- const jsonData = {
3425
- method,
3426
- kwargs: {
3427
- vals: {
3428
- code,
3429
- device,
3430
- location
3431
- }
3432
- },
3433
- with_context
3434
- };
3435
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3436
- headers: {
3437
- "Content-Type": "application/json"
3438
- },
3439
- withCredentials: true
3440
- });
3117
+ kwargs: {
3118
+ vals: {
3119
+ code,
3120
+ device,
3121
+ location
3122
+ }
3123
+ },
3124
+ with_context
3125
+ };
3126
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3127
+ headers: {
3128
+ "Content-Type": "application/json"
3129
+ },
3130
+ withCredentials: true
3441
3131
  });
3442
3132
  },
3443
- signInSSO(_0) {
3444
- return __async(this, arguments, function* ({
3445
- redirect_uri,
3446
- state,
3447
- client_id,
3133
+ async signInSSO({
3134
+ redirect_uri,
3135
+ state,
3136
+ client_id,
3137
+ response_type,
3138
+ path
3139
+ }) {
3140
+ const env = getEnv();
3141
+ const params = new URLSearchParams({
3448
3142
  response_type,
3449
- path
3450
- }) {
3451
- const env = getEnv();
3452
- const params = new URLSearchParams({
3453
- response_type,
3454
- client_id,
3455
- redirect_uri,
3456
- state
3457
- });
3458
- const url = `${path}?${params.toString()}`;
3459
- return env == null ? void 0 : env.requests.get(url, {
3460
- headers: {
3461
- "Content-Type": "application/json"
3462
- },
3463
- withCredentials: true
3464
- });
3143
+ client_id,
3144
+ redirect_uri,
3145
+ state
3146
+ });
3147
+ const url = `${path}?${params.toString()}`;
3148
+ return env?.requests.get(url, {
3149
+ headers: {
3150
+ "Content-Type": "application/json"
3151
+ },
3152
+ withCredentials: true
3465
3153
  });
3466
3154
  },
3467
- grantAccess(_0) {
3468
- return __async(this, arguments, function* ({
3155
+ async grantAccess({
3156
+ redirect_uri,
3157
+ state,
3158
+ client_id,
3159
+ scopes
3160
+ }) {
3161
+ const env = getEnv();
3162
+ const jsonData = {
3469
3163
  redirect_uri,
3470
3164
  state,
3471
3165
  client_id,
3472
3166
  scopes
3473
- }) {
3474
- const env = getEnv();
3475
- const jsonData = {
3476
- redirect_uri,
3477
- state,
3478
- client_id,
3479
- scopes
3480
- };
3481
- return env == null ? void 0 : env.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3482
- headers: {
3483
- "Content-Type": "application/json"
3484
- },
3485
- withCredentials: true
3486
- });
3167
+ };
3168
+ return env?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3169
+ headers: {
3170
+ "Content-Type": "application/json"
3171
+ },
3172
+ withCredentials: true
3487
3173
  });
3488
3174
  },
3489
- getFieldsViewSecurity(_0) {
3490
- return __async(this, arguments, function* ({
3175
+ async getFieldsViewSecurity({
3176
+ method,
3177
+ token,
3178
+ views
3179
+ }) {
3180
+ const env = getEnv();
3181
+ const jsonData = {
3491
3182
  method,
3492
- token,
3493
- views
3494
- }) {
3495
- const env = getEnv();
3496
- const jsonData = {
3497
- method,
3498
- kwargs: {
3499
- views
3500
- },
3501
- with_context: {
3502
- token
3503
- }
3504
- };
3505
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3506
- headers: {
3507
- "Content-Type": "application/json"
3508
- }
3509
- });
3183
+ kwargs: {
3184
+ views
3185
+ },
3186
+ with_context: {
3187
+ token
3188
+ }
3189
+ };
3190
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3191
+ headers: {
3192
+ "Content-Type": "application/json"
3193
+ }
3510
3194
  });
3511
3195
  },
3512
- settingsWebRead2fa(_0) {
3513
- return __async(this, arguments, function* ({
3196
+ async settingsWebRead2fa({
3197
+ method,
3198
+ model,
3199
+ kwargs,
3200
+ token
3201
+ }) {
3202
+ const env = getEnv();
3203
+ const jsonData = {
3514
3204
  method,
3515
3205
  model,
3516
3206
  kwargs,
3517
- token
3518
- }) {
3519
- const env = getEnv();
3520
- const jsonData = {
3521
- method,
3522
- model,
3523
- kwargs,
3524
- with_context: {
3525
- token
3526
- }
3527
- };
3528
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3529
- headers: {
3530
- "Content-Type": "application/json"
3531
- }
3532
- });
3207
+ with_context: {
3208
+ token
3209
+ }
3210
+ };
3211
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3212
+ headers: {
3213
+ "Content-Type": "application/json"
3214
+ }
3533
3215
  });
3534
3216
  },
3535
- requestSetupTotp(_0) {
3536
- return __async(this, arguments, function* ({ method, token }) {
3537
- const env = getEnv();
3538
- const jsonData = {
3539
- method,
3540
- with_context: {
3541
- token
3542
- }
3543
- };
3544
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3545
- headers: {
3546
- "Content-Type": "application/json"
3547
- }
3548
- });
3217
+ async requestSetupTotp({ method, token }) {
3218
+ const env = getEnv();
3219
+ const jsonData = {
3220
+ method,
3221
+ with_context: {
3222
+ token
3223
+ }
3224
+ };
3225
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3226
+ headers: {
3227
+ "Content-Type": "application/json"
3228
+ }
3549
3229
  });
3550
3230
  },
3551
- verifyTotp(_0) {
3552
- return __async(this, arguments, function* ({
3231
+ async verifyTotp({
3232
+ method,
3233
+ action_token,
3234
+ code
3235
+ }) {
3236
+ const env = getEnv();
3237
+ const jsonData = {
3553
3238
  method,
3554
- action_token,
3555
- code
3556
- }) {
3557
- const env = getEnv();
3558
- const jsonData = {
3559
- method,
3560
- kwargs: {
3561
- vals: {
3562
- code
3563
- }
3564
- },
3565
- with_context: {
3566
- action_token
3239
+ kwargs: {
3240
+ vals: {
3241
+ code
3567
3242
  }
3568
- };
3569
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3570
- headers: {
3571
- "Content-Type": "application/json"
3572
- }
3573
- });
3243
+ },
3244
+ with_context: {
3245
+ action_token
3246
+ }
3247
+ };
3248
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3249
+ headers: {
3250
+ "Content-Type": "application/json"
3251
+ }
3574
3252
  });
3575
3253
  },
3576
- removeTotpSetUp(_0) {
3577
- return __async(this, arguments, function* ({ method, token }) {
3578
- const env = getEnv();
3579
- const jsonData = {
3580
- method,
3581
- with_context: {
3582
- token
3583
- }
3584
- };
3585
- return env == null ? void 0 : env.requests.post("/call" /* CALL_PATH */, jsonData, {
3586
- headers: {
3587
- "Content-Type": "application/json"
3588
- }
3589
- });
3254
+ async removeTotpSetUp({ method, token }) {
3255
+ const env = getEnv();
3256
+ const jsonData = {
3257
+ method,
3258
+ with_context: {
3259
+ token
3260
+ }
3261
+ };
3262
+ return env?.requests.post("/call" /* CALL_PATH */, jsonData, {
3263
+ headers: {
3264
+ "Content-Type": "application/json"
3265
+ }
3590
3266
  });
3591
3267
  }
3592
3268
  };
3593
3269
  var view_service_default = ViewService;
3594
3270
 
3595
3271
  // src/provider/version-gate-provider.tsx
3596
- import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
3272
+ var import_jsx_runtime4 = require("react/jsx-runtime");
3597
3273
  var VersionGate = ({ children }) => {
3598
- const queryClient = useQueryClient();
3599
- const [ready, setReady] = useState2(false);
3600
- useEffect2(() => {
3274
+ const queryClient = (0, import_react_query2.useQueryClient)();
3275
+ const [ready, setReady] = (0, import_react2.useState)(false);
3276
+ (0, import_react2.useEffect)(() => {
3601
3277
  const clearVersion = () => {
3602
3278
  queryClient.clear();
3603
3279
  localStorage.removeItem("__api_version__");
3604
3280
  };
3605
- const validateVersion = () => __async(null, null, function* () {
3606
- const serverVersion = yield view_service_default.getVersion();
3607
- console.log("serverVersion", serverVersion);
3281
+ const validateVersion = async () => {
3282
+ const serverVersion = await view_service_default.getVersion();
3608
3283
  const cached = localStorage.getItem("__api_version__");
3609
- if (cached !== (serverVersion == null ? void 0 : serverVersion.api_version)) {
3284
+ if (cached !== serverVersion?.api_version) {
3610
3285
  clearVersion();
3611
- localStorage.setItem("__api_version__", serverVersion == null ? void 0 : serverVersion.api_version);
3286
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
3612
3287
  } else {
3613
- console.log("Api version:", serverVersion == null ? void 0 : serverVersion.api_version);
3288
+ console.log("Api version:", serverVersion?.api_version);
3614
3289
  }
3615
3290
  setReady(true);
3616
- });
3291
+ };
3617
3292
  validateVersion();
3618
3293
  if (typeof window !== "undefined") {
3619
3294
  const onKey = (e) => {
@@ -3625,10 +3300,11 @@ var VersionGate = ({ children }) => {
3625
3300
  return () => window.removeEventListener("keydown", onKey);
3626
3301
  }
3627
3302
  }, [queryClient]);
3628
- return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
3303
+ return ready ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children }) : null;
3629
3304
  };
3630
- export {
3305
+ // Annotate the CommonJS export names for ESM import in node:
3306
+ 0 && (module.exports = {
3631
3307
  MainProvider,
3632
3308
  ReactQueryProvider,
3633
3309
  VersionGate
3634
- };
3310
+ });