@fctc/interface-logic 5.2.4 → 5.2.6

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 (58) hide show
  1. package/dist/{chunk-Q5YXX4OR.js → chunk-CCTDGAMA.js} +52 -51
  2. package/dist/{chunk-WBGK2SHU.js → chunk-COC7NGXP.js} +20 -19
  3. package/dist/{chunk-6ARYI77N.mjs → chunk-F2VAAEVB.mjs} +12 -3
  4. package/dist/{chunk-OV7EKGYM.mjs → chunk-F4RE57FT.mjs} +1394 -640
  5. package/dist/{chunk-C5QQGBN4.js → chunk-FWBYTZIV.js} +23 -18
  6. package/dist/chunk-GGNOJ77I.js +1 -2
  7. package/dist/{chunk-BPJZ3QRN.mjs → chunk-HQVNK2EW.mjs} +128 -770
  8. package/dist/{chunk-VBYRP2P7.mjs → chunk-Q3Y6RCJ4.mjs} +19 -1
  9. package/dist/{chunk-5STZNSW4.js → chunk-U2COUTK5.js} +1663 -1087
  10. package/dist/{chunk-JDXUTKMX.js → chunk-U4Q3MW45.js} +170 -852
  11. package/dist/{chunk-QOXPJWSN.mjs → chunk-VBVNP77T.mjs} +6 -2
  12. package/dist/chunk-WAXGOBY2.mjs +0 -1
  13. package/dist/chunk-WTPKTZQC.js +118 -0
  14. package/dist/{chunk-ACSPOGTI.mjs → chunk-ZDXEWQQD.mjs} +14 -7
  15. package/dist/configs.js +4 -9
  16. package/dist/configs.mjs +7 -3
  17. package/dist/constants.d.mts +2 -1
  18. package/dist/constants.d.ts +2 -1
  19. package/dist/constants.js +36 -70
  20. package/dist/constants.mjs +36 -1
  21. package/dist/environment.d.mts +1 -1
  22. package/dist/environment.d.ts +1 -1
  23. package/dist/environment.js +8 -17
  24. package/dist/environment.mjs +12 -4
  25. package/dist/hooks.d.mts +7 -23
  26. package/dist/hooks.d.ts +7 -23
  27. package/dist/hooks.js +312 -635
  28. package/dist/hooks.mjs +312 -6
  29. package/dist/index.d.mts +4 -10
  30. package/dist/index.d.ts +4 -10
  31. package/dist/index.js +433 -1257
  32. package/dist/index.mjs +433 -8
  33. package/dist/{local-storage-BPvoMGYJ.d.mts → local-storage-AbiOQTLK.d.mts} +1 -1
  34. package/dist/{local-storage-BPvoMGYJ.d.ts → local-storage-AbiOQTLK.d.ts} +1 -1
  35. package/dist/models.js +4 -8
  36. package/dist/models.mjs +7 -2
  37. package/dist/provider.d.mts +4 -12
  38. package/dist/provider.d.ts +4 -12
  39. package/dist/provider.js +26 -51
  40. package/dist/provider.mjs +26 -6
  41. package/dist/services.d.mts +6 -10
  42. package/dist/services.d.ts +6 -10
  43. package/dist/services.js +30 -55
  44. package/dist/services.mjs +30 -6
  45. package/dist/types.js +1 -4
  46. package/dist/types.mjs +1 -1
  47. package/dist/utils.d.mts +33 -61
  48. package/dist/utils.d.ts +33 -61
  49. package/dist/utils.js +36 -139
  50. package/dist/utils.mjs +36 -2
  51. package/package.json +15 -29
  52. package/dist/chunk-6LSKTACC.js +0 -687
  53. package/dist/chunk-B432GFRR.mjs +0 -606
  54. package/dist/chunk-RPWKWEMA.js +0 -116
  55. package/dist/store.d.mts +0 -382
  56. package/dist/store.d.ts +0 -382
  57. package/dist/store.js +0 -326
  58. package/dist/store.mjs +0 -1
package/dist/provider.js CHANGED
@@ -1,51 +1,26 @@
1
- 'use strict';
2
-
3
- var chunk5STZNSW4_js = require('./chunk-5STZNSW4.js');
4
- require('./chunk-6LSKTACC.js');
5
- require('./chunk-Q5YXX4OR.js');
6
- require('./chunk-JDXUTKMX.js');
7
- require('./chunk-RPWKWEMA.js');
8
- require('./chunk-WBGK2SHU.js');
9
-
10
-
11
-
12
- Object.defineProperty(exports, "EnvProvider", {
13
- enumerable: true,
14
- get: function () { return chunk5STZNSW4_js.EnvProvider; }
15
- });
16
- Object.defineProperty(exports, "MainProvider", {
17
- enumerable: true,
18
- get: function () { return chunk5STZNSW4_js.MainProvider; }
19
- });
20
- Object.defineProperty(exports, "MetaProvider", {
21
- enumerable: true,
22
- get: function () { return chunk5STZNSW4_js.MetaProvider; }
23
- });
24
- Object.defineProperty(exports, "ReactQueryProvider", {
25
- enumerable: true,
26
- get: function () { return chunk5STZNSW4_js.ReactQueryProvider; }
27
- });
28
- Object.defineProperty(exports, "ServiceProvider", {
29
- enumerable: true,
30
- get: function () { return chunk5STZNSW4_js.ServiceProvider; }
31
- });
32
- Object.defineProperty(exports, "SupabaseProvider", {
33
- enumerable: true,
34
- get: function () { return chunk5STZNSW4_js.SupabaseProvider; }
35
- });
36
- Object.defineProperty(exports, "VersionGate", {
37
- enumerable: true,
38
- get: function () { return chunk5STZNSW4_js.VersionGate; }
39
- });
40
- Object.defineProperty(exports, "useEnv", {
41
- enumerable: true,
42
- get: function () { return chunk5STZNSW4_js.useEnv; }
43
- });
44
- Object.defineProperty(exports, "useService", {
45
- enumerable: true,
46
- get: function () { return chunk5STZNSW4_js.useService; }
47
- });
48
- Object.defineProperty(exports, "useSupabase", {
49
- enumerable: true,
50
- get: function () { return chunk5STZNSW4_js.useSupabase; }
51
- });
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chunkU2COUTK5js = require('./chunk-U2COUTK5.js');
12
+ require('./chunk-CCTDGAMA.js');
13
+ require('./chunk-U4Q3MW45.js');
14
+ require('./chunk-WTPKTZQC.js');
15
+ require('./chunk-COC7NGXP.js');
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+ exports.EnvProvider = _chunkU2COUTK5js.EnvProvider; exports.MainProvider = _chunkU2COUTK5js.MainProvider; exports.MetaProvider = _chunkU2COUTK5js.MetaProvider; exports.ReactQueryProvider = _chunkU2COUTK5js.ReactQueryProvider; exports.ServiceProvider = _chunkU2COUTK5js.ServiceProvider; exports.SupabaseProvider = _chunkU2COUTK5js.SupabaseProvider; exports.useEnv = _chunkU2COUTK5js.useEnv; exports.useService = _chunkU2COUTK5js.useService; exports.useSupabase = _chunkU2COUTK5js.useSupabase;
package/dist/provider.mjs CHANGED
@@ -1,6 +1,26 @@
1
- export { EnvProvider, MainProvider, MetaProvider, ReactQueryProvider, ServiceProvider, SupabaseProvider, VersionGate, useEnv, useService, useSupabase } from './chunk-OV7EKGYM.mjs';
2
- import './chunk-B432GFRR.mjs';
3
- import './chunk-ACSPOGTI.mjs';
4
- import './chunk-BPJZ3QRN.mjs';
5
- import './chunk-QOXPJWSN.mjs';
6
- import './chunk-VBYRP2P7.mjs';
1
+ import {
2
+ EnvProvider,
3
+ MainProvider,
4
+ MetaProvider,
5
+ ReactQueryProvider,
6
+ ServiceProvider,
7
+ SupabaseProvider,
8
+ useEnv,
9
+ useService,
10
+ useSupabase
11
+ } from "./chunk-F4RE57FT.mjs";
12
+ import "./chunk-ZDXEWQQD.mjs";
13
+ import "./chunk-HQVNK2EW.mjs";
14
+ import "./chunk-VBVNP77T.mjs";
15
+ import "./chunk-Q3Y6RCJ4.mjs";
16
+ export {
17
+ EnvProvider,
18
+ MainProvider,
19
+ MetaProvider,
20
+ ReactQueryProvider,
21
+ ServiceProvider,
22
+ SupabaseProvider,
23
+ useEnv,
24
+ useService,
25
+ useSupabase
26
+ };
@@ -52,10 +52,6 @@ declare function useActionService(): {
52
52
  xNode?: string;
53
53
  }) => Promise<any>;
54
54
  actionServerHome: () => Promise<any>;
55
- actionOpenHome: ({ model, method }: {
56
- model: string;
57
- method: string;
58
- }) => Promise<any>;
59
55
  };
60
56
 
61
57
  declare function useAuthService(): {
@@ -362,12 +358,6 @@ declare function useViewService(): {
362
358
  kwargs: any;
363
359
  withContext?: any;
364
360
  }) => Promise<any>;
365
- getPoints: (path?: string) => Promise<any>;
366
- getOrders: ({ kwargs, withContext }: {
367
- kwargs: any;
368
- withContext?: any;
369
- }) => Promise<any>;
370
- getVouchers: () => Promise<any>;
371
361
  };
372
362
 
373
363
  declare function useDashboardService(): {
@@ -674,6 +664,12 @@ declare const serviceFactories: readonly [(env: any) => {
674
664
  xNode?: string;
675
665
  service?: string;
676
666
  }) => any;
667
+ }, (env: any) => {
668
+ getCustomerLoyaltyPoint: ({ xNode, service, partnerId, }: {
669
+ service?: string;
670
+ xNode?: string;
671
+ partnerId: number;
672
+ }) => Promise<any>;
677
673
  }, () => {
678
674
  addFloorSupabase: (values: {
679
675
  name: string;
@@ -52,10 +52,6 @@ declare function useActionService(): {
52
52
  xNode?: string;
53
53
  }) => Promise<any>;
54
54
  actionServerHome: () => Promise<any>;
55
- actionOpenHome: ({ model, method }: {
56
- model: string;
57
- method: string;
58
- }) => Promise<any>;
59
55
  };
60
56
 
61
57
  declare function useAuthService(): {
@@ -362,12 +358,6 @@ declare function useViewService(): {
362
358
  kwargs: any;
363
359
  withContext?: any;
364
360
  }) => Promise<any>;
365
- getPoints: (path?: string) => Promise<any>;
366
- getOrders: ({ kwargs, withContext }: {
367
- kwargs: any;
368
- withContext?: any;
369
- }) => Promise<any>;
370
- getVouchers: () => Promise<any>;
371
361
  };
372
362
 
373
363
  declare function useDashboardService(): {
@@ -674,6 +664,12 @@ declare const serviceFactories: readonly [(env: any) => {
674
664
  xNode?: string;
675
665
  service?: string;
676
666
  }) => any;
667
+ }, (env: any) => {
668
+ getCustomerLoyaltyPoint: ({ xNode, service, partnerId, }: {
669
+ service?: string;
670
+ xNode?: string;
671
+ partnerId: number;
672
+ }) => Promise<any>;
677
673
  }, () => {
678
674
  addFloorSupabase: (values: {
679
675
  name: string;
package/dist/services.js CHANGED
@@ -1,55 +1,30 @@
1
- 'use strict';
2
-
3
- var chunk5STZNSW4_js = require('./chunk-5STZNSW4.js');
4
- require('./chunk-6LSKTACC.js');
5
- require('./chunk-Q5YXX4OR.js');
6
- require('./chunk-JDXUTKMX.js');
7
- require('./chunk-RPWKWEMA.js');
8
- require('./chunk-WBGK2SHU.js');
9
-
10
-
11
-
12
- Object.defineProperty(exports, "useActionService", {
13
- enumerable: true,
14
- get: function () { return chunk5STZNSW4_js.useActionService; }
15
- });
16
- Object.defineProperty(exports, "useAuthService", {
17
- enumerable: true,
18
- get: function () { return chunk5STZNSW4_js.useAuthService; }
19
- });
20
- Object.defineProperty(exports, "useCompanyService", {
21
- enumerable: true,
22
- get: function () { return chunk5STZNSW4_js.useCompanyService; }
23
- });
24
- Object.defineProperty(exports, "useDashboardService", {
25
- enumerable: true,
26
- get: function () { return chunk5STZNSW4_js.useDashboardService; }
27
- });
28
- Object.defineProperty(exports, "useExcelService", {
29
- enumerable: true,
30
- get: function () { return chunk5STZNSW4_js.useExcelService; }
31
- });
32
- Object.defineProperty(exports, "useFormService", {
33
- enumerable: true,
34
- get: function () { return chunk5STZNSW4_js.useFormService; }
35
- });
36
- Object.defineProperty(exports, "useKanbanService", {
37
- enumerable: true,
38
- get: function () { return chunk5STZNSW4_js.useKanbanService; }
39
- });
40
- Object.defineProperty(exports, "useModelService", {
41
- enumerable: true,
42
- get: function () { return chunk5STZNSW4_js.useModelService; }
43
- });
44
- Object.defineProperty(exports, "usePosService", {
45
- enumerable: true,
46
- get: function () { return chunk5STZNSW4_js.usePosService; }
47
- });
48
- Object.defineProperty(exports, "useUserService", {
49
- enumerable: true,
50
- get: function () { return chunk5STZNSW4_js.useUserService; }
51
- });
52
- Object.defineProperty(exports, "useViewService", {
53
- enumerable: true,
54
- get: function () { return chunk5STZNSW4_js.useViewService; }
55
- });
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ var _chunkU2COUTK5js = require('./chunk-U2COUTK5.js');
14
+ require('./chunk-CCTDGAMA.js');
15
+ require('./chunk-U4Q3MW45.js');
16
+ require('./chunk-WTPKTZQC.js');
17
+ require('./chunk-COC7NGXP.js');
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+ exports.useActionService = _chunkU2COUTK5js.useActionService; exports.useAuthService = _chunkU2COUTK5js.useAuthService; exports.useCompanyService = _chunkU2COUTK5js.useCompanyService; exports.useDashboardService = _chunkU2COUTK5js.useDashboardService; exports.useExcelService = _chunkU2COUTK5js.useExcelService; exports.useFormService = _chunkU2COUTK5js.useFormService; exports.useKanbanService = _chunkU2COUTK5js.useKanbanService; exports.useModelService = _chunkU2COUTK5js.useModelService; exports.usePosService = _chunkU2COUTK5js.usePosService; exports.useUserService = _chunkU2COUTK5js.useUserService; exports.useViewService = _chunkU2COUTK5js.useViewService;
package/dist/services.mjs CHANGED
@@ -1,6 +1,30 @@
1
- export { useActionService, useAuthService, useCompanyService, useDashboardService, useExcelService, useFormService, useKanbanService, useModelService, usePosService, useUserService, useViewService } from './chunk-OV7EKGYM.mjs';
2
- import './chunk-B432GFRR.mjs';
3
- import './chunk-ACSPOGTI.mjs';
4
- import './chunk-BPJZ3QRN.mjs';
5
- import './chunk-QOXPJWSN.mjs';
6
- import './chunk-VBYRP2P7.mjs';
1
+ import {
2
+ useActionService,
3
+ useAuthService,
4
+ useCompanyService,
5
+ useDashboardService,
6
+ useExcelService,
7
+ useFormService,
8
+ useKanbanService,
9
+ useModelService,
10
+ usePosService,
11
+ useUserService,
12
+ useViewService
13
+ } from "./chunk-F4RE57FT.mjs";
14
+ import "./chunk-ZDXEWQQD.mjs";
15
+ import "./chunk-HQVNK2EW.mjs";
16
+ import "./chunk-VBVNP77T.mjs";
17
+ import "./chunk-Q3Y6RCJ4.mjs";
18
+ export {
19
+ useActionService,
20
+ useAuthService,
21
+ useCompanyService,
22
+ useDashboardService,
23
+ useExcelService,
24
+ useFormService,
25
+ useKanbanService,
26
+ useModelService,
27
+ usePosService,
28
+ useUserService,
29
+ useViewService
30
+ };
package/dist/types.js CHANGED
@@ -1,4 +1 @@
1
- 'use strict';
2
-
3
- require('./chunk-GGNOJ77I.js');
4
-
1
+ "use strict";require('./chunk-GGNOJ77I.js');
package/dist/types.mjs CHANGED
@@ -1 +1 @@
1
- import './chunk-WAXGOBY2.mjs';
1
+ import "./chunk-WAXGOBY2.mjs";
package/dist/utils.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ export { L as LocalStorageUtilsType, l as localStorageUtils } from './local-storage-AbiOQTLK.mjs';
2
+
1
3
  declare const sessionStorageUtils: {
2
4
  getMenuFocus: () => IMenu;
3
5
  setMenuFocus: (menuTree: IMenu) => void;
@@ -14,21 +16,28 @@ interface IMenu {
14
16
  service: string;
15
17
  }
16
18
 
17
- declare class WesapError extends Error {
18
- code: number;
19
- constructor(message: string, code: number);
19
+ interface Context {
20
+ [key: string]: any;
20
21
  }
21
- declare function handleError(error: Error, env: {
22
- services: {
23
- notification: {
24
- error: (message: string) => void;
25
- };
26
- };
27
- }): void;
28
-
29
- declare const formatCurrency: (amount: number, currency?: string) => string;
30
- declare const formatDate: (date: string | Date, locale?: string) => string;
31
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
+ type ContextDescription = Context | string | undefined;
23
+ /**
24
+ * Create an evaluated context from an arbitrary list of context representations.
25
+ * The evaluated context in construction is used along the way to evaluate further parts.
26
+ *
27
+ * @param contexts - Danh sách các context representations
28
+ * @param initialEvaluationContext - Context ban đầu để bắt đầu đánh giá (tùy chọn)
29
+ * @returns Context đã được đánh giá
30
+ */
31
+ declare function makeContext(contexts: ContextDescription[], initialEvaluationContext?: Context): Context;
32
+ /**
33
+ * Allow to evaluate a context with an incomplete evaluation context. The evaluated context only
34
+ * contains keys whose values are static or can be evaluated with the given evaluation context.
35
+ *
36
+ * @param context - Chuỗi context cần đánh giá
37
+ * @param evaluationContext - Context dùng để đánh giá (mặc định là rỗng)
38
+ * @returns Context đã được đánh giá một phần
39
+ */
40
+ declare function evalPartialContext(_context: string, evaluationContext?: Context): Context;
32
41
 
33
42
  type AST = {
34
43
  type: number;
@@ -37,6 +46,8 @@ type AST = {
37
46
  type Condition = [string | 0 | 1, string, any];
38
47
  type DomainListRepr = ('&' | '|' | '!' | Condition)[];
39
48
  type DomainRepr = DomainListRepr | string | Domain;
49
+ declare class InvalidDomainError extends Error {
50
+ }
40
51
  declare class Domain {
41
52
  ast: AST;
42
53
  static TRUE: Domain;
@@ -52,61 +63,22 @@ declare class Domain {
52
63
  toList(context: Record<string, any>): DomainListRepr;
53
64
  toJson(): DomainListRepr | string;
54
65
  }
66
+ declare function evalDomain(modifier: any[] | boolean, evalContext: Record<string, any>): boolean;
67
+ declare const checkDomain: (context: any, domain: any) => boolean;
68
+ declare const matchDomains: (context: any, domains: any) => boolean;
55
69
 
56
- declare const evalJSONContext: (_context: any, context?: {}) => any;
57
- declare const evalJSONDomain: (domain: any, context: any) => any;
58
- declare const formatSortingString: (input: string | null | undefined) => string | null;
59
70
  declare const domainHelper: {
60
71
  checkDomain: (context: any, domain: any) => boolean;
61
72
  matchDomains: (context: any, domains: any) => boolean;
62
73
  Domain: typeof Domain;
63
74
  };
75
+ declare const evalJSONContext: (_context: any, context?: {}) => any;
76
+ declare const evalJSONDomain: (domain: any, context: any) => any;
77
+ declare const formatSortingString: (input: string | null | undefined) => string | null;
64
78
  declare const toQueryString: (params: Record<string, string | number | boolean>) => string;
65
- declare const convertFloatToTime: (floatValue: number) => string;
66
- declare const convertTimeToFloat: (timeString: string) => number;
67
- declare const stringToColor: (name: string, id: number) => string;
68
- declare const getFieldsOnChange: (fields: any) => any;
69
- declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, keepZeroValue, }: {
70
- id?: any;
71
- viewData?: any;
72
- formValues?: any;
73
- dirtyFields?: any;
74
- model?: any;
75
- defaultData?: any;
76
- keepZeroValue?: boolean;
77
- }) => any;
78
- type MergeableObject = {
79
- [key: string]: any;
80
- } | null | undefined;
81
- declare const mergeObjects: <T extends MergeableObject, U extends MergeableObject>(object1: T, object2: U) => (T & U) | undefined;
82
- declare const formatUrlPath: ({ viewType, aid, model, id, actionPath, }: {
83
- viewType: "list" | "form" | "kanban" | any;
84
- actionPath: string;
85
- aid: string | number;
86
- model: string;
87
- id?: string | number;
88
- }) => string;
89
- declare const removeUndefinedFields: <T extends Record<string, any>>(obj: T) => Partial<T>;
90
- declare const useTabModel: (viewData: any, onchangeData: any) => any;
91
- declare const isBase64File: (str: any) => boolean;
92
- declare const isBase64Image: (str: any) => boolean;
93
- declare const checkIsImageLink: (url: any) => boolean;
94
- declare const formatFileSize: (size: any) => string;
95
- declare const getSubdomain: (url?: string) => string | null;
96
- declare const resequence: (arr: any, start: any, end: any) => any;
97
- declare const getOffSet: (arr: any, start: any, end: any) => any;
98
- declare const copyTextToClipboard: (text: string) => Promise<void>;
79
+ declare function cleanObject<T extends Record<string, any>>(obj: T): Partial<T>;
99
80
  declare const updateTokenParamInOriginalRequest: (originalRequest: {
100
81
  data?: any;
101
82
  }, newAccessToken: string) => any;
102
- declare const isObjectEmpty: (obj: object) => boolean;
103
- declare const useField: (props: any) => {
104
- invisible: boolean;
105
- required: boolean;
106
- readonly: boolean;
107
- nameField: string | null;
108
- };
109
- declare const downloadFile: (url: string, filename?: string) => Promise<void>;
110
- declare const extractIdFromDomain: (domain?: [string, string, any][]) => number | null;
111
83
 
112
- export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, extractIdFromDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
84
+ export { Domain, InvalidDomainError, checkDomain, cleanObject, domainHelper, evalDomain, evalJSONContext, evalJSONDomain, evalPartialContext, formatSortingString, makeContext, matchDomains, sessionStorageUtils, toQueryString, updateTokenParamInOriginalRequest };
package/dist/utils.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { L as LocalStorageUtilsType, l as localStorageUtils } from './local-storage-AbiOQTLK.js';
2
+
1
3
  declare const sessionStorageUtils: {
2
4
  getMenuFocus: () => IMenu;
3
5
  setMenuFocus: (menuTree: IMenu) => void;
@@ -14,21 +16,28 @@ interface IMenu {
14
16
  service: string;
15
17
  }
16
18
 
17
- declare class WesapError extends Error {
18
- code: number;
19
- constructor(message: string, code: number);
19
+ interface Context {
20
+ [key: string]: any;
20
21
  }
21
- declare function handleError(error: Error, env: {
22
- services: {
23
- notification: {
24
- error: (message: string) => void;
25
- };
26
- };
27
- }): void;
28
-
29
- declare const formatCurrency: (amount: number, currency?: string) => string;
30
- declare const formatDate: (date: string | Date, locale?: string) => string;
31
- declare const validateAndParseDate: (input: string, isDateTime?: boolean) => string | null;
22
+ type ContextDescription = Context | string | undefined;
23
+ /**
24
+ * Create an evaluated context from an arbitrary list of context representations.
25
+ * The evaluated context in construction is used along the way to evaluate further parts.
26
+ *
27
+ * @param contexts - Danh sách các context representations
28
+ * @param initialEvaluationContext - Context ban đầu để bắt đầu đánh giá (tùy chọn)
29
+ * @returns Context đã được đánh giá
30
+ */
31
+ declare function makeContext(contexts: ContextDescription[], initialEvaluationContext?: Context): Context;
32
+ /**
33
+ * Allow to evaluate a context with an incomplete evaluation context. The evaluated context only
34
+ * contains keys whose values are static or can be evaluated with the given evaluation context.
35
+ *
36
+ * @param context - Chuỗi context cần đánh giá
37
+ * @param evaluationContext - Context dùng để đánh giá (mặc định là rỗng)
38
+ * @returns Context đã được đánh giá một phần
39
+ */
40
+ declare function evalPartialContext(_context: string, evaluationContext?: Context): Context;
32
41
 
33
42
  type AST = {
34
43
  type: number;
@@ -37,6 +46,8 @@ type AST = {
37
46
  type Condition = [string | 0 | 1, string, any];
38
47
  type DomainListRepr = ('&' | '|' | '!' | Condition)[];
39
48
  type DomainRepr = DomainListRepr | string | Domain;
49
+ declare class InvalidDomainError extends Error {
50
+ }
40
51
  declare class Domain {
41
52
  ast: AST;
42
53
  static TRUE: Domain;
@@ -52,61 +63,22 @@ declare class Domain {
52
63
  toList(context: Record<string, any>): DomainListRepr;
53
64
  toJson(): DomainListRepr | string;
54
65
  }
66
+ declare function evalDomain(modifier: any[] | boolean, evalContext: Record<string, any>): boolean;
67
+ declare const checkDomain: (context: any, domain: any) => boolean;
68
+ declare const matchDomains: (context: any, domains: any) => boolean;
55
69
 
56
- declare const evalJSONContext: (_context: any, context?: {}) => any;
57
- declare const evalJSONDomain: (domain: any, context: any) => any;
58
- declare const formatSortingString: (input: string | null | undefined) => string | null;
59
70
  declare const domainHelper: {
60
71
  checkDomain: (context: any, domain: any) => boolean;
61
72
  matchDomains: (context: any, domains: any) => boolean;
62
73
  Domain: typeof Domain;
63
74
  };
75
+ declare const evalJSONContext: (_context: any, context?: {}) => any;
76
+ declare const evalJSONDomain: (domain: any, context: any) => any;
77
+ declare const formatSortingString: (input: string | null | undefined) => string | null;
64
78
  declare const toQueryString: (params: Record<string, string | number | boolean>) => string;
65
- declare const convertFloatToTime: (floatValue: number) => string;
66
- declare const convertTimeToFloat: (timeString: string) => number;
67
- declare const stringToColor: (name: string, id: number) => string;
68
- declare const getFieldsOnChange: (fields: any) => any;
69
- declare const filterFieldDirty: ({ id, viewData, formValues, dirtyFields, model, defaultData, keepZeroValue, }: {
70
- id?: any;
71
- viewData?: any;
72
- formValues?: any;
73
- dirtyFields?: any;
74
- model?: any;
75
- defaultData?: any;
76
- keepZeroValue?: boolean;
77
- }) => any;
78
- type MergeableObject = {
79
- [key: string]: any;
80
- } | null | undefined;
81
- declare const mergeObjects: <T extends MergeableObject, U extends MergeableObject>(object1: T, object2: U) => (T & U) | undefined;
82
- declare const formatUrlPath: ({ viewType, aid, model, id, actionPath, }: {
83
- viewType: "list" | "form" | "kanban" | any;
84
- actionPath: string;
85
- aid: string | number;
86
- model: string;
87
- id?: string | number;
88
- }) => string;
89
- declare const removeUndefinedFields: <T extends Record<string, any>>(obj: T) => Partial<T>;
90
- declare const useTabModel: (viewData: any, onchangeData: any) => any;
91
- declare const isBase64File: (str: any) => boolean;
92
- declare const isBase64Image: (str: any) => boolean;
93
- declare const checkIsImageLink: (url: any) => boolean;
94
- declare const formatFileSize: (size: any) => string;
95
- declare const getSubdomain: (url?: string) => string | null;
96
- declare const resequence: (arr: any, start: any, end: any) => any;
97
- declare const getOffSet: (arr: any, start: any, end: any) => any;
98
- declare const copyTextToClipboard: (text: string) => Promise<void>;
79
+ declare function cleanObject<T extends Record<string, any>>(obj: T): Partial<T>;
99
80
  declare const updateTokenParamInOriginalRequest: (originalRequest: {
100
81
  data?: any;
101
82
  }, newAccessToken: string) => any;
102
- declare const isObjectEmpty: (obj: object) => boolean;
103
- declare const useField: (props: any) => {
104
- invisible: boolean;
105
- required: boolean;
106
- readonly: boolean;
107
- nameField: string | null;
108
- };
109
- declare const downloadFile: (url: string, filename?: string) => Promise<void>;
110
- declare const extractIdFromDomain: (domain?: [string, string, any][]) => number | null;
111
83
 
112
- export { WesapError, checkIsImageLink, convertFloatToTime, convertTimeToFloat, copyTextToClipboard, domainHelper, downloadFile, evalJSONContext, evalJSONDomain, extractIdFromDomain, filterFieldDirty, formatCurrency, formatDate, formatFileSize, formatSortingString, formatUrlPath, getFieldsOnChange, getOffSet, getSubdomain, handleError, isBase64File, isBase64Image, isObjectEmpty, mergeObjects, removeUndefinedFields, resequence, sessionStorageUtils, stringToColor, toQueryString, updateTokenParamInOriginalRequest, useField, useTabModel, validateAndParseDate };
84
+ export { Domain, InvalidDomainError, checkDomain, cleanObject, domainHelper, evalDomain, evalJSONContext, evalJSONDomain, evalPartialContext, formatSortingString, makeContext, matchDomains, sessionStorageUtils, toQueryString, updateTokenParamInOriginalRequest };