@beinformed/ui 1.18.2 → 1.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/esm/constants/Constants.js +1 -0
  3. package/esm/constants/Constants.js.map +1 -1
  4. package/esm/constants/Settings.js +10 -3
  5. package/esm/constants/Settings.js.map +1 -1
  6. package/esm/hooks/useAuthentication.js +7 -50
  7. package/esm/hooks/useAuthentication.js.map +1 -1
  8. package/esm/i18n/Locales.js.map +1 -1
  9. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  10. package/esm/models/form/FormModel.js +3 -1
  11. package/esm/models/form/FormModel.js.map +1 -1
  12. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  13. package/esm/models/list/ListModel.js +1 -1
  14. package/esm/models/list/ListModel.js.map +1 -1
  15. package/esm/models/tab/TabModel.js.map +1 -1
  16. package/esm/modularui/Authenticate.js +100 -21
  17. package/esm/modularui/Authenticate.js.map +1 -1
  18. package/esm/redux/actions/Preferences.js +2 -2
  19. package/esm/redux/actions/Preferences.js.map +1 -1
  20. package/esm/redux/actions/SignOut.js +6 -2
  21. package/esm/redux/actions/SignOut.js.map +1 -1
  22. package/esm/redux/connectors/SignIn.js +3 -2
  23. package/esm/redux/connectors/SignIn.js.map +1 -1
  24. package/esm/redux/connectors/SignOut.js +4 -1
  25. package/esm/redux/connectors/SignOut.js.map +1 -1
  26. package/esm/redux/reducers/AuthReducer.js +0 -10
  27. package/esm/redux/reducers/AuthReducer.js.map +1 -1
  28. package/esm/redux/types.js.map +1 -1
  29. package/esm/utils/helpers/checkResource.js +2 -0
  30. package/esm/utils/helpers/checkResource.js.map +1 -1
  31. package/lib/constants/Constants.js +3 -1
  32. package/lib/constants/Constants.js.flow +1 -0
  33. package/lib/constants/Constants.js.map +1 -1
  34. package/lib/constants/LayoutHints.js.map +1 -1
  35. package/lib/constants/Settings.js +13 -3
  36. package/lib/constants/Settings.js.flow +8 -3
  37. package/lib/constants/Settings.js.map +1 -1
  38. package/lib/exceptions/FetchException.js.map +1 -1
  39. package/lib/hooks/__tests__/useAuthentication.spec.js.flow +15 -1
  40. package/lib/hooks/useAllFormsOnModel.js.map +1 -1
  41. package/lib/hooks/useAuthentication.js +7 -55
  42. package/lib/hooks/useAuthentication.js.flow +4 -37
  43. package/lib/hooks/useAuthentication.js.map +1 -1
  44. package/lib/hooks/useContent.js.map +1 -1
  45. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  46. package/lib/hooks/useForm.js.map +1 -1
  47. package/lib/hooks/useI18n.js.map +1 -1
  48. package/lib/hooks/useModal.js.map +1 -1
  49. package/lib/hooks/useModelCatalog.js.map +1 -1
  50. package/lib/hooks/useModels.js.map +1 -1
  51. package/lib/hooks/useModularUI.js.map +1 -1
  52. package/lib/hooks/useModularUIBasic.js.map +1 -1
  53. package/lib/hooks/useModularUIModel.js.map +1 -1
  54. package/lib/hooks/useModularUIRequest.js.map +1 -1
  55. package/lib/hooks/useNotification.js.map +1 -1
  56. package/lib/hooks/usePreference.js.map +1 -1
  57. package/lib/hooks/useProgressIndicator.js.map +1 -1
  58. package/lib/hooks/useRouter.js.map +1 -1
  59. package/lib/i18n/Locale.js.map +1 -1
  60. package/lib/i18n/Locales.js.map +1 -1
  61. package/lib/i18n/Message.js.map +1 -1
  62. package/lib/i18n/withMessage.js.map +1 -1
  63. package/lib/models/actions/ActionModel.js.map +1 -1
  64. package/lib/models/application/ApplicationModel.js.map +1 -1
  65. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  66. package/lib/models/attributes/AttributeContent.js.map +1 -1
  67. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  68. package/lib/models/attributes/AttributeModel.js.map +1 -1
  69. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  70. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  71. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  72. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  73. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  74. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  75. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  76. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  77. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  78. package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
  79. package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
  80. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  81. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  82. package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
  83. package/lib/models/attributes/_createAttribute.js.map +1 -1
  84. package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  85. package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  86. package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
  87. package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
  88. package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
  89. package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
  90. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  91. package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
  92. package/lib/models/base/BaseCollection.js.map +1 -1
  93. package/lib/models/base/BaseModel.js.map +1 -1
  94. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  95. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  96. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  97. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  98. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  99. package/lib/models/content/ContentLinkModel.js.map +1 -1
  100. package/lib/models/content/ContentTOCModel.js.map +1 -1
  101. package/lib/models/content/SectionModel.js.map +1 -1
  102. package/lib/models/content/SubSectionModel.js.map +1 -1
  103. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  104. package/lib/models/detail/DetailModel.js.map +1 -1
  105. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  106. package/lib/models/form/FormModel.js +3 -1
  107. package/lib/models/form/FormModel.js.flow +1 -1
  108. package/lib/models/form/FormModel.js.map +1 -1
  109. package/lib/models/form/FormObjectModel.js.map +1 -1
  110. package/lib/models/href/Href.js.map +1 -1
  111. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  112. package/lib/models/links/LinkCollection.js.map +1 -1
  113. package/lib/models/links/LinkModel.js.map +1 -1
  114. package/lib/models/list/ListDetailModel.js.map +1 -1
  115. package/lib/models/list/ListHeaderModel.js.map +1 -1
  116. package/lib/models/list/ListItemCollection.js.map +1 -1
  117. package/lib/models/list/ListModel.js +1 -1
  118. package/lib/models/list/ListModel.js.flow +1 -1
  119. package/lib/models/list/ListModel.js.map +1 -1
  120. package/lib/models/list/__tests__/ListModel.spec.js.flow +13 -0
  121. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  122. package/lib/models/paging/PagingModel.js.map +1 -1
  123. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  124. package/lib/models/parameter/Parameter.js.map +1 -1
  125. package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
  126. package/lib/models/resolveModel.js.map +1 -1
  127. package/lib/models/sorting/SortingModel.js.map +1 -1
  128. package/lib/models/tab/TabModel.js.map +1 -1
  129. package/lib/models/user/UserProfileModel.js.map +1 -1
  130. package/lib/models/user/UserServicesModel.js.map +1 -1
  131. package/lib/modularui/Authenticate.js +102 -21
  132. package/lib/modularui/Authenticate.js.flow +75 -20
  133. package/lib/modularui/Authenticate.js.map +1 -1
  134. package/lib/modularui/ModularUIRequest.js.map +1 -1
  135. package/lib/modularui/ModularUIResponse.js.map +1 -1
  136. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  137. package/lib/react-client/client.js.map +1 -1
  138. package/lib/react-client/rehydrate.js.map +1 -1
  139. package/lib/react-server/__tests__/serverUtil.spec.js.flow +6 -4
  140. package/lib/react-server/createSSRComplete.js.map +1 -1
  141. package/lib/react-server/renderSSRComplete.js.map +1 -1
  142. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  143. package/lib/react-server/serverNoSSR.js.map +1 -1
  144. package/lib/react-server/serverSSR.js.map +1 -1
  145. package/lib/react-server/serverUtil.js.map +1 -1
  146. package/lib/react-theme/ThemeProvider.js.map +1 -1
  147. package/lib/react-theme/createTheme.js.map +1 -1
  148. package/lib/react-theme/useTheme.js.map +1 -1
  149. package/lib/react-theme/utils/background.js.map +1 -1
  150. package/lib/react-theme/utils/colors.js.map +1 -1
  151. package/lib/react-theme/utils/contrast.js.map +1 -1
  152. package/lib/react-theme/utils/corners.js.map +1 -1
  153. package/lib/react-theme/utils/spacers.js.map +1 -1
  154. package/lib/react-theme/utils/themeProps.js.map +1 -1
  155. package/lib/redux/_i18n/actions.js.map +1 -1
  156. package/lib/redux/_i18n/reducer.js.map +1 -1
  157. package/lib/redux/_modularui/actions.js.map +1 -1
  158. package/lib/redux/_modularui/connector.js.map +1 -1
  159. package/lib/redux/_modularui/middleware.js.map +1 -1
  160. package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
  161. package/lib/redux/_modularui/reducer.js.map +1 -1
  162. package/lib/redux/_modularui/selectors.js.map +1 -1
  163. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  164. package/lib/redux/_router/connectors.js.map +1 -1
  165. package/lib/redux/actions/Application.js.map +1 -1
  166. package/lib/redux/actions/Authorization.js.map +1 -1
  167. package/lib/redux/actions/Error.js.map +1 -1
  168. package/lib/redux/actions/Form.js.map +1 -1
  169. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  170. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  171. package/lib/redux/actions/FormAutosave.js.map +1 -1
  172. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  173. package/lib/redux/actions/FormValidations.js.map +1 -1
  174. package/lib/redux/actions/Notification.js.map +1 -1
  175. package/lib/redux/actions/Preferences.js +1 -1
  176. package/lib/redux/actions/Preferences.js.flow +7 -3
  177. package/lib/redux/actions/Preferences.js.map +1 -1
  178. package/lib/redux/actions/SignIn.js.map +1 -1
  179. package/lib/redux/actions/SignOut.js +6 -1
  180. package/lib/redux/actions/SignOut.js.flow +9 -5
  181. package/lib/redux/actions/SignOut.js.map +1 -1
  182. package/lib/redux/connectors/Application.js.map +1 -1
  183. package/lib/redux/connectors/Breadcrumb.js.map +1 -1
  184. package/lib/redux/connectors/CaseView.js.map +1 -1
  185. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  186. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  187. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  188. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  189. package/lib/redux/connectors/Form.js.map +1 -1
  190. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  191. package/lib/redux/connectors/ListDetail.js.map +1 -1
  192. package/lib/redux/connectors/Modal.js.map +1 -1
  193. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  194. package/lib/redux/connectors/Notification.js.map +1 -1
  195. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  196. package/lib/redux/connectors/Preferences.js.map +1 -1
  197. package/lib/redux/connectors/Progress.js.map +1 -1
  198. package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
  199. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  200. package/lib/redux/connectors/SignIn.js +3 -5
  201. package/lib/redux/connectors/SignIn.js.flow +1 -6
  202. package/lib/redux/connectors/SignIn.js.map +1 -1
  203. package/lib/redux/connectors/SignOut.js +5 -1
  204. package/lib/redux/connectors/SignOut.js.flow +2 -1
  205. package/lib/redux/connectors/SignOut.js.map +1 -1
  206. package/lib/redux/connectors/Tab.js.map +1 -1
  207. package/lib/redux/reducers/AuthReducer.js +0 -11
  208. package/lib/redux/reducers/AuthReducer.js.flow +0 -11
  209. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  210. package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
  211. package/lib/redux/store/configureStore.js.map +1 -1
  212. package/lib/redux/types.js.flow +0 -1
  213. package/lib/redux/types.js.map +1 -1
  214. package/lib/utils/browser/Cookies.js.map +1 -1
  215. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  216. package/lib/utils/fetch/universalFetch.js.map +1 -1
  217. package/lib/utils/fetch/xhr.js.map +1 -1
  218. package/lib/utils/helpers/checkResource.js +2 -0
  219. package/lib/utils/helpers/checkResource.js.flow +3 -0
  220. package/lib/utils/helpers/checkResource.js.map +1 -1
  221. package/lib/utils/helpers/objects.js.map +1 -1
  222. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  223. package/lib/utils/helpers/text.js.map +1 -1
  224. package/lib/utils/number/formatValue.js.map +1 -1
  225. package/lib/utils/number/parseNumbers.js.map +1 -1
  226. package/package.json +22 -22
  227. package/src/constants/Constants.js +1 -0
  228. package/src/constants/Settings.js +8 -3
  229. package/src/hooks/__tests__/useAuthentication.spec.js +15 -1
  230. package/src/hooks/useAuthentication.js +4 -37
  231. package/src/models/form/FormModel.js +1 -1
  232. package/src/models/list/ListModel.js +1 -1
  233. package/src/models/list/__tests__/ListModel.spec.js +13 -0
  234. package/src/models/list/__tests__/related-contributions.json +42 -0
  235. package/src/models/list/__tests__/related-data.json +32 -0
  236. package/src/modularui/Authenticate.js +75 -20
  237. package/src/react-server/__tests__/serverUtil.spec.js +6 -4
  238. package/src/redux/actions/Preferences.js +7 -3
  239. package/src/redux/actions/SignOut.js +9 -5
  240. package/src/redux/connectors/SignIn.js +1 -6
  241. package/src/redux/connectors/SignOut.js +2 -1
  242. package/src/redux/reducers/AuthReducer.js +0 -11
  243. package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
  244. package/src/redux/types.js +0 -1
  245. package/src/utils/helpers/checkResource.js +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"parseNumbers.js","names":["removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (input, groupingSeparator) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n \"\\\\$&\"\n );\n\n return input.replace(new RegExp(escapedGroupingSeparator, \"g\"), \"\");\n};\n\n/**\n * @private\n */\nconst updateDecimalSeparator = (input, decimalSeparator) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (decimalSeparator == null || decimalSeparator === \"\") {\n return input;\n }\n\n return input.replace(decimalSeparator, \".\");\n};\n\n/**\n * Parses input into a number, removes the grouping separator from the input and\n * replaces the decimal separator with a dot to make it a JavaScript parseable number\n */\nconst parseToNumber = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): number => {\n if (input == null || input === \"\") {\n return NaN;\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n return Number(inputCorrectDecimalSeparator);\n};\n\n/**\n * parses Numbers To String\n */\nconst parseNumberToString = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): string => {\n if (input == null || input === \"\") {\n return \"NaN\";\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n try {\n return big(inputCorrectDecimalSeparator).toFixed();\n } catch (error) {\n return \"NaN\";\n }\n};\n\nexport { parseToNumber, parseNumberToString };\n"],"mappings":";;;;;;;;;AACA;;AAEA;AACA;AACA;AACA,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,KAAD,EAAQC,iBAAR,EAA8B;EAC5D,IAAI,OAAOD,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOA,KAAP;EACD;;EAED,IAAIC,iBAAiB,IAAI,IAAzB,EAA+B;IAC7B,OAAOD,KAAP;EACD;;EAED,IAAME,wBAAwB,GAAGD,iBAAiB,CAACE,OAAlB,CAC/B,qBAD+B,EAE/B,MAF+B,CAAjC;EAKA,OAAOH,KAAK,CAACG,OAAN,CAAc,IAAIC,MAAJ,CAAWF,wBAAX,EAAqC,GAArC,CAAd,EAAyD,EAAzD,CAAP;AACD,CAfD;AAiBA;AACA;AACA;;;AACA,IAAMG,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACL,KAAD,EAAQM,gBAAR,EAA6B;EAC1D,IAAI,OAAON,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOA,KAAP;EACD;;EAED,IAAIM,gBAAgB,IAAI,IAApB,IAA4BA,gBAAgB,KAAK,EAArD,EAAyD;IACvD,OAAON,KAAP;EACD;;EAED,OAAOA,KAAK,CAACG,OAAN,CAAcG,gBAAd,EAAgC,GAAhC,CAAP;AACD,CAVD;AAYA;AACA;AACA;AACA;;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CACpBP,KADoB,EAIT;EAAA,IAFXC,iBAEW,uEAFkB,GAElB;EAAA,IADXK,gBACW,uEADiB,GACjB;;EACX,IAAIN,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA/B,EAAmC;IACjC,OAAOQ,GAAP;EACD;;EAED,IAAMC,eAAe,GAAGV,uBAAuB,CAACC,KAAD,EAAQC,iBAAR,CAA/C;EAEA,IAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eADyD,EAEzDH,gBAFyD,CAA3D;EAKA,OAAOK,MAAM,CAACD,4BAAD,CAAb;AACD,CAjBD;AAmBA;AACA;AACA;;;;;AACA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAC1BZ,KAD0B,EAIf;EAAA,IAFXC,iBAEW,uEAFkB,GAElB;EAAA,IADXK,gBACW,uEADiB,GACjB;;EACX,IAAIN,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA/B,EAAmC;IACjC,OAAO,KAAP;EACD;;EAED,IAAMS,eAAe,GAAGV,uBAAuB,CAACC,KAAD,EAAQC,iBAAR,CAA/C;EAEA,IAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eADyD,EAEzDH,gBAFyD,CAA3D;;EAKA,IAAI;IACF,OAAO,kBAAII,4BAAJ,EAAkCG,OAAlC,EAAP;EACD,CAFD,CAEE,OAAOC,KAAP,EAAc;IACd,OAAO,KAAP;EACD;AACF,CArBD"}
1
+ {"version":3,"file":"parseNumbers.js","names":["removeGroupingSeparator","input","groupingSeparator","escapedGroupingSeparator","replace","RegExp","updateDecimalSeparator","decimalSeparator","parseToNumber","NaN","inputNoGrouping","inputCorrectDecimalSeparator","Number","parseNumberToString","big","toFixed","error"],"sources":["../../../src/utils/number/parseNumbers.js"],"sourcesContent":["// @flow\nimport big from \"big.js\";\n\n/**\n * @private\n */\nconst removeGroupingSeparator = (input, groupingSeparator) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (groupingSeparator == null) {\n return input;\n }\n\n const escapedGroupingSeparator = groupingSeparator.replace(\n /[$()*+.?[\\\\\\]^{|}]/g,\n \"\\\\$&\"\n );\n\n return input.replace(new RegExp(escapedGroupingSeparator, \"g\"), \"\");\n};\n\n/**\n * @private\n */\nconst updateDecimalSeparator = (input, decimalSeparator) => {\n if (typeof input === \"number\") {\n return input;\n }\n\n if (decimalSeparator == null || decimalSeparator === \"\") {\n return input;\n }\n\n return input.replace(decimalSeparator, \".\");\n};\n\n/**\n * Parses input into a number, removes the grouping separator from the input and\n * replaces the decimal separator with a dot to make it a JavaScript parseable number\n */\nconst parseToNumber = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): number => {\n if (input == null || input === \"\") {\n return NaN;\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n return Number(inputCorrectDecimalSeparator);\n};\n\n/**\n * parses Numbers To String\n */\nconst parseNumberToString = (\n input: ?string | ?number,\n groupingSeparator: ?string = \",\",\n decimalSeparator: ?string = \".\"\n): string => {\n if (input == null || input === \"\") {\n return \"NaN\";\n }\n\n const inputNoGrouping = removeGroupingSeparator(input, groupingSeparator);\n\n const inputCorrectDecimalSeparator = updateDecimalSeparator(\n inputNoGrouping,\n decimalSeparator\n );\n\n try {\n return big(inputCorrectDecimalSeparator).toFixed();\n } catch (error) {\n return \"NaN\";\n }\n};\n\nexport { parseToNumber, parseNumberToString };\n"],"mappings":";;;;;;;;;AACA;;AAEA;AACA;AACA;AACA,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CAACC,KAAD,EAAQC,iBAAR,EAA8B;EAC5D,IAAI,OAAOD,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOA,KAAP;EACD;;EAED,IAAIC,iBAAiB,IAAI,IAAzB,EAA+B;IAC7B,OAAOD,KAAP;EACD;;EAED,IAAME,wBAAwB,GAAGD,iBAAiB,CAACE,OAAlB,CAC/B,qBAD+B,EAE/B,MAF+B,CAAjC;EAKA,OAAOH,KAAK,CAACG,OAAN,CAAc,IAAIC,MAAJ,CAAWF,wBAAX,EAAqC,GAArC,CAAd,EAAyD,EAAzD,CAAP;AACD,CAfD;AAiBA;AACA;AACA;;;AACA,IAAMG,sBAAsB,GAAG,SAAzBA,sBAAyB,CAACL,KAAD,EAAQM,gBAAR,EAA6B;EAC1D,IAAI,OAAON,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOA,KAAP;EACD;;EAED,IAAIM,gBAAgB,IAAI,IAApB,IAA4BA,gBAAgB,KAAK,EAArD,EAAyD;IACvD,OAAON,KAAP;EACD;;EAED,OAAOA,KAAK,CAACG,OAAN,CAAcG,gBAAd,EAAgC,GAAhC,CAAP;AACD,CAVD;AAYA;AACA;AACA;AACA;;;AACA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CACpBP,KADoB,EAIT;EAAA,IAFXC,iBAEW,uEAFkB,GAElB;EAAA,IADXK,gBACW,uEADiB,GACjB;;EACX,IAAIN,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA/B,EAAmC;IACjC,OAAOQ,GAAP;EACD;;EAED,IAAMC,eAAe,GAAGV,uBAAuB,CAACC,KAAD,EAAQC,iBAAR,CAA/C;EAEA,IAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eADyD,EAEzDH,gBAFyD,CAA3D;EAKA,OAAOK,MAAM,CAACD,4BAAD,CAAb;AACD,CAjBD;AAmBA;AACA;AACA;;;;;AACA,IAAME,mBAAmB,GAAG,SAAtBA,mBAAsB,CAC1BZ,KAD0B,EAIf;EAAA,IAFXC,iBAEW,uEAFkB,GAElB;EAAA,IADXK,gBACW,uEADiB,GACjB;;EACX,IAAIN,KAAK,IAAI,IAAT,IAAiBA,KAAK,KAAK,EAA/B,EAAmC;IACjC,OAAO,KAAP;EACD;;EAED,IAAMS,eAAe,GAAGV,uBAAuB,CAACC,KAAD,EAAQC,iBAAR,CAA/C;EAEA,IAAMS,4BAA4B,GAAGL,sBAAsB,CACzDI,eADyD,EAEzDH,gBAFyD,CAA3D;;EAKA,IAAI;IACF,OAAO,IAAAO,YAAA,EAAIH,4BAAJ,EAAkCI,OAAlC,EAAP;EACD,CAFD,CAEE,OAAOC,KAAP,EAAc;IACd,OAAO,KAAP;EACD;AACF,CArBD"}
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.18.2",
3
+ "version": "1.18.5",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
7
7
  "main": "lib/index.js",
8
8
  "module": "esm/index.js",
9
9
  "engines": {
10
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
10
+ "node": "^14.13.1 || >=16.0.0"
11
11
  },
12
12
  "esnext": "src/index.js",
13
13
  "sideEffects": false,
@@ -78,7 +78,7 @@
78
78
  "styled-components": "^5.2.0"
79
79
  },
80
80
  "dependencies": {
81
- "@babel/runtime-corejs3": "^7.17.9",
81
+ "@babel/runtime-corejs3": "^7.18.0",
82
82
  "big.js": "^6.1.1",
83
83
  "date-fns": "^2.28.0",
84
84
  "deepmerge": "^4.2.2",
@@ -96,41 +96,41 @@
96
96
  },
97
97
  "devDependencies": {
98
98
  "@babel/cli": "^7.17.10",
99
- "@babel/core": "^7.17.10",
99
+ "@babel/core": "^7.18.0",
100
100
  "@babel/eslint-parser": "^7.17.0",
101
101
  "@babel/eslint-plugin": "^7.16.5",
102
- "@babel/plugin-proposal-class-properties": "^7.16.7",
102
+ "@babel/plugin-proposal-class-properties": "^7.17.12",
103
103
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
104
- "@babel/plugin-transform-runtime": "^7.17.10",
105
- "@babel/preset-env": "^7.17.10",
106
- "@babel/preset-flow": "^7.16.7",
107
- "@babel/preset-react": "^7.16.7",
108
- "@commitlint/cli": "^16.2.4",
109
- "@commitlint/config-conventional": "^16.2.4",
104
+ "@babel/plugin-transform-runtime": "^7.18.0",
105
+ "@babel/preset-env": "^7.18.0",
106
+ "@babel/preset-flow": "^7.17.12",
107
+ "@babel/preset-react": "^7.17.12",
108
+ "@commitlint/cli": "^17.0.0",
109
+ "@commitlint/config-conventional": "^17.0.0",
110
110
  "@testing-library/react-hooks": "^8.0.0",
111
111
  "auditjs": "^4.0.37",
112
- "babel-jest": "^28.0.3",
112
+ "babel-jest": "^28.1.0",
113
113
  "babel-plugin-styled-components": "^2.0.7",
114
114
  "cherry-pick": "^0.5.0",
115
115
  "cross-env": "^7.0.3",
116
116
  "documentation": "^13.2.5",
117
- "eslint": "^8.14.0",
117
+ "eslint": "^8.15.0",
118
118
  "eslint-config-prettier": "^8.3.0",
119
119
  "eslint-plugin-babel": "^5.3.1",
120
120
  "eslint-plugin-ft-flow": "^2.0.1",
121
121
  "eslint-plugin-import": "^2.26.0",
122
- "eslint-plugin-jest": "^26.1.5",
123
- "eslint-plugin-jsdoc": "^39.2.9",
124
- "eslint-plugin-react": "^7.28.0",
122
+ "eslint-plugin-jest": "^26.2.2",
123
+ "eslint-plugin-jsdoc": "^39.3.0",
124
+ "eslint-plugin-react": "^7.30.0",
125
125
  "eslint-plugin-react-hooks": "^4.5.0",
126
- "flow-bin": "^0.176.3",
126
+ "flow-bin": "^0.178.0",
127
127
  "flow-copy-source": "^2.0.9",
128
128
  "flow-typed": "^3.6.1",
129
- "glob": "^8.0.1",
129
+ "glob": "^8.0.3",
130
130
  "history": "^4.0.0",
131
- "husky": "^7.0.4",
132
- "jest": "^28.0.3",
133
- "jest-environment-jsdom": "^28.0.2",
131
+ "husky": "^8.0.1",
132
+ "jest": "^28.1.0",
133
+ "jest-environment-jsdom": "^28.1.0",
134
134
  "jest-junit": "^13.2.0",
135
135
  "jest-sonar-reporter": "^2.0.0",
136
136
  "jscodeshift": "^0.13.1",
@@ -147,7 +147,7 @@
147
147
  "redux-mock-store": "^1.5.4",
148
148
  "redux-thunk": "^2.4.1",
149
149
  "rimraf": "^3.0.2",
150
- "standard-version": "^9.3.2",
150
+ "standard-version": "^9.5.0",
151
151
  "styled-components": "^5.3.5",
152
152
  "xhr-mock": "^2.5.1"
153
153
  },
@@ -198,6 +198,7 @@ export const ATTRIBUTE_WIDTH = {
198
198
 
199
199
  export const ALL_CONTENT_IN_DATA_SETTING = "hasAllContentInData";
200
200
 
201
+ export const LOGIN_TYPE = "security.clients";
201
202
  export const LOGIN_PATH_SETTING = "FormClient.login_url";
202
203
  export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
203
204
  export const LOGIN_PASSWORD_SETTING = "FormClient.password_field_name";
@@ -1,8 +1,8 @@
1
1
  // @flow
2
2
  import { isPlainObject, has } from "../utils/helpers/objects";
3
3
  import {
4
- BASE,
5
4
  ALL_CONTENT_IN_DATA_SETTING,
5
+ LOGIN_TYPE,
6
6
  LOGIN_PATH_SETTING,
7
7
  LOGIN_USERNAME_SETTING,
8
8
  LOGIN_PASSWORD_SETTING,
@@ -123,10 +123,15 @@ export const allSettings = (): { [name: string]: Setting } => settings;
123
123
  export const hasAllContentInData = (): boolean =>
124
124
  getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
125
125
 
126
+ /**
127
+ * Login type, only available when pac4j is configured
128
+ */
129
+ export const loginType = (): string => getSetting(LOGIN_TYPE, "JAAS");
130
+
126
131
  /**
127
132
  */
128
133
  export const loginPath = (): string =>
129
- getSetting(LOGIN_PATH_SETTING, `${BASE}/j_security_check`);
134
+ getSetting(LOGIN_PATH_SETTING, "/j_security_check");
130
135
  /**
131
136
  */
132
137
  export const loginUsernameField = (): string =>
@@ -138,4 +143,4 @@ export const loginPasswordField = (): string =>
138
143
  /**
139
144
  */
140
145
  export const logoutPath = (): string =>
141
- getSetting(LOGOUT_PATH_SETTING, `${BASE}/Logoff`);
146
+ getSetting(LOGOUT_PATH_SETTING, "/Logoff");
@@ -88,7 +88,8 @@ describe("authentication hooks", () => {
88
88
  return res.status(200).body({ data: "ok" });
89
89
  });
90
90
 
91
- const store = mockStore({ auth: {} });
91
+ const store = mockStore({ auth: {}, i18n: { locale: "en" } });
92
+
92
93
  /**
93
94
  */
94
95
  const wrapper = ({ children }) => (
@@ -107,6 +108,19 @@ describe("authentication hooks", () => {
107
108
  expect(store.getActions()).toStrictEqual([
108
109
  { type: "START_PROGRESS" },
109
110
  { type: "MODULARUI/RESET" },
111
+ {
112
+ type: "MODULARUI/STATUS",
113
+ payload: { key: "application(/)(en)", status: "LOADING" },
114
+ },
115
+ { type: "START_PROGRESS" },
116
+ expect.objectContaining({
117
+ type: "MODULARUI/FETCH",
118
+ payload: expect.objectContaining({
119
+ href: new Href("/", "Application"),
120
+ }),
121
+ }),
122
+ { type: "FINISH_PROGRESS" },
123
+
110
124
  { type: "AUTHENTICATION_LOGOUT" },
111
125
  { type: "FINISH_PROGRESS" },
112
126
  ]);
@@ -1,9 +1,8 @@
1
1
  // @flow
2
2
  import { useSelector, useDispatch } from "react-redux";
3
+
3
4
  import { getApplication } from "../redux/_modularui/selectors";
4
5
  import { login, logout, resetAuthErrors } from "../redux/actions";
5
- import UserServicesModel from "../models/user/UserServicesModel";
6
- import { useState, useEffect } from "react";
7
6
 
8
7
  import type { ResetAuthErrorsAction } from "../redux/types";
9
8
  type LoginHook = {
@@ -17,19 +16,6 @@ type LogoutHook = {
17
16
  logout: () => void,
18
17
  };
19
18
 
20
- const getIsAuthenticated = (isAuthenticated, application) => {
21
- if (!application) {
22
- return false;
23
- }
24
-
25
- const userServicesModel = application.userServices;
26
- if (userServicesModel instanceof UserServicesModel) {
27
- return isAuthenticated && userServicesModel.isLoggedIn;
28
- }
29
-
30
- return false;
31
- };
32
-
33
19
  /**
34
20
  */
35
21
  export const useLogin = (): LoginHook => {
@@ -39,7 +25,7 @@ export const useLogin = (): LoginHook => {
39
25
  const auth = useSelector((state) => state.auth);
40
26
 
41
27
  return {
42
- isAuthenticated: getIsAuthenticated(auth.isAuthenticated, application),
28
+ isAuthenticated: application?.isLoggedIn ?? false,
43
29
  errorMessage: auth.error,
44
30
  resetErrors: () => dispatch(resetAuthErrors()),
45
31
  login: (username: string, password: string) =>
@@ -52,28 +38,9 @@ export const useLogin = (): LoginHook => {
52
38
  export const useLogout = (): LogoutHook => {
53
39
  const dispatch = useDispatch();
54
40
  const application = useSelector(getApplication);
55
- const auth = useSelector((state) => state.auth?.isAuthenticated || false);
56
-
57
- const [cancel, setCancel] = useState(false);
58
- const [isAuthenticated, setIsAuthenticated] = useState(() =>
59
- getIsAuthenticated(auth, application)
60
- );
61
-
62
- // set cancel to true when the component this hook is used on, has been unmounted
63
- // prevents state changes after unmount
64
- useEffect(() => {
65
- return () => {
66
- setCancel(true);
67
- };
68
- }, []);
69
41
 
70
42
  return {
71
- isAuthenticated,
72
- logout: () =>
73
- dispatch(logout()).then(() => {
74
- if (!cancel) {
75
- setIsAuthenticated(false);
76
- }
77
- }),
43
+ isAuthenticated: application?.isLoggedIn ?? false,
44
+ logout: () => dispatch(logout()),
78
45
  };
79
46
  };
@@ -472,7 +472,7 @@ class FormModel extends ResourceModel {
472
472
  }
473
473
  }
474
474
 
475
- return this.currentFormObject.isValid;
475
+ return this.currentFormObject?.isValid ?? true;
476
476
  }
477
477
 
478
478
  return true;
@@ -48,7 +48,7 @@ export default class ListModel extends ResourceModel {
48
48
  data.contributions.resourcetype &&
49
49
  (data.contributions.resourcetype.endsWith("List") ||
50
50
  data.contributions.resourcetype.endsWith("ListPanel") ||
51
- data.contributions.resourcetype.endsWith("RelatedDatastorePanel") ||
51
+ data.contributions.resourcetype.endsWith("RelatedDataStorePanel") ||
52
52
  [
53
53
  "list-related-cases",
54
54
  "RecordPanel",
@@ -7,6 +7,10 @@ import ListModel from "../ListModel";
7
7
  import mockList from "./list.json";
8
8
  import mockListContributions from "./listContributions.json";
9
9
 
10
+ import testData from "./related-data.json";
11
+ import testContributions from "./related-contributions.json";
12
+ import ModularUIResponse from "../../../modularui/ModularUIResponse";
13
+
10
14
  describe("listModel spec", () => {
11
15
  it("should be able to create an empty list", () => {
12
16
  const list = new ListModel();
@@ -120,4 +124,13 @@ describe("listModel spec", () => {
120
124
  "<p>This is introtext</p>"
121
125
  );
122
126
  });
127
+
128
+ it("list model is applicable for contributions with resourcetype RecordRelatedDataStorePanel", () => {
129
+ const data = ModularUIResponse.create({
130
+ key: "Bewijsstukken",
131
+ data: testData,
132
+ contributions: testContributions,
133
+ });
134
+ expect(ListModel.isApplicableModel(data)).toBe(true);
135
+ });
123
136
  });
@@ -0,0 +1,42 @@
1
+ {
2
+ "Bewijsstukken": {
3
+ "label": "Bewijsstukken",
4
+ "resourcetype": "RecordRelatedDataStorePanel",
5
+ "paging": {
6
+ "pagesize": {
7
+ "options": [10, 25, 50]
8
+ }
9
+ },
10
+ "sorting": {
11
+ "attributes": ["CreationDate", "FileName"]
12
+ },
13
+ "results": {
14
+ "Bewijsstukken": {
15
+ "metadata": {
16
+ "_id": {
17
+ "type": "number"
18
+ }
19
+ },
20
+ "attributes": [
21
+ {
22
+ "FileName": {
23
+ "type": "string",
24
+ "label": "FileName",
25
+ "layouthint": ["download=CmfDocumentRecordId"],
26
+ "displaysize": 50,
27
+ "maxLength": 255
28
+ }
29
+ },
30
+ {
31
+ "CreationDate": {
32
+ "type": "date",
33
+ "label": "CreationDate",
34
+ "formatlabel": "dd-mm-jjjj",
35
+ "format": "dd-MM-yyyy"
36
+ }
37
+ }
38
+ ]
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "Bewijsstukken": {
3
+ "_links": {
4
+ "self": {
5
+ "href": "/mijn-account/gebruiker/981/overige-wijzigingshistorie/ta-wijzigings-historie/6341/bewijsstukken"
6
+ },
7
+ "api_doc": {
8
+ "href": "/api-docs/v3/mijn-account/gebruiker/(case-id)/overige-wijzigingshistorie/ta-wijzigings-historie/(ta-wijzigings-historie-record-id)/bewijsstukken"
9
+ },
10
+ "contributions": {
11
+ "href": "/contributions/mijn-account/gebruiker/(case-id)/overige-wijzigingshistorie/ta-wijzigings-historie/(ta-wijzigings-historie-record-id)/bewijsstukken"
12
+ }
13
+ },
14
+ "paging": { "totalresults": 1, "pagesize": 25, "page": 1, "maxpages": 1 },
15
+ "_embedded": {
16
+ "results": [
17
+ {
18
+ "Bewijsstukken": {
19
+ "_id": 181,
20
+ "_links": {
21
+ "self": {
22
+ "href": "/mijn-account/gebruiker/981/overige-wijzigingshistorie/ta-wijzigings-historie/6341/bewijsstukken/181"
23
+ }
24
+ },
25
+ "FileName": "dummy.pdf",
26
+ "CreationDate": "2022-04-22"
27
+ }
28
+ }
29
+ ]
30
+ }
31
+ }
32
+ }
@@ -5,10 +5,10 @@ import universalFetch from "../utils/fetch/universalFetch";
5
5
  import Cache from "../utils/browser/Cache";
6
6
 
7
7
  import { UnauthorizedException } from "../exceptions";
8
- import type { RequestOptions } from "../utils/fetch/types";
9
8
  import {
10
- loginPasswordField,
9
+ loginType,
11
10
  loginPath,
11
+ loginPasswordField,
12
12
  loginUsernameField,
13
13
  logoutPath,
14
14
  } from "../constants";
@@ -24,10 +24,27 @@ class Authenticate {
24
24
  this._isBasic = false;
25
25
  }
26
26
 
27
+ /**
28
+ */
29
+ get authenticationType(): "JAAS" | "PAC4J_FORM" | "PAC4J_BASIC" {
30
+ const type = loginType();
31
+
32
+ if (!type || type === "JAAS") {
33
+ return "JAAS";
34
+ }
35
+ if (type.includes("FormClient")) {
36
+ return "PAC4J_FORM";
37
+ } else if (type.includes("BasicClient")) {
38
+ return "PAC4J_BASIC";
39
+ }
40
+
41
+ throw new Error(`Unsupported login type found: ${type}`);
42
+ }
43
+
27
44
  /**
28
45
  */
29
46
  get isBasicAuthentication(): boolean {
30
- return this._isBasic;
47
+ return this._isBasic || this.authenticationType === "PAC4J_BASIC";
31
48
  }
32
49
 
33
50
  /**
@@ -64,47 +81,85 @@ class Authenticate {
64
81
 
65
82
  /**
66
83
  */
67
- createLogin(username: string, password: string): $Shape<RequestOptions> {
68
- const LOGIN_PATH = loginPath();
69
- const usernameField = loginUsernameField();
70
- const passwordField = loginPasswordField();
84
+ login(username: string, password: string): Promise<any> {
85
+ switch (this.authenticationType) {
86
+ case "PAC4J_FORM":
87
+ return this.doFormLogin(username, password);
88
+ case "PAC4J_BASIC":
89
+ return this.doBasicAuthentication(username, password);
90
+ default:
91
+ return this.doJaasAuthentication(username, password);
92
+ }
93
+ }
94
+
95
+ /**
96
+ */
97
+ getFormLoginUrl(): string {
98
+ switch (this.authenticationType) {
99
+ case "PAC4J_BASIC":
100
+ case "PAC4J_FORM":
101
+ return `${BASE}${loginPath()}`;
102
+ default:
103
+ return `${BASE}/j_security_check`;
104
+ }
105
+ }
71
106
 
107
+ /**
108
+ */
109
+ getFormLoginData(username: string, password: string): string {
72
110
  const encodedUsername = encodeURIComponent(username);
73
111
  const encodedPassword = encodeURIComponent(password);
74
112
 
75
- return {
76
- url: LOGIN_PATH,
113
+ switch (this.authenticationType) {
114
+ case "PAC4J_BASIC":
115
+ case "PAC4J_FORM":
116
+ return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;
117
+ default:
118
+ return `j_username=${encodedUsername}&j_password=${encodedPassword}`;
119
+ }
120
+ }
121
+
122
+ /**
123
+ */
124
+ doFormLogin(username: string, password: string): Promise<any> {
125
+ return universalFetch({
126
+ url: this.getFormLoginUrl(),
77
127
  method: HTTP_METHODS.POST,
78
128
  headers: {
79
129
  Accept: "application/json",
80
130
  "Content-Type": "application/x-www-form-urlencoded",
81
131
  },
82
- data: `${usernameField}=${encodedUsername}&${passwordField}=${encodedPassword}`,
83
- };
132
+ data: this.getFormLoginData(username, password),
133
+ });
84
134
  }
85
135
 
86
136
  /**
87
137
  */
88
- login(username: string, password: string): Promise<any> {
138
+ doBasicAuthentication(username: string, password: string): Promise<any> {
139
+ Cache.addItem("basic", btoa(`${username}:${password}`));
140
+ return Promise.resolve();
141
+ }
142
+
143
+ /**
144
+ */
145
+ doJaasAuthentication(username: string, password: string): Promise<any> {
89
146
  return this.initLogin(true).then(() => {
90
147
  if (this.isBasicAuthentication) {
91
- Cache.addItem("basic", btoa(`${username}:${password}`));
92
-
93
- return Promise.resolve();
148
+ return this.doBasicAuthentication(username, password);
94
149
  }
95
-
96
- return universalFetch(this.createLogin(username, password));
150
+ return this.doFormLogin(username, password);
97
151
  });
98
152
  }
99
153
 
100
154
  /**
101
155
  */
102
- logout(): Promise<void> {
156
+ logout(): Promise<any> {
103
157
  return universalFetch({
104
- url: logoutPath(),
105
- }).then(() => {
158
+ url: `${BASE}${logoutPath()}`,
159
+ }).then((response) => {
106
160
  // clear cache because of cached contributions
107
161
  Cache.clear();
162
+ return response;
108
163
  });
109
164
  }
110
165
  }
@@ -112,10 +112,11 @@ describe("serverUtil", () => {
112
112
  {
113
113
  type: "SET_PREFERENCES",
114
114
  payload: {
115
- "FormClient.login_url": "/BeInformed/j_security_check",
116
- "FormClient.logout_url": "/BeInformed/Logoff",
115
+ "FormClient.login_url": "/j_security_check",
116
+ "FormClient.logout_url": "/Logoff",
117
117
  "FormClient.password_field_name": "j_password",
118
118
  "FormClient.username_field_name": "j_username",
119
+ "security.clients": null,
119
120
  },
120
121
  },
121
122
  ]);
@@ -158,10 +159,11 @@ describe("serverUtil", () => {
158
159
  {
159
160
  type: "SET_PREFERENCES",
160
161
  payload: {
161
- "FormClient.login_url": "/BeInformed/j_security_check",
162
- "FormClient.logout_url": "/BeInformed/Logoff",
162
+ "FormClient.login_url": "/j_security_check",
163
+ "FormClient.logout_url": "/Logoff",
163
164
  "FormClient.password_field_name": "j_password",
164
165
  "FormClient.username_field_name": "j_username",
166
+ "security.clients": null,
165
167
  },
166
168
  },
167
169
  ]);
@@ -12,8 +12,8 @@ import type {
12
12
  } from "../types";
13
13
 
14
14
  import {
15
- BASE,
16
15
  ALL_CONTENT_IN_DATA_SETTING,
16
+ LOGIN_TYPE,
17
17
  LOGIN_PASSWORD_SETTING,
18
18
  LOGIN_PATH_SETTING,
19
19
  LOGIN_USERNAME_SETTING,
@@ -123,9 +123,13 @@ export const setLoginPreferences = (
123
123
  state?: ReduxState
124
124
  ): SetPreferencesAction => {
125
125
  const loginSettings = {
126
+ [LOGIN_TYPE]: getServerPreferenceValue(
127
+ LOGIN_TYPE,
128
+ state?.preferences[LOGIN_TYPE]
129
+ ),
126
130
  [LOGIN_PATH_SETTING]: getServerPreferenceValue(
127
131
  LOGIN_PATH_SETTING,
128
- state?.preferences[LOGIN_PATH_SETTING] ?? `${BASE}/j_security_check`
132
+ state?.preferences[LOGIN_PATH_SETTING] ?? `/j_security_check`
129
133
  ),
130
134
  [LOGIN_USERNAME_SETTING]: getServerPreferenceValue(
131
135
  LOGIN_USERNAME_SETTING,
@@ -137,7 +141,7 @@ export const setLoginPreferences = (
137
141
  ),
138
142
  [LOGOUT_PATH_SETTING]: getServerPreferenceValue(
139
143
  LOGOUT_PATH_SETTING,
140
- state?.preferences[LOGOUT_PATH_SETTING] ?? `${BASE}/Logoff`
144
+ state?.preferences[LOGOUT_PATH_SETTING] ?? `/Logoff`
141
145
  ),
142
146
  };
143
147
 
@@ -4,6 +4,7 @@ import { startProgress, finishProgress } from "./ProgressIndicator";
4
4
  import { resetModularUI } from "../_modularui/actions";
5
5
 
6
6
  import type { Dispatch, LogoutSuccessAction, ThunkAction } from "../types";
7
+ import { reloadApplication } from "./Application";
7
8
 
8
9
  /**
9
10
  * Send logout success action
@@ -17,9 +18,12 @@ export const logoutSuccess = (): LogoutSuccessAction => ({
17
18
  export const logout = (): ThunkAction => (dispatch: Dispatch) => {
18
19
  dispatch(startProgress());
19
20
 
20
- return new Authenticate().logout().then(() => {
21
- dispatch(resetModularUI());
22
- dispatch(logoutSuccess());
23
- return dispatch(finishProgress());
24
- });
21
+ return new Authenticate()
22
+ .logout()
23
+ .then(() => dispatch(resetModularUI()))
24
+ .then(() => dispatch(reloadApplication()))
25
+ .then(() => {
26
+ dispatch(logoutSuccess());
27
+ return dispatch(finishProgress());
28
+ });
25
29
  };
@@ -5,8 +5,6 @@ import { login } from "../actions/SignIn";
5
5
 
6
6
  import { getApplication } from "../_modularui/selectors";
7
7
 
8
- import UserServicesModel from "../../models/user/UserServicesModel";
9
-
10
8
  import type { ReduxState, ThunkAction } from "../types";
11
9
  import type { ComponentType } from "react";
12
10
 
@@ -28,10 +26,7 @@ const mapStateToProps = (state: ReduxState): StateProps => {
28
26
  const application = getApplication(state);
29
27
 
30
28
  return {
31
- isAuthenticated:
32
- state.auth.isAuthenticated &&
33
- application?.userServices instanceof UserServicesModel &&
34
- application.userServices.isLoggedIn,
29
+ isAuthenticated: application?.isLoggedIn ?? false,
35
30
  errorMessage: state.auth.error,
36
31
  };
37
32
  };
@@ -5,6 +5,7 @@ import { logout } from "../actions/SignOut";
5
5
 
6
6
  import type { ThunkAction } from "../types";
7
7
  import type { ComponentType } from "react";
8
+ import { getApplication } from "../_modularui";
8
9
 
9
10
  type StateProps = {
10
11
  isAuthenticated: boolean,
@@ -20,7 +21,7 @@ type Props = {
20
21
  };
21
22
 
22
23
  const mapStateToProps = (state): StateProps => ({
23
- isAuthenticated: state.auth.isAuthenticated,
24
+ isAuthenticated: getApplication(state)?.isLoggedIn ?? false,
24
25
  });
25
26
 
26
27
  const mapDispatchToProps = { doLogout: logout };