@beinformed/ui 1.13.5 → 1.14.1
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/Settings.js +4 -0
- package/esm/constants/Settings.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +25 -6
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +3 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/redux/actions/Authorization.js +2 -1
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/utils/helpers/checkResourceExists.js +23 -0
- package/esm/utils/helpers/checkResourceExists.js.map +1 -0
- package/esm/utils/index.js +2 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/constants/Settings.js +4 -0
- package/lib/constants/Settings.js.flow +8 -0
- package/lib/constants/Settings.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +27 -6
- package/lib/models/concepts/BusinessScenarioModel.js.flow +47 -11
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/href/Href.js.flow +2 -2
- package/lib/models/href/Href.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js +3 -1
- package/lib/react-server/renderSSRComplete.js.flow +2 -0
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/redux/actions/Authorization.js +2 -1
- package/lib/redux/actions/Authorization.js.flow +1 -0
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/utils/helpers/checkResourceExists.js +34 -0
- package/lib/utils/helpers/checkResourceExists.js.flow +21 -0
- package/lib/utils/helpers/checkResourceExists.js.map +1 -0
- package/lib/utils/index.js +14 -0
- package/lib/utils/index.js.flow +1 -0
- package/lib/utils/index.js.map +1 -1
- package/package.json +12 -12
- package/src/constants/Settings.js +8 -0
- package/src/models/concepts/BusinessScenarioModel.js +47 -11
- package/src/models/href/Href.js +2 -2
- package/src/react-server/renderSSRComplete.js +2 -0
- package/src/redux/actions/Authorization.js +1 -0
- package/src/utils/helpers/checkResourceExists.js +21 -0
- package/src/utils/index.js +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ConceptDetailModel from "./ConceptDetailModel";
|
|
3
3
|
import ConceptTypeDetailModel from "./ConceptTypeDetailModel";
|
|
4
|
+
import { getSetting } from "../../constants/Settings";
|
|
4
5
|
|
|
5
6
|
import type { ModularUIResponse } from "../../modularui";
|
|
6
7
|
import type { ModularUIModel } from "../types";
|
|
@@ -21,13 +22,43 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
21
22
|
/**
|
|
22
23
|
*/
|
|
23
24
|
static isApplicableModel(data: ModularUIResponse): boolean {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"/concepttypes/Library/KMTs/Business scenarios.bixml/BusinessScenario"
|
|
25
|
+
return BusinessScenarioModel.isOfConceptType(
|
|
26
|
+
data?.data?._links?.concepttype?.href,
|
|
27
|
+
"SCENARIO"
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
*/
|
|
33
|
+
static isOfConceptType(
|
|
34
|
+
conceptTypeHref: ?string,
|
|
35
|
+
settingName: "STEP" | "PERSONA" | "SCENARIO"
|
|
36
|
+
): boolean {
|
|
37
|
+
if (!conceptTypeHref) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const pathToKmt = "/Library/KMTs/Business scenarios.bixml";
|
|
42
|
+
|
|
43
|
+
const conceptTypeSettings = {
|
|
44
|
+
STEP: getSetting(
|
|
45
|
+
"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE",
|
|
46
|
+
`${pathToKmt}/ScenarioStep`
|
|
47
|
+
),
|
|
48
|
+
PERSONA: getSetting(
|
|
49
|
+
"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE",
|
|
50
|
+
`${pathToKmt}/Persona`
|
|
51
|
+
),
|
|
52
|
+
SCENARIO: getSetting(
|
|
53
|
+
"BUSINESS_SCENARIO_CONCEPT_TYPE",
|
|
54
|
+
`${pathToKmt}/BusinessScenario`
|
|
55
|
+
),
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const conceptTypeSetting = conceptTypeSettings[settingName];
|
|
59
|
+
return conceptTypeHref.endsWith(conceptTypeSetting);
|
|
60
|
+
}
|
|
61
|
+
|
|
31
62
|
/**
|
|
32
63
|
*/
|
|
33
64
|
getInitialChildModelLinks(): Array<LinkModel> {
|
|
@@ -42,8 +73,10 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
42
73
|
.filter(
|
|
43
74
|
(relation) =>
|
|
44
75
|
relation.direction === "outgoing" &&
|
|
45
|
-
|
|
46
|
-
|
|
76
|
+
BusinessScenarioModel.isOfConceptType(
|
|
77
|
+
relation.concept.concepttypeHref?.path,
|
|
78
|
+
"STEP"
|
|
79
|
+
)
|
|
47
80
|
)
|
|
48
81
|
.map((relation) => relation.concept.asLinkModel());
|
|
49
82
|
|
|
@@ -63,14 +96,15 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
63
96
|
);
|
|
64
97
|
|
|
65
98
|
const scenarioSteps = [];
|
|
66
|
-
const SCENARIO_STEP_HREF =
|
|
67
|
-
"/concepttypes/Library/KMTs/Business scenarios.bixml/ScenarioStep";
|
|
68
99
|
for (let i = 0; i < models.length; i++) {
|
|
69
100
|
const model = models[i];
|
|
70
101
|
|
|
71
102
|
if (
|
|
72
103
|
model instanceof ConceptDetailModel &&
|
|
73
|
-
|
|
104
|
+
BusinessScenarioModel.isOfConceptType(
|
|
105
|
+
model.conceptType?.selfhref.path,
|
|
106
|
+
"STEP"
|
|
107
|
+
)
|
|
74
108
|
) {
|
|
75
109
|
scenarioSteps.push(model);
|
|
76
110
|
}
|
|
@@ -100,8 +134,10 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
100
134
|
const relationsToActor = scenarioStep.relationsCollection.find(
|
|
101
135
|
(relation) =>
|
|
102
136
|
relation.direction === "outgoing" &&
|
|
103
|
-
|
|
104
|
-
|
|
137
|
+
BusinessScenarioModel.isOfConceptType(
|
|
138
|
+
relation.concept.concepttypeHref?.path,
|
|
139
|
+
"PERSONA"
|
|
140
|
+
)
|
|
105
141
|
);
|
|
106
142
|
|
|
107
143
|
const newRelationToActor =
|
package/src/models/href/Href.js
CHANGED
|
@@ -4,7 +4,7 @@ import { BASE, CONTENT_PATH, HTTP_METHODS } from "../../constants/Constants";
|
|
|
4
4
|
import Parameter from "../parameter/Parameter";
|
|
5
5
|
import { IllegalArgumentException } from "../../exceptions";
|
|
6
6
|
|
|
7
|
-
import type { LocationShape
|
|
7
|
+
import type { LocationShape } from "react-router";
|
|
8
8
|
|
|
9
9
|
type HrefObject = {
|
|
10
10
|
_path: string,
|
|
@@ -439,7 +439,7 @@ class Href {
|
|
|
439
439
|
|
|
440
440
|
/**
|
|
441
441
|
*/
|
|
442
|
-
toLocation():
|
|
442
|
+
toLocation(): LocationShape {
|
|
443
443
|
return {
|
|
444
444
|
pathname: this.path,
|
|
445
445
|
search: this.querystring.length > 0 ? `?${this.querystring}` : "",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
import { BASE } from "../../constants/Constants";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)
|
|
6
|
+
* When the resource returns a 404, the resource does not exists and the method returns false
|
|
7
|
+
*
|
|
8
|
+
* @param url
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export const resourceExists = (url: string): boolean => {
|
|
12
|
+
const fullUrl = `${BASE}/${url}`.replace(/\/\//g, "/");
|
|
13
|
+
|
|
14
|
+
const xhr = new XMLHttpRequest();
|
|
15
|
+
xhr.open("HEAD", fullUrl, false);
|
|
16
|
+
xhr.setRequestHeader("Accept", "application/json");
|
|
17
|
+
xhr.setRequestHeader("Content-Type", "application/json");
|
|
18
|
+
xhr.send();
|
|
19
|
+
|
|
20
|
+
return xhr.status !== 404;
|
|
21
|
+
};
|
package/src/utils/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as createUUID } from "./helpers/createUUID";
|
|
|
19
19
|
export * from "./helpers/sanitizeHtml";
|
|
20
20
|
export * from "./helpers/objects";
|
|
21
21
|
export * from "./helpers/text";
|
|
22
|
+
export * from "./helpers/checkResourceExists";
|
|
22
23
|
|
|
23
24
|
// number
|
|
24
25
|
export { default as DecimalFormat } from "./number/DecimalFormat";
|