@beinformed/ui 1.18.9 → 1.19.3

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 (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/constants/Settings.js +6 -0
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useNotification.js +11 -1
  5. package/esm/hooks/useNotification.js.map +1 -1
  6. package/esm/models/application/ApplicationModel.js +9 -0
  7. package/esm/models/application/ApplicationModel.js.map +1 -1
  8. package/esm/models/attributes/PasswordAttributeModel.js +50 -31
  9. package/esm/models/attributes/PasswordAttributeModel.js.map +1 -1
  10. package/esm/models/types.js.map +1 -1
  11. package/lib/constants/Settings.js +6 -0
  12. package/lib/constants/Settings.js.flow +9 -0
  13. package/lib/constants/Settings.js.map +1 -1
  14. package/lib/hooks/useNotification.js +15 -1
  15. package/lib/hooks/useNotification.js.flow +20 -1
  16. package/lib/hooks/useNotification.js.map +1 -1
  17. package/lib/models/application/ApplicationModel.js +9 -0
  18. package/lib/models/application/ApplicationModel.js.flow +7 -1
  19. package/lib/models/application/ApplicationModel.js.map +1 -1
  20. package/lib/models/attributes/PasswordAttributeModel.js +50 -31
  21. package/lib/models/attributes/PasswordAttributeModel.js.flow +63 -46
  22. package/lib/models/attributes/PasswordAttributeModel.js.map +1 -1
  23. package/lib/models/types.js.flow +7 -0
  24. package/lib/models/types.js.map +1 -1
  25. package/package.json +14 -14
  26. package/src/constants/Settings.js +9 -0
  27. package/src/hooks/useNotification.js +20 -1
  28. package/src/models/application/ApplicationModel.js +7 -1
  29. package/src/models/attributes/PasswordAttributeModel.js +63 -46
  30. package/src/models/types.js +7 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.19.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.19.2...v1.19.3) (2022-06-17)
6
+
7
+ ### [1.19.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.19.1...v1.19.2) (2022-06-17)
8
+
9
+ ### [1.19.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.19.0...v1.19.1) (2022-06-16)
10
+
11
+ ### Bug Fixes
12
+
13
+ - **confirm-password:** confirm constraint only in specific situations ([bf39462](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bf394622b39c51145411bf4176d055d57488c412))
14
+
15
+ ## [1.19.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.18.9...v1.19.0) (2022-06-15)
16
+
17
+ ### Features
18
+
19
+ - **hooks:** add error notification hook ([dc8f71a](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/dc8f71a849418d4b3022b8ab96a5cfae018cea7d))
20
+
5
21
  ### [1.18.9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.18.8...v1.18.9) (2022-06-14)
6
22
 
7
23
  ### Bug Fixes
@@ -22,6 +22,12 @@ var defaultSettings = {
22
22
  USE_INSTANT_SERVER_VALIDATION: true,
23
23
  // Indicates which locales are enabled
24
24
  ENABLED_LOCALES: ["en", "nl"],
25
+ // Renders the global log in page
26
+ RENDER_GLOBAL_LOGIN_PAGE: false,
27
+ // Renders the global log out page
28
+ RENDER_GLOBAL_LOGOUT_PAGE: false,
29
+ // Renders the login variants as option on the global logout page
30
+ RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,
25
31
  // Render forms in a modal
26
32
  RENDER_FORMS_IN_MODAL: true,
27
33
  // Wait timeout before rendering submit wait icon
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData","loginType","loginPath","loginUsernameField","loginPasswordField","logoutPath"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SACEC,2BADF,EAEEC,UAFF,EAGEC,kBAHF,EAIEC,sBAJF,EAKEC,sBALF,EAMEC,mBANF,QAOO,aAPP;AAWA,IAAMC,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oBAAoB,EAAE,CAAC,UAAD,EA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;AACA;;AACA,OAAO,IAAMG,UAAU,GAAG,SAAbA,UAAa,CAACJ,GAAD,EAAcK,KAAd,EAA6B;EACrDT,QAAQ,CAACI,GAAD,CAAR,GAAgBK,KAAhB;AACD,CAFM;AAIP;AACA;;AACA,OAAO,IAAMC,WAAW,GAAG,SAAdA,WAAc;EAAA,OAAmCV,QAAnC;AAAA,CAApB;AAEP;AACA;;AACA,OAAO,IAAMW,mBAAmB,GAAG,SAAtBA,mBAAsB;EAAA,OACjCR,UAAU,CAAClC,2BAAD,EAA8B,IAA9B,CADuB;AAAA,CAA5B;AAGP;AACA;AACA;;AACA,OAAO,IAAM2C,SAAS,GAAG,SAAZA,SAAY;EAAA,OAAcT,UAAU,CAACjC,UAAD,EAAa,MAAb,CAAxB;AAAA,CAAlB;AAEP;AACA;;AACA,OAAO,IAAM2C,SAAS,GAAG,SAAZA,SAAY;EAAA,OACvBV,UAAU,CAAChC,kBAAD,EAAqB,mBAArB,CADa;AAAA,CAAlB;AAEP;AACA;;AACA,OAAO,IAAM2C,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChCX,UAAU,CAAC/B,sBAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;AACA,OAAO,IAAM2C,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChCZ,UAAU,CAAC9B,sBAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;AACA,OAAO,IAAM2C,UAAU,GAAG,SAAbA,UAAa;EAAA,OACxBb,UAAU,CAAC7B,mBAAD,EAAsB,SAAtB,CADc;AAAA,CAAnB"}
1
+ {"version":3,"file":"Settings.js","names":["isPlainObject","has","ALL_CONTENT_IN_DATA_SETTING","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData","loginType","loginPath","loginUsernameField","loginPasswordField","logoutPath"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";AACA,SAASA,aAAT,EAAwBC,GAAxB,QAAmC,0BAAnC;AACA,SACEC,2BADF,EAEEC,UAFF,EAGEC,kBAHF,EAIEC,sBAJF,EAKEC,sBALF,EAMEC,mBANF,QAOO,aAPP;AAWA,IAAMC,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EA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,OACxBb,UAAU,CAAChC,mBAAD,EAAsB,SAAtB,CADc;AAAA,CAAnB"}
@@ -1,5 +1,6 @@
1
1
  import { useSelector, useDispatch } from "react-redux";
2
- import { dismissNotification } from "../redux/actions";
2
+ import { dismissNotification, showNotification } from "../redux/actions";
3
+ import { NOTIFICATION_TYPES } from "../constants";
3
4
 
4
5
  /**
5
6
  */
@@ -24,4 +25,13 @@ export var useNotification = function useNotification() {
24
25
  }
25
26
  };
26
27
  };
28
+ /**
29
+ */
30
+
31
+ export var useErrorNotification = function useErrorNotification() {
32
+ var dispatch = useDispatch();
33
+ return function (message, error) {
34
+ return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));
35
+ };
36
+ };
27
37
  //# sourceMappingURL=useNotification.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNotification.js","names":["useSelector","useDispatch","dismissNotification","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n} from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,QAAoC,kBAApC;;AAWA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;EACrD,IAAMC,QAAQ,GAAGH,WAAW,EAA5B;;EACA,mBAAgDD,WAAW,CACzD,UAACK,KAAD;IAAA,OAAWA,KAAK,CAACC,YAAjB;EAAA,CADyD,CAA3D;EAAA,IAAQC,MAAR,gBAAQA,MAAR;EAAA,IAAgBC,WAAhB,gBAAgBA,WAAhB;EAAA,IAA6BC,OAA7B,gBAA6BA,OAA7B;EAAA,IAAsCC,KAAtC,gBAAsCA,KAAtC;;EAIA,OAAO;IACLH,MAAM,EAANA,MADK;IAELC,WAAW,EAAXA,WAFK;IAGLC,OAAO,EAAPA,OAHK;IAILC,KAAK,EAALA,KAJK;IAKLC,OAAO,EAAE;MAAA,OAAMP,QAAQ,CAACF,mBAAmB,EAApB,CAAd;IAAA;EALJ,CAAP;AAOD,CAbM"}
1
+ {"version":3,"file":"useNotification.js","names":["useSelector","useDispatch","dismissNotification","showNotification","NOTIFICATION_TYPES","useNotification","dispatch","state","notification","render","messageType","message","error","dismiss","useErrorNotification","ERROR"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification, showNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n ShowNotificationAction,\n} from \"../redux/types\";\n\nimport { NOTIFICATION_TYPES } from \"../constants\";\n\nimport type { MessageObject } from \"../i18n\";\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\ntype ErrorNotificationHook = (\n message: MessageObject,\n error?: ?ErrorResponse\n) => ShowNotificationAction;\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\n/**\n */\nexport const useErrorNotification = (): ErrorNotificationHook => {\n const dispatch = useDispatch();\n return (message: MessageObject, error?: ?ErrorResponse) => {\n return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));\n };\n};\n"],"mappings":"AACA,SAASA,WAAT,EAAsBC,WAAtB,QAAyC,aAAzC;AACA,SAASC,mBAAT,EAA8BC,gBAA9B,QAAsD,kBAAtD;AAQA,SAASC,kBAAT,QAAmC,cAAnC;;AAaA;AACA;AACA,OAAO,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;EACrD,IAAMC,QAAQ,GAAGL,WAAW,EAA5B;;EACA,mBAAgDD,WAAW,CACzD,UAACO,KAAD;IAAA,OAAWA,KAAK,CAACC,YAAjB;EAAA,CADyD,CAA3D;EAAA,IAAQC,MAAR,gBAAQA,MAAR;EAAA,IAAgBC,WAAhB,gBAAgBA,WAAhB;EAAA,IAA6BC,OAA7B,gBAA6BA,OAA7B;EAAA,IAAsCC,KAAtC,gBAAsCA,KAAtC;;EAIA,OAAO;IACLH,MAAM,EAANA,MADK;IAELC,WAAW,EAAXA,WAFK;IAGLC,OAAO,EAAPA,OAHK;IAILC,KAAK,EAALA,KAJK;IAKLC,OAAO,EAAE;MAAA,OAAMP,QAAQ,CAACJ,mBAAmB,EAApB,CAAd;IAAA;EALJ,CAAP;AAOD,CAbM;AAeP;AACA;;AACA,OAAO,IAAMY,oBAAoB,GAAG,SAAvBA,oBAAuB,GAA6B;EAC/D,IAAMR,QAAQ,GAAGL,WAAW,EAA5B;EACA,OAAO,UAACU,OAAD,EAAyBC,KAAzB,EAAoD;IACzD,OAAON,QAAQ,CAACH,gBAAgB,CAACC,kBAAkB,CAACW,KAApB,EAA2BJ,OAA3B,EAAoCC,KAApC,CAAjB,CAAf;EACD,CAFD;AAGD,CALM"}
@@ -93,6 +93,15 @@ var ApplicationModel = /*#__PURE__*/function (_ResourceModel) {
93
93
  get: function get() {
94
94
  return this.getContribution("label", "");
95
95
  }
96
+ /**
97
+ * Getting the authentication types of the application
98
+ */
99
+
100
+ }, {
101
+ key: "authenticationTypes",
102
+ get: function get() {
103
+ return this.getContribution("security", []);
104
+ }
96
105
  /**
97
106
  * Getting the tab links
98
107
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","ApplicationModel","userService","links","getLinkByKey","href","path","models","userServiceModel","model","type","userServices","getContribution","getLinksByGroup","create","_userServices","isLoggedIn","userLink","data","contributions","resourcetype"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\"\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\"\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\"modelcatalog\", \"/modelcatalog\", \"Model catalog\");\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices != null && this.userServices.userLink != null) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,OAAOA,aAAP,MAA0B,uBAA1B;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AACA,OAAOC,iBAAP,MAA8B,2BAA9B;AAEA,SAASC,sBAAT,QAAuC,kBAAvC;;AAOA;AACA;AACA;IACqBC,gB;;;;;;;;;;;;;;;;;;;;;;;;;;IAGnB;AACF;AACA;IACE,eAAmB;MACjB,OAAO,aAAP;IACD;IAED;AACF;;;;;IAQE;AACF;IACE,qCAA8C;MAC5C,IAAMC,WAAW,GAAG,KAAKC,KAAL,CAAWC,YAAX,CAAwB,cAAxB,CAApB;;MACA,IAAIF,WAAW,IAAIA,WAAW,CAACG,IAAZ,CAAiBC,IAAjB,KAA0B,QAA7C,EAAuD;QACrD,MAAM,IAAIN,sBAAJ,CACJ,kIADI,CAAN;MAGD;;MAED,OAAOE,WAAW,GAAG,CAACA,WAAD,CAAH,GAAmB,EAArC;IACD;IAED;AACF;;;;WACE,wBAAeK,MAAf,EAA8C;MAC5C,IAAMC,gBAAgB,GAAG,sBAAAD,MAAM,MAAN,CAAAA,MAAM,EAC7B,UAACE,KAAD;QAAA,OAAWA,KAAK,CAACC,IAAN,KAAe,cAA1B;MAAA,CAD6B,CAA/B;;MAIA,IAAIF,gBAAJ,EAAsB;QACpB,KAAKG,YAAL,GAAoBH,gBAApB;MACD;IACF;IAED;AACF;AACA;;;;SACE,eAAoB;MAClB,OAAO,KAAKI,eAAL,CAAqB,OAArB,EAA8B,EAA9B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAA2B;MACzB,OAAO,KAAKT,KAAL,CAAWU,eAAX,CAA2B,KAA3B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAA8B;MAC5B,OAAOf,SAAS,CAACgB,MAAV,CAAiB,cAAjB,EAAiC,eAAjC,EAAkD,eAAlD,CAAP;IACD;IAED;AACF;AACA;;;;;IAKE;AACF;AACA;IACE,eAAuC;MACrC,OAAO,KAAKC,aAAL,GAAqB,KAAKA,aAA1B,GAA0C,IAAjD;IACD;IAED;AACF;AACA;;SAbE,aAAiBN,KAAjB,EAAyC;MACvC,KAAKM,aAAL,GAAqBN,KAAK,YAAYV,iBAAjB,GAAqCU,KAArC,GAA6C,IAAlE;IACD;;;SAYD,eAA0B;MAAA;;MACxB,sDAAO,KAAKE,YAAZ,uDAAO,mBAAmBK,UAA1B,yEAAwC,KAAxC;IACD;IAED;AACF;AACA;AACA;;;;SACE,eAA4B;MAC1B,IAAI,KAAKL,YAAL,IAAqB,IAArB,IAA6B,KAAKA,YAAL,CAAkBM,QAAlB,IAA8B,IAA/D,EAAqE;QACnE,OAAO,KAAKN,YAAL,CAAkBM,QAAlB,CAA2BZ,IAAlC;MACD;;MAED,OAAO,IAAP;IACD;;;WApFD,2BAAyBa,IAAzB,EAA2D;MACzD,OACEA,IAAI,CAACC,aAAL,CAAmBC,YAAnB,IACAF,IAAI,CAACC,aAAL,CAAmBC,YAAnB,KAAoC,aAFtC;IAID;;;;EAjB2CvB,a;;SAAzBI,gB"}
1
+ {"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","ApplicationModel","userService","links","getLinkByKey","href","path","models","userServiceModel","model","type","userServices","getContribution","getLinksByGroup","create","_userServices","isLoggedIn","userLink","data","contributions","resourcetype"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\"\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\"\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n return this.getContribution(\"security\", []);\n }\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\"modelcatalog\", \"/modelcatalog\", \"Model catalog\");\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices != null && this.userServices.userLink != null) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,OAAOA,aAAP,MAA0B,uBAA1B;AACA,OAAOC,SAAP,MAAsB,oBAAtB;AACA,OAAOC,iBAAP,MAA8B,2BAA9B;AAEA,SAASC,sBAAT,QAAuC,kBAAvC;;AAOA;AACA;AACA;IACqBC,gB;;;;;;;;;;;;;;;;;;;;;;;;;;IAGnB;AACF;AACA;IACE,eAAmB;MACjB,OAAO,aAAP;IACD;IAED;AACF;;;;;IAQE;AACF;IACE,qCAA8C;MAC5C,IAAMC,WAAW,GAAG,KAAKC,KAAL,CAAWC,YAAX,CAAwB,cAAxB,CAApB;;MACA,IAAIF,WAAW,IAAIA,WAAW,CAACG,IAAZ,CAAiBC,IAAjB,KAA0B,QAA7C,EAAuD;QACrD,MAAM,IAAIN,sBAAJ,CACJ,kIADI,CAAN;MAGD;;MAED,OAAOE,WAAW,GAAG,CAACA,WAAD,CAAH,GAAmB,EAArC;IACD;IAED;AACF;;;;WACE,wBAAeK,MAAf,EAA8C;MAC5C,IAAMC,gBAAgB,GAAG,sBAAAD,MAAM,MAAN,CAAAA,MAAM,EAC7B,UAACE,KAAD;QAAA,OAAWA,KAAK,CAACC,IAAN,KAAe,cAA1B;MAAA,CAD6B,CAA/B;;MAIA,IAAIF,gBAAJ,EAAsB;QACpB,KAAKG,YAAL,GAAoBH,gBAApB;MACD;IACF;IAED;AACF;AACA;;;;SACE,eAAoB;MAClB,OAAO,KAAKI,eAAL,CAAqB,OAArB,EAA8B,EAA9B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAAqD;MACnD,OAAO,KAAKA,eAAL,CAAqB,UAArB,EAAiC,EAAjC,CAAP;IACD;IACD;AACF;AACA;;;;SACE,eAA2B;MACzB,OAAO,KAAKT,KAAL,CAAWU,eAAX,CAA2B,KAA3B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAA8B;MAC5B,OAAOf,SAAS,CAACgB,MAAV,CAAiB,cAAjB,EAAiC,eAAjC,EAAkD,eAAlD,CAAP;IACD;IAED;AACF;AACA;;;;;IAKE;AACF;AACA;IACE,eAAuC;MACrC,OAAO,KAAKC,aAAL,GAAqB,KAAKA,aAA1B,GAA0C,IAAjD;IACD;IAED;AACF;AACA;;SAbE,aAAiBN,KAAjB,EAAyC;MACvC,KAAKM,aAAL,GAAqBN,KAAK,YAAYV,iBAAjB,GAAqCU,KAArC,GAA6C,IAAlE;IACD;;;SAYD,eAA0B;MAAA;;MACxB,sDAAO,KAAKE,YAAZ,uDAAO,mBAAmBK,UAA1B,yEAAwC,KAAxC;IACD;IAED;AACF;AACA;AACA;;;;SACE,eAA4B;MAC1B,IAAI,KAAKL,YAAL,IAAqB,IAArB,IAA6B,KAAKA,YAAL,CAAkBM,QAAlB,IAA8B,IAA/D,EAAqE;QACnE,OAAO,KAAKN,YAAL,CAAkBM,QAAlB,CAA2BZ,IAAlC;MACD;;MAED,OAAO,IAAP;IACD;;;WA1FD,2BAAyBa,IAAzB,EAA2D;MACzD,OACEA,IAAI,CAACC,aAAL,CAAmBC,YAAnB,IACAF,IAAI,CAACC,aAAL,CAAmBC,YAAnB,KAAoC,aAFtC;IAID;;;;EAjB2CvB,a;;SAAzBI,gB"}
@@ -136,36 +136,56 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
136
136
  }, {
137
137
  key: "addConstraints",
138
138
  value: function addConstraints() {
139
+ if (this.isConfirmPassword) {
140
+ return this.getConfirmPasswordConstraints();
141
+ }
142
+
143
+ return this.getStandardPasswordConstraints();
144
+ }
145
+ /**
146
+ * Constraints for a confirmation password
147
+ */
148
+
149
+ }, {
150
+ key: "getConfirmPasswordConstraints",
151
+ value: function getConfirmPasswordConstraints() {
139
152
  var constraints = new ConstraintCollection();
153
+ constraints.add(new PasswordConfirmConstraint(this.confirmValue, this.otherLabel));
154
+ return constraints;
155
+ }
156
+ /**
157
+ * Constrains for a standard password
158
+ */
140
159
 
141
- if (this.isConfirmPassword) {
160
+ }, {
161
+ key: "getStandardPasswordConstraints",
162
+ value: function getStandardPasswordConstraints() {
163
+ var constraints = new ConstraintCollection();
164
+
165
+ if (this.upperAndLowerCaseMandatory) {
166
+ constraints.add(new PasswordLowerAndUpperCaseConstraint());
167
+ }
168
+
169
+ if (this.maxSequenceOfIdenticalCharacters) {
170
+ constraints.add(new PasswordThreeConsecutiveCharactersNotAllowedConstraint(this.maxSequenceOfIdenticalCharacters));
171
+ }
172
+
173
+ if (this.minNumberOfNumericCharacters) {
174
+ constraints.add(new PasswordMinNumericCharactersConstraint(this.minNumberOfNumericCharacters));
175
+ }
176
+
177
+ if (this.minNumberOfSpecialCharacters) {
178
+ constraints.add(new PasswordMinSpecialCharactersConstraint(this.minNumberOfSpecialCharacters));
179
+ }
180
+
181
+ if (this.regexConstraints && this.regexConstraints.length > 0) {
182
+ this.regexConstraints.forEach(function (regexConstraint) {
183
+ constraints.add(new RegexConstraint(regexConstraint));
184
+ });
185
+ }
186
+
187
+ if (this.layouthint.has(CONFIRM_PASSWORD) && this.isConfirmPassword == null) {
142
188
  constraints.add(new PasswordConfirmConstraint(this.confirmValue, this.otherLabel));
143
- } else {
144
- if (this.upperAndLowerCaseMandatory) {
145
- constraints.add(new PasswordLowerAndUpperCaseConstraint());
146
- }
147
-
148
- if (this.maxSequenceOfIdenticalCharacters) {
149
- constraints.add(new PasswordThreeConsecutiveCharactersNotAllowedConstraint(this.maxSequenceOfIdenticalCharacters));
150
- }
151
-
152
- if (this.minNumberOfNumericCharacters) {
153
- constraints.add(new PasswordMinNumericCharactersConstraint(this.minNumberOfNumericCharacters));
154
- }
155
-
156
- if (this.minNumberOfSpecialCharacters) {
157
- constraints.add(new PasswordMinSpecialCharactersConstraint(this.minNumberOfSpecialCharacters));
158
- }
159
-
160
- if (this.regexConstraints && this.regexConstraints.length > 0) {
161
- this.regexConstraints.forEach(function (regexConstraint) {
162
- constraints.add(new RegexConstraint(regexConstraint));
163
- });
164
- }
165
-
166
- if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== "") {
167
- constraints.add(new PasswordConfirmConstraint(this.confirmValue, this.otherLabel));
168
- }
169
189
  }
170
190
 
171
191
  return constraints;
@@ -178,9 +198,8 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
178
198
  key: "constraintCollection",
179
199
  get: function get() {
180
200
  if (this.isConfirmPassword) {
181
- var constraints = new ConstraintCollection();
182
- constraints.add(this.addConstraints());
183
- return constraints;
201
+ // confirm password only needs local constraints, no server constraints
202
+ return this.getConfirmPasswordConstraints();
184
203
  }
185
204
 
186
205
  return _get(_getPrototypeOf(PasswordAttributeModel.prototype), "constraintCollection", this);
@@ -191,7 +210,7 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
191
210
  }, {
192
211
  key: "isConfirmPassword",
193
212
  get: function get() {
194
- return this._isConfirmPassword || false;
213
+ return this._isConfirmPassword;
195
214
  }
196
215
  /**
197
216
  */
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordAttributeModel.js","names":["StringAttributeModel","ConstraintCollection","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","RegexConstraint","PasswordConfirmConstraint","CONFIRM_PASSWORD","PasswordAttributeModel","value","updateLastModification","inputvalue","getContribution","constraints","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraint","isConfirmPassword","add","confirmValue","otherLabel","regexConstraints","length","forEach","layouthint","has","addConstraints","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","constraintCollection","inError","name","contributions","type","Array","isArray"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.isConfirmPassword) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n } else {\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters\n )\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters\n )\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters\n )\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== \"\") {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n }\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n const constraints = new ConstraintCollection();\n constraints.add(this.addConstraints());\n return constraints;\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean {\n return this._isConfirmPassword || false;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,OAAOA,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AAEA,OAAOC,mCAAP,MAAgD,yDAAhD;AACA,OAAOC,sDAAP,MAAmE,4EAAnE;AACA,OAAOC,sCAAP,MAAmD,4DAAnD;AACA,OAAOC,sCAAP,MAAmD,4DAAnD;AACA,OAAOC,eAAP,MAA4B,qCAA5B;AACA,OAAOC,yBAAP,MAAsC,+CAAtC;AAEA,SAASC,gBAAT,QAAiC,6BAAjC;;AAIA;AACA;AACA;IACqBC,sB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAenB;AACF;IACE,eAAmB;MACjB,OAAO,UAAP;IACD;IAED;AACF;AACA;;;;WACE,gBAAOC,KAAP,EAA8C;MAC5C,KAAKC,sBAAL;MACA,KAAKC,UAAL,GAAkBF,KAAlB;MAEA,OAAO,IAAP;IACD;IAED;AACF;;;;SACE,eAA0B;MACxB,OAAO,KAAKG,eAAL,CAAqB,aAArB,EAAoC,EAApC,CAAP;IACD;IAED;AACF;;;;SACE,eAA2C;MACzC,OAAO,KAAKC,WAAL,CAAiBC,0BAAxB;IACD;IAED;AACF;;;;SACE,eAAgD;M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ACnE,KAAK2B,QAAL,GAAgB,KAAKE,oBAAL,CAA0BN,QAA1B,CAAmCvB,KAAnC,CAAhB;MACD;;MACD,KAAK4B,eAAL,iDAA0B,KAAKf,YAA/B,wBAA+Cb,KAA/C;MAEA,OAAO,KAAK2B,QAAZ;IACD;IAED;AACF;;;;WACE,uBAAwC;MACtC,IAAI,KAAKhB,iBAAL,IAA0B,KAAKmB,OAAL,EAA9B,EAA8C;QAC5C,OAAO,IAAP;MACD;;MAED,2BACG,KAAKC,IADR,EACe,KAAK/B,KADpB;IAGD;;;;IA3MD;AACF;IACE,2BAAyBgC,aAAzB,EAAyD;MACvD,IAAMd,UAAU,GAAGc,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAEd,UAAlC;MACA,OACEc,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCC,KAAK,CAACC,OAAN,CAAcjB,UAAd,KAA6B,0BAAAA,UAAU,MAAV,CAAAA,UAAU,EAAU,UAAV,CAF1C;IAID;;;;EAbiD5B,oB;;SAA/BS,sB"}
1
+ {"version":3,"file":"PasswordAttributeModel.js","names":["StringAttributeModel","ConstraintCollection","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","RegexConstraint","PasswordConfirmConstraint","CONFIRM_PASSWORD","PasswordAttributeModel","value","updateLastModification","inputvalue","getContribution","constraints","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraint","isConfirmPassword","getConfirmPasswordConstraints","getStandardPasswordConstraints","add","confirmValue","otherLabel","regexConstraints","length","forEach","layouthint","has","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","constraintCollection","inError","name","contributions","type","Array","isArray"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n if (this.isConfirmPassword) {\n return this.getConfirmPasswordConstraints();\n }\n return this.getStandardPasswordConstraints();\n }\n\n /**\n * Constraints for a confirmation password\n */\n getConfirmPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n return constraints;\n }\n\n /**\n * Constrains for a standard password\n */\n getStandardPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters\n )\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters\n )\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters\n )\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (\n this.layouthint.has(CONFIRM_PASSWORD) &&\n this.isConfirmPassword == null\n ) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n // confirm password only needs local constraints, no server constraints\n return this.getConfirmPasswordConstraints();\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean | null {\n return this._isConfirmPassword;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,OAAOA,oBAAP,MAAiC,wBAAjC;AACA,OAAOC,oBAAP,MAAiC,0CAAjC;AAEA,OAAOC,mCAAP,MAAgD,yDAAhD;AACA,OAAOC,sDAAP,MAAmE,4EAAnE;AACA,OAAOC,sCAAP,MAAmD,4DAAnD;AACA,OAAOC,sCAAP,MAAmD,4DAAnD;AACA,OAAOC,eAAP,MAA4B,qCAA5B;AACA,OAAOC,yBAAP,MAAsC,+CAAtC;AAEA,SAASC,gBAAT,QAAiC,6BAAjC;;AAIA;AACA;AACA;IACqBC,sB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAenB;AACF;IACE,eAAmB;MACjB,OAAO,UAAP;IACD;IAED;AACF;AACA;;;;WACE,gBAAOC,KAAP,EAA8C;MAC5C,KAAKC,sBAAL;MACA,KAAKC,UAAL,GAAkBF,KAAlB;MAEA,OAAO,IAAP;IACD;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AA;;MAC/B;MACA,IAAI,CAAC,KAAK0B,uBAAL,EAAL,EAAqC;QACnC,OAAO,IAAP;MACD;;MAED,IAAI,KAAKC,kBAAL,CAAwB3B,KAAxB,CAAJ,EAAoC;QAClC,KAAK4B,QAAL,GAAgB,IAAhB;MACD,CAFD,MAEO,IAAI,KAAKC,eAAL,mDAA4B,KAAKd,YAAjC,wBAAiDf,KAAjD,CAAJ,EAA8D;QACnE,KAAK4B,QAAL,GAAgB,KAAKE,oBAAL,CAA0BN,QAA1B,CAAmCxB,KAAnC,CAAhB;MACD;;MACD,KAAK6B,eAAL,iDAA0B,KAAKd,YAA/B,wBAA+Cf,KAA/C;MAEA,OAAO,KAAK4B,QAAZ;IACD;IAED;AACF;;;;WACE,uBAAwC;MACtC,IAAI,KAAKjB,iBAAL,IAA0B,KAAKoB,OAAL,EAA9B,EAA8C;QAC5C,OAAO,IAAP;MACD;;MAED,2BACG,KAAKC,IADR,EACe,KAAKhC,KADpB;IAGD;;;;IA5ND;AACF;IACE,2BAAyBiC,aAAzB,EAAyD;MACvD,IAAMb,UAAU,GAAGa,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAEb,UAAlC;MACA,OACEa,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCC,KAAK,CAACC,OAAN,CAAchB,UAAd,KAA6B,0BAAAA,UAAU,MAAV,CAAAA,UAAU,EAAU,UAAV,CAF1C;IAID;;;;EAbiD9B,oB;;SAA/BS,sB"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
@@ -34,6 +34,12 @@ var defaultSettings = {
34
34
  USE_INSTANT_SERVER_VALIDATION: true,
35
35
  // Indicates which locales are enabled
36
36
  ENABLED_LOCALES: ["en", "nl"],
37
+ // Renders the global log in page
38
+ RENDER_GLOBAL_LOGIN_PAGE: false,
39
+ // Renders the global log out page
40
+ RENDER_GLOBAL_LOGOUT_PAGE: false,
41
+ // Renders the login variants as option on the global logout page
42
+ RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,
37
43
  // Render forms in a modal
38
44
  RENDER_FORMS_IN_MODAL: true,
39
45
  // Wait timeout before rendering submit wait icon
@@ -42,6 +42,15 @@ const defaultSettings = {
42
42
  // Indicates which locales are enabled
43
43
  ENABLED_LOCALES: ["en", "nl"],
44
44
 
45
+ // Renders the global log in page
46
+ RENDER_GLOBAL_LOGIN_PAGE: false,
47
+
48
+ // Renders the global log out page
49
+ RENDER_GLOBAL_LOGOUT_PAGE: false,
50
+
51
+ // Renders the login variants as option on the global logout page
52
+ RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,
53
+
45
54
  // Render forms in a modal
46
55
  RENDER_FORMS_IN_MODAL: true,
47
56
 
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,IAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAO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_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,IAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE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a;EAAA,OACxBnB,UAAU,CAACoB,8BAAD,EAAsB,SAAtB,CADc;AAAA,CAAnB"}
@@ -3,12 +3,14 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useNotification = void 0;
6
+ exports.useNotification = exports.useErrorNotification = void 0;
7
7
 
8
8
  var _reactRedux = require("react-redux");
9
9
 
10
10
  var _actions = require("../redux/actions");
11
11
 
12
+ var _constants = require("../constants");
13
+
12
14
  /**
13
15
  */
14
16
  var useNotification = function useNotification() {
@@ -32,6 +34,18 @@ var useNotification = function useNotification() {
32
34
  }
33
35
  };
34
36
  };
37
+ /**
38
+ */
39
+
35
40
 
36
41
  exports.useNotification = useNotification;
42
+
43
+ var useErrorNotification = function useErrorNotification() {
44
+ var dispatch = (0, _reactRedux.useDispatch)();
45
+ return function (message, error) {
46
+ return dispatch((0, _actions.showNotification)(_constants.NOTIFICATION_TYPES.ERROR, message, error));
47
+ };
48
+ };
49
+
50
+ exports.useErrorNotification = useErrorNotification;
37
51
  //# sourceMappingURL=useNotification.js.map
@@ -1,15 +1,25 @@
1
1
  // @flow
2
2
  import { useSelector, useDispatch } from "react-redux";
3
- import { dismissNotification } from "../redux/actions";
3
+ import { dismissNotification, showNotification } from "../redux/actions";
4
4
 
5
5
  import type {
6
6
  DismissNotificationAction,
7
7
  NotificationState,
8
+ ShowNotificationAction,
8
9
  } from "../redux/types";
10
+
11
+ import { NOTIFICATION_TYPES } from "../constants";
12
+
13
+ import type { MessageObject } from "../i18n";
14
+ import type ErrorResponse from "../models/error/ErrorResponse";
9
15
  type NotificationHook = {
10
16
  ...NotificationState,
11
17
  dismiss: () => DismissNotificationAction,
12
18
  };
19
+ type ErrorNotificationHook = (
20
+ message: MessageObject,
21
+ error?: ?ErrorResponse
22
+ ) => ShowNotificationAction;
13
23
 
14
24
  /**
15
25
  */
@@ -27,3 +37,12 @@ export const useNotification = (): NotificationHook => {
27
37
  dismiss: () => dispatch(dismissNotification()),
28
38
  };
29
39
  };
40
+
41
+ /**
42
+ */
43
+ export const useErrorNotification = (): ErrorNotificationHook => {
44
+ const dispatch = useDispatch();
45
+ return (message: MessageObject, error?: ?ErrorResponse) => {
46
+ return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));
47
+ };
48
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"useNotification.js","names":["useNotification","dispatch","useDispatch","useSelector","state","notification","render","messageType","message","error","dismiss","dismissNotification"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n} from \"../redux/types\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AAWA;AACA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;EACrD,IAAMC,QAAQ,GAAG,IAAAC,uBAAA,GAAjB;;EACA,mBAAgD,IAAAC,uBAAA,EAC9C,UAACC,KAAD;IAAA,OAAWA,KAAK,CAACC,YAAjB;EAAA,CAD8C,CAAhD;EAAA,IAAQC,MAAR,gBAAQA,MAAR;EAAA,IAAgBC,WAAhB,gBAAgBA,WAAhB;EAAA,IAA6BC,OAA7B,gBAA6BA,OAA7B;EAAA,IAAsCC,KAAtC,gBAAsCA,KAAtC;;EAIA,OAAO;IACLH,MAAM,EAANA,MADK;IAELC,WAAW,EAAXA,WAFK;IAGLC,OAAO,EAAPA,OAHK;IAILC,KAAK,EAALA,KAJK;IAKLC,OAAO,EAAE;MAAA,OAAMT,QAAQ,CAAC,IAAAU,4BAAA,GAAD,CAAd;IAAA;EALJ,CAAP;AAOD,CAbM"}
1
+ {"version":3,"file":"useNotification.js","names":["useNotification","dispatch","useDispatch","useSelector","state","notification","render","messageType","message","error","dismiss","dismissNotification","useErrorNotification","showNotification","NOTIFICATION_TYPES","ERROR"],"sources":["../../src/hooks/useNotification.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { dismissNotification, showNotification } from \"../redux/actions\";\n\nimport type {\n DismissNotificationAction,\n NotificationState,\n ShowNotificationAction,\n} from \"../redux/types\";\n\nimport { NOTIFICATION_TYPES } from \"../constants\";\n\nimport type { MessageObject } from \"../i18n\";\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\ntype NotificationHook = {\n ...NotificationState,\n dismiss: () => DismissNotificationAction,\n};\ntype ErrorNotificationHook = (\n message: MessageObject,\n error?: ?ErrorResponse\n) => ShowNotificationAction;\n\n/**\n */\nexport const useNotification = (): NotificationHook => {\n const dispatch = useDispatch();\n const { render, messageType, message, error } = useSelector(\n (state) => state.notification\n );\n\n return {\n render,\n messageType,\n message,\n error,\n dismiss: () => dispatch(dismissNotification()),\n };\n};\n\n/**\n */\nexport const useErrorNotification = (): ErrorNotificationHook => {\n const dispatch = useDispatch();\n return (message: MessageObject, error?: ?ErrorResponse) => {\n return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));\n };\n};\n"],"mappings":";;;;;;;AACA;;AACA;;AAQA;;AAaA;AACA;AACO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,GAAwB;EACrD,IAAMC,QAAQ,GAAG,IAAAC,uBAAA,GAAjB;;EACA,mBAAgD,IAAAC,uBAAA,EAC9C,UAACC,KAAD;IAAA,OAAWA,KAAK,CAACC,YAAjB;EAAA,CAD8C,CAAhD;EAAA,IAAQC,MAAR,gBAAQA,MAAR;EAAA,IAAgBC,WAAhB,gBAAgBA,WAAhB;EAAA,IAA6BC,OAA7B,gBAA6BA,OAA7B;EAAA,IAAsCC,KAAtC,gBAAsCA,KAAtC;;EAIA,OAAO;IACLH,MAAM,EAANA,MADK;IAELC,WAAW,EAAXA,WAFK;IAGLC,OAAO,EAAPA,OAHK;IAILC,KAAK,EAALA,KAJK;IAKLC,OAAO,EAAE;MAAA,OAAMT,QAAQ,CAAC,IAAAU,4BAAA,GAAD,CAAd;IAAA;EALJ,CAAP;AAOD,CAbM;AAeP;AACA;;;;;AACO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAuB,GAA6B;EAC/D,IAAMX,QAAQ,GAAG,IAAAC,uBAAA,GAAjB;EACA,OAAO,UAACM,OAAD,EAAyBC,KAAzB,EAAoD;IACzD,OAAOR,QAAQ,CAAC,IAAAY,yBAAA,EAAiBC,6BAAA,CAAmBC,KAApC,EAA2CP,OAA3C,EAAoDC,KAApD,CAAD,CAAf;EACD,CAFD;AAGD,CALM"}
@@ -112,6 +112,15 @@ var ApplicationModel = /*#__PURE__*/function (_ResourceModel) {
112
112
  get: function get() {
113
113
  return this.getContribution("label", "");
114
114
  }
115
+ /**
116
+ * Getting the authentication types of the application
117
+ */
118
+
119
+ }, {
120
+ key: "authenticationTypes",
121
+ get: function get() {
122
+ return this.getContribution("security", []);
123
+ }
115
124
  /**
116
125
  * Getting the tab links
117
126
  */
@@ -5,7 +5,7 @@ import UserServicesModel from "../user/UserServicesModel";
5
5
 
6
6
  import { NotAllowedUriException } from "../../exceptions";
7
7
 
8
- import type { ModularUIModel } from "../types";
8
+ import type { ModularUIModel, AuthenticationType } from "../types";
9
9
  import type { ModularUIResponse } from "../../modularui";
10
10
  import type LinkCollection from "../links/LinkCollection";
11
11
  import type Href from "../href/Href";
@@ -64,6 +64,12 @@ export default class ApplicationModel extends ResourceModel {
64
64
  return this.getContribution("label", "");
65
65
  }
66
66
 
67
+ /**
68
+ * Getting the authentication types of the application
69
+ */
70
+ get authenticationTypes(): Array<AuthenticationType> {
71
+ return this.getContribution("security", []);
72
+ }
67
73
  /**
68
74
  * Getting the tab links
69
75
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationModel.js","names":["ApplicationModel","userService","links","getLinkByKey","href","path","NotAllowedUriException","models","userServiceModel","model","type","userServices","getContribution","getLinksByGroup","LinkModel","create","_userServices","UserServicesModel","isLoggedIn","userLink","data","contributions","resourcetype","ResourceModel"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\"\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\"\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\"modelcatalog\", \"/modelcatalog\", \"Model catalog\");\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices != null && this.userServices.userLink != null) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;;;;;AAOA;AACA;AACA;IACqBA,gB;;;;;;;;;;;;;;;;;;;;;;;;IAGnB;AACF;AACA;IACE,eAAmB;MACjB,OAAO,aAAP;IACD;IAED;AACF;;;;;IAQE;AACF;IACE,qCAA8C;MAC5C,IAAMC,WAAW,GAAG,KAAKC,KAAL,CAAWC,YAAX,CAAwB,cAAxB,CAApB;;MACA,IAAIF,WAAW,IAAIA,WAAW,CAACG,IAAZ,CAAiBC,IAAjB,KAA0B,QAA7C,EAAuD;QACrD,MAAM,IAAIC,kCAAJ,CACJ,kIADI,CAAN;MAGD;;MAED,OAAOL,WAAW,GAAG,CAACA,WAAD,CAAH,GAAmB,EAArC;IACD;IAED;AACF;;;;WACE,wBAAeM,MAAf,EAA8C;MAC5C,IAAMC,gBAAgB,GAAG,mBAAAD,MAAM,MAAN,CAAAA,MAAM,EAC7B,UAACE,KAAD;QAAA,OAAWA,KAAK,CAACC,IAAN,KAAe,cAA1B;MAAA,CAD6B,CAA/B;;MAIA,IAAIF,gBAAJ,EAAsB;QACpB,KAAKG,YAAL,GAAoBH,gBAApB;MACD;IACF;IAED;AACF;AACA;;;;SACE,eAAoB;MAClB,OAAO,KAAKI,eAAL,CAAqB,OAArB,EAA8B,EAA9B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAA2B;MACzB,OAAO,KAAKV,KAAL,CAAWW,eAAX,CAA2B,KAA3B,CAAP;IACD;IAED;AACF;AACA;;;;SACE,eAA8B;MAC5B,OAAOC,kBAAA,CAAUC,MAAV,CAAiB,cAAjB,EAAiC,eAAjC,EAAkD,eAAlD,CAAP;IACD;IAED;AACF;AACA;;;;;IAKE;AACF;AACA;IACE,eAAuC;MACrC,OAAO,KAAKC,aAAL,GAAqB,KAAKA,aAA1B,GAA0C,IAAjD;IACD;IAED;AACF;AACA;;SAbE,aAAiBP,KAAjB,EAAyC;MACvC,KAAKO,aAAL,GAAqBP,KAAK,YAAYQ,0BAAjB,GAAqCR,KAArC,GAA6C,IAAlE;IACD;;;SAYD,eAA0B;MAAA;;MACxB,sDAAO,KAAKE,YAAZ,uDAAO,mBAAmBO,UAA1B,yEAAwC,KAAxC;IACD;IAED;AACF;AACA;AACA;;;;SACE,eAA4B;MAC1B,IAAI,KAAKP,YAAL,IAAqB,IAArB,IAA6B,KAAKA,YAAL,CAAkBQ,QAAlB,IAA8B,IAA/D,EAAqE;QACnE,OAAO,KAAKR,YAAL,CAAkBQ,QAAlB,CAA2Bf,IAAlC;MACD;;MAED,OAAO,IAAP;IACD;;;WApFD,2BAAyBgB,IAAzB,EAA2D;MACzD,OACEA,IAAI,CAACC,aAAL,CAAmBC,YAAnB,IACAF,IAAI,CAACC,aAAL,CAAmBC,YAAnB,KAAoC,aAFtC;IAID;;;EAjB2CC,uB"}
1
+ {"version":3,"file":"ApplicationModel.js","names":["ApplicationModel","userService","links","getLinkByKey","href","path","NotAllowedUriException","models","userServiceModel","model","type","userServices","getContribution","getLinksByGroup","LinkModel","create","_userServices","UserServicesModel","isLoggedIn","userLink","data","contributions","resourcetype","ResourceModel"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\"\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\"\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n return this.getContribution(\"security\", []);\n }\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\"modelcatalog\", \"/modelcatalog\", \"Model catalog\");\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices != null && this.userServices.userLink != null) {\n return this.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rC,OAAO,KAAKC,aAAL,GAAqB,KAAKA,aAA1B,GAA0C,IAAjD;IACD;IAED;AACF;AACA;;SAbE,aAAiBP,KAAjB,EAAyC;MACvC,KAAKO,aAAL,GAAqBP,KAAK,YAAYQ,0BAAjB,GAAqCR,KAArC,GAA6C,IAAlE;IACD;;;SAYD,eAA0B;MAAA;;MACxB,sDAAO,KAAKE,YAAZ,uDAAO,mBAAmBO,UAA1B,yEAAwC,KAAxC;IACD;IAED;AACF;AACA;AACA;;;;SACE,eAA4B;MAC1B,IAAI,KAAKP,YAAL,IAAqB,IAArB,IAA6B,KAAKA,YAAL,CAAkBQ,QAAlB,IAA8B,IAA/D,EAAqE;QACnE,OAAO,KAAKR,YAAL,CAAkBQ,QAAlB,CAA2Bf,IAAlC;MACD;;MAED,OAAO,IAAP;IACD;;;WA1FD,2BAAyBgB,IAAzB,EAA2D;MACzD,OACEA,IAAI,CAACC,aAAL,CAAmBC,YAAnB,IACAF,IAAI,CAACC,aAAL,CAAmBC,YAAnB,KAAoC,aAFtC;IAID;;;EAjB2CC,uB"}
@@ -159,36 +159,56 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
159
159
  }, {
160
160
  key: "addConstraints",
161
161
  value: function addConstraints() {
162
+ if (this.isConfirmPassword) {
163
+ return this.getConfirmPasswordConstraints();
164
+ }
165
+
166
+ return this.getStandardPasswordConstraints();
167
+ }
168
+ /**
169
+ * Constraints for a confirmation password
170
+ */
171
+
172
+ }, {
173
+ key: "getConfirmPasswordConstraints",
174
+ value: function getConfirmPasswordConstraints() {
162
175
  var constraints = new _ConstraintCollection.default();
176
+ constraints.add(new _PasswordConfirmConstraint.default(this.confirmValue, this.otherLabel));
177
+ return constraints;
178
+ }
179
+ /**
180
+ * Constrains for a standard password
181
+ */
163
182
 
164
- if (this.isConfirmPassword) {
183
+ }, {
184
+ key: "getStandardPasswordConstraints",
185
+ value: function getStandardPasswordConstraints() {
186
+ var constraints = new _ConstraintCollection.default();
187
+
188
+ if (this.upperAndLowerCaseMandatory) {
189
+ constraints.add(new _PasswordLowerAndUpperCaseConstraint.default());
190
+ }
191
+
192
+ if (this.maxSequenceOfIdenticalCharacters) {
193
+ constraints.add(new _PasswordThreeConsecutiveCharactersNotAllowedConstraint.default(this.maxSequenceOfIdenticalCharacters));
194
+ }
195
+
196
+ if (this.minNumberOfNumericCharacters) {
197
+ constraints.add(new _PasswordMinNumericCharactersConstraint.default(this.minNumberOfNumericCharacters));
198
+ }
199
+
200
+ if (this.minNumberOfSpecialCharacters) {
201
+ constraints.add(new _PasswordMinSpecialCharactersConstraint.default(this.minNumberOfSpecialCharacters));
202
+ }
203
+
204
+ if (this.regexConstraints && this.regexConstraints.length > 0) {
205
+ this.regexConstraints.forEach(function (regexConstraint) {
206
+ constraints.add(new _RegexConstraint.default(regexConstraint));
207
+ });
208
+ }
209
+
210
+ if (this.layouthint.has(_LayoutHints.CONFIRM_PASSWORD) && this.isConfirmPassword == null) {
165
211
  constraints.add(new _PasswordConfirmConstraint.default(this.confirmValue, this.otherLabel));
166
- } else {
167
- if (this.upperAndLowerCaseMandatory) {
168
- constraints.add(new _PasswordLowerAndUpperCaseConstraint.default());
169
- }
170
-
171
- if (this.maxSequenceOfIdenticalCharacters) {
172
- constraints.add(new _PasswordThreeConsecutiveCharactersNotAllowedConstraint.default(this.maxSequenceOfIdenticalCharacters));
173
- }
174
-
175
- if (this.minNumberOfNumericCharacters) {
176
- constraints.add(new _PasswordMinNumericCharactersConstraint.default(this.minNumberOfNumericCharacters));
177
- }
178
-
179
- if (this.minNumberOfSpecialCharacters) {
180
- constraints.add(new _PasswordMinSpecialCharactersConstraint.default(this.minNumberOfSpecialCharacters));
181
- }
182
-
183
- if (this.regexConstraints && this.regexConstraints.length > 0) {
184
- this.regexConstraints.forEach(function (regexConstraint) {
185
- constraints.add(new _RegexConstraint.default(regexConstraint));
186
- });
187
- }
188
-
189
- if (this.layouthint.has(_LayoutHints.CONFIRM_PASSWORD) && this.confirmValue !== "") {
190
- constraints.add(new _PasswordConfirmConstraint.default(this.confirmValue, this.otherLabel));
191
- }
192
212
  }
193
213
 
194
214
  return constraints;
@@ -201,9 +221,8 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
201
221
  key: "constraintCollection",
202
222
  get: function get() {
203
223
  if (this.isConfirmPassword) {
204
- var constraints = new _ConstraintCollection.default();
205
- constraints.add(this.addConstraints());
206
- return constraints;
224
+ // confirm password only needs local constraints, no server constraints
225
+ return this.getConfirmPasswordConstraints();
207
226
  }
208
227
 
209
228
  return (0, _get2.default)((0, _getPrototypeOf2.default)(PasswordAttributeModel.prototype), "constraintCollection", this);
@@ -214,7 +233,7 @@ var PasswordAttributeModel = /*#__PURE__*/function (_StringAttributeModel) {
214
233
  }, {
215
234
  key: "isConfirmPassword",
216
235
  get: function get() {
217
- return this._isConfirmPassword || false;
236
+ return this._isConfirmPassword;
218
237
  }
219
238
  /**
220
239
  */
@@ -93,52 +93,70 @@ export default class PasswordAttributeModel extends StringAttributeModel {
93
93
  * Add password constraints
94
94
  */
95
95
  addConstraints(): ConstraintCollection {
96
+ if (this.isConfirmPassword) {
97
+ return this.getConfirmPasswordConstraints();
98
+ }
99
+ return this.getStandardPasswordConstraints();
100
+ }
101
+
102
+ /**
103
+ * Constraints for a confirmation password
104
+ */
105
+ getConfirmPasswordConstraints(): ConstraintCollection {
96
106
  const constraints = new ConstraintCollection();
107
+ constraints.add(
108
+ new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
109
+ );
110
+ return constraints;
111
+ }
97
112
 
98
- if (this.isConfirmPassword) {
113
+ /**
114
+ * Constrains for a standard password
115
+ */
116
+ getStandardPasswordConstraints(): ConstraintCollection {
117
+ const constraints = new ConstraintCollection();
118
+
119
+ if (this.upperAndLowerCaseMandatory) {
120
+ constraints.add(new PasswordLowerAndUpperCaseConstraint());
121
+ }
122
+
123
+ if (this.maxSequenceOfIdenticalCharacters) {
124
+ constraints.add(
125
+ new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
126
+ this.maxSequenceOfIdenticalCharacters
127
+ )
128
+ );
129
+ }
130
+
131
+ if (this.minNumberOfNumericCharacters) {
132
+ constraints.add(
133
+ new PasswordMinNumericCharactersConstraint(
134
+ this.minNumberOfNumericCharacters
135
+ )
136
+ );
137
+ }
138
+
139
+ if (this.minNumberOfSpecialCharacters) {
140
+ constraints.add(
141
+ new PasswordMinSpecialCharactersConstraint(
142
+ this.minNumberOfSpecialCharacters
143
+ )
144
+ );
145
+ }
146
+
147
+ if (this.regexConstraints && this.regexConstraints.length > 0) {
148
+ this.regexConstraints.forEach((regexConstraint) => {
149
+ constraints.add(new RegexConstraint(regexConstraint));
150
+ });
151
+ }
152
+
153
+ if (
154
+ this.layouthint.has(CONFIRM_PASSWORD) &&
155
+ this.isConfirmPassword == null
156
+ ) {
99
157
  constraints.add(
100
158
  new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
101
159
  );
102
- } else {
103
- if (this.upperAndLowerCaseMandatory) {
104
- constraints.add(new PasswordLowerAndUpperCaseConstraint());
105
- }
106
-
107
- if (this.maxSequenceOfIdenticalCharacters) {
108
- constraints.add(
109
- new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
110
- this.maxSequenceOfIdenticalCharacters
111
- )
112
- );
113
- }
114
-
115
- if (this.minNumberOfNumericCharacters) {
116
- constraints.add(
117
- new PasswordMinNumericCharactersConstraint(
118
- this.minNumberOfNumericCharacters
119
- )
120
- );
121
- }
122
-
123
- if (this.minNumberOfSpecialCharacters) {
124
- constraints.add(
125
- new PasswordMinSpecialCharactersConstraint(
126
- this.minNumberOfSpecialCharacters
127
- )
128
- );
129
- }
130
-
131
- if (this.regexConstraints && this.regexConstraints.length > 0) {
132
- this.regexConstraints.forEach((regexConstraint) => {
133
- constraints.add(new RegexConstraint(regexConstraint));
134
- });
135
- }
136
-
137
- if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== "") {
138
- constraints.add(
139
- new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
140
- );
141
- }
142
160
  }
143
161
 
144
162
  return constraints;
@@ -149,9 +167,8 @@ export default class PasswordAttributeModel extends StringAttributeModel {
149
167
  */
150
168
  get constraintCollection(): ConstraintCollection {
151
169
  if (this.isConfirmPassword) {
152
- const constraints = new ConstraintCollection();
153
- constraints.add(this.addConstraints());
154
- return constraints;
170
+ // confirm password only needs local constraints, no server constraints
171
+ return this.getConfirmPasswordConstraints();
155
172
  }
156
173
 
157
174
  return super.constraintCollection;
@@ -159,8 +176,8 @@ export default class PasswordAttributeModel extends StringAttributeModel {
159
176
 
160
177
  /**
161
178
  */
162
- get isConfirmPassword(): boolean {
163
- return this._isConfirmPassword || false;
179
+ get isConfirmPassword(): boolean | null {
180
+ return this._isConfirmPassword;
164
181
  }
165
182
 
166
183
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordAttributeModel.js","names":["PasswordAttributeModel","value","updateLastModification","inputvalue","getContribution","constraints","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraint","ConstraintCollection","isConfirmPassword","add","PasswordConfirmConstraint","confirmValue","otherLabel","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","regexConstraints","length","forEach","RegexConstraint","layouthint","has","CONFIRM_PASSWORD","addConstraints","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","constraintCollection","inError","name","contributions","type","Array","isArray","StringAttributeModel"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.isConfirmPassword) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n } else {\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters\n )\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters\n )\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters\n )\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== \"\") {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n }\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n const constraints = new ConstraintCollection();\n constraints.add(this.addConstraints());\n return constraints;\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean {\n return this._isConfirmPassword || false;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAIA;AACA;AACA;IACqBA,sB;;;;;;;;;;;;;;;;;;;;;;;;;;IAenB;AACF;IACE,eAAmB;MACjB,OAAO,UAAP;IACD;IAED;AACF;AACA;;;;WACE,gBAAOC,KAAP,EAA8C;MAC5C,KAAKC,sBAAL;MACA,KAAKC,UAAL,GAAkBF,KAAlB;MAEA,OAAO,IAAP;IACD;IAED;AACF;;;;SACE,eAA0B;MACxB,OAAO,KAAKG,eAAL,CAAqB,aAArB,EAAoC,EAApC,CAAP;IACD;IAED;AACF;;;;SACE,eAA2C;MACzC,OAAO,KAAKC,WAAL,CAAiBC,0BAAxB;IACD;IAED;AACF;;;;SACE,eAAgD;MAC9C,OAAO,KAAKD,WAAL,CAAiBE,gCAAxB;IACD;IAED;AACF;;;;SACE,eAA+C;MAC7C,OAAO,KAAKF,WAAL,CAAiBG,+BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKH,WAAL,CAAiBI,4BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKJ,WAAL,CAAiBK,4BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKL,WAAL,CAAiBM,eAAxB;IACD;IAED;AACF;AACA;;;;WACE,0BAAuC;MACrC,IAAMN,WAAW,GAAG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f,UAAU,GAAGe,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAEf,UAAlC;MACA,OACEe,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCC,KAAK,CAACC,OAAN,CAAclB,UAAd,KAA6B,uBAAAA,UAAU,MAAV,CAAAA,UAAU,EAAU,UAAV,CAF1C;IAID;;;EAbiDmB,8B"}
1
+ {"version":3,"file":"PasswordAttributeModel.js","names":["PasswordAttributeModel","value","updateLastModification","inputvalue","getContribution","constraints","upperAndLowerCaseMandatory","maxSequenceOfIdenticalCharacters","maxSequenceOfUsernameCharacters","minNumberOfNumericCharacters","minNumberOfSpecialCharacters","regexConstraint","isConfirmPassword","getConfirmPasswordConstraints","getStandardPasswordConstraints","ConstraintCollection","add","PasswordConfirmConstraint","confirmValue","otherLabel","PasswordLowerAndUpperCaseConstraint","PasswordThreeConsecutiveCharactersNotAllowedConstraint","PasswordMinNumericCharactersConstraint","PasswordMinSpecialCharactersConstraint","regexConstraints","length","forEach","RegexConstraint","layouthint","has","CONFIRM_PASSWORD","_isConfirmPassword","_confirmValue","validate","_otherLabel","useClientsideValidation","isOptionalAndEmpty","_isValid","_validatedValue","constraintCollection","inError","name","contributions","type","Array","isArray","StringAttributeModel"],"sources":["../../../src/models/attributes/PasswordAttributeModel.js"],"sourcesContent":["// @flow\nimport StringAttributeModel from \"./StringAttributeModel\";\nimport ConstraintCollection from \"./input-constraints/ConstraintCollection\";\n\nimport PasswordLowerAndUpperCaseConstraint from \"./input-constraints/PasswordLowerAndUpperCaseConstraint\";\nimport PasswordThreeConsecutiveCharactersNotAllowedConstraint from \"./input-constraints/PasswordThreeConsecutiveCharactersNotAllowedConstraint\";\nimport PasswordMinNumericCharactersConstraint from \"./input-constraints/PasswordMinNumericCharactersConstraint\";\nimport PasswordMinSpecialCharactersConstraint from \"./input-constraints/PasswordMinSpecialCharactersConstraint\";\nimport RegexConstraint from \"./input-constraints/RegexConstraint\";\nimport PasswordConfirmConstraint from \"./input-constraints/PasswordConfirmConstraint\";\n\nimport { CONFIRM_PASSWORD } from \"../../constants/LayoutHints\";\n\nimport type { RegexObject } from \"./input-constraints/RegexConstraint\";\n\n/**\n * Password attribute\n */\nexport default class PasswordAttributeModel extends StringAttributeModel {\n _confirmValue: string;\n _isConfirmPassword: boolean;\n _otherLabel: string;\n\n /**\n */\n static isApplicableModel(contributions: Object): boolean {\n const layouthint = contributions?.layouthint;\n return (\n contributions.type === \"password\" ||\n (Array.isArray(layouthint) && layouthint.includes(\"password\"))\n );\n }\n\n /**\n */\n get type(): string {\n return \"password\";\n }\n\n /**\n * Update the attribute by name and value\n */\n update(value: string): PasswordAttributeModel {\n this.updateLastModification();\n this.inputvalue = value;\n\n return this;\n }\n\n /**\n */\n get constraints(): Object {\n return this.getContribution(\"constraints\", {});\n }\n\n /**\n */\n get upperAndLowerCaseMandatory(): ?boolean {\n return this.constraints.upperAndLowerCaseMandatory;\n }\n\n /**\n */\n get maxSequenceOfIdenticalCharacters(): ?number {\n return this.constraints.maxSequenceOfIdenticalCharacters;\n }\n\n /**\n */\n get maxSequenceOfUsernameCharacters(): ?number {\n return this.constraints.maxSequenceOfUsernameCharacters;\n }\n\n /**\n */\n get minNumberOfNumericCharacters(): ?number {\n return this.constraints.minNumberOfNumericCharacters;\n }\n\n /**\n */\n get minNumberOfSpecialCharacters(): ?number {\n return this.constraints.minNumberOfSpecialCharacters;\n }\n\n /**\n */\n get regexConstraints(): ?Array<RegexObject> {\n return this.constraints.regexConstraint;\n }\n\n /**\n * Add password constraints\n */\n addConstraints(): ConstraintCollection {\n if (this.isConfirmPassword) {\n return this.getConfirmPasswordConstraints();\n }\n return this.getStandardPasswordConstraints();\n }\n\n /**\n * Constraints for a confirmation password\n */\n getConfirmPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n return constraints;\n }\n\n /**\n * Constrains for a standard password\n */\n getStandardPasswordConstraints(): ConstraintCollection {\n const constraints = new ConstraintCollection();\n\n if (this.upperAndLowerCaseMandatory) {\n constraints.add(new PasswordLowerAndUpperCaseConstraint());\n }\n\n if (this.maxSequenceOfIdenticalCharacters) {\n constraints.add(\n new PasswordThreeConsecutiveCharactersNotAllowedConstraint(\n this.maxSequenceOfIdenticalCharacters\n )\n );\n }\n\n if (this.minNumberOfNumericCharacters) {\n constraints.add(\n new PasswordMinNumericCharactersConstraint(\n this.minNumberOfNumericCharacters\n )\n );\n }\n\n if (this.minNumberOfSpecialCharacters) {\n constraints.add(\n new PasswordMinSpecialCharactersConstraint(\n this.minNumberOfSpecialCharacters\n )\n );\n }\n\n if (this.regexConstraints && this.regexConstraints.length > 0) {\n this.regexConstraints.forEach((regexConstraint) => {\n constraints.add(new RegexConstraint(regexConstraint));\n });\n }\n\n if (\n this.layouthint.has(CONFIRM_PASSWORD) &&\n this.isConfirmPassword == null\n ) {\n constraints.add(\n new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)\n );\n }\n\n return constraints;\n }\n\n /**\n * Retrieve applicable constraint for this attribute\n */\n get constraintCollection(): ConstraintCollection {\n if (this.isConfirmPassword) {\n // confirm password only needs local constraints, no server constraints\n return this.getConfirmPasswordConstraints();\n }\n\n return super.constraintCollection;\n }\n\n /**\n */\n get isConfirmPassword(): boolean | null {\n return this._isConfirmPassword;\n }\n\n /**\n */\n set isConfirmPassword(isConfirmPassword: boolean) {\n this._isConfirmPassword = isConfirmPassword;\n }\n\n /**\n */\n get confirmValue(): string {\n return this._confirmValue || \"\";\n }\n\n /**\n */\n set confirmValue(confirmValue: string) {\n this._confirmValue = confirmValue;\n\n this.validate(this.inputvalue);\n }\n\n /**\n */\n get otherLabel(): string {\n return this._otherLabel;\n }\n\n /**\n */\n set otherLabel(otherLabel: string) {\n this._otherLabel = otherLabel;\n }\n\n /**\n * Validate input\n */\n validate(value: string): boolean {\n // when client side validation is disabled, this attribute is always valid\n if (!this.useClientsideValidation()) {\n return true;\n }\n\n if (this.isOptionalAndEmpty(value)) {\n this._isValid = true;\n } else if (this._validatedValue !== `${this.confirmValue}-${value}`) {\n this._isValid = this.constraintCollection.validate(value);\n }\n this._validatedValue = `${this.confirmValue}-${value}`;\n\n return this._isValid;\n }\n\n /**\n */\n getFormData(): { [string]: any } | null {\n if (this.isConfirmPassword || this.inError()) {\n return null;\n }\n\n return {\n [this.name]: this.value,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;AAIA;AACA;AACA;IACqBA,sB;;;;;;;;;;;;;;;;;;;;;;;;;;IAenB;AACF;IACE,eAAmB;MACjB,OAAO,UAAP;IACD;IAED;AACF;AACA;;;;WACE,gBAAOC,KAAP,EAA8C;MAC5C,KAAKC,sBAAL;MACA,KAAKC,UAAL,GAAkBF,KAAlB;MAEA,OAAO,IAAP;IACD;IAED;AACF;;;;SACE,eAA0B;MACxB,OAAO,KAAKG,eAAL,CAAqB,aAArB,EAAoC,EAApC,CAAP;IACD;IAED;AACF;;;;SACE,eAA2C;MACzC,OAAO,KAAKC,WAAL,CAAiBC,0BAAxB;IACD;IAED;AACF;;;;SACE,eAAgD;MAC9C,OAAO,KAAKD,WAAL,CAAiBE,gCAAxB;IACD;IAED;AACF;;;;SACE,eAA+C;MAC7C,OAAO,KAAKF,WAAL,CAAiBG,+BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKH,WAAL,CAAiBI,4BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKJ,WAAL,CAAiBK,4BAAxB;IACD;IAED;AACF;;;;SACE,eAA4C;MAC1C,OAAO,KAAKL,WAAL,CAAiBM,eAAxB;IACD;IAED;AACF;AACA;;;;WACE,0BAAuC;MACrC,IAAI,KAAKC,iBAAT,EAA4B;QAC1B,OAAO,KAAKC,6BAAL,EAAP;MACD;;MACD,OAAO,KAAKC,8BAAL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AAMd,UAAU,GAAGc,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAEd,UAAlC;MACA,OACEc,aAAa,CAACC,IAAd,KAAuB,UAAvB,IACCC,KAAK,CAACC,OAAN,CAAcjB,UAAd,KAA6B,uBAAAA,UAAU,MAAV,CAAAA,UAAU,EAAU,UAAV,CAF1C;IAID;;;EAbiDkB,8B"}
@@ -153,6 +153,13 @@ export interface IModelWithChildModels {
153
153
  setChildModels(models: Array<ModularUIModel>): void;
154
154
  }
155
155
 
156
+ export type AuthenticationType = {
157
+ name: string,
158
+ authentication: string,
159
+ redirectUri: string,
160
+ isPrimary: boolean,
161
+ };
162
+
156
163
  export type FileEntryType = {
157
164
  name: string,
158
165
  size?: number,
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/models/types.js"],"sourcesContent":["// @flow\nimport type ApplicationModel from \"./application/ApplicationModel\";\nimport type BooleanAttributeModel from \"./attributes/BooleanAttributeModel\";\nimport type CaptchaAttributeModel from \"./attributes/CaptchaAttributeModel\";\nimport type ChoiceAttributeModel from \"./attributes/ChoiceAttributeModel\";\nimport type CompositeAttributeModel from \"./attributes/CompositeAttributeModel\";\nimport type DatetimeAttributeModel from \"./attributes/DatetimeAttributeModel\";\nimport type HelptextAttributeModel from \"./attributes/HelptextAttributeModel\";\nimport type LabelAttributeModel from \"./attributes/LabelAttributeModel\";\nimport type MemoAttributeModel from \"./attributes/MemoAttributeModel\";\nimport type MoneyAttributeModel from \"./attributes/MoneyAttributeModel\";\nimport type NumberAttributeModel from \"./attributes/NumberAttributeModel\";\nimport type PasswordAttributeModel from \"./attributes/PasswordAttributeModel\";\nimport type StringAttributeModel from \"./attributes/StringAttributeModel\";\nimport type UploadAttributeModel from \"./attributes/UploadAttributeModel\";\nimport type XMLAttributeModel from \"./attributes/XMLAttributeModel\";\nimport type CaseViewModel from \"./caseview/CaseViewModel\";\nimport type BusinessScenarioModel from \"./concepts/BusinessScenarioModel\";\nimport type ConceptDetailModel from \"./concepts/ConceptDetailModel\";\nimport type ConceptIndexModel from \"./concepts/ConceptIndexModel\";\nimport type ConceptTypeDetailModel from \"./concepts/ConceptTypeDetailModel\";\nimport type ContentIndexModel from \"./content/ContentIndexModel\";\nimport type ContentModel from \"./content/ContentModel\";\nimport type SectionModel from \"./content/SectionModel\";\nimport type ContentTOCModel from \"./content/ContentTOCModel\";\nimport type ContentTypeModel from \"./content/ContentTypeModel\";\nimport type DetailModel from \"./detail/DetailModel\";\nimport type AssignmentFilterModel from \"./filters/AssignmentFilterModel\";\nimport type FilterModel from \"./filters/FilterModel\";\nimport type RangeFilterModel from \"./filters/RangeFilterModel\";\nimport type ConceptIndexFilterModel from \"./filters/ConceptIndexFilterModel\";\nimport type FormModel from \"./form/FormModel\";\nimport type ListDetailModel from \"./list/ListDetailModel\";\nimport type ListModel from \"./list/ListModel\";\nimport type ModelCatalogModel from \"./modelcatalog/ModelCatalogModel\";\nimport type GroupingPanelModel from \"./panels/GroupingPanelModel\";\nimport type CaseSearchModel from \"./search/CaseSearchModel\";\nimport type TabModel from \"./tab/TabModel\";\nimport type TaskGroupModel from \"./taskgroup/TaskGroupModel\";\nimport type UserModel from \"./user/UserModel\";\nimport type UserServicesModel from \"./user/UserServicesModel\";\nimport type LinkModel from \"./links/LinkModel\";\nimport type LookupOptionsModel from \"./lookup/LookupOptionsModel\";\nimport type BaseFilterModel from \"./filters/BaseFilterModel\";\nimport type AttributeCollection from \"./attributes/AttributeCollection\";\nimport type AttributeModel from \"./attributes/AttributeModel\";\nimport type LayoutHintCollection from \"./layouthint/LayoutHintCollection\";\n\nexport type ModularUIModel =\n | ApplicationModel\n | CaseSearchModel\n | CaseViewModel\n | ListDetailModel\n | DetailModel\n | FormModel\n | GroupingPanelModel\n | ListModel\n | TabModel\n | TaskGroupModel\n | UserModel\n | UserServicesModel\n | ModelCatalogModel\n | ConceptIndexModel\n | ConceptDetailModel\n | BusinessScenarioModel\n | ConceptTypeDetailModel\n | ContentIndexModel\n | ContentTOCModel\n | ContentModel\n | ContentTypeModel\n | LookupOptionsModel;\n\nexport type AttributeType =\n | BooleanAttributeModel\n | CaptchaAttributeModel\n | ChoiceAttributeModel\n | DatetimeAttributeModel\n | HelptextAttributeModel\n | LabelAttributeModel\n | MemoAttributeModel\n | MoneyAttributeModel\n | NumberAttributeModel\n | PasswordAttributeModel\n | CompositeAttributeModel\n | StringAttributeModel\n | UploadAttributeModel\n | XMLAttributeModel;\n\nexport type RangeChildAttributeType =\n | NumberAttributeModel\n | DatetimeAttributeModel;\n\nexport type FilterType =\n | BaseFilterModel\n | FilterModel\n | AssignmentFilterModel\n | RangeFilterModel\n | ConceptIndexFilterModel;\n\nexport type FormErrorAnchor = {\n id: string,\n properties?: {\n [propertyName: string]: string | number,\n },\n anchor?: {\n objectid: string,\n elementid?: string,\n _links?: Object,\n index?: number,\n \"index-identifier\"?: string,\n },\n message: string,\n param?: {\n name: string,\n },\n};\n\nexport type labelsJSON = {|\n _id: string,\n label: string,\n value: string,\n|};\n\nexport type propertyJSON = {|\n _id: string,\n type: string,\n mandatory: string,\n label: string,\n value: string,\n|};\n\nexport type textfragmentJSON = {|\n label: string,\n text: string,\n type: string,\n|};\n\nexport interface IConstraintModel {\n +id: string;\n +defaultMessage: string;\n +parameters: Object;\n +isMandatoryConstraint: boolean;\n validate(value: any): boolean;\n hasValidation(): boolean;\n}\n\nexport interface ILayoutHintRule {\n process(attribute: AttributeModel, attributes: AttributeCollection): void;\n}\n\nexport interface IModelWithChildModels {\n getInitialChildModelLinks(): Array<LinkModel>;\n setChildModels(models: Array<ModularUIModel>): void;\n}\n\nexport type AuthenticationType = {\n name: string,\n authentication: string,\n redirectUri: string,\n isPrimary: boolean,\n};\n\nexport type FileEntryType = {\n name: string,\n size?: number,\n progress: number,\n error?: string,\n token?: string,\n};\n\nexport type FilesType = {\n [filename: string]: FileEntryType,\n};\n\nexport type FiletypeConstraintsType = Array<{|\n extensions: Array<string>,\n mimeTypes: Array<string>,\n|}>;\n\nexport type FilesizeConstraintsType = {\n fileSize: ?number,\n maxTotalFileSize: ?number,\n isMaxTotal: boolean,\n};\n\nexport type PropertyData = { type: string, label: string, value: string };\nexport type TextFragmentData = {\n type: string,\n label: string,\n text: string | { id?: string, message: string, properties?: Object },\n};\nexport type SectionData = {\n id: string,\n type: string,\n label?: string,\n number?: string,\n body: string | { id?: string, message: string, properties?: Object },\n _links: { self: { href: string } },\n childSections: Array<SectionData>,\n subSections: Array<SectionData>,\n};\n\nexport type PropertyElement = {\n propertyElement: {\n label: string,\n layouthint: Array<string>,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElement = {\n textFragmentElement: {\n label: string,\n layouthint: Array<string>,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElement = {\n contentElement: {\n label: string,\n layouthint: Array<string>,\n sections: Array<SectionData>,\n },\n};\n\nexport type PropertyElementMapped = {\n propertyElement: {\n label: string,\n layouthint: LayoutHintCollection,\n properties: Array<PropertyData>,\n },\n};\nexport type TextFragmentElementMapped = {\n textFragmentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n textfragments: Array<TextFragmentData>,\n },\n};\nexport type ContentElementMapped = {\n contentElement: {\n label: string,\n layouthint: LayoutHintCollection,\n sections: Array<SectionModel>,\n },\n};\n\nexport type ContentAll = Array<\n PropertyElementMapped | TextFragmentElementMapped | ContentElementMapped\n>;\n\nexport type ContentData = {\n header: {\n label?: string,\n description?: { id?: string, message: string, properties?: Object },\n },\n label?: string,\n elements: Array<PropertyElement | TextFragmentElement | ContentElement>,\n};\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.18.9",
3
+ "version": "1.19.3",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -72,10 +72,10 @@
72
72
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
73
73
  "react-helmet-async": "^1.0.0",
74
74
  "react-redux": "^7.0.0 || ^8.0.0",
75
- "react-router": "^5.2.0",
75
+ "react-router": "^5.0.0",
76
76
  "redux": "^4.0.0",
77
- "redux-thunk": "^2.3.0",
78
- "styled-components": "^5.2.0"
77
+ "redux-thunk": "^2.0.0",
78
+ "styled-components": "^5.0.0"
79
79
  },
80
80
  "dependencies": {
81
81
  "@babel/runtime-corejs3": "^7.18.3",
@@ -135,20 +135,20 @@
135
135
  "jest-sonar-reporter": "^2.0.0",
136
136
  "jscodeshift": "^0.13.1",
137
137
  "lint-staged": "^13.0.1",
138
- "polished": "^4.2.2",
139
- "prettier": "^2.7.0",
140
- "react": "^18.1.0",
141
- "react-dom": "^18.1.0",
142
- "react-helmet-async": "^1.3.0",
143
- "react-redux": "^8.0.2",
144
- "react-router": "^5.2.0",
138
+ "polished": "^4.0.0",
139
+ "prettier": "^2.7.1",
140
+ "react": "^18.0.0",
141
+ "react-dom": "^18.0.0",
142
+ "react-helmet-async": "^1.0.0",
143
+ "react-redux": "^8.0.0",
144
+ "react-router": "^5.0.0",
145
145
  "react-test-renderer": "^18.1.0",
146
- "redux": "^4.2.0",
146
+ "redux": "^4.0.0",
147
147
  "redux-mock-store": "^1.5.4",
148
- "redux-thunk": "^2.4.1",
148
+ "redux-thunk": "^2.0.0",
149
149
  "rimraf": "^3.0.2",
150
150
  "standard-version": "^9.5.0",
151
- "styled-components": "^5.3.5",
151
+ "styled-components": "^5.0.0",
152
152
  "xhr-mock": "^2.5.1"
153
153
  },
154
154
  "scarfSettings": {
@@ -42,6 +42,15 @@ const defaultSettings = {
42
42
  // Indicates which locales are enabled
43
43
  ENABLED_LOCALES: ["en", "nl"],
44
44
 
45
+ // Renders the global log in page
46
+ RENDER_GLOBAL_LOGIN_PAGE: false,
47
+
48
+ // Renders the global log out page
49
+ RENDER_GLOBAL_LOGOUT_PAGE: false,
50
+
51
+ // Renders the login variants as option on the global logout page
52
+ RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,
53
+
45
54
  // Render forms in a modal
46
55
  RENDER_FORMS_IN_MODAL: true,
47
56
 
@@ -1,15 +1,25 @@
1
1
  // @flow
2
2
  import { useSelector, useDispatch } from "react-redux";
3
- import { dismissNotification } from "../redux/actions";
3
+ import { dismissNotification, showNotification } from "../redux/actions";
4
4
 
5
5
  import type {
6
6
  DismissNotificationAction,
7
7
  NotificationState,
8
+ ShowNotificationAction,
8
9
  } from "../redux/types";
10
+
11
+ import { NOTIFICATION_TYPES } from "../constants";
12
+
13
+ import type { MessageObject } from "../i18n";
14
+ import type ErrorResponse from "../models/error/ErrorResponse";
9
15
  type NotificationHook = {
10
16
  ...NotificationState,
11
17
  dismiss: () => DismissNotificationAction,
12
18
  };
19
+ type ErrorNotificationHook = (
20
+ message: MessageObject,
21
+ error?: ?ErrorResponse
22
+ ) => ShowNotificationAction;
13
23
 
14
24
  /**
15
25
  */
@@ -27,3 +37,12 @@ export const useNotification = (): NotificationHook => {
27
37
  dismiss: () => dispatch(dismissNotification()),
28
38
  };
29
39
  };
40
+
41
+ /**
42
+ */
43
+ export const useErrorNotification = (): ErrorNotificationHook => {
44
+ const dispatch = useDispatch();
45
+ return (message: MessageObject, error?: ?ErrorResponse) => {
46
+ return dispatch(showNotification(NOTIFICATION_TYPES.ERROR, message, error));
47
+ };
48
+ };
@@ -5,7 +5,7 @@ import UserServicesModel from "../user/UserServicesModel";
5
5
 
6
6
  import { NotAllowedUriException } from "../../exceptions";
7
7
 
8
- import type { ModularUIModel } from "../types";
8
+ import type { ModularUIModel, AuthenticationType } from "../types";
9
9
  import type { ModularUIResponse } from "../../modularui";
10
10
  import type LinkCollection from "../links/LinkCollection";
11
11
  import type Href from "../href/Href";
@@ -64,6 +64,12 @@ export default class ApplicationModel extends ResourceModel {
64
64
  return this.getContribution("label", "");
65
65
  }
66
66
 
67
+ /**
68
+ * Getting the authentication types of the application
69
+ */
70
+ get authenticationTypes(): Array<AuthenticationType> {
71
+ return this.getContribution("security", []);
72
+ }
67
73
  /**
68
74
  * Getting the tab links
69
75
  */
@@ -93,52 +93,70 @@ export default class PasswordAttributeModel extends StringAttributeModel {
93
93
  * Add password constraints
94
94
  */
95
95
  addConstraints(): ConstraintCollection {
96
+ if (this.isConfirmPassword) {
97
+ return this.getConfirmPasswordConstraints();
98
+ }
99
+ return this.getStandardPasswordConstraints();
100
+ }
101
+
102
+ /**
103
+ * Constraints for a confirmation password
104
+ */
105
+ getConfirmPasswordConstraints(): ConstraintCollection {
96
106
  const constraints = new ConstraintCollection();
107
+ constraints.add(
108
+ new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
109
+ );
110
+ return constraints;
111
+ }
97
112
 
98
- if (this.isConfirmPassword) {
113
+ /**
114
+ * Constrains for a standard password
115
+ */
116
+ getStandardPasswordConstraints(): ConstraintCollection {
117
+ const constraints = new ConstraintCollection();
118
+
119
+ if (this.upperAndLowerCaseMandatory) {
120
+ constraints.add(new PasswordLowerAndUpperCaseConstraint());
121
+ }
122
+
123
+ if (this.maxSequenceOfIdenticalCharacters) {
124
+ constraints.add(
125
+ new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
126
+ this.maxSequenceOfIdenticalCharacters
127
+ )
128
+ );
129
+ }
130
+
131
+ if (this.minNumberOfNumericCharacters) {
132
+ constraints.add(
133
+ new PasswordMinNumericCharactersConstraint(
134
+ this.minNumberOfNumericCharacters
135
+ )
136
+ );
137
+ }
138
+
139
+ if (this.minNumberOfSpecialCharacters) {
140
+ constraints.add(
141
+ new PasswordMinSpecialCharactersConstraint(
142
+ this.minNumberOfSpecialCharacters
143
+ )
144
+ );
145
+ }
146
+
147
+ if (this.regexConstraints && this.regexConstraints.length > 0) {
148
+ this.regexConstraints.forEach((regexConstraint) => {
149
+ constraints.add(new RegexConstraint(regexConstraint));
150
+ });
151
+ }
152
+
153
+ if (
154
+ this.layouthint.has(CONFIRM_PASSWORD) &&
155
+ this.isConfirmPassword == null
156
+ ) {
99
157
  constraints.add(
100
158
  new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
101
159
  );
102
- } else {
103
- if (this.upperAndLowerCaseMandatory) {
104
- constraints.add(new PasswordLowerAndUpperCaseConstraint());
105
- }
106
-
107
- if (this.maxSequenceOfIdenticalCharacters) {
108
- constraints.add(
109
- new PasswordThreeConsecutiveCharactersNotAllowedConstraint(
110
- this.maxSequenceOfIdenticalCharacters
111
- )
112
- );
113
- }
114
-
115
- if (this.minNumberOfNumericCharacters) {
116
- constraints.add(
117
- new PasswordMinNumericCharactersConstraint(
118
- this.minNumberOfNumericCharacters
119
- )
120
- );
121
- }
122
-
123
- if (this.minNumberOfSpecialCharacters) {
124
- constraints.add(
125
- new PasswordMinSpecialCharactersConstraint(
126
- this.minNumberOfSpecialCharacters
127
- )
128
- );
129
- }
130
-
131
- if (this.regexConstraints && this.regexConstraints.length > 0) {
132
- this.regexConstraints.forEach((regexConstraint) => {
133
- constraints.add(new RegexConstraint(regexConstraint));
134
- });
135
- }
136
-
137
- if (this.layouthint.has(CONFIRM_PASSWORD) && this.confirmValue !== "") {
138
- constraints.add(
139
- new PasswordConfirmConstraint(this.confirmValue, this.otherLabel)
140
- );
141
- }
142
160
  }
143
161
 
144
162
  return constraints;
@@ -149,9 +167,8 @@ export default class PasswordAttributeModel extends StringAttributeModel {
149
167
  */
150
168
  get constraintCollection(): ConstraintCollection {
151
169
  if (this.isConfirmPassword) {
152
- const constraints = new ConstraintCollection();
153
- constraints.add(this.addConstraints());
154
- return constraints;
170
+ // confirm password only needs local constraints, no server constraints
171
+ return this.getConfirmPasswordConstraints();
155
172
  }
156
173
 
157
174
  return super.constraintCollection;
@@ -159,8 +176,8 @@ export default class PasswordAttributeModel extends StringAttributeModel {
159
176
 
160
177
  /**
161
178
  */
162
- get isConfirmPassword(): boolean {
163
- return this._isConfirmPassword || false;
179
+ get isConfirmPassword(): boolean | null {
180
+ return this._isConfirmPassword;
164
181
  }
165
182
 
166
183
  /**
@@ -153,6 +153,13 @@ export interface IModelWithChildModels {
153
153
  setChildModels(models: Array<ModularUIModel>): void;
154
154
  }
155
155
 
156
+ export type AuthenticationType = {
157
+ name: string,
158
+ authentication: string,
159
+ redirectUri: string,
160
+ isPrimary: boolean,
161
+ };
162
+
156
163
  export type FileEntryType = {
157
164
  name: string,
158
165
  size?: number,