@beinformed/ui 1.65.29 → 1.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/esm/hooks/useErrorHandler.js +26 -0
  3. package/esm/hooks/useErrorHandler.js.flow +31 -0
  4. package/esm/hooks/useErrorHandler.js.map +1 -0
  5. package/esm/hooks/useI18n.js +16 -2
  6. package/esm/hooks/useI18n.js.flow +21 -2
  7. package/esm/hooks/useI18n.js.map +1 -1
  8. package/esm/hooks/useModelSelectors.js +13 -2
  9. package/esm/hooks/useModelSelectors.js.flow +15 -1
  10. package/esm/hooks/useModelSelectors.js.map +1 -1
  11. package/esm/models/concepts/BusinessScenarioModel.js +1 -0
  12. package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
  13. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  14. package/esm/redux/_i18n/types.js.flow +14 -0
  15. package/esm/redux/_i18n/types.js.map +1 -1
  16. package/esm/redux/_modularui/ModularUISelectors.js +8 -2
  17. package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
  18. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  19. package/esm/redux/_modularui/types.js.flow +63 -0
  20. package/esm/redux/_modularui/types.js.map +1 -1
  21. package/esm/redux/_router/types.js.flow +45 -0
  22. package/esm/redux/_router/types.js.map +1 -1
  23. package/esm/redux/types.js.flow +144 -12
  24. package/esm/redux/types.js.map +1 -1
  25. package/lib/hooks/useErrorHandler.js +33 -0
  26. package/lib/hooks/useErrorHandler.js.map +1 -0
  27. package/lib/hooks/useI18n.js +16 -1
  28. package/lib/hooks/useI18n.js.map +1 -1
  29. package/lib/hooks/useModelSelectors.js +14 -1
  30. package/lib/hooks/useModelSelectors.js.map +1 -1
  31. package/lib/models/concepts/BusinessScenarioModel.js +1 -0
  32. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  33. package/lib/redux/_i18n/types.js.map +1 -1
  34. package/lib/redux/_modularui/ModularUISelectors.js +8 -2
  35. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  36. package/lib/redux/_modularui/types.js.map +1 -1
  37. package/lib/redux/_router/types.js.map +1 -1
  38. package/lib/redux/types.js.map +1 -1
  39. package/package.json +5 -5
@@ -29,6 +29,13 @@ export type ModularUIState = {
29
29
  ...
30
30
  };
31
31
 
32
+ /**
33
+ * @deprecated This manual action type will be removed in a future major release.
34
+ * Recommended fixes:
35
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
36
+ * - Use the appropriate hook to encapsulate this logic.
37
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
38
+ */
32
39
  export type SetModelAction = {
33
40
  type: "MODULARUI/SET",
34
41
  payload: {
@@ -37,6 +44,13 @@ export type SetModelAction = {
37
44
  },
38
45
  };
39
46
 
47
+ /**
48
+ * @deprecated This manual action type will be removed in a future major release.
49
+ * Recommended fixes:
50
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
51
+ * - Use the appropriate hook to encapsulate this logic.
52
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
53
+ */
40
54
  export type InitModelAction = {
41
55
  type: "MODULARUI/INIT",
42
56
  payload: Array<{
@@ -45,16 +59,37 @@ export type InitModelAction = {
45
59
  }>,
46
60
  };
47
61
 
62
+ /**
63
+ * @deprecated This manual action type will be removed in a future major release.
64
+ * Recommended fixes:
65
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
66
+ * - Use the appropriate hook to encapsulate this logic.
67
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
68
+ */
48
69
  export type UpdateModelAction = {
49
70
  type: "MODULARUI/UPDATE",
50
71
  payload: ModularUIModel,
51
72
  };
52
73
 
74
+ /**
75
+ * @deprecated This manual action type will be removed in a future major release.
76
+ * Recommended fixes:
77
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
78
+ * - Use the appropriate hook to encapsulate this logic.
79
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
80
+ */
53
81
  export type UpdateFormAction = {
54
82
  type: "MODULARUI/UPDATE_FORM",
55
83
  payload: ModularUIModel,
56
84
  };
57
85
 
86
+ /**
87
+ * @deprecated This manual action type will be removed in a future major release.
88
+ * Recommended fixes:
89
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
90
+ * - Use the appropriate hook to encapsulate this logic.
91
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
92
+ */
58
93
  export type SuccessAction = (
59
94
  model: ModularUIModel,
60
95
  ) => UpdateModelAction | SetModelAction;
@@ -63,6 +98,13 @@ export type ErrorAction = (
63
98
  error: FetchException,
64
99
  ) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;
65
100
 
101
+ /**
102
+ * @deprecated This manual action type will be removed in a future major release.
103
+ * Recommended fixes:
104
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
105
+ * - Use the appropriate hook to encapsulate this logic.
106
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
107
+ */
66
108
  export type ModularUIAction = {
67
109
  type: "MODULARUI/FETCH",
68
110
  payload: {
@@ -98,15 +140,36 @@ export type ModularUIAction = {
98
140
  },
99
141
  };
100
142
 
143
+ /**
144
+ * @deprecated This manual action type will be removed in a future major release.
145
+ * Recommended fixes:
146
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
147
+ * - Use the appropriate hook to encapsulate this logic.
148
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
149
+ */
101
150
  export type RemoveModelByKeyAction = {
102
151
  type: "MODULARUI/REMOVE_KEY",
103
152
  payload: string,
104
153
  };
105
154
 
155
+ /**
156
+ * @deprecated This manual action type will be removed in a future major release.
157
+ * Recommended fixes:
158
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
159
+ * - Use the appropriate hook to encapsulate this logic.
160
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
161
+ */
106
162
  export type ResetModularUIAction = {
107
163
  type: "MODULARUI/RESET",
108
164
  };
109
165
 
166
+ /**
167
+ * @deprecated This manual action type will be removed in a future major release.
168
+ * Recommended fixes:
169
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
170
+ * - Use the appropriate hook to encapsulate this logic.
171
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
172
+ */
110
173
  export type UpdateStatusAction = {
111
174
  type: "MODULARUI/STATUS",
112
175
  payload: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n +requestOptions?: any,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n origin?: string,\n contextPath?: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n isReload?: boolean,\n withCredentials?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n requestOptions: any,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
@@ -6,6 +6,13 @@ export type RouterState = {
6
6
  +action: HistoryAction,
7
7
  };
8
8
 
9
+ /**
10
+ * @deprecated This manual action type will be removed in a future major release.
11
+ * Recommended fixes:
12
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
13
+ * - Use the appropriate hook to encapsulate this logic.
14
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
15
+ */
9
16
  export type LocationChangeAction = {
10
17
  type: "ROUTER/LOCATION_CHANGE",
11
18
  payload: {
@@ -14,6 +21,13 @@ export type LocationChangeAction = {
14
21
  },
15
22
  };
16
23
 
24
+ /**
25
+ * @deprecated This manual action type will be removed in a future major release.
26
+ * Recommended fixes:
27
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
28
+ * - Use the appropriate hook to encapsulate this logic.
29
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
30
+ */
17
31
  export type PushAction = {
18
32
  type: "ROUTER/PUSH",
19
33
  payload: {
@@ -21,6 +35,14 @@ export type PushAction = {
21
35
  state?: { ... },
22
36
  },
23
37
  };
38
+
39
+ /**
40
+ * @deprecated This manual action type will be removed in a future major release.
41
+ * Recommended fixes:
42
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
43
+ * - Use the appropriate hook to encapsulate this logic.
44
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
45
+ */
24
46
  export type ReplaceAction = {
25
47
  type: "ROUTER/REPLACE",
26
48
  payload: {
@@ -28,16 +50,39 @@ export type ReplaceAction = {
28
50
  state?: { ... },
29
51
  },
30
52
  };
53
+
54
+ /**
55
+ * @deprecated This manual action type will be removed in a future major release.
56
+ * Recommended fixes:
57
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
58
+ * - Use the appropriate hook to encapsulate this logic.
59
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
60
+ */
31
61
  export type GoAction = {
32
62
  type: "ROUTER/GO",
33
63
  payload: {
34
64
  delta: number,
35
65
  },
36
66
  };
67
+
68
+ /**
69
+ * @deprecated This manual action type will be removed in a future major release.
70
+ * Recommended fixes:
71
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
72
+ * - Use the appropriate hook to encapsulate this logic.
73
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
74
+ */
37
75
  export type GoBackAction = {
38
76
  type: "ROUTER/GOBACK",
39
77
  };
40
78
 
79
+ /**
80
+ * @deprecated This manual action type will be removed in a future major release.
81
+ * Recommended fixes:
82
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
83
+ * - Use the appropriate hook to encapsulate this logic.
84
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
85
+ */
41
86
  export type GoForwardAction = {
42
87
  type: "ROUTER/GOFORWARD",
43
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_router/types.js"],"sourcesContent":["// @flow\nimport type { HistoryAction, Location, LocationShape } from \"react-router\";\n\nexport type RouterState = {\n +location: Location,\n +action: HistoryAction,\n};\n\nexport type LocationChangeAction = {\n type: \"ROUTER/LOCATION_CHANGE\",\n payload: {\n location: Location,\n action: HistoryAction,\n },\n};\n\nexport type PushAction = {\n type: \"ROUTER/PUSH\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\nexport type ReplaceAction = {\n type: \"ROUTER/REPLACE\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\nexport type GoAction = {\n type: \"ROUTER/GO\",\n payload: {\n delta: number,\n },\n};\nexport type GoBackAction = {\n type: \"ROUTER/GOBACK\",\n};\n\nexport type GoForwardAction = {\n type: \"ROUTER/GOFORWARD\",\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_router/types.js"],"sourcesContent":["// @flow\nimport type { HistoryAction, Location, LocationShape } from \"react-router\";\n\nexport type RouterState = {\n +location: Location,\n +action: HistoryAction,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type LocationChangeAction = {\n type: \"ROUTER/LOCATION_CHANGE\",\n payload: {\n location: Location,\n action: HistoryAction,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type PushAction = {\n type: \"ROUTER/PUSH\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ReplaceAction = {\n type: \"ROUTER/REPLACE\",\n payload: {\n location: string | LocationShape,\n state?: { ... },\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoAction = {\n type: \"ROUTER/GO\",\n payload: {\n delta: number,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoBackAction = {\n type: \"ROUTER/GOBACK\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type GoForwardAction = {\n type: \"ROUTER/GOFORWARD\",\n};\n"],"mappings":"","ignoreList":[]}
@@ -52,28 +52,66 @@ export type UpdateFormOptions = {
52
52
  validate?: boolean,
53
53
  };
54
54
 
55
+ /**
56
+ * @deprecated This manual action type will be removed in a future major release.
57
+ */
55
58
  export type NoAction = {
56
59
  type: "NO_ACTION",
57
60
  };
58
61
 
62
+ /**
63
+ * @deprecated This manual action type will be removed in a future major release.
64
+ * Recommended fixes:
65
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
66
+ * - Use the appropriate hook (useErrorHandler) to encapsulate this logic.
67
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
68
+ */
59
69
  export type SaveErrorAction = {
60
70
  type: "SAVE_ERROR",
61
71
  payload: ErrorResponse,
62
72
  };
63
73
 
74
+ /**
75
+ * @deprecated This manual action type will be removed in a future major release.
76
+ * Recommended fixes:
77
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
78
+ * - Use the appropriate hook (useModal) to encapsulate this logic.
79
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
80
+ */
64
81
  export type ShowModalAction = {
65
82
  type: "SHOW_MODAL",
66
83
  payload: string,
67
84
  };
68
85
 
86
+ /**
87
+ * @deprecated This manual action type will be removed in a future major release.
88
+ * Recommended fixes:
89
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
90
+ * - Use the appropriate hook (useModal) to encapsulate this logic.
91
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
92
+ */
69
93
  export type CloseModalAction = {
70
94
  type: "CLOSE_MODAL",
71
95
  payload: string,
72
96
  };
73
97
 
98
+ /**
99
+ * @deprecated This manual action type will be removed in a future major release.
100
+ * Recommended fixes:
101
+ * - Type component props as a simple callback: e.g. onDismiss: () => void`.
102
+ * - Use the appropriate hook (useNotification) to encapsulate this logic.
103
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
104
+ */
74
105
  export type DismissNotificationAction = {
75
106
  type: "DISMISS_NOTIFICATION",
76
107
  };
108
+ /**
109
+ * @deprecated This manual action type will be removed in a future major release.
110
+ * Recommended fixes:
111
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
112
+ * - Use the appropriate hook (useNotification) to encapsulate this logic.
113
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
114
+ */
77
115
  export type ShowNotificationAction = {
78
116
  type: "SHOW_NOTIFICATION",
79
117
  payload: {
@@ -83,50 +121,134 @@ export type ShowNotificationAction = {
83
121
  },
84
122
  };
85
123
 
124
+ /**
125
+ * @deprecated This manual action type will be removed in a future major release.
126
+ * Recommended fixes:
127
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
128
+ * - Use the appropriate hook (usePreference) to encapsulate this logic.
129
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
130
+ */
86
131
  export type SetPreferenceAction = {
87
132
  type: "SET_PREFERENCE",
88
133
  payload: { [name: string]: PreferenceValue },
89
134
  };
135
+ /**
136
+ * @deprecated This manual action type will be removed in a future major release.
137
+ * Recommended fixes:
138
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
139
+ * - Use the appropriate hook (usePreference) to encapsulate this logic.
140
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
141
+ */
90
142
  export type SetPreferencesAction = {
91
143
  type: "SET_PREFERENCES",
92
144
  payload: { [name: string]: PreferenceValue },
93
145
  };
94
146
 
147
+ /**
148
+ * @deprecated This manual action type will be removed in a future major release.
149
+ * Recommended fixes:
150
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
151
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
152
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
153
+ */
95
154
  export type StartProgressAction = {
96
155
  type: "START_PROGRESS",
97
156
  };
157
+ /**
158
+ * @deprecated This manual action type will be removed in a future major release.
159
+ * Recommended fixes:
160
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
161
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
162
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
163
+ */
98
164
  export type FinishProgressAction = {
99
165
  type: "FINISH_PROGRESS",
100
166
  };
167
+ /**
168
+ * @deprecated This manual action type will be removed in a future major release.
169
+ * Recommended fixes:
170
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
171
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
172
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
173
+ */
101
174
  export type ResetProgressAction = {
102
175
  type: "RESET_PROGRESS",
103
176
  };
177
+ /**
178
+ * @deprecated This manual action type will be removed in a future major release.
179
+ * Recommended fixes:
180
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
181
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
182
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
183
+ */
104
184
  export type UpdateProgressAction = {
105
185
  type: "UPDATE_PROGRESS",
106
186
  payload: { percentComplete: number },
107
187
  };
108
188
 
189
+ /**
190
+ * @deprecated This manual action type will be removed in a future major release.
191
+ * Recommended fixes:
192
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
193
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
194
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
195
+ */
109
196
  export type SendAuthenticationErrorAction = {
110
197
  type: "AUTHENTICATION_ERROR",
111
198
  payload: string,
112
199
  };
113
200
 
201
+ /**
202
+ * @deprecated This manual action type will be removed in a future major release.
203
+ * Recommended fixes:
204
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
205
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
206
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
207
+ */
114
208
  export type ResetAuthErrorsAction = {
115
209
  type: "AUTHENTICATION_RESET_ERRORS",
116
210
  };
117
211
 
212
+ /**
213
+ * @deprecated This manual action type will be removed in a future major release.
214
+ * Recommended fixes:
215
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
216
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
217
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
218
+ */
118
219
  export type LoginSuccessAction = {
119
220
  type: "AUTHENTICATION_SUCCESS",
120
221
  };
121
222
 
223
+ /**
224
+ * @deprecated This manual action type will be removed in a future major release.
225
+ * Recommended fixes:
226
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
227
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
228
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
229
+ */
122
230
  export type ChangePasswordAction = {
123
231
  type: "CHANGE_PASSWORD",
124
232
  };
125
233
 
234
+ /**
235
+ * @deprecated This manual action type will be removed in a future major release.
236
+ * Recommended fixes:
237
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
238
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
239
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
240
+ */
126
241
  export type LogoutSuccessAction = {
127
242
  type: "AUTHENTICATION_LOGOUT",
128
243
  };
129
244
 
245
+ /**
246
+ * @deprecated This manual action type will be removed in a future major release.
247
+ * Recommended fixes:
248
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
249
+ * - Use the appropriate hook (useFormNavigation) to encapsulate this logic.
250
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
251
+ */
130
252
  export type UpdateAutosaveAction = {
131
253
  type: "UPDATE_AUTOSAVE_STATUS",
132
254
  payload: {
@@ -135,11 +257,21 @@ export type UpdateAutosaveAction = {
135
257
  },
136
258
  };
137
259
 
260
+ /**
261
+ * @deprecated This manual action type will be removed in a future major release.
262
+ * Recommended fixes:
263
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
264
+ * - Use the appropriate hook to encapsulate this logic.
265
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
266
+ */
138
267
  export type UpdateEntryDateAction = {
139
268
  type: "UPDATE_ENTRYDATE",
140
269
  payload: ISO_DATE,
141
270
  };
142
271
 
272
+ /**
273
+ * @deprecated This union type is a legacy pattern and is not maintained for new actions.
274
+ */
143
275
  export type ReduxAction =
144
276
  | UpdateStatusAction
145
277
  | SetModelAction
@@ -177,7 +309,6 @@ export type ReduxAction =
177
309
  | ModularUIAction
178
310
  | NoAction;
179
311
 
180
- // Redux state
181
312
  export type AuthState = {
182
313
  +mustChangePassword: boolean,
183
314
  +error: ?string,
@@ -232,9 +363,6 @@ export type ReduxState = {
232
363
 
233
364
  export type GetState = () => ReduxState;
234
365
 
235
- /**
236
- * A function that accepts a listener callback and returns an unsubscribe function.
237
- */
238
366
  export type Subscribe = (listener: () => void) => () => void;
239
367
 
240
368
  export type ThunkExtra = {
@@ -242,28 +370,32 @@ export type ThunkExtra = {
242
370
  ...
243
371
  };
244
372
 
245
- // 1. Define ThunkAction first.
246
- // We use 'any' for Dispatch here temporarily to break the circularity
247
- // or use the specialized function type.
248
373
  export type ThunkAction<R = any> = (
249
374
  dispatch: Dispatch,
250
375
  getState: GetState,
251
376
  extra: ThunkExtra,
252
377
  ) => R;
253
378
 
379
+ /**
380
+ * @deprecated This manual action type will be removed in a future major release.
381
+ * Recommended fixes:
382
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
383
+ * - Use the appropriate hook to encapsulate this logic.
384
+ */
254
385
  export type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;
255
386
 
256
- // 2. Define Dispatch as a naked function type.
257
- // This is much more reliable in modern Flow than DispatchAPI<...>.
258
387
  export type Dispatch = (
259
388
  action: ReduxAction | ThunkAction<any> | PromiseAction,
260
389
  ) => any;
261
390
 
262
- // 3. Update ReduxStore to use the ReduxAction for the base reducer
263
- // but our custom Dispatch for the store instance.
264
391
  export type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;
265
392
 
266
- // 4. Clean up PossibleAction if you still use it elsewhere
393
+ /**
394
+ * @deprecated This manual action type will be removed in a future major release.
395
+ * Recommended fixes:
396
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
397
+ * - Use the appropriate hook to encapsulate this logic.
398
+ */
267
399
  export type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;
268
400
 
269
401
  export type CustomReducers = { [reducerKey: string]: any };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\n\n/**\n * A function that accepts a listener callback and returns an unsubscribe function.\n */\nexport type Subscribe = (listener: () => void) => () => void;\n\nexport type ThunkExtra = {\n subscribe: Subscribe,\n ...\n};\n\n// 1. Define ThunkAction first.\n// We use 'any' for Dispatch here temporarily to break the circularity\n// or use the specialized function type.\nexport type ThunkAction<R = any> = (\n dispatch: Dispatch,\n getState: GetState,\n extra: ThunkExtra,\n) => R;\n\nexport type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;\n\n// 2. Define Dispatch as a naked function type.\n// This is much more reliable in modern Flow than DispatchAPI<...>.\nexport type Dispatch = (\n action: ReduxAction | ThunkAction<any> | PromiseAction,\n) => any;\n\n// 3. Update ReduxStore to use the ReduxAction for the base reducer\n// but our custom Dispatch for the store instance.\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n// 4. Clean up PossibleAction if you still use it elsewhere\nexport type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n InitModelAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n autoupdate: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n */\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useErrorHandler) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useModal) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useModal) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. onDismiss: () => void`.\n * - Use the appropriate hook (useNotification) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useNotification) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (usePreference) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (usePreference) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useAuthentication) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type SendAuthenticationErrorAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useAuthentication) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useAuthentication) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useAuthentication) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useAuthentication) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook (useFormNavigation) to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.\n */\nexport type UpdateEntryDateAction = {\n type: \"UPDATE_ENTRYDATE\",\n payload: ISO_DATE,\n};\n\n/**\n * @deprecated This union type is a legacy pattern and is not maintained for new actions.\n */\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | InitModelAction\n | UpdateModelAction\n | UpdateFormAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | ResetAuthErrorsAction\n | SendAuthenticationErrorAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | UpdateEntryDateAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +modelcatalog: ModelCatalogState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\n\nexport type Subscribe = (listener: () => void) => () => void;\n\nexport type ThunkExtra = {\n subscribe: Subscribe,\n ...\n};\n\nexport type ThunkAction<R = any> = (\n dispatch: Dispatch,\n getState: GetState,\n extra: ThunkExtra,\n) => R;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n */\nexport type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;\n\nexport type Dispatch = (\n action: ReduxAction | ThunkAction<any> | PromiseAction,\n) => any;\n\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n * Recommended fixes:\n * - Type component props as a simple callback: e.g. `onDismiss: () => void`.\n * - Use the appropriate hook to encapsulate this logic.\n */\nexport type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.useErrorHandler = void 0;
8
+ var _reactRedux = require("react-redux");
9
+ var _react = require("react");
10
+ var _Error = require("../redux/actions/Error");
11
+ var _FetchException = _interopRequireDefault(require("../exceptions/FetchException"));
12
+ /**
13
+ * A hook that returns a memoized function to handle application-wide errors.
14
+ *
15
+ * By default, this handler orchestrates:
16
+ * - Redirects for unauthorized, blocked, or concurrent users.
17
+ * - Handles forced password change triggers.
18
+ * - Saves the error in the Redux store (server-side).
19
+ * - Triggers global XHR error notifications.
20
+ */
21
+ const useErrorHandler = () => {
22
+ const dispatch = (0, _reactRedux.useDispatch)();
23
+ return (0, _react.useCallback)(
24
+ /**
25
+ * @param {string | Error | FetchException} error - The error object or message to process.
26
+ */
27
+ error => {
28
+ const err = typeof error === "string" ? new Error(error) : error;
29
+ dispatch((0, _Error.handleError)(err));
30
+ }, [dispatch]);
31
+ };
32
+ exports.useErrorHandler = useErrorHandler;
33
+ //# sourceMappingURL=useErrorHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useErrorHandler.js","names":["_reactRedux","require","_react","_Error","_FetchException","_interopRequireDefault","useErrorHandler","dispatch","useDispatch","useCallback","error","err","Error","handleError","exports"],"sources":["../../src/hooks/useErrorHandler.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useCallback } from \"react\";\nimport { handleError } from \"../redux/actions/Error\";\nimport FetchException from \"../exceptions/FetchException\";\n\n/**\n * A hook that returns a memoized function to handle application-wide errors.\n *\n * By default, this handler orchestrates:\n * - Redirects for unauthorized, blocked, or concurrent users.\n * - Handles forced password change triggers.\n * - Saves the error in the Redux store (server-side).\n * - Triggers global XHR error notifications.\n */\nexport const useErrorHandler = (): ((\n error: string | Error | FetchException,\n) => void) => {\n const dispatch = useDispatch();\n\n return useCallback(\n /**\n * @param {string | Error | FetchException} error - The error object or message to process.\n */\n (error: string | Error | FetchException) => {\n const err = typeof error === \"string\" ? new Error(error) : error;\n dispatch(handleError(err));\n },\n [dispatch],\n );\n};\n"],"mappings":";;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMK,eAAe,GAAGA,CAAA,KAEjB;EACZ,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,OAAO,IAAAC,kBAAW;EAChB;AACJ;AACA;EACKC,KAAsC,IAAK;IAC1C,MAAMC,GAAG,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAG,IAAIE,KAAK,CAACF,KAAK,CAAC,GAAGA,KAAK;IAChEH,QAAQ,CAAC,IAAAM,kBAAW,EAACF,GAAG,CAAC,CAAC;EAC5B,CAAC,EACD,CAACJ,QAAQ,CACX,CAAC;AACH,CAAC;AAACO,OAAA,CAAAR,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -4,13 +4,15 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.useTranslate = exports.useMessage = exports.useLocaleCodes = exports.useLocale = void 0;
7
+ exports.useUpdateLocale = exports.useTranslate = exports.useMessage = exports.useLocaleCodes = exports.useLocale = void 0;
8
8
  var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
9
9
  var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
10
+ var _react = require("react");
10
11
  var _reactRedux = require("react-redux");
11
12
  var _reselect = require("reselect");
12
13
  var _memoize = _interopRequireDefault(require("lodash/memoize"));
13
14
  var _i18n = require("../redux/selectors/i18n");
15
+ var _I18nActions = require("../redux/_i18n/I18nActions");
14
16
  const getMessage = (0, _reselect.createSelector)([_i18n.getLocales, _i18n.getLocale], (locales, localeCode) => (0, _memoize.default)((id, defaultMessage, placeholders) => locales.getLocale(localeCode).getMessage(id, defaultMessage, placeholders), (...args) => (0, _stringify.default)(args)));
15
17
 
16
18
  /**
@@ -33,5 +35,18 @@ const getLocaleCodes = (0, _reselect.createSelector)(state => state.i18n.locales
33
35
  * Retrieve all available locale codes
34
36
  */
35
37
  const useLocaleCodes = () => (0, _reactRedux.useSelector)(getLocaleCodes);
38
+
39
+ /**
40
+ * A hook that returns a memoized function to update the application locale.
41
+ *
42
+ * @returns {(locale: string) => void} A memoized function to update the locale.
43
+ */
36
44
  exports.useLocaleCodes = useLocaleCodes;
45
+ const useUpdateLocale = () => {
46
+ const dispatch = (0, _reactRedux.useDispatch)();
47
+ return (0, _react.useCallback)(locale => {
48
+ dispatch((0, _I18nActions.updateLocale)(locale));
49
+ }, [dispatch]);
50
+ };
51
+ exports.useUpdateLocale = useUpdateLocale;
37
52
  //# sourceMappingURL=useI18n.js.map