@beinformed/ui 1.20.3 → 1.20.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/esm/constants/Settings.js +2 -1
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useAuthentication.js +1 -0
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
  7. package/esm/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
  8. package/esm/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
  9. package/esm/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
  10. package/esm/models/form/FormModel.js +7 -6
  11. package/esm/models/form/FormModel.js.map +1 -1
  12. package/esm/modularui/ModularUIRequest.js +4 -1
  13. package/esm/modularui/ModularUIRequest.js.map +1 -1
  14. package/esm/redux/_modularui/actions.js +1 -1
  15. package/esm/redux/_modularui/actions.js.map +1 -1
  16. package/esm/redux/actions/Authorization.js +4 -9
  17. package/esm/redux/actions/Authorization.js.map +1 -1
  18. package/esm/redux/actions/SignIn.js +7 -0
  19. package/esm/redux/actions/SignIn.js.map +1 -1
  20. package/esm/redux/index.js +3 -1
  21. package/esm/redux/index.js.map +1 -1
  22. package/esm/redux/selectors/index.js +2 -0
  23. package/esm/redux/selectors/index.js.map +1 -0
  24. package/esm/redux/types.js.map +1 -1
  25. package/lib/constants/Settings.js +2 -1
  26. package/lib/constants/Settings.js.flow +2 -0
  27. package/lib/constants/Settings.js.map +1 -1
  28. package/lib/hooks/useAuthentication.js +2 -0
  29. package/lib/hooks/useAuthentication.js.flow +2 -0
  30. package/lib/hooks/useAuthentication.js.map +1 -1
  31. package/lib/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
  32. package/lib/i18n/translations/beinformed_error_messages_en.nl.js.flow +3 -2
  33. package/lib/i18n/translations/beinformed_error_messages_en.nl.js.map +1 -1
  34. package/lib/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
  35. package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.flow +4 -3
  36. package/lib/i18n/translations/beinformed_error_messages_nl.nl.js.map +1 -1
  37. package/lib/models/form/FormModel.js +7 -7
  38. package/lib/models/form/FormModel.js.flow +2 -3
  39. package/lib/models/form/FormModel.js.map +1 -1
  40. package/lib/modularui/ModularUIRequest.js +4 -1
  41. package/lib/modularui/ModularUIRequest.js.flow +9 -1
  42. package/lib/modularui/ModularUIRequest.js.map +1 -1
  43. package/lib/redux/_modularui/actions.js +1 -1
  44. package/lib/redux/_modularui/actions.js.flow +1 -4
  45. package/lib/redux/_modularui/actions.js.map +1 -1
  46. package/lib/redux/actions/Authorization.js +4 -10
  47. package/lib/redux/actions/Authorization.js.flow +3 -16
  48. package/lib/redux/actions/Authorization.js.map +1 -1
  49. package/lib/redux/actions/SignIn.js +12 -2
  50. package/lib/redux/actions/SignIn.js.flow +11 -2
  51. package/lib/redux/actions/SignIn.js.map +1 -1
  52. package/lib/redux/actions/__tests__/Authorization.spec.js.flow +4 -18
  53. package/lib/redux/index.js +14 -0
  54. package/lib/redux/index.js.flow +3 -0
  55. package/lib/redux/index.js.map +1 -1
  56. package/lib/redux/selectors/index.js +21 -0
  57. package/lib/redux/selectors/index.js.flow +2 -0
  58. package/lib/redux/selectors/index.js.map +1 -0
  59. package/lib/redux/types.js.flow +2 -2
  60. package/lib/redux/types.js.map +1 -1
  61. package/package.json +17 -16
  62. package/src/constants/Settings.js +2 -0
  63. package/src/hooks/useAuthentication.js +2 -0
  64. package/src/i18n/translations/beinformed_error_messages_en.nl.js +3 -2
  65. package/src/i18n/translations/beinformed_error_messages_nl.nl.js +4 -3
  66. package/src/models/form/FormModel.js +2 -3
  67. package/src/modularui/ModularUIRequest.js +9 -1
  68. package/src/redux/_modularui/actions.js +1 -4
  69. package/src/redux/actions/Authorization.js +3 -16
  70. package/src/redux/actions/SignIn.js +11 -2
  71. package/src/redux/actions/__tests__/Authorization.spec.js +4 -18
  72. package/src/redux/index.js +3 -0
  73. package/src/redux/selectors/index.js +2 -0
  74. package/src/redux/types.js +2 -2
@@ -1,11 +1,8 @@
1
1
  // @flow
2
- import { 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,24 +38,13 @@ export const handleUnauthorized =
40
38
  dispatch(reloadApplication());
41
39
  }
42
40
 
43
- // set logged auth
41
+ // set logged out
44
42
  dispatch(logoutSuccess());
45
43
 
46
44
  Cache.removeItem("auth");
47
45
 
48
46
  if (errorResponse.isInvalidUsername) {
49
- const WARNING_TIMEOUT = 4000;
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
@@ -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","WARNING_TIMEOUT","showNotification","NOTIFICATION_TYPES","WARNING","id","defaultMessage","message","router","LOGIN_PATH","pathname","locationFrom","state","from","replace","modal","type"],"sources":["../../../src/redux/actions/Authorization.js"],"sourcesContent":["// @flow\nimport { NOTIFICATION_TYPES } from \"../../constants/Constants\";\n\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\n\nimport { replace } from \"../_router/actions\";\nimport { logoutSuccess } from \"./SignOut\";\nimport { showNotification } from \"./Notification\";\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\";\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 auth\n dispatch(logoutSuccess());\n\n Cache.removeItem(\"auth\");\n\n if (errorResponse.isInvalidUsername) {\n const WARNING_TIMEOUT = 4000;\n dispatch(\n showNotification(\n NOTIFICATION_TYPES.WARNING,\n {\n id: errorResponse.id,\n defaultMessage: errorResponse.message,\n },\n null,\n WARNING_TIMEOUT\n )\n );\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;;AAEA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAEA;;AAIA;AACA;AACO,IAAMA,k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,MAAuBD,UAA3B,EAAuC;MAAA;;MACrC,IAAME,YAAY,GAAGrB,QAAH,aAAGA,QAAH,0CAAGA,QAAQ,CAAEsB,KAAb,oDAAG,gBAAiBC,IAAtC;MACA,OAAO/B,QAAQ,CACb,IAAAgC,gBAAA,EAAQL,UAAR,EAAoB;QAClBI,IAAI,EAAEF,YAAY,GAAGA,YAAH,GAAkB5B,QAAQ,GAAGyB,MAAX,CAAkBlB,QADpC;QAElB;QACAyB,KAAK,EAAE;MAHW,CAApB,CADa,CAAf;IAOD;;IAED,OAAO;MAAEC,IAAI,EAAE;IAAR,CAAP;EACD,CAvDD;AAAA,CADK"}
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"}
@@ -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.loginFailed = loginFailed;
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
- LoginFailedAction,
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 = (errorMessage: string): LoginFailedAction => ({
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 LoginFailedAction,\n ResetAuthErrorsAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (errorMessage: string): LoginFailedAction => ({\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,CAACC,YAAD;EAAA,OAA8C;IACvEC,IAAI,EAAE,sBADiE;IAEvEC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,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,CAACP,WAAW,CAAC6B,KAAK,CAACC,EAAP,CAAZ,CAAR;MACA,OAAOvB,QAAQ,CAAC,IAAAoB,iCAAA,GAAD,CAAf;IACD,CArBI,CAAP;EAsBD,CA1BD;AAAA,CADK"}
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,OA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I,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: "SHOW_NOTIFICATION",
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: "SHOW_NOTIFICATION",
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",
@@ -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
@@ -21,4 +21,7 @@ export * from "./connectors/index";
21
21
  // REDUCERS
22
22
  export * from "./reducers/index";
23
23
 
24
+ // SELECTORS
25
+ export * from "./selectors/index";
26
+
24
27
  export type * from "./types";
@@ -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,2 @@
1
+ // @flow
2
+ export * from "./i18n";
@@ -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"}
@@ -103,7 +103,7 @@ export type UpdateProgressAction = {
103
103
  payload: { percentComplete: number },
104
104
  };
105
105
 
106
- export type LoginFailedAction = {
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
@@ -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 LoginFailedAction = {\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 | LoginFailedAction\n | ResetAuthErrorsAction\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":""}
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",
3
+ "version": "1.20.6",
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.3",
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.17.10",
99
- "@babel/core": "^7.18.5",
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.17.12",
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.5",
105
- "@babel/preset-env": "^7.18.2",
106
- "@babel/preset-flow": "^7.17.12",
107
- "@babel/preset-react": "^7.17.12",
108
- "@commitlint/cli": "^17.0.2",
109
- "@commitlint/config-conventional": "^17.0.2",
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",
@@ -121,20 +121,21 @@
121
121
  "eslint-plugin-import": "^2.26.0",
122
122
  "eslint-plugin-jest": "^26.5.3",
123
123
  "eslint-plugin-jsdoc": "^39.3.3",
124
- "eslint-plugin-react": "^7.30.0",
124
+ "eslint-plugin-react": "^7.30.1",
125
125
  "eslint-plugin-react-hooks": "^4.5.0",
126
- "flow-bin": "^0.180.1",
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.6.1",
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": "^13.2.0",
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.2",
138
+ "lint-staged": "^13.0.3",
138
139
  "polished": "^4.0.0",
139
140
  "prettier": "^2.7.1",
140
141
  "react": "^18.0.0",
@@ -102,6 +102,8 @@ const defaultSettings = {
102
102
  PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,
103
103
 
104
104
  XHR_TIMEOUT_MS: 300000,
105
+
106
+ HIDE_WHEN_EMPTY_IGNORE_TASKS: false,
105
107
  };
106
108
 
107
109
  let settings = defaultSettings;
@@ -27,6 +27,8 @@ type LogoutHook = {
27
27
  /**
28
28
  */
29
29
  export const useLogin = (): LoginHook => {
30
+ Cache.setItem("isRedirectLogin", false);
31
+
30
32
  const dispatch = useDispatch();
31
33
 
32
34
  const application = useSelector(getApplication);
@@ -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. 1234 AB",
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": "Row cannot be overwritten because it already exists",
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 1234 AB",
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": "\"U bent uitgelogd omdat uw gebruikersnaam niet meer geldig is",
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": "Rij kan niet worden overschreven aangezien deze reeds bestaat",
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",
@@ -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 get(this.buttonLabels, "cancel", null);
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 get(this.currentFormObject?.buttonLabels, buttonType, null);
162
+ return this.currentFormObject?.buttonLabels?.[buttonType] ?? null;
164
163
  }
165
164
 
166
165
  /**
@@ -445,6 +445,11 @@ class ModularUIRequest {
445
445
  /**
446
446
  */
447
447
  isHiddenList(name: string, href: string): Promise<string> {
448
+ const HIDE_WHEN_EMPTY_IGNORE_TASKS = getSetting(
449
+ "HIDE_WHEN_EMPTY_IGNORE_TASKS",
450
+ false
451
+ );
452
+
448
453
  return universalFetch({
449
454
  ...this.options,
450
455
  url: `${BASE}${href}`,
@@ -454,7 +459,10 @@ class ModularUIRequest {
454
459
  const [key] = Object.keys(response);
455
460
  const { _embedded, actions } = response[key];
456
461
 
457
- const isHidden = _embedded == null && actions == null;
462
+ const noListItems = _embedded == null;
463
+ const noActions = actions == null || HIDE_WHEN_EMPTY_IGNORE_TASKS;
464
+
465
+ const isHidden = noListItems && noActions;
458
466
  if (isHidden) {
459
467
  return name;
460
468
  }
@@ -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 { 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,24 +38,13 @@ export const handleUnauthorized =
40
38
  dispatch(reloadApplication());
41
39
  }
42
40
 
43
- // set logged auth
41
+ // set logged out
44
42
  dispatch(logoutSuccess());
45
43
 
46
44
  Cache.removeItem("auth");
47
45
 
48
46
  if (errorResponse.isInvalidUsername) {
49
- const WARNING_TIMEOUT = 4000;
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
@@ -9,7 +9,7 @@ import { push } from "../_router/actions";
9
9
  import { CHANGEPASSWORD_PATH } from "../../constants/Constants";
10
10
 
11
11
  import type {
12
- LoginFailedAction,
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 = (errorMessage: string): LoginFailedAction => ({
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: "SHOW_NOTIFICATION",
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: "SHOW_NOTIFICATION",
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",