@fctc/interface-logic 1.5.8 → 1.5.9

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,114 @@ 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;
3171
3154
  }
3172
3155
  setupEnv(envConfig) {
3173
- const dispatch = this.envStore.dispatch;
3174
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3156
+ const dispatch = envStore.dispatch;
3157
+ const env2 = {
3158
+ ...envConfig,
3175
3159
  localStorageUtils: this.localStorageUtils,
3176
3160
  sessionStorageUtils: this.sessionStorageUtils
3177
- });
3161
+ };
3178
3162
  const requests = axiosClient.init(env2);
3179
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3163
+ dispatch(setEnv({ ...env2, requests }));
3180
3164
  this.setup();
3181
3165
  }
3182
3166
  setUid(uid) {
3183
- const dispatch = this.envStore.dispatch;
3167
+ const dispatch = envStore.dispatch;
3184
3168
  dispatch(setUid(uid));
3185
3169
  this.setup();
3186
3170
  }
3187
3171
  setLang(lang) {
3188
- const dispatch = this.envStore.dispatch;
3172
+ const dispatch = envStore.dispatch;
3189
3173
  dispatch(setLang(lang));
3190
3174
  this.setup();
3191
3175
  }
3192
3176
  setAllowCompanies(allowCompanies) {
3193
- const dispatch = this.envStore.dispatch;
3177
+ const dispatch = envStore.dispatch;
3194
3178
  dispatch(setAllowCompanies(allowCompanies));
3195
3179
  this.setup();
3196
3180
  }
3197
3181
  setCompanies(companies) {
3198
- const dispatch = this.envStore.dispatch;
3182
+ const dispatch = envStore.dispatch;
3199
3183
  dispatch(setCompanies(companies));
3200
3184
  this.setup();
3201
3185
  }
3202
3186
  setDefaultCompany(company) {
3203
- const dispatch = this.envStore.dispatch;
3187
+ const dispatch = envStore.dispatch;
3204
3188
  dispatch(setDefaultCompany(company));
3205
3189
  this.setup();
3206
3190
  }
3207
3191
  setUserInfo(userInfo) {
3208
- const dispatch = this.envStore.dispatch;
3192
+ const dispatch = envStore.dispatch;
3209
3193
  dispatch(setUser(userInfo));
3210
3194
  this.setup();
3211
3195
  }
3212
3196
  };
3213
3197
  var env = null;
3214
3198
  function getEnv() {
3215
- if (!env)
3216
- env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3199
+ if (!env) env = new EnvStore(localStorageUtils(), sessionStorageUtils());
3217
3200
  return env;
3218
3201
  }
3219
3202
 
3220
3203
  // src/services/action-service/index.ts
3221
3204
  var ActionService = {
3222
3205
  // 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;
3206
+ async loadAction({
3207
+ idAction,
3208
+ context
3209
+ }) {
3210
+ const env2 = getEnv();
3211
+ const jsonData = {
3212
+ action_id: idAction,
3213
+ with_context: {
3214
+ ...context
3215
+ }
3216
+ };
3217
+ return env2.requests.post(`${"/load_action" /* LOAD_ACTION */}`, jsonData, {
3218
+ headers: {
3219
+ "Content-Type": "application/json"
3264
3220
  }
3265
3221
  });
3266
3222
  },
3267
- // remove Row
3268
- removeRows(_0) {
3269
- return __async(this, arguments, function* ({
3270
- model,
3271
- ids,
3272
- context
3273
- }) {
3223
+ // Call Button
3224
+ async callButton({
3225
+ model,
3226
+ ids = [],
3227
+ context,
3228
+ method
3229
+ }) {
3230
+ try {
3274
3231
  const env2 = getEnv();
3275
3232
  const jsonData = {
3276
3233
  model,
3277
- method: "unlink",
3234
+ method,
3278
3235
  ids,
3279
3236
  with_context: context
3280
3237
  };
@@ -3283,96 +3240,112 @@ var ActionService = {
3283
3240
  "Content-Type": "application/json"
3284
3241
  }
3285
3242
  });
3243
+ } catch (error) {
3244
+ console.error("Error when calling button action:", error);
3245
+ throw error;
3246
+ }
3247
+ },
3248
+ // remove Row
3249
+ async removeRows({
3250
+ model,
3251
+ ids,
3252
+ context
3253
+ }) {
3254
+ const env2 = getEnv();
3255
+ const jsonData = {
3256
+ model,
3257
+ method: "unlink",
3258
+ ids,
3259
+ with_context: context
3260
+ };
3261
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3262
+ headers: {
3263
+ "Content-Type": "application/json"
3264
+ }
3286
3265
  });
3287
3266
  },
3288
3267
  // Duplicate Model
3289
- duplicateRecord(_0) {
3290
- return __async(this, arguments, function* ({
3268
+ async duplicateRecord({
3269
+ model,
3270
+ id,
3271
+ context
3272
+ }) {
3273
+ const env2 = getEnv();
3274
+ const jsonData = {
3291
3275
  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
- });
3276
+ method: "copy",
3277
+ ids: id,
3278
+ with_context: context
3279
+ };
3280
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3281
+ headers: {
3282
+ "Content-Type": "application/json"
3283
+ }
3307
3284
  });
3308
3285
  },
3309
3286
  // 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"
3287
+ async getPrintReportName({ id }) {
3288
+ const env2 = getEnv();
3289
+ const jsonData = {
3290
+ model: "ir.actions.report",
3291
+ method: "web_read",
3292
+ id,
3293
+ kwargs: {
3294
+ specification: {
3295
+ report_name: {}
3326
3296
  }
3327
- });
3297
+ }
3298
+ };
3299
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3300
+ headers: {
3301
+ "Content-Type": "application/json"
3302
+ }
3328
3303
  });
3329
3304
  },
3330
3305
  //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
- });
3306
+ async print({ id, report, db }) {
3307
+ const env2 = getEnv();
3308
+ const jsonData = {
3309
+ report,
3310
+ id,
3311
+ type: "pdf",
3312
+ file_response: true,
3313
+ db
3314
+ };
3315
+ const queryString = toQueryString(jsonData);
3316
+ const urlWithParams = `${"/report" /* REPORT_PATH */}?${queryString}`;
3317
+ return env2.requests.get(urlWithParams, {
3318
+ headers: {
3319
+ "Content-Type": "application/json"
3320
+ },
3321
+ responseType: "arraybuffer"
3349
3322
  });
3350
3323
  },
3351
3324
  //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
- });
3325
+ async runAction({
3326
+ idAction,
3327
+ context
3328
+ }) {
3329
+ const env2 = getEnv();
3330
+ const jsonData = {
3331
+ action_id: idAction,
3332
+ with_context: {
3333
+ ...context
3334
+ }
3335
+ // context: {
3336
+ // lang: 'en_US',
3337
+ // tz: 'Asia/Saigon',
3338
+ // uid: 2,
3339
+ // allowed_company_ids: [1],
3340
+ // active_id: Array.isArray(idDetail) ? idDetail[0] : idDetail,
3341
+ // active_ids: Array.isArray(idDetail) ? [...idDetail] : idDetail,
3342
+ // active_model: model,
3343
+ // },
3344
+ };
3345
+ return env2.requests.post(`${"/run_action" /* RUN_ACTION_PATH */}`, jsonData, {
3346
+ headers: {
3347
+ "Content-Type": "application/json"
3348
+ }
3376
3349
  });
3377
3350
  }
3378
3351
  };
@@ -3380,910 +3353,828 @@ var action_service_default = ActionService;
3380
3353
 
3381
3354
  // src/services/auth-service/index.ts
3382
3355
  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
- });
3356
+ async login(body) {
3357
+ const env2 = getEnv();
3358
+ const payload = Object.fromEntries(
3359
+ Object.entries({
3360
+ username: body.email,
3361
+ password: body.password,
3362
+ grant_type: env2?.config?.grantType || "",
3363
+ client_id: env2?.config?.clientId || "",
3364
+ client_secret: env2?.config?.clientSecret || ""
3365
+ }).filter(([_, value]) => !!value)
3366
+ );
3367
+ const encodedData = new URLSearchParams(payload).toString();
3368
+ return env2?.requests?.post(body.path, encodedData, {
3369
+ headers: {
3370
+ "Content-Type": "application/x-www-form-urlencoded"
3371
+ }
3402
3372
  });
3403
3373
  },
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
- });
3374
+ async forgotPassword(email) {
3375
+ const env2 = getEnv();
3376
+ const bodyData = {
3377
+ login: email,
3378
+ url: `${window.location.origin}/reset-password`
3379
+ };
3380
+ return env2?.requests?.post("/reset_password" /* RESET_PASSWORD_PATH */, bodyData, {
3381
+ headers: {
3382
+ "Content-Type": "application/json"
3383
+ }
3417
3384
  });
3418
3385
  },
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"
3386
+ async forgotPasswordSSO({
3387
+ email,
3388
+ with_context,
3389
+ method
3390
+ }) {
3391
+ const env2 = getEnv();
3392
+ const body = {
3393
+ method,
3394
+ kwargs: {
3395
+ vals: {
3396
+ email
3439
3397
  }
3440
- });
3398
+ },
3399
+ with_context
3400
+ };
3401
+ return env2?.requests?.post("/call" /* CALL_PATH */, body, {
3402
+ headers: {
3403
+ "Content-Type": "application/json"
3404
+ }
3441
3405
  });
3442
3406
  },
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
- });
3407
+ async resetPassword(data, token) {
3408
+ const env2 = getEnv();
3409
+ const bodyData = {
3410
+ token,
3411
+ password: data.password,
3412
+ new_password: data.confirmPassword
3413
+ };
3414
+ return env2?.requests?.post("/change_password" /* CHANGE_PASSWORD_PATH */, bodyData, {
3415
+ headers: {
3416
+ "Content-Type": "application/json"
3417
+ }
3457
3418
  });
3458
3419
  },
3459
- resetPasswordSSO(_0) {
3460
- return __async(this, arguments, function* ({
3420
+ async resetPasswordSSO({
3421
+ method,
3422
+ password,
3423
+ with_context
3424
+ }) {
3425
+ const env2 = getEnv();
3426
+ const bodyData = {
3461
3427
  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
- }
3428
+ kwargs: {
3429
+ vals: {
3430
+ password
3431
+ }
3432
+ },
3433
+ with_context
3434
+ };
3435
+ return env2?.requests?.post("/call" /* CALL_PATH */, bodyData, {
3436
+ headers: {
3437
+ "Content-Type": "application/json"
3438
+ }
3439
+ });
3440
+ },
3441
+ async updatePassword(data, token) {
3442
+ const env2 = getEnv();
3443
+ const bodyData = {
3444
+ token,
3445
+ old_password: data.oldPassword,
3446
+ new_password: data.newPassword
3447
+ };
3448
+ return env2?.requests?.post("/change_password_parent" /* UPDATE_PASSWORD_PATH */, bodyData, {
3449
+ headers: {
3450
+ "Content-Type": "application/json"
3451
+ }
3452
+ });
3453
+ },
3454
+ async isValidToken(token) {
3455
+ const env2 = getEnv();
3456
+ const bodyData = {
3457
+ token
3458
+ };
3459
+ return env2?.requests?.post("/check_token" /* TOKEN */, bodyData, {
3460
+ headers: {
3461
+ "Content-Type": "application/json"
3462
+ }
3463
+ });
3464
+ },
3465
+ async isValidActionToken(actionToken, path) {
3466
+ const env2 = getEnv();
3467
+ return env2?.requests?.post(
3468
+ path,
3469
+ {},
3470
+ {
3471
+ headers: {
3472
+ "Content-Type": "application/json"
3473
3473
  },
3474
- with_context
3475
- };
3476
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, bodyData, {
3474
+ useActionToken: true,
3475
+ actionToken
3476
+ }
3477
+ );
3478
+ },
3479
+ async loginSocial({
3480
+ db,
3481
+ state,
3482
+ access_token
3483
+ }) {
3484
+ const env2 = getEnv();
3485
+ return env2?.requests?.post(
3486
+ "/token/generate" /* GENTOKEN_SOCIAL */,
3487
+ { state, access_token },
3488
+ {
3477
3489
  headers: {
3478
3490
  "Content-Type": "application/json"
3479
3491
  }
3480
- });
3481
- });
3492
+ }
3493
+ );
3482
3494
  },
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, {
3495
+ async getProviders(db) {
3496
+ const env2 = getEnv();
3497
+ return env2?.requests?.get("/oauth/providers", { params: { db } });
3498
+ },
3499
+ async getAccessByCode(code) {
3500
+ const env2 = getEnv();
3501
+ const data = new URLSearchParams();
3502
+ data.append("code", code);
3503
+ data.append("grant_type", "authorization_code");
3504
+ data.append("client_id", env2?.config?.clientId || "");
3505
+ data.append("redirect_uri", env2?.config?.redirectUri || "");
3506
+ return env2?.requests?.post(
3507
+ `${env2?.baseUrl?.replace("/mms/", "/id/")}/${"/token" /* TOKEN_BY_CODE */}`,
3508
+ data,
3509
+ {
3493
3510
  headers: {
3494
- "Content-Type": "application/json"
3511
+ "Content-Type": "application/x-www-form-urlencoded"
3495
3512
  }
3496
- });
3497
- });
3513
+ }
3514
+ );
3498
3515
  },
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, {
3516
+ async logout(data) {
3517
+ const env2 = getEnv();
3518
+ console.log(data);
3519
+ return env2?.requests?.post(
3520
+ "/logout" /* LOGOUT */,
3521
+ {},
3522
+ {
3507
3523
  headers: {
3508
3524
  "Content-Type": "application/json"
3509
- }
3510
- });
3525
+ },
3526
+ withCredentials: true,
3527
+ useRefreshToken: true
3528
+ }
3529
+ );
3530
+ }
3531
+ };
3532
+ var auth_service_default = AuthService;
3533
+
3534
+ // src/services/company-service/index.ts
3535
+ var CompanyService = {
3536
+ async getCurrentCompany() {
3537
+ const env2 = getEnv();
3538
+ return await env2.requests.get("/company" /* COMPANY_PATH */, {
3539
+ headers: {
3540
+ "Content-Type": "application/json"
3541
+ }
3511
3542
  });
3512
3543
  },
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
- }
3544
+ async getInfoCompany(id) {
3545
+ const env2 = getEnv();
3546
+ const jsonData = {
3547
+ ids: [id],
3548
+ model: "res.company" /* COMPANY */,
3549
+ method: "web_read" /* WEB_READ */,
3550
+ kwargs: {
3551
+ specification: {
3552
+ primary_color: {},
3553
+ secondary_color: {},
3554
+ logo: {},
3555
+ display_name: {},
3556
+ secondary_logo: {}
3528
3557
  }
3529
- );
3558
+ }
3559
+ };
3560
+ return await env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3561
+ headers: {
3562
+ "Content-Type": "application/json"
3563
+ }
3564
+ });
3565
+ }
3566
+ };
3567
+ var company_service_default = CompanyService;
3568
+
3569
+ // src/services/excel-service/index.ts
3570
+ var ExcelService = {
3571
+ async uploadFile({ formData }) {
3572
+ const env2 = getEnv();
3573
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3574
+ headers: {
3575
+ "Content-Type": "multipart/form-data"
3576
+ }
3530
3577
  });
3531
3578
  },
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 } });
3579
+ async uploadIdFile({ formData }) {
3580
+ const env2 = getEnv();
3581
+ return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3582
+ headers: {
3583
+ "Content-Type": "multipart/form-data"
3584
+ }
3537
3585
  });
3538
3586
  },
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
- }
3587
+ async parsePreview({
3588
+ id,
3589
+ selectedSheet,
3590
+ isHeader,
3591
+ context
3592
+ }) {
3593
+ const env2 = getEnv();
3594
+ const jsonData = {
3595
+ model: "base_import.import" /* BASE_IMPORT */,
3596
+ method: "parse_preview",
3597
+ ids: [id],
3598
+ kwargs: {
3599
+ options: {
3600
+ import_skip_records: [],
3601
+ import_set_empty_fields: [],
3602
+ fallback_values: {},
3603
+ name_create_enabled_fields: {},
3604
+ encoding: "",
3605
+ separator: "",
3606
+ quoting: '"',
3607
+ date_format: "",
3608
+ datetime_format: "",
3609
+ float_thousand_separator: ",",
3610
+ float_decimal_separator: ".",
3611
+ advanced: true,
3612
+ has_headers: isHeader,
3613
+ keep_matches: false,
3614
+ limit: 2e3,
3615
+ sheets: [],
3616
+ sheet: selectedSheet,
3617
+ skip: 0,
3618
+ tracking_disable: true
3555
3619
  }
3556
- );
3620
+ },
3621
+ with_context: context
3622
+ };
3623
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3624
+ headers: {
3625
+ "Content-Type": "multipart/form-data"
3626
+ }
3557
3627
  });
3558
3628
  },
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
- );
3629
+ async executeImport({
3630
+ columns,
3631
+ fields,
3632
+ idFile,
3633
+ options,
3634
+ dryrun,
3635
+ context
3636
+ }) {
3637
+ const env2 = getEnv();
3638
+ const jsonData = {
3639
+ model: "base_import.import" /* BASE_IMPORT */,
3640
+ method: "execute_import",
3641
+ ids: [idFile],
3642
+ kwargs: {
3643
+ fields,
3644
+ columns,
3645
+ options,
3646
+ dryrun
3647
+ },
3648
+ with_context: context
3649
+ };
3650
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3651
+ headers: {
3652
+ "Content-Type": "multipart/form-data"
3653
+ }
3575
3654
  });
3655
+ },
3656
+ async getFileExcel({ model }) {
3657
+ const env2 = getEnv();
3658
+ const jsonData = {
3659
+ model,
3660
+ method: "get_import_templates" /* GET_IMPORT */,
3661
+ args: []
3662
+ };
3663
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData);
3664
+ },
3665
+ async getFieldExport({
3666
+ ids,
3667
+ model,
3668
+ isShow,
3669
+ parentField,
3670
+ fieldType,
3671
+ parentName,
3672
+ prefix,
3673
+ name,
3674
+ context,
3675
+ importCompat
3676
+ }) {
3677
+ const env2 = getEnv();
3678
+ const jsonData = {
3679
+ model,
3680
+ import_compat: importCompat,
3681
+ domain: [["id", "in", ids]],
3682
+ with_context: context
3683
+ };
3684
+ if (isShow) {
3685
+ jsonData.parent_field = parentField;
3686
+ jsonData.parent_field_type = fieldType;
3687
+ jsonData.parent_name = parentName;
3688
+ jsonData.name = name;
3689
+ jsonData.prefix = prefix;
3690
+ jsonData.exclude = [null];
3691
+ }
3692
+ return env2.requests.post("/export/get_fields", jsonData);
3693
+ },
3694
+ async exportExcel({
3695
+ model,
3696
+ domain,
3697
+ ids,
3698
+ fields,
3699
+ type,
3700
+ importCompat,
3701
+ context,
3702
+ groupby
3703
+ }) {
3704
+ const env2 = getEnv();
3705
+ const jsonData = {
3706
+ model,
3707
+ domain,
3708
+ ids,
3709
+ import_compat: importCompat,
3710
+ fields,
3711
+ with_context: context,
3712
+ groupby: groupby ?? []
3713
+ };
3714
+ return env2.requests.post_excel(`/export/${type}`, jsonData);
3576
3715
  }
3577
3716
  };
3578
- var auth_service_default = AuthService;
3717
+ var excel_service_default = ExcelService;
3579
3718
 
3580
- // src/services/company-service/index.ts
3581
- var CompanyService = {
3582
- getCurrentCompany() {
3583
- return __async(this, null, function* () {
3719
+ // src/services/form-service/index.ts
3720
+ var FormService = {
3721
+ async getComment({ data }) {
3722
+ try {
3584
3723
  const env2 = getEnv();
3585
- return yield env2.requests.get("/company" /* COMPANY_PATH */, {
3724
+ const jsonData = {
3725
+ thread_id: data.thread_id,
3726
+ thread_model: data.thread_model,
3727
+ limit: 100,
3728
+ with_context: {
3729
+ lang: data.lang
3730
+ }
3731
+ };
3732
+ return env2.requests.post("/chatter/thread/messages" /* GET_MESSAGE */, jsonData, {
3586
3733
  headers: {
3587
3734
  "Content-Type": "application/json"
3588
3735
  }
3589
3736
  });
3590
- });
3737
+ } catch (error) {
3738
+ console.error("Error when sending message:", error);
3739
+ throw error;
3740
+ }
3591
3741
  },
3592
- getInfoCompany(id) {
3593
- return __async(this, null, function* () {
3594
- var _a;
3742
+ async sentComment({ data }) {
3743
+ try {
3595
3744
  const env2 = getEnv();
3596
3745
  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
- }
3746
+ context: {
3747
+ tz: "Asia/Saigon",
3748
+ uid: 2,
3749
+ allowed_company_ids: [1],
3750
+ mail_post_autofollow: false,
3751
+ temporary_id: 142183.01
3752
+ },
3753
+ post_data: {
3754
+ body: data.message,
3755
+ message_type: "comment",
3756
+ attachment_ids: data.attachment_ids,
3757
+ attachment_tokens: [],
3758
+ subtype_xmlid: data.subtype
3759
+ },
3760
+ thread_id: Number(data.thread_id),
3761
+ thread_model: data.thread_model
3609
3762
  };
3610
- return yield (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3763
+ return env2.requests.post("/chatter/message/post" /* SENT_MESSAGE */, jsonData, {
3611
3764
  headers: {
3612
3765
  "Content-Type": "application/json"
3613
3766
  }
3614
3767
  });
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 }) {
3768
+ } catch (error) {
3769
+ console.error("Error when sent message:", error);
3770
+ throw error;
3771
+ }
3772
+ },
3773
+ async deleteComment({ data }) {
3774
+ try {
3624
3775
  const env2 = getEnv();
3625
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3776
+ const jsonData = {
3777
+ attachment_ids: [],
3778
+ attachment_tokens: [],
3779
+ body: "",
3780
+ message_id: data.message_id
3781
+ };
3782
+ return env2.requests.post("/chatter/message/update_content" /* DELETE_MESSAGE */, jsonData, {
3626
3783
  headers: {
3627
- "Content-Type": "multipart/form-data"
3784
+ "Content-Type": "application/json"
3628
3785
  }
3629
3786
  });
3630
- });
3787
+ } catch (error) {
3788
+ console.error("Error when sent message:", error);
3789
+ throw error;
3790
+ }
3631
3791
  },
3632
- uploadIdFile(_0) {
3633
- return __async(this, arguments, function* ({ formData }) {
3792
+ async getImage({ data }) {
3793
+ try {
3634
3794
  const env2 = getEnv();
3635
- return env2.requests.post(`${"/upload/file" /* UPLOAD_FILE_PATH */}`, formData, {
3636
- headers: {
3637
- "Content-Type": "multipart/form-data"
3795
+ return env2.requests.get(
3796
+ `${"/web/image" /* IMAGE_PATH */}?filename=${data.filename}&unique=${data.checksum}&width=1920&height=300`,
3797
+ {
3798
+ headers: {
3799
+ "Content-Type": "application/json"
3800
+ }
3638
3801
  }
3639
- });
3640
- });
3802
+ );
3803
+ } catch (error) {
3804
+ console.error("Error when sent message:", error);
3805
+ throw error;
3806
+ }
3641
3807
  },
3642
- parsePreview(_0) {
3643
- return __async(this, arguments, function* ({
3644
- id,
3645
- selectedSheet,
3646
- isHeader,
3647
- context
3648
- }) {
3808
+ async uploadImage({ data }) {
3809
+ try {
3649
3810
  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, {
3811
+ return env2.requests.post("/mail/attachment/upload" /* UPLOAD_IMAGE */, data, {
3680
3812
  headers: {
3681
3813
  "Content-Type": "multipart/form-data"
3682
3814
  }
3683
3815
  });
3684
- });
3816
+ } catch (error) {
3817
+ console.error("Error when sent message:", error);
3818
+ throw error;
3819
+ }
3685
3820
  },
3686
- executeImport(_0) {
3687
- return __async(this, arguments, function* ({
3688
- columns,
3689
- fields,
3690
- idFile,
3691
- options,
3692
- dryrun,
3693
- context
3694
- }) {
3821
+ async getFormView({ data }) {
3822
+ try {
3695
3823
  const env2 = getEnv();
3696
3824
  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
3825
+ model: data.model,
3826
+ method: "get_formview_action",
3827
+ ids: data.id ? [data.id] : [],
3828
+ with_context: data.context
3707
3829
  };
3708
3830
  return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3709
3831
  headers: {
3710
- "Content-Type": "multipart/form-data"
3832
+ "Content-Type": "application/json"
3711
3833
  }
3712
3834
  });
3713
- });
3835
+ } catch (error) {
3836
+ console.error("Error when fetching form view:", error);
3837
+ throw error;
3838
+ }
3714
3839
  },
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);
3840
+ async changeStatus({ data }) {
3841
+ const env2 = getEnv();
3842
+ const vals = {
3843
+ [data.name]: data.stage_id
3844
+ };
3845
+ const jsonData = {
3846
+ model: data.model,
3847
+ method: "web_save",
3848
+ with_context: {
3849
+ lang: data.lang,
3850
+ allowed_company_ids: [1],
3851
+ uid: 2,
3852
+ search_default_my_ticket: true,
3853
+ search_default_is_open: true
3854
+ },
3855
+ ids: [data.id],
3856
+ kwargs: {
3857
+ vals,
3858
+ specification: {}
3859
+ }
3860
+ };
3861
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3862
+ headers: {
3863
+ "Content-Type": "application/json"
3864
+ }
3724
3865
  });
3725
- },
3726
- getFieldExport(_0) {
3727
- return __async(this, arguments, function* ({
3728
- ids,
3866
+ }
3867
+ };
3868
+ var form_service_default = FormService;
3869
+
3870
+ // src/services/kanban-service/index.ts
3871
+ var KanbanServices = {
3872
+ async getGroups({
3873
+ model,
3874
+ width_context
3875
+ }) {
3876
+ const env2 = getEnv();
3877
+ const jsonDataView = {
3729
3878
  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);
3879
+ method: "web_read_group",
3880
+ kwargs: {
3881
+ domain: [["stage_id.fold", "=", false]],
3882
+ fields: ["color:sum"],
3883
+ groupby: ["stage_id"]
3884
+ },
3885
+ width_context
3886
+ };
3887
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3888
+ headers: {
3889
+ "Content-Type": "application/json"
3890
+ }
3755
3891
  });
3756
3892
  },
3757
- exportExcel(_0) {
3758
- return __async(this, arguments, function* ({
3893
+ async getProgressBar({
3894
+ field,
3895
+ color,
3896
+ model,
3897
+ width_context
3898
+ }) {
3899
+ const env2 = getEnv();
3900
+ const jsonDataView = {
3759
3901
  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);
3902
+ method: "read_progress_bar",
3903
+ kwargs: {
3904
+ domain: [],
3905
+ group_by: "stage_id",
3906
+ progress_bar: {
3907
+ colors: color,
3908
+ field
3909
+ }
3910
+ },
3911
+ width_context
3912
+ };
3913
+ return env2.requests.post("/call" /* CALL_PATH */, jsonDataView, {
3914
+ headers: {
3915
+ "Content-Type": "application/json"
3916
+ }
3779
3917
  });
3780
3918
  }
3781
3919
  };
3782
- var excel_service_default = ExcelService;
3920
+ var kanban_service_default = KanbanServices;
3783
3921
 
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;
3922
+ // src/services/model-service/index.ts
3923
+ var OBJECT_POSITION = 2;
3924
+ var ModelService = {
3925
+ async getListMyBankAccount({
3926
+ domain,
3927
+ spectification,
3928
+ model
3929
+ }) {
3930
+ const env2 = getEnv();
3931
+ const jsonData = {
3932
+ model,
3933
+ method: "web_search_read",
3934
+ kwargs: {
3935
+ specification: spectification,
3936
+ domain,
3937
+ limit: 100,
3938
+ offset: 0
3806
3939
  }
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;
3940
+ };
3941
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3942
+ headers: {
3943
+ "Content-Type": "application/json"
3839
3944
  }
3840
3945
  });
3841
3946
  },
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;
3947
+ async getCurrency() {
3948
+ const env2 = getEnv();
3949
+ const jsonData = {
3950
+ model: "res.currency",
3951
+ method: "web_search_read",
3952
+ kwargs: {
3953
+ specification: {
3954
+ icon_url: {},
3955
+ name: {}
3956
+ },
3957
+ domain: [["active", "=", true]],
3958
+ limit: 100,
3959
+ offset: 0
3960
+ }
3961
+ };
3962
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3963
+ headers: {
3964
+ "Content-Type": "application/json"
3860
3965
  }
3861
3966
  });
3862
3967
  },
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"
3968
+ async getConversionRate() {
3969
+ const env2 = getEnv();
3970
+ const jsonData = {
3971
+ model: "res.currency",
3972
+ method: "web_search_read",
3973
+ kwargs: {
3974
+ specification: {
3975
+ name: {},
3976
+ icon_url: {},
3977
+ rate_ids: {
3978
+ fields: {
3979
+ company_rate: {},
3980
+ sell: {}
3872
3981
  }
3873
3982
  }
3874
- );
3875
- } catch (error) {
3876
- console.error("Error when sent message:", error);
3877
- throw error;
3983
+ },
3984
+ domain: [["active", "=", true]],
3985
+ limit: 100,
3986
+ offset: 0
3987
+ }
3988
+ };
3989
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3990
+ headers: {
3991
+ "Content-Type": "application/json"
3878
3992
  }
3879
3993
  });
3880
3994
  },
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;
3995
+ async getAll({ data }) {
3996
+ const env2 = getEnv();
3997
+ const jsonReadGroup = data.type == "calendar" ? { fields: data?.fields } : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
3998
+ fields: data.fields,
3999
+ groupby: data.groupby
4000
+ } : {
4001
+ count_limit: 10001,
4002
+ order: data.sort,
4003
+ specification: data.specification
4004
+ };
4005
+ const jsonData = {
4006
+ model: String(data.model),
4007
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4008
+ ids: data.ids,
4009
+ with_context: data.context,
4010
+ kwargs: {
4011
+ domain: data.domain,
4012
+ limit: data.limit,
4013
+ offset: data.offset,
4014
+ ...jsonReadGroup
4015
+ }
4016
+ };
4017
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4018
+ headers: {
4019
+ "Content-Type": "application/json"
3893
4020
  }
3894
4021
  });
3895
4022
  },
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;
4023
+ async getListCalendar({ data }) {
4024
+ const env2 = getEnv();
4025
+ const jsonReadGroup = data.type == "calendar" ? data?.fields : data.fields && data.fields.length > 0 && data.groupby && data.groupby.length > 0 && data.groupby[0] ? {
4026
+ fields: data.fields,
4027
+ groupby: data.groupby
4028
+ } : {
4029
+ count_limit: 10001,
4030
+ order: data.sort,
4031
+ specification: data.specification
4032
+ };
4033
+ const jsonData = {
4034
+ model: String(data.model),
4035
+ method: data.type == "calendar" ? "search_read" : jsonReadGroup.fields && jsonReadGroup.groupby ? "web_read_group" : "web_search_read",
4036
+ ids: data.ids,
4037
+ with_context: data.context,
4038
+ kwargs: {
4039
+ domain: data.domain,
4040
+ limit: data.limit,
4041
+ offset: data.offset,
4042
+ fields: data.fields,
4043
+ ...jsonReadGroup
4044
+ }
4045
+ };
4046
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4047
+ headers: {
4048
+ "Content-Type": "application/json"
3914
4049
  }
3915
4050
  });
3916
4051
  },
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* ({
4052
+ async getList({
4053
+ model,
4054
+ ids = [],
4055
+ specification = {},
4056
+ domain = [],
4057
+ offset,
4058
+ order,
4059
+ context = {},
4060
+ limit = 10
4061
+ }) {
4062
+ const env2 = getEnv();
4063
+ const jsonData = {
3953
4064
  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
- });
4065
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4066
+ ids,
4067
+ with_context: context,
4068
+ kwargs: {
4069
+ specification,
4070
+ domain,
4071
+ limit,
4072
+ offset,
4073
+ order
4074
+ }
4075
+ };
4076
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4077
+ headers: {
4078
+ "Content-Type": "application/json"
4079
+ }
3972
4080
  });
3973
4081
  },
3974
- getProgressBar(_0) {
3975
- return __async(this, arguments, function* ({
3976
- field,
3977
- color,
4082
+ async getDetail({
4083
+ ids = [],
4084
+ model,
4085
+ specification,
4086
+ context
4087
+ }) {
4088
+ const env2 = getEnv();
4089
+ const jsonData = {
3978
4090
  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
- });
4091
+ method: "web_read" /* WEB_READ */,
4092
+ ids,
4093
+ with_context: context,
4094
+ kwargs: {
4095
+ specification
4096
+ }
4097
+ };
4098
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4099
+ headers: {
4100
+ "Content-Type": "application/json"
4101
+ }
4141
4102
  });
4142
4103
  },
4143
- getList(_0) {
4144
- return __async(this, arguments, function* ({
4104
+ async save({
4105
+ model,
4106
+ ids = [],
4107
+ data = {},
4108
+ specification = {},
4109
+ context = {},
4110
+ path
4111
+ }) {
4112
+ const env2 = getEnv();
4113
+ const jsonData = {
4145
4114
  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
- });
4115
+ method: "web_save" /* WEB_SAVE */,
4116
+ with_context: context,
4117
+ ids,
4118
+ kwargs: {
4119
+ vals: data,
4120
+ specification
4121
+ }
4122
+ };
4123
+ return env2?.requests?.post(path ?? "/call" /* CALL_PATH */, jsonData, {
4124
+ headers: {
4125
+ "Content-Type": "application/json"
4126
+ }
4174
4127
  });
4175
4128
  },
4176
- getDetail(_0) {
4177
- return __async(this, arguments, function* ({
4178
- ids = [],
4129
+ async delete({ ids = [], model }) {
4130
+ const env2 = getEnv();
4131
+ const jsonData = {
4179
4132
  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
- });
4133
+ method: "unlink" /* UNLINK */,
4134
+ ids
4135
+ };
4136
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4137
+ headers: {
4138
+ "Content-Type": "application/json"
4139
+ }
4199
4140
  });
4200
4141
  },
4201
- save(_0) {
4202
- return __async(this, arguments, function* ({
4142
+ async onChange({
4143
+ ids = [],
4144
+ model,
4145
+ object,
4146
+ specification,
4147
+ context,
4148
+ fieldChange
4149
+ }) {
4150
+ const env2 = getEnv();
4151
+ const jsonData = {
4203
4152
  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
- });
4153
+ method: "onchange" /* ONCHANGE */,
4154
+ ids,
4155
+ with_context: context,
4156
+ args: [
4157
+ object ? object : {},
4158
+ fieldChange ? fieldChange : [],
4159
+ specification
4160
+ ]
4161
+ };
4162
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4163
+ headers: {
4164
+ "Content-Type": "application/json"
4165
+ }
4243
4166
  });
4244
4167
  },
4245
- onChange(_0) {
4246
- return __async(this, arguments, function* ({
4247
- ids = [],
4168
+ async getListFieldsOnchange({ model }) {
4169
+ const env2 = getEnv();
4170
+ const jsonData = {
4248
4171
  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
- });
4172
+ method: "get_fields_onchange" /* GET_ONCHANGE_FIELDS */
4173
+ };
4174
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4175
+ headers: {
4176
+ "Content-Type": "application/json"
4177
+ }
4287
4178
  });
4288
4179
  },
4289
4180
  parseORMOdoo(data) {
@@ -4297,14 +4188,13 @@ var ModelService = {
4297
4188
  data[key] = "/";
4298
4189
  }
4299
4190
  }
4300
- return __spreadValues({}, data);
4191
+ return { ...data };
4301
4192
  },
4302
4193
  toDataJS(data, viewData, model) {
4303
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4304
4194
  for (const key in data) {
4305
4195
  if (data[key] === false) {
4306
4196
  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 */) {
4197
+ if (viewData?.models?.[model]?.[key]?.type !== "boolean" /* BOOLEAN */) {
4308
4198
  data[key] = null;
4309
4199
  }
4310
4200
  } else {
@@ -4314,13 +4204,12 @@ var ModelService = {
4314
4204
  data[key] = "Draft";
4315
4205
  } else if (data[key] !== false) {
4316
4206
  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;
4207
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */ || viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
4208
+ data[key] = (data[key] ??= [])?.map((item) => {
4209
+ const relation = viewData?.models?.[model]?.[key]?.relation;
4321
4210
  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) {
4211
+ if (viewData?.models?.[relation]) {
4212
+ if (item?.length >= 3) {
4324
4213
  return ModelService.toDataJS(
4325
4214
  item[OBJECT_POSITION],
4326
4215
  viewData,
@@ -4330,7 +4219,7 @@ var ModelService = {
4330
4219
  return ModelService.toDataJS(item, viewData, relation);
4331
4220
  }
4332
4221
  } else {
4333
- if ((item == null ? void 0 : item.length) >= 3) {
4222
+ if (item?.length >= 3) {
4334
4223
  return item[OBJECT_POSITION];
4335
4224
  } else {
4336
4225
  return item;
@@ -4342,556 +4231,514 @@ var ModelService = {
4342
4231
  }
4343
4232
  }
4344
4233
  }
4345
- return __spreadValues({}, data);
4234
+ return { ...data };
4346
4235
  }
4347
4236
  };
4348
4237
  var model_service_default = ModelService;
4349
4238
 
4350
4239
  // src/services/user-service/index.ts
4351
4240
  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
- });
4241
+ async getProfile(path) {
4242
+ const env2 = getEnv();
4243
+ return env2.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4244
+ headers: {
4245
+ "Content-Type": "application/x-www-form-urlencoded"
4246
+ }
4360
4247
  });
4361
4248
  },
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
- }
4249
+ async getUser({ context, id }) {
4250
+ const env2 = getEnv();
4251
+ const jsonData = {
4252
+ model: "res.users",
4253
+ method: "web_read",
4254
+ ids: [id],
4255
+ with_context: context,
4256
+ kwargs: {
4257
+ specification: {
4258
+ display_name: {},
4259
+ image_1920: {},
4260
+ name: {},
4261
+ login: {},
4262
+ email: {},
4263
+ password: {},
4264
+ visible_group_id: {
4265
+ fields: {
4266
+ id: {},
4267
+ display_name: {}
4268
+ }
4269
+ },
4270
+ company_id: {
4271
+ fields: {
4272
+ id: {},
4273
+ display_name: {}
4389
4274
  }
4390
4275
  }
4391
4276
  }
4392
- };
4393
- return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4394
- headers: {
4395
- "Content-Type": "application/json"
4396
- }
4397
- });
4277
+ }
4278
+ };
4279
+ return env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4280
+ headers: {
4281
+ "Content-Type": "application/json"
4282
+ }
4398
4283
  });
4399
4284
  },
4400
- switchUserLocale: (_0) => __async(null, [_0], function* ({ id, values }) {
4401
- var _a;
4285
+ switchUserLocale: async ({ id, values }) => {
4402
4286
  const env2 = getEnv();
4403
4287
  const jsonData = {
4404
4288
  model: "res.users",
4405
4289
  domain: [["id", "=", id]],
4406
4290
  values
4407
4291
  };
4408
- return env2 == null ? void 0 : env2.requests.post((_a = UriConstants) == null ? void 0 : _a.CREATE_UPDATE_PATH, jsonData, {
4292
+ return env2?.requests.post(UriConstants?.CREATE_UPDATE_PATH, jsonData, {
4409
4293
  headers: {
4410
4294
  "Content-Type": "application/json"
4411
4295
  }
4412
4296
  });
4413
- })
4297
+ }
4414
4298
  };
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
- });
4299
+ var user_service_default = UserService;
4300
+
4301
+ // src/services/view-service/index.ts
4302
+ var ViewService = {
4303
+ async getView({
4304
+ model,
4305
+ views,
4306
+ context = {},
4307
+ options = {},
4308
+ aid
4309
+ }) {
4310
+ const env2 = getEnv();
4311
+ const defaultOptions = {
4312
+ load_filters: true,
4313
+ toolbar: true,
4314
+ action_id: aid
4315
+ };
4316
+ const jsonDataView = {
4317
+ model,
4318
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
4319
+ kwargs: {
4320
+ views,
4321
+ options: { ...options, ...defaultOptions }
4322
+ },
4323
+ with_context: context
4324
+ };
4325
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
4326
+ headers: {
4327
+ "Content-Type": "application/json"
4328
+ }
4448
4329
  });
4449
4330
  },
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
- }
4331
+ async getMenu(context) {
4332
+ const env2 = getEnv();
4333
+ const jsonData = {
4334
+ model: "ir.ui.menu" /* MENU */,
4335
+ method: "web_search_read" /* WEB_SEARCH_READ */,
4336
+ ids: [],
4337
+ with_context: context,
4338
+ kwargs: {
4339
+ specification: {
4340
+ active: {},
4341
+ name: {},
4342
+ is_display: {},
4343
+ sequence: {},
4344
+ complete_name: {},
4345
+ action: {
4346
+ fields: {
4347
+ display_name: {},
4348
+ type: {},
4349
+ binding_view_types: {}
4350
+ // res_model: {},
4351
+ }
4352
+ },
4353
+ url_icon: {},
4354
+ web_icon: {},
4355
+ web_icon_data: {},
4356
+ groups_id: {
4357
+ fields: {
4358
+ full_name: {}
4473
4359
  },
4474
- url_icon: {},
4475
- web_icon: {},
4476
- web_icon_data: {},
4477
- groups_id: {
4478
- fields: {
4479
- full_name: {}
4360
+ limit: 40,
4361
+ order: ""
4362
+ },
4363
+ display_name: {},
4364
+ child_id: {
4365
+ fields: {
4366
+ active: {},
4367
+ name: {},
4368
+ is_display: {},
4369
+ sequence: {},
4370
+ complete_name: {},
4371
+ action: {
4372
+ fields: {
4373
+ display_name: {},
4374
+ type: {},
4375
+ binding_view_types: {}
4376
+ // res_model: {},
4377
+ }
4480
4378
  },
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
- }
4379
+ url_icon: {},
4380
+ web_icon: {},
4381
+ web_icon_data: {},
4382
+ groups_id: {
4383
+ fields: {
4384
+ full_name: {}
4499
4385
  },
4500
- url_icon: {},
4501
- web_icon: {},
4502
- web_icon_data: {},
4503
- groups_id: {
4504
- fields: {
4505
- full_name: {}
4386
+ limit: 40,
4387
+ order: ""
4388
+ },
4389
+ display_name: {},
4390
+ child_id: {
4391
+ fields: {
4392
+ active: {},
4393
+ name: {},
4394
+ is_display: {},
4395
+ sequence: {},
4396
+ complete_name: {},
4397
+ action: {
4398
+ fields: {
4399
+ display_name: {},
4400
+ type: {},
4401
+ binding_view_types: {}
4402
+ // res_model: {},
4403
+ }
4506
4404
  },
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
- }
4405
+ url_icon: {},
4406
+ web_icon: {},
4407
+ web_icon_data: {},
4408
+ groups_id: {
4409
+ fields: {
4410
+ full_name: {}
4525
4411
  },
4526
- url_icon: {},
4527
- web_icon: {},
4528
- web_icon_data: {},
4529
- groups_id: {
4530
- fields: {
4531
- full_name: {}
4412
+ limit: 40,
4413
+ order: ""
4414
+ },
4415
+ display_name: {},
4416
+ child_id: {
4417
+ fields: {
4418
+ active: {},
4419
+ name: {},
4420
+ is_display: {},
4421
+ sequence: {},
4422
+ complete_name: {},
4423
+ action: {
4424
+ fields: {
4425
+ display_name: {},
4426
+ type: {},
4427
+ binding_view_types: {}
4428
+ // res_model: {},
4429
+ }
4532
4430
  },
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: ""
4431
+ url_icon: {},
4432
+ web_icon: {},
4433
+ web_icon_data: {},
4434
+ groups_id: {
4435
+ fields: {
4436
+ full_name: {}
4561
4437
  },
4562
- display_name: {},
4563
- child_id: {
4564
- fields: {},
4565
- limit: 40,
4566
- order: ""
4567
- }
4438
+ limit: 40,
4439
+ order: ""
4568
4440
  },
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
- });
4441
+ display_name: {},
4442
+ child_id: {
4443
+ fields: {},
4444
+ limit: 40,
4445
+ order: ""
4446
+ }
4447
+ },
4448
+ limit: 40,
4449
+ order: ""
4450
+ }
4451
+ },
4452
+ limit: 40,
4453
+ order: ""
4454
+ }
4455
+ },
4456
+ limit: 40,
4457
+ order: ""
4458
+ }
4459
+ },
4460
+ domain: [
4461
+ "&",
4462
+ ["is_display", "=", true],
4463
+ "&",
4464
+ ["active", "=", true],
4465
+ ["parent_id", "=", false]
4466
+ ]
4467
+ }
4468
+ };
4469
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4470
+ headers: {
4471
+ "Content-Type": "application/json"
4472
+ }
4595
4473
  });
4596
4474
  },
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"
4475
+ async getActionDetail(aid, context) {
4476
+ const env2 = getEnv();
4477
+ const jsonData = {
4478
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
4479
+ method: "web_read" /* WEB_READ */,
4480
+ ids: [aid],
4481
+ with_context: context,
4482
+ kwargs: {
4483
+ specification: {
4484
+ id: {},
4485
+ name: {},
4486
+ res_model: {},
4487
+ views: {},
4488
+ view_mode: {},
4489
+ mobile_view_mode: {},
4490
+ domain: {},
4491
+ context: {},
4492
+ groups_id: {},
4493
+ search_view_id: {}
4624
4494
  }
4625
- });
4495
+ }
4496
+ };
4497
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
4498
+ headers: {
4499
+ "Content-Type": "application/json"
4500
+ }
4626
4501
  });
4627
4502
  },
4628
- getResequence(_0) {
4629
- return __async(this, arguments, function* ({
4503
+ async getResequence({
4504
+ model,
4505
+ ids,
4506
+ context,
4507
+ offset
4508
+ }) {
4509
+ const env2 = getEnv();
4510
+ const jsonData = {
4630
4511
  model,
4512
+ with_context: context,
4631
4513
  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
- });
4514
+ field: "sequence",
4515
+ ...offset > 0 ? { offset } : {}
4516
+ };
4517
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
4518
+ headers: {
4519
+ "Content-Type": "application/json"
4520
+ }
4675
4521
  });
4676
4522
  },
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
- }
4523
+ async getSelectionItem({ data }) {
4524
+ const env2 = getEnv();
4525
+ const jsonData = {
4526
+ model: data.model,
4527
+ ids: [],
4528
+ method: "get_data_select",
4529
+ with_context: data.context,
4530
+ kwargs: {
4531
+ count_limit: 10001,
4532
+ domain: data.domain ? data.domain : [],
4533
+ offset: 0,
4534
+ order: "",
4535
+ specification: data?.specification ?? {
4536
+ id: {},
4537
+ name: {},
4538
+ display_name: {}
4687
4539
  }
4688
- );
4540
+ }
4541
+ };
4542
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4543
+ headers: {
4544
+ "Content-Type": "application/json"
4545
+ }
4689
4546
  });
4690
4547
  },
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("", {
4548
+ async loadMessages() {
4549
+ const env2 = getEnv();
4550
+ return env2.requests.post(
4551
+ "/load_message_failures" /* LOAD_MESSAGE */,
4552
+ {},
4553
+ {
4697
4554
  headers: {
4698
4555
  "Content-Type": "application/json"
4699
4556
  }
4700
- });
4557
+ }
4558
+ );
4559
+ },
4560
+ async getVersion() {
4561
+ const env2 = getEnv();
4562
+ return env2?.requests.get("", {
4563
+ headers: {
4564
+ "Content-Type": "application/json"
4565
+ }
4701
4566
  });
4702
4567
  },
4703
- get2FAMethods(_0) {
4704
- return __async(this, arguments, function* ({
4568
+ async get2FAMethods({
4569
+ method,
4570
+ with_context
4571
+ }) {
4572
+ const env2 = getEnv();
4573
+ const jsonData = {
4705
4574
  method,
4706
4575
  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
- });
4576
+ };
4577
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4578
+ headers: {
4579
+ "Content-Type": "application/json"
4580
+ }
4718
4581
  });
4719
4582
  },
4720
- verify2FA(_0) {
4721
- return __async(this, arguments, function* ({
4583
+ async verify2FA({
4584
+ method,
4585
+ with_context,
4586
+ code,
4587
+ device,
4588
+ location
4589
+ }) {
4590
+ const env2 = getEnv();
4591
+ const jsonData = {
4722
4592
  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
- });
4593
+ kwargs: {
4594
+ vals: {
4595
+ code,
4596
+ device,
4597
+ location
4598
+ }
4599
+ },
4600
+ with_context
4601
+ };
4602
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4603
+ headers: {
4604
+ "Content-Type": "application/json"
4605
+ },
4606
+ withCredentials: true
4746
4607
  });
4747
4608
  },
4748
- signInSSO(_0) {
4749
- return __async(this, arguments, function* ({
4750
- redirect_uri,
4751
- state,
4752
- client_id,
4609
+ async signInSSO({
4610
+ redirect_uri,
4611
+ state,
4612
+ client_id,
4613
+ response_type,
4614
+ path
4615
+ }) {
4616
+ const env2 = getEnv();
4617
+ const params = new URLSearchParams({
4753
4618
  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
- });
4619
+ client_id,
4620
+ redirect_uri,
4621
+ state
4622
+ });
4623
+ const url = `${path}?${params.toString()}`;
4624
+ return env2?.requests.get(url, {
4625
+ headers: {
4626
+ "Content-Type": "application/json"
4627
+ },
4628
+ withCredentials: true
4770
4629
  });
4771
4630
  },
4772
- grantAccess(_0) {
4773
- return __async(this, arguments, function* ({
4631
+ async grantAccess({
4632
+ redirect_uri,
4633
+ state,
4634
+ client_id,
4635
+ scopes
4636
+ }) {
4637
+ const env2 = getEnv();
4638
+ const jsonData = {
4774
4639
  redirect_uri,
4775
4640
  state,
4776
4641
  client_id,
4777
4642
  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
- });
4643
+ };
4644
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
4645
+ headers: {
4646
+ "Content-Type": "application/json"
4647
+ },
4648
+ withCredentials: true
4792
4649
  });
4793
4650
  },
4794
- getFieldsViewSecurity(_0) {
4795
- return __async(this, arguments, function* ({
4651
+ async getFieldsViewSecurity({
4652
+ method,
4653
+ token,
4654
+ views
4655
+ }) {
4656
+ const env2 = getEnv();
4657
+ const jsonData = {
4796
4658
  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
- });
4659
+ kwargs: {
4660
+ views
4661
+ },
4662
+ with_context: {
4663
+ token
4664
+ }
4665
+ };
4666
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4667
+ headers: {
4668
+ "Content-Type": "application/json"
4669
+ }
4815
4670
  });
4816
4671
  },
4817
- settingsWebRead2fa(_0) {
4818
- return __async(this, arguments, function* ({
4672
+ async settingsWebRead2fa({
4673
+ method,
4674
+ model,
4675
+ kwargs,
4676
+ token
4677
+ }) {
4678
+ const env2 = getEnv();
4679
+ const jsonData = {
4819
4680
  method,
4820
4681
  model,
4821
4682
  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
- });
4683
+ with_context: {
4684
+ token
4685
+ }
4686
+ };
4687
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4688
+ headers: {
4689
+ "Content-Type": "application/json"
4690
+ }
4838
4691
  });
4839
4692
  },
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
- });
4693
+ async requestSetupTotp({ method, token }) {
4694
+ const env2 = getEnv();
4695
+ const jsonData = {
4696
+ method,
4697
+ with_context: {
4698
+ token
4699
+ }
4700
+ };
4701
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4702
+ headers: {
4703
+ "Content-Type": "application/json"
4704
+ }
4854
4705
  });
4855
4706
  },
4856
- verifyTotp(_0) {
4857
- return __async(this, arguments, function* ({
4707
+ async verifyTotp({
4708
+ method,
4709
+ action_token,
4710
+ code
4711
+ }) {
4712
+ const env2 = getEnv();
4713
+ const jsonData = {
4858
4714
  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
4715
+ kwargs: {
4716
+ vals: {
4717
+ code
4872
4718
  }
4873
- };
4874
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
4875
- headers: {
4876
- "Content-Type": "application/json"
4877
- }
4878
- });
4719
+ },
4720
+ with_context: {
4721
+ action_token
4722
+ }
4723
+ };
4724
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4725
+ headers: {
4726
+ "Content-Type": "application/json"
4727
+ }
4879
4728
  });
4880
4729
  },
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
- });
4730
+ async removeTotpSetUp({ method, token }) {
4731
+ const env2 = getEnv();
4732
+ const jsonData = {
4733
+ method,
4734
+ with_context: {
4735
+ token
4736
+ }
4737
+ };
4738
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
4739
+ headers: {
4740
+ "Content-Type": "application/json"
4741
+ }
4895
4742
  });
4896
4743
  }
4897
4744
  };
@@ -4927,7 +4774,7 @@ var import_react_query3 = require("@tanstack/react-query");
4927
4774
  var useGetProvider = () => {
4928
4775
  return (0, import_react_query3.useMutation)({
4929
4776
  mutationFn: (data) => {
4930
- return auth_service_default.getProviders(data == null ? void 0 : data.db);
4777
+ return auth_service_default.getProviders(data?.db);
4931
4778
  }
4932
4779
  });
4933
4780
  };
@@ -5029,26 +4876,40 @@ var useGetAccessByCode = () => {
5029
4876
  };
5030
4877
  var use_get_access_by_code_default = useGetAccessByCode;
5031
4878
 
5032
- // src/hooks/company/use-get-company-info.ts
4879
+ // src/hooks/auth/use-validate-action-token.ts
5033
4880
  var import_react_query12 = require("@tanstack/react-query");
5034
- var useGetCompanyInfo = () => {
4881
+ var useValidateActionToken = () => {
5035
4882
  return (0, import_react_query12.useMutation)({
4883
+ mutationFn: ({
4884
+ actionToken,
4885
+ path
4886
+ }) => {
4887
+ return auth_service_default.isValidActionToken(actionToken, path);
4888
+ }
4889
+ });
4890
+ };
4891
+ var use_validate_action_token_default = useValidateActionToken;
4892
+
4893
+ // src/hooks/company/use-get-company-info.ts
4894
+ var import_react_query13 = require("@tanstack/react-query");
4895
+ var useGetCompanyInfo = () => {
4896
+ return (0, import_react_query13.useMutation)({
5036
4897
  mutationFn: (id) => company_service_default.getInfoCompany(id)
5037
4898
  });
5038
4899
  };
5039
4900
  var use_get_company_info_default = useGetCompanyInfo;
5040
4901
 
5041
4902
  // src/hooks/company/use-get-current-company.ts
5042
- var import_react_query13 = require("@tanstack/react-query");
4903
+ var import_react_query14 = require("@tanstack/react-query");
5043
4904
  var useGetCurrentCompany = () => {
5044
- return (0, import_react_query13.useMutation)({
4905
+ return (0, import_react_query14.useMutation)({
5045
4906
  mutationFn: () => company_service_default.getCurrentCompany()
5046
4907
  });
5047
4908
  };
5048
4909
  var use_get_current_company_default = useGetCurrentCompany;
5049
4910
 
5050
4911
  // src/hooks/company/use-get-list-company.ts
5051
- var import_react_query14 = require("@tanstack/react-query");
4912
+ var import_react_query15 = require("@tanstack/react-query");
5052
4913
  var useGetListCompany = (companyIDs = []) => {
5053
4914
  const companySpec = {
5054
4915
  id: {},
@@ -5059,7 +4920,7 @@ var useGetListCompany = (companyIDs = []) => {
5059
4920
  ids: companyIDs,
5060
4921
  specification: companySpec
5061
4922
  };
5062
- return (0, import_react_query14.useQuery)({
4923
+ return (0, import_react_query15.useQuery)({
5063
4924
  queryKey: ["list_company" /* LIST_COMPANY */, companyIDs],
5064
4925
  queryFn: () => model_service_default.getList(getListParams),
5065
4926
  refetchOnWindowFocus: false
@@ -5068,9 +4929,9 @@ var useGetListCompany = (companyIDs = []) => {
5068
4929
  var use_get_list_company_default = useGetListCompany;
5069
4930
 
5070
4931
  // src/hooks/excel/use-export-excel.ts
5071
- var import_react_query15 = require("@tanstack/react-query");
4932
+ var import_react_query16 = require("@tanstack/react-query");
5072
4933
  var useExportExcel = () => {
5073
- return (0, import_react_query15.useMutation)({
4934
+ return (0, import_react_query16.useMutation)({
5074
4935
  mutationFn: ({
5075
4936
  model,
5076
4937
  domain,
@@ -5095,9 +4956,9 @@ var useExportExcel = () => {
5095
4956
  var use_export_excel_default = useExportExcel;
5096
4957
 
5097
4958
  // src/hooks/excel/use-get-field-export.ts
5098
- var import_react_query16 = require("@tanstack/react-query");
4959
+ var import_react_query17 = require("@tanstack/react-query");
5099
4960
  var useGetFieldExport = () => {
5100
- return (0, import_react_query16.useMutation)({
4961
+ return (0, import_react_query17.useMutation)({
5101
4962
  mutationFn: ({
5102
4963
  ids,
5103
4964
  model,
@@ -5126,9 +4987,9 @@ var useGetFieldExport = () => {
5126
4987
  var use_get_field_export_default = useGetFieldExport;
5127
4988
 
5128
4989
  // src/hooks/excel/use-get-file-excel.ts
5129
- var import_react_query17 = require("@tanstack/react-query");
4990
+ var import_react_query18 = require("@tanstack/react-query");
5130
4991
  var useGetFileExcel = ({ model }) => {
5131
- return (0, import_react_query17.useQuery)({
4992
+ return (0, import_react_query18.useQuery)({
5132
4993
  queryKey: [],
5133
4994
  queryFn: () => excel_service_default.getFileExcel({
5134
4995
  model
@@ -5144,9 +5005,9 @@ var useGetFileExcel = ({ model }) => {
5144
5005
  var use_get_file_excel_default = useGetFileExcel;
5145
5006
 
5146
5007
  // src/hooks/excel/use-parse-preview.ts
5147
- var import_react_query18 = require("@tanstack/react-query");
5008
+ var import_react_query19 = require("@tanstack/react-query");
5148
5009
  var useParsePreview = () => {
5149
- return (0, import_react_query18.useMutation)({
5010
+ return (0, import_react_query19.useMutation)({
5150
5011
  mutationFn: ({
5151
5012
  id,
5152
5013
  selectedSheet,
@@ -5163,9 +5024,9 @@ var useParsePreview = () => {
5163
5024
  var use_parse_preview_default = useParsePreview;
5164
5025
 
5165
5026
  // src/hooks/excel/use-upload-file.ts
5166
- var import_react_query19 = require("@tanstack/react-query");
5027
+ var import_react_query20 = require("@tanstack/react-query");
5167
5028
  var useUploadFile = () => {
5168
- return (0, import_react_query19.useMutation)({
5029
+ return (0, import_react_query20.useMutation)({
5169
5030
  mutationFn: ({ formData }) => excel_service_default.uploadFile({
5170
5031
  formData
5171
5032
  })
@@ -5174,9 +5035,9 @@ var useUploadFile = () => {
5174
5035
  var use_upload_file_default = useUploadFile;
5175
5036
 
5176
5037
  // src/hooks/excel/use-upload-id-file.ts
5177
- var import_react_query20 = require("@tanstack/react-query");
5038
+ var import_react_query21 = require("@tanstack/react-query");
5178
5039
  var useUploadIdFile = () => {
5179
- return (0, import_react_query20.useMutation)({
5040
+ return (0, import_react_query21.useMutation)({
5180
5041
  mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
5181
5042
  formData
5182
5043
  })
@@ -5185,9 +5046,9 @@ var useUploadIdFile = () => {
5185
5046
  var use_upload_id_file_default = useUploadIdFile;
5186
5047
 
5187
5048
  // src/hooks/excel/uss-execute-import.ts
5188
- var import_react_query21 = require("@tanstack/react-query");
5049
+ var import_react_query22 = require("@tanstack/react-query");
5189
5050
  var useExecuteImport = () => {
5190
- return (0, import_react_query21.useMutation)({
5051
+ return (0, import_react_query22.useMutation)({
5191
5052
  mutationFn: ({
5192
5053
  fields,
5193
5054
  columns,
@@ -5208,9 +5069,9 @@ var useExecuteImport = () => {
5208
5069
  var uss_execute_import_default = useExecuteImport;
5209
5070
 
5210
5071
  // src/hooks/form/use-change-status.ts
5211
- var import_react_query22 = require("@tanstack/react-query");
5072
+ var import_react_query23 = require("@tanstack/react-query");
5212
5073
  var useChangeStatus = () => {
5213
- return (0, import_react_query22.useMutation)({
5074
+ return (0, import_react_query23.useMutation)({
5214
5075
  mutationFn: ({ data }) => {
5215
5076
  return form_service_default.changeStatus({
5216
5077
  data
@@ -5221,9 +5082,9 @@ var useChangeStatus = () => {
5221
5082
  var use_change_status_default = useChangeStatus;
5222
5083
 
5223
5084
  // src/hooks/form/use-delete-comment.ts
5224
- var import_react_query23 = require("@tanstack/react-query");
5085
+ var import_react_query24 = require("@tanstack/react-query");
5225
5086
  var useDeleteComment = () => {
5226
- return (0, import_react_query23.useMutation)({
5087
+ return (0, import_react_query24.useMutation)({
5227
5088
  mutationFn: ({ data }) => form_service_default.deleteComment({
5228
5089
  data
5229
5090
  })
@@ -5232,9 +5093,9 @@ var useDeleteComment = () => {
5232
5093
  var use_delete_comment_default = useDeleteComment;
5233
5094
 
5234
5095
  // src/hooks/form/use-get-comment.ts
5235
- var import_react_query24 = require("@tanstack/react-query");
5096
+ var import_react_query25 = require("@tanstack/react-query");
5236
5097
  var useGetComment = ({ data, queryKey }) => {
5237
- return (0, import_react_query24.useQuery)({
5098
+ return (0, import_react_query25.useQuery)({
5238
5099
  queryKey,
5239
5100
  queryFn: () => form_service_default.getComment({ data }).then((res) => {
5240
5101
  if (res) {
@@ -5248,13 +5109,13 @@ var useGetComment = ({ data, queryKey }) => {
5248
5109
  var use_get_comment_default = useGetComment;
5249
5110
 
5250
5111
  // src/hooks/form/use-get-form-view.ts
5251
- var import_react_query25 = require("@tanstack/react-query");
5112
+ var import_react_query26 = require("@tanstack/react-query");
5252
5113
  var useGetFormView = ({
5253
5114
  data,
5254
5115
  queryKey,
5255
5116
  enabled
5256
5117
  }) => {
5257
- return (0, import_react_query25.useQuery)({
5118
+ return (0, import_react_query26.useQuery)({
5258
5119
  queryKey,
5259
5120
  queryFn: () => form_service_default.getFormView({ data }).then((res) => {
5260
5121
  if (res) {
@@ -5268,13 +5129,13 @@ var useGetFormView = ({
5268
5129
  var use_get_form_view_default = useGetFormView;
5269
5130
 
5270
5131
  // src/hooks/form/use-get-image.ts
5271
- var import_react_query26 = require("@tanstack/react-query");
5132
+ var import_react_query27 = require("@tanstack/react-query");
5272
5133
  var useGetImage = ({
5273
5134
  data,
5274
5135
  queryKey,
5275
5136
  src
5276
5137
  }) => {
5277
- return (0, import_react_query26.useQuery)({
5138
+ return (0, import_react_query27.useQuery)({
5278
5139
  queryKey,
5279
5140
  queryFn: () => form_service_default.getImage({ data }).then((res) => {
5280
5141
  if (res) {
@@ -5288,9 +5149,9 @@ var useGetImage = ({
5288
5149
  var use_get_image_default = useGetImage;
5289
5150
 
5290
5151
  // src/hooks/form/use-send-comment.ts
5291
- var import_react_query27 = require("@tanstack/react-query");
5152
+ var import_react_query28 = require("@tanstack/react-query");
5292
5153
  var useSendComment = () => {
5293
- return (0, import_react_query27.useMutation)({
5154
+ return (0, import_react_query28.useMutation)({
5294
5155
  mutationFn: ({ data }) => form_service_default.sentComment({
5295
5156
  data
5296
5157
  })
@@ -5299,9 +5160,9 @@ var useSendComment = () => {
5299
5160
  var use_send_comment_default = useSendComment;
5300
5161
 
5301
5162
  // src/hooks/form/use-upload-image.ts
5302
- var import_react_query28 = require("@tanstack/react-query");
5163
+ var import_react_query29 = require("@tanstack/react-query");
5303
5164
  var useUploadImage = () => {
5304
- return (0, import_react_query28.useMutation)({
5165
+ return (0, import_react_query29.useMutation)({
5305
5166
  mutationFn: ({ data }) => form_service_default.uploadImage({
5306
5167
  data
5307
5168
  })
@@ -5310,18 +5171,18 @@ var useUploadImage = () => {
5310
5171
  var use_upload_image_default = useUploadImage;
5311
5172
 
5312
5173
  // src/hooks/model/use-delete.ts
5313
- var import_react_query29 = require("@tanstack/react-query");
5174
+ var import_react_query30 = require("@tanstack/react-query");
5314
5175
  var useDelete = () => {
5315
- return (0, import_react_query29.useMutation)({
5176
+ return (0, import_react_query30.useMutation)({
5316
5177
  mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
5317
5178
  });
5318
5179
  };
5319
5180
  var use_delete_default = useDelete;
5320
5181
 
5321
5182
  // src/hooks/model/use-get-all.ts
5322
- var import_react_query30 = require("@tanstack/react-query");
5183
+ var import_react_query31 = require("@tanstack/react-query");
5323
5184
  var useGetAll = ({ data, queryKey, viewResponse }) => {
5324
- return (0, import_react_query30.useQuery)({
5185
+ return (0, import_react_query31.useQuery)({
5325
5186
  queryKey,
5326
5187
  queryFn: () => model_service_default.getAll({ data }).then((res) => {
5327
5188
  if (res) {
@@ -5336,9 +5197,9 @@ var useGetAll = ({ data, queryKey, viewResponse }) => {
5336
5197
  var use_get_all_default = useGetAll;
5337
5198
 
5338
5199
  // src/hooks/model/use-get-conversion-rate.ts
5339
- var import_react_query31 = require("@tanstack/react-query");
5200
+ var import_react_query32 = require("@tanstack/react-query");
5340
5201
  var useGetConversionRate = () => {
5341
- return (0, import_react_query31.useQuery)({
5202
+ return (0, import_react_query32.useQuery)({
5342
5203
  queryKey: ["currency-rate"],
5343
5204
  queryFn: () => model_service_default.getConversionRate().then((res) => {
5344
5205
  if (res) {
@@ -5351,9 +5212,9 @@ var useGetConversionRate = () => {
5351
5212
  var use_get_conversion_rate_default = useGetConversionRate;
5352
5213
 
5353
5214
  // src/hooks/model/use-get-currency.ts
5354
- var import_react_query32 = require("@tanstack/react-query");
5215
+ var import_react_query33 = require("@tanstack/react-query");
5355
5216
  var useGetCurrency = () => {
5356
- return (0, import_react_query32.useQuery)({
5217
+ return (0, import_react_query33.useQuery)({
5357
5218
  queryKey: ["currency"],
5358
5219
  queryFn: () => model_service_default.getCurrency().then((res) => {
5359
5220
  if (res) {
@@ -5366,9 +5227,9 @@ var useGetCurrency = () => {
5366
5227
  var use_get_currency_default = useGetCurrency;
5367
5228
 
5368
5229
  // src/hooks/model/use-get-detail.ts
5369
- var import_react_query33 = require("@tanstack/react-query");
5230
+ var import_react_query34 = require("@tanstack/react-query");
5370
5231
  var useGetDetail = () => {
5371
- return (0, import_react_query33.useMutation)({
5232
+ return (0, import_react_query34.useMutation)({
5372
5233
  mutationFn: ({
5373
5234
  model,
5374
5235
  ids,
@@ -5385,9 +5246,9 @@ var useGetDetail = () => {
5385
5246
  var use_get_detail_default = useGetDetail;
5386
5247
 
5387
5248
  // src/hooks/model/use-get-field-onchange.ts
5388
- var import_react_query34 = require("@tanstack/react-query");
5249
+ var import_react_query35 = require("@tanstack/react-query");
5389
5250
  var useGetFieldOnChange = ({ model }) => {
5390
- return (0, import_react_query34.useQuery)({
5251
+ return (0, import_react_query35.useQuery)({
5391
5252
  queryKey: [`field-onchange-${model}`, model],
5392
5253
  queryFn: () => model_service_default.getListFieldsOnchange({
5393
5254
  model
@@ -5403,13 +5264,13 @@ var useGetFieldOnChange = ({ model }) => {
5403
5264
  var use_get_field_onchange_default = useGetFieldOnChange;
5404
5265
 
5405
5266
  // src/hooks/model/use-get-list-my-bank-account.ts
5406
- var import_react_query35 = require("@tanstack/react-query");
5267
+ var import_react_query36 = require("@tanstack/react-query");
5407
5268
  var useGetListMyBankAccount = ({
5408
5269
  domain,
5409
5270
  spectification,
5410
5271
  model
5411
5272
  }) => {
5412
- return (0, import_react_query35.useQuery)({
5273
+ return (0, import_react_query36.useQuery)({
5413
5274
  queryKey: ["bank-account", model, domain],
5414
5275
  queryFn: () => model_service_default.getListMyBankAccount({
5415
5276
  domain,
@@ -5427,6 +5288,10 @@ var use_get_list_my_bank_account_default = useGetListMyBankAccount;
5427
5288
 
5428
5289
  // src/models/base-model/index.ts
5429
5290
  var BaseModel = class {
5291
+ name;
5292
+ view;
5293
+ actContext;
5294
+ fields;
5430
5295
  constructor(init) {
5431
5296
  this.name = init.name;
5432
5297
  this.view = init.view;
@@ -5441,22 +5306,21 @@ var BaseModel = class {
5441
5306
  modelRoot
5442
5307
  }) {
5443
5308
  if (Array.isArray(fields)) {
5444
- let spec = __spreadValues({}, specification);
5309
+ let spec = { ...specification };
5445
5310
  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];
5311
+ if (!field?.type_co || field?.name && field?.type_co === "field" /* FIELD */) {
5312
+ if (modelsData?.[model]?.[field?.name]) {
5313
+ if (modelsData?.[model]?.[field?.name]?.type === "one2many" /* ONE2MANY */ || modelsData?.[model]?.[field?.name]?.type === "many2many" /* MANY2MANY */) {
5314
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5315
+ const modelRelation = modelsData?.[relation];
5452
5316
  if (modelRelation) {
5453
- spec[field == null ? void 0 : field.name] = {
5317
+ spec[field?.name] = {
5454
5318
  fields: {}
5455
5319
  };
5456
5320
  if (modelRoot && modelRoot === relation) {
5457
- spec[field == null ? void 0 : field.name].fields = { id: {} };
5321
+ spec[field?.name].fields = { id: {} };
5458
5322
  } else {
5459
- spec[field == null ? void 0 : field.name].fields = this.getSpecificationByFields({
5323
+ spec[field?.name].fields = this.getSpecificationByFields({
5460
5324
  fields: Object.values(modelRelation),
5461
5325
  specification: {},
5462
5326
  modelsData,
@@ -5465,42 +5329,45 @@ var BaseModel = class {
5465
5329
  });
5466
5330
  }
5467
5331
  } else {
5468
- spec[field == null ? void 0 : field.name] = {
5332
+ spec[field?.name] = {
5469
5333
  fields: {
5470
5334
  id: {},
5471
5335
  display_name: {}
5472
5336
  }
5473
5337
  };
5474
5338
  }
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({
5339
+ } else if (modelsData?.[model]?.[field?.name]?.type === "many2one" /* MANY2ONE */) {
5340
+ spec[field?.name] = {
5341
+ fields: {
5478
5342
  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: {} } : {})
5343
+ display_name: {},
5344
+ ...WIDGETAVATAR[field?.widget] ? { image_256: {} } : {},
5345
+ ...field?.name === "currency_id" && fields?.find((item) => item?.widget === "monetary") ? { symbol: {} } : {},
5346
+ ...field?.widget === "many2many_binary" ? { mimetype: {} } : {}
5347
+ }
5481
5348
  };
5482
5349
  } else {
5483
- spec[field == null ? void 0 : field.name] = {};
5350
+ spec[field?.name] = {};
5484
5351
  }
5485
5352
  }
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 */) {
5353
+ } else if (field?.type_co === "group" /* GROUP */ || field?.type_co === "div" /* DIV */ || field?.type_co === "span" /* SPAN */) {
5487
5354
  const specGroup = this.getSpecificationByFields({
5488
- fields: field == null ? void 0 : field.fields,
5355
+ fields: field?.fields,
5489
5356
  specification: spec,
5490
5357
  modelsData,
5491
5358
  model
5492
5359
  });
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;
5360
+ spec = { ...spec, ...specGroup };
5361
+ } else if (field?.type_co === "tree" /* TREE */ || field?.type_co === "list" /* LIST */) {
5362
+ const relation = modelsData?.[model]?.[field?.name]?.relation;
5496
5363
  const specTreee = this.getSpecificationByFields({
5497
- fields: field == null ? void 0 : field.fields,
5364
+ fields: field?.fields,
5498
5365
  specification: {},
5499
5366
  modelsData,
5500
5367
  model: relation,
5501
5368
  modelRoot: model
5502
5369
  });
5503
- spec = __spreadProps(__spreadValues({}, spec), { [field == null ? void 0 : field.name]: { fields: specTreee } });
5370
+ spec = { ...spec, [field?.name]: { fields: specTreee } };
5504
5371
  }
5505
5372
  });
5506
5373
  return spec;
@@ -5509,19 +5376,16 @@ var BaseModel = class {
5509
5376
  }
5510
5377
  }
5511
5378
  getTreeProps() {
5512
- var _a, _b;
5513
- const props = ((_b = (_a = this.view) == null ? void 0 : _a.views) == null ? void 0 : _b.list) || {};
5379
+ const props = this.view?.views?.list || {};
5514
5380
  return props;
5515
5381
  }
5516
5382
  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) || [];
5383
+ const fields = this.view?.views?.list?.fields || [];
5519
5384
  return fields;
5520
5385
  }
5521
5386
  getSpecification() {
5522
- var _a;
5523
5387
  const specInit = {};
5524
- const modelData = ((_a = this.view) == null ? void 0 : _a.models) || {};
5388
+ const modelData = this.view?.models || {};
5525
5389
  const specification = this.getSpecificationByFields({
5526
5390
  fields: this.fields,
5527
5391
  specification: specInit,
@@ -5537,7 +5401,7 @@ var base_model_default = BaseModel;
5537
5401
  // src/hooks/model/use-model.ts
5538
5402
  var useModel = () => {
5539
5403
  const initModel = (modelData) => {
5540
- switch (modelData == null ? void 0 : modelData.name) {
5404
+ switch (modelData?.name) {
5541
5405
  default:
5542
5406
  return new base_model_default(modelData);
5543
5407
  }
@@ -5558,9 +5422,9 @@ var useOdooDataTransform = () => {
5558
5422
  var use_odoo_data_transform_default = useOdooDataTransform;
5559
5423
 
5560
5424
  // src/hooks/model/use-onchange-form.ts
5561
- var import_react_query36 = require("@tanstack/react-query");
5425
+ var import_react_query37 = require("@tanstack/react-query");
5562
5426
  var useOnChangeForm = () => {
5563
- return (0, import_react_query36.useMutation)({
5427
+ return (0, import_react_query37.useMutation)({
5564
5428
  mutationFn: ({
5565
5429
  ids,
5566
5430
  model,
@@ -5581,9 +5445,9 @@ var useOnChangeForm = () => {
5581
5445
  var use_onchange_form_default = useOnChangeForm;
5582
5446
 
5583
5447
  // src/hooks/model/use-save.ts
5584
- var import_react_query37 = require("@tanstack/react-query");
5448
+ var import_react_query38 = require("@tanstack/react-query");
5585
5449
  var useSave = () => {
5586
- return (0, import_react_query37.useMutation)({
5450
+ return (0, import_react_query38.useMutation)({
5587
5451
  mutationFn: ({
5588
5452
  ids,
5589
5453
  model,
@@ -5597,18 +5461,18 @@ var useSave = () => {
5597
5461
  var use_save_default = useSave;
5598
5462
 
5599
5463
  // src/hooks/user/use-get-profile.ts
5600
- var import_react_query38 = require("@tanstack/react-query");
5464
+ var import_react_query39 = require("@tanstack/react-query");
5601
5465
  var useGetProfile = (path) => {
5602
- return (0, import_react_query38.useMutation)({
5466
+ return (0, import_react_query39.useMutation)({
5603
5467
  mutationFn: () => user_service_default.getProfile(path)
5604
5468
  });
5605
5469
  };
5606
5470
  var use_get_profile_default = useGetProfile;
5607
5471
 
5608
5472
  // src/hooks/user/use-get-user.ts
5609
- var import_react_query39 = require("@tanstack/react-query");
5473
+ var import_react_query40 = require("@tanstack/react-query");
5610
5474
  var useGetUser = () => {
5611
- return (0, import_react_query39.useMutation)({
5475
+ return (0, import_react_query40.useMutation)({
5612
5476
  mutationFn: ({ id, context }) => user_service_default.getUser({
5613
5477
  id,
5614
5478
  context
@@ -5618,9 +5482,9 @@ var useGetUser = () => {
5618
5482
  var use_get_user_default = useGetUser;
5619
5483
 
5620
5484
  // src/hooks/user/use-switch-locale.ts
5621
- var import_react_query40 = require("@tanstack/react-query");
5485
+ var import_react_query41 = require("@tanstack/react-query");
5622
5486
  var useSwitchLocale = () => {
5623
- return (0, import_react_query40.useMutation)({
5487
+ return (0, import_react_query41.useMutation)({
5624
5488
  mutationFn: ({ data }) => {
5625
5489
  return user_service_default.switchUserLocale({
5626
5490
  id: data.id,
@@ -5632,9 +5496,9 @@ var useSwitchLocale = () => {
5632
5496
  var use_switch_locale_default = useSwitchLocale;
5633
5497
 
5634
5498
  // src/hooks/view/use-button.ts
5635
- var import_react_query41 = require("@tanstack/react-query");
5499
+ var import_react_query42 = require("@tanstack/react-query");
5636
5500
  var useButton = () => {
5637
- return (0, import_react_query41.useMutation)({
5501
+ return (0, import_react_query42.useMutation)({
5638
5502
  mutationFn: ({
5639
5503
  model,
5640
5504
  ids,
@@ -5654,9 +5518,9 @@ var useButton = () => {
5654
5518
  var use_button_default = useButton;
5655
5519
 
5656
5520
  // src/hooks/view/use-duplicate-record.ts
5657
- var import_react_query42 = require("@tanstack/react-query");
5521
+ var import_react_query43 = require("@tanstack/react-query");
5658
5522
  var useDuplicateRecord = () => {
5659
- return (0, import_react_query42.useMutation)({
5523
+ return (0, import_react_query43.useMutation)({
5660
5524
  mutationFn: ({
5661
5525
  id,
5662
5526
  model,
@@ -5671,7 +5535,7 @@ var useDuplicateRecord = () => {
5671
5535
  var use_duplicate_record_default = useDuplicateRecord;
5672
5536
 
5673
5537
  // src/hooks/view/use-get-action-detail.ts
5674
- var import_react_query43 = require("@tanstack/react-query");
5538
+ var import_react_query44 = require("@tanstack/react-query");
5675
5539
  var useGetActionDetail = ({
5676
5540
  aid,
5677
5541
  context,
@@ -5682,22 +5546,22 @@ var useGetActionDetail = ({
5682
5546
  }) => {
5683
5547
  const data = {
5684
5548
  id,
5685
- model: model != null ? model : "",
5549
+ model: model ?? "",
5686
5550
  context
5687
5551
  };
5688
- return (0, import_react_query43.useQuery)({
5552
+ return (0, import_react_query44.useQuery)({
5689
5553
  queryKey,
5690
- queryFn: () => __async(null, null, function* () {
5554
+ queryFn: async () => {
5691
5555
  if (aid) {
5692
- const res = yield view_service_default.getActionDetail(aid, context);
5556
+ const res = await view_service_default.getActionDetail(aid, context);
5693
5557
  if (res && res.length > 0) {
5694
5558
  return res[0];
5695
5559
  }
5696
5560
  } else {
5697
- const res = yield form_service_default.getFormView({ data });
5561
+ const res = await form_service_default.getFormView({ data });
5698
5562
  return res;
5699
5563
  }
5700
- }),
5564
+ },
5701
5565
  enabled,
5702
5566
  refetchOnWindowFocus: false,
5703
5567
  staleTime: Infinity
@@ -5706,9 +5570,9 @@ var useGetActionDetail = ({
5706
5570
  var use_get_action_detail_default = useGetActionDetail;
5707
5571
 
5708
5572
  // src/hooks/view/use-get-calendar.ts
5709
- var import_react_query44 = require("@tanstack/react-query");
5573
+ var import_react_query45 = require("@tanstack/react-query");
5710
5574
  var useGetCalendar = (listDataProps, queryKey, enabled) => {
5711
- return (0, import_react_query44.useQuery)({
5575
+ return (0, import_react_query45.useQuery)({
5712
5576
  queryKey,
5713
5577
  queryFn: () => model_service_default.getListCalendar({ data: listDataProps }).then((res) => {
5714
5578
  if (res) {
@@ -5724,12 +5588,12 @@ var useGetCalendar = (listDataProps, queryKey, enabled) => {
5724
5588
  var use_get_calendar_default = useGetCalendar;
5725
5589
 
5726
5590
  // src/hooks/view/use-get-groups.ts
5727
- var import_react_query45 = require("@tanstack/react-query");
5591
+ var import_react_query46 = require("@tanstack/react-query");
5728
5592
  var useGetGroups = ({
5729
5593
  model,
5730
5594
  width_context
5731
5595
  }) => {
5732
- return (0, import_react_query45.useQuery)({
5596
+ return (0, import_react_query46.useQuery)({
5733
5597
  queryKey: [model, width_context],
5734
5598
  queryFn: () => kanban_service_default.getGroups({
5735
5599
  model,
@@ -5746,9 +5610,9 @@ var useGetGroups = ({
5746
5610
  var use_get_groups_default = useGetGroups;
5747
5611
 
5748
5612
  // src/hooks/view/use-get-list-data.ts
5749
- var import_react_query46 = require("@tanstack/react-query");
5613
+ var import_react_query47 = require("@tanstack/react-query");
5750
5614
  var useGetListData = (listDataProps, queryKey, enabled) => {
5751
- return (0, import_react_query46.useQuery)({
5615
+ return (0, import_react_query47.useQuery)({
5752
5616
  queryKey,
5753
5617
  queryFn: () => model_service_default.getAll({ data: listDataProps }).then((res) => {
5754
5618
  if (res) {
@@ -5764,14 +5628,13 @@ var useGetListData = (listDataProps, queryKey, enabled) => {
5764
5628
  var use_get_list_data_default = useGetListData;
5765
5629
 
5766
5630
  // src/hooks/view/use-get-menu.ts
5767
- var import_react_query47 = require("@tanstack/react-query");
5631
+ var import_react_query48 = require("@tanstack/react-query");
5768
5632
  var useGetMenu = (context, enabled) => {
5769
- return (0, import_react_query47.useQuery)({
5633
+ return (0, import_react_query48.useQuery)({
5770
5634
  queryKey: ["menus" /* MENU */, context],
5771
5635
  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;
5636
+ if (res && res?.records && res?.records?.length > 0) {
5637
+ return res?.records;
5775
5638
  }
5776
5639
  return [];
5777
5640
  }),
@@ -5783,9 +5646,9 @@ var useGetMenu = (context, enabled) => {
5783
5646
  var use_get_menu_default = useGetMenu;
5784
5647
 
5785
5648
  // src/hooks/view/use-get-print-report.ts
5786
- var import_react_query48 = require("@tanstack/react-query");
5649
+ var import_react_query49 = require("@tanstack/react-query");
5787
5650
  var useGetPrintReport = () => {
5788
- return (0, import_react_query48.useMutation)({
5651
+ return (0, import_react_query49.useMutation)({
5789
5652
  mutationFn: ({ id }) => action_service_default.getPrintReportName({
5790
5653
  id
5791
5654
  })
@@ -5794,14 +5657,14 @@ var useGetPrintReport = () => {
5794
5657
  var use_get_print_report_default = useGetPrintReport;
5795
5658
 
5796
5659
  // src/hooks/view/use-get-progress-bar.ts
5797
- var import_react_query49 = require("@tanstack/react-query");
5660
+ var import_react_query50 = require("@tanstack/react-query");
5798
5661
  var useGetProGressBar = ({
5799
5662
  field,
5800
5663
  color,
5801
5664
  model,
5802
5665
  width_context
5803
5666
  }) => {
5804
- return (0, import_react_query49.useQuery)({
5667
+ return (0, import_react_query50.useQuery)({
5805
5668
  queryKey: [],
5806
5669
  queryFn: () => kanban_service_default.getProgressBar({
5807
5670
  field,
@@ -5820,13 +5683,13 @@ var useGetProGressBar = ({
5820
5683
  var use_get_progress_bar_default = useGetProGressBar;
5821
5684
 
5822
5685
  // src/hooks/view/use-get-selection.ts
5823
- var import_react_query50 = require("@tanstack/react-query");
5686
+ var import_react_query51 = require("@tanstack/react-query");
5824
5687
  var useGetSelection = ({
5825
5688
  data,
5826
5689
  queryKey,
5827
5690
  enabled
5828
5691
  }) => {
5829
- return (0, import_react_query50.useQuery)({
5692
+ return (0, import_react_query51.useQuery)({
5830
5693
  queryKey,
5831
5694
  queryFn: () => view_service_default.getSelectionItem({ data }),
5832
5695
  enabled,
@@ -5836,9 +5699,9 @@ var useGetSelection = ({
5836
5699
  var use_get_selection_default = useGetSelection;
5837
5700
 
5838
5701
  // src/hooks/view/use-get-view.ts
5839
- var import_react_query51 = require("@tanstack/react-query");
5702
+ var import_react_query52 = require("@tanstack/react-query");
5840
5703
  var useGetView = (viewParams, actData) => {
5841
- return (0, import_react_query51.useQuery)({
5704
+ return (0, import_react_query52.useQuery)({
5842
5705
  queryKey: ["get_view_by_action" /* GET_VIEW_BY_ACTION */, viewParams],
5843
5706
  queryFn: () => view_service_default.getView(viewParams),
5844
5707
  enabled: !!actData,
@@ -5849,9 +5712,9 @@ var useGetView = (viewParams, actData) => {
5849
5712
  var use_get_view_default = useGetView;
5850
5713
 
5851
5714
  // src/hooks/view/use-load-action.ts
5852
- var import_react_query52 = require("@tanstack/react-query");
5715
+ var import_react_query53 = require("@tanstack/react-query");
5853
5716
  var useLoadAction = () => {
5854
- return (0, import_react_query52.useMutation)({
5717
+ return (0, import_react_query53.useMutation)({
5855
5718
  mutationFn: ({
5856
5719
  idAction,
5857
5720
  context
@@ -5866,9 +5729,9 @@ var useLoadAction = () => {
5866
5729
  var use_load_action_default = useLoadAction;
5867
5730
 
5868
5731
  // src/hooks/view/use-load-message.ts
5869
- var import_react_query53 = require("@tanstack/react-query");
5732
+ var import_react_query54 = require("@tanstack/react-query");
5870
5733
  var useLoadMessage = () => {
5871
- return (0, import_react_query53.useQuery)({
5734
+ return (0, import_react_query54.useQuery)({
5872
5735
  queryKey: [`load-message-failure`],
5873
5736
  queryFn: () => view_service_default.loadMessages(),
5874
5737
  refetchOnWindowFocus: false
@@ -5877,9 +5740,9 @@ var useLoadMessage = () => {
5877
5740
  var use_load_message_default = useLoadMessage;
5878
5741
 
5879
5742
  // src/hooks/view/use-print.ts
5880
- var import_react_query54 = require("@tanstack/react-query");
5743
+ var import_react_query55 = require("@tanstack/react-query");
5881
5744
  var usePrint = () => {
5882
- return (0, import_react_query54.useMutation)({
5745
+ return (0, import_react_query55.useMutation)({
5883
5746
  mutationFn: ({ id, report, db }) => action_service_default.print({
5884
5747
  id,
5885
5748
  report,
@@ -5890,9 +5753,9 @@ var usePrint = () => {
5890
5753
  var use_print_default = usePrint;
5891
5754
 
5892
5755
  // src/hooks/view/use-remove-row.ts
5893
- var import_react_query55 = require("@tanstack/react-query");
5756
+ var import_react_query56 = require("@tanstack/react-query");
5894
5757
  var useRemoveRow = () => {
5895
- return (0, import_react_query55.useMutation)({
5758
+ return (0, import_react_query56.useMutation)({
5896
5759
  mutationFn: ({
5897
5760
  model,
5898
5761
  ids,
@@ -5907,9 +5770,9 @@ var useRemoveRow = () => {
5907
5770
  var use_remove_row_default = useRemoveRow;
5908
5771
 
5909
5772
  // src/hooks/view/use-resequence.ts
5910
- var import_react_query56 = require("@tanstack/react-query");
5773
+ var import_react_query57 = require("@tanstack/react-query");
5911
5774
  var useGetResequence = (model, resIds, context, offset) => {
5912
- return (0, import_react_query56.useQuery)({
5775
+ return (0, import_react_query57.useQuery)({
5913
5776
  queryKey: [],
5914
5777
  queryFn: () => view_service_default.getResequence({
5915
5778
  model,
@@ -5924,9 +5787,9 @@ var useGetResequence = (model, resIds, context, offset) => {
5924
5787
  var use_resequence_default = useGetResequence;
5925
5788
 
5926
5789
  // src/hooks/view/use-run-action.ts
5927
- var import_react_query57 = require("@tanstack/react-query");
5790
+ var import_react_query58 = require("@tanstack/react-query");
5928
5791
  var useRunAction = () => {
5929
- return (0, import_react_query57.useMutation)({
5792
+ return (0, import_react_query58.useMutation)({
5930
5793
  mutationFn: ({
5931
5794
  idAction,
5932
5795
  context
@@ -5939,9 +5802,9 @@ var useRunAction = () => {
5939
5802
  var use_run_action_default = useRunAction;
5940
5803
 
5941
5804
  // src/hooks/view/use-signin-sso.ts
5942
- var import_react_query58 = require("@tanstack/react-query");
5805
+ var import_react_query59 = require("@tanstack/react-query");
5943
5806
  var useSignInSSO = () => {
5944
- return (0, import_react_query58.useMutation)({
5807
+ return (0, import_react_query59.useMutation)({
5945
5808
  mutationFn: ({
5946
5809
  redirect_uri,
5947
5810
  state,
@@ -5962,9 +5825,9 @@ var useSignInSSO = () => {
5962
5825
  var use_signin_sso_default = useSignInSSO;
5963
5826
 
5964
5827
  // src/hooks/view/use-verify-2FA.ts
5965
- var import_react_query59 = require("@tanstack/react-query");
5828
+ var import_react_query60 = require("@tanstack/react-query");
5966
5829
  var useVerify2FA = () => {
5967
- return (0, import_react_query59.useMutation)({
5830
+ return (0, import_react_query60.useMutation)({
5968
5831
  mutationFn: ({
5969
5832
  method,
5970
5833
  with_context,
@@ -5985,9 +5848,9 @@ var useVerify2FA = () => {
5985
5848
  var use_verify_2FA_default = useVerify2FA;
5986
5849
 
5987
5850
  // src/hooks/view/uset-get-2FA-method.ts
5988
- var import_react_query60 = require("@tanstack/react-query");
5851
+ var import_react_query61 = require("@tanstack/react-query");
5989
5852
  var useGet2FAMethods = () => {
5990
- return (0, import_react_query60.useMutation)({
5853
+ return (0, import_react_query61.useMutation)({
5991
5854
  mutationFn: ({
5992
5855
  method,
5993
5856
  with_context
@@ -6002,9 +5865,9 @@ var useGet2FAMethods = () => {
6002
5865
  var uset_get_2FA_method_default = useGet2FAMethods;
6003
5866
 
6004
5867
  // src/hooks/view/use-get-fields-view-security.ts
6005
- var import_react_query61 = require("@tanstack/react-query");
5868
+ var import_react_query62 = require("@tanstack/react-query");
6006
5869
  var useGetFieldsViewSecurity = () => {
6007
- return (0, import_react_query61.useMutation)({
5870
+ return (0, import_react_query62.useMutation)({
6008
5871
  mutationFn: ({
6009
5872
  method,
6010
5873
  token,
@@ -6021,9 +5884,9 @@ var useGetFieldsViewSecurity = () => {
6021
5884
  var use_get_fields_view_security_default = useGetFieldsViewSecurity;
6022
5885
 
6023
5886
  // src/hooks/view/use-grant-access.ts
6024
- var import_react_query62 = require("@tanstack/react-query");
5887
+ var import_react_query63 = require("@tanstack/react-query");
6025
5888
  var useGrantAccess = () => {
6026
- return (0, import_react_query62.useMutation)({
5889
+ return (0, import_react_query63.useMutation)({
6027
5890
  mutationFn: ({
6028
5891
  redirect_uri,
6029
5892
  state,
@@ -6042,9 +5905,9 @@ var useGrantAccess = () => {
6042
5905
  var use_grant_access_default = useGrantAccess;
6043
5906
 
6044
5907
  // src/hooks/view/use-remove-totp-setup.ts
6045
- var import_react_query63 = require("@tanstack/react-query");
5908
+ var import_react_query64 = require("@tanstack/react-query");
6046
5909
  var useRemoveTotpSetup = () => {
6047
- return (0, import_react_query63.useMutation)({
5910
+ return (0, import_react_query64.useMutation)({
6048
5911
  mutationFn: ({ method, token }) => {
6049
5912
  return view_service_default.removeTotpSetUp({
6050
5913
  method,
@@ -6056,9 +5919,9 @@ var useRemoveTotpSetup = () => {
6056
5919
  var use_remove_totp_setup_default = useRemoveTotpSetup;
6057
5920
 
6058
5921
  // src/hooks/view/use-request-setup-totp.ts
6059
- var import_react_query64 = require("@tanstack/react-query");
5922
+ var import_react_query65 = require("@tanstack/react-query");
6060
5923
  var useRequestSetupTotp = () => {
6061
- return (0, import_react_query64.useMutation)({
5924
+ return (0, import_react_query65.useMutation)({
6062
5925
  mutationFn: ({ method, token }) => {
6063
5926
  return view_service_default.requestSetupTotp({
6064
5927
  method,
@@ -6070,9 +5933,9 @@ var useRequestSetupTotp = () => {
6070
5933
  var use_request_setup_totp_default = useRequestSetupTotp;
6071
5934
 
6072
5935
  // src/hooks/view/use-settings-web-read-2fa.ts
6073
- var import_react_query65 = require("@tanstack/react-query");
5936
+ var import_react_query66 = require("@tanstack/react-query");
6074
5937
  var useSettingsWebRead2fa = () => {
6075
- return (0, import_react_query65.useMutation)({
5938
+ return (0, import_react_query66.useMutation)({
6076
5939
  mutationFn: ({
6077
5940
  method,
6078
5941
  token,
@@ -6091,9 +5954,9 @@ var useSettingsWebRead2fa = () => {
6091
5954
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
6092
5955
 
6093
5956
  // src/hooks/view/use-verify-totp.ts
6094
- var import_react_query66 = require("@tanstack/react-query");
5957
+ var import_react_query67 = require("@tanstack/react-query");
6095
5958
  var useVerifyTotp = () => {
6096
- return (0, import_react_query66.useMutation)({
5959
+ return (0, import_react_query67.useMutation)({
6097
5960
  mutationFn: ({
6098
5961
  method,
6099
5962
  action_token,
@@ -6176,6 +6039,7 @@ var use_verify_totp_default = useVerifyTotp;
6176
6039
  useUploadFile,
6177
6040
  useUploadIdFile,
6178
6041
  useUploadImage,
6042
+ useValidateActionToken,
6179
6043
  useVerify2FA,
6180
6044
  useVerifyTotp
6181
6045
  });