@beinformed/ui 1.65.29 → 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.
- package/CHANGELOG.md +13 -0
- package/esm/hooks/useErrorHandler.js +26 -0
- package/esm/hooks/useErrorHandler.js.flow +31 -0
- package/esm/hooks/useErrorHandler.js.map +1 -0
- package/esm/hooks/useI18n.js +16 -2
- package/esm/hooks/useI18n.js.flow +21 -2
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModelSelectors.js +13 -2
- package/esm/hooks/useModelSelectors.js.flow +15 -1
- package/esm/hooks/useModelSelectors.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/redux/_i18n/types.js.flow +16 -0
- package/esm/redux/_i18n/types.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +8 -2
- package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.flow +72 -0
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_router/types.js.flow +51 -0
- package/esm/redux/_router/types.js.map +1 -1
- package/esm/redux/types.js.flow +276 -1
- package/esm/redux/types.js.map +1 -1
- package/lib/hooks/useErrorHandler.js +33 -0
- package/lib/hooks/useErrorHandler.js.map +1 -0
- package/lib/hooks/useI18n.js +16 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModelSelectors.js +14 -1
- package/lib/hooks/useModelSelectors.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +1 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/redux/_i18n/types.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +8 -2
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_router/types.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/package.json +5 -5
package/esm/redux/types.js.flow
CHANGED
|
@@ -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
|
-
|
|
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 };
|
package/esm/redux/types.js.map
CHANGED
|
@@ -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":[]}
|
package/lib/hooks/useI18n.js
CHANGED
|
@@ -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
|
package/lib/hooks/useI18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","names":["
|
|
1
|
+
{"version":3,"file":"useI18n.js","names":["_react","require","_reactRedux","_reselect","_memoize","_interopRequireDefault","_i18n","_I18nActions","getMessage","createSelector","getLocales","getLocale","locales","localeCode","memoize","id","defaultMessage","placeholders","args","_stringify","default","useMessage","useSelector","exports","useTranslate","useLocale","getLocaleCodes","state","i18n","_map","call","locale","code","useLocaleCodes","useUpdateLocale","dispatch","useDispatch","useCallback","updateLocale"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\n\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\nimport { updateLocale } from \"../redux/_i18n/I18nActions\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args),\n ),\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null,\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nconst getLocaleCodes = createSelector(\n (state) => state.i18n.locales,\n (locales) => locales.map((locale) => locale.code),\n);\n\n/**\n * Retrieve all available locale codes\n */\nconst useLocaleCodes = (): Array<string> => useSelector(getLocaleCodes);\n\n/**\n * A hook that returns a memoized function to update the application locale.\n *\n * @returns {(locale: string) => void} A memoized function to update the locale.\n */\nconst useUpdateLocale = (): ((locale: string) => void) => {\n const dispatch = useDispatch();\n\n return useCallback(\n (locale: string) => {\n dispatch(updateLocale(locale));\n },\n [dispatch],\n );\n};\n\nexport { useTranslate, useMessage, useLocale, useLocaleCodes, useUpdateLocale };\n"],"mappings":";;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAAG,QAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAEA,MAAMO,UAAU,GAAG,IAAAC,wBAAc,EAC/B,CAACC,gBAAU,EAAEC,eAAS,CAAC,EACvB,CAACC,OAAO,EAAEC,UAAU,KAClB,IAAAC,gBAAO,EACL,CAACC,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDL,OAAO,CACJD,SAAS,CAACE,UAAU,CAAC,CACrBL,UAAU,CAACO,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC,EACjD,CAAC,GAAGC,IAAI,KAAK,IAAAC,UAAA,CAAAC,OAAA,EAAeF,IAAI,CAClC,CACJ,CAAC;;AAED;AACA;AACA,MAAMG,UAAU,GAAGA,CACjBN,EAAU,EACVC,cAAuB,EACvBC,YAA4B,KACpB,IAAAK,uBAAW,EAACd,UAAU,CAAC,CAACO,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC;;AAEnE;AACA;AADAM,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAEA,MAAMG,YAAY,GAAGA,CAAA,KAAyB,IAAAF,uBAAW,EAACd,UAAU,CAAC;;AAErE;AACA;AADAe,OAAA,CAAAC,YAAA,GAAAA,YAAA;AAEA,MAAMC,SAAS,GAAGA,CAAA,KAAc,IAAAH,uBAAW,EAACX,eAAS,CAAC;AAACY,OAAA,CAAAE,SAAA,GAAAA,SAAA;AAEvD,MAAMC,cAAc,GAAG,IAAAjB,wBAAc,EAClCkB,KAAK,IAAKA,KAAK,CAACC,IAAI,CAAChB,OAAO,EAC5BA,OAAO,IAAK,IAAAiB,IAAA,CAAAT,OAAA,EAAAR,OAAO,EAAAkB,IAAA,CAAPlB,OAAO,EAAMmB,MAAM,IAAKA,MAAM,CAACC,IAAI,CAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CAAA,KAAqB,IAAAX,uBAAW,EAACI,cAAc,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AAJAH,OAAA,CAAAU,cAAA,GAAAA,cAAA;AAKA,MAAMC,eAAe,GAAGA,CAAA,KAAkC;EACxD,MAAMC,QAAQ,GAAG,IAAAC,uBAAW,EAAC,CAAC;EAE9B,OAAO,IAAAC,kBAAW,EACfN,MAAc,IAAK;IAClBI,QAAQ,CAAC,IAAAG,yBAAY,EAACP,MAAM,CAAC,CAAC;EAChC,CAAC,EACD,CAACI,QAAQ,CACX,CAAC;AACH,CAAC;AAACZ,OAAA,CAAAW,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -4,10 +4,11 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useModelByHref = exports.useKeyByHref = exports.useFirstModelByInstance = exports.useAllModelsByInstance = exports.useAllKeysByHref = exports.useAllFinishedModels = exports.useActiveModels = exports.useActiveModelByInstance = void 0;
|
|
7
|
+
exports.useModelByHref = exports.useKeyByHref = exports.useFirstModelByInstance = exports.useCurrentApplication = exports.useAllModelsByInstance = exports.useAllKeysByHref = exports.useAllFinishedModels = exports.useActiveModels = exports.useActiveModelByInstance = void 0;
|
|
8
8
|
var _reactRedux = require("react-redux");
|
|
9
9
|
var _ModularUISelectors = require("../redux/_modularui/ModularUISelectors");
|
|
10
10
|
var _Href = _interopRequireDefault(require("../models/href/Href"));
|
|
11
|
+
var _ApplicationModel = _interopRequireDefault(require("../models/application/ApplicationModel"));
|
|
11
12
|
/**
|
|
12
13
|
* Returns all models in the store that are instances of the provided class
|
|
13
14
|
* and match the current application locale.
|
|
@@ -83,5 +84,17 @@ exports.useActiveModels = useActiveModels;
|
|
|
83
84
|
const useAllFinishedModels = () => {
|
|
84
85
|
return (0, _reactRedux.useSelector)(_ModularUISelectors.getAllFinishedModels);
|
|
85
86
|
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Returns the current active application, without retrying to request it.
|
|
90
|
+
*/
|
|
86
91
|
exports.useAllFinishedModels = useAllFinishedModels;
|
|
92
|
+
const useCurrentApplication = () => {
|
|
93
|
+
const application = (0, _reactRedux.useSelector)(_ModularUISelectors.getApplication);
|
|
94
|
+
if (application instanceof _ApplicationModel.default) {
|
|
95
|
+
return application;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
};
|
|
99
|
+
exports.useCurrentApplication = useCurrentApplication;
|
|
87
100
|
//# sourceMappingURL=useModelSelectors.js.map
|