@beinformed/ui 1.57.2 → 1.57.3

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 (430) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/esm/constants/Settings.js +14 -6
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useAuthentication.js +3 -3
  5. package/esm/hooks/useAuthentication.js.map +1 -1
  6. package/esm/hooks/useModelCatalog.js.map +1 -1
  7. package/esm/hooks/useModularUIBasic.js +1 -1
  8. package/esm/hooks/useModularUIBasic.js.map +1 -1
  9. package/esm/hooks/useModularUIModel.js.map +1 -1
  10. package/esm/models/actions/ActionCollection.js +2 -3
  11. package/esm/models/actions/ActionCollection.js.map +1 -1
  12. package/esm/models/actions/ActionModel.js +13 -23
  13. package/esm/models/actions/ActionModel.js.map +1 -1
  14. package/esm/models/application/ApplicationModel.js +1 -1
  15. package/esm/models/application/ApplicationModel.js.map +1 -1
  16. package/esm/models/attributes/AttributeCollection.js +6 -3
  17. package/esm/models/attributes/AttributeCollection.js.map +1 -1
  18. package/esm/models/attributes/AttributeModel.js +3 -3
  19. package/esm/models/attributes/AttributeModel.js.map +1 -1
  20. package/esm/models/attributes/AttributeSetModel.js +7 -4
  21. package/esm/models/attributes/AttributeSetModel.js.map +1 -1
  22. package/esm/models/attributes/BooleanAttributeModel.js +6 -3
  23. package/esm/models/attributes/BooleanAttributeModel.js.map +1 -1
  24. package/esm/models/attributes/ChoiceAttributeModel.js +6 -3
  25. package/esm/models/attributes/ChoiceAttributeModel.js.map +1 -1
  26. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +18 -14
  27. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  28. package/esm/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  29. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  30. package/esm/models/attributes/CompositeAttributeChildCollection.js +7 -7
  31. package/esm/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  32. package/esm/models/attributes/CompositeAttributeModel.js +3 -3
  33. package/esm/models/attributes/CompositeAttributeModel.js.map +1 -1
  34. package/esm/models/attributes/DatetimeAttributeModel.js +2 -2
  35. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  36. package/esm/models/attributes/StringAttributeModel.js +2 -2
  37. package/esm/models/attributes/StringAttributeModel.js.map +1 -1
  38. package/esm/models/attributes/_createAttribute.js +2 -2
  39. package/esm/models/attributes/_createAttribute.js.map +1 -1
  40. package/esm/models/base/BaseModel.js +27 -1
  41. package/esm/models/base/BaseModel.js.map +1 -1
  42. package/esm/models/base/ResourceModel.js +3 -23
  43. package/esm/models/base/ResourceModel.js.map +1 -1
  44. package/esm/models/caseview/CaseViewModel.js +1 -1
  45. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  46. package/esm/models/concepts/ConceptDetailModel.js +2 -2
  47. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  48. package/esm/models/concepts/ConceptIndexModel.js +2 -2
  49. package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
  50. package/esm/models/concepts/ConceptLinkModel.js +4 -10
  51. package/esm/models/concepts/ConceptLinkModel.js.map +1 -1
  52. package/esm/models/concepts/ConceptRelationCollection.js +11 -4
  53. package/esm/models/concepts/ConceptRelationCollection.js.map +1 -1
  54. package/esm/models/concepts/ConceptRelationModel.js +8 -1
  55. package/esm/models/concepts/ConceptRelationModel.js.map +1 -1
  56. package/esm/models/concepts/SourceReferenceCollection.js +2 -4
  57. package/esm/models/concepts/SourceReferenceCollection.js.map +1 -1
  58. package/esm/models/concepts/SourceReferenceModel.js +9 -10
  59. package/esm/models/concepts/SourceReferenceModel.js.map +1 -1
  60. package/esm/models/content/ContentIndexModel.js +2 -2
  61. package/esm/models/content/ContentIndexModel.js.map +1 -1
  62. package/esm/models/content/ContentLinkModel.js +4 -11
  63. package/esm/models/content/ContentLinkModel.js.map +1 -1
  64. package/esm/models/content/ContentModel.js +2 -2
  65. package/esm/models/content/ContentModel.js.map +1 -1
  66. package/esm/models/content/ContentTOCModel.js +7 -7
  67. package/esm/models/content/ContentTOCModel.js.map +1 -1
  68. package/esm/models/content/SectionModel.js +6 -12
  69. package/esm/models/content/SectionModel.js.map +1 -1
  70. package/esm/models/detail/DetailModel.js +9 -3
  71. package/esm/models/detail/DetailModel.js.map +1 -1
  72. package/esm/models/error/ErrorResponse.js +8 -10
  73. package/esm/models/error/ErrorResponse.js.map +1 -1
  74. package/esm/models/filters/AssignmentFilterModel.js +2 -2
  75. package/esm/models/filters/AssignmentFilterModel.js.map +1 -1
  76. package/esm/models/filters/BaseFilterModel.js +3 -3
  77. package/esm/models/filters/BaseFilterModel.js.map +1 -1
  78. package/esm/models/filters/ConceptIndexFilterModel.js +2 -3
  79. package/esm/models/filters/ConceptIndexFilterModel.js.map +1 -1
  80. package/esm/models/filters/FilterCollection.js +8 -7
  81. package/esm/models/filters/FilterCollection.js.map +1 -1
  82. package/esm/models/filters/StringFilterModel.js +2 -2
  83. package/esm/models/filters/StringFilterModel.js.map +1 -1
  84. package/esm/models/form/FormModel.js +4 -4
  85. package/esm/models/form/FormModel.js.map +1 -1
  86. package/esm/models/form/FormObjectModel.js +7 -4
  87. package/esm/models/form/FormObjectModel.js.map +1 -1
  88. package/esm/models/grouping/GroupingModel.js +10 -7
  89. package/esm/models/grouping/GroupingModel.js.map +1 -1
  90. package/esm/models/href/Href.js +9 -8
  91. package/esm/models/href/Href.js.map +1 -1
  92. package/esm/models/links/LinkCollection.js +2 -3
  93. package/esm/models/links/LinkCollection.js.map +1 -1
  94. package/esm/models/links/LinkModel.js +7 -7
  95. package/esm/models/links/LinkModel.js.map +1 -1
  96. package/esm/models/list/ListDetailModel.js +1 -1
  97. package/esm/models/list/ListDetailModel.js.map +1 -1
  98. package/esm/models/list/ListItemCollection.js +1 -1
  99. package/esm/models/list/ListItemCollection.js.map +1 -1
  100. package/esm/models/list/ListItemModel.js +3 -3
  101. package/esm/models/list/ListItemModel.js.map +1 -1
  102. package/esm/models/list/ListModel.js +3 -3
  103. package/esm/models/list/ListModel.js.map +1 -1
  104. package/esm/models/lookup/LookupOptionCollection.js +5 -2
  105. package/esm/models/lookup/LookupOptionCollection.js.map +1 -1
  106. package/esm/models/lookup/LookupOptionsModel.js +2 -2
  107. package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
  108. package/esm/models/panels/GroupingPanelModel.js +1 -1
  109. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  110. package/esm/models/tab/TabModel.js +2 -2
  111. package/esm/models/tab/TabModel.js.map +1 -1
  112. package/esm/models/taskgroup/TaskGroupModel.js +4 -5
  113. package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
  114. package/esm/models/types.js.map +1 -1
  115. package/esm/models/user/UserProfileModel.js +4 -1
  116. package/esm/models/user/UserProfileModel.js.map +1 -1
  117. package/esm/modularui/CaptchaRequest.js +3 -3
  118. package/esm/modularui/CaptchaRequest.js.map +1 -1
  119. package/esm/modularui/ModularUIRequest.js +8 -5
  120. package/esm/modularui/ModularUIRequest.js.map +1 -1
  121. package/esm/modularui/ModularUIResponse.js +12 -3
  122. package/esm/modularui/ModularUIResponse.js.map +1 -1
  123. package/esm/modularui/UploadRequest.js +3 -3
  124. package/esm/modularui/UploadRequest.js.map +1 -1
  125. package/esm/react-client/client.js +3 -3
  126. package/esm/react-client/client.js.map +1 -1
  127. package/esm/react-server/renderSSRComplete.js +2 -2
  128. package/esm/react-server/renderSSRComplete.js.map +1 -1
  129. package/esm/react-server/renderSSRMinimal.js +2 -2
  130. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  131. package/esm/redux/_modularui/ModularUIActions.js +8 -2
  132. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  133. package/esm/redux/_modularui/ModularUIUtils.js +8 -11
  134. package/esm/redux/_modularui/ModularUIUtils.js.map +1 -1
  135. package/esm/utils/browser/Cookies.js +3 -3
  136. package/esm/utils/browser/Cookies.js.map +1 -1
  137. package/esm/utils/helpers/createHref.js +23 -3
  138. package/esm/utils/helpers/createHref.js.map +1 -1
  139. package/esm/utils/helpers/repositoryResource.js +2 -2
  140. package/esm/utils/helpers/repositoryResource.js.map +1 -1
  141. package/lib/constants/Settings.js +18 -8
  142. package/lib/constants/Settings.js.flow +16 -6
  143. package/lib/constants/Settings.js.map +1 -1
  144. package/lib/hooks/useAuthentication.js +2 -2
  145. package/lib/hooks/useAuthentication.js.flow +3 -3
  146. package/lib/hooks/useAuthentication.js.map +1 -1
  147. package/lib/hooks/useModelCatalog.js.flow +7 -6
  148. package/lib/hooks/useModelCatalog.js.map +1 -1
  149. package/lib/hooks/useModularUIBasic.js +1 -1
  150. package/lib/hooks/useModularUIBasic.js.flow +1 -1
  151. package/lib/hooks/useModularUIBasic.js.map +1 -1
  152. package/lib/hooks/useModularUIModel.js.flow +16 -11
  153. package/lib/hooks/useModularUIModel.js.map +1 -1
  154. package/lib/models/actions/ActionCollection.js +2 -2
  155. package/lib/models/actions/ActionCollection.js.flow +3 -8
  156. package/lib/models/actions/ActionCollection.js.map +1 -1
  157. package/lib/models/actions/ActionModel.js +12 -22
  158. package/lib/models/actions/ActionModel.js.flow +7 -24
  159. package/lib/models/actions/ActionModel.js.map +1 -1
  160. package/lib/models/application/ApplicationModel.js +1 -1
  161. package/lib/models/application/ApplicationModel.js.flow +1 -2
  162. package/lib/models/application/ApplicationModel.js.map +1 -1
  163. package/lib/models/attributes/AttributeCollection.js +6 -3
  164. package/lib/models/attributes/AttributeCollection.js.flow +12 -4
  165. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  166. package/lib/models/attributes/AttributeModel.js +3 -3
  167. package/lib/models/attributes/AttributeModel.js.flow +8 -2
  168. package/lib/models/attributes/AttributeModel.js.map +1 -1
  169. package/lib/models/attributes/AttributeSetModel.js +7 -3
  170. package/lib/models/attributes/AttributeSetModel.js.flow +11 -3
  171. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  172. package/lib/models/attributes/BooleanAttributeModel.js +6 -3
  173. package/lib/models/attributes/BooleanAttributeModel.js.flow +8 -4
  174. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  175. package/lib/models/attributes/ChoiceAttributeModel.js +6 -3
  176. package/lib/models/attributes/ChoiceAttributeModel.js.flow +13 -4
  177. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  178. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +18 -13
  179. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +30 -28
  180. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  181. package/lib/models/attributes/ChoiceAttributeOptionModel.js +17 -10
  182. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +30 -11
  183. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  184. package/lib/models/attributes/CompositeAttributeChildCollection.js +7 -7
  185. package/lib/models/attributes/CompositeAttributeChildCollection.js.flow +8 -1
  186. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  187. package/lib/models/attributes/CompositeAttributeModel.js +3 -3
  188. package/lib/models/attributes/CompositeAttributeModel.js.flow +8 -3
  189. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  190. package/lib/models/attributes/DatetimeAttributeModel.js +2 -2
  191. package/lib/models/attributes/DatetimeAttributeModel.js.flow +7 -2
  192. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  193. package/lib/models/attributes/StringAttributeModel.js +2 -2
  194. package/lib/models/attributes/StringAttributeModel.js.flow +7 -3
  195. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  196. package/lib/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js.flow +1 -1
  197. package/lib/models/attributes/_createAttribute.js +2 -2
  198. package/lib/models/attributes/_createAttribute.js.flow +3 -2
  199. package/lib/models/attributes/_createAttribute.js.map +1 -1
  200. package/lib/models/base/BaseModel.js +27 -1
  201. package/lib/models/base/BaseModel.js.flow +31 -1
  202. package/lib/models/base/BaseModel.js.map +1 -1
  203. package/lib/models/base/ResourceModel.js +3 -22
  204. package/lib/models/base/ResourceModel.js.flow +6 -23
  205. package/lib/models/base/ResourceModel.js.map +1 -1
  206. package/lib/models/base/__tests__/BaseModel.spec.js.flow +4 -0
  207. package/lib/models/caseview/CaseViewModel.js +1 -1
  208. package/lib/models/caseview/CaseViewModel.js.flow +1 -2
  209. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  210. package/lib/models/concepts/ConceptDetailModel.js +2 -2
  211. package/lib/models/concepts/ConceptDetailModel.js.flow +2 -2
  212. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  213. package/lib/models/concepts/ConceptIndexModel.js +2 -2
  214. package/lib/models/concepts/ConceptIndexModel.js.flow +9 -6
  215. package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
  216. package/lib/models/concepts/ConceptLinkModel.js +4 -10
  217. package/lib/models/concepts/ConceptLinkModel.js.flow +15 -12
  218. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  219. package/lib/models/concepts/ConceptRelationCollection.js +11 -4
  220. package/lib/models/concepts/ConceptRelationCollection.js.flow +17 -3
  221. package/lib/models/concepts/ConceptRelationCollection.js.map +1 -1
  222. package/lib/models/concepts/ConceptRelationModel.js +8 -1
  223. package/lib/models/concepts/ConceptRelationModel.js.flow +18 -2
  224. package/lib/models/concepts/ConceptRelationModel.js.map +1 -1
  225. package/lib/models/concepts/SourceReferenceCollection.js +2 -3
  226. package/lib/models/concepts/SourceReferenceCollection.js.flow +3 -8
  227. package/lib/models/concepts/SourceReferenceCollection.js.map +1 -1
  228. package/lib/models/concepts/SourceReferenceModel.js +8 -8
  229. package/lib/models/concepts/SourceReferenceModel.js.flow +10 -11
  230. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  231. package/lib/models/content/ContentIndexModel.js +2 -2
  232. package/lib/models/content/ContentIndexModel.js.flow +10 -5
  233. package/lib/models/content/ContentIndexModel.js.map +1 -1
  234. package/lib/models/content/ContentLinkModel.js +4 -10
  235. package/lib/models/content/ContentLinkModel.js.flow +10 -13
  236. package/lib/models/content/ContentLinkModel.js.map +1 -1
  237. package/lib/models/content/ContentModel.js +2 -2
  238. package/lib/models/content/ContentModel.js.flow +6 -1
  239. package/lib/models/content/ContentModel.js.map +1 -1
  240. package/lib/models/content/ContentTOCModel.js +7 -7
  241. package/lib/models/content/ContentTOCModel.js.flow +19 -11
  242. package/lib/models/content/ContentTOCModel.js.map +1 -1
  243. package/lib/models/content/SectionModel.js +6 -11
  244. package/lib/models/content/SectionModel.js.flow +9 -21
  245. package/lib/models/content/SectionModel.js.map +1 -1
  246. package/lib/models/detail/DetailModel.js +9 -3
  247. package/lib/models/detail/DetailModel.js.flow +3 -4
  248. package/lib/models/detail/DetailModel.js.map +1 -1
  249. package/lib/models/error/ErrorResponse.js +7 -9
  250. package/lib/models/error/ErrorResponse.js.flow +9 -20
  251. package/lib/models/error/ErrorResponse.js.map +1 -1
  252. package/lib/models/filters/AssignmentFilterModel.js +2 -2
  253. package/lib/models/filters/AssignmentFilterModel.js.flow +7 -3
  254. package/lib/models/filters/AssignmentFilterModel.js.map +1 -1
  255. package/lib/models/filters/BaseFilterModel.js +3 -3
  256. package/lib/models/filters/BaseFilterModel.js.flow +16 -7
  257. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  258. package/lib/models/filters/ConceptIndexFilterModel.js +2 -2
  259. package/lib/models/filters/ConceptIndexFilterModel.js.flow +8 -2
  260. package/lib/models/filters/ConceptIndexFilterModel.js.map +1 -1
  261. package/lib/models/filters/FilterCollection.js +8 -7
  262. package/lib/models/filters/FilterCollection.js.flow +13 -7
  263. package/lib/models/filters/FilterCollection.js.map +1 -1
  264. package/lib/models/filters/StringFilterModel.js +2 -2
  265. package/lib/models/filters/StringFilterModel.js.flow +7 -3
  266. package/lib/models/filters/StringFilterModel.js.map +1 -1
  267. package/lib/models/form/FormModel.js +4 -4
  268. package/lib/models/form/FormModel.js.flow +8 -2
  269. package/lib/models/form/FormModel.js.map +1 -1
  270. package/lib/models/form/FormObjectModel.js +7 -4
  271. package/lib/models/form/FormObjectModel.js.flow +17 -4
  272. package/lib/models/form/FormObjectModel.js.map +1 -1
  273. package/lib/models/grouping/GroupingModel.js +10 -7
  274. package/lib/models/grouping/GroupingModel.js.flow +21 -5
  275. package/lib/models/grouping/GroupingModel.js.map +1 -1
  276. package/lib/models/href/Href.js +8 -7
  277. package/lib/models/href/Href.js.flow +17 -10
  278. package/lib/models/href/Href.js.map +1 -1
  279. package/lib/models/href/__tests__/Href.spec.js.flow +5 -8
  280. package/lib/models/links/LinkCollection.js +2 -3
  281. package/lib/models/links/LinkCollection.js.flow +3 -3
  282. package/lib/models/links/LinkCollection.js.map +1 -1
  283. package/lib/models/links/LinkModel.js +7 -7
  284. package/lib/models/links/LinkModel.js.flow +8 -15
  285. package/lib/models/links/LinkModel.js.map +1 -1
  286. package/lib/models/list/ListDetailModel.js +1 -1
  287. package/lib/models/list/ListDetailModel.js.flow +6 -1
  288. package/lib/models/list/ListDetailModel.js.map +1 -1
  289. package/lib/models/list/ListItemCollection.js +1 -1
  290. package/lib/models/list/ListItemCollection.js.flow +1 -2
  291. package/lib/models/list/ListItemCollection.js.map +1 -1
  292. package/lib/models/list/ListItemModel.js +3 -3
  293. package/lib/models/list/ListItemModel.js.flow +4 -4
  294. package/lib/models/list/ListItemModel.js.map +1 -1
  295. package/lib/models/list/ListModel.js +3 -3
  296. package/lib/models/list/ListModel.js.flow +12 -8
  297. package/lib/models/list/ListModel.js.map +1 -1
  298. package/lib/models/lookup/LookupOptionCollection.js +5 -1
  299. package/lib/models/lookup/LookupOptionCollection.js.flow +17 -6
  300. package/lib/models/lookup/LookupOptionCollection.js.map +1 -1
  301. package/lib/models/lookup/LookupOptionsModel.js +2 -2
  302. package/lib/models/lookup/LookupOptionsModel.js.flow +2 -0
  303. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  304. package/lib/models/panels/GroupingPanelModel.js +1 -1
  305. package/lib/models/panels/GroupingPanelModel.js.flow +1 -2
  306. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  307. package/lib/models/tab/TabModel.js +2 -2
  308. package/lib/models/tab/TabModel.js.flow +2 -4
  309. package/lib/models/tab/TabModel.js.map +1 -1
  310. package/lib/models/taskgroup/TaskGroupModel.js +4 -4
  311. package/lib/models/taskgroup/TaskGroupModel.js.flow +5 -6
  312. package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
  313. package/lib/models/types.js.flow +5 -0
  314. package/lib/models/types.js.map +1 -1
  315. package/lib/models/user/UserProfileModel.js +4 -1
  316. package/lib/models/user/UserProfileModel.js.flow +1 -0
  317. package/lib/models/user/UserProfileModel.js.map +1 -1
  318. package/lib/modularui/CaptchaRequest.js +2 -2
  319. package/lib/modularui/CaptchaRequest.js.flow +7 -3
  320. package/lib/modularui/CaptchaRequest.js.map +1 -1
  321. package/lib/modularui/ModularUIRequest.js +7 -4
  322. package/lib/modularui/ModularUIRequest.js.flow +8 -5
  323. package/lib/modularui/ModularUIRequest.js.map +1 -1
  324. package/lib/modularui/ModularUIResponse.js +11 -2
  325. package/lib/modularui/ModularUIResponse.js.flow +13 -3
  326. package/lib/modularui/ModularUIResponse.js.map +1 -1
  327. package/lib/modularui/UploadRequest.js +2 -2
  328. package/lib/modularui/UploadRequest.js.flow +7 -3
  329. package/lib/modularui/UploadRequest.js.map +1 -1
  330. package/lib/react-client/client.js +2 -2
  331. package/lib/react-client/client.js.flow +7 -3
  332. package/lib/react-client/client.js.map +1 -1
  333. package/lib/react-server/renderSSRComplete.js +1 -1
  334. package/lib/react-server/renderSSRComplete.js.flow +2 -2
  335. package/lib/react-server/renderSSRComplete.js.map +1 -1
  336. package/lib/react-server/renderSSRMinimal.js +1 -1
  337. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  338. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  339. package/lib/redux/_modularui/ModularUIActions.js +8 -2
  340. package/lib/redux/_modularui/ModularUIActions.js.flow +8 -7
  341. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  342. package/lib/redux/_modularui/ModularUIUtils.js +8 -11
  343. package/lib/redux/_modularui/ModularUIUtils.js.flow +13 -14
  344. package/lib/redux/_modularui/ModularUIUtils.js.map +1 -1
  345. package/lib/utils/browser/Cookies.js +2 -2
  346. package/lib/utils/browser/Cookies.js.flow +3 -3
  347. package/lib/utils/browser/Cookies.js.map +1 -1
  348. package/lib/utils/helpers/__tests__/createHref.spec.js.flow +13 -8
  349. package/lib/utils/helpers/createHref.js +23 -3
  350. package/lib/utils/helpers/createHref.js.flow +37 -8
  351. package/lib/utils/helpers/createHref.js.map +1 -1
  352. package/lib/utils/helpers/repositoryResource.js +1 -1
  353. package/lib/utils/helpers/repositoryResource.js.flow +2 -2
  354. package/lib/utils/helpers/repositoryResource.js.map +1 -1
  355. package/package.json +4 -4
  356. package/src/constants/Settings.js +16 -6
  357. package/src/hooks/useAuthentication.js +3 -3
  358. package/src/hooks/useModelCatalog.js +7 -6
  359. package/src/hooks/useModularUIBasic.js +1 -1
  360. package/src/hooks/useModularUIModel.js +16 -11
  361. package/src/models/actions/ActionCollection.js +3 -8
  362. package/src/models/actions/ActionModel.js +7 -24
  363. package/src/models/application/ApplicationModel.js +1 -2
  364. package/src/models/attributes/AttributeCollection.js +12 -4
  365. package/src/models/attributes/AttributeModel.js +8 -2
  366. package/src/models/attributes/AttributeSetModel.js +11 -3
  367. package/src/models/attributes/BooleanAttributeModel.js +8 -4
  368. package/src/models/attributes/ChoiceAttributeModel.js +13 -4
  369. package/src/models/attributes/ChoiceAttributeOptionCollection.js +30 -28
  370. package/src/models/attributes/ChoiceAttributeOptionModel.js +30 -11
  371. package/src/models/attributes/CompositeAttributeChildCollection.js +8 -1
  372. package/src/models/attributes/CompositeAttributeModel.js +8 -3
  373. package/src/models/attributes/DatetimeAttributeModel.js +7 -2
  374. package/src/models/attributes/StringAttributeModel.js +7 -3
  375. package/src/models/attributes/__tests__/ChoiceAttributeOptionModel.spec.js +1 -1
  376. package/src/models/attributes/_createAttribute.js +3 -2
  377. package/src/models/base/BaseModel.js +31 -1
  378. package/src/models/base/ResourceModel.js +6 -23
  379. package/src/models/base/__tests__/BaseModel.spec.js +4 -0
  380. package/src/models/caseview/CaseViewModel.js +1 -2
  381. package/src/models/concepts/ConceptDetailModel.js +2 -2
  382. package/src/models/concepts/ConceptIndexModel.js +9 -6
  383. package/src/models/concepts/ConceptLinkModel.js +15 -12
  384. package/src/models/concepts/ConceptRelationCollection.js +17 -3
  385. package/src/models/concepts/ConceptRelationModel.js +18 -2
  386. package/src/models/concepts/SourceReferenceCollection.js +3 -8
  387. package/src/models/concepts/SourceReferenceModel.js +10 -11
  388. package/src/models/content/ContentIndexModel.js +10 -5
  389. package/src/models/content/ContentLinkModel.js +10 -13
  390. package/src/models/content/ContentModel.js +6 -1
  391. package/src/models/content/ContentTOCModel.js +19 -11
  392. package/src/models/content/SectionModel.js +9 -21
  393. package/src/models/detail/DetailModel.js +3 -4
  394. package/src/models/error/ErrorResponse.js +9 -20
  395. package/src/models/filters/AssignmentFilterModel.js +7 -3
  396. package/src/models/filters/BaseFilterModel.js +16 -7
  397. package/src/models/filters/ConceptIndexFilterModel.js +8 -2
  398. package/src/models/filters/FilterCollection.js +13 -7
  399. package/src/models/filters/StringFilterModel.js +7 -3
  400. package/src/models/form/FormModel.js +8 -2
  401. package/src/models/form/FormObjectModel.js +17 -4
  402. package/src/models/grouping/GroupingModel.js +21 -5
  403. package/src/models/href/Href.js +17 -10
  404. package/src/models/href/__tests__/Href.spec.js +5 -8
  405. package/src/models/links/LinkCollection.js +3 -3
  406. package/src/models/links/LinkModel.js +8 -15
  407. package/src/models/list/ListDetailModel.js +6 -1
  408. package/src/models/list/ListItemCollection.js +1 -2
  409. package/src/models/list/ListItemModel.js +4 -4
  410. package/src/models/list/ListModel.js +12 -8
  411. package/src/models/lookup/LookupOptionCollection.js +17 -6
  412. package/src/models/lookup/LookupOptionsModel.js +2 -0
  413. package/src/models/panels/GroupingPanelModel.js +1 -2
  414. package/src/models/tab/TabModel.js +2 -4
  415. package/src/models/taskgroup/TaskGroupModel.js +5 -6
  416. package/src/models/types.js +5 -0
  417. package/src/models/user/UserProfileModel.js +1 -0
  418. package/src/modularui/CaptchaRequest.js +7 -3
  419. package/src/modularui/ModularUIRequest.js +8 -5
  420. package/src/modularui/ModularUIResponse.js +13 -3
  421. package/src/modularui/UploadRequest.js +7 -3
  422. package/src/react-client/client.js +7 -3
  423. package/src/react-server/renderSSRComplete.js +2 -2
  424. package/src/react-server/renderSSRMinimal.js +2 -2
  425. package/src/redux/_modularui/ModularUIActions.js +8 -7
  426. package/src/redux/_modularui/ModularUIUtils.js +13 -14
  427. package/src/utils/browser/Cookies.js +3 -3
  428. package/src/utils/helpers/__tests__/createHref.spec.js +13 -8
  429. package/src/utils/helpers/createHref.js +37 -8
  430. package/src/utils/helpers/repositoryResource.js +2 -2
@@ -180,6 +180,7 @@ export default class ListModel extends ResourceModel {
180
180
  return new GroupingModel(
181
181
  { ...this.data.grouping, dynamicschema: this.data.dynamicschema },
182
182
  this.contributions.contexts,
183
+ this.modelOptions,
183
184
  );
184
185
  }
185
186
 
@@ -285,12 +286,16 @@ export default class ListModel extends ResourceModel {
285
286
  /**
286
287
  */
287
288
  setFilters(): FilterCollection {
288
- return new FilterCollection(this.data.filter, {
289
- listkey: this.key,
290
- filter: this.contributions.filter,
291
- contexts: this.contributions.contexts,
292
- dynamicschema: this.data.dynamicschema,
293
- });
289
+ return new FilterCollection(
290
+ this.data.filter,
291
+ {
292
+ listkey: this.key,
293
+ filter: this.contributions.filter,
294
+ contexts: this.contributions.contexts,
295
+ dynamicschema: this.data.dynamicschema,
296
+ },
297
+ this.modelOptions,
298
+ );
294
299
  }
295
300
 
296
301
  /**
@@ -316,8 +321,7 @@ export default class ListModel extends ResourceModel {
316
321
  return new ActionCollection(
317
322
  this.data.actions,
318
323
  this.contributions.actions,
319
- this.origin,
320
- this.contextPath,
324
+ this.modelOptions,
321
325
  );
322
326
  }
323
327
 
@@ -1,23 +1,34 @@
1
1
  // @flow
2
2
  import ResourceCollection from "../base/ResourceCollection";
3
3
  import ChoiceAttributeOptionModel from "../attributes/ChoiceAttributeOptionModel";
4
+ import { DateUtil } from "../../utils";
5
+
6
+ import type { ModelOptions } from "../types";
4
7
 
5
8
  /**
6
9
  */
7
10
  class LookupOptionCollection extends ResourceCollection<ChoiceAttributeOptionModel> {
8
11
  /**
9
12
  */
10
- static create(data: Object, contributions: Object): LookupOptionCollection {
13
+ static create(
14
+ data: Object,
15
+ contributions: Object,
16
+ modelOptions?: ModelOptions,
17
+ ): LookupOptionCollection {
11
18
  const collection = new LookupOptionCollection();
12
19
 
13
20
  if (data.options && contributions.options) {
14
21
  data.options.forEach((option) => {
15
22
  collection.add(
16
- new ChoiceAttributeOptionModel([], {
17
- ...option,
18
- optionType: this.getOptionType(option, contributions),
19
- elementsContributions: contributions.options[0].elements,
20
- }),
23
+ new ChoiceAttributeOptionModel(
24
+ [],
25
+ {
26
+ ...option,
27
+ optionType: this.getOptionType(option, contributions),
28
+ elementsContributions: contributions.options[0].elements,
29
+ },
30
+ { ...modelOptions, referenceDate: DateUtil.now() },
31
+ ),
21
32
  );
22
33
  });
23
34
  }
@@ -19,6 +19,7 @@ export default class LookupOptionsModel extends ResourceModel {
19
19
  this._options = LookupOptionCollection.create(
20
20
  this.data,
21
21
  this.contributions,
22
+ this.modelOptions,
22
23
  );
23
24
 
24
25
  this._filterCollection = this.createFilterCollection(
@@ -64,6 +65,7 @@ export default class LookupOptionsModel extends ResourceModel {
64
65
  return new FilterCollection(
65
66
  { [data.name]: data },
66
67
  { filter: contributions },
68
+ this.modelOptions,
67
69
  );
68
70
  }
69
71
 
@@ -129,8 +129,7 @@ export default class GroupingPanelModel extends ResourceModel {
129
129
  taskgroup.name,
130
130
  taskgroup,
131
131
  taskgroupContributions,
132
- this.origin,
133
- this.contextPath,
132
+ this.modelOptions,
134
133
  );
135
134
  });
136
135
  }
@@ -26,8 +26,7 @@ export default class TabModel extends ResourceModel {
26
26
  this._actionCollection = new ActionCollection(
27
27
  this.data.actions,
28
28
  this.contributions.actions,
29
- this.origin,
30
- this.contextPath,
29
+ this.modelOptions,
31
30
  );
32
31
  }
33
32
 
@@ -95,8 +94,7 @@ export default class TabModel extends ResourceModel {
95
94
  taskgroup.name,
96
95
  taskgroup,
97
96
  taskgroupContributions,
98
- this.origin,
99
- this.contextPath,
97
+ this.modelOptions,
100
98
  );
101
99
  }
102
100
 
@@ -3,6 +3,7 @@ import ActionCollection from "../actions/ActionCollection";
3
3
  import ResourceModel from "../base/ResourceModel";
4
4
 
5
5
  import ModularUIResponse from "../../modularui/ModularUIResponse";
6
+ import type { ModelOptions } from "../types";
6
7
 
7
8
  /**
8
9
  * TaskGroupModel
@@ -19,8 +20,7 @@ export default class TaskGroupModel extends ResourceModel {
19
20
  this._actionCollection = new ActionCollection(
20
21
  this.data.actions,
21
22
  this.contributions.actions,
22
- this.origin,
23
- this.contextPath,
23
+ this.modelOptions,
24
24
  );
25
25
 
26
26
  const selfHref = this.links.getLinkByKey("self")
@@ -38,15 +38,14 @@ export default class TaskGroupModel extends ResourceModel {
38
38
  key: string,
39
39
  data: Object,
40
40
  contributions: Object,
41
- origin?: string,
42
- contextPath?: string,
41
+ modelOptions?: ModelOptions,
43
42
  ): TaskGroupModel {
44
43
  const taskgroup = new ModularUIResponse();
45
44
  taskgroup.key = key;
46
45
  taskgroup.data = data;
47
46
  taskgroup.contributions = contributions;
48
- taskgroup.origin = origin;
49
- taskgroup.contextPath = contextPath;
47
+ taskgroup.origin = modelOptions?.origin;
48
+ taskgroup.contextPath = modelOptions?.contextPath;
50
49
 
51
50
  return new TaskGroupModel(taskgroup);
52
51
  }
@@ -261,3 +261,8 @@ export type ContentData = {
261
261
  label?: string,
262
262
  elements: Array<PropertyElement | TextFragmentElement | ContentElement>,
263
263
  };
264
+
265
+ export type ModelOptions = {
266
+ origin?: ?string,
267
+ contextPath?: ?string,
268
+ };
@@ -29,6 +29,7 @@ export default class UserProfileModel extends UserModel {
29
29
  this._attributeCollection = new AttributeCollection(
30
30
  this.data,
31
31
  attributeContributions,
32
+ { ...this.modelOptions, isReadonly: true },
32
33
  );
33
34
  }
34
35
 
@@ -1,6 +1,10 @@
1
1
  // @flow
2
2
  import xhr from "../utils/fetch/xhr";
3
- import { getBasePath, getCaptchaPath, HTTP_METHODS } from "../constants";
3
+ import {
4
+ getBasePathModularUI,
5
+ getCaptchaPath,
6
+ HTTP_METHODS,
7
+ } from "../constants";
4
8
 
5
9
  type CaptchaInitialResponse = {
6
10
  tokenId: string,
@@ -36,13 +40,13 @@ class CaptchaRequest {
36
40
  _tokenId: string;
37
41
  _image: string;
38
42
  _origin: string = "";
39
- _contextPath: string = getBasePath();
43
+ _contextPath: string = getBasePathModularUI();
40
44
 
41
45
  /**
42
46
  */
43
47
  CaptchaRequest(options?: CaptchaRequestOptions) {
44
48
  this._origin = options?.origin || "";
45
- this._contextPath = options?.contextPath || getBasePath();
49
+ this._contextPath = options?.contextPath || getBasePathModularUI();
46
50
  }
47
51
 
48
52
  /**
@@ -5,7 +5,7 @@ import { HTTP_METHODS, TIMEVERSION_FILTER_NAME } from "../constants/Constants";
5
5
 
6
6
  import { HIDE_WHEN_EMPTY } from "../constants/LayoutHints";
7
7
 
8
- import { getBasePath, getSetting } from "../constants/Settings";
8
+ import { getBasePathModularUI, getSetting } from "../constants/Settings";
9
9
 
10
10
  import Href from "../models/href/Href";
11
11
 
@@ -47,7 +47,7 @@ class ModularUIRequest {
47
47
  _progressEvent: ProgressEventHandler;
48
48
 
49
49
  _origin: string = "";
50
- _contextPath: string = getBasePath();
50
+ _contextPath: string = getBasePathModularUI();
51
51
 
52
52
  /**
53
53
  */
@@ -117,8 +117,8 @@ class ModularUIRequest {
117
117
  /**
118
118
  */
119
119
  set contextPath(contextPath: ?string) {
120
- this._contextPath = contextPath ?? getBasePath();
121
- this._response.contextPath = contextPath ?? getBasePath();
120
+ this._contextPath = contextPath ?? getBasePathModularUI();
121
+ this._response.contextPath = contextPath ?? getBasePathModularUI();
122
122
  }
123
123
 
124
124
  /**
@@ -725,7 +725,10 @@ class ModularUIRequest {
725
725
  );
726
726
  }
727
727
  errorChildModels.push(
728
- new ErrorResponse(reason, "", this.origin, this.contextPath),
728
+ new ErrorResponse(reason, "", {
729
+ origin: this.origin,
730
+ contextPath: this.contextPath,
731
+ }),
729
732
  );
730
733
  } else {
731
734
  resolvedChildModels.push(childModel.value);
@@ -1,8 +1,9 @@
1
1
  // @flow
2
2
  import { has } from "../utils/helpers/objects";
3
- import { getBasePath } from "../constants";
3
+ import { getBasePathModularUI } from "../constants";
4
4
 
5
5
  import type Parameter from "../models/parameter/Parameter";
6
+ import type { ModelOptions } from "../models";
6
7
 
7
8
  /**
8
9
  */
@@ -12,7 +13,7 @@ class ModularUIResponse {
12
13
  _contributions: Object;
13
14
  _locale: string = "en";
14
15
  _parameters: Array<Parameter> = [];
15
- _contextPath: string = getBasePath();
16
+ _contextPath: string = getBasePathModularUI();
16
17
  _origin: string = "";
17
18
 
18
19
  /**
@@ -40,6 +41,15 @@ class ModularUIResponse {
40
41
  return response;
41
42
  }
42
43
 
44
+ /**
45
+ */
46
+ get modelOptions(): ModelOptions {
47
+ return {
48
+ origin: this.origin,
49
+ contextPath: this.contextPath,
50
+ };
51
+ }
52
+
43
53
  /**
44
54
  */
45
55
  set origin(origin: ?string) {
@@ -55,7 +65,7 @@ class ModularUIResponse {
55
65
  /**
56
66
  */
57
67
  set contextPath(contextPath: ?string) {
58
- this._contextPath = contextPath ?? getBasePath();
68
+ this._contextPath = contextPath ?? getBasePathModularUI();
59
69
  }
60
70
 
61
71
  /**
@@ -1,5 +1,9 @@
1
1
  // @flow
2
- import { getBasePath, getUploadPath, HTTP_METHODS } from "../constants";
2
+ import {
3
+ getBasePathModularUI,
4
+ getUploadPath,
5
+ HTTP_METHODS,
6
+ } from "../constants";
3
7
 
4
8
  import xhr from "../utils/fetch/xhr";
5
9
 
@@ -31,7 +35,7 @@ class UploadRequest {
31
35
  };
32
36
  _progressHandler: ProgressHandler;
33
37
  _origin: string = "";
34
- _contextPath: string = getBasePath();
38
+ _contextPath: string = getBasePathModularUI();
35
39
 
36
40
  constructor(
37
41
  uploadConstraints: {
@@ -45,7 +49,7 @@ class UploadRequest {
45
49
  this._uploadConstraints = uploadConstraints;
46
50
  this._progressHandler = progressHandler;
47
51
  this._origin = options?.origin || "";
48
- this._contextPath = options?.contextPath || getBasePath();
52
+ this._contextPath = options?.contextPath || getBasePathModularUI();
49
53
  }
50
54
 
51
55
  /**
@@ -13,7 +13,11 @@ import { createBrowserHistory } from "history";
13
13
  import configureStore from "../redux/store/configureStore";
14
14
 
15
15
  import rehydrate from "./rehydrate";
16
- import { getBasePath, getSetting } from "../constants/Settings";
16
+ import {
17
+ getBasePathModularUI,
18
+ getBasePathServer,
19
+ getSetting,
20
+ } from "../constants/Settings";
17
21
 
18
22
  import {
19
23
  setAllContentInDataSetting,
@@ -107,7 +111,7 @@ const handleRedirectURI = (store: ReduxStore) => {
107
111
  const urlParams = new URLSearchParams(window.location.search);
108
112
  const redirectURI = urlParams.get("redirectURI");
109
113
  if (redirectURI) {
110
- xhr({ url: `${getBasePath()}${redirectURI}` }).catch((e) => {
114
+ xhr({ url: `${getBasePathModularUI()}${redirectURI}` }).catch((e) => {
111
115
  if (
112
116
  e.id === "UnauthorizedException" ||
113
117
  e.id === "Error.NotAuthorized" ||
@@ -143,7 +147,7 @@ export const setupClient = (
143
147
 
144
148
  // $FlowExpectedError
145
149
  const browserHistory: RouterHistory = createBrowserHistory({
146
- basename: getBasePath(),
150
+ basename: getBasePathServer(),
147
151
  });
148
152
  const { routerHistory, store } = configureStore(
149
153
  browserHistory,
@@ -10,7 +10,7 @@ import { ServerStyleSheet, StyleSheetManager } from "styled-components";
10
10
  import createSSRComplete from "./createSSRComplete";
11
11
  import htmlpage from "./htmlpage";
12
12
 
13
- import { getBasePath } from "../constants/Settings";
13
+ import { getBasePathServer } from "../constants/Settings";
14
14
 
15
15
  import ThemeProvider from "../react-theme/ThemeProvider";
16
16
  import ErrorBoundary from "../react/ErrorBoundary";
@@ -52,7 +52,7 @@ const renderSSRComplete = ({
52
52
  // $FlowFixMe[prop-missing]
53
53
  const location: Location = requestHref.toLocation();
54
54
 
55
- const basePath = getBasePath();
55
+ const basePath = getBasePathServer();
56
56
 
57
57
  return createSSRComplete(store, () =>
58
58
  renderToString(
@@ -6,7 +6,7 @@ import { Provider } from "react-redux";
6
6
  import { ServerStyleSheet, StyleSheetManager } from "styled-components";
7
7
  import ThemeProvider from "../react-theme/ThemeProvider";
8
8
 
9
- import { getBasePath } from "../constants/Settings";
9
+ import { getBasePathServer } from "../constants/Settings";
10
10
 
11
11
  import { createHead, dehydrate } from "./serverUtil";
12
12
  import htmlpage from "./htmlpage";
@@ -43,7 +43,7 @@ const renderSSRMinimal = ({
43
43
 
44
44
  const head = createHead(sheet, UUID);
45
45
  return template({
46
- contextPath: getBasePath(),
46
+ contextPath: getBasePathServer(),
47
47
  html: appHTML,
48
48
  head,
49
49
  state: dehydrate(store),
@@ -115,7 +115,10 @@ export const loadModel = (
115
115
  href:
116
116
  href instanceof Href
117
117
  ? href
118
- : new Href(href, "", options?.origin, options?.contextPath),
118
+ : new Href(href, "", {
119
+ origin: options?.origin,
120
+ contextPath: options?.contextPath,
121
+ }),
119
122
  method: options?.method ?? HTTP_METHODS.GET,
120
123
  data: options?.data,
121
124
  locale: options?.locale ?? "en",
@@ -130,12 +133,10 @@ export const loadModel = (
130
133
  /**
131
134
  */
132
135
  errorAction: (error) => {
133
- const errorResponse = new ErrorResponse(
134
- error,
135
- key,
136
- options?.origin,
137
- options?.contextPath,
138
- );
136
+ const errorResponse = new ErrorResponse(error, key, {
137
+ origin: options?.origin,
138
+ contextPath: options?.contextPath,
139
+ });
139
140
  if (errorResponse.isChangePassword) {
140
141
  return {
141
142
  type: "NO_ACTION",
@@ -10,20 +10,23 @@ import type { ComponentType } from "react";
10
10
  /**
11
11
  * Generate modular ui url
12
12
  */
13
- const getUrl = (resource: string | Function, props: Object) => {
13
+ const getUrl = (resource: string | Function | Href, props: Object): Href => {
14
14
  const url = typeof resource === "function" ? resource(props) : resource;
15
15
 
16
16
  if (url instanceof Href) {
17
- return url.toString();
17
+ return url;
18
18
  }
19
19
 
20
- return url || "";
20
+ return new Href(url);
21
21
  };
22
22
 
23
23
  /**
24
24
  */
25
- export const useUrl = (resource: string | Function, props: Object): string => {
26
- const [previousUrl, setPreviousUrl] = useState("");
25
+ export const useUrl = (
26
+ resource: string | Function | Href,
27
+ props: Object,
28
+ ): Href => {
29
+ const [previousUrl, setPreviousUrl] = useState(null);
27
30
  const [previousExact, setPreviousExact] = useState(false);
28
31
 
29
32
  const url = getUrl(resource, props);
@@ -36,21 +39,17 @@ export const useUrl = (resource: string | Function, props: Object): string => {
36
39
  return url;
37
40
  }
38
41
 
39
- const isDifferentUrl = url !== previousUrl;
40
- if (!isDifferentUrl) {
41
- return previousUrl;
42
+ if (url.equals(previousUrl)) {
43
+ return url;
42
44
  }
43
45
 
44
- const hasDifferentStartUriPart =
45
- previousUrl !== "" && !previousUrl.startsWith(match.url);
46
-
47
46
  // Always create an url when the match is exact
48
47
  // Or when the match is not exact AND the original match also was not exact
49
- // Or when the new start uri is different from the previous url
48
+ // Or when the new start uri is different from the previous url --> different resource for same panel
50
49
  if (
51
50
  match.isExact === true ||
52
51
  previousExact === match.isExact ||
53
- hasDifferentStartUriPart
52
+ !previousUrl?.startsWith(match.url)
54
53
  ) {
55
54
  setPreviousUrl(url);
56
55
  setPreviousExact(match.isExact);
@@ -58,7 +57,7 @@ export const useUrl = (resource: string | Function, props: Object): string => {
58
57
  return url;
59
58
  }
60
59
 
61
- return previousUrl;
60
+ return previousUrl || new Href("");
62
61
  };
63
62
 
64
63
  /**
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
  import Cookies from "js-cookie";
3
3
 
4
- import { getBasePath } from "../../constants/Settings";
4
+ import { getBasePathServer } from "../../constants/Settings";
5
5
 
6
6
  type CookieOptions = {
7
7
  days?: number,
@@ -29,7 +29,7 @@ export const setCookie = (
29
29
  value: any,
30
30
  options?: CookieOptions,
31
31
  ) => {
32
- const attributes: CookieAttributes = { path: getBasePath() };
32
+ const attributes: CookieAttributes = { path: getBasePathServer() };
33
33
  attributes.expires = options?.days;
34
34
  attributes.sameSite = options?.sameSite ?? "Strict";
35
35
  attributes.secure = options?.secure;
@@ -40,5 +40,5 @@ export const setCookie = (
40
40
  /**
41
41
  */
42
42
  export const clearCookie = (name: string) => {
43
- Cookies.remove(name, { path: getBasePath() });
43
+ Cookies.remove(name, { path: getBasePathServer() });
44
44
  };
@@ -1,4 +1,5 @@
1
1
  import { createHref } from "../createHref";
2
+ import Href from "../../../models/href/Href";
2
3
 
3
4
  describe("createHref", () => {
4
5
  it("can filter out qs parameters", () => {
@@ -7,24 +8,28 @@ describe("createHref", () => {
7
8
  search: "?entryDate=2024-03-08&index=C&notAllowed=true",
8
9
  };
9
10
 
10
- expect(createHref("concepts", dynamicPart)).toBe(
11
- "/concepts/" + dynamicPart,
11
+ expect(createHref("concepts", dynamicPart)).toEqual(
12
+ new Href("/concepts/" + dynamicPart),
12
13
  );
13
- expect(createHref("concepts", dynamicPart, location)).toBe(
14
- "/concepts/" + dynamicPart + location.search,
14
+ expect(createHref("concepts", dynamicPart, location)).toEqual(
15
+ new Href("/concepts/" + dynamicPart + location.search),
15
16
  );
16
17
  expect(
17
18
  createHref("concepts", dynamicPart, location, ["entryDate", "index"]),
18
- ).toBe("/concepts/" + dynamicPart + "?entryDate=2024-03-08&index=C");
19
+ ).toEqual(
20
+ new Href("/concepts/" + dynamicPart + "?entryDate=2024-03-08&index=C"),
21
+ );
19
22
  expect(
20
23
  createHref("concepts", dynamicPart + location.search, location, [
21
24
  "entryDate",
22
25
  "index",
23
26
  ]),
24
- ).toBe("/concepts/" + dynamicPart + "?entryDate=2024-03-08&index=C");
27
+ ).toEqual(
28
+ new Href("/concepts/" + dynamicPart + "?entryDate=2024-03-08&index=C"),
29
+ );
25
30
 
26
- expect(createHref("concepts", dynamicPart + "#hash")).toBe(
27
- "/concepts/" + dynamicPart + "#hash",
31
+ expect(createHref("concepts", dynamicPart + "#hash")).toEqual(
32
+ new Href("/concepts/" + dynamicPart + "#hash"),
28
33
  );
29
34
  });
30
35
  });
@@ -1,11 +1,21 @@
1
1
  // @flow
2
+ import Href from "../../models/href/Href";
3
+
2
4
  import type { Location } from "react-router";
3
5
 
4
6
  /**
5
7
  */
6
8
  export const parseUrl = (
7
- href: string,
9
+ href: string | Href,
8
10
  ): { path: string, querystring: null | string, hash: null | string } => {
11
+ if (href instanceof Href) {
12
+ return {
13
+ path: href.path,
14
+ querystring: href.querystring,
15
+ hash: href.hash,
16
+ };
17
+ }
18
+
9
19
  let path = href;
10
20
  let hash = null;
11
21
  let querystring = null;
@@ -29,11 +39,11 @@ export const parseUrl = (
29
39
  /**
30
40
  */
31
41
  export const filterParameters = (
32
- href: string,
42
+ href: string | Href,
33
43
  allowedParameters?: Array<string>,
34
- ): string => {
44
+ ): Href => {
35
45
  if (!Array.isArray(allowedParameters)) {
36
- return href;
46
+ return new Href(href);
37
47
  }
38
48
 
39
49
  const url = parseUrl(href);
@@ -51,18 +61,27 @@ export const filterParameters = (
51
61
  if (url.hash) {
52
62
  filteredUrl = filteredUrl + "#" + url.hash;
53
63
  }
54
- return filteredUrl;
64
+
65
+ if (href instanceof Href) {
66
+ return new Href(filteredUrl, href.resourcetype, {
67
+ origin: href.origin,
68
+ contextPath: href.contextPath,
69
+ });
70
+ }
71
+
72
+ return new Href(filteredUrl);
55
73
  };
56
74
 
57
75
  /**
58
76
  */
59
77
  export const createHref = (
60
78
  context: string,
61
- dynamicPart: string,
79
+ dynamicPart: string | Href,
62
80
  location?: ?Location,
63
81
  allowedParameters?: Array<string>,
64
- ): string => {
65
- let href = dynamicPart;
82
+ ): Href => {
83
+ let href = dynamicPart.toString();
84
+
66
85
  if (!href.startsWith(`/${context}/`)) {
67
86
  href = `/${context}/${href}`;
68
87
  }
@@ -76,5 +95,15 @@ export const createHref = (
76
95
  href = `${href}?${search}`;
77
96
  }
78
97
 
98
+ if (dynamicPart instanceof Href) {
99
+ return filterParameters(
100
+ new Href(href, dynamicPart.resourcetype, {
101
+ origin: dynamicPart.origin,
102
+ contextPath: dynamicPart.contextPath,
103
+ }),
104
+ allowedParameters,
105
+ );
106
+ }
107
+
79
108
  return filterParameters(href, allowedParameters);
80
109
  };
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import { getBasePath, RESOURCE_PATH } from "../../constants";
2
+ import { getBasePathServer, RESOURCE_PATH } from "../../constants";
3
3
 
4
4
  /**
5
5
  * Creates an url to a resource in the Be Informed repository
@@ -7,7 +7,7 @@ import { getBasePath, RESOURCE_PATH } from "../../constants";
7
7
  */
8
8
  export const getRepositoryResourceUrl = (
9
9
  resourceUrl: string,
10
- contextPath: string = getBasePath(),
10
+ contextPath: string = getBasePathServer(),
11
11
  origin: string = "",
12
12
  ): string => {
13
13
  if (resourceUrl.startsWith(origin + contextPath)) {