@beinformed/ui 1.13.3 → 1.14.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 +20 -0
- package/esm/models/attributes/AttributeContent.js +3 -3
- package/esm/models/attributes/AttributeContent.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/BooleanAttributeModel.js +1 -0
- package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +1 -0
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +2 -1
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/attributes/DatetimeAttributeModel.js +3 -2
- package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/esm/models/base/BaseCollection.js.map +1 -1
- package/esm/models/base/ResourceCollection.js +4 -2
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js +1 -0
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
- package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
- package/esm/models/content/ContentLinkModel.js +2 -0
- package/esm/models/content/ContentLinkModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -1
- package/esm/models/href/Href.js.map +1 -1
- package/esm/react-server/renderSSRComplete.js +2 -1
- package/esm/react-server/renderSSRComplete.js.map +1 -1
- package/esm/react-server/serverNoSSR.js +1 -1
- package/esm/react-server/serverNoSSR.js.map +1 -1
- package/esm/redux/_modularui/actions.js +16 -17
- package/esm/redux/_modularui/actions.js.map +1 -1
- package/esm/redux/_modularui/reducer.js +1 -2
- package/esm/redux/_modularui/reducer.js.map +1 -1
- package/esm/redux/actions/Authorization.js +2 -1
- package/esm/redux/actions/Authorization.js.map +1 -1
- package/esm/redux/actions/SignIn.js +5 -9
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/esm/utils/helpers/checkResourceExists.js +23 -0
- package/esm/utils/helpers/checkResourceExists.js.map +1 -0
- package/esm/utils/helpers/objects.js +2 -1
- package/esm/utils/helpers/objects.js.map +1 -1
- package/esm/utils/index.js +2 -1
- package/esm/utils/index.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +1 -0
- package/lib/models/attributes/AttributeContent.js +3 -3
- package/lib/models/attributes/AttributeContent.js.flow +3 -3
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.flow +10 -2
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js +1 -0
- package/lib/models/attributes/BooleanAttributeModel.js.flow +4 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +1 -0
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +4 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +5 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +2 -1
- package/lib/models/attributes/CompositeAttributeModel.js.flow +1 -0
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js +4 -2
- package/lib/models/attributes/DatetimeAttributeModel.js.flow +3 -5
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/base/BaseCollection.js.flow +2 -2
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +4 -2
- package/lib/models/base/ResourceCollection.js.flow +4 -6
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +1 -0
- package/lib/models/base/ResourceModel.js.flow +3 -2
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +3 -1
- package/lib/models/concepts/BusinessScenarioModel.js.flow +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +3 -1
- package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.flow +5 -2
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/ConceptRelationModel.js.flow +6 -2
- package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js +2 -0
- package/lib/models/content/ContentLinkModel.js.flow +2 -0
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/href/Href.js +1 -1
- package/lib/models/href/Href.js.flow +2 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/types.js.flow +2 -2
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +15 -14
- package/lib/react-server/renderSSRComplete.js +2 -1
- package/lib/react-server/renderSSRComplete.js.flow +4 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/serverNoSSR.js +1 -1
- package/lib/react-server/serverNoSSR.js.flow +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -0
- package/lib/redux/_modularui/actions.js +12 -12
- package/lib/redux/_modularui/actions.js.flow +12 -12
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/reducer.js +1 -2
- package/lib/redux/_modularui/reducer.js.flow +0 -1
- package/lib/redux/_modularui/reducer.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/redux/actions/SignIn.js +6 -9
- package/lib/redux/actions/SignIn.js.flow +5 -11
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -0
- package/lib/redux/actions/__tests__/CustomErrorResponseHandler.spec.js.flow +2 -0
- package/lib/utils/fetch/__tests__/xhr.spec.js.flow +1 -0
- 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/helpers/objects.js +3 -1
- package/lib/utils/helpers/objects.js.flow +2 -2
- package/lib/utils/helpers/objects.js.map +1 -1
- 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 +17 -17
- package/src/hooks/__tests__/useAuthentication.spec.js +1 -0
- package/src/models/attributes/AttributeContent.js +3 -3
- package/src/models/attributes/AttributeModel.js +10 -2
- package/src/models/attributes/BooleanAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeModel.js +4 -1
- package/src/models/attributes/ChoiceAttributeOptionCollection.js +1 -1
- package/src/models/attributes/ChoiceAttributeOptionModel.js +5 -2
- package/src/models/attributes/CompositeAttributeChildCollection.js +1 -1
- package/src/models/attributes/CompositeAttributeModel.js +1 -0
- package/src/models/attributes/DatetimeAttributeModel.js +3 -5
- package/src/models/base/BaseCollection.js +2 -2
- package/src/models/base/ResourceCollection.js +4 -6
- package/src/models/base/ResourceModel.js +3 -2
- package/src/models/concepts/BusinessScenarioModel.js +2 -1
- package/src/models/concepts/ConceptDetailModel.js +2 -2
- package/src/models/concepts/ConceptLinkModel.js +5 -2
- package/src/models/concepts/ConceptRelationModel.js +6 -2
- package/src/models/content/ContentLinkModel.js +2 -0
- package/src/models/href/Href.js +2 -1
- package/src/models/types.js +2 -2
- package/src/react-server/__tests__/serverUtil.spec.js +15 -14
- package/src/react-server/renderSSRComplete.js +4 -1
- package/src/react-server/serverNoSSR.js +1 -1
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -0
- package/src/redux/_modularui/actions.js +12 -12
- package/src/redux/_modularui/reducer.js +0 -1
- package/src/redux/actions/Authorization.js +1 -0
- package/src/redux/actions/SignIn.js +5 -11
- package/src/redux/actions/__tests__/Application.spec.js +1 -0
- package/src/redux/actions/__tests__/CustomErrorResponseHandler.spec.js +2 -0
- package/src/utils/fetch/__tests__/xhr.spec.js +1 -0
- package/src/utils/helpers/checkResourceExists.js +21 -0
- package/src/utils/helpers/objects.js +2 -2
- package/src/utils/index.js +1 -0
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import ConceptLinkModel from "./ConceptLinkModel";
|
|
3
3
|
import LinkModel from "../links/LinkModel";
|
|
4
4
|
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
IModelWithChildModels,
|
|
7
|
+
ModularUIModel,
|
|
8
|
+
textfragmentJSON,
|
|
9
|
+
} from "../types";
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Concept relation model
|
|
9
13
|
*/
|
|
10
|
-
export default class ConceptRelationModel {
|
|
14
|
+
export default class ConceptRelationModel implements IModelWithChildModels {
|
|
11
15
|
_relation: Object;
|
|
12
16
|
_concept: ConceptLinkModel;
|
|
13
17
|
|
|
@@ -33,6 +33,7 @@ export default class ContentLinkModel
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
*/
|
|
36
|
+
// $FlowFixMe[method-unbinding]
|
|
36
37
|
getInitialChildModelLinks(): Array<LinkModel> {
|
|
37
38
|
if (this.contentTypeLink) {
|
|
38
39
|
this.contentTypeLink.isCacheable = true;
|
|
@@ -44,6 +45,7 @@ export default class ContentLinkModel
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
*/
|
|
48
|
+
// $FlowFixMe[method-unbinding]
|
|
47
49
|
setChildModels(models: Array<ModularUIModel>) {
|
|
48
50
|
if (this.contentTypeLink) {
|
|
49
51
|
const href = this.contentTypeLink.href;
|
package/src/models/href/Href.js
CHANGED
|
@@ -13,6 +13,7 @@ type HrefObject = {
|
|
|
13
13
|
_resourcetype: string,
|
|
14
14
|
_method: $Keys<typeof HTTP_METHODS>,
|
|
15
15
|
_state: ?{ [key: string]: any },
|
|
16
|
+
pathname: ?string,
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
export type HrefInput = Href | HrefObject | LocationShape | string;
|
|
@@ -61,7 +62,7 @@ class Href {
|
|
|
61
62
|
/**
|
|
62
63
|
*/
|
|
63
64
|
setFromLocationOrObject(href: LocationShape | HrefObject) {
|
|
64
|
-
if (href
|
|
65
|
+
if (typeof href["pathname"] === "string") {
|
|
65
66
|
this.path = href.pathname;
|
|
66
67
|
} else if (typeof href._path === "string") {
|
|
67
68
|
this.path = href._path;
|
package/src/models/types.js
CHANGED
|
@@ -149,8 +149,8 @@ export interface ILayoutHintRule {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
export interface IModelWithChildModels {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
getInitialChildModelLinks(): Array<LinkModel>;
|
|
153
|
+
setChildModels(models: Array<ModularUIModel>): void;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
export type FileEntryType = {
|
|
@@ -16,6 +16,20 @@ global.preferencesProvider = {
|
|
|
16
16
|
|
|
17
17
|
const mockStore = configureMockStore();
|
|
18
18
|
|
|
19
|
+
const getExpectedLocales = () =>
|
|
20
|
+
new Locales([
|
|
21
|
+
...availableLocales.map((locale) =>
|
|
22
|
+
locale.code === "nl"
|
|
23
|
+
? {
|
|
24
|
+
...locale,
|
|
25
|
+
messages: {
|
|
26
|
+
message_nl: "Dutch message",
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
: locale
|
|
30
|
+
),
|
|
31
|
+
]);
|
|
32
|
+
|
|
19
33
|
describe("serverUtil", () => {
|
|
20
34
|
it("handles setI18n", () => {
|
|
21
35
|
const store = mockStore({ i18n: {} });
|
|
@@ -39,25 +53,12 @@ describe("serverUtil", () => {
|
|
|
39
53
|
}
|
|
40
54
|
);
|
|
41
55
|
|
|
42
|
-
const expectedLocales = new Locales([
|
|
43
|
-
...availableLocales.map((locale) =>
|
|
44
|
-
locale.code === "nl"
|
|
45
|
-
? {
|
|
46
|
-
...locale,
|
|
47
|
-
messages: {
|
|
48
|
-
message_nl: "Dutch message",
|
|
49
|
-
},
|
|
50
|
-
}
|
|
51
|
-
: locale
|
|
52
|
-
),
|
|
53
|
-
]);
|
|
54
|
-
|
|
55
56
|
expect(store.getActions()).toStrictEqual([
|
|
56
57
|
{
|
|
57
58
|
type: "SET_LOCALES",
|
|
58
59
|
payload: {
|
|
59
60
|
locale: "en",
|
|
60
|
-
locales:
|
|
61
|
+
locales: getExpectedLocales(),
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
64
|
]);
|
|
@@ -21,6 +21,8 @@ import type { Theme } from "../react-theme/types";
|
|
|
21
21
|
import type { ReduxStore } from "../redux/types";
|
|
22
22
|
import type Href from "../models/href/Href";
|
|
23
23
|
import type { TemplateProps } from "./htmlpage";
|
|
24
|
+
import type { Location } from "react-router";
|
|
25
|
+
|
|
24
26
|
type Props = {
|
|
25
27
|
store: ReduxStore,
|
|
26
28
|
theme: Theme,
|
|
@@ -46,7 +48,8 @@ const renderSSRComplete = ({
|
|
|
46
48
|
|
|
47
49
|
const sheet = new ServerStyleSheet();
|
|
48
50
|
|
|
49
|
-
// $
|
|
51
|
+
// $FlowFixMe[incompatible-type]
|
|
52
|
+
// $FlowFixMe[prop-missing]
|
|
50
53
|
const location: Location = requestHref.toLocation();
|
|
51
54
|
|
|
52
55
|
return createSSRComplete(store, () =>
|
|
@@ -73,7 +73,8 @@ const loadModelSuccessAction = (
|
|
|
73
73
|
modelToUpdate
|
|
74
74
|
): UpdateModelAction | SetModelAction => {
|
|
75
75
|
if (modelToUpdate) {
|
|
76
|
-
|
|
76
|
+
// $FlowFixMe[prop-missing]
|
|
77
|
+
if (typeof modelToUpdate["update"] === "function") {
|
|
77
78
|
const clonedModel = modelToUpdate.clone();
|
|
78
79
|
clonedModel.update(model);
|
|
79
80
|
|
|
@@ -140,17 +141,16 @@ export const loadModularUI =
|
|
|
140
141
|
dispatch(startProgress());
|
|
141
142
|
|
|
142
143
|
const loadModelPromise = dispatch(loadModel(key, href, options));
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
144
|
+
|
|
145
|
+
return Promise.resolve(loadModelPromise)
|
|
146
|
+
.then((response) => {
|
|
147
|
+
if (response?.type === "FINISH_PROGRESS") {
|
|
148
|
+
dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return dispatch(finishProgress());
|
|
152
|
+
})
|
|
153
|
+
.catch((error) => dispatch(handleError(error)));
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
/**
|
|
@@ -66,17 +66,11 @@ export const login =
|
|
|
66
66
|
.catch((error) => {
|
|
67
67
|
if (error.id === "Error.ChangePasswordRequired") {
|
|
68
68
|
const dispatchedReloadApplication = dispatch(reloadApplication());
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
.then(() => {
|
|
75
|
-
Cache.addItem("auth", true);
|
|
76
|
-
return dispatch(changePassword());
|
|
77
|
-
})
|
|
78
|
-
.then(() => dispatch(finishProgress()));
|
|
79
|
-
}
|
|
69
|
+
|
|
70
|
+
return Promise.resolve(dispatchedReloadApplication).then(() => {
|
|
71
|
+
Cache.addItem("auth", true);
|
|
72
|
+
return dispatch(changePassword());
|
|
73
|
+
});
|
|
80
74
|
}
|
|
81
75
|
|
|
82
76
|
dispatch(loginFailed(error.id));
|
|
@@ -27,6 +27,7 @@ describe("custom error response handling", () => {
|
|
|
27
27
|
const store = mockStore({});
|
|
28
28
|
|
|
29
29
|
setCustomErrorResponseHandler((error) => {
|
|
30
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
30
31
|
if (error.isRemoteServiceException) {
|
|
31
32
|
return {
|
|
32
33
|
type: "REMOTE_SERVICE_EXCEPTION",
|
|
@@ -50,6 +51,7 @@ describe("custom error response handling", () => {
|
|
|
50
51
|
const store = mockStore({});
|
|
51
52
|
|
|
52
53
|
setCustomErrorResponseHandler((error, defaultHandler) => (dispatch) => {
|
|
54
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
53
55
|
if (error.isRemoteServiceException) {
|
|
54
56
|
dispatch({
|
|
55
57
|
type: "REMOTE_SERVICE_EXCEPTION",
|
|
@@ -156,6 +156,7 @@ describe("xhr", () => {
|
|
|
156
156
|
onProgress: ({ type, loaded, total, lengthComputable }) => {
|
|
157
157
|
events.push({ type, loaded, total, lengthComputable });
|
|
158
158
|
|
|
159
|
+
// eslint-disable-next-line jest/no-conditional-in-test
|
|
159
160
|
if (type === "loadend") {
|
|
160
161
|
resolve(events);
|
|
161
162
|
}
|
|
@@ -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
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import _has from "lodash/has";
|
|
3
|
+
import _isPlainObject from "lodash/isPlainObject";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
*/
|
|
6
|
-
export const isPlainObject = (value: any): boolean =>
|
|
7
|
-
Object.prototype.toString.call(value) === "[object Object]";
|
|
7
|
+
export const isPlainObject = (value: any): boolean => _isPlainObject(value);
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
*/
|
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";
|