@beinformed/ui 1.20.2 → 1.20.5
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 +21 -0
- package/esm/constants/Constants.js +0 -15
- package/esm/constants/Constants.js.map +1 -1
- package/esm/constants/Settings.js +6 -0
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +41 -5
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
- package/esm/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
- package/esm/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
- package/esm/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +6 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/form/FormModel.js +7 -6
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/redux/_modularui/actions.js +1 -1
- package/esm/redux/_modularui/actions.js.map +1 -1
- package/esm/redux/actions/Authorization.js +5 -9
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/Error.js +3 -1
- package/esm/redux/actions/Error.js.map +1 -1
- package/esm/redux/actions/SignIn.js +7 -0
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/redux/index.js +3 -1
- package/esm/redux/index.js.map +1 -1
- package/esm/redux/selectors/index.js +2 -0
- package/esm/redux/selectors/index.js.map +1 -0
- package/esm/redux/types.js.map +1 -1
- package/lib/constants/Constants.js +2 -20
- package/lib/constants/Constants.js.flow +0 -15
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/Settings.js +6 -0
- package/lib/constants/Settings.js.flow +9 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/hooks/useAuthentication.js +49 -5
- package/lib/hooks/useAuthentication.js.flow +42 -3
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js.flow +3 -2
- package/lib/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.flow +4 -3
- package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +7 -1
- package/lib/models/application/ApplicationModel.js.flow +7 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/form/FormModel.js +7 -7
- package/lib/models/form/FormModel.js.flow +2 -3
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/redux/_modularui/actions.js +1 -1
- package/lib/redux/_modularui/actions.js.flow +1 -4
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/actions/Authorization.js +7 -12
- package/lib/redux/actions/Authorization.js.flow +4 -16
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js +4 -1
- package/lib/redux/actions/Error.js.flow +3 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/SignIn.js +12 -2
- package/lib/redux/actions/SignIn.js.flow +11 -2
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Authorization.spec.js.flow +4 -18
- package/lib/redux/index.js +14 -0
- package/lib/redux/index.js.flow +3 -0
- package/lib/redux/index.js.map +1 -1
- package/lib/redux/selectors/index.js +21 -0
- package/lib/redux/selectors/index.js.flow +2 -0
- package/lib/redux/selectors/index.js.map +1 -0
- package/lib/redux/types.js.flow +2 -2
- package/lib/redux/types.js.map +1 -1
- package/package.json +19 -18
- package/src/constants/Constants.js +0 -15
- package/src/constants/Settings.js +9 -0
- package/src/hooks/useAuthentication.js +42 -3
- package/src/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
- package/src/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
- package/src/models/application/ApplicationModel.js +7 -1
- package/src/models/form/FormModel.js +2 -3
- package/src/redux/_modularui/actions.js +1 -4
- package/src/redux/actions/Authorization.js +4 -16
- package/src/redux/actions/Error.js +3 -1
- package/src/redux/actions/SignIn.js +11 -2
- package/src/redux/actions/__tests__/Authorization.spec.js +4 -18
- package/src/redux/index.js +3 -0
- package/src/redux/selectors/index.js +2 -0
- package/src/redux/types.js +2 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import flattenDeep from "lodash/flattenDeep";
|
|
3
3
|
import deepmerge from "deepmerge";
|
|
4
|
-
import { get } from "lodash";
|
|
5
4
|
|
|
6
5
|
import { has } from "../../utils/helpers/objects";
|
|
7
6
|
|
|
@@ -156,11 +155,11 @@ class FormModel extends ResourceModel {
|
|
|
156
155
|
): string | null {
|
|
157
156
|
// cancel button labels are defined on the form
|
|
158
157
|
if (buttonType === "cancel") {
|
|
159
|
-
return
|
|
158
|
+
return this.buttonLabels?.cancel ?? null;
|
|
160
159
|
}
|
|
161
160
|
|
|
162
161
|
// all other form related button labels are defined on the object
|
|
163
|
-
return
|
|
162
|
+
return this.currentFormObject?.buttonLabels?.[buttonType] ?? null;
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
/**
|
|
@@ -116,10 +116,7 @@ export const loadModel = (
|
|
|
116
116
|
return {
|
|
117
117
|
type: "NO_ACTION",
|
|
118
118
|
};
|
|
119
|
-
} else if (
|
|
120
|
-
errorResponse.isResourceNotFoundAfterReload ||
|
|
121
|
-
errorResponse.isInvalidUsername
|
|
122
|
-
) {
|
|
119
|
+
} else if (errorResponse.isResourceNotFoundAfterReload) {
|
|
123
120
|
return removeModelByKey(key);
|
|
124
121
|
}
|
|
125
122
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import { LOGIN_PATH, NOTIFICATION_TYPES } from "../../constants/Constants";
|
|
3
|
-
|
|
4
2
|
import ErrorResponse from "../../models/error/ErrorResponse";
|
|
5
3
|
|
|
6
4
|
import { replace } from "../_router/actions";
|
|
7
5
|
import { logoutSuccess } from "./SignOut";
|
|
8
|
-
import { showNotification } from "./Notification";
|
|
9
6
|
|
|
10
7
|
import Cache from "../../utils/browser/Cache";
|
|
11
8
|
|
|
@@ -16,6 +13,7 @@ import { reloadApplication } from "./Application";
|
|
|
16
13
|
import { getSetting } from "../../constants";
|
|
17
14
|
|
|
18
15
|
import type { ThunkAction } from "../types";
|
|
16
|
+
import { sendAuthenticationError } from "./SignIn";
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
*/
|
|
@@ -40,28 +38,18 @@ export const handleUnauthorized =
|
|
|
40
38
|
dispatch(reloadApplication());
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
// set logged
|
|
41
|
+
// set logged out
|
|
44
42
|
dispatch(logoutSuccess());
|
|
45
43
|
|
|
46
44
|
Cache.removeItem("auth");
|
|
47
45
|
|
|
48
46
|
if (errorResponse.isInvalidUsername) {
|
|
49
|
-
|
|
50
|
-
dispatch(
|
|
51
|
-
showNotification(
|
|
52
|
-
NOTIFICATION_TYPES.WARNING,
|
|
53
|
-
{
|
|
54
|
-
id: errorResponse.id,
|
|
55
|
-
defaultMessage: errorResponse.message,
|
|
56
|
-
},
|
|
57
|
-
null,
|
|
58
|
-
WARNING_TIMEOUT
|
|
59
|
-
)
|
|
60
|
-
);
|
|
47
|
+
dispatch(sendAuthenticationError(errorResponse.message));
|
|
61
48
|
}
|
|
62
49
|
|
|
63
50
|
// add current location as from location before redirect
|
|
64
51
|
const location = getState().router.location;
|
|
52
|
+
const LOGIN_PATH = getSetting("LOGIN_PATH", "/signin");
|
|
65
53
|
if (location?.pathname !== LOGIN_PATH) {
|
|
66
54
|
const locationFrom = location?.state?.from;
|
|
67
55
|
return dispatch(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { IS_SERVER } from "../../constants/Constants";
|
|
3
|
+
import { getSetting } from "../../constants/Settings";
|
|
3
4
|
|
|
4
5
|
import ErrorResponse from "../../models/error/ErrorResponse";
|
|
5
6
|
|
|
@@ -39,6 +40,7 @@ const defaultErrorResponseHandler: DefaultErrorResponseHandler =
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
if (error.isBlocked || error.isConcurrentUser) {
|
|
43
|
+
const LOGOUT_PATH = getSetting("LOGOUT_PATH", "/signout");
|
|
42
44
|
dispatch(push(LOGOUT_PATH));
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -9,7 +9,7 @@ import { push } from "../_router/actions";
|
|
|
9
9
|
import { CHANGEPASSWORD_PATH } from "../../constants/Constants";
|
|
10
10
|
|
|
11
11
|
import type {
|
|
12
|
-
|
|
12
|
+
SendAuthenticationErrorAction,
|
|
13
13
|
ResetAuthErrorsAction,
|
|
14
14
|
LoginSuccessAction,
|
|
15
15
|
ThunkAction,
|
|
@@ -18,7 +18,16 @@ import type {
|
|
|
18
18
|
/**
|
|
19
19
|
* Send login failed action
|
|
20
20
|
*/
|
|
21
|
-
export const loginFailed = (
|
|
21
|
+
export const loginFailed = (
|
|
22
|
+
errorMessage: string
|
|
23
|
+
): SendAuthenticationErrorAction => sendAuthenticationError(errorMessage);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Send authentication error action
|
|
27
|
+
*/
|
|
28
|
+
export const sendAuthenticationError = (
|
|
29
|
+
errorMessage: string
|
|
30
|
+
): SendAuthenticationErrorAction => ({
|
|
22
31
|
type: "AUTHENTICATION_ERROR",
|
|
23
32
|
payload: errorMessage,
|
|
24
33
|
});
|
|
@@ -60,15 +60,8 @@ describe("authorization actions", () => {
|
|
|
60
60
|
type: "AUTHENTICATION_LOGOUT",
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
type: "
|
|
64
|
-
payload:
|
|
65
|
-
error: null,
|
|
66
|
-
message: {
|
|
67
|
-
defaultMessage: "Error.Authentication.InvalidUsername",
|
|
68
|
-
id: "Error.Authentication.InvalidUsername",
|
|
69
|
-
},
|
|
70
|
-
type: "WARNING",
|
|
71
|
-
},
|
|
63
|
+
type: "AUTHENTICATION_ERROR",
|
|
64
|
+
payload: "Error.Authentication.InvalidUsername",
|
|
72
65
|
},
|
|
73
66
|
{
|
|
74
67
|
type: "ROUTER/REPLACE",
|
|
@@ -114,15 +107,8 @@ describe("authorization actions", () => {
|
|
|
114
107
|
type: "AUTHENTICATION_LOGOUT",
|
|
115
108
|
},
|
|
116
109
|
{
|
|
117
|
-
type: "
|
|
118
|
-
payload:
|
|
119
|
-
error: null,
|
|
120
|
-
message: {
|
|
121
|
-
defaultMessage: "Error.Authentication.InvalidUsername",
|
|
122
|
-
id: "Error.Authentication.InvalidUsername",
|
|
123
|
-
},
|
|
124
|
-
type: "WARNING",
|
|
125
|
-
},
|
|
110
|
+
type: "AUTHENTICATION_ERROR",
|
|
111
|
+
payload: "Error.Authentication.InvalidUsername",
|
|
126
112
|
},
|
|
127
113
|
{
|
|
128
114
|
type: "ROUTER/REPLACE",
|
package/src/redux/index.js
CHANGED
package/src/redux/types.js
CHANGED
|
@@ -103,7 +103,7 @@ export type UpdateProgressAction = {
|
|
|
103
103
|
payload: { percentComplete: number },
|
|
104
104
|
};
|
|
105
105
|
|
|
106
|
-
export type
|
|
106
|
+
export type SendAuthenticationErrorAction = {
|
|
107
107
|
type: "AUTHENTICATION_ERROR",
|
|
108
108
|
payload: string,
|
|
109
109
|
};
|
|
@@ -151,8 +151,8 @@ export type ReduxAction =
|
|
|
151
151
|
| FinishProgressAction
|
|
152
152
|
| ResetProgressAction
|
|
153
153
|
| UpdateProgressAction
|
|
154
|
-
| LoginFailedAction
|
|
155
154
|
| ResetAuthErrorsAction
|
|
155
|
+
| SendAuthenticationErrorAction
|
|
156
156
|
| LoginSuccessAction
|
|
157
157
|
| ChangePasswordAction
|
|
158
158
|
| LogoutSuccessAction
|