@beinformed/ui 1.56.2 → 1.56.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/esm/hooks/useModularUI.js +20 -18
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +18 -16
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +2 -2
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/redux/_modularui/ModularUIActions.js +10 -8
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js +4 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/ModularUIReducer.js +2 -1
- package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +11 -4
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +2 -8
- package/lib/hooks/__tests__/useForm.spec.js.flow +14 -12
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +10 -4
- package/lib/hooks/__tests__/useModels.spec.js.flow +3 -12
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +9 -8
- package/lib/hooks/useModularUI.js +19 -17
- package/lib/hooks/useModularUI.js.flow +26 -16
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +18 -16
- package/lib/hooks/useModularUIBasic.js.flow +23 -16
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +2 -2
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +2 -2
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/redux/_modularui/ModularUIActions.js +10 -8
- package/lib/redux/_modularui/ModularUIActions.js.flow +14 -9
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js +3 -0
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +6 -3
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/ModularUIReducer.js +2 -1
- package/lib/redux/_modularui/ModularUIReducer.js.flow +1 -0
- package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
- package/lib/redux/_modularui/__tests__/actions.spec.js.flow +1 -4
- package/lib/redux/_modularui/types.js.flow +1 -0
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/actions/__tests__/Application.spec.js.flow +1 -8
- package/lib/redux/actions/__tests__/Authorization.spec.js.flow +0 -4
- package/package.json +9 -9
- package/src/hooks/__tests__/UseModularUIModel.spec.js +11 -4
- package/src/hooks/__tests__/useAuthentication.spec.js +2 -8
- package/src/hooks/__tests__/useForm.spec.js +14 -12
- package/src/hooks/__tests__/useModelCatalog.spec.js +10 -4
- package/src/hooks/__tests__/useModels.spec.js +3 -12
- package/src/hooks/__tests__/useModularUIBasic.spec.js +9 -8
- package/src/hooks/useModularUI.js +26 -16
- package/src/hooks/useModularUIBasic.js +23 -16
- package/src/models/concepts/ConceptTypeDetailModel.js +2 -2
- package/src/redux/_modularui/ModularUIActions.js +14 -9
- package/src/redux/_modularui/ModularUIMiddleware.js +6 -3
- package/src/redux/_modularui/ModularUIReducer.js +1 -0
- package/src/redux/_modularui/__tests__/actions.spec.js +1 -4
- package/src/redux/_modularui/types.js +1 -0
- package/src/redux/actions/__tests__/Application.spec.js +1 -8
- package/src/redux/actions/__tests__/Authorization.spec.js +0 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","_promise","default","resolve","then","
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["_Constants","require","_Href","_interopRequireDefault","_ErrorResponse","_ProgressIndicator","_Error","setModel","key","model","connectKey","type","payload","exports","initModels","models","updateModel","updateForm","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","updateHandler","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","forceTargetModel","cache","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","getState","modularuiStore","modularui","LOADING","startProgress","loadModelPromise","_promise","default","resolve","then","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n InitModelAction,\n UpdateModelAction,\n UpdateFormAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {\n RequestModularUIOptions,\n UpdateHandler,\n} from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel,\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const initModels = (\n models: Array<{ key: string, model: ModularUIModel }>,\n): InitModelAction => ({\n type: \"MODULARUI/INIT\",\n payload: models,\n});\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const updateForm = (model: ModularUIModel): UpdateFormAction => ({\n type: \"MODULARUI/UPDATE_FORM\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>,\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n updateHandler: UpdateHandler | void,\n): UpdateModelAction | SetModelAction => {\n if (updateHandler) {\n return updateModel(updateHandler(model));\n }\n return setModel(key, model);\n};\n\n/**\n * This action is handled by the modularui middleware\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n key,\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n forceTargetModel: options?.forceTargetModel,\n cache: options?.cache,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateHandler),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions,\n ): ThunkAction =>\n (dispatch: Dispatch, getState) => {\n const modularuiStore = getState()?.modularui;\n if (\n modularuiStore &&\n modularuiStore[key]?.status === MODULARUI_STATUS.LOADING\n ) {\n // don't create duplicate requests during loading\n return dispatch({\n type: \"NO_ACTION\",\n });\n }\n\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then(() => dispatch(finishProgress()))\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions,\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAmBA;AACA;AACO,MAAMM,QAAQ,GAAGA,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADAI,OAAA,CAAAN,QAAA,GAAAA,QAAA;AAEO,MAAMO,UAAU,GACrBC,MAAqD,KAChC;EACrBJ,IAAI,EAAE,gBAAgB;EACtBC,OAAO,EAAEG;AACX,CAAC,CAAC;;AAEF;AACA;AADAF,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAEO,MAAME,WAAW,GAAIP,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAA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C,CAAC;EAEzB,MAAMC,gBAAgB,GAAGN,QAAQ,CAACvB,SAAS,CAAChB,GAAG,EAAEiB,IAAI,EAAEC,OAAO,CAAC,CAAC;EAEhE,OAAO4B,QAAA,CAAAC,OAAA,CAAQC,OAAO,CAACH,gBAAgB,CAAC,CACrCI,IAAI,CAAC,MAAMV,QAAQ,CAAC,IAAAW,iCAAc,EAAC,CAAC,CAAC,CAAC,CACtCC,KAAK,CAAEpB,KAAK,IAAKQ,QAAQ,CAAC,IAAAa,kBAAW,EAACrB,KAAK,CAAC,CAAC,CAAC;AACnD,CAAC;;AAEH;AACA;AADA1B,OAAA,CAAAiC,aAAA,GAAAA,aAAA;AAEO,MAAMe,WAAW,GAAGA,CACzBpD,KAAqB,EACrBiB,OAAiC,KAEjCoB,aAAa,CAACrC,KAAK,CAACC,UAAU,EAAED,KAAK,CAACqD,QAAQ,EAAE;EAC9C,GAAGpC,OAAO;EACVqC,QAAQ,EAAE;AACZ,CAAC,CAAC;AAAClD,OAAA,CAAAgD,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ var _ModularUIRequest = _interopRequireDefault(require("../../modularui/ModularU
|
|
|
10
10
|
var _Constants = require("../../constants/Constants");
|
|
11
11
|
var _ProgressIndicator = require("../actions/ProgressIndicator");
|
|
12
12
|
var _Error = require("../actions/Error");
|
|
13
|
+
var _ModularUIActions = require("./ModularUIActions");
|
|
13
14
|
/**
|
|
14
15
|
* Symbol key that carries API call info interpreted by this Redux middleware.
|
|
15
16
|
*/
|
|
@@ -71,12 +72,14 @@ const errorHandler = (next, dispatch, errorAction, err) => {
|
|
|
71
72
|
const handleFetch = (action, locale, dispatch, next) => {
|
|
72
73
|
dispatch((0, _ProgressIndicator.startProgress)());
|
|
73
74
|
const {
|
|
75
|
+
key,
|
|
74
76
|
successAction,
|
|
75
77
|
errorAction,
|
|
76
78
|
...requestOptions
|
|
77
79
|
} = action.payload;
|
|
78
80
|
requestOptions.locale = locale;
|
|
79
81
|
const modularuiRequest = createRequest(requestOptions);
|
|
82
|
+
dispatch((0, _ModularUIActions.updateStatus)(key, _Constants.MODULARUI_STATUS.LOADING));
|
|
80
83
|
return modularuiRequest.fetch().then(model => responseHandler(next, dispatch, successAction, model)).catch(error => errorHandler(next, dispatch, errorAction, error));
|
|
81
84
|
};
|
|
82
85
|
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import ModularUIRequest from "../../modularui/ModularUIRequest";
|
|
3
|
-
import { HTTP_METHODS } from "../../constants/Constants";
|
|
3
|
+
import { HTTP_METHODS, MODULARUI_STATUS } from "../../constants/Constants";
|
|
4
4
|
|
|
5
5
|
import { startProgress, finishProgress } from "../actions/ProgressIndicator";
|
|
6
|
-
|
|
7
6
|
import { handleError } from "../actions/Error";
|
|
8
7
|
|
|
8
|
+
import { updateStatus } from "./ModularUIActions";
|
|
9
|
+
|
|
9
10
|
import type { Middleware, MiddlewareAPI } from "redux";
|
|
10
11
|
import type {
|
|
11
12
|
ReduxAction,
|
|
@@ -117,11 +118,13 @@ const handleFetch = (
|
|
|
117
118
|
) => {
|
|
118
119
|
dispatch(startProgress());
|
|
119
120
|
|
|
120
|
-
const { successAction, errorAction, ...requestOptions } = action.payload;
|
|
121
|
+
const { key, successAction, errorAction, ...requestOptions } = action.payload;
|
|
121
122
|
requestOptions.locale = locale;
|
|
122
123
|
|
|
123
124
|
const modularuiRequest = createRequest(requestOptions);
|
|
124
125
|
|
|
126
|
+
dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));
|
|
127
|
+
|
|
125
128
|
return modularuiRequest
|
|
126
129
|
.fetch()
|
|
127
130
|
.then((model) => responseHandler(next, dispatch, successAction, model))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIMiddleware.js","names":["_ModularUIRequest","_interopRequireDefault","require","_Constants","_ProgressIndicator","_Error","createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","cache","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","_promise","default","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n","exports"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\
|
|
1
|
+
{"version":3,"file":"ModularUIMiddleware.js","names":["_ModularUIRequest","_interopRequireDefault","require","_Constants","_ProgressIndicator","_Error","_ModularUIActions","createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","cache","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","_promise","default","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","key","requestOptions","payload","modularuiRequest","updateStatus","MODULARUI_STATUS","LOADING","fetch","modularUIMiddleware","api","type","getState","i18n","exports"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport { updateStatus } from \"./ModularUIActions\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n cache?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n cache: modularui.cache,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel,\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`,\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any,\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch,\n) => {\n dispatch(startProgress());\n\n const { key, successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch,\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next,\n );\n }\n\n return next(action);\n };\n"],"mappings":";;;;;;;;AACA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AA0BA;AACA;AACA;AACA,MAAMK,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIC,yBAAgB,CAACF,SAAS,CAACG,IAAI,EAAE;IACnDC,MAAM,EAAEJ,SAAS,CAACI,MAAM,IAAIC,uBAAY,CAACC,GAAG;IAC5CC,IAAI,EAAEP,SAAS,CAACO,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAER,SAAS,CAACQ,MAAM;IACxBC,WAAW,EAAET,SAAS,CAACS,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAEV,SAAS,CAACU,QAAQ;IAC5BC,KAAK,EAAEX,SAAS,CAACW;EACnB,CAAC,CAAC;EAEF,IAAIX,SAAS,CAACY,WAAW,EAAE;IACzBX,OAAO,CAACW,WAAW,GAAGZ,SAAS,CAACY,WAAW;IAC3CX,OAAO,CAACY,gBAAgB,GAAGb,SAAS,CAACa,gBAAgB,IAAI,KAAK;EAChE;EAEA,OAAOZ,OAAO;AAChB,CAAC;;AAED;AACA;AACA,MAAMa,eAAe,GAAGA,CACtBC,IAAc,EACdC,QAAkB,EAClBC,aAA4B,EAC5BC,KAAqB,KAClB;EACH,IAAID,aAAa,EAAE;I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AEa,WAAW;IAAE,GAAGO;EAAe,CAAC,GAAGH,MAAM,CAACI,OAAO;EAC7ED,cAAc,CAAC7B,MAAM,GAAGA,MAAM;EAE9B,MAAM+B,gBAAgB,GAAGxC,aAAa,CAACsC,cAAc,CAAC;EAEtDrB,QAAQ,CAAC,IAAAwB,8BAAY,EAACJ,GAAG,EAAEK,2BAAgB,CAACC,OAAO,CAAC,CAAC;EAErD,OAAOH,gBAAgB,CACpBI,KAAK,CAAC,CAAC,CACPrB,IAAI,CAAEJ,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEM,KAAK,CAAEC,KAAK,IAAKI,YAAY,CAACd,IAAI,EAAEC,QAAQ,EAAEc,WAAW,EAAEL,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACO,MAAMmB,mBAIZ,GACEC,GAAqD,IACrD9B,IAAc,IACdmB,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACY,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOb,WAAW;IAChB;IACAC,MAAM,EACNW,GAAG,CAACE,QAAQ,CAAC,CAAC,CAACC,IAAI,CAACxC,MAAM,EAC1BqC,GAAG,CAAC7B,QAAQ,EACZD,IACF,CAAC;EACH;EAEA,OAAOA,IAAI,CAACmB,MAAM,CAAC;AACrB,CAAC;AAACe,OAAA,CAAAL,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIReducer.js","names":["_exceptions","require","_Constants","_models","updateStatus","state","_ref","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","_ref2","model","IllegalArgumentException","initModularUI","models","newState","_assign","default","forEach","_ref3","
|
|
1
|
+
{"version":3,"file":"ModularUIReducer.js","names":["_exceptions","require","_Constants","_models","updateStatus","state","_ref","key","status","MODULARUI_STATUS","LOADING","lastModification","Date","now","setModel","_ref2","model","FINISHED","IllegalArgumentException","initModularUI","models","newState","_assign","default","forEach","_ref3","getModelKey","_context","_find","_keys","call","connectKey","updateModel","modelKey","Error","removeKey","resetModularUI","ApplicationModel","initialState","ModularUIReducer","arguments","length","undefined","action","type","payload","exports"],"sources":["../../../src/redux/_modularui/ModularUIReducer.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../../exceptions\";\nimport { MODULARUI_STATUS } from \"../../constants/Constants\";\nimport { ApplicationModel } from \"../../models\";\n\nimport type { Reducer } from \"redux\";\nimport type { ReduxAction } from \"../types\";\nimport type { ModularUIState } from \"./types\";\nimport type { ModularUIModel } from \"../../models\";\n\n/**\n */\nconst updateStatus = (\n state: ModularUIState,\n { key, status }: { key: string, status: $Keys<typeof MODULARUI_STATUS> },\n) => {\n // model should always be available when status is not loading\n if (status !== MODULARUI_STATUS.LOADING && !state[key]) {\n return state;\n }\n\n return {\n ...state,\n [key]: {\n ...state[key],\n status,\n lastModification: Date.now(),\n },\n };\n};\n\n/**\n */\nconst setModel = (\n state: ModularUIState,\n { key, model }: { key: string, model: ?ModularUIModel },\n) => {\n if (!state[key]) {\n return state;\n }\n\n if (model) {\n return {\n ...state,\n [key]: {\n ...state[key],\n model,\n lastModification: Date.now(),\n status: MODULARUI_STATUS.FINISHED,\n },\n };\n }\n\n throw new IllegalArgumentException(\"No model for setModel\");\n};\n\n/**\n */\nconst initModularUI = (\n state: ModularUIState,\n models: Array<{ key: string, model: ModularUIModel }>,\n) => {\n const newState = Object.assign({}, state);\n\n models.forEach(({ key, model }) => {\n newState[key] = {\n status: MODULARUI_STATUS.FINISHED,\n lastModification: Date.now(),\n model,\n };\n });\n\n return newState;\n};\n\n/**\n */\nconst getModelKey = (state: ModularUIState, model: ModularUIModel) =>\n Object.keys(state).find((key) => {\n const connectKey = state[key]?.model?.connectKey ?? \"\";\n return connectKey === model.connectKey;\n });\n\n/**\n */\nconst updateModel = (state: ModularUIState, model: ModularUIModel) => {\n const modelKey = getModelKey(state, model);\n\n if (modelKey) {\n return setModel(state, { key: modelKey, model });\n }\n\n throw new Error(\n `ModularUIReducer: Cannot update model with key ${model.connectKey}`,\n );\n};\n\n/**\n */\nconst removeKey = (modelKey: string, state: ModularUIState): ModularUIState => {\n const newState = Object.assign({}, state);\n delete newState[modelKey];\n return newState;\n};\n\n/**\n * Remove all but application models\n */\nconst resetModularUI = (state: ModularUIState) => {\n const newState: ModularUIState = {};\n\n for (const key in state) {\n if (state[key].model instanceof ApplicationModel) {\n newState[key] = { ...state[key] };\n }\n }\n\n return newState;\n};\n\nconst initialState: ModularUIState = {};\n\n/**\n * Modular UI Reducer\n */\nexport const ModularUIReducer: Reducer<ModularUIState, ReduxAction> = (\n state = initialState,\n action,\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"MODULARUI/INIT\":\n return initModularUI(state, action.payload);\n\n case \"MODULARUI/RESET\":\n return resetModularUI(state);\n\n case \"MODULARUI/STATUS\":\n return updateStatus(state, action.payload);\n\n case \"MODULARUI/SET\":\n return setModel(state, action.payload);\n\n case \"MODULARUI/UPDATE\":\n case \"MODULARUI/UPDATE_FORM\":\n return updateModel(state, action.payload);\n\n case \"MODULARUI/REMOVE_KEY\":\n return removeKey(action.payload, state);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAOA;AACA;AACA,MAAMG,YAAY,GAAGA,CACnBC,KAAqB,EAAAC,IAAA,KAElB;EAAA,IADH;IAAEC,GAAG;IAAEC;EAAgE,CAAC,GAAAF,IAAA;EAExE;EACA,IAAIE,MAAM,KAAKC,2BAAgB,CAACC,OAAO,IAAI,CAACL,KAAK,CAACE,GAAG,CAAC,EAAE;IACtD,OAAOF,KAAK;EACd;EAEA,OAAO;IACL,GAAGA,KAAK;IACR,CAACE,GAAG,GAAG;MACL,GAAGF,KAAK,CAACE,GAAG,CAA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AAA,CAAA,EAGjE;EAAA,IAFHlC,KAAK,GAAAmC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGF,YAAY;EAAA,IACpBK,MAAM,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAEN,IAAI,CAACC,MAAM,EAAE;IACX,OAAOtC,KAAK;EACd;EAEA,QAAQsC,MAAM,CAACC,IAAI;IACjB,KAAK,gBAAgB;MACnB,OAAOzB,aAAa,CAACd,KAAK,EAAEsC,MAAM,CAACE,OAAO,CAAC;IAE7C,KAAK,iBAAiB;MACpB,OAAOT,cAAc,CAAC/B,KAAK,CAAC;IAE9B,KAAK,kBAAkB;MACrB,OAAOD,YAAY,CAACC,KAAK,EAAEsC,MAAM,CAACE,OAAO,CAAC;IAE5C,KAAK,eAAe;MAClB,OAAO/B,QAAQ,CAACT,KAAK,EAAEsC,MAAM,CAACE,OAAO,CAAC;IAExC,KAAK,kBAAkB;IACvB,KAAK,uBAAuB;MAC1B,OAAOb,WAAW,CAAC3B,KAAK,EAAEsC,MAAM,CAACE,OAAO,CAAC;IAE3C,KAAK,sBAAsB;MACzB,OAAOV,SAAS,CAACQ,MAAM,CAACE,OAAO,EAAExC,KAAK,CAAC;IAEzC;MACE,OAAOA,KAAK;EAChB;AACF,CAAC;AAACyC,OAAA,CAAAP,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -134,16 +134,13 @@ describe("modularui actions", () => {
|
|
|
134
134
|
await store.dispatch(loadModularUI("application", "/", {}));
|
|
135
135
|
|
|
136
136
|
expect(store.getActions()).toStrictEqual([
|
|
137
|
-
{
|
|
138
|
-
type: "MODULARUI/STATUS",
|
|
139
|
-
payload: { key: "application", status: MODULARUI_STATUS.LOADING },
|
|
140
|
-
},
|
|
141
137
|
{
|
|
142
138
|
type: "START_PROGRESS",
|
|
143
139
|
},
|
|
144
140
|
{
|
|
145
141
|
type: "MODULARUI/FETCH",
|
|
146
142
|
payload: expect.objectContaining({
|
|
143
|
+
key: "application",
|
|
147
144
|
href: new Href("/"),
|
|
148
145
|
method: HTTP_METHODS.GET,
|
|
149
146
|
data: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type UpdateFormAction = {\n type: \"MODULARUI/UPDATE_FORM\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel,\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException,\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n key: string,\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n cache?: boolean,\n successAction: (\n model: ModularUIModel,\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>,\n) => ComponentType<any>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -16,14 +16,11 @@ describe("application actions", () => {
|
|
|
16
16
|
await store.dispatch(reloadApplication());
|
|
17
17
|
|
|
18
18
|
expect(store.getActions()).toStrictEqual([
|
|
19
|
-
{
|
|
20
|
-
type: "MODULARUI/STATUS",
|
|
21
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
22
|
-
},
|
|
23
19
|
{ type: "START_PROGRESS" },
|
|
24
20
|
expect.objectContaining({
|
|
25
21
|
type: "MODULARUI/FETCH",
|
|
26
22
|
payload: expect.objectContaining({
|
|
23
|
+
key: "application(/)(en)",
|
|
27
24
|
href: new Href("/", "Application"),
|
|
28
25
|
}),
|
|
29
26
|
}),
|
|
@@ -43,10 +40,6 @@ describe("application actions", () => {
|
|
|
43
40
|
type: "MODULARUI/REMOVE_KEY",
|
|
44
41
|
payload: "/",
|
|
45
42
|
},
|
|
46
|
-
{
|
|
47
|
-
type: "MODULARUI/STATUS",
|
|
48
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
49
|
-
},
|
|
50
43
|
{ type: "START_PROGRESS" },
|
|
51
44
|
expect.objectContaining({
|
|
52
45
|
type: "MODULARUI/FETCH",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.56.
|
|
3
|
+
"version": "1.56.5",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"flow": "flow",
|
|
30
30
|
"flow:ci": "flow check",
|
|
31
31
|
"flow-typed-install": "flow-typed install -l .flow/flow-typed/ --ignoreDeps peer --overwrite",
|
|
32
|
-
"test": "jest",
|
|
32
|
+
"test": "jest --bail",
|
|
33
33
|
"test:ci": "jest --ci",
|
|
34
34
|
"test:changed": "jest --onlyChanged",
|
|
35
35
|
"upgrade-interactive": "npm-check -u",
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@babel/cli": "^7.25.7",
|
|
102
|
-
"@babel/core": "^7.25.
|
|
103
|
-
"@babel/eslint-parser": "^7.25.
|
|
102
|
+
"@babel/core": "^7.25.8",
|
|
103
|
+
"@babel/eslint-parser": "^7.25.8",
|
|
104
104
|
"@babel/eslint-plugin": "^7.25.7",
|
|
105
105
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
106
106
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
107
107
|
"@babel/plugin-transform-runtime": "^7.25.7",
|
|
108
|
-
"@babel/preset-env": "^7.25.
|
|
108
|
+
"@babel/preset-env": "^7.25.8",
|
|
109
109
|
"@babel/preset-flow": "^7.25.7",
|
|
110
110
|
"@babel/preset-react": "^7.25.7",
|
|
111
111
|
"@commitlint/cli": "^19.5.0",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"babel-jest": "^29.7.0",
|
|
116
116
|
"babel-plugin-styled-components": "^2.1.4",
|
|
117
117
|
"cherry-pick": "^0.5.0",
|
|
118
|
-
"commit-and-tag-version": "^12.
|
|
118
|
+
"commit-and-tag-version": "^12.5.0",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"documentation": "^14.0.2",
|
|
121
121
|
"eslint": "^8.57.0",
|
|
@@ -124,21 +124,21 @@
|
|
|
124
124
|
"eslint-plugin-ft-flow": "^3.0.11",
|
|
125
125
|
"eslint-plugin-import": "^2.31.0",
|
|
126
126
|
"eslint-plugin-jest": "^28.8.3",
|
|
127
|
-
"eslint-plugin-jsdoc": "^50.3
|
|
127
|
+
"eslint-plugin-jsdoc": "^50.4.3",
|
|
128
128
|
"eslint-plugin-react": "^7.37.1",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
130
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.14.0",
|
|
131
131
|
"flow-bin": "^0.200.1",
|
|
132
132
|
"flow-copy-source": "^2.0.9",
|
|
133
133
|
"flow-typed": "^3.9.0",
|
|
134
|
-
"hermes-eslint": "^0.
|
|
134
|
+
"hermes-eslint": "^0.25.0",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
136
|
"husky": "^9.1.6",
|
|
137
137
|
"jest": "^29.7.0",
|
|
138
138
|
"jest-environment-jsdom": "^29.7.0",
|
|
139
139
|
"jest-junit": "^16.0.0",
|
|
140
140
|
"jest-sonar-reporter": "^2.0.0",
|
|
141
|
-
"jscodeshift": "^0.
|
|
141
|
+
"jscodeshift": "^17.0.0",
|
|
142
142
|
"lint-staged": "^15.2.10",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
144
|
"prettier": "^3.3.3",
|
|
@@ -4,6 +4,8 @@ import { Provider } from "react-redux";
|
|
|
4
4
|
import { renderHook } from "@testing-library/react";
|
|
5
5
|
import xhrMock from "xhr-mock";
|
|
6
6
|
|
|
7
|
+
import { useLocation } from "react-router";
|
|
8
|
+
|
|
7
9
|
import {
|
|
8
10
|
useApplication,
|
|
9
11
|
useTab,
|
|
@@ -32,6 +34,11 @@ import {
|
|
|
32
34
|
const middlewares = [thunk];
|
|
33
35
|
const mockStore = configureMockStore(middlewares);
|
|
34
36
|
|
|
37
|
+
jest.mock("react-router", () => ({
|
|
38
|
+
...jest.requireActual("react-router"), // Keep other methods from react-router as is
|
|
39
|
+
useLocation: jest.fn(), // Mock useLocation
|
|
40
|
+
}));
|
|
41
|
+
|
|
35
42
|
const JSON_TYPE = "application/json";
|
|
36
43
|
|
|
37
44
|
describe("modularui hooks", () => {
|
|
@@ -64,14 +71,11 @@ describe("modularui hooks", () => {
|
|
|
64
71
|
expect(result.current).toBeNull();
|
|
65
72
|
|
|
66
73
|
expect(store.getActions()).toStrictEqual([
|
|
67
|
-
{
|
|
68
|
-
type: "MODULARUI/STATUS",
|
|
69
|
-
payload: { key: `${key}(${url})(en)`, status: "LOADING" },
|
|
70
|
-
},
|
|
71
74
|
{ type: "START_PROGRESS" },
|
|
72
75
|
{
|
|
73
76
|
type: "MODULARUI/FETCH",
|
|
74
77
|
payload: expect.objectContaining({
|
|
78
|
+
key: `${key}(${url})(en)`,
|
|
75
79
|
href: new Href(url),
|
|
76
80
|
locale: "en",
|
|
77
81
|
targetModel: targetModel,
|
|
@@ -83,6 +87,9 @@ describe("modularui hooks", () => {
|
|
|
83
87
|
// replace the real XHR object with the mock XHR object before each test
|
|
84
88
|
// eslint-disable-next-line jest/no-hooks
|
|
85
89
|
beforeEach(() => {
|
|
90
|
+
useLocation.mockReturnValue({
|
|
91
|
+
state: null,
|
|
92
|
+
});
|
|
86
93
|
xhrMock.setup();
|
|
87
94
|
});
|
|
88
95
|
|
|
@@ -61,14 +61,11 @@ describe("authentication hooks", () => {
|
|
|
61
61
|
|
|
62
62
|
expect(store.getActions()).toStrictEqual([
|
|
63
63
|
{ type: "START_PROGRESS" },
|
|
64
|
-
{
|
|
65
|
-
type: "MODULARUI/STATUS",
|
|
66
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
67
|
-
},
|
|
68
64
|
{ type: "START_PROGRESS" },
|
|
69
65
|
expect.objectContaining({
|
|
70
66
|
type: "MODULARUI/FETCH",
|
|
71
67
|
payload: expect.objectContaining({
|
|
68
|
+
key: "application(/)(en)",
|
|
72
69
|
href: new Href("/", "Application"),
|
|
73
70
|
}),
|
|
74
71
|
}),
|
|
@@ -108,14 +105,11 @@ describe("authentication hooks", () => {
|
|
|
108
105
|
expect(store.getActions()).toStrictEqual([
|
|
109
106
|
{ type: "START_PROGRESS" },
|
|
110
107
|
{ type: "MODULARUI/RESET" },
|
|
111
|
-
{
|
|
112
|
-
type: "MODULARUI/STATUS",
|
|
113
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
114
|
-
},
|
|
115
108
|
{ type: "START_PROGRESS" },
|
|
116
109
|
expect.objectContaining({
|
|
117
110
|
type: "MODULARUI/FETCH",
|
|
118
111
|
payload: expect.objectContaining({
|
|
112
|
+
key: "application(/)(en)",
|
|
119
113
|
href: new Href("/", "Application"),
|
|
120
114
|
}),
|
|
121
115
|
}),
|
|
@@ -3,6 +3,7 @@ import thunk from "redux-thunk";
|
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
4
|
import { renderHook } from "@testing-library/react";
|
|
5
5
|
import xhrMock from "xhr-mock";
|
|
6
|
+
import { useLocation } from "react-router";
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
useAttributeSet,
|
|
@@ -19,12 +20,22 @@ import { IllegalArgumentException } from "../../exceptions";
|
|
|
19
20
|
const middlewares = [thunk];
|
|
20
21
|
const mockStore = configureMockStore(middlewares);
|
|
21
22
|
|
|
23
|
+
jest.mock("react-router", () => ({
|
|
24
|
+
...jest.requireActual("react-router"), // Keep other methods from react-router as is
|
|
25
|
+
useLocation: jest.fn(), // Mock useLocation
|
|
26
|
+
}));
|
|
27
|
+
|
|
22
28
|
const JSON_TYPE = "application/json";
|
|
23
29
|
|
|
24
30
|
describe("form hooks", () => {
|
|
25
31
|
// replace the real XHR object with the mock XHR object before each test
|
|
26
32
|
// eslint-disable-next-line jest/no-hooks
|
|
27
|
-
beforeEach(() =>
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
useLocation.mockReturnValue({
|
|
35
|
+
state: null,
|
|
36
|
+
});
|
|
37
|
+
xhrMock.setup();
|
|
38
|
+
});
|
|
28
39
|
|
|
29
40
|
// put the real XHR object back and clear the mocks after each test
|
|
30
41
|
// eslint-disable-next-line jest/no-hooks
|
|
@@ -58,14 +69,11 @@ describe("form hooks", () => {
|
|
|
58
69
|
expect(result.current).toBeUndefined();
|
|
59
70
|
|
|
60
71
|
expect(store.getActions()).toStrictEqual([
|
|
61
|
-
{
|
|
62
|
-
type: "MODULARUI/STATUS",
|
|
63
|
-
payload: { key: "form(/form)(en)", status: "LOADING" },
|
|
64
|
-
},
|
|
65
72
|
{ type: "START_PROGRESS" },
|
|
66
73
|
{
|
|
67
74
|
type: "MODULARUI/FETCH",
|
|
68
75
|
payload: expect.objectContaining({
|
|
76
|
+
key: "form(/form)(en)",
|
|
69
77
|
href: new Href("/form?commit=false"),
|
|
70
78
|
locale: "en",
|
|
71
79
|
targetModel: FormModel,
|
|
@@ -102,17 +110,11 @@ describe("form hooks", () => {
|
|
|
102
110
|
href.resourcetype = "Form";
|
|
103
111
|
|
|
104
112
|
expect(store.getActions()).toStrictEqual([
|
|
105
|
-
{
|
|
106
|
-
type: "MODULARUI/STATUS",
|
|
107
|
-
payload: {
|
|
108
|
-
key: "form(/persons/persons/createperson)(en)",
|
|
109
|
-
status: "LOADING",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
113
|
{ type: "START_PROGRESS" },
|
|
113
114
|
{
|
|
114
115
|
type: "MODULARUI/FETCH",
|
|
115
116
|
payload: expect.objectContaining({
|
|
117
|
+
key: "form(/persons/persons/createperson)(en)",
|
|
116
118
|
href: href,
|
|
117
119
|
locale: "en",
|
|
118
120
|
targetModel: FormModel,
|
|
@@ -3,6 +3,7 @@ import thunk from "redux-thunk";
|
|
|
3
3
|
import { Provider } from "react-redux";
|
|
4
4
|
import { renderHook } from "@testing-library/react";
|
|
5
5
|
import xhrMock from "xhr-mock";
|
|
6
|
+
import { useLocation } from "react-router";
|
|
6
7
|
|
|
7
8
|
import {
|
|
8
9
|
ConceptIndexModel,
|
|
@@ -26,6 +27,11 @@ import {
|
|
|
26
27
|
const middlewares = [thunk];
|
|
27
28
|
const mockStore = configureMockStore(middlewares);
|
|
28
29
|
|
|
30
|
+
jest.mock("react-router", () => ({
|
|
31
|
+
...jest.requireActual("react-router"), // Keep other methods from react-router as is
|
|
32
|
+
useLocation: jest.fn(), // Mock useLocation
|
|
33
|
+
}));
|
|
34
|
+
|
|
29
35
|
const JSON_TYPE = "application/json";
|
|
30
36
|
|
|
31
37
|
describe("modelcatalog hooks", () => {
|
|
@@ -58,14 +64,11 @@ describe("modelcatalog hooks", () => {
|
|
|
58
64
|
expect(result.current).toBeNull();
|
|
59
65
|
|
|
60
66
|
expect(store.getActions()).toStrictEqual([
|
|
61
|
-
{
|
|
62
|
-
type: "MODULARUI/STATUS",
|
|
63
|
-
payload: { key: `${key}(${url})(en)`, status: "LOADING" },
|
|
64
|
-
},
|
|
65
67
|
{ type: "START_PROGRESS" },
|
|
66
68
|
{
|
|
67
69
|
type: "MODULARUI/FETCH",
|
|
68
70
|
payload: expect.objectContaining({
|
|
71
|
+
key: `${key}(${url})(en)`,
|
|
69
72
|
href: new Href(url),
|
|
70
73
|
locale: "en",
|
|
71
74
|
targetModel: targetModel,
|
|
@@ -77,6 +80,9 @@ describe("modelcatalog hooks", () => {
|
|
|
77
80
|
// replace the real XHR object with the mock XHR object before each test
|
|
78
81
|
// eslint-disable-next-line jest/no-hooks
|
|
79
82
|
beforeEach(() => {
|
|
83
|
+
useLocation.mockReturnValue({
|
|
84
|
+
state: null,
|
|
85
|
+
});
|
|
80
86
|
xhrMock.setup();
|
|
81
87
|
});
|
|
82
88
|
|
|
@@ -37,14 +37,11 @@ describe("model hooks", () => {
|
|
|
37
37
|
|
|
38
38
|
result.current.reload(application);
|
|
39
39
|
expect(store.getActions()).toStrictEqual([
|
|
40
|
-
{
|
|
41
|
-
type: "MODULARUI/STATUS",
|
|
42
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
43
|
-
},
|
|
44
40
|
{ type: "START_PROGRESS" },
|
|
45
41
|
{
|
|
46
42
|
type: "MODULARUI/FETCH",
|
|
47
43
|
payload: expect.objectContaining({
|
|
44
|
+
key: "application(/)(en)",
|
|
48
45
|
href: new Href("/", "Application"),
|
|
49
46
|
locale: "en",
|
|
50
47
|
}),
|
|
@@ -83,14 +80,11 @@ describe("model hooks", () => {
|
|
|
83
80
|
model.selfhref.equals(new Href("/")),
|
|
84
81
|
);
|
|
85
82
|
expect(store.getActions()).toStrictEqual([
|
|
86
|
-
{
|
|
87
|
-
type: "MODULARUI/STATUS",
|
|
88
|
-
payload: { key: "application(/)(en)", status: "LOADING" },
|
|
89
|
-
},
|
|
90
83
|
{ type: "START_PROGRESS" },
|
|
91
84
|
{
|
|
92
85
|
type: "MODULARUI/FETCH",
|
|
93
86
|
payload: expect.objectContaining({
|
|
87
|
+
key: "application(/)(en)",
|
|
94
88
|
href: new Href("/", "Application"),
|
|
95
89
|
locale: "en",
|
|
96
90
|
}),
|
|
@@ -130,14 +124,11 @@ describe("model hooks", () => {
|
|
|
130
124
|
model.selfhref.equals(new Href("/books/books")),
|
|
131
125
|
);
|
|
132
126
|
expect(store.getActions()).toStrictEqual([
|
|
133
|
-
{
|
|
134
|
-
type: "MODULARUI/STATUS",
|
|
135
|
-
payload: { key: "list(/books/books)(en)", status: "LOADING" },
|
|
136
|
-
},
|
|
137
127
|
{ type: "START_PROGRESS" },
|
|
138
128
|
{
|
|
139
129
|
type: "MODULARUI/FETCH",
|
|
140
130
|
payload: expect.objectContaining({
|
|
131
|
+
key: "list(/books/books)(en)",
|
|
141
132
|
href: caselist.selfhref,
|
|
142
133
|
locale: "en",
|
|
143
134
|
}),
|
|
@@ -6,16 +6,25 @@ import xhrMock from "xhr-mock";
|
|
|
6
6
|
|
|
7
7
|
import { useModularUIBasic } from "../useModularUIBasic";
|
|
8
8
|
import { ApplicationModel, Href } from "../../models";
|
|
9
|
+
import { useLocation } from "react-router";
|
|
9
10
|
|
|
10
11
|
const middlewares = [thunk];
|
|
11
12
|
const mockStore = configureMockStore(middlewares);
|
|
12
13
|
|
|
14
|
+
jest.mock("react-router", () => ({
|
|
15
|
+
...jest.requireActual("react-router"), // Keep other methods from react-router as is
|
|
16
|
+
useLocation: jest.fn(), // Mock useLocation
|
|
17
|
+
}));
|
|
18
|
+
|
|
13
19
|
const JSON_TYPE = "application/json";
|
|
14
20
|
|
|
15
21
|
describe("modularui hooks", () => {
|
|
16
22
|
// replace the real XHR object with the mock XHR object before each test
|
|
17
23
|
// eslint-disable-next-line jest/no-hooks
|
|
18
24
|
beforeEach(() => {
|
|
25
|
+
useLocation.mockReturnValue({
|
|
26
|
+
state: null,
|
|
27
|
+
});
|
|
19
28
|
xhrMock.setup();
|
|
20
29
|
});
|
|
21
30
|
|
|
@@ -57,10 +66,6 @@ describe("modularui hooks", () => {
|
|
|
57
66
|
expect(result.current).toBeNull();
|
|
58
67
|
|
|
59
68
|
expect(store.getActions()).toStrictEqual([
|
|
60
|
-
{
|
|
61
|
-
type: "MODULARUI/STATUS",
|
|
62
|
-
payload: { key: `app(/)(en)`, status: "LOADING" },
|
|
63
|
-
},
|
|
64
69
|
{ type: "START_PROGRESS" },
|
|
65
70
|
{
|
|
66
71
|
type: "MODULARUI/FETCH",
|
|
@@ -107,10 +112,6 @@ describe("modularui hooks", () => {
|
|
|
107
112
|
expect(result.current).toBeNull();
|
|
108
113
|
|
|
109
114
|
expect(store.getActions()).toStrictEqual([
|
|
110
|
-
{
|
|
111
|
-
type: "MODULARUI/STATUS",
|
|
112
|
-
payload: { key: `app(/)(en)`, status: "LOADING" },
|
|
113
|
-
},
|
|
114
115
|
{ type: "START_PROGRESS" },
|
|
115
116
|
{
|
|
116
117
|
type: "MODULARUI/FETCH",
|