@beinformed/ui 1.18.4 → 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.
- package/CHANGELOG.md +9 -0
- package/esm/hooks/useAuthentication.js +7 -50
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +2 -1
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/redux/actions/SignOut.js +6 -2
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/SignIn.js +3 -2
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js +4 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +0 -10
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +15 -1
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js +7 -55
- package/lib/hooks/useAuthentication.js.flow +4 -37
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/usePreference.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js.map +1 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
- package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListHeaderModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +3 -1
- package/lib/modularui/Authenticate.js.flow +3 -2
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/useTheme.js.map +1 -1
- package/lib/react-theme/utils/background.js.map +1 -1
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/actions.js.map +1 -1
- package/lib/redux/_i18n/reducer.js.map +1 -1
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/connector.js.map +1 -1
- package/lib/redux/_modularui/middleware.js.map +1 -1
- package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/_modularui/selectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/connectors.js.map +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js +6 -1
- package/lib/redux/actions/SignOut.js.flow +9 -5
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +3 -5
- package/lib/redux/connectors/SignIn.js.flow +1 -6
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js +5 -1
- package/lib/redux/connectors/SignOut.js.flow +2 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +0 -11
- package/lib/redux/reducers/AuthReducer.js.flow +0 -11
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.flow +0 -1
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +3 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/helpers/text.js.map +1 -1
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +17 -17
- package/src/hooks/__tests__/useAuthentication.spec.js +15 -1
- package/src/hooks/useAuthentication.js +4 -37
- package/src/modularui/Authenticate.js +3 -2
- package/src/redux/actions/SignOut.js +9 -5
- package/src/redux/connectors/SignIn.js +1 -6
- package/src/redux/connectors/SignOut.js +2 -1
- package/src/redux/reducers/AuthReducer.js +0 -11
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
- package/src/redux/types.js +0 -1
- 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,
|
|
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.
|
|
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": "^
|
|
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.
|
|
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,17 +96,17 @@
|
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@babel/cli": "^7.17.10",
|
|
99
|
-
"@babel/core": "^7.
|
|
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.
|
|
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.
|
|
105
|
-
"@babel/preset-env": "^7.
|
|
106
|
-
"@babel/preset-flow": "^7.
|
|
107
|
-
"@babel/preset-react": "^7.
|
|
108
|
-
"@commitlint/cli": "^
|
|
109
|
-
"@commitlint/config-conventional": "^
|
|
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
112
|
"babel-jest": "^28.1.0",
|
|
@@ -119,16 +119,16 @@
|
|
|
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.
|
|
123
|
-
"eslint-plugin-jsdoc": "^39.
|
|
124
|
-
"eslint-plugin-react": "^7.
|
|
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
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.
|
|
129
|
+
"glob": "^8.0.3",
|
|
130
130
|
"history": "^4.0.0",
|
|
131
|
-
"husky": "^
|
|
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",
|
|
@@ -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.
|
|
150
|
+
"standard-version": "^9.5.0",
|
|
151
151
|
"styled-components": "^5.3.5",
|
|
152
152
|
"xhr-mock": "^2.5.1"
|
|
153
153
|
},
|
|
@@ -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:
|
|
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<
|
|
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
|
}
|
|
@@ -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()
|
|
21
|
-
|
|
22
|
-
dispatch(
|
|
23
|
-
|
|
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
|
|
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
|
});
|
package/src/redux/types.js
CHANGED
|
@@ -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 ?? "";
|