@beinformed/ui 1.65.23 → 1.65.25

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 (299) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm/builder/mergeLayoutHintConfigurations.js +6 -5
  3. package/esm/builder/mergeLayoutHintConfigurations.js.flow +11 -5
  4. package/esm/builder/mergeLayoutHintConfigurations.js.map +1 -1
  5. package/esm/constants/Settings.js +4 -1
  6. package/esm/constants/Settings.js.flow +3 -3
  7. package/esm/constants/Settings.js.map +1 -1
  8. package/esm/hooks/__tests__/useAuthentication.spec.js.flow +100 -132
  9. package/esm/hooks/useAuthentication.js +21 -11
  10. package/esm/hooks/useAuthentication.js.flow +29 -26
  11. package/esm/hooks/useAuthentication.js.map +1 -1
  12. package/esm/hooks/useModelCatalog.js +1 -1
  13. package/esm/hooks/useModelCatalog.js.flow +1 -1
  14. package/esm/hooks/useModelCatalog.js.map +1 -1
  15. package/esm/hooks/useModularUI.js +1 -1
  16. package/esm/hooks/useModularUI.js.flow +1 -1
  17. package/esm/hooks/useModularUI.js.map +1 -1
  18. package/esm/i18n/Locale.js +3 -1
  19. package/esm/i18n/Locale.js.flow +2 -2
  20. package/esm/i18n/Locale.js.map +1 -1
  21. package/esm/models/actions/ActionCollection.js +1 -1
  22. package/esm/models/actions/ActionCollection.js.flow +3 -3
  23. package/esm/models/actions/ActionCollection.js.map +1 -1
  24. package/esm/models/application/ApplicationModel.js +6 -1
  25. package/esm/models/application/ApplicationModel.js.flow +7 -2
  26. package/esm/models/application/ApplicationModel.js.map +1 -1
  27. package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
  28. package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
  29. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  30. package/esm/models/attributes/CompositeAttributeModel.js +1 -1
  31. package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
  32. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  33. package/esm/models/attributes/NumberAttributeModel.js +3 -1
  34. package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
  35. package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
  36. package/esm/models/attributes/StringAttributeModel.js +5 -4
  37. package/esm/models/attributes/StringAttributeModel.js.flow +4 -4
  38. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  39. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  40. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
  41. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  42. package/esm/models/base/BaseModel.js +6 -5
  43. package/esm/models/base/BaseModel.js.flow +7 -5
  44. package/esm/models/base/BaseModel.js.map +1 -1
  45. package/esm/models/base/ResourceModel.js +6 -7
  46. package/esm/models/base/ResourceModel.js.flow +4 -4
  47. package/esm/models/base/ResourceModel.js.map +1 -1
  48. package/esm/models/concepts/ConceptDetailModel.js +16 -16
  49. package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
  50. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  51. package/esm/models/concepts/SourceReferenceCollection.js +1 -1
  52. package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
  53. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  54. package/esm/models/content/ContentLinkModel.js +6 -6
  55. package/esm/models/content/ContentLinkModel.js.flow +6 -6
  56. package/esm/models/content/ContentLinkModel.js.map +1 -1
  57. package/esm/models/filters/BaseFilterModel.js +3 -5
  58. package/esm/models/filters/BaseFilterModel.js.flow +4 -5
  59. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  60. package/esm/models/filters/StringFilterModel.js +3 -2
  61. package/esm/models/filters/StringFilterModel.js.flow +2 -2
  62. package/esm/models/filters/StringFilterModel.js.map +1 -1
  63. package/esm/models/form/FormModel.js +1 -1
  64. package/esm/models/form/FormModel.js.flow +1 -2
  65. package/esm/models/form/FormModel.js.map +1 -1
  66. package/esm/models/form/FormObjectModel.js +1 -1
  67. package/esm/models/form/FormObjectModel.js.flow +2 -3
  68. package/esm/models/form/FormObjectModel.js.map +1 -1
  69. package/esm/models/href/Href.js +2 -2
  70. package/esm/models/href/Href.js.flow +2 -2
  71. package/esm/models/href/Href.js.map +1 -1
  72. package/esm/models/index.js +2 -2
  73. package/esm/models/index.js.flow +1 -2
  74. package/esm/models/index.js.map +1 -1
  75. package/esm/models/links/normalizeLinkJSON.js +1 -1
  76. package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
  77. package/esm/models/links/normalizeLinkJSON.js.map +1 -1
  78. package/esm/modularui/Authenticate.js +7 -2
  79. package/esm/modularui/Authenticate.js.flow +4 -2
  80. package/esm/modularui/Authenticate.js.map +1 -1
  81. package/esm/modularui/ModularUIRequest.js +2 -5
  82. package/esm/modularui/ModularUIRequest.js.flow +2 -6
  83. package/esm/modularui/ModularUIRequest.js.map +1 -1
  84. package/esm/modularui/UploadRequest.js +3 -1
  85. package/esm/modularui/UploadRequest.js.flow +3 -1
  86. package/esm/modularui/UploadRequest.js.map +1 -1
  87. package/esm/react-client/client.js +22 -10
  88. package/esm/react-client/client.js.flow +17 -11
  89. package/esm/react-client/client.js.map +1 -1
  90. package/esm/react-client/contextPath.js +3 -1
  91. package/esm/react-client/contextPath.js.flow +2 -1
  92. package/esm/react-client/contextPath.js.map +1 -1
  93. package/esm/redux/_i18n/I18nActions.js.flow +1 -1
  94. package/esm/redux/_i18n/I18nActions.js.map +1 -1
  95. package/esm/redux/_i18n/I18nReducer.js +1 -4
  96. package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
  97. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  98. package/esm/redux/_modularui/ModularUIActions.js +1 -4
  99. package/esm/redux/_modularui/ModularUIActions.js.flow +3 -7
  100. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  101. package/esm/redux/_modularui/ModularUIConnector.js +2 -5
  102. package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -2
  103. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  104. package/esm/redux/_modularui/ModularUIReducer.js +6 -3
  105. package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
  106. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  107. package/esm/redux/_modularui/ModularUISelectors.js +12 -18
  108. package/esm/redux/_modularui/ModularUISelectors.js.flow +13 -14
  109. package/esm/redux/_modularui/ModularUISelectors.js.map +1 -1
  110. package/esm/redux/_modularui/withModularUI.js.flow +2 -2
  111. package/esm/redux/_modularui/withModularUI.js.map +1 -1
  112. package/esm/redux/actions/Application.js +32 -4
  113. package/esm/redux/actions/Application.js.flow +34 -5
  114. package/esm/redux/actions/Application.js.map +1 -1
  115. package/esm/redux/actions/Authorization.js +23 -26
  116. package/esm/redux/actions/Authorization.js.flow +30 -30
  117. package/esm/redux/actions/Authorization.js.map +1 -1
  118. package/esm/redux/actions/Error.js +2 -0
  119. package/esm/redux/actions/Error.js.flow +5 -4
  120. package/esm/redux/actions/Error.js.map +1 -1
  121. package/esm/redux/actions/Form.js.flow +1 -1
  122. package/esm/redux/actions/Form.js.map +1 -1
  123. package/esm/redux/actions/FormAttributeSet.js.flow +1 -1
  124. package/esm/redux/actions/FormAttributeSet.js.map +1 -1
  125. package/esm/redux/actions/FormAutosave.js.flow +1 -1
  126. package/esm/redux/actions/FormAutosave.js.map +1 -1
  127. package/esm/redux/actions/FormAutosubmit.js.flow +1 -1
  128. package/esm/redux/actions/FormAutosubmit.js.map +1 -1
  129. package/esm/redux/actions/FormAutoupdate.js.flow +1 -1
  130. package/esm/redux/actions/FormAutoupdate.js.map +1 -1
  131. package/esm/redux/actions/FormValidations.js.flow +1 -1
  132. package/esm/redux/actions/FormValidations.js.map +1 -1
  133. package/esm/redux/actions/Notification.js.flow +3 -3
  134. package/esm/redux/actions/Notification.js.map +1 -1
  135. package/esm/redux/actions/Preferences.js +4 -4
  136. package/esm/redux/actions/Preferences.js.flow +6 -10
  137. package/esm/redux/actions/Preferences.js.map +1 -1
  138. package/esm/redux/actions/SignIn.js +2 -4
  139. package/esm/redux/actions/SignIn.js.flow +4 -7
  140. package/esm/redux/actions/SignIn.js.map +1 -1
  141. package/esm/redux/actions/SignOut.js.flow +1 -1
  142. package/esm/redux/actions/SignOut.js.map +1 -1
  143. package/esm/redux/actions/__tests__/Application.spec.js.flow +67 -29
  144. package/esm/redux/actions/__tests__/Authorization.spec.js.flow +77 -83
  145. package/esm/redux/connectors/Form.js.flow +2 -2
  146. package/esm/redux/connectors/Form.js.map +1 -1
  147. package/esm/redux/connectors/FormAttributeSet.js.flow +2 -5
  148. package/esm/redux/connectors/FormAttributeSet.js.map +1 -1
  149. package/esm/redux/connectors/Progress.js.flow +1 -1
  150. package/esm/redux/connectors/Progress.js.map +1 -1
  151. package/esm/redux/connectors/SignIn.js.flow +1 -1
  152. package/esm/redux/connectors/SignIn.js.map +1 -1
  153. package/esm/redux/connectors/SignOut.js.flow +1 -1
  154. package/esm/redux/connectors/SignOut.js.map +1 -1
  155. package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
  156. package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
  157. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  158. package/esm/redux/store/configureStore.js +9 -2
  159. package/esm/redux/store/configureStore.js.flow +13 -2
  160. package/esm/redux/store/configureStore.js.map +1 -1
  161. package/esm/redux/types.js.flow +33 -5
  162. package/esm/redux/types.js.map +1 -1
  163. package/esm/utils/browser/Cache.js +3 -1
  164. package/esm/utils/browser/Cache.js.flow +2 -1
  165. package/esm/utils/browser/Cache.js.map +1 -1
  166. package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
  167. package/esm/utils/datetime/DateTimeUtil.js +6 -5
  168. package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
  169. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  170. package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
  171. package/esm/utils/fetch/universalFetch.js +7 -8
  172. package/esm/utils/fetch/universalFetch.js.flow +13 -14
  173. package/esm/utils/fetch/universalFetch.js.map +1 -1
  174. package/esm/utils/fetch/xhr.js +2 -5
  175. package/esm/utils/fetch/xhr.js.flow +2 -6
  176. package/esm/utils/fetch/xhr.js.map +1 -1
  177. package/esm/utils/helpers/createHref.js +2 -1
  178. package/esm/utils/helpers/createHref.js.flow +1 -1
  179. package/esm/utils/helpers/createHref.js.map +1 -1
  180. package/esm/utils/helpers/createUUID.js +2 -1
  181. package/esm/utils/helpers/createUUID.js.flow +1 -1
  182. package/esm/utils/helpers/createUUID.js.map +1 -1
  183. package/esm/utils/number/parseNumbers.js +4 -3
  184. package/esm/utils/number/parseNumbers.js.flow +3 -3
  185. package/esm/utils/number/parseNumbers.js.map +1 -1
  186. package/lib/builder/mergeLayoutHintConfigurations.js +6 -5
  187. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  188. package/lib/constants/Settings.js +4 -1
  189. package/lib/constants/Settings.js.map +1 -1
  190. package/lib/hooks/useAuthentication.js +21 -11
  191. package/lib/hooks/useAuthentication.js.map +1 -1
  192. package/lib/hooks/useModelCatalog.js +1 -1
  193. package/lib/hooks/useModelCatalog.js.map +1 -1
  194. package/lib/hooks/useModularUI.js +1 -1
  195. package/lib/hooks/useModularUI.js.map +1 -1
  196. package/lib/i18n/Locale.js +3 -1
  197. package/lib/i18n/Locale.js.map +1 -1
  198. package/lib/models/actions/ActionCollection.js +1 -1
  199. package/lib/models/actions/ActionCollection.js.map +1 -1
  200. package/lib/models/application/ApplicationModel.js +6 -1
  201. package/lib/models/application/ApplicationModel.js.map +1 -1
  202. package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
  203. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  204. package/lib/models/attributes/CompositeAttributeModel.js +1 -1
  205. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  206. package/lib/models/attributes/NumberAttributeModel.js +3 -1
  207. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  208. package/lib/models/attributes/StringAttributeModel.js +5 -4
  209. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  210. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  211. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  212. package/lib/models/base/BaseModel.js +6 -5
  213. package/lib/models/base/BaseModel.js.map +1 -1
  214. package/lib/models/base/ResourceModel.js +6 -7
  215. package/lib/models/base/ResourceModel.js.map +1 -1
  216. package/lib/models/concepts/ConceptDetailModel.js +16 -16
  217. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  218. package/lib/models/concepts/SourceReferenceCollection.js +1 -1
  219. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  220. package/lib/models/content/ContentLinkModel.js +6 -6
  221. package/lib/models/content/ContentLinkModel.js.map +1 -1
  222. package/lib/models/filters/BaseFilterModel.js +3 -5
  223. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  224. package/lib/models/filters/StringFilterModel.js +3 -2
  225. package/lib/models/filters/StringFilterModel.js.map +1 -1
  226. package/lib/models/form/FormModel.js +1 -1
  227. package/lib/models/form/FormModel.js.map +1 -1
  228. package/lib/models/form/FormObjectModel.js +1 -1
  229. package/lib/models/form/FormObjectModel.js.map +1 -1
  230. package/lib/models/href/Href.js +2 -2
  231. package/lib/models/href/Href.js.map +1 -1
  232. package/lib/models/index.js.map +1 -1
  233. package/lib/models/links/normalizeLinkJSON.js +1 -1
  234. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  235. package/lib/modularui/Authenticate.js +7 -2
  236. package/lib/modularui/Authenticate.js.map +1 -1
  237. package/lib/modularui/ModularUIRequest.js +2 -5
  238. package/lib/modularui/ModularUIRequest.js.map +1 -1
  239. package/lib/modularui/UploadRequest.js +3 -1
  240. package/lib/modularui/UploadRequest.js.map +1 -1
  241. package/lib/react-client/client.js +22 -10
  242. package/lib/react-client/client.js.map +1 -1
  243. package/lib/react-client/contextPath.js +4 -1
  244. package/lib/react-client/contextPath.js.map +1 -1
  245. package/lib/redux/_i18n/I18nActions.js.map +1 -1
  246. package/lib/redux/_i18n/I18nReducer.js +1 -4
  247. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  248. package/lib/redux/_modularui/ModularUIActions.js +1 -4
  249. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  250. package/lib/redux/_modularui/ModularUIConnector.js +2 -5
  251. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  252. package/lib/redux/_modularui/ModularUIReducer.js +6 -3
  253. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  254. package/lib/redux/_modularui/ModularUISelectors.js +12 -18
  255. package/lib/redux/_modularui/ModularUISelectors.js.map +1 -1
  256. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  257. package/lib/redux/actions/Application.js +33 -4
  258. package/lib/redux/actions/Application.js.map +1 -1
  259. package/lib/redux/actions/Authorization.js +23 -26
  260. package/lib/redux/actions/Authorization.js.map +1 -1
  261. package/lib/redux/actions/Error.js +2 -0
  262. package/lib/redux/actions/Error.js.map +1 -1
  263. package/lib/redux/actions/Form.js.map +1 -1
  264. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  265. package/lib/redux/actions/FormAutosave.js.map +1 -1
  266. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  267. package/lib/redux/actions/FormAutoupdate.js.map +1 -1
  268. package/lib/redux/actions/FormValidations.js.map +1 -1
  269. package/lib/redux/actions/Notification.js.map +1 -1
  270. package/lib/redux/actions/Preferences.js +4 -4
  271. package/lib/redux/actions/Preferences.js.map +1 -1
  272. package/lib/redux/actions/SignIn.js +2 -4
  273. package/lib/redux/actions/SignIn.js.map +1 -1
  274. package/lib/redux/actions/SignOut.js.map +1 -1
  275. package/lib/redux/connectors/Form.js.map +1 -1
  276. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  277. package/lib/redux/connectors/Progress.js.map +1 -1
  278. package/lib/redux/connectors/SignIn.js.map +1 -1
  279. package/lib/redux/connectors/SignOut.js.map +1 -1
  280. package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
  281. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  282. package/lib/redux/store/configureStore.js +9 -2
  283. package/lib/redux/store/configureStore.js.map +1 -1
  284. package/lib/redux/types.js.map +1 -1
  285. package/lib/utils/browser/Cache.js +3 -1
  286. package/lib/utils/browser/Cache.js.map +1 -1
  287. package/lib/utils/datetime/DateTimeUtil.js +6 -5
  288. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  289. package/lib/utils/fetch/universalFetch.js +7 -8
  290. package/lib/utils/fetch/universalFetch.js.map +1 -1
  291. package/lib/utils/fetch/xhr.js +2 -5
  292. package/lib/utils/fetch/xhr.js.map +1 -1
  293. package/lib/utils/helpers/createHref.js +2 -1
  294. package/lib/utils/helpers/createHref.js.map +1 -1
  295. package/lib/utils/helpers/createUUID.js +3 -1
  296. package/lib/utils/helpers/createUUID.js.map +1 -1
  297. package/lib/utils/number/parseNumbers.js +4 -3
  298. package/lib/utils/number/parseNumbers.js.map +1 -1
  299. package/package.json +9 -9
@@ -1,8 +1,6 @@
1
1
  // @flow
2
2
  import { useSelector, useDispatch } from "react-redux";
3
-
4
3
  import { login, logout, resetAuthErrors } from "../redux/actions";
5
-
6
4
  import Cache from "../utils/browser/Cache";
7
5
  import {
8
6
  getBasePath,
@@ -18,39 +16,40 @@ import type { AuthenticationType } from "../models/types";
18
16
 
19
17
  type LoginHook = {
20
18
  isAuthenticated: boolean,
21
- primaryAuthenticationType: AuthenticationType,
19
+ primaryAuthenticationType: ?AuthenticationType,
22
20
  authenticationTypes: Array<AuthenticationType>,
23
21
  errorMessage: ?string,
24
22
  resetErrors: () => ResetAuthErrorsAction,
25
- login: (username: string, password: string) => void,
23
+ login: (username: string, password: string) => any, // Changed to any for Promise support
26
24
  redirectLogin: (authenticationType: AuthenticationType) => void,
27
25
  };
26
+
28
27
  type LogoutHook = {
29
28
  isAuthenticated: boolean,
30
- primaryAuthenticationType: AuthenticationType,
29
+ primaryAuthenticationType: ?AuthenticationType,
31
30
  authenticationTypes: Array<AuthenticationType>,
32
- logout: () => void,
31
+ logout: () => any, // Changed to any for Promise support
33
32
  logoutUrl: string,
34
33
  };
35
34
 
36
35
  /**
36
+ * Hook for handling login logic
37
37
  */
38
38
  export const useLogin = (): LoginHook => {
39
39
  Cache.setItem("isRedirectLogin", false);
40
40
 
41
41
  const dispatch = useDispatch();
42
-
43
42
  const application = useApplication();
44
43
  const auth = useSelector((state) => state.auth);
45
44
 
46
45
  const isAuthenticated = application?.isLoggedIn ?? false;
47
-
48
- const primaryAuthenticationType = Cache.getItem("primaryAuthenticationType");
46
+ const cachedType = Cache.getItem("primaryAuthenticationType");
49
47
 
50
48
  return {
51
49
  isAuthenticated,
50
+ // Safely fallback to the first available type if nothing is cached
52
51
  primaryAuthenticationType:
53
- primaryAuthenticationType ?? application?.authenticationTypes[0],
52
+ cachedType ?? application?.authenticationTypes?.[0],
54
53
  authenticationTypes: application?.authenticationTypes ?? [],
55
54
  errorMessage: auth.error,
56
55
  resetErrors: () => dispatch(resetAuthErrors()),
@@ -58,17 +57,15 @@ export const useLogin = (): LoginHook => {
58
57
  dispatch(login(username, password)),
59
58
  redirectLogin: (authenticationType: AuthenticationType) => {
60
59
  if (Cache.getItem("isRedirectLogin")) {
61
- // prevent endless loop in redirects when authentication type can't be redirected
62
60
  throw new IllegalStateException(
63
- `Could not redirect to '${
64
- authenticationType.authentication
65
- }' using url: '${authenticationType.redirectUri ?? ""}'`,
61
+ `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? ""}'`,
66
62
  );
67
63
  }
68
64
 
69
65
  if (!isAuthenticated) {
70
66
  Cache.setItem("isRedirectLogin", true);
71
- window.location.assign(
67
+ // $FlowIssue
68
+ globalThis.location.assign(
72
69
  `${getBasePathServer()}${authenticationType.redirectUri ?? ""}`,
73
70
  );
74
71
  }
@@ -77,36 +74,42 @@ export const useLogin = (): LoginHook => {
77
74
  };
78
75
 
79
76
  /**
77
+ * Hook for handling logout logic
80
78
  */
81
79
  export const useLogout = (): LogoutHook => {
82
80
  const dispatch = useDispatch();
83
-
84
81
  const application = useApplication();
85
-
86
82
  const BASE_PATH = getBasePath();
87
-
88
83
  const authenticate = new Authenticate();
89
84
 
90
- const primaryAuthenticationType = Cache.getItem("primaryAuthenticationType");
91
-
92
85
  const isAuthenticated = application?.isLoggedIn ?? false;
86
+ const cachedType = Cache.getItem("primaryAuthenticationType");
87
+
93
88
  return {
94
89
  isAuthenticated,
95
90
  primaryAuthenticationType:
96
- primaryAuthenticationType ?? application?.authenticationTypes[0],
91
+ cachedType ?? application?.authenticationTypes?.[0],
97
92
  authenticationTypes: application?.authenticationTypes ?? [],
98
93
  logout: () => {
99
94
  const type = authenticate.authenticationType;
95
+
100
96
  if (type === INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {
101
97
  authenticate.redirectToLogout();
102
- } else if (Cache.getItem("isRedirectLogin")) {
103
- const origin = window.location.origin;
98
+ return; // Redirects stop execution
99
+ }
100
+
101
+ if (Cache.getItem("isRedirectLogin")) {
102
+ // $FlowIssue
103
+ const origin = globalThis.location.origin;
104
104
  const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;
105
105
  Cache.setItem("isRedirectLogin", false);
106
- window.location.assign(url);
107
- } else {
108
- return dispatch(logout());
106
+ // $FlowIssue
107
+ globalThis.location.assign(url);
108
+ return;
109
109
  }
110
+
111
+ // Returns the Promise from the logout thunk
112
+ return dispatch(logout());
110
113
  },
111
114
  logoutUrl: authenticate.getLogoutUrl(),
112
115
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useAuthentication.js","names":["useSelector","useDispatch","login","logout","resetAuthErrors","Cache","getBasePath","getBasePathServer","INTERNAL_LOGIN_TYPE","IllegalStateException","Authenticate","useApplication","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","primaryAuthenticationType","getItem","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","authentication","redirectUri","window","location","assign","useLogout","BASE_PATH","authenticate","type","PAC4J_INDIRECT","redirectToLogout","origin","url","getLogoutUrl","logoutUrl"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\n\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\n\nimport Cache from \"../utils/browser/Cache\";\nimport {\n getBasePath,\n getBasePathServer,\n INTERNAL_LOGIN_TYPE,\n} from \"../constants\";\nimport { IllegalStateException } from \"../exceptions\";\nimport { Authenticate } from \"../modularui\";\nimport { useApplication } from \"./useModularUIModel\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\n\ntype LoginHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => void,\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\ntype LogoutHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => void,\n logoutUrl: string,\n};\n\n/**\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n\n const application = useApplication();\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n\n const primaryAuthenticationType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n primaryAuthenticationType:\n primaryAuthenticationType ?? application?.authenticationTypes[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n // prevent endless loop in redirects when authentication type can't be redirected\n throw new IllegalStateException(\n `Could not redirect to '${\n authenticationType.authentication\n }' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n window.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n\n const application = useApplication();\n\n const BASE_PATH = getBasePath();\n\n const authenticate = new Authenticate();\n\n const primaryAuthenticationType = Cache.getItem(\"primaryAuthenticationType\");\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n return {\n isAuthenticated,\n primaryAuthenticationType:\n primaryAuthenticationType ?? application?.authenticationTypes[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n logout: () => {\n const type = authenticate.authenticationType;\n if (type === INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {\n authenticate.redirectToLogout();\n } else if (Cache.getItem(\"isRedirectLogin\")) {\n const origin = window.location.origin;\n const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n window.location.assign(url);\n } else {\n return dispatch(logout());\n }\n },\n logoutUrl: authenticate.getLogoutUrl(),\n };\n};\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AAEtD,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AAEjE,OAAOC,KAAK,MAAM,wBAAwB;AAC1C,SACEC,WAAW,EACXC,iBAAiB,EACjBC,mBAAmB,QACd,cAAc;AACrB,SAASC,qBAAqB,QAAQ,eAAe;AACrD,SAASC,YAAY,QAAQ,cAAc;AAC3C,SAASC,cAAc,QAAQ,qBAAqB;AAsBpD;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;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,"file":"useAuthentication.js","names":["useSelector","useDispatch","login","logout","resetAuthErrors","Cache","getBasePath","getBasePathServer","INTERNAL_LOGIN_TYPE","IllegalStateException","Authenticate","useApplication","useLogin","setItem","dispatch","application","auth","state","isAuthenticated","isLoggedIn","cachedType","getItem","primaryAuthenticationType","authenticationTypes","errorMessage","error","resetErrors","username","password","redirectLogin","authenticationType","authentication","redirectUri","_globalThis","location","assign","useLogout","BASE_PATH","authenticate","type","PAC4J_INDIRECT","redirectToLogout","origin","url","getLogoutUrl","logoutUrl"],"sources":["../../src/hooks/useAuthentication.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { login, logout, resetAuthErrors } from \"../redux/actions\";\nimport Cache from \"../utils/browser/Cache\";\nimport {\n getBasePath,\n getBasePathServer,\n INTERNAL_LOGIN_TYPE,\n} from \"../constants\";\nimport { IllegalStateException } from \"../exceptions\";\nimport { Authenticate } from \"../modularui\";\nimport { useApplication } from \"./useModularUIModel\";\n\nimport type { ResetAuthErrorsAction } from \"../redux/types\";\nimport type { AuthenticationType } from \"../models/types\";\n\ntype LoginHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n errorMessage: ?string,\n resetErrors: () => ResetAuthErrorsAction,\n login: (username: string, password: string) => any, // Changed to any for Promise support\n redirectLogin: (authenticationType: AuthenticationType) => void,\n};\n\ntype LogoutHook = {\n isAuthenticated: boolean,\n primaryAuthenticationType: ?AuthenticationType,\n authenticationTypes: Array<AuthenticationType>,\n logout: () => any, // Changed to any for Promise support\n logoutUrl: string,\n};\n\n/**\n * Hook for handling login logic\n */\nexport const useLogin = (): LoginHook => {\n Cache.setItem(\"isRedirectLogin\", false);\n\n const dispatch = useDispatch();\n const application = useApplication();\n const auth = useSelector((state) => state.auth);\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n // Safely fallback to the first available type if nothing is cached\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n errorMessage: auth.error,\n resetErrors: () => dispatch(resetAuthErrors()),\n login: (username: string, password: string) =>\n dispatch(login(username, password)),\n redirectLogin: (authenticationType: AuthenticationType) => {\n if (Cache.getItem(\"isRedirectLogin\")) {\n throw new IllegalStateException(\n `Could not redirect to '${authenticationType.authentication}' using url: '${authenticationType.redirectUri ?? \"\"}'`,\n );\n }\n\n if (!isAuthenticated) {\n Cache.setItem(\"isRedirectLogin\", true);\n // $FlowIssue\n globalThis.location.assign(\n `${getBasePathServer()}${authenticationType.redirectUri ?? \"\"}`,\n );\n }\n },\n };\n};\n\n/**\n * Hook for handling logout logic\n */\nexport const useLogout = (): LogoutHook => {\n const dispatch = useDispatch();\n const application = useApplication();\n const BASE_PATH = getBasePath();\n const authenticate = new Authenticate();\n\n const isAuthenticated = application?.isLoggedIn ?? false;\n const cachedType = Cache.getItem(\"primaryAuthenticationType\");\n\n return {\n isAuthenticated,\n primaryAuthenticationType:\n cachedType ?? application?.authenticationTypes?.[0],\n authenticationTypes: application?.authenticationTypes ?? [],\n logout: () => {\n const type = authenticate.authenticationType;\n\n if (type === INTERNAL_LOGIN_TYPE.PAC4J_INDIRECT) {\n authenticate.redirectToLogout();\n return; // Redirects stop execution\n }\n\n if (Cache.getItem(\"isRedirectLogin\")) {\n // $FlowIssue\n const origin = globalThis.location.origin;\n const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;\n Cache.setItem(\"isRedirectLogin\", false);\n // $FlowIssue\n globalThis.location.assign(url);\n return;\n }\n\n // Returns the Promise from the logout thunk\n return dispatch(logout());\n },\n logoutUrl: authenticate.getLogoutUrl(),\n };\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,KAAK,EAAEC,MAAM,EAAEC,eAAe,QAAQ,kBAAkB;AACjE,OAAOC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AAC,iBAAiB,EAAE,KAAK,CAAC;QACvC;QACAoB,WAAA,CAAWC,QAAQ,CAACC,MAAM,CAACQ,GAAG,CAAC;QAC/B;MACF;;MAEA;MACA,OAAO7B,QAAQ,CAACX,MAAM,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD0C,SAAS,EAAEP,YAAY,CAACM,YAAY,CAAC;EACvC,CAAC;AACH,CAAC","ignoreList":[]}
@@ -158,7 +158,7 @@ export const useEntryDate = () => {
158
158
  const entryDate = useSelector(getEntryDate);
159
159
  return {
160
160
  entryDate,
161
- setEntryDate: entryDate => dispatch(updateEntryDate(entryDate))
161
+ setEntryDate: date => dispatch(updateEntryDate(date))
162
162
  };
163
163
  };
164
164
 
@@ -233,7 +233,7 @@ export const useEntryDate = (): ({
233
233
 
234
234
  return {
235
235
  entryDate,
236
- setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),
236
+ setEntryDate: (date: ISO_DATE) => dispatch(updateEntryDate(date)),
237
237
  };
238
238
  };
239
239
 
@@ -1 +1 @@
1
- {"version":3,"file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","Href","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","useCompleteSource","contentHref","removeParameter","addParameter","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","setEntryDate","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (entryDate: ISO_DATE) => dispatch(updateEntryDate(entryDate)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,OAAOC,IAAI,MAAM,qBAAqB;AAWtC;AACA;AACA,OAAO,MAAMC,eAAe,GAC1BC,OAAqD,IAErDN,iBAAiB,CAAC,cAAc,EAAE,eAAe,EAAE;EACjDO,cAAc,EAAE,CAAC,cAAc,CAAC;EAChCC,WAAW,EAAEhB,iBAAiB;EAC9B,GAAGc;AACL,CAAC,CAAC;;AAEJ;AACA;AACA,OAAO,MAAMG,eAAe,GAAGA,CAC7BC,IAAmB,EACnBC,GAAY,GAAG,cAAc,EAC7BL,OAAqD,KAC9B;EACvB,MAAM;IAAEM;EAAU,CAAC,GAAGC,YAAY,CAAC,CAAC;EACpC,MAAMC,GAAG,GAAGvB,gBAAgB,CAACmB,IAAI,EAAE,CACjC,OAAO,EACP,OAAO,EACP,eAAe,EACf,MAAM,CACP,CAAC;EACFI,GAAG,CAACC,YAAY,CAAC,WAAW,EAAEH,SAAS,CAAC;EAExC,OAAOZ,iBAAiB,CAACW,GA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file":"useModelCatalog.js","names":["useSelector","useDispatch","useLocation","createHref","filterParameters","ModelCatalogModel","ConceptIndexModel","ConceptDetailModel","default","BusinessScenarioModel","ContentIndexModel","ContentTOCModel","ContentModel","useModularUIBasic","ContentTypeModel","getEntryDate","updateEntryDate","Href","useModelCatalog","options","expectedModels","targetModel","useConceptIndex","href","key","entryDate","useEntryDate","url","setParameter","useConceptDetail","concept","location","useContentIndex","useContentTOC","content","useContent","useCompleteSource","contentHref","removeParameter","addParameter","useContentType","contentType","getSearchHref","uri","filters","filterString","_Object$keys","filterValue","value","Array","isArray","join","replace","push","length","useConceptSearch","useContentSearch","dispatch","setEntryDate","date","useRelatedConcepts"],"sources":["../../src/hooks/useModelCatalog.js"],"sourcesContent":["// @flow\nimport { useSelector, useDispatch } from \"react-redux\";\nimport { useLocation } from \"./useRouter\";\n\nimport { createHref, filterParameters } from \"../utils/helpers/createHref\";\n\nimport ModelCatalogModel from \"../models/modelcatalog/ModelCatalogModel\";\nimport ConceptIndexModel from \"../models/concepts/ConceptIndexModel\";\nimport ConceptDetailModel from \"../models/concepts/ConceptDetailModel\";\nimport { default as BusinessScenarioModel } from \"../models/concepts/BusinessScenarioModel\";\nimport ContentIndexModel from \"../models/content/ContentIndexModel\";\nimport ContentTOCModel from \"../models/content/ContentTOCModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport { useModularUIBasic } from \"./useModularUIBasic\";\nimport { ContentTypeModel } from \"../models\";\n\nimport { getEntryDate } from \"../redux/selectors/modelcatalog\";\nimport { updateEntryDate } from \"../redux/actions/ModelCatalog\";\n\nimport Href from \"../models/href/Href\";\nimport type { UseModularUIBasicOptions } from \"./useModularUIBasic\";\nimport type { UpdateEntryDateAction } from \"../redux\";\nexport type SearchFilter = {\n index?: string,\n label?: string,\n type?: string | Array<string>,\n modelCategory?: string | Array<string>,\n entryDate?: string,\n};\n\n/**\n */\nexport const useModelCatalog = (\n options?: UseModularUIBasicOptions<ModelCatalogModel>,\n): ?ModelCatalogModel =>\n useModularUIBasic(\"modelcatalog\", \"/modelcatalog\", {\n expectedModels: [\"ModelCatalog\"],\n targetModel: ModelCatalogModel,\n ...options,\n });\n\n/**\n */\nexport const useConceptIndex = (\n href: string | Href,\n key?: string = \"conceptindex\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\n \"index\",\n \"label\",\n \"modelcategory\",\n \"type\",\n ]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useConceptDetail = (\n concept: string | Href,\n key?: string = \"conceptdetail\",\n options?: UseModularUIBasicOptions<\n ConceptDetailModel | BusinessScenarioModel,\n >,\n): ?ConceptDetailModel | ?BusinessScenarioModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"concepts\", concept, entryDate, location, []);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ConceptDetail\", \"BusinessScenario\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentIndex = (\n href: string | Href,\n key?: string = \"contentindex\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const url = filterParameters(href, [\"index\", \"label\", \"type\"]);\n return useModularUIBasic(key, url, {\n expectedModels: [\"ContentIndex\"],\n targetModel: ContentIndexModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContentTOC = (\n content: string | Href,\n key?: string = \"contenttoc\",\n options?: UseModularUIBasicOptions<ContentTOCModel>,\n): ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentTOC\"],\n targetModel: ContentTOCModel,\n ...options,\n });\n};\n\n/**\n */\nexport const useContent = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n const href = createHref(\"content\", content, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useCompleteSource = (\n content: string | Href,\n key?: string = \"content\",\n options?: UseModularUIBasicOptions<ContentModel>,\n): ?ContentModel | ?ContentTOCModel => {\n const { entryDate } = useEntryDate();\n const location = useLocation();\n\n let contentHref = new Href(content);\n contentHref.removeParameter(\"complete\");\n contentHref.addParameter(\"complete\", \"true\");\n\n const href = createHref(\"content\", contentHref, entryDate, location, [\n \"complete\",\n ]);\n\n return useModularUIBasic(key, href, {\n expectedModels: [\"Content\", \"ContentTOC\"],\n ...options,\n });\n};\n\n/**\n */\nexport const useContentType = (\n contentType: string | Href,\n key?: string = \"contenttypes\",\n options?: UseModularUIBasicOptions<ContentTypeModel>,\n): ?ContentTypeModel => {\n const href = createHref(\"contenttypes\", contentType, null, null, []);\n return useModularUIBasic(key, href, {\n expectedModels: [\"ContentType\"],\n targetModel: ContentTypeModel,\n ...options,\n });\n};\n\n/**\n */\nconst getSearchHref = (uri: string, filters: SearchFilter): string => {\n const filterString = [];\n\n for (const key of Object.keys(filters)) {\n const filterValue = filters[key];\n if (filterValue) {\n let value: string = Array.isArray(filterValue)\n ? filterValue.join(\",\")\n : filterValue;\n if (key === \"type\") {\n value = value.replace(\"#\", \"%23\"); // handles un-encoded #\n }\n filterString.push(`${key}=${value}`);\n }\n }\n\n return filterString.length ? `${uri}?${filterString.join(\"&\")}` : uri;\n};\n\n/**\n */\nexport const useConceptSearch = (\n filters: SearchFilter,\n key?: string = \"conceptSearch\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const href = getSearchHref(\"/concepts\", filters);\n return useConceptIndex(href, key, options);\n};\n\n/**\n */\nexport const useContentSearch = (\n filters: SearchFilter,\n key?: string = \"contentSearch\",\n options?: UseModularUIBasicOptions<ContentIndexModel>,\n): ?ContentIndexModel => {\n const href = getSearchHref(\"/content\", filters);\n return useContentIndex(href, key, options);\n};\n\n/**\n * Retrieve and update the entrydate for the modelcatalog\n */\nexport const useEntryDate = (): ({\n entryDate: ISO_DATE,\n setEntryDate: (entryDate: ISO_DATE) => UpdateEntryDateAction,\n}) => {\n const dispatch = useDispatch();\n const entryDate = useSelector(getEntryDate);\n\n return {\n entryDate,\n setEntryDate: (date: ISO_DATE) => dispatch(updateEntryDate(date)),\n };\n};\n\n/**\n */\nexport const useRelatedConcepts = (\n href: string | Href,\n key?: string = \"relatedconcepts\",\n options?: UseModularUIBasicOptions<ConceptIndexModel>,\n): ?ConceptIndexModel => {\n const { entryDate } = useEntryDate();\n const url = filterParameters(href, [\"modelcategory\"]);\n url.setParameter(\"entryDate\", entryDate);\n\n return useModularUIBasic(key, url, {\n expectedModels: [\"ConceptIndex\"],\n targetModel: ConceptIndexModel,\n ...options,\n });\n};\n"],"mappings":";AACA,SAASA,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,aAAa;AAEzC,SAASC,UAAU,EAAEC,gBAAgB,QAAQ,6BAA6B;AAE1E,OAAOC,iBAAiB,MAAM,0CAA0C;AACxE,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,kBAAkB,MAAM,uCAAuC;AACtE,SAASC,OAAO,IAAIC,qBAAqB,QAAQ,0CAA0C;AAC3F,OAAOC,iBAAiB,MAAM,qCAAqC;AACnE,OAAOC,eAAe,MAAM,mCAAmC;AAC/D,OAAOC,YAAY,MAAM,gCAAgC;AAEzD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,gBAAgB,QAAQ,WAAW;AAE5C,SAASC,YAAY,QAAQ,iCAAiC;AAC9D,SAASC,eAAe,QAAQ,+BAA+B;AAE/D,OAAOC,IAAI,MAAM,qBA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AKF,QAAQ,CAACzC,eAAe,CAAC2C,IAAI,CAAC;EAClE,CAAC;AACH,CAAC;;AAED;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAGA,CAChCrC,IAAmB,EACnBC,GAAY,GAAG,iBAAiB,EAChCL,OAAqD,KAC9B;EACvB,MAAM;IAAEM;EAAU,CAAC,GAAGC,YAAY,CAAC,CAAC;EACpC,MAAMC,GAAG,GAAGvB,gBAAgB,CAACmB,IAAI,EAAE,CAAC,eAAe,CAAC,CAAC;EACrDI,GAAG,CAACC,YAAY,CAAC,WAAW,EAAEH,SAAS,CAAC;EAExC,OAAOZ,iBAAiB,CAACW,GAAG,EAAEG,GAAG,EAAE;IACjCP,cAAc,EAAE,CAAC,cAAc,CAAC;IAChCC,WAAW,EAAEf,iBAAiB;IAC9B,GAAGa;EACL,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -40,7 +40,7 @@ export const useModularUI = (modelKey, url, options = {}) => {
40
40
  const requestOptions = useMemo(() => {
41
41
  const merged = {
42
42
  method: HTTP_METHODS.GET,
43
- removeOnUnmount: true,
43
+ removeOnUnmount: false,
44
44
  ...options
45
45
  };
46
46
  if (url instanceof Href) {
@@ -55,7 +55,7 @@ export const useModularUI = (
55
55
  const requestOptions = useMemo(() => {
56
56
  const merged = {
57
57
  method: HTTP_METHODS.GET,
58
- removeOnUnmount: true,
58
+ removeOnUnmount: false,
59
59
  ...options,
60
60
  };
61
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"useModularUI.js","names":["useEffect","useMemo","useRef","useDispatch","useSelector","useLocation","HTTP_METHODS","MODULARUI_STATUS","loadModularUI","removeModelByKey","useDeepCompareEffect","useModularUIKey","Href","useModularUI","modelKey","url","options","dispatch","hrefInstance","requestUrl","toString","currentQueryString","querystring","prevQueryRef","key","model","state","modularui","requestOptions","merged","method","GET","removeOnUnmount","origin","contextPath","location","redirectLocation","shouldLoad","status","ERROR","current","equals","isReload"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useMemo, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\nimport { useModularUIKey } from \"./useModularUIKey\";\n\nimport Href from \"../models/href/Href\";\n\nimport type { RequestModularUIOptions } from \"../utils\";\nimport type { ModelEntry } from \"../redux\";\n\n/**\n * A custom hook to fetch and manage Be Informed modular UI resources.\n * It handles automatic data fetching based on URL/query changes, manages Redux state\n * synchronization, and provides cleanup logic when components unmount.\n *\n * @param {string} modelKey - A unique identifier for the type of model being fetched.\n * @param {string | Href} url - The endpoint URL or Href instance to fetch data from.\n * @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).\n * @returns {ModelEntry} The model data retrieved from the Redux store.\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = (({}: any): RequestModularUIOptions),\n): any => {\n const dispatch = useDispatch();\n\n // Normalize the URL input into a Href instance to safely access query params and paths\n const hrefInstance = useMemo(() => new Href(url), [url]);\n const requestUrl = useMemo(() => hrefInstance.toString(), [hrefInstance]);\n const currentQueryString = hrefInstance.querystring;\n\n // Persistence ref to detect if query parameters have changed between renders\n const prevQueryRef = useRef(currentQueryString);\n\n // Generate a unique key for the Redux store based on the model type and the full URL\n const key = useModularUIKey(modelKey, requestUrl);\n\n // Select the specific piece of state corresponding to this modular UI component\n const model = useSelector((state) => state.modularui[key]);\n\n /**\n * Memoize request options to prevent unnecessary re-renders.\n * Merges default settings (GET method, auto-cleanup) with user-provided options.\n */\n const requestOptions = useMemo(() => {\n const merged = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: true,\n ...options,\n };\n\n if (url instanceof Href) {\n merged.origin = merged.origin ?? url.origin;\n merged.contextPath = merged.contextPath ?? url.contextPath;\n }\n return merged;\n }, [options, url]);\n\n const location = useLocation();\n const redirectLocation = location.state?.redirectLocation;\n\n /**\n * Determines if a network request should be initiated.\n * Logic includes:\n * - Model doesn't exist yet (Initial load)\n * - Previous request resulted in an error (Retry)\n * - The query parameters changed (Filtering/Paging)\n * - A redirect was triggered specifically for this URL\n * - Manual 'isReload' flag is passed in options\n */\n const shouldLoad =\n model == null ||\n model.status === MODULARUI_STATUS.ERROR ||\n prevQueryRef.current !== currentQueryString ||\n (redirectLocation instanceof Href\n ? redirectLocation.equals(requestUrl)\n : false) ||\n requestOptions.isReload === true;\n\n // Synchronize the ref after the render cycle determines if we should load\n useEffect(() => {\n prevQueryRef.current = currentQueryString;\n }, [currentQueryString]);\n\n // Execute the load action. Deep compare is used on options to prevent\n // infinite loops caused by passing inline object literals.\n useDeepCompareEffect(() => {\n if (requestUrl !== \"\" && shouldLoad) {\n dispatch(loadModularUI(key, requestUrl, requestOptions));\n }\n }, [key, requestUrl, requestOptions, shouldLoad]);\n\n // Cleanup Effect:\n // If 'removeOnUnmount' is true, this removes the model data from the Redux store\n // when the component using this hook is destroyed.\n useEffect(() => {\n if (requestOptions.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n }, [dispatch, key, requestOptions.removeOnUnmount]);\n\n return model;\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,cAAc;AAC7D,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,OAAOC,IAAI,MAAM,qBAAqB;AAKtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY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;AACA;AACA;AACA;AACA;EACE,MAAMC,UAAU,GACdZ,KAAK,IAAI,IAAI,IACbA,KAAK,CAACa,MAAM,KAAK/B,gBAAgB,CAACgC,KAAK,IACvChB,YAAY,CAACiB,OAAO,KAAKnB,kBAAkB,KAC1Ce,gBAAgB,YAAYxB,IAAI,GAC7BwB,gBAAgB,CAACK,MAAM,CAACtB,UAAU,CAAC,GACnC,KAAK,CAAC,IACVS,cAAc,CAACc,QAAQ,KAAK,IAAI;;EAElC;EACA1C,SAAS,CAAC,MAAM;IACduB,YAAY,CAACiB,OAAO,GAAGnB,kBAAkB;EAC3C,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;;EAExB;EACA;EACAX,oBAAoB,CAAC,MAAM;IACzB,IAAIS,UAAU,KAAK,EAAE,IAAIkB,UAAU,EAAE;MACnCpB,QAAQ,CAACT,aAAa,CAACgB,GAAG,EAAEL,UAAU,EAAES,cAAc,CAAC,CAAC;IAC1D;EACF,CAAC,EAAE,CAACJ,GAAG,EAAEL,UAAU,EAAES,cAAc,EAAES,UAAU,CAAC,CAAC;;EAEjD;EACA;EACA;EACArC,SAAS,CAAC,MAAM;IACd,IAAI4B,cAAc,CAACI,eAAe,EAAE;MAClC,OAAO,MAAM;QACXf,QAAQ,CAACR,gBAAgB,CAACe,GAAG,CAAC,CAAC;MACjC,CAAC;IACH;EACF,CAAC,EAAE,CAACP,QAAQ,EAAEO,GAAG,EAAEI,cAAc,CAACI,eAAe,CAAC,CAAC;EAEnD,OAAOP,KAAK;AACd,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useModularUI.js","names":["useEffect","useMemo","useRef","useDispatch","useSelector","useLocation","HTTP_METHODS","MODULARUI_STATUS","loadModularUI","removeModelByKey","useDeepCompareEffect","useModularUIKey","Href","useModularUI","modelKey","url","options","dispatch","hrefInstance","requestUrl","toString","currentQueryString","querystring","prevQueryRef","key","model","state","modularui","requestOptions","merged","method","GET","removeOnUnmount","origin","contextPath","location","redirectLocation","shouldLoad","status","ERROR","current","equals","isReload"],"sources":["../../src/hooks/useModularUI.js"],"sourcesContent":["// @flow\nimport { useEffect, useMemo, useRef } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../constants\";\nimport {\n loadModularUI,\n removeModelByKey,\n} from \"../redux/_modularui/ModularUIActions\";\n\nimport useDeepCompareEffect from \"./useDeepCompareEffect\";\nimport { useModularUIKey } from \"./useModularUIKey\";\n\nimport Href from \"../models/href/Href\";\n\nimport type { RequestModularUIOptions } from \"../utils\";\nimport type { ModelEntry } from \"../redux\";\n\n/**\n * A custom hook to fetch and manage Be Informed modular UI resources.\n * It handles automatic data fetching based on URL/query changes, manages Redux state\n * synchronization, and provides cleanup logic when components unmount.\n *\n * @param {string} modelKey - A unique identifier for the type of model being fetched.\n * @param {string | Href} url - The endpoint URL or Href instance to fetch data from.\n * @param {RequestModularUIOptions} options - Configuration for the request (method, headers, etc.).\n * @returns {ModelEntry} The model data retrieved from the Redux store.\n */\nexport const useModularUI = (\n modelKey: string,\n url: string | Href,\n options: RequestModularUIOptions = (({}: any): RequestModularUIOptions),\n): any => {\n const dispatch = useDispatch();\n\n // Normalize the URL input into a Href instance to safely access query params and paths\n const hrefInstance = useMemo(() => new Href(url), [url]);\n const requestUrl = useMemo(() => hrefInstance.toString(), [hrefInstance]);\n const currentQueryString = hrefInstance.querystring;\n\n // Persistence ref to detect if query parameters have changed between renders\n const prevQueryRef = useRef(currentQueryString);\n\n // Generate a unique key for the Redux store based on the model type and the full URL\n const key = useModularUIKey(modelKey, requestUrl);\n\n // Select the specific piece of state corresponding to this modular UI component\n const model = useSelector((state) => state.modularui[key]);\n\n /**\n * Memoize request options to prevent unnecessary re-renders.\n * Merges default settings (GET method, auto-cleanup) with user-provided options.\n */\n const requestOptions = useMemo(() => {\n const merged = {\n method: HTTP_METHODS.GET,\n removeOnUnmount: false,\n ...options,\n };\n\n if (url instanceof Href) {\n merged.origin = merged.origin ?? url.origin;\n merged.contextPath = merged.contextPath ?? url.contextPath;\n }\n return merged;\n }, [options, url]);\n\n const location = useLocation();\n const redirectLocation = location.state?.redirectLocation;\n\n /**\n * Determines if a network request should be initiated.\n * Logic includes:\n * - Model doesn't exist yet (Initial load)\n * - Previous request resulted in an error (Retry)\n * - The query parameters changed (Filtering/Paging)\n * - A redirect was triggered specifically for this URL\n * - Manual 'isReload' flag is passed in options\n */\n const shouldLoad =\n model == null ||\n model.status === MODULARUI_STATUS.ERROR ||\n prevQueryRef.current !== currentQueryString ||\n (redirectLocation instanceof Href\n ? redirectLocation.equals(requestUrl)\n : false) ||\n requestOptions.isReload === true;\n\n // Synchronize the ref after the render cycle determines if we should load\n useEffect(() => {\n prevQueryRef.current = currentQueryString;\n }, [currentQueryString]);\n\n // Execute the load action. Deep compare is used on options to prevent\n // infinite loops caused by passing inline object literals.\n useDeepCompareEffect(() => {\n if (requestUrl !== \"\" && shouldLoad) {\n dispatch(loadModularUI(key, requestUrl, requestOptions));\n }\n }, [key, requestUrl, requestOptions, shouldLoad]);\n\n // Cleanup Effect:\n // If 'removeOnUnmount' is true, this removes the model data from the Redux store\n // when the component using this hook is destroyed.\n useEffect(() => {\n if (requestOptions.removeOnUnmount) {\n return () => {\n dispatch(removeModelByKey(key));\n };\n }\n }, [dispatch, key, requestOptions.removeOnUnmount]);\n\n return model;\n};\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAClD,SAASC,WAAW,EAAEC,WAAW,QAAQ,aAAa;AACtD,SAASC,WAAW,QAAQ,cAAc;AAE1C,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,cAAc;AAC7D,SACEC,aAAa,EACbC,gBAAgB,QACX,sCAAsC;AAE7C,OAAOC,oBAAoB,MAAM,wBAAwB;AACzD,SAASC,eAAe,QAAQ,mBAAmB;AAEnD,OAAOC,IAAI,MAAM,qBAAqB;AAKtC;AACA;AACA;A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,CAACT,KAAK,EAAEU,gBAAgB;;EAEzD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMC,UAAU,GACdZ,KAAK,IAAI,IAAI,IACbA,KAAK,CAACa,MAAM,KAAK/B,gBAAgB,CAACgC,KAAK,IACvChB,YAAY,CAACiB,OAAO,KAAKnB,kBAAkB,KAC1Ce,gBAAgB,YAAYxB,IAAI,GAC7BwB,gBAAgB,CAACK,MAAM,CAACtB,UAAU,CAAC,GACnC,KAAK,CAAC,IACVS,cAAc,CAACc,QAAQ,KAAK,IAAI;;EAElC;EACA1C,SAAS,CAAC,MAAM;IACduB,YAAY,CAACiB,OAAO,GAAGnB,kBAAkB;EAC3C,CAAC,EAAE,CAACA,kBAAkB,CAAC,CAAC;;EAExB;EACA;EACAX,oBAAoB,CAAC,MAAM;IACzB,IAAIS,UAAU,KAAK,EAAE,IAAIkB,UAAU,EAAE;MACnCpB,QAAQ,CAACT,aAAa,CAACgB,GAAG,EAAEL,UAAU,EAAES,cAAc,CAAC,CAAC;IAC1D;EACF,CAAC,EAAE,CAACJ,GAAG,EAAEL,UAAU,EAAES,cAAc,EAAES,UAAU,CAAC,CAAC;;EAEjD;EACA;EACA;EACArC,SAAS,CAAC,MAAM;IACd,IAAI4B,cAAc,CAACI,eAAe,EAAE;MAClC,OAAO,MAAM;QACXf,QAAQ,CAACR,gBAAgB,CAACe,GAAG,CAAC,CAAC;MACjC,CAAC;IACH;EACF,CAAC,EAAE,CAACP,QAAQ,EAAEO,GAAG,EAAEI,cAAc,CAACI,eAAe,CAAC,CAAC;EAEnD,OAAOP,KAAK;AACd,CAAC","ignoreList":[]}
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime-corejs3/helpers/esm/defineProperty";
2
+ import _replaceAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/replace-all";
2
3
  import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
3
4
  import formatMessage from "format-message";
4
5
  import languages from "./languages";
@@ -64,7 +65,8 @@ class Locale {
64
65
  * This method converts the ${} to {}
65
66
  */
66
67
  fixPlaceHoldersInObject(messages = {}) {
67
- return JSON.parse(_JSON$stringify(messages).replace(/'\$\{(?<key>.*?)}'/g, "''{$<key>}''").replace(/\$\{(?<key>.*?)}/g, "{$<key>}"));
68
+ var _context, _context2;
69
+ return JSON.parse(_replaceAllInstanceProperty(_context = _replaceAllInstanceProperty(_context2 = _JSON$stringify(messages)).call(_context2, /'\$\{(?<key>.*?)}'/g, "''{$<key>}''")).call(_context, /\$\{(?<key>.*?)}/g, "{$<key>}"));
68
70
  }
69
71
 
70
72
  /**
@@ -85,8 +85,8 @@ class Locale {
85
85
  fixPlaceHoldersInObject(messages: Object = {}): Object {
86
86
  return JSON.parse(
87
87
  JSON.stringify(messages)
88
- .replace(/'\$\{(?<key>.*?)}'/g, "''{$<key>}''")
89
- .replace(/\$\{(?<key>.*?)}/g, "{$<key>}"),
88
+ .replaceAll(/'\$\{(?<key>.*?)}'/g, "''{$<key>}''")
89
+ .replaceAll(/\$\{(?<key>.*?)}/g, "{$<key>}"),
90
90
  );
91
91
  }
92
92
 
@@ -1 +1 @@
1
- {"version":3,"file":"Locale.js","names":["formatMessage","languages","IllegalStateException","getSetting","Locale","constructor","locale","_defineProperty","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","setup","missingTranslation","aLocale","split","length","language","lang","toUpperCase","fixPlaceHolders","message","replace","JSON","parse","_JSON$stringify","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","debug","parameters","getMessage","update"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`,\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\"),\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `Message with id ${id} not found for locale ${this.code} in layout translations`,\n );\n }\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"mappings":";;AACA,OAAOA,aAAa,MAAM,gBAAgB;AAE1C,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,qBAAqB,QAAQ,eAAe;AAErD,SAASC,UAAU,QAAQ,cAAc;AAIzC;AACA;AACA;AACA,MAAMC,MAAM,CAAC;EAMXC,WAAWA,CAACC,MAA2B,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IACvC,IAAI,CAACC,KAAK,GAAGF,MAAM,CAACG,IAAI;IAExB,IAAI,CAACC,SAAS,GAAG,IAAI,CAACC,uBAAuB,CAACL,MAAM,CAACM,QAAQ,CAAC;IAC9D,IAAI,CAACC,OAAO,GAAG,IAAI,CAACF,uBAAuB,CAACL,MAAM,CAACQ,MAAM,CAAC;IAE1D,IAAI,CAACC,WAAW,GAAGT,MAAM,CAACU,UAAU;IAEpChB,aAAa,CAACiB,KAAK,CAAC;MAClBC,kBAAkB,EAAE;IACtB,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;EACE,IAAIT,I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ACG,MAAM;IACxC,CAAC;EACH;AACF;AAEA,eAAeV,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"Locale.js","names":["formatMessage","languages","IllegalStateException","getSetting","Locale","constructor","locale","_defineProperty","_code","code","_messages","fixPlaceHoldersInObject","messages","_errors","errors","_nativeName","nativeName","setup","missingTranslation","aLocale","split","length","language","lang","toUpperCase","fixPlaceHolders","message","replace","_context","_context2","JSON","parse","_replaceAllInstanceProperty","_JSON$stringify","call","getBaseMessage","id","defaultMessage","messageFromLocale","process","env","NODE_ENV","console","debug","parameters","getMessage","update"],"sources":["../../src/i18n/Locale.js"],"sourcesContent":["// @flow\nimport formatMessage from \"format-message\";\n\nimport languages from \"./languages\";\nimport { IllegalStateException } from \"../exceptions\";\n\nimport { getSetting } from \"../constants\";\n\nimport type { LocaleConfiguration, MessageParameters } from \"./types\";\n\n/**\n * Create a locale\n */\nclass Locale {\n _code: string;\n _messages: { [string]: string };\n _errors: { [string]: string };\n _nativeName: ?string;\n\n constructor(locale: LocaleConfiguration) {\n this._code = locale.code;\n\n this._messages = this.fixPlaceHoldersInObject(locale.messages);\n this._errors = this.fixPlaceHoldersInObject(locale.errors);\n\n this._nativeName = locale.nativeName;\n\n formatMessage.setup({\n missingTranslation: \"ignore\",\n });\n }\n\n /**\n * Retrieve locale code\n */\n get code(): string {\n return this._code;\n }\n\n /**\n * Retrieve nativeName\n */\n get nativeName(): string {\n if (this._nativeName) {\n return this._nativeName;\n }\n\n const aLocale = this.code.split(\"-\");\n\n if (aLocale.length > 0) {\n const language = languages.lang[aLocale[0]];\n\n if (language) {\n return (\n language[1] + (aLocale[1] ? ` (${aLocale[1].toUpperCase()})` : \"\")\n );\n }\n }\n\n throw new IllegalStateException(\n `Can not find language name based on locale: ${this.code}`,\n );\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHolders(message: ?string): null | string {\n if (typeof message === \"string\") {\n return message\n .replace(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replace(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\");\n }\n\n return null;\n }\n\n /**\n * Exported messages from Be Informed have placeholders in the syntax ${placeholder_name}\n * where the ICU messageformat module uses {placeholder_name}.\n * This method converts the ${} to {}\n */\n fixPlaceHoldersInObject(messages: Object = {}): Object {\n return JSON.parse(\n JSON.stringify(messages)\n .replaceAll(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n .replaceAll(/\\$\\{(?<key>.*?)}/g, \"{$<key>}\"),\n );\n }\n\n /**\n * Retrieve message by id\n */\n getBaseMessage(id: string, defaultMessage?: string): string {\n if (!id && !defaultMessage) {\n return \"[message: id or defaultMessage missing]\";\n }\n\n const messageFromLocale = this._messages[id] || this._errors[id];\n\n if (\n (typeof process === \"undefined\" ||\n process.env.NODE_ENV !== \"production\") &&\n !messageFromLocale &&\n id &&\n getSetting(\"DEBUG_I18N_MESSAGE_NOT_FOUND\")\n ) {\n // eslint-disable-next-line no-console\n console.debug(\n `Message with id ${id} not found for locale ${this.code} in layout translations`,\n );\n }\n return messageFromLocale || this.fixPlaceHolders(defaultMessage) || id;\n }\n\n /**\n * Format message using formatMessage library\n */\n formatMessage(message: string, parameters?: MessageParameters): string {\n if (parameters) {\n return formatMessage(message, parameters);\n }\n\n return message;\n }\n\n /**\n * Retrieve a messages with replaced parameters\n */\n getMessage(\n id: string,\n defaultMessage?: string,\n parameters?: MessageParameters,\n ): string {\n const message = this.getBaseMessage(id, defaultMessage);\n return this.formatMessage(message, parameters);\n }\n\n /**\n * Add or change messages for this locale. It is not possible to remove messages.\n */\n update(messages: Object = {}, errors: Object = {}) {\n this._messages = {\n ...this._messages,\n ...this.fixPlaceHoldersInObject(messages),\n };\n\n this._errors = {\n ...this._errors,\n ...this.fixPlaceHoldersInObject(errors),\n };\n }\n}\n\nexport default Locale;\n"],"mappings":";;;AACA,OAAOA,aAAa,MA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,IAAID,EAAE;EACxE;;EAEA;AACF;AACA;EACEpC,aAAaA,CAAC0B,OAAe,EAAEkB,UAA8B,EAAU;IACrE,IAAIA,UAAU,EAAE;MACd,OAAO5C,aAAa,CAAC0B,OAAO,EAAEkB,UAAU,CAAC;IAC3C;IAEA,OAAOlB,OAAO;EAChB;;EAEA;AACF;AACA;EACEmB,UAAUA,CACRT,EAAU,EACVC,cAAuB,EACvBO,UAA8B,EACtB;IACR,MAAMlB,OAAO,GAAG,IAAI,CAACS,cAAc,CAACC,EAAE,EAAEC,cAAc,CAAC;IACvD,OAAO,IAAI,CAACrC,aAAa,CAAC0B,OAAO,EAAEkB,UAAU,CAAC;EAChD;;EAEA;AACF;AACA;EACEE,MAAMA,CAAClC,QAAgB,GAAG,CAAC,CAAC,EAAEE,MAAc,GAAG,CAAC,CAAC,EAAE;IACjD,IAAI,CAACJ,SAAS,GAAG;MACf,GAAG,IAAI,CAACA,SAAS;MACjB,GAAG,IAAI,CAACC,uBAAuB,CAACC,QAAQ;IAC1C,CAAC;IAED,IAAI,CAACC,OAAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACf,GAAG,IAAI,CAACF,uBAAuB,CAACG,MAAM;IACxC,CAAC;EACH;AACF;AAEA,eAAeV,MAAM","ignoreList":[]}
@@ -17,7 +17,7 @@ export default class ActionCollection extends BaseCollection {
17
17
  } else if (Array.isArray(actionsContributions)) {
18
18
  const actionModels = [];
19
19
  for (const actionData of actions) {
20
- const actionContribution = _findInstanceProperty(actionsContributions).call(actionsContributions, actionContribution => actionContribution.name === actionData.name && actionContribution.type !== "service-operation");
20
+ const actionContribution = _findInstanceProperty(actionsContributions).call(actionsContributions, contribution => contribution.name === actionData.name && contribution.type !== "service-operation");
21
21
  if (actionContribution) {
22
22
  actionModels.push(new ActionModel(actionData, actionContribution, modelOptions));
23
23
  }
@@ -21,9 +21,9 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
21
21
  const actionModels = [];
22
22
  for (const actionData of actions) {
23
23
  const actionContribution = actionsContributions.find(
24
- (actionContribution) =>
25
- actionContribution.name === actionData.name &&
26
- actionContribution.type !== "service-operation",
24
+ (contribution) =>
25
+ contribution.name === actionData.name &&
26
+ contribution.type !== "service-operation",
27
27
  );
28
28
 
29
29
  if (actionContribution) {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_findInstanceProperty","call","name","type","push","getActionByKey","key","_context","newCollection","_filterInstanceProperty","action","first","getActionsByType","_context2","_includesInstanceProperty","getActionsByLayoutHint","hints","_context3","layouthint","has","hasActionsByLayoutHint","length","routePath","_context4","enabledRoutes","isDisabled","path","_mapInstanceProperty","selfhref","join"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (actionContribution) =>\n actionContribution.name === actionData.name &&\n actionContribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(actionData, actionContribution, modelOptions),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,WAAW,MAAM,eAAe;AAGvC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,cAAc,CAAc;EACxEG,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,YAA2B,EAC3B;IACA,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACK,UAAU,GAAG,EAAE;IACtB,CAAC,MAAM,IAAIF,KAAK,CAACC,OAAO,CAACH,oBAAoB,CAAC,EAAE;MAC9C,MAAMK,YAAY,GAAG,EAAE;MACvB,KAAK,MAAMC,UAAU,IAAIP,OAAO,EAAE;QAChC,MAAMQ,kBAAkB,GAAGC,qBAAA,CAAAR,oBAAoB,EAAAS,IAAA,CAApBT,oBAAoB,EAC5CO,kBAAkB,IACjBA,kBAAkB,CAACG,IAAI,KAAKJ,UAAU,CAACI,IAAI,IAC3CH,kBAAkB,CAACI,IAAI,KAAK,mBAChC,CAAC;QAED,IAAIJ,kBAAkB,EAAE;UACtB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F;AACA;EACEY,sBAAsBA,CAAC,GAAGJ,KAAoB,EAAW;IACvD,OAAO,IAAI,CAACD,sBAAsB,CAAC,GAAGC,KAAK,CAAC,CAACK,MAAM,GAAG,CAAC;EACzD;;EAEA;AACF;AACA;EACE,IAAIC,SAASA,CAAA,EAAW;IAAA,IAAAC,SAAA;IACtB,MAAMC,aAAa,GAAGf,uBAAA,CAAAc,SAAA,OAAI,CAAC3B,UAAU,EAAAK,IAAA,CAAAsB,SAAA,EAClCb,MAAM,IAAK,CAACA,MAAM,CAACe,UACtB,CAAC;IAED,IAAID,aAAa,CAACH,MAAM,KAAK,CAAC,EAAE;MAC9B,OAAO,wBAAwB;IACjC;IAEA,MAAMK,IAAI,GAAGC,oBAAA,CAAAH,aAAa,EAAAvB,IAAA,CAAbuB,aAAa,EAAMd,MAAM,IAAKA,MAAM,CAACkB,QAAQ,CAACF,IAAI,CAAC,CAACG,IAAI,CAAC,GAAG,CAAC;IAE1E,OAAO,IAAI,CAACR,MAAM,GAAG,CAAC,GAAG,IAAIK,IAAI,GAAG,GAAGA,IAAI;EAC7C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ActionCollection.js","names":["BaseCollection","ActionModel","ActionCollection","constructor","actions","actionsContributions","modelOptions","Array","isArray","collection","actionModels","actionData","actionContribution","_findInstanceProperty","call","contribution","name","type","push","getActionByKey","key","_context","newCollection","_filterInstanceProperty","action","first","getActionsByType","_context2","_includesInstanceProperty","getActionsByLayoutHint","hints","_context3","layouthint","has","hasActionsByLayoutHint","length","routePath","_context4","enabledRoutes","isDisabled","path","_mapInstanceProperty","selfhref","join"],"sources":["../../../src/models/actions/ActionCollection.js"],"sourcesContent":["// @flow\nimport BaseCollection from \"../base/BaseCollection\";\nimport ActionModel from \"./ActionModel\";\nimport type { ModelOptions } from \"../types\";\n\n/**\n * Collection of actions\n */\nexport default class ActionCollection extends BaseCollection<ActionModel> {\n constructor(\n actions?: Object,\n actionsContributions?: Object,\n modelOptions?: ModelOptions,\n ) {\n super();\n\n // no actions gives an empty collection\n if (!Array.isArray(actions)) {\n this.collection = [];\n } else if (Array.isArray(actionsContributions)) {\n const actionModels = [];\n for (const actionData of actions) {\n const actionContribution = actionsContributions.find(\n (contribution) =>\n contribution.name === actionData.name &&\n contribution.type !== \"service-operation\",\n );\n\n if (actionContribution) {\n actionModels.push(\n new ActionModel(actionData, actionContribution, modelOptions),\n );\n }\n }\n\n this.collection = actionModels;\n }\n }\n\n /**\n * Retrieve action by key\n */\n getActionByKey(key: string): ActionModel | null {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) => action.key === key);\n\n return newCollection.first;\n }\n\n /**\n * Retrieve actions by type\n */\n getActionsByType(type: string | Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n Array.isArray(type) ? type.includes(action.type) : action.type === type,\n );\n\n return newCollection;\n }\n\n /**\n * Retrieve actions including a layout hint\n */\n getActionsByLayoutHint(...hints: Array<string>): ActionCollection {\n const newCollection = new ActionCollection();\n\n newCollection.collection = this.filter((action) =>\n action.layouthint.has(...hints),\n );\n\n return newCollection;\n }\n\n /**\n * Indicates if an action with layout hint exists\n */\n hasActionsByLayoutHint(...hints: Array<string>): boolean {\n return this.getActionsByLayoutHint(...hints).length > 0;\n }\n\n /**\n * Use as path regex for react router routes\n */\n get routePath(): string {\n const enabledRoutes = this.collection.filter(\n (action) => !action.isDisabled,\n );\n\n if (enabledRoutes.length === 0) {\n return \"__NON_EXISTING_ROUTE__\";\n }\n\n const path = enabledRoutes.map((action) => action.selfhref.path).join(\"|\");\n\n return this.length > 1 ? `(${path})` : path;\n }\n}\n"],"mappings":";;;;AACA,OAAOA,cAAc,MAAM,wBAAwB;AACnD,OAAOC,WAAW,MAAM,eAAe;AAGvC;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASF,cAAc,CAAc;EACxEG,WAAWA,CACTC,OAAgB,EAChBC,oBAA6B,EAC7BC,YAA2B,EAC3B;IACA,KAA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enticationTypes) {
73
73
  var _context;
74
74
  //put primary first
75
- return ((_context = authenticationTypes) == null ? void 0 : Function.call.bind(_sortInstanceProperty(_context), _context))?.((a, b) => a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1);
75
+ return ((_context = authenticationTypes) == null ? void 0 : Function.call.bind(_sortInstanceProperty(_context), _context))?.((a, b) => {
76
+ if (a.isPrimary === b.isPrimary) {
77
+ return 0;
78
+ }
79
+ return a.isPrimary ? -1 : 1;
80
+ });
76
81
  }
77
82
  return [DEFAULT_AUTHENTICATION_TYPE];
78
83
  }
@@ -92,8 +92,13 @@ export default class ApplicationModel extends ResourceModel {
92
92
  if (authenticationTypes) {
93
93
  //put primary first
94
94
  return authenticationTypes?.sort(
95
- (a: AuthenticationType, b: AuthenticationType) =>
96
- a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1,
95
+ (a: AuthenticationType, b: AuthenticationType) => {
96
+ if (a.isPrimary === b.isPrimary) {
97
+ return 0;
98
+ }
99
+
100
+ return a.isPrimary ? -1 : 1;
101
+ },
97
102
  );
98
103
  }
99
104
 
@@ -1 +1 @@
1
- {"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","DEFAULT_AUTHENTICATION_TYPE","Cache","ApplicationModel","constructor","modularuiResponse","_defineProperty","setItem","primaryAuthenticationType","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","_findInstanceProperty","call","model","userServices","label","getContribution","authenticationTypes","_context","Function","bind","_sortInstanceProperty","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","modelOptions","_userServices","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n // store authentication type in session cache, to make it available when application is no longer available (when not permitted for example)\n Cache.setItem(\"primaryAuthenticationType\", this.primaryAuthenticationType);\n }\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) =>\n a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1,\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Returns the primary authentication type\n * @returns {AuthenticationType}\n */\n get primaryAuthenticationType(): AuthenticationType {\n return this.authenticationTypes[0];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\n \"modelcatalog\",\n \"/modelcatalog\",\n \"Model catalog\",\n this.modelOptions,\n );\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices?.userLink) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get userMustChangePassword(): boolean {\n return this.userServices?.mustChangePassword ?? false;\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASC,sBAAsB,QAAQ,kBAAkB;AAEzD,SAASC,2BAA2B,QAAQ,iBAAiB;AAE7D,OAAOC,KAAK,MAAM,2BAA2B;AAO7C;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASN,aAAa,CAAC;EAG1DO,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;;IAExB;IAAAC,eAAA;IACAJ,KAAK,CAACK,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAACC,yBAAyB,CAAC;EAC5E;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,C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,CAAA,EAAY;IACpC,OAAO,IAAI,CAACpB,YAAY,EAAEqB,kBAAkB,IAAI,KAAK;EACvD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"ApplicationModel.js","names":["ResourceModel","LinkModel","UserServicesModel","NotAllowedUriException","DEFAULT_AUTHENTICATION_TYPE","Cache","ApplicationModel","constructor","modularuiResponse","_defineProperty","setItem","primaryAuthenticationType","type","modelName","isApplicableModel","data","contributions","resourcetype","getInitialChildModelLinks","userService","links","getLinkByKey","href","path","setChildModels","models","userServiceModel","_findInstanceProperty","call","model","userServices","label","getContribution","authenticationTypes","_context","Function","bind","_sortInstanceProperty","a","b","isPrimary","tabs","getLinksByGroup","modelcatalog","create","modelOptions","_userServices","isLoggedIn","userHref","userLink","userMustChangePassword","mustChangePassword"],"sources":["../../../src/models/application/ApplicationModel.js"],"sourcesContent":["// @flow\nimport ResourceModel from \"../base/ResourceModel\";\nimport LinkModel from \"../links/LinkModel\";\nimport UserServicesModel from \"../user/UserServicesModel\";\n\nimport { NotAllowedUriException } from \"../../exceptions\";\n\nimport { DEFAULT_AUTHENTICATION_TYPE } from \"../../constants\";\n\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { ModularUIModel, AuthenticationType } from \"../types\";\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type LinkCollection from \"../links/LinkCollection\";\nimport type Href from \"../href/Href\";\n\n/**\n * The Application model\n */\nexport default class ApplicationModel extends ResourceModel {\n _userServices: ?UserServicesModel;\n\n constructor(modularuiResponse: ModularUIResponse) {\n super(modularuiResponse);\n\n // store authentication type in session cache, to make it available when application is no longer available (when not permitted for example)\n Cache.setItem(\"primaryAuthenticationType\", this.primaryAuthenticationType);\n }\n\n /**\n * Retrieve type of model\n */\n get type(): string {\n return \"Application\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"ApplicationModel\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n data.contributions.resourcetype === \"Application\"\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const userService = this.links.getLinkByKey(\"UserServices\");\n if (userService && userService.href.path === \"/login\") {\n throw new NotAllowedUriException(\n \"The user service (Login panel) should not have the uri '/login', use a different URI because this uri matches the login service.\",\n );\n }\n\n return userService ? [userService] : [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n const userServiceModel = models.find(\n (model) => model.type === \"UserServices\",\n );\n\n if (userServiceModel) {\n this.userServices = userServiceModel;\n }\n }\n\n /**\n * Getting the label of the application\n */\n get label(): string {\n return this.getContribution(\"label\", \"\");\n }\n\n /**\n * Getting the authentication types of the application\n */\n get authenticationTypes(): Array<AuthenticationType> {\n const authenticationTypes = this.getContribution(\"security\", [\n DEFAULT_AUTHENTICATION_TYPE,\n ]);\n\n if (authenticationTypes) {\n //put primary first\n return authenticationTypes?.sort(\n (a: AuthenticationType, b: AuthenticationType) => {\n if (a.isPrimary === b.isPrimary) {\n return 0;\n }\n\n return a.isPrimary ? -1 : 1;\n },\n );\n }\n\n return [DEFAULT_AUTHENTICATION_TYPE];\n }\n\n /**\n * Returns the primary authentication type\n * @returns {AuthenticationType}\n */\n get primaryAuthenticationType(): AuthenticationType {\n return this.authenticationTypes[0];\n }\n\n /**\n * Getting the tab links\n */\n get tabs(): LinkCollection {\n return this.links.getLinksByGroup(\"tab\");\n }\n\n /**\n * Get modelcatalog link\n */\n get modelcatalog(): LinkModel {\n return LinkModel.create(\n \"modelcatalog\",\n \"/modelcatalog\",\n \"Model catalog\",\n this.modelOptions,\n );\n }\n\n /**\n * Set the userservices for this application\n */\n set userServices(model: ?ModularUIModel) {\n this._userServices = model instanceof UserServicesModel ? model : null;\n }\n\n /**\n * returns the userservices configured for this application\n */\n get userServices(): ?UserServicesModel {\n return this._userServices ? this._userServices : null;\n }\n\n /**\n * Indicates if the user is logged in\n */\n get isLoggedIn(): boolean {\n return this.userServices?.isLoggedIn ?? false;\n }\n\n /**\n * Retrieve link to the user information,\n * only available when the user services are available\n */\n get userHref(): Href | null {\n if (this.userServices?.userLink) {\n return this.userServices.userLink.href;\n }\n\n return null;\n }\n\n /**\n */\n get userMustChangePassword(): boolean {\n return this.userServices?.mustChangePassword ?? false;\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAa,MAAM,uBAAuB;AACjD,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,iBAAiB,MAAM,2BAA2B;AAEzD,SAASC,sBAAsB,QAAQ,kBAAkB;AAEzD,SAASC,2BAA2B,QAAQ,iBAAiB;AAE7D,OAAOC,KAAK,MAAM,2BAA2B;AAO7C;AACA;AACA;AACA,eAAe,MAAMC,gBAAgB,SAASN,aAAa,CAAC;EAG1DO,WAAWA,CAACC,iBAAoC,EAAE;IAChD,KAAK,CAACA,iBAAiB,CAAC;;IAExB;IAAAC,eAAA;IACAJ,KAAK,CAACK,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAACC,yBAAyB,CAAC;EAC5E;;EAEA;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,aAAa;EACtB;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OACEA,IAAI,CAACC,aAAa,CAACC,YAAY,IAC/BF,IAAI,CAACC,aAAa,CAACC,YAAY,KAAK,aAAa;EAErD;;EAEA;AACF;EACEC,yBAAyBA,CAAA,EAAqB;IAC5C,MAAMC,WAAW,GAAG,IAAI,CAACC,KAAK,CAACC,YAAY,CAAC,cAAc,CAAC;IAC3D,IAAIF,WAAW,IAAIA,WAAW,CAACG,IAAI,CAACC,IAAI,KAAK,QAAQ,EAAE;MACrD,MAAM,IAAIpB,sBAAsB,CAC9B,kIACF,CAAC;IACH;IAEA,OAAOgB,WAAW,GAAG,CAACA,WAAW,CAAC,GAAG,EAAE;EACzC;;EAEA;AACF;EACEK,c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CAAC2C,MAAM,CACrB,cAAc,EACd,eAAe,EACf,eAAe,EACf,IAAI,CAACC,YACP,CAAC;EACH;;EAEA;AACF;AACA;EACE,IAAIf,YAAYA,CAACD,KAAsB,EAAE;IACvC,IAAI,CAACiB,aAAa,GAAGjB,KAAK,YAAY3B,iBAAiB,GAAG2B,KAAK,GAAG,IAAI;EACxE;;EAEA;AACF;AACA;EACE,IAAIC,YAAYA,CAAA,EAAuB;IACrC,OAAO,IAAI,CAACgB,aAAa,GAAG,IAAI,CAACA,aAAa,GAAG,IAAI;EACvD;;EAEA;AACF;AACA;EACE,IAAIC,UAAUA,CAAA,EAAY;IACxB,OAAO,IAAI,CAACjB,YAAY,EAAEiB,UAAU,IAAI,KAAK;EAC/C;;EAEA;AACF;AACA;AACA;EACE,IAAIC,QAAQA,CAAA,EAAgB;IAC1B,IAAI,IAAI,CAAClB,YAAY,EAAEmB,QAAQ,EAAE;MAC/B,OAAO,IAAI,CAACnB,YAAY,CAACmB,QAAQ,CAAC3B,IAAI;IACxC;IAEA,OAAO,IAAI;EACb;;EAEA;AACF;EACE,IAAI4B,sBAAsBA,CAAA,EAAY;IACpC,OAAO,IAAI,CAACpB,YAAY,EAAEqB,kBAAkB,IAAI,KAAK;EACvD;AACF","ignoreList":[]}
@@ -101,12 +101,10 @@ export default class ChoiceAttributeModel extends AttributeModel {
101
101
  */
102
102
  get lookupParameterType() {
103
103
  const parameterType = this.getContribution("parameterType");
104
- switch (parameterType) {
105
- case "bodyParameter":
106
- return PARAMETER_TYPES.BODY;
107
- default:
108
- return PARAMETER_TYPES.QUERY;
104
+ if (parameterType === "bodyParameter") {
105
+ return PARAMETER_TYPES.BODY;
109
106
  }
107
+ return PARAMETER_TYPES.QUERY;
110
108
  }
111
109
 
112
110
  /**
@@ -149,12 +149,10 @@ export default class ChoiceAttributeModel extends AttributeModel {
149
149
  */
150
150
  get lookupParameterType(): $Values<typeof PARAMETER_TYPES> {
151
151
  const parameterType = this.getContribution("parameterType");
152
- switch (parameterType) {
153
- case "bodyParameter":
154
- return PARAMETER_TYPES.BODY;
155
- default:
156
- return PARAMETER_TYPES.QUERY;
152
+ if (parameterType === "bodyParameter") {
153
+ return PARAMETER_TYPES.BODY;
157
154
  }
155
+ return PARAMETER_TYPES.QUERY;
158
156
  }
159
157
 
160
158
  /**