@fctc/interface-logic 1.5.8 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/hooks.js CHANGED
@@ -1,27 +1,10 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
6
  var __getProtoOf = Object.getPrototypeOf;
9
7
  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
8
  var __export = (target, all) => {
26
9
  for (var name in all)
27
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -43,26 +26,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
43
26
  mod
44
27
  ));
45
28
  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
29
 
67
30
  // src/hooks.ts
68
31
  var hooks_exports = {};
@@ -133,6 +96,7 @@ __export(hooks_exports, {
133
96
  useUploadFile: () => use_upload_file_default,
134
97
  useUploadIdFile: () => use_upload_id_file_default,
135
98
  useUploadImage: () => use_upload_image_default,
99
+ useValidateActionToken: () => use_validate_action_token_default,
136
100
  useVerify2FA: () => use_verify_2FA_default,
137
101
  useVerifyTotp: () => use_verify_totp_default
138
102
  });
@@ -1262,6 +1226,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1262
1226
  this.microsecond = params.microsecond;
1263
1227
  this.weekday = params.weekday;
1264
1228
  }
1229
+ years;
1230
+ months;
1231
+ days;
1232
+ hours;
1233
+ minutes;
1234
+ seconds;
1235
+ microseconds;
1236
+ leapDays;
1237
+ year;
1238
+ month;
1239
+ day;
1240
+ hour;
1241
+ minute;
1242
+ second;
1243
+ microsecond;
1244
+ weekday;
1265
1245
  negate() {
1266
1246
  return new _PyRelativeDelta(this, -1);
1267
1247
  }
@@ -1376,7 +1356,7 @@ function execOnIterable(iterable, func) {
1376
1356
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1377
1357
  iterable = Object.keys(iterable);
1378
1358
  }
1379
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1359
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1380
1360
  throw new EvaluationError("value not iterable");
1381
1361
  }
1382
1362
  return func(iterable);
@@ -1699,7 +1679,7 @@ function applyBinaryOp(ast, context) {
1699
1679
  }
1700
1680
  return Math.floor(left / right);
1701
1681
  case "**":
1702
- return __pow(left, right);
1682
+ return left ** right;
1703
1683
  case "==":
1704
1684
  return isEqual(left, right);
1705
1685
  case "<>":
@@ -1821,7 +1801,7 @@ function evaluate(ast, context = {}) {
1821
1801
  const dicts = /* @__PURE__ */ new Set();
1822
1802
  let pyContext;
1823
1803
  const evalContext = Object.create(context);
1824
- if (!(evalContext == null ? void 0 : evalContext.context)) {
1804
+ if (!evalContext?.context) {
1825
1805
  Object.defineProperty(evalContext, "context", {
1826
1806
  get() {
1827
1807
  if (!pyContext) {
@@ -1832,18 +1812,17 @@ function evaluate(ast, context = {}) {
1832
1812
  });
1833
1813
  }
1834
1814
  function _innerEvaluate(ast2) {
1835
- var _a, _b, _c;
1836
- switch (ast2 == null ? void 0 : ast2.type) {
1815
+ switch (ast2?.type) {
1837
1816
  case 0:
1838
1817
  // Number
1839
1818
  case 1:
1840
1819
  return ast2.value;
1841
1820
  case 5:
1842
1821
  if (ast2.value in evalContext) {
1843
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
1844
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
1822
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
1823
+ return evalContext[ast2.value]?.id;
1845
1824
  }
1846
- return (_c = evalContext[ast2.value]) != null ? _c : false;
1825
+ return evalContext[ast2.value] ?? false;
1847
1826
  } else if (ast2.value in BUILTINS) {
1848
1827
  return BUILTINS[ast2.value];
1849
1828
  } else {
@@ -1880,7 +1859,7 @@ function evaluate(ast, context = {}) {
1880
1859
  const args = ast2.args.map(_evaluate);
1881
1860
  const kwargs = {};
1882
1861
  for (const kwarg in ast2.kwargs) {
1883
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
1862
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
1884
1863
  }
1885
1864
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
1886
1865
  return fnValue.create(...args, kwargs);
@@ -1959,25 +1938,9 @@ function escapeRegExp(str) {
1959
1938
  var InvalidDomainError = class extends Error {
1960
1939
  };
1961
1940
  var Domain = class _Domain {
1962
- constructor(descr = []) {
1963
- this.ast = { type: -1, value: null };
1964
- if (descr instanceof _Domain) {
1965
- return new _Domain(descr.toString());
1966
- } else {
1967
- let rawAST;
1968
- try {
1969
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
1970
- } catch (error) {
1971
- throw new InvalidDomainError(
1972
- `Invalid domain representation: ${descr}`,
1973
- {
1974
- cause: error
1975
- }
1976
- );
1977
- }
1978
- this.ast = normalizeDomainAST(rawAST);
1979
- }
1980
- }
1941
+ ast = { type: -1, value: null };
1942
+ static TRUE;
1943
+ static FALSE;
1981
1944
  static combine(domains, operator) {
1982
1945
  if (domains.length === 0) {
1983
1946
  return new _Domain([]);
@@ -2056,6 +2019,24 @@ var Domain = class _Domain {
2056
2019
  processLeaf(d.ast.value, 0, "&", newDomain);
2057
2020
  return newDomain;
2058
2021
  }
2022
+ constructor(descr = []) {
2023
+ if (descr instanceof _Domain) {
2024
+ return new _Domain(descr.toString());
2025
+ } else {
2026
+ let rawAST;
2027
+ try {
2028
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2029
+ } catch (error) {
2030
+ throw new InvalidDomainError(
2031
+ `Invalid domain representation: ${descr}`,
2032
+ {
2033
+ cause: error
2034
+ }
2035
+ );
2036
+ }
2037
+ this.ast = normalizeDomainAST(rawAST);
2038
+ }
2039
+ }
2059
2040
  contains(record) {
2060
2041
  const expr = evaluate(this.ast, record);
2061
2042
  return matchDomain(record, expr);
@@ -2074,7 +2055,7 @@ var Domain = class _Domain {
2074
2055
  return evaluatedAsList;
2075
2056
  }
2076
2057
  return this.toString();
2077
- } catch (e) {
2058
+ } catch {
2078
2059
  return this.toString();
2079
2060
  }
2080
2061
  }
@@ -2317,22 +2298,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2317
2298
 
2318
2299
  // src/utils/storage/local-storage.ts
2319
2300
  var localStorageUtils = () => {
2320
- const setToken = (access_token) => __async(null, null, function* () {
2301
+ const setToken = async (access_token) => {
2321
2302
  localStorage.setItem("accessToken", access_token);
2322
- });
2323
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2303
+ };
2304
+ const setRefreshToken = async (refresh_token) => {
2324
2305
  localStorage.setItem("refreshToken", refresh_token);
2325
- });
2326
- const getAccessToken = () => __async(null, null, function* () {
2306
+ };
2307
+ const getAccessToken = async () => {
2327
2308
  return localStorage.getItem("accessToken");
2328
- });
2329
- const getRefreshToken = () => __async(null, null, function* () {
2309
+ };
2310
+ const getRefreshToken = async () => {
2330
2311
  return localStorage.getItem("refreshToken");
2331
- });
2332
- const clearToken = () => __async(null, null, function* () {
2312
+ };
2313
+ const clearToken = async () => {
2333
2314
  localStorage.removeItem("accessToken");
2334
2315
  localStorage.removeItem("refreshToken");
2335
- });
2316
+ };
2336
2317
  return {
2337
2318
  setToken,
2338
2319
  setRefreshToken,
@@ -2344,9 +2325,9 @@ var localStorageUtils = () => {
2344
2325
 
2345
2326
  // src/utils/storage/session-storage.ts
2346
2327
  var sessionStorageUtils = () => {
2347
- const getBrowserSession = () => __async(null, null, function* () {
2328
+ const getBrowserSession = async () => {
2348
2329
  return sessionStorage.getItem("browserSession");
2349
- });
2330
+ };
2350
2331
  return {
2351
2332
  getBrowserSession
2352
2333
  };
@@ -2355,14 +2336,13 @@ var sessionStorageUtils = () => {
2355
2336
  // src/configs/axios-client.ts
2356
2337
  var axiosClient = {
2357
2338
  init(config) {
2358
- var _a, _b;
2359
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2360
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2339
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2340
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2361
2341
  const db = config.db;
2362
2342
  let isRefreshing = false;
2363
2343
  let failedQueue = [];
2364
2344
  const processQueue = (error, token = null) => {
2365
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2345
+ failedQueue?.forEach((prom) => {
2366
2346
  if (error) {
2367
2347
  prom.reject(error);
2368
2348
  } else {
@@ -2377,38 +2357,33 @@ var axiosClient = {
2377
2357
  timeout: 5e4,
2378
2358
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2379
2359
  });
2380
- instance.interceptors.request.use(
2381
- (config2) => __async(null, null, function* () {
2382
- const useRefreshToken = config2.useRefreshToken;
2383
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2384
- if (token) {
2385
- config2.headers["Authorization"] = "Bearer " + token;
2386
- }
2387
- return config2;
2388
- }),
2389
- (error) => {
2390
- Promise.reject(error);
2360
+ instance.interceptors.request.use(async (config2) => {
2361
+ const { useRefreshToken, useActionToken, actionToken } = config2;
2362
+ if (useActionToken && actionToken) {
2363
+ config2.headers["Action-Token"] = actionToken;
2391
2364
  }
2392
- );
2365
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2366
+ const token = await getToken?.();
2367
+ if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2368
+ return config2;
2369
+ }, Promise.reject);
2393
2370
  instance.interceptors.response.use(
2394
2371
  (response) => {
2395
2372
  return handleResponse(response);
2396
2373
  },
2397
- (error) => __async(null, null, function* () {
2398
- var _a2, _b2, _c;
2399
- const handleError3 = (error2) => __async(null, null, function* () {
2400
- var _a3;
2374
+ async (error) => {
2375
+ const handleError3 = async (error2) => {
2401
2376
  if (!error2.response) {
2402
2377
  return error2;
2403
2378
  }
2404
2379
  const { data } = error2.response;
2405
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2406
- yield clearAuthToken();
2380
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
2381
+ await clearAuthToken();
2407
2382
  }
2408
2383
  return data;
2409
- });
2384
+ };
2410
2385
  const originalRequest = error.config;
2411
- 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(
2386
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2412
2387
  error.response.data.code
2413
2388
  )) {
2414
2389
  if (isRefreshing) {
@@ -2421,19 +2396,18 @@ var axiosClient = {
2421
2396
  token
2422
2397
  );
2423
2398
  return instance.request(originalRequest);
2424
- }).catch((err) => __async(null, null, function* () {
2425
- var _a3, _b3;
2426
- 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)) {
2427
- yield clearAuthToken();
2399
+ }).catch(async (err) => {
2400
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2401
+ await clearAuthToken();
2428
2402
  }
2429
- }));
2403
+ });
2430
2404
  }
2431
- const browserSession = yield sessionStorage2.getBrowserSession();
2432
- const refreshToken = yield localStorage2.getRefreshToken();
2433
- const accessTokenExp = yield localStorage2.getAccessToken();
2405
+ const browserSession = await sessionStorage2.getBrowserSession();
2406
+ const refreshToken = await localStorage2.getRefreshToken();
2407
+ const accessTokenExp = await localStorage2.getAccessToken();
2434
2408
  isRefreshing = true;
2435
2409
  if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2436
- yield clearAuthToken();
2410
+ await clearAuthToken();
2437
2411
  } else {
2438
2412
  const payload = Object.fromEntries(
2439
2413
  Object.entries({
@@ -2444,9 +2418,8 @@ var axiosClient = {
2444
2418
  }).filter(([_, value]) => !!value)
2445
2419
  );
2446
2420
  return new Promise(function(resolve) {
2447
- var _a3;
2448
2421
  import_axios.default.post(
2449
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2422
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2450
2423
  payload,
2451
2424
  {
2452
2425
  headers: {
@@ -2454,10 +2427,10 @@ var axiosClient = {
2454
2427
  Authorization: `Bearer ${accessTokenExp}`
2455
2428
  }
2456
2429
  }
2457
- ).then((res) => __async(null, null, function* () {
2430
+ ).then(async (res) => {
2458
2431
  const data = res.data;
2459
- yield localStorage2.setToken(data.access_token);
2460
- yield localStorage2.setRefreshToken(data.refresh_token);
2432
+ await localStorage2.setToken(data.access_token);
2433
+ await localStorage2.setRefreshToken(data.refresh_token);
2461
2434
  import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2462
2435
  originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2463
2436
  originalRequest.data = updateTokenParamInOriginalRequest(
@@ -2466,26 +2439,25 @@ var axiosClient = {
2466
2439
  );
2467
2440
  processQueue(null, data.access_token);
2468
2441
  resolve(instance.request(originalRequest));
2469
- })).catch((err) => __async(null, null, function* () {
2470
- var _a4;
2471
- 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") {
2472
- yield clearAuthToken();
2442
+ }).catch(async (err) => {
2443
+ if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST") || err?.error_code === "ERR_2FA_006") {
2444
+ await clearAuthToken();
2473
2445
  }
2474
2446
  if (err && err.response) {
2475
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
2447
+ const { error_code } = err.response?.data || {};
2476
2448
  if (error_code === "AUTHEN_FAIL") {
2477
- yield clearAuthToken();
2449
+ await clearAuthToken();
2478
2450
  }
2479
2451
  }
2480
2452
  processQueue(err, null);
2481
- })).finally(() => {
2453
+ }).finally(() => {
2482
2454
  isRefreshing = false;
2483
2455
  });
2484
2456
  });
2485
2457
  }
2486
2458
  }
2487
- return Promise.reject(yield handleError3(error));
2488
- })
2459
+ return Promise.reject(await handleError3(error));
2460
+ }
2489
2461
  );
2490
2462
  const handleResponse = (res) => {
2491
2463
  if (res && res.data) {
@@ -2494,7 +2466,6 @@ var axiosClient = {
2494
2466
  return res;
2495
2467
  };
2496
2468
  const handleError2 = (error) => {
2497
- var _a2, _b2, _c;
2498
2469
  if (error.isAxiosError && error.code === "ECONNABORTED") {
2499
2470
  console.error("Request Timeout Error:", error);
2500
2471
  return "Request Timeout Error";
@@ -2502,17 +2473,17 @@ var axiosClient = {
2502
2473
  console.error("Network Error:", error);
2503
2474
  return "Network Error";
2504
2475
  } else {
2505
- console.error("Other Error:", error == null ? void 0 : error.response);
2506
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
2507
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
2476
+ console.error("Other Error:", error?.response);
2477
+ const errorMessage = error?.response?.data?.message || "An error occurred";
2478
+ return { message: errorMessage, status: error?.response?.status };
2508
2479
  }
2509
2480
  };
2510
- const clearAuthToken = () => __async(null, null, function* () {
2511
- yield localStorage2.clearToken();
2481
+ const clearAuthToken = async () => {
2482
+ await localStorage2.clearToken();
2512
2483
  if (typeof window !== "undefined") {
2513
2484
  window.location.href = `/login`;
2514
2485
  }
2515
- });
2486
+ };
2516
2487
  function formatUrl(url, db2) {
2517
2488
  return url + (db2 ? "?db=" + db2 : "");
2518
2489
  }
@@ -2562,6 +2533,8 @@ var initialState2 = {
2562
2533
  requests: null,
2563
2534
  companies: [],
2564
2535
  user: {},
2536
+ db: "",
2537
+ refreshTokenEndpoint: "",
2565
2538
  config: null,
2566
2539
  envFile: null,
2567
2540
  defaultCompany: {
@@ -2725,7 +2698,7 @@ var headerSlice = (0, import_toolkit5.createSlice)({
2725
2698
  },
2726
2699
  reducers: {
2727
2700
  setHeader: (state, action) => {
2728
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
2701
+ state.value = { ...state.value, ...action.payload };
2729
2702
  },
2730
2703
  setAllowedCompanyIds: (state, action) => {
2731
2704
  state.value.allowedCompanyIds = action.payload;
@@ -3151,130 +3124,115 @@ var envStore = (0, import_toolkit11.configureStore)({
3151
3124
 
3152
3125
  // src/environment/EnvStore.ts
3153
3126
  var EnvStore = class {
3154
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3155
- this.envStore = envStore2;
3127
+ baseUrl;
3128
+ requests;
3129
+ context;
3130
+ defaultCompany;
3131
+ config;
3132
+ companies;
3133
+ user;
3134
+ db;
3135
+ localStorageUtils;
3136
+ sessionStorageUtils;
3137
+ refreshTokenEndpoint;
3138
+ constructor(localStorageUtils2, sessionStorageUtils2) {
3156
3139
  this.localStorageUtils = localStorageUtils2;
3157
3140
  this.sessionStorageUtils = sessionStorageUtils2;
3158
3141
  this.setup();
3159
3142
  }
3160
3143
  setup() {
3161
- const env2 = this.envStore.getState().env;
3162
- this.baseUrl = env2 == null ? void 0 : env2.baseUrl;
3163
- this.requests = env2 == null ? void 0 : env2.requests;
3164
- this.context = env2 == null ? void 0 : env2.context;
3165
- this.defaultCompany = env2 == null ? void 0 : env2.defaultCompany;
3166
- this.config = env2 == null ? void 0 : env2.config;
3167
- this.companies = (env2 == null ? void 0 : env2.companies) || [];
3168
- this.user = env2 == null ? void 0 : env2.user;
3169
- this.db = env2 == null ? void 0 : env2.db;
3170
- this.refreshTokenEndpoint = env2 == null ? void 0 : env2.refreshTokenEndpoint;
3144
+ const env2 = envStore.getState().env;
3145
+ this.baseUrl = env2?.baseUrl;
3146
+ this.requests = env2?.requests;
3147
+ this.context = env2?.context;
3148
+ this.defaultCompany = env2?.defaultCompany;
3149
+ this.config = env2?.config;
3150
+ this.companies = env2?.companies || [];
3151
+ this.user = env2?.user;
3152
+ this.db = env2?.db;
3153
+ this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
3154
+ console.log("env from interface-logic", env2);
3171
3155
  }
3172
3156
  setupEnv(envConfig) {
3173
- const dispatch = this.envStore.dispatch;
3174
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3157
+ const dispatch = envStore.dispatch;
3158
+ const env2 = {
3159
+ ...envConfig,
3175
3160
  localStorageUtils: this.localStorageUtils,
3176
3161
  sessionStorageUtils: this.sessionStorageUtils
3177
- });
3162
+ };
3178
3163
  const requests = axiosClient.init(env2);
3179
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3164
+ dispatch(setEnv({ ...env2, requests }));
3180
3165
  this.setup();
3181
3166
  }
3182
3167
  setUid(uid) {
3183
- const dispatch = this.envStore.dispatch;
3168
+ const dispatch = envStore.dispatch;
3184
3169
  dispatch(setUid(uid));
3185
3170
  this.setup();
3186
3171
  }
3187
3172
  setLang(lang) {
3188
- const dispatch = this.envStore.dispatch;
3173
+ const dispatch = envStore.dispatch;
3189
3174
  dispatch(setLang(lang));
3190
3175
  this.setup();
3191
3176
  }
3192
3177
  setAllowCompanies(allowCompanies) {
3193
- const dispatch = this.envStore.dispatch;
3178
+ const dispatch = envStore.dispatch;
3194
3179
  dispatch(setAllowCompanies(allowCompanies));
3195
3180
  this.setup();
3196
3181
  }
3197
3182
  setCompanies(companies) {
3198
- const dispatch = this.envStore.dispatch;
3183
+ const dispatch = envStore.dispatch;
3199
3184
  dispatch(setCompanies(companies));
3200
3185
  this.setup();
3201
3186
  }
3202
3187
  setDefaultCompany(company) {
3203
- const dispatch = this.envStore.dispatch;
3188
+ const dispatch = envStore.dispatch;
3204
3189
  dispatch(setDefaultCompany(company));
3205
3190
  this.setup();
3206
3191
  }
3207
3192
  setUserInfo(userInfo) {
3208
- const dispatch = this.envStore.dispatch;
3193
+ const dispatch = envStore.dispatch;
3209
3194
  dispatch(setUser(userInfo));
3210
3195
  this.setup();
3211
3196
  }
3212
3197
  };
3213
3198
  var env = null;
3214
3199
  function getEnv() {
3215
- if (!env)
3216
- env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3200
+ if (!env) env = new EnvStore(localStorageUtils(), sessionStorageUtils());
3217
3201
  return env;
3218
3202
  }
3219
3203
 
3220
3204
  // src/services/action-service/index.ts
3221
3205
  var ActionService = {
3222
3206
  // Load Action
3223
- loadAction(_0) {
3224
- return __async(this, arguments, function* ({
3225
- idAction,
3226
- context
3227
- }) {
3228
- const env2 = getEnv();
3229
- const jsonData = {
3230
- action_id: idAction,
3231
- with_context: __spreadValues({}, context)
3232
- };
3233
- return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3234
- headers: {
3235
- "Content-Type": "application/json"
3236
- }
3237
- });
3238
- });
3239
- },
3240
- // Call Button
3241
- callButton(_0) {
3242
- return __async(this, arguments, function* ({
3243
- model,
3244
- ids = [],
3245
- context,
3246
- method
3247
- }) {
3248
- try {
3249
- const env2 = getEnv();
3250
- const jsonData = {
3251
- model,
3252
- method,
3253
- ids,
3254
- with_context: context
3255
- };
3256
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3257
- headers: {
3258
- "Content-Type": "application/json"
3259
- }
3260
- });
3261
- } catch (error) {
3262
- console.error("Error when calling button action:", error);
3263
- throw error;
3207
+ async loadAction({
3208
+ idAction,
3209
+ context
3210
+ }) {
3211
+ const env2 = getEnv();
3212
+ const jsonData = {
3213
+ action_id: idAction,
3214
+ with_context: {
3215
+ ...context
3216
+ }
3217
+ };
3218
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3219
+ headers: {
3220
+ "Content-Type": "application/json"
3264
3221
  }
3265
3222
  });
3266
3223
  },
3267
- // remove Row
3268
- removeRows(_0) {
3269
- return __async(this, arguments, function* ({
3270
- model,
3271
- ids,
3272
- context
3273
- }) {
3224
+ // Call Button
3225
+ async callButton({
3226
+ model,
3227
+ ids = [],
3228
+ context,
3229
+ method
3230
+ }) {
3231
+ try {
3274
3232
  const env2 = getEnv();
3275
3233
  const jsonData = {
3276
3234
  model,
3277
- method: "unlink",
3235
+ method,
3278
3236
  ids,
3279
3237
  with_context: context
3280
3238
  };
@@ -3283,96 +3241,112 @@ var ActionService = {
3283
3241
  "Content-Type": "application/json"
3284
3242
  }
3285
3243
  });
3244
+ } catch (error) {
3245
+ console.error("Error when calling button action:", error);
3246
+ throw error;
3247
+ }
3248
+ },
3249
+ // remove Row
3250
+ async removeRows({
3251
+ model,
3252
+ ids,
3253
+ context
3254
+ }) {
3255
+ const env2 = getEnv();
3256
+ const jsonData = {
3257
+ model,
3258
+ method: "unlink",
3259
+ ids,
3260
+ with_context: context
3261
+ };
3262
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3263
+ headers: {
3264
+ "Content-Type": "application/json"
3265
+ }
3286
3266
  });
3287
3267
  },
3288
3268
  // Duplicate Model
3289
- duplicateRecord(_0) {
3290
- return __async(this, arguments, function* ({
3269
+ async duplicateRecord({
3270
+ model,
3271
+ id,
3272
+ context
3273
+ }) {
3274
+ const env2 = getEnv();
3275
+ const jsonData = {
3291
3276
  model,
3292
- id,
3293
- context
3294
- }) {
3295
- const env2 = getEnv();
3296
- const jsonData = {
3297
- model,
3298
- method: "copy",
3299
- ids: id,
3300
- with_context: context
3301
- };
3302
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3303
- headers: {
3304
- "Content-Type": "application/json"
3305
- }
3306
- });
3277
+ method: "copy",
3278
+ ids: id,
3279
+ with_context: context
3280
+ };
3281
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3282
+ headers: {
3283
+ "Content-Type": "application/json"
3284
+ }
3307
3285
  });
3308
3286
  },
3309
3287
  // Get Print Report
3310
- getPrintReportName(_0) {
3311
- return __async(this, arguments, function* ({ id }) {
3312
- const env2 = getEnv();
3313
- const jsonData = {
3314
- model: "ir.actions.report",
3315
- method: "web_read",
3316
- id,
3317
- kwargs: {
3318
- specification: {
3319
- report_name: {}
3320
- }
3321
- }
3322
- };
3323
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3324
- headers: {
3325
- "Content-Type": "application/json"
3288
+ async getPrintReportName({ id }) {
3289
+ const env2 = getEnv();
3290
+ const jsonData = {
3291
+ model: "ir.actions.report",
3292
+ method: "web_read",
3293
+ id,
3294
+ kwargs: {
3295
+ specification: {
3296
+ report_name: {}
3326
3297
  }
3327
- });
3298
+ }
3299
+ };
3300
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3301
+ headers: {
3302
+ "Content-Type": "application/json"
3303
+ }
3328
3304
  });
3329
3305
  },
3330
3306
  //Save Print Invoice
3331
- print(_0) {
3332
- return __async(this, arguments, function* ({ id, report, db }) {
3333
- const env2 = getEnv();
3334
- const jsonData = {
3335
- report,
3336
- id,
3337
- type: "pdf",
3338
- file_response: true,
3339
- db
3340
- };
3341
- const queryString = toQueryString(jsonData);
3342
- const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3343
- return env2.requests.get(urlWithParams, {
3344
- headers: {
3345
- "Content-Type": "application/json"
3346
- },
3347
- responseType: "arraybuffer"
3348
- });
3307
+ async print({ id, report, db }) {
3308
+ const env2 = getEnv();
3309
+ const jsonData = {
3310
+ report,
3311
+ id,
3312
+ type: "pdf",
3313
+ file_response: true,
3314
+ db
3315
+ };
3316
+ const queryString = toQueryString(jsonData);
3317
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3318
+ return env2.requests.get(urlWithParams, {
3319
+ headers: {
3320
+ "Content-Type": "application/json"
3321
+ },
3322
+ responseType: "arraybuffer"
3349
3323
  });
3350
3324
  },
3351
3325
  //Run Action
3352
- runAction(_0) {
3353
- return __async(this, arguments, function* ({
3354
- idAction,
3355
- context
3356
- }) {
3357
- const env2 = getEnv();
3358
- const jsonData = {
3359
- action_id: idAction,
3360
- with_context: __spreadValues({}, context)
3361
- // context: {
3362
- // lang: 'en_US',
3363
- // tz: 'Asia/Saigon',
3364
- // uid: 2,
3365
- // allowed_company_ids: [1],
3366
- // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3367
- // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3368
- // active_model: model,
3369
- // },
3370
- };
3371
- return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3372
- headers: {
3373
- "Content-Type": "application/json"
3374
- }
3375
- });
3326
+ async runAction({
3327
+ idAction,
3328
+ context
3329
+ }) {
3330
+ const env2 = getEnv();
3331
+ const jsonData = {
3332
+ action_id: idAction,
3333
+ with_context: {
3334
+ ...context
3335
+ }
3336
+ // context: {
3337
+ // lang: 'en_US',
3338
+ // tz: 'Asia/Saigon',
3339
+ // uid: 2,
3340
+ // allowed_company_ids: [1],
3341
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3342
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3343
+ // active_model: model,
3344
+ // },
3345
+ };
3346
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3347
+ headers: {
3348
+ "Content-Type": "application/json"
3349
+ }
3376
3350
  });
3377
3351
  }
3378
3352
  };
@@ -3380,910 +3354,828 @@ var action_service_default = ActionService;
3380
3354
 
3381
3355
  // src/services/auth-service/index.ts
3382
3356
  var AuthService = {
3383
- login(body) {
3384
- return __async(this, null, function* () {
3385
- var _a, _b, _c, _d;
3386
- const env2 = getEnv();
3387
- const payload = Object.fromEntries(
3388
- Object.entries({
3389
- username: body.email,
3390
- password: body.password,
3391
- grant_type: ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.grantType) || "",
3392
- client_id: ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.clientId) || "",
3393
- client_secret: ((_c = env2 == null ? void 0 : env2.config) == null ? void 0 : _c.clientSecret) || ""
3394
- }).filter(([_, value]) => !!value)
3395
- );
3396
- const encodedData = new URLSearchParams(payload).toString();
3397
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(body.path, encodedData, {
3398
- headers: {
3399
- "Content-Type": "application/x-www-form-urlencoded"
3400
- }
3401
- });
3357
+ async login(body) {
3358
+ const env2 = getEnv();
3359
+ const payload = Object.fromEntries(
3360
+ Object.entries({
3361
+ username: body.email,
3362
+ password: body.password,
3363
+ grant_type: env2?.config?.grantType || "",
3364
+ client_id: env2?.config?.clientId || "",
3365
+ client_secret: env2?.config?.clientSecret || ""
3366
+ }).filter(([_, value]) => !!value)
3367
+ );
3368
+ const encodedData = new URLSearchParams(payload).toString();
3369
+ return env2?.requests?.post(body.path, encodedData, {
3370
+ headers: {
3371
+ "Content-Type": "application/x-www-form-urlencoded"
3372
+ }
3402
3373
  });
3403
3374
  },
3404
- forgotPassword(email) {
3405
- return __async(this, null, function* () {
3406
- var _a;
3407
- const env2 = getEnv();
3408
- const bodyData = {
3409
- login: email,
3410
- url: `${window.location.origin}/reset-password`
3411
- };
3412
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3413
- headers: {
3414
- "Content-Type": "application/json"
3415
- }
3416
- });
3375
+ async forgotPassword(email) {
3376
+ const env2 = getEnv();
3377
+ const bodyData = {
3378
+ login: email,
3379
+ url: `${window.location.origin}/reset-password`
3380
+ };
3381
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3382
+ headers: {
3383
+ "Content-Type": "application/json"
3384
+ }
3417
3385
  });
3418
3386
  },
3419
- forgotPasswordSSO(_0) {
3420
- return __async(this, arguments, function* ({
3421
- email,
3422
- with_context,
3423
- method
3424
- }) {
3425
- var _a;
3426
- const env2 = getEnv();
3427
- const body = {
3428
- method,
3429
- kwargs: {
3430
- vals: {
3431
- email
3432
- }
3433
- },
3434
- with_context
3435
- };
3436
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, body, {
3437
- headers: {
3438
- "Content-Type": "application/json"
3387
+ async forgotPasswordSSO({
3388
+ email,
3389
+ with_context,
3390
+ method
3391
+ }) {
3392
+ const env2 = getEnv();
3393
+ const body = {
3394
+ method,
3395
+ kwargs: {
3396
+ vals: {
3397
+ email
3439
3398
  }
3440
- });
3399
+ },
3400
+ with_context
3401
+ };
3402
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3403
+ headers: {
3404
+ "Content-Type": "application/json"
3405
+ }
3441
3406
  });
3442
3407
  },
3443
- resetPassword(data, token) {
3444
- return __async(this, null, function* () {
3445
- var _a;
3446
- const env2 = getEnv();
3447
- const bodyData = {
3448
- token,
3449
- password: data.password,
3450
- new_password: data.confirmPassword
3451
- };
3452
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3453
- headers: {
3454
- "Content-Type": "application/json"
3455
- }
3456
- });
3408
+ async resetPassword(data, token) {
3409
+ const env2 = getEnv();
3410
+ const bodyData = {
3411
+ token,
3412
+ password: data.password,
3413
+ new_password: data.confirmPassword
3414
+ };
3415
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3416
+ headers: {
3417
+ "Content-Type": "application/json"
3418
+ }
3457
3419
  });
3458
3420
  },
3459
- resetPasswordSSO(_0) {
3460
- return __async(this, arguments, function* ({
3421
+ async resetPasswordSSO({
3422
+ method,
3423
+ password,
3424
+ with_context
3425
+ }) {
3426
+ const env2 = getEnv();
3427
+ const bodyData = {
3461
3428
  method,
3462
- password,
3463
- with_context
3464
- }) {
3465
- var _a;
3466
- const env2 = getEnv();
3467
- const bodyData = {
3468
- method,
3469
- kwargs: {
3470
- vals: {
3471
- password
3472
- }
3429
+ kwargs: {
3430
+ vals: {
3431
+ password
3432
+ }
3433
+ },
3434
+ with_context
3435
+ };
3436
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3437
+ headers: {
3438
+ "Content-Type": "application/json"
3439
+ }
3440
+ });
3441
+ },
3442
+ async updatePassword(data, token) {
3443
+ const env2 = getEnv();
3444
+ const bodyData = {
3445
+ token,
3446
+ old_password: data.oldPassword,
3447
+ new_password: data.newPassword
3448
+ };
3449
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3450
+ headers: {
3451
+ "Content-Type": "application/json"
3452
+ }
3453
+ });
3454
+ },
3455
+ async isValidToken(token) {
3456
+ const env2 = getEnv();
3457
+ const bodyData = {
3458
+ token
3459
+ };
3460
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3461
+ headers: {
3462
+ "Content-Type": "application/json"
3463
+ }
3464
+ });
3465
+ },
3466
+ async isValidActionToken(actionToken, path) {
3467
+ const env2 = getEnv();
3468
+ return env2?.requests?.post(
3469
+ path,
3470
+ {},
3471
+ {
3472
+ headers: {
3473
+ "Content-Type": "application/json"
3473
3474
  },
3474
- with_context
3475
- };
3476
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, bodyData, {
3475
+ useActionToken: true,
3476
+ actionToken
3477
+ }
3478
+ );
3479
+ },
3480
+ async loginSocial({
3481
+ db,
3482
+ state,
3483
+ access_token
3484
+ }) {
3485
+ const env2 = getEnv();
3486
+ return env2?.requests?.post(
3487
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3488
+ { state, access_token },
3489
+ {
3477
3490
  headers: {
3478
3491
  "Content-Type": "application/json"
3479
3492
  }
3480
- });
3481
- });
3493
+ }
3494
+ );
3482
3495
  },
3483
- updatePassword(data, token) {
3484
- return __async(this, null, function* () {
3485
- var _a;
3486
- const env2 = getEnv();
3487
- const bodyData = {
3488
- token,
3489
- old_password: data.oldPassword,
3490
- new_password: data.newPassword
3491
- };
3492
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3496
+ async getProviders(db) {
3497
+ const env2 = getEnv();
3498
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3499
+ },
3500
+ async getAccessByCode(code) {
3501
+ const env2 = getEnv();
3502
+ const data = new URLSearchParams();
3503
+ data.append("code", code);
3504
+ data.append("grant_type", "authorization_code");
3505
+ data.append("client_id", env2?.config?.clientId || "");
3506
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3507
+ return env2?.requests?.post(
3508
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3509
+ data,
3510
+ {
3493
3511
  headers: {
3494
- "Content-Type": "application/json"
3512
+ "Content-Type": "application/x-www-form-urlencoded"
3495
3513
  }
3496
- });
3497
- });
3514
+ }
3515
+ );
3498
3516
  },
3499
- isValidToken(token) {
3500
- return __async(this, null, function* () {
3501
- var _a;
3502
- const env2 = getEnv();
3503
- const bodyData = {
3504
- token
3505
- };
3506
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/check_token" /* TOKEN */, bodyData, {
3517
+ async logout(data) {
3518
+ const env2 = getEnv();
3519
+ console.log(data);
3520
+ return env2?.requests?.post(
3521
+ "/logout" /* LOGOUT */,
3522
+ {},
3523
+ {
3507
3524
  headers: {
3508
3525
  "Content-Type": "application/json"
3509
- }
3510
- });
3526
+ },
3527
+ withCredentials: true,
3528
+ useRefreshToken: true
3529
+ }
3530
+ );
3531
+ }
3532
+ };
3533
+ var auth_service_default = AuthService;
3534
+
3535
+ // src/services/company-service/index.ts
3536
+ var CompanyService = {
3537
+ async getCurrentCompany() {
3538
+ const env2 = getEnv();
3539
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3540
+ headers: {
3541
+ "Content-Type": "application/json"
3542
+ }
3511
3543
  });
3512
3544
  },
3513
- loginSocial(_0) {
3514
- return __async(this, arguments, function* ({
3515
- db,
3516
- state,
3517
- access_token
3518
- }) {
3519
- var _a;
3520
- const env2 = getEnv();
3521
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3522
- "/token/generate" /* GENTOKEN_SOCIAL */,
3523
- { state, access_token },
3524
- {
3525
- headers: {
3526
- "Content-Type": "application/json"
3527
- }
3545
+ async getInfoCompany(id) {
3546
+ const env2 = getEnv();
3547
+ const jsonData = {
3548
+ ids: [id],
3549
+ model: "res.company" /* COMPANY */,
3550
+ method: "web_read" /* WEB_READ */,
3551
+ kwargs: {
3552
+ specification: {
3553
+ primary_color: {},
3554
+ secondary_color: {},
3555
+ logo: {},
3556
+ display_name: {},
3557
+ secondary_logo: {}
3528
3558
  }
3529
- );
3559
+ }
3560
+ };
3561
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3562
+ headers: {
3563
+ "Content-Type": "application/json"
3564
+ }
3565
+ });
3566
+ }
3567
+ };
3568
+ var company_service_default = CompanyService;
3569
+
3570
+ // src/services/excel-service/index.ts
3571
+ var ExcelService = {
3572
+ async uploadFile({ formData }) {
3573
+ const env2 = getEnv();
3574
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3575
+ headers: {
3576
+ "Content-Type": "multipart/form-data"
3577
+ }
3530
3578
  });
3531
3579
  },
3532
- getProviders(db) {
3533
- return __async(this, null, function* () {
3534
- var _a;
3535
- const env2 = getEnv();
3536
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("/oauth/providers", { params: { db } });
3580
+ async uploadIdFile({ formData }) {
3581
+ const env2 = getEnv();
3582
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3583
+ headers: {
3584
+ "Content-Type": "multipart/form-data"
3585
+ }
3537
3586
  });
3538
3587
  },
3539
- getAccessByCode(code) {
3540
- return __async(this, null, function* () {
3541
- var _a, _b, _c, _d;
3542
- const env2 = getEnv();
3543
- const data = new URLSearchParams();
3544
- data.append("code", code);
3545
- data.append("grant_type", "authorization_code");
3546
- data.append("client_id", ((_a = env2 == null ? void 0 : env2.config) == null ? void 0 : _a.clientId) || "");
3547
- data.append("redirect_uri", ((_b = env2 == null ? void 0 : env2.config) == null ? void 0 : _b.redirectUri) || "");
3548
- return (_d = env2 == null ? void 0 : env2.requests) == null ? void 0 : _d.post(
3549
- `${(_c = env2 == null ? void 0 : env2.baseUrl) == null ? void 0 : _c.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3550
- data,
3551
- {
3552
- headers: {
3553
- "Content-Type": "application/x-www-form-urlencoded"
3554
- }
3588
+ async parsePreview({
3589
+ id,
3590
+ selectedSheet,
3591
+ isHeader,
3592
+ context
3593
+ }) {
3594
+ const env2 = getEnv();
3595
+ const jsonData = {
3596
+ model: "base_import.import" /* BASE_IMPORT */,
3597
+ method: "parse_preview",
3598
+ ids: [id],
3599
+ kwargs: {
3600
+ options: {
3601
+ import_skip_records: [],
3602
+ import_set_empty_fields: [],
3603
+ fallback_values: {},
3604
+ name_create_enabled_fields: {},
3605
+ encoding: "",
3606
+ separator: "",
3607
+ quoting: '"',
3608
+ date_format: "",
3609
+ datetime_format: "",
3610
+ float_thousand_separator: ",",
3611
+ float_decimal_separator: ".",
3612
+ advanced: true,
3613
+ has_headers: isHeader,
3614
+ keep_matches: false,
3615
+ limit: 2e3,
3616
+ sheets: [],
3617
+ sheet: selectedSheet,
3618
+ skip: 0,
3619
+ tracking_disable: true
3555
3620
  }
3556
- );
3621
+ },
3622
+ with_context: context
3623
+ };
3624
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3625
+ headers: {
3626
+ "Content-Type": "multipart/form-data"
3627
+ }
3557
3628
  });
3558
3629
  },
3559
- logout(data) {
3560
- return __async(this, null, function* () {
3561
- var _a;
3562
- const env2 = getEnv();
3563
- console.log(data);
3564
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(
3565
- "/logout" /* LOGOUT */,
3566
- {},
3567
- {
3568
- headers: {
3569
- "Content-Type": "application/json"
3570
- },
3571
- withCredentials: true,
3572
- useRefreshToken: true
3573
- }
3574
- );
3630
+ async executeImport({
3631
+ columns,
3632
+ fields,
3633
+ idFile,
3634
+ options,
3635
+ dryrun,
3636
+ context
3637
+ }) {
3638
+ const env2 = getEnv();
3639
+ const jsonData = {
3640
+ model: "base_import.import" /* BASE_IMPORT */,
3641
+ method: "execute_import",
3642
+ ids: [idFile],
3643
+ kwargs: {
3644
+ fields,
3645
+ columns,
3646
+ options,
3647
+ dryrun
3648
+ },
3649
+ with_context: context
3650
+ };
3651
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3652
+ headers: {
3653
+ "Content-Type": "multipart/form-data"
3654
+ }
3575
3655
  });
3656
+ },
3657
+ async getFileExcel({ model }) {
3658
+ const env2 = getEnv();
3659
+ const jsonData = {
3660
+ model,
3661
+ method: "get_import_templates" /* GET_IMPORT */,
3662
+ args: []
3663
+ };
3664
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3665
+ },
3666
+ async getFieldExport({
3667
+ ids,
3668
+ model,
3669
+ isShow,
3670
+ parentField,
3671
+ fieldType,
3672
+ parentName,
3673
+ prefix,
3674
+ name,
3675
+ context,
3676
+ importCompat
3677
+ }) {
3678
+ const env2 = getEnv();
3679
+ const jsonData = {
3680
+ model,
3681
+ import_compat: importCompat,
3682
+ domain: [["id", "in", ids]],
3683
+ with_context: context
3684
+ };
3685
+ if (isShow) {
3686
+ jsonData.parent_field = parentField;
3687
+ jsonData.parent_field_type = fieldType;
3688
+ jsonData.parent_name = parentName;
3689
+ jsonData.name = name;
3690
+ jsonData.prefix = prefix;
3691
+ jsonData.exclude = [null];
3692
+ }
3693
+ return env2.requests.post("/export/get_fields", jsonData);
3694
+ },
3695
+ async exportExcel({
3696
+ model,
3697
+ domain,
3698
+ ids,
3699
+ fields,
3700
+ type,
3701
+ importCompat,
3702
+ context,
3703
+ groupby
3704
+ }) {
3705
+ const env2 = getEnv();
3706
+ const jsonData = {
3707
+ model,
3708
+ domain,
3709
+ ids,
3710
+ import_compat: importCompat,
3711
+ fields,
3712
+ with_context: context,
3713
+ groupby: groupby ?? []
3714
+ };
3715
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3576
3716
  }
3577
3717
  };
3578
- var auth_service_default = AuthService;
3718
+ var excel_service_default = ExcelService;
3579
3719
 
3580
- // src/services/company-service/index.ts
3581
- var CompanyService = {
3582
- getCurrentCompany() {
3583
- return __async(this, null, function* () {
3720
+ // src/services/form-service/index.ts
3721
+ var FormService = {
3722
+ async getComment({ data }) {
3723
+ try {
3584
3724
  const env2 = getEnv();
3585
- return yield env2.requests.get("/company" /* COMPANY_PATH */, {
3725
+ const jsonData = {
3726
+ thread_id: data.thread_id,
3727
+ thread_model: data.thread_model,
3728
+ limit: 100,
3729
+ with_context: {
3730
+ lang: data.lang
3731
+ }
3732
+ };
3733
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3586
3734
  headers: {
3587
3735
  "Content-Type": "application/json"
3588
3736
  }
3589
3737
  });
3590
- });
3738
+ } catch (error) {
3739
+ console.error("Error when sending message:", error);
3740
+ throw error;
3741
+ }
3591
3742
  },
3592
- getInfoCompany(id) {
3593
- return __async(this, null, function* () {
3594
- var _a;
3743
+ async sentComment({ data }) {
3744
+ try {
3595
3745
  const env2 = getEnv();
3596
3746
  const jsonData = {
3597
- ids: [id],
3598
- model: "res.company" /* COMPANY */,
3599
- method: "web_read" /* WEB_READ */,
3600
- kwargs: {
3601
- specification: {
3602
- primary_color: {},
3603
- secondary_color: {},
3604
- logo: {},
3605
- display_name: {},
3606
- secondary_logo: {}
3607
- }
3608
- }
3747
+ context: {
3748
+ tz: "Asia/Saigon",
3749
+ uid: 2,
3750
+ allowed_company_ids: [1],
3751
+ mail_post_autofollow: false,
3752
+ temporary_id: 142183.01
3753
+ },
3754
+ post_data: {
3755
+ body: data.message,
3756
+ message_type: "comment",
3757
+ attachment_ids: data.attachment_ids,
3758
+ attachment_tokens: [],
3759
+ subtype_xmlid: data.subtype
3760
+ },
3761
+ thread_id: Number(data.thread_id),
3762
+ thread_model: data.thread_model
3609
3763
  };
3610
- return yield (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3764
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3611
3765
  headers: {
3612
3766
  "Content-Type": "application/json"
3613
3767
  }
3614
3768
  });
3615
- });
3616
- }
3617
- };
3618
- var company_service_default = CompanyService;
3619
-
3620
- // src/services/excel-service/index.ts
3621
- var ExcelService = {
3622
- uploadFile(_0) {
3623
- return __async(this, arguments, function* ({ formData }) {
3769
+ } catch (error) {
3770
+ console.error("Error when sent message:", error);
3771
+ throw error;
3772
+ }
3773
+ },
3774
+ async deleteComment({ data }) {
3775
+ try {
3624
3776
  const env2 = getEnv();
3625
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3777
+ const jsonData = {
3778
+ attachment_ids: [],
3779
+ attachment_tokens: [],
3780
+ body: "",
3781
+ message_id: data.message_id
3782
+ };
3783
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3626
3784
  headers: {
3627
- "Content-Type": "multipart/form-data"
3785
+ "Content-Type": "application/json"
3628
3786
  }
3629
3787
  });
3630
- });
3788
+ } catch (error) {
3789
+ console.error("Error when sent message:", error);
3790
+ throw error;
3791
+ }
3631
3792
  },
3632
- uploadIdFile(_0) {
3633
- return __async(this, arguments, function* ({ formData }) {
3793
+ async getImage({ data }) {
3794
+ try {
3634
3795
  const env2 = getEnv();
3635
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3636
- headers: {
3637
- "Content-Type": "multipart/form-data"
3796
+ return env2.requests.get(
3797
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3798
+ {
3799
+ headers: {
3800
+ "Content-Type": "application/json"
3801
+ }
3638
3802
  }
3639
- });
3640
- });
3803
+ );
3804
+ } catch (error) {
3805
+ console.error("Error when sent message:", error);
3806
+ throw error;
3807
+ }
3641
3808
  },
3642
- parsePreview(_0) {
3643
- return __async(this, arguments, function* ({
3644
- id,
3645
- selectedSheet,
3646
- isHeader,
3647
- context
3648
- }) {
3809
+ async uploadImage({ data }) {
3810
+ try {
3649
3811
  const env2 = getEnv();
3650
- const jsonData = {
3651
- model: "base_import.import" /* BASE_IMPORT */,
3652
- method: "parse_preview",
3653
- ids: [id],
3654
- kwargs: {
3655
- options: {
3656
- import_skip_records: [],
3657
- import_set_empty_fields: [],
3658
- fallback_values: {},
3659
- name_create_enabled_fields: {},
3660
- encoding: "",
3661
- separator: "",
3662
- quoting: '"',
3663
- date_format: "",
3664
- datetime_format: "",
3665
- float_thousand_separator: ",",
3666
- float_decimal_separator: ".",
3667
- advanced: true,
3668
- has_headers: isHeader,
3669
- keep_matches: false,
3670
- limit: 2e3,
3671
- sheets: [],
3672
- sheet: selectedSheet,
3673
- skip: 0,
3674
- tracking_disable: true
3675
- }
3676
- },
3677
- with_context: context
3678
- };
3679
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3812
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3680
3813
  headers: {
3681
3814
  "Content-Type": "multipart/form-data"
3682
3815
  }
3683
3816
  });
3684
- });
3817
+ } catch (error) {
3818
+ console.error("Error when sent message:", error);
3819
+ throw error;
3820
+ }
3685
3821
  },
3686
- executeImport(_0) {
3687
- return __async(this, arguments, function* ({
3688
- columns,
3689
- fields,
3690
- idFile,
3691
- options,
3692
- dryrun,
3693
- context
3694
- }) {
3822
+ async getFormView({ data }) {
3823
+ try {
3695
3824
  const env2 = getEnv();
3696
3825
  const jsonData = {
3697
- model: "base_import.import" /* BASE_IMPORT */,
3698
- method: "execute_import",
3699
- ids: [idFile],
3700
- kwargs: {
3701
- fields,
3702
- columns,
3703
- options,
3704
- dryrun
3705
- },
3706
- with_context: context
3826
+ model: data.model,
3827
+ method: "get_formview_action",
3828
+ ids: data.id ? [data.id] : [],
3829
+ with_context: data.context
3707
3830
  };
3708
3831
  return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3709
3832
  headers: {
3710
- "Content-Type": "multipart/form-data"
3833
+ "Content-Type": "application/json"
3711
3834
  }
3712
3835
  });
3713
- });
3836
+ } catch (error) {
3837
+ console.error("Error when fetching form view:", error);
3838
+ throw error;
3839
+ }
3714
3840
  },
3715
- getFileExcel(_0) {
3716
- return __async(this, arguments, function* ({ model }) {
3717
- const env2 = getEnv();
3718
- const jsonData = {
3719
- model,
3720
- method: "get_import_templates" /* GET_IMPORT */,
3721
- args: []
3722
- };
3723
- return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3841
+ async changeStatus({ data }) {
3842
+ const env2 = getEnv();
3843
+ const vals = {
3844
+ [data.name]: data.stage_id
3845
+ };
3846
+ const jsonData = {
3847
+ model: data.model,
3848
+ method: "web_save",
3849
+ with_context: {
3850
+ lang: data.lang,
3851
+ allowed_company_ids: [1],
3852
+ uid: 2,
3853
+ search_default_my_ticket: true,
3854
+ search_default_is_open: true
3855
+ },
3856
+ ids: [data.id],
3857
+ kwargs: {
3858
+ vals,
3859
+ specification: {}
3860
+ }
3861
+ };
3862
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3863
+ headers: {
3864
+ "Content-Type": "application/json"
3865
+ }
3724
3866
  });
3725
- },
3726
- getFieldExport(_0) {
3727
- return __async(this, arguments, function* ({
3728
- ids,
3867
+ }
3868
+ };
3869
+ var form_service_default = FormService;
3870
+
3871
+ // src/services/kanban-service/index.ts
3872
+ var KanbanServices = {
3873
+ async getGroups({
3874
+ model,
3875
+ width_context
3876
+ }) {
3877
+ const env2 = getEnv();
3878
+ const jsonDataView = {
3729
3879
  model,
3730
- isShow,
3731
- parentField,
3732
- fieldType,
3733
- parentName,
3734
- prefix,
3735
- name,
3736
- context,
3737
- importCompat
3738
- }) {
3739
- const env2 = getEnv();
3740
- const jsonData = {
3741
- model,
3742
- import_compat: importCompat,
3743
- domain: [["id", "in", ids]],
3744
- with_context: context
3745
- };
3746
- if (isShow) {
3747
- jsonData.parent_field = parentField;
3748
- jsonData.parent_field_type = fieldType;
3749
- jsonData.parent_name = parentName;
3750
- jsonData.name = name;
3751
- jsonData.prefix = prefix;
3752
- jsonData.exclude = [null];
3753
- }
3754
- return env2.requests.post("/export/get_fields", jsonData);
3880
+ method: "web_read_group",
3881
+ kwargs: {
3882
+ domain: [["stage_id.fold", "=", false]],
3883
+ fields: ["color:sum"],
3884
+ groupby: ["stage_id"]
3885
+ },
3886
+ width_context
3887
+ };
3888
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3889
+ headers: {
3890
+ "Content-Type": "application/json"
3891
+ }
3755
3892
  });
3756
3893
  },
3757
- exportExcel(_0) {
3758
- return __async(this, arguments, function* ({
3894
+ async getProgressBar({
3895
+ field,
3896
+ color,
3897
+ model,
3898
+ width_context
3899
+ }) {
3900
+ const env2 = getEnv();
3901
+ const jsonDataView = {
3759
3902
  model,
3760
- domain,
3761
- ids,
3762
- fields,
3763
- type,
3764
- importCompat,
3765
- context,
3766
- groupby
3767
- }) {
3768
- const env2 = getEnv();
3769
- const jsonData = {
3770
- model,
3771
- domain,
3772
- ids,
3773
- import_compat: importCompat,
3774
- fields,
3775
- with_context: context,
3776
- groupby: groupby != null ? groupby : []
3777
- };
3778
- return env2.requests.post_excel(`/export/${type}`, jsonData);
3903
+ method: "read_progress_bar",
3904
+ kwargs: {
3905
+ domain: [],
3906
+ group_by: "stage_id",
3907
+ progress_bar: {
3908
+ colors: color,
3909
+ field
3910
+ }
3911
+ },
3912
+ width_context
3913
+ };
3914
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3915
+ headers: {
3916
+ "Content-Type": "application/json"
3917
+ }
3779
3918
  });
3780
3919
  }
3781
3920
  };
3782
- var excel_service_default = ExcelService;
3921
+ var kanban_service_default = KanbanServices;
3783
3922
 
3784
- // src/services/form-service/index.ts
3785
- var FormService = {
3786
- getComment(_0) {
3787
- return __async(this, arguments, function* ({ data }) {
3788
- try {
3789
- const env2 = getEnv();
3790
- const jsonData = {
3791
- thread_id: data.thread_id,
3792
- thread_model: data.thread_model,
3793
- limit: 100,
3794
- with_context: {
3795
- lang: data.lang
3796
- }
3797
- };
3798
- return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3799
- headers: {
3800
- "Content-Type": "application/json"
3801
- }
3802
- });
3803
- } catch (error) {
3804
- console.error("Error when sending message:", error);
3805
- throw error;
3923
+ // src/services/model-service/index.ts
3924
+ var OBJECT_POSITION = 2;
3925
+ var ModelService = {
3926
+ async getListMyBankAccount({
3927
+ domain,
3928
+ spectification,
3929
+ model
3930
+ }) {
3931
+ const env2 = getEnv();
3932
+ const jsonData = {
3933
+ model,
3934
+ method: "web_search_read",
3935
+ kwargs: {
3936
+ specification: spectification,
3937
+ domain,
3938
+ limit: 100,
3939
+ offset: 0
3806
3940
  }
3807
- });
3808
- },
3809
- sentComment(_0) {
3810
- return __async(this, arguments, function* ({ data }) {
3811
- try {
3812
- const env2 = getEnv();
3813
- const jsonData = {
3814
- context: {
3815
- tz: "Asia/Saigon",
3816
- uid: 2,
3817
- allowed_company_ids: [1],
3818
- mail_post_autofollow: false,
3819
- temporary_id: 142183.01
3820
- },
3821
- post_data: {
3822
- body: data.message,
3823
- message_type: "comment",
3824
- attachment_ids: data.attachment_ids,
3825
- attachment_tokens: [],
3826
- subtype_xmlid: data.subtype
3827
- },
3828
- thread_id: Number(data.thread_id),
3829
- thread_model: data.thread_model
3830
- };
3831
- return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3832
- headers: {
3833
- "Content-Type": "application/json"
3834
- }
3835
- });
3836
- } catch (error) {
3837
- console.error("Error when sent message:", error);
3838
- throw error;
3941
+ };
3942
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3943
+ headers: {
3944
+ "Content-Type": "application/json"
3839
3945
  }
3840
3946
  });
3841
3947
  },
3842
- deleteComment(_0) {
3843
- return __async(this, arguments, function* ({ data }) {
3844
- try {
3845
- const env2 = getEnv();
3846
- const jsonData = {
3847
- attachment_ids: [],
3848
- attachment_tokens: [],
3849
- body: "",
3850
- message_id: data.message_id
3851
- };
3852
- return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3853
- headers: {
3854
- "Content-Type": "application/json"
3855
- }
3856
- });
3857
- } catch (error) {
3858
- console.error("Error when sent message:", error);
3859
- throw error;
3948
+ async getCurrency() {
3949
+ const env2 = getEnv();
3950
+ const jsonData = {
3951
+ model: "res.currency",
3952
+ method: "web_search_read",
3953
+ kwargs: {
3954
+ specification: {
3955
+ icon_url: {},
3956
+ name: {}
3957
+ },
3958
+ domain: [["active", "=", true]],
3959
+ limit: 100,
3960
+ offset: 0
3961
+ }
3962
+ };
3963
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3964
+ headers: {
3965
+ "Content-Type": "application/json"
3860
3966
  }
3861
3967
  });
3862
3968
  },
3863
- getImage(_0) {
3864
- return __async(this, arguments, function* ({ data }) {
3865
- try {
3866
- const env2 = getEnv();
3867
- return env2.requests.get(
3868
- `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3869
- {
3870
- headers: {
3871
- "Content-Type": "application/json"
3969
+ async getConversionRate() {
3970
+ const env2 = getEnv();
3971
+ const jsonData = {
3972
+ model: "res.currency",
3973
+ method: "web_search_read",
3974
+ kwargs: {
3975
+ specification: {
3976
+ name: {},
3977
+ icon_url: {},
3978
+ rate_ids: {
3979
+ fields: {
3980
+ company_rate: {},
3981
+ sell: {}
3872
3982
  }
3873
3983
  }
3874
- );
3875
- } catch (error) {
3876
- console.error("Error when sent message:", error);
3877
- throw error;
3984
+ },
3985
+ domain: [["active", "=", true]],
3986
+ limit: 100,
3987
+ offset: 0
3988
+ }
3989
+ };
3990
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3991
+ headers: {
3992
+ "Content-Type": "application/json"
3878
3993
  }
3879
3994
  });
3880
3995
  },
3881
- uploadImage(_0) {
3882
- return __async(this, arguments, function* ({ data }) {
3883
- try {
3884
- const env2 = getEnv();
3885
- return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3886
- headers: {
3887
- "Content-Type": "multipart/form-data"
3888
- }
3889
- });
3890
- } catch (error) {
3891
- console.error("Error when sent message:", error);
3892
- throw error;
3996
+ async getAll({ data }) {
3997
+ const env2 = getEnv();
3998
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3999
+ fields: data.fields,
4000
+ groupby: data.groupby
4001
+ } : {
4002
+ count_limit: 10001,
4003
+ order: data.sort,
4004
+ specification: data.specification
4005
+ };
4006
+ const jsonData = {
4007
+ model: String(data.model),
4008
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4009
+ ids: data.ids,
4010
+ with_context: data.context,
4011
+ kwargs: {
4012
+ domain: data.domain,
4013
+ limit: data.limit,
4014
+ offset: data.offset,
4015
+ ...jsonReadGroup
4016
+ }
4017
+ };
4018
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4019
+ headers: {
4020
+ "Content-Type": "application/json"
3893
4021
  }
3894
4022
  });
3895
4023
  },
3896
- getFormView(_0) {
3897
- return __async(this, arguments, function* ({ data }) {
3898
- try {
3899
- const env2 = getEnv();
3900
- const jsonData = {
3901
- model: data.model,
3902
- method: "get_formview_action",
3903
- ids: data.id ? [data.id] : [],
3904
- with_context: data.context
3905
- };
3906
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3907
- headers: {
3908
- "Content-Type": "application/json"
3909
- }
3910
- });
3911
- } catch (error) {
3912
- console.error("Error when fetching form view:", error);
3913
- throw error;
4024
+ async getListCalendar({ data }) {
4025
+ const env2 = getEnv();
4026
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4027
+ fields: data.fields,
4028
+ groupby: data.groupby
4029
+ } : {
4030
+ count_limit: 10001,
4031
+ order: data.sort,
4032
+ specification: data.specification
4033
+ };
4034
+ const jsonData = {
4035
+ model: String(data.model),
4036
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4037
+ ids: data.ids,
4038
+ with_context: data.context,
4039
+ kwargs: {
4040
+ domain: data.domain,
4041
+ limit: data.limit,
4042
+ offset: data.offset,
4043
+ fields: data.fields,
4044
+ ...jsonReadGroup
4045
+ }
4046
+ };
4047
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4048
+ headers: {
4049
+ "Content-Type": "application/json"
3914
4050
  }
3915
4051
  });
3916
4052
  },
3917
- changeStatus(_0) {
3918
- return __async(this, arguments, function* ({ data }) {
3919
- const env2 = getEnv();
3920
- const vals = {
3921
- [data.name]: data.stage_id
3922
- };
3923
- const jsonData = {
3924
- model: data.model,
3925
- method: "web_save",
3926
- with_context: {
3927
- lang: data.lang,
3928
- allowed_company_ids: [1],
3929
- uid: 2,
3930
- search_default_my_ticket: true,
3931
- search_default_is_open: true
3932
- },
3933
- ids: [data.id],
3934
- kwargs: {
3935
- vals,
3936
- specification: {}
3937
- }
3938
- };
3939
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3940
- headers: {
3941
- "Content-Type": "application/json"
3942
- }
3943
- });
3944
- });
3945
- }
3946
- };
3947
- var form_service_default = FormService;
3948
-
3949
- // src/services/kanban-service/index.ts
3950
- var KanbanServices = {
3951
- getGroups(_0) {
3952
- return __async(this, arguments, function* ({
4053
+ async getList({
4054
+ model,
4055
+ ids = [],
4056
+ specification = {},
4057
+ domain = [],
4058
+ offset,
4059
+ order,
4060
+ context = {},
4061
+ limit = 10
4062
+ }) {
4063
+ const env2 = getEnv();
4064
+ const jsonData = {
3953
4065
  model,
3954
- width_context
3955
- }) {
3956
- const env2 = getEnv();
3957
- const jsonDataView = {
3958
- model,
3959
- method: "web_read_group",
3960
- kwargs: {
3961
- domain: [["stage_id.fold", "=", false]],
3962
- fields: ["color:sum"],
3963
- groupby: ["stage_id"]
3964
- },
3965
- width_context
3966
- };
3967
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3968
- headers: {
3969
- "Content-Type": "application/json"
3970
- }
3971
- });
4066
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4067
+ ids,
4068
+ with_context: context,
4069
+ kwargs: {
4070
+ specification,
4071
+ domain,
4072
+ limit,
4073
+ offset,
4074
+ order
4075
+ }
4076
+ };
4077
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4078
+ headers: {
4079
+ "Content-Type": "application/json"
4080
+ }
3972
4081
  });
3973
4082
  },
3974
- getProgressBar(_0) {
3975
- return __async(this, arguments, function* ({
3976
- field,
3977
- color,
4083
+ async getDetail({
4084
+ ids = [],
4085
+ model,
4086
+ specification,
4087
+ context
4088
+ }) {
4089
+ const env2 = getEnv();
4090
+ const jsonData = {
3978
4091
  model,
3979
- width_context
3980
- }) {
3981
- const env2 = getEnv();
3982
- const jsonDataView = {
3983
- model,
3984
- method: "read_progress_bar",
3985
- kwargs: {
3986
- domain: [],
3987
- group_by: "stage_id",
3988
- progress_bar: {
3989
- colors: color,
3990
- field
3991
- }
3992
- },
3993
- width_context
3994
- };
3995
- return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3996
- headers: {
3997
- "Content-Type": "application/json"
3998
- }
3999
- });
4000
- });
4001
- }
4002
- };
4003
- var kanban_service_default = KanbanServices;
4004
-
4005
- // src/services/model-service/index.ts
4006
- var OBJECT_POSITION = 2;
4007
- var ModelService = {
4008
- getListMyBankAccount(_0) {
4009
- return __async(this, arguments, function* ({
4010
- domain,
4011
- spectification,
4012
- model
4013
- }) {
4014
- const env2 = getEnv();
4015
- const jsonData = {
4016
- model,
4017
- method: "web_search_read",
4018
- kwargs: {
4019
- specification: spectification,
4020
- domain,
4021
- limit: 100,
4022
- offset: 0
4023
- }
4024
- };
4025
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4026
- headers: {
4027
- "Content-Type": "application/json"
4028
- }
4029
- });
4030
- });
4031
- },
4032
- getCurrency() {
4033
- return __async(this, null, function* () {
4034
- const env2 = getEnv();
4035
- const jsonData = {
4036
- model: "res.currency",
4037
- method: "web_search_read",
4038
- kwargs: {
4039
- specification: {
4040
- icon_url: {},
4041
- name: {}
4042
- },
4043
- domain: [["active", "=", true]],
4044
- limit: 100,
4045
- offset: 0
4046
- }
4047
- };
4048
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4049
- headers: {
4050
- "Content-Type": "application/json"
4051
- }
4052
- });
4053
- });
4054
- },
4055
- getConversionRate() {
4056
- return __async(this, null, function* () {
4057
- const env2 = getEnv();
4058
- const jsonData = {
4059
- model: "res.currency",
4060
- method: "web_search_read",
4061
- kwargs: {
4062
- specification: {
4063
- name: {},
4064
- icon_url: {},
4065
- rate_ids: {
4066
- fields: {
4067
- company_rate: {},
4068
- sell: {}
4069
- }
4070
- }
4071
- },
4072
- domain: [["active", "=", true]],
4073
- limit: 100,
4074
- offset: 0
4075
- }
4076
- };
4077
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4078
- headers: {
4079
- "Content-Type": "application/json"
4080
- }
4081
- });
4082
- });
4083
- },
4084
- getAll(_0) {
4085
- return __async(this, arguments, function* ({ data }) {
4086
- const env2 = getEnv();
4087
- const jsonReadGroup = data.type == "calendar" ? { fields: data == null ? void 0 : data.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4088
- fields: data.fields,
4089
- groupby: data.groupby
4090
- } : {
4091
- count_limit: 10001,
4092
- order: data.sort,
4093
- specification: data.specification
4094
- };
4095
- const jsonData = {
4096
- model: String(data.model),
4097
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4098
- ids: data.ids,
4099
- with_context: data.context,
4100
- kwargs: __spreadValues({
4101
- domain: data.domain,
4102
- limit: data.limit,
4103
- offset: data.offset
4104
- }, jsonReadGroup)
4105
- };
4106
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4107
- headers: {
4108
- "Content-Type": "application/json"
4109
- }
4110
- });
4111
- });
4112
- },
4113
- getListCalendar(_0) {
4114
- return __async(this, arguments, function* ({ data }) {
4115
- const env2 = getEnv();
4116
- const jsonReadGroup = data.type == "calendar" ? data == null ? void 0 : data.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4117
- fields: data.fields,
4118
- groupby: data.groupby
4119
- } : {
4120
- count_limit: 10001,
4121
- order: data.sort,
4122
- specification: data.specification
4123
- };
4124
- const jsonData = {
4125
- model: String(data.model),
4126
- method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4127
- ids: data.ids,
4128
- with_context: data.context,
4129
- kwargs: __spreadValues({
4130
- domain: data.domain,
4131
- limit: data.limit,
4132
- offset: data.offset,
4133
- fields: data.fields
4134
- }, jsonReadGroup)
4135
- };
4136
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4137
- headers: {
4138
- "Content-Type": "application/json"
4139
- }
4140
- });
4092
+ method: "web_read" /* WEB_READ */,
4093
+ ids,
4094
+ with_context: context,
4095
+ kwargs: {
4096
+ specification
4097
+ }
4098
+ };
4099
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4100
+ headers: {
4101
+ "Content-Type": "application/json"
4102
+ }
4141
4103
  });
4142
4104
  },
4143
- getList(_0) {
4144
- return __async(this, arguments, function* ({
4105
+ async save({
4106
+ model,
4107
+ ids = [],
4108
+ data = {},
4109
+ specification = {},
4110
+ context = {},
4111
+ path
4112
+ }) {
4113
+ const env2 = getEnv();
4114
+ const jsonData = {
4145
4115
  model,
4146
- ids = [],
4147
- specification = {},
4148
- domain = [],
4149
- offset,
4150
- order,
4151
- context = {},
4152
- limit = 10
4153
- }) {
4154
- var _a;
4155
- const env2 = getEnv();
4156
- const jsonData = {
4157
- model,
4158
- method: "web_search_read" /* WEB_SEARCH_READ */,
4159
- ids,
4160
- with_context: context,
4161
- kwargs: {
4162
- specification,
4163
- domain,
4164
- limit,
4165
- offset,
4166
- order
4167
- }
4168
- };
4169
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4170
- headers: {
4171
- "Content-Type": "application/json"
4172
- }
4173
- });
4116
+ method: "web_save" /* WEB_SAVE */,
4117
+ with_context: context,
4118
+ ids,
4119
+ kwargs: {
4120
+ vals: data,
4121
+ specification
4122
+ }
4123
+ };
4124
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4125
+ headers: {
4126
+ "Content-Type": "application/json"
4127
+ }
4174
4128
  });
4175
4129
  },
4176
- getDetail(_0) {
4177
- return __async(this, arguments, function* ({
4178
- ids = [],
4130
+ async delete({ ids = [], model }) {
4131
+ const env2 = getEnv();
4132
+ const jsonData = {
4179
4133
  model,
4180
- specification,
4181
- context
4182
- }) {
4183
- var _a;
4184
- const env2 = getEnv();
4185
- const jsonData = {
4186
- model,
4187
- method: "web_read" /* WEB_READ */,
4188
- ids,
4189
- with_context: context,
4190
- kwargs: {
4191
- specification
4192
- }
4193
- };
4194
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4195
- headers: {
4196
- "Content-Type": "application/json"
4197
- }
4198
- });
4134
+ method: "unlink" /* UNLINK */,
4135
+ ids
4136
+ };
4137
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4138
+ headers: {
4139
+ "Content-Type": "application/json"
4140
+ }
4199
4141
  });
4200
4142
  },
4201
- save(_0) {
4202
- return __async(this, arguments, function* ({
4143
+ async onChange({
4144
+ ids = [],
4145
+ model,
4146
+ object,
4147
+ specification,
4148
+ context,
4149
+ fieldChange
4150
+ }) {
4151
+ const env2 = getEnv();
4152
+ const jsonData = {
4203
4153
  model,
4204
- ids = [],
4205
- data = {},
4206
- specification = {},
4207
- context = {},
4208
- path
4209
- }) {
4210
- var _a;
4211
- const env2 = getEnv();
4212
- const jsonData = {
4213
- model,
4214
- method: "web_save" /* WEB_SAVE */,
4215
- with_context: context,
4216
- ids,
4217
- kwargs: {
4218
- vals: data,
4219
- specification
4220
- }
4221
- };
4222
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post(path != null ? path : "/call" /* CALL_PATH */, jsonData, {
4223
- headers: {
4224
- "Content-Type": "application/json"
4225
- }
4226
- });
4227
- });
4228
- },
4229
- delete(_0) {
4230
- return __async(this, arguments, function* ({ ids = [], model }) {
4231
- var _a;
4232
- const env2 = getEnv();
4233
- const jsonData = {
4234
- model,
4235
- method: "unlink" /* UNLINK */,
4236
- ids
4237
- };
4238
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4239
- headers: {
4240
- "Content-Type": "application/json"
4241
- }
4242
- });
4154
+ method: "onchange" /* ONCHANGE */,
4155
+ ids,
4156
+ with_context: context,
4157
+ args: [
4158
+ object ? object : {},
4159
+ fieldChange ? fieldChange : [],
4160
+ specification
4161
+ ]
4162
+ };
4163
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4164
+ headers: {
4165
+ "Content-Type": "application/json"
4166
+ }
4243
4167
  });
4244
4168
  },
4245
- onChange(_0) {
4246
- return __async(this, arguments, function* ({
4247
- ids = [],
4169
+ async getListFieldsOnchange({ model }) {
4170
+ const env2 = getEnv();
4171
+ const jsonData = {
4248
4172
  model,
4249
- object,
4250
- specification,
4251
- context,
4252
- fieldChange
4253
- }) {
4254
- var _a;
4255
- const env2 = getEnv();
4256
- const jsonData = {
4257
- model,
4258
- method: "onchange" /* ONCHANGE */,
4259
- ids,
4260
- with_context: context,
4261
- args: [
4262
- object ? object : {},
4263
- fieldChange ? fieldChange : [],
4264
- specification
4265
- ]
4266
- };
4267
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4268
- headers: {
4269
- "Content-Type": "application/json"
4270
- }
4271
- });
4272
- });
4273
- },
4274
- getListFieldsOnchange(_0) {
4275
- return __async(this, arguments, function* ({ model }) {
4276
- var _a;
4277
- const env2 = getEnv();
4278
- const jsonData = {
4279
- model,
4280
- method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4281
- };
4282
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4283
- headers: {
4284
- "Content-Type": "application/json"
4285
- }
4286
- });
4173
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4174
+ };
4175
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4176
+ headers: {
4177
+ "Content-Type": "application/json"
4178
+ }
4287
4179
  });
4288
4180
  },
4289
4181
  parseORMOdoo(data) {
@@ -4297,14 +4189,13 @@ var ModelService = {
4297
4189
  data[key] = "/";
4298
4190
  }
4299
4191
  }
4300
- return __spreadValues({}, data);
4192
+ return { ...data };
4301
4193
  },
4302
4194
  toDataJS(data, viewData, model) {
4303
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4304
4195
  for (const key in data) {
4305
4196
  if (data[key] === false) {
4306
4197
  if (viewData && model) {
4307
- if (((_c = (_b = (_a = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a[model]) == null ? void 0 : _b[key]) == null ? void 0 : _c.type) !== "boolean" /* BOOLEAN */) {
4198
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4308
4199
  data[key] = null;
4309
4200
  }
4310
4201
  } else {
@@ -4314,13 +4205,12 @@ var ModelService = {
4314
4205
  data[key] = "Draft";
4315
4206
  } else if (data[key] !== false) {
4316
4207
  if (model !== void 0) {
4317
- if (((_f = (_e = (_d = viewData == null ? void 0 : viewData.models) == null ? void 0 : _d[model]) == null ? void 0 : _e[key]) == null ? void 0 : _f.type) === "one2many" /* ONE2MANY */ || ((_i = (_h = (_g = viewData == null ? void 0 : viewData.models) == null ? void 0 : _g[model]) == null ? void 0 : _h[key]) == null ? void 0 : _i.type) === "many2many" /* MANY2MANY */) {
4318
- data[key] = (_k = (_j = data[key]) != null ? _j : data[key] = []) == null ? void 0 : _k.map((item) => {
4319
- var _a2, _b2, _c2, _d2;
4320
- const relation = (_c2 = (_b2 = (_a2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _a2[model]) == null ? void 0 : _b2[key]) == null ? void 0 : _c2.relation;
4208
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4209
+ data[key] = (data[key] ??= [])?.map((item) => {
4210
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4321
4211
  if (relation !== void 0) {
4322
- if ((_d2 = viewData == null ? void 0 : viewData.models) == null ? void 0 : _d2[relation]) {
4323
- if ((item == null ? void 0 : item.length) >= 3) {
4212
+ if (viewData?.models?.[relation]) {
4213
+ if (item?.length >= 3) {
4324
4214
  return ModelService.toDataJS(
4325
4215
  item[OBJECT_POSITION],
4326
4216
  viewData,
@@ -4330,7 +4220,7 @@ var ModelService = {
4330
4220
  return ModelService.toDataJS(item, viewData, relation);
4331
4221
  }
4332
4222
  } else {
4333
- if ((item == null ? void 0 : item.length) >= 3) {
4223
+ if (item?.length >= 3) {
4334
4224
  return item[OBJECT_POSITION];
4335
4225
  } else {
4336
4226
  return item;
@@ -4342,556 +4232,514 @@ var ModelService = {
4342
4232
  }
4343
4233
  }
4344
4234
  }
4345
- return __spreadValues({}, data);
4235
+ return { ...data };
4346
4236
  }
4347
4237
  };
4348
4238
  var model_service_default = ModelService;
4349
4239
 
4350
4240
  // src/services/user-service/index.ts
4351
4241
  var UserService = {
4352
- getProfile(path) {
4353
- return __async(this, null, function* () {
4354
- const env2 = getEnv();
4355
- return env2.requests.get(path != null ? path : "/userinfo" /* PROFILE_PATH */, {
4356
- headers: {
4357
- "Content-Type": "application/x-www-form-urlencoded"
4358
- }
4359
- });
4242
+ async getProfile(path) {
4243
+ const env2 = getEnv();
4244
+ return env2.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4245
+ headers: {
4246
+ "Content-Type": "application/x-www-form-urlencoded"
4247
+ }
4360
4248
  });
4361
4249
  },
4362
- getUser(_0) {
4363
- return __async(this, arguments, function* ({ context, id }) {
4364
- const env2 = getEnv();
4365
- const jsonData = {
4366
- model: "res.users",
4367
- method: "web_read",
4368
- ids: [id],
4369
- with_context: context,
4370
- kwargs: {
4371
- specification: {
4372
- display_name: {},
4373
- image_1920: {},
4374
- name: {},
4375
- login: {},
4376
- email: {},
4377
- password: {},
4378
- visible_group_id: {
4379
- fields: {
4380
- id: {},
4381
- display_name: {}
4382
- }
4383
- },
4384
- company_id: {
4385
- fields: {
4386
- id: {},
4387
- display_name: {}
4388
- }
4250
+ async getUser({ context, id }) {
4251
+ const env2 = getEnv();
4252
+ const jsonData = {
4253
+ model: "res.users",
4254
+ method: "web_read",
4255
+ ids: [id],
4256
+ with_context: context,
4257
+ kwargs: {
4258
+ specification: {
4259
+ display_name: {},
4260
+ image_1920: {},
4261
+ name: {},
4262
+ login: {},
4263
+ email: {},
4264
+ password: {},
4265
+ visible_group_id: {
4266
+ fields: {
4267
+ id: {},
4268
+ display_name: {}
4269
+ }
4270
+ },
4271
+ company_id: {
4272
+ fields: {
4273
+ id: {},
4274
+ display_name: {}
4389
4275
  }
4390
4276
  }
4391
4277
  }
4392
- };
4393
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4394
- headers: {
4395
- "Content-Type": "application/json"
4396
- }
4397
- });
4278
+ }
4279
+ };
4280
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4281
+ headers: {
4282
+ "Content-Type": "application/json"
4283
+ }
4398
4284
  });
4399
4285
  },
4400
- switchUserLocale: (_0) => __async(null, [_0], function* ({ id, values }) {
4401
- var _a;
4286
+ switchUserLocale: async ({ id, values }) => {
4402
4287
  const env2 = getEnv();
4403
4288
  const jsonData = {
4404
4289
  model: "res.users",
4405
4290
  domain: [["id", "=", id]],
4406
4291
  values
4407
4292
  };
4408
- return env2 == null ? void 0 : env2.requests.post((_a = UriConstants) == null ? void 0 : _a.CREATE_UPDATE_PATH, jsonData, {
4293
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4409
4294
  headers: {
4410
4295
  "Content-Type": "application/json"
4411
4296
  }
4412
4297
  });
4413
- })
4298
+ }
4414
4299
  };
4415
- var user_service_default = UserService;
4416
-
4417
- // src/services/view-service/index.ts
4418
- var ViewService = {
4419
- getView(_0) {
4420
- return __async(this, arguments, function* ({
4421
- model,
4422
- views,
4423
- context = {},
4424
- options = {},
4425
- aid
4426
- }) {
4427
- var _a;
4428
- const env2 = getEnv();
4429
- const defaultOptions = {
4430
- load_filters: true,
4431
- toolbar: true,
4432
- action_id: aid
4433
- };
4434
- const jsonDataView = {
4435
- model,
4436
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4437
- kwargs: {
4438
- views,
4439
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
4440
- },
4441
- with_context: context
4442
- };
4443
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
4444
- headers: {
4445
- "Content-Type": "application/json"
4446
- }
4447
- });
4300
+ var user_service_default = UserService;
4301
+
4302
+ // src/services/view-service/index.ts
4303
+ var ViewService = {
4304
+ async getView({
4305
+ model,
4306
+ views,
4307
+ context = {},
4308
+ options = {},
4309
+ aid
4310
+ }) {
4311
+ const env2 = getEnv();
4312
+ const defaultOptions = {
4313
+ load_filters: true,
4314
+ toolbar: true,
4315
+ action_id: aid
4316
+ };
4317
+ const jsonDataView = {
4318
+ model,
4319
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4320
+ kwargs: {
4321
+ views,
4322
+ options: { ...options, ...defaultOptions }
4323
+ },
4324
+ with_context: context
4325
+ };
4326
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4327
+ headers: {
4328
+ "Content-Type": "application/json"
4329
+ }
4448
4330
  });
4449
4331
  },
4450
- getMenu(context) {
4451
- return __async(this, null, function* () {
4452
- var _a;
4453
- const env2 = getEnv();
4454
- const jsonData = {
4455
- model: "ir.ui.menu" /* MENU */,
4456
- method: "web_search_read" /* WEB_SEARCH_READ */,
4457
- ids: [],
4458
- with_context: context,
4459
- kwargs: {
4460
- specification: {
4461
- active: {},
4462
- name: {},
4463
- is_display: {},
4464
- sequence: {},
4465
- complete_name: {},
4466
- action: {
4467
- fields: {
4468
- display_name: {},
4469
- type: {},
4470
- binding_view_types: {}
4471
- // res_model: {},
4472
- }
4332
+ async getMenu(context) {
4333
+ const env2 = getEnv();
4334
+ const jsonData = {
4335
+ model: "ir.ui.menu" /* MENU */,
4336
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4337
+ ids: [],
4338
+ with_context: context,
4339
+ kwargs: {
4340
+ specification: {
4341
+ active: {},
4342
+ name: {},
4343
+ is_display: {},
4344
+ sequence: {},
4345
+ complete_name: {},
4346
+ action: {
4347
+ fields: {
4348
+ display_name: {},
4349
+ type: {},
4350
+ binding_view_types: {}
4351
+ // res_model: {},
4352
+ }
4353
+ },
4354
+ url_icon: {},
4355
+ web_icon: {},
4356
+ web_icon_data: {},
4357
+ groups_id: {
4358
+ fields: {
4359
+ full_name: {}
4473
4360
  },
4474
- url_icon: {},
4475
- web_icon: {},
4476
- web_icon_data: {},
4477
- groups_id: {
4478
- fields: {
4479
- full_name: {}
4361
+ limit: 40,
4362
+ order: ""
4363
+ },
4364
+ display_name: {},
4365
+ child_id: {
4366
+ fields: {
4367
+ active: {},
4368
+ name: {},
4369
+ is_display: {},
4370
+ sequence: {},
4371
+ complete_name: {},
4372
+ action: {
4373
+ fields: {
4374
+ display_name: {},
4375
+ type: {},
4376
+ binding_view_types: {}
4377
+ // res_model: {},
4378
+ }
4480
4379
  },
4481
- limit: 40,
4482
- order: ""
4483
- },
4484
- display_name: {},
4485
- child_id: {
4486
- fields: {
4487
- active: {},
4488
- name: {},
4489
- is_display: {},
4490
- sequence: {},
4491
- complete_name: {},
4492
- action: {
4493
- fields: {
4494
- display_name: {},
4495
- type: {},
4496
- binding_view_types: {}
4497
- // res_model: {},
4498
- }
4380
+ url_icon: {},
4381
+ web_icon: {},
4382
+ web_icon_data: {},
4383
+ groups_id: {
4384
+ fields: {
4385
+ full_name: {}
4499
4386
  },
4500
- url_icon: {},
4501
- web_icon: {},
4502
- web_icon_data: {},
4503
- groups_id: {
4504
- fields: {
4505
- full_name: {}
4387
+ limit: 40,
4388
+ order: ""
4389
+ },
4390
+ display_name: {},
4391
+ child_id: {
4392
+ fields: {
4393
+ active: {},
4394
+ name: {},
4395
+ is_display: {},
4396
+ sequence: {},
4397
+ complete_name: {},
4398
+ action: {
4399
+ fields: {
4400
+ display_name: {},
4401
+ type: {},
4402
+ binding_view_types: {}
4403
+ // res_model: {},
4404
+ }
4506
4405
  },
4507
- limit: 40,
4508
- order: ""
4509
- },
4510
- display_name: {},
4511
- child_id: {
4512
- fields: {
4513
- active: {},
4514
- name: {},
4515
- is_display: {},
4516
- sequence: {},
4517
- complete_name: {},
4518
- action: {
4519
- fields: {
4520
- display_name: {},
4521
- type: {},
4522
- binding_view_types: {}
4523
- // res_model: {},
4524
- }
4406
+ url_icon: {},
4407
+ web_icon: {},
4408
+ web_icon_data: {},
4409
+ groups_id: {
4410
+ fields: {
4411
+ full_name: {}
4525
4412
  },
4526
- url_icon: {},
4527
- web_icon: {},
4528
- web_icon_data: {},
4529
- groups_id: {
4530
- fields: {
4531
- full_name: {}
4413
+ limit: 40,
4414
+ order: ""
4415
+ },
4416
+ display_name: {},
4417
+ child_id: {
4418
+ fields: {
4419
+ active: {},
4420
+ name: {},
4421
+ is_display: {},
4422
+ sequence: {},
4423
+ complete_name: {},
4424
+ action: {
4425
+ fields: {
4426
+ display_name: {},
4427
+ type: {},
4428
+ binding_view_types: {}
4429
+ // res_model: {},
4430
+ }
4532
4431
  },
4533
- limit: 40,
4534
- order: ""
4535
- },
4536
- display_name: {},
4537
- child_id: {
4538
- fields: {
4539
- active: {},
4540
- name: {},
4541
- is_display: {},
4542
- sequence: {},
4543
- complete_name: {},
4544
- action: {
4545
- fields: {
4546
- display_name: {},
4547
- type: {},
4548
- binding_view_types: {}
4549
- // res_model: {},
4550
- }
4551
- },
4552
- url_icon: {},
4553
- web_icon: {},
4554
- web_icon_data: {},
4555
- groups_id: {
4556
- fields: {
4557
- full_name: {}
4558
- },
4559
- limit: 40,
4560
- order: ""
4432
+ url_icon: {},
4433
+ web_icon: {},
4434
+ web_icon_data: {},
4435
+ groups_id: {
4436
+ fields: {
4437
+ full_name: {}
4561
4438
  },
4562
- display_name: {},
4563
- child_id: {
4564
- fields: {},
4565
- limit: 40,
4566
- order: ""
4567
- }
4439
+ limit: 40,
4440
+ order: ""
4568
4441
  },
4569
- limit: 40,
4570
- order: ""
4571
- }
4572
- },
4573
- limit: 40,
4574
- order: ""
4575
- }
4576
- },
4577
- limit: 40,
4578
- order: ""
4579
- }
4580
- },
4581
- domain: [
4582
- "&",
4583
- ["is_display", "=", true],
4584
- "&",
4585
- ["active", "=", true],
4586
- ["parent_id", "=", false]
4587
- ]
4588
- }
4589
- };
4590
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4591
- headers: {
4592
- "Content-Type": "application/json"
4593
- }
4594
- });
4442
+ display_name: {},
4443
+ child_id: {
4444
+ fields: {},
4445
+ limit: 40,
4446
+ order: ""
4447
+ }
4448
+ },
4449
+ limit: 40,
4450
+ order: ""
4451
+ }
4452
+ },
4453
+ limit: 40,
4454
+ order: ""
4455
+ }
4456
+ },
4457
+ limit: 40,
4458
+ order: ""
4459
+ }
4460
+ },
4461
+ domain: [
4462
+ "&",
4463
+ ["is_display", "=", true],
4464
+ "&",
4465
+ ["active", "=", true],
4466
+ ["parent_id", "=", false]
4467
+ ]
4468
+ }
4469
+ };
4470
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4471
+ headers: {
4472
+ "Content-Type": "application/json"
4473
+ }
4595
4474
  });
4596
4475
  },
4597
- getActionDetail(aid, context) {
4598
- return __async(this, null, function* () {
4599
- var _a;
4600
- const env2 = getEnv();
4601
- const jsonData = {
4602
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
4603
- method: "web_read" /* WEB_READ */,
4604
- ids: [aid],
4605
- with_context: context,
4606
- kwargs: {
4607
- specification: {
4608
- id: {},
4609
- name: {},
4610
- res_model: {},
4611
- views: {},
4612
- view_mode: {},
4613
- mobile_view_mode: {},
4614
- domain: {},
4615
- context: {},
4616
- groups_id: {},
4617
- search_view_id: {}
4618
- }
4619
- }
4620
- };
4621
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
4622
- headers: {
4623
- "Content-Type": "application/json"
4476
+ async getActionDetail(aid, context) {
4477
+ const env2 = getEnv();
4478
+ const jsonData = {
4479
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4480
+ method: "web_read" /* WEB_READ */,
4481
+ ids: [aid],
4482
+ with_context: context,
4483
+ kwargs: {
4484
+ specification: {
4485
+ id: {},
4486
+ name: {},
4487
+ res_model: {},
4488
+ views: {},
4489
+ view_mode: {},
4490
+ mobile_view_mode: {},
4491
+ domain: {},
4492
+ context: {},
4493
+ groups_id: {},
4494
+ search_view_id: {}
4624
4495
  }
4625
- });
4496
+ }
4497
+ };
4498
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4499
+ headers: {
4500
+ "Content-Type": "application/json"
4501
+ }
4626
4502
  });
4627
4503
  },
4628
- getResequence(_0) {
4629
- return __async(this, arguments, function* ({
4504
+ async getResequence({
4505
+ model,
4506
+ ids,
4507
+ context,
4508
+ offset
4509
+ }) {
4510
+ const env2 = getEnv();
4511
+ const jsonData = {
4630
4512
  model,
4513
+ with_context: context,
4631
4514
  ids,
4632
- context,
4633
- offset
4634
- }) {
4635
- const env2 = getEnv();
4636
- const jsonData = __spreadValues({
4637
- model,
4638
- with_context: context,
4639
- ids,
4640
- field: "sequence"
4641
- }, offset > 0 ? { offset } : {});
4642
- return env2 == null ? void 0 : env2.requests.post("/web/dataset/resequence", jsonData, {
4643
- headers: {
4644
- "Content-Type": "application/json"
4645
- }
4646
- });
4647
- });
4648
- },
4649
- getSelectionItem(_0) {
4650
- return __async(this, arguments, function* ({ data }) {
4651
- var _a;
4652
- const env2 = getEnv();
4653
- const jsonData = {
4654
- model: data.model,
4655
- ids: [],
4656
- method: "get_data_select",
4657
- with_context: data.context,
4658
- kwargs: {
4659
- count_limit: 10001,
4660
- domain: data.domain ? data.domain : [],
4661
- offset: 0,
4662
- order: "",
4663
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
4664
- id: {},
4665
- name: {},
4666
- display_name: {}
4667
- }
4668
- }
4669
- };
4670
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4671
- headers: {
4672
- "Content-Type": "application/json"
4673
- }
4674
- });
4515
+ field: "sequence",
4516
+ ...offset > 0 ? { offset } : {}
4517
+ };
4518
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4519
+ headers: {
4520
+ "Content-Type": "application/json"
4521
+ }
4675
4522
  });
4676
4523
  },
4677
- loadMessages() {
4678
- return __async(this, null, function* () {
4679
- const env2 = getEnv();
4680
- return env2.requests.post(
4681
- "/load_message_failures" /* LOAD_MESSAGE */,
4682
- {},
4683
- {
4684
- headers: {
4685
- "Content-Type": "application/json"
4686
- }
4524
+ async getSelectionItem({ data }) {
4525
+ const env2 = getEnv();
4526
+ const jsonData = {
4527
+ model: data.model,
4528
+ ids: [],
4529
+ method: "get_data_select",
4530
+ with_context: data.context,
4531
+ kwargs: {
4532
+ count_limit: 10001,
4533
+ domain: data.domain ? data.domain : [],
4534
+ offset: 0,
4535
+ order: "",
4536
+ specification: data?.specification ?? {
4537
+ id: {},
4538
+ name: {},
4539
+ display_name: {}
4687
4540
  }
4688
- );
4541
+ }
4542
+ };
4543
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4544
+ headers: {
4545
+ "Content-Type": "application/json"
4546
+ }
4689
4547
  });
4690
4548
  },
4691
- getVersion() {
4692
- return __async(this, null, function* () {
4693
- var _a;
4694
- const env2 = getEnv();
4695
- console.log("env?.requests", env2, env2 == null ? void 0 : env2.requests);
4696
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("", {
4549
+ async loadMessages() {
4550
+ const env2 = getEnv();
4551
+ return env2.requests.post(
4552
+ "/load_message_failures" /* LOAD_MESSAGE */,
4553
+ {},
4554
+ {
4697
4555
  headers: {
4698
4556
  "Content-Type": "application/json"
4699
4557
  }
4700
- });
4558
+ }
4559
+ );
4560
+ },
4561
+ async getVersion() {
4562
+ const env2 = getEnv();
4563
+ return env2?.requests.get("", {
4564
+ headers: {
4565
+ "Content-Type": "application/json"
4566
+ }
4701
4567
  });
4702
4568
  },
4703
- get2FAMethods(_0) {
4704
- return __async(this, arguments, function* ({
4569
+ async get2FAMethods({
4570
+ method,
4571
+ with_context
4572
+ }) {
4573
+ const env2 = getEnv();
4574
+ const jsonData = {
4705
4575
  method,
4706
4576
  with_context
4707
- }) {
4708
- const env2 = getEnv();
4709
- const jsonData = {
4710
- method,
4711
- with_context
4712
- };
4713
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4714
- headers: {
4715
- "Content-Type": "application/json"
4716
- }
4717
- });
4577
+ };
4578
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4579
+ headers: {
4580
+ "Content-Type": "application/json"
4581
+ }
4718
4582
  });
4719
4583
  },
4720
- verify2FA(_0) {
4721
- return __async(this, arguments, function* ({
4584
+ async verify2FA({
4585
+ method,
4586
+ with_context,
4587
+ code,
4588
+ device,
4589
+ location
4590
+ }) {
4591
+ const env2 = getEnv();
4592
+ const jsonData = {
4722
4593
  method,
4723
- with_context,
4724
- code,
4725
- device,
4726
- location
4727
- }) {
4728
- const env2 = getEnv();
4729
- const jsonData = {
4730
- method,
4731
- kwargs: {
4732
- vals: {
4733
- code,
4734
- device,
4735
- location
4736
- }
4737
- },
4738
- with_context
4739
- };
4740
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4741
- headers: {
4742
- "Content-Type": "application/json"
4743
- },
4744
- withCredentials: true
4745
- });
4594
+ kwargs: {
4595
+ vals: {
4596
+ code,
4597
+ device,
4598
+ location
4599
+ }
4600
+ },
4601
+ with_context
4602
+ };
4603
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4604
+ headers: {
4605
+ "Content-Type": "application/json"
4606
+ },
4607
+ withCredentials: true
4746
4608
  });
4747
4609
  },
4748
- signInSSO(_0) {
4749
- return __async(this, arguments, function* ({
4750
- redirect_uri,
4751
- state,
4752
- client_id,
4610
+ async signInSSO({
4611
+ redirect_uri,
4612
+ state,
4613
+ client_id,
4614
+ response_type,
4615
+ path
4616
+ }) {
4617
+ const env2 = getEnv();
4618
+ const params = new URLSearchParams({
4753
4619
  response_type,
4754
- path
4755
- }) {
4756
- const env2 = getEnv();
4757
- const params = new URLSearchParams({
4758
- response_type,
4759
- client_id,
4760
- redirect_uri,
4761
- state
4762
- });
4763
- const url = `${path}?${params.toString()}`;
4764
- return env2 == null ? void 0 : env2.requests.get(url, {
4765
- headers: {
4766
- "Content-Type": "application/json"
4767
- },
4768
- withCredentials: true
4769
- });
4620
+ client_id,
4621
+ redirect_uri,
4622
+ state
4623
+ });
4624
+ const url = `${path}?${params.toString()}`;
4625
+ return env2?.requests.get(url, {
4626
+ headers: {
4627
+ "Content-Type": "application/json"
4628
+ },
4629
+ withCredentials: true
4770
4630
  });
4771
4631
  },
4772
- grantAccess(_0) {
4773
- return __async(this, arguments, function* ({
4632
+ async grantAccess({
4633
+ redirect_uri,
4634
+ state,
4635
+ client_id,
4636
+ scopes
4637
+ }) {
4638
+ const env2 = getEnv();
4639
+ const jsonData = {
4774
4640
  redirect_uri,
4775
4641
  state,
4776
4642
  client_id,
4777
4643
  scopes
4778
- }) {
4779
- const env2 = getEnv();
4780
- const jsonData = {
4781
- redirect_uri,
4782
- state,
4783
- client_id,
4784
- scopes
4785
- };
4786
- return env2 == null ? void 0 : env2.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4787
- headers: {
4788
- "Content-Type": "application/json"
4789
- },
4790
- withCredentials: true
4791
- });
4644
+ };
4645
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4646
+ headers: {
4647
+ "Content-Type": "application/json"
4648
+ },
4649
+ withCredentials: true
4792
4650
  });
4793
4651
  },
4794
- getFieldsViewSecurity(_0) {
4795
- return __async(this, arguments, function* ({
4652
+ async getFieldsViewSecurity({
4653
+ method,
4654
+ token,
4655
+ views
4656
+ }) {
4657
+ const env2 = getEnv();
4658
+ const jsonData = {
4796
4659
  method,
4797
- token,
4798
- views
4799
- }) {
4800
- const env2 = getEnv();
4801
- const jsonData = {
4802
- method,
4803
- kwargs: {
4804
- views
4805
- },
4806
- with_context: {
4807
- token
4808
- }
4809
- };
4810
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4811
- headers: {
4812
- "Content-Type": "application/json"
4813
- }
4814
- });
4660
+ kwargs: {
4661
+ views
4662
+ },
4663
+ with_context: {
4664
+ token
4665
+ }
4666
+ };
4667
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4668
+ headers: {
4669
+ "Content-Type": "application/json"
4670
+ }
4815
4671
  });
4816
4672
  },
4817
- settingsWebRead2fa(_0) {
4818
- return __async(this, arguments, function* ({
4673
+ async settingsWebRead2fa({
4674
+ method,
4675
+ model,
4676
+ kwargs,
4677
+ token
4678
+ }) {
4679
+ const env2 = getEnv();
4680
+ const jsonData = {
4819
4681
  method,
4820
4682
  model,
4821
4683
  kwargs,
4822
- token
4823
- }) {
4824
- const env2 = getEnv();
4825
- const jsonData = {
4826
- method,
4827
- model,
4828
- kwargs,
4829
- with_context: {
4830
- token
4831
- }
4832
- };
4833
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4834
- headers: {
4835
- "Content-Type": "application/json"
4836
- }
4837
- });
4684
+ with_context: {
4685
+ token
4686
+ }
4687
+ };
4688
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4689
+ headers: {
4690
+ "Content-Type": "application/json"
4691
+ }
4838
4692
  });
4839
4693
  },
4840
- requestSetupTotp(_0) {
4841
- return __async(this, arguments, function* ({ method, token }) {
4842
- const env2 = getEnv();
4843
- const jsonData = {
4844
- method,
4845
- with_context: {
4846
- token
4847
- }
4848
- };
4849
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4850
- headers: {
4851
- "Content-Type": "application/json"
4852
- }
4853
- });
4694
+ async requestSetupTotp({ method, token }) {
4695
+ const env2 = getEnv();
4696
+ const jsonData = {
4697
+ method,
4698
+ with_context: {
4699
+ token
4700
+ }
4701
+ };
4702
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4703
+ headers: {
4704
+ "Content-Type": "application/json"
4705
+ }
4854
4706
  });
4855
4707
  },
4856
- verifyTotp(_0) {
4857
- return __async(this, arguments, function* ({
4708
+ async verifyTotp({
4709
+ method,
4710
+ action_token,
4711
+ code
4712
+ }) {
4713
+ const env2 = getEnv();
4714
+ const jsonData = {
4858
4715
  method,
4859
- action_token,
4860
- code
4861
- }) {
4862
- const env2 = getEnv();
4863
- const jsonData = {
4864
- method,
4865
- kwargs: {
4866
- vals: {
4867
- code
4868
- }
4869
- },
4870
- with_context: {
4871
- action_token
4716
+ kwargs: {
4717
+ vals: {
4718
+ code
4872
4719
  }
4873
- };
4874
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4875
- headers: {
4876
- "Content-Type": "application/json"
4877
- }
4878
- });
4720
+ },
4721
+ with_context: {
4722
+ action_token
4723
+ }
4724
+ };
4725
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4726
+ headers: {
4727
+ "Content-Type": "application/json"
4728
+ }
4879
4729
  });
4880
4730
  },
4881
- removeTotpSetUp(_0) {
4882
- return __async(this, arguments, function* ({ method, token }) {
4883
- const env2 = getEnv();
4884
- const jsonData = {
4885
- method,
4886
- with_context: {
4887
- token
4888
- }
4889
- };
4890
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4891
- headers: {
4892
- "Content-Type": "application/json"
4893
- }
4894
- });
4731
+ async removeTotpSetUp({ method, token }) {
4732
+ const env2 = getEnv();
4733
+ const jsonData = {
4734
+ method,
4735
+ with_context: {
4736
+ token
4737
+ }
4738
+ };
4739
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4740
+ headers: {
4741
+ "Content-Type": "application/json"
4742
+ }
4895
4743
  });
4896
4744
  }
4897
4745
  };
@@ -4927,7 +4775,7 @@ var import_react_query3 = require("@tanstack/react-query");
4927
4775
  var useGetProvider = () => {
4928
4776
  return (0, import_react_query3.useMutation)({
4929
4777
  mutationFn: (data) => {
4930
- return auth_service_default.getProviders(data == null ? void 0 : data.db);
4778
+ return auth_service_default.getProviders(data?.db);
4931
4779
  }
4932
4780
  });
4933
4781
  };
@@ -5029,26 +4877,40 @@ var useGetAccessByCode = () => {
5029
4877
  };
5030
4878
  var use_get_access_by_code_default = useGetAccessByCode;
5031
4879
 
5032
- // src/hooks/company/use-get-company-info.ts
4880
+ // src/hooks/auth/use-validate-action-token.ts
5033
4881
  var import_react_query12 = require("@tanstack/react-query");
5034
- var useGetCompanyInfo = () => {
4882
+ var useValidateActionToken = () => {
5035
4883
  return (0, import_react_query12.useMutation)({
4884
+ mutationFn: ({
4885
+ actionToken,
4886
+ path
4887
+ }) => {
4888
+ return auth_service_default.isValidActionToken(actionToken, path);
4889
+ }
4890
+ });
4891
+ };
4892
+ var use_validate_action_token_default = useValidateActionToken;
4893
+
4894
+ // src/hooks/company/use-get-company-info.ts
4895
+ var import_react_query13 = require("@tanstack/react-query");
4896
+ var useGetCompanyInfo = () => {
4897
+ return (0, import_react_query13.useMutation)({
5036
4898
  mutationFn: (id) => company_service_default.getInfoCompany(id)
5037
4899
  });
5038
4900
  };
5039
4901
  var use_get_company_info_default = useGetCompanyInfo;
5040
4902
 
5041
4903
  // src/hooks/company/use-get-current-company.ts
5042
- var import_react_query13 = require("@tanstack/react-query");
4904
+ var import_react_query14 = require("@tanstack/react-query");
5043
4905
  var useGetCurrentCompany = () => {
5044
- return (0, import_react_query13.useMutation)({
4906
+ return (0, import_react_query14.useMutation)({
5045
4907
  mutationFn: () => company_service_default.getCurrentCompany()
5046
4908
  });
5047
4909
  };
5048
4910
  var use_get_current_company_default = useGetCurrentCompany;
5049
4911
 
5050
4912
  // src/hooks/company/use-get-list-company.ts
5051
- var import_react_query14 = require("@tanstack/react-query");
4913
+ var import_react_query15 = require("@tanstack/react-query");
5052
4914
  var useGetListCompany = (companyIDs = []) => {
5053
4915
  const companySpec = {
5054
4916
  id: {},
@@ -5059,7 +4921,7 @@ var useGetListCompany = (companyIDs = []) => {
5059
4921
  ids: companyIDs,
5060
4922
  specification: companySpec
5061
4923
  };
5062
- return (0, import_react_query14.useQuery)({
4924
+ return (0, import_react_query15.useQuery)({
5063
4925
  queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
5064
4926
  queryFn: () => model_service_default.getList(getListParams),
5065
4927
  refetchOnWindowFocus: false
@@ -5068,9 +4930,9 @@ var useGetListCompany = (companyIDs = []) => {
5068
4930
  var use_get_list_company_default = useGetListCompany;
5069
4931
 
5070
4932
  // src/hooks/excel/use-export-excel.ts
5071
- var import_react_query15 = require("@tanstack/react-query");
4933
+ var import_react_query16 = require("@tanstack/react-query");
5072
4934
  var useExportExcel = () => {
5073
- return (0, import_react_query15.useMutation)({
4935
+ return (0, import_react_query16.useMutation)({
5074
4936
  mutationFn: ({
5075
4937
  model,
5076
4938
  domain,
@@ -5095,9 +4957,9 @@ var useExportExcel = () => {
5095
4957
  var use_export_excel_default = useExportExcel;
5096
4958
 
5097
4959
  // src/hooks/excel/use-get-field-export.ts
5098
- var import_react_query16 = require("@tanstack/react-query");
4960
+ var import_react_query17 = require("@tanstack/react-query");
5099
4961
  var useGetFieldExport = () => {
5100
- return (0, import_react_query16.useMutation)({
4962
+ return (0, import_react_query17.useMutation)({
5101
4963
  mutationFn: ({
5102
4964
  ids,
5103
4965
  model,
@@ -5126,9 +4988,9 @@ var useGetFieldExport = () => {
5126
4988
  var use_get_field_export_default = useGetFieldExport;
5127
4989
 
5128
4990
  // src/hooks/excel/use-get-file-excel.ts
5129
- var import_react_query17 = require("@tanstack/react-query");
4991
+ var import_react_query18 = require("@tanstack/react-query");
5130
4992
  var useGetFileExcel = ({ model }) => {
5131
- return (0, import_react_query17.useQuery)({
4993
+ return (0, import_react_query18.useQuery)({
5132
4994
  queryKey: [],
5133
4995
  queryFn: () => excel_service_default.getFileExcel({
5134
4996
  model
@@ -5144,9 +5006,9 @@ var useGetFileExcel = ({ model }) => {
5144
5006
  var use_get_file_excel_default = useGetFileExcel;
5145
5007
 
5146
5008
  // src/hooks/excel/use-parse-preview.ts
5147
- var import_react_query18 = require("@tanstack/react-query");
5009
+ var import_react_query19 = require("@tanstack/react-query");
5148
5010
  var useParsePreview = () => {
5149
- return (0, import_react_query18.useMutation)({
5011
+ return (0, import_react_query19.useMutation)({
5150
5012
  mutationFn: ({
5151
5013
  id,
5152
5014
  selectedSheet,
@@ -5163,9 +5025,9 @@ var useParsePreview = () => {
5163
5025
  var use_parse_preview_default = useParsePreview;
5164
5026
 
5165
5027
  // src/hooks/excel/use-upload-file.ts
5166
- var import_react_query19 = require("@tanstack/react-query");
5028
+ var import_react_query20 = require("@tanstack/react-query");
5167
5029
  var useUploadFile = () => {
5168
- return (0, import_react_query19.useMutation)({
5030
+ return (0, import_react_query20.useMutation)({
5169
5031
  mutationFn: ({ formData }) => excel_service_default.uploadFile({
5170
5032
  formData
5171
5033
  })
@@ -5174,9 +5036,9 @@ var useUploadFile = () => {
5174
5036
  var use_upload_file_default = useUploadFile;
5175
5037
 
5176
5038
  // src/hooks/excel/use-upload-id-file.ts
5177
- var import_react_query20 = require("@tanstack/react-query");
5039
+ var import_react_query21 = require("@tanstack/react-query");
5178
5040
  var useUploadIdFile = () => {
5179
- return (0, import_react_query20.useMutation)({
5041
+ return (0, import_react_query21.useMutation)({
5180
5042
  mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
5181
5043
  formData
5182
5044
  })
@@ -5185,9 +5047,9 @@ var useUploadIdFile = () => {
5185
5047
  var use_upload_id_file_default = useUploadIdFile;
5186
5048
 
5187
5049
  // src/hooks/excel/uss-execute-import.ts
5188
- var import_react_query21 = require("@tanstack/react-query");
5050
+ var import_react_query22 = require("@tanstack/react-query");
5189
5051
  var useExecuteImport = () => {
5190
- return (0, import_react_query21.useMutation)({
5052
+ return (0, import_react_query22.useMutation)({
5191
5053
  mutationFn: ({
5192
5054
  fields,
5193
5055
  columns,
@@ -5208,9 +5070,9 @@ var useExecuteImport = () => {
5208
5070
  var uss_execute_import_default = useExecuteImport;
5209
5071
 
5210
5072
  // src/hooks/form/use-change-status.ts
5211
- var import_react_query22 = require("@tanstack/react-query");
5073
+ var import_react_query23 = require("@tanstack/react-query");
5212
5074
  var useChangeStatus = () => {
5213
- return (0, import_react_query22.useMutation)({
5075
+ return (0, import_react_query23.useMutation)({
5214
5076
  mutationFn: ({ data }) => {
5215
5077
  return form_service_default.changeStatus({
5216
5078
  data
@@ -5221,9 +5083,9 @@ var useChangeStatus = () => {
5221
5083
  var use_change_status_default = useChangeStatus;
5222
5084
 
5223
5085
  // src/hooks/form/use-delete-comment.ts
5224
- var import_react_query23 = require("@tanstack/react-query");
5086
+ var import_react_query24 = require("@tanstack/react-query");
5225
5087
  var useDeleteComment = () => {
5226
- return (0, import_react_query23.useMutation)({
5088
+ return (0, import_react_query24.useMutation)({
5227
5089
  mutationFn: ({ data }) => form_service_default.deleteComment({
5228
5090
  data
5229
5091
  })
@@ -5232,9 +5094,9 @@ var useDeleteComment = () => {
5232
5094
  var use_delete_comment_default = useDeleteComment;
5233
5095
 
5234
5096
  // src/hooks/form/use-get-comment.ts
5235
- var import_react_query24 = require("@tanstack/react-query");
5097
+ var import_react_query25 = require("@tanstack/react-query");
5236
5098
  var useGetComment = ({ data, queryKey }) => {
5237
- return (0, import_react_query24.useQuery)({
5099
+ return (0, import_react_query25.useQuery)({
5238
5100
  queryKey,
5239
5101
  queryFn: () => form_service_default.getComment({ data }).then((res) => {
5240
5102
  if (res) {
@@ -5248,13 +5110,13 @@ var useGetComment = ({ data, queryKey }) => {
5248
5110
  var use_get_comment_default = useGetComment;
5249
5111
 
5250
5112
  // src/hooks/form/use-get-form-view.ts
5251
- var import_react_query25 = require("@tanstack/react-query");
5113
+ var import_react_query26 = require("@tanstack/react-query");
5252
5114
  var useGetFormView = ({
5253
5115
  data,
5254
5116
  queryKey,
5255
5117
  enabled
5256
5118
  }) => {
5257
- return (0, import_react_query25.useQuery)({
5119
+ return (0, import_react_query26.useQuery)({
5258
5120
  queryKey,
5259
5121
  queryFn: () => form_service_default.getFormView({ data }).then((res) => {
5260
5122
  if (res) {
@@ -5268,13 +5130,13 @@ var useGetFormView = ({
5268
5130
  var use_get_form_view_default = useGetFormView;
5269
5131
 
5270
5132
  // src/hooks/form/use-get-image.ts
5271
- var import_react_query26 = require("@tanstack/react-query");
5133
+ var import_react_query27 = require("@tanstack/react-query");
5272
5134
  var useGetImage = ({
5273
5135
  data,
5274
5136
  queryKey,
5275
5137
  src
5276
5138
  }) => {
5277
- return (0, import_react_query26.useQuery)({
5139
+ return (0, import_react_query27.useQuery)({
5278
5140
  queryKey,
5279
5141
  queryFn: () => form_service_default.getImage({ data }).then((res) => {
5280
5142
  if (res) {
@@ -5288,9 +5150,9 @@ var useGetImage = ({
5288
5150
  var use_get_image_default = useGetImage;
5289
5151
 
5290
5152
  // src/hooks/form/use-send-comment.ts
5291
- var import_react_query27 = require("@tanstack/react-query");
5153
+ var import_react_query28 = require("@tanstack/react-query");
5292
5154
  var useSendComment = () => {
5293
- return (0, import_react_query27.useMutation)({
5155
+ return (0, import_react_query28.useMutation)({
5294
5156
  mutationFn: ({ data }) => form_service_default.sentComment({
5295
5157
  data
5296
5158
  })
@@ -5299,9 +5161,9 @@ var useSendComment = () => {
5299
5161
  var use_send_comment_default = useSendComment;
5300
5162
 
5301
5163
  // src/hooks/form/use-upload-image.ts
5302
- var import_react_query28 = require("@tanstack/react-query");
5164
+ var import_react_query29 = require("@tanstack/react-query");
5303
5165
  var useUploadImage = () => {
5304
- return (0, import_react_query28.useMutation)({
5166
+ return (0, import_react_query29.useMutation)({
5305
5167
  mutationFn: ({ data }) => form_service_default.uploadImage({
5306
5168
  data
5307
5169
  })
@@ -5310,18 +5172,18 @@ var useUploadImage = () => {
5310
5172
  var use_upload_image_default = useUploadImage;
5311
5173
 
5312
5174
  // src/hooks/model/use-delete.ts
5313
- var import_react_query29 = require("@tanstack/react-query");
5175
+ var import_react_query30 = require("@tanstack/react-query");
5314
5176
  var useDelete = () => {
5315
- return (0, import_react_query29.useMutation)({
5177
+ return (0, import_react_query30.useMutation)({
5316
5178
  mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
5317
5179
  });
5318
5180
  };
5319
5181
  var use_delete_default = useDelete;
5320
5182
 
5321
5183
  // src/hooks/model/use-get-all.ts
5322
- var import_react_query30 = require("@tanstack/react-query");
5184
+ var import_react_query31 = require("@tanstack/react-query");
5323
5185
  var useGetAll = ({ data, queryKey, viewResponse }) => {
5324
- return (0, import_react_query30.useQuery)({
5186
+ return (0, import_react_query31.useQuery)({
5325
5187
  queryKey,
5326
5188
  queryFn: () => model_service_default.getAll({ data }).then((res) => {
5327
5189
  if (res) {
@@ -5336,9 +5198,9 @@ var useGetAll = ({ data, queryKey, viewResponse }) => {
5336
5198
  var use_get_all_default = useGetAll;
5337
5199
 
5338
5200
  // src/hooks/model/use-get-conversion-rate.ts
5339
- var import_react_query31 = require("@tanstack/react-query");
5201
+ var import_react_query32 = require("@tanstack/react-query");
5340
5202
  var useGetConversionRate = () => {
5341
- return (0, import_react_query31.useQuery)({
5203
+ return (0, import_react_query32.useQuery)({
5342
5204
  queryKey: ["currency-rate"],
5343
5205
  queryFn: () => model_service_default.getConversionRate().then((res) => {
5344
5206
  if (res) {
@@ -5351,9 +5213,9 @@ var useGetConversionRate = () => {
5351
5213
  var use_get_conversion_rate_default = useGetConversionRate;
5352
5214
 
5353
5215
  // src/hooks/model/use-get-currency.ts
5354
- var import_react_query32 = require("@tanstack/react-query");
5216
+ var import_react_query33 = require("@tanstack/react-query");
5355
5217
  var useGetCurrency = () => {
5356
- return (0, import_react_query32.useQuery)({
5218
+ return (0, import_react_query33.useQuery)({
5357
5219
  queryKey: ["currency"],
5358
5220
  queryFn: () => model_service_default.getCurrency().then((res) => {
5359
5221
  if (res) {
@@ -5366,9 +5228,9 @@ var useGetCurrency = () => {
5366
5228
  var use_get_currency_default = useGetCurrency;
5367
5229
 
5368
5230
  // src/hooks/model/use-get-detail.ts
5369
- var import_react_query33 = require("@tanstack/react-query");
5231
+ var import_react_query34 = require("@tanstack/react-query");
5370
5232
  var useGetDetail = () => {
5371
- return (0, import_react_query33.useMutation)({
5233
+ return (0, import_react_query34.useMutation)({
5372
5234
  mutationFn: ({
5373
5235
  model,
5374
5236
  ids,
@@ -5385,9 +5247,9 @@ var useGetDetail = () => {
5385
5247
  var use_get_detail_default = useGetDetail;
5386
5248
 
5387
5249
  // src/hooks/model/use-get-field-onchange.ts
5388
- var import_react_query34 = require("@tanstack/react-query");
5250
+ var import_react_query35 = require("@tanstack/react-query");
5389
5251
  var useGetFieldOnChange = ({ model }) => {
5390
- return (0, import_react_query34.useQuery)({
5252
+ return (0, import_react_query35.useQuery)({
5391
5253
  queryKey: [`field-onchange-${model}`, model],
5392
5254
  queryFn: () => model_service_default.getListFieldsOnchange({
5393
5255
  model
@@ -5403,13 +5265,13 @@ var useGetFieldOnChange = ({ model }) => {
5403
5265
  var use_get_field_onchange_default = useGetFieldOnChange;
5404
5266
 
5405
5267
  // src/hooks/model/use-get-list-my-bank-account.ts
5406
- var import_react_query35 = require("@tanstack/react-query");
5268
+ var import_react_query36 = require("@tanstack/react-query");
5407
5269
  var useGetListMyBankAccount = ({
5408
5270
  domain,
5409
5271
  spectification,
5410
5272
  model
5411
5273
  }) => {
5412
- return (0, import_react_query35.useQuery)({
5274
+ return (0, import_react_query36.useQuery)({
5413
5275
  queryKey: ["bank-account", model, domain],
5414
5276
  queryFn: () => model_service_default.getListMyBankAccount({
5415
5277
  domain,
@@ -5427,6 +5289,10 @@ var use_get_list_my_bank_account_default = useGetListMyBankAccount;
5427
5289
 
5428
5290
  // src/models/base-model/index.ts
5429
5291
  var BaseModel = class {
5292
+ name;
5293
+ view;
5294
+ actContext;
5295
+ fields;
5430
5296
  constructor(init) {
5431
5297
  this.name = init.name;
5432
5298
  this.view = init.view;
@@ -5441,22 +5307,21 @@ var BaseModel = class {
5441
5307
  modelRoot
5442
5308
  }) {
5443
5309
  if (Array.isArray(fields)) {
5444
- let spec = __spreadValues({}, specification);
5310
+ let spec = { ...specification };
5445
5311
  fields.forEach((field) => {
5446
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
5447
- if (!(field == null ? void 0 : field.type_co) || (field == null ? void 0 : field.name) && (field == null ? void 0 : field.type_co) === "field" /* FIELD */) {
5448
- if ((_a = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _a[field == null ? void 0 : field.name]) {
5449
- if (((_c = (_b = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _b[field == null ? void 0 : field.name]) == null ? void 0 : _c.type) === "one2many" /* ONE2MANY */ || ((_e = (_d = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _d[field == null ? void 0 : field.name]) == null ? void 0 : _e.type) === "many2many" /* MANY2MANY */) {
5450
- const relation = (_g = (_f = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _f[field == null ? void 0 : field.name]) == null ? void 0 : _g.relation;
5451
- const modelRelation = modelsData == null ? void 0 : modelsData[relation];
5312
+ if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
5313
+ if (modelsData?.[model]?.[field?.name]) {
5314
+ if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
5315
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5316
+ const modelRelation = modelsData?.[relation];
5452
5317
  if (modelRelation) {
5453
- spec[field == null ? void 0 : field.name] = {
5318
+ spec[field?.name] = {
5454
5319
  fields: {}
5455
5320
  };
5456
5321
  if (modelRoot && modelRoot === relation) {
5457
- spec[field == null ? void 0 : field.name].fields = { id: {} };
5322
+ spec[field?.name].fields = { id: {} };
5458
5323
  } else {
5459
- spec[field == null ? void 0 : field.name].fields = this.getSpecificationByFields({
5324
+ spec[field?.name].fields = this.getSpecificationByFields({
5460
5325
  fields: Object.values(modelRelation),
5461
5326
  specification: {},
5462
5327
  modelsData,
@@ -5465,42 +5330,45 @@ var BaseModel = class {
5465
5330
  });
5466
5331
  }
5467
5332
  } else {
5468
- spec[field == null ? void 0 : field.name] = {
5333
+ spec[field?.name] = {
5469
5334
  fields: {
5470
5335
  id: {},
5471
5336
  display_name: {}
5472
5337
  }
5473
5338
  };
5474
5339
  }
5475
- } else if (((_i = (_h = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _h[field == null ? void 0 : field.name]) == null ? void 0 : _i.type) === "many2one" /* MANY2ONE */) {
5476
- spec[field == null ? void 0 : field.name] = {
5477
- fields: __spreadValues(__spreadValues(__spreadValues({
5340
+ } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
5341
+ spec[field?.name] = {
5342
+ fields: {
5478
5343
  id: {},
5479
- display_name: {}
5480
- }, WIDGETAVATAR[field == null ? void 0 : field.widget] ? { image_256: {} } : {}), (field == null ? void 0 : field.name) === "currency_id" && (fields == null ? void 0 : fields.find((item) => (item == null ? void 0 : item.widget) === "monetary")) ? { symbol: {} } : {}), (field == null ? void 0 : field.widget) === "many2many_binary" ? { mimetype: {} } : {})
5344
+ display_name: {},
5345
+ ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
5346
+ ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
5347
+ ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
5348
+ }
5481
5349
  };
5482
5350
  } else {
5483
- spec[field == null ? void 0 : field.name] = {};
5351
+ spec[field?.name] = {};
5484
5352
  }
5485
5353
  }
5486
- } else if ((field == null ? void 0 : field.type_co) === "group" /* GROUP */ || (field == null ? void 0 : field.type_co) === "div" /* DIV */ || (field == null ? void 0 : field.type_co) === "span" /* SPAN */) {
5354
+ } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
5487
5355
  const specGroup = this.getSpecificationByFields({
5488
- fields: field == null ? void 0 : field.fields,
5356
+ fields: field?.fields,
5489
5357
  specification: spec,
5490
5358
  modelsData,
5491
5359
  model
5492
5360
  });
5493
- spec = __spreadValues(__spreadValues({}, spec), specGroup);
5494
- } else if ((field == null ? void 0 : field.type_co) === "tree" /* TREE */ || (field == null ? void 0 : field.type_co) === "list" /* LIST */) {
5495
- const relation = (_k = (_j = modelsData == null ? void 0 : modelsData[model]) == null ? void 0 : _j[field == null ? void 0 : field.name]) == null ? void 0 : _k.relation;
5361
+ spec = { ...spec, ...specGroup };
5362
+ } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
5363
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5496
5364
  const specTreee = this.getSpecificationByFields({
5497
- fields: field == null ? void 0 : field.fields,
5365
+ fields: field?.fields,
5498
5366
  specification: {},
5499
5367
  modelsData,
5500
5368
  model: relation,
5501
5369
  modelRoot: model
5502
5370
  });
5503
- spec = __spreadProps(__spreadValues({}, spec), { [field == null ? void 0 : field.name]: { fields: specTreee } });
5371
+ spec = { ...spec, [field?.name]: { fields: specTreee } };
5504
5372
  }
5505
5373
  });
5506
5374
  return spec;
@@ -5509,19 +5377,16 @@ var BaseModel = class {
5509
5377
  }
5510
5378
  }
5511
5379
  getTreeProps() {
5512
- var _a, _b;
5513
- const props = ((_b = (_a = this.view) == null ? void 0 : _a.views) == null ? void 0 : _b.list) || {};
5380
+ const props = this.view?.views?.list || {};
5514
5381
  return props;
5515
5382
  }
5516
5383
  getTreeFields() {
5517
- var _a, _b, _c;
5518
- const fields = ((_c = (_b = (_a = this.view) == null ? void 0 : _a.views) == null ? void 0 : _b.list) == null ? void 0 : _c.fields) || [];
5384
+ const fields = this.view?.views?.list?.fields || [];
5519
5385
  return fields;
5520
5386
  }
5521
5387
  getSpecification() {
5522
- var _a;
5523
5388
  const specInit = {};
5524
- const modelData = ((_a = this.view) == null ? void 0 : _a.models) || {};
5389
+ const modelData = this.view?.models || {};
5525
5390
  const specification = this.getSpecificationByFields({
5526
5391
  fields: this.fields,
5527
5392
  specification: specInit,
@@ -5537,7 +5402,7 @@ var base_model_default = BaseModel;
5537
5402
  // src/hooks/model/use-model.ts
5538
5403
  var useModel = () => {
5539
5404
  const initModel = (modelData) => {
5540
- switch (modelData == null ? void 0 : modelData.name) {
5405
+ switch (modelData?.name) {
5541
5406
  default:
5542
5407
  return new base_model_default(modelData);
5543
5408
  }
@@ -5558,9 +5423,9 @@ var useOdooDataTransform = () => {
5558
5423
  var use_odoo_data_transform_default = useOdooDataTransform;
5559
5424
 
5560
5425
  // src/hooks/model/use-onchange-form.ts
5561
- var import_react_query36 = require("@tanstack/react-query");
5426
+ var import_react_query37 = require("@tanstack/react-query");
5562
5427
  var useOnChangeForm = () => {
5563
- return (0, import_react_query36.useMutation)({
5428
+ return (0, import_react_query37.useMutation)({
5564
5429
  mutationFn: ({
5565
5430
  ids,
5566
5431
  model,
@@ -5581,9 +5446,9 @@ var useOnChangeForm = () => {
5581
5446
  var use_onchange_form_default = useOnChangeForm;
5582
5447
 
5583
5448
  // src/hooks/model/use-save.ts
5584
- var import_react_query37 = require("@tanstack/react-query");
5449
+ var import_react_query38 = require("@tanstack/react-query");
5585
5450
  var useSave = () => {
5586
- return (0, import_react_query37.useMutation)({
5451
+ return (0, import_react_query38.useMutation)({
5587
5452
  mutationFn: ({
5588
5453
  ids,
5589
5454
  model,
@@ -5597,18 +5462,18 @@ var useSave = () => {
5597
5462
  var use_save_default = useSave;
5598
5463
 
5599
5464
  // src/hooks/user/use-get-profile.ts
5600
- var import_react_query38 = require("@tanstack/react-query");
5465
+ var import_react_query39 = require("@tanstack/react-query");
5601
5466
  var useGetProfile = (path) => {
5602
- return (0, import_react_query38.useMutation)({
5467
+ return (0, import_react_query39.useMutation)({
5603
5468
  mutationFn: () => user_service_default.getProfile(path)
5604
5469
  });
5605
5470
  };
5606
5471
  var use_get_profile_default = useGetProfile;
5607
5472
 
5608
5473
  // src/hooks/user/use-get-user.ts
5609
- var import_react_query39 = require("@tanstack/react-query");
5474
+ var import_react_query40 = require("@tanstack/react-query");
5610
5475
  var useGetUser = () => {
5611
- return (0, import_react_query39.useMutation)({
5476
+ return (0, import_react_query40.useMutation)({
5612
5477
  mutationFn: ({ id, context }) => user_service_default.getUser({
5613
5478
  id,
5614
5479
  context
@@ -5618,9 +5483,9 @@ var useGetUser = () => {
5618
5483
  var use_get_user_default = useGetUser;
5619
5484
 
5620
5485
  // src/hooks/user/use-switch-locale.ts
5621
- var import_react_query40 = require("@tanstack/react-query");
5486
+ var import_react_query41 = require("@tanstack/react-query");
5622
5487
  var useSwitchLocale = () => {
5623
- return (0, import_react_query40.useMutation)({
5488
+ return (0, import_react_query41.useMutation)({
5624
5489
  mutationFn: ({ data }) => {
5625
5490
  return user_service_default.switchUserLocale({
5626
5491
  id: data.id,
@@ -5632,9 +5497,9 @@ var useSwitchLocale = () => {
5632
5497
  var use_switch_locale_default = useSwitchLocale;
5633
5498
 
5634
5499
  // src/hooks/view/use-button.ts
5635
- var import_react_query41 = require("@tanstack/react-query");
5500
+ var import_react_query42 = require("@tanstack/react-query");
5636
5501
  var useButton = () => {
5637
- return (0, import_react_query41.useMutation)({
5502
+ return (0, import_react_query42.useMutation)({
5638
5503
  mutationFn: ({
5639
5504
  model,
5640
5505
  ids,
@@ -5654,9 +5519,9 @@ var useButton = () => {
5654
5519
  var use_button_default = useButton;
5655
5520
 
5656
5521
  // src/hooks/view/use-duplicate-record.ts
5657
- var import_react_query42 = require("@tanstack/react-query");
5522
+ var import_react_query43 = require("@tanstack/react-query");
5658
5523
  var useDuplicateRecord = () => {
5659
- return (0, import_react_query42.useMutation)({
5524
+ return (0, import_react_query43.useMutation)({
5660
5525
  mutationFn: ({
5661
5526
  id,
5662
5527
  model,
@@ -5671,7 +5536,7 @@ var useDuplicateRecord = () => {
5671
5536
  var use_duplicate_record_default = useDuplicateRecord;
5672
5537
 
5673
5538
  // src/hooks/view/use-get-action-detail.ts
5674
- var import_react_query43 = require("@tanstack/react-query");
5539
+ var import_react_query44 = require("@tanstack/react-query");
5675
5540
  var useGetActionDetail = ({
5676
5541
  aid,
5677
5542
  context,
@@ -5682,22 +5547,22 @@ var useGetActionDetail = ({
5682
5547
  }) => {
5683
5548
  const data = {
5684
5549
  id,
5685
- model: model != null ? model : "",
5550
+ model: model ?? "",
5686
5551
  context
5687
5552
  };
5688
- return (0, import_react_query43.useQuery)({
5553
+ return (0, import_react_query44.useQuery)({
5689
5554
  queryKey,
5690
- queryFn: () => __async(null, null, function* () {
5555
+ queryFn: async () => {
5691
5556
  if (aid) {
5692
- const res = yield view_service_default.getActionDetail(aid, context);
5557
+ const res = await view_service_default.getActionDetail(aid, context);
5693
5558
  if (res && res.length > 0) {
5694
5559
  return res[0];
5695
5560
  }
5696
5561
  } else {
5697
- const res = yield form_service_default.getFormView({ data });
5562
+ const res = await form_service_default.getFormView({ data });
5698
5563
  return res;
5699
5564
  }
5700
- }),
5565
+ },
5701
5566
  enabled,
5702
5567
  refetchOnWindowFocus: false,
5703
5568
  staleTime: Infinity
@@ -5706,9 +5571,9 @@ var useGetActionDetail = ({
5706
5571
  var use_get_action_detail_default = useGetActionDetail;
5707
5572
 
5708
5573
  // src/hooks/view/use-get-calendar.ts
5709
- var import_react_query44 = require("@tanstack/react-query");
5574
+ var import_react_query45 = require("@tanstack/react-query");
5710
5575
  var useGetCalendar = (listDataProps, queryKey, enabled) => {
5711
- return (0, import_react_query44.useQuery)({
5576
+ return (0, import_react_query45.useQuery)({
5712
5577
  queryKey,
5713
5578
  queryFn: () => model_service_default.getListCalendar({ data: listDataProps }).then((res) => {
5714
5579
  if (res) {
@@ -5724,12 +5589,12 @@ var useGetCalendar = (listDataProps, queryKey, enabled) => {
5724
5589
  var use_get_calendar_default = useGetCalendar;
5725
5590
 
5726
5591
  // src/hooks/view/use-get-groups.ts
5727
- var import_react_query45 = require("@tanstack/react-query");
5592
+ var import_react_query46 = require("@tanstack/react-query");
5728
5593
  var useGetGroups = ({
5729
5594
  model,
5730
5595
  width_context
5731
5596
  }) => {
5732
- return (0, import_react_query45.useQuery)({
5597
+ return (0, import_react_query46.useQuery)({
5733
5598
  queryKey: [model, width_context],
5734
5599
  queryFn: () => kanban_service_default.getGroups({
5735
5600
  model,
@@ -5746,9 +5611,9 @@ var useGetGroups = ({
5746
5611
  var use_get_groups_default = useGetGroups;
5747
5612
 
5748
5613
  // src/hooks/view/use-get-list-data.ts
5749
- var import_react_query46 = require("@tanstack/react-query");
5614
+ var import_react_query47 = require("@tanstack/react-query");
5750
5615
  var useGetListData = (listDataProps, queryKey, enabled) => {
5751
- return (0, import_react_query46.useQuery)({
5616
+ return (0, import_react_query47.useQuery)({
5752
5617
  queryKey,
5753
5618
  queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
5754
5619
  if (res) {
@@ -5764,14 +5629,13 @@ var useGetListData = (listDataProps, queryKey, enabled) => {
5764
5629
  var use_get_list_data_default = useGetListData;
5765
5630
 
5766
5631
  // src/hooks/view/use-get-menu.ts
5767
- var import_react_query47 = require("@tanstack/react-query");
5632
+ var import_react_query48 = require("@tanstack/react-query");
5768
5633
  var useGetMenu = (context, enabled) => {
5769
- return (0, import_react_query47.useQuery)({
5634
+ return (0, import_react_query48.useQuery)({
5770
5635
  queryKey: ["menus" /* MENU */, context],
5771
5636
  queryFn: () => view_service_default.getMenu(context).then((res) => {
5772
- var _a;
5773
- if (res && (res == null ? void 0 : res.records) && ((_a = res == null ? void 0 : res.records) == null ? void 0 : _a.length) > 0) {
5774
- return res == null ? void 0 : res.records;
5637
+ if (res && res?.records && res?.records?.length > 0) {
5638
+ return res?.records;
5775
5639
  }
5776
5640
  return [];
5777
5641
  }),
@@ -5783,9 +5647,9 @@ var useGetMenu = (context, enabled) => {
5783
5647
  var use_get_menu_default = useGetMenu;
5784
5648
 
5785
5649
  // src/hooks/view/use-get-print-report.ts
5786
- var import_react_query48 = require("@tanstack/react-query");
5650
+ var import_react_query49 = require("@tanstack/react-query");
5787
5651
  var useGetPrintReport = () => {
5788
- return (0, import_react_query48.useMutation)({
5652
+ return (0, import_react_query49.useMutation)({
5789
5653
  mutationFn: ({ id }) => action_service_default.getPrintReportName({
5790
5654
  id
5791
5655
  })
@@ -5794,14 +5658,14 @@ var useGetPrintReport = () => {
5794
5658
  var use_get_print_report_default = useGetPrintReport;
5795
5659
 
5796
5660
  // src/hooks/view/use-get-progress-bar.ts
5797
- var import_react_query49 = require("@tanstack/react-query");
5661
+ var import_react_query50 = require("@tanstack/react-query");
5798
5662
  var useGetProGressBar = ({
5799
5663
  field,
5800
5664
  color,
5801
5665
  model,
5802
5666
  width_context
5803
5667
  }) => {
5804
- return (0, import_react_query49.useQuery)({
5668
+ return (0, import_react_query50.useQuery)({
5805
5669
  queryKey: [],
5806
5670
  queryFn: () => kanban_service_default.getProgressBar({
5807
5671
  field,
@@ -5820,13 +5684,13 @@ var useGetProGressBar = ({
5820
5684
  var use_get_progress_bar_default = useGetProGressBar;
5821
5685
 
5822
5686
  // src/hooks/view/use-get-selection.ts
5823
- var import_react_query50 = require("@tanstack/react-query");
5687
+ var import_react_query51 = require("@tanstack/react-query");
5824
5688
  var useGetSelection = ({
5825
5689
  data,
5826
5690
  queryKey,
5827
5691
  enabled
5828
5692
  }) => {
5829
- return (0, import_react_query50.useQuery)({
5693
+ return (0, import_react_query51.useQuery)({
5830
5694
  queryKey,
5831
5695
  queryFn: () => view_service_default.getSelectionItem({ data }),
5832
5696
  enabled,
@@ -5836,9 +5700,9 @@ var useGetSelection = ({
5836
5700
  var use_get_selection_default = useGetSelection;
5837
5701
 
5838
5702
  // src/hooks/view/use-get-view.ts
5839
- var import_react_query51 = require("@tanstack/react-query");
5703
+ var import_react_query52 = require("@tanstack/react-query");
5840
5704
  var useGetView = (viewParams, actData) => {
5841
- return (0, import_react_query51.useQuery)({
5705
+ return (0, import_react_query52.useQuery)({
5842
5706
  queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
5843
5707
  queryFn: () => view_service_default.getView(viewParams),
5844
5708
  enabled: !!actData,
@@ -5849,9 +5713,9 @@ var useGetView = (viewParams, actData) => {
5849
5713
  var use_get_view_default = useGetView;
5850
5714
 
5851
5715
  // src/hooks/view/use-load-action.ts
5852
- var import_react_query52 = require("@tanstack/react-query");
5716
+ var import_react_query53 = require("@tanstack/react-query");
5853
5717
  var useLoadAction = () => {
5854
- return (0, import_react_query52.useMutation)({
5718
+ return (0, import_react_query53.useMutation)({
5855
5719
  mutationFn: ({
5856
5720
  idAction,
5857
5721
  context
@@ -5866,9 +5730,9 @@ var useLoadAction = () => {
5866
5730
  var use_load_action_default = useLoadAction;
5867
5731
 
5868
5732
  // src/hooks/view/use-load-message.ts
5869
- var import_react_query53 = require("@tanstack/react-query");
5733
+ var import_react_query54 = require("@tanstack/react-query");
5870
5734
  var useLoadMessage = () => {
5871
- return (0, import_react_query53.useQuery)({
5735
+ return (0, import_react_query54.useQuery)({
5872
5736
  queryKey: [`load-message-failure`],
5873
5737
  queryFn: () => view_service_default.loadMessages(),
5874
5738
  refetchOnWindowFocus: false
@@ -5877,9 +5741,9 @@ var useLoadMessage = () => {
5877
5741
  var use_load_message_default = useLoadMessage;
5878
5742
 
5879
5743
  // src/hooks/view/use-print.ts
5880
- var import_react_query54 = require("@tanstack/react-query");
5744
+ var import_react_query55 = require("@tanstack/react-query");
5881
5745
  var usePrint = () => {
5882
- return (0, import_react_query54.useMutation)({
5746
+ return (0, import_react_query55.useMutation)({
5883
5747
  mutationFn: ({ id, report, db }) => action_service_default.print({
5884
5748
  id,
5885
5749
  report,
@@ -5890,9 +5754,9 @@ var usePrint = () => {
5890
5754
  var use_print_default = usePrint;
5891
5755
 
5892
5756
  // src/hooks/view/use-remove-row.ts
5893
- var import_react_query55 = require("@tanstack/react-query");
5757
+ var import_react_query56 = require("@tanstack/react-query");
5894
5758
  var useRemoveRow = () => {
5895
- return (0, import_react_query55.useMutation)({
5759
+ return (0, import_react_query56.useMutation)({
5896
5760
  mutationFn: ({
5897
5761
  model,
5898
5762
  ids,
@@ -5907,9 +5771,9 @@ var useRemoveRow = () => {
5907
5771
  var use_remove_row_default = useRemoveRow;
5908
5772
 
5909
5773
  // src/hooks/view/use-resequence.ts
5910
- var import_react_query56 = require("@tanstack/react-query");
5774
+ var import_react_query57 = require("@tanstack/react-query");
5911
5775
  var useGetResequence = (model, resIds, context, offset) => {
5912
- return (0, import_react_query56.useQuery)({
5776
+ return (0, import_react_query57.useQuery)({
5913
5777
  queryKey: [],
5914
5778
  queryFn: () => view_service_default.getResequence({
5915
5779
  model,
@@ -5924,9 +5788,9 @@ var useGetResequence = (model, resIds, context, offset) => {
5924
5788
  var use_resequence_default = useGetResequence;
5925
5789
 
5926
5790
  // src/hooks/view/use-run-action.ts
5927
- var import_react_query57 = require("@tanstack/react-query");
5791
+ var import_react_query58 = require("@tanstack/react-query");
5928
5792
  var useRunAction = () => {
5929
- return (0, import_react_query57.useMutation)({
5793
+ return (0, import_react_query58.useMutation)({
5930
5794
  mutationFn: ({
5931
5795
  idAction,
5932
5796
  context
@@ -5939,9 +5803,9 @@ var useRunAction = () => {
5939
5803
  var use_run_action_default = useRunAction;
5940
5804
 
5941
5805
  // src/hooks/view/use-signin-sso.ts
5942
- var import_react_query58 = require("@tanstack/react-query");
5806
+ var import_react_query59 = require("@tanstack/react-query");
5943
5807
  var useSignInSSO = () => {
5944
- return (0, import_react_query58.useMutation)({
5808
+ return (0, import_react_query59.useMutation)({
5945
5809
  mutationFn: ({
5946
5810
  redirect_uri,
5947
5811
  state,
@@ -5962,9 +5826,9 @@ var useSignInSSO = () => {
5962
5826
  var use_signin_sso_default = useSignInSSO;
5963
5827
 
5964
5828
  // src/hooks/view/use-verify-2FA.ts
5965
- var import_react_query59 = require("@tanstack/react-query");
5829
+ var import_react_query60 = require("@tanstack/react-query");
5966
5830
  var useVerify2FA = () => {
5967
- return (0, import_react_query59.useMutation)({
5831
+ return (0, import_react_query60.useMutation)({
5968
5832
  mutationFn: ({
5969
5833
  method,
5970
5834
  with_context,
@@ -5985,9 +5849,9 @@ var useVerify2FA = () => {
5985
5849
  var use_verify_2FA_default = useVerify2FA;
5986
5850
 
5987
5851
  // src/hooks/view/uset-get-2FA-method.ts
5988
- var import_react_query60 = require("@tanstack/react-query");
5852
+ var import_react_query61 = require("@tanstack/react-query");
5989
5853
  var useGet2FAMethods = () => {
5990
- return (0, import_react_query60.useMutation)({
5854
+ return (0, import_react_query61.useMutation)({
5991
5855
  mutationFn: ({
5992
5856
  method,
5993
5857
  with_context
@@ -6002,9 +5866,9 @@ var useGet2FAMethods = () => {
6002
5866
  var uset_get_2FA_method_default = useGet2FAMethods;
6003
5867
 
6004
5868
  // src/hooks/view/use-get-fields-view-security.ts
6005
- var import_react_query61 = require("@tanstack/react-query");
5869
+ var import_react_query62 = require("@tanstack/react-query");
6006
5870
  var useGetFieldsViewSecurity = () => {
6007
- return (0, import_react_query61.useMutation)({
5871
+ return (0, import_react_query62.useMutation)({
6008
5872
  mutationFn: ({
6009
5873
  method,
6010
5874
  token,
@@ -6021,9 +5885,9 @@ var useGetFieldsViewSecurity = () => {
6021
5885
  var use_get_fields_view_security_default = useGetFieldsViewSecurity;
6022
5886
 
6023
5887
  // src/hooks/view/use-grant-access.ts
6024
- var import_react_query62 = require("@tanstack/react-query");
5888
+ var import_react_query63 = require("@tanstack/react-query");
6025
5889
  var useGrantAccess = () => {
6026
- return (0, import_react_query62.useMutation)({
5890
+ return (0, import_react_query63.useMutation)({
6027
5891
  mutationFn: ({
6028
5892
  redirect_uri,
6029
5893
  state,
@@ -6042,9 +5906,9 @@ var useGrantAccess = () => {
6042
5906
  var use_grant_access_default = useGrantAccess;
6043
5907
 
6044
5908
  // src/hooks/view/use-remove-totp-setup.ts
6045
- var import_react_query63 = require("@tanstack/react-query");
5909
+ var import_react_query64 = require("@tanstack/react-query");
6046
5910
  var useRemoveTotpSetup = () => {
6047
- return (0, import_react_query63.useMutation)({
5911
+ return (0, import_react_query64.useMutation)({
6048
5912
  mutationFn: ({ method, token }) => {
6049
5913
  return view_service_default.removeTotpSetUp({
6050
5914
  method,
@@ -6056,9 +5920,9 @@ var useRemoveTotpSetup = () => {
6056
5920
  var use_remove_totp_setup_default = useRemoveTotpSetup;
6057
5921
 
6058
5922
  // src/hooks/view/use-request-setup-totp.ts
6059
- var import_react_query64 = require("@tanstack/react-query");
5923
+ var import_react_query65 = require("@tanstack/react-query");
6060
5924
  var useRequestSetupTotp = () => {
6061
- return (0, import_react_query64.useMutation)({
5925
+ return (0, import_react_query65.useMutation)({
6062
5926
  mutationFn: ({ method, token }) => {
6063
5927
  return view_service_default.requestSetupTotp({
6064
5928
  method,
@@ -6070,9 +5934,9 @@ var useRequestSetupTotp = () => {
6070
5934
  var use_request_setup_totp_default = useRequestSetupTotp;
6071
5935
 
6072
5936
  // src/hooks/view/use-settings-web-read-2fa.ts
6073
- var import_react_query65 = require("@tanstack/react-query");
5937
+ var import_react_query66 = require("@tanstack/react-query");
6074
5938
  var useSettingsWebRead2fa = () => {
6075
- return (0, import_react_query65.useMutation)({
5939
+ return (0, import_react_query66.useMutation)({
6076
5940
  mutationFn: ({
6077
5941
  method,
6078
5942
  token,
@@ -6091,9 +5955,9 @@ var useSettingsWebRead2fa = () => {
6091
5955
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
6092
5956
 
6093
5957
  // src/hooks/view/use-verify-totp.ts
6094
- var import_react_query66 = require("@tanstack/react-query");
5958
+ var import_react_query67 = require("@tanstack/react-query");
6095
5959
  var useVerifyTotp = () => {
6096
- return (0, import_react_query66.useMutation)({
5960
+ return (0, import_react_query67.useMutation)({
6097
5961
  mutationFn: ({
6098
5962
  method,
6099
5963
  action_token,
@@ -6176,6 +6040,7 @@ var use_verify_totp_default = useVerifyTotp;
6176
6040
  useUploadFile,
6177
6041
  useUploadIdFile,
6178
6042
  useUploadImage,
6043
+ useValidateActionToken,
6179
6044
  useVerify2FA,
6180
6045
  useVerifyTotp
6181
6046
  });