@beinformed/ui 1.65.28 → 1.66.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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +59 -18
  3. package/esm/hooks/useErrorHandler.js +26 -0
  4. package/esm/hooks/useErrorHandler.js.flow +31 -0
  5. package/esm/hooks/useErrorHandler.js.map +1 -0
  6. package/esm/hooks/useI18n.js +16 -2
  7. package/esm/hooks/useI18n.js.flow +21 -2
  8. package/esm/hooks/useI18n.js.map +1 -1
  9. package/esm/hooks/useModelSelectors.js +13 -2
  10. package/esm/hooks/useModelSelectors.js.flow +15 -1
  11. package/esm/hooks/useModelSelectors.js.map +1 -1
  12. package/esm/models/concepts/BusinessScenarioModel.js +1 -0
  13. package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
  14. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  15. package/esm/models/concepts/ConceptDetailModel.js +47 -49
  16. package/esm/models/concepts/ConceptDetailModel.js.flow +37 -52
  17. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  18. package/esm/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +27 -7
  19. package/esm/redux/_i18n/types.js.flow +16 -0
  20. package/esm/redux/_i18n/types.js.map +1 -1
  21. package/esm/redux/_modularui/ModularUISelectors.js +8 -2
  22. package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
  23. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  24. package/esm/redux/_modularui/types.js.flow +72 -0
  25. package/esm/redux/_modularui/types.js.map +1 -1
  26. package/esm/redux/_router/types.js.flow +51 -0
  27. package/esm/redux/_router/types.js.map +1 -1
  28. package/esm/redux/types.js.flow +276 -1
  29. package/esm/redux/types.js.map +1 -1
  30. package/lib/hooks/useErrorHandler.js +33 -0
  31. package/lib/hooks/useErrorHandler.js.map +1 -0
  32. package/lib/hooks/useI18n.js +16 -1
  33. package/lib/hooks/useI18n.js.map +1 -1
  34. package/lib/hooks/useModelSelectors.js +14 -1
  35. package/lib/hooks/useModelSelectors.js.map +1 -1
  36. package/lib/models/concepts/BusinessScenarioModel.js +1 -0
  37. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  38. package/lib/models/concepts/ConceptDetailModel.js +47 -49
  39. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  40. package/lib/redux/_i18n/types.js.map +1 -1
  41. package/lib/redux/_modularui/ModularUISelectors.js +8 -2
  42. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  43. package/lib/redux/_modularui/types.js.map +1 -1
  44. package/lib/redux/_router/types.js.map +1 -1
  45. package/lib/redux/types.js.map +1 -1
  46. package/package.json +6 -6
@@ -6,6 +6,14 @@ 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
+ *
12
+ * Recommended fixes:
13
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
14
+ * - Use the appropriate hook to encapsulate this logic.
15
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
16
+ */
9
17
  export type LocationChangeAction = {
10
18
  type: "ROUTER/LOCATION_CHANGE",
11
19
  payload: {
@@ -14,6 +22,14 @@ export type LocationChangeAction = {
14
22
  },
15
23
  };
16
24
 
25
+ /**
26
+ * @deprecated This manual action type will be removed in a future major release.
27
+ *
28
+ * Recommended fixes:
29
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
30
+ * - Use the appropriate hook to encapsulate this logic.
31
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
32
+ */
17
33
  export type PushAction = {
18
34
  type: "ROUTER/PUSH",
19
35
  payload: {
@@ -21,6 +37,15 @@ export type PushAction = {
21
37
  state?: { ... },
22
38
  },
23
39
  };
40
+
41
+ /**
42
+ * @deprecated This manual action type will be removed in a future major release.
43
+ *
44
+ * Recommended fixes:
45
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
46
+ * - Use the appropriate hook to encapsulate this logic.
47
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
48
+ */
24
49
  export type ReplaceAction = {
25
50
  type: "ROUTER/REPLACE",
26
51
  payload: {
@@ -28,16 +53,42 @@ export type ReplaceAction = {
28
53
  state?: { ... },
29
54
  },
30
55
  };
56
+
57
+ /**
58
+ * @deprecated This manual action type will be removed in a future major release.
59
+ *
60
+ * Recommended fixes:
61
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
62
+ * - Use the appropriate hook to encapsulate this logic.
63
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
64
+ */
31
65
  export type GoAction = {
32
66
  type: "ROUTER/GO",
33
67
  payload: {
34
68
  delta: number,
35
69
  },
36
70
  };
71
+
72
+ /**
73
+ * @deprecated This manual action type will be removed in a future major release.
74
+ *
75
+ * Recommended fixes:
76
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
77
+ * - Use the appropriate hook to encapsulate this logic.
78
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
79
+ */
37
80
  export type GoBackAction = {
38
81
  type: "ROUTER/GOBACK",
39
82
  };
40
83
 
84
+ /**
85
+ * @deprecated This manual action type will be removed in a future major release.
86
+ *
87
+ * Recommended fixes:
88
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
89
+ * - Use the appropriate hook to encapsulate this logic.
90
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
91
+ */
41
92
  export type GoForwardAction = {
42
93
  type: "ROUTER/GOFORWARD",
43
94
  };
@@ -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 *\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 *\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 *\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 *\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 *\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 *\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,71 @@ 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
+ *
65
+ * Recommended fixes:
66
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
67
+ * - Use the appropriate hook (useErrorHandler) to encapsulate this logic.
68
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
69
+ */
59
70
  export type SaveErrorAction = {
60
71
  type: "SAVE_ERROR",
61
72
  payload: ErrorResponse,
62
73
  };
63
74
 
75
+ /**
76
+ * @deprecated This manual action type will be removed in a future major release.
77
+ *
78
+ * Recommended fixes:
79
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
80
+ * - Use the appropriate hook (useModal) to encapsulate this logic.
81
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
82
+ */
64
83
  export type ShowModalAction = {
65
84
  type: "SHOW_MODAL",
66
85
  payload: string,
67
86
  };
68
87
 
88
+ /**
89
+ * @deprecated This manual action type will be removed in a future major release.
90
+ *
91
+ * Recommended fixes:
92
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
93
+ * - Use the appropriate hook (useModal) to encapsulate this logic.
94
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
95
+ */
69
96
  export type CloseModalAction = {
70
97
  type: "CLOSE_MODAL",
71
98
  payload: string,
72
99
  };
73
100
 
101
+ /**
102
+ * @deprecated This manual action type will be removed in a future major release.
103
+ *
104
+ * Recommended fixes:
105
+ * - Type component props as a simple callback: e.g. onDismiss: () => void`.
106
+ * - Use the appropriate hook (useNotification) to encapsulate this logic.
107
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
108
+ */
74
109
  export type DismissNotificationAction = {
75
110
  type: "DISMISS_NOTIFICATION",
76
111
  };
112
+ /**
113
+ * @deprecated This manual action type will be removed in a future major release.
114
+ *
115
+ * Recommended fixes:
116
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
117
+ * - Use the appropriate hook (useNotification) to encapsulate this logic.
118
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
119
+ */
77
120
  export type ShowNotificationAction = {
78
121
  type: "SHOW_NOTIFICATION",
79
122
  payload: {
@@ -83,50 +126,146 @@ export type ShowNotificationAction = {
83
126
  },
84
127
  };
85
128
 
129
+ /**
130
+ * @deprecated This manual action type will be removed in a future major release.
131
+ *
132
+ * Recommended fixes:
133
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
134
+ * - Use the appropriate hook (usePreference) to encapsulate this logic.
135
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
136
+ */
86
137
  export type SetPreferenceAction = {
87
138
  type: "SET_PREFERENCE",
88
139
  payload: { [name: string]: PreferenceValue },
89
140
  };
141
+ /**
142
+ * @deprecated This manual action type will be removed in a future major release.
143
+ *
144
+ * Recommended fixes:
145
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
146
+ * - Use the appropriate hook (usePreference) to encapsulate this logic.
147
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
148
+ */
90
149
  export type SetPreferencesAction = {
91
150
  type: "SET_PREFERENCES",
92
151
  payload: { [name: string]: PreferenceValue },
93
152
  };
94
153
 
154
+ /**
155
+ * @deprecated This manual action type will be removed in a future major release.
156
+ *
157
+ * Recommended fixes:
158
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
159
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
160
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
161
+ */
95
162
  export type StartProgressAction = {
96
163
  type: "START_PROGRESS",
97
164
  };
165
+ /**
166
+ * @deprecated This manual action type will be removed in a future major release.
167
+ *
168
+ * Recommended fixes:
169
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
170
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
171
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
172
+ */
98
173
  export type FinishProgressAction = {
99
174
  type: "FINISH_PROGRESS",
100
175
  };
176
+ /**
177
+ * @deprecated This manual action type will be removed in a future major release.
178
+ *
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
+ */
101
184
  export type ResetProgressAction = {
102
185
  type: "RESET_PROGRESS",
103
186
  };
187
+ /**
188
+ * @deprecated This manual action type will be removed in a future major release.
189
+ *
190
+ * Recommended fixes:
191
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
192
+ * - Use the appropriate hook (useProgressIndicator) to encapsulate this logic.
193
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
194
+ */
104
195
  export type UpdateProgressAction = {
105
196
  type: "UPDATE_PROGRESS",
106
197
  payload: { percentComplete: number },
107
198
  };
108
199
 
200
+ /**
201
+ * @deprecated This manual action type will be removed in a future major release.
202
+ *
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
+ */
109
208
  export type SendAuthenticationErrorAction = {
110
209
  type: "AUTHENTICATION_ERROR",
111
210
  payload: string,
112
211
  };
113
212
 
213
+ /**
214
+ * @deprecated This manual action type will be removed in a future major release.
215
+ *
216
+ * Recommended fixes:
217
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
218
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
219
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
220
+ */
114
221
  export type ResetAuthErrorsAction = {
115
222
  type: "AUTHENTICATION_RESET_ERRORS",
116
223
  };
117
224
 
225
+ /**
226
+ * @deprecated This manual action type will be removed in a future major release.
227
+ *
228
+ * Recommended fixes:
229
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
230
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
231
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
232
+ */
118
233
  export type LoginSuccessAction = {
119
234
  type: "AUTHENTICATION_SUCCESS",
120
235
  };
121
236
 
237
+ /**
238
+ * @deprecated This manual action type will be removed in a future major release.
239
+ *
240
+ * Recommended fixes:
241
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
242
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
243
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
244
+ */
122
245
  export type ChangePasswordAction = {
123
246
  type: "CHANGE_PASSWORD",
124
247
  };
125
248
 
249
+ /**
250
+ * @deprecated This manual action type will be removed in a future major release.
251
+ *
252
+ * Recommended fixes:
253
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
254
+ * - Use the appropriate hook (useAuthentication) to encapsulate this logic.
255
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
256
+ */
126
257
  export type LogoutSuccessAction = {
127
258
  type: "AUTHENTICATION_LOGOUT",
128
259
  };
129
260
 
261
+ /**
262
+ * @deprecated This manual action type will be removed in a future major release.
263
+ *
264
+ * Recommended fixes:
265
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
266
+ * - Use the appropriate hook (useFormNavigation) to encapsulate this logic.
267
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
268
+ */
130
269
  export type UpdateAutosaveAction = {
131
270
  type: "UPDATE_AUTOSAVE_STATUS",
132
271
  payload: {
@@ -135,11 +274,22 @@ export type UpdateAutosaveAction = {
135
274
  },
136
275
  };
137
276
 
277
+ /**
278
+ * @deprecated This manual action type will be removed in a future major release.
279
+ *
280
+ * Recommended fixes:
281
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
282
+ * - Use the appropriate hook to encapsulate this logic.
283
+ * - Reference the action object type for middleware, use ReturnType<typeof actionCreator>.
284
+ */
138
285
  export type UpdateEntryDateAction = {
139
286
  type: "UPDATE_ENTRYDATE",
140
287
  payload: ISO_DATE,
141
288
  };
142
289
 
290
+ /**
291
+ * @deprecated This union type is a legacy pattern and is not maintained for new actions.
292
+ */
143
293
  export type ReduxAction =
144
294
  | UpdateStatusAction
145
295
  | SetModelAction
@@ -177,24 +327,58 @@ export type ReduxAction =
177
327
  | ModularUIAction
178
328
  | NoAction;
179
329
 
180
- // Redux state
330
+ /**
331
+ * @deprecated This manual action type will be removed in a future major release.
332
+ *
333
+ * Recommended fixes:
334
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
335
+ * - Use the appropriate hook to encapsulate this logic.
336
+ */
181
337
  export type AuthState = {
182
338
  +mustChangePassword: boolean,
183
339
  +error: ?string,
184
340
  };
185
341
 
342
+ /**
343
+ * @deprecated This manual action type will be removed in a future major release.
344
+ *
345
+ * Recommended fixes:
346
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
347
+ * - Use the appropriate hook to encapsulate this logic.
348
+ */
186
349
  export type ErrorState = null | ErrorResponse;
187
350
 
351
+ /**
352
+ * @deprecated This manual action type will be removed in a future major release.
353
+ *
354
+ * Recommended fixes:
355
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
356
+ * - Use the appropriate hook to encapsulate this logic.
357
+ */
188
358
  export type ModalState = {
189
359
  +key: string,
190
360
  +visible: boolean,
191
361
  +size?: string,
192
362
  };
193
363
 
364
+ /**
365
+ * @deprecated This manual action type will be removed in a future major release.
366
+ *
367
+ * Recommended fixes:
368
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
369
+ * - Use the appropriate hook to encapsulate this logic.
370
+ */
194
371
  export type ModalsState = {
195
372
  +modals: Array<ModalState>,
196
373
  };
197
374
 
375
+ /**
376
+ * @deprecated This manual action type will be removed in a future major release.
377
+ *
378
+ * Recommended fixes:
379
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
380
+ * - Use the appropriate hook to encapsulate this logic.
381
+ */
198
382
  export type NotificationState = {
199
383
  +render: boolean,
200
384
  +messageType: string | null,
@@ -202,20 +386,48 @@ export type NotificationState = {
202
386
  +error: ?ErrorResponse | null,
203
387
  };
204
388
 
389
+ /**
390
+ * @deprecated This manual action type will be removed in a future major release.
391
+ *
392
+ * Recommended fixes:
393
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
394
+ * - Use the appropriate hook to encapsulate this logic.
395
+ */
205
396
  export type PreferencesState = {
206
397
  +[name: string]: PreferenceValue,
207
398
  };
208
399
 
400
+ /**
401
+ * @deprecated This manual action type will be removed in a future major release.
402
+ *
403
+ * Recommended fixes:
404
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
405
+ * - Use the appropriate hook to encapsulate this logic.
406
+ */
209
407
  export type ProgressIndicatorState = {
210
408
  +count: number,
211
409
  +timestamp: number,
212
410
  +percentComplete: number,
213
411
  };
214
412
 
413
+ /**
414
+ * @deprecated This manual action type will be removed in a future major release.
415
+ *
416
+ * Recommended fixes:
417
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
418
+ * - Use the appropriate hook to encapsulate this logic.
419
+ */
215
420
  export type ModelCatalogState = {
216
421
  entryDate: ISO_DATE | null,
217
422
  };
218
423
 
424
+ /**
425
+ * @deprecated This manual action type will be removed in a future major release.
426
+ *
427
+ * Recommended fixes:
428
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
429
+ * - Use the appropriate hook to encapsulate this logic.
430
+ */
219
431
  export type ReduxState = {
220
432
  +router: RouterState,
221
433
  +modularui: ModularUIState,
@@ -230,13 +442,34 @@ export type ReduxState = {
230
442
  ...
231
443
  };
232
444
 
445
+ /**
446
+ * @deprecated This manual action type will be removed in a future major release.
447
+ *
448
+ * Recommended fixes:
449
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
450
+ * - Use the appropriate hook to encapsulate this logic.
451
+ */
233
452
  export type GetState = () => ReduxState;
234
453
 
235
454
  /**
236
455
  * A function that accepts a listener callback and returns an unsubscribe function.
237
456
  */
457
+ /**
458
+ * @deprecated This manual action type will be removed in a future major release.
459
+ *
460
+ * Recommended fixes:
461
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
462
+ * - Use the appropriate hook to encapsulate this logic.
463
+ */
238
464
  export type Subscribe = (listener: () => void) => () => void;
239
465
 
466
+ /**
467
+ * @deprecated This manual action type will be removed in a future major release.
468
+ *
469
+ * Recommended fixes:
470
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
471
+ * - Use the appropriate hook to encapsulate this logic.
472
+ */
240
473
  export type ThunkExtra = {
241
474
  subscribe: Subscribe,
242
475
  ...
@@ -245,25 +478,67 @@ export type ThunkExtra = {
245
478
  // 1. Define ThunkAction first.
246
479
  // We use 'any' for Dispatch here temporarily to break the circularity
247
480
  // or use the specialized function type.
481
+ /**
482
+ * @deprecated This manual action type will be removed in a future major release.
483
+ *
484
+ * Recommended fixes:
485
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
486
+ * - Use the appropriate hook to encapsulate this logic.
487
+ */
248
488
  export type ThunkAction<R = any> = (
249
489
  dispatch: Dispatch,
250
490
  getState: GetState,
251
491
  extra: ThunkExtra,
252
492
  ) => R;
253
493
 
494
+ /**
495
+ * @deprecated This manual action type will be removed in a future major release.
496
+ *
497
+ * Recommended fixes:
498
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
499
+ * - Use the appropriate hook to encapsulate this logic.
500
+ */
254
501
  export type PromiseAction = Promise<ReduxAction | ThunkAction<any>>;
255
502
 
256
503
  // 2. Define Dispatch as a naked function type.
257
504
  // This is much more reliable in modern Flow than DispatchAPI<...>.
505
+ /**
506
+ * @deprecated This manual action type will be removed in a future major release.
507
+ *
508
+ * Recommended fixes:
509
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
510
+ * - Use the appropriate hook to encapsulate this logic.
511
+ */
258
512
  export type Dispatch = (
259
513
  action: ReduxAction | ThunkAction<any> | PromiseAction,
260
514
  ) => any;
261
515
 
262
516
  // 3. Update ReduxStore to use the ReduxAction for the base reducer
263
517
  // but our custom Dispatch for the store instance.
518
+ /**
519
+ * @deprecated This manual action type will be removed in a future major release.
520
+ *
521
+ * Recommended fixes:
522
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
523
+ * - Use the appropriate hook to encapsulate this logic.
524
+ */
264
525
  export type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;
265
526
 
266
527
  // 4. Clean up PossibleAction if you still use it elsewhere
528
+ /**
529
+ * @deprecated This manual action type will be removed in a future major release.
530
+ *
531
+ * Recommended fixes:
532
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
533
+ * - Use the appropriate hook to encapsulate this logic.
534
+ */
267
535
  export type PossibleAction = ReduxAction | ThunkAction<any> | PromiseAction;
268
536
 
537
+ /**
538
+ * @deprecated This manual action type will be removed in a future major release.
539
+ *
540
+ * Recommended fixes:
541
+ * - Type component props as a simple callback: e.g. `onDismiss: () => void`.
542
+ * - Use the appropriate hook to encapsulate this logic.
543
+ */
269
544
  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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ErrorState = null | ErrorResponse;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ModalsState = {\n +modals: Array<ModalState>,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ModelCatalogState = {\n entryDate: ISO_DATE | null,\n};\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 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\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 GetState = () => ReduxState;\n\n/**\n * A function that accepts a listener callback and returns an unsubscribe function.\n */\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 Subscribe = (listener: () => void) => () => void;\n\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 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.\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 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 *\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\n// 2. Define Dispatch as a naked function type.\n// This is much more reliable in modern Flow than DispatchAPI<...>.\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 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.\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\n// 4. Clean up PossibleAction if you still use it elsewhere\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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\n/**\n * @deprecated This manual action type will be removed in a future major release.\n *\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 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":[]}