@beinformed/ui 1.63.4 → 1.63.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/esm/constants/Constants.js +2 -1
  3. package/esm/constants/Constants.js.flow +1 -0
  4. package/esm/constants/Constants.js.map +1 -1
  5. package/esm/constants/Settings.js +2 -4
  6. package/esm/constants/Settings.js.flow +2 -4
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/__tests__/useAuthentication.spec.js.flow +2 -1
  9. package/esm/hooks/useAuthentication.js +3 -1
  10. package/esm/hooks/useAuthentication.js.flow +5 -1
  11. package/esm/hooks/useAuthentication.js.map +1 -1
  12. package/esm/models/concepts/ConceptDetailModel.js +5 -1
  13. package/esm/models/concepts/ConceptDetailModel.js.flow +6 -0
  14. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  15. package/esm/models/concepts/SourceReferenceCollection.js +9 -2
  16. package/esm/models/concepts/SourceReferenceCollection.js.flow +12 -4
  17. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  18. package/esm/models/concepts/SourceReferenceModel.js +6 -0
  19. package/esm/models/concepts/SourceReferenceModel.js.flow +6 -0
  20. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  21. package/esm/modularui/Authenticate.js +9 -3
  22. package/esm/modularui/Authenticate.js.flow +9 -4
  23. package/esm/modularui/Authenticate.js.map +1 -1
  24. package/lib/constants/Constants.js +2 -1
  25. package/lib/constants/Constants.js.map +1 -1
  26. package/lib/constants/Settings.js +2 -4
  27. package/lib/constants/Settings.js.map +1 -1
  28. package/lib/hooks/useAuthentication.js +3 -1
  29. package/lib/hooks/useAuthentication.js.map +1 -1
  30. package/lib/models/concepts/ConceptDetailModel.js +5 -1
  31. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  32. package/lib/models/concepts/SourceReferenceCollection.js +9 -2
  33. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  34. package/lib/models/concepts/SourceReferenceModel.js +6 -0
  35. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  36. package/lib/modularui/Authenticate.js +9 -3
  37. package/lib/modularui/Authenticate.js.map +1 -1
  38. package/package.json +7 -7
  39. package/src/constants/Constants.js +1 -0
  40. package/src/constants/Settings.js +2 -4
  41. package/src/hooks/__tests__/useAuthentication.spec.js +2 -1
  42. package/src/hooks/useAuthentication.js +5 -1
  43. package/src/models/concepts/ConceptDetailModel.js +6 -0
  44. package/src/models/concepts/SourceReferenceCollection.js +12 -4
  45. package/src/models/concepts/SourceReferenceModel.js +6 -0
  46. package/src/modularui/Authenticate.js +9 -4
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 [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.63.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.5...v1.63.6) (2025-11-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **authenticate:** add PAC4J_INDIRECT support and refine logout handling logic ([6064816](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/60648164fed78b9c2f9391e6e6eff3fd241f1dc2))
11
+ * **docs:** update models documentation to reflect corrected attributes and structure ([32b33b8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/32b33b83e418a8c5eb20e580e0eba2908909f907))
12
+
13
+ ## [1.63.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.4...v1.63.5) (2025-10-21)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **constants:** correct typo in getBasePath comment ([18c6ded](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/18c6ded64df5e453fff0fcd749a560b3f770b6dc))
19
+ * **source-ref:** add typeLabel property and support sectionReferenceTypes in collection ([44787b5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/44787b54b346dfe8dd0d7c516db22042638d1f62))
20
+
5
21
  ## [1.63.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.63.2...v1.63.4) (2025-10-15)
6
22
 
7
23
 
@@ -168,7 +168,8 @@ export const INCLUDE_TIME_OFFSET = "isIncludeTimeOffsetInDateTimes";
168
168
  export const INTERNAL_LOGIN_TYPE = {
169
169
  JAAS: "JAAS",
170
170
  PAC4J_FORM: "PAC4J_FORM",
171
- PAC4J_BASIC: "PAC4J_BASIC"
171
+ PAC4J_BASIC: "PAC4J_BASIC",
172
+ PAC4J_INDIRECT: "PAC4J_INDIRECT"
172
173
  };
173
174
  export const LOGIN_TYPE = "security.clients";
174
175
  export const LOGIN_PATH_SETTING = "FormClient.login_url";
@@ -176,6 +176,7 @@ export const INTERNAL_LOGIN_TYPE = {
176
176
  JAAS: "JAAS",
177
177
  PAC4J_FORM: "PAC4J_FORM",
178
178
  PAC4J_BASIC: "PAC4J_BASIC",
179
+ PAC4J_INDIRECT: "PAC4J_INDIRECT",
179
180
  };
180
181
  export const LOGIN_TYPE = "security.clients";
181
182
  export const LOGIN_PATH_SETTING = "FormClient.login_url";
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","names":["CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEAVATAR_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","RESOURCE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_FORMAT","DATETIME_OFFSET_FORMAT","DEFAULT_WEEK_STARTS_ON","DEFAULT_FIRST_WEEK_CONTAINS_DATE","KEYCODES","TAB","ENTER","ESCAPE","SPACE","PAGE_UP","PAGE_DOWN","ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN","IS_SYNC","dataFetcher","IS_SERVER","IS_GRAALJS","Graal","NOTIFICATION_TYPES","SUCCESS","INFO","WARNING","ERROR","HTTP_METHODS","GET","POST","MODULARUI_STATUS","LOADING","FINISHED","AUTOSAVE_STATUS","START","INPUT_DEBOUNCE_TIMEOUT","VALIDATE_DEBOUNCE_TIMEOUT","ATTRIBUTE_WIDTH","EXTRA_SMALL","SMALL","MEDIUM","LARGE","EXTRA_LARGE","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","JAAS","PAC4J_FORM","PAC4J_BASIC","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","DEFAULT_AUTHENTICATION_TYPE","name","authentication","isPrimary"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `/captchaServices`;\n\n/**\n * Path to change avatar page / component\n */\nexport const CHANGEAVATAR_PATH = \"/change-avatar\";\n\n/**\n * Path to change password page / component\n */\nexport const CHANGEPASSWORD_PATH = \"/change-password\";\n\n/**\n * Path to user profile page / component\n */\nexport const USERPROFILE_PATH = \"/user\";\n\n/**\n * Path to resources in the Be Informed repository\n */\nexport const RESOURCE_PATH = \"/resource\";\n\n/**\n * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment\n */\nexport const PARAMETER_SEPARATOR = \"~\";\n\n/**\n * Timeversion filter name\n */\nexport const TIMEVERSION_FILTER_NAME = \"entryDate\";\n\nconst PARAMETER_OVERVIEW_VIEWTYPE = \"viewType\";\n/**\n * Parameter name for the viewtype toggle\n */\nexport const DEFAULT_UI_PARAMETERS: Array<string> = [\n PARAMETER_OVERVIEW_VIEWTYPE,\n];\n\n/**\n */\nexport const ISO_DATE_FORMAT = \"yyyy-MM-dd\";\n/**\n */\nexport const ISO_DATETIME_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss\";\n/**\n */\nexport const ISO_TIME_FORMAT = \"HH:mm:ss\";\n/**\n */\nexport const ISO_TIMESTAMP_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSS\";\n/**\n * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true\n */\nexport const DATETIME_OFFSET_FORMAT = \"xxx\";\n/**\n * week starts on monday by default\n */\nexport const DEFAULT_WEEK_STARTS_ON = 1;\n\n/**\n * first week indicated by the 1st of january\n */\nexport const DEFAULT_FIRST_WEEK_CONTAINS_DATE = 1;\n\n/**\n * Key codes\n * @type {{SPACE: number, PAGE_DOWN: number, TAB: number, ARROW_RIGHT: number, ARROW_DOWN: number, ENTER: number, ARROW_UP: number, ARROW_LEFT: number, PAGE_UP: number, ESCAPE: number}}\n */\nexport const KEYCODES = {\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n};\n\n/**\n * @type {boolean}\n */\nexport const IS_SYNC = typeof dataFetcher !== \"undefined\";\n/**\n * @type {boolean}\n */\nexport const IS_SERVER = IS_SYNC;\n/**\n * @type {boolean}\n */\n// $FlowExpectedError[cannot-resolve-name]\nexport const IS_GRAALJS = typeof Graal !== \"undefined\";\n\n/**\n * @type {{SUCCESS: string, ERROR: string, INFO: string, WARNING: string}}\n */\nexport const NOTIFICATION_TYPES = {\n SUCCESS: \"SUCCESS\",\n INFO: \"INFO\",\n WARNING: \"WARNING\",\n ERROR: \"ERROR\",\n};\n\n/**\n * SUPPORTED HTTP METHODS\n * @type {{POST: string, GET: string}}\n */\nexport const HTTP_METHODS = {\n GET: \"GET\",\n POST: \"POST\",\n};\n\n/**\n * POSSIBLE MODULARUI STATUSSES\n * @type {{LOADING: string, ERROR: string, FINISHED: string}}\n */\nexport const MODULARUI_STATUS = {\n LOADING: \"LOADING\",\n FINISHED: \"FINISHED\",\n ERROR: \"ERROR\",\n};\n\n/**\n * POSSIBLE AUTOSAVE STATUSSES\n * @type {{START: string, FINISHED: string}}\n */\nexport const AUTOSAVE_STATUS = {\n START: \"START\",\n FINISHED: \"FINISHED\",\n};\n\n/**\n * DEBOUNCE INPUT TIMEOUT\n */\nexport const INPUT_DEBOUNCE_TIMEOUT = 100;\n\n/**\n * DEBOUNCE VALIDATION TIMEOUT\n */\nexport const VALIDATE_DEBOUNCE_TIMEOUT = 500;\n\n/**\n * ATTRIBUTE WIDTH\n */\nexport const ATTRIBUTE_WIDTH = {\n EXTRA_SMALL: \"EXTRA_SMALL\",\n SMALL: \"SMALL\",\n MEDIUM: \"MEDIUM\",\n LARGE: \"LARGE\",\n EXTRA_LARGE: \"EXTRA_LARGE\",\n};\n\nexport const ALL_CONTENT_IN_DATA_SETTING = \"hasAllContentInData\";\n\nexport const INCLUDE_TIME_OFFSET = \"isIncludeTimeOffsetInDateTimes\";\n\nexport const INTERNAL_LOGIN_TYPE = {\n JAAS: \"JAAS\",\n PAC4J_FORM: \"PAC4J_FORM\",\n PAC4J_BASIC: \"PAC4J_BASIC\",\n};\nexport const LOGIN_TYPE = \"security.clients\";\nexport const LOGIN_PATH_SETTING = \"FormClient.login_url\";\nexport const LOGIN_USERNAME_SETTING = \"FormClient.username_field_name\";\nexport const LOGIN_PASSWORD_SETTING = \"FormClient.password_field_name\";\nexport const LOGOUT_PATH_SETTING = \"FormClient.logout_url\";\n\nexport const DEFAULT_AUTHENTICATION_TYPE = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG,UAAU;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,aAAa;;AA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AsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAE1D,OAAO,MAAMC,2BAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,cAAc,EAAE,mBAAmB;EACnCC,SAAS,EAAE;AACb,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Constants.js","names":["CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEAVATAR_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","RESOURCE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_FORMAT","DATETIME_OFFSET_FORMAT","DEFAULT_WEEK_STARTS_ON","DEFAULT_FIRST_WEEK_CONTAINS_DATE","KEYCODES","TAB","ENTER","ESCAPE","SPACE","PAGE_UP","PAGE_DOWN","ARROW_LEFT","ARROW_UP","ARROW_RIGHT","ARROW_DOWN","IS_SYNC","dataFetcher","IS_SERVER","IS_GRAALJS","Graal","NOTIFICATION_TYPES","SUCCESS","INFO","WARNING","ERROR","HTTP_METHODS","GET","POST","MODULARUI_STATUS","LOADING","FINISHED","AUTOSAVE_STATUS","START","INPUT_DEBOUNCE_TIMEOUT","VALIDATE_DEBOUNCE_TIMEOUT","ATTRIBUTE_WIDTH","EXTRA_SMALL","SMALL","MEDIUM","LARGE","EXTRA_LARGE","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","JAAS","PAC4J_FORM","PAC4J_BASIC","PAC4J_INDIRECT","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","DEFAULT_AUTHENTICATION_TYPE","name","authentication","isPrimary"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `/captchaServices`;\n\n/**\n * Path to change avatar page / component\n */\nexport const CHANGEAVATAR_PATH = \"/change-avatar\";\n\n/**\n * Path to change password page / component\n */\nexport const CHANGEPASSWORD_PATH = \"/change-password\";\n\n/**\n * Path to user profile page / component\n */\nexport const USERPROFILE_PATH = \"/user\";\n\n/**\n * Path to resources in the Be Informed repository\n */\nexport const RESOURCE_PATH = \"/resource\";\n\n/**\n * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment\n */\nexport const PARAMETER_SEPARATOR = \"~\";\n\n/**\n * Timeversion filter name\n */\nexport const TIMEVERSION_FILTER_NAME = \"entryDate\";\n\nconst PARAMETER_OVERVIEW_VIEWTYPE = \"viewType\";\n/**\n * Parameter name for the viewtype toggle\n */\nexport const DEFAULT_UI_PARAMETERS: Array<string> = [\n PARAMETER_OVERVIEW_VIEWTYPE,\n];\n\n/**\n */\nexport const ISO_DATE_FORMAT = \"yyyy-MM-dd\";\n/**\n */\nexport const ISO_DATETIME_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss\";\n/**\n */\nexport const ISO_TIME_FORMAT = \"HH:mm:ss\";\n/**\n */\nexport const ISO_TIMESTAMP_FORMAT = \"yyyy-MM-dd'T'HH:mm:ss.SSS\";\n/**\n * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true\n */\nexport const DATETIME_OFFSET_FORMAT = \"xxx\";\n/**\n * week starts on monday by default\n */\nexport const DEFAULT_WEEK_STARTS_ON = 1;\n\n/**\n * first week indicated by the 1st of january\n */\nexport const DEFAULT_FIRST_WEEK_CONTAINS_DATE = 1;\n\n/**\n * Key codes\n * @type {{SPACE: number, PAGE_DOWN: number, TAB: number, ARROW_RIGHT: number, ARROW_DOWN: number, ENTER: number, ARROW_UP: number, ARROW_LEFT: number, PAGE_UP: number, ESCAPE: number}}\n */\nexport const KEYCODES = {\n TAB: 9,\n ENTER: 13,\n ESCAPE: 27,\n SPACE: 32,\n PAGE_UP: 33,\n PAGE_DOWN: 34,\n ARROW_LEFT: 37,\n ARROW_UP: 38,\n ARROW_RIGHT: 39,\n ARROW_DOWN: 40,\n};\n\n/**\n * @type {boolean}\n */\nexport const IS_SYNC = typeof dataFetcher !== \"undefined\";\n/**\n * @type {boolean}\n */\nexport const IS_SERVER = IS_SYNC;\n/**\n * @type {boolean}\n */\n// $FlowExpectedError[cannot-resolve-name]\nexport const IS_GRAALJS = typeof Graal !== \"undefined\";\n\n/**\n * @type {{SUCCESS: string, ERROR: string, INFO: string, WARNING: string}}\n */\nexport const NOTIFICATION_TYPES = {\n SUCCESS: \"SUCCESS\",\n INFO: \"INFO\",\n WARNING: \"WARNING\",\n ERROR: \"ERROR\",\n};\n\n/**\n * SUPPORTED HTTP METHODS\n * @type {{POST: string, GET: string}}\n */\nexport const HTTP_METHODS = {\n GET: \"GET\",\n POST: \"POST\",\n};\n\n/**\n * POSSIBLE MODULARUI STATUSSES\n * @type {{LOADING: string, ERROR: string, FINISHED: string}}\n */\nexport const MODULARUI_STATUS = {\n LOADING: \"LOADING\",\n FINISHED: \"FINISHED\",\n ERROR: \"ERROR\",\n};\n\n/**\n * POSSIBLE AUTOSAVE STATUSSES\n * @type {{START: string, FINISHED: string}}\n */\nexport const AUTOSAVE_STATUS = {\n START: \"START\",\n FINISHED: \"FINISHED\",\n};\n\n/**\n * DEBOUNCE INPUT TIMEOUT\n */\nexport const INPUT_DEBOUNCE_TIMEOUT = 100;\n\n/**\n * DEBOUNCE VALIDATION TIMEOUT\n */\nexport const VALIDATE_DEBOUNCE_TIMEOUT = 500;\n\n/**\n * ATTRIBUTE WIDTH\n */\nexport const ATTRIBUTE_WIDTH = {\n EXTRA_SMALL: \"EXTRA_SMALL\",\n SMALL: \"SMALL\",\n MEDIUM: \"MEDIUM\",\n LARGE: \"LARGE\",\n EXTRA_LARGE: \"EXTRA_LARGE\",\n};\n\nexport const ALL_CONTENT_IN_DATA_SETTING = \"hasAllContentInData\";\n\nexport const INCLUDE_TIME_OFFSET = \"isIncludeTimeOffsetInDateTimes\";\n\nexport const INTERNAL_LOGIN_TYPE = {\n JAAS: \"JAAS\",\n PAC4J_FORM: \"PAC4J_FORM\",\n PAC4J_BASIC: \"PAC4J_BASIC\",\n PAC4J_INDIRECT: \"PAC4J_INDIRECT\",\n};\nexport const LOGIN_TYPE = \"security.clients\";\nexport const LOGIN_PATH_SETTING = \"FormClient.login_url\";\nexport const LOGIN_USERNAME_SETTING = \"FormClient.username_field_name\";\nexport const LOGIN_PASSWORD_SETTING = \"FormClient.password_field_name\";\nexport const LOGOUT_PATH_SETTING = \"FormClient.logout_url\";\n\nexport const DEFAULT_AUTHENTICATION_TYPE = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,YAAY,GAAG,UAAU;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,aAAa;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAG,kBAAkB;;AAE9C;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,gBAAgB;;AAEjD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,kBAAkB;;AAErD;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,OAAO;;AAEvC;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GAAG,WAAW;;AAExC;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,GAAG;;AAEtC;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,WAAW;AAElD,MAAMC,2BAA2B,GAAG,UAAU;AAC9C;AACA;AACA;AACA,OAAO,MAAMC,qBAAoC,GAAG,CA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BC,QAAQ,EAAE,UAAU;EACpBN,KAAK,EAAE;AACT,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMO,eAAe,GAAG;EAC7BC,KAAK,EAAE,OAAO;EACdF,QAAQ,EAAE;AACZ,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,sBAAsB,GAAG,GAAG;;AAEzC;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAG,GAAG;;AAE5C;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAG;EAC7BC,WAAW,EAAE,aAAa;EAC1BC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,WAAW,EAAE;AACf,CAAC;AAED,OAAO,MAAMC,2BAA2B,GAAG,qBAAqB;AAEhE,OAAO,MAAMC,mBAAmB,GAAG,gCAAgC;AAEnE,OAAO,MAAMC,mBAAmB,GAAG;EACjCC,IAAI,EAAE,MAAM;EACZC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BC,cAAc,EAAE;AAClB,CAAC;AACD,OAAO,MAAMC,UAAU,GAAG,kBAAkB;AAC5C,OAAO,MAAMC,kBAAkB,GAAG,sBAAsB;AACxD,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,sBAAsB,GAAG,gCAAgC;AACtE,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAE1D,OAAO,MAAMC,2BAA2B,GAAG;EACzCC,IAAI,EAAE,2BAA2B;EACjCC,cAAc,EAAE,mBAAmB;EACnCC,SAAS,EAAE;AACb,CAAC","ignoreList":[]}
@@ -104,7 +104,7 @@ export const cacheContributions = () => getSetting("CACHE_CONTRIBUTIONS", true);
104
104
 
105
105
  /**
106
106
  * The context path is retrieved on the server using the context path property as set in the runtime properties
107
- * This can be manually override by setting the UI setting 'CONTEXT_PATH'
107
+ * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
108
108
  */
109
109
  export const getBasePath = () => getSetting("CONTEXT_PATH", "/BeInformed");
110
110
 
@@ -141,9 +141,7 @@ export const isIncludeTimeOffsetInDateTimes = () => getSetting(INCLUDE_TIME_OFFS
141
141
  export const getEnabledLocales = () => getSetting("ENABLED_LOCALES", ["en"]);
142
142
 
143
143
  /**
144
- * Login type, only available when pac4j is configured
145
- *
146
- * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS
144
+ * Login type
147
145
  */
148
146
  export const loginType = () => getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);
149
147
 
@@ -166,7 +166,7 @@ export const cacheContributions = (): boolean =>
166
166
 
167
167
  /**
168
168
  * The context path is retrieved on the server using the context path property as set in the runtime properties
169
- * This can be manually override by setting the UI setting 'CONTEXT_PATH'
169
+ * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'
170
170
  */
171
171
  export const getBasePath = (): string =>
172
172
  getSetting("CONTEXT_PATH", "/BeInformed");
@@ -215,9 +215,7 @@ export const getEnabledLocales = (): Array<string> =>
215
215
  getSetting("ENABLED_LOCALES", ["en"]);
216
216
 
217
217
  /**
218
- * Login type, only available when pac4j is configured
219
- *
220
- * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS
218
+ * Login type
221
219
  */
222
220
  export const loginType = (): string =>
223
221
  getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually override by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type, only available when pac4j is configured\n *\n * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mB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AAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG1B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC2B,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAOjF,wBAAwB,CAACiF,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIpE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMqE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","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","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","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","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","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","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\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 // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\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 BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\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 XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\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 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 * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type\n */\nexport const loginType = (): string =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\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, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;EAEpB;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,KAAK;EAE/B;EACAC,yBAA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","ignoreList":[]}
@@ -76,7 +76,7 @@ describe("authentication hooks", () => {
76
76
  });
77
77
 
78
78
  it("useLogout", async () => {
79
- expect.assertions(6);
79
+ expect.assertions(7);
80
80
 
81
81
  xhrMock.get("/BeInformed/Logoff", (req, res) => {
82
82
  expect(req.header("accept")).toBe(JSON_TYPE);
@@ -99,6 +99,7 @@ describe("authentication hooks", () => {
99
99
 
100
100
  expect(result.current.isAuthenticated).toBe(false);
101
101
  expect(typeof result.current.logout).toBe("function");
102
+ expect(result.current.logoutUrl).toBe("/BeInformed/Logoff");
102
103
 
103
104
  await result.current.logout();
104
105
 
@@ -4,6 +4,7 @@ import { login, logout, resetAuthErrors } from "../redux/actions";
4
4
  import Cache from "../utils/browser/Cache";
5
5
  import { DEFAULT_AUTHENTICATION_TYPE, getBasePathServer, logoutPath } from "../constants";
6
6
  import { IllegalStateException } from "../exceptions";
7
+ import { Authenticate } from "../modularui";
7
8
  /**
8
9
  */
9
10
  export const useLogin = () => {
@@ -51,7 +52,8 @@ export const useLogout = () => {
51
52
  } else {
52
53
  return dispatch(logout());
53
54
  }
54
- }
55
+ },
56
+ logoutUrl: Authenticate.getLogoutUrl()
55
57
  };
56
58
  };
57
59
  //# sourceMappingURL=useAuthentication.js.map
@@ -10,10 +10,12 @@ import {
10
10
  getBasePathServer,
11
11
  logoutPath,
12
12
  } from "../constants";
13
+ import { IllegalStateException } from "../exceptions";
14
+ import { Authenticate } from "../modularui";
13
15
 
14
16
  import type { ResetAuthErrorsAction } from "../redux/types";
15
17
  import type { AuthenticationType } from "../models/types";
16
- import { IllegalStateException } from "../exceptions";
18
+
17
19
  type LoginHook = {
18
20
  isAuthenticated: boolean,
19
21
  authenticationTypes: Array<AuthenticationType>,
@@ -26,6 +28,7 @@ type LogoutHook = {
26
28
  isAuthenticated: boolean,
27
29
  authenticationTypes: Array<AuthenticationType>,
28
30
  logout: () => void,
31
+ logoutUrl: string,
29
32
  };
30
33
 
31
34
  /**
@@ -94,5 +97,6 @@ export const useLogout = (): LogoutHook => {
94
97
  return dispatch(logout());
95
98
  }
96
99
  },
100
+ logoutUrl: Authenticate.getLogoutUrl(),
97
101
  };
98
102
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePathServer","logoutPath","IllegalStateException","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","getItem","authentication","redirectUri","window","location","assign","useLogout","LOGOUT_PATH","BASE_PATH","origin","url"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n DEFAULT_AUTHENTICATION_TYPE,\n getBasePathServer,\n logoutPath,\n} from \"../constants\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\nimport { IllegalStateException } from \"../exceptions\";\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getBasePathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,2BAA2B,EAC3BC,iBAAiB,EACjBC,UAAU,QACL,cAAc;AAIrB,SAASC,qBAAqB,QAAQ,eAAe;AAerD;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCL,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGZ,WAAW,CAAC,CAAC;EAE9B,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ErC,MAAMS,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EACxD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDZ,2BAA2B,CAC5B;IACDH,MAAM,EAAEA,CAAA,KAAM;MACZ,IAAIE,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMS,MAAM,GAAGN,MAAM,CAACC,QAAQ,CAACK,MAAM;QACrC,MAAMC,GAAG,GAAG,GAAGD,MAAM,GAAGD,SAAS,eAAeC,MAAM,GAAGD,SAAS,GAAGD,WAAW,EAAE;QAClF5B,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACK,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOxB,QAAQ,CAACT,MAAM,CAAC,CAAC,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","DEFAULT_AUTHENTICATION_TYPE","getBasePathServer","logoutPath","IllegalStateException","Authenticate","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","getItem","authentication","redirectUri","window","location","assign","useLogout","LOGOUT_PATH","BASE_PATH","origin","url","logoutUrl","getLogoutUrl"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { getApplication } from \"../redux/_modularui/ModularUISelectors\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n DEFAULT_AUTHENTICATION_TYPE,\n getBasePathServer,\n logoutPath,\n} from \"../constants\";\nimport { IllegalStateException } from \"../exceptions\";\nimport { Authenticate } from \"../modularui\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\n\ntype LoginHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n logoutUrl: string,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useSelector(getApplication);\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useSelector(getApplication);\n\n const LOGOUT_PATH = logoutPath();\n const BASE_PATH = getBasePathServer();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n DEFAULT_AUTHENTICATION_TYPE,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE_PATH}/logout?url=${origin}${BASE_PATH}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n logoutUrl: Authenticate.getLogoutUrl(),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,cAAc,QAAQ,wCAAwC;AACvE,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,2BAA2B,EAC3BC,iBAAiB,EACjBC,UAAU,QACL,cAAc;AACrB,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,YAAY,QAAQ,cAAc;AAoB3C;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCN,KAAK,CAACO,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGb,WAAW,CAAC,CAAC;EAE9B,MAAMc,WAAW,GAAGf,WAAW,CAACE,cAAc,CAAC;EAC/C,MAAMc,IAAI,GAAGhB,WAAW,CAAEiB,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;EAE/C,MAAME,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EAExD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDb,2BAA2B,CAC5B;IACDc,YAAY,EAAEL,IAAI,CAACM,KAAK;IACxBC,WAAW,EAAEA,CAAA,KAAMT,QAAQ,CAACT,eAAe,CAAC,CAAC,CAAC;IAC9CF,KAAK,EAAEA,CAACqB,QAAgB,EAAEC,QAAgB,KACxCX,QAAQ,CAACX,KAAK,CAACqB,QAAQ,EAAEC,QAAQ,CAAC,CAAC;IACrCC,aAAa,EAAGC,kBAAsC,IAAK;MACzD,IAAIrB,KAAK,CAACsB,OAAO,CAAC,iBAAiB,CAA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ACF,CAAC;IACDmC,SAAS,EAAE5B,YAAY,CAAC6B,YAAY,CAAC;EACvC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -222,7 +222,11 @@ export default class ConceptDetailModel extends ResourceModel {
222
222
  */
223
223
  getSourceReferenceCollection(availableLocales = []) {
224
224
  if (!this._sourceReferences) {
225
- this._sourceReferences = new SourceReferenceCollection(this.getSourceReferencesForCurrentLanguage(availableLocales), this.entryDate, this.modelOptions);
225
+ let sectionReferenceTypes = [];
226
+ if (this.conceptType && this.conceptType.sectionReferenceTypes) {
227
+ sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
228
+ }
229
+ this._sourceReferences = new SourceReferenceCollection(this.getSourceReferencesForCurrentLanguage(availableLocales), sectionReferenceTypes, this.entryDate, this.modelOptions);
226
230
  }
227
231
  return this._sourceReferences;
228
232
  }
@@ -271,8 +271,14 @@ export default class ConceptDetailModel extends ResourceModel {
271
271
  availableLocales: Array<string> = [],
272
272
  ): SourceReferenceCollection {
273
273
  if (!this._sourceReferences) {
274
+ let sectionReferenceTypes = [];
275
+ if (this.conceptType && this.conceptType.sectionReferenceTypes) {
276
+ sectionReferenceTypes = this.conceptType.sectionReferenceTypes;
277
+ }
278
+
274
279
  this._sourceReferences = new SourceReferenceCollection(
275
280
  this.getSourceReferencesForCurrentLanguage(availableLocales),
281
+ sectionReferenceTypes,
276
282
  this.entryDate,
277
283
  this.modelOptions,
278
284
  );
@@ -1 +1 @@
1
- {"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"m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EACjBR,eAAe,CAACjF,IAAI,CAACkF,SAAS,CAC5BD,eAAe,CAACjF,IAAI,CAACmF,MAAM,GAAGP,uBAChC,CACF,CACJ,CAAC;IACH;IACA,OAAO,EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAI9E,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEqG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC1E,WAAW,EAAEyE,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ConceptDetailModel.js","names":["ResourceModel","ConceptRelationCollection","SourceReferenceCollection","ConceptTypeDetailModel","TIMEVERSION_FILTER_NAME","ConceptDetailModel","constructor","modularuiResponse","_defineProperty","_relations","data","relations","entryDate","modelOptions","type","modelName","isApplicableModel","contributions","resourcetype","getInitialChildModelLinks","conceptTypeLink","links","getLinkByKey","relationsCollectionLinks","relationsCollection","isCacheable","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","call","model","conceptType","key","getData","selfhref","href","selflink","setParameter","removeParameter","diagramLinks","getLinksByGroup","_conceptType","label","conceptLabel","modelCategory","taxonomyType","formula","labels","_context","labelTypes","_mapInstanceProperty","labelType","_context2","setting","_id","getLabelElementByIds","ids","_context3","_filterInstanceProperty","_includesInstanceProperty","conceptProperties","_context4","propertyTypes","propertyType","_context5","properties","property","getConceptPropertiesByIds","_context6","textfragments","_context7","_context9","textFragments","textFragment","_context8","textFragmentConfig","textFragmentTypes","textFragmentType","notConfiguredTextFragments","some","textfragment","getTextFragmentByKeys","keys","_context0","getSourceReferenceCollection","availableLocales","_sourceReferences","sectionReferenceTypes","getSourceReferencesForCurrentLanguage","LANGUAGE_POSTFIX_LENGTH","sourceReferences","_context1","_context12","availableLanguagesInSourceReferences","sourceReference","substring","length","currentLanguagePostfix","locale","_context10","_context11","_endsWithInstanceProperty","availableLanguages","split","value","isOfConceptType","conceptTypeId"],"sources":["../../../src/models/concepts/ConceptDetailModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport ConceptRelationCollection from \"./ConceptRelationCollection\";\nimport SourceReferenceCollection from \"./SourceReferenceCollection\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\n\nimport { TIMEVERSION_FILTER_NAME } from \"../../constants/Constants\";\n\nimport type {\n ModularUIModel,\n labelsJSON,\n textfragmentJSON,\n propertyJSON,\n} from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type Href from \"../href/Href\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * Model for concept details, available through modelcatalog\n */\nexport default class ConceptDetailModel extends ResourceModel {\n _relations: ConceptRelationCollection;\n _conceptType: ?ConceptTypeDetailModel;\n _sourceReferences: SourceReferenceCollection;\n\n /**\n */\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n this._relations = new ConceptRelationCollection(\n this.data.relations,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n /**\n */\n get type(): string {\n return \"ConceptDetail\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ConceptDetailModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"ConceptDetail\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const conceptTypeLink = this.links.getLinkByKey(\"concepttype\");\n const relationsCollectionLinks =\n this.relationsCollection.getInitialChildModelLinks();\n\n if (conceptTypeLink) {\n conceptTypeLink.isCacheable = true;\n return [conceptTypeLink, ...relationsCollectionLinks];\n }\n\n return relationsCollectionLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n }\n\n /**\n * Retrieve concept detail identifier as key for this model\n */\n get key(): string {\n return this.getData(\"_id\", \"concept\");\n }\n\n /**\n * Getting the self link of this Concept\n */\n get selfhref(): Href {\n const { href } = this.selflink;\n\n if (this.entryDate) {\n href.setParameter(TIMEVERSION_FILTER_NAME, this.entryDate);\n } else {\n href.removeParameter(TIMEVERSION_FILTER_NAME);\n }\n\n return href;\n }\n\n /**\n * Available diagrams for the concept, most of the time just one\n */\n get diagramLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"diagram\");\n }\n\n /**\n * Get conceptType of concept\n */\n get conceptType(): ?ConceptTypeDetailModel {\n return this._conceptType;\n }\n\n /**\n */\n set conceptType(conceptType: ?ConceptTypeDetailModel) {\n this._conceptType = conceptType;\n }\n\n /**\n * Get concept label\n */\n get label(): string {\n return this.data.conceptLabel;\n }\n\n /**\n * Get model category of the concept\n */\n get modelCategory(): string {\n return this.getData(\"modelCategory\", \"\");\n }\n\n /**\n * Get taxonomy type\n */\n get taxonomyType(): string {\n return this.getData(\"taxonomyType\", \"default\");\n }\n\n /**\n * Get concept relations collection\n */\n get relationsCollection(): ConceptRelationCollection {\n return this._relations;\n }\n\n /**\n * Get concept formula\n */\n get formula(): string {\n return this.data.formula;\n }\n\n /**\n * Get additional labels of concept\n */\n get labels(): Array<labelsJSON> {\n return this.conceptType && this.conceptType.labelTypes\n ? this.conceptType.labelTypes.map((labelType) => {\n const setting = this.data.labels\n ? this.data.labels.find((label) => label.type === labelType._id)\n : {};\n\n return {\n ...labelType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get label elements by id\n */\n getLabelElementByIds(ids: Array<string>): Array<labelsJSON> {\n return this.labels.filter((label: labelsJSON) => ids.includes(label._id));\n }\n\n /**\n * Get concept properties\n */\n get conceptProperties(): Array<propertyJSON> {\n return this.conceptType && this.conceptType.propertyTypes\n ? this.conceptType.propertyTypes.map((propertyType) => {\n const setting = this.data.properties\n ? this.data.properties.find(\n (property) => property.type === propertyType._id,\n )\n : {};\n\n return {\n ...propertyType,\n ...setting,\n };\n })\n : [];\n }\n\n /**\n * Get concept properties by id\n */\n getConceptPropertiesByIds(ids: Array<string>): Array<propertyJSON> {\n return this.conceptProperties.filter((property) =>\n ids.includes(property._id),\n );\n }\n\n /**\n * Get Text fragments\n */\n get textfragments(): Array<textfragmentJSON> {\n const textFragments = this.data.textFragments\n ? this.data.textFragments.map((textFragment) => {\n const textFragmentConfig =\n this.conceptType &&\n this.conceptType.textFragmentTypes.find(\n (textFragmentType) => textFragment.type === textFragmentType._id,\n );\n\n return {\n ...textFragmentConfig,\n ...textFragment,\n };\n })\n : [];\n\n const notConfiguredTextFragments =\n this.conceptType && this.conceptType.textFragmentTypes\n ? this.conceptType.textFragmentTypes.filter((textFragmentType) => {\n if (!this.data.textFragments) {\n return true;\n }\n\n return !this.data.textFragments.some(\n (textfragment) => textfragment.type === textFragmentType._id,\n );\n })\n : [];\n\n return [...textFragments, ...notConfiguredTextFragments];\n }\n\n /**\n * Get text fragments by id\n */\n getTextFragmentByKeys(keys: Array<string>): Array<textfragmentJSON> {\n return this.textfragments.filter((textfragment) =>\n keys.includes(textfragment.type),\n );\n }\n\n /**\n * Get source reference collection\n */\n getSourceReferenceCollection(\n availableLocales: Array<string> = [],\n ): SourceReferenceCollection {\n if (!this._sourceReferences) {\n let sectionReferenceTypes = [];\n if (this.conceptType && this.conceptType.sectionReferenceTypes) {\n sectionReferenceTypes = this.conceptType.sectionReferenceTypes;\n }\n\n this._sourceReferences = new SourceReferenceCollection(\n this.getSourceReferencesForCurrentLanguage(availableLocales),\n sectionReferenceTypes,\n this.entryDate,\n this.modelOptions,\n );\n }\n\n return this._sourceReferences;\n }\n\n /*\n * Retrieve all sourceReferenceTypes that are valid for the current language\n * Used by sourceRef collection\n */\n /**\n */\n getSourceReferencesForCurrentLanguage(\n availableLocales: Array<string>,\n ): Array<Object> {\n const LANGUAGE_POSTFIX_LENGTH = 3;\n if (this.data.sourceReferences) {\n const availableLanguagesInSourceReferences =\n this.data.sourceReferences.map((sourceReference) =>\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n );\n\n const currentLanguagePostfix = `_${this.locale}`;\n\n if (\n availableLanguagesInSourceReferences.includes(currentLanguagePostfix)\n ) {\n // return all sourceReferences that end with language that is selected\n return this.data.sourceReferences.filter((sourceReference) =>\n sourceReference.type.endsWith(currentLanguagePostfix),\n );\n }\n\n const availableLanguages = availableLocales.map(\n (locale) => `_${locale.split(\"-\")[0]}`,\n );\n\n // return all sourceReferences that do not end with language postfix\n return this.data.sourceReferences.filter(\n (sourceReference) =>\n !availableLanguages.includes(\n sourceReference.type.substring(\n sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH,\n ),\n ),\n );\n }\n return [];\n }\n\n /**\n * Retrieve modelcatalog.js\n */\n get entryDate(): string | null {\n return this.data.filter?.[TIMEVERSION_FILTER_NAME]?.value ?? null;\n }\n\n /**\n * Indicates if the given concept type id or href exists in the hierarchy of concept types for this concept\n */\n isOfConceptType(conceptTypeId: string): boolean {\n return this.conceptType?.isOfConceptType(conceptTypeId) ?? false;\n }\n}\n"],"mappings":";;;;;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,yBAAyB,MAAM,6BAA6B;AACnE,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,2BAA2B;AAcnE;AACA;AACA;AACA,eAAe,MAAMC,kBAAkB,SAASL,aAAa,CAAC;EAK5D;AACF;EACEM,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;IAACC,e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AACF;AACA;EACE,IAAI/E,SAASA,CAAA,EAAkB;IAC7B,OAAOgD,uBAAA,KAAI,CAAClD,IAAI,IAAUN,uBAAuB,CAAC,EAAEsG,KAAK,IAAI,IAAI;EACnE;;EAEA;AACF;AACA;EACEC,eAAeA,CAACC,aAAqB,EAAW;IAC9C,OAAO,IAAI,CAAC3E,WAAW,EAAE0E,eAAe,CAACC,aAAa,CAAC,IAAI,KAAK;EAClE;AACF","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
+ import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
2
3
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
3
4
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
4
5
  import BaseCollection from "../base/BaseCollection";
@@ -9,9 +10,15 @@ import SourceReferenceModel from "./SourceReferenceModel";
9
10
  export default class SourceReferenceCollection extends BaseCollection {
10
11
  /**
11
12
  */
12
- constructor(sourceReferences = [], entryDate = null, modelOptions) {
13
+ constructor(sourceReferences = [], sectionReferenceTypes = [], entryDate = null, modelOptions) {
13
14
  super();
14
- this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference => new SourceReferenceModel(sourceReference, entryDate, modelOptions)) : [];
15
+ this.collection = sourceReferences ? _mapInstanceProperty(sourceReferences).call(sourceReferences, sourceReference => {
16
+ const sectionReferenceType = _findInstanceProperty(sectionReferenceTypes).call(sectionReferenceTypes, sectionReferenceType => sectionReferenceType._id === sourceReference.type);
17
+ return new SourceReferenceModel({
18
+ typeLabel: sectionReferenceType?.label,
19
+ ...sourceReference
20
+ }, entryDate, modelOptions);
21
+ }) : [];
15
22
  }
16
23
 
17
24
  /**
@@ -11,16 +11,24 @@ export default class SourceReferenceCollection extends BaseCollection<SourceRefe
11
11
  */
12
12
  constructor(
13
13
  sourceReferences: Array<Object> = [],
14
+ sectionReferenceTypes: Array<Object> = [],
14
15
  entryDate: ?ISO_DATE = null,
15
16
  modelOptions?: ModelOptions,
16
17
  ) {
17
18
  super();
18
19
 
19
20
  this.collection = sourceReferences
20
- ? sourceReferences.map(
21
- (sourceReference) =>
22
- new SourceReferenceModel(sourceReference, entryDate, modelOptions),
23
- )
21
+ ? sourceReferences.map((sourceReference) => {
22
+ const sectionReferenceType = sectionReferenceTypes.find(
23
+ (sectionReferenceType) =>
24
+ sectionReferenceType._id === sourceReference.type,
25
+ );
26
+ return new SourceReferenceModel(
27
+ { typeLabel: sectionReferenceType?.label, ...sourceReference },
28
+ entryDate,
29
+ modelOptions,
30
+ );
31
+ })
24
32
  : [];
25
33
  }
26
34
 
@@ -1 +1 @@
1
- {"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","entryDate","modelOptions","collection","_mapInstanceProperty","call","sourceReference","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty","type"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map(\n (sourceReference) =>\n new SourceReferenceModel(sourceReference, entryDate, modelOptions),\n )\n : [];\n }\n\n /**\n */\n byTypes(types: string): Array<SourceReferenceModel> {\n return this.filter((sourceRef) => types.includes(sourceRef.type));\n }\n}\n"],"mappings":";;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,oBAAoB,MAAM,wBAAwB;AAGzD;AACA;AACA;AACA,eAAe,MAAMC,yBAAyB,SAASF,cAAc,CAAuB;EAC1F;AACF;EACEG,WAAWA,CACTC,gBAA+B,GAAG,EAAE,EACpCC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,UAAU,GAAGH,gBAAgB,GAC9BI,oBAAA,CAAAJ,gBAAgB,EAAAK,IAAA,CAAhBL,gBAAgB,EACbM,eAAe,IACd,IAAIT,oBAAoB,CAACS,eAAe,EAAEL,SAAS,EAAEC,YAAY,CACrE,CAAC,GACD,EAAE;EACR;;EAEA;AACF;EACEK,OAAOA,CAACC,KAAa,EAA+B;IAAA,IAAAC,QAAA;IAClD,OAAOC,uBAAA,CAAAD,QAAA,OAAI,EAAAJ,IAAA,CAAAI,QAAA,EAASE,SAAS,IAAKC,yBAAA,CAAAJ,KAAK,EAAAH,IAAA,CAALG,KAAK,EAAUG,SAAS,CAACE,IAAI,CAAC,CAAC;EACnE;AACF","ignoreList":[]}
1
+ {"version":3,"file":"SourceReferenceCollection.js","names":["BaseCollection","SourceReferenceModel","SourceReferenceCollection","constructor","sourceReferences","sectionReferenceTypes","entryDate","modelOptions","collection","_mapInstanceProperty","call","sourceReference","sectionReferenceType","_findInstanceProperty","_id","type","typeLabel","label","byTypes","types","_context","_filterInstanceProperty","sourceRef","_includesInstanceProperty"],"sources":["../../../src/models/concepts/SourceReferenceCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport SourceReferenceModel from \"./SourceReferenceModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Source reference collection\n */\nexport default class SourceReferenceCollection extends BaseCollection<SourceReferenceModel> {\n /**\n */\n constructor(\n sourceReferences: Array<Object> = [],\n sectionReferenceTypes: Array<Object> = [],\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n this.collection = sourceReferences\n ? sourceReferences.map((sourceReference) => {\n const sectionReferenceType = sectionReferenceTypes.find(\n (sectionReferenceType) =>\n sectionReferenceType._id === sourceReference.type,\n );\n return new SourceReferenceModel(\n { typeLabel: sectionReferenceType?.label, ...sourceReference },\n entryDate,\n modelOptions,\n );\n })\n : [];\n }\n\n /**\n */\n byTypes(types: string): Array<SourceReferenceModel> {\n return this.filter((sourceRef) => types.includes(sourceRef.type));\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,oBAAoB,MAAM,wBAAwB;AAGzD;AACA;AACA;AACA,eAAe,MAAMC,yBAAyB,SAASF,cAAc,CAAuB;EAC1F;AACF;EACEG,WAAWA,CACTC,gBAA+B,GAAG,EAAE,EACpCC,qBAAoC,GAAG,EAAE,EACzCC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;IAEP,IAAI,CAACC,UAAU,GAAGJ,gBAAgB,GAC9BK,oBAAA,CAAAL,gBAAgB,EAAAM,IAAA,CAAhBN,gBAAgB,EAAMO,eAAe,IAAK;MACxC,MAAMC,oBAAoB,GAAGC,qBAAA,CAAAR,qBAAqB,EAAAK,IAAA,CAArBL,qBAAqB,EAC/CO,oBAAoB,IACnBA,oBAAoB,CAACE,GAAG,KAAKH,eAAe,CAACI,IACjD,CAAC;MACD,OAAO,IAAId,oBAAoB,CAC7B;QAAEe,SAAS,EAAEJ,oBAAoB,EAAEK,KAAK;QAAE,GAAGN;MAAgB,CAAC,EAC9DL,SAAS,EACTC,YACF,CAAC;IACH,CAAC,CAAC,GACF,EAAE;EACR;;EAEA;AACF;EACEW,OAAOA,CAACC,KAAa,EAA+B;IAAA,IAAAC,QAAA;IAClD,OAAOC,uBAAA,CAAAD,QAAA,OAAI,EAAAV,IAAA,CAAAU,QAAA,EAASE,SAAS,IAAKC,yBAAA,CAAAJ,KAAK,EAAAT,IAAA,CAALS,KAAK,EAAUG,SAAS,CAACP,IAAI,CAAC,CAAC;EACnE;AACF","ignoreList":[]}
@@ -49,6 +49,12 @@ class SourceReferenceModel {
49
49
  return this._sourceReference.type;
50
50
  }
51
51
 
52
+ /**
53
+ */
54
+ get typeLabel() {
55
+ return this._sourceReference.typeLabel;
56
+ }
57
+
52
58
  /**
53
59
  */
54
60
  get number() {
@@ -72,6 +72,12 @@ class SourceReferenceModel {
72
72
  return this._sourceReference.type;
73
73
  }
74
74
 
75
+ /**
76
+ */
77
+ get typeLabel(): string {
78
+ return this._sourceReference.typeLabel;
79
+ }
80
+
75
81
  /**
76
82
  */
77
83
  get number(): string {
@@ -1 +1 @@
1
- {"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","links","_links","link","section","sectionId","self","href","replace","content","selfhref","type","number","label","sourceLabel","sourceAbbreviation","referenceHash","fragment","sectionFragment"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,oBAAoB,QAAQ,iBAAiB;AAEtD,OAAOC,cAAc,MAAM,yBAAyB;AAGpD;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EACvBC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACA,IAAI,CAACC,gBAAgB,GAAGJ,eAAe;IACvC,IAAI,CAACK,UAAU,GAAGJ,SAAS;IAC3B,IAAI,CAACK,aAAa,GAAGJ,YAAY,IAAI;MACnCK,MAAM,EAAE,EAAE;MACVC,WAAW,EAAEZ,oBAAoB,CAAC;IACpC,CAAC;EACH;;EAEA;AACF;EACE,IAAIa,KAAKA,CAAA,EAAmB;IAC1B,OAAO,IAAIZ,cAAc,CACvB,IAAI,CAACO,gBAAgB,CAACM,MAAM,EAC5B,IAAI,EACJ,IAAI,CAAC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AQA,CAAA,EAA2B;IACrC,OAAO,IAAI,CAACrB,gBAAgB,CAACsB,eAAe;EAC9C;AACF;AAEA,eAAe5B,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"SourceReferenceModel.js","names":["createHashFromHref","ContentLinkModel","Href","getBasePathModularUI","LinkCollection","SourceReferenceModel","constructor","sourceReference","entryDate","modelOptions","_defineProperty","_sourceReference","_entryDate","_modelOptions","origin","contextPath","links","_links","link","section","sectionId","self","href","replace","content","selfhref","type","typeLabel","number","label","sourceLabel","sourceAbbreviation","referenceHash","fragment","sectionFragment"],"sources":["../../../src/models/concepts/SourceReferenceModel.js"],"sourcesContent":["// @flow\nimport { createHashFromHref } from \"../../utils/helpers/createHash\";\n\nimport ContentLinkModel from \"../content/ContentLinkModel\";\nimport Href from \"../href/Href\";\nimport { getBasePathModularUI } from \"../../constants\";\n\nimport LinkCollection from \"../links/LinkCollection\";\nimport type { ModelOptions, SectionFragment } from \"../types\";\n\n/**\n */\nclass SourceReferenceModel {\n _sourceReference: Object;\n _entryDate: ?ISO_DATE;\n _modelOptions: ModelOptions;\n\n /**\n */\n constructor(\n sourceReference: Object,\n entryDate: ?ISO_DATE = null,\n modelOptions?: ModelOptions,\n ) {\n this._sourceReference = sourceReference;\n this._entryDate = entryDate;\n this._modelOptions = modelOptions || {\n origin: \"\",\n contextPath: getBasePathModularUI(),\n };\n }\n\n /**\n */\n get links(): LinkCollection {\n return new LinkCollection(\n this._sourceReference._links,\n null,\n this._modelOptions,\n );\n }\n\n /**\n */\n get link(): ContentLinkModel {\n const section =\n this.sectionId ||\n this._sourceReference._links.self.href.replace(\n `${this._sourceReference._links.content.href}/`,\n \"\",\n );\n\n return new ContentLinkModel(\n {\n ...this._sourceReference,\n section,\n },\n this._entryDate,\n this._modelOptions,\n );\n }\n\n /**\n */\n get selfhref(): Href {\n return this.link.selfhref;\n }\n\n /**\n */\n get type(): string {\n return this._sourceReference.type;\n }\n\n /**\n */\n get typeLabel(): string {\n return this._sourceReference.typeLabel;\n }\n\n /**\n */\n get number(): string {\n return this._sourceReference.number;\n }\n\n /**\n */\n get label(): string {\n return this._sourceReference.label;\n }\n\n /**\n */\n get sourceLabel(): string {\n return this._sourceReference.sourceLabel;\n }\n\n /**\n *\n */\n get sourceAbbreviation(): string {\n return this._sourceReference.sourceAbbreviation;\n }\n\n /**\n */\n get referenceHash(): number {\n return createHashFromHref(this.selfhref);\n }\n\n /**\n */\n get sectionId(): string {\n return this._sourceReference.sectionId;\n }\n\n /**\n *\n */\n get fragment(): SectionFragment | void {\n return this._sourceReference.sectionFragment;\n }\n}\n\nexport default SourceReferenceModel;\n"],"mappings":";AACA,SAASA,kBAAkB,QAAQ,gCAAgC;AAEnE,OAAOC,gBAAgB,MAAM,6BAA6B;AAC1D,OAAOC,IAAI,MAAM,cAAc;AAC/B,SAASC,oBAAoB,QAAQ,iBAAiB;AAEtD,OAAOC,cAAc,MAAM,yBAAyB;AAGpD;AACA;AACA,MAAMC,oBAAoB,CAAC;EAKzB;AACF;EACEC,WAAWA,CACTC,eAAuB,EACvBC,SAAoB,GAAG,IAAI,EAC3BC,YAA2B,EAC3B;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACA,IAAI,CAACC,gBAAgB,GAAGJ,eAAe;IACvC,IAAI,CAACK,UAAU,GAAGJ,SAAS;IAC3B,IAAI,CAACK,aAAa,GAAGJ,YAAY,IAAI;MACnCK,MAAM,EAAE,EAAE;MACVC,WAAW,EAAEZ,oBAAoB,CAAC;IACpC,CAAC;EACH;;EAEA;AACF;EACE,IAAIa,KAAKA,CAAA,EAAmB;IAC1B,OAAO,IAAIZ,cAAc,CACvB,IAAI,CAACO,gBAAgB,CAACM,MAAM,EAC5B,IAAI,EACJ,IAAI,CAACJ,aACP,CAAC;EACH;;EAEA;AACF;EACE,IAAIK,IAAIA,CAAA,EAAqB;IAC3B,MAAMC,OAAO,GACX,IAAI,CAACC,SAAS,IACd,IAAI,CAACT,gBAAgB,CAACM,MAAM,CAAC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AACuB,eAAe;EAC9C;AACF;AAEA,eAAe7B,oBAAoB","ignoreList":[]}
@@ -29,7 +29,7 @@ class Authenticate {
29
29
  } else if (_includesInstanceProperty(type).call(type, "BasicClient")) {
30
30
  return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;
31
31
  }
32
- throw new Error(`Unsupported login type found: ${type}`);
32
+ return INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT;
33
33
  }
34
34
 
35
35
  /**
@@ -82,6 +82,9 @@ class Authenticate {
82
82
  return this.doFormLogin(username, password);
83
83
  case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
84
84
  return this.doBasicAuthentication(username, password);
85
+ case INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT:
86
+ // pac4j should handle this
87
+ return _Promise.resolve();
85
88
  default:
86
89
  return this.doJaasAuthentication(username, password);
87
90
  }
@@ -95,6 +98,9 @@ class Authenticate {
95
98
  return `${getBasePath()}${loginPath("DirectBasicAuthClient")}`;
96
99
  case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
97
100
  return `${getBasePath()}${loginPath("FormClient")}`;
101
+ case INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT:
102
+ //pac4j should handle this
103
+ return "";
98
104
  default:
99
105
  return `${getBasePath()}/j_security_check`;
100
106
  }
@@ -151,7 +157,7 @@ class Authenticate {
151
157
 
152
158
  /**
153
159
  */
154
- getLogoutUrl() {
160
+ static getLogoutUrl() {
155
161
  const type = loginType();
156
162
  if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {
157
163
  return `${getBasePath()}/Logoff`;
@@ -163,7 +169,7 @@ class Authenticate {
163
169
  */
164
170
  logout() {
165
171
  return universalFetch({
166
- url: this.getLogoutUrl()
172
+ url: Authenticate.getLogoutUrl()
167
173
  }).then(response => {
168
174
  // clear cache because of cached contributions
169
175
  Cache.clear();