@fctc/interface-logic 1.8.0 → 1.8.2

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 (43) hide show
  1. package/dist/index.d.mts +1681 -0
  2. package/dist/index.d.ts +1681 -0
  3. package/dist/{hooks.js → index.js} +1438 -203
  4. package/dist/index.js.map +1 -0
  5. package/dist/{hooks.mjs → index.mjs} +1252 -157
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +1 -1
  8. package/dist/configs.d.mts +0 -12
  9. package/dist/configs.d.ts +0 -12
  10. package/dist/configs.js +0 -2386
  11. package/dist/configs.mjs +0 -2349
  12. package/dist/constants.d.mts +0 -131
  13. package/dist/constants.d.ts +0 -131
  14. package/dist/constants.js +0 -205
  15. package/dist/constants.mjs +0 -166
  16. package/dist/environment.d.mts +0 -53
  17. package/dist/environment.d.ts +0 -53
  18. package/dist/environment.js +0 -3080
  19. package/dist/environment.mjs +0 -3042
  20. package/dist/hooks.d.mts +0 -359
  21. package/dist/hooks.d.ts +0 -359
  22. package/dist/provider.d.mts +0 -16
  23. package/dist/provider.d.ts +0 -16
  24. package/dist/provider.js +0 -3595
  25. package/dist/provider.mjs +0 -3556
  26. package/dist/services.d.mts +0 -255
  27. package/dist/services.d.ts +0 -255
  28. package/dist/services.js +0 -4653
  29. package/dist/services.mjs +0 -4608
  30. package/dist/store.d.mts +0 -377
  31. package/dist/store.d.ts +0 -377
  32. package/dist/store.js +0 -814
  33. package/dist/store.mjs +0 -709
  34. package/dist/types.d.mts +0 -17
  35. package/dist/types.d.ts +0 -17
  36. package/dist/types.js +0 -18
  37. package/dist/types.mjs +0 -0
  38. package/dist/utils.d.mts +0 -93
  39. package/dist/utils.d.ts +0 -93
  40. package/dist/utils.js +0 -2962
  41. package/dist/utils.mjs +0 -2896
  42. package/dist/view-type-D8ukwj_2.d.mts +0 -113
  43. package/dist/view-type-D8ukwj_2.d.ts +0 -113
@@ -1,5 +1,34 @@
1
- // src/hooks/auth/use-forgot-password.ts
2
- import { useMutation } from "@tanstack/react-query";
1
+ // src/configs/axios-client.ts
2
+ import axios from "axios";
3
+
4
+ // src/constants/api/key-constant.ts
5
+ var KeyConstants = /* @__PURE__ */ ((KeyConstants2) => {
6
+ KeyConstants2["PROFILE"] = "userinfo";
7
+ KeyConstants2["CURRENT_COMPANY"] = "current_company";
8
+ KeyConstants2["LIST_COMPANY"] = "list_company";
9
+ KeyConstants2["COMPANY_INFO"] = "company_info";
10
+ KeyConstants2["MENU"] = "menus";
11
+ KeyConstants2["GET_VIEW_BY_ACTION"] = "get_view_by_action";
12
+ KeyConstants2["ACTION_DETAIL"] = "action_detail";
13
+ KeyConstants2["GET_DATA_SELECTION"] = "get_data_select";
14
+ KeyConstants2["WEB_SAVE"] = "web_save";
15
+ KeyConstants2["WEB_READ"] = "web_read";
16
+ KeyConstants2["GET_PROVIDER"] = "get_provider";
17
+ return KeyConstants2;
18
+ })(KeyConstants || {});
19
+
20
+ // src/constants/api/method-constant.ts
21
+ var MethodConstants = /* @__PURE__ */ ((MethodConstants2) => {
22
+ MethodConstants2["WEB_SEARCH_READ"] = "web_search_read";
23
+ MethodConstants2["WEB_READ_GROUP"] = "web_read_group";
24
+ MethodConstants2["WEB_READ"] = "web_read";
25
+ MethodConstants2["WEB_SAVE"] = "web_save";
26
+ MethodConstants2["UNLINK"] = "unlink";
27
+ MethodConstants2["ONCHANGE"] = "onchange";
28
+ MethodConstants2["GET_ONCHANGE_FIELDS"] = "get_fields_onchange";
29
+ MethodConstants2["GET_FIELD_VIEW"] = "get_fields_view_v2";
30
+ return MethodConstants2;
31
+ })(MethodConstants || {});
3
32
 
4
33
  // src/constants/api/uri-constant.ts
5
34
  var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
@@ -31,11 +60,380 @@ var UriConstants = /* @__PURE__ */ ((UriConstants2) => {
31
60
  return UriConstants2;
32
61
  })(UriConstants || {});
33
62
 
34
- // src/configs/axios-client.ts
35
- import axios from "axios";
63
+ // src/utils/error-handler.ts
64
+ var WesapError = class extends Error {
65
+ code;
66
+ constructor(message, code) {
67
+ super(message);
68
+ this.code = code;
69
+ }
70
+ };
71
+ function handleError(error, env2) {
72
+ if (error instanceof WesapError) {
73
+ env2.services.notification.error(error.message);
74
+ } else {
75
+ env2.services.notification.error("An unexpected error occurred");
76
+ }
77
+ }
36
78
 
37
79
  // src/utils/format.ts
38
80
  import moment from "moment";
81
+ var formatCurrency = (amount, currency = "USD") => {
82
+ const formatter = new Intl.NumberFormat("vi-VN", {
83
+ style: "currency",
84
+ currency,
85
+ minimumFractionDigits: 0
86
+ });
87
+ return formatter.format(amount).replaceAll(".", ",");
88
+ };
89
+ var formatDate = (date, locale = "en-US") => {
90
+ return new Intl.DateTimeFormat(locale).format(new Date(date));
91
+ };
92
+ var validateAndParseDate = (input, isDateTime = false) => {
93
+ if (!input || typeof input !== "string") return null;
94
+ const cleanInput = input.replace(/[^0-9-\/:\s]/g, "");
95
+ const dateFormat = "YYYY-MM-DD";
96
+ const dateTimeFormat = "YYYY-MM-DD HH:mm:ss";
97
+ const currentDay = moment().format("DD");
98
+ const currentMonth = moment().format("MM");
99
+ const currentYear = moment().format("YYYY");
100
+ const defaultTime = "00:00:00";
101
+ const maxYear = parseInt(currentYear) + 10;
102
+ const isValidDate = (day, month, year) => {
103
+ const date = moment(`${day}-${month}-${year}`, "DD-MM-YYYY", true);
104
+ return date.isValid();
105
+ };
106
+ const isValidTime = (hour, minute = "00", second = "00") => {
107
+ const h = parseInt(hour, 10);
108
+ const m = parseInt(minute, 10);
109
+ const s = parseInt(second, 10);
110
+ return h >= 0 && h <= 23 && m >= 0 && m <= 59 && s >= 0 && s <= 59;
111
+ };
112
+ const formatOutput = (day, month, year, time = defaultTime) => {
113
+ let result = moment(
114
+ `${day}-${month}-${year} ${time}`,
115
+ "DD-MM-YYYY HH:mm:ss"
116
+ );
117
+ if (!result.isValid()) return null;
118
+ if (isDateTime) {
119
+ result = result.subtract(7, "hours");
120
+ return result.format(dateTimeFormat);
121
+ }
122
+ return result.format(dateFormat);
123
+ };
124
+ if (isDateTime && input.match(
125
+ /^\d{1,2}[\/-]\d{1,2}[\/-]\d{2,4}\s+\d{1,2}(:\d{1,2}(:\d{1,2})?)?$/
126
+ )) {
127
+ const [datePart, timePart] = input.split(/\s+/);
128
+ const dateParts = datePart.split(/[\/-]/);
129
+ const timeParts = timePart.split(":");
130
+ const day = dateParts[0].padStart(2, "0");
131
+ const month = dateParts[1].padStart(2, "0");
132
+ const year = dateParts[2].length <= 2 ? `20${dateParts[2].padStart(2, "0")}` : dateParts[2].padStart(4, "0");
133
+ const hour = timeParts[0].padStart(2, "0");
134
+ const minute = timeParts[1] ? timeParts[1].padStart(2, "0") : "00";
135
+ const second = timeParts[2] ? timeParts[2].padStart(2, "0") : "00";
136
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
137
+ let result = moment(
138
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
139
+ "DD-MM-YYYY HH:mm:ss"
140
+ );
141
+ if (!result.isValid()) return null;
142
+ result = result.subtract(7, "hours");
143
+ return result.format(dateTimeFormat);
144
+ }
145
+ return null;
146
+ }
147
+ if (cleanInput.match(/^\d{4}-\d{2}-\d{2}$/)) {
148
+ const [year, month, day] = cleanInput.split("-");
149
+ if (isValidDate(day, month, year)) {
150
+ return formatOutput(day, month, year);
151
+ }
152
+ return null;
153
+ }
154
+ if (cleanInput.match(/^\d{1,2}\/\d{1,2}\/\d{2,4}$/)) {
155
+ const [day, month, year] = cleanInput.split("/");
156
+ const paddedDay = day.padStart(2, "0");
157
+ const paddedMonth = month.padStart(2, "0");
158
+ const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
159
+ if (isValidDate(paddedDay, paddedMonth, fullYear)) {
160
+ return formatOutput(paddedDay, paddedMonth, fullYear);
161
+ }
162
+ return null;
163
+ }
164
+ if (cleanInput.match(/^\d{1,2}-\d{1,2}-\d{2,4}$/)) {
165
+ const [day, month, year] = cleanInput.split("-");
166
+ const paddedDay = day.padStart(2, "0");
167
+ const paddedMonth = month.padStart(2, "0");
168
+ const fullYear = year.length <= 2 ? `20${year.padStart(2, "0")}` : year.padStart(4, "0");
169
+ if (isValidDate(paddedDay, paddedMonth, fullYear)) {
170
+ return formatOutput(paddedDay, paddedMonth, fullYear);
171
+ }
172
+ return null;
173
+ }
174
+ if (cleanInput.match(/^\d{1,2}[\/-]\d{1,2}$/)) {
175
+ const [day, month] = cleanInput.split(/[\/-]/);
176
+ const paddedDay = day.padStart(2, "0");
177
+ const paddedMonth = month.padStart(2, "0");
178
+ if (isValidDate(paddedDay, paddedMonth, currentYear)) {
179
+ return formatOutput(paddedDay, paddedMonth, currentYear);
180
+ }
181
+ return null;
182
+ }
183
+ if (cleanInput.match(/^\d{4}$/)) {
184
+ const num = parseInt(cleanInput, 10);
185
+ if (num >= 2e3 && num <= maxYear) {
186
+ if (isValidDate(currentDay, currentMonth, num.toString())) {
187
+ return formatOutput(currentDay, currentMonth, num.toString());
188
+ }
189
+ return null;
190
+ }
191
+ const day = cleanInput.slice(0, 2);
192
+ const month = cleanInput.slice(2, 4);
193
+ if (isValidDate(day, month, currentYear)) {
194
+ return formatOutput(day, month, currentYear);
195
+ }
196
+ return null;
197
+ }
198
+ if (cleanInput.startsWith("-") && /^\-\d+$/.test(cleanInput)) {
199
+ const daysToSubtract = Math.abs(parseInt(cleanInput, 10));
200
+ let result = moment().subtract(daysToSubtract, "days");
201
+ if (isDateTime) {
202
+ result = result.subtract(7, "hours");
203
+ }
204
+ if (result.isValid()) {
205
+ return isDateTime ? result.format(dateTimeFormat) : result.format(dateFormat);
206
+ }
207
+ return null;
208
+ }
209
+ if (input.match(/^\d{1,2}[^0-9-\/]+\d{1,2}[^0-9-\/]+\d{2,4}.*$/)) {
210
+ const parts = input.split(/[^0-9-\/]+/).filter(Boolean);
211
+ const day = parts[0].padStart(2, "0");
212
+ const month = parts[1].padStart(2, "0");
213
+ let year = parts[2];
214
+ year = year.length === 2 ? `20${year}` : year.padStart(4, "0");
215
+ if (isValidDate(day, month, year)) {
216
+ return formatOutput(day, month, year);
217
+ }
218
+ return null;
219
+ }
220
+ if (isDateTime) {
221
+ if (cleanInput.length === 9) {
222
+ const day = cleanInput.slice(0, 2);
223
+ const month = cleanInput.slice(2, 4);
224
+ const year = cleanInput.slice(4, 8);
225
+ const hour = cleanInput.slice(8, 9).padStart(2, "0");
226
+ if (isValidDate(day, month, year) && isValidTime(hour)) {
227
+ let result = moment(
228
+ `${day}-${month}-${year} ${hour}:00:00`,
229
+ "DD-MM-YYYY HH:mm:ss"
230
+ );
231
+ if (!result.isValid()) return null;
232
+ result = result.subtract(7, "hours");
233
+ return result.format(dateTimeFormat);
234
+ }
235
+ return null;
236
+ }
237
+ if (cleanInput.length === 10) {
238
+ const day = cleanInput.slice(0, 2);
239
+ const month = cleanInput.slice(2, 4);
240
+ const year = cleanInput.slice(4, 8);
241
+ const hour = cleanInput.slice(8, 10);
242
+ if (isValidDate(day, month, year) && isValidTime(hour)) {
243
+ let result = moment(
244
+ `${day}-${month}-${year} ${hour}:00:00`,
245
+ "DD-MM-YYYY HH:mm:ss"
246
+ );
247
+ if (!result.isValid()) return null;
248
+ result = result.subtract(7, "hours");
249
+ return result.format(dateTimeFormat);
250
+ }
251
+ return null;
252
+ }
253
+ if (cleanInput.length === 11) {
254
+ const day = cleanInput.slice(0, 2);
255
+ const month = cleanInput.slice(2, 4);
256
+ const year = cleanInput.slice(4, 8);
257
+ const hour = cleanInput.slice(8, 10);
258
+ const minute = cleanInput.slice(10, 11).padStart(2, "0");
259
+ if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
260
+ let result = moment(
261
+ `${day}-${month}-${year} ${hour}:${minute}:00`,
262
+ "DD-MM-YYYY HH:mm:ss"
263
+ );
264
+ if (!result.isValid()) return null;
265
+ result = result.subtract(7, "hours");
266
+ return result.format(dateTimeFormat);
267
+ }
268
+ return null;
269
+ }
270
+ if (cleanInput.length === 12) {
271
+ const day = cleanInput.slice(0, 2);
272
+ const month = cleanInput.slice(2, 4);
273
+ const year = cleanInput.slice(4, 8);
274
+ const hour = cleanInput.slice(8, 10);
275
+ const minute = cleanInput.slice(10, 12);
276
+ if (isValidDate(day, month, year) && isValidTime(hour, minute)) {
277
+ let result = moment(
278
+ `${day}-${month}-${year} ${hour}:${minute}:00`,
279
+ "DD-MM-YYYY HH:mm:ss"
280
+ );
281
+ if (!result.isValid()) return null;
282
+ result = result.subtract(7, "hours");
283
+ return result.format(dateTimeFormat);
284
+ }
285
+ return null;
286
+ }
287
+ if (cleanInput.length === 13) {
288
+ const day = cleanInput.slice(0, 2);
289
+ const month = cleanInput.slice(2, 4);
290
+ const year = cleanInput.slice(4, 8);
291
+ const hour = cleanInput.slice(8, 10);
292
+ const minute = cleanInput.slice(10, 12);
293
+ const second = cleanInput.slice(12, 13).padStart(2, "0");
294
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
295
+ let result = moment(
296
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
297
+ "DD-MM-YYYY HH:mm:ss"
298
+ );
299
+ if (!result.isValid()) return null;
300
+ result = result.subtract(7, "hours");
301
+ return result.format(dateTimeFormat);
302
+ }
303
+ return null;
304
+ }
305
+ if (cleanInput.length === 14) {
306
+ const day = cleanInput.slice(0, 2);
307
+ const month = cleanInput.slice(2, 4);
308
+ const year = cleanInput.slice(4, 8);
309
+ const hour = cleanInput.slice(8, 10);
310
+ const minute = cleanInput.slice(10, 12);
311
+ const second = cleanInput.slice(12, 14);
312
+ if (isValidDate(day, month, year) && isValidTime(hour, minute, second)) {
313
+ let result = moment(
314
+ `${day}-${month}-${year} ${hour}:${minute}:${second}`,
315
+ "DD-MM-YYYY HH:mm:ss"
316
+ );
317
+ if (!result.isValid()) return null;
318
+ result = result.subtract(7, "hours");
319
+ return result.format(dateTimeFormat);
320
+ }
321
+ return null;
322
+ }
323
+ }
324
+ const len = cleanInput.length;
325
+ if (len === 1 || len === 2) {
326
+ const paddedDay = cleanInput.padStart(2, "0");
327
+ if (isValidDate(paddedDay, currentMonth, currentYear)) {
328
+ return formatOutput(paddedDay, currentMonth, currentYear);
329
+ }
330
+ return null;
331
+ }
332
+ if (len === 3) {
333
+ const day = cleanInput.slice(0, 2);
334
+ const month = cleanInput.slice(2, 3).padStart(2, "0");
335
+ if (isValidDate(day, month, currentYear)) {
336
+ return formatOutput(day, month, currentYear);
337
+ }
338
+ return null;
339
+ }
340
+ if (len === 6) {
341
+ const day = cleanInput.slice(0, 2);
342
+ const month = cleanInput.slice(2, 4);
343
+ let year = cleanInput.slice(4, 6);
344
+ year = `20${year}`;
345
+ if (parseInt(month) > 12) {
346
+ if (isValidDate(day, currentMonth, currentYear)) {
347
+ return formatOutput(day, currentMonth, currentYear);
348
+ }
349
+ return null;
350
+ }
351
+ if (isValidDate(day, month, year)) {
352
+ return formatOutput(day, month, year);
353
+ }
354
+ return null;
355
+ }
356
+ if (len === 7) {
357
+ return null;
358
+ }
359
+ if (len === 8) {
360
+ const day = cleanInput.slice(0, 2);
361
+ const month = cleanInput.slice(2, 4);
362
+ const year = cleanInput.slice(4, 8);
363
+ if (isValidDate(day, month, year)) {
364
+ return formatOutput(day, month, year);
365
+ }
366
+ return null;
367
+ }
368
+ if (len > 8 && !isDateTime) {
369
+ return null;
370
+ }
371
+ return null;
372
+ };
373
+
374
+ // src/constants/field/field-type-constant.ts
375
+ var FieldTypeConstants = /* @__PURE__ */ ((FieldTypeConstants2) => {
376
+ FieldTypeConstants2["CHAR"] = "char";
377
+ FieldTypeConstants2["TEXT"] = "text";
378
+ FieldTypeConstants2["INTEGER"] = "integer";
379
+ FieldTypeConstants2["FLOAT"] = "float";
380
+ FieldTypeConstants2["BOOLEAN"] = "boolean";
381
+ FieldTypeConstants2["DATE"] = "date";
382
+ FieldTypeConstants2["DATETIME"] = "datetime";
383
+ FieldTypeConstants2["BINARY"] = "binary";
384
+ FieldTypeConstants2["SELECTION"] = "selection";
385
+ FieldTypeConstants2["HTML"] = "html";
386
+ FieldTypeConstants2["MANY2ONE"] = "many2one";
387
+ FieldTypeConstants2["ONE2MANY"] = "one2many";
388
+ FieldTypeConstants2["MANY2MANY"] = "many2many";
389
+ FieldTypeConstants2["MONETARY"] = "monetary";
390
+ FieldTypeConstants2["REFERENCE"] = "reference";
391
+ FieldTypeConstants2["FUNCTION"] = "function";
392
+ FieldTypeConstants2["PROPERTY"] = "property";
393
+ return FieldTypeConstants2;
394
+ })(FieldTypeConstants || {});
395
+
396
+ // src/constants/method/method-type-constant.ts
397
+ var MethodType = /* @__PURE__ */ ((MethodType2) => {
398
+ MethodType2[MethodType2["CREATE"] = 0] = "CREATE";
399
+ MethodType2[MethodType2["UPDATE"] = 1] = "UPDATE";
400
+ MethodType2[MethodType2["DELETE"] = 2] = "DELETE";
401
+ MethodType2[MethodType2["UNLINK"] = 3] = "UNLINK";
402
+ MethodType2[MethodType2["NO_CHANGE"] = 4] = "NO_CHANGE";
403
+ return MethodType2;
404
+ })(MethodType || {});
405
+
406
+ // src/constants/model/model-constant.ts
407
+ var ModelConstants = /* @__PURE__ */ ((ModelConstants2) => {
408
+ ModelConstants2["MENU"] = "ir.ui.menu";
409
+ ModelConstants2["USER"] = "res.users";
410
+ ModelConstants2["COMPANY"] = "res.company";
411
+ ModelConstants2["WINDOW_ACTION"] = "ir.actions.act_window";
412
+ ModelConstants2["BASE_IMPORT"] = "base_import.import";
413
+ ModelConstants2["GET_IMPORT"] = "get_import_templates";
414
+ return ModelConstants2;
415
+ })(ModelConstants || {});
416
+
417
+ // src/constants/type/index.ts
418
+ var ComponentType = /* @__PURE__ */ ((ComponentType2) => {
419
+ ComponentType2["GROUP"] = "group";
420
+ ComponentType2["FIELD"] = "field";
421
+ ComponentType2["TREE"] = "tree";
422
+ ComponentType2["DIV"] = "div";
423
+ ComponentType2["LIST"] = "list";
424
+ ComponentType2["FORM"] = "form";
425
+ ComponentType2["SETTINGS"] = "setting";
426
+ ComponentType2["SPAN"] = "span";
427
+ ComponentType2["KANBAN"] = "kanban";
428
+ ComponentType2["CALENDAR"] = "calendar";
429
+ ComponentType2["TYPE"] = "view-type";
430
+ return ComponentType2;
431
+ })(ComponentType || {});
432
+ var SearchType = {
433
+ FILTER: "filter_by",
434
+ SEARCH: "search_by",
435
+ GROUP: "group_by"
436
+ };
39
437
 
40
438
  // src/constants/widget/widget-avatar-constant.ts
41
439
  var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
@@ -43,6 +441,28 @@ var WIDGETAVATAR = /* @__PURE__ */ ((WIDGETAVATAR2) => {
43
441
  WIDGETAVATAR2["many2many_avatar_user"] = "many2many_avatar_user";
44
442
  return WIDGETAVATAR2;
45
443
  })(WIDGETAVATAR || {});
444
+ var WIDGETCURRENCY = /* @__PURE__ */ ((WIDGETCURRENCY2) => {
445
+ WIDGETCURRENCY2["many2one_avatar_user"] = "many2one_avatar_user";
446
+ WIDGETCURRENCY2["many2many_avatar_user"] = "many2many_avatar_user";
447
+ return WIDGETCURRENCY2;
448
+ })(WIDGETCURRENCY || {});
449
+
450
+ // src/constants/widget/widget-color-constant.ts
451
+ var WIDGETCOLOR = /* @__PURE__ */ ((WIDGETCOLOR2) => {
452
+ WIDGETCOLOR2["many2many_tags"] = "many2many_tags";
453
+ WIDGETCOLOR2["helpdesk_sla_many2many_tags"] = "helpdesk_sla_many2many_tags";
454
+ return WIDGETCOLOR2;
455
+ })(WIDGETCOLOR || {});
456
+
457
+ // src/constants/widget/widget-status-constant.ts
458
+ var WIDGETSTATUS = /* @__PURE__ */ ((WIDGETSTATUS2) => {
459
+ WIDGETSTATUS2["sla_status_ids"] = "sla_status_ids";
460
+ return WIDGETSTATUS2;
461
+ })(WIDGETSTATUS || {});
462
+ var WIDGETNOSTRING = /* @__PURE__ */ ((WIDGETNOSTRING2) => {
463
+ WIDGETNOSTRING2["sla_status_ids"] = "sla_status_ids";
464
+ return WIDGETNOSTRING2;
465
+ })(WIDGETNOSTRING || {});
46
466
 
47
467
  // src/utils/domain/py_tokenizer.ts
48
468
  var TokenizerError = class extends Error {
@@ -1811,6 +2231,48 @@ function parseExpr(expr) {
1811
2231
  const tokens = tokenize(expr);
1812
2232
  return parse(tokens);
1813
2233
  }
2234
+ function evaluateExpr(expr, context = {}) {
2235
+ let ast;
2236
+ try {
2237
+ ast = parseExpr(expr);
2238
+ } catch (error) {
2239
+ throw new EvalError(
2240
+ `Can not parse python expression: (${expr})
2241
+ Error: ${error.message}`
2242
+ );
2243
+ }
2244
+ try {
2245
+ return evaluate(ast, context);
2246
+ } catch (error) {
2247
+ throw new EvalError(
2248
+ `Can not evaluate python expression: (${expr})
2249
+ Error: ${error.message}`
2250
+ );
2251
+ }
2252
+ }
2253
+ function evaluateBooleanExpr(expr, context = {}) {
2254
+ if (!expr || expr === "False" || expr === "0") {
2255
+ return false;
2256
+ }
2257
+ if (expr === "True" || expr === "1") {
2258
+ return true;
2259
+ }
2260
+ return evaluateExpr(`bool(${expr})`, context);
2261
+ }
2262
+
2263
+ // src/utils/domain/context.ts
2264
+ function evalPartialContext(_context, evaluationContext = {}) {
2265
+ const ast = parseExpr(_context);
2266
+ const context = {};
2267
+ for (const key in ast.value) {
2268
+ const value = ast.value[key];
2269
+ try {
2270
+ context[key] = evaluate(value, evaluationContext);
2271
+ } catch {
2272
+ }
2273
+ }
2274
+ return context;
2275
+ }
1814
2276
 
1815
2277
  // src/utils/domain/objects.ts
1816
2278
  function shallowEqual(obj1, obj2, comparisonFn = (a, b) => a === b) {
@@ -2149,14 +2611,280 @@ function matchDomain(record, domain) {
2149
2611
  }
2150
2612
  return matchCondition(record, condStack.pop());
2151
2613
  }
2614
+ var checkDomain = (context, domain) => {
2615
+ try {
2616
+ if (domain === void 0 || domain === "0" || domain === "False" || domain === false) {
2617
+ return false;
2618
+ } else if (domain === "1" || domain === "True" || domain === true) {
2619
+ return true;
2620
+ }
2621
+ try {
2622
+ if (context && domain) {
2623
+ const d = new Domain(domain);
2624
+ return d.contains(context);
2625
+ }
2626
+ } catch (error) {
2627
+ if (context && domain) {
2628
+ const domainEval = evaluateBooleanExpr(domain, context);
2629
+ return domainEval;
2630
+ }
2631
+ return false;
2632
+ }
2633
+ return false;
2634
+ } catch (e) {
2635
+ return false;
2636
+ }
2637
+ };
2638
+ var matchDomains = (context, domains) => {
2639
+ if (Array.isArray(domains)) {
2640
+ if (domains?.length > 0) {
2641
+ return domains && domains.some((domain) => checkDomain(context, domain));
2642
+ }
2643
+ } else return checkDomain(context, domains);
2644
+ return false;
2645
+ };
2152
2646
 
2153
2647
  // src/utils/function.ts
2154
2648
  import { useEffect, useState } from "react";
2649
+ var evalJSONContext = (_context, context = {}) => {
2650
+ try {
2651
+ return evalPartialContext(_context, context);
2652
+ } catch (err) {
2653
+ return null;
2654
+ }
2655
+ };
2656
+ var evalJSONDomain = (domain, context) => {
2657
+ try {
2658
+ if (context) {
2659
+ Object.keys(context)?.forEach((key) => {
2660
+ if (Array.isArray(context[key])) {
2661
+ const isTypeObject = context[key]?.every(
2662
+ (item) => typeof item === "object" && item !== null && item?.id !== void 0
2663
+ );
2664
+ if (isTypeObject) {
2665
+ context[key] = context[key]?.map((item) => item?.id);
2666
+ }
2667
+ }
2668
+ });
2669
+ }
2670
+ const value = evaluateExpr(domain, context);
2671
+ return value;
2672
+ } catch (err) {
2673
+ try {
2674
+ const domainObject = new Domain(domain).toList(context);
2675
+ return domainObject;
2676
+ } catch (err2) {
2677
+ return [];
2678
+ }
2679
+ }
2680
+ };
2681
+ var formatSortingString = (input) => {
2682
+ if (!input) return null;
2683
+ return input.split(",").map((field) => {
2684
+ const [key, order] = field.trim().split(/\s+/);
2685
+ const sortOrder = order?.toUpperCase() === "DESC" ? "DESC" : "ASC";
2686
+ return `${key} ${sortOrder}`;
2687
+ }).join(", ");
2688
+ };
2689
+ var domainHelper = {
2690
+ checkDomain,
2691
+ matchDomains,
2692
+ Domain
2693
+ };
2155
2694
  var toQueryString = (params) => {
2156
2695
  return Object.keys(params).map(
2157
2696
  (key) => encodeURIComponent(key) + "=" + encodeURIComponent(params[key].toString())
2158
2697
  ).join("&");
2159
2698
  };
2699
+ var convertFloatToTime = (floatValue) => {
2700
+ const hours = Math.floor(floatValue);
2701
+ const minutes = Math.round((floatValue - hours) * 60);
2702
+ const formattedHours = String(hours).padStart(2, "0");
2703
+ const formattedMinutes = String(minutes).padStart(2, "0");
2704
+ return `${formattedHours}:${formattedMinutes}`;
2705
+ };
2706
+ var convertTimeToFloat = (timeString) => {
2707
+ const [hours, minutes] = timeString.split(":").map(Number);
2708
+ return hours + minutes / 60;
2709
+ };
2710
+ var stringToColor = (name, id) => {
2711
+ const combined = name + id / 2;
2712
+ let hash = 0;
2713
+ for (let i = 0; i < combined.length; i++) {
2714
+ hash = combined.charCodeAt(i) + ((hash << 5) - hash);
2715
+ }
2716
+ const r = hash >> 16 & 255;
2717
+ const g = hash >> 8 & 255;
2718
+ const b = hash & 255;
2719
+ const adjustedR = 120 + r % 61;
2720
+ const adjustedG = 120 + g % 61;
2721
+ const adjustedB = 120 + b % 61;
2722
+ return `#${adjustedR.toString(16).padStart(2, "0")}${adjustedG.toString(16).padStart(2, "0")}${adjustedB.toString(16).padStart(2, "0")}`;
2723
+ };
2724
+ var getFieldsOnChange = (fields) => {
2725
+ const result = [];
2726
+ function traverse(items) {
2727
+ for (const item of items) {
2728
+ if (item) {
2729
+ if (item?.type_co === "field" && matchDomains(fields, item?.on_change)) {
2730
+ result.push(item.name);
2731
+ }
2732
+ if (item?.fields && Array.isArray(item?.fields)) {
2733
+ traverse(item?.fields);
2734
+ }
2735
+ }
2736
+ }
2737
+ }
2738
+ traverse(fields);
2739
+ return result;
2740
+ };
2741
+ var filterFieldDirty = ({
2742
+ id,
2743
+ viewData,
2744
+ formValues,
2745
+ dirtyFields,
2746
+ model,
2747
+ defaultData
2748
+ }) => {
2749
+ const data = id ? { ...dirtyFields } : { ...formValues };
2750
+ for (const key in data) {
2751
+ if (viewData?.models?.[model]?.[key]?.type === "one2many" /* ONE2MANY */) {
2752
+ const lineData = [];
2753
+ (formValues[key] ?? []).forEach((itemData, index) => {
2754
+ if (typeof itemData?.id === "string" && itemData?.id.includes("virtual")) {
2755
+ delete itemData?.id;
2756
+ }
2757
+ if (!itemData?.id) {
2758
+ lineData.push([
2759
+ 0 /* CREATE */,
2760
+ `virtual_${index}`,
2761
+ filterFieldDirty({
2762
+ id: itemData?.id,
2763
+ viewData,
2764
+ formValues: itemData,
2765
+ dirtyFields: {},
2766
+ model: viewData?.models?.[model]?.[key]?.relation,
2767
+ defaultData
2768
+ })
2769
+ ]);
2770
+ } else if (dirtyFields[key]?.length) {
2771
+ dirtyFields[key].forEach((itemDirty, indexDirty) => {
2772
+ if (Object.values(itemDirty).includes(true) && indexDirty === index) {
2773
+ lineData.push([
2774
+ 1 /* UPDATE */,
2775
+ itemData?.id,
2776
+ filterFieldDirty({
2777
+ id: itemData?.id,
2778
+ viewData,
2779
+ formValues: itemData,
2780
+ dirtyFields: itemDirty,
2781
+ model: viewData?.models?.[model]?.[key]?.relation,
2782
+ defaultData: {}
2783
+ })
2784
+ ]);
2785
+ }
2786
+ });
2787
+ }
2788
+ });
2789
+ (defaultData[key] ?? []).forEach((item) => {
2790
+ if (!(formValues[key] ?? []).find(
2791
+ (itemData) => itemData?.id === item?.id
2792
+ )) {
2793
+ lineData.push([2 /* DELETE */, item?.id, item]);
2794
+ }
2795
+ });
2796
+ data[key] = lineData;
2797
+ } else if (viewData?.models?.[model]?.[key]?.type === "many2many" /* MANY2MANY */) {
2798
+ const lineData = [];
2799
+ (formValues[key] || []).forEach((itemData) => {
2800
+ if (itemData?.id) {
2801
+ lineData.push([4 /* NO_CHANGE */, itemData?.id]);
2802
+ }
2803
+ });
2804
+ (defaultData[key] ?? []).forEach((item) => {
2805
+ if (!(formValues[key] ?? []).find(
2806
+ (itemData) => itemData?.id === item?.id
2807
+ )) {
2808
+ lineData.push([3 /* UNLINK */, item?.id]);
2809
+ }
2810
+ });
2811
+ data[key] = lineData;
2812
+ } else {
2813
+ if (id && (typeof dirtyFields?.[key] === "object" && !dirtyFields?.[key]?.id || typeof dirtyFields[key] !== "object" && !dirtyFields[key])) {
2814
+ delete data[key];
2815
+ } else {
2816
+ if (!data[key]) {
2817
+ delete data[key];
2818
+ } else {
2819
+ data[key] = formValues?.[key]?.display_name ? formValues?.[key]?.id : formValues?.[key];
2820
+ }
2821
+ }
2822
+ }
2823
+ }
2824
+ return data;
2825
+ };
2826
+ var mergeObjects = (object1, object2) => {
2827
+ if (!object1 || !object2) return void 0;
2828
+ const mergedObject = { ...object2 };
2829
+ Object.keys(object1).forEach((key) => {
2830
+ if (Array.isArray(object1[key]) && Array.isArray(object2[key])) {
2831
+ mergedObject[key] = object2[key].map((item, index) => {
2832
+ if (object1[key][index]) {
2833
+ return {
2834
+ ...item,
2835
+ ...object1[key][index]
2836
+ };
2837
+ }
2838
+ return item;
2839
+ });
2840
+ } else if (typeof object1[key] === "object" && typeof object2[key] === "object" && object1[key] !== null && object2[key] !== null) {
2841
+ mergedObject[key] = mergeObjects(object1[key], object2[key]);
2842
+ } else {
2843
+ mergedObject[key] = object1[key] !== void 0 ? object1[key] : object2[key];
2844
+ }
2845
+ });
2846
+ if (object2) {
2847
+ Object.keys(object2).forEach((key) => {
2848
+ if (!mergedObject.hasOwnProperty(key)) {
2849
+ mergedObject[key] = object2[key];
2850
+ }
2851
+ });
2852
+ }
2853
+ return mergedObject;
2854
+ };
2855
+ var formatUrlPath = ({
2856
+ viewType,
2857
+ aid,
2858
+ model,
2859
+ id,
2860
+ actionPath
2861
+ }) => {
2862
+ let _url = `/${viewType}/${actionPath}?aid=${aid}&model=${model}`;
2863
+ if (id) {
2864
+ _url += `&id=${id}`;
2865
+ }
2866
+ return _url;
2867
+ };
2868
+ var removeUndefinedFields = (obj) => {
2869
+ const newObj = {};
2870
+ for (const key in obj) {
2871
+ if (obj[key] !== void 0) {
2872
+ newObj[key] = obj[key];
2873
+ }
2874
+ }
2875
+ return newObj;
2876
+ };
2877
+ var useTabModel = (viewData, onchangeData) => {
2878
+ const tabsData = viewData?.views?.form?.tabs?.filter((val) => {
2879
+ if (!val) return null;
2880
+ const hide = checkDomain(onchangeData, val.invisible);
2881
+ if (!hide) {
2882
+ return val;
2883
+ }
2884
+ return false;
2885
+ }) || [];
2886
+ return tabsData;
2887
+ };
2160
2888
  var isBase64File = (str) => {
2161
2889
  try {
2162
2890
  const dataUriPattern = /^data:([a-zA-Z]+\/[a-zA-Z0-9-.+]+)?;base64,/;
@@ -2172,6 +2900,69 @@ var isBase64File = (str) => {
2172
2900
  return false;
2173
2901
  }
2174
2902
  };
2903
+ var isBase64Image = (str) => {
2904
+ const base64Regex = /^data:image\/(png|jpeg|jpg|gif|webp);base64,/;
2905
+ if (!base64Regex.test(str)) {
2906
+ return false;
2907
+ }
2908
+ try {
2909
+ const base64Data = str.split(",")[1];
2910
+ return !!base64Data && atob(base64Data).length > 0;
2911
+ } catch (error) {
2912
+ return false;
2913
+ }
2914
+ };
2915
+ var checkIsImageLink = (url) => {
2916
+ const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
2917
+ return imageExtensions.test(url) || isBase64Image(url);
2918
+ };
2919
+ var formatFileSize = (size) => {
2920
+ if (size < 1024) return `${size} B`;
2921
+ const i = Math.floor(Math.log(size) / Math.log(1024));
2922
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
2923
+ return `${(size / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
2924
+ };
2925
+ var getSubdomain = (url = window.location.href) => {
2926
+ const parts = url?.split(".");
2927
+ if (parts.length > 2) {
2928
+ return parts[0].replace("https://", "").replace("http://", "");
2929
+ }
2930
+ return null;
2931
+ };
2932
+ var resequence = (arr, start, end) => {
2933
+ if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
2934
+ return [];
2935
+ }
2936
+ const [element] = arr.splice(start, 1);
2937
+ arr.splice(end, 0, element);
2938
+ return arr.slice(Math.min(start, end), Math.max(start, end) + 1);
2939
+ };
2940
+ var getOffSet = (arr, start, end) => {
2941
+ if (start < 0 || start >= arr.length || end < 0 || end >= arr.length) {
2942
+ return 0;
2943
+ }
2944
+ if (start > end) {
2945
+ return end;
2946
+ }
2947
+ return arr.slice(0, start).length;
2948
+ };
2949
+ var copyTextToClipboard = async (text) => {
2950
+ if ("clipboard" in navigator) {
2951
+ return await navigator.clipboard.writeText(text);
2952
+ } else {
2953
+ const textArea = document.createElement("textarea");
2954
+ textArea.value = text;
2955
+ textArea.style.position = "fixed";
2956
+ document.body.appendChild(textArea);
2957
+ textArea.focus();
2958
+ textArea.select();
2959
+ try {
2960
+ document.execCommand("copy");
2961
+ } finally {
2962
+ document.body.removeChild(textArea);
2963
+ }
2964
+ }
2965
+ };
2175
2966
  var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2176
2967
  if (!originalRequest.data) return originalRequest.data;
2177
2968
  if (typeof originalRequest.data === "string") {
@@ -2191,6 +2982,41 @@ var updateTokenParamInOriginalRequest = (originalRequest, newAccessToken) => {
2191
2982
  }
2192
2983
  return originalRequest.data;
2193
2984
  };
2985
+ var isObjectEmpty = (obj) => {
2986
+ return Object.keys(obj).length === 0;
2987
+ };
2988
+ var useField = (props) => {
2989
+ const [invisible, setInvisible] = useState(true);
2990
+ const [required, setRequired] = useState(false);
2991
+ const [readonly, setReadOnly] = useState(false);
2992
+ const {
2993
+ invisible: inv,
2994
+ required: req,
2995
+ readonly: rea,
2996
+ onchangeData,
2997
+ rootField,
2998
+ index,
2999
+ name
3000
+ } = props;
3001
+ const nameField = rootField ? `${rootField?.name}.${index}.${name}` : null;
3002
+ useEffect(() => {
3003
+ if (onchangeData && Object.keys(onchangeData).length > 0) {
3004
+ setRequired(
3005
+ typeof req === "object" ? matchDomains(onchangeData, req) : checkDomain(onchangeData, req)
3006
+ );
3007
+ setInvisible(matchDomains(onchangeData, inv));
3008
+ setReadOnly(
3009
+ typeof req === "object" ? matchDomains(onchangeData, rea) : checkDomain(onchangeData, rea)
3010
+ );
3011
+ }
3012
+ }, [onchangeData]);
3013
+ return {
3014
+ invisible,
3015
+ required,
3016
+ readonly,
3017
+ nameField
3018
+ };
3019
+ };
2194
3020
 
2195
3021
  // src/utils/storage/local-storage.ts
2196
3022
  var localStorageUtils = () => {
@@ -2232,9 +3058,9 @@ var sessionStorageUtils = () => {
2232
3058
  // src/configs/axios-client.ts
2233
3059
  var axiosClient = {
2234
3060
  init(config) {
2235
- const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
2236
- const sessionStorage2 = config?.sessionStorageUtils ?? sessionStorageUtils();
2237
- const db = config?.db;
3061
+ const localStorage2 = config.localStorageUtils ?? localStorageUtils();
3062
+ const sessionStorage2 = config.sessionStorageUtils ?? sessionStorageUtils();
3063
+ const db = config.db;
2238
3064
  let isRefreshing = false;
2239
3065
  let failedQueue = [];
2240
3066
  const processQueue = (error, token = null) => {
@@ -2253,19 +3079,16 @@ var axiosClient = {
2253
3079
  timeout: 5e4,
2254
3080
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2255
3081
  });
2256
- instance.interceptors.request.use(
2257
- async (config2) => {
2258
- const useRefreshToken = config2.useRefreshToken;
2259
- const token = useRefreshToken ? await localStorage2.getRefreshToken() : await localStorage2.getAccessToken();
2260
- if (token) {
2261
- config2.headers["Authorization"] = "Bearer " + token;
2262
- }
2263
- return config2;
2264
- },
2265
- (error) => {
2266
- Promise.reject(error);
2267
- }
2268
- );
3082
+ instance.interceptors.request.use(async (config2) => {
3083
+ const { useRefreshToken, useActionToken, actionToken } = config2;
3084
+ if (useActionToken && actionToken) {
3085
+ config2.headers["Action-Token"] = actionToken;
3086
+ }
3087
+ const getToken = useRefreshToken ? localStorage2.getRefreshToken : localStorage2.getAccessToken;
3088
+ const token = await getToken?.();
3089
+ if (token) config2.headers["Authorization"] = `Bearer ${token}`;
3090
+ return config2;
3091
+ }, Promise.reject);
2269
3092
  instance.interceptors.response.use(
2270
3093
  (response) => {
2271
3094
  return handleResponse(response);
@@ -2423,6 +3246,7 @@ var breadcrumbsSlice = createSlice({
2423
3246
  }
2424
3247
  });
2425
3248
  var { setBreadCrumbs } = breadcrumbsSlice.actions;
3249
+ var selectBreadCrumbs = (state) => state.breadcrumbs;
2426
3250
  var breadcrums_slice_default = breadcrumbsSlice.reducer;
2427
3251
 
2428
3252
  // src/store/reducers/env-slice/index.ts
@@ -2491,6 +3315,7 @@ var {
2491
3315
  setConfig,
2492
3316
  setEnvFile
2493
3317
  } = envSlice.actions;
3318
+ var selectEnv = (state) => state.env;
2494
3319
  var env_slice_default = envSlice.reducer;
2495
3320
 
2496
3321
  // src/store/reducers/excel-slice/index.ts
@@ -2535,6 +3360,7 @@ var {
2535
3360
  setSelectedFile,
2536
3361
  setErrorData
2537
3362
  } = excelSlice.actions;
3363
+ var selectExcel = (state) => state.excel;
2538
3364
  var excel_slice_default = excelSlice.reducer;
2539
3365
 
2540
3366
  // src/store/reducers/form-slice/index.ts
@@ -2584,6 +3410,7 @@ var {
2584
3410
  setListSubject,
2585
3411
  setDataUser
2586
3412
  } = formSlice.actions;
3413
+ var selectForm = (state) => state.form;
2587
3414
  var form_slice_default = formSlice.reducer;
2588
3415
 
2589
3416
  // src/store/reducers/header-slice/index.ts
@@ -2603,6 +3430,7 @@ var headerSlice = createSlice5({
2603
3430
  }
2604
3431
  });
2605
3432
  var { setAllowedCompanyIds, setHeader } = headerSlice.actions;
3433
+ var selectHeader = (state) => state.header;
2606
3434
  var header_slice_default = headerSlice.reducer;
2607
3435
 
2608
3436
  // src/store/reducers/list-slice/index.ts
@@ -2668,6 +3496,7 @@ var {
2668
3496
  setTransferDetail,
2669
3497
  setDomainTable
2670
3498
  } = listSlice.actions;
3499
+ var selectList = (state) => state.list;
2671
3500
  var list_slice_default = listSlice.reducer;
2672
3501
 
2673
3502
  // src/store/reducers/login-slice/index.ts
@@ -2693,6 +3522,7 @@ var loginSlice = createSlice7({
2693
3522
  }
2694
3523
  });
2695
3524
  var { setDb, setRedirectTo, setForgotPasswordUrl } = loginSlice.actions;
3525
+ var selectLogin = (state) => state.login;
2696
3526
  var login_slice_default = loginSlice.reducer;
2697
3527
 
2698
3528
  // src/store/reducers/navbar-slice/index.ts
@@ -2722,6 +3552,7 @@ var navbarSlice = createSlice8({
2722
3552
  }
2723
3553
  });
2724
3554
  var { setMenuFocus, setMenuFocusAction, setNavbarWidth, setMenuList } = navbarSlice.actions;
3555
+ var selectNavbar = (state) => state.navbar;
2725
3556
  var navbar_slice_default = navbarSlice.reducer;
2726
3557
 
2727
3558
  // src/store/reducers/profile-slice/index.ts
@@ -2739,6 +3570,7 @@ var profileSlice = createSlice9({
2739
3570
  }
2740
3571
  });
2741
3572
  var { setProfile } = profileSlice.actions;
3573
+ var selectProfile = (state) => state.profile;
2742
3574
  var profile_slice_default = profileSlice.reducer;
2743
3575
 
2744
3576
  // src/store/reducers/search-slice/index.ts
@@ -2825,6 +3657,8 @@ var {
2825
3657
  setGroupBy,
2826
3658
  clearSearchMap
2827
3659
  } = searchSlice.actions;
3660
+ var selectSearch = (state) => state.search;
3661
+ var selectSearchMap = (state) => state.search.searchMap;
2828
3662
  var search_slice_default = searchSlice.reducer;
2829
3663
 
2830
3664
  // src/store/store.ts
@@ -3019,77 +3853,101 @@ var envStore = configureStore({
3019
3853
  })
3020
3854
  });
3021
3855
 
3856
+ // src/store/index.ts
3857
+ var useAppDispatch = useDispatch;
3858
+ var useAppSelector = useSelector;
3859
+
3022
3860
  // src/environment/EnvStore.ts
3023
- function createEnvStore(store, localStorageUtil, sessionStorageUtil) {
3024
- const getEnvState = () => store.getState().env;
3025
- const setupEnvConfig = () => {
3026
- const env2 = getEnvState();
3027
- return {
3028
- baseUrl: env2?.baseUrl,
3029
- requests: env2?.requests,
3030
- context: env2?.context,
3031
- defaultCompany: env2?.defaultCompany,
3032
- config: env2?.config,
3033
- companies: env2?.companies || [],
3034
- user: env2?.user,
3035
- db: env2?.db,
3036
- refreshTokenEndpoint: env2?.refreshTokenEndpoint
3037
- };
3038
- };
3039
- const setupEnv = (envConfig) => {
3040
- const dispatch = store.dispatch;
3041
- const updatedEnv = {
3861
+ var EnvStore = class {
3862
+ envStore;
3863
+ baseUrl;
3864
+ requests;
3865
+ context;
3866
+ defaultCompany;
3867
+ config;
3868
+ companies;
3869
+ user;
3870
+ db;
3871
+ localStorageUtils;
3872
+ sessionStorageUtils;
3873
+ refreshTokenEndpoint;
3874
+ constructor(envStore2, localStorageUtils2, sessionStorageUtils2) {
3875
+ this.envStore = envStore2;
3876
+ this.localStorageUtils = localStorageUtils2;
3877
+ this.sessionStorageUtils = sessionStorageUtils2;
3878
+ this.setup();
3879
+ }
3880
+ setup() {
3881
+ const env2 = this.envStore.getState().env;
3882
+ this.baseUrl = env2?.baseUrl;
3883
+ this.requests = env2?.requests;
3884
+ this.context = env2?.context;
3885
+ this.defaultCompany = env2?.defaultCompany;
3886
+ this.config = env2?.config;
3887
+ this.companies = env2?.companies || [];
3888
+ this.user = env2?.user;
3889
+ this.db = env2?.db;
3890
+ this.refreshTokenEndpoint = env2?.refreshTokenEndpoint;
3891
+ }
3892
+ setupEnv(envConfig) {
3893
+ const dispatch = this.envStore.dispatch;
3894
+ const env2 = {
3042
3895
  ...envConfig,
3043
- localStorageUtils: localStorageUtil,
3044
- sessionStorageUtils: sessionStorageUtil
3896
+ localStorageUtils: this.localStorageUtils,
3897
+ sessionStorageUtils: this.sessionStorageUtils
3045
3898
  };
3046
- const requests = axiosClient.init(updatedEnv);
3047
- dispatch(setEnv({ ...updatedEnv, requests }));
3048
- return setupEnvConfig();
3049
- };
3050
- const setupUid = (uid) => {
3051
- store.dispatch(setUid(uid));
3052
- return setupEnvConfig();
3053
- };
3054
- const setupLang = (lang) => {
3055
- store.dispatch(setLang(lang));
3056
- return setupEnvConfig();
3057
- };
3058
- const setupAllowCompanies = (allowCompanies) => {
3059
- store.dispatch(setAllowCompanies(allowCompanies));
3060
- return setupEnvConfig();
3061
- };
3062
- const setupCompanies = (companies) => {
3063
- store.dispatch(setCompanies(companies));
3064
- return setupEnvConfig();
3065
- };
3066
- const setupDefaultCompany = (company) => {
3067
- store.dispatch(setDefaultCompany(company));
3068
- return setupEnvConfig();
3069
- };
3070
- const setUserInfo = (userInfo) => {
3071
- store.dispatch(setUser(userInfo));
3072
- return setupEnvConfig();
3073
- };
3074
- return {
3075
- getEnvConfig: setupEnvConfig,
3076
- setupEnv,
3077
- setUid: setupUid,
3078
- setLang: setupLang,
3079
- setAllowCompanies: setupAllowCompanies,
3080
- setCompanies: setupCompanies,
3081
- setDefaultCompany: setupDefaultCompany,
3082
- setUserInfo
3083
- };
3084
- }
3899
+ const requests = axiosClient.init(env2);
3900
+ dispatch(setEnv({ ...env2, requests }));
3901
+ this.setup();
3902
+ }
3903
+ setUid(uid) {
3904
+ const dispatch = this.envStore.dispatch;
3905
+ dispatch(setUid(uid));
3906
+ this.setup();
3907
+ }
3908
+ setLang(lang) {
3909
+ const dispatch = this.envStore.dispatch;
3910
+ dispatch(setLang(lang));
3911
+ this.setup();
3912
+ }
3913
+ setAllowCompanies(allowCompanies) {
3914
+ const dispatch = this.envStore.dispatch;
3915
+ dispatch(setAllowCompanies(allowCompanies));
3916
+ this.setup();
3917
+ }
3918
+ setCompanies(companies) {
3919
+ const dispatch = this.envStore.dispatch;
3920
+ dispatch(setCompanies(companies));
3921
+ this.setup();
3922
+ }
3923
+ setDefaultCompany(company) {
3924
+ const dispatch = this.envStore.dispatch;
3925
+ dispatch(setDefaultCompany(company));
3926
+ this.setup();
3927
+ }
3928
+ setUserInfo(userInfo) {
3929
+ const dispatch = this.envStore.dispatch;
3930
+ dispatch(setUser(userInfo));
3931
+ this.setup();
3932
+ }
3933
+ };
3085
3934
  var env = null;
3935
+ function initEnv({
3936
+ localStorageUtils: localStorageUtils2,
3937
+ sessionStorageUtils: sessionStorageUtils2
3938
+ }) {
3939
+ env = new EnvStore(envStore, localStorageUtils2, sessionStorageUtils2);
3940
+ return env;
3941
+ }
3086
3942
  function getEnv() {
3087
- if (!env) {
3088
- env = createEnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3089
- }
3943
+ if (!env)
3944
+ env = new EnvStore(envStore, localStorageUtils(), sessionStorageUtils());
3090
3945
  return env;
3091
3946
  }
3092
3947
 
3948
+ // src/hooks/auth/use-forgot-password.ts
3949
+ import { useMutation } from "@tanstack/react-query";
3950
+
3093
3951
  // src/services/action-service/index.ts
3094
3952
  var ActionService = {
3095
3953
  // Load Action
@@ -3352,6 +4210,20 @@ var AuthService = {
3352
4210
  }
3353
4211
  });
3354
4212
  },
4213
+ async isValidActionToken(actionToken, path) {
4214
+ const env2 = getEnv();
4215
+ return env2?.requests?.post(
4216
+ path,
4217
+ {},
4218
+ {
4219
+ headers: {
4220
+ "Content-Type": "application/json"
4221
+ },
4222
+ useActionToken: true,
4223
+ actionToken
4224
+ }
4225
+ );
4226
+ },
3355
4227
  async loginSocial({
3356
4228
  db,
3357
4229
  state,
@@ -4116,7 +4988,7 @@ var model_service_default = ModelService;
4116
4988
  var UserService = {
4117
4989
  async getProfile(path) {
4118
4990
  const env2 = getEnv();
4119
- return env2.requests.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4991
+ return env2?.requests?.get(path ?? "/userinfo" /* PROFILE_PATH */, {
4120
4992
  headers: {
4121
4993
  "Content-Type": "application/x-www-form-urlencoded"
4122
4994
  }
@@ -4435,8 +5307,8 @@ var ViewService = {
4435
5307
  },
4436
5308
  async getVersion() {
4437
5309
  const env2 = getEnv();
4438
- console.log("env?.requests", env2, env2?.requests);
4439
- return env2?.requests?.get("", {
5310
+ console.log("env", env2);
5311
+ return env2?.requests.get("", {
4440
5312
  headers: {
4441
5313
  "Content-Type": "application/json"
4442
5314
  }
@@ -4753,19 +5625,33 @@ var useGetAccessByCode = () => {
4753
5625
  };
4754
5626
  var use_get_access_by_code_default = useGetAccessByCode;
4755
5627
 
4756
- // src/hooks/company/use-get-company-info.ts
5628
+ // src/hooks/auth/use-validate-action-token.ts
4757
5629
  import { useMutation as useMutation12 } from "@tanstack/react-query";
4758
- var useGetCompanyInfo = () => {
5630
+ var useValidateActionToken = () => {
4759
5631
  return useMutation12({
5632
+ mutationFn: ({
5633
+ actionToken,
5634
+ path
5635
+ }) => {
5636
+ return auth_service_default.isValidActionToken(actionToken, path);
5637
+ }
5638
+ });
5639
+ };
5640
+ var use_validate_action_token_default = useValidateActionToken;
5641
+
5642
+ // src/hooks/company/use-get-company-info.ts
5643
+ import { useMutation as useMutation13 } from "@tanstack/react-query";
5644
+ var useGetCompanyInfo = () => {
5645
+ return useMutation13({
4760
5646
  mutationFn: (id) => company_service_default.getInfoCompany(id)
4761
5647
  });
4762
5648
  };
4763
5649
  var use_get_company_info_default = useGetCompanyInfo;
4764
5650
 
4765
5651
  // src/hooks/company/use-get-current-company.ts
4766
- import { useMutation as useMutation13 } from "@tanstack/react-query";
5652
+ import { useMutation as useMutation14 } from "@tanstack/react-query";
4767
5653
  var useGetCurrentCompany = () => {
4768
- return useMutation13({
5654
+ return useMutation14({
4769
5655
  mutationFn: () => company_service_default.getCurrentCompany()
4770
5656
  });
4771
5657
  };
@@ -4792,9 +5678,9 @@ var useGetListCompany = (companyIDs = []) => {
4792
5678
  var use_get_list_company_default = useGetListCompany;
4793
5679
 
4794
5680
  // src/hooks/excel/use-export-excel.ts
4795
- import { useMutation as useMutation14 } from "@tanstack/react-query";
5681
+ import { useMutation as useMutation15 } from "@tanstack/react-query";
4796
5682
  var useExportExcel = () => {
4797
- return useMutation14({
5683
+ return useMutation15({
4798
5684
  mutationFn: ({
4799
5685
  model,
4800
5686
  domain,
@@ -4819,9 +5705,9 @@ var useExportExcel = () => {
4819
5705
  var use_export_excel_default = useExportExcel;
4820
5706
 
4821
5707
  // src/hooks/excel/use-get-field-export.ts
4822
- import { useMutation as useMutation15 } from "@tanstack/react-query";
5708
+ import { useMutation as useMutation16 } from "@tanstack/react-query";
4823
5709
  var useGetFieldExport = () => {
4824
- return useMutation15({
5710
+ return useMutation16({
4825
5711
  mutationFn: ({
4826
5712
  ids,
4827
5713
  model,
@@ -4868,9 +5754,9 @@ var useGetFileExcel = ({ model }) => {
4868
5754
  var use_get_file_excel_default = useGetFileExcel;
4869
5755
 
4870
5756
  // src/hooks/excel/use-parse-preview.ts
4871
- import { useMutation as useMutation16 } from "@tanstack/react-query";
5757
+ import { useMutation as useMutation17 } from "@tanstack/react-query";
4872
5758
  var useParsePreview = () => {
4873
- return useMutation16({
5759
+ return useMutation17({
4874
5760
  mutationFn: ({
4875
5761
  id,
4876
5762
  selectedSheet,
@@ -4887,9 +5773,9 @@ var useParsePreview = () => {
4887
5773
  var use_parse_preview_default = useParsePreview;
4888
5774
 
4889
5775
  // src/hooks/excel/use-upload-file.ts
4890
- import { useMutation as useMutation17 } from "@tanstack/react-query";
5776
+ import { useMutation as useMutation18 } from "@tanstack/react-query";
4891
5777
  var useUploadFile = () => {
4892
- return useMutation17({
5778
+ return useMutation18({
4893
5779
  mutationFn: ({ formData }) => excel_service_default.uploadFile({
4894
5780
  formData
4895
5781
  })
@@ -4898,9 +5784,9 @@ var useUploadFile = () => {
4898
5784
  var use_upload_file_default = useUploadFile;
4899
5785
 
4900
5786
  // src/hooks/excel/use-upload-id-file.ts
4901
- import { useMutation as useMutation18 } from "@tanstack/react-query";
5787
+ import { useMutation as useMutation19 } from "@tanstack/react-query";
4902
5788
  var useUploadIdFile = () => {
4903
- return useMutation18({
5789
+ return useMutation19({
4904
5790
  mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
4905
5791
  formData
4906
5792
  })
@@ -4909,9 +5795,9 @@ var useUploadIdFile = () => {
4909
5795
  var use_upload_id_file_default = useUploadIdFile;
4910
5796
 
4911
5797
  // src/hooks/excel/uss-execute-import.ts
4912
- import { useMutation as useMutation19 } from "@tanstack/react-query";
5798
+ import { useMutation as useMutation20 } from "@tanstack/react-query";
4913
5799
  var useExecuteImport = () => {
4914
- return useMutation19({
5800
+ return useMutation20({
4915
5801
  mutationFn: ({
4916
5802
  fields,
4917
5803
  columns,
@@ -4932,9 +5818,9 @@ var useExecuteImport = () => {
4932
5818
  var uss_execute_import_default = useExecuteImport;
4933
5819
 
4934
5820
  // src/hooks/form/use-change-status.ts
4935
- import { useMutation as useMutation20 } from "@tanstack/react-query";
5821
+ import { useMutation as useMutation21 } from "@tanstack/react-query";
4936
5822
  var useChangeStatus = () => {
4937
- return useMutation20({
5823
+ return useMutation21({
4938
5824
  mutationFn: ({ data }) => {
4939
5825
  return form_service_default.changeStatus({
4940
5826
  data
@@ -4945,9 +5831,9 @@ var useChangeStatus = () => {
4945
5831
  var use_change_status_default = useChangeStatus;
4946
5832
 
4947
5833
  // src/hooks/form/use-delete-comment.ts
4948
- import { useMutation as useMutation21 } from "@tanstack/react-query";
5834
+ import { useMutation as useMutation22 } from "@tanstack/react-query";
4949
5835
  var useDeleteComment = () => {
4950
- return useMutation21({
5836
+ return useMutation22({
4951
5837
  mutationFn: ({ data }) => form_service_default.deleteComment({
4952
5838
  data
4953
5839
  })
@@ -5012,9 +5898,9 @@ var useGetImage = ({
5012
5898
  var use_get_image_default = useGetImage;
5013
5899
 
5014
5900
  // src/hooks/form/use-send-comment.ts
5015
- import { useMutation as useMutation22 } from "@tanstack/react-query";
5901
+ import { useMutation as useMutation23 } from "@tanstack/react-query";
5016
5902
  var useSendComment = () => {
5017
- return useMutation22({
5903
+ return useMutation23({
5018
5904
  mutationFn: ({ data }) => form_service_default.sentComment({
5019
5905
  data
5020
5906
  })
@@ -5023,9 +5909,9 @@ var useSendComment = () => {
5023
5909
  var use_send_comment_default = useSendComment;
5024
5910
 
5025
5911
  // src/hooks/form/use-upload-image.ts
5026
- import { useMutation as useMutation23 } from "@tanstack/react-query";
5912
+ import { useMutation as useMutation24 } from "@tanstack/react-query";
5027
5913
  var useUploadImage = () => {
5028
- return useMutation23({
5914
+ return useMutation24({
5029
5915
  mutationFn: ({ data }) => form_service_default.uploadImage({
5030
5916
  data
5031
5917
  })
@@ -5034,9 +5920,9 @@ var useUploadImage = () => {
5034
5920
  var use_upload_image_default = useUploadImage;
5035
5921
 
5036
5922
  // src/hooks/model/use-delete.ts
5037
- import { useMutation as useMutation24 } from "@tanstack/react-query";
5923
+ import { useMutation as useMutation25 } from "@tanstack/react-query";
5038
5924
  var useDelete = () => {
5039
- return useMutation24({
5925
+ return useMutation25({
5040
5926
  mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
5041
5927
  });
5042
5928
  };
@@ -5090,9 +5976,9 @@ var useGetCurrency = () => {
5090
5976
  var use_get_currency_default = useGetCurrency;
5091
5977
 
5092
5978
  // src/hooks/model/use-get-detail.ts
5093
- import { useMutation as useMutation25 } from "@tanstack/react-query";
5979
+ import { useMutation as useMutation26 } from "@tanstack/react-query";
5094
5980
  var useGetDetail = () => {
5095
- return useMutation25({
5981
+ return useMutation26({
5096
5982
  mutationFn: ({
5097
5983
  model,
5098
5984
  ids,
@@ -5285,9 +6171,9 @@ var useOdooDataTransform = () => {
5285
6171
  var use_odoo_data_transform_default = useOdooDataTransform;
5286
6172
 
5287
6173
  // src/hooks/model/use-onchange-form.ts
5288
- import { useMutation as useMutation26 } from "@tanstack/react-query";
6174
+ import { useMutation as useMutation27 } from "@tanstack/react-query";
5289
6175
  var useOnChangeForm = () => {
5290
- return useMutation26({
6176
+ return useMutation27({
5291
6177
  mutationFn: ({
5292
6178
  ids,
5293
6179
  model,
@@ -5308,9 +6194,9 @@ var useOnChangeForm = () => {
5308
6194
  var use_onchange_form_default = useOnChangeForm;
5309
6195
 
5310
6196
  // src/hooks/model/use-save.ts
5311
- import { useMutation as useMutation27 } from "@tanstack/react-query";
6197
+ import { useMutation as useMutation28 } from "@tanstack/react-query";
5312
6198
  var useSave = () => {
5313
- return useMutation27({
6199
+ return useMutation28({
5314
6200
  mutationFn: ({
5315
6201
  ids,
5316
6202
  model,
@@ -5324,18 +6210,18 @@ var useSave = () => {
5324
6210
  var use_save_default = useSave;
5325
6211
 
5326
6212
  // src/hooks/user/use-get-profile.ts
5327
- import { useMutation as useMutation28 } from "@tanstack/react-query";
6213
+ import { useMutation as useMutation29 } from "@tanstack/react-query";
5328
6214
  var useGetProfile = (path) => {
5329
- return useMutation28({
6215
+ return useMutation29({
5330
6216
  mutationFn: () => user_service_default.getProfile(path)
5331
6217
  });
5332
6218
  };
5333
6219
  var use_get_profile_default = useGetProfile;
5334
6220
 
5335
6221
  // src/hooks/user/use-get-user.ts
5336
- import { useMutation as useMutation29 } from "@tanstack/react-query";
6222
+ import { useMutation as useMutation30 } from "@tanstack/react-query";
5337
6223
  var useGetUser = () => {
5338
- return useMutation29({
6224
+ return useMutation30({
5339
6225
  mutationFn: ({ id, context }) => user_service_default.getUser({
5340
6226
  id,
5341
6227
  context
@@ -5345,9 +6231,9 @@ var useGetUser = () => {
5345
6231
  var use_get_user_default = useGetUser;
5346
6232
 
5347
6233
  // src/hooks/user/use-switch-locale.ts
5348
- import { useMutation as useMutation30 } from "@tanstack/react-query";
6234
+ import { useMutation as useMutation31 } from "@tanstack/react-query";
5349
6235
  var useSwitchLocale = () => {
5350
- return useMutation30({
6236
+ return useMutation31({
5351
6237
  mutationFn: ({ data }) => {
5352
6238
  return user_service_default.switchUserLocale({
5353
6239
  id: data.id,
@@ -5359,9 +6245,9 @@ var useSwitchLocale = () => {
5359
6245
  var use_switch_locale_default = useSwitchLocale;
5360
6246
 
5361
6247
  // src/hooks/view/use-button.ts
5362
- import { useMutation as useMutation31 } from "@tanstack/react-query";
6248
+ import { useMutation as useMutation32 } from "@tanstack/react-query";
5363
6249
  var useButton = () => {
5364
- return useMutation31({
6250
+ return useMutation32({
5365
6251
  mutationFn: ({
5366
6252
  model,
5367
6253
  ids,
@@ -5381,9 +6267,9 @@ var useButton = () => {
5381
6267
  var use_button_default = useButton;
5382
6268
 
5383
6269
  // src/hooks/view/use-duplicate-record.ts
5384
- import { useMutation as useMutation32 } from "@tanstack/react-query";
6270
+ import { useMutation as useMutation33 } from "@tanstack/react-query";
5385
6271
  var useDuplicateRecord = () => {
5386
- return useMutation32({
6272
+ return useMutation33({
5387
6273
  mutationFn: ({
5388
6274
  id,
5389
6275
  model,
@@ -5509,9 +6395,9 @@ var useGetMenu = (context, enabled) => {
5509
6395
  var use_get_menu_default = useGetMenu;
5510
6396
 
5511
6397
  // src/hooks/view/use-get-print-report.ts
5512
- import { useMutation as useMutation33 } from "@tanstack/react-query";
6398
+ import { useMutation as useMutation34 } from "@tanstack/react-query";
5513
6399
  var useGetPrintReport = () => {
5514
- return useMutation33({
6400
+ return useMutation34({
5515
6401
  mutationFn: ({ id }) => action_service_default.getPrintReportName({
5516
6402
  id
5517
6403
  })
@@ -5575,9 +6461,9 @@ var useGetView = (viewParams, actData) => {
5575
6461
  var use_get_view_default = useGetView;
5576
6462
 
5577
6463
  // src/hooks/view/use-load-action.ts
5578
- import { useMutation as useMutation34 } from "@tanstack/react-query";
6464
+ import { useMutation as useMutation35 } from "@tanstack/react-query";
5579
6465
  var useLoadAction = () => {
5580
- return useMutation34({
6466
+ return useMutation35({
5581
6467
  mutationFn: ({
5582
6468
  idAction,
5583
6469
  context
@@ -5603,9 +6489,9 @@ var useLoadMessage = () => {
5603
6489
  var use_load_message_default = useLoadMessage;
5604
6490
 
5605
6491
  // src/hooks/view/use-print.ts
5606
- import { useMutation as useMutation35 } from "@tanstack/react-query";
6492
+ import { useMutation as useMutation36 } from "@tanstack/react-query";
5607
6493
  var usePrint = () => {
5608
- return useMutation35({
6494
+ return useMutation36({
5609
6495
  mutationFn: ({ id, report, db }) => action_service_default.print({
5610
6496
  id,
5611
6497
  report,
@@ -5616,9 +6502,9 @@ var usePrint = () => {
5616
6502
  var use_print_default = usePrint;
5617
6503
 
5618
6504
  // src/hooks/view/use-remove-row.ts
5619
- import { useMutation as useMutation36 } from "@tanstack/react-query";
6505
+ import { useMutation as useMutation37 } from "@tanstack/react-query";
5620
6506
  var useRemoveRow = () => {
5621
- return useMutation36({
6507
+ return useMutation37({
5622
6508
  mutationFn: ({
5623
6509
  model,
5624
6510
  ids,
@@ -5650,9 +6536,9 @@ var useGetResequence = (model, resIds, context, offset) => {
5650
6536
  var use_resequence_default = useGetResequence;
5651
6537
 
5652
6538
  // src/hooks/view/use-run-action.ts
5653
- import { useMutation as useMutation37 } from "@tanstack/react-query";
6539
+ import { useMutation as useMutation38 } from "@tanstack/react-query";
5654
6540
  var useRunAction = () => {
5655
- return useMutation37({
6541
+ return useMutation38({
5656
6542
  mutationFn: ({
5657
6543
  idAction,
5658
6544
  context
@@ -5665,9 +6551,9 @@ var useRunAction = () => {
5665
6551
  var use_run_action_default = useRunAction;
5666
6552
 
5667
6553
  // src/hooks/view/use-signin-sso.ts
5668
- import { useMutation as useMutation38 } from "@tanstack/react-query";
6554
+ import { useMutation as useMutation39 } from "@tanstack/react-query";
5669
6555
  var useSignInSSO = () => {
5670
- return useMutation38({
6556
+ return useMutation39({
5671
6557
  mutationFn: ({
5672
6558
  redirect_uri,
5673
6559
  state,
@@ -5688,9 +6574,9 @@ var useSignInSSO = () => {
5688
6574
  var use_signin_sso_default = useSignInSSO;
5689
6575
 
5690
6576
  // src/hooks/view/use-verify-2FA.ts
5691
- import { useMutation as useMutation39 } from "@tanstack/react-query";
6577
+ import { useMutation as useMutation40 } from "@tanstack/react-query";
5692
6578
  var useVerify2FA = () => {
5693
- return useMutation39({
6579
+ return useMutation40({
5694
6580
  mutationFn: ({
5695
6581
  method,
5696
6582
  with_context,
@@ -5711,9 +6597,9 @@ var useVerify2FA = () => {
5711
6597
  var use_verify_2FA_default = useVerify2FA;
5712
6598
 
5713
6599
  // src/hooks/view/uset-get-2FA-method.ts
5714
- import { useMutation as useMutation40 } from "@tanstack/react-query";
6600
+ import { useMutation as useMutation41 } from "@tanstack/react-query";
5715
6601
  var useGet2FAMethods = () => {
5716
- return useMutation40({
6602
+ return useMutation41({
5717
6603
  mutationFn: ({
5718
6604
  method,
5719
6605
  with_context
@@ -5728,9 +6614,9 @@ var useGet2FAMethods = () => {
5728
6614
  var uset_get_2FA_method_default = useGet2FAMethods;
5729
6615
 
5730
6616
  // src/hooks/view/use-get-fields-view-security.ts
5731
- import { useMutation as useMutation41 } from "@tanstack/react-query";
6617
+ import { useMutation as useMutation42 } from "@tanstack/react-query";
5732
6618
  var useGetFieldsViewSecurity = () => {
5733
- return useMutation41({
6619
+ return useMutation42({
5734
6620
  mutationFn: ({
5735
6621
  method,
5736
6622
  token,
@@ -5747,9 +6633,9 @@ var useGetFieldsViewSecurity = () => {
5747
6633
  var use_get_fields_view_security_default = useGetFieldsViewSecurity;
5748
6634
 
5749
6635
  // src/hooks/view/use-grant-access.ts
5750
- import { useMutation as useMutation42 } from "@tanstack/react-query";
6636
+ import { useMutation as useMutation43 } from "@tanstack/react-query";
5751
6637
  var useGrantAccess = () => {
5752
- return useMutation42({
6638
+ return useMutation43({
5753
6639
  mutationFn: ({
5754
6640
  redirect_uri,
5755
6641
  state,
@@ -5768,9 +6654,9 @@ var useGrantAccess = () => {
5768
6654
  var use_grant_access_default = useGrantAccess;
5769
6655
 
5770
6656
  // src/hooks/view/use-remove-totp-setup.ts
5771
- import { useMutation as useMutation43 } from "@tanstack/react-query";
6657
+ import { useMutation as useMutation44 } from "@tanstack/react-query";
5772
6658
  var useRemoveTotpSetup = () => {
5773
- return useMutation43({
6659
+ return useMutation44({
5774
6660
  mutationFn: ({ method, token }) => {
5775
6661
  return view_service_default.removeTotpSetUp({
5776
6662
  method,
@@ -5782,9 +6668,9 @@ var useRemoveTotpSetup = () => {
5782
6668
  var use_remove_totp_setup_default = useRemoveTotpSetup;
5783
6669
 
5784
6670
  // src/hooks/view/use-request-setup-totp.ts
5785
- import { useMutation as useMutation44 } from "@tanstack/react-query";
6671
+ import { useMutation as useMutation45 } from "@tanstack/react-query";
5786
6672
  var useRequestSetupTotp = () => {
5787
- return useMutation44({
6673
+ return useMutation45({
5788
6674
  mutationFn: ({ method, token }) => {
5789
6675
  return view_service_default.requestSetupTotp({
5790
6676
  method,
@@ -5796,9 +6682,9 @@ var useRequestSetupTotp = () => {
5796
6682
  var use_request_setup_totp_default = useRequestSetupTotp;
5797
6683
 
5798
6684
  // src/hooks/view/use-settings-web-read-2fa.ts
5799
- import { useMutation as useMutation45 } from "@tanstack/react-query";
6685
+ import { useMutation as useMutation46 } from "@tanstack/react-query";
5800
6686
  var useSettingsWebRead2fa = () => {
5801
- return useMutation45({
6687
+ return useMutation46({
5802
6688
  mutationFn: ({
5803
6689
  method,
5804
6690
  token,
@@ -5817,9 +6703,9 @@ var useSettingsWebRead2fa = () => {
5817
6703
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
5818
6704
 
5819
6705
  // src/hooks/view/use-verify-totp.ts
5820
- import { useMutation as useMutation46 } from "@tanstack/react-query";
6706
+ import { useMutation as useMutation47 } from "@tanstack/react-query";
5821
6707
  var useVerifyTotp = () => {
5822
- return useMutation46({
6708
+ return useMutation47({
5823
6709
  mutationFn: ({
5824
6710
  method,
5825
6711
  action_token,
@@ -5834,7 +6720,211 @@ var useVerifyTotp = () => {
5834
6720
  });
5835
6721
  };
5836
6722
  var use_verify_totp_default = useVerifyTotp;
6723
+
6724
+ // src/provider/react-query-provider.tsx
6725
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
6726
+ import { jsx } from "react/jsx-runtime";
6727
+ var ReactQueryProvider = ({ children }) => {
6728
+ const queryClient = new QueryClient({
6729
+ defaultOptions: {
6730
+ queries: {
6731
+ // placeholderData: keepPreviousData,
6732
+ refetchOnWindowFocus: false,
6733
+ refetchOnMount: false,
6734
+ refetchOnReconnect: false,
6735
+ retry: false
6736
+ }
6737
+ }
6738
+ });
6739
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
6740
+ };
6741
+
6742
+ // src/provider/redux-provider.tsx
6743
+ import { Provider } from "react-redux";
6744
+ import { jsx as jsx2 } from "react/jsx-runtime";
6745
+ var ReduxProvider = ({ children }) => {
6746
+ return /* @__PURE__ */ jsx2(Provider, { store: envStore, children });
6747
+ };
6748
+
6749
+ // src/provider/main-provider.tsx
6750
+ import { jsx as jsx3 } from "react/jsx-runtime";
6751
+ var MainProvider = ({ children }) => {
6752
+ return /* @__PURE__ */ jsx3(ReduxProvider, { children: /* @__PURE__ */ jsx3(ReactQueryProvider, { children }) });
6753
+ };
6754
+
6755
+ // src/provider/version-gate-provider.tsx
6756
+ import { useEffect as useEffect2, useState as useState2 } from "react";
6757
+ import { useQueryClient } from "@tanstack/react-query";
6758
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
6759
+ var VersionGate = ({ children }) => {
6760
+ const queryClient = useQueryClient();
6761
+ const [ready, setReady] = useState2(false);
6762
+ useEffect2(() => {
6763
+ const clearVersion = () => {
6764
+ queryClient.clear();
6765
+ localStorage.removeItem("__api_version__");
6766
+ };
6767
+ const validateVersion = async () => {
6768
+ const serverVersion = await view_service_default.getVersion();
6769
+ const cached = localStorage.getItem("__api_version__");
6770
+ if (cached !== serverVersion?.api_version) {
6771
+ clearVersion();
6772
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
6773
+ } else {
6774
+ console.log("Api version:", serverVersion?.api_version);
6775
+ }
6776
+ setReady(true);
6777
+ };
6778
+ validateVersion();
6779
+ if (typeof window !== "undefined") {
6780
+ const onKey = (e) => {
6781
+ const key = e.key.toLowerCase();
6782
+ const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
6783
+ if (isHardRefresh) clearVersion();
6784
+ };
6785
+ window.addEventListener("keydown", onKey);
6786
+ return () => window.removeEventListener("keydown", onKey);
6787
+ }
6788
+ }, [queryClient]);
6789
+ return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
6790
+ };
5837
6791
  export {
6792
+ action_service_default as ActionService,
6793
+ auth_service_default as AuthService,
6794
+ company_service_default as CompanyService,
6795
+ ComponentType,
6796
+ EnvStore,
6797
+ excel_service_default as ExcelService,
6798
+ FieldTypeConstants,
6799
+ form_service_default as FormService,
6800
+ kanban_service_default as KanbanService,
6801
+ KeyConstants,
6802
+ MainProvider,
6803
+ MethodConstants,
6804
+ MethodType,
6805
+ ModelConstants,
6806
+ model_service_default as ModelService,
6807
+ ReactQueryProvider,
6808
+ SearchType,
6809
+ UriConstants,
6810
+ user_service_default as UserService,
6811
+ VersionGate,
6812
+ view_service_default as ViewService,
6813
+ WIDGETAVATAR,
6814
+ WIDGETCOLOR,
6815
+ WIDGETCURRENCY,
6816
+ WIDGETNOSTRING,
6817
+ WIDGETSTATUS,
6818
+ WesapError,
6819
+ axiosClient,
6820
+ breadcrumbsSlice,
6821
+ checkIsImageLink,
6822
+ clearSearchMap,
6823
+ convertFloatToTime,
6824
+ convertTimeToFloat,
6825
+ copyTextToClipboard,
6826
+ domainHelper,
6827
+ env,
6828
+ envSlice,
6829
+ envStore,
6830
+ evalJSONContext,
6831
+ evalJSONDomain,
6832
+ excelSlice,
6833
+ filterFieldDirty,
6834
+ formSlice,
6835
+ formatCurrency,
6836
+ formatDate,
6837
+ formatFileSize,
6838
+ formatSortingString,
6839
+ formatUrlPath,
6840
+ getEnv,
6841
+ getFieldsOnChange,
6842
+ getOffSet,
6843
+ getSubdomain,
6844
+ handleError,
6845
+ headerSlice,
6846
+ initEnv,
6847
+ isBase64File,
6848
+ isBase64Image,
6849
+ isObjectEmpty,
6850
+ listSlice,
6851
+ loginSlice,
6852
+ mergeObjects,
6853
+ navbarSlice,
6854
+ profileSlice,
6855
+ removeKeyFromSearchMap,
6856
+ removeUndefinedFields,
6857
+ resequence,
6858
+ searchSlice,
6859
+ selectBreadCrumbs,
6860
+ selectEnv,
6861
+ selectExcel,
6862
+ selectForm,
6863
+ selectHeader,
6864
+ selectList,
6865
+ selectLogin,
6866
+ selectNavbar,
6867
+ selectProfile,
6868
+ selectSearch,
6869
+ selectSearchMap,
6870
+ setAllowCompanies,
6871
+ setAllowedCompanyIds,
6872
+ setBreadCrumbs,
6873
+ setCompanies,
6874
+ setConfig,
6875
+ setDataParse,
6876
+ setDataUser,
6877
+ setDb,
6878
+ setDefaultCompany,
6879
+ setDomainTable,
6880
+ setEnv,
6881
+ setEnvFile,
6882
+ setErrorData,
6883
+ setFieldTranslate,
6884
+ setFields,
6885
+ setFilterBy,
6886
+ setFirstDomain,
6887
+ setForgotPasswordUrl,
6888
+ setFormSubmitComponent,
6889
+ setGroupBy,
6890
+ setGroupByDomain,
6891
+ setHeader,
6892
+ setHoveredIndexSearchList,
6893
+ setIdFile,
6894
+ setIndexRowTableModal,
6895
+ setIsFileLoaded,
6896
+ setIsShowModalTranslate,
6897
+ setIsShowingModalDetail,
6898
+ setIsUpdateTableModal,
6899
+ setLang,
6900
+ setListSubject,
6901
+ setLoadingImport,
6902
+ setMenuFocus,
6903
+ setMenuFocusAction,
6904
+ setMenuList,
6905
+ setNavbarWidth,
6906
+ setOrder,
6907
+ setPage,
6908
+ setPageLimit,
6909
+ setProfile,
6910
+ setRedirectTo,
6911
+ setSearchBy,
6912
+ setSearchMap,
6913
+ setSearchString,
6914
+ setSelectedFile,
6915
+ setSelectedRadioKey,
6916
+ setSelectedRowKeys,
6917
+ setSelectedTags,
6918
+ setTransferDetail,
6919
+ setUid,
6920
+ setUser,
6921
+ setViewDataStore,
6922
+ stringToColor,
6923
+ toQueryString,
6924
+ updateSearchMap,
6925
+ updateTokenParamInOriginalRequest,
6926
+ useAppDispatch,
6927
+ useAppSelector,
5838
6928
  use_button_default as useButton,
5839
6929
  use_change_status_default as useChangeStatus,
5840
6930
  use_delete_default as useDelete,
@@ -5842,6 +6932,7 @@ export {
5842
6932
  use_duplicate_record_default as useDuplicateRecord,
5843
6933
  uss_execute_import_default as useExecuteImport,
5844
6934
  use_export_excel_default as useExportExcel,
6935
+ useField,
5845
6936
  use_forgot_password_default as useForgotPassword,
5846
6937
  use_forgotpassword_sso_default as useForgotPasswordSSO,
5847
6938
  uset_get_2FA_method_default as useGet2FAMethods,
@@ -5897,10 +6988,14 @@ export {
5897
6988
  use_settings_web_read_2fa_default as useSettingsWebRead2fa,
5898
6989
  use_signin_sso_default as useSignInSSO,
5899
6990
  use_switch_locale_default as useSwitchLocale,
6991
+ useTabModel,
5900
6992
  use_update_password_default as useUpdatePassword,
5901
6993
  use_upload_file_default as useUploadFile,
5902
6994
  use_upload_id_file_default as useUploadIdFile,
5903
6995
  use_upload_image_default as useUploadImage,
6996
+ use_validate_action_token_default as useValidateActionToken,
5904
6997
  use_verify_2FA_default as useVerify2FA,
5905
- use_verify_totp_default as useVerifyTotp
6998
+ use_verify_totp_default as useVerifyTotp,
6999
+ validateAndParseDate
5906
7000
  };
7001
+ //# sourceMappingURL=index.mjs.map