@fctc/interface-logic 1.8.0 → 1.8.1

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} +1437 -203
  4. package/dist/index.js.map +1 -0
  5. package/dist/{hooks.mjs → index.mjs} +1251 -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,7 @@ 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
+ return env2?.requests.get("", {
4440
5311
  headers: {
4441
5312
  "Content-Type": "application/json"
4442
5313
  }
@@ -4753,19 +5624,33 @@ var useGetAccessByCode = () => {
4753
5624
  };
4754
5625
  var use_get_access_by_code_default = useGetAccessByCode;
4755
5626
 
4756
- // src/hooks/company/use-get-company-info.ts
5627
+ // src/hooks/auth/use-validate-action-token.ts
4757
5628
  import { useMutation as useMutation12 } from "@tanstack/react-query";
4758
- var useGetCompanyInfo = () => {
5629
+ var useValidateActionToken = () => {
4759
5630
  return useMutation12({
5631
+ mutationFn: ({
5632
+ actionToken,
5633
+ path
5634
+ }) => {
5635
+ return auth_service_default.isValidActionToken(actionToken, path);
5636
+ }
5637
+ });
5638
+ };
5639
+ var use_validate_action_token_default = useValidateActionToken;
5640
+
5641
+ // src/hooks/company/use-get-company-info.ts
5642
+ import { useMutation as useMutation13 } from "@tanstack/react-query";
5643
+ var useGetCompanyInfo = () => {
5644
+ return useMutation13({
4760
5645
  mutationFn: (id) => company_service_default.getInfoCompany(id)
4761
5646
  });
4762
5647
  };
4763
5648
  var use_get_company_info_default = useGetCompanyInfo;
4764
5649
 
4765
5650
  // src/hooks/company/use-get-current-company.ts
4766
- import { useMutation as useMutation13 } from "@tanstack/react-query";
5651
+ import { useMutation as useMutation14 } from "@tanstack/react-query";
4767
5652
  var useGetCurrentCompany = () => {
4768
- return useMutation13({
5653
+ return useMutation14({
4769
5654
  mutationFn: () => company_service_default.getCurrentCompany()
4770
5655
  });
4771
5656
  };
@@ -4792,9 +5677,9 @@ var useGetListCompany = (companyIDs = []) => {
4792
5677
  var use_get_list_company_default = useGetListCompany;
4793
5678
 
4794
5679
  // src/hooks/excel/use-export-excel.ts
4795
- import { useMutation as useMutation14 } from "@tanstack/react-query";
5680
+ import { useMutation as useMutation15 } from "@tanstack/react-query";
4796
5681
  var useExportExcel = () => {
4797
- return useMutation14({
5682
+ return useMutation15({
4798
5683
  mutationFn: ({
4799
5684
  model,
4800
5685
  domain,
@@ -4819,9 +5704,9 @@ var useExportExcel = () => {
4819
5704
  var use_export_excel_default = useExportExcel;
4820
5705
 
4821
5706
  // src/hooks/excel/use-get-field-export.ts
4822
- import { useMutation as useMutation15 } from "@tanstack/react-query";
5707
+ import { useMutation as useMutation16 } from "@tanstack/react-query";
4823
5708
  var useGetFieldExport = () => {
4824
- return useMutation15({
5709
+ return useMutation16({
4825
5710
  mutationFn: ({
4826
5711
  ids,
4827
5712
  model,
@@ -4868,9 +5753,9 @@ var useGetFileExcel = ({ model }) => {
4868
5753
  var use_get_file_excel_default = useGetFileExcel;
4869
5754
 
4870
5755
  // src/hooks/excel/use-parse-preview.ts
4871
- import { useMutation as useMutation16 } from "@tanstack/react-query";
5756
+ import { useMutation as useMutation17 } from "@tanstack/react-query";
4872
5757
  var useParsePreview = () => {
4873
- return useMutation16({
5758
+ return useMutation17({
4874
5759
  mutationFn: ({
4875
5760
  id,
4876
5761
  selectedSheet,
@@ -4887,9 +5772,9 @@ var useParsePreview = () => {
4887
5772
  var use_parse_preview_default = useParsePreview;
4888
5773
 
4889
5774
  // src/hooks/excel/use-upload-file.ts
4890
- import { useMutation as useMutation17 } from "@tanstack/react-query";
5775
+ import { useMutation as useMutation18 } from "@tanstack/react-query";
4891
5776
  var useUploadFile = () => {
4892
- return useMutation17({
5777
+ return useMutation18({
4893
5778
  mutationFn: ({ formData }) => excel_service_default.uploadFile({
4894
5779
  formData
4895
5780
  })
@@ -4898,9 +5783,9 @@ var useUploadFile = () => {
4898
5783
  var use_upload_file_default = useUploadFile;
4899
5784
 
4900
5785
  // src/hooks/excel/use-upload-id-file.ts
4901
- import { useMutation as useMutation18 } from "@tanstack/react-query";
5786
+ import { useMutation as useMutation19 } from "@tanstack/react-query";
4902
5787
  var useUploadIdFile = () => {
4903
- return useMutation18({
5788
+ return useMutation19({
4904
5789
  mutationFn: ({ formData }) => excel_service_default.uploadIdFile({
4905
5790
  formData
4906
5791
  })
@@ -4909,9 +5794,9 @@ var useUploadIdFile = () => {
4909
5794
  var use_upload_id_file_default = useUploadIdFile;
4910
5795
 
4911
5796
  // src/hooks/excel/uss-execute-import.ts
4912
- import { useMutation as useMutation19 } from "@tanstack/react-query";
5797
+ import { useMutation as useMutation20 } from "@tanstack/react-query";
4913
5798
  var useExecuteImport = () => {
4914
- return useMutation19({
5799
+ return useMutation20({
4915
5800
  mutationFn: ({
4916
5801
  fields,
4917
5802
  columns,
@@ -4932,9 +5817,9 @@ var useExecuteImport = () => {
4932
5817
  var uss_execute_import_default = useExecuteImport;
4933
5818
 
4934
5819
  // src/hooks/form/use-change-status.ts
4935
- import { useMutation as useMutation20 } from "@tanstack/react-query";
5820
+ import { useMutation as useMutation21 } from "@tanstack/react-query";
4936
5821
  var useChangeStatus = () => {
4937
- return useMutation20({
5822
+ return useMutation21({
4938
5823
  mutationFn: ({ data }) => {
4939
5824
  return form_service_default.changeStatus({
4940
5825
  data
@@ -4945,9 +5830,9 @@ var useChangeStatus = () => {
4945
5830
  var use_change_status_default = useChangeStatus;
4946
5831
 
4947
5832
  // src/hooks/form/use-delete-comment.ts
4948
- import { useMutation as useMutation21 } from "@tanstack/react-query";
5833
+ import { useMutation as useMutation22 } from "@tanstack/react-query";
4949
5834
  var useDeleteComment = () => {
4950
- return useMutation21({
5835
+ return useMutation22({
4951
5836
  mutationFn: ({ data }) => form_service_default.deleteComment({
4952
5837
  data
4953
5838
  })
@@ -5012,9 +5897,9 @@ var useGetImage = ({
5012
5897
  var use_get_image_default = useGetImage;
5013
5898
 
5014
5899
  // src/hooks/form/use-send-comment.ts
5015
- import { useMutation as useMutation22 } from "@tanstack/react-query";
5900
+ import { useMutation as useMutation23 } from "@tanstack/react-query";
5016
5901
  var useSendComment = () => {
5017
- return useMutation22({
5902
+ return useMutation23({
5018
5903
  mutationFn: ({ data }) => form_service_default.sentComment({
5019
5904
  data
5020
5905
  })
@@ -5023,9 +5908,9 @@ var useSendComment = () => {
5023
5908
  var use_send_comment_default = useSendComment;
5024
5909
 
5025
5910
  // src/hooks/form/use-upload-image.ts
5026
- import { useMutation as useMutation23 } from "@tanstack/react-query";
5911
+ import { useMutation as useMutation24 } from "@tanstack/react-query";
5027
5912
  var useUploadImage = () => {
5028
- return useMutation23({
5913
+ return useMutation24({
5029
5914
  mutationFn: ({ data }) => form_service_default.uploadImage({
5030
5915
  data
5031
5916
  })
@@ -5034,9 +5919,9 @@ var useUploadImage = () => {
5034
5919
  var use_upload_image_default = useUploadImage;
5035
5920
 
5036
5921
  // src/hooks/model/use-delete.ts
5037
- import { useMutation as useMutation24 } from "@tanstack/react-query";
5922
+ import { useMutation as useMutation25 } from "@tanstack/react-query";
5038
5923
  var useDelete = () => {
5039
- return useMutation24({
5924
+ return useMutation25({
5040
5925
  mutationFn: ({ ids, model }) => model_service_default.delete({ ids, model })
5041
5926
  });
5042
5927
  };
@@ -5090,9 +5975,9 @@ var useGetCurrency = () => {
5090
5975
  var use_get_currency_default = useGetCurrency;
5091
5976
 
5092
5977
  // src/hooks/model/use-get-detail.ts
5093
- import { useMutation as useMutation25 } from "@tanstack/react-query";
5978
+ import { useMutation as useMutation26 } from "@tanstack/react-query";
5094
5979
  var useGetDetail = () => {
5095
- return useMutation25({
5980
+ return useMutation26({
5096
5981
  mutationFn: ({
5097
5982
  model,
5098
5983
  ids,
@@ -5285,9 +6170,9 @@ var useOdooDataTransform = () => {
5285
6170
  var use_odoo_data_transform_default = useOdooDataTransform;
5286
6171
 
5287
6172
  // src/hooks/model/use-onchange-form.ts
5288
- import { useMutation as useMutation26 } from "@tanstack/react-query";
6173
+ import { useMutation as useMutation27 } from "@tanstack/react-query";
5289
6174
  var useOnChangeForm = () => {
5290
- return useMutation26({
6175
+ return useMutation27({
5291
6176
  mutationFn: ({
5292
6177
  ids,
5293
6178
  model,
@@ -5308,9 +6193,9 @@ var useOnChangeForm = () => {
5308
6193
  var use_onchange_form_default = useOnChangeForm;
5309
6194
 
5310
6195
  // src/hooks/model/use-save.ts
5311
- import { useMutation as useMutation27 } from "@tanstack/react-query";
6196
+ import { useMutation as useMutation28 } from "@tanstack/react-query";
5312
6197
  var useSave = () => {
5313
- return useMutation27({
6198
+ return useMutation28({
5314
6199
  mutationFn: ({
5315
6200
  ids,
5316
6201
  model,
@@ -5324,18 +6209,18 @@ var useSave = () => {
5324
6209
  var use_save_default = useSave;
5325
6210
 
5326
6211
  // src/hooks/user/use-get-profile.ts
5327
- import { useMutation as useMutation28 } from "@tanstack/react-query";
6212
+ import { useMutation as useMutation29 } from "@tanstack/react-query";
5328
6213
  var useGetProfile = (path) => {
5329
- return useMutation28({
6214
+ return useMutation29({
5330
6215
  mutationFn: () => user_service_default.getProfile(path)
5331
6216
  });
5332
6217
  };
5333
6218
  var use_get_profile_default = useGetProfile;
5334
6219
 
5335
6220
  // src/hooks/user/use-get-user.ts
5336
- import { useMutation as useMutation29 } from "@tanstack/react-query";
6221
+ import { useMutation as useMutation30 } from "@tanstack/react-query";
5337
6222
  var useGetUser = () => {
5338
- return useMutation29({
6223
+ return useMutation30({
5339
6224
  mutationFn: ({ id, context }) => user_service_default.getUser({
5340
6225
  id,
5341
6226
  context
@@ -5345,9 +6230,9 @@ var useGetUser = () => {
5345
6230
  var use_get_user_default = useGetUser;
5346
6231
 
5347
6232
  // src/hooks/user/use-switch-locale.ts
5348
- import { useMutation as useMutation30 } from "@tanstack/react-query";
6233
+ import { useMutation as useMutation31 } from "@tanstack/react-query";
5349
6234
  var useSwitchLocale = () => {
5350
- return useMutation30({
6235
+ return useMutation31({
5351
6236
  mutationFn: ({ data }) => {
5352
6237
  return user_service_default.switchUserLocale({
5353
6238
  id: data.id,
@@ -5359,9 +6244,9 @@ var useSwitchLocale = () => {
5359
6244
  var use_switch_locale_default = useSwitchLocale;
5360
6245
 
5361
6246
  // src/hooks/view/use-button.ts
5362
- import { useMutation as useMutation31 } from "@tanstack/react-query";
6247
+ import { useMutation as useMutation32 } from "@tanstack/react-query";
5363
6248
  var useButton = () => {
5364
- return useMutation31({
6249
+ return useMutation32({
5365
6250
  mutationFn: ({
5366
6251
  model,
5367
6252
  ids,
@@ -5381,9 +6266,9 @@ var useButton = () => {
5381
6266
  var use_button_default = useButton;
5382
6267
 
5383
6268
  // src/hooks/view/use-duplicate-record.ts
5384
- import { useMutation as useMutation32 } from "@tanstack/react-query";
6269
+ import { useMutation as useMutation33 } from "@tanstack/react-query";
5385
6270
  var useDuplicateRecord = () => {
5386
- return useMutation32({
6271
+ return useMutation33({
5387
6272
  mutationFn: ({
5388
6273
  id,
5389
6274
  model,
@@ -5509,9 +6394,9 @@ var useGetMenu = (context, enabled) => {
5509
6394
  var use_get_menu_default = useGetMenu;
5510
6395
 
5511
6396
  // src/hooks/view/use-get-print-report.ts
5512
- import { useMutation as useMutation33 } from "@tanstack/react-query";
6397
+ import { useMutation as useMutation34 } from "@tanstack/react-query";
5513
6398
  var useGetPrintReport = () => {
5514
- return useMutation33({
6399
+ return useMutation34({
5515
6400
  mutationFn: ({ id }) => action_service_default.getPrintReportName({
5516
6401
  id
5517
6402
  })
@@ -5575,9 +6460,9 @@ var useGetView = (viewParams, actData) => {
5575
6460
  var use_get_view_default = useGetView;
5576
6461
 
5577
6462
  // src/hooks/view/use-load-action.ts
5578
- import { useMutation as useMutation34 } from "@tanstack/react-query";
6463
+ import { useMutation as useMutation35 } from "@tanstack/react-query";
5579
6464
  var useLoadAction = () => {
5580
- return useMutation34({
6465
+ return useMutation35({
5581
6466
  mutationFn: ({
5582
6467
  idAction,
5583
6468
  context
@@ -5603,9 +6488,9 @@ var useLoadMessage = () => {
5603
6488
  var use_load_message_default = useLoadMessage;
5604
6489
 
5605
6490
  // src/hooks/view/use-print.ts
5606
- import { useMutation as useMutation35 } from "@tanstack/react-query";
6491
+ import { useMutation as useMutation36 } from "@tanstack/react-query";
5607
6492
  var usePrint = () => {
5608
- return useMutation35({
6493
+ return useMutation36({
5609
6494
  mutationFn: ({ id, report, db }) => action_service_default.print({
5610
6495
  id,
5611
6496
  report,
@@ -5616,9 +6501,9 @@ var usePrint = () => {
5616
6501
  var use_print_default = usePrint;
5617
6502
 
5618
6503
  // src/hooks/view/use-remove-row.ts
5619
- import { useMutation as useMutation36 } from "@tanstack/react-query";
6504
+ import { useMutation as useMutation37 } from "@tanstack/react-query";
5620
6505
  var useRemoveRow = () => {
5621
- return useMutation36({
6506
+ return useMutation37({
5622
6507
  mutationFn: ({
5623
6508
  model,
5624
6509
  ids,
@@ -5650,9 +6535,9 @@ var useGetResequence = (model, resIds, context, offset) => {
5650
6535
  var use_resequence_default = useGetResequence;
5651
6536
 
5652
6537
  // src/hooks/view/use-run-action.ts
5653
- import { useMutation as useMutation37 } from "@tanstack/react-query";
6538
+ import { useMutation as useMutation38 } from "@tanstack/react-query";
5654
6539
  var useRunAction = () => {
5655
- return useMutation37({
6540
+ return useMutation38({
5656
6541
  mutationFn: ({
5657
6542
  idAction,
5658
6543
  context
@@ -5665,9 +6550,9 @@ var useRunAction = () => {
5665
6550
  var use_run_action_default = useRunAction;
5666
6551
 
5667
6552
  // src/hooks/view/use-signin-sso.ts
5668
- import { useMutation as useMutation38 } from "@tanstack/react-query";
6553
+ import { useMutation as useMutation39 } from "@tanstack/react-query";
5669
6554
  var useSignInSSO = () => {
5670
- return useMutation38({
6555
+ return useMutation39({
5671
6556
  mutationFn: ({
5672
6557
  redirect_uri,
5673
6558
  state,
@@ -5688,9 +6573,9 @@ var useSignInSSO = () => {
5688
6573
  var use_signin_sso_default = useSignInSSO;
5689
6574
 
5690
6575
  // src/hooks/view/use-verify-2FA.ts
5691
- import { useMutation as useMutation39 } from "@tanstack/react-query";
6576
+ import { useMutation as useMutation40 } from "@tanstack/react-query";
5692
6577
  var useVerify2FA = () => {
5693
- return useMutation39({
6578
+ return useMutation40({
5694
6579
  mutationFn: ({
5695
6580
  method,
5696
6581
  with_context,
@@ -5711,9 +6596,9 @@ var useVerify2FA = () => {
5711
6596
  var use_verify_2FA_default = useVerify2FA;
5712
6597
 
5713
6598
  // src/hooks/view/uset-get-2FA-method.ts
5714
- import { useMutation as useMutation40 } from "@tanstack/react-query";
6599
+ import { useMutation as useMutation41 } from "@tanstack/react-query";
5715
6600
  var useGet2FAMethods = () => {
5716
- return useMutation40({
6601
+ return useMutation41({
5717
6602
  mutationFn: ({
5718
6603
  method,
5719
6604
  with_context
@@ -5728,9 +6613,9 @@ var useGet2FAMethods = () => {
5728
6613
  var uset_get_2FA_method_default = useGet2FAMethods;
5729
6614
 
5730
6615
  // src/hooks/view/use-get-fields-view-security.ts
5731
- import { useMutation as useMutation41 } from "@tanstack/react-query";
6616
+ import { useMutation as useMutation42 } from "@tanstack/react-query";
5732
6617
  var useGetFieldsViewSecurity = () => {
5733
- return useMutation41({
6618
+ return useMutation42({
5734
6619
  mutationFn: ({
5735
6620
  method,
5736
6621
  token,
@@ -5747,9 +6632,9 @@ var useGetFieldsViewSecurity = () => {
5747
6632
  var use_get_fields_view_security_default = useGetFieldsViewSecurity;
5748
6633
 
5749
6634
  // src/hooks/view/use-grant-access.ts
5750
- import { useMutation as useMutation42 } from "@tanstack/react-query";
6635
+ import { useMutation as useMutation43 } from "@tanstack/react-query";
5751
6636
  var useGrantAccess = () => {
5752
- return useMutation42({
6637
+ return useMutation43({
5753
6638
  mutationFn: ({
5754
6639
  redirect_uri,
5755
6640
  state,
@@ -5768,9 +6653,9 @@ var useGrantAccess = () => {
5768
6653
  var use_grant_access_default = useGrantAccess;
5769
6654
 
5770
6655
  // src/hooks/view/use-remove-totp-setup.ts
5771
- import { useMutation as useMutation43 } from "@tanstack/react-query";
6656
+ import { useMutation as useMutation44 } from "@tanstack/react-query";
5772
6657
  var useRemoveTotpSetup = () => {
5773
- return useMutation43({
6658
+ return useMutation44({
5774
6659
  mutationFn: ({ method, token }) => {
5775
6660
  return view_service_default.removeTotpSetUp({
5776
6661
  method,
@@ -5782,9 +6667,9 @@ var useRemoveTotpSetup = () => {
5782
6667
  var use_remove_totp_setup_default = useRemoveTotpSetup;
5783
6668
 
5784
6669
  // src/hooks/view/use-request-setup-totp.ts
5785
- import { useMutation as useMutation44 } from "@tanstack/react-query";
6670
+ import { useMutation as useMutation45 } from "@tanstack/react-query";
5786
6671
  var useRequestSetupTotp = () => {
5787
- return useMutation44({
6672
+ return useMutation45({
5788
6673
  mutationFn: ({ method, token }) => {
5789
6674
  return view_service_default.requestSetupTotp({
5790
6675
  method,
@@ -5796,9 +6681,9 @@ var useRequestSetupTotp = () => {
5796
6681
  var use_request_setup_totp_default = useRequestSetupTotp;
5797
6682
 
5798
6683
  // src/hooks/view/use-settings-web-read-2fa.ts
5799
- import { useMutation as useMutation45 } from "@tanstack/react-query";
6684
+ import { useMutation as useMutation46 } from "@tanstack/react-query";
5800
6685
  var useSettingsWebRead2fa = () => {
5801
- return useMutation45({
6686
+ return useMutation46({
5802
6687
  mutationFn: ({
5803
6688
  method,
5804
6689
  token,
@@ -5817,9 +6702,9 @@ var useSettingsWebRead2fa = () => {
5817
6702
  var use_settings_web_read_2fa_default = useSettingsWebRead2fa;
5818
6703
 
5819
6704
  // src/hooks/view/use-verify-totp.ts
5820
- import { useMutation as useMutation46 } from "@tanstack/react-query";
6705
+ import { useMutation as useMutation47 } from "@tanstack/react-query";
5821
6706
  var useVerifyTotp = () => {
5822
- return useMutation46({
6707
+ return useMutation47({
5823
6708
  mutationFn: ({
5824
6709
  method,
5825
6710
  action_token,
@@ -5834,7 +6719,211 @@ var useVerifyTotp = () => {
5834
6719
  });
5835
6720
  };
5836
6721
  var use_verify_totp_default = useVerifyTotp;
6722
+
6723
+ // src/provider/react-query-provider.tsx
6724
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
6725
+ import { jsx } from "react/jsx-runtime";
6726
+ var ReactQueryProvider = ({ children }) => {
6727
+ const queryClient = new QueryClient({
6728
+ defaultOptions: {
6729
+ queries: {
6730
+ // placeholderData: keepPreviousData,
6731
+ refetchOnWindowFocus: false,
6732
+ refetchOnMount: false,
6733
+ refetchOnReconnect: false,
6734
+ retry: false
6735
+ }
6736
+ }
6737
+ });
6738
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
6739
+ };
6740
+
6741
+ // src/provider/redux-provider.tsx
6742
+ import { Provider } from "react-redux";
6743
+ import { jsx as jsx2 } from "react/jsx-runtime";
6744
+ var ReduxProvider = ({ children }) => {
6745
+ return /* @__PURE__ */ jsx2(Provider, { store: envStore, children });
6746
+ };
6747
+
6748
+ // src/provider/main-provider.tsx
6749
+ import { jsx as jsx3 } from "react/jsx-runtime";
6750
+ var MainProvider = ({ children }) => {
6751
+ return /* @__PURE__ */ jsx3(ReduxProvider, { children: /* @__PURE__ */ jsx3(ReactQueryProvider, { children }) });
6752
+ };
6753
+
6754
+ // src/provider/version-gate-provider.tsx
6755
+ import { useEffect as useEffect2, useState as useState2 } from "react";
6756
+ import { useQueryClient } from "@tanstack/react-query";
6757
+ import { Fragment, jsx as jsx4 } from "react/jsx-runtime";
6758
+ var VersionGate = ({ children }) => {
6759
+ const queryClient = useQueryClient();
6760
+ const [ready, setReady] = useState2(false);
6761
+ useEffect2(() => {
6762
+ const clearVersion = () => {
6763
+ queryClient.clear();
6764
+ localStorage.removeItem("__api_version__");
6765
+ };
6766
+ const validateVersion = async () => {
6767
+ const serverVersion = await view_service_default.getVersion();
6768
+ const cached = localStorage.getItem("__api_version__");
6769
+ if (cached !== serverVersion?.api_version) {
6770
+ clearVersion();
6771
+ localStorage.setItem("__api_version__", serverVersion?.api_version);
6772
+ } else {
6773
+ console.log("Api version:", serverVersion?.api_version);
6774
+ }
6775
+ setReady(true);
6776
+ };
6777
+ validateVersion();
6778
+ if (typeof window !== "undefined") {
6779
+ const onKey = (e) => {
6780
+ const key = e.key.toLowerCase();
6781
+ const isHardRefresh = (key === "f5" || key === "r") && e.ctrlKey && (key !== "r" || e.shiftKey) || key === "r" && e.metaKey && e.shiftKey || key === "r" && e.metaKey && e.altKey;
6782
+ if (isHardRefresh) clearVersion();
6783
+ };
6784
+ window.addEventListener("keydown", onKey);
6785
+ return () => window.removeEventListener("keydown", onKey);
6786
+ }
6787
+ }, [queryClient]);
6788
+ return ready ? /* @__PURE__ */ jsx4(Fragment, { children }) : null;
6789
+ };
5837
6790
  export {
6791
+ action_service_default as ActionService,
6792
+ auth_service_default as AuthService,
6793
+ company_service_default as CompanyService,
6794
+ ComponentType,
6795
+ EnvStore,
6796
+ excel_service_default as ExcelService,
6797
+ FieldTypeConstants,
6798
+ form_service_default as FormService,
6799
+ kanban_service_default as KanbanService,
6800
+ KeyConstants,
6801
+ MainProvider,
6802
+ MethodConstants,
6803
+ MethodType,
6804
+ ModelConstants,
6805
+ model_service_default as ModelService,
6806
+ ReactQueryProvider,
6807
+ SearchType,
6808
+ UriConstants,
6809
+ user_service_default as UserService,
6810
+ VersionGate,
6811
+ view_service_default as ViewService,
6812
+ WIDGETAVATAR,
6813
+ WIDGETCOLOR,
6814
+ WIDGETCURRENCY,
6815
+ WIDGETNOSTRING,
6816
+ WIDGETSTATUS,
6817
+ WesapError,
6818
+ axiosClient,
6819
+ breadcrumbsSlice,
6820
+ checkIsImageLink,
6821
+ clearSearchMap,
6822
+ convertFloatToTime,
6823
+ convertTimeToFloat,
6824
+ copyTextToClipboard,
6825
+ domainHelper,
6826
+ env,
6827
+ envSlice,
6828
+ envStore,
6829
+ evalJSONContext,
6830
+ evalJSONDomain,
6831
+ excelSlice,
6832
+ filterFieldDirty,
6833
+ formSlice,
6834
+ formatCurrency,
6835
+ formatDate,
6836
+ formatFileSize,
6837
+ formatSortingString,
6838
+ formatUrlPath,
6839
+ getEnv,
6840
+ getFieldsOnChange,
6841
+ getOffSet,
6842
+ getSubdomain,
6843
+ handleError,
6844
+ headerSlice,
6845
+ initEnv,
6846
+ isBase64File,
6847
+ isBase64Image,
6848
+ isObjectEmpty,
6849
+ listSlice,
6850
+ loginSlice,
6851
+ mergeObjects,
6852
+ navbarSlice,
6853
+ profileSlice,
6854
+ removeKeyFromSearchMap,
6855
+ removeUndefinedFields,
6856
+ resequence,
6857
+ searchSlice,
6858
+ selectBreadCrumbs,
6859
+ selectEnv,
6860
+ selectExcel,
6861
+ selectForm,
6862
+ selectHeader,
6863
+ selectList,
6864
+ selectLogin,
6865
+ selectNavbar,
6866
+ selectProfile,
6867
+ selectSearch,
6868
+ selectSearchMap,
6869
+ setAllowCompanies,
6870
+ setAllowedCompanyIds,
6871
+ setBreadCrumbs,
6872
+ setCompanies,
6873
+ setConfig,
6874
+ setDataParse,
6875
+ setDataUser,
6876
+ setDb,
6877
+ setDefaultCompany,
6878
+ setDomainTable,
6879
+ setEnv,
6880
+ setEnvFile,
6881
+ setErrorData,
6882
+ setFieldTranslate,
6883
+ setFields,
6884
+ setFilterBy,
6885
+ setFirstDomain,
6886
+ setForgotPasswordUrl,
6887
+ setFormSubmitComponent,
6888
+ setGroupBy,
6889
+ setGroupByDomain,
6890
+ setHeader,
6891
+ setHoveredIndexSearchList,
6892
+ setIdFile,
6893
+ setIndexRowTableModal,
6894
+ setIsFileLoaded,
6895
+ setIsShowModalTranslate,
6896
+ setIsShowingModalDetail,
6897
+ setIsUpdateTableModal,
6898
+ setLang,
6899
+ setListSubject,
6900
+ setLoadingImport,
6901
+ setMenuFocus,
6902
+ setMenuFocusAction,
6903
+ setMenuList,
6904
+ setNavbarWidth,
6905
+ setOrder,
6906
+ setPage,
6907
+ setPageLimit,
6908
+ setProfile,
6909
+ setRedirectTo,
6910
+ setSearchBy,
6911
+ setSearchMap,
6912
+ setSearchString,
6913
+ setSelectedFile,
6914
+ setSelectedRadioKey,
6915
+ setSelectedRowKeys,
6916
+ setSelectedTags,
6917
+ setTransferDetail,
6918
+ setUid,
6919
+ setUser,
6920
+ setViewDataStore,
6921
+ stringToColor,
6922
+ toQueryString,
6923
+ updateSearchMap,
6924
+ updateTokenParamInOriginalRequest,
6925
+ useAppDispatch,
6926
+ useAppSelector,
5838
6927
  use_button_default as useButton,
5839
6928
  use_change_status_default as useChangeStatus,
5840
6929
  use_delete_default as useDelete,
@@ -5842,6 +6931,7 @@ export {
5842
6931
  use_duplicate_record_default as useDuplicateRecord,
5843
6932
  uss_execute_import_default as useExecuteImport,
5844
6933
  use_export_excel_default as useExportExcel,
6934
+ useField,
5845
6935
  use_forgot_password_default as useForgotPassword,
5846
6936
  use_forgotpassword_sso_default as useForgotPasswordSSO,
5847
6937
  uset_get_2FA_method_default as useGet2FAMethods,
@@ -5897,10 +6987,14 @@ export {
5897
6987
  use_settings_web_read_2fa_default as useSettingsWebRead2fa,
5898
6988
  use_signin_sso_default as useSignInSSO,
5899
6989
  use_switch_locale_default as useSwitchLocale,
6990
+ useTabModel,
5900
6991
  use_update_password_default as useUpdatePassword,
5901
6992
  use_upload_file_default as useUploadFile,
5902
6993
  use_upload_id_file_default as useUploadIdFile,
5903
6994
  use_upload_image_default as useUploadImage,
6995
+ use_validate_action_token_default as useValidateActionToken,
5904
6996
  use_verify_2FA_default as useVerify2FA,
5905
- use_verify_totp_default as useVerifyTotp
6997
+ use_verify_totp_default as useVerifyTotp,
6998
+ validateAndParseDate
5906
6999
  };
7000
+ //# sourceMappingURL=index.mjs.map