@beinformed/ui 1.25.2 → 1.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/esm/constants/Constants.js +5 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/hooks/useAuthentication.js +5 -5
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +7 -1
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +9 -1
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/hooks/useModularUIRequest.js +5 -7
- package/esm/hooks/useModularUIRequest.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +9 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +7 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +6 -0
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +6 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +6 -0
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +6 -0
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +6 -0
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +6 -0
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +6 -0
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/ContentTypeModel.js +6 -0
- package/esm/models/content/ContentTypeModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +6 -0
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +6 -0
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +6 -0
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListModel.js +6 -0
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js +6 -0
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +6 -0
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/resolveModel.js +4 -4
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js +6 -0
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +6 -0
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +6 -0
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/models/user/UserModel.js +6 -0
- package/esm/models/user/UserModel.js.map +1 -1
- package/esm/models/user/UserProfileModel.js +6 -0
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +6 -0
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +54 -10
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/types.js +2 -0
- package/esm/modularui/types.js.map +1 -0
- package/esm/redux/_modularui/ModularUIActions.js +2 -0
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +1 -0
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/lib/constants/Constants.js +7 -1
- package/lib/constants/Constants.js.flow +6 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +2 -2
- package/lib/hooks/useAuthentication.js +4 -4
- package/lib/hooks/useAuthentication.js.flow +17 -5
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModularUI.js.flow +2 -2
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +7 -1
- package/lib/hooks/useModularUIBasic.js.flow +14 -4
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +11 -2
- package/lib/hooks/useModularUIModel.js.flow +19 -10
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js +5 -7
- package/lib/hooks/useModularUIRequest.js.flow +12 -11
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +8 -1
- package/lib/models/application/ApplicationModel.js.flow +10 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +7 -0
- package/lib/models/base/ResourceModel.js.flow +7 -0
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +6 -0
- package/lib/models/caseview/CaseViewModel.js.flow +6 -0
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.flow +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.flow +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +6 -0
- package/lib/models/content/ContentIndexModel.js.flow +6 -0
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +6 -0
- package/lib/models/content/ContentModel.js.flow +6 -0
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +6 -0
- package/lib/models/content/ContentTOCModel.js.flow +6 -0
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/ContentTypeModel.js +6 -0
- package/lib/models/content/ContentTypeModel.js.flow +6 -0
- package/lib/models/content/ContentTypeModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +6 -0
- package/lib/models/detail/DetailModel.js.flow +6 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/form/FormModel.js +6 -0
- package/lib/models/form/FormModel.js.flow +6 -0
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +6 -0
- package/lib/models/list/ListDetailModel.js.flow +6 -0
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListModel.js +6 -0
- package/lib/models/list/ListModel.js.flow +6 -0
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.flow +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.flow +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +6 -0
- package/lib/models/panels/GroupingPanelModel.js.flow +6 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/resolveModel.js +4 -3
- package/lib/models/resolveModel.js.flow +6 -4
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js +6 -0
- package/lib/models/search/CaseSearchModel.js.flow +6 -0
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +6 -0
- package/lib/models/tab/TabModel.js.flow +6 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/types.js.flow +1 -1
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserModel.js +6 -0
- package/lib/models/user/UserModel.js.flow +6 -0
- package/lib/models/user/UserModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js +6 -0
- package/lib/models/user/UserProfileModel.js.flow +6 -0
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +6 -0
- package/lib/models/user/UserServicesModel.js.flow +6 -0
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +54 -10
- package/lib/modularui/ModularUIRequest.js.flow +83 -17
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/__tests__/ModularUIRequest.spec.js.flow +4 -9
- package/lib/modularui/types.js +2 -0
- package/lib/modularui/types.js.flow +4 -0
- package/lib/modularui/types.js.map +1 -0
- package/lib/redux/_modularui/ModularUIActions.js +2 -0
- package/lib/redux/_modularui/ModularUIActions.js.flow +6 -4
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +1 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +5 -2
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +5 -3
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.flow +2 -2
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +12 -4
- package/lib/utils/fetch/types.js.map +1 -1
- package/package.json +7 -7
- package/src/constants/Constants.js +6 -0
- package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
- package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
- package/src/hooks/__tests__/useModularUIBasic.spec.js +2 -2
- package/src/hooks/useAuthentication.js +17 -5
- package/src/hooks/useModularUI.js +2 -2
- package/src/hooks/useModularUIBasic.js +14 -4
- package/src/hooks/useModularUIModel.js +19 -10
- package/src/hooks/useModularUIRequest.js +12 -11
- package/src/models/application/ApplicationModel.js +10 -1
- package/src/models/base/ResourceModel.js +7 -0
- package/src/models/caseview/CaseViewModel.js +6 -0
- package/src/models/concepts/BusinessScenarioModel.js +6 -0
- package/src/models/concepts/ConceptDetailModel.js +6 -0
- package/src/models/concepts/ConceptIndexModel.js +6 -0
- package/src/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/src/models/content/ContentIndexModel.js +6 -0
- package/src/models/content/ContentModel.js +6 -0
- package/src/models/content/ContentTOCModel.js +6 -0
- package/src/models/content/ContentTypeModel.js +6 -0
- package/src/models/detail/DetailModel.js +6 -0
- package/src/models/form/FormModel.js +6 -0
- package/src/models/list/ListDetailModel.js +6 -0
- package/src/models/list/ListModel.js +6 -0
- package/src/models/lookup/LookupOptionsModel.js +6 -0
- package/src/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/src/models/panels/GroupingPanelModel.js +6 -0
- package/src/models/resolveModel.js +6 -4
- package/src/models/search/CaseSearchModel.js +6 -0
- package/src/models/tab/TabModel.js +6 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/models/types.js +1 -1
- package/src/models/user/UserModel.js +6 -0
- package/src/models/user/UserProfileModel.js +6 -0
- package/src/models/user/UserServicesModel.js +6 -0
- package/src/modularui/ModularUIRequest.js +83 -17
- package/src/modularui/__tests__/ModularUIRequest.spec.js +4 -9
- package/src/modularui/types.js +4 -0
- package/src/redux/_modularui/ModularUIActions.js +6 -4
- package/src/redux/_modularui/ModularUIMiddleware.js +5 -2
- package/src/redux/_modularui/types.js +5 -3
- package/src/redux/_modularui/withModularUI.js +2 -2
- package/src/utils/fetch/types.js +12 -4
- package/types/constants/Constants.d.ts +5 -0
- package/types/models/base/ResourceModel.d.ts +4 -0
- package/types/models/form/FormObjectModel.d.ts +28 -2
- package/types/models/resolveModel.d.ts +1 -1
- package/types/models/types.d.ts +1 -1
- package/types/modularui/ModularUIRequest.d.ts +15 -7
- package/types/modularui/types.d.ts +2 -0
- package/types/redux/_modularui/types.d.ts +2 -2
- package/types/utils/fetch/types.d.ts +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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.25.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.25.4...v1.25.5) (2023-01-10)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **use-modularui:** make it possible to force a target model ([1b24e91](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/1b24e91f09f7c562cd7ab7fff2f30d50007cffbf))
|
|
10
|
+
|
|
11
|
+
### [1.25.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.25.3...v1.25.4) (2023-01-10)
|
|
12
|
+
|
|
13
|
+
### [1.25.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.25.2...v1.25.3) (2023-01-10)
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
- **authentiation:** improve exception messages on redirect information ([bd017b3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/bd017b30deebe15906a588e8cb9fc64a2974b982))
|
|
18
|
+
- **authentiation:** improve resolving of models on useModularUIModel hooks ([75a0fee](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/75a0fee4910fc94852ec5501cf6cfd0937c365ec))
|
|
19
|
+
- **flowtype:** improve typings of request options ([b39ae9b](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b39ae9b48cc288c104a0b703d8b9a0bb89c95f93))
|
|
20
|
+
- **login:** add default authentication type for older be informed versions ([6c30e12](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/6c30e1298cf3715f4d1480e7c047cdee63cf3529))
|
|
21
|
+
- **models:** add model name property to identify models ([b17d4bc](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b17d4bcd9d7a6dabbbb3fe0bdfda43ee0c6b2da1))
|
|
22
|
+
|
|
5
23
|
### [1.25.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.25.1...v1.25.2) (2023-01-05)
|
|
6
24
|
|
|
7
25
|
### Bug Fixes
|
|
@@ -181,4 +181,9 @@ export const LOGIN_PATH_SETTING = "FormClient.login_url";
|
|
|
181
181
|
export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
|
|
182
182
|
export const LOGIN_PASSWORD_SETTING = "FormClient.password_field_name";
|
|
183
183
|
export const LOGOUT_PATH_SETTING = "FormClient.logout_url";
|
|
184
|
+
export const fallbackDefaultAuthenticationType = {
|
|
185
|
+
name: "Form based authentication",
|
|
186
|
+
authentication: "DefaultFormClient",
|
|
187
|
+
isPrimary: true
|
|
188
|
+
};
|
|
184
189
|
//# sourceMappingURL=Constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","names":["USE_CACHE","serverBase","__CONTEXT_PATH__","BASE","window","contextPath","MODULARUI_CONTRIBUTIONS","APPLICATION_URI","APPLICATION_PATH","CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_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","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","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * Indicates if contributions should be cached\n */\nexport const USE_CACHE = true;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const BASE: string =\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\");\n\n/**\n * Path to the contributions api end point\n * /contributions uri part is added through the _links in the data service\n */\nexport const MODULARUI_CONTRIBUTIONS = \"/contributions\";\n\n/**\n * Application uri\n * @private\n */\nconst APPLICATION_URI = \"/\";\n\n/**\n * Base Path\n */\nexport const APPLICATION_PATH: string = BASE + APPLICATION_URI;\n\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `${BASE}/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `${BASE}/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `${BASE}/captchaServices`;\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 * 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 * 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/**\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 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"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,IAAI;AAE7B,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAY,GACvBF,UAAU,KACT,OAAOG,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;;AAEpB;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,gBAAgB;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,GAAG;;AAE3B;AACA;AACA;AACA,OAAO,MAAMC,gBAAwB,GAAGL,IAAI,GAAGI,eAAe;;AAE9D;AACA;AACA;AACA,OAAO,MAAME,YAAY,GAAI,GAAEN,IAAK,UAAS;;AAE7C;AACA;AACA;AACA,OAAO,MAAMO,WAAW,GAAI,GAAEP,IAAK,aAAY;;AAE/C;AACA;AACA;AACA,OAAO,MAAMQ,YAAY,GAAI,GAAER,IAAK,kBAAiB;;AAErD;AACA;AACA;AACA,OAAO,MAAMS,mBAAmB,GAAG,kBAAkB;;AAErD;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,OAAO;;AAEvC;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,CAClDD,2BAA2B,CAC5B;;AAED;AACA;AACA,OAAO,MAAME,eAAe,GAAG,YAAY;AAC3C;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,uBAAuB;AAC1D;AACA;AACA,O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AG;;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,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"}
|
|
1
|
+
{"version":3,"file":"Constants.js","names":["USE_CACHE","serverBase","__CONTEXT_PATH__","BASE","window","contextPath","MODULARUI_CONTRIBUTIONS","APPLICATION_URI","APPLICATION_PATH","CONTENT_PATH","UPLOAD_PATH","CAPTCHA_PATH","CHANGEPASSWORD_PATH","USERPROFILE_PATH","PARAMETER_SEPARATOR","TIMEVERSION_FILTER_NAME","PARAMETER_OVERVIEW_VIEWTYPE","DEFAULT_UI_PARAMETERS","ISO_DATE_FORMAT","ISO_DATETIME_FORMAT","ISO_TIME_FORMAT","ISO_TIMESTAMP_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","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","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","fallbackDefaultAuthenticationType","name","authentication","isPrimary"],"sources":["../../src/constants/Constants.js"],"sourcesContent":["// @flow\n/**\n * Indicates if contributions should be cached\n */\nexport const USE_CACHE = true;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\n/**\n * Base path\n * This uses contextPath set from property from server\n * When requesting a remote server with CORS enabled, add the origin, for example:\n * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';\n */\nexport const BASE: string =\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\");\n\n/**\n * Path to the contributions api end point\n * /contributions uri part is added through the _links in the data service\n */\nexport const MODULARUI_CONTRIBUTIONS = \"/contributions\";\n\n/**\n * Application uri\n * @private\n */\nconst APPLICATION_URI = \"/\";\n\n/**\n * Base Path\n */\nexport const APPLICATION_PATH: string = BASE + APPLICATION_URI;\n\n/**\n * path to content service\n */\nexport const CONTENT_PATH = `${BASE}/content`;\n\n/**\n * Upload Path\n */\nexport const UPLOAD_PATH = `${BASE}/uploadFile`;\n\n/**\n * Captcha Path\n */\nexport const CAPTCHA_PATH = `${BASE}/captchaServices`;\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 * 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 * 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/**\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 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 fallbackDefaultAuthenticationType = {\n name: \"Form based authentication\",\n authentication: \"DefaultFormClient\",\n isPrimary: true,\n};\n"],"mappings":"AACA;AACA;AACA;AACA,OAAO,MAAMA,SAAS,GAAG,IAAI;AAE7B,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAY,GACvBF,UAAU,KACT,OAAOG,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,WAAW,GAChDD,MAAM,CAACC,WAAW,GAClB,aAAa,CAAC;;AAEpB;AACA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAG,gBAAgB;;AAEvD;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAG,GAAG;;AAE3B;AACA;AACA;AACA,OAAO,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S,EAAE;AACb,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { useSelector, useDispatch } from "react-redux";
|
|
|
2
2
|
import { getApplication } from "../redux/_modularui/ModularUISelectors";
|
|
3
3
|
import { login, logout, resetAuthErrors } from "../redux/actions";
|
|
4
4
|
import Cache from "../utils/browser/Cache";
|
|
5
|
-
import { BASE, getSetting } from "../constants";
|
|
5
|
+
import { BASE, fallbackDefaultAuthenticationType, getSetting } from "../constants";
|
|
6
6
|
import { IllegalStateException } from "../exceptions";
|
|
7
7
|
/**
|
|
8
8
|
*/
|
|
@@ -14,18 +14,18 @@ export const useLogin = () => {
|
|
|
14
14
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
15
15
|
return {
|
|
16
16
|
isAuthenticated,
|
|
17
|
-
authenticationTypes: application?.authenticationTypes ?? [],
|
|
17
|
+
authenticationTypes: application?.authenticationTypes ?? [fallbackDefaultAuthenticationType],
|
|
18
18
|
errorMessage: auth.error,
|
|
19
19
|
resetErrors: () => dispatch(resetAuthErrors()),
|
|
20
20
|
login: (username, password) => dispatch(login(username, password)),
|
|
21
21
|
redirectLogin: authenticationType => {
|
|
22
22
|
if (Cache.getItem("isRedirectLogin")) {
|
|
23
23
|
// prevent endless loop in redirects when authentication type can't be redirected
|
|
24
|
-
throw new IllegalStateException(`Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri}'`);
|
|
24
|
+
throw new IllegalStateException(`Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? ""}'`);
|
|
25
25
|
}
|
|
26
26
|
if (!isAuthenticated) {
|
|
27
27
|
Cache.setItem("isRedirectLogin", true);
|
|
28
|
-
window.location.assign(`${BASE}${authenticationType.redirectUri}`);
|
|
28
|
+
window.location.assign(`${BASE}${authenticationType.redirectUri ?? ""}`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -40,7 +40,7 @@ export const useLogout = () => {
|
|
|
40
40
|
const isAuthenticated = application?.isLoggedIn ?? false;
|
|
41
41
|
return {
|
|
42
42
|
isAuthenticated,
|
|
43
|
-
authenticationTypes: application?.authenticationTypes ?? [],
|
|
43
|
+
authenticationTypes: application?.authenticationTypes ?? [fallbackDefaultAuthenticationType],
|
|
44
44
|
logout: () => {
|
|
45
45
|
if (Cache.getItem("isRedirectLogin")) {
|
|
46
46
|
const origin = window.location.origin;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","BASE","getSetting","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","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 {
|
|
1
|
+
{"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","getApplication","login","logout","resetAuthErrors","Cache","BASE","fallbackDefaultAuthenticationType","getSetting","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","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 BASE,\n fallbackDefaultAuthenticationType,\n getSetting,\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 fallbackDefaultAuthenticationType,\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 `${BASE}${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 = getSetting(\"LOGOUT_PATH\", \"/signout\");\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n authenticationTypes: application?.authenticationTypes ?? [\n fallbackDefaultAuthenticationType,\n ],\n logout: () => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${origin}${BASE}/logout?url=${origin}${BASE}${LOGOUT_PATH}`;\n Cache.setItem(\"isRedir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E;QACpBX,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC;QACtCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CACnB,GAAEzB,IAAK,GAAEmB,kBAAkB,CAACG,WAAW,IAAI,EAAG,EAAC,CACjD;MACH;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMI,SAAS,GAAG,MAAkB;EACzC,MAAMpB,QAAQ,GAAGZ,WAAW,EAAE;EAC9B,MAAMa,WAAW,GAAGd,WAAW,CAACE,cAAc,CAAC;EAE/C,MAAMgC,WAAW,GAAGzB,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC;EAEzD,MAAMQ,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EACxD,OAAO;IACLD,eAAe;IACfE,mBAAmB,EAAEL,WAAW,EAAEK,mBAAmB,IAAI,CACvDX,iCAAiC,CAClC;IACDJ,MAAM,EAAE,MAAM;MACZ,IAAIE,KAAK,CAACqB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC,MAAMQ,MAAM,GAAGL,MAAM,CAACC,QAAQ,CAACI,MAAM;QACrC,MAAMC,GAAG,GAAI,GAAED,MAAO,GAAE5B,IAAK,eAAc4B,MAAO,GAAE5B,IAAK,GAAE2B,WAAY,EAAC;QACxE5B,KAAK,CAACM,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;QACvCkB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACI,GAAG,CAAC;MAC7B,CAAC,MAAM;QACL,OAAOvB,QAAQ,CAACT,MAAM,EAAE,CAAC;MAC3B;IACF;EACF,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useDispatch","useSelector","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","useKeyForHook","modelKey","url","locale","split","useModularUI","options","method","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","state","modularui"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\n\nimport type Href from \"../models/href/Href\";\nimport type {
|
|
1
|
+
{"version":3,"file":"useModularUI.js","names":["useEffect","useRef","useDispatch","useSelector","HTTP_METHODS","loadModularUI","removeModelByKey","useDeepCompareEffect","useLocale","useKeyForHook","modelKey","url","locale","split","useModularUI","options","method","GET","removeOnUnmount","dispatch","href","toString","key","prevOptions","prevHref","isOldReload","current","isReload","state","modularui"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\n\nimport { HTTP_METHODS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\n\nimport { useLocale } from \"./useI18n\";\n\nimport type Href from \"../models/href/Href\";\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n */\nconst useKeyForHook = (modelKey: string, url: string) => {\n const locale = useLocale();\n return `${modelKey}(${url.split(\"?\")[0]})(${locale})`;\n};\n\n/**\n * Use redux action and selector to retrieve the correct modular ui service model\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n }\n): any => {\n const dispatch = useDispatch();\n const href = url.toString();\n const key = useKeyForHook(modelKey, href);\n\n const prevOptions = useRef(options);\n const prevHref = useRef(href);\n\n // dispatch loadModularUI\n useDeepCompareEffect(() => {\n // prevent reloads when previous option had the isReload, but the new options not\n const isOldReload =\n prevHref.current === href &&\n prevOptions.current.isReload &&\n !options.isReload;\n\n if (!isOldReload) {\n dispatch(loadModularUI(key, href, options));\n }\n\n prevOptions.current = options;\n prevHref.current = href;\n }, [key, href, options]);\n\n const { removeOnUnmount = false } = options;\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(key));\n }\n };\n }, [dispatch, key, removeOnUnmount]);\n\n // retrieve current model from modularui reducer\n return useSelector((state) => {\n return state.modularui[key];\n });\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AACzC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,YAAY,QAAQ,cAAc;AAC3C,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AAEzD,SAASC,SAAS,QAAQ,WAAW;AAKrC;AACA;AACA,MAAMC,aAAa,GAAG,CAACC,QAAgB,EAAEC,GAAW,KAAK;EACvD,MAAMC,MAAM,GAAGJ,SAAS,EAAE;EAC1B,OAAQ,GAAEE,QAAS,IAAGC,GAAG,CAACE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,KAAID,MAAO,GAAE;AACvD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAME,YAAY,GAAG,UAC1BJ,QAAgB,EAChBC,GAAkB,EAKV;EAAA,IAJRI,OAAgC,uEAAG;IACjCC,MAAM,EAAEZ,YAAY,CAACa,GAAG;IACxBC,eAAe,EAAE;EACnB,CAAC;EAED,MAAMC,QAAQ,GAAGjB,WAAW,EAAE;EAC9B,MAAMkB,IAAI,GAAGT,GAAG,CAACU,QAAQ,EAAE;EAC3B,MAAMC,GAAG,GAAGb,aAAa,CAACC,QAAQ,EAAEU,IAAI,CAAC;EAEzC,MAAMG,WAAW,GAAGtB,MAAM,CAACc,OAAO,CAAC;EACnC,MAAMS,QAAQ,GAAGvB,MAAM,CAACmB,IAAI,CAAC;;EAE7B;EACAb,oBAAoB,CAAC,MAAM;IACzB;IACA,MAAMkB,WAAW,GACfD,QAAQ,CAACE,OAAO,KAAKN,IAAI,IACzBG,WAAW,CAACG,OAAO,CAACC,QAAQ,IAC5B,CAACZ,OAAO,CAACY,QAAQ;IAEnB,IAAI,CAACF,WAAW,EAAE;MAChBN,QAAQ,CAACd,aAAa,CAACiB,GAAG,EAAEF,IAAI,EAAEL,OAAO,CAAC,CAAC;IAC7C;IAEAQ,WAAW,CAACG,OAAO,GAAGX,OAAO;IAC7BS,QAAQ,CAACE,OAAO,GAAGN,IAAI;EACzB,CAAC,EAAE,CAACE,GAAG,EAAEF,IAAI,EAAEL,OAAO,CAAC,CAAC;EAExB,MAAM;IAAEG,eAAe,GAAG;EAAM,CAAC,GAAGH,OAAO;EAC3Cf,SAAS,CAAC,MAAM;IACd,OAAO,MAAM;MACX,IAAIkB,eAAe,EAAE;QACnBC,QAAQ,CAACb,gBAAgB,CAACgB,GAAG,CAAC,CAAC;MACjC;IACF,CAAC;EACH,CAAC,EAAE,CAACH,QAAQ,EAAEG,GAAG,EAAEJ,eAAe,CAAC,CAAC;;EAEpC;EACA,OAAOf,WAAW,CAAEyB,KAAK,IAAK;IAC5B,OAAOA,KAAK,CAACC,SAAS,CAACP,GAAG,CAAC;EAC7B,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,8 @@ export const useModularUIBasic = function (key, href) {
|
|
|
8
8
|
var _context;
|
|
9
9
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
10
10
|
expectedModels: [],
|
|
11
|
-
targetModel: undefined
|
|
11
|
+
targetModel: undefined,
|
|
12
|
+
forceTargetModel: false
|
|
12
13
|
};
|
|
13
14
|
const location = useLocation();
|
|
14
15
|
if (!href) {
|
|
@@ -16,16 +17,20 @@ export const useModularUIBasic = function (key, href) {
|
|
|
16
17
|
}
|
|
17
18
|
const useModularUIOptions = {
|
|
18
19
|
targetModel: undefined,
|
|
20
|
+
forceTargetModel: undefined,
|
|
19
21
|
isReload: false
|
|
20
22
|
};
|
|
21
23
|
if (options.targetModel) {
|
|
22
24
|
useModularUIOptions.targetModel = options.targetModel;
|
|
25
|
+
useModularUIOptions.forceTargetModel = options.forceTargetModel;
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
// reload when the modular service starts with the current location
|
|
26
29
|
if (location.state?.reload && _startsWithInstanceProperty(_context = location.pathname).call(_context, href.toString())) {
|
|
27
30
|
useModularUIOptions.isReload = true;
|
|
28
31
|
}
|
|
32
|
+
|
|
33
|
+
// $FlowFixMe[incompatible-call]
|
|
29
34
|
const modularUI = useModularUI(key, href, useModularUIOptions);
|
|
30
35
|
if (modularUI?.model) {
|
|
31
36
|
const {
|
|
@@ -42,5 +47,6 @@ export const useModularUIBasic = function (key, href) {
|
|
|
42
47
|
}
|
|
43
48
|
return model;
|
|
44
49
|
}
|
|
50
|
+
return null;
|
|
45
51
|
};
|
|
46
52
|
//# sourceMappingURL=useModularUIBasic.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIBasic.js","names":["useModularUI","useLocation","IllegalArgumentException","IllegalStateException","useModularUIBasic","key","href","options","expectedModels","targetModel","undefined","location","useModularUIOptions","isReload","state","reload","pathname","toString","modularUI","model","length","isCorrectModel","some","expectedModel","type","console","error"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\ntype UseModularUIBasicOptions<T> = {\n expectedModels: Array<string>,\n targetModel?: Class<T
|
|
1
|
+
{"version":3,"file":"useModularUIBasic.js","names":["useModularUI","useLocation","IllegalArgumentException","IllegalStateException","useModularUIBasic","key","href","options","expectedModels","targetModel","undefined","forceTargetModel","location","useModularUIOptions","isReload","state","reload","pathname","toString","modularUI","model","length","isCorrectModel","some","expectedModel","type","console","error"],"sources":["../../src/hooks/useModularUIBasic.js"],"sourcesContent":["// @flow\nimport { useModularUI } from \"./useModularUI\";\n\nimport { useLocation } from \"./useRouter\";\n\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport type { ModularUIModel, Href } from \"../models\";\n\ntype UseModularUIBasicOptions<T: ModularUIModel> = {\n expectedModels: Array<string>,\n targetModel?: Class<T> | Array<Class<T>>,\n forceTargetModel?: boolean,\n};\n\n/**\n */\nexport const useModularUIBasic = <T: ModularUIModel>(\n key: string,\n href: string | Href,\n options: UseModularUIBasicOptions<T> = {\n expectedModels: [],\n targetModel: undefined,\n forceTargetModel: false,\n }\n): T | null => {\n const location = useLocation();\n if (!href) {\n throw new IllegalArgumentException(\"Missing href\");\n }\n\n const useModularUIOptions = {\n targetModel: undefined,\n forceTargetModel: undefined,\n isReload: false,\n };\n if (options.targetModel) {\n useModularUIOptions.targetModel = options.targetModel;\n useModularUIOptions.forceTargetModel = options.forceTargetModel;\n }\n\n // reload when the modular service starts with the current location\n if (location.state?.reload && location.pathname.startsWith(href.toString())) {\n useModularUIOptions.isReload = true;\n }\n\n // $FlowFixMe[incompatible-call]\n const modularUI = useModularUI(key, href, useModularUIOptions);\n\n if (modularUI?.model) {\n const { model } = modularUI;\n if (options.expectedModels.length > 0) {\n const isCorrectModel = options.expectedModels.some((expectedModel) => {\n return model.type === expectedModel;\n });\n\n if (!isCorrectModel) {\n console.error(modularUI, \"is not of instance\", options.expectedModels);\n throw new IllegalStateException(\"Resolved model has incorrect type\");\n }\n }\n\n return model;\n }\n\n return null;\n};\n"],"mappings":";AACA,SAASA,YAAY,QAAQ,gBAAgB;AAE7C,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,wBAAwB,EAAEC,qBAAqB,QAAQ,eAAe;AAU/E;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,UAC/BC,GAAW,EACXC,IAAmB,EAMN;EAAA;EAAA,IALbC,OAAoC,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AAK;EACd;EAEA,OAAO,IAAI;AACb,CAAC"}
|
|
@@ -46,11 +46,19 @@ export const useList = href => useModularUIBasic("list", href, {
|
|
|
46
46
|
targetModel: ListModel
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
*/
|
|
51
|
+
export const useListOrDetail = href => useModularUIBasic("list", href, {
|
|
52
|
+
expectedModels: ["List", "Detail"],
|
|
53
|
+
targetModel: [ListModel, DetailModel]
|
|
54
|
+
});
|
|
55
|
+
|
|
49
56
|
/**
|
|
50
57
|
*/
|
|
51
58
|
export const useListDetail = href => useModularUIBasic("listdetail", href, {
|
|
52
59
|
expectedModels: ["ListDetail"],
|
|
53
|
-
targetModel: ListDetailModel
|
|
60
|
+
targetModel: ListDetailModel,
|
|
61
|
+
forceTargetModel: true
|
|
54
62
|
});
|
|
55
63
|
|
|
56
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListDetail","useGroupingPanel","useDetailPanel","useQuicksearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\n/**\n * Load application\n */\nexport const useApplication = ():
|
|
1
|
+
{"version":3,"file":"useModularUIModel.js","names":["ApplicationModel","CaseViewModel","TabModel","ListModel","GroupingPanelModel","DetailModel","CaseSearchModel","ListDetailModel","UserProfileModel","useModularUIBasic","useApplication","expectedModels","targetModel","useTab","href","useCaseView","usePanel","useList","useListOrDetail","useListDetail","forceTargetModel","useGroupingPanel","useDetailPanel","useQuicksearch","useUserProfile"],"sources":["../../src/hooks/useModularUIModel.js"],"sourcesContent":["// @flow\nimport ApplicationModel from \"../models/application/ApplicationModel\";\nimport CaseViewModel from \"../models/caseview/CaseViewModel\";\nimport TabModel from \"../models/tab/TabModel\";\nimport ListModel from \"../models/list/ListModel\";\nimport GroupingPanelModel from \"../models/panels/GroupingPanelModel\";\nimport DetailModel from \"../models/detail/DetailModel\";\nimport CaseSearchModel from \"../models/search/CaseSearchModel\";\nimport ListDetailModel from \"../models/list/ListDetailModel\";\nimport UserProfileModel from \"../models/user/UserProfileModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\n\n/**\n * Load application\n */\nexport const useApplication = (): ApplicationModel | null =>\n useModularUIBasic(\"application\", \"/\", {\n expectedModels: [\"Application\"],\n targetModel: ApplicationModel,\n });\n\n/**\n * Load a tab by href\n */\nexport const useTab = (href: string): TabModel | null =>\n useModularUIBasic(\"tab\", href, {\n expectedModels: [\"Tab\"],\n targetModel: TabModel,\n });\n\n/**\n * Load caseview by href\n */\nexport const useCaseView = (href: string): CaseViewModel | null =>\n useModularUIBasic(\"caseview\", href, {\n expectedModels: [\"CaseView\"],\n targetModel: CaseViewModel,\n });\n\n/**\n */\nexport const usePanel = (\n href: string\n): ListModel | GroupingPanelModel | DetailModel | null =>\n useModularUIBasic(\"panel\", href, {\n expectedModels: [\"List\", \"GroupingPanel\", \"Detail\"],\n });\n\n/**\n */\nexport const useList = (href: string): ListModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\"],\n targetModel: ListModel,\n });\n\n/**\n */\nexport const useListOrDetail = (href: string): ListModel | DetailModel | null =>\n useModularUIBasic(\"list\", href, {\n expectedModels: [\"List\", \"Detail\"],\n targetModel: [ListModel, DetailModel],\n });\n\n/**\n */\nexport const useListDetail = (href: string): ListDetailModel | null =>\n useModularUIBasic(\"listdetail\", href, {\n expectedModels: [\"ListDetail\"],\n targetModel: ListDetailModel,\n forceTargetModel: true,\n });\n\n/**\n */\nexport const useGroupingPanel = (href: string): GroupingPanelModel | null =>\n useModularUIBasic(\"groupingpanel\", href, {\n expectedModels: [\"GroupingPanel\"],\n targetModel: GroupingPanelModel,\n });\n\n/**\n */\nexport const useDetailPanel = (href: string): DetailModel | null =>\n useModularUIBasic(\"detailpanel\", href, {\n expectedModels: [\"Detail\"],\n targetModel: DetailModel,\n });\n\n/**\n */\nexport const useQuicksearch = (href: string): CaseSearchModel | null =>\n useModularUIBasic(\"quicksearch\", href, {\n expectedModels: [\"CaseSearch\"],\n targetModel: CaseSearchModel,\n });\n\n/**\n */\nexport const useUserProfile = (href: string): UserProfileModel | null =>\n useModularUIBasic(\"userprofile\", href, {\n expectedModels: [\"UserProfile\"],\n targetModel: UserProfileModel,\n });\n"],"mappings":"AACA,OAAOA,gBAAgB,MAAM,wCAAwC;AACrE,OAAOC,aAAa,MAAM,kCAAkC;AAC5D,OAAOC,QAAQ,MAAM,wBAAwB;AAC7C,OAAOC,SAAS,MAAM,0BAA0B;AAChD,OAAOC,kBAAkB,MAAM,qCAAqC;AACpE,OAAOC,WAAW,MAAM,8BAA8B;AACtD,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAOC,eAAe,MAAM,gCAAgC;AAC5D,OAAOC,gBAAgB,MAAM,iCAAiC;AAE9D,SAASC,iBAAiB,QAAQ,qBAAqB;;AAEvD;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAG,MAC5BD,iBAAiB,CAAC,aAAa,EAAE,GAAG,EAAE;EACpCE,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEZ;AACf,CAAC,CAAC;;AAEJ;AACA;AACA;AACA,OAAO,MAAMa,MAA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EAAER;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMkB,cAAc,GAAIR,IAAY,IACzCL,iBAAiB,CAAC,aAAa,EAAEK,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,QAAQ,CAAC;EAC1BC,WAAW,EAAEP;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMkB,cAAc,GAAIT,IAAY,IACzCL,iBAAiB,CAAC,aAAa,EAAEK,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,YAAY,CAAC;EAC9BC,WAAW,EAAEN;AACf,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMkB,cAAc,GAAIV,IAAY,IACzCL,iBAAiB,CAAC,aAAa,EAAEK,IAAI,EAAE;EACrCH,cAAc,EAAE,CAAC,aAAa,CAAC;EAC/BC,WAAW,EAAEJ;AACf,CAAC,CAAC"}
|
|
@@ -2,16 +2,14 @@ import { createSelector } from "reselect";
|
|
|
2
2
|
import { useSelector } from "react-redux";
|
|
3
3
|
import ModularUIRequest from "../modularui/ModularUIRequest";
|
|
4
4
|
import { getLocale } from "../redux/selectors/i18n";
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Creates a ModularUIRequest with the locale as available in the redux store
|
|
7
|
+
*/
|
|
8
|
+
export const useModularUIRequest = () => useSelector(createSelector([getLocale], localeCode => {
|
|
6
9
|
return (href, options) => {
|
|
7
10
|
const request = new ModularUIRequest(href, options);
|
|
8
11
|
request.locale = localeCode;
|
|
9
12
|
return request;
|
|
10
13
|
};
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Creates a ModularUIRequest with the locale as available in the redux store
|
|
15
|
-
*/
|
|
16
|
-
export const useModularUIRequest = () => useSelector(getModularUIRequest);
|
|
14
|
+
}));
|
|
17
15
|
//# sourceMappingURL=useModularUIRequest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModularUIRequest.js","names":["createSelector","useSelector","ModularUIRequest","getLocale","
|
|
1
|
+
{"version":3,"file":"useModularUIRequest.js","names":["createSelector","useSelector","ModularUIRequest","getLocale","useModularUIRequest","localeCode","href","options","request","locale"],"sources":["../../src/hooks/useModularUIRequest.js"],"sourcesContent":["// @flow\nimport { createSelector } from \"reselect\";\nimport { useSelector } from \"react-redux\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport type Href from \"../models/href/Href\";\nimport type { RequestModularUIOptions } from \"../utils\";\n\n/**\n * Creates a ModularUIRequest with the locale as available in the redux store\n */\nexport const useModularUIRequest = (): ((\n href: Href,\n options?: $Shape<RequestModularUIOptions>\n) => ModularUIRequest) =>\n useSelector(\n createSelector([getLocale], (localeCode) => {\n return (href: Href, options?: $Shape<RequestModularUIOptions>) => {\n const request = new ModularUIRequest(href, options);\n request.locale = localeCode;\n return request;\n };\n })\n );\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,UAAU;AACzC,SAASC,WAAW,QAAQ,aAAa;AAEzC,OAAOC,gBAAgB,MAAM,+BAA+B;AAC5D,SAASC,SAAS,QAAQ,yBAAyB;AAKnD;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAG,MAIjCH,WAAW,CACTD,cAAc,CAAC,CAACG,SAAS,CAAC,EAAGE,UAAU,IAAK;EAC1C,OAAO,CAACC,IAAU,EAAEC,OAAyC,KAAK;IAChE,MAAMC,OAAO,GAAG,IAAIN,gBAAgB,CAACI,IAAI,EAAEC,OAAO,CAAC;IACnDC,OAAO,CAACC,MAAM,GAAGJ,UAAU;IAC3B,OAAOG,OAAO;EAChB,CAAC;AACH,CAAC,CAAC,CACH"}
|
|
@@ -4,6 +4,8 @@ import ResourceModel from "../base/ResourceModel";
|
|
|
4
4
|
import LinkModel from "../links/LinkModel";
|
|
5
5
|
import UserServicesModel from "../user/UserServicesModel";
|
|
6
6
|
import { NotAllowedUriException } from "../../exceptions";
|
|
7
|
+
import { fallbackDefaultAuthenticationType } from "../../constants";
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
10
|
* The Application model
|
|
9
11
|
*/
|
|
@@ -19,6 +21,12 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
19
21
|
return "Application";
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
/**
|
|
25
|
+
*/
|
|
26
|
+
static get modelName() {
|
|
27
|
+
return "ApplicationModel";
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
/**
|
|
23
31
|
*/
|
|
24
32
|
static isApplicableModel(data) {
|
|
@@ -55,7 +63,7 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
55
63
|
* Getting the authentication types of the application
|
|
56
64
|
*/
|
|
57
65
|
get authenticationTypes() {
|
|
58
|
-
const authenticationTypes = this.getContribution("security", []);
|
|
66
|
+
const authenticationTypes = this.getContribution("security", [fallbackDefaultAuthenticationType]);
|
|
59
67
|
|
|
60
68
|
//put primary first
|
|
61
69
|
return authenticationTypes?.sort((a, b) => a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","ApplicationModel","type","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","model","userServices","label","getContribution","authenticationTypes","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","_userServices","isLoggedIn","userHref","userLink"],"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 const authenticationTypes = this.getContribution(\"security\", []);\n\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1\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,aAAa,MAAM,uBAAuB;AACjD,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASC,sBAAsB,QAAQ,kBAAkB;
|
|
1
|
+
{"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","fallbackDefaultAuthenticationType","ApplicationModel","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","model","userServices","label","getContribution","authenticationTypes","sort","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","_userServices","isLoggedIn","userHref","userLink"],"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\";\nimport { fallbackDefaultAuthenticationType } from \"../../constants\";\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 get modelName(): string {\n return \"ApplicationModel\";\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 const authenticationTypes = this.getContribution(\"security\", [\n fallbackDefaultAuthenticationType,\n ]);\n\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1\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,aAAa,MAAM,uBAAuB;AACjD,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASC,sBAAsB,QAAQ,kBAAkB;AAMzD,SAASC,iCAAiC,QAAQ,iBAAiB;;AAEnE;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB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GAAG,CAAC,GAAGF,CAAC,CAACE,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,CACzD;EACH;EACA;AACF;AACA;EACE,IAAIC,IAAI,GAAmB;IACzB,OAAO,IAAI,CAAChB,KAAK,CAACiB,eAAe,CAAC,KAAK,CAAC;EAC1C;;EAEA;AACF;AACA;EACE,IAAIC,YAAY,GAAc;IAC5B,OAAO/B,SAAS,CAACgC,MAAM,CAAC,cAAc,EAAE,eAAe,EAAE,eAAe,CAAC;EAC3E;;EAEA;AACF;AACA;EACE,IAAIX,YAAY,CAACD,KAAsB,EAAE;IACvC,IAAI,CAACa,aAAa,GAAGb,KAAK,YAAYnB,iBAAiB,GAAGmB,KAAK,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIC,YAAY,GAAuB;IACrC,OAAO,IAAI,CAACY,aAAa,GAAG,IAAI,CAACA,aAAa,GAAG,IAAI;EACvD;;EAEA;AACF;AACA;EACE,IAAIC,UAAU,GAAY;IACxB,OAAO,IAAI,CAACb,YAAY,EAAEa,UAAU,IAAI,KAAK;EAC/C;;EAEA;AACF;AACA;AACA;EACE,IAAIC,QAAQ,GAAgB;IAC1B,IAAI,IAAI,CAACd,YAAY,IAAI,IAAI,IAAI,IAAI,CAACA,YAAY,CAACe,QAAQ,IAAI,IAAI,EAAE;MACnE,OAAO,IAAI,CAACf,YAAY,CAACe,QAAQ,CAACrB,IAAI;IACxC;IAEA,OAAO,IAAI;EACb;AACF"}
|
|
@@ -26,6 +26,13 @@ class ResourceModel extends BaseModel {
|
|
|
26
26
|
this._lastServerUpdate = Date.now();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Property to render name of a model, is original name after transpilation
|
|
31
|
+
*/
|
|
32
|
+
static get modelName() {
|
|
33
|
+
throw new IllegalStateException(`No modelName set on the resource model`);
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
/**
|
|
30
37
|
* Returns true when the model is supported based on configuration found in contributions
|
|
31
38
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceModel.js","names":["ModularUIResponse","BaseModel","LinkCollection","IllegalArgumentException","IllegalStateException","ResourceModel","constructor","modularuiResponse","data","contributions","_key","key","_locale","locale","_childModels","_lastServerUpdate","Date","now","isApplicableModel","Error","lastServerUpdate","type","resourcetype","getContribution","label","links","_links","Array","isArray","self","selflink","getLinkByKey","selfhref","href","getInitialChildModelLinks","childModels","addChildModels","models","flattenModels","setChildModels","dehydrate","childModel"],"sources":["../../../src/models/base/ResourceModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport BaseModel from \"./BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport {\n IllegalArgumentException,\n IllegalStateException,\n} from \"../../exceptions\";\n\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport type { ModularUIModel, IModelWithChildModels } from \"../types\";\n\n/**\n * Base model, this the foundation for models that represent modular ui services, e.g. application, tab, caseview, etc\n */\nclass ResourceModel extends BaseModel implements IModelWithChildModels {\n _key: string;\n _locale: string;\n _childModels: Array<ModularUIModel>;\n _links: LinkCollection;\n _lastServerUpdate: number;\n\n /**\n * constructor\n */\n constructor(modularuiResponse: ModularUIResponse = new ModularUIResponse()) {\n super(modularuiResponse.data, modularuiResponse.contributions);\n\n this._key = modularuiResponse.key;\n this._locale = modularuiResponse.locale;\n\n this._childModels = [];\n\n this._lastServerUpdate = Date.now();\n }\n\n /**\n * Returns true when the model is supported based on configuration found in contributions\n *\n * @abstract\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n if (!(data instanceof ModularUIResponse)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a ModularUIResponse\"\n );\n }\n\n throw new Error(\"No isApplicableModel condition set on resourcemodel\");\n }\n\n /**\n */\n get lastServerUpdate(): number {\n return this._lastServerUpdate;\n }\n\n /**\n */\n set lastServerUpdate(lastServerUpdate: number) {\n this._lastServerUpdate = lastServerUpdate;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this._key;\n }\n\n /**\n * Get type of model\n *\n * @abstract\n */\n get type(): string {\n throw new IllegalStateException(\n `No type set on the resource model with key ${this.key}`\n );\n }\n\n /**\n * Retrieve type of resource\n */\n get resourcetype(): string {\n return this.getContribution(\"resourcetype\", \"unknown\");\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n {\n self: {\n resourcetype: this.resourcetype,\n },\n ...this.contributions._links,\n }\n );\n }\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new IllegalStateException(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`\n );\n }\n\n return selflink;\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n * Add links to expand on initialization of this model\n *\n * @abstract\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return [];\n }\n\n /**\n * Retrieve links of expanded child models\n */\n get childModels(): Array<ModularUIModel> {\n return this._childModels;\n }\n\n /**\n * Add child models to this model\n */\n addChildModels(models: Array<ModularUIModel>): this {\n const flattenModels = [].concat(...models);\n\n this._childModels = flattenModels;\n\n this.setChildModels(flattenModels);\n\n return this;\n }\n\n /**\n * Template to set expanded child models\n * Use this hook to separate the retrieved child models into the correct models.\n *\n * @abstract\n * @example <caption>Put all models of instance List and GroupingPanel into the panels property</caption>\n */\n setChildModels(models: Array<ModularUIModel>): void {\n if (!models) {\n throw new IllegalArgumentException(\"No models send to setChildModels\");\n }\n }\n\n /**\n */\n dehydrate(): Object {\n return {\n ...super.dehydrate(),\n key: this._key,\n locale: this._locale,\n // $FlowFixMe[missing-type-arg]\n childModels: this._childModels.map<ModularUIModel>(\n (childModel: ModularUIModel) => childModel.dehydrate()\n ),\n };\n }\n}\n\nexport default ResourceModel;\n"],"mappings":";;;AACA,OAAOA,iBAAiB,MAAM,mCAAmC;AAEjE,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,SACEC,wBAAwB,EACxBC,qBAAqB,QAChB,kBAAkB;AAMzB;AACA;AACA;AACA,MAAMC,aAAa,SAASJ,SAAS,CAAkC;EAOrE;AACF;AACA;EACEK,WAAW,GAAiE;IAAA,IAAhEC,iBAAoC,uEAAG,IAAIP,iBAAiB,EAAE;IACxE,KAAK,CAACO,iBAAiB,CAACC,IAAI,EAAED,iBAAiB,CAACE,aAAa,CAAC;IAAC;IAAA;IAAA;IAAA;IAAA;IAE/D,IAAI,CAACC,IAAI,GAAGH,iBAAiB,CAACI,GAAG;IACjC,IAAI,CAACC,OAAO,GAAGL,iBAAiB,CAACM,MAAM;IAEvC,IAAI,CAACC,YAAY,GAAG,EAAE;IAEtB,IAAI,CAACC,iBAAiB,GAAGC,IAAI,CAACC,GAAG,EAAE;EACrC;;EAEA;AACF;AACA;AACA;AACA;EACE,
|
|
1
|
+
{"version":3,"file":"ResourceModel.js","names":["ModularUIResponse","BaseModel","LinkCollection","IllegalArgumentException","IllegalStateException","ResourceModel","constructor","modularuiResponse","data","contributions","_key","key","_locale","locale","_childModels","_lastServerUpdate","Date","now","modelName","isApplicableModel","Error","lastServerUpdate","type","resourcetype","getContribution","label","links","_links","Array","isArray","self","selflink","getLinkByKey","selfhref","href","getInitialChildModelLinks","childModels","addChildModels","models","flattenModels","setChildModels","dehydrate","childModel"],"sources":["../../../src/models/base/ResourceModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport BaseModel from \"./BaseModel\";\nimport LinkCollection from \"../links/LinkCollection\";\n\nimport {\n IllegalArgumentException,\n IllegalStateException,\n} from \"../../exceptions\";\n\nimport type LinkModel from \"../links/LinkModel\";\nimport type Href from \"../href/Href\";\nimport type { ModularUIModel, IModelWithChildModels } from \"../types\";\n\n/**\n * Base model, this the foundation for models that represent modular ui services, e.g. application, tab, caseview, etc\n */\nclass ResourceModel extends BaseModel implements IModelWithChildModels {\n _key: string;\n _locale: string;\n _childModels: Array<ModularUIModel>;\n _links: LinkCollection;\n _lastServerUpdate: number;\n\n /**\n * constructor\n */\n constructor(modularuiResponse: ModularUIResponse = new ModularUIResponse()) {\n super(modularuiResponse.data, modularuiResponse.contributions);\n\n this._key = modularuiResponse.key;\n this._locale = modularuiResponse.locale;\n\n this._childModels = [];\n\n this._lastServerUpdate = Date.now();\n }\n\n /**\n * Property to render name of a model, is original name after transpilation\n */\n static get modelName(): string {\n throw new IllegalStateException(`No modelName set on the resource model`);\n }\n\n /**\n * Returns true when the model is supported based on configuration found in contributions\n *\n * @abstract\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n if (!(data instanceof ModularUIResponse)) {\n throw new IllegalArgumentException(\n \"Given argument for isApplicableModel is not a ModularUIResponse\"\n );\n }\n\n throw new Error(\"No isApplicableModel condition set on resourcemodel\");\n }\n\n /**\n */\n get lastServerUpdate(): number {\n return this._lastServerUpdate;\n }\n\n /**\n */\n set lastServerUpdate(lastServerUpdate: number) {\n this._lastServerUpdate = lastServerUpdate;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n * Retrieve key\n */\n get key(): string {\n return this._key;\n }\n\n /**\n * Get type of model\n *\n * @abstract\n */\n get type(): string {\n throw new IllegalStateException(\n `No type set on the resource model with key ${this.key}`\n );\n }\n\n /**\n * Retrieve type of resource\n */\n get resourcetype(): string {\n return this.getContribution(\"resourcetype\", \"unknown\");\n }\n\n /**\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the links of the resource\n */\n get links(): LinkCollection {\n if (!this._links) {\n this._links = new LinkCollection(\n Array.isArray(this.data._links)\n ? this.data._links[0]\n : this.data._links,\n {\n self: {\n resourcetype: this.resourcetype,\n },\n ...this.contributions._links,\n }\n );\n }\n return this._links;\n }\n\n /**\n */\n set links(links: LinkCollection) {\n this._links = links;\n }\n\n /**\n * Get self link of model\n */\n get selflink(): LinkModel {\n const selflink = this.links.getLinkByKey(\"self\");\n\n if (selflink === null) {\n throw new IllegalStateException(\n `Could not find self link for ${\n this.key === null ? \"unknown\" : this.key\n }`\n );\n }\n\n return selflink;\n }\n\n /**\n * Return default self link of resource\n */\n get selfhref(): Href {\n return this.selflink.href;\n }\n\n /**\n * Add links to expand on initialization of this model\n *\n * @abstract\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return [];\n }\n\n /**\n * Retrieve links of expanded child models\n */\n get childModels(): Array<ModularUIModel> {\n return this._childModels;\n }\n\n /**\n * Add child models to this model\n */\n addChildModels(models: Array<ModularUIModel>): this {\n const flattenModels = [].concat(...models);\n\n this._childModels = flattenModels;\n\n this.setChildModels(flattenModels);\n\n return this;\n }\n\n /**\n * Template to set expanded child models\n * Use this hook to separate the retrieved child models into the correct models.\n *\n * @abstract\n * @example <caption>Put all models of instance List and GroupingPanel into the panels property</caption>\n */\n setChildModels(models: Array<ModularUIModel>): void {\n if (!models) {\n throw new IllegalArgumentException(\"No models send to setChildModels\");\n }\n }\n\n /**\n */\n dehydrate(): Object {\n return {\n ...super.dehydrate(),\n key: this._key,\n locale: this._locale,\n // $FlowFixMe[missing-type-arg]\n childModels: this._childModels.map<ModularUIModel>(\n (childModel: ModularUIModel) => childModel.dehydrate()\n ),\n };\n }\n}\n\nexport default ResourceModel;\n"],"mappings":";;;AACA,OAAOA,iBAAiB,MAAM,mCAAmC;AAEjE,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,cAAc,MAAM,yBAAyB;AAEpD,SACEC,wBAAwB,EACxBC,qBAAqB,QAChB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EAAE;EACX;;EAEA;AACF;AACA;EACE,IAAIC,WAAW,GAA0B;IACvC,OAAO,IAAI,CAACtB,YAAY;EAC1B;;EAEA;AACF;AACA;EACEuB,cAAc,CAACC,MAA6B,EAAQ;IAAA;IAClD,MAAMC,aAAa,GAAG,qCAAE,iBAAQ,GAAGD,MAAM,CAAC;IAE1C,IAAI,CAACxB,YAAY,GAAGyB,aAAa;IAEjC,IAAI,CAACC,cAAc,CAACD,aAAa,CAAC;IAElC,OAAO,IAAI;EACb;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,cAAc,CAACF,MAA6B,EAAQ;IAClD,IAAI,CAACA,MAAM,EAAE;MACX,MAAM,IAAInC,wBAAwB,CAAC,kCAAkC,CAAC;IACxE;EACF;;EAEA;AACF;EACEsC,SAAS,GAAW;IAAA;IAClB,OAAO;MACL,GAAG,KAAK,CAACA,SAAS,EAAE;MACpB9B,GAAG,EAAE,IAAI,CAACD,IAAI;MACdG,MAAM,EAAE,IAAI,CAACD,OAAO;MACpB;MACAwB,WAAW,EAAE,qCAAI,CAACtB,YAAY,kBAC3B4B,UAA0B,IAAKA,UAAU,CAACD,SAAS,EAAE;IAE1D,CAAC;EACH;AACF;AAEA,eAAepC,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseViewModel.js","names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","IllegalStateException","CaseViewModel","constructor","caseviewData","createTaskGroupCollection","type","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","links","getLinksByGroup","all","panelLinks","setChildModels","models","taskGroupModels","i","length","push","taskGroupCollection","add","casename","attributeCollection","getAttributeByLayoutHint","label","value","viewLabel","getContribution","hasIntroText","introtext","_content","text","message","Array","isArray","texts","selfhref","selfLink","getLinkByKey","href","allTaskgroupData","getData","allTaskgroupContributions","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","taskgroups","_taskGroupCollection","hasTaskGroups","hasItems"],"sources":["../../../src/models/caseview/CaseViewModel.js"],"sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n * Retrieve the case label, this can be configured with a case property with the layout hint 'title'\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Retrieve the label that was configured on the caseview\n */\n get viewLabel(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new IllegalStateException(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,WAAW,MAAM,uBAAuB;AAC/C,OAAOC,IAAI,MAAM,cAAc;AAC/B,OAAOC,mBAAmB,MAAM,kCAAkC;AAClE,OAAOC,cAAc,MAAM,6BAA6B;AAExD,SAASC,KAAK,QAAQ,6BAA6B;AAEnD,OAAOC,qBAAqB,MAAM,wCAAwC;AAO1E;AACA;AACA;AACA,eAAe,MAAMC,aAAa,SAASN,WAAW,CAAC;EAGrD;AACF;EACEO,WAAW,CAACC,YAA+B,EAAE;IAC3C,KAAK,CAACA,YAAY,CAAC;IAAC;IAEpB,IAAI,CAACC,yBAAyB,EAAE;EAClC;;EAEA;AACF;EACE,IAAIC,IAAI,GAAW;IACjB,OAAO,UAAU;EACnB;;EAEA;AACF;EACE,OAAOC,iBAAiB,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,UAAU;EAElD;;EAEA;AACF;EACEC,yBAAyB,GAAqB;IAC5C,OAAO,IAAI,CAACC,KAAK,CAACC,eAAe,CAAC,WAAW,CAAC,CAACC,GAAG;EACpD;;EAEA;AACF;AACA;EACE,IAAIC,UAAU,GAAmB;IAC/B,OAAO,IAAI,CAACH,KAAK,CAACC,eAAe,CAAC,OAAO,CAAC;EAC5C;;EAEA;AACF;EACEG,cAAc,CAACC,MAA6B,EAAE;IAC5C,KAAK,CAACD,cAAc,CAACC,MAAM,CAAC;IAE5B,MAAMC,eAAe,GAAG,EAAE;IAC1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,MAAM,CAACG,MAAM,EAAED,CAAC,EAAE,EAAE;MACtC,IAAIF,MAAM,CAACE,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"CaseViewModel.js","names":["DetailModel","Href","TaskGroupCollection","TaskGroupModel","TITLE","IllegalStateException","CaseViewModel","constructor","caseviewData","createTaskGroupCollection","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","links","getLinksByGroup","all","panelLinks","setChildModels","models","taskGroupModels","i","length","push","taskGroupCollection","add","casename","attributeCollection","getAttributeByLayoutHint","label","value","viewLabel","getContribution","hasIntroText","introtext","_content","text","message","Array","isArray","texts","selfhref","selfLink","getLinkByKey","href","allTaskgroupData","getData","allTaskgroupContributions","taskgroup","some","taskgroupContribution","name","taskgroupContributions","create","taskgroups","_taskGroupCollection","hasTaskGroups","hasItems"],"sources":["../../../src/models/caseview/CaseViewModel.js"],"sourcesContent":["// @flow\nimport DetailModel from \"../detail/DetailModel\";\nimport Href from \"../href/Href\";\nimport TaskGroupCollection from \"../taskgroup/TaskGroupCollection\";\nimport TaskGroupModel from \"../taskgroup/TaskGroupModel\";\n\nimport { TITLE } from \"../../constants/LayoutHints\";\n\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\nimport type { ModularUIModel, AttributeType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Model containing the details of one case.\n */\nexport default class CaseViewModel extends DetailModel {\n _taskGroupCollection: TaskGroupCollection;\n\n /**\n */\n constructor(caseviewData: ModularUIResponse) {\n super(caseviewData);\n\n this.createTaskGroupCollection();\n }\n\n /**\n */\n get type(): string {\n return \"CaseView\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"CaseViewModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"CaseView\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n return this.links.getLinksByGroup(\"taskgroup\").all;\n }\n\n /**\n * Getting panel links\n */\n get panelLinks(): LinkCollection {\n return this.links.getLinksByGroup(\"panel\");\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n super.setChildModels(models);\n\n const taskGroupModels = [];\n for (let i = 0; i < models.length; i++) {\n if (models[i] instanceof TaskGroupModel) {\n taskGroupModels.push(models[i]);\n }\n }\n\n this.taskGroupCollection.add(taskGroupModels);\n }\n\n /**\n * Getting the case name\n */\n get casename(): ?AttributeType {\n return this.attributeCollection.getAttributeByLayoutHint(TITLE);\n }\n\n /**\n * Retrieve the case label, this can be configured with a case property with the layout hint 'title'\n */\n get label(): string {\n return this.casename ? this.casename.value : \"\";\n }\n\n /**\n * Retrieve the label that was configured on the caseview\n */\n get viewLabel(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Check if an introtext exists for this caseview\n */\n hasIntroText(): boolean {\n return this.introtext !== \"\";\n }\n\n /**\n * Getting the introduction text configured on the case view\n */\n get introtext(): string {\n if (this.data._content) {\n return this.data._content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the self href\n */\n get selfhref(): Href {\n const selfLink = this.links.getLinkByKey(\"self\");\n\n if (selfLink === null) {\n throw new IllegalStateException(\"No self href available\");\n }\n\n return new Href(selfLink.href);\n }\n\n /**\n */\n createTaskGroupCollection() {\n const allTaskgroupData = this.getData(\"taskgroups\", []);\n const allTaskgroupContributions = this.getContribution(\"taskgroups\", []);\n\n this.taskGroupCollection = allTaskgroupData\n .filter((taskgroup) =>\n allTaskgroupContributions.some(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n )\n )\n .map((taskgroup) => {\n const taskgroupContributions = allTaskgroupContributions.find(\n (taskgroupContribution) =>\n taskgroupContribution.name === taskgroup.name\n );\n\n return TaskGroupModel.create(\n taskgroup.name,\n taskgroup,\n taskgroupContributions\n );\n });\n }\n\n /**\n * Setting the taskgroup panel collection\n */\n set taskGroupCollection(taskgroups: Array<TaskGroupModel>) {\n this._taskGroupCollection = new TaskGroupCollection(taskgroups);\n }\n\n /**\n * Getting the taskgrouppanels on the tab\n */\n get taskGroupCollection(): TaskGroupCollection {\n return this._taskGroupCollection;\n }\n\n /**\n * Has taskgroups\n */\n hasTaskGroups(): boolean {\n return this.taskGroupCollection && this.taskGroupCollection.hasItems;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,WAAW,MAAM,uBAAuB;AAC/C,OAAOC,IAA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ACE,IAAI,CAAC;EAChC;;EAEA;AACF;EACEtC,yBAAyB,GAAG;IAAA;IAC1B,MAAMuC,gBAAgB,GAAG,IAAI,CAACC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC;IACvD,MAAMC,yBAAyB,GAAG,IAAI,CAACf,eAAe,CAAC,YAAY,EAAE,EAAE,CAAC;IAExE,IAAI,CAACR,mBAAmB,GAAG,wDAAAqB,gBAAgB,OAAhBA,gBAAgB,EAChCG,SAAS,IAChBD,yBAAyB,CAACE,IAAI,CAC3BC,qBAAqB,IACpBA,qBAAqB,CAACC,IAAI,KAAKH,SAAS,CAACG,IAAI,CAChD,CACF,iBACKH,SAAS,IAAK;MAClB,MAAMI,sBAAsB,GAAG,sBAAAL,yBAAyB,OAAzBA,yBAAyB,EACrDG,qBAAqB,IACpBA,qBAAqB,CAACC,IAAI,KAAKH,SAAS,CAACG,IAAI,CAChD;MAED,OAAOnD,cAAc,CAACqD,MAAM,CAC1BL,SAAS,CAACG,IAAI,EACdH,SAAS,EACTI,sBAAsB,CACvB;IACH,CAAC,CAAC;EACN;;EAEA;AACF;AACA;EACE,IAAI5B,mBAAmB,CAAC8B,UAAiC,EAAE;IACzD,IAAI,CAACC,oBAAoB,GAAG,IAAIxD,mBAAmB,CAACuD,UAAU,CAAC;EACjE;;EAEA;AACF;AACA;EACE,IAAI9B,mBAAmB,GAAwB;IAC7C,OAAO,IAAI,CAAC+B,oBAAoB;EAClC;;EAEA;AACF;AACA;EACEC,aAAa,GAAY;IACvB,OAAO,IAAI,CAAChC,mBAAmB,IAAI,IAAI,CAACA,mBAAmB,CAACiC,QAAQ;EACtE;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","type","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","PERSONA","SCENARIO","Array","isArray","some","conceptTypeSetting","getInitialChildModelLinks","childModelLinks","scenarioStepLinks","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","relationsToActor","newRelationToActor","actor","key"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\"\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\"\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n conceptTypeHref.endsWith(conceptTypeSetting)\n )\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"STEP\"\n )\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\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);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n \"STEP\"\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"PERSONA\"\n )\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,SAASC,UAAU,QAAQ,0BAA0B;AAOrD;AACA;AACA,MAAMC,qBAAqB,SAASH,kBAAkB,CAAC;EAAA;IAAA;IAAA;EAAA;EAGrD;AACF;EACE,IAAII,IAAI,GAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiB,CAACC,IAAuB,EAAW;IACzD,
|
|
1
|
+
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","PERSONA","SCENARIO","Array","isArray","some","conceptTypeSetting","getInitialChildModelLinks","childModelLinks","scenarioStepLinks","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","relationsToActor","newRelationToActor","actor","key"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\"\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\"\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n conceptTypeHref.endsWith(conceptTypeSetting)\n )\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"STEP\"\n )\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\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);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n \"STEP\"\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"PERSONA\"\n )\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,SAASC,UAAU,QAAQ,0BAA0B;AAOrD;AACA;AACA,MAAMC,qBAAqB,SAASH,kBAAkB,CAAC;EAAA;IAAA;IAAA;EAAA;EAGrD;AACF;EACE,IAAII,IAAI,GAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAAS,GAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiB,CAACC,IAAuB,EAAW;IACzD,OAAOJ,qBAAqB,CAACK,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,EAAEC,IAAI,EACrC,UAAU,CACX;EACH;;EAEA;AACF;EACE,OAAOH,eAAe,CACpBI,eAAwB,EACxBC,WAA4C,EACnC;IACT,IAAI,CAACD,eAAe,EAAE;MACpB,OAAO,KAAK;IACd;IAEA,MAAME,SAAS,GAAG,wCAAwC;IAE1D,MAAMC,mBAAmB,GAAG;MAC1BC,IAA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