@fctc/interface-logic 1.5.8 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/provider.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/provider.ts
68
31
  var provider_exports = {};
@@ -121,6 +84,8 @@ var initialState2 = {
121
84
  requests: null,
122
85
  companies: [],
123
86
  user: {},
87
+ db: "",
88
+ refreshTokenEndpoint: "",
124
89
  config: null,
125
90
  envFile: null,
126
91
  defaultCompany: {
@@ -284,7 +249,7 @@ var headerSlice = (0, import_toolkit5.createSlice)({
284
249
  },
285
250
  reducers: {
286
251
  setHeader: (state, action) => {
287
- state.value = __spreadValues(__spreadValues({}, state.value), action.payload);
252
+ state.value = { ...state.value, ...action.payload };
288
253
  },
289
254
  setAllowedCompanyIds: (state, action) => {
290
255
  state.value.allowedCompanyIds = action.payload;
@@ -1808,6 +1773,22 @@ var PyRelativeDelta = class _PyRelativeDelta {
1808
1773
  this.microsecond = params.microsecond;
1809
1774
  this.weekday = params.weekday;
1810
1775
  }
1776
+ years;
1777
+ months;
1778
+ days;
1779
+ hours;
1780
+ minutes;
1781
+ seconds;
1782
+ microseconds;
1783
+ leapDays;
1784
+ year;
1785
+ month;
1786
+ day;
1787
+ hour;
1788
+ minute;
1789
+ second;
1790
+ microsecond;
1791
+ weekday;
1811
1792
  negate() {
1812
1793
  return new _PyRelativeDelta(this, -1);
1813
1794
  }
@@ -1922,7 +1903,7 @@ function execOnIterable(iterable, func) {
1922
1903
  if (typeof iterable === "object" && !Array.isArray(iterable) && !(iterable instanceof Set)) {
1923
1904
  iterable = Object.keys(iterable);
1924
1905
  }
1925
- if (typeof (iterable == null ? void 0 : iterable[Symbol.iterator]) !== "function") {
1906
+ if (typeof iterable?.[Symbol.iterator] !== "function") {
1926
1907
  throw new EvaluationError("value not iterable");
1927
1908
  }
1928
1909
  return func(iterable);
@@ -2245,7 +2226,7 @@ function applyBinaryOp(ast, context) {
2245
2226
  }
2246
2227
  return Math.floor(left / right);
2247
2228
  case "**":
2248
- return __pow(left, right);
2229
+ return left ** right;
2249
2230
  case "==":
2250
2231
  return isEqual(left, right);
2251
2232
  case "<>":
@@ -2367,7 +2348,7 @@ function evaluate(ast, context = {}) {
2367
2348
  const dicts = /* @__PURE__ */ new Set();
2368
2349
  let pyContext;
2369
2350
  const evalContext = Object.create(context);
2370
- if (!(evalContext == null ? void 0 : evalContext.context)) {
2351
+ if (!evalContext?.context) {
2371
2352
  Object.defineProperty(evalContext, "context", {
2372
2353
  get() {
2373
2354
  if (!pyContext) {
@@ -2378,18 +2359,17 @@ function evaluate(ast, context = {}) {
2378
2359
  });
2379
2360
  }
2380
2361
  function _innerEvaluate(ast2) {
2381
- var _a, _b, _c;
2382
- switch (ast2 == null ? void 0 : ast2.type) {
2362
+ switch (ast2?.type) {
2383
2363
  case 0:
2384
2364
  // Number
2385
2365
  case 1:
2386
2366
  return ast2.value;
2387
2367
  case 5:
2388
2368
  if (ast2.value in evalContext) {
2389
- if (typeof evalContext[ast2.value] === "object" && ((_a = evalContext[ast2.value]) == null ? void 0 : _a.id)) {
2390
- return (_b = evalContext[ast2.value]) == null ? void 0 : _b.id;
2369
+ if (typeof evalContext[ast2.value] === "object" && evalContext[ast2.value]?.id) {
2370
+ return evalContext[ast2.value]?.id;
2391
2371
  }
2392
- return (_c = evalContext[ast2.value]) != null ? _c : false;
2372
+ return evalContext[ast2.value] ?? false;
2393
2373
  } else if (ast2.value in BUILTINS) {
2394
2374
  return BUILTINS[ast2.value];
2395
2375
  } else {
@@ -2426,7 +2406,7 @@ function evaluate(ast, context = {}) {
2426
2406
  const args = ast2.args.map(_evaluate);
2427
2407
  const kwargs = {};
2428
2408
  for (const kwarg in ast2.kwargs) {
2429
- kwargs[kwarg] = _evaluate(ast2 == null ? void 0 : ast2.kwargs[kwarg]);
2409
+ kwargs[kwarg] = _evaluate(ast2?.kwargs[kwarg]);
2430
2410
  }
2431
2411
  if (fnValue === PyDate || fnValue === PyDateTime || fnValue === PyTime || fnValue === PyRelativeDelta || fnValue === PyTimeDelta) {
2432
2412
  return fnValue.create(...args, kwargs);
@@ -2505,25 +2485,9 @@ function escapeRegExp(str) {
2505
2485
  var InvalidDomainError = class extends Error {
2506
2486
  };
2507
2487
  var Domain = class _Domain {
2508
- constructor(descr = []) {
2509
- this.ast = { type: -1, value: null };
2510
- if (descr instanceof _Domain) {
2511
- return new _Domain(descr.toString());
2512
- } else {
2513
- let rawAST;
2514
- try {
2515
- rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2516
- } catch (error) {
2517
- throw new InvalidDomainError(
2518
- `Invalid domain representation: ${descr}`,
2519
- {
2520
- cause: error
2521
- }
2522
- );
2523
- }
2524
- this.ast = normalizeDomainAST(rawAST);
2525
- }
2526
- }
2488
+ ast = { type: -1, value: null };
2489
+ static TRUE;
2490
+ static FALSE;
2527
2491
  static combine(domains, operator) {
2528
2492
  if (domains.length === 0) {
2529
2493
  return new _Domain([]);
@@ -2602,6 +2566,24 @@ var Domain = class _Domain {
2602
2566
  processLeaf(d.ast.value, 0, "&", newDomain);
2603
2567
  return newDomain;
2604
2568
  }
2569
+ constructor(descr = []) {
2570
+ if (descr instanceof _Domain) {
2571
+ return new _Domain(descr.toString());
2572
+ } else {
2573
+ let rawAST;
2574
+ try {
2575
+ rawAST = typeof descr === "string" ? parseExpr(descr) : toAST(descr);
2576
+ } catch (error) {
2577
+ throw new InvalidDomainError(
2578
+ `Invalid domain representation: ${descr}`,
2579
+ {
2580
+ cause: error
2581
+ }
2582
+ );
2583
+ }
2584
+ this.ast = normalizeDomainAST(rawAST);
2585
+ }
2586
+ }
2605
2587
  contains(record) {
2606
2588
  const expr = evaluate(this.ast, record);
2607
2589
  return matchDomain(record, expr);
@@ -2620,7 +2602,7 @@ var Domain = class _Domain {
2620
2602
  return evaluatedAsList;
2621
2603
  }
2622
2604
  return this.toString();
2623
- } catch (e) {
2605
+ } catch {
2624
2606
  return this.toString();
2625
2607
  }
2626
2608
  }
@@ -2843,22 +2825,22 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2843
2825
 
2844
2826
  // src/utils/storage/local-storage.ts
2845
2827
  var localStorageUtils = () => {
2846
- const setToken = (access_token) => __async(null, null, function* () {
2828
+ const setToken = async (access_token) => {
2847
2829
  localStorage.setItem("accessToken", access_token);
2848
- });
2849
- const setRefreshToken = (refresh_token) => __async(null, null, function* () {
2830
+ };
2831
+ const setRefreshToken = async (refresh_token) => {
2850
2832
  localStorage.setItem("refreshToken", refresh_token);
2851
- });
2852
- const getAccessToken = () => __async(null, null, function* () {
2833
+ };
2834
+ const getAccessToken = async () => {
2853
2835
  return localStorage.getItem("accessToken");
2854
- });
2855
- const getRefreshToken = () => __async(null, null, function* () {
2836
+ };
2837
+ const getRefreshToken = async () => {
2856
2838
  return localStorage.getItem("refreshToken");
2857
- });
2858
- const clearToken = () => __async(null, null, function* () {
2839
+ };
2840
+ const clearToken = async () => {
2859
2841
  localStorage.removeItem("accessToken");
2860
2842
  localStorage.removeItem("refreshToken");
2861
- });
2843
+ };
2862
2844
  return {
2863
2845
  setToken,
2864
2846
  setRefreshToken,
@@ -2870,9 +2852,9 @@ var localStorageUtils = () => {
2870
2852
 
2871
2853
  // src/utils/storage/session-storage.ts
2872
2854
  var sessionStorageUtils = () => {
2873
- const getBrowserSession = () => __async(null, null, function* () {
2855
+ const getBrowserSession = async () => {
2874
2856
  return sessionStorage.getItem("browserSession");
2875
- });
2857
+ };
2876
2858
  return {
2877
2859
  getBrowserSession
2878
2860
  };
@@ -2881,14 +2863,13 @@ var sessionStorageUtils = () => {
2881
2863
  // src/configs/axios-client.ts
2882
2864
  var axiosClient = {
2883
2865
  init(config) {
2884
- var _a, _b;
2885
- const localStorage2 = (_a = config.localStorageUtils) != null ? _a : localStorageUtils();
2886
- const sessionStorage2 = (_b = config.sessionStorageUtils) != null ? _b : sessionStorageUtils();
2866
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
2867
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
2887
2868
  const db = config.db;
2888
2869
  let isRefreshing = false;
2889
2870
  let failedQueue = [];
2890
2871
  const processQueue = (error, token = null) => {
2891
- failedQueue == null ? void 0 : failedQueue.forEach((prom) => {
2872
+ failedQueue?.forEach((prom) => {
2892
2873
  if (error) {
2893
2874
  prom.reject(error);
2894
2875
  } else {
@@ -2903,38 +2884,33 @@ var axiosClient = {
2903
2884
  timeout: 5e4,
2904
2885
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2905
2886
  });
2906
- instance.interceptors.request.use(
2907
- (config2) => __async(null, null, function* () {
2908
- const useRefreshToken = config2.useRefreshToken;
2909
- const token = useRefreshToken ? yield localStorage2.getRefreshToken() : yield localStorage2.getAccessToken();
2910
- if (token) {
2911
- config2.headers["Authorization"] = "Bearer " + token;
2912
- }
2913
- return config2;
2914
- }),
2915
- (error) => {
2916
- Promise.reject(error);
2887
+ instance.interceptors.request.use(async (config2) => {
2888
+ const { useRefreshToken, useActionToken, actionToken } = config2;
2889
+ if (useActionToken && actionToken) {
2890
+ config2.headers["Action-Token"] = actionToken;
2917
2891
  }
2918
- );
2892
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
2893
+ const token = await getToken?.();
2894
+ if (token) config2.headers["Authorization"] = `Bearer ${token}`;
2895
+ return config2;
2896
+ }, Promise.reject);
2919
2897
  instance.interceptors.response.use(
2920
2898
  (response) => {
2921
2899
  return handleResponse(response);
2922
2900
  },
2923
- (error) => __async(null, null, function* () {
2924
- var _a2, _b2, _c;
2925
- const handleError3 = (error2) => __async(null, null, function* () {
2926
- var _a3;
2901
+ async (error) => {
2902
+ const handleError3 = async (error2) => {
2927
2903
  if (!error2.response) {
2928
2904
  return error2;
2929
2905
  }
2930
2906
  const { data } = error2.response;
2931
- if (data && data.code === 400 && ["invalid_grant"].includes((_a3 = data.data) == null ? void 0 : _a3.error)) {
2932
- yield clearAuthToken();
2907
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
2908
+ await clearAuthToken();
2933
2909
  }
2934
2910
  return data;
2935
- });
2911
+ };
2936
2912
  const originalRequest = error.config;
2937
- if ((((_a2 = error.response) == null ? void 0 : _a2.status) === 403 || ((_b2 = error.response) == null ? void 0 : _b2.status) === 401 || ((_c = error.response) == null ? void 0 : _c.status) === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2913
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401, "ERR_2FA_006"].includes(
2938
2914
  error.response.data.code
2939
2915
  )) {
2940
2916
  if (isRefreshing) {
@@ -2947,19 +2923,18 @@ var axiosClient = {
2947
2923
  token
2948
2924
  );
2949
2925
  return instance.request(originalRequest);
2950
- }).catch((err) => __async(null, null, function* () {
2951
- var _a3, _b3;
2952
- if ((((_a3 = err.response) == null ? void 0 : _a3.status) === 400 || ((_b3 = err.response) == null ? void 0 : _b3.status) === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2953
- yield clearAuthToken();
2926
+ }).catch(async (err) => {
2927
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
2928
+ await clearAuthToken();
2954
2929
  }
2955
- }));
2930
+ });
2956
2931
  }
2957
- const browserSession = yield sessionStorage2.getBrowserSession();
2958
- const refreshToken = yield localStorage2.getRefreshToken();
2959
- const accessTokenExp = yield localStorage2.getAccessToken();
2932
+ const browserSession = await sessionStorage2.getBrowserSession();
2933
+ const refreshToken = await localStorage2.getRefreshToken();
2934
+ const accessTokenExp = await localStorage2.getAccessToken();
2960
2935
  isRefreshing = true;
2961
2936
  if (!refreshToken && (!browserSession || browserSession == "unActive")) {
2962
- yield clearAuthToken();
2937
+ await clearAuthToken();
2963
2938
  } else {
2964
2939
  const payload = Object.fromEntries(
2965
2940
  Object.entries({
@@ -2970,9 +2945,8 @@ var axiosClient = {
2970
2945
  }).filter(([_, value]) => !!value)
2971
2946
  );
2972
2947
  return new Promise(function(resolve) {
2973
- var _a3;
2974
2948
  import_axios.default.post(
2975
- `${config.baseUrl}${(_a3 = config.refreshTokenEndpoint) != null ? _a3 : "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2949
+ `${config.baseUrl}${config.refreshTokenEndpoint ?? "/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
2976
2950
  payload,
2977
2951
  {
2978
2952
  headers: {
@@ -2980,10 +2954,10 @@ var axiosClient = {
2980
2954
  Authorization: `Bearer ${accessTokenExp}`
2981
2955
  }
2982
2956
  }
2983
- ).then((res) => __async(null, null, function* () {
2957
+ ).then(async (res) => {
2984
2958
  const data = res.data;
2985
- yield localStorage2.setToken(data.access_token);
2986
- yield localStorage2.setRefreshToken(data.refresh_token);
2959
+ await localStorage2.setToken(data.access_token);
2960
+ await localStorage2.setRefreshToken(data.refresh_token);
2987
2961
  import_axios.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
2988
2962
  originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
2989
2963
  originalRequest.data = updateTokenParamInOriginalRequest(
@@ -2992,26 +2966,25 @@ var axiosClient = {
2992
2966
  );
2993
2967
  processQueue(null, data.access_token);
2994
2968
  resolve(instance.request(originalRequest));
2995
- })).catch((err) => __async(null, null, function* () {
2996
- var _a4;
2997
- if (err && ((err == null ? void 0 : err.error_code) === "AUTHEN_FAIL" || (err == null ? void 0 : err.error_code) === "TOKEN_EXPIRED" || (err == null ? void 0 : err.error_code) === "TOKEN_INCORRECT" || (err == null ? void 0 : err.code) === "ERR_BAD_REQUEST") || (err == null ? void 0 : err.error_code) === "ERR_2FA_006") {
2998
- yield clearAuthToken();
2969
+ }).catch(async (err) => {
2970
+ 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") {
2971
+ await clearAuthToken();
2999
2972
  }
3000
2973
  if (err && err.response) {
3001
- const { error_code } = ((_a4 = err.response) == null ? void 0 : _a4.data) || {};
2974
+ const { error_code } = err.response?.data || {};
3002
2975
  if (error_code === "AUTHEN_FAIL") {
3003
- yield clearAuthToken();
2976
+ await clearAuthToken();
3004
2977
  }
3005
2978
  }
3006
2979
  processQueue(err, null);
3007
- })).finally(() => {
2980
+ }).finally(() => {
3008
2981
  isRefreshing = false;
3009
2982
  });
3010
2983
  });
3011
2984
  }
3012
2985
  }
3013
- return Promise.reject(yield handleError3(error));
3014
- })
2986
+ return Promise.reject(await handleError3(error));
2987
+ }
3015
2988
  );
3016
2989
  const handleResponse = (res) => {
3017
2990
  if (res && res.data) {
@@ -3020,7 +2993,6 @@ var axiosClient = {
3020
2993
  return res;
3021
2994
  };
3022
2995
  const handleError2 = (error) => {
3023
- var _a2, _b2, _c;
3024
2996
  if (error.isAxiosError && error.code === "ECONNABORTED") {
3025
2997
  console.error("Request Timeout Error:", error);
3026
2998
  return "Request Timeout Error";
@@ -3028,17 +3000,17 @@ var axiosClient = {
3028
3000
  console.error("Network Error:", error);
3029
3001
  return "Network Error";
3030
3002
  } else {
3031
- console.error("Other Error:", error == null ? void 0 : error.response);
3032
- const errorMessage = ((_b2 = (_a2 = error == null ? void 0 : error.response) == null ? void 0 : _a2.data) == null ? void 0 : _b2.message) || "An error occurred";
3033
- return { message: errorMessage, status: (_c = error == null ? void 0 : error.response) == null ? void 0 : _c.status };
3003
+ console.error("Other Error:", error?.response);
3004
+ const errorMessage = error?.response?.data?.message || "An error occurred";
3005
+ return { message: errorMessage, status: error?.response?.status };
3034
3006
  }
3035
3007
  };
3036
- const clearAuthToken = () => __async(null, null, function* () {
3037
- yield localStorage2.clearToken();
3008
+ const clearAuthToken = async () => {
3009
+ await localStorage2.clearToken();
3038
3010
  if (typeof window !== "undefined") {
3039
3011
  window.location.href = `/login`;
3040
3012
  }
3041
- });
3013
+ };
3042
3014
  function formatUrl(url, db2) {
3043
3015
  return url + (db2 ? "?db=" + db2 : "");
3044
3016
  }
@@ -3063,550 +3035,524 @@ var axiosClient = {
3063
3035
 
3064
3036
  // src/environment/EnvStore.ts
3065
3037
  var EnvStore = class {
3066
- constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3067
- this.envStore = envStore2;
3038
+ baseUrl;
3039
+ requests;
3040
+ context;
3041
+ defaultCompany;
3042
+ config;
3043
+ companies;
3044
+ user;
3045
+ db;
3046
+ localStorageUtils;
3047
+ sessionStorageUtils;
3048
+ refreshTokenEndpoint;
3049
+ constructor(localStorageUtils2, sessionStorageUtils2) {
3068
3050
  this.localStorageUtils = localStorageUtils2;
3069
3051
  this.sessionStorageUtils = sessionStorageUtils2;
3070
3052
  this.setup();
3071
3053
  }
3072
3054
  setup() {
3073
- const env2 = this.envStore.getState().env;
3074
- this.baseUrl = env2 == null ? void 0 : env2.baseUrl;
3075
- this.requests = env2 == null ? void 0 : env2.requests;
3076
- this.context = env2 == null ? void 0 : env2.context;
3077
- this.defaultCompany = env2 == null ? void 0 : env2.defaultCompany;
3078
- this.config = env2 == null ? void 0 : env2.config;
3079
- this.companies = (env2 == null ? void 0 : env2.companies) || [];
3080
- this.user = env2 == null ? void 0 : env2.user;
3081
- this.db = env2 == null ? void 0 : env2.db;
3082
- this.refreshTokenEndpoint = env2 == null ? void 0 : env2.refreshTokenEndpoint;
3055
+ const env2 = envStore.getState().env;
3056
+ this.baseUrl = env2?.baseUrl;
3057
+ this.requests = env2?.requests;
3058
+ this.context = env2?.context;
3059
+ this.defaultCompany = env2?.defaultCompany;
3060
+ this.config = env2?.config;
3061
+ this.companies = env2?.companies || [];
3062
+ this.user = env2?.user;
3063
+ this.db = env2?.db;
3064
+ this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
3065
+ console.log("env from interface-logic", env2);
3083
3066
  }
3084
3067
  setupEnv(envConfig) {
3085
- const dispatch = this.envStore.dispatch;
3086
- const env2 = __spreadProps(__spreadValues({}, envConfig), {
3068
+ const dispatch = envStore.dispatch;
3069
+ const env2 = {
3070
+ ...envConfig,
3087
3071
  localStorageUtils: this.localStorageUtils,
3088
3072
  sessionStorageUtils: this.sessionStorageUtils
3089
- });
3073
+ };
3090
3074
  const requests = axiosClient.init(env2);
3091
- dispatch(setEnv(__spreadProps(__spreadValues({}, env2), { requests })));
3075
+ dispatch(setEnv({ ...env2, requests }));
3092
3076
  this.setup();
3093
3077
  }
3094
3078
  setUid(uid) {
3095
- const dispatch = this.envStore.dispatch;
3079
+ const dispatch = envStore.dispatch;
3096
3080
  dispatch(setUid(uid));
3097
3081
  this.setup();
3098
3082
  }
3099
3083
  setLang(lang) {
3100
- const dispatch = this.envStore.dispatch;
3084
+ const dispatch = envStore.dispatch;
3101
3085
  dispatch(setLang(lang));
3102
3086
  this.setup();
3103
3087
  }
3104
3088
  setAllowCompanies(allowCompanies) {
3105
- const dispatch = this.envStore.dispatch;
3089
+ const dispatch = envStore.dispatch;
3106
3090
  dispatch(setAllowCompanies(allowCompanies));
3107
3091
  this.setup();
3108
3092
  }
3109
3093
  setCompanies(companies) {
3110
- const dispatch = this.envStore.dispatch;
3094
+ const dispatch = envStore.dispatch;
3111
3095
  dispatch(setCompanies(companies));
3112
3096
  this.setup();
3113
3097
  }
3114
3098
  setDefaultCompany(company) {
3115
- const dispatch = this.envStore.dispatch;
3099
+ const dispatch = envStore.dispatch;
3116
3100
  dispatch(setDefaultCompany(company));
3117
3101
  this.setup();
3118
3102
  }
3119
3103
  setUserInfo(userInfo) {
3120
- const dispatch = this.envStore.dispatch;
3104
+ const dispatch = envStore.dispatch;
3121
3105
  dispatch(setUser(userInfo));
3122
3106
  this.setup();
3123
3107
  }
3124
3108
  };
3125
3109
  var env = null;
3126
3110
  function getEnv() {
3127
- if (!env)
3128
- env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3111
+ if (!env) env = new EnvStore(localStorageUtils(), sessionStorageUtils());
3129
3112
  return env;
3130
3113
  }
3131
3114
 
3132
3115
  // src/services/view-service/index.ts
3133
3116
  var ViewService = {
3134
- getView(_0) {
3135
- return __async(this, arguments, function* ({
3117
+ async getView({
3118
+ model,
3119
+ views,
3120
+ context = {},
3121
+ options = {},
3122
+ aid
3123
+ }) {
3124
+ const env2 = getEnv();
3125
+ const defaultOptions = {
3126
+ load_filters: true,
3127
+ toolbar: true,
3128
+ action_id: aid
3129
+ };
3130
+ const jsonDataView = {
3136
3131
  model,
3137
- views,
3138
- context = {},
3139
- options = {},
3140
- aid
3141
- }) {
3142
- var _a;
3143
- const env2 = getEnv();
3144
- const defaultOptions = {
3145
- load_filters: true,
3146
- toolbar: true,
3147
- action_id: aid
3148
- };
3149
- const jsonDataView = {
3150
- model,
3151
- method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
3152
- kwargs: {
3153
- views,
3154
- options: __spreadValues(__spreadValues({}, options), defaultOptions)
3155
- },
3156
- with_context: context
3157
- };
3158
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonDataView, {
3159
- headers: {
3160
- "Content-Type": "application/json"
3161
- }
3162
- });
3132
+ method: "get_fields_view_v2" /* GET_FIELD_VIEW */,
3133
+ kwargs: {
3134
+ views,
3135
+ options: { ...options, ...defaultOptions }
3136
+ },
3137
+ with_context: context
3138
+ };
3139
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonDataView, {
3140
+ headers: {
3141
+ "Content-Type": "application/json"
3142
+ }
3163
3143
  });
3164
3144
  },
3165
- getMenu(context) {
3166
- return __async(this, null, function* () {
3167
- var _a;
3168
- const env2 = getEnv();
3169
- const jsonData = {
3170
- model: "ir.ui.menu" /* MENU */,
3171
- method: "web_search_read" /* WEB_SEARCH_READ */,
3172
- ids: [],
3173
- with_context: context,
3174
- kwargs: {
3175
- specification: {
3176
- active: {},
3177
- name: {},
3178
- is_display: {},
3179
- sequence: {},
3180
- complete_name: {},
3181
- action: {
3182
- fields: {
3183
- display_name: {},
3184
- type: {},
3185
- binding_view_types: {}
3186
- // res_model: {},
3187
- }
3145
+ async getMenu(context) {
3146
+ const env2 = getEnv();
3147
+ const jsonData = {
3148
+ model: "ir.ui.menu" /* MENU */,
3149
+ method: "web_search_read" /* WEB_SEARCH_READ */,
3150
+ ids: [],
3151
+ with_context: context,
3152
+ kwargs: {
3153
+ specification: {
3154
+ active: {},
3155
+ name: {},
3156
+ is_display: {},
3157
+ sequence: {},
3158
+ complete_name: {},
3159
+ action: {
3160
+ fields: {
3161
+ display_name: {},
3162
+ type: {},
3163
+ binding_view_types: {}
3164
+ // res_model: {},
3165
+ }
3166
+ },
3167
+ url_icon: {},
3168
+ web_icon: {},
3169
+ web_icon_data: {},
3170
+ groups_id: {
3171
+ fields: {
3172
+ full_name: {}
3188
3173
  },
3189
- url_icon: {},
3190
- web_icon: {},
3191
- web_icon_data: {},
3192
- groups_id: {
3193
- fields: {
3194
- full_name: {}
3174
+ limit: 40,
3175
+ order: ""
3176
+ },
3177
+ display_name: {},
3178
+ child_id: {
3179
+ fields: {
3180
+ active: {},
3181
+ name: {},
3182
+ is_display: {},
3183
+ sequence: {},
3184
+ complete_name: {},
3185
+ action: {
3186
+ fields: {
3187
+ display_name: {},
3188
+ type: {},
3189
+ binding_view_types: {}
3190
+ // res_model: {},
3191
+ }
3195
3192
  },
3196
- limit: 40,
3197
- order: ""
3198
- },
3199
- display_name: {},
3200
- child_id: {
3201
- fields: {
3202
- active: {},
3203
- name: {},
3204
- is_display: {},
3205
- sequence: {},
3206
- complete_name: {},
3207
- action: {
3208
- fields: {
3209
- display_name: {},
3210
- type: {},
3211
- binding_view_types: {}
3212
- // res_model: {},
3213
- }
3193
+ url_icon: {},
3194
+ web_icon: {},
3195
+ web_icon_data: {},
3196
+ groups_id: {
3197
+ fields: {
3198
+ full_name: {}
3214
3199
  },
3215
- url_icon: {},
3216
- web_icon: {},
3217
- web_icon_data: {},
3218
- groups_id: {
3219
- fields: {
3220
- full_name: {}
3200
+ limit: 40,
3201
+ order: ""
3202
+ },
3203
+ display_name: {},
3204
+ child_id: {
3205
+ fields: {
3206
+ active: {},
3207
+ name: {},
3208
+ is_display: {},
3209
+ sequence: {},
3210
+ complete_name: {},
3211
+ action: {
3212
+ fields: {
3213
+ display_name: {},
3214
+ type: {},
3215
+ binding_view_types: {}
3216
+ // res_model: {},
3217
+ }
3221
3218
  },
3222
- limit: 40,
3223
- order: ""
3224
- },
3225
- display_name: {},
3226
- child_id: {
3227
- fields: {
3228
- active: {},
3229
- name: {},
3230
- is_display: {},
3231
- sequence: {},
3232
- complete_name: {},
3233
- action: {
3234
- fields: {
3235
- display_name: {},
3236
- type: {},
3237
- binding_view_types: {}
3238
- // res_model: {},
3239
- }
3219
+ url_icon: {},
3220
+ web_icon: {},
3221
+ web_icon_data: {},
3222
+ groups_id: {
3223
+ fields: {
3224
+ full_name: {}
3240
3225
  },
3241
- url_icon: {},
3242
- web_icon: {},
3243
- web_icon_data: {},
3244
- groups_id: {
3245
- fields: {
3246
- full_name: {}
3226
+ limit: 40,
3227
+ order: ""
3228
+ },
3229
+ display_name: {},
3230
+ child_id: {
3231
+ fields: {
3232
+ active: {},
3233
+ name: {},
3234
+ is_display: {},
3235
+ sequence: {},
3236
+ complete_name: {},
3237
+ action: {
3238
+ fields: {
3239
+ display_name: {},
3240
+ type: {},
3241
+ binding_view_types: {}
3242
+ // res_model: {},
3243
+ }
3247
3244
  },
3248
- limit: 40,
3249
- order: ""
3250
- },
3251
- display_name: {},
3252
- child_id: {
3253
- fields: {
3254
- active: {},
3255
- name: {},
3256
- is_display: {},
3257
- sequence: {},
3258
- complete_name: {},
3259
- action: {
3260
- fields: {
3261
- display_name: {},
3262
- type: {},
3263
- binding_view_types: {}
3264
- // res_model: {},
3265
- }
3245
+ url_icon: {},
3246
+ web_icon: {},
3247
+ web_icon_data: {},
3248
+ groups_id: {
3249
+ fields: {
3250
+ full_name: {}
3266
3251
  },
3267
- url_icon: {},
3268
- web_icon: {},
3269
- web_icon_data: {},
3270
- groups_id: {
3271
- fields: {
3272
- full_name: {}
3273
- },
3274
- limit: 40,
3275
- order: ""
3276
- },
3277
- display_name: {},
3278
- child_id: {
3279
- fields: {},
3280
- limit: 40,
3281
- order: ""
3282
- }
3252
+ limit: 40,
3253
+ order: ""
3283
3254
  },
3284
- limit: 40,
3285
- order: ""
3286
- }
3287
- },
3288
- limit: 40,
3289
- order: ""
3290
- }
3291
- },
3292
- limit: 40,
3293
- order: ""
3294
- }
3295
- },
3296
- domain: [
3297
- "&",
3298
- ["is_display", "=", true],
3299
- "&",
3300
- ["active", "=", true],
3301
- ["parent_id", "=", false]
3302
- ]
3303
- }
3304
- };
3305
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3306
- headers: {
3307
- "Content-Type": "application/json"
3308
- }
3309
- });
3255
+ display_name: {},
3256
+ child_id: {
3257
+ fields: {},
3258
+ limit: 40,
3259
+ order: ""
3260
+ }
3261
+ },
3262
+ limit: 40,
3263
+ order: ""
3264
+ }
3265
+ },
3266
+ limit: 40,
3267
+ order: ""
3268
+ }
3269
+ },
3270
+ limit: 40,
3271
+ order: ""
3272
+ }
3273
+ },
3274
+ domain: [
3275
+ "&",
3276
+ ["is_display", "=", true],
3277
+ "&",
3278
+ ["active", "=", true],
3279
+ ["parent_id", "=", false]
3280
+ ]
3281
+ }
3282
+ };
3283
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3284
+ headers: {
3285
+ "Content-Type": "application/json"
3286
+ }
3310
3287
  });
3311
3288
  },
3312
- getActionDetail(aid, context) {
3313
- return __async(this, null, function* () {
3314
- var _a;
3315
- const env2 = getEnv();
3316
- const jsonData = {
3317
- model: "ir.actions.act_window" /* WINDOW_ACTION */,
3318
- method: "web_read" /* WEB_READ */,
3319
- ids: [aid],
3320
- with_context: context,
3321
- kwargs: {
3322
- specification: {
3323
- id: {},
3324
- name: {},
3325
- res_model: {},
3326
- views: {},
3327
- view_mode: {},
3328
- mobile_view_mode: {},
3329
- domain: {},
3330
- context: {},
3331
- groups_id: {},
3332
- search_view_id: {}
3333
- }
3289
+ async getActionDetail(aid, context) {
3290
+ const env2 = getEnv();
3291
+ const jsonData = {
3292
+ model: "ir.actions.act_window" /* WINDOW_ACTION */,
3293
+ method: "web_read" /* WEB_READ */,
3294
+ ids: [aid],
3295
+ with_context: context,
3296
+ kwargs: {
3297
+ specification: {
3298
+ id: {},
3299
+ name: {},
3300
+ res_model: {},
3301
+ views: {},
3302
+ view_mode: {},
3303
+ mobile_view_mode: {},
3304
+ domain: {},
3305
+ context: {},
3306
+ groups_id: {},
3307
+ search_view_id: {}
3334
3308
  }
3335
- };
3336
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.post("/call" /* CALL_PATH */, jsonData, {
3337
- headers: {
3338
- "Content-Type": "application/json"
3339
- }
3340
- });
3309
+ }
3310
+ };
3311
+ return env2?.requests?.post("/call" /* CALL_PATH */, jsonData, {
3312
+ headers: {
3313
+ "Content-Type": "application/json"
3314
+ }
3341
3315
  });
3342
3316
  },
3343
- getResequence(_0) {
3344
- return __async(this, arguments, function* ({
3317
+ async getResequence({
3318
+ model,
3319
+ ids,
3320
+ context,
3321
+ offset
3322
+ }) {
3323
+ const env2 = getEnv();
3324
+ const jsonData = {
3345
3325
  model,
3326
+ with_context: context,
3346
3327
  ids,
3347
- context,
3348
- offset
3349
- }) {
3350
- const env2 = getEnv();
3351
- const jsonData = __spreadValues({
3352
- model,
3353
- with_context: context,
3354
- ids,
3355
- field: "sequence"
3356
- }, offset > 0 ? { offset } : {});
3357
- return env2 == null ? void 0 : env2.requests.post("/web/dataset/resequence", jsonData, {
3358
- headers: {
3359
- "Content-Type": "application/json"
3360
- }
3361
- });
3362
- });
3363
- },
3364
- getSelectionItem(_0) {
3365
- return __async(this, arguments, function* ({ data }) {
3366
- var _a;
3367
- const env2 = getEnv();
3368
- const jsonData = {
3369
- model: data.model,
3370
- ids: [],
3371
- method: "get_data_select",
3372
- with_context: data.context,
3373
- kwargs: {
3374
- count_limit: 10001,
3375
- domain: data.domain ? data.domain : [],
3376
- offset: 0,
3377
- order: "",
3378
- specification: (_a = data == null ? void 0 : data.specification) != null ? _a : {
3379
- id: {},
3380
- name: {},
3381
- display_name: {}
3382
- }
3383
- }
3384
- };
3385
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3386
- headers: {
3387
- "Content-Type": "application/json"
3388
- }
3389
- });
3328
+ field: "sequence",
3329
+ ...offset > 0 ? { offset } : {}
3330
+ };
3331
+ return env2?.requests.post("/web/dataset/resequence", jsonData, {
3332
+ headers: {
3333
+ "Content-Type": "application/json"
3334
+ }
3390
3335
  });
3391
3336
  },
3392
- loadMessages() {
3393
- return __async(this, null, function* () {
3394
- const env2 = getEnv();
3395
- return env2.requests.post(
3396
- "/load_message_failures" /* LOAD_MESSAGE */,
3397
- {},
3398
- {
3399
- headers: {
3400
- "Content-Type": "application/json"
3401
- }
3337
+ async getSelectionItem({ data }) {
3338
+ const env2 = getEnv();
3339
+ const jsonData = {
3340
+ model: data.model,
3341
+ ids: [],
3342
+ method: "get_data_select",
3343
+ with_context: data.context,
3344
+ kwargs: {
3345
+ count_limit: 10001,
3346
+ domain: data.domain ? data.domain : [],
3347
+ offset: 0,
3348
+ order: "",
3349
+ specification: data?.specification ?? {
3350
+ id: {},
3351
+ name: {},
3352
+ display_name: {}
3402
3353
  }
3403
- );
3354
+ }
3355
+ };
3356
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3357
+ headers: {
3358
+ "Content-Type": "application/json"
3359
+ }
3404
3360
  });
3405
3361
  },
3406
- getVersion() {
3407
- return __async(this, null, function* () {
3408
- var _a;
3409
- const env2 = getEnv();
3410
- console.log("env?.requests", env2, env2 == null ? void 0 : env2.requests);
3411
- return (_a = env2 == null ? void 0 : env2.requests) == null ? void 0 : _a.get("", {
3362
+ async loadMessages() {
3363
+ const env2 = getEnv();
3364
+ return env2.requests.post(
3365
+ "/load_message_failures" /* LOAD_MESSAGE */,
3366
+ {},
3367
+ {
3412
3368
  headers: {
3413
3369
  "Content-Type": "application/json"
3414
3370
  }
3415
- });
3371
+ }
3372
+ );
3373
+ },
3374
+ async getVersion() {
3375
+ const env2 = getEnv();
3376
+ return env2?.requests.get("", {
3377
+ headers: {
3378
+ "Content-Type": "application/json"
3379
+ }
3416
3380
  });
3417
3381
  },
3418
- get2FAMethods(_0) {
3419
- return __async(this, arguments, function* ({
3382
+ async get2FAMethods({
3383
+ method,
3384
+ with_context
3385
+ }) {
3386
+ const env2 = getEnv();
3387
+ const jsonData = {
3420
3388
  method,
3421
3389
  with_context
3422
- }) {
3423
- const env2 = getEnv();
3424
- const jsonData = {
3425
- method,
3426
- with_context
3427
- };
3428
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3429
- headers: {
3430
- "Content-Type": "application/json"
3431
- }
3432
- });
3390
+ };
3391
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3392
+ headers: {
3393
+ "Content-Type": "application/json"
3394
+ }
3433
3395
  });
3434
3396
  },
3435
- verify2FA(_0) {
3436
- return __async(this, arguments, function* ({
3397
+ async verify2FA({
3398
+ method,
3399
+ with_context,
3400
+ code,
3401
+ device,
3402
+ location
3403
+ }) {
3404
+ const env2 = getEnv();
3405
+ const jsonData = {
3437
3406
  method,
3438
- with_context,
3439
- code,
3440
- device,
3441
- location
3442
- }) {
3443
- const env2 = getEnv();
3444
- const jsonData = {
3445
- method,
3446
- kwargs: {
3447
- vals: {
3448
- code,
3449
- device,
3450
- location
3451
- }
3452
- },
3453
- with_context
3454
- };
3455
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3456
- headers: {
3457
- "Content-Type": "application/json"
3458
- },
3459
- withCredentials: true
3460
- });
3407
+ kwargs: {
3408
+ vals: {
3409
+ code,
3410
+ device,
3411
+ location
3412
+ }
3413
+ },
3414
+ with_context
3415
+ };
3416
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3417
+ headers: {
3418
+ "Content-Type": "application/json"
3419
+ },
3420
+ withCredentials: true
3461
3421
  });
3462
3422
  },
3463
- signInSSO(_0) {
3464
- return __async(this, arguments, function* ({
3465
- redirect_uri,
3466
- state,
3467
- client_id,
3423
+ async signInSSO({
3424
+ redirect_uri,
3425
+ state,
3426
+ client_id,
3427
+ response_type,
3428
+ path
3429
+ }) {
3430
+ const env2 = getEnv();
3431
+ const params = new URLSearchParams({
3468
3432
  response_type,
3469
- path
3470
- }) {
3471
- const env2 = getEnv();
3472
- const params = new URLSearchParams({
3473
- response_type,
3474
- client_id,
3475
- redirect_uri,
3476
- state
3477
- });
3478
- const url = `${path}?${params.toString()}`;
3479
- return env2 == null ? void 0 : env2.requests.get(url, {
3480
- headers: {
3481
- "Content-Type": "application/json"
3482
- },
3483
- withCredentials: true
3484
- });
3433
+ client_id,
3434
+ redirect_uri,
3435
+ state
3436
+ });
3437
+ const url = `${path}?${params.toString()}`;
3438
+ return env2?.requests.get(url, {
3439
+ headers: {
3440
+ "Content-Type": "application/json"
3441
+ },
3442
+ withCredentials: true
3485
3443
  });
3486
3444
  },
3487
- grantAccess(_0) {
3488
- return __async(this, arguments, function* ({
3445
+ async grantAccess({
3446
+ redirect_uri,
3447
+ state,
3448
+ client_id,
3449
+ scopes
3450
+ }) {
3451
+ const env2 = getEnv();
3452
+ const jsonData = {
3489
3453
  redirect_uri,
3490
3454
  state,
3491
3455
  client_id,
3492
3456
  scopes
3493
- }) {
3494
- const env2 = getEnv();
3495
- const jsonData = {
3496
- redirect_uri,
3497
- state,
3498
- client_id,
3499
- scopes
3500
- };
3501
- return env2 == null ? void 0 : env2.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3502
- headers: {
3503
- "Content-Type": "application/json"
3504
- },
3505
- withCredentials: true
3506
- });
3457
+ };
3458
+ return env2?.requests.post("/grant-access" /* GRANT_ACCESS */, jsonData, {
3459
+ headers: {
3460
+ "Content-Type": "application/json"
3461
+ },
3462
+ withCredentials: true
3507
3463
  });
3508
3464
  },
3509
- getFieldsViewSecurity(_0) {
3510
- return __async(this, arguments, function* ({
3465
+ async getFieldsViewSecurity({
3466
+ method,
3467
+ token,
3468
+ views
3469
+ }) {
3470
+ const env2 = getEnv();
3471
+ const jsonData = {
3511
3472
  method,
3512
- token,
3513
- views
3514
- }) {
3515
- const env2 = getEnv();
3516
- const jsonData = {
3517
- method,
3518
- kwargs: {
3519
- views
3520
- },
3521
- with_context: {
3522
- token
3523
- }
3524
- };
3525
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3526
- headers: {
3527
- "Content-Type": "application/json"
3528
- }
3529
- });
3473
+ kwargs: {
3474
+ views
3475
+ },
3476
+ with_context: {
3477
+ token
3478
+ }
3479
+ };
3480
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3481
+ headers: {
3482
+ "Content-Type": "application/json"
3483
+ }
3530
3484
  });
3531
3485
  },
3532
- settingsWebRead2fa(_0) {
3533
- return __async(this, arguments, function* ({
3486
+ async settingsWebRead2fa({
3487
+ method,
3488
+ model,
3489
+ kwargs,
3490
+ token
3491
+ }) {
3492
+ const env2 = getEnv();
3493
+ const jsonData = {
3534
3494
  method,
3535
3495
  model,
3536
3496
  kwargs,
3537
- token
3538
- }) {
3539
- const env2 = getEnv();
3540
- const jsonData = {
3541
- method,
3542
- model,
3543
- kwargs,
3544
- with_context: {
3545
- token
3546
- }
3547
- };
3548
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3549
- headers: {
3550
- "Content-Type": "application/json"
3551
- }
3552
- });
3497
+ with_context: {
3498
+ token
3499
+ }
3500
+ };
3501
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3502
+ headers: {
3503
+ "Content-Type": "application/json"
3504
+ }
3553
3505
  });
3554
3506
  },
3555
- requestSetupTotp(_0) {
3556
- return __async(this, arguments, function* ({ method, token }) {
3557
- const env2 = getEnv();
3558
- const jsonData = {
3559
- method,
3560
- with_context: {
3561
- token
3562
- }
3563
- };
3564
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3565
- headers: {
3566
- "Content-Type": "application/json"
3567
- }
3568
- });
3507
+ async requestSetupTotp({ method, token }) {
3508
+ const env2 = getEnv();
3509
+ const jsonData = {
3510
+ method,
3511
+ with_context: {
3512
+ token
3513
+ }
3514
+ };
3515
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3516
+ headers: {
3517
+ "Content-Type": "application/json"
3518
+ }
3569
3519
  });
3570
3520
  },
3571
- verifyTotp(_0) {
3572
- return __async(this, arguments, function* ({
3521
+ async verifyTotp({
3522
+ method,
3523
+ action_token,
3524
+ code
3525
+ }) {
3526
+ const env2 = getEnv();
3527
+ const jsonData = {
3573
3528
  method,
3574
- action_token,
3575
- code
3576
- }) {
3577
- const env2 = getEnv();
3578
- const jsonData = {
3579
- method,
3580
- kwargs: {
3581
- vals: {
3582
- code
3583
- }
3584
- },
3585
- with_context: {
3586
- action_token
3529
+ kwargs: {
3530
+ vals: {
3531
+ code
3587
3532
  }
3588
- };
3589
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3590
- headers: {
3591
- "Content-Type": "application/json"
3592
- }
3593
- });
3533
+ },
3534
+ with_context: {
3535
+ action_token
3536
+ }
3537
+ };
3538
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3539
+ headers: {
3540
+ "Content-Type": "application/json"
3541
+ }
3594
3542
  });
3595
3543
  },
3596
- removeTotpSetUp(_0) {
3597
- return __async(this, arguments, function* ({ method, token }) {
3598
- const env2 = getEnv();
3599
- const jsonData = {
3600
- method,
3601
- with_context: {
3602
- token
3603
- }
3604
- };
3605
- return env2 == null ? void 0 : env2.requests.post("/call" /* CALL_PATH */, jsonData, {
3606
- headers: {
3607
- "Content-Type": "application/json"
3608
- }
3609
- });
3544
+ async removeTotpSetUp({ method, token }) {
3545
+ const env2 = getEnv();
3546
+ const jsonData = {
3547
+ method,
3548
+ with_context: {
3549
+ token
3550
+ }
3551
+ };
3552
+ return env2?.requests.post("/call" /* CALL_PATH */, jsonData, {
3553
+ headers: {
3554
+ "Content-Type": "application/json"
3555
+ }
3610
3556
  });
3611
3557
  }
3612
3558
  };
@@ -3622,18 +3568,17 @@ var VersionGate = ({ children }) => {
3622
3568
  queryClient.clear();
3623
3569
  localStorage.removeItem("__api_version__");
3624
3570
  };
3625
- const validateVersion = () => __async(null, null, function* () {
3626
- const serverVersion = yield view_service_default.getVersion();
3627
- console.log("serverVersion", serverVersion);
3571
+ const validateVersion = async () => {
3572
+ const serverVersion = await view_service_default.getVersion();
3628
3573
  const cached = localStorage.getItem("__api_version__");
3629
- if (cached !== (serverVersion == null ? void 0 : serverVersion.api_version)) {
3574
+ if (cached !== serverVersion?.api_version) {
3630
3575
  clearVersion();
3631
- localStorage.setItem("__api_version__", serverVersion == null ? void 0 : serverVersion.api_version);
3576
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
3632
3577
  } else {
3633
- console.log("Api version:", serverVersion == null ? void 0 : serverVersion.api_version);
3578
+ console.log("Api version:", serverVersion?.api_version);
3634
3579
  }
3635
3580
  setReady(true);
3636
- });
3581
+ };
3637
3582
  validateVersion();
3638
3583
  if (typeof window !== "undefined") {
3639
3584
  const onKey = (e) => {