@beinformed/ui 1.45.3 → 1.46.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 +13 -0
- package/esm/models/application/ApplicationModel.js +7 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/attributes/AttributeModel.js +2 -2
- package/esm/models/attributes/AttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/esm/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/esm/models/attributes/CompositeAttributeModel.js +2 -2
- package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/esm/models/base/ResourceCollection.js +2 -2
- package/esm/models/base/ResourceCollection.js.map +1 -1
- package/esm/models/base/ResourceModel.js +8 -7
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +2 -2
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +2 -2
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +2 -2
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +2 -2
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +2 -3
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +2 -2
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +3 -4
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +2 -2
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +4 -4
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +16 -1
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +7 -3
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/react-client/rehydrate.js +1 -1
- package/esm/react-client/rehydrate.js.map +1 -1
- package/esm/redux/actions/SignIn.js +8 -2
- package/esm/redux/actions/SignIn.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +7 -1
- package/lib/models/application/ApplicationModel.js.flow +7 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js +2 -1
- package/lib/models/attributes/AttributeModel.js.flow +5 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeModel.js.flow +3 -2
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js +2 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +3 -2
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js +2 -2
- package/lib/models/attributes/CompositeAttributeModel.js.flow +3 -2
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/base/ResourceCollection.js +2 -2
- package/lib/models/base/ResourceCollection.js.flow +3 -2
- package/lib/models/base/ResourceCollection.js.map +1 -1
- package/lib/models/base/ResourceModel.js +8 -7
- package/lib/models/base/ResourceModel.js.flow +12 -4
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +2 -2
- package/lib/models/caseview/CaseViewModel.js.flow +3 -2
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +2 -2
- package/lib/models/concepts/BusinessScenarioModel.js.flow +3 -2
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +2 -2
- package/lib/models/concepts/ConceptDetailModel.js.flow +3 -2
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +2 -2
- package/lib/models/concepts/ConceptIndexModel.js.flow +3 -2
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +2 -2
- package/lib/models/content/ContentIndexModel.js.flow +4 -3
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +2 -2
- package/lib/models/detail/DetailModel.js.flow +3 -2
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/form/FormModel.js +3 -3
- package/lib/models/form/FormModel.js.flow +6 -5
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +2 -2
- package/lib/models/form/FormObjectModel.js.flow +3 -2
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js +4 -4
- package/lib/models/list/ListDetailModel.js.flow +5 -4
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/types.js.flow +5 -1
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +16 -1
- package/lib/models/user/UserServicesModel.js.flow +18 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +7 -3
- package/lib/modularui/ModularUIRequest.js.flow +7 -3
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/react-client/rehydrate.js +1 -1
- package/lib/react-client/rehydrate.js.flow +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/redux/actions/SignIn.js +8 -2
- package/lib/redux/actions/SignIn.js.flow +8 -3
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/package.json +1 -1
- package/src/models/application/ApplicationModel.js +7 -1
- package/src/models/attributes/AttributeModel.js +5 -1
- package/src/models/attributes/ChoiceAttributeModel.js +3 -2
- package/src/models/attributes/ChoiceAttributeOptionModel.js +3 -2
- package/src/models/attributes/CompositeAttributeModel.js +3 -2
- package/src/models/base/ResourceCollection.js +3 -2
- package/src/models/base/ResourceModel.js +12 -4
- package/src/models/caseview/CaseViewModel.js +3 -2
- package/src/models/concepts/BusinessScenarioModel.js +3 -2
- package/src/models/concepts/ConceptDetailModel.js +3 -2
- package/src/models/concepts/ConceptIndexModel.js +3 -2
- package/src/models/content/ContentIndexModel.js +4 -3
- package/src/models/detail/DetailModel.js +3 -2
- package/src/models/form/FormModel.js +6 -5
- package/src/models/form/FormObjectModel.js +3 -2
- package/src/models/list/ListDetailModel.js +5 -4
- package/src/models/types.js +5 -1
- package/src/models/user/UserServicesModel.js +18 -1
- package/src/modularui/ModularUIRequest.js +7 -3
- package/src/react-client/rehydrate.js +1 -1
- package/src/redux/actions/SignIn.js +8 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rehydrate.js","names":["_objects","require","_Locales","_interopRequireDefault","_resolveModel","_ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","resolveModel","_context","model","childModels","_map","default","call","childModel","addChildModels","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","_includes","state","mappedState","_keys","forEach","_default","exports"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel),\n );\n\n model.addChildModels(childModels);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey: string, stateValue: any) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState: { [string]: any } = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":";;;;;;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,aAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,kBAAA,GAAAF,sBAAA,CAAAF,OAAA;AAEA;AACA;AACA;AACA,MAAMK,aAAa,GAAIC,IAAY,IAAK;EACtC,MAAMC,SAAS,GAAGC,0BAAiB,CAACC,SAAS,CAACH,IAAI,CAAC;EAEnD,MAAMI,KAAK,GAAG,IAAAC,qBAAY,EAACJ,SAAS,CAAC;EAErC,IAAIG,KAAK,EAAE;IAAA,IAAAE,QAAA;IACT,MAAMC,KAAK,GAAG,IAAIH,KAAK,CAACH,SAAS,CAAC;IAClCM,KAAK,CAACJ,SAAS,CAACH,IAAI,CAAC;IAErB,MAAMQ,WAAW,GAAG,IAAAC,IAAA,CAAAC,OAAA,EAAAJ,QAAA,GAAAN,IAAI,CAACQ,WAAW,EAAAG,IAAA,CAAAL,QAAA,EAAMM,UAAU,IAClDb,aAAa,CAACa,UAAU,CAC1B,CAAC;IAEDL,KAAK,CAACM,cAAc,CAACL,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"rehydrate.js","names":["_objects","require","_Locales","_interopRequireDefault","_resolveModel","_ModularUIResponse","recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","resolveModel","_context","model","childModels","_map","default","call","childModel","addChildModels","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","_includes","state","mappedState","_keys","forEach","_default","exports"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel),\n );\n\n model.addChildModels(childModels, []);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey: string, stateValue: any) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState: { [string]: any } = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ exports.sendAuthenticationError = exports.resetAuthErrors = exports.loginSuccess
|
|
|
8
8
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/promise"));
|
|
9
9
|
var _Cache = _interopRequireDefault(require("../../utils/browser/Cache"));
|
|
10
10
|
var _Authenticate = _interopRequireDefault(require("../../modularui/Authenticate"));
|
|
11
|
+
var _ModularUISelectors = require("../_modularui/ModularUISelectors");
|
|
11
12
|
var _Application = require("./Application");
|
|
12
13
|
var _ProgressIndicator = require("./ProgressIndicator");
|
|
13
14
|
var _RouterActions = require("../_router/RouterActions");
|
|
@@ -61,11 +62,16 @@ const changePassword = () => (dispatch, getState) => {
|
|
|
61
62
|
/**
|
|
62
63
|
*/
|
|
63
64
|
exports.changePassword = changePassword;
|
|
64
|
-
const login = (username, password) => dispatch => {
|
|
65
|
+
const login = (username, password) => (dispatch, getState) => {
|
|
65
66
|
dispatch((0, _ProgressIndicator.startProgress)());
|
|
66
67
|
return new _Authenticate.default().login(username, password).then(() => dispatch((0, _Application.reloadApplication)())).then(() => {
|
|
67
68
|
_Cache.default.addItem("auth", true);
|
|
68
|
-
|
|
69
|
+
const application = (0, _ModularUISelectors.getApplication)(getState());
|
|
70
|
+
if (application?.userMustChangePassword) {
|
|
71
|
+
dispatch(changePassword());
|
|
72
|
+
} else {
|
|
73
|
+
dispatch(loginSuccess());
|
|
74
|
+
}
|
|
69
75
|
return dispatch((0, _ProgressIndicator.finishProgress)());
|
|
70
76
|
}).catch(error => {
|
|
71
77
|
if (error.id === "Error.ChangePasswordRequired") {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import Cache from "../../utils/browser/Cache";
|
|
3
3
|
import Authenticate from "../../modularui/Authenticate";
|
|
4
|
+
import { getApplication } from "../_modularui/ModularUISelectors";
|
|
4
5
|
|
|
5
6
|
import { reloadApplication } from "./Application";
|
|
6
7
|
|
|
@@ -68,7 +69,7 @@ export const changePassword = (): ThunkAction => (dispatch, getState) => {
|
|
|
68
69
|
*/
|
|
69
70
|
export const login =
|
|
70
71
|
(username: string, password: string): ThunkAction =>
|
|
71
|
-
(dispatch) => {
|
|
72
|
+
(dispatch, getState) => {
|
|
72
73
|
dispatch(startProgress());
|
|
73
74
|
|
|
74
75
|
return new Authenticate()
|
|
@@ -76,8 +77,12 @@ export const login =
|
|
|
76
77
|
.then(() => dispatch(reloadApplication()))
|
|
77
78
|
.then(() => {
|
|
78
79
|
Cache.addItem("auth", true);
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const application = getApplication(getState());
|
|
81
|
+
if (application?.userMustChangePassword) {
|
|
82
|
+
dispatch(changePassword());
|
|
83
|
+
} else {
|
|
84
|
+
dispatch(loginSuccess());
|
|
85
|
+
}
|
|
81
86
|
return dispatch(finishProgress());
|
|
82
87
|
})
|
|
83
88
|
.catch((error) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignIn.js","names":["_Cache","_interopRequireDefault","require","_Authenticate","_Application","_ProgressIndicator","_RouterActions","_Constants","loginFailed","errorMessage","sendAuthenticationError","exports","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","push","CHANGEPASSWORD_PATH","login","username","password","startProgress","Authenticate","then","reloadApplication","Cache","addItem","finishProgress","catch","error","id","dispatchedReloadApplication","_promise","default","resolve"],"sources":["../../../src/redux/actions/SignIn.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\n\nimport { reloadApplication } from \"./Application\";\n\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { push } from \"../_router/RouterActions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n SendAuthenticationErrorAction,\n ResetAuthErrorsAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (\n errorMessage: string,\n): SendAuthenticationErrorAction => sendAuthenticationError(errorMessage);\n\n/**\n * Send authentication error action\n */\nexport const sendAuthenticationError = (\n errorMessage: string,\n): SendAuthenticationErrorAction => ({\n type: \"AUTHENTICATION_ERROR\",\n payload: errorMessage,\n});\n\n/**\n * Resets any authentication errors\n */\nexport const resetAuthErrors = (): ResetAuthErrorsAction => ({\n type: \"AUTHENTICATION_RESET_ERRORS\",\n});\n\n/**\n * Send login success action\n */\nexport const loginSuccess = (): LoginSuccessAction => ({\n type: \"AUTHENTICATION_SUCCESS\",\n});\n\n/**\n * Send change password action\n */\nexport const changePassword = (): ThunkAction => (dispatch, getState) => {\n dispatch({\n type: \"CHANGE_PASSWORD\",\n });\n\n const isModal = getState().router.location?.state?.modal;\n const locationFrom = getState().router.location?.state?.from;\n return dispatch(\n push(CHANGEPASSWORD_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n modal: isModal,\n }),\n );\n};\n\n/**\n */\nexport const login =\n (username: string, password: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .login(username, password)\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n Cache.addItem(\"auth\", true);\n dispatch(loginSuccess());\n\n return dispatch(finishProgress());\n })\n .catch((error) => {\n if (error.id === \"Error.ChangePasswordRequired\") {\n const dispatchedReloadApplication = dispatch(reloadApplication());\n\n return Promise.resolve(dispatchedReloadApplication).then(() => {\n Cache.addItem(\"auth\", true);\n dispatch(changePassword());\n return dispatch(finishProgress());\n });\n }\n\n dispatch(loginFailed(error.id));\n return dispatch(finishProgress());\n });\n };\n"],"mappings":";;;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"SignIn.js","names":["_Cache","_interopRequireDefault","require","_Authenticate","_ModularUISelectors","_Application","_ProgressIndicator","_RouterActions","_Constants","loginFailed","errorMessage","sendAuthenticationError","exports","type","payload","resetAuthErrors","loginSuccess","changePassword","dispatch","getState","isModal","router","location","state","modal","locationFrom","from","push","CHANGEPASSWORD_PATH","login","username","password","startProgress","Authenticate","then","reloadApplication","Cache","addItem","application","getApplication","userMustChangePassword","finishProgress","catch","error","id","dispatchedReloadApplication","_promise","default","resolve"],"sources":["../../../src/redux/actions/SignIn.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport Authenticate from \"../../modularui/Authenticate\";\nimport { getApplication } from \"../_modularui/ModularUISelectors\";\n\nimport { reloadApplication } from \"./Application\";\n\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { push } from \"../_router/RouterActions\";\nimport { CHANGEPASSWORD_PATH } from \"../../constants/Constants\";\n\nimport type {\n SendAuthenticationErrorAction,\n ResetAuthErrorsAction,\n LoginSuccessAction,\n ThunkAction,\n} from \"../types\";\n\n/**\n * Send login failed action\n */\nexport const loginFailed = (\n errorMessage: string,\n): SendAuthenticationErrorAction => sendAuthenticationError(errorMessage);\n\n/**\n * Send authentication error action\n */\nexport const sendAuthenticationError = (\n errorMessage: string,\n): SendAuthenticationErrorAction => ({\n type: \"AUTHENTICATION_ERROR\",\n payload: errorMessage,\n});\n\n/**\n * Resets any authentication errors\n */\nexport const resetAuthErrors = (): ResetAuthErrorsAction => ({\n type: \"AUTHENTICATION_RESET_ERRORS\",\n});\n\n/**\n * Send login success action\n */\nexport const loginSuccess = (): LoginSuccessAction => ({\n type: \"AUTHENTICATION_SUCCESS\",\n});\n\n/**\n * Send change password action\n */\nexport const changePassword = (): ThunkAction => (dispatch, getState) => {\n dispatch({\n type: \"CHANGE_PASSWORD\",\n });\n\n const isModal = getState().router.location?.state?.modal;\n const locationFrom = getState().router.location?.state?.from;\n return dispatch(\n push(CHANGEPASSWORD_PATH, {\n from: locationFrom ? locationFrom : getState().router.location,\n modal: isModal,\n }),\n );\n};\n\n/**\n */\nexport const login =\n (username: string, password: string): ThunkAction =>\n (dispatch, getState) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .login(username, password)\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n Cache.addItem(\"auth\", true);\n const application = getApplication(getState());\n if (application?.userMustChangePassword) {\n dispatch(changePassword());\n } else {\n dispatch(loginSuccess());\n }\n return dispatch(finishProgress());\n })\n .catch((error) => {\n if (error.id === \"Error.ChangePasswordRequired\") {\n const dispatchedReloadApplication = dispatch(reloadApplication());\n\n return Promise.resolve(dispatchedReloadApplication).then(() => {\n Cache.addItem(\"auth\", true);\n dispatch(changePassword());\n return dispatch(finishProgress());\n });\n }\n\n dispatch(loginFailed(error.id));\n return dispatch(finishProgress());\n });\n };\n"],"mappings":"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","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -131,10 +131,16 @@ export default class ApplicationModel extends ResourceModel {
|
|
|
131
131
|
* only available when the user services are available
|
|
132
132
|
*/
|
|
133
133
|
get userHref(): Href | null {
|
|
134
|
-
if (this.userServices
|
|
134
|
+
if (this.userServices?.userLink) {
|
|
135
135
|
return this.userServices.userLink.href;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
*/
|
|
143
|
+
get userMustChangePassword(): boolean {
|
|
144
|
+
return this.userServices?.mustChangePassword ?? false;
|
|
145
|
+
}
|
|
140
146
|
}
|
|
@@ -38,6 +38,7 @@ import type ContentConfigurationElements from "../contentconfiguration/ContentCo
|
|
|
38
38
|
import type LayoutHintRuleCollection from "./layouthint-rules/LayoutHintRuleCollection";
|
|
39
39
|
import type AttributeCollection from "./AttributeCollection";
|
|
40
40
|
import AttributeContent from "./AttributeContent";
|
|
41
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Attribute model, base model for all kind of attributes
|
|
@@ -144,7 +145,10 @@ export default class AttributeModel
|
|
|
144
145
|
|
|
145
146
|
/**
|
|
146
147
|
*/
|
|
147
|
-
setChildModels(
|
|
148
|
+
setChildModels(
|
|
149
|
+
models: Array<ModularUIModel>,
|
|
150
|
+
errors: Array<ErrorResponse>, // eslint-disable-line no-unused-vars
|
|
151
|
+
): void {
|
|
148
152
|
const conceptHref = this.conceptLink?.href;
|
|
149
153
|
if (conceptHref) {
|
|
150
154
|
this.concept = models.find((model) =>
|
|
@@ -15,6 +15,7 @@ import { ATTRIBUTE_WIDTH } from "../../constants";
|
|
|
15
15
|
|
|
16
16
|
import type { ModularUIModel, AttributeType, FormErrorAnchor } from "../types";
|
|
17
17
|
import type LinkModel from "../links/LinkModel";
|
|
18
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Model for a choice attribute
|
|
@@ -101,7 +102,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
104
|
*/
|
|
104
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
105
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
105
106
|
const conceptLinkHref = this.conceptLink?.href;
|
|
106
107
|
if (conceptLinkHref) {
|
|
107
108
|
this.concept = models.find(
|
|
@@ -111,7 +112,7 @@ export default class ChoiceAttributeModel extends AttributeModel {
|
|
|
111
112
|
);
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
this.options.setChildModels(models);
|
|
115
|
+
this.options.setChildModels(models, errors);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
/**
|
|
@@ -16,6 +16,7 @@ import AttributeContent from "./AttributeContent";
|
|
|
16
16
|
import type { IModelWithChildModels, ModularUIModel } from "../types";
|
|
17
17
|
import type ListItemModel from "../list/ListItemModel";
|
|
18
18
|
import type LinkModel from "../links/LinkModel";
|
|
19
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
*/
|
|
@@ -101,7 +102,7 @@ class ChoiceAttributeOptionModel
|
|
|
101
102
|
|
|
102
103
|
/**
|
|
103
104
|
*/
|
|
104
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
105
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
105
106
|
if (this.conceptLink !== null) {
|
|
106
107
|
const conceptHref = this.conceptLink.href;
|
|
107
108
|
|
|
@@ -111,7 +112,7 @@ class ChoiceAttributeOptionModel
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
if (this.children) {
|
|
114
|
-
this.children.setChildModels(models);
|
|
115
|
+
this.children.setChildModels(models, errors);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
|
|
@@ -15,6 +15,7 @@ import DatetimeAttributeModel from "./DatetimeAttributeModel";
|
|
|
15
15
|
import type { ModularUIModel, AttributeType } from "../types";
|
|
16
16
|
import type ContentConfiguration from "../contentconfiguration/ContentConfiguration";
|
|
17
17
|
import type LinkModel from "../links/LinkModel";
|
|
18
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
*/
|
|
@@ -49,8 +50,8 @@ class CompositeAttributeModel extends AttributeModel {
|
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
52
|
*/
|
|
52
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
53
|
-
this.children.setChildModels(models);
|
|
53
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
54
|
+
this.children.setChildModels(models, errors);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import BaseCollection from "./BaseCollection";
|
|
3
3
|
|
|
4
4
|
import type { ModularUIModel, IModelWithChildModels } from "../types";
|
|
5
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
5
6
|
import type LinkModel from "../links/LinkModel";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -28,11 +29,11 @@ class ResourceCollection<T: IModelWithChildModels> extends BaseCollection<T> {
|
|
|
28
29
|
/**
|
|
29
30
|
* Pass through models for setchildmodels to items of this collection
|
|
30
31
|
*/
|
|
31
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
32
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
32
33
|
this.collection.forEach((item) => {
|
|
33
34
|
// $FlowFixMe[prop-missing]
|
|
34
35
|
if (typeof item["setChildModels"] === "function") {
|
|
35
|
-
item.setChildModels(models);
|
|
36
|
+
item.setChildModels(models, errors);
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import type LinkModel from "../links/LinkModel";
|
|
13
13
|
import type Href from "../href/Href";
|
|
14
14
|
import type { ModularUIModel, IModelWithChildModels } from "../types";
|
|
15
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Base model, this the foundation for models that represent modular ui services, e.g. application, tab, caseview, etc
|
|
@@ -189,12 +190,16 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
189
190
|
/**
|
|
190
191
|
* Add child models to this model
|
|
191
192
|
*/
|
|
192
|
-
addChildModels(
|
|
193
|
+
addChildModels(
|
|
194
|
+
models: Array<ModularUIModel>,
|
|
195
|
+
errors: Array<ErrorResponse>,
|
|
196
|
+
): this {
|
|
193
197
|
const flattenModels = [].concat(...models);
|
|
198
|
+
const flattenErrors = [].concat(errors);
|
|
194
199
|
|
|
195
200
|
this._childModels = flattenModels;
|
|
196
201
|
|
|
197
|
-
this.setChildModels(flattenModels);
|
|
202
|
+
this.setChildModels(flattenModels, flattenErrors);
|
|
198
203
|
|
|
199
204
|
return this;
|
|
200
205
|
}
|
|
@@ -206,8 +211,11 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
|
|
|
206
211
|
* @abstract
|
|
207
212
|
* @example <caption>Put all models of instance List and GroupingPanel into the panels property</caption>
|
|
208
213
|
*/
|
|
209
|
-
setChildModels(
|
|
210
|
-
|
|
214
|
+
setChildModels(
|
|
215
|
+
models: Array<ModularUIModel>,
|
|
216
|
+
errors: Array<ErrorResponse>,
|
|
217
|
+
): void {
|
|
218
|
+
if (!models && !errors) {
|
|
211
219
|
throw new IllegalArgumentException("No models send to setChildModels");
|
|
212
220
|
}
|
|
213
221
|
}
|
|
@@ -12,6 +12,7 @@ import type { ModularUIModel, AttributeType } from "../types";
|
|
|
12
12
|
import type { ModularUIResponse } from "../../modularui";
|
|
13
13
|
import type LinkCollection from "../links/LinkCollection";
|
|
14
14
|
import type LinkModel from "../links/LinkModel";
|
|
15
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Model containing the details of one case.
|
|
@@ -63,8 +64,8 @@ export default class CaseViewModel extends DetailModel {
|
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
*/
|
|
66
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
67
|
-
super.setChildModels(models);
|
|
67
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
68
|
+
super.setChildModels(models, errors);
|
|
68
69
|
|
|
69
70
|
const taskGroupModels = [];
|
|
70
71
|
for (let i = 0; i < models.length; i++) {
|
|
@@ -7,6 +7,7 @@ import type { ModularUIResponse } from "../../modularui";
|
|
|
7
7
|
import type { ModularUIModel } from "../types";
|
|
8
8
|
import type LinkModel from "../links/LinkModel";
|
|
9
9
|
import type ConceptLinkModel from "./ConceptLinkModel";
|
|
10
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
*/
|
|
@@ -92,7 +93,7 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
92
93
|
|
|
93
94
|
/**
|
|
94
95
|
*/
|
|
95
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
96
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
96
97
|
// $FlowExpectedError[incompatible-type]
|
|
97
98
|
const conceptTypeModel: ?ConceptTypeDetailModel = models.find(
|
|
98
99
|
(model) => model instanceof ConceptTypeDetailModel,
|
|
@@ -102,7 +103,7 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
102
103
|
this.conceptType = conceptTypeModel;
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
this.relationsCollection.setChildModels(models);
|
|
106
|
+
this.relationsCollection.setChildModels(models, errors);
|
|
106
107
|
|
|
107
108
|
const scenarioSteps = [];
|
|
108
109
|
for (let i = 0; i < models.length; i++) {
|
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
import type { ModularUIResponse } from "../../modularui";
|
|
16
16
|
import type Href from "../href/Href";
|
|
17
17
|
import type LinkModel from "../links/LinkModel";
|
|
18
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Model for concept details, available through modelcatalog
|
|
@@ -73,7 +74,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
73
74
|
|
|
74
75
|
/**
|
|
75
76
|
*/
|
|
76
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
77
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
77
78
|
// $FlowExpectedError[incompatible-type]
|
|
78
79
|
const conceptTypeModel: ?ConceptTypeDetailModel = models.find(
|
|
79
80
|
(model) => model instanceof ConceptTypeDetailModel,
|
|
@@ -83,7 +84,7 @@ export default class ConceptDetailModel extends ResourceModel {
|
|
|
83
84
|
this.conceptType = conceptTypeModel;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
this.relationsCollection.setChildModels(models);
|
|
87
|
+
this.relationsCollection.setChildModels(models, errors);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
/**
|
|
@@ -10,6 +10,7 @@ import type { ModularUIResponse } from "../../modularui";
|
|
|
10
10
|
import type { FilterType, ModularUIModel } from "../types";
|
|
11
11
|
import type LinkModel from "../links/LinkModel";
|
|
12
12
|
import type Href from "../href/Href";
|
|
13
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Get Index of concepts, to filter model catalog
|
|
@@ -69,8 +70,8 @@ export default class ConceptIndexModel extends ResourceModel {
|
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
*/
|
|
72
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
73
|
-
this.items.setChildModels(models);
|
|
73
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
74
|
+
this.items.setChildModels(models, errors);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
/**
|
|
@@ -4,11 +4,12 @@ import ResourceCollection from "../base/ResourceCollection";
|
|
|
4
4
|
import FilterCollection from "../filters/FilterCollection";
|
|
5
5
|
import ContentLinkModel from "./ContentLinkModel";
|
|
6
6
|
import Href from "../href/Href";
|
|
7
|
+
import ChoiceAttributeModel from "../attributes/ChoiceAttributeModel";
|
|
7
8
|
|
|
8
9
|
import type { FilterType, ModularUIModel } from "../types";
|
|
9
10
|
import type { ModularUIResponse } from "../../modularui";
|
|
10
11
|
import type LinkModel from "../links/LinkModel";
|
|
11
|
-
import
|
|
12
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Get Index of concepts, to filter model catalog
|
|
@@ -64,8 +65,8 @@ export default class ContentIndexModel extends ResourceModel {
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
*/
|
|
67
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
68
|
-
this.items.setChildModels(models);
|
|
68
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
69
|
+
this.items.setChildModels(models, errors);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -10,6 +10,7 @@ import { AVATAR, AVATAR_IN_TITLE, TITLE } from "../../constants/LayoutHints";
|
|
|
10
10
|
import type { ModularUIResponse } from "../../modularui";
|
|
11
11
|
import type { ModularUIModel, AttributeType } from "../types";
|
|
12
12
|
import type LinkModel from "../links/LinkModel";
|
|
13
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Base class for details<br/>
|
|
@@ -64,8 +65,8 @@ export default class DetailModel extends ResourceModel {
|
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
67
|
*/
|
|
67
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
68
|
-
this._attributeCollection.setChildModels(models);
|
|
68
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
69
|
+
this._attributeCollection.setChildModels(models, errors);
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
/**
|
|
@@ -22,12 +22,13 @@ import {
|
|
|
22
22
|
UPDATE_ACTION,
|
|
23
23
|
} from "../../constants/LayoutHints";
|
|
24
24
|
|
|
25
|
+
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
26
|
+
import AttributeSetModel from "../attributes/AttributeSetModel";
|
|
27
|
+
|
|
25
28
|
import type { AttributeType, ModularUIModel } from "../types";
|
|
26
29
|
import type { ModularUIResponse } from "../../modularui";
|
|
27
30
|
import type ErrorResponse from "../error/ErrorResponse";
|
|
28
31
|
import type LinkModel from "../links/LinkModel";
|
|
29
|
-
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
30
|
-
import AttributeSetModel from "../attributes/AttributeSetModel";
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
*/
|
|
@@ -135,13 +136,13 @@ class FormModel extends ResourceModel {
|
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
*/
|
|
138
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
139
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
139
140
|
if (this.currentFormObject) {
|
|
140
|
-
this.currentFormObject.setChildModels(models);
|
|
141
|
+
this.currentFormObject.setChildModels(models, errors);
|
|
141
142
|
}
|
|
142
143
|
|
|
143
144
|
this.endResultFormObjects.forEach((endResultFormObject) => {
|
|
144
|
-
endResultFormObject.setChildModels(models);
|
|
145
|
+
endResultFormObject.setChildModels(models, errors);
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
|
|
@@ -12,6 +12,7 @@ import type { AttributeType, ModularUIModel, FormErrorAnchor } from "../types";
|
|
|
12
12
|
import type LinkModel from "../links/LinkModel";
|
|
13
13
|
import LayoutHintCollection from "../layouthint/LayoutHintCollection";
|
|
14
14
|
import type { MessageParameters } from "../../i18n";
|
|
15
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Form Object
|
|
@@ -192,8 +193,8 @@ export default class FormObjectModel extends BaseModel {
|
|
|
192
193
|
|
|
193
194
|
/**
|
|
194
195
|
*/
|
|
195
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
196
|
-
this._attributeCollection.setChildModels(models);
|
|
196
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
197
|
+
this._attributeCollection.setChildModels(models, errors);
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
/**
|
|
@@ -14,6 +14,7 @@ import type { ModularUIResponse } from "../../modularui";
|
|
|
14
14
|
import type LinkCollection from "../links/LinkCollection";
|
|
15
15
|
import type ListItemModel from "../list/ListItemModel";
|
|
16
16
|
import type LinkModel from "../links/LinkModel";
|
|
17
|
+
import type ErrorResponse from "../error/ErrorResponse";
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Detail of a list item
|
|
@@ -65,15 +66,15 @@ export default class ListDetailModel extends DetailModel {
|
|
|
65
66
|
|
|
66
67
|
/**
|
|
67
68
|
*/
|
|
68
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
69
|
-
this._attributeCollection.setChildModels(models);
|
|
69
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
70
|
+
this._attributeCollection.setChildModels(models, errors);
|
|
70
71
|
|
|
71
72
|
if (this.results) {
|
|
72
|
-
this.results.setChildModels(models);
|
|
73
|
+
this.results.setChildModels(models, errors);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
if (this.givenAnswers) {
|
|
76
|
-
this.givenAnswers.setChildModels(models);
|
|
77
|
+
this.givenAnswers.setChildModels(models, errors);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
|
package/src/models/types.js
CHANGED
|
@@ -45,6 +45,7 @@ import type BaseFilterModel from "./filters/BaseFilterModel";
|
|
|
45
45
|
import type AttributeCollection from "./attributes/AttributeCollection";
|
|
46
46
|
import type AttributeModel from "./attributes/AttributeModel";
|
|
47
47
|
import type LayoutHintCollection from "./layouthint/LayoutHintCollection";
|
|
48
|
+
import type ErrorResponse from "./error/ErrorResponse";
|
|
48
49
|
|
|
49
50
|
export type ModularUIModel =
|
|
50
51
|
| ApplicationModel
|
|
@@ -151,7 +152,10 @@ export interface ILayoutHintRule {
|
|
|
151
152
|
|
|
152
153
|
export interface IModelWithChildModels {
|
|
153
154
|
getInitialChildModelLinks(): Array<LinkModel>;
|
|
154
|
-
setChildModels(
|
|
155
|
+
setChildModels(
|
|
156
|
+
models: Array<ModularUIModel>,
|
|
157
|
+
errors: Array<ErrorResponse>,
|
|
158
|
+
): void;
|
|
155
159
|
}
|
|
156
160
|
|
|
157
161
|
export type AuthenticationType = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ResourceModel from "../base/ResourceModel";
|
|
3
3
|
import UserModel from "../user/UserModel";
|
|
4
|
+
import ErrorResponse from "../error/ErrorResponse";
|
|
4
5
|
|
|
5
6
|
import type { ModularUIModel } from "../types";
|
|
6
7
|
import type { ModularUIResponse } from "../../modularui";
|
|
@@ -12,6 +13,7 @@ import type Href from "../href/Href";
|
|
|
12
13
|
*/
|
|
13
14
|
class UserServicesModel extends ResourceModel {
|
|
14
15
|
_user: ?UserModel;
|
|
16
|
+
_mustChangePassword: boolean = false;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
*/
|
|
@@ -43,7 +45,10 @@ class UserServicesModel extends ResourceModel {
|
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
*/
|
|
46
|
-
setChildModels(models: Array<ModularUIModel>) {
|
|
48
|
+
setChildModels(models: Array<ModularUIModel>, errors: Array<ErrorResponse>) {
|
|
49
|
+
this.mustChangePassword = Array.isArray(errors)
|
|
50
|
+
? errors.some((error) => error.isChangePassword) ?? false
|
|
51
|
+
: false;
|
|
47
52
|
this.user = models.find((model) => model.type === "User");
|
|
48
53
|
}
|
|
49
54
|
|
|
@@ -109,6 +114,18 @@ class UserServicesModel extends ResourceModel {
|
|
|
109
114
|
const UNSECURE_LINK_COUNT = 3;
|
|
110
115
|
return this.links.length > UNSECURE_LINK_COUNT || hasUser;
|
|
111
116
|
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
*/
|
|
120
|
+
set mustChangePassword(mustChangePassword: boolean) {
|
|
121
|
+
this._mustChangePassword = mustChangePassword;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
*/
|
|
126
|
+
get mustChangePassword(): boolean {
|
|
127
|
+
return this._mustChangePassword;
|
|
128
|
+
}
|
|
112
129
|
}
|
|
113
130
|
|
|
114
131
|
export default UserServicesModel;
|
|
@@ -13,6 +13,7 @@ import universalFetch from "../utils/fetch/universalFetch";
|
|
|
13
13
|
import resolveModel from "../models/resolveModel";
|
|
14
14
|
import FormModel from "../models/form/FormModel";
|
|
15
15
|
import ContentModel from "../models/content/ContentModel";
|
|
16
|
+
import ErrorResponse from "../models/error/ErrorResponse";
|
|
16
17
|
|
|
17
18
|
import ModularUIResponse from "./ModularUIResponse";
|
|
18
19
|
|
|
@@ -670,22 +671,25 @@ class ModularUIRequest {
|
|
|
670
671
|
|
|
671
672
|
return Promise.allSettled(childModelRequests).then((childModels) => {
|
|
672
673
|
const resolvedChildModels = [];
|
|
674
|
+
const errorChildModels = [];
|
|
673
675
|
|
|
674
676
|
childModels.forEach((childModel) => {
|
|
675
677
|
if (childModel.status === "rejected") {
|
|
676
678
|
const { reason } = childModel;
|
|
677
679
|
if (reason.name !== "Error.ChangePasswordRequired") {
|
|
678
|
-
console
|
|
680
|
+
// eslint-disable-next-line no-console
|
|
681
|
+
console.debug(
|
|
679
682
|
"Unexpected error when retrieving child model:",
|
|
680
683
|
reason,
|
|
681
684
|
);
|
|
682
685
|
}
|
|
686
|
+
errorChildModels.push(new ErrorResponse(reason));
|
|
683
687
|
} else {
|
|
684
688
|
resolvedChildModels.push(childModel.value);
|
|
685
689
|
}
|
|
686
690
|
});
|
|
687
691
|
|
|
688
|
-
model.addChildModels(resolvedChildModels);
|
|
692
|
+
model.addChildModels(resolvedChildModels, errorChildModels);
|
|
689
693
|
|
|
690
694
|
return model;
|
|
691
695
|
});
|
|
@@ -798,7 +802,7 @@ class ModularUIRequest {
|
|
|
798
802
|
locale: this.locale,
|
|
799
803
|
}).fetchSync();
|
|
800
804
|
});
|
|
801
|
-
model.addChildModels(childModels);
|
|
805
|
+
model.addChildModels(childModels, []);
|
|
802
806
|
|
|
803
807
|
return model;
|
|
804
808
|
}
|