@beinformed/ui 1.65.24 → 1.65.26

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 (226) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/esm/builder/mergeLayoutHintConfigurations.js +7 -5
  3. package/esm/builder/mergeLayoutHintConfigurations.js.flow +12 -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/useAuthentication.js +7 -3
  9. package/esm/hooks/useAuthentication.js.flow +6 -3
  10. package/esm/hooks/useAuthentication.js.map +1 -1
  11. package/esm/hooks/useModelCatalog.js +1 -1
  12. package/esm/hooks/useModelCatalog.js.flow +1 -1
  13. package/esm/hooks/useModelCatalog.js.map +1 -1
  14. package/esm/i18n/Locale.js +7 -1
  15. package/esm/i18n/Locale.js.flow +4 -2
  16. package/esm/i18n/Locale.js.map +1 -1
  17. package/esm/models/actions/ActionCollection.js +1 -1
  18. package/esm/models/actions/ActionCollection.js.flow +3 -3
  19. package/esm/models/actions/ActionCollection.js.map +1 -1
  20. package/esm/models/application/ApplicationModel.js +6 -1
  21. package/esm/models/application/ApplicationModel.js.flow +7 -2
  22. package/esm/models/application/ApplicationModel.js.map +1 -1
  23. package/esm/models/attributes/ChoiceAttributeModel.js +3 -5
  24. package/esm/models/attributes/ChoiceAttributeModel.js.flow +3 -5
  25. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  26. package/esm/models/attributes/CompositeAttributeModel.js +1 -1
  27. package/esm/models/attributes/CompositeAttributeModel.js.flow +1 -1
  28. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  29. package/esm/models/attributes/NumberAttributeModel.js +3 -1
  30. package/esm/models/attributes/NumberAttributeModel.js.flow +2 -1
  31. package/esm/models/attributes/NumberAttributeModel.js.map +1 -1
  32. package/esm/models/attributes/StringAttributeModel.js +9 -4
  33. package/esm/models/attributes/StringAttributeModel.js.flow +7 -4
  34. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  35. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  36. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.flow +1 -1
  37. package/esm/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  38. package/esm/models/base/BaseModel.js +8 -5
  39. package/esm/models/base/BaseModel.js.flow +8 -5
  40. package/esm/models/base/BaseModel.js.map +1 -1
  41. package/esm/models/base/ResourceModel.js +6 -7
  42. package/esm/models/base/ResourceModel.js.flow +4 -4
  43. package/esm/models/base/ResourceModel.js.map +1 -1
  44. package/esm/models/concepts/ConceptDetailModel.js +16 -16
  45. package/esm/models/concepts/ConceptDetailModel.js.flow +16 -19
  46. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  47. package/esm/models/concepts/SourceReferenceCollection.js +1 -1
  48. package/esm/models/concepts/SourceReferenceCollection.js.flow +1 -2
  49. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  50. package/esm/models/content/ContentLinkModel.js +6 -6
  51. package/esm/models/content/ContentLinkModel.js.flow +6 -6
  52. package/esm/models/content/ContentLinkModel.js.map +1 -1
  53. package/esm/models/filters/BaseFilterModel.js +3 -5
  54. package/esm/models/filters/BaseFilterModel.js.flow +4 -5
  55. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  56. package/esm/models/filters/StringFilterModel.js +4 -2
  57. package/esm/models/filters/StringFilterModel.js.flow +3 -2
  58. package/esm/models/filters/StringFilterModel.js.map +1 -1
  59. package/esm/models/form/FormModel.js +1 -1
  60. package/esm/models/form/FormModel.js.flow +1 -2
  61. package/esm/models/form/FormModel.js.map +1 -1
  62. package/esm/models/form/FormObjectModel.js +1 -1
  63. package/esm/models/form/FormObjectModel.js.flow +2 -3
  64. package/esm/models/form/FormObjectModel.js.map +1 -1
  65. package/esm/models/href/Href.js +2 -2
  66. package/esm/models/href/Href.js.flow +2 -2
  67. package/esm/models/href/Href.js.map +1 -1
  68. package/esm/models/index.js +2 -2
  69. package/esm/models/index.js.flow +1 -2
  70. package/esm/models/index.js.map +1 -1
  71. package/esm/models/links/normalizeLinkJSON.js +1 -1
  72. package/esm/models/links/normalizeLinkJSON.js.flow +1 -1
  73. package/esm/models/links/normalizeLinkJSON.js.map +1 -1
  74. package/esm/modularui/Authenticate.js +7 -2
  75. package/esm/modularui/Authenticate.js.flow +4 -2
  76. package/esm/modularui/Authenticate.js.map +1 -1
  77. package/esm/modularui/ModularUIRequest.js +2 -5
  78. package/esm/modularui/ModularUIRequest.js.flow +2 -6
  79. package/esm/modularui/ModularUIRequest.js.map +1 -1
  80. package/esm/modularui/UploadRequest.js +3 -1
  81. package/esm/modularui/UploadRequest.js.flow +3 -1
  82. package/esm/modularui/UploadRequest.js.map +1 -1
  83. package/esm/react-client/client.js +22 -10
  84. package/esm/react-client/client.js.flow +17 -11
  85. package/esm/react-client/client.js.map +1 -1
  86. package/esm/react-client/contextPath.js +3 -1
  87. package/esm/react-client/contextPath.js.flow +2 -1
  88. package/esm/react-client/contextPath.js.map +1 -1
  89. package/esm/redux/_i18n/I18nReducer.js +1 -4
  90. package/esm/redux/_i18n/I18nReducer.js.flow +1 -4
  91. package/esm/redux/_i18n/I18nReducer.js.map +1 -1
  92. package/esm/redux/_modularui/ModularUIActions.js +1 -4
  93. package/esm/redux/_modularui/ModularUIActions.js.flow +1 -5
  94. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  95. package/esm/redux/_modularui/ModularUIConnector.js +3 -4
  96. package/esm/redux/_modularui/ModularUIConnector.js.flow +2 -1
  97. package/esm/redux/_modularui/ModularUIConnector.js.map +1 -1
  98. package/esm/redux/_modularui/ModularUIReducer.js +6 -3
  99. package/esm/redux/_modularui/ModularUIReducer.js.flow +2 -2
  100. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  101. package/esm/redux/actions/Authorization.js +4 -2
  102. package/esm/redux/actions/Authorization.js.flow +3 -2
  103. package/esm/redux/actions/Authorization.js.map +1 -1
  104. package/esm/redux/actions/Preferences.js +4 -4
  105. package/esm/redux/actions/Preferences.js.flow +6 -10
  106. package/esm/redux/actions/Preferences.js.map +1 -1
  107. package/esm/redux/reducers/ModelCatalogReducer.js +7 -9
  108. package/esm/redux/reducers/ModelCatalogReducer.js.flow +8 -9
  109. package/esm/redux/reducers/ModelCatalogReducer.js.map +1 -1
  110. package/esm/redux/store/configureStore.js +6 -1
  111. package/esm/redux/store/configureStore.js.flow +4 -1
  112. package/esm/redux/store/configureStore.js.map +1 -1
  113. package/esm/redux/types.js.flow +10 -1
  114. package/esm/redux/types.js.map +1 -1
  115. package/esm/utils/browser/Cache.js +3 -1
  116. package/esm/utils/browser/Cache.js.flow +2 -1
  117. package/esm/utils/browser/Cache.js.map +1 -1
  118. package/esm/utils/browser/__tests__/Cookies.spec.js.flow +2 -1
  119. package/esm/utils/datetime/DateTimeUtil.js +6 -5
  120. package/esm/utils/datetime/DateTimeUtil.js.flow +5 -11
  121. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  122. package/esm/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +0 -6
  123. package/esm/utils/fetch/universalFetch.js +7 -8
  124. package/esm/utils/fetch/universalFetch.js.flow +13 -14
  125. package/esm/utils/fetch/universalFetch.js.map +1 -1
  126. package/esm/utils/fetch/xhr.js +2 -5
  127. package/esm/utils/fetch/xhr.js.flow +2 -6
  128. package/esm/utils/fetch/xhr.js.map +1 -1
  129. package/esm/utils/helpers/createHref.js +4 -1
  130. package/esm/utils/helpers/createHref.js.flow +2 -1
  131. package/esm/utils/helpers/createHref.js.map +1 -1
  132. package/esm/utils/helpers/createUUID.js +2 -1
  133. package/esm/utils/helpers/createUUID.js.flow +1 -1
  134. package/esm/utils/helpers/createUUID.js.map +1 -1
  135. package/esm/utils/number/parseNumbers.js +6 -3
  136. package/esm/utils/number/parseNumbers.js.flow +4 -3
  137. package/esm/utils/number/parseNumbers.js.map +1 -1
  138. package/lib/builder/mergeLayoutHintConfigurations.js +7 -5
  139. package/lib/builder/mergeLayoutHintConfigurations.js.map +1 -1
  140. package/lib/constants/Settings.js +4 -1
  141. package/lib/constants/Settings.js.map +1 -1
  142. package/lib/hooks/useAuthentication.js +7 -3
  143. package/lib/hooks/useAuthentication.js.map +1 -1
  144. package/lib/hooks/useModelCatalog.js +1 -1
  145. package/lib/hooks/useModelCatalog.js.map +1 -1
  146. package/lib/i18n/Locale.js +7 -1
  147. package/lib/i18n/Locale.js.map +1 -1
  148. package/lib/models/actions/ActionCollection.js +1 -1
  149. package/lib/models/actions/ActionCollection.js.map +1 -1
  150. package/lib/models/application/ApplicationModel.js +6 -1
  151. package/lib/models/application/ApplicationModel.js.map +1 -1
  152. package/lib/models/attributes/ChoiceAttributeModel.js +3 -5
  153. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  154. package/lib/models/attributes/CompositeAttributeModel.js +1 -1
  155. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  156. package/lib/models/attributes/NumberAttributeModel.js +3 -1
  157. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  158. package/lib/models/attributes/StringAttributeModel.js +9 -4
  159. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  160. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js +1 -1
  161. package/lib/models/attributes/input-constraints/DatetimeFormatConstraint.js.map +1 -1
  162. package/lib/models/base/BaseModel.js +8 -5
  163. package/lib/models/base/BaseModel.js.map +1 -1
  164. package/lib/models/base/ResourceModel.js +6 -7
  165. package/lib/models/base/ResourceModel.js.map +1 -1
  166. package/lib/models/concepts/ConceptDetailModel.js +16 -16
  167. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  168. package/lib/models/concepts/SourceReferenceCollection.js +1 -1
  169. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  170. package/lib/models/content/ContentLinkModel.js +6 -6
  171. package/lib/models/content/ContentLinkModel.js.map +1 -1
  172. package/lib/models/filters/BaseFilterModel.js +3 -5
  173. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  174. package/lib/models/filters/StringFilterModel.js +4 -2
  175. package/lib/models/filters/StringFilterModel.js.map +1 -1
  176. package/lib/models/form/FormModel.js +1 -1
  177. package/lib/models/form/FormModel.js.map +1 -1
  178. package/lib/models/form/FormObjectModel.js +1 -1
  179. package/lib/models/form/FormObjectModel.js.map +1 -1
  180. package/lib/models/href/Href.js +2 -2
  181. package/lib/models/href/Href.js.map +1 -1
  182. package/lib/models/index.js.map +1 -1
  183. package/lib/models/links/normalizeLinkJSON.js +1 -1
  184. package/lib/models/links/normalizeLinkJSON.js.map +1 -1
  185. package/lib/modularui/Authenticate.js +7 -2
  186. package/lib/modularui/Authenticate.js.map +1 -1
  187. package/lib/modularui/ModularUIRequest.js +2 -5
  188. package/lib/modularui/ModularUIRequest.js.map +1 -1
  189. package/lib/modularui/UploadRequest.js +3 -1
  190. package/lib/modularui/UploadRequest.js.map +1 -1
  191. package/lib/react-client/client.js +22 -10
  192. package/lib/react-client/client.js.map +1 -1
  193. package/lib/react-client/contextPath.js +4 -1
  194. package/lib/react-client/contextPath.js.map +1 -1
  195. package/lib/redux/_i18n/I18nReducer.js +1 -4
  196. package/lib/redux/_i18n/I18nReducer.js.map +1 -1
  197. package/lib/redux/_modularui/ModularUIActions.js +1 -4
  198. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  199. package/lib/redux/_modularui/ModularUIConnector.js +3 -4
  200. package/lib/redux/_modularui/ModularUIConnector.js.map +1 -1
  201. package/lib/redux/_modularui/ModularUIReducer.js +6 -3
  202. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  203. package/lib/redux/actions/Authorization.js +4 -2
  204. package/lib/redux/actions/Authorization.js.map +1 -1
  205. package/lib/redux/actions/Preferences.js +4 -4
  206. package/lib/redux/actions/Preferences.js.map +1 -1
  207. package/lib/redux/reducers/ModelCatalogReducer.js +7 -9
  208. package/lib/redux/reducers/ModelCatalogReducer.js.map +1 -1
  209. package/lib/redux/store/configureStore.js +6 -1
  210. package/lib/redux/store/configureStore.js.map +1 -1
  211. package/lib/redux/types.js.map +1 -1
  212. package/lib/utils/browser/Cache.js +3 -1
  213. package/lib/utils/browser/Cache.js.map +1 -1
  214. package/lib/utils/datetime/DateTimeUtil.js +6 -5
  215. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  216. package/lib/utils/fetch/universalFetch.js +7 -8
  217. package/lib/utils/fetch/universalFetch.js.map +1 -1
  218. package/lib/utils/fetch/xhr.js +2 -5
  219. package/lib/utils/fetch/xhr.js.map +1 -1
  220. package/lib/utils/helpers/createHref.js +4 -1
  221. package/lib/utils/helpers/createHref.js.map +1 -1
  222. package/lib/utils/helpers/createUUID.js +3 -1
  223. package/lib/utils/helpers/createUUID.js.map +1 -1
  224. package/lib/utils/number/parseNumbers.js +6 -3
  225. package/lib/utils/number/parseNumbers.js.map +1 -1
  226. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [1.65.26](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.25...v1.65.26) (2026-01-30)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **flow:** try to ignore unknown methods for older flow verions ([b163bce](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/b163bceee4ebff1a0837a3a4227adda3e91e75de))
11
+ * **flow:** try to ignore unknown methods for older flow verions ([ae06ea1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/ae06ea1324a0de3b15ee4010c2864ce3ae452d25))
12
+
13
+ ## [1.65.25](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.23...v1.65.25) (2026-01-30)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **modularui:** set default `removeOnUnmount` to false, prevent missing application model on reload ([477da03](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/477da03f0e981c66d2ea5654ad191ca57636165b))
19
+ * **reload:** let reloadApplication wait on reload of model and return application model ([5864385](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/58643859d97a575ec93abbe7481471b71826a2d2))
20
+ * **sonar:** various minor sonar issues ([74e806c](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/74e806c9f22701bdba7c8ef22db6028f940ef122))
21
+ * **sonar:** various minor sonar issues ([2c2a19c](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2c2a19c0d6c0ec19cadcb715e3fa039a2661c1b4))
22
+
5
23
  ## [1.65.24](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.65.23...v1.65.24) (2026-01-30)
6
24
 
7
25
 
@@ -1,14 +1,16 @@
1
+ import _replaceAllInstanceProperty from "@babel/runtime-corejs3/core-js/instance/replace-all";
1
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
2
3
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
3
4
  import _JSON$stringify from "@babel/runtime-corejs3/core-js-stable/json/stringify";
4
- import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
5
- const path = require("path");
5
+ // $FlowIssue
6
+ const path = require("node:path");
6
7
  const {
7
8
  readdirSync,
8
9
  statSync,
9
10
  readFileSync,
10
11
  writeFileSync
11
- } = require("fs");
12
+ // $FlowIssue
13
+ } = require("node:fs");
12
14
  const mergeWith = require("lodash/mergeWith");
13
15
  const {
14
16
  LayoutHintConfiguration
@@ -37,7 +39,8 @@ const findFiles = dir => {
37
39
  * This file is consumed by Be Informed studio to give layout hint information
38
40
  */
39
41
  exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
40
- const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
42
+ // $FlowIssue
43
+ const escapedSrcFolder = _replaceAllInstanceProperty(srcFolder).call(srcFolder, "\\", "/");
41
44
  const files = findFiles(escapedSrcFolder);
42
45
  const jsons = _mapInstanceProperty(files).call(files, file => {
43
46
  const content = readFileSync(file, "utf-8");
@@ -52,6 +55,5 @@ exports.mergeLayoutHintConfigurations = async (srcFolder, outputFolder) => {
52
55
  };
53
56
  const newConfig = mergeWith(LayoutHintConfiguration, ...jsons, customizer);
54
57
  writeFileSync(path.join(outputFolder, "LayoutHintConfig.json"), _JSON$stringify(newConfig));
55
- return _Promise.resolve();
56
58
  };
57
59
  //# sourceMappingURL=mergeLayoutHintConfigurations.js.map
@@ -1,6 +1,14 @@
1
1
  // @flow
2
- const path = require("path");
3
- const { readdirSync, statSync, readFileSync, writeFileSync } = require("fs");
2
+
3
+ // $FlowIssue
4
+ const path = require("node:path");
5
+ const {
6
+ readdirSync,
7
+ statSync,
8
+ readFileSync,
9
+ writeFileSync,
10
+ // $FlowIssue
11
+ } = require("node:fs");
4
12
 
5
13
  const mergeWith = require("lodash/mergeWith");
6
14
  const { LayoutHintConfiguration } = require("../constants/LayoutHintConfig");
@@ -35,7 +43,8 @@ exports.mergeLayoutHintConfigurations = async (
35
43
  srcFolder: string,
36
44
  outputFolder: string,
37
45
  ): Promise<void> => {
38
- const escapedSrcFolder = srcFolder.replace(/\\/g, "/");
46
+ // $FlowIssue
47
+ const escapedSrcFolder = srcFolder.replaceAll("\\", "/");
39
48
 
40
49
  const files = findFiles(escapedSrcFolder);
41
50
 
@@ -57,6 +66,4 @@ exports.mergeLayoutHintConfigurations = async (
57
66
  path.join(outputFolder, "LayoutHintConfig.json"),
58
67
  JSON.stringify(newConfig),
59
68
  );
60
-
61
- return Promise.resolve();
62
69
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","mergeWith","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","replace","jsons","_mapInstanceProperty","call","content","JSON","parse","customizer","objValue","srcValue","Array","isArray","_Set","newConfig","_JSON$stringify","_Promise","resolve"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\nconst path = require(\"path\");\nconst { readdirSync, statSync, readFileSync, writeFileSync } = require(\"fs\");\n\nconst mergeWith = require(\"lodash/mergeWith\");\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst findFiles = (dir: string): Array<string> => {\n const matchedFiles = [];\n\n const files = readdirSync(dir);\n\n for (const file of files) {\n const absolute = path.join(dir, file);\n if (statSync(absolute).isDirectory()) {\n const foundFiles = findFiles(absolute);\n matchedFiles.push(...foundFiles);\n } else {\n const filename = path.basename(file);\n if (filename === \"LayoutHintConfig.json\") {\n matchedFiles.push(absolute);\n }\n }\n }\n\n return matchedFiles;\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string,\n): Promise<void> => {\n const escapedSrcFolder = srcFolder.replace(/\\\\/g, \"/\");\n\n const files = findFiles(escapedSrcFolder);\n\n const jsons = files.map((file) => {\n const content = readFileSync(file, \"utf-8\");\n return JSON.parse(content);\n });\n\n // Function to merge arrays during merging\n const customizer = (objValue: Object, srcValue: Object): Object => {\n if (Array.isArray(objValue)) {\n return [...new Set([...objValue, ...srcValue])];\n }\n };\n\n const newConfig = mergeWith(LayoutHintConfiguration, ...jsons, customizer);\n\n writeFileSync(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n );\n\n return Promise.resolve();\n};\n"],"mappings":";;;;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAM;E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IAC3C,OAAOkB,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC;EAC5B,CAAC,CAAC;;EAEF;EACA,MAAMG,UAAU,GAAGA,CAACC,QAAgB,EAAEC,QAAgB,KAAa;IACjE,IAAIC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,EAAE;MAC3B,OAAO,CAAC,GAAG,IAAAI,IAAA,CAAQ,CAAC,GAAGJ,QAAQ,EAAE,GAAGC,QAAQ,CAAC,CAAC,CAAC;IACjD;EACF,CAAC;EAED,MAAMI,SAAS,GAAGhC,SAAS,CAACC,uBAAuB,EAAE,GAAGmB,KAAK,EAAEM,UAAU,CAAC;EAE1E3B,aAAa,CACXL,IAAI,CAACc,IAAI,CAACS,YAAY,EAAE,uBAAuB,CAAC,EAChDgB,eAAA,CAAeD,SAAS,CAC1B,CAAC;EAED,OAAOE,QAAA,CAAQC,OAAO,CAAC,CAAC;AAC1B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"mergeLayoutHintConfigurations.js","names":["path","require","readdirSync","statSync","readFileSync","writeFileSync","mergeWith","LayoutHintConfiguration","findFiles","dir","matchedFiles","files","file","absolute","join","isDirectory","foundFiles","push","filename","basename","exports","mergeLayoutHintConfigurations","srcFolder","outputFolder","escapedSrcFolder","_replaceAllInstanceProperty","call","jsons","_mapInstanceProperty","content","JSON","parse","customizer","objValue","srcValue","Array","isArray","_Set","newConfig","_JSON$stringify"],"sources":["../../src/builder/mergeLayoutHintConfigurations.js"],"sourcesContent":["// @flow\n\n// $FlowIssue\nconst path = require(\"node:path\");\nconst {\n readdirSync,\n statSync,\n readFileSync,\n writeFileSync,\n // $FlowIssue\n} = require(\"node:fs\");\n\nconst mergeWith = require(\"lodash/mergeWith\");\nconst { LayoutHintConfiguration } = require(\"../constants/LayoutHintConfig\");\n\nconst findFiles = (dir: string): Array<string> => {\n const matchedFiles = [];\n\n const files = readdirSync(dir);\n\n for (const file of files) {\n const absolute = path.join(dir, file);\n if (statSync(absolute).isDirectory()) {\n const foundFiles = findFiles(absolute);\n matchedFiles.push(...foundFiles);\n } else {\n const filename = path.basename(file);\n if (filename === \"LayoutHintConfig.json\") {\n matchedFiles.push(absolute);\n }\n }\n }\n\n return matchedFiles;\n};\n\n/**\n * Merge all LayoutHintConfig.json files from this library and in the srcFolder\n * together into one config file, and copies it to the outputFolder.<br/>\n * This file is consumed by Be Informed studio to give layout hint information\n */\nexports.mergeLayoutHintConfigurations = async (\n srcFolder: string,\n outputFolder: string,\n): Promise<void> => {\n // $FlowIssue\n const escapedSrcFolder = srcFolder.replaceAll(\"\\\\\", \"/\");\n\n const files = findFiles(escapedSrcFolder);\n\n const jsons = files.map((file) => {\n const content = readFileSync(file, \"utf-8\");\n return JSON.parse(content);\n });\n\n // Function to merge arrays during merging\n const customizer = (objValue: Object, srcValue: Object): Object => {\n if (Array.isArray(objValue)) {\n return [...new Set([...objValue, ...srcValue])];\n }\n };\n\n const newConfig = mergeWith(LayoutHintConfiguration, ...jsons, customizer);\n\n writeFileSync(\n path.join(outputFolder, \"LayoutHintConfig.json\"),\n JSON.stringify(newConfig),\n );\n};\n"],"mappings":";;;;AAEA;AACA,MAAMA,IAAI,GAAGC,OAAO,CAAC,WAAW,CAAC;AACjC,MAAM;EACJC,WAAW;EACXC,QAAQ;EACRC,YAAY;EACZC;EACA;AACF,CAAC,GAAGJ,OAAO,CAAC,SAAS,CAAC;AAEtB,MAAMK,SAAS,GAAGL,OAAO,CAAC,kBAAkB,CAAC;AAC7C,MAAM;EAAEM;AAAwB,CAAC,GAAGN,OAAO,CAAC,+BAA+B,CAAC;AAE5E,MAAMO,SAAS,GAAIC,GAAW,IAAoB;EAChD,MAAMC,YAAY,GAAG,EAAE;EAEvB,MAAMC,KAAK,GAAGT,WAAW,CAACO,GAAG,CAAC;EAE9B,KAAK,MAAMG,IAAI,IAAID,KAAK,EAAE;IACxB,MAAME,QAAQ,GAAGb,IAAI,CAACc,IAAI,CAACL,GAAG,EAAEG,IAAI,CAAC;IACrC,IAAIT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AAI,CAACS,YAAY,EAAE,uBAAuB,CAAC,EAChDgB,eAAA,CAAeD,SAAS,CAC1B,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
1
2
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
3
  import _startsWithInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/starts-with";
3
4
  import { isPlainObject, has } from "../utils/helpers/objects";
@@ -6,7 +7,9 @@ import { ALL_CONTENT_IN_DATA_SETTING, INCLUDE_TIME_OFFSET, INTERNAL_LOGIN_TYPE,
6
7
  const serverBase = typeof __CONTEXT_PATH__ === "undefined" ? null : __CONTEXT_PATH__;
7
8
  const defaultSettings = {
8
9
  // This uses contextPath set from property from server
9
- CONTEXT_PATH: serverBase ?? (typeof window !== "undefined" && window.contextPath ? window.contextPath : "/BeInformed"),
10
+ CONTEXT_PATH: serverBase ??
11
+ // $FlowIssue
12
+ _globalThis?.contextPath ?? "/BeInformed",
10
13
  // Indicates if contributions should be cached
11
14
  CACHE_CONTRIBUTIONS: true,
12
15
  // Debug missing i18n messages in layout
@@ -23,9 +23,9 @@ const defaultSettings: { [name: string]: Setting } = {
23
23
  // This uses contextPath set from property from server
24
24
  CONTEXT_PATH:
25
25
  serverBase ??
26
- (typeof window !== "undefined" && window.contextPath
27
- ? window.contextPath
28
- : "/BeInformed"),
26
+ // $FlowIssue
27
+ globalThis?.contextPath ??
28
+ "/BeInformed",
29
29
 
30
30
  // Indicates if contributions should be cached
31
31
  CACHE_CONTRIBUTIONS: true,
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","window","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n (typeof window !== \"undefined\" && window.contextPath\n ? window.contextPath\n : \"/BeInformed\"),\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type\n */\nexport const loginType = (): string | Array<string> =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU,KACT,OAAOI,MAAM,KAAK,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,WAAmB,GAAG8C,UAAU,CAAC,CAAC;;AAE/C;AACA;AACA;AACA,OAAO,MAAMC,+BAAuC,GAAGA,CAAA,KAAM;EAC3D,IAAIC,cAAc,GAAG1B,UAAU,CAC7B,iCAAiC,EACjC,kCACF,CAAC;EACD,IAAI,CAAC2B,2BAAA,CAAAD,cAAc,EAAAE,IAAA,CAAdF,cAAc,EAAY,GAAG,CAAC,EAAE;IACnCA,cAAc,GAAG,IAAIA,cAAc,EAAE;EACvC;EACA,OAAOjF,wBAAwB,CAACiF,cAAc,CAAC;AACjD,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMG,cAAc,GAAIpE,WAAmB,IAAK;EACrD4C,UAAU,CAAC,cAAc,EAAE5C,WAAW,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMqE,IAAY,GAAGrB,WAAW,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Settings.js","names":["isPlainObject","has","getRepositoryResourceUrl","ALL_CONTENT_IN_DATA_SETTING","INCLUDE_TIME_OFFSET","INTERNAL_LOGIN_TYPE","LOGIN_TYPE","LOGIN_PATH_SETTING","LOGIN_USERNAME_SETTING","LOGIN_PASSWORD_SETTING","LOGOUT_PATH_SETTING","UPLOAD_PATH","CAPTCHA_PATH","serverBase","__CONTEXT_PATH__","defaultSettings","CONTEXT_PATH","_globalThis","contextPath","CACHE_CONTRIBUTIONS","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_GLOBAL_LOGIN_PAGE","RENDER_GLOBAL_LOGOUT_PAGE","RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE","LOGIN_PATH","ADMINISTRATOR_LOGIN_PATH","LOGOUT_PATH","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","XHR_ALWAYS_WITH_CREDENTIALS","HIDE_WHEN_EMPTY_IGNORE_TASKS","SHOW_AVATARS","COMPLETE_SOURCE","settings","setSettings","config","_Object$assign","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","cacheContributions","getBasePath","getBasePathModularUI","getBasePathServer","getUploadPath","origin","getCaptchaPath","hasAllContentInData","isIncludeTimeOffsetInDateTimes","getEnabledLocales","loginType","JAAS","loginPath","clientName","loginUsernameField","loginPasswordField","logoutPath","getSwimLaneDiagramConfiguration","configLocation","_startsWithInstanceProperty","call","setContextPath","BASE"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport { getRepositoryResourceUrl } from \"../utils/helpers/repositoryResource\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n INCLUDE_TIME_OFFSET,\n INTERNAL_LOGIN_TYPE,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n UPLOAD_PATH,\n CAPTCHA_PATH,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst serverBase =\n typeof __CONTEXT_PATH__ === \"undefined\" ? null : __CONTEXT_PATH__;\n\nconst defaultSettings: { [name: string]: Setting } = {\n // This uses contextPath set from property from server\n CONTEXT_PATH:\n serverBase ??\n // $FlowIssue\n globalThis?.contextPath ??\n \"/BeInformed\",\n\n // Indicates if contributions should be cached\n CACHE_CONTRIBUTIONS: true,\n\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Renders the global log in page\n RENDER_GLOBAL_LOGIN_PAGE: false,\n\n // Renders the global log out page\n RENDER_GLOBAL_LOGOUT_PAGE: false,\n\n // Renders the login variants as option on the global logout page\n RENDER_MULTI_LOGIN_ON_GLOBAL_LOGOUT_PAGE: false,\n\n // Path to login page / component\n LOGIN_PATH: \"/signin\",\n\n // Path to administrator login page / component\n ADMINISTRATOR_LOGIN_PATH: \"\",\n\n // Path to logout page / component\n LOGOUT_PATH: \"/signout\",\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n BUSINESS_SCENARIO_SYSTEM_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/System\",\n ],\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n\n XHR_ALWAYS_WITH_CREDENTIALS: false,\n\n HIDE_WHEN_EMPTY_IGNORE_TASKS: false,\n\n SHOW_AVATARS: true,\n\n COMPLETE_SOURCE: false,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`,\n );\n }\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n * Indicates if contributions must be cached\n */\nexport const cacheContributions = (): boolean =>\n getSetting(\"CACHE_CONTRIBUTIONS\", true);\n\n/**\n * The context path is retrieved on the server using the context path property as set in the runtime properties\n * This can be manually overriden by setting the UI setting 'CONTEXT_PATH'\n */\nexport const getBasePath = (): string =>\n getSetting(\"CONTEXT_PATH\", \"/BeInformed\");\n\n/**\n * The context path to modular ui rest services\n */\nexport const getBasePathModularUI = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Used to link the css and js files in the server templates\n */\nexport const getBasePathServer = (): string =>\n getSetting(\"CONTEXT_PATH_SERVER\", getBasePath());\n\n/**\n * Path to upload service\n */\nexport const getUploadPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${UPLOAD_PATH}`;\n\n/**\n * Path to captcha service\n */\nexport const getCaptchaPath = (\n contextPath: string = getBasePathModularUI(),\n origin: string = \"\",\n): string => `${origin}${contextPath}${CAPTCHA_PATH}`;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n */\nexport const isIncludeTimeOffsetInDateTimes = (): boolean =>\n getSetting(INCLUDE_TIME_OFFSET, false);\n\n/**\n */\nexport const getEnabledLocales = (): Array<string> =>\n getSetting(\"ENABLED_LOCALES\", [\"en\"]);\n\n/**\n * Login type\n */\nexport const loginType = (): string | Array<string> =>\n getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);\n\n/**\n */\nexport const loginPath = (clientName: string = \"FormClient\"): string =>\n getSetting(LOGIN_PATH_SETTING, `/callback?client_name=${clientName}`);\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/logout\");\n\nexport const LOGIN_PATH: string = loginPath();\nexport const LOGOUT_PATH: string = logoutPath();\n\n/**\n * Model overview swim lane configuration\n */\nexport const getSwimLaneDiagramConfiguration: Object = () => {\n let configLocation = getSetting(\n \"SWIM_LANE_DIAGRAM_CONFIGURATION\",\n \"/Library/Diagrams/Overviews.json\",\n );\n if (!configLocation.startsWith(\"/\")) {\n configLocation = `/${configLocation}`;\n }\n return getRepositoryResourceUrl(configLocation);\n};\n\n/**\n * Set the context path for requests to be informed\n */\nexport const setContextPath = (contextPath: string) => {\n setSetting(\"CONTEXT_PATH\", contextPath);\n};\n\n/**\n * Backwards compatible export of BASE constant\n */\nexport const BASE: string = getBasePath();\n"],"mappings":";;;AACA,SAASA,aAAa,EAAEC,GAAG,QAAQ,0BAA0B;AAC7D,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SACEC,2BAA2B,EAC3BC,mBAAmB,EACnBC,mBAAmB,EACnBC,UAAU,EACVC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,YAAY,QACP,aAAa;AAIpB,MAAMC,UAAU,GACd,OAAOC,gBAAgB,KAAK,WAAW,GAAG,IAAI,GAAGA,gBAAgB;AAEnE,MAAMC,eAA4C,GAAG;EACnD;EACAC,YAAY,EACVH,UAAU;EACV;EACAI,WAAA,EAAYC,WAAW,IACvB,aAAa;EAEf;EACAC,mBAAmB,EAAE,IAAI;EAEzB;EACAC,4BAA4B,EAAE,IAAI;EAElC;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,kBAAkB,EAAE,KAAK;EAEzB;EACAC,sBAAsB,EAAE,IAAI;EAE5B;EACAC,qCAAqC,EAAE,IAAI;EAE3C;EACAC,oCAAoC,EAAE,KAAK;EAE3C;EACAC,oBAAoB,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC;EAE/C;EACAC,yBAAyB,EAAE,IAAI;EAE/B;EACAC,6BAA6B,EAAE,IAAI;EAEnC;EACAC,eAAe,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;EAE7B;EACAC,wBAAwB,EAAE,K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AGrB,WAAW,CAAC,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ import _globalThis from "@babel/runtime-corejs3/core-js/global-this";
1
2
  import { useSelector, useDispatch } from "react-redux";
2
3
  import { login, logout, resetAuthErrors } from "../redux/actions";
3
4
  import Cache from "../utils/browser/Cache";
@@ -29,7 +30,8 @@ export const useLogin = () => {
29
30
  }
30
31
  if (!isAuthenticated) {
31
32
  Cache.setItem("isRedirectLogin", true);
32
- window.location.assign(`${getBasePathServer()}${authenticationType.redirectUri ?? ""}`);
33
+ // $FlowIssue
34
+ _globalThis.location.assign(`${getBasePathServer()}${authenticationType.redirectUri ?? ""}`);
33
35
  }
34
36
  }
35
37
  };
@@ -56,10 +58,12 @@ export const useLogout = () => {
56
58
  return; // Redirects stop execution
57
59
  }
58
60
  if (Cache.getItem("isRedirectLogin")) {
59
- const origin = window.location.origin;
61
+ // $FlowIssue
62
+ const origin = _globalThis.location.origin;
60
63
  const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;
61
64
  Cache.setItem("isRedirectLogin", false);
62
- window.location.assign(url);
65
+ // $FlowIssue
66
+ _globalThis.location.assign(url);
63
67
  return;
64
68
  }
65
69
 
@@ -64,7 +64,8 @@ export const useLogin = (): LoginHook => {
64
64
 
65
65
  if (!isAuthenticated) {
66
66
  Cache.setItem("isRedirectLogin", true);
67
- window.location.assign(
67
+ // $FlowIssue
68
+ globalThis.location.assign(
68
69
  `${getBasePathServer()}${authenticationType.redirectUri ?? ""}`,
69
70
  );
70
71
  }
@@ -98,10 +99,12 @@ export const useLogout = (): LogoutHook => {
98
99
  }
99
100
 
100
101
  if (Cache.getItem("isRedirectLogin")) {
101
- const origin = window.location.origin;
102
+ // $FlowIssue
103
+ const origin = globalThis.location.origin;
102
104
  const url = `${authenticate.getLogoutUrl()}?url=${origin}${BASE_PATH}`;
103
105
  Cache.setItem("isRedirectLogin", false);
104
- window.location.assign(url);
106
+ // $FlowIssue
107
+ globalThis.location.assign(url);
105
108
  return;
106
109
  }
107
110
 
@@ -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","cachedType","getItem","primaryAuthenticationType","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\";\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 window.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 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 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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EAAE,KAAK,CAAC;QACvCoB,MAAM,CAACC,QAAQ,CAACC,MAAM,CAACQ,GAAG,CAAC;QAC3B;MACF;;MAEA;MACA,OAAO7B,QAAQ,CAACX,MAAM,CAAC,CAAC,CAAC;IAC3B,CAAC;IACD0C,SAAS,EAAEP,YAAY,CAACM,YAAY,CAAC;EACvC,CAAC;AACH,CAAC","ignoreList":[]}
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","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,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;AAuBpD;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAiB;EACvCP,KAAK,CAACQ,OAAO,CAAC,iBAAiB,EAAE,KAAK,CAAC;EAEvC,MAAMC,QAAQ,GAAGb,WAAW,CAAC,CAAC;EAC9B,MAAMc,WAAW,GAAGJ,cAAc,CAAC,CAAC;EACpC,MAAMK,IAAI,GAAGhB,WAAW,CAAEiB,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;EAE/C,MAAME,eAAe,GAAGH,WAAW,EAAEI,UAAU,IAAI,KAAK;EACxD,MAAMC,UAAU,GAAGf,KAAK,CAACgB,OAAO,CAAC,2BAA2B,CAAC;EAE7D,OAAO;IACLH,eAAe;IACf;IACAI,yBAAyB,EACvBF,UAAU,IAAIL,WAAW,EAAEQ,mBAAmB,GAAG,CAAC,CAAC;IACrDA,mBAAmB,EAAER,WAAW,EAAEQ,mBAAmB,IAAI,EAAE;IAC3DC,YAAY,EAAER,IAAI,CAACS,KAAK;IACxBC,WAAW,EAAEA,CAAA,KAAMZ,QAAQ,CAACV,eAAe,CAAC,CAAC,CAAC;IAC9CF,KAAK,EAAEA,CAACyB,QAAgB,EAAEC,QAAgB,KACxCd,QAAQ,CAACZ,KAAK,CAACyB,QAAQ,EAAEC,QAAQ,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MAEA,IAAIpC,KAAK,CAACgB,OAAO,CAAC,iBAAiB,CAAC,EAAE;QACpC;QACA,MAAMqB,MAAM,GAAGT,WAAA,CAAWC,QAAQ,CAACQ,MAAM;QACzC,MAAMC,GAAG,GAAG,GAAGL,YAAY,CAACM,YAAY,CAAC,CAAC,QAAQF,MAAM,GAAGL,SAAS,EAAE;QACtEhC,KAAK,CAACQ,OAAO,CAAC,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;EACv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AAC;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":[]}
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","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,MAA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,EAAEL,OAAO,CAAC;AAC5C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMO,YAAY,GAAGA,CAAA,KAGtB;EACJ,MAAM+B,QAAQ,GAAGxD,WAAW,CAAC,CAAC;EAC9B,MAAMwB,SAAS,GAAGzB,WAAW,CAACe,YAAY,CAAC;EAE3C,OAAO;IACLU,SAAS;IACTiC,YAAY,EAAGC,IAAc,IAAKF,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":[]}
@@ -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,12 @@ 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)
70
+ // $FlowIssue
71
+ ).call(_context2, /'\$\{(?<key>.*?)}'/g, "''{$<key>}''")
72
+ // $FlowIssue
73
+ ).call(_context, /\$\{(?<key>.*?)}/g, "{$<key>}"));
68
74
  }
69
75
 
70
76
  /**
@@ -85,8 +85,10 @@ 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
+ // $FlowIssue
89
+ .replaceAll(/'\$\{(?<key>.*?)}'/g, "''{$<key>}''")
90
+ // $FlowIssue
91
+ .replaceAll(/\$\{(?<key>.*?)}/g, "{$<key>}"),
90
92
  );
91
93
  }
92
94
 
@@ -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,IAAIA,CAAA,EAAW;IACjB,OAAO,IAAI,CAACD,KAAK;EACnB;;EAEA;AACF;AACA;EACE,IAAIQ,UAAUA,CAAA,EAAW;IACvB,IAAI,IAAI,CAACD,WAAW,EAAE;MACpB,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nB,OAAO,CAACmB,EAAE,CAAC;IAEhE,IACE,CAAC,OAAOG,OAAO,KAAK,WAAW,IAC7BA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,KACvC,CAACH,iBAAiB,IAClBF,EAAE,IACF7B,UAAU,CAAC,8BAA8B,CAAC,EAC1C;MACA;MACAmC,OAAO,CAACC,KAAK,CACX,mBAAmBP,EAAE,yBAAyB,IAAI,CAACvB,IAAI,yBACzD,CAAC;IACH;IACA,OAAOyB,iBAAiB,IAAI,IAAI,CAACT,eAAe,CAACQ,cAAc,CAAC,IAAID,EAAE;EACxE;;EAEA;AACF;AACA;EACEhC,aAAaA,CAAC0B,OAAe,EAAEc,UAA8B,EAAU;IACrE,IAAIA,UAAU,EAAE;MACd,OAAOxC,aAAa,CAAC0B,OAAO,EAAEc,UAAU,CAAC;IAC3C;IAEA,OAAOd,OAAO;EAChB;;EAEA;AACF;AACA;EACEe,UAAUA,CACRT,EAAU,EACVC,cAAuB,EACvBO,UAA8B,EACtB;IACR,MAAMd,OAAO,GAAG,IAAI,CAACK,cAAc,CAACC,EAAE,EAAEC,cAAc,CAAC;IACvD,OAAO,IAAI,CAACjC,aAAa,CAAC0B,OAAO,EAAEc,UAAU,CAAC;EAChD;;EAEA;AACF;AACA;EACEE,MAAMA,CAAC9B,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":[]}
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 // $FlowIssue\n .replaceAll(/'\\$\\{(?<key>.*?)}'/g, \"''{$<key>}''\")\n // $FlowIssue\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,MAAM,gBAAgB;AAE1C,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,qBAAqB,QAAQ,eAAe;AAErD,SAASC,UAAU,QAAQ,cAAc;AAIzC;AACA;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;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;UACtBF,YAAY,CAACO,IAAI,CACf,IAAIhB,WAAW,CAACU,UAAU,EAAEC,kBAAkB,EAAEN,YAAY,CAC9D,CAAC;QACH;MACF;MAEA,I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ACK,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,KAAK,CAAC,CAAC;;IAEP;IACA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACJ,OAAO,CAAC,EAAE;MAC3B,IAAI,CAACK,UAAU,GAA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E,CAAC;IAED,OAAOK,aAAa;EACtB;;EAEA;AACF;AACA;EACEO,sBAAsBA,CAAC,GAAGC,KAAoB,EAAoB;IAAA,IAAAC,SAAA;IAChE,MAAMT,aAAa,GAAG,IAAIpB,gBAAgB,CAAC,CAAC;IAE5CoB,aAAa,CAACb,UAAU,GAAGc,uBAAA,CAAAQ,SAAA,OAAI,EAAAjB,IAAA,CAAAiB,SAAA,EAASP,MAAM,IAC5CA,MAAM,CAACQ,UAAU,CAACC,GAAG,CAAC,GAAGH,KAAK,CAChC,CAAC;IAED,OAAOR,aAAa;EACtB;;EAEA;AACF;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,CAAC5B,UAAU,EAAAK,IAAA,CAAAuB,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,EAAAxB,IAAA,CAAbwB,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":[]}
@@ -72,7 +72,12 @@ export default class ApplicationModel extends ResourceModel {
72
72
  if (authenticationTypes) {
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