@fctc/edu-logic-lib 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/base-model-type-DvO53Lwi.d.mts +7 -0
  2. package/dist/base-model-type-DvO53Lwi.d.ts +7 -0
  3. package/dist/chunk-4K3QAEZ6.js +90 -0
  4. package/dist/chunk-6BLY7NZ6.mjs +120 -0
  5. package/dist/chunk-6QXB3XX7.mjs +256 -0
  6. package/dist/chunk-7JD5GMIZ.js +2 -0
  7. package/dist/chunk-AYUH66EE.mjs +62 -0
  8. package/dist/chunk-CZHZLKNA.mjs +585 -0
  9. package/dist/chunk-EK43MEN4.js +635 -0
  10. package/dist/chunk-ELARQVCE.mjs +2344 -0
  11. package/dist/chunk-FVGPSTJ7.js +122 -0
  12. package/dist/chunk-GGOFXFSX.js +2362 -0
  13. package/dist/chunk-IXDDYGKE.js +61 -0
  14. package/dist/chunk-MLJQPO4Q.mjs +57 -0
  15. package/dist/chunk-OADBRQ4A.js +32 -0
  16. package/dist/chunk-OBR6UTC5.mjs +1 -0
  17. package/dist/chunk-OFUXC2LA.mjs +86 -0
  18. package/dist/chunk-P2IGWJDZ.js +1068 -0
  19. package/dist/chunk-QLUONJPQ.mjs +519 -0
  20. package/dist/chunk-RWRHCIQI.mjs +1059 -0
  21. package/dist/chunk-RZBHZYXG.js +582 -0
  22. package/dist/chunk-S7B3VKMJ.mjs +85 -0
  23. package/dist/chunk-S7YF2I23.js +95 -0
  24. package/dist/chunk-UY6GNZNB.js +262 -0
  25. package/dist/chunk-XYVK476U.mjs +29 -0
  26. package/dist/chunk-YOV6KAT2.js +66 -0
  27. package/dist/config.d.mts +15 -0
  28. package/dist/config.d.ts +15 -0
  29. package/dist/config.js +11 -0
  30. package/dist/config.mjs +2 -0
  31. package/dist/constants.d.mts +120 -0
  32. package/dist/constants.d.ts +120 -0
  33. package/dist/constants.js +55 -0
  34. package/dist/constants.mjs +2 -0
  35. package/dist/context-type-D5XefoL-.d.mts +8 -0
  36. package/dist/context-type-D5XefoL-.d.ts +8 -0
  37. package/dist/environment.d.mts +37 -0
  38. package/dist/environment.d.ts +37 -0
  39. package/dist/environment.js +25 -0
  40. package/dist/environment.mjs +4 -0
  41. package/dist/hooks.d.mts +218 -0
  42. package/dist/hooks.d.ts +218 -0
  43. package/dist/hooks.js +194 -0
  44. package/dist/hooks.mjs +9 -0
  45. package/dist/index-C_nK1Mii.d.mts +19 -0
  46. package/dist/index-C_nK1Mii.d.ts +19 -0
  47. package/dist/index.d.mts +23 -1294
  48. package/dist/index.d.ts +23 -1294
  49. package/dist/index.js +626 -5320
  50. package/dist/index.mjs +12 -5165
  51. package/dist/models.d.mts +35 -0
  52. package/dist/models.d.ts +35 -0
  53. package/dist/models.js +26 -0
  54. package/dist/models.mjs +9 -0
  55. package/dist/provider.d.mts +16 -0
  56. package/dist/provider.d.ts +16 -0
  57. package/dist/provider.js +25 -0
  58. package/dist/provider.mjs +8 -0
  59. package/dist/services.d.mts +160 -0
  60. package/dist/services.d.ts +160 -0
  61. package/dist/services.js +44 -0
  62. package/dist/services.mjs +7 -0
  63. package/dist/store.d.mts +505 -0
  64. package/dist/store.d.ts +505 -0
  65. package/dist/store.js +254 -0
  66. package/dist/store.mjs +1 -0
  67. package/dist/types.d.mts +12 -0
  68. package/dist/types.d.ts +12 -0
  69. package/dist/types.js +4 -0
  70. package/dist/types.mjs +1 -0
  71. package/dist/use-get-selection-DFh6sc49.d.mts +26 -0
  72. package/dist/use-get-selection-DFh6sc49.d.ts +26 -0
  73. package/dist/utils.d.mts +52 -0
  74. package/dist/utils.d.ts +52 -0
  75. package/dist/utils.js +66 -0
  76. package/dist/utils.mjs +1 -0
  77. package/dist/view-type-BTzRpkT7.d.mts +106 -0
  78. package/dist/view-type-BTzRpkT7.d.ts +106 -0
  79. package/package.json +41 -41
@@ -0,0 +1,95 @@
1
+ 'use strict';
2
+
3
+ // src/constants/field/field-type-constant.ts
4
+ var FieldTypeConstants = /* @__PURE__ */ ((FieldTypeConstants2) => {
5
+ FieldTypeConstants2["CHAR"] = "char";
6
+ FieldTypeConstants2["TEXT"] = "text";
7
+ FieldTypeConstants2["INTEGER"] = "integer";
8
+ FieldTypeConstants2["FLOAT"] = "float";
9
+ FieldTypeConstants2["BOOLEAN"] = "boolean";
10
+ FieldTypeConstants2["DATE"] = "date";
11
+ FieldTypeConstants2["DATETIME"] = "datetime";
12
+ FieldTypeConstants2["BINARY"] = "binary";
13
+ FieldTypeConstants2["SELECTION"] = "selection";
14
+ FieldTypeConstants2["HTML"] = "html";
15
+ FieldTypeConstants2["MANY2ONE"] = "many2one";
16
+ FieldTypeConstants2["ONE2MANY"] = "one2many";
17
+ FieldTypeConstants2["MANY2MANY"] = "many2many";
18
+ FieldTypeConstants2["MONETARY"] = "monetary";
19
+ FieldTypeConstants2["REFERENCE"] = "reference";
20
+ FieldTypeConstants2["FUNCTION"] = "function";
21
+ FieldTypeConstants2["PROPERTY"] = "property";
22
+ return FieldTypeConstants2;
23
+ })(FieldTypeConstants || {});
24
+
25
+ // src/constants/method/method-type-constant.ts
26
+ var MethodType = /* @__PURE__ */ ((MethodType2) => {
27
+ MethodType2[MethodType2["CREATE"] = 0] = "CREATE";
28
+ MethodType2[MethodType2["UPDATE"] = 1] = "UPDATE";
29
+ MethodType2[MethodType2["DELETE"] = 2] = "DELETE";
30
+ MethodType2[MethodType2["UNLINK"] = 3] = "UNLINK";
31
+ MethodType2[MethodType2["NO_CHANGE"] = 4] = "NO_CHANGE";
32
+ return MethodType2;
33
+ })(MethodType || {});
34
+
35
+ // src/constants/model/model-constant.ts
36
+ var ModelConstants = /* @__PURE__ */ ((ModelConstants2) => {
37
+ ModelConstants2["MENU"] = "ir.ui.menu";
38
+ ModelConstants2["USER"] = "res.users";
39
+ ModelConstants2["COMPANY"] = "res.company";
40
+ ModelConstants2["WINDOW_ACTION"] = "ir.actions.act_window";
41
+ ModelConstants2["BASE_IMPORT"] = "base_import.import";
42
+ ModelConstants2["GET_IMPORT"] = "get_import_templates";
43
+ return ModelConstants2;
44
+ })(ModelConstants || {});
45
+
46
+ // src/constants/type/index.ts
47
+ var ComponentType = /* @__PURE__ */ ((ComponentType2) => {
48
+ ComponentType2["TREE"] = "tree";
49
+ ComponentType2["GROUP"] = "group";
50
+ ComponentType2["LIST"] = "list";
51
+ ComponentType2["FORM"] = "form";
52
+ ComponentType2["FIELD"] = "field";
53
+ ComponentType2["DIV"] = "div";
54
+ ComponentType2["SPAN"] = "span";
55
+ return ComponentType2;
56
+ })(ComponentType || {});
57
+ var SearchType = {
58
+ FILTER: "filter_by",
59
+ SEARCH: "search_by",
60
+ GROUP: "group_by"
61
+ };
62
+
63
+ // src/constants/widget/widget-avatar-constant.ts
64
+ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
65
+ WIDGETAVATAR2["many2one_avatar_user"] = "many2one_avatar_user";
66
+ WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
67
+ return WIDGETAVATAR2;
68
+ })(WIDGETAVATAR || {});
69
+
70
+ // src/constants/widget/widget-color-constant.ts
71
+ var WIDGETCOLOR = /* @__PURE__ */ ((WIDGETCOLOR2) => {
72
+ WIDGETCOLOR2["many2many_tags"] = "many2many_tags";
73
+ WIDGETCOLOR2["helpdesk_sla_many2many_tags"] = "helpdesk_sla_many2many_tags";
74
+ return WIDGETCOLOR2;
75
+ })(WIDGETCOLOR || {});
76
+
77
+ // src/constants/widget/widget-status-constant.ts
78
+ var WIDGETSTATUS = /* @__PURE__ */ ((WIDGETSTATUS2) => {
79
+ WIDGETSTATUS2["sla_status_ids"] = "sla_status_ids";
80
+ return WIDGETSTATUS2;
81
+ })(WIDGETSTATUS || {});
82
+ var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
83
+ WIDGETNOSTRING2["sla_status_ids"] = "sla_status_ids";
84
+ return WIDGETNOSTRING2;
85
+ })(WIDGETNOSTRING || {});
86
+
87
+ exports.ComponentType = ComponentType;
88
+ exports.FieldTypeConstants = FieldTypeConstants;
89
+ exports.MethodType = MethodType;
90
+ exports.ModelConstants = ModelConstants;
91
+ exports.SearchType = SearchType;
92
+ exports.WIDGETAVATAR = WIDGETAVATAR;
93
+ exports.WIDGETCOLOR = WIDGETCOLOR;
94
+ exports.WIDGETNOSTRING = WIDGETNOSTRING;
95
+ exports.WIDGETSTATUS = WIDGETSTATUS;
@@ -0,0 +1,262 @@
1
+ 'use strict';
2
+
3
+ var axios = require('axios');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
8
+
9
+ // src/config/axios-client.ts
10
+ var MAINT_KEY = "MAINTENANCE_ACTIVE";
11
+ var MAINT_AT = "MAINTENANCE_AT";
12
+ var MAINT_LAST_PATH = "MAINTENANCE_LAST_PATH";
13
+ var hasRedirectedToMaintenance = false;
14
+ function setMaintenanceFlags() {
15
+ if (typeof window === "undefined") return;
16
+ const { pathname, search } = window.location;
17
+ const lastPath = pathname + (search || "");
18
+ if (pathname !== "/maintenance" && !window.localStorage.getItem(MAINT_LAST_PATH)) {
19
+ window.localStorage.setItem(MAINT_LAST_PATH, lastPath);
20
+ }
21
+ window.localStorage.setItem(MAINT_KEY, "true");
22
+ window.localStorage.setItem(MAINT_AT, String(Date.now()));
23
+ }
24
+ async function clearMaintenanceAndExit(getToken, opts) {
25
+ if (typeof window === "undefined") return;
26
+ const forceLogin = opts?.forceLogin === true;
27
+ const clearTokenOnForce = opts?.clearTokenOnForce !== false;
28
+ window.localStorage.removeItem(MAINT_KEY);
29
+ window.localStorage.removeItem(MAINT_AT);
30
+ const lastPath = window.localStorage.getItem(MAINT_LAST_PATH);
31
+ window.localStorage.removeItem(MAINT_LAST_PATH);
32
+ try {
33
+ if (forceLogin) {
34
+ if (clearTokenOnForce) {
35
+ try {
36
+ await opts?.clearToken?.();
37
+ } catch {
38
+ }
39
+ }
40
+ window.location.replace("/login");
41
+ return;
42
+ }
43
+ const token = await getToken();
44
+ if (token) {
45
+ const target = lastPath && lastPath !== "/maintenance" ? lastPath : "/";
46
+ window.location.replace(target);
47
+ } else {
48
+ window.location.replace("/login");
49
+ }
50
+ } catch {
51
+ window.location.replace("/login");
52
+ }
53
+ }
54
+ var axiosClient = {
55
+ init(config) {
56
+ const localStorage = config.localStorageUtils;
57
+ const sessionStorage = config.sessionStorageUtils;
58
+ const db = config.db;
59
+ let isRefreshing = false;
60
+ let failedQueue = [];
61
+ const processQueue = (error, token = null) => {
62
+ failedQueue?.forEach((prom) => {
63
+ if (error) {
64
+ prom.reject(error);
65
+ } else {
66
+ prom.resolve(token);
67
+ }
68
+ });
69
+ failedQueue = [];
70
+ };
71
+ const instance = axios__default.default.create({
72
+ adapter: axios__default.default.defaults.adapter,
73
+ baseURL: config.baseUrl,
74
+ timeout: 5e4,
75
+ paramsSerializer: (params) => new URLSearchParams(params).toString()
76
+ });
77
+ if (typeof window !== "undefined") {
78
+ const isMaint = window.localStorage.getItem(MAINT_KEY) === "true";
79
+ const onMaintenancePage = window.location.pathname === "/maintenance";
80
+ if (isMaint && !onMaintenancePage) {
81
+ hasRedirectedToMaintenance = true;
82
+ window.location.replace("/maintenance");
83
+ }
84
+ if (isMaint && onMaintenancePage) {
85
+ const healthUrl = config.healthUrl || `${(config.baseUrl || "").replace(/\/+$/, "")}/health`;
86
+ (async () => {
87
+ try {
88
+ await axios__default.default.get(healthUrl, { timeout: 8e3 });
89
+ await clearMaintenanceAndExit(() => localStorage.getAccessToken(), {
90
+ forceLogin: true,
91
+ clearTokenOnForce: true,
92
+ clearToken: () => localStorage.clearToken()
93
+ });
94
+ } catch {
95
+ }
96
+ })();
97
+ }
98
+ }
99
+ instance.interceptors.request.use(
100
+ async (configReq) => {
101
+ const token = await localStorage.getAccessToken();
102
+ if (token) {
103
+ configReq.headers["Authorization"] = "Bearer " + token;
104
+ }
105
+ return configReq;
106
+ },
107
+ (error) => Promise.reject(error)
108
+ );
109
+ instance.interceptors.response.use(
110
+ (response) => {
111
+ if (typeof window !== "undefined") {
112
+ const isMaint = window.localStorage.getItem(MAINT_KEY) === "true";
113
+ const onMaintenancePage = window.location.pathname === "/maintenance";
114
+ if (isMaint && onMaintenancePage) {
115
+ (async () => {
116
+ await clearMaintenanceAndExit(
117
+ () => localStorage.getAccessToken(),
118
+ {
119
+ forceLogin: true,
120
+ clearTokenOnForce: true,
121
+ clearToken: () => localStorage.clearToken()
122
+ }
123
+ );
124
+ })();
125
+ } else if (isMaint) {
126
+ window.localStorage.removeItem(MAINT_KEY);
127
+ window.localStorage.removeItem(MAINT_AT);
128
+ window.localStorage.removeItem(MAINT_LAST_PATH);
129
+ }
130
+ }
131
+ return handleResponse(response);
132
+ },
133
+ async (error) => {
134
+ const status = error?.response?.status;
135
+ if (status === 503) {
136
+ if (typeof window !== "undefined") {
137
+ setMaintenanceFlags();
138
+ if (!hasRedirectedToMaintenance && window.location.pathname !== "/maintenance") {
139
+ hasRedirectedToMaintenance = true;
140
+ window.location.replace("/maintenance");
141
+ }
142
+ }
143
+ return Promise.reject({
144
+ code: 503,
145
+ message: "SERVICE_UNAVAILABLE",
146
+ original: error?.response?.data
147
+ });
148
+ }
149
+ const handleError = async (err) => {
150
+ if (!err.response) {
151
+ return err;
152
+ }
153
+ const { data } = err.response;
154
+ if (data && data.code === 400 && ["invalid_grant"].includes(data.data?.error)) {
155
+ await clearAuthToken();
156
+ }
157
+ return data;
158
+ };
159
+ const originalRequest = error.config;
160
+ if ((error.response?.status === 403 || error.response?.status === 401 || error.response?.status === 404) && ["TOKEN_EXPIRED", "AUTHEN_FAIL", 401].includes(
161
+ error.response.data.code
162
+ )) {
163
+ if (isRefreshing) {
164
+ return new Promise(function(resolve, reject) {
165
+ failedQueue.push({ resolve, reject });
166
+ }).then((token) => {
167
+ originalRequest.headers["Authorization"] = "Bearer " + token;
168
+ return instance.request(originalRequest);
169
+ }).catch(async (err) => {
170
+ if ((err.response?.status === 400 || err.response?.status === 401) && ["invalid_grant"].includes(err.response.data.error)) {
171
+ await clearAuthToken();
172
+ }
173
+ });
174
+ }
175
+ const browserSession = await sessionStorage.getBrowserSession();
176
+ const refreshToken = await localStorage.getRefreshToken();
177
+ const accessTokenExp = await localStorage.getAccessToken();
178
+ isRefreshing = true;
179
+ if (!refreshToken && (!browserSession || browserSession == "unActive")) {
180
+ await clearAuthToken();
181
+ } else {
182
+ const payload = Object.fromEntries(
183
+ Object.entries({
184
+ refresh_token: refreshToken,
185
+ grant_type: "refresh_token",
186
+ client_id: config.config.clientId,
187
+ client_secret: config.config.clientSecret
188
+ }).filter(([_, value]) => !!value)
189
+ );
190
+ return new Promise(function(resolve) {
191
+ axios__default.default.post(
192
+ `${config.baseUrl}${"/authentication/oauth2/token" /* AUTH_TOKEN_PATH */}`,
193
+ payload,
194
+ {
195
+ headers: {
196
+ "Content-Type": "multipart/form-data",
197
+ Authorization: `Bearer ${accessTokenExp}`
198
+ }
199
+ }
200
+ ).then(async (res) => {
201
+ const data = res.data;
202
+ await localStorage.setToken(data.access_token);
203
+ await localStorage.setRefreshToken(data.refresh_token);
204
+ axios__default.default.defaults.headers.common["Authorization"] = "Bearer " + data.access_token;
205
+ originalRequest.headers["Authorization"] = "Bearer " + data.access_token;
206
+ processQueue(null, data.access_token);
207
+ resolve(instance.request(originalRequest));
208
+ }).catch(async (err) => {
209
+ if (err && (err?.error_code === "AUTHEN_FAIL" || err?.error_code === "TOKEN_EXPIRED" || err?.error_code === "TOKEN_INCORRECT" || err?.code === "ERR_BAD_REQUEST")) {
210
+ await clearAuthToken();
211
+ }
212
+ if (err && err.response) {
213
+ const { error_code } = err.response?.data || {};
214
+ if (error_code === "AUTHEN_FAIL") {
215
+ await clearAuthToken();
216
+ }
217
+ }
218
+ processQueue(err, null);
219
+ }).finally(() => {
220
+ isRefreshing = false;
221
+ });
222
+ });
223
+ }
224
+ }
225
+ return Promise.reject(await handleError(error));
226
+ }
227
+ );
228
+ const handleResponse = (res) => {
229
+ if (res && res.data) {
230
+ return res.data;
231
+ }
232
+ return res;
233
+ };
234
+ const clearAuthToken = async () => {
235
+ await localStorage.clearToken();
236
+ if (typeof window !== "undefined") {
237
+ window.location.href = `/login`;
238
+ }
239
+ };
240
+ function formatUrl(url, db2) {
241
+ return url + (db2 ? "?db=" + db2 : "");
242
+ }
243
+ const responseBody = (response) => response;
244
+ const requests = {
245
+ get: (url, headers) => instance.get(formatUrl(url, db), headers).then(responseBody),
246
+ post: (url, body, headers) => instance.post(formatUrl(url, db), body, { headers }).then(responseBody),
247
+ post_excel: (url, body, headers) => instance.post(formatUrl(url, db), body, {
248
+ responseType: "arraybuffer",
249
+ headers: {
250
+ "Content-Type": typeof window !== "undefined" ? "application/json" : "application/javascript",
251
+ Accept: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
252
+ }
253
+ }).then(responseBody),
254
+ put: (url, body, headers) => instance.put(formatUrl(url, db), body, headers).then(responseBody),
255
+ patch: (url, body) => instance.patch(formatUrl(url, db), body).then(responseBody),
256
+ delete: (url, body) => instance.delete(formatUrl(url, db), body).then(responseBody)
257
+ };
258
+ return requests;
259
+ }
260
+ };
261
+
262
+ exports.axiosClient = axiosClient;
@@ -0,0 +1,29 @@
1
+ import { base_model_default } from './chunk-6BLY7NZ6.mjs';
2
+ import { company_service_default, user_service_default } from './chunk-RWRHCIQI.mjs';
3
+
4
+ // src/models/company-model/index.ts
5
+ var CompanyModel = class extends base_model_default {
6
+ constructor(init) {
7
+ super(init);
8
+ }
9
+ async getCurrentCompany() {
10
+ return await company_service_default.getCurrentCompany();
11
+ }
12
+ async getUserCompany(id) {
13
+ return await company_service_default.getInfoCompany(id);
14
+ }
15
+ };
16
+ var company_model_default = CompanyModel;
17
+
18
+ // src/models/user-model/index.ts
19
+ var UserModel = class extends base_model_default {
20
+ constructor(init) {
21
+ super(init);
22
+ }
23
+ async getProfile() {
24
+ return await user_service_default.getProfile();
25
+ }
26
+ };
27
+ var user_model_default = UserModel;
28
+
29
+ export { company_model_default, user_model_default };
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ var chunkP2IGWJDZ_js = require('./chunk-P2IGWJDZ.js');
4
+ var chunkRZBHZYXG_js = require('./chunk-RZBHZYXG.js');
5
+ var react = require('react');
6
+ var reactQuery = require('@tanstack/react-query');
7
+ var jsxRuntime = require('react/jsx-runtime');
8
+ var reactRedux = require('react-redux');
9
+
10
+ var ReactQueryProvider = ({ children }) => {
11
+ const [queryClient] = react.useState(
12
+ () => new reactQuery.QueryClient({
13
+ defaultOptions: {
14
+ queries: {
15
+ refetchOnWindowFocus: false,
16
+ refetchOnMount: false,
17
+ refetchOnReconnect: false,
18
+ retry: false
19
+ }
20
+ }
21
+ })
22
+ );
23
+ return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
24
+ };
25
+ var ReduxProvider = ({ children }) => {
26
+ return /* @__PURE__ */ jsxRuntime.jsx(reactRedux.Provider, { store: chunkRZBHZYXG_js.envStore, children });
27
+ };
28
+ var MainProvider = ({ children }) => {
29
+ return /* @__PURE__ */ jsxRuntime.jsx(ReduxProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(ReactQueryProvider, { children }) });
30
+ };
31
+ var VersionGate = ({ children }) => {
32
+ const queryClient = reactQuery.useQueryClient();
33
+ const [ready, setReady] = react.useState(false);
34
+ react.useEffect(() => {
35
+ const clearVersion = () => {
36
+ queryClient.clear();
37
+ localStorage.removeItem("__api_version__");
38
+ };
39
+ const validateVersion = async () => {
40
+ const serverVersion = await chunkP2IGWJDZ_js.view_service_default.getVersion();
41
+ const cached = localStorage.getItem("__api_version__");
42
+ if (cached !== serverVersion?.api_version) {
43
+ clearVersion();
44
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
45
+ } else {
46
+ console.log("Api version:", serverVersion?.api_version);
47
+ }
48
+ setReady(true);
49
+ };
50
+ validateVersion();
51
+ if (typeof window !== "undefined") {
52
+ const onKey = (e) => {
53
+ const key = e.key.toLowerCase();
54
+ const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
55
+ if (isHardRefresh) clearVersion();
56
+ };
57
+ window.addEventListener("keydown", onKey);
58
+ return () => window.removeEventListener("keydown", onKey);
59
+ }
60
+ }, [queryClient]);
61
+ return ready ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : null;
62
+ };
63
+
64
+ exports.MainProvider = MainProvider;
65
+ exports.ReactQueryProvider = ReactQueryProvider;
66
+ exports.VersionGate = VersionGate;
@@ -0,0 +1,15 @@
1
+ import { EnvStore } from './environment.mjs';
2
+ import '@reduxjs/toolkit';
3
+
4
+ declare const axiosClient: {
5
+ init(config: EnvStore): {
6
+ get: (url: string, headers: any) => Promise<any>;
7
+ post: (url: string, body: any, headers: any) => Promise<any>;
8
+ post_excel: (url: string, body: any, headers: any) => Promise<any>;
9
+ put: (url: string, body: any, headers: any) => Promise<any>;
10
+ patch: (url: string, body: any) => Promise<any>;
11
+ delete: (url: string, body: any) => Promise<any>;
12
+ };
13
+ };
14
+
15
+ export { axiosClient };
@@ -0,0 +1,15 @@
1
+ import { EnvStore } from './environment.js';
2
+ import '@reduxjs/toolkit';
3
+
4
+ declare const axiosClient: {
5
+ init(config: EnvStore): {
6
+ get: (url: string, headers: any) => Promise<any>;
7
+ post: (url: string, body: any, headers: any) => Promise<any>;
8
+ post_excel: (url: string, body: any, headers: any) => Promise<any>;
9
+ put: (url: string, body: any, headers: any) => Promise<any>;
10
+ patch: (url: string, body: any) => Promise<any>;
11
+ delete: (url: string, body: any) => Promise<any>;
12
+ };
13
+ };
14
+
15
+ export { axiosClient };
package/dist/config.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var chunkUY6GNZNB_js = require('./chunk-UY6GNZNB.js');
4
+ require('./chunk-IXDDYGKE.js');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "axiosClient", {
9
+ enumerable: true,
10
+ get: function () { return chunkUY6GNZNB_js.axiosClient; }
11
+ });
@@ -0,0 +1,2 @@
1
+ export { axiosClient } from './chunk-6QXB3XX7.mjs';
2
+ import './chunk-MLJQPO4Q.mjs';
@@ -0,0 +1,120 @@
1
+ declare enum KeyConstants {
2
+ PROFILE = "userinfo",
3
+ CURRENT_COMPANY = "current_company",
4
+ LIST_COMPANY = "list_company",
5
+ COMPANY_INFO = "company_info",
6
+ MENU = "menus",
7
+ GET_VIEW_BY_ACTION = "get_view_by_action",
8
+ ACTION_DETAIL = "action_detail",
9
+ GET_DATA_SELECTION = "get_data_select",
10
+ WEB_SAVE = "web_save",
11
+ WEB_READ = "web_read",
12
+ GET_PROVIDER = "get_provider"
13
+ }
14
+
15
+ declare enum MethodConstants {
16
+ WEB_SEARCH_READ = "web_search_read",
17
+ WEB_READ_GROUP = "web_read_group",
18
+ WEB_READ = "web_read",
19
+ WEB_SAVE = "web_save",
20
+ UNLINK = "unlink",
21
+ ONCHANGE = "onchange",
22
+ GET_ONCHANGE_FIELDS = "get_fields_onchange",
23
+ GET_FIELD_VIEW = "get_fields_view_v2"
24
+ }
25
+
26
+ declare enum UriConstants {
27
+ AUTH_TOKEN_PATH = "/authentication/oauth2/token",
28
+ GENTOKEN_SOCIAL = "/token/generate",
29
+ CALL_PATH = "/call",
30
+ COMPANY_PATH = "/company",
31
+ PROFILE_PATH = "/userinfo",
32
+ RESET_PASSWORD_PATH = "/reset_password",
33
+ CHANGE_PASSWORD_PATH = "/change_password",
34
+ UPDATE_PASSWORD_PATH = "/change_password_parent",
35
+ LOAD_ACTION = "/load_action",
36
+ REPORT_PATH = "/report",
37
+ RUN_ACTION_PATH = "/run_action",
38
+ UPLOAD_FILE_PATH = "/upload/file",
39
+ GET_MESSAGE = "/chatter/thread/messages",
40
+ SENT_MESSAGE = "/chatter/message/post",
41
+ UPLOAD_IMAGE = "/mail/attachment/upload",
42
+ DELETE_MESSAGE = "/chatter/message/update_content",
43
+ IMAGE_PATH = "/web/image",
44
+ LOAD_MESSAGE = "/load_message_failures",
45
+ TOKEN = "/check_token",
46
+ CREATE_UPDATE_PATH = "/create_update",
47
+ TWOFA_METHOD_PATH = "/id/api/v2/call",
48
+ SIGNIN_SSO = "/signin-sso/oauth"
49
+ }
50
+
51
+ declare enum FieldTypeConstants {
52
+ CHAR = "char",
53
+ TEXT = "text",
54
+ INTEGER = "integer",
55
+ FLOAT = "float",
56
+ BOOLEAN = "boolean",
57
+ DATE = "date",
58
+ DATETIME = "datetime",
59
+ BINARY = "binary",
60
+ SELECTION = "selection",
61
+ HTML = "html",
62
+ MANY2ONE = "many2one",
63
+ ONE2MANY = "one2many",
64
+ MANY2MANY = "many2many",
65
+ MONETARY = "monetary",
66
+ REFERENCE = "reference",
67
+ FUNCTION = "function",
68
+ PROPERTY = "property"
69
+ }
70
+
71
+ declare enum MethodType {
72
+ CREATE = 0,
73
+ UPDATE = 1,
74
+ DELETE = 2,
75
+ UNLINK = 3,
76
+ NO_CHANGE = 4
77
+ }
78
+
79
+ declare enum ModelConstants {
80
+ MENU = "ir.ui.menu",
81
+ USER = "res.users",
82
+ COMPANY = "res.company",
83
+ WINDOW_ACTION = "ir.actions.act_window",
84
+ BASE_IMPORT = "base_import.import",
85
+ GET_IMPORT = "get_import_templates"
86
+ }
87
+
88
+ declare enum ComponentType {
89
+ TREE = "tree",
90
+ GROUP = "group",
91
+ LIST = "list",
92
+ FORM = "form",
93
+ FIELD = "field",
94
+ DIV = "div",
95
+ SPAN = "span"
96
+ }
97
+ declare const SearchType: {
98
+ FILTER: string;
99
+ SEARCH: string;
100
+ GROUP: string;
101
+ };
102
+
103
+ declare enum WIDGETAVATAR {
104
+ many2one_avatar_user = "many2one_avatar_user",
105
+ many2many_avatar_user = "many2many_avatar_user"
106
+ }
107
+
108
+ declare enum WIDGETCOLOR {
109
+ many2many_tags = "many2many_tags",
110
+ helpdesk_sla_many2many_tags = "helpdesk_sla_many2many_tags"
111
+ }
112
+
113
+ declare enum WIDGETSTATUS {
114
+ sla_status_ids = "sla_status_ids"
115
+ }
116
+ declare enum WIDGETNOSTRING {
117
+ sla_status_ids = "sla_status_ids"
118
+ }
119
+
120
+ export { ComponentType, FieldTypeConstants, KeyConstants, MethodConstants, MethodType, ModelConstants, SearchType, UriConstants, WIDGETAVATAR, WIDGETCOLOR, WIDGETNOSTRING, WIDGETSTATUS };