@beinformed/ui 1.18.4 → 1.18.7-beta.0

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 (234) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/esm/hooks/useAuthentication.js +7 -50
  3. package/esm/hooks/useAuthentication.js.map +1 -1
  4. package/esm/i18n/Locales.js.map +1 -1
  5. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  6. package/esm/models/form/FormModel.js.map +1 -1
  7. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  8. package/esm/models/tab/TabModel.js.map +1 -1
  9. package/esm/modularui/Authenticate.js +2 -1
  10. package/esm/modularui/Authenticate.js.map +1 -1
  11. package/esm/redux/actions/SignOut.js +6 -2
  12. package/esm/redux/actions/SignOut.js.map +1 -1
  13. package/esm/redux/connectors/SignIn.js +3 -2
  14. package/esm/redux/connectors/SignIn.js.map +1 -1
  15. package/esm/redux/connectors/SignOut.js +4 -1
  16. package/esm/redux/connectors/SignOut.js.map +1 -1
  17. package/esm/redux/reducers/AuthReducer.js +0 -10
  18. package/esm/redux/reducers/AuthReducer.js.map +1 -1
  19. package/esm/redux/types.js.map +1 -1
  20. package/esm/utils/helpers/checkResource.js +2 -0
  21. package/esm/utils/helpers/checkResource.js.map +1 -1
  22. package/lib/constants/LayoutHints.js.map +1 -1
  23. package/lib/constants/Settings.js.map +1 -1
  24. package/lib/exceptions/FetchException.js.map +1 -1
  25. package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
  26. package/lib/hooks/__tests__/useAuthentication.spec.js.flow +16 -2
  27. package/lib/hooks/__tests__/useForm.spec.js.flow +1 -1
  28. package/lib/hooks/__tests__/useModal.spec.js.flow +1 -1
  29. package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
  30. package/lib/hooks/__tests__/useModels.spec.js.flow +1 -1
  31. package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +1 -18
  32. package/lib/hooks/__tests__/useNotification.spec.js.flow +1 -1
  33. package/lib/hooks/__tests__/usePreference.spec.js.flow +1 -1
  34. package/lib/hooks/__tests__/useProgressIndicator.spec.js.flow +1 -1
  35. package/lib/hooks/useAllFormsOnModel.js.map +1 -1
  36. package/lib/hooks/useAuthentication.js +7 -55
  37. package/lib/hooks/useAuthentication.js.flow +4 -37
  38. package/lib/hooks/useAuthentication.js.map +1 -1
  39. package/lib/hooks/useContent.js.map +1 -1
  40. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  41. package/lib/hooks/useForm.js.map +1 -1
  42. package/lib/hooks/useI18n.js.map +1 -1
  43. package/lib/hooks/useModal.js.map +1 -1
  44. package/lib/hooks/useModelCatalog.js.map +1 -1
  45. package/lib/hooks/useModels.js.map +1 -1
  46. package/lib/hooks/useModularUI.js.map +1 -1
  47. package/lib/hooks/useModularUIBasic.js.map +1 -1
  48. package/lib/hooks/useModularUIModel.js.map +1 -1
  49. package/lib/hooks/useModularUIRequest.js.map +1 -1
  50. package/lib/hooks/useNotification.js.map +1 -1
  51. package/lib/hooks/usePreference.js.map +1 -1
  52. package/lib/hooks/useProgressIndicator.js.map +1 -1
  53. package/lib/hooks/useRouter.js.map +1 -1
  54. package/lib/i18n/Locale.js.map +1 -1
  55. package/lib/i18n/Locales.js.map +1 -1
  56. package/lib/i18n/Message.js.map +1 -1
  57. package/lib/i18n/withMessage.js.map +1 -1
  58. package/lib/models/actions/ActionModel.js.map +1 -1
  59. package/lib/models/application/ApplicationModel.js.map +1 -1
  60. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  61. package/lib/models/attributes/AttributeContent.js.map +1 -1
  62. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  63. package/lib/models/attributes/AttributeModel.js.map +1 -1
  64. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  65. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  66. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  67. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  68. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  69. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  70. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  71. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  72. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  73. package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
  74. package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
  75. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  76. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  77. package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
  78. package/lib/models/attributes/_createAttribute.js.map +1 -1
  79. package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  80. package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  81. package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
  82. package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
  83. package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
  84. package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
  85. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  86. package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
  87. package/lib/models/base/BaseCollection.js.map +1 -1
  88. package/lib/models/base/BaseModel.js.map +1 -1
  89. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  90. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  91. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  92. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  93. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  94. package/lib/models/content/ContentLinkModel.js.map +1 -1
  95. package/lib/models/content/ContentTOCModel.js.map +1 -1
  96. package/lib/models/content/SectionModel.js.map +1 -1
  97. package/lib/models/content/SubSectionModel.js.map +1 -1
  98. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  99. package/lib/models/detail/DetailModel.js.map +1 -1
  100. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  101. package/lib/models/form/FormModel.js.map +1 -1
  102. package/lib/models/form/FormObjectModel.js.map +1 -1
  103. package/lib/models/href/Href.js.map +1 -1
  104. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  105. package/lib/models/links/LinkCollection.js.map +1 -1
  106. package/lib/models/links/LinkModel.js.map +1 -1
  107. package/lib/models/list/ListDetailModel.js.map +1 -1
  108. package/lib/models/list/ListHeaderModel.js.map +1 -1
  109. package/lib/models/list/ListItemCollection.js.map +1 -1
  110. package/lib/models/list/ListModel.js.map +1 -1
  111. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  112. package/lib/models/paging/PagingModel.js.map +1 -1
  113. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  114. package/lib/models/parameter/Parameter.js.map +1 -1
  115. package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
  116. package/lib/models/resolveModel.js.map +1 -1
  117. package/lib/models/sorting/SortingModel.js.map +1 -1
  118. package/lib/models/tab/TabModel.js.map +1 -1
  119. package/lib/models/user/UserProfileModel.js.map +1 -1
  120. package/lib/models/user/UserServicesModel.js.map +1 -1
  121. package/lib/modularui/Authenticate.js +3 -1
  122. package/lib/modularui/Authenticate.js.flow +3 -2
  123. package/lib/modularui/Authenticate.js.map +1 -1
  124. package/lib/modularui/ModularUIRequest.js.map +1 -1
  125. package/lib/modularui/ModularUIResponse.js.map +1 -1
  126. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  127. package/lib/react-client/client.js.map +1 -1
  128. package/lib/react-client/rehydrate.js.map +1 -1
  129. package/lib/react-server/createSSRComplete.js.map +1 -1
  130. package/lib/react-server/renderSSRComplete.js.map +1 -1
  131. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  132. package/lib/react-server/serverNoSSR.js.map +1 -1
  133. package/lib/react-server/serverSSR.js.map +1 -1
  134. package/lib/react-server/serverUtil.js.map +1 -1
  135. package/lib/react-theme/ThemeProvider.js.map +1 -1
  136. package/lib/react-theme/createTheme.js.map +1 -1
  137. package/lib/react-theme/useTheme.js.map +1 -1
  138. package/lib/react-theme/utils/background.js.map +1 -1
  139. package/lib/react-theme/utils/colors.js.map +1 -1
  140. package/lib/react-theme/utils/contrast.js.map +1 -1
  141. package/lib/react-theme/utils/corners.js.map +1 -1
  142. package/lib/react-theme/utils/spacers.js.map +1 -1
  143. package/lib/react-theme/utils/themeProps.js.map +1 -1
  144. package/lib/redux/_i18n/actions.js.map +1 -1
  145. package/lib/redux/_i18n/reducer.js.map +1 -1
  146. package/lib/redux/_modularui/actions.js.map +1 -1
  147. package/lib/redux/_modularui/connector.js.map +1 -1
  148. package/lib/redux/_modularui/middleware.js.map +1 -1
  149. package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
  150. package/lib/redux/_modularui/reducer.js.map +1 -1
  151. package/lib/redux/_modularui/selectors.js.map +1 -1
  152. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  153. package/lib/redux/_router/__tests__/hooks.spec.js.flow +1 -1
  154. package/lib/redux/_router/connectors.js.map +1 -1
  155. package/lib/redux/actions/Application.js.map +1 -1
  156. package/lib/redux/actions/Authorization.js.map +1 -1
  157. package/lib/redux/actions/Error.js.map +1 -1
  158. package/lib/redux/actions/Form.js.map +1 -1
  159. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  160. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  161. package/lib/redux/actions/FormAutosave.js.map +1 -1
  162. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  163. package/lib/redux/actions/FormValidations.js.map +1 -1
  164. package/lib/redux/actions/Notification.js.map +1 -1
  165. package/lib/redux/actions/Preferences.js.map +1 -1
  166. package/lib/redux/actions/SignIn.js.map +1 -1
  167. package/lib/redux/actions/SignOut.js +6 -1
  168. package/lib/redux/actions/SignOut.js.flow +9 -5
  169. package/lib/redux/actions/SignOut.js.map +1 -1
  170. package/lib/redux/connectors/Application.js.map +1 -1
  171. package/lib/redux/connectors/Breadcrumb.js.map +1 -1
  172. package/lib/redux/connectors/CaseView.js.map +1 -1
  173. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  174. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  175. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  176. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  177. package/lib/redux/connectors/Form.js.map +1 -1
  178. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  179. package/lib/redux/connectors/ListDetail.js.map +1 -1
  180. package/lib/redux/connectors/Modal.js.map +1 -1
  181. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  182. package/lib/redux/connectors/Notification.js.map +1 -1
  183. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  184. package/lib/redux/connectors/Preferences.js.map +1 -1
  185. package/lib/redux/connectors/Progress.js.map +1 -1
  186. package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
  187. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  188. package/lib/redux/connectors/SignIn.js +3 -5
  189. package/lib/redux/connectors/SignIn.js.flow +1 -6
  190. package/lib/redux/connectors/SignIn.js.map +1 -1
  191. package/lib/redux/connectors/SignOut.js +5 -1
  192. package/lib/redux/connectors/SignOut.js.flow +2 -1
  193. package/lib/redux/connectors/SignOut.js.map +1 -1
  194. package/lib/redux/connectors/Tab.js.map +1 -1
  195. package/lib/redux/reducers/AuthReducer.js +0 -11
  196. package/lib/redux/reducers/AuthReducer.js.flow +0 -11
  197. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  198. package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
  199. package/lib/redux/store/configureStore.js.map +1 -1
  200. package/lib/redux/types.js.flow +0 -1
  201. package/lib/redux/types.js.map +1 -1
  202. package/lib/utils/browser/Cookies.js.map +1 -1
  203. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  204. package/lib/utils/fetch/universalFetch.js.map +1 -1
  205. package/lib/utils/fetch/xhr.js.map +1 -1
  206. package/lib/utils/helpers/checkResource.js +2 -0
  207. package/lib/utils/helpers/checkResource.js.flow +3 -0
  208. package/lib/utils/helpers/checkResource.js.map +1 -1
  209. package/lib/utils/helpers/objects.js.map +1 -1
  210. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  211. package/lib/utils/helpers/text.js.map +1 -1
  212. package/lib/utils/number/formatValue.js.map +1 -1
  213. package/lib/utils/number/parseNumbers.js.map +1 -1
  214. package/package.json +27 -27
  215. package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
  216. package/src/hooks/__tests__/useAuthentication.spec.js +16 -2
  217. package/src/hooks/__tests__/useForm.spec.js +1 -1
  218. package/src/hooks/__tests__/useModal.spec.js +1 -1
  219. package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
  220. package/src/hooks/__tests__/useModels.spec.js +1 -1
  221. package/src/hooks/__tests__/useModularUIBasic.spec.js +1 -18
  222. package/src/hooks/__tests__/useNotification.spec.js +1 -1
  223. package/src/hooks/__tests__/usePreference.spec.js +1 -1
  224. package/src/hooks/__tests__/useProgressIndicator.spec.js +1 -1
  225. package/src/hooks/useAuthentication.js +4 -37
  226. package/src/modularui/Authenticate.js +3 -2
  227. package/src/redux/_router/__tests__/hooks.spec.js +1 -1
  228. package/src/redux/actions/SignOut.js +9 -5
  229. package/src/redux/connectors/SignIn.js +1 -6
  230. package/src/redux/connectors/SignOut.js +2 -1
  231. package/src/redux/reducers/AuthReducer.js +0 -11
  232. package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
  233. package/src/redux/types.js +0 -1
  234. 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.4",
3
+ "version": "1.18.7-beta.0",
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,
@@ -68,17 +68,17 @@
68
68
  "peerDependencies": {
69
69
  "history": "^4.0.0",
70
70
  "polished": "^4.0.0",
71
- "react": "^16.14.0 || ^17.0.0",
72
- "react-dom": "^16.14.0 || ^17.0.0",
71
+ "react": "^16.14.0 || ^17.0.0 || ^18.0.0",
72
+ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0",
73
73
  "react-helmet-async": "^1.0.0",
74
- "react-redux": "^7.0.0",
74
+ "react-redux": "^7.0.0 || ^8.0.0",
75
75
  "react-router": "^5.2.0",
76
76
  "redux": "^4.0.0",
77
77
  "redux-thunk": "^2.3.0",
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,39 +96,39 @@
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",
110
- "@testing-library/react-hooks": "^8.0.0",
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
+ "@testing-library/react": "^13.2.0",
111
111
  "auditjs": "^4.0.37",
112
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.15.0",
117
+ "eslint": "^8.16.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.178.0",
126
+ "flow-bin": "^0.178.1",
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",
131
+ "husky": "^8.0.1",
132
132
  "jest": "^28.1.0",
133
133
  "jest-environment-jsdom": "^28.1.0",
134
134
  "jest-junit": "^13.2.0",
@@ -137,17 +137,17 @@
137
137
  "lint-staged": "^12.4.1",
138
138
  "polished": "^4.2.2",
139
139
  "prettier": "^2.6.2",
140
- "react": "^17.0.2",
141
- "react-dom": "^17.0.2",
140
+ "react": "^18.1.0",
141
+ "react-dom": "^18.1.0",
142
142
  "react-helmet-async": "^1.3.0",
143
- "react-redux": "^7.2.8",
143
+ "react-redux": "^8.0.2",
144
144
  "react-router": "^5.2.0",
145
- "react-test-renderer": "^17.0.2",
145
+ "react-test-renderer": "^18.1.0",
146
146
  "redux": "^4.2.0",
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
  },
@@ -1,7 +1,7 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import thunk from "redux-thunk";
3
3
  import { Provider } from "react-redux";
4
- import { renderHook } from "@testing-library/react-hooks";
4
+ import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
7
  import {
@@ -1,7 +1,7 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import thunk from "redux-thunk";
3
3
  import { Provider } from "react-redux";
4
- import { renderHook } from "@testing-library/react-hooks";
4
+ import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
7
  import { useLogin, useLogout } from "../useAuthentication";
@@ -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,7 +1,7 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import thunk from "redux-thunk";
3
3
  import { Provider } from "react-redux";
4
- import { renderHook } from "@testing-library/react-hooks";
4
+ import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
7
  import {
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
 
5
5
  import { useModal } from "../useModal";
6
6
  import { IllegalArgumentException } from "../../exceptions";
@@ -1,7 +1,7 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import thunk from "redux-thunk";
3
3
  import { Provider } from "react-redux";
4
- import { renderHook } from "@testing-library/react-hooks";
4
+ import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
7
  import {
@@ -1,5 +1,5 @@
1
1
  import { useModels } from "../useModels";
2
- import { renderHook } from "@testing-library/react-hooks";
2
+ import { renderHook } from "@testing-library/react";
3
3
  import { Provider } from "react-redux";
4
4
  import configureMockStore from "redux-mock-store";
5
5
 
@@ -1,12 +1,11 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import thunk from "redux-thunk";
3
3
  import { Provider } from "react-redux";
4
- import { renderHook } from "@testing-library/react-hooks";
4
+ import { renderHook } from "@testing-library/react";
5
5
  import xhrMock from "xhr-mock";
6
6
 
7
7
  import { useModularUIBasic } from "../useModularUIBasic";
8
8
  import { ApplicationModel, Href } from "../../models";
9
- import { IllegalArgumentException } from "../../exceptions";
10
9
 
11
10
  const middlewares = [thunk];
12
11
  const mockStore = configureMockStore(middlewares);
@@ -74,22 +73,6 @@ describe("modularui hooks", () => {
74
73
  ]);
75
74
  });
76
75
 
77
- it("missing href", () => {
78
- const store = mockStore({
79
- modularui: {},
80
- router: { location: { pathname: "/", state: { reload: true } } },
81
- i18n: { locale: "en" },
82
- });
83
- /**
84
- */
85
- const wrapper = ({ children }) => (
86
- <Provider store={store}>{children}</Provider>
87
- );
88
-
89
- const { result } = renderHook(() => useModularUIBasic(), { wrapper });
90
- expect(result.error).toBeInstanceOf(IllegalArgumentException);
91
- });
92
-
93
76
  it("useModularUIBasic with reload", () => {
94
77
  expect.assertions(2);
95
78
 
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
  import { useNotification } from "../useNotification";
5
5
 
6
6
  const mockStore = configureMockStore();
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
  import { usePreference } from "../usePreference";
5
5
 
6
6
  const mockStore = configureMockStore();
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
  import { useProgressIndicator } from "../useProgressIndicator";
5
5
 
6
6
  const mockStore = configureMockStore();
@@ -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
  };
@@ -153,12 +153,13 @@ class Authenticate {
153
153
 
154
154
  /**
155
155
  */
156
- logout(): Promise<void> {
156
+ logout(): Promise<any> {
157
157
  return universalFetch({
158
158
  url: `${BASE}${logoutPath()}`,
159
- }).then(() => {
159
+ }).then((response) => {
160
160
  // clear cache because of cached contributions
161
161
  Cache.clear();
162
+ return response;
162
163
  });
163
164
  }
164
165
  }
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
  import {
5
5
  useLocation,
6
6
  useLocationKey,
@@ -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 };
@@ -1,12 +1,9 @@
1
1
  // @flow
2
- import Cache from "../../utils/browser/Cache";
3
-
4
2
  import type { Reducer } from "redux";
5
3
  import type { AuthState, ReduxAction } from "../types";
6
4
 
7
5
  // REDUCER
8
6
  const initialState: AuthState = {
9
- isAuthenticated: false,
10
7
  mustChangePassword: false,
11
8
  error: null,
12
9
  };
@@ -26,7 +23,6 @@ const AuthReducer: Reducer<AuthState, ReduxAction> = (
26
23
  case "AUTHENTICATION_SUCCESS":
27
24
  return {
28
25
  ...state,
29
- isAuthenticated: true,
30
26
  error: null,
31
27
  mustChangePassword: false,
32
28
  };
@@ -38,15 +34,9 @@ const AuthReducer: Reducer<AuthState, ReduxAction> = (
38
34
  return { ...state, error: null };
39
35
 
40
36
  case "AUTHENTICATION_LOGOUT": {
41
- // clear cache because of cached contributions
42
- if (state.isAuthenticated) {
43
- Cache.clear();
44
- }
45
-
46
37
  return {
47
38
  ...state,
48
39
  mustChangePassword: false,
49
- isAuthenticated: false,
50
40
  error: null,
51
41
  };
52
42
  }
@@ -54,7 +44,6 @@ const AuthReducer: Reducer<AuthState, ReduxAction> = (
54
44
  case "CHANGE_PASSWORD":
55
45
  return {
56
46
  ...state,
57
- isAuthenticated: true,
58
47
  mustChangePassword: true,
59
48
  error: null,
60
49
  };
@@ -3,13 +3,11 @@ import AuthReducer from "../AuthReducer";
3
3
  describe("authentication reducer", () => {
4
4
  it("should return the initial state", () => {
5
5
  expect(AuthReducer(undefined, {})).toStrictEqual({
6
- isAuthenticated: false,
7
6
  mustChangePassword: false,
8
7
  error: null,
9
8
  });
10
9
 
11
10
  expect(AuthReducer()).toStrictEqual({
12
- isAuthenticated: false,
13
11
  mustChangePassword: false,
14
12
  error: null,
15
13
  });
@@ -24,7 +22,6 @@ describe("authentication reducer", () => {
24
22
  }
25
23
  )
26
24
  ).toStrictEqual({
27
- isAuthenticated: true,
28
25
  mustChangePassword: false,
29
26
  error: null,
30
27
  });
@@ -49,7 +46,6 @@ describe("authentication reducer", () => {
49
46
  expect(
50
47
  AuthReducer(
51
48
  {
52
- isAuthenticated: true,
53
49
  mustChangePassword: false,
54
50
  error: null,
55
51
  },
@@ -58,7 +54,6 @@ describe("authentication reducer", () => {
58
54
  }
59
55
  )
60
56
  ).toStrictEqual({
61
- isAuthenticated: false,
62
57
  mustChangePassword: false,
63
58
  error: null,
64
59
  });
@@ -68,7 +63,6 @@ describe("authentication reducer", () => {
68
63
  expect(
69
64
  AuthReducer(
70
65
  {
71
- isAuthenticated: false,
72
66
  mustChangePassword: false,
73
67
  error: "In error",
74
68
  },
@@ -77,7 +71,6 @@ describe("authentication reducer", () => {
77
71
  }
78
72
  )
79
73
  ).toStrictEqual({
80
- isAuthenticated: false,
81
74
  mustChangePassword: false,
82
75
  error: null,
83
76
  });
@@ -87,7 +80,6 @@ describe("authentication reducer", () => {
87
80
  expect(
88
81
  AuthReducer(
89
82
  {
90
- isAuthenticated: true,
91
83
  mustChangePassword: false,
92
84
  error: null,
93
85
  },
@@ -96,7 +88,6 @@ describe("authentication reducer", () => {
96
88
  }
97
89
  )
98
90
  ).toStrictEqual({
99
- isAuthenticated: true,
100
91
  mustChangePassword: true,
101
92
  error: null,
102
93
  });
@@ -168,7 +168,6 @@ export type ReduxAction =
168
168
 
169
169
  // Redux state
170
170
  export type AuthState = {
171
- +isAuthenticated: boolean,
172
171
  +mustChangePassword: boolean,
173
172
  +error: ?string,
174
173
  };
@@ -17,6 +17,8 @@ export const resourceExists = (url: string | Href): boolean => {
17
17
  xhr.open("HEAD", fullUrl, false);
18
18
  xhr.setRequestHeader("Accept", "application/json");
19
19
  xhr.setRequestHeader("Content-Type", "application/json");
20
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
21
+
20
22
  xhr.send();
21
23
 
22
24
  return xhr.status !== 404;
@@ -34,6 +36,7 @@ export const resourceRedirectsToSecureLogin = (url: string | Href): boolean => {
34
36
  xhr.open("HEAD", fullUrl, false);
35
37
  xhr.setRequestHeader("Accept", "application/json");
36
38
  xhr.setRequestHeader("Content-Type", "application/json");
39
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
37
40
  xhr.send();
38
41
 
39
42
  const responseURL = xhr.responseURL ?? "";