@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.js","names":["handleUnauthorized","errorResponse","dispatch","getState","connectKey","removeModelByKey","getSetting","response","error","window","location","reload","application","getApplication","Cache","getItem","isLoggedIn","reloadApplication","logoutSuccess","removeItem","isInvalidUsername","
|
|
1
|
+
{"version":3,"file":"Authorization.js","names":["handleUnauthorized","errorResponse","dispatch","getState","connectKey","removeModelByKey","getSetting","response","error","window","location","reload","application","getApplication","Cache","getItem","isLoggedIn","reloadApplication","logoutSuccess","removeItem","isInvalidUsername","sendAuthenticationError","message","router","LOGIN_PATH","pathname","locationFrom","state","from","replace","modal","type"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/actions\";\nimport { logoutSuccess } from \"./SignOut\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport { removeModelByKey } from \"../_modularui/actions\";\nimport { getApplication } from \"../_modularui/selectors\";\nimport { reloadApplication } from \"./Application\";\n\nimport { getSetting } from \"../../constants\";\n\nimport type { ThunkAction } from \"../types\";\nimport { sendAuthenticationError } from \"./SignIn\";\n\n/**\n */\nexport const handleUnauthorized =\n (errorResponse: ErrorResponse): ThunkAction =>\n (dispatch, getState) => {\n if (errorResponse.connectKey) {\n dispatch(removeModelByKey(errorResponse.connectKey));\n }\n\n if (\n getSetting(\"PAGE_RELOAD_ON_UNAUTHORIZED_ERROR\", false) &&\n errorResponse.response?.error\n ) {\n window.location.reload();\n return;\n }\n\n // reload application when flag auth is set or isLogged\n const application = getApplication(getState());\n if (Cache.getItem(\"auth\") || application?.isLoggedIn) {\n dispatch(reloadApplication());\n }\n\n // set logged out\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n dispatch(sendAuthenticationError(errorResponse.message));\n }\n\n // add current location as from location before redirect\n const location = getState().router.location;\n const LOGIN_PATH = getSetting(\"LOGIN_PATH\", \"/signin\");\n if (location?.pathname !== LOGIN_PATH) {\n const locationFrom = location?.state?.from;\n return dispatch(\n replace(LOGIN_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n // cannot open login in a modal, because of previous locations that might be secure\n modal: false,\n })\n );\n }\n\n return { type: \"NO_ACTION\" };\n };\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;AAGA;;AAEA;AACA;AACO,IAAMA,kBAAkB,GAC7B,SADWA,kBACX,CAACC,aAAD;EAAA,OACA,UAACC,QAAD,EAAWC,QAAX,EAAwB;IAAA;;IACtB,IAAIF,aAAa,CAACG,UAAlB,EAA8B;MAC5BF,QAAQ,CAAC,IAAAG,0BAAA,EAAiBJ,aAAa,CAACG,UAA/B,CAAD,CAAR;IACD;;IAED,IACE,IAAAE,qBAAA,EAAW,mCAAX,EAAgD,KAAhD,8BACAL,aAAa,CAACM,QADd,kDACA,sBAAwBC,KAF1B,EAGE;MACAC,MAAM,CAACC,QAAP,CAAgBC,MAAhB;MACA;IACD,CAXqB,CAatB;;;IACA,IAAMC,WAAW,GAAG,IAAAC,yBAAA,EAAeV,QAAQ,EAAvB,CAApB;;IACA,IAAIW,cAAA,CAAMC,OAAN,CAAc,MAAd,KAAyBH,WAAzB,aAAyBA,WAAzB,eAAyBA,WAAW,CAAEI,UAA1C,EAAsD;MACpDd,QAAQ,CAAC,IAAAe,8BAAA,GAAD,CAAR;IACD,CAjBqB,CAmBtB;;;IACAf,QAAQ,CAAC,IAAAgB,sBAAA,GAAD,CAAR;;IAEAJ,cAAA,CAAMK,UAAN,CAAiB,MAAjB;;IAEA,IAAIlB,aAAa,CAACmB,iBAAlB,EAAqC;MACnClB,QAAQ,CAAC,IAAAmB,+BAAA,EAAwBpB,aAAa,CAACqB,OAAtC,CAAD,CAAR;IACD,CA1BqB,CA4BtB;;;IACA,IAAMZ,QAAQ,GAAGP,QAAQ,GAAGoB,MAAX,CAAkBb,QAAnC;IACA,IAAMc,UAAU,GAAG,IAAAlB,qBAAA,EAAW,YAAX,EAAyB,SAAzB,CAAnB;;IACA,IAAI,CAAAI,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEe,QAAV,MAAuBD,UAA3B,EAAuC;MAAA;;MACrC,IAAME,YAAY,GAAGhB,QAAH,aAAGA,QAAH,0CAAGA,QAAQ,CAAEiB,KAAb,oDAAG,gBAAiBC,IAAtC;MACA,OAAO1B,QAAQ,CACb,IAAA2B,gBAAA,EAAQL,UAAR,EAAoB;QAClBI,IAAI,EAAEF,YAAY,GAAGA,YAAH,GAAkBvB,QAAQ,GAAGoB,MAAX,CAAkBb,QADpC;QAElB;QACAoB,KAAK,EAAE;MAHW,CAApB,CADa,CAAf;IAOD;;IAED,OAAO;MAAEC,IAAI,EAAE;IAAR,CAAP;EACD,CA5CD;AAAA,CADK"}
|
|
@@ -9,6 +9,8 @@ exports.setCustomErrorResponseHandler = exports.handleError = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _Constants = require("../../constants/Constants");
|
|
11
11
|
|
|
12
|
+
var _Settings = require("../../constants/Settings");
|
|
13
|
+
|
|
12
14
|
var _ErrorResponse = _interopRequireDefault(require("../../models/error/ErrorResponse"));
|
|
13
15
|
|
|
14
16
|
var _actions = require("../_router/actions");
|
|
@@ -46,7 +48,8 @@ var defaultErrorResponseHandler = function defaultErrorResponseHandler(error) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
if (error.isBlocked || error.isConcurrentUser) {
|
|
49
|
-
|
|
51
|
+
var LOGOUT_PATH = (0, _Settings.getSetting)("LOGOUT_PATH", "/signout");
|
|
52
|
+
dispatch((0, _actions.push)(LOGOUT_PATH));
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
if (error.isChangePassword) {
|
|
@@ -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
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Error.js","names":["saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","handleUnauthorized","isBlocked","isConcurrentUser","
|
|
1
|
+
{"version":3,"file":"Error.js","names":["saveError","error","type","payload","defaultErrorResponseHandler","dispatch","isResourceNotFoundAfterReload","isRemoteServiceException","isUnauthorized","handleUnauthorized","isBlocked","isConcurrentUser","LOGOUT_PATH","getSetting","push","isChangePassword","changePassword","IS_SERVER","setTimeout","showXHRErrorNotification","customErrorResponseHandler","errorResponse","defaultHandler","setCustomErrorResponseHandler","handler","handleError","resetProgress","ErrorResponse"],"sources":["../../../src/redux/actions/Error.js"],"sourcesContent":["// @flow\nimport { IS_SERVER } from \"../../constants/Constants\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { push } from \"../_router/actions\";\nimport { showXHRErrorNotification } from \"./Notification\";\nimport { resetProgress } from \"./ProgressIndicator\";\nimport { changePassword } from \"./SignIn\";\nimport { handleUnauthorized } from \"./Authorization\";\n\nimport type { FetchException } from \"../../exceptions\";\nimport type { Dispatch, SaveErrorAction, ThunkAction } from \"../types\";\n\ntype DefaultErrorResponseHandler = (error: ErrorResponse) => ThunkAction;\ntype CustomErrorResponseHandler = (\n errorResponse: ErrorResponse,\n defaultHandler: DefaultErrorResponseHandler\n) => ThunkAction;\n\n/**\n */\nconst saveError = (error): SaveErrorAction => ({\n type: \"SAVE_ERROR\",\n payload: error,\n});\n\n/**\n */\nconst defaultErrorResponseHandler: DefaultErrorResponseHandler =\n (error: ErrorResponse): ThunkAction =>\n (dispatch: Dispatch) => {\n if (error.isResourceNotFoundAfterReload || error.isRemoteServiceException) {\n return dispatch({ type: \"NO_ACTION\" });\n }\n\n if (error.isUnauthorized) {\n return dispatch(handleUnauthorized(error));\n }\n\n if (error.isBlocked || error.isConcurrentUser) {\n const LOGOUT_PATH = getSetting(\"LOGOUT_PATH\", \"/signout\");\n dispatch(push(LOGOUT_PATH));\n }\n\n if (error.isChangePassword) {\n return dispatch(changePassword());\n }\n\n if (IS_SERVER) {\n return dispatch(saveError(error));\n }\n\n setTimeout(() => {\n throw error;\n });\n\n return dispatch(showXHRErrorNotification(error));\n };\n\n/**\n * Standard Custom error response, acts as a proxy and can be overwritten by {@link setCustomErrorResponseHandler}\n */\nlet customErrorResponseHandler: CustomErrorResponseHandler =\n (errorResponse, defaultHandler) => (dispatch: Dispatch) =>\n dispatch(defaultHandler(errorResponse));\n\n/**\n * Set a custom error response handler,\n * can be used when custom functionality is needed on certain (error) response\n * of the modular ui, for example when custom logic is needed when a user is unauthorized<br>\n * It receives an {@link ErrorResponse} and the {@link defaultErrorResponseHandler}\n */\nexport const setCustomErrorResponseHandler = (\n handler: CustomErrorResponseHandler\n) => {\n customErrorResponseHandler = handler;\n};\n\n/**\n * Handle errors by sending an error notification message\n */\nexport const handleError =\n (error: Error | FetchException): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(resetProgress());\n\n const errorResponse = new ErrorResponse(error);\n\n return dispatch(\n customErrorResponseHandler(errorResponse, defaultErrorResponseHandler)\n );\n };\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAWA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;EAAA,OAA6B;IAC7CC,IAAI,EAAE,YADuC;IAE7CC,OAAO,EAAEF;EAFoC,CAA7B;AAAA,CAAlB;AAKA;AACA;;;AACA,IAAMG,2BAAwD,GAC5D,SADIA,2BACJ,CAACH,KAAD;EAAA,OACA,UAACI,QAAD,EAAwB;IACtB,IAAIJ,KAAK,CAACK,6BAAN,IAAuCL,KAAK,CAACM,wBAAjD,EAA2E;MACzE,OAAOF,QAAQ,CAAC;QAAEH,IAAI,EAAE;MAAR,CAAD,CAAf;IACD;;IAED,IAAID,KAAK,CAACO,cAAV,EAA0B;MACxB,OAAOH,QAAQ,CAAC,IAAAI,iCAAA,EAAmBR,KAAnB,CAAD,CAAf;IACD;;IAED,IAAIA,KAAK,CAACS,SAAN,IAAmBT,KAAK,CAACU,gBAA7B,EAA+C;MAC7C,IAAMC,WAAW,GAAG,IAAAC,oBAAA,EAAW,aAAX,EAA0B,UAA1B,CAApB;MACAR,QAAQ,CAAC,IAAAS,aAAA,EAAKF,WAAL,CAAD,CAAR;IACD;;IAED,IAAIX,KAAK,CAACc,gBAAV,EAA4B;MAC1B,OAAOV,QAAQ,CAAC,IAAAW,sBAAA,GAAD,CAAf;IACD;;IAED,IAAIC,oBAAJ,EAAe;MACb,OAAOZ,QAAQ,CAACL,SAAS,CAACC,KAAD,CAAV,CAAf;IACD;;IAEDiB,UAAU,CAAC,YAAM;MACf,MAAMjB,KAAN;IACD,CAFS,CAAV;IAIA,OAAOI,QAAQ,CAAC,IAAAc,sCAAA,EAAyBlB,KAAzB,CAAD,CAAf;EACD,CA5BD;AAAA,CADF;AA+BA;AACA;AACA;;;AACA,IAAImB,0BAAsD,GACxD,oCAACC,aAAD,EAAgBC,cAAhB;EAAA,OAAmC,UAACjB,QAAD;IAAA,OACjCA,QAAQ,CAACiB,cAAc,CAACD,aAAD,CAAf,CADyB;EAAA,CAAnC;AAAA,CADF;AAIA;AACA;AACA;AACA;AACA;AACA;;;AACO,IAAME,6BAA6B,GAAG,SAAhCA,6BAAgC,CAC3CC,OAD2C,EAExC;EACHJ,0BAA0B,GAAGI,OAA7B;AACD,CAJM;AAMP;AACA;AACA;;;;;AACO,IAAMC,WAAW,GACtB,SADWA,WACX,CAACxB,KAAD;EAAA,OACA,UAACI,QAAD,EAAwB;IACtBA,QAAQ,CAAC,IAAAqB,gCAAA,GAAD,CAAR;IAEA,IAAML,aAAa,GAAG,IAAIM,sBAAJ,CAAkB1B,KAAlB,CAAtB;IAEA,OAAOI,QAAQ,CACbe,0BAA0B,CAACC,aAAD,EAAgBjB,2BAAhB,CADb,CAAf;EAGD,CATD;AAAA,CADK"}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.resetAuthErrors = exports.loginSuccess = exports.loginFailed = exports.login = exports.changePassword = void 0;
|
|
8
|
+
exports.sendAuthenticationError = exports.resetAuthErrors = exports.loginSuccess = exports.loginFailed = exports.login = exports.changePassword = void 0;
|
|
9
9
|
|
|
10
10
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
11
11
|
|
|
@@ -25,6 +25,16 @@ var _Constants = require("../../constants/Constants");
|
|
|
25
25
|
* Send login failed action
|
|
26
26
|
*/
|
|
27
27
|
var loginFailed = function loginFailed(errorMessage) {
|
|
28
|
+
return sendAuthenticationError(errorMessage);
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Send authentication error action
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
exports.loginFailed = loginFailed;
|
|
36
|
+
|
|
37
|
+
var sendAuthenticationError = function sendAuthenticationError(errorMessage) {
|
|
28
38
|
return {
|
|
29
39
|
type: "AUTHENTICATION_ERROR",
|
|
30
40
|
payload: errorMessage
|
|
@@ -35,7 +45,7 @@ var loginFailed = function loginFailed(errorMessage) {
|
|
|
35
45
|
*/
|
|
36
46
|
|
|
37
47
|
|
|
38
|
-
exports.
|
|
48
|
+
exports.sendAuthenticationError = sendAuthenticationError;
|
|
39
49
|
|
|
40
50
|
var resetAuthErrors = function resetAuthErrors() {
|
|
41
51
|
return {
|
|
@@ -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
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignIn.js","names":["loginFailed","errorMessage","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","push","CHANGEPASSWORD_PATH","login","username","password","startProgress","Authenticate","then","reloadApplication","Cache","addItem","finishProgress","catch","error","id","dispatchedReloadApplication","resolve"],"sources":["../../../src/redux/actions/SignIn.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport { reloadApplication } from \"./Application\";\n\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { push } from \"../_router/actions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n
|
|
1
|
+
{"version":3,"file":"SignIn.js","names":["loginFailed","errorMessage","sendAuthenticationError","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","push","CHANGEPASSWORD_PATH","login","username","password","startProgress","Authenticate","then","reloadApplication","Cache","addItem","finishProgress","catch","error","id","dispatchedReloadApplication","resolve"],"sources":["../../../src/redux/actions/SignIn.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport { reloadApplication } from \"./Application\";\n\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { push } from \"../_router/actions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n SendAuthenticationErrorAction,\n ResetAuthErrorsAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (\n errorMessage: string\n): SendAuthenticationErrorAction => sendAuthenticationError(errorMessage);\n\n/**\n * Send authentication error action\n */\nexport const sendAuthenticationError = (\n errorMessage: string\n): SendAuthenticationErrorAction => ({\n type: \"AUTHENTICATION_ERROR\",\n payload: errorMessage,\n});\n\n/**\n * Resets any authentication errors\n */\nexport const resetAuthErrors = (): ResetAuthErrorsAction => ({\n type: \"AUTHENTICATION_RESET_ERRORS\",\n});\n\n/**\n * Send login success action\n */\nexport const loginSuccess = (): LoginSuccessAction => ({\n type: \"AUTHENTICATION_SUCCESS\",\n});\n\n/**\n * Send change password action\n */\nexport const changePassword = (): ThunkAction => (dispatch, getState) => {\n dispatch({\n type: \"CHANGE_PASSWORD\",\n });\n\n const isModal = getState().router.location?.state?.modal;\n const locationFrom = getState().router.location?.state?.from;\n return dispatch(\n push(CHANGEPASSWORD_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n modal: isModal,\n })\n );\n};\n\n/**\n */\nexport const login =\n (username: string, password: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .login(username, password)\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n Cache.addItem(\"auth\", true);\n dispatch(loginSuccess());\n\n return dispatch(finishProgress());\n })\n .catch((error) => {\n if (error.id === \"Error.ChangePasswordRequired\") {\n const dispatchedReloadApplication = dispatch(reloadApplication());\n\n return Promise.resolve(dispatchedReloadApplication).then(() => {\n Cache.addItem(\"auth\", true);\n return dispatch(changePassword());\n });\n }\n\n dispatch(loginFailed(error.id));\n return dispatch(finishProgress());\n });\n };\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AASA;AACA;AACA;AACO,IAAMA,WAAW,GAAG,SAAdA,WAAc,CACzBC,YADyB;EAAA,OAESC,uBAAuB,CAACD,YAAD,CAFhC;AAAA,CAApB;AAIP;AACA;AACA;;;;;AACO,IAAMC,uBAAuB,GAAG,SAA1BA,uBAA0B,CACrCD,YADqC;EAAA,OAEF;IACnCE,IAAI,EAAE,sBAD6B;IAEnCC,OAAO,EAAEH;EAF0B,CAFE;AAAA,CAAhC;AAOP;AACA;AACA;;;;;AACO,IAAMI,eAAe,GAAG,SAAlBA,eAAkB;EAAA,OAA8B;IAC3DF,IAAI,EAAE;EADqD,CAA9B;AAAA,CAAxB;AAIP;AACA;AACA;;;;;AACO,IAAMG,YAAY,GAAG,SAAfA,YAAe;EAAA,OAA2B;IACrDH,IAAI,EAAE;EAD+C,CAA3B;AAAA,CAArB;AAIP;AACA;AACA;;;;;AACO,IAAMI,cAAc,GAAG,SAAjBA,cAAiB;EAAA,OAAmB,UAACC,QAAD,EAAWC,QAAX,EAAwB;IAAA;;IACvED,QAAQ,CAAC;MACPL,IAAI,EAAE;IADC,CAAD,CAAR;IAIA,IAAMO,OAAO,4BAAGD,QAAQ,GAAGE,MAAX,CAAkBC,QAArB,oFAAG,sBAA4BC,KAA/B,2DAAG,uBAAmCC,KAAnD;IACA,IAAMC,YAAY,6BAAGN,QAAQ,GAAGE,MAAX,CAAkBC,QAArB,qFAAG,uBAA4BC,KAA/B,2DAAG,uBAAmCG,IAAxD;IACA,OAAOR,QAAQ,CACb,IAAAS,aAAA,EAAKC,8BAAL,EAA0B;MACxBF,IAAI,EAAED,YAAY,GAAGA,YAAH,GAAkBN,QAAQ,GAAGE,MAAX,CAAkBC,QAD9B;MAExBE,KAAK,EAAEJ;IAFiB,CAA1B,CADa,CAAf;EAMD,CAb6B;AAAA,CAAvB;AAeP;AACA;;;;;AACO,IAAMS,KAAK,GAChB,SADWA,KACX,CAACC,QAAD,EAAmBC,QAAnB;EAAA,OACA,UAACb,QAAD,EAAc;IACZA,QAAQ,CAAC,IAAAc,gCAAA,GAAD,CAAR;IAEA,OAAO,IAAIC,qBAAJ,GACJJ,KADI,CACEC,QADF,EACYC,QADZ,EAEJG,IAFI,CAEC;MAAA,OAAMhB,QAAQ,CAAC,IAAAiB,8BAAA,GAAD,CAAd;IAAA,CAFD,EAGJD,IAHI,CAGC,YAAM;MACVE,cAAA,CAAMC,OAAN,CAAc,MAAd,EAAsB,IAAtB;;MACAnB,QAAQ,CAACF,YAAY,EAAb,CAAR;MAEA,OAAOE,QAAQ,CAAC,IAAAoB,iCAAA,GAAD,CAAf;IACD,CARI,EASJC,KATI,CASE,UAACC,KAAD,EAAW;MAChB,IAAIA,KAAK,CAACC,EAAN,KAAa,8BAAjB,EAAiD;QAC/C,IAAMC,2BAA2B,GAAGxB,QAAQ,CAAC,IAAAiB,8BAAA,GAAD,CAA5C;QAEA,OAAO,iBAAQQ,OAAR,CAAgBD,2BAAhB,EAA6CR,IAA7C,CAAkD,YAAM;UAC7DE,cAAA,CAAMC,OAAN,CAAc,MAAd,EAAsB,IAAtB;;UACA,OAAOnB,QAAQ,CAACD,cAAc,EAAf,CAAf;QACD,CAHM,CAAP;MAID;;MAEDC,QAAQ,CAACR,WAAW,CAAC8B,KAAK,CAACC,EAAP,CAAZ,CAAR;MACA,OAAOvB,QAAQ,CAAC,IAAAoB,iCAAA,GAAD,CAAf;IACD,CArBI,CAAP;EAsBD,CA1BD;AAAA,CADK"}
|
|
@@ -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/lib/redux/index.js
CHANGED
|
@@ -102,4 +102,18 @@ _Object$keys(_index6).forEach(function (key) {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
var _index7 = require("./selectors/index");
|
|
107
|
+
|
|
108
|
+
_Object$keys(_index7).forEach(function (key) {
|
|
109
|
+
if (key === "default" || key === "__esModule") return;
|
|
110
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
111
|
+
if (key in exports && exports[key] === _index7[key]) return;
|
|
112
|
+
Object.defineProperty(exports, key, {
|
|
113
|
+
enumerable: true,
|
|
114
|
+
get: function get() {
|
|
115
|
+
return _index7[key];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
105
119
|
//# sourceMappingURL=index.js.map
|
package/lib/redux/index.js.flow
CHANGED
package/lib/redux/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/redux/index.js"],"sourcesContent":["// @flow\n\n// ROUTER\nexport * from \"./_router/index\";\n\n// I18N\nexport * from \"./_i18n/index\";\n\n// MODULAR UI\nexport * from \"./_modularui/index\";\n\n// STORE\nexport { default as configureStore } from \"./store/configureStore\";\n\n// ACTIONS\nexport * from \"./actions/index\";\n\n// CONNECTORS\nexport * from \"./connectors/index\";\n\n// REDUCERS\nexport * from \"./reducers/index\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/redux/index.js"],"sourcesContent":["// @flow\n\n// ROUTER\nexport * from \"./_router/index\";\n\n// I18N\nexport * from \"./_i18n/index\";\n\n// MODULAR UI\nexport * from \"./_modularui/index\";\n\n// STORE\nexport { default as configureStore } from \"./store/configureStore\";\n\n// ACTIONS\nexport * from \"./actions/index\";\n\n// CONNECTORS\nexport * from \"./connectors/index\";\n\n// REDUCERS\nexport * from \"./reducers/index\";\n\n// SELECTORS\nexport * from \"./selectors/index\";\n\nexport type * from \"./types\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AAGA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
var _i18n = require("./i18n");
|
|
10
|
+
|
|
11
|
+
_Object$keys(_i18n).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (key in exports && exports[key] === _i18n[key]) return;
|
|
14
|
+
Object.defineProperty(exports, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _i18n[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/redux/selectors/index.js"],"sourcesContent":["// @flow\nexport * from \"./i18n\";\n"],"mappings":";;;;;;;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/lib/redux/types.js.flow
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
|
package/lib/redux/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } 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 RemoveModelByKeyAction,\n ResetModularUIAction,\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 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
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } 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 RemoveModelByKeyAction,\n ResetModularUIAction,\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 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 ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | UpdateModelAction\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 | 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 ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.5",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"styled-components": "^5.0.0"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@babel/runtime-corejs3": "^7.18.
|
|
81
|
+
"@babel/runtime-corejs3": "^7.18.6",
|
|
82
82
|
"big.js": "^6.2.0",
|
|
83
83
|
"date-fns": "^2.28.0",
|
|
84
84
|
"deepmerge": "^4.2.2",
|
|
@@ -95,18 +95,18 @@
|
|
|
95
95
|
"setimmediate": "^1.0.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@babel/cli": "^7.
|
|
99
|
-
"@babel/core": "^7.18.
|
|
98
|
+
"@babel/cli": "^7.18.6",
|
|
99
|
+
"@babel/core": "^7.18.6",
|
|
100
100
|
"@babel/eslint-parser": "^7.18.2",
|
|
101
101
|
"@babel/eslint-plugin": "^7.16.5",
|
|
102
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
102
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
103
103
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
104
|
-
"@babel/plugin-transform-runtime": "^7.18.
|
|
105
|
-
"@babel/preset-env": "^7.18.
|
|
106
|
-
"@babel/preset-flow": "^7.
|
|
107
|
-
"@babel/preset-react": "^7.
|
|
108
|
-
"@commitlint/cli": "^17.0.
|
|
109
|
-
"@commitlint/config-conventional": "^17.0.
|
|
104
|
+
"@babel/plugin-transform-runtime": "^7.18.6",
|
|
105
|
+
"@babel/preset-env": "^7.18.6",
|
|
106
|
+
"@babel/preset-flow": "^7.18.6",
|
|
107
|
+
"@babel/preset-react": "^7.18.6",
|
|
108
|
+
"@commitlint/cli": "^17.0.3",
|
|
109
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
110
110
|
"@testing-library/react": "^13.3.0",
|
|
111
111
|
"auditjs": "^4.0.37",
|
|
112
112
|
"babel-jest": "^28.1.1",
|
|
@@ -114,27 +114,28 @@
|
|
|
114
114
|
"cherry-pick": "^0.5.0",
|
|
115
115
|
"cross-env": "^7.0.3",
|
|
116
116
|
"documentation": "^13.2.5",
|
|
117
|
-
"eslint": "^8.
|
|
117
|
+
"eslint": "^8.18.0",
|
|
118
118
|
"eslint-config-prettier": "^8.3.0",
|
|
119
119
|
"eslint-plugin-babel": "^5.3.1",
|
|
120
120
|
"eslint-plugin-ft-flow": "^2.0.1",
|
|
121
121
|
"eslint-plugin-import": "^2.26.0",
|
|
122
122
|
"eslint-plugin-jest": "^26.5.3",
|
|
123
|
-
"eslint-plugin-jsdoc": "^39.3.
|
|
124
|
-
"eslint-plugin-react": "^7.30.
|
|
123
|
+
"eslint-plugin-jsdoc": "^39.3.3",
|
|
124
|
+
"eslint-plugin-react": "^7.30.1",
|
|
125
125
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
126
|
-
"
|
|
126
|
+
"eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
|
|
127
|
+
"flow-bin": "^0.181.1",
|
|
127
128
|
"flow-copy-source": "^2.0.9",
|
|
128
|
-
"flow-typed": "^3.
|
|
129
|
+
"flow-typed": "^3.8.0",
|
|
129
130
|
"glob": "^8.0.3",
|
|
130
131
|
"history": "^4.0.0",
|
|
131
132
|
"husky": "^8.0.1",
|
|
132
133
|
"jest": "^28.1.1",
|
|
133
134
|
"jest-environment-jsdom": "^28.1.1",
|
|
134
|
-
"jest-junit": "^
|
|
135
|
+
"jest-junit": "^14.0.0",
|
|
135
136
|
"jest-sonar-reporter": "^2.0.0",
|
|
136
137
|
"jscodeshift": "^0.13.1",
|
|
137
|
-
"lint-staged": "^13.0.
|
|
138
|
+
"lint-staged": "^13.0.3",
|
|
138
139
|
"polished": "^4.0.0",
|
|
139
140
|
"prettier": "^2.7.1",
|
|
140
141
|
"react": "^18.0.0",
|
|
@@ -51,21 +51,6 @@ export const UPLOAD_PATH = `${BASE}/uploadFile`;
|
|
|
51
51
|
*/
|
|
52
52
|
export const CAPTCHA_PATH = `${BASE}/captchaServices`;
|
|
53
53
|
|
|
54
|
-
/**
|
|
55
|
-
* Path to login page / component
|
|
56
|
-
*/
|
|
57
|
-
export const LOGIN_PATH = "/signin";
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Path to administrator login page / component
|
|
61
|
-
*/
|
|
62
|
-
export const ADMINISTRATOR_LOGIN_PATH = null;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Path to logout page / component
|
|
66
|
-
*/
|
|
67
|
-
export const LOGOUT_PATH = "/signout";
|
|
68
|
-
|
|
69
54
|
/**
|
|
70
55
|
* Path to change password page / component
|
|
71
56
|
*/
|
|
@@ -51,6 +51,15 @@ const defaultSettings = {
|
|
|
51
51
|
// Renders the login variants as option on the global logout page
|
|
52
52
|
RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,
|
|
53
53
|
|
|
54
|
+
// Path to login page / component
|
|
55
|
+
LOGIN_PATH: "/signin",
|
|
56
|
+
|
|
57
|
+
// Path to administrator login page / component
|
|
58
|
+
ADMINISTRATOR_LOGIN_PATH: "",
|
|
59
|
+
|
|
60
|
+
// Path to logout page / component
|
|
61
|
+
LOGOUT_PATH: "/signout",
|
|
62
|
+
|
|
54
63
|
// Render forms in a modal
|
|
55
64
|
RENDER_FORMS_IN_MODAL: true,
|
|
56
65
|
|
|
@@ -4,32 +4,58 @@ import { useSelector, useDispatch } from "react-redux";
|
|
|
4
4
|
import { getApplication } from "../redux/_modularui/selectors";
|
|
5
5
|
import { login, logout, resetAuthErrors } from "../redux/actions";
|
|
6
6
|
|
|
7
|
+
import Cache from "../utils/browser/Cache";
|
|
8
|
+
import { BASE, getSetting } from "../constants";
|
|
9
|
+
|
|
7
10
|
import type { ResetAuthErrorsAction } from "../redux/types";
|
|
11
|
+
import type { AuthenticationType } from "../models/types";
|
|
12
|
+
import { IllegalStateException } from "../exceptions";
|
|
8
13
|
type LoginHook = {
|
|
9
14
|
isAuthenticated: boolean,
|
|
15
|
+
authenticationTypes: Array<AuthenticationType>,
|
|
10
16
|
errorMessage: ?string,
|
|
11
17
|
resetErrors: () => ResetAuthErrorsAction,
|
|
12
18
|
login: (username: string, password: string) => void,
|
|
19
|
+
redirectLogin: (authenticationType: AuthenticationType) => void,
|
|
13
20
|
};
|
|
14
21
|
type LogoutHook = {
|
|
15
22
|
isAuthenticated: boolean,
|
|
23
|
+
authenticationTypes: Array<AuthenticationType>,
|
|
16
24
|
logout: () => void,
|
|
17
25
|
};
|
|
18
26
|
|
|
19
27
|
/**
|
|
20
28
|
*/
|
|
21
29
|
export const useLogin = (): LoginHook => {
|
|
30
|
+
Cache.setItem("isRedirectLogin", false);
|
|
31
|
+
|
|
22
32
|
const dispatch = useDispatch();
|
|
23
33
|
|
|
24
34
|
const application = useSelector(getApplication);
|
|
25
35
|
const auth = useSelector((state) => state.auth);
|
|
26
36
|
|
|
37
|
+
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
38
|
+
|
|
27
39
|
return {
|
|
28
|
-
isAuthenticated
|
|
40
|
+
isAuthenticated,
|
|
41
|
+
authenticationTypes: application?.authenticationTypes ?? [],
|
|
29
42
|
errorMessage: auth.error,
|
|
30
43
|
resetErrors: () => dispatch(resetAuthErrors()),
|
|
31
44
|
login: (username: string, password: string) =>
|
|
32
45
|
dispatch(login(username, password)),
|
|
46
|
+
redirectLogin: (authenticationType: AuthenticationType) => {
|
|
47
|
+
if (Cache.getItem("isRedirectLogin")) {
|
|
48
|
+
// prevent endless loop in redirects when authentication type can't be redirected
|
|
49
|
+
throw new IllegalStateException(
|
|
50
|
+
`Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri}'`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!isAuthenticated) {
|
|
55
|
+
Cache.setItem("isRedirectLogin", true);
|
|
56
|
+
window.location.assign(`${BASE}${authenticationType.redirectUri}`);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
33
59
|
};
|
|
34
60
|
};
|
|
35
61
|
|
|
@@ -39,8 +65,21 @@ export const useLogout = (): LogoutHook => {
|
|
|
39
65
|
const dispatch = useDispatch();
|
|
40
66
|
const application = useSelector(getApplication);
|
|
41
67
|
|
|
68
|
+
const LOGOUT_PATH = getSetting("LOGOUT_PATH", "/signout");
|
|
69
|
+
|
|
70
|
+
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
42
71
|
return {
|
|
43
|
-
isAuthenticated
|
|
44
|
-
|
|
72
|
+
isAuthenticated,
|
|
73
|
+
authenticationTypes: application?.authenticationTypes ?? [],
|
|
74
|
+
logout: () => {
|
|
75
|
+
if (Cache.getItem("isRedirectLogin")) {
|
|
76
|
+
const origin = window.location.origin;
|
|
77
|
+
const url = `${origin}${BASE}/logout?url=${origin}${BASE}${LOGOUT_PATH}`;
|
|
78
|
+
Cache.setItem("isRedirectLogin", false);
|
|
79
|
+
window.location.assign(url);
|
|
80
|
+
} else {
|
|
81
|
+
return dispatch(logout());
|
|
82
|
+
}
|
|
83
|
+
},
|
|
45
84
|
};
|
|
46
85
|
};
|
|
@@ -31,6 +31,7 @@ export default {
|
|
|
31
31
|
"Constraint.File.InvalidFormat": "Must meet the requirements of the file name",
|
|
32
32
|
"Constraint.File.InvalidMimeType": "Allowed mime types are: ${mime-types}",
|
|
33
33
|
"Constraint.File.MaxFileSizeExceeded": "Maximum file upload size is ${max-filesize}",
|
|
34
|
+
"Constraint.File.OnlyAllowsOneFile": "Only one file is allowed",
|
|
34
35
|
"Constraint.IBAN.InvalidFormat": "Must be a valid IBAN number",
|
|
35
36
|
"Constraint.InvalidLengthBetween": "Length must be between ${min-length} and ${max-length} characters",
|
|
36
37
|
"Constraint.InvalidLengthExact": "Length must be precisely ${length} characters",
|
|
@@ -65,7 +66,7 @@ export default {
|
|
|
65
66
|
"Constraint.TimeStampRange.InvalidRange": "Start value must be before end value",
|
|
66
67
|
"Constraint.TimeStampRange.Mandatory": "Field is mandatory: must contain at least a start or end value",
|
|
67
68
|
"Constraint.XML.InvalidFormat": "Must be well-formed XML",
|
|
68
|
-
"Constraint.ZipCode.InvalidFormat": "Must be a valid Dutch ZIP code, e.g.
|
|
69
|
+
"Constraint.ZipCode.InvalidFormat": "Must be a valid Dutch ZIP code, e.g. 1234AB",
|
|
69
70
|
"Error.AcceptHeaderRequired": "The 'Accept' request-header field must be provided",
|
|
70
71
|
"Error.Authentication.BlockedUser": "You have been logged out, because your account has been blocked",
|
|
71
72
|
"Error.Authentication.ConcurrentUser": "You have been logged out, since your username has been used at a different location.",
|
|
@@ -76,7 +77,7 @@ export default {
|
|
|
76
77
|
"Error.ChangePasswordRequired": "User password is initial or expired, and must be changed ",
|
|
77
78
|
"Error.CodemapLookup.InvalidToken": "Token for codemap lookup is not valid",
|
|
78
79
|
"Error.DataStore.ConcurrentModification": "Another user has updated a record used in this task",
|
|
79
|
-
"Error.DataStore.RecordAlreadyExists": "
|
|
80
|
+
"Error.DataStore.RecordAlreadyExists": "",
|
|
80
81
|
"Error.DataStore.RowCannotBeLocked": "Another user has already locked a record used in this task",
|
|
81
82
|
"Error.Form.DataNotAvailableForId": "Service can not be completed, data not available for mandatory element ${elementid}",
|
|
82
83
|
"Error.Form.ObjectNotAllowed": "Object '${objectid}' is not allowed",
|
|
@@ -31,6 +31,7 @@ export default {
|
|
|
31
31
|
"Constraint.File.InvalidFormat": "Voldoet niet aan de voorwaarden van een bestandsnaam",
|
|
32
32
|
"Constraint.File.InvalidMimeType": "Toegestane mime-types zijn: ${mime-types}",
|
|
33
33
|
"Constraint.File.MaxFileSizeExceeded": "De maximum file grootte voor upload is ${max-filesize}",
|
|
34
|
+
"Constraint.File.OnlyAllowsOneFile": "Er is slechts één bestand toegestaan",
|
|
34
35
|
"Constraint.IBAN.InvalidFormat": "Moet een geldig IBAN nummer zijn",
|
|
35
36
|
"Constraint.InvalidLengthBetween": "Lengte moet tussen ${min-length} en ${max-length} karakters liggen",
|
|
36
37
|
"Constraint.InvalidLengthExact": "Lengte moet precies ${length} karakters zijn",
|
|
@@ -65,18 +66,18 @@ export default {
|
|
|
65
66
|
"Constraint.TimeStampRange.InvalidRange": "De beginwaarde dient voor de eindwaarde te liggen",
|
|
66
67
|
"Constraint.TimeStampRange.Mandatory": "Veld is verplicht: moet tenminste begin- of eindwaarde bevatten",
|
|
67
68
|
"Constraint.XML.InvalidFormat": "Moet geldige XML zijn",
|
|
68
|
-
"Constraint.ZipCode.InvalidFormat": "Moet een geldige postcode zijn, bijvoorbeeld
|
|
69
|
+
"Constraint.ZipCode.InvalidFormat": "Moet een geldige postcode zijn, bijvoorbeeld 1234AB",
|
|
69
70
|
"Error.AcceptHeaderRequired": "De 'Accept' request-header moet worden meegegeven",
|
|
70
71
|
"Error.Authentication.BlockedUser": "U bent uitgelogd omdat uw account geblokkeerd is",
|
|
71
72
|
"Error.Authentication.ConcurrentUser": "U bent uitgelogd omdat uw gebruikersnaam op een andere locatie is gebruikt om in te loggen.",
|
|
72
73
|
"Error.Authentication.InvalidCredentials": "Inloggen is mislukt",
|
|
73
|
-
"Error.Authentication.InvalidUsername": "
|
|
74
|
+
"Error.Authentication.InvalidUsername": "U bent uitgelogd omdat uw gebruikersnaam niet meer geldig is",
|
|
74
75
|
"Error.Authentication.Required": "Autorisatie is vereist",
|
|
75
76
|
"Error.Case.ConcurrentModification": "Een andere gebruiker heeft het dossier aangepast waardoor deze taak nu niet meer is toegestaan",
|
|
76
77
|
"Error.ChangePasswordRequired": "Gebruikerswachtwoord is initieel of verlopen, en moet worden aangepast",
|
|
77
78
|
"Error.CodemapLookup.InvalidToken": "Token voor keuzelijst lookup is niet valide",
|
|
78
79
|
"Error.DataStore.ConcurrentModification": "Een andere gebruiker heeft de rij in de datastore reeds aangepast",
|
|
79
|
-
"Error.DataStore.RecordAlreadyExists": "
|
|
80
|
+
"Error.DataStore.RecordAlreadyExists": "",
|
|
80
81
|
"Error.DataStore.RowCannotBeLocked": "Een andere gebruiker heeft de rij in bewerking en daarom kan deze taak niet worden volbracht.",
|
|
81
82
|
"Error.Form.DataNotAvailableForId": "Service kan niet worden afgrond, data voor verplicht element ${elementid} is niet beschikbaar",
|
|
82
83
|
"Error.Form.ObjectNotAllowed": "Object '${objectid}' is niet toegestaan",
|
|
@@ -68,7 +68,13 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
68
68
|
* Getting the authentication types of the application
|
|
69
69
|
*/
|
|
70
70
|
get authenticationTypes(): Array<AuthenticationType> {
|
|
71
|
-
|
|
71
|
+
const authenticationTypes = this.getContribution("security", []);
|
|
72
|
+
|
|
73
|
+
//put primary first
|
|
74
|
+
return authenticationTypes?.sort(
|
|
75
|
+
(a: AuthenticationType, b: AuthenticationType) =>
|
|
76
|
+
a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1
|
|
77
|
+
);
|
|
72
78
|
}
|
|
73
79
|
/**
|
|
74
80
|
* Getting the tab links
|