@beinformed/ui 1.65.28 → 1.66.0
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 +15 -0
- package/README.md +59 -18
- package/esm/hooks/useErrorHandler.js +26 -0
- package/esm/hooks/useErrorHandler.js.flow +31 -0
- package/esm/hooks/useErrorHandler.js.map +1 -0
- package/esm/hooks/useI18n.js +16 -2
- package/esm/hooks/useI18n.js.flow +21 -2
- package/esm/hooks/useI18n.js.map +1 -1
- package/esm/hooks/useModelSelectors.js +13 -2
- package/esm/hooks/useModelSelectors.js.flow +15 -1
- package/esm/hooks/useModelSelectors.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.flow +1 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +47 -49
- package/esm/models/concepts/ConceptDetailModel.js.flow +37 -52
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +27 -7
- package/esm/redux/_i18n/types.js.flow +16 -0
- package/esm/redux/_i18n/types.js.map +1 -1
- package/esm/redux/_modularui/ModularUISelectors.js +8 -2
- package/esm/redux/_modularui/ModularUISelectors.js.flow +12 -7
- package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/esm/redux/_modularui/types.js.flow +72 -0
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_router/types.js.flow +51 -0
- package/esm/redux/_router/types.js.map +1 -1
- package/esm/redux/types.js.flow +276 -1
- package/esm/redux/types.js.map +1 -1
- package/lib/hooks/useErrorHandler.js +33 -0
- package/lib/hooks/useErrorHandler.js.map +1 -0
- package/lib/hooks/useI18n.js +16 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModelSelectors.js +14 -1
- package/lib/hooks/useModelSelectors.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +1 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +47 -49
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/redux/_i18n/types.js.map +1 -1
- package/lib/redux/_modularui/ModularUISelectors.js +8 -2
- package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_router/types.js.map +1 -1
- package/lib/redux/types.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.66.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.29...v1.66.0) (2026-02-14)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **hooks:** add hooks for update locale and retrieval of application ([25cbb98](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/25cbb98c17eea37d91b6cee9623e263b61068d51))
|
|
11
|
+
* **hooks:** add useErrorHandler hook to dispatch error handle actions ([be2a7a1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/be2a7a193038c91fbbdf948fd9c55cbf6b0c20e6))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* **selector:** retrieve models for active local ([c91b49f](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/c91b49f58973f1d69169f17e964dd107259cf4b7))
|
|
17
|
+
|
|
18
|
+
## [1.65.29](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.28...v1.65.29) (2026-02-06)
|
|
19
|
+
|
|
5
20
|
## [1.65.28](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.27...v1.65.28) (2026-02-02)
|
|
6
21
|
|
|
7
22
|
|
package/README.md
CHANGED
|
@@ -1,32 +1,73 @@
|
|
|
1
1
|
# @beinformed/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`@beinformed/ui` provides the core infrastructure and high-level React building blocks for applications powered by [Be Informed](https://www.beinformed.com) Modular UI services.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It handles the complexities of state management, server-side rendering, and model rehydration, allowing you to focus on building rich user experiences.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- Redux modules for working with modular UI services, and other features required for a complete Be Informed user interface
|
|
9
|
-
- React modules containing:
|
|
10
|
-
- Client setup
|
|
11
|
-
- Server setup
|
|
12
|
-
- Styled-components theming
|
|
13
|
-
- I18n
|
|
14
|
-
- Settings
|
|
15
|
-
- Hooks and redux connectors
|
|
16
|
-
- Generic utils for creating a user interface
|
|
7
|
+
## ✨ Features
|
|
17
8
|
|
|
18
|
-
|
|
9
|
+
- **Model-Driven UI**: Automatically transforms Modular UI service responses into rich JavaScript Class instances (Models) that combine data with metadata and logic.
|
|
10
|
+
- **React-First**: Comprehensive library of hooks and providers for data fetching and state interaction.
|
|
11
|
+
- **SSR Support**: Native pipeline for Java-backed Server-Side Rendering (SSR) with state dehydration and rehydration.
|
|
12
|
+
- **Unified Theming**: A robust design token system built on `styled-components` with automatic accessibility/contrast calculation.
|
|
13
|
+
- **Redux Integration**: Built-in modules for navigation, preferences, i18n, and resource caching.
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
## 📦 Installation
|
|
16
|
+
|
|
17
|
+
Install the library via npm, yarn, pnpm:
|
|
21
18
|
|
|
22
19
|
```bash
|
|
23
20
|
npm install @beinformed/ui
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
##
|
|
23
|
+
## 🚀 Quick Start
|
|
24
|
+
|
|
25
|
+
To use the library, wrap your application in the initialization client. This sets up the Redux store, handles routing, and enables rehydration.
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
import { client } from "@beinformed/ui/react";
|
|
29
|
+
|
|
30
|
+
client({
|
|
31
|
+
theme: { PRIMARY_COLOR: "#0055aa" },
|
|
32
|
+
render: () => <MyApplication />,
|
|
33
|
+
});
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
And a server that is loaded in the Be Informed environment:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import { serverNoSSR } from "@beinformed/ui/react";
|
|
40
|
+
|
|
41
|
+
export const server = (request: HttpServletRequestJava) => {
|
|
42
|
+
setSettings(DEFAULT_SETTINGS);
|
|
43
|
+
return serverNoSSR({
|
|
44
|
+
request,
|
|
45
|
+
render: () => <MyServer />,
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## 📖 Documentation
|
|
27
51
|
|
|
28
|
-
|
|
52
|
+
Detailed usage guides and API references are available to help you build your application:
|
|
29
53
|
|
|
30
|
-
|
|
54
|
+
- **[Initialization & SSR](./docs/usage/react-client.md)** – Setting up the client and server environments.
|
|
55
|
+
- **[Theming System](./docs/usage/react-theme.md)** – Using design tokens and styling utilities.
|
|
56
|
+
- **[React Hooks Cheat Sheet](./docs/usage/index.md)** – A quick reference for fetching data and models.
|
|
57
|
+
- **[Form & Attribute Handling](./docs/usage/forms.md)** – Managing complex state and submissions.
|
|
31
58
|
|
|
32
|
-
|
|
59
|
+
For comprehensive platform documentation, visit the [Be Informed Plaza](https://plaza.beinformed.com/).
|
|
60
|
+
|
|
61
|
+
## 💬 Questions & Feedback
|
|
62
|
+
|
|
63
|
+
We value your input!
|
|
64
|
+
|
|
65
|
+
- **Bugs & Features**: Please file an issue on our [Support Environment](https://support.beinformed.com).
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
© 2026 Be Informed. All rights reserved.
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useDispatch } from "react-redux";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { handleError } from "../redux/actions/Error";
|
|
4
|
+
import FetchException from "../exceptions/FetchException";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A hook that returns a memoized function to handle application-wide errors.
|
|
8
|
+
*
|
|
9
|
+
* By default, this handler orchestrates:
|
|
10
|
+
* - Redirects for unauthorized, blocked, or concurrent users.
|
|
11
|
+
* - Handles forced password change triggers.
|
|
12
|
+
* - Saves the error in the Redux store (server-side).
|
|
13
|
+
* - Triggers global XHR error notifications.
|
|
14
|
+
*/
|
|
15
|
+
export const useErrorHandler = () => {
|
|
16
|
+
const dispatch = useDispatch();
|
|
17
|
+
return useCallback(
|
|
18
|
+
/**
|
|
19
|
+
* @param {string | Error | FetchException} error - The error object or message to process.
|
|
20
|
+
*/
|
|
21
|
+
error => {
|
|
22
|
+
const err = typeof error === "string" ? new Error(error) : error;
|
|
23
|
+
dispatch(handleError(err));
|
|
24
|
+
}, [dispatch]);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useErrorHandler.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { useDispatch } from "react-redux";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { handleError } from "../redux/actions/Error";
|
|
5
|
+
import FetchException from "../exceptions/FetchException";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A hook that returns a memoized function to handle application-wide errors.
|
|
9
|
+
*
|
|
10
|
+
* By default, this handler orchestrates:
|
|
11
|
+
* - Redirects for unauthorized, blocked, or concurrent users.
|
|
12
|
+
* - Handles forced password change triggers.
|
|
13
|
+
* - Saves the error in the Redux store (server-side).
|
|
14
|
+
* - Triggers global XHR error notifications.
|
|
15
|
+
*/
|
|
16
|
+
export const useErrorHandler = (): ((
|
|
17
|
+
error: string | Error | FetchException,
|
|
18
|
+
) => void) => {
|
|
19
|
+
const dispatch = useDispatch();
|
|
20
|
+
|
|
21
|
+
return useCallback(
|
|
22
|
+
/**
|
|
23
|
+
* @param {string | Error | FetchException} error - The error object or message to process.
|
|
24
|
+
*/
|
|
25
|
+
(error: string | Error | FetchException) => {
|
|
26
|
+
const err = typeof error === "string" ? new Error(error) : error;
|
|
27
|
+
dispatch(handleError(err));
|
|
28
|
+
},
|
|
29
|
+
[dispatch],
|
|
30
|
+
);
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useErrorHandler.js","names":["useDispatch","useCallback","handleError","FetchException","useErrorHandler","dispatch","error","err","Error"],"sources":["../../src/hooks/useErrorHandler.js"],"sourcesContent":["// @flow\nimport { useDispatch } from \"react-redux\";\nimport { useCallback } from \"react\";\nimport { handleError } from \"../redux/actions/Error\";\nimport FetchException from \"../exceptions/FetchException\";\n\n/**\n * A hook that returns a memoized function to handle application-wide errors.\n *\n * By default, this handler orchestrates:\n * - Redirects for unauthorized, blocked, or concurrent users.\n * - Handles forced password change triggers.\n * - Saves the error in the Redux store (server-side).\n * - Triggers global XHR error notifications.\n */\nexport const useErrorHandler = (): ((\n error: string | Error | FetchException,\n) => void) => {\n const dispatch = useDispatch();\n\n return useCallback(\n /**\n * @param {string | Error | FetchException} error - The error object or message to process.\n */\n (error: string | Error | FetchException) => {\n const err = typeof error === \"string\" ? new Error(error) : error;\n dispatch(handleError(err));\n },\n [dispatch],\n );\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AACzC,SAASC,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,QAAQ,wBAAwB;AACpD,OAAOC,cAAc,MAAM,8BAA8B;;AAEzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAe,GAAGA,CAAA,KAEjB;EACZ,MAAMC,QAAQ,GAAGL,WAAW,CAAC,CAAC;EAE9B,OAAOC,WAAW;EAChB;AACJ;AACA;EACKK,KAAsC,IAAK;IAC1C,MAAMC,GAAG,GAAG,OAAOD,KAAK,KAAK,QAAQ,GAAG,IAAIE,KAAK,CAACF,KAAK,CAAC,GAAGA,KAAK;IAChED,QAAQ,CAACH,WAAW,CAACK,GAAG,CAAC,CAAC;EAC5B,CAAC,EACD,CAACF,QAAQ,CACX,CAAC;AACH,CAAC","ignoreList":[]}
|
package/esm/hooks/useI18n.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
|
|
2
2
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
4
5
|
import { createSelector } from "reselect";
|
|
5
6
|
import memoize from "lodash/memoize";
|
|
6
7
|
import { getLocales, getLocale } from "../redux/selectors/i18n";
|
|
8
|
+
import { updateLocale } from "../redux/_i18n/I18nActions";
|
|
7
9
|
const getMessage = createSelector([getLocales, getLocale], (locales, localeCode) => memoize((id, defaultMessage, placeholders) => locales.getLocale(localeCode).getMessage(id, defaultMessage, placeholders), (...args) => _JSON$stringify(args)));
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -23,5 +25,17 @@ const getLocaleCodes = createSelector(state => state.i18n.locales, locales => _m
|
|
|
23
25
|
* Retrieve all available locale codes
|
|
24
26
|
*/
|
|
25
27
|
const useLocaleCodes = () => useSelector(getLocaleCodes);
|
|
26
|
-
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A hook that returns a memoized function to update the application locale.
|
|
31
|
+
*
|
|
32
|
+
* @returns {(locale: string) => void} A memoized function to update the locale.
|
|
33
|
+
*/
|
|
34
|
+
const useUpdateLocale = () => {
|
|
35
|
+
const dispatch = useDispatch();
|
|
36
|
+
return useCallback(locale => {
|
|
37
|
+
dispatch(updateLocale(locale));
|
|
38
|
+
}, [dispatch]);
|
|
39
|
+
};
|
|
40
|
+
export { useTranslate, useMessage, useLocale, useLocaleCodes, useUpdateLocale };
|
|
27
41
|
//# sourceMappingURL=useI18n.js.map
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import {
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
3
4
|
import { createSelector } from "reselect";
|
|
5
|
+
|
|
4
6
|
import memoize from "lodash/memoize";
|
|
5
7
|
|
|
6
8
|
import { getLocales, getLocale } from "../redux/selectors/i18n";
|
|
9
|
+
import { updateLocale } from "../redux/_i18n/I18nActions";
|
|
7
10
|
|
|
8
11
|
const getMessage = createSelector(
|
|
9
12
|
[getLocales, getLocale],
|
|
@@ -43,4 +46,20 @@ const getLocaleCodes = createSelector(
|
|
|
43
46
|
*/
|
|
44
47
|
const useLocaleCodes = (): Array<string> => useSelector(getLocaleCodes);
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
/**
|
|
50
|
+
* A hook that returns a memoized function to update the application locale.
|
|
51
|
+
*
|
|
52
|
+
* @returns {(locale: string) => void} A memoized function to update the locale.
|
|
53
|
+
*/
|
|
54
|
+
const useUpdateLocale = (): ((locale: string) => void) => {
|
|
55
|
+
const dispatch = useDispatch();
|
|
56
|
+
|
|
57
|
+
return useCallback(
|
|
58
|
+
(locale: string) => {
|
|
59
|
+
dispatch(updateLocale(locale));
|
|
60
|
+
},
|
|
61
|
+
[dispatch],
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useTranslate, useMessage, useLocale, useLocaleCodes, useUpdateLocale };
|
package/esm/hooks/useI18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useI18n.js","names":["useSelector","createSelector","memoize","getLocales","getLocale","getMessage","locales","localeCode","id","defaultMessage","placeholders","args","_JSON$stringify","useMessage","useTranslate","useLocale","getLocaleCodes","state","i18n","_mapInstanceProperty","call","locale","code","useLocaleCodes"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args),\n ),\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null,\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nconst getLocaleCodes = createSelector(\n (state) => state.i18n.locales,\n (locales) => locales.map((locale) => locale.code),\n);\n\n/**\n * Retrieve all available locale codes\n */\nconst useLocaleCodes = (): Array<string> => useSelector(getLocaleCodes);\n\nexport { useTranslate, useMessage, useLocale, useLocaleCodes };\n"],"mappings":";;AACA,SAASA,WAAW,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"useI18n.js","names":["useCallback","useDispatch","useSelector","createSelector","memoize","getLocales","getLocale","updateLocale","getMessage","locales","localeCode","id","defaultMessage","placeholders","args","_JSON$stringify","useMessage","useTranslate","useLocale","getLocaleCodes","state","i18n","_mapInstanceProperty","call","locale","code","useLocaleCodes","useUpdateLocale","dispatch"],"sources":["../../src/hooks/useI18n.js"],"sourcesContent":["// @flow\nimport { useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { createSelector } from \"reselect\";\n\nimport memoize from \"lodash/memoize\";\n\nimport { getLocales, getLocale } from \"../redux/selectors/i18n\";\nimport { updateLocale } from \"../redux/_i18n/I18nActions\";\n\nconst getMessage = createSelector(\n [getLocales, getLocale],\n (locales, localeCode) =>\n memoize(\n (id: string, defaultMessage?: string, placeholders?: Object) =>\n locales\n .getLocale(localeCode)\n .getMessage(id, defaultMessage, placeholders),\n (...args) => JSON.stringify(args),\n ),\n);\n\n/**\n */\nconst useMessage = (\n id: string,\n defaultMessage?: string,\n placeholders?: Object | null,\n): any => useSelector(getMessage)(id, defaultMessage, placeholders);\n\n/**\n */\nconst useTranslate = (): ((...any) => any) => useSelector(getMessage);\n\n/**\n */\nconst useLocale = (): string => useSelector(getLocale);\n\nconst getLocaleCodes = createSelector(\n (state) => state.i18n.locales,\n (locales) => locales.map((locale) => locale.code),\n);\n\n/**\n * Retrieve all available locale codes\n */\nconst useLocaleCodes = (): Array<string> => useSelector(getLocaleCodes);\n\n/**\n * A hook that returns a memoized function to update the application locale.\n *\n * @returns {(locale: string) => void} A memoized function to update the locale.\n */\nconst useUpdateLocale = (): ((locale: string) => void) => {\n const dispatch = useDispatch();\n\n return useCallback(\n (locale: string) => {\n dispatch(updateLocale(locale));\n },\n [dispatch],\n );\n};\n\nexport { useTranslate, useMessage, useLocale, useLocaleCodes, useUpdateLocale };\n"],"mappings":";;AACA,SAASA,WAAW,QAAQ,OAAO;AACnC,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,cAAc,QAAQ,UAAU;AAEzC,OAAOC,OAAO,MAAM,gBAAgB;AAEpC,SAASC,UAAU,EAAEC,SAAS,QAAQ,yBAAyB;AAC/D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,MAAMC,UAAU,GAAGL,cAAc,CAC/B,CAACE,UAAU,EAAEC,SAAS,CAAC,EACvB,CAACG,OAAO,EAAEC,UAAU,KAClBN,OAAO,CACL,CAACO,EAAU,EAAEC,cAAuB,EAAEC,YAAqB,KACzDJ,OAAO,CACJH,SAAS,CAACI,UAAU,CAAC,CACrBF,UAAU,CAACG,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC,EACjD,CAAC,GAAGC,IAAI,KAAKC,eAAA,CAAeD,IAAI,CAClC,CACJ,CAAC;;AAED;AACA;AACA,MAAME,UAAU,GAAGA,CACjBL,EAAU,EACVC,cAAuB,EACvBC,YAA4B,KACpBX,WAAW,CAACM,UAAU,CAAC,CAACG,EAAE,EAAEC,cAAc,EAAEC,YAAY,CAAC;;AAEnE;AACA;AACA,MAAMI,YAAY,GAAGA,CAAA,KAAyBf,WAAW,CAACM,UAAU,CAAC;;AAErE;AACA;AACA,MAAMU,SAAS,GAAGA,CAAA,KAAchB,WAAW,CAACI,SAAS,CAAC;AAEtD,MAAMa,cAAc,GAAGhB,cAAc,CAClCiB,KAAK,IAAKA,KAAK,CAACC,IAAI,CAACZ,OAAO,EAC5BA,OAAO,IAAKa,oBAAA,CAAAb,OAAO,EAAAc,IAAA,CAAPd,OAAO,EAAMe,MAAM,IAAKA,MAAM,CAACC,IAAI,CAClD,CAAC;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAAGA,CAAA,KAAqBxB,WAAW,CAACiB,cAAc,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA,MAAMQ,eAAe,GAAGA,CAAA,KAAkC;EACxD,MAAMC,QAAQ,GAAG3B,WAAW,CAAC,CAAC;EAE9B,OAAOD,WAAW,CACfwB,MAAc,IAAK;IAClBI,QAAQ,CAACrB,YAAY,CAACiB,MAAM,CAAC,CAAC;EAChC,CAAC,EACD,CAACI,QAAQ,CACX,CAAC;AACH,CAAC;AAED,SAASX,YAAY,EAAED,UAAU,EAAEE,SAAS,EAAEQ,cAAc,EAAEC,eAAe","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useSelector } from "react-redux";
|
|
2
|
-
import { getAllModelsByInstance, getFirstModelByInstance, getActiveModelByInstance, modelByHref, keyByHref, allKeysByHref, getActiveModels, getAllFinishedModels } from "../redux/_modularui/ModularUISelectors";
|
|
2
|
+
import { getAllModelsByInstance, getFirstModelByInstance, getActiveModelByInstance, modelByHref, keyByHref, allKeysByHref, getActiveModels, getAllFinishedModels, getApplication } from "../redux/_modularui/ModularUISelectors";
|
|
3
3
|
import Href from "../models/href/Href";
|
|
4
|
-
|
|
4
|
+
import ApplicationModel from "../models/application/ApplicationModel";
|
|
5
5
|
/**
|
|
6
6
|
* Returns all models in the store that are instances of the provided class
|
|
7
7
|
* and match the current application locale.
|
|
@@ -70,4 +70,15 @@ export const useActiveModels = () => {
|
|
|
70
70
|
export const useAllFinishedModels = () => {
|
|
71
71
|
return useSelector(getAllFinishedModels);
|
|
72
72
|
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns the current active application, without retrying to request it.
|
|
76
|
+
*/
|
|
77
|
+
export const useCurrentApplication = () => {
|
|
78
|
+
const application = useSelector(getApplication);
|
|
79
|
+
if (application instanceof ApplicationModel) {
|
|
80
|
+
return application;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
73
84
|
//# sourceMappingURL=useModelSelectors.js.map
|
|
@@ -10,10 +10,13 @@ import {
|
|
|
10
10
|
allKeysByHref,
|
|
11
11
|
getActiveModels,
|
|
12
12
|
getAllFinishedModels,
|
|
13
|
+
getApplication,
|
|
13
14
|
} from "../redux/_modularui/ModularUISelectors";
|
|
15
|
+
import Href from "../models/href/Href";
|
|
16
|
+
import ApplicationModel from "../models/application/ApplicationModel";
|
|
17
|
+
|
|
14
18
|
import type { ModularUIModel } from "../models/types";
|
|
15
19
|
import type { ReduxState } from "../redux/types";
|
|
16
|
-
import Href from "../models/href/Href";
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Returns all models in the store that are instances of the provided class
|
|
@@ -96,3 +99,14 @@ export const useActiveModels = (): Array<{
|
|
|
96
99
|
export const useAllFinishedModels = (): Array<ModularUIModel> => {
|
|
97
100
|
return useSelector(getAllFinishedModels);
|
|
98
101
|
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Returns the current active application, without retrying to request it.
|
|
105
|
+
*/
|
|
106
|
+
export const useCurrentApplication = (): ApplicationModel | null => {
|
|
107
|
+
const application = useSelector(getApplication);
|
|
108
|
+
if (application instanceof ApplicationModel) {
|
|
109
|
+
return application;
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModelSelectors.js","names":["useSelector","getAllModelsByInstance","getFirstModelByInstance","getActiveModelByInstance","modelByHref","keyByHref","allKeysByHref","getActiveModels","getAllFinishedModels","Href","useAllModelsByInstance","instance","state","useFirstModelByInstance","useActiveModelByInstance","useModelByHref","href","useKeyByHref","useAllKeysByHref","useActiveModels","useAllFinishedModels"],"sources":["../../src/hooks/useModelSelectors.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\n\nimport {\n getAllModelsByInstance,\n getFirstModelByInstance,\n getActiveModelByInstance,\n modelByHref,\n keyByHref,\n allKeysByHref,\n getActiveModels,\n getAllFinishedModels,\n} from \"../redux/_modularui/ModularUISelectors\";\nimport
|
|
1
|
+
{"version":3,"file":"useModelSelectors.js","names":["useSelector","getAllModelsByInstance","getFirstModelByInstance","getActiveModelByInstance","modelByHref","keyByHref","allKeysByHref","getActiveModels","getAllFinishedModels","getApplication","Href","ApplicationModel","useAllModelsByInstance","instance","state","useFirstModelByInstance","useActiveModelByInstance","useModelByHref","href","useKeyByHref","useAllKeysByHref","useActiveModels","useAllFinishedModels","useCurrentApplication","application"],"sources":["../../src/hooks/useModelSelectors.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\n\nimport {\n getAllModelsByInstance,\n getFirstModelByInstance,\n getActiveModelByInstance,\n modelByHref,\n keyByHref,\n allKeysByHref,\n getActiveModels,\n getAllFinishedModels,\n getApplication,\n} from \"../redux/_modularui/ModularUISelectors\";\nimport Href from \"../models/href/Href\";\nimport ApplicationModel from \"../models/application/ApplicationModel\";\n\nimport type { ModularUIModel } from \"../models/types\";\nimport type { ReduxState } from \"../redux/types\";\n\n/**\n * Returns all models in the store that are instances of the provided class\n * and match the current application locale.\n */\nexport const useAllModelsByInstance = <T>(\n instance: Class<T>,\n): Array<ModularUIModel> => {\n return useSelector((state: ReduxState) =>\n getAllModelsByInstance(state, instance),\n );\n};\n\n/**\n * Returns the first model found in the store that is an instance of the\n * provided class and matches the current locale.\n */\nexport const useFirstModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getFirstModelByInstance(state, instance),\n );\n};\n\n/**\n * Returns the model instance that is currently \"active\" based on the URL path.\n * It checks if the current router location starts with the model's selfhref path.\n */\nexport const useActiveModelByInstance = <T>(instance: Class<T>): T | null => {\n return useSelector((state: ReduxState) =>\n getActiveModelByInstance(state, instance),\n );\n};\n\n/**\n * Retrieves a specific model from the store based on its unique Href.\n * @param {Href | string} href - The Href object or string path of the model.\n * @returns {ModularUIModel | null} The model matching the href or null.\n */\nexport const useModelByHref = (href: Href | string): null | ModularUIModel => {\n return useSelector((state: ReduxState) => modelByHref(state, href));\n};\n\n/**\n * Returns the unique store key (identifier) for a model associated with a specific Href.\n * @param {Href | string} href - The Href object or string path.\n * @returns {string | null | void} The internal key of the model.\n */\nexport const useKeyByHref = (href: Href | string): ?string => {\n return useSelector((state: ReduxState) => keyByHref(state, href));\n};\n\n/**\n * Returns all internal keys found in the store for a specific Href.\n * Useful if multiple versions/entries exist for the same path.\n * @param {Href | string} href - The Href object or string path.\n * @returns {Array<string>} An array of keys.\n */\nexport const useAllKeysByHref = (href: Href | string): Array<string> => {\n return useSelector((state: ReduxState) => allKeysByHref(state, href));\n};\n\n/**\n * Returns a list of simplified model info (key, href, label, type) for all\n * models currently active in the navigation context (breadcrumbs).\n * @returns {Array<{key: string, href: Href, label: string, type: string}>}\n */\nexport const useActiveModels = (): Array<{\n key: string,\n href: Href,\n label: string,\n type: string,\n}> => {\n return useSelector(getActiveModels);\n};\n\n/**\n * Returns all models in the store that have a status of MODULARUI_STATUS.FINISHED.\n * @returns {Array<ModularUIModel>} An array of fully loaded models.\n */\nexport const useAllFinishedModels = (): Array<ModularUIModel> => {\n return useSelector(getAllFinishedModels);\n};\n\n/**\n * Returns the current active application, without retrying to request it.\n */\nexport const useCurrentApplication = (): ApplicationModel | null => {\n const application = useSelector(getApplication);\n if (application instanceof ApplicationModel) {\n return application;\n }\n return null;\n};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,aAAa;AAEzC,SACEC,sBAAsB,EACtBC,uBAAuB,EACvBC,wBAAwB,EACxBC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,eAAe,EACfC,oBAAoB,EACpBC,cAAc,QACT,wCAAwC;AAC/C,OAAOC,IAAI,MAAM,qBAAqB;AACtC,OAAOC,gBAAgB,MAAM,wCAAwC;AAKrE;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GACjCC,QAAkB,IACQ;EAC1B,OAAOb,WAAW,CAAEc,KAAiB,IACnCb,sBAAsB,CAACa,KAAK,EAAED,QAAQ,CACxC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAME,uBAAuB,GAAOF,QAAkB,IAAe;EAC1E,OAAOb,WAAW,CAAEc,KAAiB,IACnCZ,uBAAuB,CAACY,KAAK,EAAED,QAAQ,CACzC,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMG,wBAAwB,GAAOH,QAAkB,IAAe;EAC3E,OAAOb,WAAW,CAAEc,KAAiB,IACnCX,wBAAwB,CAACW,KAAK,EAAED,QAAQ,CAC1C,CAAC;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,cAAc,GAAIC,IAAmB,IAA4B;EAC5E,OAAOlB,WAAW,CAAEc,KAAiB,IAAKV,WAAW,CAACU,KAAK,EAAEI,IAAI,CAAC,CAAC;AACrE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,GAAID,IAAmB,IAAc;EAC5D,OAAOlB,WAAW,CAAEc,KAAiB,IAAKT,SAAS,CAACS,KAAK,EAAEI,IAAI,CAAC,CAAC;AACnE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,gBAAgB,GAAIF,IAAmB,IAAoB;EACtE,OAAOlB,WAAW,CAAEc,KAAiB,IAAKR,aAAa,CAACQ,KAAK,EAAEI,IAAI,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMG,eAAe,GAAGA,CAAA,KAKzB;EACJ,OAAOrB,WAAW,CAACO,eAAe,CAAC;AACrC,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMe,oBAAoB,GAAGA,CAAA,KAA6B;EAC/D,OAAOtB,WAAW,CAACQ,oBAAoB,CAAC;AAC1C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMe,qBAAqB,GAAGA,CAAA,KAA+B;EAClE,MAAMC,WAAW,GAAGxB,WAAW,CAACS,cAAc,CAAC;EAC/C,IAAIe,WAAW,YAAYb,gBAAgB,EAAE;IAC3C,OAAOa,WAAW;EACpB;EACA,OAAO,IAAI;AACb,CAAC","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ import ConceptDetailModel from "./ConceptDetailModel";
|
|
|
7
7
|
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
8
8
|
import { getSetting } from "../../constants/Settings";
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated use the ConceptDetailModel with concept type BusinessScenarios#BusinessScenario
|
|
10
11
|
*/
|
|
11
12
|
class BusinessScenarioModel extends ConceptDetailModel {
|
|
12
13
|
constructor(...args) {
|
|
@@ -10,6 +10,7 @@ import type ConceptLinkModel from "./ConceptLinkModel";
|
|
|
10
10
|
import type ErrorResponse from "../error/ErrorResponse";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
+
* @deprecated use the ConceptDetailModel with concept type BusinessScenarios#BusinessScenario
|
|
13
14
|
*/
|
|
14
15
|
class BusinessScenarioModel extends ConceptDetailModel {
|
|
15
16
|
_scenarioSteps: Array<ConceptDetailModel>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","constructor","args","_defineProperty","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingNames","Array","isArray","TypeError","pathToKmt","conceptTypeSettings","STEP","PERSONA","SYSTEM","SCENARIO","decodedConceptTypeHref","decodeURIComponent","some","settingName","conceptTypeSetting","_endsWithInstanceProperty","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_mapInstanceProperty","_filterInstanceProperty","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","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\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\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 settingNames: Array<\"STEP\" | \"PERSONA\" | \"SCENARIO\" | \"SYSTEM\">,\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n // Check if settingNames is an array\n if (!Array.isArray(settingNames)) {\n throw new TypeError(\"settingNames must be an array\");\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 SYSTEM: getSetting(\"BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE\", [\n `${pathToKmt}/System`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n\n return settingNames.some(\n (settingName) =>\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.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>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n\n 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\", \"SYSTEM\"],\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;AAQrD;AACA;AACA,MAAMC,qBAAqB,SAASH,kBAAkB,CAAC;EAAAI,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;EAAA;EAGrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OAAOP,qBAAqB,CAACQ,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,EAAEC,IAAI,EACrC,CA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ACF;EACE,IAAIA,aAAaA,CAACN,MAAiC,EAAE;IACnD,IAAI,CAACS,cAAc,GAAGT,MAAM;EAC9B;;EAEA;AACF;EACE,IAAIM,aAAaA,CAAA,EAA8B;IAC7C,OAAO,IAAI,CAACG,cAAc;EAC5B;;EAEA;AACF;EACE,IAAIC,MAAMA,CAAA,EAA4B;IACpC,MAAMA,MAAM,GAAG,EAAE;IAEjB,IAAI,CAACJ,aAAa,CAACK,OAAO,CAAEC,YAAY,IAAK;MAAA,IAAAC,SAAA;MAC3C,MAAMC,gBAAgB,GAAGX,qBAAA,CAAAU,SAAA,GAAAD,YAAY,CAACvB,mBAAmB,EAAAR,IAAA,CAAAgC,SAAA,EACtDtB,QAAQ,IACPA,QAAQ,CAACC,SAAS,KAAK,UAAU,IACjCxC,qBAAqB,CAACQ,eAAe,CACnC+B,QAAQ,CAACE,OAAO,CAACC,eAAe,EAAEC,IAAI,EACtC,CAAC,SAAS,EAAE,QAAQ,CACtB,CACJ,CAAC;MAED,MAAMoB,kBAAkB,GACtBD,gBAAgB,IAChB,CAACJ,MAAM,CAACjC,IAAI,CAAEuC,KAAK,IAAKA,KAAK,CAACC,GAAG,KAAKH,gBAAgB,CAACrB,OAAO,CAACwB,GAAG,CAAC;MAErE,IAAIH,gBAAgB,IAAIC,kBAAkB,EAAE;QAC1CL,MAAM,CAACZ,IAAI,CAACgB,gBAAgB,CAACrB,OAAO,CAAC;MACvC;IACF,CAAC,CAAC;IAEF,OAAOiB,MAAM;EACf;AACF;AAEA,eAAe1D,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","constructor","args","_defineProperty","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingNames","Array","isArray","TypeError","pathToKmt","conceptTypeSettings","STEP","PERSONA","SYSTEM","SCENARIO","decodedConceptTypeHref","decodeURIComponent","some","settingName","conceptTypeSetting","_endsWithInstanceProperty","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_mapInstanceProperty","_filterInstanceProperty","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","errors","conceptTypeModel","_findInstanceProperty","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","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\";\nimport type ErrorResponse from \"../error/ErrorResponse\";\n\n/**\n * @deprecated use the ConceptDetailModel with concept type BusinessScenarios#BusinessScenario\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 settingNames: Array<\"STEP\" | \"PERSONA\" | \"SCENARIO\" | \"SYSTEM\">,\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n // Check if settingNames is an array\n if (!Array.isArray(settingNames)) {\n throw new TypeError(\"settingNames must be an array\");\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 SYSTEM: getSetting(\"BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE\", [\n `${pathToKmt}/System`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n\n return settingNames.some(\n (settingName) =>\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.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>, errors: Array<ErrorResponse>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models, errors);\n\n 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\", \"SYSTEM\"],\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;AAQrD;AACA;AACA;AACA,MAAMC,qBAAqB,SAASH,kBAAkB,CAAC;EAAAI,YAAA,GAAAC,IAAA;IAAA,SAAAA,IAAA;IAAAC,eAAA;EAAA;EAGrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OAAOP,qBAAqB,CAACQ,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,EAAEC,IAAI,EACrC,CAAC,UAAU,CACb,CAAC;EACH;;EAEA;AACF;EACE,OAAOH,eAAeA,CACpBI,eAAwB,EACxBC,YAA+D,EACtD;IACT,IAAI,CAACD,eAAe,EAAE;MACpB,OAAO,KAAK;IACd;;IAEA;IACA,IAAI,CAACE,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;MAChC,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ACpC,MAAMA,MAAM,GAAG,EAAE;IAEjB,IAAI,CAACJ,aAAa,CAACK,OAAO,CAAEC,YAAY,IAAK;MAAA,IAAAC,SAAA;MAC3C,MAAMC,gBAAgB,GAAGX,qBAAA,CAAAU,SAAA,GAAAD,YAAY,CAACvB,mBAAmB,EAAAR,IAAA,CAAAgC,SAAA,EACtDtB,QAAQ,IACPA,QAAQ,CAACC,SAAS,KAAK,UAAU,IACjCxC,qBAAqB,CAACQ,eAAe,CACnC+B,QAAQ,CAACE,OAAO,CAACC,eAAe,EAAEC,IAAI,EACtC,CAAC,SAAS,EAAE,QAAQ,CACtB,CACJ,CAAC;MAED,MAAMoB,kBAAkB,GACtBD,gBAAgB,IAChB,CAACJ,MAAM,CAACjC,IAAI,CAAEuC,KAAK,IAAKA,KAAK,CAACC,GAAG,KAAKH,gBAAgB,CAACrB,OAAO,CAACwB,GAAG,CAAC;MAErE,IAAIH,gBAAgB,IAAIC,kBAAkB,EAAE;QAC1CL,MAAM,CAACZ,IAAI,CAACgB,gBAAgB,CAACrB,OAAO,CAAC;MACvC;IACF,CAAC,CAAC;IAEF,OAAOiB,MAAM;EACf;AACF;AAEA,eAAe1D,qBAAqB","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
|
|
2
2
|
import _findInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
4
|
-
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
3
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
4
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
5
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
6
6
|
import _endsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/ends-with";
|
|
7
7
|
import ResourceModel from "../base/ResourceModel";
|
|
8
8
|
import ConceptRelationCollection from "./ConceptRelationCollection";
|
|
@@ -141,80 +141,78 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
141
141
|
return this.data.formula;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
/**
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
getElements(propName, typePropName) {
|
|
148
|
+
// $FlowIssue
|
|
149
|
+
const elementTypes = this.conceptType?.[typePropName] ?? [];
|
|
150
|
+
const allElements = this.data[propName] ?? [];
|
|
151
|
+
const elements = [];
|
|
152
|
+
const usedElementTypes = [];
|
|
153
|
+
for (const element of allElements) {
|
|
154
|
+
const elementType = _findInstanceProperty(elementTypes).call(elementTypes, elType => elType._id === element.type);
|
|
155
|
+
if (elementType) {
|
|
156
|
+
elements.push({
|
|
157
|
+
...elementType,
|
|
158
|
+
...element
|
|
159
|
+
});
|
|
160
|
+
usedElementTypes.push(elementType._id);
|
|
161
|
+
} else {
|
|
162
|
+
elements.push(element);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
for (const elementType of elementTypes) {
|
|
166
|
+
if (!_includesInstanceProperty(usedElementTypes).call(usedElementTypes, elementType._id)) {
|
|
167
|
+
elements.push(elementType);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return elements;
|
|
171
|
+
}
|
|
172
|
+
|
|
144
173
|
/**
|
|
145
174
|
* Get additional labels of concept
|
|
146
175
|
*/
|
|
147
176
|
get labels() {
|
|
148
|
-
|
|
149
|
-
return this.conceptType?.labelTypes ? _mapInstanceProperty(_context = this.conceptType.labelTypes).call(_context, labelType => {
|
|
150
|
-
var _context2;
|
|
151
|
-
const setting = this.data.labels ? _findInstanceProperty(_context2 = this.data.labels).call(_context2, label => label.type === labelType._id) : {};
|
|
152
|
-
return {
|
|
153
|
-
...labelType,
|
|
154
|
-
...setting
|
|
155
|
-
};
|
|
156
|
-
}) : [];
|
|
177
|
+
return this.getElements("labels", "labelTypes");
|
|
157
178
|
}
|
|
158
179
|
|
|
159
180
|
/**
|
|
160
181
|
* Get label elements by id
|
|
161
182
|
*/
|
|
162
183
|
getLabelElementByIds(ids) {
|
|
163
|
-
var
|
|
164
|
-
return _filterInstanceProperty(
|
|
184
|
+
var _context;
|
|
185
|
+
return _filterInstanceProperty(_context = this.labels).call(_context, label => _includesInstanceProperty(ids).call(ids, label._id));
|
|
165
186
|
}
|
|
166
187
|
|
|
167
188
|
/**
|
|
168
189
|
* Get concept properties
|
|
169
190
|
*/
|
|
170
191
|
get conceptProperties() {
|
|
171
|
-
|
|
172
|
-
return this.conceptType?.propertyTypes ? _mapInstanceProperty(_context4 = this.conceptType.propertyTypes).call(_context4, propertyType => {
|
|
173
|
-
var _context5;
|
|
174
|
-
const setting = this.data.properties ? _findInstanceProperty(_context5 = this.data.properties).call(_context5, property => property.type === propertyType._id) : {};
|
|
175
|
-
return {
|
|
176
|
-
...propertyType,
|
|
177
|
-
...setting
|
|
178
|
-
};
|
|
179
|
-
}) : [];
|
|
192
|
+
return this.getElements("properties", "propertyTypes");
|
|
180
193
|
}
|
|
181
194
|
|
|
182
195
|
/**
|
|
183
196
|
* Get concept properties by id
|
|
184
197
|
*/
|
|
185
198
|
getConceptPropertiesByIds(ids) {
|
|
186
|
-
var
|
|
187
|
-
return _filterInstanceProperty(
|
|
199
|
+
var _context2;
|
|
200
|
+
return _filterInstanceProperty(_context2 = this.conceptProperties).call(_context2, property => _includesInstanceProperty(ids).call(ids, property._id));
|
|
188
201
|
}
|
|
189
202
|
|
|
190
203
|
/**
|
|
191
204
|
* Get Text fragments
|
|
192
205
|
*/
|
|
193
206
|
get textfragments() {
|
|
194
|
-
|
|
195
|
-
const textFragments = this.data.textFragments ? _mapInstanceProperty(_context7 = this.data.textFragments).call(_context7, textFragment => {
|
|
196
|
-
var _context8, _context9;
|
|
197
|
-
const textFragmentConfig = ((_context8 = this.conceptType) == null ? void 0 : Function.call.bind(_findInstanceProperty(_context9 = _context8.textFragmentTypes), _context9))?.(textFragmentType => textFragment.type === textFragmentType._id);
|
|
198
|
-
return {
|
|
199
|
-
...textFragmentConfig,
|
|
200
|
-
...textFragment
|
|
201
|
-
};
|
|
202
|
-
}) : [];
|
|
203
|
-
const notConfiguredTextFragments = this.conceptType?.textFragmentTypes ? _filterInstanceProperty(_context0 = this.conceptType.textFragmentTypes).call(_context0, textFragmentType => {
|
|
204
|
-
if (!this.data.textFragments) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
return !this.data.textFragments.some(textfragment => textfragment.type === textFragmentType._id);
|
|
208
|
-
}) : [];
|
|
209
|
-
return [...textFragments, ...notConfiguredTextFragments];
|
|
207
|
+
return this.getElements("textFragments", "textFragmentTypes");
|
|
210
208
|
}
|
|
211
209
|
|
|
212
210
|
/**
|
|
213
211
|
* Get text fragments by id
|
|
214
212
|
*/
|
|
215
213
|
getTextFragmentByKeys(keys) {
|
|
216
|
-
var
|
|
217
|
-
return _filterInstanceProperty(
|
|
214
|
+
var _context3;
|
|
215
|
+
return _filterInstanceProperty(_context3 = this.textfragments).call(_context3, textfragment => _includesInstanceProperty(keys).call(keys, textfragment.type));
|
|
218
216
|
}
|
|
219
217
|
|
|
220
218
|
/**
|
|
@@ -240,21 +238,21 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
240
238
|
getSourceReferencesForCurrentLanguage(availableLocales) {
|
|
241
239
|
const LANGUAGE_POSTFIX_LENGTH = 3;
|
|
242
240
|
if (this.data.sourceReferences) {
|
|
243
|
-
var
|
|
244
|
-
const availableLanguagesInSourceReferences = _mapInstanceProperty(
|
|
241
|
+
var _context4, _context7;
|
|
242
|
+
const availableLanguagesInSourceReferences = _mapInstanceProperty(_context4 = this.data.sourceReferences).call(_context4, sourceReference => sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH));
|
|
245
243
|
const currentLanguagePostfix = `_${this.locale}`;
|
|
246
244
|
if (_includesInstanceProperty(availableLanguagesInSourceReferences).call(availableLanguagesInSourceReferences, currentLanguagePostfix)) {
|
|
247
|
-
var
|
|
245
|
+
var _context5;
|
|
248
246
|
// return all sourceReferences that end with language that is selected
|
|
249
|
-
return _filterInstanceProperty(
|
|
250
|
-
var
|
|
251
|
-
return _endsWithInstanceProperty(
|
|
247
|
+
return _filterInstanceProperty(_context5 = this.data.sourceReferences).call(_context5, sourceReference => {
|
|
248
|
+
var _context6;
|
|
249
|
+
return _endsWithInstanceProperty(_context6 = sourceReference.type).call(_context6, currentLanguagePostfix);
|
|
252
250
|
});
|
|
253
251
|
}
|
|
254
252
|
const availableLanguages = _mapInstanceProperty(availableLocales).call(availableLocales, locale => `_${locale.split("-")[0]}`);
|
|
255
253
|
|
|
256
254
|
// return all sourceReferences that do not end with language postfix
|
|
257
|
-
return _filterInstanceProperty(
|
|
255
|
+
return _filterInstanceProperty(_context7 = this.data.sourceReferences).call(_context7, sourceReference => !_includesInstanceProperty(availableLanguages).call(availableLanguages, sourceReference.type.substring(sourceReference.type.length - LANGUAGE_POSTFIX_LENGTH)));
|
|
258
256
|
}
|
|
259
257
|
return [];
|
|
260
258
|
}
|