@beinformed/ui 1.25.2 → 1.25.4

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.
Files changed (239) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/constants/Constants.js +5 -0
  3. package/esm/constants/Constants.js.map +1 -1
  4. package/esm/hooks/useAuthentication.js +5 -5
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/hooks/useModularUI.js.map +1 -1
  7. package/esm/hooks/useModularUIBasic.js +3 -0
  8. package/esm/hooks/useModularUIBasic.js.map +1 -1
  9. package/esm/hooks/useModularUIModel.js +7 -0
  10. package/esm/hooks/useModularUIModel.js.map +1 -1
  11. package/esm/hooks/useModularUIRequest.js +5 -7
  12. package/esm/hooks/useModularUIRequest.js.map +1 -1
  13. package/esm/models/application/ApplicationModel.js +9 -1
  14. package/esm/models/application/ApplicationModel.js.map +1 -1
  15. package/esm/models/base/ResourceModel.js +7 -0
  16. package/esm/models/base/ResourceModel.js.map +1 -1
  17. package/esm/models/caseview/CaseViewModel.js +6 -0
  18. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  19. package/esm/models/concepts/BusinessScenarioModel.js +6 -0
  20. package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
  21. package/esm/models/concepts/ConceptDetailModel.js +6 -0
  22. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  23. package/esm/models/concepts/ConceptIndexModel.js +6 -0
  24. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  25. package/esm/models/concepts/ConceptTypeDetailModel.js +6 -0
  26. package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
  27. package/esm/models/content/ContentIndexModel.js +6 -0
  28. package/esm/models/content/ContentIndexModel.js.map +1 -1
  29. package/esm/models/content/ContentModel.js +6 -0
  30. package/esm/models/content/ContentModel.js.map +1 -1
  31. package/esm/models/content/ContentTOCModel.js +6 -0
  32. package/esm/models/content/ContentTOCModel.js.map +1 -1
  33. package/esm/models/content/ContentTypeModel.js +6 -0
  34. package/esm/models/content/ContentTypeModel.js.map +1 -1
  35. package/esm/models/detail/DetailModel.js +6 -0
  36. package/esm/models/detail/DetailModel.js.map +1 -1
  37. package/esm/models/form/FormModel.js +6 -0
  38. package/esm/models/form/FormModel.js.map +1 -1
  39. package/esm/models/list/ListDetailModel.js +6 -0
  40. package/esm/models/list/ListDetailModel.js.map +1 -1
  41. package/esm/models/list/ListModel.js +6 -0
  42. package/esm/models/list/ListModel.js.map +1 -1
  43. package/esm/models/lookup/LookupOptionsModel.js +6 -0
  44. package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
  45. package/esm/models/modelcatalog/ModelCatalogModel.js +6 -0
  46. package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
  47. package/esm/models/panels/GroupingPanelModel.js +6 -0
  48. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  49. package/esm/models/resolveModel.js +4 -4
  50. package/esm/models/resolveModel.js.map +1 -1
  51. package/esm/models/search/CaseSearchModel.js +6 -0
  52. package/esm/models/search/CaseSearchModel.js.map +1 -1
  53. package/esm/models/tab/TabModel.js +6 -0
  54. package/esm/models/tab/TabModel.js.map +1 -1
  55. package/esm/models/taskgroup/TaskGroupModel.js +6 -0
  56. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  57. package/esm/models/types.js.map +1 -1
  58. package/esm/models/user/UserModel.js +6 -0
  59. package/esm/models/user/UserModel.js.map +1 -1
  60. package/esm/models/user/UserProfileModel.js +6 -0
  61. package/esm/models/user/UserProfileModel.js.map +1 -1
  62. package/esm/models/user/UserServicesModel.js +6 -0
  63. package/esm/models/user/UserServicesModel.js.map +1 -1
  64. package/esm/modularui/ModularUIRequest.js +38 -11
  65. package/esm/modularui/ModularUIRequest.js.map +1 -1
  66. package/esm/modularui/types.js +2 -0
  67. package/esm/modularui/types.js.map +1 -0
  68. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  69. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  70. package/esm/redux/_modularui/types.js.map +1 -1
  71. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  72. package/esm/utils/fetch/types.js.map +1 -1
  73. package/lib/constants/Constants.js +7 -1
  74. package/lib/constants/Constants.js.flow +6 -0
  75. package/lib/constants/Constants.js.map +1 -1
  76. package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
  77. package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
  78. package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +2 -2
  79. package/lib/hooks/useAuthentication.js +4 -4
  80. package/lib/hooks/useAuthentication.js.flow +17 -5
  81. package/lib/hooks/useAuthentication.js.map +1 -1
  82. package/lib/hooks/useModularUI.js.flow +2 -2
  83. package/lib/hooks/useModularUI.js.map +1 -1
  84. package/lib/hooks/useModularUIBasic.js +3 -0
  85. package/lib/hooks/useModularUIBasic.js.flow +6 -3
  86. package/lib/hooks/useModularUIBasic.js.map +1 -1
  87. package/lib/hooks/useModularUIModel.js +9 -1
  88. package/lib/hooks/useModularUIModel.js.flow +18 -10
  89. package/lib/hooks/useModularUIModel.js.map +1 -1
  90. package/lib/hooks/useModularUIRequest.js +5 -7
  91. package/lib/hooks/useModularUIRequest.js.flow +12 -11
  92. package/lib/hooks/useModularUIRequest.js.map +1 -1
  93. package/lib/models/application/ApplicationModel.js +8 -1
  94. package/lib/models/application/ApplicationModel.js.flow +10 -1
  95. package/lib/models/application/ApplicationModel.js.map +1 -1
  96. package/lib/models/base/ResourceModel.js +7 -0
  97. package/lib/models/base/ResourceModel.js.flow +7 -0
  98. package/lib/models/base/ResourceModel.js.map +1 -1
  99. package/lib/models/caseview/CaseViewModel.js +6 -0
  100. package/lib/models/caseview/CaseViewModel.js.flow +6 -0
  101. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  102. package/lib/models/concepts/BusinessScenarioModel.js +6 -0
  103. package/lib/models/concepts/BusinessScenarioModel.js.flow +6 -0
  104. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  105. package/lib/models/concepts/ConceptDetailModel.js +6 -0
  106. package/lib/models/concepts/ConceptDetailModel.js.flow +6 -0
  107. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  108. package/lib/models/concepts/ConceptIndexModel.js +6 -0
  109. package/lib/models/concepts/ConceptIndexModel.js.flow +6 -0
  110. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  111. package/lib/models/concepts/ConceptTypeDetailModel.js +6 -0
  112. package/lib/models/concepts/ConceptTypeDetailModel.js.flow +6 -0
  113. package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
  114. package/lib/models/content/ContentIndexModel.js +6 -0
  115. package/lib/models/content/ContentIndexModel.js.flow +6 -0
  116. package/lib/models/content/ContentIndexModel.js.map +1 -1
  117. package/lib/models/content/ContentModel.js +6 -0
  118. package/lib/models/content/ContentModel.js.flow +6 -0
  119. package/lib/models/content/ContentModel.js.map +1 -1
  120. package/lib/models/content/ContentTOCModel.js +6 -0
  121. package/lib/models/content/ContentTOCModel.js.flow +6 -0
  122. package/lib/models/content/ContentTOCModel.js.map +1 -1
  123. package/lib/models/content/ContentTypeModel.js +6 -0
  124. package/lib/models/content/ContentTypeModel.js.flow +6 -0
  125. package/lib/models/content/ContentTypeModel.js.map +1 -1
  126. package/lib/models/detail/DetailModel.js +6 -0
  127. package/lib/models/detail/DetailModel.js.flow +6 -0
  128. package/lib/models/detail/DetailModel.js.map +1 -1
  129. package/lib/models/form/FormModel.js +6 -0
  130. package/lib/models/form/FormModel.js.flow +6 -0
  131. package/lib/models/form/FormModel.js.map +1 -1
  132. package/lib/models/list/ListDetailModel.js +6 -0
  133. package/lib/models/list/ListDetailModel.js.flow +6 -0
  134. package/lib/models/list/ListDetailModel.js.map +1 -1
  135. package/lib/models/list/ListModel.js +6 -0
  136. package/lib/models/list/ListModel.js.flow +6 -0
  137. package/lib/models/list/ListModel.js.map +1 -1
  138. package/lib/models/lookup/LookupOptionsModel.js +6 -0
  139. package/lib/models/lookup/LookupOptionsModel.js.flow +6 -0
  140. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  141. package/lib/models/modelcatalog/ModelCatalogModel.js +6 -0
  142. package/lib/models/modelcatalog/ModelCatalogModel.js.flow +6 -0
  143. package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
  144. package/lib/models/panels/GroupingPanelModel.js +6 -0
  145. package/lib/models/panels/GroupingPanelModel.js.flow +6 -0
  146. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  147. package/lib/models/resolveModel.js +4 -3
  148. package/lib/models/resolveModel.js.flow +6 -4
  149. package/lib/models/resolveModel.js.map +1 -1
  150. package/lib/models/search/CaseSearchModel.js +6 -0
  151. package/lib/models/search/CaseSearchModel.js.flow +6 -0
  152. package/lib/models/search/CaseSearchModel.js.map +1 -1
  153. package/lib/models/tab/TabModel.js +6 -0
  154. package/lib/models/tab/TabModel.js.flow +6 -0
  155. package/lib/models/tab/TabModel.js.map +1 -1
  156. package/lib/models/taskgroup/TaskGroupModel.js +6 -0
  157. package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
  158. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  159. package/lib/models/types.js.flow +1 -1
  160. package/lib/models/types.js.map +1 -1
  161. package/lib/models/user/UserModel.js +6 -0
  162. package/lib/models/user/UserModel.js.flow +6 -0
  163. package/lib/models/user/UserModel.js.map +1 -1
  164. package/lib/models/user/UserProfileModel.js +6 -0
  165. package/lib/models/user/UserProfileModel.js.flow +6 -0
  166. package/lib/models/user/UserProfileModel.js.map +1 -1
  167. package/lib/models/user/UserServicesModel.js +6 -0
  168. package/lib/models/user/UserServicesModel.js.flow +6 -0
  169. package/lib/models/user/UserServicesModel.js.map +1 -1
  170. package/lib/modularui/ModularUIRequest.js +38 -11
  171. package/lib/modularui/ModularUIRequest.js.flow +65 -17
  172. package/lib/modularui/ModularUIRequest.js.map +1 -1
  173. package/lib/modularui/__tests__/ModularUIRequest.spec.js.flow +4 -9
  174. package/lib/modularui/types.js +2 -0
  175. package/lib/modularui/types.js.flow +4 -0
  176. package/lib/modularui/types.js.map +1 -0
  177. package/lib/redux/_modularui/ModularUIActions.js.flow +4 -4
  178. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  179. package/lib/redux/_modularui/ModularUIMiddleware.js.flow +3 -2
  180. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  181. package/lib/redux/_modularui/types.js.flow +4 -3
  182. package/lib/redux/_modularui/types.js.map +1 -1
  183. package/lib/redux/_modularui/withModularUI.js.flow +2 -2
  184. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  185. package/lib/utils/fetch/types.js.flow +12 -4
  186. package/lib/utils/fetch/types.js.map +1 -1
  187. package/package.json +7 -7
  188. package/src/constants/Constants.js +6 -0
  189. package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
  190. package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
  191. package/src/hooks/__tests__/useModularUIBasic.spec.js +2 -2
  192. package/src/hooks/useAuthentication.js +17 -5
  193. package/src/hooks/useModularUI.js +2 -2
  194. package/src/hooks/useModularUIBasic.js +6 -3
  195. package/src/hooks/useModularUIModel.js +18 -10
  196. package/src/hooks/useModularUIRequest.js +12 -11
  197. package/src/models/application/ApplicationModel.js +10 -1
  198. package/src/models/base/ResourceModel.js +7 -0
  199. package/src/models/caseview/CaseViewModel.js +6 -0
  200. package/src/models/concepts/BusinessScenarioModel.js +6 -0
  201. package/src/models/concepts/ConceptDetailModel.js +6 -0
  202. package/src/models/concepts/ConceptIndexModel.js +6 -0
  203. package/src/models/concepts/ConceptTypeDetailModel.js +6 -0
  204. package/src/models/content/ContentIndexModel.js +6 -0
  205. package/src/models/content/ContentModel.js +6 -0
  206. package/src/models/content/ContentTOCModel.js +6 -0
  207. package/src/models/content/ContentTypeModel.js +6 -0
  208. package/src/models/detail/DetailModel.js +6 -0
  209. package/src/models/form/FormModel.js +6 -0
  210. package/src/models/list/ListDetailModel.js +6 -0
  211. package/src/models/list/ListModel.js +6 -0
  212. package/src/models/lookup/LookupOptionsModel.js +6 -0
  213. package/src/models/modelcatalog/ModelCatalogModel.js +6 -0
  214. package/src/models/panels/GroupingPanelModel.js +6 -0
  215. package/src/models/resolveModel.js +6 -4
  216. package/src/models/search/CaseSearchModel.js +6 -0
  217. package/src/models/tab/TabModel.js +6 -0
  218. package/src/models/taskgroup/TaskGroupModel.js +6 -0
  219. package/src/models/types.js +1 -1
  220. package/src/models/user/UserModel.js +6 -0
  221. package/src/models/user/UserProfileModel.js +6 -0
  222. package/src/models/user/UserServicesModel.js +6 -0
  223. package/src/modularui/ModularUIRequest.js +65 -17
  224. package/src/modularui/__tests__/ModularUIRequest.spec.js +4 -9
  225. package/src/modularui/types.js +4 -0
  226. package/src/redux/_modularui/ModularUIActions.js +4 -4
  227. package/src/redux/_modularui/ModularUIMiddleware.js +3 -2
  228. package/src/redux/_modularui/types.js +4 -3
  229. package/src/redux/_modularui/withModularUI.js +2 -2
  230. package/src/utils/fetch/types.js +12 -4
  231. package/types/constants/Constants.d.ts +5 -0
  232. package/types/models/base/ResourceModel.d.ts +4 -0
  233. package/types/models/form/FormObjectModel.d.ts +28 -2
  234. package/types/models/resolveModel.d.ts +1 -1
  235. package/types/models/types.d.ts +1 -1
  236. package/types/modularui/ModularUIRequest.d.ts +15 -7
  237. package/types/modularui/types.d.ts +2 -0
  238. package/types/redux/_modularui/types.d.ts +2 -2
  239. package/types/utils/fetch/types.d.ts +8 -5
@@ -7,13 +7,14 @@ import typeof {
7
7
  HTTP_METHODS,
8
8
  MODULARUI_STATUS,
9
9
  } from "../../constants/Constants";
10
- import type { RequestBaseOptions } from "../../utils/fetch/types";
11
10
  import type { ComponentType } from "react";
11
+ import type { TargetModel } from "../../modularui/types";
12
+ import type { RequestModularUIOptions } from "../../utils/fetch/types";
12
13
 
13
14
  export type ModularUIOptions = {
14
15
  propName?: string,
15
16
  removeOnUnmount?: boolean,
16
- ...RequestBaseOptions,
17
+ ...RequestModularUIOptions,
17
18
  };
18
19
 
19
20
  export type ModelEntry = {
@@ -56,7 +57,7 @@ export type ModularUIAction = {
56
57
  data?: string | { [key: string]: string },
57
58
  locale: string,
58
59
  childmodels?: boolean,
59
- targetModel?: Class<ModularUIModel>,
60
+ targetModel?: TargetModel,
60
61
  successAction: (
61
62
  model: ModularUIModel
62
63
  ) => UpdateModelAction | SetModelAction,
@@ -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 { RequestBaseOptions } from \"../../utils/fetch/types\";\nimport type { ComponentType } from \"react\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestBaseOptions,\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 UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\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?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: Class<ModularUIModel>,\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":""}
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 UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\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?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\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":""}
@@ -21,9 +21,9 @@ import type {
21
21
  } from "../types";
22
22
  import type Href from "../../models/href/Href";
23
23
  import type { ModularUIModel } from "../../models/types";
24
- import type { RequestBaseOptions } from "../../utils/fetch/types";
25
24
  import type FetchException from "../../exceptions/FetchException";
26
25
  import type { ComponentType } from "react";
26
+ import type { RequestModularUIOptions } from "../../utils/fetch/types";
27
27
 
28
28
  type StateProps = {
29
29
  modularui: (href: Href, options: any) => ModularUIRequest,
@@ -35,7 +35,7 @@ type DispatchProps = {
35
35
  finishProgress: () => FinishProgressAction,
36
36
  reloadModel: (
37
37
  model: ModularUIModel,
38
- options?: RequestBaseOptions
38
+ options?: RequestModularUIOptions
39
39
  ) => ThunkAction,
40
40
  handleError: (error: Error | FetchException) => ThunkAction,
41
41
  };
@@ -1 +1 @@
1
- {"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { RequestBaseOptions } from \"../../utils/fetch/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestBaseOptions\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n }\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAkCA,MAAMA,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,UAACC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EACjB,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAACH,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACE,MAAM,GAAGL,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CAAC,CACJ;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1DV,SAAS,EAAEA,SAAS,CAACU,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,eAExBK,aAAa;AAAA"}
1
+ {"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n }\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAkCA,MAAMA,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,UAACC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EACjB,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAACH,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACE,MAAM,GAAGL,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CAAC,CACJ;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1DV,SAAS,EAAEA,SAAS,CAACU,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,eAExBK,aAAa;AAAA"}
@@ -1,10 +1,12 @@
1
1
  // @flow
2
2
  import typeof { HTTP_METHODS } from "../../constants/Constants";
3
3
  import type { ModularUIModel } from "../../models/types";
4
+ import type { TargetModel } from "../../modularui/types";
4
5
 
5
6
  export type RequestURLOptions = {
6
7
  url: string,
7
8
  };
9
+
8
10
  export type RequestBaseOptions = {
9
11
  method?: $Keys<HTTP_METHODS>,
10
12
  params?: string,
@@ -24,11 +26,17 @@ export type RequestBaseOptions = {
24
26
  includeContext?: boolean,
25
27
  locale?: string,
26
28
  cache?: boolean,
29
+ isReload?: boolean,
30
+ };
31
+
32
+ export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
33
+
34
+ export type RequestModularUIOptions = {
35
+ ...RequestBaseOptions,
36
+ targetModel?: TargetModel,
37
+ updateModel?: ModularUIModel,
27
38
  childmodels?: boolean,
28
39
  isValidationRequest?: boolean,
29
- targetModel?: Class<ModularUIModel>,
30
- updateModel?: ModularUIModel,
31
- isReload?: boolean,
40
+
32
41
  removeOnUnmount?: boolean,
33
42
  };
34
- export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: string | { [key: string]: string },\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n targetModel?: Class<ModularUIModel>,\n updateModel?: ModularUIModel,\n isReload?: boolean,\n removeOnUnmount?: boolean,\n};\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: string | { [key: string]: string },\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n updateModel?: ModularUIModel,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n\n removeOnUnmount?: boolean,\n};\n"],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.25.2",
3
+ "version": "1.25.4",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -100,7 +100,7 @@
100
100
  },
101
101
  "devDependencies": {
102
102
  "@babel/cli": "^7.20.7",
103
- "@babel/core": "^7.20.7",
103
+ "@babel/core": "^7.20.12",
104
104
  "@babel/eslint-parser": "^7.19.1",
105
105
  "@babel/eslint-plugin": "^7.19.1",
106
106
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -109,8 +109,8 @@
109
109
  "@babel/preset-env": "^7.20.2",
110
110
  "@babel/preset-flow": "^7.18.6",
111
111
  "@babel/preset-react": "^7.18.6",
112
- "@commitlint/cli": "^17.3.0",
113
- "@commitlint/config-conventional": "^17.3.0",
112
+ "@commitlint/cli": "^17.4.1",
113
+ "@commitlint/config-conventional": "^17.4.0",
114
114
  "@testing-library/react": "^13.4.0",
115
115
  "auditjs": "^4.0.39",
116
116
  "babel-jest": "^29.3.1",
@@ -123,7 +123,7 @@
123
123
  "eslint-plugin-babel": "^5.3.1",
124
124
  "eslint-plugin-ft-flow": "^2.0.3",
125
125
  "eslint-plugin-import": "^2.26.0",
126
- "eslint-plugin-jest": "^27.2.0",
126
+ "eslint-plugin-jest": "^27.2.1",
127
127
  "eslint-plugin-jsdoc": "^39.6.4",
128
128
  "eslint-plugin-react": "^7.31.11",
129
129
  "eslint-plugin-react-hooks": "^4.5.0",
@@ -133,7 +133,7 @@
133
133
  "flow-typed": "^3.8.0",
134
134
  "glob": "^8.0.3",
135
135
  "history": "^4.0.0",
136
- "husky": "^8.0.2",
136
+ "husky": "^8.0.3",
137
137
  "jest": "^29.3.1",
138
138
  "jest-environment-jsdom": "^29.3.1",
139
139
  "jest-junit": "^15.0.0",
@@ -141,7 +141,7 @@
141
141
  "jscodeshift": "^0.14.0",
142
142
  "lint-staged": "^13.1.0",
143
143
  "polished": "^4.0.0",
144
- "prettier": "^2.8.0",
144
+ "prettier": "^2.8.2",
145
145
  "react": "^18.0.0",
146
146
  "react-dom": "^18.0.0",
147
147
  "react-helmet-async": "^1.0.0",
@@ -193,3 +193,9 @@ export const LOGIN_PATH_SETTING = "FormClient.login_url";
193
193
  export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
194
194
  export const LOGIN_PASSWORD_SETTING = "FormClient.password_field_name";
195
195
  export const LOGOUT_PATH_SETTING = "FormClient.logout_url";
196
+
197
+ export const fallbackDefaultAuthenticationType = {
198
+ name: "Form based authentication",
199
+ authentication: "DefaultFormClient",
200
+ isPrimary: true,
201
+ };
@@ -61,7 +61,7 @@ describe("modularui hooks", () => {
61
61
  wrapper,
62
62
  });
63
63
 
64
- expect(result.current).toBeUndefined();
64
+ expect(result.current).toBeNull();
65
65
 
66
66
  expect(store.getActions()).toStrictEqual([
67
67
  {
@@ -55,7 +55,7 @@ describe("modelcatalog hooks", () => {
55
55
  wrapper,
56
56
  });
57
57
 
58
- expect(result.current).toBeUndefined();
58
+ expect(result.current).toBeNull();
59
59
 
60
60
  expect(store.getActions()).toStrictEqual([
61
61
  {
@@ -54,7 +54,7 @@ describe("modularui hooks", () => {
54
54
  }
55
55
  );
56
56
 
57
- expect(result.current).toBeUndefined();
57
+ expect(result.current).toBeNull();
58
58
 
59
59
  expect(store.getActions()).toStrictEqual([
60
60
  {
@@ -104,7 +104,7 @@ describe("modularui hooks", () => {
104
104
  }
105
105
  );
106
106
 
107
- expect(result.current).toBeUndefined();
107
+ expect(result.current).toBeNull();
108
108
 
109
109
  expect(store.getActions()).toStrictEqual([
110
110
  {
@@ -5,7 +5,11 @@ import { getApplication } from "../redux/_modularui/ModularUISelectors";
5
5
  import { login, logout, resetAuthErrors } from "../redux/actions";
6
6
 
7
7
  import Cache from "../utils/browser/Cache";
8
- import { BASE, getSetting } from "../constants";
8
+ import {
9
+ BASE,
10
+ fallbackDefaultAuthenticationType,
11
+ getSetting,
12
+ } from "../constants";
9
13
 
10
14
  import type { ResetAuthErrorsAction } from "../redux/types";
11
15
  import type { AuthenticationType } from "../models/types";
@@ -38,7 +42,9 @@ export const useLogin = (): LoginHook => {
38
42
 
39
43
  return {
40
44
  isAuthenticated,
41
- authenticationTypes: application?.authenticationTypes ?? [],
45
+ authenticationTypes: application?.authenticationTypes ?? [
46
+ fallbackDefaultAuthenticationType,
47
+ ],
42
48
  errorMessage: auth.error,
43
49
  resetErrors: () => dispatch(resetAuthErrors()),
44
50
  login: (username: string, password: string) =>
@@ -47,13 +53,17 @@ export const useLogin = (): LoginHook => {
47
53
  if (Cache.getItem("isRedirectLogin")) {
48
54
  // prevent endless loop in redirects when authentication type can't be redirected
49
55
  throw new IllegalStateException(
50
- `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri}'`
56
+ `Could not redirect to '${
57
+ authenticationType.authentication
58
+ }' using url: '${authenticationType.redirectUri ?? ""}'`
51
59
  );
52
60
  }
53
61
 
54
62
  if (!isAuthenticated) {
55
63
  Cache.setItem("isRedirectLogin", true);
56
- window.location.assign(`${BASE}${authenticationType.redirectUri}`);
64
+ window.location.assign(
65
+ `${BASE}${authenticationType.redirectUri ?? ""}`
66
+ );
57
67
  }
58
68
  },
59
69
  };
@@ -70,7 +80,9 @@ export const useLogout = (): LogoutHook => {
70
80
  const isAuthenticated = application?.isLoggedIn ?? false;
71
81
  return {
72
82
  isAuthenticated,
73
- authenticationTypes: application?.authenticationTypes ?? [],
83
+ authenticationTypes: application?.authenticationTypes ?? [
84
+ fallbackDefaultAuthenticationType,
85
+ ],
74
86
  logout: () => {
75
87
  if (Cache.getItem("isRedirectLogin")) {
76
88
  const origin = window.location.origin;
@@ -13,7 +13,7 @@ import useDeepCompareEffect from "./useDeepCompareEffect";
13
13
  import { useLocale } from "./useI18n";
14
14
 
15
15
  import type Href from "../models/href/Href";
16
- import type { RequestBaseOptions } from "../utils";
16
+ import type { RequestModularUIOptions } from "../utils";
17
17
 
18
18
  /**
19
19
  */
@@ -28,7 +28,7 @@ const useKeyForHook = (modelKey: string, url: string) => {
28
28
  export const useModularUI = (
29
29
  modelKey: string,
30
30
  url: string | Href,
31
- options: RequestBaseOptions = {
31
+ options: RequestModularUIOptions = {
32
32
  method: HTTP_METHODS.GET,
33
33
  removeOnUnmount: false,
34
34
  }
@@ -7,9 +7,9 @@ import { IllegalArgumentException, IllegalStateException } from "../exceptions";
7
7
 
8
8
  import type { ModularUIModel, Href } from "../models";
9
9
 
10
- type UseModularUIBasicOptions<T> = {
10
+ type UseModularUIBasicOptions<T: ModularUIModel> = {
11
11
  expectedModels: Array<string>,
12
- targetModel?: Class<T>,
12
+ targetModel?: Class<T> | Array<Class<T>>,
13
13
  };
14
14
 
15
15
  /**
@@ -21,7 +21,7 @@ export const useModularUIBasic = <T: ModularUIModel>(
21
21
  expectedModels: [],
22
22
  targetModel: undefined,
23
23
  }
24
- ): ?T => {
24
+ ): T | null => {
25
25
  const location = useLocation();
26
26
  if (!href) {
27
27
  throw new IllegalArgumentException("Missing href");
@@ -37,6 +37,7 @@ export const useModularUIBasic = <T: ModularUIModel>(
37
37
  useModularUIOptions.isReload = true;
38
38
  }
39
39
 
40
+ // $FlowFixMe[incompatible-call]
40
41
  const modularUI = useModularUI(key, href, useModularUIOptions);
41
42
 
42
43
  if (modularUI?.model) {
@@ -54,4 +55,6 @@ export const useModularUIBasic = <T: ModularUIModel>(
54
55
 
55
56
  return model;
56
57
  }
58
+
59
+ return null;
57
60
  };
@@ -14,7 +14,7 @@ import { useModularUIBasic } from "./useModularUIBasic";
14
14
  /**
15
15
  * Load application
16
16
  */
17
- export const useApplication = (): ?ApplicationModel =>
17
+ export const useApplication = (): ApplicationModel | null =>
18
18
  useModularUIBasic("application", "/", {
19
19
  expectedModels: ["Application"],
20
20
  targetModel: ApplicationModel,
@@ -23,7 +23,7 @@ export const useApplication = (): ?ApplicationModel =>
23
23
  /**
24
24
  * Load a tab by href
25
25
  */
26
- export const useTab = (href: string): ?TabModel =>
26
+ export const useTab = (href: string): TabModel | null =>
27
27
  useModularUIBasic("tab", href, {
28
28
  expectedModels: ["Tab"],
29
29
  targetModel: TabModel,
@@ -32,7 +32,7 @@ export const useTab = (href: string): ?TabModel =>
32
32
  /**
33
33
  * Load caseview by href
34
34
  */
35
- export const useCaseView = (href: string): ?CaseViewModel =>
35
+ export const useCaseView = (href: string): CaseViewModel | null =>
36
36
  useModularUIBasic("caseview", href, {
37
37
  expectedModels: ["CaseView"],
38
38
  targetModel: CaseViewModel,
@@ -42,14 +42,14 @@ export const useCaseView = (href: string): ?CaseViewModel =>
42
42
  */
43
43
  export const usePanel = (
44
44
  href: string
45
- ): ?ListModel | ?GroupingPanelModel | ?DetailModel =>
45
+ ): ListModel | GroupingPanelModel | DetailModel | null =>
46
46
  useModularUIBasic("panel", href, {
47
47
  expectedModels: ["List", "GroupingPanel", "Detail"],
48
48
  });
49
49
 
50
50
  /**
51
51
  */
52
- export const useList = (href: string): ?ListModel =>
52
+ export const useList = (href: string): ListModel | null =>
53
53
  useModularUIBasic("list", href, {
54
54
  expectedModels: ["List"],
55
55
  targetModel: ListModel,
@@ -57,7 +57,15 @@ export const useList = (href: string): ?ListModel =>
57
57
 
58
58
  /**
59
59
  */
60
- export const useListDetail = (href: string): ?ListDetailModel =>
60
+ export const useListOrDetail = (href: string): ListModel | DetailModel | null =>
61
+ useModularUIBasic("list", href, {
62
+ expectedModels: ["List", "Detail"],
63
+ targetModel: [ListModel, DetailModel],
64
+ });
65
+
66
+ /**
67
+ */
68
+ export const useListDetail = (href: string): ListDetailModel | null =>
61
69
  useModularUIBasic("listdetail", href, {
62
70
  expectedModels: ["ListDetail"],
63
71
  targetModel: ListDetailModel,
@@ -65,7 +73,7 @@ export const useListDetail = (href: string): ?ListDetailModel =>
65
73
 
66
74
  /**
67
75
  */
68
- export const useGroupingPanel = (href: string): ?GroupingPanelModel =>
76
+ export const useGroupingPanel = (href: string): GroupingPanelModel | null =>
69
77
  useModularUIBasic("groupingpanel", href, {
70
78
  expectedModels: ["GroupingPanel"],
71
79
  targetModel: GroupingPanelModel,
@@ -73,7 +81,7 @@ export const useGroupingPanel = (href: string): ?GroupingPanelModel =>
73
81
 
74
82
  /**
75
83
  */
76
- export const useDetailPanel = (href: string): ?DetailModel =>
84
+ export const useDetailPanel = (href: string): DetailModel | null =>
77
85
  useModularUIBasic("detailpanel", href, {
78
86
  expectedModels: ["Detail"],
79
87
  targetModel: DetailModel,
@@ -81,7 +89,7 @@ export const useDetailPanel = (href: string): ?DetailModel =>
81
89
 
82
90
  /**
83
91
  */
84
- export const useQuicksearch = (href: string): ?CaseSearchModel =>
92
+ export const useQuicksearch = (href: string): CaseSearchModel | null =>
85
93
  useModularUIBasic("quicksearch", href, {
86
94
  expectedModels: ["CaseSearch"],
87
95
  targetModel: CaseSearchModel,
@@ -89,7 +97,7 @@ export const useQuicksearch = (href: string): ?CaseSearchModel =>
89
97
 
90
98
  /**
91
99
  */
92
- export const useUserProfile = (href: string): ?UserProfileModel =>
100
+ export const useUserProfile = (href: string): UserProfileModel | null =>
93
101
  useModularUIBasic("userprofile", href, {
94
102
  expectedModels: ["UserProfile"],
95
103
  targetModel: UserProfileModel,
@@ -5,21 +5,22 @@ import { useSelector } from "react-redux";
5
5
  import ModularUIRequest from "../modularui/ModularUIRequest";
6
6
  import { getLocale } from "../redux/selectors/i18n";
7
7
 
8
- import type { RequestBaseOptions } from "../utils";
9
8
  import type Href from "../models/href/Href";
10
-
11
- const getModularUIRequest = createSelector([getLocale], (localeCode) => {
12
- return (href: Href, options?: $Shape<RequestBaseOptions>) => {
13
- const request = new ModularUIRequest(href, options);
14
- request.locale = localeCode;
15
- return request;
16
- };
17
- });
9
+ import type { RequestModularUIOptions } from "../utils";
18
10
 
19
11
  /**
20
12
  * Creates a ModularUIRequest with the locale as available in the redux store
21
13
  */
22
14
  export const useModularUIRequest = (): ((
23
15
  href: Href,
24
- options?: $Shape<RequestBaseOptions>
25
- ) => ModularUIRequest) => useSelector(getModularUIRequest);
16
+ options?: $Shape<RequestModularUIOptions>
17
+ ) => ModularUIRequest) =>
18
+ useSelector(
19
+ createSelector([getLocale], (localeCode) => {
20
+ return (href: Href, options?: $Shape<RequestModularUIOptions>) => {
21
+ const request = new ModularUIRequest(href, options);
22
+ request.locale = localeCode;
23
+ return request;
24
+ };
25
+ })
26
+ );
@@ -9,6 +9,7 @@ import type { ModularUIModel, AuthenticationType } from "../types";
9
9
  import type { ModularUIResponse } from "../../modularui";
10
10
  import type LinkCollection from "../links/LinkCollection";
11
11
  import type Href from "../href/Href";
12
+ import { fallbackDefaultAuthenticationType } from "../../constants";
12
13
 
13
14
  /**
14
15
  * The Application model
@@ -23,6 +24,12 @@ export default class ApplicationModel extends ResourceModel {
23
24
  return "Application";
24
25
  }
25
26
 
27
+ /**
28
+ */
29
+ static get modelName(): string {
30
+ return "ApplicationModel";
31
+ }
32
+
26
33
  /**
27
34
  */
28
35
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -68,7 +75,9 @@ export default class ApplicationModel extends ResourceModel {
68
75
  * Getting the authentication types of the application
69
76
  */
70
77
  get authenticationTypes(): Array<AuthenticationType> {
71
- const authenticationTypes = this.getContribution("security", []);
78
+ const authenticationTypes = this.getContribution("security", [
79
+ fallbackDefaultAuthenticationType,
80
+ ]);
72
81
 
73
82
  //put primary first
74
83
  return authenticationTypes?.sort(
@@ -37,6 +37,13 @@ class ResourceModel extends BaseModel implements IModelWithChildModels {
37
37
  this._lastServerUpdate = Date.now();
38
38
  }
39
39
 
40
+ /**
41
+ * Property to render name of a model, is original name after transpilation
42
+ */
43
+ static get modelName(): string {
44
+ throw new IllegalStateException(`No modelName set on the resource model`);
45
+ }
46
+
40
47
  /**
41
48
  * Returns true when the model is supported based on configuration found in contributions
42
49
  *
@@ -33,6 +33,12 @@ export default class CaseViewModel extends DetailModel {
33
33
  return "CaseView";
34
34
  }
35
35
 
36
+ /**
37
+ */
38
+ static get modelName(): string {
39
+ return "CaseViewModel";
40
+ }
41
+
36
42
  /**
37
43
  */
38
44
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -19,6 +19,12 @@ class BusinessScenarioModel extends ConceptDetailModel {
19
19
  return "BusinessScenario";
20
20
  }
21
21
 
22
+ /**
23
+ */
24
+ static get modelName(): string {
25
+ return "BusinessScenario";
26
+ }
27
+
22
28
  /**
23
29
  */
24
30
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -41,6 +41,12 @@ export default class ConceptDetailModel extends ResourceModel {
41
41
  return "ConceptDetail";
42
42
  }
43
43
 
44
+ /**
45
+ */
46
+ static get modelName(): string {
47
+ return "ConceptDetailModel";
48
+ }
49
+
44
50
  /**
45
51
  */
46
52
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -46,6 +46,12 @@ export default class ConceptIndexModel extends ResourceModel {
46
46
  return "ConceptIndex";
47
47
  }
48
48
 
49
+ /**
50
+ */
51
+ static get modelName(): string {
52
+ return "ConceptIndexModel";
53
+ }
54
+
49
55
  /**
50
56
  */
51
57
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -13,6 +13,12 @@ class ConceptTypeDetailModel extends ResourceModel {
13
13
  return "ConceptTypeDetail";
14
14
  }
15
15
 
16
+ /**
17
+ */
18
+ static get modelName(): string {
19
+ return "ConceptTypeDetailModel";
20
+ }
21
+
16
22
  /**
17
23
  */
18
24
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -41,6 +41,12 @@ export default class ContentIndexModel extends ResourceModel {
41
41
  return "ContentIndex";
42
42
  }
43
43
 
44
+ /**
45
+ */
46
+ static get modelName(): string {
47
+ return "ContentIndexModel";
48
+ }
49
+
44
50
  /**
45
51
  */
46
52
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -35,6 +35,12 @@ export default class ContentModel extends ResourceModel {
35
35
  return "Content";
36
36
  }
37
37
 
38
+ /**
39
+ */
40
+ static get modelName(): string {
41
+ return "ContentModel";
42
+ }
43
+
38
44
  /**
39
45
  */
40
46
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -49,6 +49,12 @@ export default class ContentTOCModel extends ResourceModel {
49
49
  return "ContentTOC";
50
50
  }
51
51
 
52
+ /**
53
+ */
54
+ static get modelName(): string {
55
+ return "ContentTOCModel";
56
+ }
57
+
52
58
  /**
53
59
  */
54
60
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -12,6 +12,12 @@ export default class ContentTypeModel extends ResourceModel {
12
12
  return "ContentType";
13
13
  }
14
14
 
15
+ /**
16
+ */
17
+ static get modelName(): string {
18
+ return "ContentTypeModel";
19
+ }
20
+
15
21
  /**
16
22
  */
17
23
  static isApplicableModel(data: ModularUIResponse): boolean {
@@ -37,6 +37,12 @@ export default class DetailModel extends ResourceModel {
37
37
  return "Detail";
38
38
  }
39
39
 
40
+ /**
41
+ */
42
+ static get modelName(): string {
43
+ return "DetailModel";
44
+ }
45
+
40
46
  /**
41
47
  */
42
48
  static isApplicableModel(data: ModularUIResponse): boolean {